/* Page shell: the canvas, the layer stack, and the boot screen.
   Everything else lives in ui.css, hud.css and touch.css. */

:root {
  color-scheme: dark;

  --ink:        #e9edf2;
  --ink-dim:    #9aa4b0;
  --ink-faint:  #6b7480;
  --bg:         #0b0d10;
  --panel:      rgba(16, 19, 24, 0.78);
  --panel-edge: rgba(255, 255, 255, 0.10);
  --accent:     #ffb020;
  --accent-ink: #1a1200;
  --good:       #4ec9a0;
  --bad:        #e2564d;

  --gap:   clamp(0.75rem, 2vw, 1.5rem);
  --round: 0.7rem;

  /* Notch and home-indicator insets, used by the HUD and touch layers. */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);

  --ui-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --num-font: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui-font);
  /* A driving game is held with both thumbs. Nothing here should ever scroll,
     bounce, zoom, or pop a text-selection handle mid-corner. */
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

/* The overlay stack. Each layer is transparent to the pointer by default; the
   individual controls inside opt back in. Otherwise an invisible full-screen
   div eats every click meant for the game. */
.layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#touch { z-index: 20; }
#menus { z-index: 30; }

/* ---- Boot screen -------------------------------------------------------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% 0%, #182231 0%, #0b0d10 62%);
  transition: opacity 0.6s ease;
}
.boot.is-done { opacity: 0; pointer-events: none; }

.boot__inner { width: min(30rem, 84vw); text-align: center; }

.boot__title {
  margin: 0 0 1.4rem;
  font-size: clamp(2.1rem, 7vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--ink);
}

.boot__bar {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
}
.boot__bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.boot__status {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-faint);
  min-height: 1.2em;
}

.boot__status[data-error] { color: var(--bad); text-transform: none; letter-spacing: 0; }

@media (prefers-reduced-motion: reduce) {
  .boot, .boot__bar i { transition: none; }
}
