:root {
  --primary-color: #1976d2;
  --bg-color-light: #1565c0;
  --bg-color-dark: #0a1929;
  --text-white: #ffffff;
}

/* Basic Resets */
html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  /* Keep fallback styles from influencing the actual app layout.
     The fallback UI is rendered as a fixed overlay (#root-fallback). */
  isolation: isolate;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

#root {
  width: 100%;
  min-height: 100vh;
}

/* Noscript fallback */
.noscript-message {
  padding: 20px;
  text-align: center;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* Tracking pixel (noscript analytics) - keep it out of layout and a11y tree */
.analytics-pixel {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  border: 0;
}

/* Fallback / Splash Screen Styles */
#root-fallback {
  /* Fixed overlay so removing it does not cause layout shifts (CLS). */
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle, var(--bg-color-light) 0%, var(--primary-color) 100%);
}

.fallback-card {
  text-align: center;
  color: var(--text-white);
  max-width: 320px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
}

.fallback-icon {
  font-size: 64px;
  animation: float 3s ease-in-out infinite;
}

.fallback-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fallback-subtitle {
  margin: 0;
  font-size: 16px;
  opacity: 0.9;
}

/* Simple CSS Loader */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  #root-fallback {
    background: var(--bg-color-dark);
  }
}

/* PWA Standalone Adjustments */
@media all and (display-mode: standalone) {
  /* No-op: fallback is an overlay and does not need to affect body styles. */
}
