/* Hand-synced copy of games/shared/theme.css - keep in sync manually */
/* ============================================================
   AutoParty "Night Drive" design system
   Shared stylesheet for all game screens (AAOS WebView, landscape,
   typical width 792-1048 px) and the phone controller.

   Loads from file:// - system fonts only, no webfonts, no assets.

   CLASS CONTRACT (consumed by game screens and the kit JS):

   Tokens (:root)
     --bg, --panel, --panel-border, --text, --text-dim
     --blue, --teal, --amber, --radius
     --player-1 .. --player-6   (stable per-player palette)

   Layout / chrome
     .stage      fixed, inset 0 game container. The only safe
                 full-screen box on AAOS - never size with vh units.
     .glass      frosted panel (blur, subtle border, radius)
     .hud        top overlay bar, flex, glass, above the stage
     .pill       small rounded badge (score, status, player tag)
     .btn-big    chunky controller-grade button (press: scale .96)
     .title-xl   hero title, clamp 48-80px, tight tracking
     .dim        dimmed secondary text
     .ellipsis   single-line truncation

   Kit overlay layers (DOM generated by kit.js)
     .kit-overlay        fixed, centered column, z-index 500, scrim
     .kit-splash         game intro container (title + subtitle)
       .kit-splash-title   hero title text
       .kit-splash-sub     subtitle, uppercase, breathing animation
     .kit-countdown      3-2-1 digit
       .kit-countdown-pop  re-added per tick to replay the pop/fade
     .kit-banner         transient mid-round announcement
       .kit-banner-sub     secondary line under the banner headline
     .kit-podium         end-of-round podium
       .kit-podium-step    one podium column, modified by .place-1/.place-2/.place-3
       .kit-podium-rank    rank label above the name
       .kit-podium-name    player name on the step
       .kit-podium-score   score under the name
     .kit-spectator      spectator scoreboard
       .kit-spectator-title  row-list heading
       .kit-spectator-row    one player row
       .kit-spectator-dot    player color swatch
       .kit-spectator-name   player name, truncates with ellipsis
       .kit-spectator-score  player score, tabular numerals

   Nesting rule: kit sub-containers (.kit-splash, .kit-banner,
   .kit-podium, .kit-spectator) are always children of .kit-overlay -
   the two are nested in the DOM, never co-applied on the same element.

   Player color helpers: .player-1 .. .player-6 set `color` and
   `--pc` so children can glow with currentColor.
   ============================================================ */

:root {
  --bg: #08090E;
  --panel: rgba(12, 16, 24, 0.72);
  --panel-border: rgba(255, 255, 255, 0.06);
  --text: #E8ECF0;
  --text-dim: rgba(255, 255, 255, 0.4);
  --blue: #0A84FF;
  --teal: #00D4AA;
  --amber: #FF6B2C;
  --radius: 16px;

  --player-1: #0A84FF;
  --player-2: #00D4AA;
  --player-3: #FF6B2C;
  --player-4: #FF2D78;
  --player-5: #BF5AF2;
  --player-6: #FFD60A;

  /* Motion defaults - premium, quick, never bouncy by accident */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 150ms;
  --t-med: 250ms;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  width: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto', -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Stage: the AAOS-safe full-screen game container ---- */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 45%, rgba(10, 132, 255, 0.06) 0%, transparent 70%),
    var(--bg);
}

/* ---- Frosted glass panel ---- */
.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ---- HUD: top overlay bar ---- */
.hud {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
}
/* Subtle blue highlight line, generalized from Auto Flap */
.hud::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, rgba(10, 132, 255, 0.3) 50%, transparent 90%);
  pointer-events: none;
}

/* ---- Pill: small rounded badge ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.2;
}

/* ---- Big button: controller-grade tap target ---- */
.btn-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  padding: 16px 52px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, var(--teal) 100%);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(10, 132, 255, 0.3);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-med) var(--ease-out), filter var(--t-fast) var(--ease-out);
  touch-action: manipulation;
}
.btn-big:hover {
  box-shadow: 0 6px 32px rgba(10, 132, 255, 0.45);
  filter: brightness(1.06);
}
.btn-big:active {
  transform: scale(0.96);
  box-shadow: 0 2px 12px rgba(10, 132, 255, 0.25);
  filter: brightness(0.95);
}
.btn-big:disabled {
  opacity: 0.4;
  pointer-events: none;
  box-shadow: none;
}
/* Quiet variant for secondary actions (back, skip) */
.btn-big.ghost {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  box-shadow: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn-big.ghost:hover { background: rgba(255, 255, 255, 0.08); }

/* ---- Hero title ---- */
.title-xl {
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.05;
  background: linear-gradient(135deg, var(--blue) 0%, var(--teal) 50%, var(--amber) 100%);
  background-size: 200% 200%;
  animation: nd-gradient-shift 4s ease-in-out infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 40px rgba(10, 132, 255, 0.3));
}

/* ---- Text utilities ---- */
.dim { color: var(--text-dim); }

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Player color helpers ---- */
.player-1 { color: var(--player-1); --pc: var(--player-1); }
.player-2 { color: var(--player-2); --pc: var(--player-2); }
.player-3 { color: var(--player-3); --pc: var(--player-3); }
.player-4 { color: var(--player-4); --pc: var(--player-4); }
.player-5 { color: var(--player-5); --pc: var(--player-5); }
.player-6 { color: var(--player-6); --pc: var(--player-6); }

/* ============================================================
   Kit overlay layers (DOM built by kit.js)
   ============================================================ */

/* Full-screen centered layer above every game element */
.kit-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(10, 132, 255, 0.12) 0%, transparent 60%),
    rgba(6, 7, 12, 0.92);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  animation: nd-fade-in var(--t-med) var(--ease-out) both;
}
.kit-overlay.transparent {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---- Splash: game intro ---- */
/* Container nested inside .kit-overlay, holds .kit-splash-title
   and .kit-splash-sub - never co-applied with .kit-overlay itself. */
.kit-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.kit-splash .kit-splash-title {
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.05;
  animation: nd-rise 400ms var(--ease-out) 100ms both;
}
.kit-splash .kit-splash-sub {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: nd-breathe 3s ease-in-out infinite;
}

/* ---- Countdown: 3-2-1 digit ---- */
.kit-countdown {
  font-size: clamp(90px, 14vw, 140px);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  pointer-events: none;
  text-shadow: 0 0 60px rgba(10, 132, 255, 0.5), 0 0 120px rgba(10, 132, 255, 0.2);
}
/* Re-add per tick (remove, force reflow, add) */
.kit-countdown-pop {
  animation:
    nd-count-pop 500ms var(--ease-spring) forwards,
    nd-count-fade 300ms ease-in 700ms forwards;
}

/* ---- Banner: transient announcement ---- */
.kit-banner {
  padding: 18px 48px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 40px rgba(10, 132, 255, 0.12);
  font-size: clamp(24px, 3.2vw, 36px);
  font-weight: 800;
  letter-spacing: -0.5px;
  max-width: 80%;
  animation: nd-rise 400ms var(--ease-spring) both;
}
.kit-banner .kit-banner-sub {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---- Podium: end-of-round results ---- */
.kit-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
}
.kit-podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: clamp(120px, 16vw, 180px);
  padding: 16px 12px 14px;
  border-radius: var(--radius) var(--radius) 4px 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, var(--panel) 60%);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: nd-rise 500ms var(--ease-spring) both;
}
.kit-podium-step.place-1 {
  min-height: 190px;
  order: 2;
  border-top: 2px solid var(--player-6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 -8px 40px rgba(255, 214, 10, 0.12);
  animation-delay: 200ms;
}
.kit-podium-step.place-2 {
  min-height: 150px;
  order: 1;
  animation-delay: 100ms;
}
.kit-podium-step.place-3 {
  min-height: 120px;
  order: 3;
  animation-delay: 0ms;
}
.kit-podium-rank {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.kit-podium-step.place-1 .kit-podium-rank { color: var(--player-6); }
.kit-podium-name {
  max-width: 100%;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 0 24px currentColor;
}
.kit-podium-step.place-1 .kit-podium-name { font-size: 26px; }
.kit-podium-score {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
}

/* ---- Spectator scoreboard ---- */
.kit-spectator {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: clamp(320px, 40vw, 520px);
  max-width: 86%;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  text-align: left;
}
.kit-spectator .kit-spectator-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.kit-spectator-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 17px;
  font-weight: 600;
  transition: background var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out);
}
.kit-spectator-row.leader {
  background: rgba(10, 132, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.25);
}
.kit-spectator-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.kit-spectator-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.kit-spectator-score {
  flex: none;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 0 16px rgba(10, 132, 255, 0.35);
}

/* ============================================================
   Keyframes (nd- prefix keeps game-local animations collision-free)
   ============================================================ */

@keyframes nd-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes nd-rise {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes nd-breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}
@keyframes nd-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes nd-count-pop {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.15); opacity: 1; }
  80% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes nd-count-fade {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}
