/*
 * Minimal pre-React normalization. These rules apply only during the brief
 * window between splash removal and CssBaseline mounting (the disconnected /
 * config-loading state, where BackendConnectionCheck short-circuits to Loader
 * before AppThemeProvider mounts).
 *
 * Deliberately NO `body` background-color here — that was the source of the
 * original TEK-4003 bug (splash.css's body bg was later in the cascade than
 * runtime-injected emotion styles, overriding CssBaseline for OS-dark users
 * with a saved light theme). CssBaseline owns body colors once it mounts.
 *
 * The `html` selector below is load-bearing — do NOT change it to `:root`.
 * Reason: splash.css is link-loaded AFTER emotion's runtime-injected styles
 * (prepend: true in emotionCache.ts), so on equal specificity splash.css
 * would win the cascade. We avoid that by using `html` (specificity 0,0,1)
 * while MUI's CssBaseline (with enableColorScheme) targets `:root` (0,1,0).
 * Specificity beats source order, so CssBaseline wins post-mount. Changing
 * the selector here to `:root` would re-introduce a TEK-4003-class bug for
 * native control / scrollbar theming.
 */
body {
  margin: 0;
}

html {
  color-scheme: light dark;
}

#splash {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: 0.01071em;
  color: rgba(0, 0, 0, 0.6);
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0);
  border-radius: 50%;
  border-top-color: #1976d2; /* MUI primary blue color */
  border-right-color: #1976d2; /* MUI primary blue color */
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-color-scheme: dark) {
  #splash {
    background: #18191a;
    color: rgba(255, 255, 255, 0.9);
  }

  .spinner {
    border: 3px solid rgba(255, 255, 255, 0);
    border-top-color: #1c83e9; /* Lighter MUI blue for dark mode */
    border-right-color: #1c83e9; /* Lighter MUI blue for dark mode */
  }
}
