/*
 * 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`.
 * The app theme declares `:root { color-scheme }` (0,1,0) and MUST outrank this
 * rule (0,0,1) once React mounts, while this one still governs the pre-mount
 * window, where there is no app theme and the OS preference is the only signal.
 * Raise this selector to `:root` and the two tie, source order decides again,
 * and this is a TEK-4003-class bug for the second time.
 *
 * CssBaseline emits its own `color-scheme` on `html`, not on `:root`; do not
 * write otherwise here. The full argument lives ONCE, beside the code
 * implementing it: `src/features/theme/utils/create-theme.ts`. Do not restate
 * it here — a second copy of it is what went stale last time.
 */
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 */
  }
}
