/* ==========================================================================
   EVADER: THE CASH HEIST
   Look: a heist planned on a vault blueprint. Deep teal-black floor,
   jumpsuit red as the one loud colour, heavy condensed type.
   ========================================================================== */

:root {
  --ink: #051317;
  --vault: #0a2329;
  --steel: #16363d;
  --line: rgba(239, 233, 220, 0.14);
  --line-strong: rgba(239, 233, 220, 0.32);
  --paper: #efe9dc;
  --muted: #9db3b5;
  --red: #d8231b;
  --red-hot: #ff4136;
  --gold: #e6c25a;
  --cop: #6fb8d9;

  --font-display: "Anton", "Big Shoulders Display", Impact, "Arial Narrow", sans-serif;
  --font-body: "Special Elite", "Courier New", ui-monospace, monospace;

  --pad-x: clamp(1rem, 4vw, 3rem);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

/* Screens toggle with the `hidden` attribute; make sure no display rule beats it. */
[hidden] { display: none !important; }

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

h1 span, h2 span { color: var(--red); }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.sr-only,
.screen-reader-status {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Shared pieces ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-sizing: border-box;
  width: 15rem;
  max-width: 100%;
  min-height: 3.4rem;
  padding: 0.7rem 1rem;
  border: 2px solid transparent;
  background: transparent;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.button-play { background: var(--red); border-color: var(--red); color: #fff; }
.button-play:hover:not(:disabled) { background: var(--red-hot); border-color: var(--red-hot); }
.button-about { border-color: var(--line-strong); color: var(--paper); }
.button-about:hover:not(:disabled) { border-color: var(--paper); background: rgba(239, 233, 220, 0.08); }
.button:disabled { opacity: 0.4; cursor: not-allowed; }
.button-arrow { display: inline-block; transition: transform 0.2s var(--ease); }
.button:hover:not(:disabled) .button-arrow { transform: translate(3px, -3px); }

.wordmark { display: inline-flex; color: var(--paper); text-decoration: none; }
.wordmark-mark {
  display: inline-block;
  padding: 0.1rem 0.55rem 0.15rem;
  border: 2px solid var(--red);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
}
.nx-x { margin-left: 0.04em; color: var(--red); font-size: 0.7em; }

/* Landing-page-only logo: glowing red N with a struck-through x */
.wordmark-hero .wordmark-mark {
  position: relative;
  padding: 0;
  border: 0;
  color: #d8231b;
  font-size: 3.2rem;
  letter-spacing: 0.02em;
  text-shadow: 0 0 14px rgba(216, 35, 27, 0.55), 0 2px 0 #7a0f0b;
}
.wordmark-hero .nx-x {
  position: relative;
  display: inline-block;
  margin-left: 0.06em;
  color: #ff4b44;
  font-size: 0.75em;
}
.wordmark-hero .nx-x::after {
  content: "";
  position: absolute;
  left: -0.15em; right: -0.15em; top: 50%;
  height: 0.09em;
  background: #ff4b44;
  transform: rotate(-35deg);
  box-shadow: 0 0 8px rgba(255, 75, 68, 0.7);
}

.topbar, .crew-topbar, .lobby-topbar, .game-topbar, .play-topbar, .victory-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--pad-x);
}

.back-link {
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.back-link:hover { color: var(--paper); }

.operation-label {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.operation-label i { margin: 0 0.35em; color: var(--red); font-style: normal; }

.panel-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.panel-kicker span { width: 2.2rem; height: 3px; background: var(--red); }

.mission-rule { width: 3.2rem; height: 3px; margin: 1.5rem 0; background: var(--red); }

.objective-copy { max-width: 46ch; color: var(--muted); }

/* Blueprint paper used behind the planning screens */
.lobby-screen,
.play-screen {
  background-color: var(--ink);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
}
.lobby-screen { min-height: 100svh; }

/* ---------- Landing ---------- */
.landing {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
.backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--ink) url("assets/page1.png") center 28% / cover no-repeat;
}
.shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(5, 19, 23, 0.92) 0%, rgba(5, 19, 23, 0.55) 45%, rgba(5, 19, 23, 0.15) 100%),
    linear-gradient(0deg, rgba(5, 19, 23, 0.95) 0%, transparent 40%);
}

.sound-toggle {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1000;
  display: grid;
  place-items: center;
  width: 2.8rem; height: 2.8rem;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(5, 19, 23, 0.5);
  color: var(--paper);
  transition: border-color 0.2s;
}
.sound-toggle:hover { border-color: var(--paper); }
.sound-icon { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-on { display: none; }
html[data-sound="on"] .sound-on { display: block; }
html[data-sound="on"] .sound-off { display: none; }
html[data-sound="on"] .sound-toggle { border-color: var(--red); color: var(--red-hot); }

.hero {
  align-self: end;
  padding: 2rem var(--pad-x) 1.5rem;
}
.hero h1 {
  font-size: clamp(3.6rem, 12.5vw, 10.5rem);
  line-height: 0.84;
  font-weight: 900;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}
.hero h1 span { display: block; }

.main-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }

.edition {
  margin-top: 1.5rem;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.bottom-mark {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem var(--pad-x) 1.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.22em;
}
.bottom-mark span { flex: 1; height: 1px; background: var(--line); }

/* The one orchestrated moment: the title and menu rise in on load. */
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.hero h1, .main-actions, .edition { animation: rise 0.8s var(--ease) both; }
.main-actions { animation-delay: 0.18s; }
.edition { animation-delay: 0.32s; }

/* ---------- Choose your side ---------- */
.crew-screen {
  min-height: 100svh;
  background: var(--ink) url("assets/money-heist-crew.jpg") center top / cover no-repeat;
}
.crew-panel {
  display: flex;
  flex-direction: column;
  width: min(34rem, 100%);
  min-height: 100svh;
  background: transparent;
  border-right: 3px solid var(--red);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}
.crew-topbar { padding-bottom: 0; }
.crew-content { flex: 1; padding: 2rem var(--pad-x) 3rem; }
.crew-content h2 { font-size: clamp(3rem, 8vw, 4.8rem); margin-bottom: 2rem; }

.choice-group { min-width: 0; margin: 0 0 1.75rem; padding: 0; border: 0; }
.choice-group legend {
  padding: 0;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.choice-grid, .mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }

.choice-card, .mode-card {
  border: 2px solid var(--line-strong);
  background: rgba(10, 35, 41, 0.7);
  color: var(--paper);
  text-align: left;
  transition: border-color 0.2s, background-color 0.2s;
}
.choice-card { display: grid; gap: 0.9rem; padding: 1.3rem 1.2rem; }
.choice-icon { color: var(--red); font-size: 2rem; line-height: 1; }
.choice-title, .mode-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.mode-card { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 1rem 1.1rem; }
.mode-title { font-size: 1.2rem; }
.mode-arrow { color: var(--muted); }

.choice-card:hover, .mode-card:hover { border-color: var(--paper); }
.choice-card[aria-pressed="true"], .mode-card[aria-pressed="true"] {
  border-color: var(--red);
  background: rgba(216, 35, 27, 0.2);
  box-shadow: inset 0 0 0 1px var(--red);
}
.mode-card[aria-pressed="true"] .mode-arrow { color: var(--red-hot); }

.crew-actions { margin-top: 2.25rem; }
.continue-button { width: 100%; }
.crew-status { min-height: 1.5em; margin-top: 1rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- Lobby ---------- */
.lobby-content { width: min(60rem, 100%); margin: 0 auto; padding: 1.5rem var(--pad-x) 4rem; }
.lobby-content h1 { margin-bottom: 2rem; font-size: clamp(3rem, 9vw, 6rem); }

.room-roster {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem 2rem;
  margin-bottom: 2rem;
  padding: 1.25rem 0;
  border-block: 1px solid var(--line-strong);
}
.room-size-label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.room-size-select {
  appearance: none;
  min-width: 6.5rem;
  padding: 0.55rem 2.4rem 0.55rem 0.9rem;
  border: 2px solid var(--line-strong);
  border-radius: 0;
  background: var(--vault) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23efe9dc' stroke-width='2'/%3E%3C/svg%3E") right 0.9rem center / 0.8rem no-repeat;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}
.room-size-select:disabled { opacity: 0.5; cursor: not-allowed; }
.room-total {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.room-total strong { margin-left: 0.5rem; color: var(--paper); font-size: 2.2rem; vertical-align: middle; }

.room-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.room-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.5rem;
  border: 2px solid var(--line-strong);
  background: rgba(10, 35, 41, 0.85);
}
.room-action-icon { color: var(--red); font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; line-height: 1; }
.room-action-card h2 { font-size: 2rem; }
.room-action-card p { color: var(--muted); }
.room-action-card > .button, .room-action-card form { margin-top: auto; }
#join-room-form { display: flex; flex-wrap: wrap; gap: 0.75rem; width: 100%; }

.room-code-input {
  width: 9rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border: 2px solid var(--line-strong);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-transform: uppercase;
}
.room-code-input::placeholder { color: rgba(239, 233, 220, 0.25); }

.room-created {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--red);
  background: rgba(216, 35, 27, 0.12);
}
.room-created-label { color: var(--muted); font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: 0.16em; }
.room-created strong { font-family: var(--font-display); font-size: 3.4rem; font-weight: 900; letter-spacing: 0.2em; line-height: 1; }
.room-created .button { margin-left: auto; }

.room-player-status {
  margin-top: 1.25rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.room-status { margin-top: 0.5rem; color: var(--muted); }

/* ---------- Mission briefing ---------- */
.game-screen {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  background: var(--ink) url("assets/money-heist-crew.jpg") center top / cover no-repeat;
}
.briefing-layout { flex: 1; display: flex; }
.mission-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(34rem, 100%);
  padding: 2.5rem var(--pad-x) 3rem;
  background: transparent;
  border-right: 3px solid var(--red);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}
.mission-panel h2 { font-size: clamp(3.4rem, 9vw, 5.6rem); }
.mode-stamp {
  margin-top: 1.25rem;
  padding: 0.35rem 0.8rem;
  border: 2px solid var(--red);
  color: var(--red-hot);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.mission-panel h3 { margin-bottom: 0.6rem; color: var(--muted); font-size: 1.1rem; letter-spacing: 0.16em; }
.briefing-room-details { margin-top: 0.75rem; color: var(--gold); font-weight: 600; }
.begin-button { margin-top: 2rem; }
.game-status { margin-top: 1rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- Live board ---------- */
.play-screen { display: flex; flex-direction: column; min-height: 100svh; }
.play-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: clamp(1rem, 3vw, 3rem);
  align-items: start;
  padding: 0.5rem var(--pad-x) 2rem;
}

.live-board-column { min-width: 0; }
.live-board-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.board-kicker { margin-bottom: 0.5rem; color: var(--muted); font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: 0.16em; }
.live-board-heading h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.grid-size { white-space: nowrap; color: var(--muted); font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; letter-spacing: 0.08em; }
.grid-size i { margin: 0 0.15em; color: var(--red); font-style: normal; }

.game-board-frame {
  /* Keep the whole board on screen: never taller than the viewport allows. */
  width: min(100%, calc(100svh - 14.5rem));
  min-width: min(100%, 18rem);
  padding: 8px;
  border: 2px solid var(--line-strong);
  background: var(--vault);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.live-board {
  container-type: inline-size;
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  background: var(--ink);
  user-select: none;
}

.play-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0; min-height: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transition: background-color 0.15s;
}
/* The outer ring is where the escape hatch can appear. */
.play-cell.edge-cell { background: rgba(239, 233, 220, 0.05); }
@media (hover: hover) {
  .play-cell:hover { background: rgba(239, 233, 220, 0.12); }
}
.play-cell:focus-visible { z-index: 4; outline-offset: -3px; }

.play-cell.selected-cell { z-index: 3; background: rgba(230, 194, 90, 0.2); box-shadow: inset 0 0 0 3px var(--gold); }
.play-cell.barricade-anchor { z-index: 3; background: rgba(216, 35, 27, 0.25); box-shadow: inset 0 0 0 3px var(--red-hot); }

/* Legal moves: a glowing dot, or a ring when the square is occupied. */
.play-cell.legal-cell::after {
  content: "";
  position: absolute;
  width: 32%; aspect-ratio: 1;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px 2px rgba(230, 194, 90, 0.7);
  pointer-events: none;
}
.play-cell.legal-cell:has(.play-token)::after {
  inset: 6%;
  width: auto;
  background: transparent;
  border: 3px solid var(--gold);
  box-shadow: 0 0 14px rgba(230, 194, 90, 0.8);
  border-radius: 8px;
}

/* Barricades sit on the line between two squares. */
.play-cell .wall-bar {
  position: absolute;
  z-index: 3;
  background: var(--red-hot);
  box-shadow: 0 0 10px rgba(255, 65, 54, 0.8);
  pointer-events: none;
}
.play-cell .wall-bar.wall-top { top: -3px; left: -3px; right: -3px; height: 5px; }
.play-cell .wall-bar.wall-left { left: -3px; top: -3px; bottom: -3px; width: 5px; }

/* Pieces — sized from the board width so 9x9 through 21x21 all fit. */
.play-token {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: calc(100cqw / var(--n, 9) * 0.5);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}
.crew-token { background: var(--red); color: #fff; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--red); }
.crew-token.carrying { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--gold); font-size: calc(100cqw / var(--n, 9) * 0.4); }
.police-token { background: var(--cop); color: var(--ink); box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--cop); }
.cash-token { background: var(--gold); color: var(--ink); border-radius: 22%; }
.exit-token {
  border: 2px dashed var(--paper);
  border-radius: 22%;
  color: var(--paper);
  animation: hatch-pulse 1.8s ease-in-out infinite;
}
@keyframes hatch-pulse { 50% { opacity: 0.45; } }

.live-instruction { max-width: 60ch; margin-top: 0.9rem; color: var(--muted); font-size: 0.95rem; }

/* Game over: freeze the board behind the result. */
.play-screen.game-over .live-board { opacity: 0.45; pointer-events: none; }

/* ---------- Side panel ---------- */
.live-panel {
  position: sticky;
  top: 1rem;
  padding: 1.5rem;
  border: 2px solid var(--line-strong);
  background: rgba(10, 35, 41, 0.9);
}
.turn-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
}
.turn-dot { width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--red-hot); box-shadow: 0 0 12px var(--red-hot); }
.turn-indicator.police-turn .turn-dot { background: var(--cop); box-shadow: 0 0 12px var(--cop); }
.turn-subtitle { margin-top: 0.5rem; color: var(--gold); font-weight: 600; }
.live-objective-title { margin-bottom: 0.6rem; color: var(--muted); font-size: 1.1rem; letter-spacing: 0.16em; }
.live-panel .objective-copy { font-size: 0.95rem; }

.map-legend { display: grid; gap: 0.6rem; margin: 1.25rem 0; font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: 0.1em; }
.map-legend > div { display: flex; align-items: center; gap: 0.75rem; }
.legend-piece {
  display: grid; place-items: center;
  width: 1.7rem; height: 1.7rem;
  border-radius: 50%;
  font-size: 1rem; font-weight: 900; line-height: 1;
}
.legend-piece.crew-piece { background: var(--red); color: #fff; }
.legend-piece.police-piece { background: var(--cop); color: var(--ink); }
.legend-piece.cash-piece { background: var(--gold); color: var(--ink); border-radius: 22%; }
.legend-piece.exit-piece { border: 2px dashed var(--paper); border-radius: 22%; }

.live-message { min-height: 3em; padding-top: 1rem; border-top: 1px solid var(--line); font-weight: 600; }
.restart-button { width: 100%; margin-top: 1rem; font-size: 1.15rem; }
.restart-button[aria-pressed="true"] { border-color: var(--red-hot); background: rgba(216, 35, 27, 0.25); }

/* ---------- Result screen ---------- */
.victory-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
.victory-art { position: absolute; inset: 0; z-index: -2; background: var(--ink) center 18% / cover no-repeat; }
.victory-shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(0deg, rgba(5, 19, 23, 0.94) 0%, rgba(5, 19, 23, 0.7) 32%, rgba(5, 19, 23, 0.05) 65%),
    linear-gradient(90deg, rgba(5, 19, 23, 0.55), transparent 55%);
}
.victory-content { margin-top: auto; padding: 2rem var(--pad-x) 3.5rem; }
.victory-content h1 { margin-bottom: 1.25rem; font-size: clamp(3.6rem, 12vw, 9rem); font-weight: 900; line-height: 0.85; }
.victory-content h1 span { display: block; }
.victory-content > p:not(.panel-kicker) { max-width: 42ch; font-size: 1.2rem; }
.victory-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }

/* ---------- About dialog ---------- */
.about-dialog {
  width: min(52rem, calc(100vw - 2rem));
  max-height: calc(100svh - 2rem);
  padding: 0;
  overflow: auto;
  border: 2px solid var(--red);
  background: var(--vault);
  color: var(--paper);
}
.about-dialog[open] { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
.about-dialog::backdrop { background: rgba(5, 19, 23, 0.82); backdrop-filter: blur(4px); }

.dialog-close {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  z-index: 2;
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(5, 19, 23, 0.7);
  font-size: 1.5rem; line-height: 1;
}
.dialog-close:hover { border-color: var(--paper); }

.about-image { min-height: 22rem; background: var(--ink) url("assets/professor-poster.jpg") center top / cover no-repeat; }
.about-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; padding: 2.5rem 2rem; }
.dialog-kicker { color: var(--red-hot); font-family: var(--font-display); font-size: 1.05rem; font-weight: 800; letter-spacing: 0.18em; }
.about-copy h2 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
.about-note { color: var(--muted); }
.dialog-done { margin-top: auto; }

/* ---------- Small screens ---------- */
@media (max-width: 62rem) {
  .play-layout { grid-template-columns: minmax(0, 1fr); }
  .live-panel { position: static; }
  .game-board-frame { width: 100%; }
}

@media (max-width: 46rem) {
  .landing .backdrop { background-image: url("assets/page1.png"); background-position: center 20%; }
  .crew-screen, .game-screen { background-position: center 38%; }
  .shade {
    background:
      linear-gradient(0deg, rgba(5, 19, 23, 0.97) 0%, rgba(5, 19, 23, 0.6) 55%, rgba(5, 19, 23, 0.25) 100%);
  }
  .main-actions .button { flex: 0 1 15rem; }
  .bottom-mark { letter-spacing: 0.12em; font-size: 0.8rem; }

  .crew-panel, .mission-panel { width: 100%; border-right: 0; }
  .crew-panel { background: transparent; }
  .briefing-layout { align-items: flex-end; }
  .mission-panel { border-top: 3px solid var(--red); }

  .choice-card { padding: 1rem; }
  .room-actions { grid-template-columns: 1fr; }
  .room-total { margin-left: 0; }
  .room-created .button { margin-left: 0; width: 100%; }
  .room-created strong { font-size: 2.6rem; }

  .lobby-topbar .operation-label,
  .game-topbar .operation-label,
  .play-topbar .operation-label,
  .victory-topbar .operation-label { display: none; }

  .about-dialog[open] { grid-template-columns: 1fr; }
  .about-image { min-height: 14rem; background-position: center 20%; }
  .about-copy { padding: 1.5rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Name / mode / room flow ---------- */
.field-label { display: block; margin: 1.25rem 0 0.5rem; color: var(--muted); font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: 0.16em; }
.text-input { box-sizing: border-box; width: 100%; max-width: 22rem; padding: 0.7rem 1rem; border: 2px solid var(--line-strong); border-radius: 0; background: rgba(5, 19, 23, 0.55); color: var(--paper); font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; letter-spacing: 0.08em; }
.text-input:focus { outline: none; border-color: var(--red); }
.flow-buttons { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.crew-actions { margin-top: 1.75rem; }
.room-list { display: grid; gap: 0.5rem; max-height: 14rem; margin: 0 0 1rem; padding: 0; overflow-y: auto; list-style: none; }
.room-row { display: flex; justify-content: space-between; gap: 1rem; width: 100%; max-width: 26rem; padding: 0.7rem 1rem; border: 2px solid var(--line-strong); background: rgba(5, 19, 23, 0.55); color: var(--paper); font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; letter-spacing: 0.1em; text-align: left; }
.room-row:hover, .room-row[aria-pressed="true"] { border-color: var(--red); }
.room-empty { color: var(--muted); }
.team-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.team-col { display: flex; flex-direction: column; gap: 0.75rem; padding: 1.25rem; border: 2px solid var(--line-strong); background: rgba(10, 35, 41, 0.85); }
.team-col:first-child { border-color: var(--red); }
.team-col h2 { font-size: 2rem; }
.team-col small { color: var(--muted); font-size: 1rem; letter-spacing: 0.1em; }
.slot-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.slot { padding: 0.6rem 0.8rem; border: 1px dashed var(--line-strong); color: var(--muted); font-weight: 600; }
.slot.filled { border-style: solid; border-color: var(--paper); color: var(--paper); }
.lobby-start { margin-top: 0.5rem; }
@media (max-width: 46rem) { .team-split { grid-template-columns: 1fr; } }

.button.is-inactive { opacity: 0.55; }
@media (max-width: 46rem) { .sound-toggle { bottom: 0.75rem; right: 0.75rem; width: 2.5rem; height: 2.5rem; } .crew-content { padding-bottom: 5rem; } }

/* Typewriter body font on UI controls (matches The Last Second) */
.button, .text-input, .room-row, .field-label, .back-link, .operation-label, .slot, .roster-title, .player-card, .choice-title, .mode-title, .room-size-label, .room-size-select, .edition { font-family: var(--font-body); }
h1, h2, h3, .wordmark-mark { letter-spacing: 0.02em; }

/* ---- In-match: team colours, door, roster ---- */
.live-board .play-token.ally { background: #1fa34a; border-color: #7dffa8; color: #fff; box-shadow: 0 0 10px rgba(47, 208, 107, 0.6); }
.live-board .play-token.enemy { background: #d8231b; border-color: #ff8a84; color: #fff; box-shadow: 0 0 10px rgba(255, 75, 68, 0.6); }
.play-cell.door-cell { position: relative; }
.play-cell.door-cell::after { content: ""; position: absolute; z-index: 3; background: #f5c542; box-shadow: 0 0 10px #f5c542; pointer-events: none; }
.door-top::after { top: 0; left: 22%; width: 56%; height: 6px; }
.door-bottom::after { bottom: 0; left: 22%; width: 56%; height: 6px; }
.door-left::after { left: 0; top: 22%; height: 56%; width: 6px; }
.door-right::after { right: 0; top: 22%; height: 56%; width: 6px; }
.roster { display: grid; gap: 0.5rem; }
.roster-title { margin: 0.6rem 0 0.1rem; font-size: 0.8rem; letter-spacing: 0.14em; }
.roster-title.ally { color: #2fd06b; } .roster-title.enemy { color: #ff4b44; }
.player-card { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.7rem; border: 2px solid; background: rgba(5, 19, 23, 0.6); color: var(--paper); transition: box-shadow 0.2s, opacity 0.2s; }
.player-card b { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; font-family: var(--font-display); font-size: 1.2rem; color: #041014; }
.player-card span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-card em { font-style: normal; font-size: 0.75rem; letter-spacing: 0.1em; }
.player-card.ally { border-color: #1fa34a; } .player-card.ally b { background: #2fd06b; }
.player-card.enemy { border-color: #d8231b; } .player-card.enemy b { background: #ff4b44; }
.player-card.active { animation: turnGlow 1.1s ease-in-out infinite alternate; }
.player-card.ally.active { color: #7dffa8; } .player-card.enemy.active { color: #ff8a84; }
.player-card.out { opacity: 0.4; }
@keyframes turnGlow { from { box-shadow: 0 0 4px currentColor; } to { box-shadow: 0 0 20px 3px currentColor, inset 0 0 12px rgba(255,255,255,0.12); } }
.legend-piece.ally-piece { background: #1fa34a; color: #fff; } .legend-piece.enemy-piece { background: #d8231b; color: #fff; }
.legend-door { display: inline-block; width: 1.4rem; height: 0.35rem; margin-right: 0.4rem; background: #f5c542; box-shadow: 0 0 8px #f5c542; vertical-align: middle; }
@media (prefers-reduced-motion: reduce) { .player-card.active { animation: none; box-shadow: 0 0 14px currentColor; } }

/* ---- Mobile polish (from phone screenshots) ---- */
#page-title { line-height: 1.08; }
.button { white-space: nowrap; font-size: 1rem; letter-spacing: 0.06em; }
.live-board .play-token { font-family: var(--font-body); font-size: 0.8em; letter-spacing: 0; }
.crew-content, .lobby-content, .play-layout, .briefing-layout { padding-bottom: 5.5rem; }
.crew-panel, .crew-content h2, .crew-content .field-label, .crew-status { text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95), 0 0 3px rgba(0, 0, 0, 0.9); }
.crew-screen .button-about, .crew-screen .choice-card, .crew-screen .text-input { background: rgba(5, 19, 23, 0.78); }
@media (max-width: 46rem) {
  .crew-content { padding-top: 1rem; }
  .crew-content h2 { font-size: clamp(2.6rem, 14vw, 3.6rem); line-height: 1.05; }
}

/* ===== Design pass: type, flat layout, polish ===== */
:root { --font-ui: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif; }
body { background: radial-gradient(ellipse 70% 50% at 15% -10%, rgba(216, 35, 27, 0.2), transparent 60%), #041014; }
h1, h2 { text-shadow: 0 0 30px rgba(216, 35, 27, 0.35); }

/* Logo: first page only */
.nx-logo { display: block; width: 4.2rem; height: auto; filter: drop-shadow(0 0 10px rgba(216, 35, 27, 0.6)); opacity: 0.95; }
.wordmark-hero { border: 0; padding: 0; }

/* Sound button: top right on every page; keep top bars clear of it */
.sound-toggle { top: 0.9rem; right: 0.9rem; bottom: auto; }
.topbar, .crew-topbar, .lobby-topbar, .game-topbar, .play-topbar, .victory-topbar { padding-right: 4.8rem; }
@media (max-width: 46rem) { .sound-toggle { top: 0.7rem; right: 0.7rem; bottom: auto; } .crew-content, .lobby-content, .play-layout, .briefing-layout { padding-bottom: 2.5rem; } }

/* Type */
.button { font-family: var(--font-ui); font-weight: 700; font-size: 1.2rem; letter-spacing: 0.14em; text-transform: uppercase; min-height: 3.2rem; transition: transform 0.15s, box-shadow 0.15s, background 0.15s; }
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button-play { background: linear-gradient(180deg, #ea3a2f, #b8150f); box-shadow: 0 8px 26px rgba(216, 35, 27, 0.35); }
.button-play:hover:not(:disabled) { box-shadow: 0 12px 32px rgba(216, 35, 27, 0.55); }
.field-label, .back-link, .operation-label, .roster-title, .room-size-label, .team-col small { font-family: var(--font-ui); font-weight: 600; letter-spacing: 0.18em; font-size: 0.95rem; }
.crew-content h2 { font-size: clamp(2.8rem, 9vw, 4.6rem); line-height: 1; }
.text-input, .room-size-select { font-family: var(--font-ui); font-weight: 600; font-size: 1.6rem; letter-spacing: 0.06em; }
.text-input { border: 0; border-bottom: 2px solid var(--red); background: transparent; padding: 0.4rem 0; }
.crew-screen .text-input { background: transparent; }
.crew-status, .live-message, .room-status { font-size: 0.95rem; line-height: 1.5; }

/* Fewer boxes: lobby, roster, rooms */
.team-col { background: none; border: 0; border-top: 3px solid var(--red); padding: 0.9rem 0 0; }
.team-col + .team-col { border-top-color: #8fb3b8; }
.team-col h2 { font-size: 2.2rem; }
.slot { border: 0; border-left: 3px solid rgba(255, 255, 255, 0.2); padding: 0.4rem 0.8rem; background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent); font-family: var(--font-ui); font-size: 1.25rem; font-weight: 600; letter-spacing: 0.04em; }
.slot.filled { border-left-color: #2fd06b; }
.room-row { border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.22); background: transparent; font-family: var(--font-ui); font-size: 1.3rem; padding: 0.7rem 0.2rem; }
.room-row:hover, .room-row[aria-pressed="true"] { border-bottom-color: var(--red); background: linear-gradient(90deg, rgba(216, 35, 27, 0.18), transparent); }
.live-panel { background: transparent; border: 0; box-shadow: none; }
.player-card { border: 0; border-left: 4px solid; background: linear-gradient(90deg, rgba(255, 255, 255, 0.07), transparent); font-family: var(--font-ui); font-size: 1.3rem; font-weight: 600; }
.player-card.ally { border-left-color: #2fd06b; } .player-card.enemy { border-left-color: #ff4b44; }
.player-card.active { box-shadow: -6px 0 18px -4px currentColor; }
@keyframes turnGlow { from { box-shadow: -2px 0 6px -2px currentColor; } to { box-shadow: -8px 0 24px -2px currentColor; background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent); } }
.map-legend { font-family: var(--font-ui); font-size: 1.05rem; letter-spacing: 0.1em; }

/* Board feel */
.play-cell { transition: background 0.15s; }
.play-cell:nth-child(even) { background-color: rgba(255, 255, 255, 0.018); }
.play-cell:hover { background-color: rgba(255, 255, 255, 0.07); }
.play-token { animation: tokenIn 0.25s ease-out; }
@keyframes tokenIn { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cash-token { animation: tokenIn 0.25s ease-out, cashShine 1.8s ease-in-out infinite alternate; }
@keyframes cashShine { from { box-shadow: 0 0 4px rgba(245, 197, 66, 0.4); } to { box-shadow: 0 0 16px rgba(245, 197, 66, 0.9); } }
.door-cell::after { animation: doorPulse 1.4s ease-in-out infinite alternate; }
@keyframes doorPulse { from { box-shadow: 0 0 4px #f5c542; } to { box-shadow: 0 0 16px 3px #f5c542; } }
.play-cell.legal-cell { animation: legalPulse 1.1s ease-in-out infinite alternate; }
.play-cell.barricade-target { outline: 3px solid #ff5a4f; outline-offset: -3px; animation: legalPulse 0.9s ease-in-out infinite alternate; cursor: crosshair; }
@keyframes legalPulse { from { background-color: rgba(255, 255, 255, 0.05); } to { background-color: rgba(255, 90, 79, 0.28); } }
.play-cell.legal-cell { --pulse: 1; }
@media (prefers-reduced-motion: reduce) { .play-token, .cash-token, .door-cell::after, .play-cell.legal-cell, .play-cell.barricade-target { animation: none; } }


/* ==========================================================================
   Compact, no-scroll layouts: join list, lobby, briefing, live match
   ========================================================================== */

/* ---- Join: "<host>'s room" rows ---- */
.room-list { max-height: 34dvh; }
.room-row { flex-direction: column; align-items: flex-start; gap: 0.1rem; max-width: 100%; }
.room-host { font-size: 1.3rem; line-height: 1.15; }
.room-meta { color: var(--muted); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.1em; }

/* ---- Lobby: both teams side by side, tap a slot, confirm ---- */
.lobby-screen { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.lobby-topbar { padding: 0.5rem 1rem; padding-right: 4rem; }
.lobby-content { flex: 1; min-height: 0; width: min(34rem, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 0.7rem; padding: 0.3rem 1rem 1rem; }
.lobby-host { margin: 0; color: var(--gold); font-family: var(--font-ui); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.08em; line-height: 1.1; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-content h1 { margin: 0; font-size: 2.1rem; line-height: 1; letter-spacing: 0.14em; }
.lobby-content h1 small { margin-right: 0.4rem; color: var(--muted); font-family: var(--font-ui); font-size: 0.85rem; letter-spacing: 0.2em; }
.team-split, .team-split { grid-template-columns: 1fr 1fr; gap: 0.9rem; margin: 0.3rem 0; }
.team-col { padding: 0.6rem 0 0; gap: 0.5rem; min-width: 0; }
.team-col h2 { font-size: 1.25rem; line-height: 1.1; letter-spacing: 0.04em; }
.team-col h2 small { font-size: 0.85rem; letter-spacing: 0.08em; }
.slot-list { gap: 0.45rem; }
.slot { display: block; width: 100%; min-height: 2.7rem; padding: 0.45rem 0.6rem; color: var(--paper); font-size: 1.1rem; line-height: 1.2; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.slot:not(.filled) { color: var(--muted); border-left-style: dashed; }
.slot.mine { border-left-color: var(--gold); }
.slot:disabled { cursor: default; opacity: 1; }
.slot.picked { outline: 2px solid var(--gold); outline-offset: -2px; background: rgba(230, 194, 90, 0.18); }
.slot.picked.kick { outline-color: var(--red-hot); background: rgba(216, 35, 27, 0.25); }
.lobby-content .room-status { min-height: 2.4em; margin: 0; font-size: 0.9rem; line-height: 1.2; }
.lobby-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0; }
.lobby-actions .button { width: 100%; min-height: 3rem; padding: 0.5rem 0.6rem; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; }
.button.danger { border-color: var(--red-hot); background: rgba(216, 35, 27, 0.25); color: #ffb3ae; }
.lobby-content .room-player-status { margin: 0; font-size: 0.9rem; text-align: center; }

/* ---- Briefing: key moved here from the match screen ---- */
.game-screen { min-height: 100dvh; }
.mission-panel .mode-stamp { margin-top: 0.7rem; font-size: 0.85rem; }
.mission-panel .mission-rule { margin: 0.9rem 0; }
.mission-panel h3 { margin-bottom: 0.3rem; font-size: 1rem; }
.mission-panel .objective-copy { font-size: 0.9rem; line-height: 1.35; }
.mission-panel .briefing-room-details { margin-top: 0.5rem; font-size: 0.85rem; }
.brief-legend { width: 100%; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; margin: 0.9rem 0 0; font-size: 0.95rem; }
.mission-panel .begin-button { margin-top: 1rem; }
.mission-panel .game-status { margin-top: 0.6rem; font-size: 0.85rem; }

/* ---- Live match: one screen, no scrolling ---- */
.play-screen { height: 100dvh; min-height: 0; overflow: hidden; }
.play-topbar { padding: 0.4rem 1rem; padding-right: 4rem; }
.play-topbar .back-link { padding: 0.3rem 0; }

.roster { display: grid; gap: 0.15rem; padding: 0.1rem 1rem 0.45rem; }
.roster-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.9rem; font-family: var(--font-ui); font-size: 0.95rem; line-height: 1.3; }
.roster-label { min-width: 5.6rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.16em; opacity: 0.8; }
.roster-row.ally .roster-label { color: #2fd06b; }
.roster-row.enemy .roster-label { color: #ff6b63; }
.roster-player { display: inline-flex; align-items: center; gap: 0.3rem; color: rgba(239, 233, 220, 0.72); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.roster-player b { display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 50%; color: #041014; font-size: 0.7rem; line-height: 1; }
.roster-row.ally b { background: #2fd06b; }
.roster-row.enemy b { background: #ff4b44; }
.roster-row.ally .roster-player.active { color: #7dffa8; }
.roster-row.enemy .roster-player.active { color: #ff8a84; }
.roster-player.active { animation: nameGlow 1s ease-in-out infinite alternate; }
.roster-player.out { opacity: 0.35; text-decoration: line-through; }
@keyframes nameGlow { from { text-shadow: 0 0 2px currentColor; } to { text-shadow: 0 0 8px currentColor, 0 0 16px currentColor; } }

.board-area { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; padding: 0 0.5rem; }
.game-board-frame { position: relative; width: min(100cqw, 100cqh); min-width: 0; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }

.live-board .play-token.turn-glow.ally { animation: glowAlly 1s ease-in-out infinite alternate; }
.live-board .play-token.turn-glow.enemy { animation: glowEnemy 1s ease-in-out infinite alternate; }
@keyframes glowAlly { from { box-shadow: 0 0 4px 1px rgba(47, 208, 107, 0.6); } to { box-shadow: 0 0 16px 5px rgba(125, 255, 168, 0.95); } }
@keyframes glowEnemy { from { box-shadow: 0 0 4px 1px rgba(255, 75, 68, 0.6); } to { box-shadow: 0 0 16px 5px rgba(255, 138, 132, 0.95); } }

.live-message { min-height: 2.5em; padding: 0.3rem 1rem; border-top: 0; color: var(--paper); font-size: 0.9rem; line-height: 1.25; text-align: center; }

/* Police walls: drag a bar onto the board; a shadow shows where it will snap. */
.wall-tray { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; padding: 0.2rem 1rem 0.8rem; transition: opacity 0.2s; }
.wall-tray.is-off { opacity: 0.35; }
.wall-tray-label { white-space: pre-line; color: var(--muted); font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; line-height: 1.2; }
.wall-chip { display: grid; place-items: center; width: 4.4rem; height: 3.1rem; border: 2px solid var(--line-strong); background: rgba(5, 19, 23, 0.7); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.wall-tray.is-off .wall-chip { cursor: not-allowed; }
.wall-chip:active { cursor: grabbing; border-color: var(--red-hot); }
.wall-chip .bar { display: block; border-radius: 2px; background: var(--red-hot); box-shadow: 0 0 8px var(--red-hot); pointer-events: none; }
.bar-h { width: 2.6rem; height: 0.35rem; }
.bar-v { width: 0.35rem; height: 1.9rem; }
.wall-ghost { position: fixed; z-index: 2000; border-radius: 4px; background: var(--red-hot); box-shadow: 0 0 16px var(--red-hot); opacity: 0.9; pointer-events: none; transform: translate(-50%, -50%); }
.wall-shadow { position: absolute; z-index: 6; border-radius: 3px; background: rgba(255, 65, 54, 0.6); outline: 2px solid rgba(255, 255, 255, 0.55); box-shadow: 0 0 12px rgba(255, 65, 54, 0.9); pointer-events: none; }
.wall-shadow.invalid { background: rgba(160, 160, 160, 0.35); outline: 2px dashed rgba(255, 255, 255, 0.5); box-shadow: none; }

/* ---- Leave-match warning + toast ---- */
.leave-dialog { width: min(22rem, calc(100vw - 2rem)); padding: 1.4rem; border: 2px solid var(--red); background: var(--vault); color: var(--paper); }
.leave-dialog::backdrop { background: rgba(5, 19, 23, 0.82); backdrop-filter: blur(4px); }
.leave-dialog h2 { font-size: 2.2rem; line-height: 1; }
.leave-dialog p { margin: 0.8rem 0 1.2rem; color: var(--muted); font-size: 0.95rem; }
.leave-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.leave-actions .button { width: 100%; min-height: 3rem; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; z-index: 1100; max-width: calc(100vw - 2rem); padding: 0.6rem 1rem; border: 2px solid var(--red); background: var(--vault); font-family: var(--font-ui); font-size: 1.05rem; transform: translateX(-50%); }

@media (prefers-reduced-motion: reduce) {
  .roster-player.active, .live-board .play-token.turn-glow { animation: none; }
  .roster-player.active { text-shadow: 0 0 8px currentColor; }
  .live-board .play-token.turn-glow { box-shadow: 0 0 14px 4px currentColor; }
}


/* ==========================================================================
   Backgrounds, aligned panels, About rules
   ========================================================================== */

/* page2 behind: who's playing, mode, side, create, join, mission brief */
.crew-screen, .game-screen {
  background-color: #000;
  background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.25) 45%, rgba(0, 0, 0, 0) 70%), url("assets/page2.jpg");
  background-size: 100% 100%, cover;
  background-position: 0 0, center bottom;
  background-repeat: no-repeat;
}
@media (max-width: 46rem) {
  .crew-screen, .game-screen { background-image: url("assets/page2.jpg"); background-size: cover; background-position: center bottom; }
}

/* no red divider line */
.crew-panel, .mission-panel { border-right: 0; border-top: 0; }

/* Mission brief sits exactly where the other panels sit */
.briefing-layout { align-items: flex-start; }
.game-topbar { padding: 1.1rem var(--pad-x) 0; padding-right: 4.8rem; }
.mission-panel { padding: 2rem var(--pad-x) 2rem; }
.mission-panel h2 { font-size: clamp(2.8rem, 9vw, 4.6rem); line-height: 1; }
@media (max-width: 46rem) {
  .mission-panel { padding-top: 1rem; padding-bottom: 1.2rem; }
  .mission-panel h2 { font-size: clamp(2.6rem, 14vw, 3.6rem); }
}

/* Victory art */
.victory-art { background-position: center; }

/* About: short rules + image that fills its panel */
.about-dialog { max-height: calc(100dvh - 2rem); }
.about-image { min-height: 100%; background-color: var(--ink); background-size: cover; background-position: center 20%; background-repeat: no-repeat; }
.about-copy { gap: 0.9rem; padding: 2rem 1.8rem; }
.about-copy h2 { font-size: clamp(2rem, 5vw, 3rem); }
.rules-list { display: grid; gap: 0.6rem; width: 100%; margin: 0; padding: 0; list-style: none; }
.rules-list li { display: grid; grid-template-columns: 4.6rem 1fr; gap: 0.6rem; align-items: baseline; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); font-size: 0.95rem; line-height: 1.3; }
.rules-list li:last-child { border-bottom: 0; }
.rules-list b { color: var(--red-hot); font-family: var(--font-ui); font-size: 1rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.dialog-done { align-self: stretch; width: auto; margin-top: 0.4rem; }
@media (max-width: 46rem) {
  .about-dialog[open] { grid-template-columns: 1fr; grid-template-rows: minmax(0, 24dvh) minmax(0, 1fr); }
  .about-image { min-height: 0; height: 100%; background-position: center 18%; }
  .about-copy { padding: 1rem 1.1rem 1.1rem; gap: 0.6rem; }
  .about-copy h2 { font-size: 1.9rem; }
  .rules-list { gap: 0.4rem; }
  .rules-list li { padding-bottom: 0.4rem; font-size: 0.88rem; grid-template-columns: 4rem 1fr; }
  .dialog-done { min-height: 2.8rem; }
}
