/* ============================================================
   SFRS Dispatch Control — styles
   Orange and black control-room look. The page is locked to
   one screen so players can tap any neighbourhood without scrolling.
   ============================================================ */

/* Shared colours and fonts used throughout the page */
:root {
  --bg: #050505;
  --bg-raised: #0a0a0a;
  --bg-card: #111111;
  --border: #2a1a0a;
  --text: #f5f5f5;
  --muted: #c4b5a5;
  --red: #ea580c;
  --red-deep: #7c2d12;
  --orange: #f97316;
  --amber: #fb923c;
  --green: #f97316;
  --green-deep: #431407;
  --hud-glow: rgba(249, 115, 22, 0.28);
  --radius: 10px;
  --font: "Exo", sans-serif;
}

/* Include padding/border inside width calculations */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Fill the window and block page scrolling */
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  touch-action: manipulation; /* Faster taps; reduces double-tap zoom */
  -webkit-tap-highlight-color: rgba(249, 115, 22, 0.28);
}

body {
  font-family: var(--font);
  font-weight: 400;
  background: #3d3834;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
}

/* ---------- Control room photo background (decorative, not interactive) ---------- */

.control-room {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-color: #2a2622;
  background-image: url("assets/control-room-bg.png");
  background-position: center 50%;
  background-size: 118%;
  background-repeat: no-repeat;
}

.room-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 75% 70% at 50% 48%, transparent 40%, rgba(0, 0, 0, 0.28) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, transparent 35%, rgba(0, 0, 0, 0.12) 100%);
}

/* ---------- Dispatch monitor (interactive screen only) ---------- */

.workstation {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.monitor-rig {
  position: absolute;
  left: 50%;
  bottom: 12vh;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(1020px, 88vw);
  transform: translateX(-50%);
  pointer-events: none;
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.55));
}

.monitor-rig::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -4px;
  height: 22px;
  background: radial-gradient(ellipse, rgba(249, 115, 22, 0.18), transparent 72%);
  pointer-events: none;
}

.monitor-bezel {
  position: relative;
  width: 100%;
  padding: 14px 16px 28px;
  background: linear-gradient(180deg, #3f3f3f 0%, #262626 40%, #1a1a1a 100%);
  border: 2px solid #555555;
  border-radius: 14px 14px 8px 8px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.14),
    inset 0 -3px 6px rgba(0, 0, 0, 0.4),
    0 10px 28px rgba(0, 0, 0, 0.45);
}

.monitor-bezel::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ea580c;
  box-shadow: 0 0 8px rgba(234, 88, 12, 0.7);
  transform: translateX(-50%);
  z-index: 1;
}

.monitor-brand {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #78716c;
  text-transform: uppercase;
}

.monitor-screen {
  --content-scale: 0.72;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  height: auto;
  max-height: min(64vh, calc((min(1020px, 88vw) - 32px) * 0.625));
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  pointer-events: auto;
  background: var(--bg);
  border: 2px solid #0a0a0a;
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px #222222,
    inset 0 0 28px rgba(249, 115, 22, 0.1);
}

/* Zoom the whole game out so HUD, grid, footer and pop-ups all fit */
.monitor-screen .app,
.monitor-screen .modal {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% / var(--content-scale));
  height: calc(100% / var(--content-scale));
  transform: scale(var(--content-scale));
  transform-origin: top left;
}

.monitor-screen .app {
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 6px 8px 8px;
  gap: 4px;
  overflow: hidden;
}

.monitor-screen .modal {
  z-index: 80;
}

.monitor-screen .modal-panel {
  max-height: 100%;
  overflow: hidden;
}

.monitor-stand {
  width: clamp(64px, 9vw, 88px);
  height: clamp(22px, 3.2vh, 30px);
  margin-top: -1px;
  background: linear-gradient(180deg, #3a3a3a, #1f1f1f);
  clip-path: polygon(22% 0, 78% 0, 100% 100%, 0 100%);
}

.monitor-stand::after {
  content: "";
  display: block;
  width: clamp(140px, 20vw, 190px);
  height: 8px;
  margin: 0 auto;
  background: linear-gradient(180deg, #333333, #1a1a1a);
  border-radius: 0 0 4px 4px;
  transform: translateY(5px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* Headings and neighbourhood names use Exo Bold */
h1,
h2,
h3,
.card-name {
  font-family: var(--font);
  font-weight: 700;
}

/* Faint horizontal lines over the whole screen (does not block clicks) */
.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 3px
  );
  opacity: 0.35;
}

/* Main column: HUD on top, grid grows to fill leftover space */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 6px 8px 8px;
  gap: 4px;
  overflow: hidden;
}

/* ---------- HUD / top bar ---------- */

.hud {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: stretch;
  gap: 6px;
  padding: 6px 12px 8px;
  background: linear-gradient(180deg, #141414 0%, var(--bg-raised) 100%);
  border: 1px solid #3d2208;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.18), 0 12px 40px rgba(0, 0, 0, 0.55);
}

.hud-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.hud h1 {
  margin: 0;
  width: 100%;
  font-size: clamp(0.72rem, 1.7vw, 1.08rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--orange);
}

.hud-stamp {
  flex-shrink: 0;
  font-family: var(--font);
  font-size: clamp(0.72rem, 1.4vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--orange);
}

.hud-meta {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0;
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 14px;
  color: #9a3412;
}

.hud-live {
  color: var(--orange);
}

.hud-live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange);
}

.hud-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.stat-block {
  min-width: 0;
  padding: 4px 10px;
  background: #000000;
  border: 1px solid #3d2208;
  border-radius: 8px;
}

.stat-label {
  display: block;
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 2px;
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff7ed;
}

.stat-denom {
  color: var(--muted);
  font-size: 1.05rem;
}

.stat-engines .stat-value {
  color: var(--green);
}

.stat-engines.is-low .stat-value {
  color: var(--orange);
}

.stat-engines.is-empty .stat-value {
  color: var(--red);
}

.stat-shift .stat-value {
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

/* Last 20 seconds of the shift */
.stat-shift.is-critical .stat-value {
  color: var(--red);
  animation: timer-pulse 1s ease-in-out infinite;
}

/* Failure banner sits on the monitor chin / bottom edge — not over the boxes */
.alert-banner {
  display: none;
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  top: auto;
  z-index: 5;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 9px 14px;
  font-family: var(--font);
  font-size: clamp(0.78rem, 1.7vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(90deg, #7c2d12, #f97316 40%, #7c2d12);
  border: 1px solid #fdba74;
  border-radius: 5px;
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.45);
  pointer-events: none;
}

.alert-banner.is-visible {
  display: flex;
  animation: banner-flash 0.35s ease-in-out 3;
}

/* ---------- Neighbourhood grid (always 5 x 5) ---------- */

.grid {
  display: grid;
  flex: 1 1 auto;
  min-height: 0; /* Lets the grid shrink instead of overflowing */
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

/* Each card is a real <button> so mouse and touch both work */
.card {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  padding: 6px 8px;
  font: inherit;
  text-align: left;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(249, 115, 22, 0.35);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Tiny engine that flies from the HUD to a card */
.engine-flyer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 70;
  width: 36px;
  height: 18px;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
}

.engine-flyer.is-moving {
  transition: transform 0.65s cubic-bezier(0.22, 0.82, 0.28, 1);
}

.engine-svg {
  display: block;
  width: 36px;
  height: 18px;
}

/* Parked engine in the corner of a card after it arrives */
.engine-dock {
  display: none;
  position: absolute;
  right: 3px;
  top: 4px;
  width: 36px;
  height: 18px;
  z-index: 2;
}

.engine-dock .engine-svg {
  width: 36px;
  height: 18px;
}

.card.has-engine .engine-dock {
  display: block;
}

.hose-dock {
  display: none;
  position: absolute;
  right: 4px;
  top: 24px;
  width: 16px;
  height: 22px;
  z-index: 2;
}

.hose-svg {
  display: block;
  width: 16px;
  height: 22px;
}

.card.has-engine[data-state="blazing"] .hose-dock {
  display: block;
}

.water-spray {
  position: absolute;
  left: 2px;
  top: 19px;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.water-drop {
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #7dd3fc;
  box-shadow: 0 0 4px #38bdf8;
  animation: water-jet 0.4s ease-out forwards;
}

@keyframes water-jet {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.4);
  }
}

/* Clicks hit the whole card, not the inner labels */
.card > * {
  pointer-events: none;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 40%);
}

.card-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding-right: 20px;
  flex-shrink: 0;
}

.card-name {
  font-family: var(--font);
  font-size: clamp(0.58rem, 1.2vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

.card-badge {
  flex-shrink: 0;
  padding: 1px 5px;
  font-family: var(--font);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  background: #000000;
  border: 1px solid var(--border);
  color: var(--muted);
}

.card-status {
  margin: 4px 0 0;
  font-size: clamp(0.62rem, 1.1vw, 0.78rem);
  color: var(--muted);
  white-space: nowrap;
}

.card[data-state="transit"] .card-status {
  color: var(--orange);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.card-hint {
  margin: 2px 0 0;
  font-family: var(--font);
  font-size: clamp(0.55rem, 0.95vw, 0.68rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fed7aa;
}

.card[data-state="transit"] .card-hint {
  display: none;
}

/* Countdown bar used only while a unit is on route */
.progress-track {
  display: none;
  height: 4px;
  margin-top: auto;
  overflow: hidden;
  background: #000000;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f59e0b, #f97316);
  transform-origin: left center;
}

/* Three ticks that fill as the player taps a blazing fire */
.tap-meter {
  display: none;
  gap: 4px;
}

.card[data-state="blazing"] .tap-meter {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.tap-pip {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #431407;
  border: 1px solid #9a3412;
}

.tap-pip.is-lit {
  background: #38bdf8;
  border-color: #7dd3fc;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.85);
}

/* State 1 — calm / secured */
.card[data-state="clear"] {
  background: #0a0a0a;
}

.card[data-state="clear"] .card-badge {
  color: #fdba74;
  border-color: #9a3412;
  background: #1a0a00;
}

/* State 2 — flashing alert, waiting for a dispatch tap */
.card[data-state="siren"] {
  cursor: pointer;
  border-color: var(--red);
  animation: siren-pulse 0.55s ease-in-out infinite;
}

.card[data-state="siren"] .card-badge {
  color: #000000;
  background: var(--orange);
  border-color: #fdba74;
}

.card[data-state="siren"] .card-hint {
  color: #fed7aa;
}

.card[data-state="siren"]:hover,
.card[data-state="siren"]:focus-visible {
  outline: 2px solid #fdba74;
}

/* State 3 — engine travelling, 5 second countdown */
.card[data-state="transit"] {
  background: linear-gradient(180deg, #3b250c 0%, #1c140c 100%);
  border-color: var(--orange);
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.25);
}

.card[data-state="transit"] .card-badge {
  color: #000000;
  background: var(--amber);
  border-color: #fde68a;
}

.card[data-state="transit"] .progress-track {
  display: block;
}

.card[data-state="transit"] .progress-fill {
  animation: eta-drain 5s linear forwards;
}

/* State 4 — fire on scene, needs three taps */
.card[data-state="blazing"] {
  cursor: pointer;
  border-color: #fb923c;
  background:
    radial-gradient(circle at 20% 80%, rgba(234, 88, 12, 0.55), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(249, 115, 22, 0.5), transparent 42%),
    linear-gradient(180deg, #7c2d12 0%, #000000 100%);
  animation: fire-flicker 0.35s ease-in-out infinite alternate;
}

.card[data-state="blazing"] .card-badge {
  color: #000000;
  background: #fdba74;
  border-color: #fff7ed;
}

.card[data-state="blazing"] .card-hint {
  display: none;
}

.card[data-state="blazing"]:hover,
.card[data-state="blazing"]:focus-visible {
  outline: 2px solid #fdba74;
}

.extinguish-stack {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  align-items: stretch;
  gap: 2px;
  margin-top: auto;
  padding-top: 2px;
}

.card[data-state="blazing"] .extinguish-stack {
  display: flex;
}

.flames {
  display: none;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
  align-items: end;
  justify-items: center;
  min-height: 1.35em;
  line-height: 1;
  flex-shrink: 0;
}

.flame-icon {
  display: block;
  text-align: center;
  font-size: clamp(0.95rem, 2.2vw, 1.35rem);
  transform-origin: 50% 100%;
  animation: fire-dance 0.42s ease-in-out infinite alternate;
}

.flame-icon:nth-child(1) {
  animation-duration: 0.38s;
  animation-delay: 0s;
}

.flame-icon:nth-child(2) {
  animation-duration: 0.5s;
  animation-delay: 0.1s;
  font-size: clamp(1.05rem, 2.5vw, 1.5rem);
}

.flame-icon:nth-child(3) {
  animation-duration: 0.34s;
  animation-delay: 0.18s;
}

@keyframes fire-dance {
  0% {
    transform: translateY(2px) scaleX(0.88) scaleY(1.12) rotate(-8deg);
    filter: hue-rotate(-8deg) brightness(0.95);
  }
  50% {
    transform: translateY(-3px) scaleX(1.12) scaleY(0.9) rotate(5deg);
    filter: hue-rotate(8deg) brightness(1.15);
  }
  100% {
    transform: translateY(1px) scaleX(0.94) scaleY(1.18) rotate(9deg);
    filter: hue-rotate(-4deg) brightness(1.05);
  }
}

/* Dim a flame after a water tap */
.flame-icon.is-out {
  opacity: 0.18;
  filter: grayscale(1);
  animation: none;
  transform: scale(0.7);
}

.card[data-state="blazing"] .flames {
  display: grid;
}

/* Guided tour: dim every card except the example */
.monitor-screen.is-tutorial .card:not(.is-tour-target) {
  opacity: 0.22;
  filter: grayscale(0.35);
  pointer-events: none;
}

.card.is-tour-target {
  z-index: 5;
  box-shadow: 0 0 0 2px #fdba74, 0 0 22px rgba(249, 115, 22, 0.55);
}

/* Rounded prompt above the example card during the demo */
.tour-tip {
  position: absolute;
  z-index: 75;
  width: max-content;
  max-width: min(280px, calc(100% - 24px));
  padding: 10px 14px;
  background: #f97316;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, calc(-100% - 16px));
  pointer-events: none;
  text-align: center;
  font-family: var(--font);
}

.tour-tip p {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  color: #000000;
}

.tour-arrow {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 0;
  height: 0;
  background: transparent;
  border: 8px solid transparent;
  border-top-color: #f97316;
  transform: translateX(-50%) rotate(0);
}

.tour-pulse {
  position: absolute;
  left: 50%;
  bottom: -26px;
  width: 14px;
  height: 14px;
  border: 2px solid #f97316;
  border-radius: 50%;
  transform: translateX(-50%);
  animation: tour-pulse 1.15s ease-out infinite;
}

@keyframes tour-pulse {
  0% {
    opacity: 0.95;
    transform: translateX(-50%) scale(0.45);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(2.6);
  }
}

.hud-footer {
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 0 4px;
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a3412;
}

/* ---------- Pop-ups (intro + end of shift) ---------- */

.modal {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.72);
}

.modal.is-open {
  display: flex;
}

.modal-panel {
  width: min(520px, 100%);
  max-height: 100%;
  overflow: hidden;
  padding: 14px 16px 12px;
  background: #0a0a0a;
  border: 1px solid var(--orange);
  border-radius: 22px;
  box-shadow:
    0 0 0 1px rgba(249, 115, 22, 0.18),
    0 0 40px rgba(249, 115, 22, 0.18),
    0 24px 60px rgba(0, 0, 0, 0.7);
  color: var(--text);
  text-align: center;
}

.modal-kicker {
  margin: 0 0 6px;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange);
}

.modal-kicker--glow {
  font-size: 12px;
  font-weight: 700;
  text-shadow:
    0 0 6px rgba(249, 115, 22, 0.95),
    0 0 14px rgba(249, 115, 22, 0.7),
    0 0 28px rgba(249, 115, 22, 0.45);
}

.modal-panel h2 {
  margin: 0 0 10px;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: #fff7ed;
  text-transform: none;
}

.modal-panel--intro {
  width: min(580px, 100%);
  animation: intro-pop 0.28s ease-out;
}

.modal-panel--intro .modal-kicker {
  font-size: 14px;
}

.modal-panel--intro h2 {
  font-size: 2rem;
  margin-bottom: 12px;
}

.modal-panel--intro .modal-lead {
  font-size: 1.22rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-panel--intro .brief-steps strong {
  font-size: 1.18rem;
}

.modal-panel--intro .brief-steps li > span {
  font-size: 1.1rem;
  line-height: 1.45;
}

.modal-panel--intro .brief-note {
  font-size: 1.15rem;
  line-height: 1.5;
}

.modal-panel--intro .modal-message {
  font-size: 1.18rem;
  line-height: 1.5;
}

.modal-lead {
  margin: 0 auto 18px;
  max-width: 36em;
  color: var(--muted);
  line-height: 1.55;
}

.brief-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  border: 0;
}

.brief-steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  line-height: 1.4;
}

.brief-pic {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  background: #111111;
  border: 1px solid #3d2208;
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.2);
}

.brief-pic--choice,
.brief-pic--end {
  margin-bottom: 12px;
}

.brief-mini-card {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #1a0a00;
  animation: siren-pulse 0.85s ease-in-out infinite;
}

.brief-engine {
  width: 48px;
  height: 24px;
  display: block;
  flex-shrink: 0;
  transform: none;
}

.brief-pic--choice {
  display: grid;
  place-items: center;
  overflow: hidden;
}

.brief-pic--choice .brief-engine {
  width: 44px;
  height: 22px;
  margin: 0 auto;
  transform: none;
}

.brief-pic--blaze {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  padding: 8px;
  box-sizing: border-box;
}

.brief-pic--blaze .flame-icon {
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  animation: none;
  transform: none;
  filter: none;
}

.brief-pic--blaze .flame-icon:nth-child(2) {
  font-size: 1.05rem;
}

.brief-steps strong {
  display: block;
  margin: 0 0 4px;
  color: var(--orange);
  font-weight: 700;
}

.brief-steps li > span {
  color: var(--muted);
  font-size: 0.82rem;
}

.brief-note {
  margin: 0 auto 12px;
  max-width: 36em;
  color: var(--muted);
  line-height: 1.5;
}

@keyframes intro-pop {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.summary-stats {
  display: flex;
  justify-content: space-around;
  gap: 12px;
  margin: 0 0 16px;
  background: transparent;
  border: 0;
}

.summary-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  background: transparent;
  border: 0;
}

.summary-stats dt {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
}

.summary-stats dd {
  margin: 0;
  font-family: var(--font);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--orange);
}

.modal-message {
  margin: 0 auto 16px;
  max-width: 36em;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--orange);
  font-size: 0.92rem;
  line-height: 1.55;
  font-style: italic;
  quotes: none;
}

.modal-message::before,
.modal-message::after {
  content: none;
}

.btn-restart {
  width: 100%;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000000;
  background: var(--orange);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(249, 115, 22, 0.35);
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.35);
}

.btn-restart:hover,
.btn-restart:focus-visible {
  filter: brightness(1.06);
}

.btn-restart:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}

.btn-secondary {
  width: 100%;
  padding: 12px 18px;
  border: 1px solid var(--orange);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange);
  background: #000000;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: #1a0a00;
  color: #fdba74;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-panel--choice {
  width: min(440px, 100%);
  padding-top: 10px;
}

.modal-panel--choice .brief-pic--choice {
  margin-bottom: 4px;
}

.modal-panel--choice .modal-kicker {
  margin-bottom: 2px;
}

.modal-panel--choice h2 {
  margin-bottom: 6px;
}

.modal-panel--choice .modal-lead {
  margin-bottom: 12px;
}

@media (max-width: 560px) {
  .btn-row,
  .brief-steps {
    grid-template-columns: 1fr;
  }

  .brief-steps {
    gap: 14px;
  }
}

/* ---------- Animations ---------- */

@keyframes siren-pulse {
  0%,
  100% {
    background: #1a0a00;
    box-shadow: 0 0 0 1px #f97316, 0 0 12px rgba(249, 115, 22, 0.35);
  }
  50% {
    background: #ea580c;
    box-shadow: 0 0 0 1px #fdba74, 0 0 28px rgba(249, 115, 22, 0.85);
  }
}

@keyframes fire-flicker {
  0% {
    filter: brightness(0.92) saturate(1.05);
  }
  100% {
    filter: brightness(1.18) saturate(1.2);
  }
}

@keyframes banner-flash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes timer-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* Shrinks the ETA bar from full to empty over 5 seconds */
@keyframes eta-drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* ---------- Responsive tweaks (grid stays 5 x 5) ---------- */

@media (max-width: 900px) {
  .control-room {
    background-size: 142%;
    background-position: center 50%;
  }

  .monitor-rig {
    width: min(880px, 94vw);
    bottom: 10vh;
  }

  .monitor-screen {
    max-height: min(58vh, calc((94vw - 32px) * 0.625));
  }

  .hud-bottom {
    flex-wrap: wrap;
    gap: 6px;
  }

  #hud-date {
    order: 1;
  }

  #hud-clock {
    order: 2;
    margin-left: auto;
  }

  .hud-meta {
    order: 3;
    flex-basis: 100%;
  }

  .hud-stats {
    order: 4;
    width: 100%;
  }

  .stat-block {
    flex: 1;
    min-width: 0;
  }
}

/* Hide extra labels on short screens so cards stay tappable */
@media (max-height: 760px) {
  .control-room {
    background-size: 128%;
    background-position: center 48%;
  }

  .monitor-rig {
    width: min(920px, 92vw);
    bottom: 8vh;
  }

  .monitor-screen {
    max-height: min(60vh, calc((92vw - 32px) * 0.625));
  }

  .brief-steps {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .brief-steps li {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 10px;
  }

  .brief-pic {
    margin: 0;
    flex-shrink: 0;
  }

  .modal-panel {
    padding: 10px 12px;
  }

  .modal-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }

  .modal-panel--intro h2 {
    font-size: 1.7rem;
  }

  .modal-lead,
  .brief-note {
    margin-bottom: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .modal-panel--intro .modal-lead,
  .modal-panel--intro .brief-note,
  .modal-panel--intro .modal-message {
    font-size: 1.1rem;
    line-height: 1.45;
  }

  .modal-panel--intro .brief-steps strong {
    font-size: 1.12rem;
  }

  .modal-panel--intro .brief-steps li > span {
    font-size: 1.02rem;
  }

  .brief-pic {
    width: 52px;
    height: 52px;
    margin-bottom: 6px;
  }

  .brief-pic--blaze {
    padding: 4px;
  }

  .brief-pic--blaze .flame-icon {
    font-size: 0.72rem;
  }

  .brief-pic--blaze .flame-icon:nth-child(2) {
    font-size: 0.8rem;
  }

  .brief-steps {
    gap: 8px;
    margin-bottom: 8px;
  }

  .hud-meta,
  .hud-footer {
    display: none;
  }
}

@media (max-height: 640px) {
  .card-hint {
    display: none !important;
  }
}

/* Respect users who asked the OS to reduce motion */
@media (prefers-reduced-motion: reduce) {
  .card,
  .alert-banner,
  .progress-fill,
  .stat-shift.is-critical,
  .modal-panel--intro {
    animation: none !important;
  }

  .tour-pulse {
    animation: none !important;
  }

  .flame-icon {
    animation: none !important;
  }

  .engine-flyer,
  .engine-flyer.is-moving {
    transition: none !important;
  }
}
