/* "After Hours": a story theme for Night Heist (games/heist.js → meta.theme).
   While the game runs, the TV and phone set <body data-theme="after-hours">; the lobby and
   podium clear it, so they stay Pop Brutal.

   How a story theme works:
   - The shared Couch Rivals frame (logo, room code, player cards, the phone header and the
     A–D answer buttons) keeps its Pop Brutal look. It reads the --frame-* properties from
     style.css, so a theme only swaps those to make the frame sit well on its background.
   - Everything in between belongs to the story: the background, the text colors, and the
     game's own pieces, which use this theme's --ah-* tokens (see the Night Heist sections
     of tv.css and play.css). */

[data-theme='after-hours'] {
  --ah-bg: #0a0f1f;
  --ah-text: #e9ecf7;
  --ah-muted: #9aa6c9;
  --ah-glass: rgba(16, 22, 44, 0.9); /* panels and speech bubbles */
  --ah-line: #36457a; /* panel borders */
  --ah-ring: #2b3966; /* thin ring around hard shadows, so they read on navy */
  --ah-neon: #3dffb0; /* vault digits, safe lasers */
  --ah-alarm: #ff3b5c; /* alarm, laser beams, timer */
  --ah-blueprint: #1a4b86; /* the floor plan */

  --frame-shadow: #000;
  --frame-ring: 0 0 0 0.12rem var(--ah-ring);
  --frame-text: var(--ah-muted);

  background-color: var(--ah-bg);
  background-image: none;
  color: var(--ah-text);
}

/* A flashlight beam slowly sweeping the room, and faint floor tiles toward the bottom. */
@property --ah-fx {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 50%;
}
[data-theme='after-hours']::before,
[data-theme='after-hours']::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
[data-theme='after-hours']::before {
  background: radial-gradient(ellipse 38vmax 28vmax at var(--ah-fx) 42%, rgba(255, 236, 180, 0.16), rgba(255, 236, 180, 0.05) 55%, transparent 75%);
  animation: ah-sweep 7s ease-in-out infinite alternate;
}
@keyframes ah-sweep {
  from {
    --ah-fx: 32%;
  }
  to {
    --ah-fx: 68%;
  }
}
[data-theme='after-hours']::after {
  opacity: 0.25;
  background:
    linear-gradient(transparent 96%, #23305a 96%) 0 0 / 8vmax 8vmax,
    linear-gradient(90deg, transparent 96%, #23305a 96%) 0 0 / 8vmax 8vmax;
  -webkit-mask-image: linear-gradient(transparent 55%, #000);
  mask-image: linear-gradient(transparent 55%, #000);
}
[data-theme='after-hours'] #app,
[data-theme='after-hours'] #game {
  position: relative;
  z-index: 1;
}

/* The alarm pulses the whole room dark red. */
[data-theme='after-hours']:has(.hx-alarm) {
  animation: ah-redflash 1.2s steps(2) infinite;
}
@keyframes ah-redflash {
  0% {
    background-color: #2a0610;
  }
  100% {
    background-color: var(--ah-bg);
  }
}

/* ---------- Shared pieces on dark (TV) ---------- */
[data-theme='after-hours'] .logo {
  box-shadow: 0 0 0 0.12rem var(--ah-ring);
}
[data-theme='after-hours'] .big-title {
  color: #fff;
  text-shadow:
    0.4rem 0.4rem 0 #000,
    0 0 3rem rgba(255, 210, 63, 0.35);
}
[data-theme='after-hours'] .q-text {
  color: #fff;
  text-shadow: 0 0.2rem 1.6rem rgba(0, 0, 0, 0.7);
}
[data-theme='after-hours'] .category {
  box-shadow: 0.35rem 0.35rem 0 #000, 0 0 0 0.12rem var(--ah-ring);
}
/* Answer cards keep their colors, with a black shadow and a glow in their own color. */
[data-theme='after-hours'] .choice {
  box-shadow:
    var(--sh) var(--sh) 0 #000,
    0 0 2rem color-mix(in srgb, var(--c) 35%, transparent);
}
[data-theme='after-hours'] .choice.wrong {
  box-shadow: 0.2rem 0.2rem 0 #000;
}
[data-theme='after-hours'] .choice.right {
  box-shadow:
    1.1rem 1.1rem 0 #000,
    0 0 3rem color-mix(in srgb, var(--c) 60%, transparent);
}
/* Timer: a dark ring with a red progress arc. Same markup and countdown as everywhere else. */
[data-theme='after-hours'] .timer {
  background: #0d1428;
  border: 0;
  border-radius: 50%;
  padding: 0.3rem;
  box-shadow: 0 0 1.6rem rgba(255, 59, 92, 0.4);
}
[data-theme='after-hours'] .timer .track {
  stroke: #26355f;
}
[data-theme='after-hours'] .timer .bar {
  stroke: var(--ah-alarm);
  filter: drop-shadow(0 0 0.3rem var(--ah-alarm));
}
[data-theme='after-hours'] .timer span {
  color: #fff;
}
[data-theme='after-hours'] .timer.low {
  background: #2a0610;
}

/* ---------- Phone ---------- */
[data-theme='after-hours'] #me .leave-btn {
  box-shadow: 3px 3px 0 #000, 0 0 0 2px var(--ah-ring);
}
[data-theme='after-hours'] #screen h2 {
  color: #fff;
}
[data-theme='after-hours'] #screen p {
  color: var(--ah-muted);
}
[data-theme='after-hours'] #screen p b {
  color: var(--ah-text);
}
[data-theme='after-hours'] .big-icon {
  color: var(--accent);
  background: var(--ah-glass);
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(255, 210, 63, 0.3);
}
[data-theme='after-hours'] .result-good h2 {
  color: var(--ah-neon);
}
[data-theme='after-hours'] .result-bad h2 {
  color: var(--ah-alarm);
}
[data-theme='after-hours'] .result-good .big-icon {
  color: var(--ah-neon);
  background: var(--ah-glass);
  border-color: var(--ah-neon);
  box-shadow: 0 0 24px rgba(61, 255, 176, 0.35);
}
[data-theme='after-hours'] .result-bad .big-icon {
  color: var(--ah-alarm);
  background: var(--ah-glass);
  border-color: var(--ah-alarm);
  box-shadow: 0 0 24px rgba(255, 59, 92, 0.4);
}
[data-theme='after-hours'] .gain-big,
[data-theme='after-hours'] .my-lie {
  color: var(--ink);
}
[data-theme='after-hours'] .answers button,
[data-theme='after-hours'] .gain-big,
[data-theme='after-hours'] .my-lie,
[data-theme='after-hours'] .locked {
  box-shadow: 4px 4px 0 #000, 0 0 0 2px var(--ah-ring);
}
[data-theme='after-hours'] .locked-art {
  box-shadow: 8px 8px 0 #000, 0 0 0 2px var(--ah-ring);
}
[data-theme='after-hours'] .guess-form input {
  box-shadow: 4px 4px 0 #000, 0 0 0 2px var(--ah-ring);
}
[data-theme='after-hours'] .guess-form button {
  box-shadow: 4px 4px 0 #000, 0 0 0 2px var(--ah-ring);
}

@media (prefers-reduced-motion: reduce) {
  [data-theme='after-hours']::before,
  [data-theme='after-hours']:has(.hx-alarm) {
    animation: none !important;
  }
}
