/* The party host screen and its phone remote (docs 119, 120, src/apps/party/): a kit's look on a TV.
   Setup is read on the laptop; the step view is read across a room, so its type scales with the
   viewport (vmin) rather than sitting at body size. The colours are the theme's, set by data-theme
   on <html> from the game's look (THEMES in src/_lib/party/screen.js); a new theme is one more
   block like snow-night's, in the colour roles the print kit uses (murder_party/look.py). */

@font-face {
  font-family: "Oswald";
  src: url("/assets/fonts/Oswald-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

/* The clock: a typewriter mono (the site's, shared with companion.css), so the digits never shift. */
@font-face {
  font-family: "Courier Prime";
  src: url("/assets/fonts/CourierPrime-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "League Spartan";
  src: url("/assets/fonts/LeagueSpartan-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "League Spartan";
  src: url("/assets/fonts/LeagueSpartan-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
}

/* Snow Night, Murder at the Nutcracker's look (games/nutcracker/look.toml). */
[data-theme="snow-night"] {
  --dark: #0c0f18;
  --panel: #151a27; /* a raised panel on the dark colour */
  --light: #efe6d2;
  --muted: #b9b2a3;
  --highlight: #c8913c;
  --accent: #c23b2e;
  --line: rgba(239, 230, 210, 0.18); /* the light colour, faint */
  --veil: rgba(12, 15, 24, 0.92); /* the dark colour over the step, under the controls */
}

/* Videotape, Murder at the Video Awards' look (games/videoawards/look.toml). */
[data-theme="videotape"] {
  --dark: #141018;
  --panel: #221a2b; /* a raised panel on the dark colour */
  --light: #f6f1e7;
  --muted: #a99fb8;
  --highlight: #19d3e6;
  --accent: #ff2e88;
  --line: rgba(246, 241, 231, 0.18); /* the light colour, faint */
  --veil: rgba(20, 16, 24, 0.92); /* the dark colour over the step, under the controls */
}

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

html, body { min-height: 100%; }

body {
  background-color: var(--dark);
  background-image: var(--texture, none);
  background-size: 400px 400px;
  color: var(--light);
  font-family: "League Spartan", Arial, sans-serif;
  font-weight: 500;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .title, .awards li {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.eyebrow, .count, .setting, .next, .rail span {
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

a { color: var(--highlight); }

button {
  font: inherit;
  color: var(--light);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55em 1.1em;
  cursor: pointer;
}

button:hover:not(:disabled) { border-color: var(--highlight); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--highlight); border-color: var(--highlight); color: var(--dark); font-weight: 700; }
:focus-visible { outline: 3px solid var(--highlight); outline-offset: 3px; }

/* --- Setup, on the laptop ------------------------------------------------------------------- */

.setup {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.setup .eyebrow { color: var(--highlight); font-size: 0.85rem; }
.setup h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1; margin: 0.3em 0 0.25em; }
.setup h1:focus { outline: none; }
.setup .setting { color: var(--muted); font-size: 0.8rem; }
.setup .lede { font-size: 1.2rem; max-width: 46em; margin-top: 1.4em; }
.setup .keys { color: var(--muted); max-width: 46em; margin-top: 0.6em; }
.setup .notice { margin-top: 1em; color: var(--highlight); }

.casting { border: 0; margin-top: 2em; }
.casting legend { font-weight: 700; margin-bottom: 0.8em; }
.casting ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.casting label {
  display: grid;
  grid-template-columns: auto 44px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.casting input { width: 18px; height: 18px; accent-color: var(--highlight); }
.casting img { width: 44px; height: 44px; border-radius: 22px 22px 4px 4px; object-fit: cover; }
.casting label:has(input:not(:checked)) { opacity: 0.45; }
.who strong { display: block; font-size: 0.95rem; }
.who span { display: block; color: var(--muted); font-size: 0.78rem; line-height: 1.25; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2em; }
.actions button { font-size: 1.1rem; padding: 0.7em 1.5em; }
.shop { margin-top: 2.5em; font-size: 0.9rem; }

/* The phone pairing (doc 120): a QR code a phone reads off the laptop or the TV. */
.pairing {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px;
  margin-top: 2.5em;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.qr { background: #fff; padding: 8px; border-radius: 4px; line-height: 0; }
.qr svg { width: 200px; height: 200px; fill: #000; shape-rendering: crispEdges; }
.pairing h2 { font-size: 1.5rem; }
.pairing p { color: var(--muted); max-width: 34em; margin-top: 0.4em; }
.pairing .phone-status { color: var(--light); font-weight: 700; }
.pairing .phone-status.on { color: var(--highlight); }
.pairing button { margin-top: 0.9em; font-size: 0.9rem; }
@media (max-width: 560px) {
  .pairing { grid-template-columns: 1fr; justify-items: start; }
}

/* --- The step, on the TV -------------------------------------------------------------------- */

.step {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 3vmin 5vmin 2vmin;
  text-align: center;
}

.top { display: flex; justify-content: space-between; align-items: baseline; gap: 2vmin; }
.top .title { font-size: 2.6vmin; color: var(--light); }
.top .title::first-letter { color: var(--light); }
.top .setting { font-size: 1.6vmin; color: var(--muted); }

.stage { align-self: center; display: grid; justify-items: center; gap: 2vmin; }
.count { color: var(--highlight); font-size: 2.2vmin; }
.stage h1 { font-size: 11vmin; line-height: 0.95; }
.stage h1:focus { outline: none; }
.line { font-size: 3.6vmin; max-width: 34em; line-height: 1.3; }
.clock {
  font-family: "Courier Prime", "Courier New", monospace;
  font-weight: 700;
  font-size: 22vmin;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-top: 1vmin;
}
.untimed .line { font-size: 5vmin; }
.up { visibility: hidden; color: var(--accent); font-size: 3vmin; letter-spacing: 0.18em; text-transform: uppercase; }
/* Courier gives a colon a digit's full width; pull the digits in around it. */
.clock .colon { margin: 0 -0.14em; }
.over .clock { color: var(--accent); }
.over .up { visibility: visible; }
.paused .clock { opacity: 0.45; }

.awards { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2vmin; margin-top: 2vmin; }
.awards li {
  font-size: 4.4vmin;
  padding: 2vmin 4vmin;
  border: 2px solid var(--highlight);
  color: var(--highlight);
}

/* The thank-you screen after the last step. */
.finale .stage { gap: 3vmin; }
.finale .review { font-size: 2.8vmin; color: var(--muted); max-width: 40em; }
.finale .brand { display: grid; justify-items: center; gap: 1.2vmin; margin-top: 3vmin; }
.finale .brand img { width: 36vmin; height: auto; filter: invert(1); } /* the lockup's ink is near-black */
.finale .brand span { font-size: 2vmin; color: var(--highlight); letter-spacing: 0.18em; text-transform: uppercase; }

.bottom { display: grid; gap: 1.2vmin; }
.rail { list-style: none; display: flex; gap: 0.5vmin; }
.rail li {
  flex: 0 1 0; /* flex-grow is the step's share of the night, set by view.js */
  min-width: 0;
  border-top: 0.8vmin solid var(--line);
  padding-top: 0.8vmin;
  text-align: center;
}
.rail span { display: block; font-size: 1.6vmin; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .done { border-top-color: var(--muted); }
.rail .now { border-top-color: var(--highlight); }
.rail .now span { color: var(--light); }
.rail .icon { display: flex; justify-content: center; }
.rail svg { width: 3vmin; height: 3vmin; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.rail .now svg { stroke: var(--highlight); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.next { font-size: 1.8vmin; color: var(--muted); text-align: right; }

.controls {
  position: fixed;
  left: 50%;
  bottom: 13vmin; /* clear of the rail and the "Next" line under it */
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: var(--veil);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: opacity 0.4s;
}
/* Hidden while the mouse and keys are still (main.js), unless a keyboard user has tabbed into them. */
.idle .controls:not(:has(:focus-visible)) { opacity: 0; pointer-events: none; }

/* Shown until a click or key press lets the browser play the time-up chime (main.js unlockAudio). */
.chime-hint {
  display: none;
  position: fixed;
  top: 7vmin;
  left: 50%;
  transform: translateX(-50%);
  color: var(--highlight);
  font-size: 1.6vmin;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.silent .chime-hint { display: block; }
.idle:not([data-view="setup"]) { cursor: none; }

/* --- The cast board, over the step ---------------------------------------------------------- */

.board {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 3vmin 5vmin 2vmin;
  background-color: var(--dark);
  background-image: var(--texture, none);
  background-size: 400px 400px;
}
.board-head { display: flex; align-items: baseline; gap: 3vmin; margin-bottom: 3vmin; }
.board-head h2 { font-size: 5vmin; }
.board-head p { color: var(--muted); font-size: 1.8vmin; flex: 1; }
.idle .board-head p, .idle .board-head button { visibility: hidden; }

.faces { list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-content: start; gap: 2.5vmin; overflow: auto; }
/* Two rows on a 16:9 screen: six across for up to 12 guests, ten across for more. */
.faces.many { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 1.6vmin; }
.faces.many strong { font-size: 1.9vmin; }
.faces.many span { font-size: 1.3vmin; }
.faces button { all: unset; display: grid; justify-items: center; gap: 0.6vmin; width: 100%; cursor: pointer; text-align: center; }
.faces button:focus-visible { outline: 3px solid var(--highlight); outline-offset: 4px; }
.faces img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50% 50% 6px 6px / 40% 40% 6px 6px;
  border: 0.4vmin solid var(--highlight);
}
.faces strong { font-family: "Oswald", sans-serif; font-weight: 600; text-transform: uppercase; font-size: 2.2vmin; }
.faces span { color: var(--muted); font-size: 1.5vmin; line-height: 1.2; }
.faces .ghost img { filter: grayscale(1) brightness(0.55); border-color: var(--muted); }
.faces .ghost span { color: var(--highlight); letter-spacing: 0.18em; text-transform: uppercase; }

/* The step and its clock, small, and the rail, under the board (view.js boardBar). */
.board-bar { display: grid; grid-template-columns: auto auto 1fr; align-items: end; column-gap: 3vmin; padding-top: 2vmin; }
.board-now { font-family: "Oswald", sans-serif; font-weight: 600; text-transform: uppercase; font-size: 3.2vmin; line-height: 1; }
.board-bar .clock { font-size: 6vmin; margin: 0; }
.board-bar .rail { grid-column: 3; align-self: end; }

/* --- The phone remote (doc 120), on the host's phone ------------------------------------------- */

.remote {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  text-align: center;
}
.remote .eyebrow { color: var(--highlight); font-size: 0.8rem; }
.remote .notice, .remote .lede { font-size: 1.15rem; }
.remote .notice { margin-top: 30vh; }
.remote .lede { margin-top: 4vh; }
.remote .notice + *, .remote .lede + button { margin-top: 0; }
.remote h1 { font-size: 2.6rem; line-height: 1; }
.remote h1:focus { outline: none; }
.remote .count { color: var(--highlight); font-size: 0.85rem; }
.remote .clock { font-size: min(22vw, 116px); margin: 0; }
.remote .clock.over { color: var(--accent); }
.remote .clock.paused { opacity: 0.45; }
.remote .next { text-align: center; font-size: 0.8rem; }
.pad { display: flex; flex-wrap: wrap; gap: 10px; }
.pad button { flex: 1 1 0; }
.pad button, .remote > button { font-size: 1.25rem; padding: 0.9em 0.5em; }
.pad #ctl-next { flex-basis: 100%; order: -1; padding: 1.3em 0.5em; font-size: 1.5rem; }
.pad #ctl-board[aria-pressed="true"] { border-color: var(--highlight); color: var(--highlight); }
.roster { margin-top: 18px; text-align: left; }
.roster h2 { font-size: 1.2rem; }
.roster p { color: var(--muted); font-size: 0.85rem; margin: 0.2em 0 0.8em; }
.roster ul { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roster button { width: 100%; text-align: left; padding: 0.6em 0.8em; }
.roster strong { display: block; font-size: 0.95rem; }
.roster span { display: block; color: var(--muted); font-size: 0.75rem; line-height: 1.2; }
.ghosts .on button { border-color: var(--highlight); opacity: 0.6; }
.ghosts .on span { color: var(--highlight); letter-spacing: 0.18em; text-transform: uppercase; }
.coming .on button { border-color: var(--highlight); }
.coming li:not(.on) button { opacity: 0.45; text-decoration: line-through; }
.remote .line { color: var(--muted); font-size: 1.05rem; }

@media (prefers-reduced-motion: reduce) {
  .controls { transition: none; }
}

/* The page's static text says to reload if the modules never replace it: shown only after a wait, so
   a normal load never flashes it. */
.reload-hint { animation: reload-hint 0s 4s forwards; visibility: hidden; }
@keyframes reload-hint { to { visibility: visible; } }
