/* ==========================================================================
 * PHASE 8 -- EVENT MODE
 *
 * Three surfaces in one sheet: the player's phone (`.ev-*`), the
 * administrator's phone (`.aev-*`) and the television (`.host-*`, `.host__*`).
 *
 * --------------------------------------------------------------------------
 * EVERYTHING VISUAL IS IN HERE, BECAUSE IT HAS TO BE
 * --------------------------------------------------------------------------
 * `style-src 'self'` blocks inline styles SILENTLY -- `element.style.width` is
 * not an error, it simply never applies. So every size, colour and length that
 * varies at runtime is expressed as a CLASS rather than a style, which is why
 * the bar fills below are eleven classes in tenths rather than one width.
 *
 * That is the Phase 7.5 lesson (`badges.js`) and the Phase 7.6 one
 * (`daily-games-76.js`), written down a third time because this phase has more
 * runtime-varying visuals than any before it.
 *
 * --------------------------------------------------------------------------
 * PHONE FIRST: 320, 375 AND 390 (Part 36)
 * --------------------------------------------------------------------------
 * Every layout here starts single-column and stays inside 320px without
 * horizontal scroll. The two places that could overflow are the Pictionary
 * palette (seven swatches) and the Feud board (text plus a number), and both
 * use flex-wrap and `min-width: 0` rather than fixed widths.
 *
 * The TELEVISION is the exception and goes the other way: `.host` is a
 * two-column grid above 1024px -- the game on the stage, the standings on a
 * fixed-width rail -- because a TV is the one screen in this application that
 * is never narrow. See the Phase 8B host block for why the rail is clamped.
 * ======================================================================== */

:root {
  --ev-gap: 0.75rem;
  --ev-radius: 14px;

  --ev-live: #2e7d32;
  /*
   * PHASE 8E: THE ACCENT GREEN, FOR TEXT.
   *
   * `--ev-live` is a BACKGROUND colour -- it carries white text at 5.1:1 on the
   * phase pill and the buzzer, which is correct. It was also being used as a
   * FOREGROUND on the dark Event surfaces, where it measures 3.22:1 on
   * `--bg-elev` and 3.60:1 on `--bg`: below AA for body text, on the winner's
   * line, read from across a room. That is the Problem 3 defect.
   *
   * This is the same hue made light enough to be read rather than decorated
   * with: 10.6:1 on `--bg-elev` and 11.9:1 on `--bg`. Essential result content
   * uses `--text`/`--metal`; this is for the small accent that says WINNER.
   */
  --ev-win: #7fe3b0;
  /*
   * And the same correction for the other two saturated tokens, which were
   * also being used as foregrounds on the dark Event surfaces. The purple was
   * the worst of the three at 1.76:1 -- the Secret Missions label, effectively
   * invisible. These measure 8.6:1 and 9.3:1 on `--bg-elev`.
   *
   * The originals stay exactly as they are: as BACKGROUNDS behind white text
   * they are correct, and nothing about the phase pills or the buzzer changes.
   */
  --ev-fp-text: #d9a9f0;
  --ev-score-text: #8cc8ff;
  /*
   * And the amber and the red, which were the worst two of the five. The
   * URGENT CLOCK -- the number a room stares at in the last five seconds --
   * was `--ev-urgent` at 2.93:1.
   *
   * These are the project's OWN `--warn` and `--danger`, not new colours:
   * app.css already defines them for exactly this job, at 8.9:1 and 5.7:1, and
   * Event Mode had quietly grown a second, darker pair for text. Reusing the
   * real palette is the Phase 8B lesson in the other direction -- that phase
   * failed by reading tokens that did not exist, and this one was ignoring
   * tokens that did.
   */
  --ev-paused-text: var(--warn, #f0b429);
  --ev-urgent-text: var(--danger, #f2706b);
  --ev-paused: #b26a00;
  --ev-urgent: #c62828;
  --ev-score: #1565c0;
  --ev-fp: #6a1b9a;

  /* The Pictionary paper. Fixed in both themes -- see PAPER in the canvas. */
  --ev-paper: #fdfdfb;
}

/* ==========================================================================
 * THE PLAYER SCREEN
 * ======================================================================== */

[data-event="root"] {
  display: flex;
  flex-direction: column;
  gap: var(--ev-gap);
  /*
   * The 16px side gutter the rest of the app uses. Stated here rather than
   * inherited so the Event screen cannot be the one that touches the edges.
   */
  padding: 0 0 2rem;
}

.ev-empty,
.ev-waiting,
.ev-next,
.ev-join {
  color: var(--text, #eaf3f0);
  background: var(--bg-elev, #112220);
  border: 1px solid var(--line, #22413c);
  border-radius: var(--ev-radius);
  padding: 1rem;
  text-align: center;
}

.ev-empty h3,
.ev-waiting h4 {
  margin: 0 0 0.35rem;
}

.ev-empty p,
.ev-waiting p {
  margin: 0;
  color: var(--text-dim, #9fb8b2);
}

/* ------------------------------- header ---------------------------------- */

.ev-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ev-head__name {
  margin: 0;
  font-size: 1.05rem;
  /* `min-width: 0` so a long session name wraps instead of pushing the row. */
  min-width: 0;
  flex: 1 1 auto;
}

.ev-head__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--ev-paused);
  color: #fff;
}

.ev-phase {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--line, #22413c);
  color: var(--text, #eaf3f0);
}

/*
 * ONE RULE PER PHASE, INCLUDING THE QUIET ONES.
 *
 * `none`, `waiting` and `ended` want the neutral pill the base class already
 * gives them -- but they are written out rather than left to fall through,
 * because `phase8-ui.test.js` asserts that every phase `phaseClass()` can
 * produce has a rule here. A phase added later with no colour would otherwise
 * be invisible to that check.
 */
.ev-phase--none,
.ev-phase--waiting,
.ev-phase--ended { background: var(--line, #22413c); color: var(--text, #eaf3f0); }
.ev-phase--live { background: var(--ev-live); color: #fff; }
.ev-phase--paused,
.ev-phase--round-paused { background: var(--ev-paused); color: #fff; }
.ev-phase--results { background: var(--ev-score); color: #fff; }
.ev-phase--ready { background: var(--ev-fp); color: #fff; }

.ev-head__status {
  font-size: 0.68rem;
  color: var(--text-dim, #9fb8b2);
}

/* All four connection states, for the same reason the phases are all here. */
.ev-head__status--live { color: var(--ev-win); }
.ev-head__status--connecting { color: var(--text-dim, #9fb8b2); }
.ev-head__status--offline { color: var(--ev-urgent-text); }
.ev-head__status--polling { color: var(--ev-paused-text); }

/* -------------------------------- join ----------------------------------- */

.ev-join h3 {
  margin: 0 0 0.25rem;
  letter-spacing: 0.04em;
}

.ev-join__button {
  /* The one tap that matters on this screen when it is shown. */
  width: 100%;
  min-height: 58px;
  margin-top: 0.75rem;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}

/* ------------------------------- scores ---------------------------------- */

.ev-scores {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ev-gap);
  align-items: stretch;
}

.ev-scores__cell {
  color: var(--text, #eaf3f0);
  flex: 1 1 8rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--ev-radius);
  border: 1px solid var(--line, #22413c);
  background: var(--bg-elev, #112220);
}

/*
 * THE TWO NUMBERS ARE DELIBERATELY DIFFERENT COLOURS (Part 23).
 *
 * Event Score and FP must never be confusable, and on a phone glanced at
 * across a room colour does more of that work than wording. The FP cell is the
 * one with the unit in its value.
 */
.ev-scores__cell--eventScore { border-left: 4px solid var(--ev-score); }
.ev-scores__cell--fp { border-left: 4px solid var(--ev-fp); }

.ev-scores__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim, #9fb8b2);
}

.ev-scores__value {
  font-size: 1.5rem;
  line-height: 1.1;
}

.ev-scores__hint {
  font-size: 0.66rem;
  color: var(--text-dim, #9fb8b2);
}

.ev-scores__leave {
  flex: 0 0 auto;
  align-self: center;
}

/* -------------------------------- round ---------------------------------- */

.ev-round {
  color: var(--text, #eaf3f0);
  background: var(--bg-elev, #112220);
  border: 1px solid var(--line, #22413c);
  border-radius: var(--ev-radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ev-round__title { margin: 0; }
.ev-round__subtitle,
.ev-round__blocked {
  margin: 0;
  color: var(--text-dim, #9fb8b2);
  font-size: 0.85rem;
}

.ev-round__blocked { color: var(--ev-paused-text); }

.ev-next__game {
  font-size: 1.3rem;
  margin: 0.2rem 0;
}

/* -------------------------------- clock ---------------------------------- */

.ev-clock {
  font-variant-numeric: tabular-nums;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  color: var(--text, #eaf3f0);
}

.ev-clock--idle { color: var(--text-faint, #6d8882); font-size: 1rem; }
.ev-clock--soon { color: var(--ev-paused-text); }
/* Phase 8E: was --ev-urgent at 2.93:1 -- the one number everybody reads. */
.ev-clock--urgent { color: var(--ev-urgent-text); }

/* ------------------------------- buzzer ---------------------------------- */

/*
 * THE LARGEST TAPPABLE THING IN THE APPLICATION, on purpose. It is pressed in
 * a hurry, in a crowded room, by people of every age -- so it is full width,
 * 96px tall, and its label is the only text on it.
 */
.ev-buzz {
  width: 100%;
  min-height: 96px;
  border: none;
  border-radius: var(--ev-radius);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--text-faint, #6d8882);
  cursor: pointer;
  /* No tap highlight or text selection on a button people will hammer. */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.ev-buzz--ready { background: var(--ev-urgent); }
.ev-buzz--yours { background: var(--ev-live); }
.ev-buzz--taken { background: var(--ev-score); }
.ev-buzz--locked,
.ev-buzz--idle { background: var(--line, #22413c); color: var(--text-dim, #9fb8b2); }

.ev-buzz:disabled { cursor: default; }

.ev-trivia__prompt,
.ev-showdown__prompt,
.ev-feud__prompt,
.ev-pict__prompt {
  color: var(--text, #eaf3f0);
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 0;
}

.ev-trivia__position,
.ev-trivia__hint,
.ev-showdown__locked,
.ev-pict__rules,
.ev-pict__shout,
.ev-feud__say {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim, #9fb8b2);
}

.ev-trivia__answer {
  display: flex;
  gap: 0.5rem;
}

.ev-trivia__answer .input { flex: 1 1 auto; min-width: 0; }

.ev-trivia__history {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
}

.ev-trivia__history li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: var(--text-dim, #9fb8b2);
}

.ev-trivia__history b { color: var(--text, #eaf3f0); }

/* ------------------------------ showdown --------------------------------- */

.ev-showdown__options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* 48px minimum, which is the ballot-tap size Phase 7.8 established. */
.ev-option {
  min-height: 52px;
  padding: 0.6rem 0.9rem;
  border-radius: var(--ev-radius);
  border: 2px solid var(--line, #22413c);
  background: var(--bg-elev, #112220);
  color: var(--text, #eaf3f0);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}

.ev-option--chosen {
  border-color: var(--ev-live);
  background: color-mix(in srgb, var(--ev-live) 24%, var(--bg-elev, #112220));
  font-weight: 700;
}

.ev-option:disabled { cursor: default; opacity: 0.75; }

/* ------------------------------ bar charts ------------------------------- */

.ev-bars,
.host__bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ev-bars__row,
.host__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4rem 2rem;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.ev-bars__bar,
.host__bar-fill {
  height: 10px;
  border-radius: 999px;
  background: var(--line, #22413c);
  display: block;
}

/*
 * ELEVEN CLASSES, IN TENTHS. This is the CSP workaround: a bar's length cannot
 * be `element.style.width`, so the renderer rounds the proportion to a tenth
 * and picks a class. Ten steps is plenty for a family of eight.
 */
.ev-bars__bar--0,  .host__bar-fill--0  { width: 2px; }
.ev-bars__bar--1,  .host__bar-fill--1  { width: 10%; }
.ev-bars__bar--2,  .host__bar-fill--2  { width: 20%; }
.ev-bars__bar--3,  .host__bar-fill--3  { width: 30%; }
.ev-bars__bar--4,  .host__bar-fill--4  { width: 40%; }
.ev-bars__bar--5,  .host__bar-fill--5  { width: 50%; }
.ev-bars__bar--6,  .host__bar-fill--6  { width: 60%; }
.ev-bars__bar--7,  .host__bar-fill--7  { width: 70%; }
.ev-bars__bar--8,  .host__bar-fill--8  { width: 80%; }
.ev-bars__bar--9,  .host__bar-fill--9  { width: 90%; }
.ev-bars__bar--10, .host__bar-fill--10 { width: 100%; }

.ev-bars__row--won .ev-bars__bar,
.host__bar--won .host__bar-fill { background: var(--ev-live); }

.ev-bars__row--won,
.host__bar--won { font-weight: 700; }

/* --------------------------------- feud ---------------------------------- */

.ev-feud__teams,
.ev-pict__teams {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ev-feud__team {
  color: var(--text, #eaf3f0);
  flex: 1 1 7rem;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--line, #22413c);
}

.ev-feud__team--yours,
.ev-pict__team--yours {
  border-color: var(--ev-live);
  font-weight: 700;
}

.ev-pict__team {
  color: var(--text, #eaf3f0);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line, #22413c);
  font-size: 0.85rem;
}

.ev-board,
.host__board {
  list-style: none;
  counter-reset: board;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ev-board__row,
.host__board-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  min-height: 42px;
  padding: 0.35rem 0.7rem;
  border-radius: 10px;
  background: var(--line-soft, #1b332f);
  color: var(--text-faint, #6d8882);
  letter-spacing: 0.2em;
}

.ev-board__row--shown,
.host__board-row--shown {
  background: var(--ev-score);
  color: #fff;
  letter-spacing: normal;
  font-weight: 600;
}

.ev-board__row--missed,
.host__board-row--missed {
  background: var(--text-faint, #6d8882);
  color: #fff;
  font-style: italic;
}

.ev-feud__strikes,
.host__strikes {
  margin: 0;
  text-align: center;
  color: var(--ev-urgent-text);
  font-weight: 700;
  letter-spacing: 0.35em;
  font-size: 1.3rem;
  min-height: 1.4rem;
}

/* -------------------------------- minute --------------------------------- */

.ev-minute__instructions { margin: 0; line-height: 1.4; }
.ev-minute__kit,
.ev-minute__heat,
.ev-minute__yours {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim, #9fb8b2);
}

.ev-minute__yours { color: var(--ev-win); font-weight: 600; }

.ev-standings,
.host__standings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/*
 * THE SAME RANK CONTRACT AS EVERY OTHER PLACEMENT ROW (Phase 8E, Problem 1).
 *
 * This row shipped with a `3.2rem` rank column, which is the reported defect:
 * at 0.9rem that track is 3.56em, and "T-10th" does not fit in it, so the
 * placement ran into the name. `minmax(4.2em, max-content)` gives it a floor
 * wide enough for the longest label this screen can produce and lets it grow
 * past that rather than overlap -- and the NAME stays the only column that
 * shrinks.
 */
.ev-standings__row {
  display: grid;
  grid-template-columns: minmax(4.2em, max-content) minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
}

.ev-standings__place { color: var(--text-dim, #9fb8b2); font-size: 0.8rem; }

/* ------------------------------ pictionary ------------------------------- */

/*
 * THE CANVAS IS SIZED BY CSS AND MEASURED BY JAVASCRIPT.
 *
 * `event-canvas.js` reads this laid-out size and sets the backing store through
 * the width/height ATTRIBUTES -- which are element properties, not styles, so
 * the CSP does not touch them. A canvas sized with `style.width` would simply
 * never appear.
 *
 * `aspect-ratio` keeps the shape identical on every phone, which matters more
 * than it sounds: normalised coordinates replay into whatever rectangle they
 * are given, so a drawer on a tall phone and a television on a wide screen
 * would otherwise see differently-stretched pictures.
 */
.ev-canvas,
.host__canvas {
  color: var(--text, #eaf3f0);
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--ev-paper);
  border-radius: var(--ev-radius);
  border: 1px solid var(--line, #22413c);
  /* A drawing surface must not scroll the page while a finger is on it. */
  touch-action: none;
}

.ev-pict__who {
  margin: 0;
  font-weight: 700;
}

/*
 * THE DRAWER'S WORD -- the second of two rules for this class.
 *
 * The first, in the shared game-text block above, sets the readable colour.
 * This one gives it the tinted panel it sits in, and REPEATS the colour rather
 * than inheriting it, because this rule changes the background and a surface
 * must establish its own foreground. Relying on inheritance across a surface
 * change is exactly what made Phase 8's cards unreadable on a real phone.
 *
 * The tint mixes towards the CARD, not towards `transparent`: mixing with
 * transparent produces a semi-transparent fill whose apparent colour depends
 * on whatever is behind it, which is how a "subtle" panel becomes an invisible
 * one.
 */
.ev-pict__prompt {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  color: var(--text, #eaf3f0);
  background: color-mix(in srgb, var(--ev-fp) 22%, var(--bg-elev, #112220));
  border: 1px dashed var(--ev-fp);
  font-size: 1.3rem;
  text-align: center;
  font-weight: 700;
}

.ev-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ev-tools__palette,
.ev-tools__widths,
.ev-tools__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/*
 * SEVEN SWATCHES, ONE CLASS EACH.
 *
 * The colour cannot be `element.style.background`, so each swatch's colour is a
 * class named after its hex. The last one is the ERASER -- it is the paper
 * colour, and it gets a visible border so it is not an invisible button.
 */
.ev-swatch {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
}

.ev-swatch--1b1b1b { background: #1b1b1b; }
.ev-swatch--c62828 { background: #c62828; }
.ev-swatch--1565c0 { background: #1565c0; }
.ev-swatch--2e7d32 { background: #2e7d32; }
.ev-swatch--f9a825 { background: #f9a825; }
.ev-swatch--6a1b9a { background: #6a1b9a; }
.ev-swatch--fdfdfb {
  background: var(--ev-paper);
  border-color: var(--text-faint, #6d8882);
  border-style: dashed;
}

.ev-swatch--on {
  border-color: var(--text, #eaf3f0);
  border-style: solid;
  transform: scale(1.1);
}

.ev-width {
  color: var(--text, #eaf3f0);
  width: 44px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line, #22413c);
  background: var(--bg-elev, #112220);
  cursor: pointer;
  position: relative;
}

/* The three widths as a visible line inside the button. */
.ev-width::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  top: 50%;
  border-radius: 999px;
  background: var(--text, #eaf3f0);
}

.ev-width--0::after { height: 2px; margin-top: -1px; }
.ev-width--1::after { height: 5px; margin-top: -2px; }
.ev-width--2::after { height: 9px; margin-top: -4px; }

.ev-width--on { border-color: var(--text, #eaf3f0); border-width: 2px; }

/* ------------------------------- missions -------------------------------- */

.ev-missions {
  color: var(--text, #eaf3f0);
  background: var(--bg-elev, #112220);
  border: 1px solid var(--line, #22413c);
  border-radius: var(--ev-radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ev-missions h4 {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--text-dim, #9fb8b2);
}

.ev-missions__counts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.ev-missions__mine,
.ev-missions__confirm {
  color: var(--text, #eaf3f0);
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--ev-fp);
  background: color-mix(in srgb, var(--ev-fp) 18%, var(--bg-elev, #112220));
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ev-missions__label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  /* Phase 8E: was `--ev-fp` at 1.76:1 -- unreadable rather than merely dim. */
  color: var(--ev-fp-text);
  font-weight: 700;
}

.ev-missions__text,
.ev-missions__question {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.ev-missions__done {
  margin: 0;
  color: var(--ev-win);
  font-weight: 700;
}

.ev-missions__buttons {
  display: flex;
  gap: 0.5rem;
}

.ev-missions__buttons .btn { flex: 1 1 0; min-height: 48px; }

/* ------------------------------- results --------------------------------- */

.ev-results,
.ev-board-panel {
  color: var(--text, #eaf3f0);
  background: var(--bg-elev, #112220);
  border: 1px solid var(--line, #22413c);
  border-radius: var(--ev-radius);
  padding: 0.9rem;
}

.ev-results h4,
.ev-board-panel h4 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--text-dim, #9fb8b2);
}

.ev-results__list,
.ev-leaders {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ev-results__row,
.ev-leaders__row {
  display: grid;
  /*
   * Phase 8E: content-sized, exactly as the host's rows are. `3.4rem` was
   * measured against "1st" and "Joint 1st" overflowed it onto the name -- the
   * same defect as the television, on the phone.
   */
  grid-template-columns: minmax(4.2em, max-content) minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.3rem 0;
}

.ev-leaders__row { grid-template-columns: minmax(4.2em, max-content) minmax(0, 1fr) auto; }

/*
 * The player's own results row carried the identical defect to the host's --
 * see `.host__results-row--won`. Light text, green as an accent border.
 */
.ev-results__row--won {
  font-weight: 700;
  color: var(--text, #eaf3f0);
  background: color-mix(in srgb, var(--ev-live) 20%, var(--bg-elev, #112220));
  border-left: 3px solid var(--ev-win);
  border-radius: 8px;
  padding-left: 0.4rem;
}

/*
 * Phase 8E: `.ev-results__row span:first-child` is gone. A positional selector
 * could only ever style one cell, said nothing about the name or the score, and
 * would have silently moved to the wrong element the first time anything was
 * inserted ahead of it.
 */
.ev-leaders__place,
.ev-results__place {
  font-size: 0.78rem;
  color: var(--text-dim, #9fb8b2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ev-results__name {
  color: var(--text, #eaf3f0);
  min-width: 0;
  /* A long display name truncates rather than pushing the score off a 320. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-results__score,
.ev-results__fp {
  color: var(--text, #eaf3f0);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.ev-leaders__row--away { opacity: 0.55; }

.ev-results__note,
.ev-board-panel__note {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  color: var(--text-dim, #9fb8b2);
}

/* ==========================================================================
 * THE HOME BANNER (Part 5)
 * ======================================================================== */

.ev-home {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem;
  border-radius: var(--ev-radius);
  color: #fff;
  background: linear-gradient(135deg, var(--ev-live), var(--ev-score));
}

.ev-home--paused {
  background: linear-gradient(135deg, var(--ev-paused), #8d5600);
}

.ev-home__headline {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}

.ev-home__name,
.ev-home__detail {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.95;
}

.ev-home__label {
  align-self: flex-start;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

/*
 * AN ANCHOR, STYLED AS THE ONE BUTTON ON THE BANNER.
 *
 * `event-banner.js` renders a link rather than a `<button>` -- it changes the
 * route and nothing else -- so this has to supply the box an `<a>` does not
 * have: the height, the centring and the loss of the underline.
 */
.ev-home__button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  margin-top: 0.4rem;
  min-height: 52px;
  width: 100%;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: var(--text, #eaf3f0);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 1rem;
  cursor: pointer;
}

.ev-home__count {
  font-size: 0.72rem;
  opacity: 0.9;
}

/* ==========================================================================
 * THE ADMIN CONTROL SCREEN
 * ======================================================================== */

[data-adminevent="root"] {
  display: flex;
  flex-direction: column;
  gap: var(--ev-gap);
  padding-bottom: 2rem;
}

.aev-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.aev-head h3 { margin: 0; flex: 1 1 auto; min-width: 0; }

.aev-head__phase,
.aev-head__status {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim, #9fb8b2);
}

.aev-panel {
  color: var(--text, #eaf3f0);
  background: var(--bg-elev, #112220);
  border: 1px solid var(--line, #22413c);
  border-radius: var(--ev-radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.aev-panel--attention { border-color: var(--ev-urgent); }

.aev-panel h4 { margin: 0; font-size: 0.95rem; }
.aev-panel h5 { margin: 0; font-size: 0.8rem; color: var(--text-dim, #9fb8b2); }

.aev-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-dim, #9fb8b2);
}

.aev-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.aev-facts li {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  color: var(--text-dim, #9fb8b2);
}

.aev-facts b { font-size: 1rem; color: var(--text, #eaf3f0); }

.aev-actions,
.aev-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Every admin control is at least 44px tall: it is pressed in a hurry. */
.aev-actions .btn,
.aev-controls .btn { min-height: 44px; }

.aev-roster,
.aev-teams__list,
.aev-history,
.aev-missions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
}

.aev-roster__row {
  color: var(--text, #eaf3f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 40px;
}

.aev-roster__row--away { opacity: 0.6; }

.aev-participants__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.aev-check {
  color: var(--text, #eaf3f0);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0 0.6rem;
  border: 1px solid var(--line, #22413c);
  border-radius: 999px;
  font-size: 0.85rem;
}

.aev-games {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 420px) {
  .aev-games { grid-template-columns: 1fr 1fr; }
}

.aev-gamecard {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
  padding: 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line, #22413c);
  background: var(--bg-elev, #112220);
  color: var(--text, #eaf3f0);
  min-height: 72px;
  cursor: pointer;
}

.aev-gamecard span { font-size: 0.78rem; color: var(--text-dim, #9fb8b2); }
.aev-gamecard small { font-size: 0.68rem; color: var(--text-faint, #6d8882); }

.aev-game {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line, #22413c);
}

.aev-game__prompt {
  color: var(--text, #eaf3f0); margin: 0; font-weight: 600; }

/*
 * THE ANSWER THE ADMINISTRATOR IS ALLOWED TO SEE.
 *
 * Marked visually as privileged so whoever is holding the phone knows not to
 * show it around -- it is the one thing on any screen in this phase that is
 * secret from the room rather than from the player.
 */
.aev-game__answer {
  margin: 0;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ev-urgent) 20%, var(--bg-elev, #112220));
  border-left: 3px solid var(--ev-urgent);
  font-weight: 700;
}

.aev-game__holder,
.aev-game__order {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim, #9fb8b2);
}

.aev-board {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.aev-board .btn { width: 100%; text-align: left; min-height: 40px; }

.aev-minute {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.aev-minute__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.aev-minute__row > span:first-child {
  flex: 1 1 6rem;
  min-width: 0;
  font-size: 0.88rem;
}

.input--tiny { width: 5.5rem; }

.aev-pending {
  color: var(--text, #eaf3f0);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ev-urgent) 18%, var(--bg-elev, #112220));
}

.aev-pending p { margin: 0; flex: 1 1 10rem; min-width: 0; font-size: 0.85rem; }

.aev-missions li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line-soft, #1b332f);
}

.aev-missions li span { flex: 1 1 10rem; min-width: 0; font-size: 0.82rem; }

.aev-results ol,
.aev-leaders {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
}

/*
 * THE ADMINISTRATOR'S LEADERBOARD, under the same rank contract (Problem 1).
 * It had the same `3.2rem` track, and the administrator's phone is the
 * narrowest screen in the house -- so it is the one most likely to overlap.
 */
.aev-leaders li {
  display: grid;
  grid-template-columns: minmax(4.2em, max-content) minmax(0, 1fr) auto auto;
  gap: 0.4rem;
  align-items: center;
  min-height: 40px;
}

/* ==========================================================================
 * THE HOST SCREEN (a television)
 * ======================================================================== */

/*
 * --------------------------------------------------------------------------
 * THE HOST ROUTE LEAVES THE PHONE SHELL (Phase 8B, Problem 3)
 * --------------------------------------------------------------------------
 * `app.css` caps `.main` at 720px and reserves the tab bar's height at the
 * bottom, which is right for a phone and wrong for a projector: on a 1920-wide
 * television the playtest saw a cramped game panel, a scoreboard squeezed to
 * one character per line, and the mobile navigation sitting over the content.
 *
 * `app.js` publishes the route onto the root element, so the television -- and
 * ONLY the television -- opts out:
 *
 *   * the width cap and the gutters go, because the TV has no thumbs;
 *   * the tab-bar reservation goes, because the tab bar goes;
 *   * the animation goes, because a rise-in on a wall screen reads as a glitch.
 *
 * Everything here is scoped to `[data-route="host"]`. No other screen can be
 * affected by it, which is why it is safe to be this blunt.
 */
:root[data-route="host"] .tabbar { display: none; }

:root[data-route="host"] .main {
  max-width: none;
  padding: 0;
}

:root[data-route="host"] .view { animation: none; }

[data-host="root"],
.host {
  display: grid;
  /*
   * ONE COLUMN BY DEFAULT, which is the narrow-window case: a browser window
   * dragged small, or somebody opening the TV screen on a laptop. The game
   * stacks above the scoreboard rather than both being crushed, which is what
   * Part 2 asks for.
   */
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(0.75rem, 1.5vw, 1.75rem);
  padding: clamp(0.75rem, 1.6vw, 2rem);
  min-height: 100vh;
  align-content: start;
  color: var(--text, #eaf3f0);
  /* A television is read from across a room: the floor is bigger than a phone's. */
  font-size: clamp(1rem, 1.1vw, 1.5rem);
}

/*
 * THE ONE PLACE THIS APPLICATION GOES WIDE.
 *
 * At 1024 and up -- which covers 1280x720, 1366x768 and 1920x1080 -- the
 * television becomes the composition Part 2 specifies: the game across roughly
 * three quarters, the standings down a fixed-width rail beside it.
 *
 * The rail is `clamp`ed rather than a bare percentage, and that is the fix for
 * "player names wrapping one character per line": a 20% column on a 1280 window
 * is 256px, which after padding is not enough for a name and a score, so the
 * name wrapped to nothing. A floor of 260px means the rail is always wide
 * enough to hold a row; a ceiling of 420px stops it stealing the game's space
 * on a 4K panel.
 */
@media (min-width: 1024px) {
  [data-host="root"],
  .host {
    grid-template-columns: minmax(0, 1fr) clamp(260px, 24%, 420px);
    align-items: start;
  }
}

.host__head {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
}

.host__name { margin: 0; font-size: clamp(1.6rem, 4vw, 3rem); }

.host__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--ev-paused);
  color: #fff;
}

.host__here { font-size: clamp(0.9rem, 1.6vw, 1.2rem); color: var(--text-dim, #9fb8b2); }

.host__head .ev-clock { font-size: clamp(2rem, 5vw, 4rem); margin-left: auto; }

.host__big,
.host__lobby,
.host__ready,
.host__round,
.host__results,
.host__final {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.host__big h1 { margin: 0; font-size: clamp(2rem, 7vw, 5rem); letter-spacing: 0.04em; }
.host__big p { margin: 0; font-size: clamp(1rem, 2.2vw, 1.6rem); color: var(--text-dim, #9fb8b2); }

.host__kicker {
  margin: 0;
  font-size: clamp(0.8rem, 1.6vw, 1.1rem);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim, #9fb8b2);
}

.host__prompt {
  margin: 0;
  font-size: clamp(1.5rem, 4.2vw, 3.4rem);
  line-height: 1.2;
}

.host__counter,
.host__locked,
.host__blurb {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.4rem);
  color: var(--text-dim, #9fb8b2);
}

.host__buzz {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-faint, #6d8882);
}

.host__buzz--taken { color: var(--ev-urgent-text); }

.host__roster,
.host__options,
.host__recent,
.host__results-live {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: clamp(1rem, 2.4vw, 1.8rem);
}

.host__options { flex-direction: column; }

.host__teams {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.host__team {
  color: var(--text, #eaf3f0);
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-radius: var(--ev-radius);
  border: 2px solid var(--line, #22413c);
}

.host__team h3 { margin: 0 0 0.35rem; font-size: clamp(1.1rem, 2.4vw, 1.8rem); }
.host__team ul { list-style: none; margin: 0; padding: 0; font-size: clamp(0.9rem, 1.8vw, 1.3rem); }

.host__feud-teams,
.host__pict-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: clamp(1.1rem, 2.6vw, 2rem);
}

.host__feud-team {
  flex: 1 1 10rem;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 10px;
  border: 2px solid var(--line, #22413c);
}

.host__board-row {
  min-height: clamp(44px, 6vh, 72px);
  font-size: clamp(1rem, 2.4vw, 1.9rem);
}

.host__bar { font-size: clamp(1rem, 2.2vw, 1.6rem); grid-template-columns: minmax(0, 1fr) 8rem 3rem; }
.host__bar-fill { height: 18px; }

.host__results-list,
.host__final-list,
.host__leaders {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/*
 * --------------------------------------------------------------------------
 * PLACE | PLAYER | SCORE -- SIZED FROM CONTENT (Phase 8E, Problem 1)
 * --------------------------------------------------------------------------
 * The rank track used to be a fixed `4.5rem` here and a fixed `2.6em` on the
 * rail below. Both were measured against "1st". `placementLabel` also returns
 * "Joint 1st" and could return "Joint 10th", which is roughly twice as wide --
 * and because the rank cell is `white-space: nowrap` with nothing telling it to
 * contain itself, grid let the text OVERFLOW its track and land on the player's
 * name. That is the reported collision, and it was a layout that could only
 * ever have worked for the short label.
 *
 * `minmax(4.5em, max-content)` fixes the class of mistake rather than the
 * instance: the floor keeps the ranks aligned down the column for the ordinary
 * case, and `max-content` means a longer label widens the track instead of
 * escaping it. No label can overflow, whatever a future `placementLabel`
 * returns, because the column is now measured from what is actually in it.
 *
 * The NAME is the only track allowed to shrink -- `minmax(0, 1fr)` with an
 * ellipsis -- because a name is the one cell a reader can still identify when
 * it is clipped. A clipped rank or a clipped score is useless.
 */
.host__results-list li,
.host__final-list li,
.host__leaders li {
  display: grid;
  grid-template-columns: minmax(4.5em, max-content) minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  align-items: baseline;
  font-size: clamp(1rem, 2.2vw, 1.7rem);
}

/*
 * THE CELLS, NAMED (Phase 8E).
 *
 * The results and final lists appended four unclassed children and leaned
 * entirely on child order. Phase 8B named the rail's cells for exactly this
 * reason and did not come back for these two, so they kept the original
 * defect: nothing told the name it could truncate, and nothing kept the score
 * on one line. Named cells also mean a test can assert the three are separate
 * elements rather than inferring it from a grid definition.
 */
.host__row-rank,
.host__leader-rank {
  color: var(--text-dim, #9fb8b2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.host__row-name,
.host__leader-name {
  color: var(--text, #eaf3f0);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host__row-score,
.host__row-fp,
.host__leader-score {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

/*
 * --------------------------------------------------------------------------
 * THE SCOREBOARD RAIL (Phase 8B, Problem 3)
 * --------------------------------------------------------------------------
 * The playtest reported player names wrapping one character per line and
 * scores colliding with them. Three things caused it, and all three are fixed
 * here:
 *
 *   1. the row's font was sized off the VIEWPORT (`2.2vw`), so on a 1920 TV it
 *      was ~42px inside a rail of ~300px -- six characters wide. The rail's
 *      type is now sized in its own terms and capped;
 *   2. the rank column was a fixed 4rem of that oversized type, taking most of
 *      the rail before the name started;
 *   3. nothing told the name it could truncate, so it wrapped instead.
 *
 * A name now ELLIPSES, a score keeps its width in tabular figures, and the
 * three columns cannot collide.
 */
/*
 * The rail is three columns, not four, and its type is smaller -- but the rank
 * track is sized the same way, from content. The `2.6em` that used to be here
 * is what "Joint 1st" overflowed.
 */
.host__leaders li {
  grid-template-columns: minmax(4.2em, max-content) minmax(0, 1fr) auto;
  gap: 0.5em;
  align-items: baseline;
  font-size: clamp(0.95rem, 1.5vw, 1.45rem);
  padding: 0.12em 0;
}

/* Smaller than the row it sits in, which is why it has its own font-size. */
.host__leader-rank { font-size: 0.8em; }

/*
 * --------------------------------------------------------------------------
 * THE WINNER'S LINE (Phase 8E, Problem 3)
 * --------------------------------------------------------------------------
 * This was `color: var(--ev-live)` -- #2e7d32 on a dark panel, measured at
 * 3.22:1. It is the single most important line on the results screen and it was
 * the least readable one, which is how it reached a playtest.
 *
 * The text is now `--text` at 14.6:1 and the green has become what it is good
 * at: an accent. A left border and a tint mixed TOWARDS THE CARD (never
 * towards `transparent`, which is the Phase 8B lesson) mark the row without
 * touching the legibility of a single character.
 *
 * The rule changes the background, so it also sets `color` -- the other half of
 * the Phase 8B rule: never inherit a foreground across a surface change.
 */
.host__results-row--won {
  font-weight: 700;
  color: var(--text, #eaf3f0);
  background: color-mix(in srgb, var(--ev-live) 22%, var(--bg-elev, #112220));
  border-left: 4px solid var(--ev-win);
  border-radius: 8px;
  padding: 0.25em 0.5em;
}

/* The winner's own cells stay light; `--ev-win` is the accent, not the text. */
.host__results-row--won .host__row-rank { color: var(--ev-win); }
.host__results-row--won .host__row-score,
.host__results-row--won .host__row-name { color: var(--text, #eaf3f0); }

.host__final h1 { margin: 0; font-size: clamp(2rem, 6vw, 4.5rem); }

.host__aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.host__board-panel,
.host__missions {
  color: var(--text, #eaf3f0);
  padding: 0.9rem 1.1rem;
  border-radius: var(--ev-radius);
  border: 1px solid var(--line, #22413c);
  background: var(--bg-elev, #112220);
}

.host__board-panel h3,
.host__missions h3 {
  margin: 0 0 0.5rem;
  font-size: clamp(0.8rem, 1.4vw, 1.1rem);
  letter-spacing: 0.1em;
  color: var(--text-dim, #9fb8b2);
}

.host__missions ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: clamp(0.9rem, 1.6vw, 1.2rem);
}

.host__mission-done {
  color: var(--text, #eaf3f0);
  margin-top: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ev-live) 24%, var(--bg-elev, #112220));
  border-left: 4px solid var(--ev-live);
}

/* Phase 8E: the light accent green, for the reason given on --ev-win. */
.host__mission-done b { display: block; font-size: 0.8rem; letter-spacing: 0.08em; color: var(--ev-win); }
.host__mission-done p { margin: 0.2rem 0 0; font-size: clamp(0.85rem, 1.5vw, 1.1rem); }

.host__playing { margin: 0; font-size: clamp(1rem, 2vw, 1.5rem); }

/* ==========================================================================
 * THE PER-GAME WRAPPERS
 *
 * One class per game, on the box each game's panel is painted into. They all
 * want the same thing -- a single column with a consistent gap -- and they are
 * named separately anyway, because a game-specific rule added later has
 * somewhere obvious to go and because `phase8-ui.test.js` asserts that every
 * class the painters use is defined here.
 * ======================================================================== */

.ev-trivia,
.ev-showdown,
.ev-feud,
.ev-minute,
.ev-pict,
.ev-mission {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.ev-showdown__reveal {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px dashed var(--line, #22413c);
}

.ev-leaders__name {
  color: var(--text, #eaf3f0);
  min-width: 0;
  /* A long display name truncates rather than pushing the score off a 320. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-leaders__score {
  color: var(--text, #eaf3f0);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}

/* The television's five. Same single column, larger gap: it is read from the
 * other side of a room, not from a hand. */
.host__trivia,
.host__showdown,
.host__feud,
.host__minute,
.host__pict {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

/* The administrator's three composite panels. `aev-round` is always paired
 * with `aev-panel`, so it carries only what is specific to it. */
.aev-round { gap: 0.75rem; }

.aev-participants,
.aev-teams {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

/* ==========================================================================
 * DARK MODE
 *
 * Guarded exactly as the rest of this project's sheets are, so an explicit
 * light choice wins over the OS preference.
 * ======================================================================== */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ev-live: #66bb6a;
    --ev-paused: #ffb74d;
    --ev-urgent: #ef5350;
    --ev-score: #64b5f6;
    --ev-fp: #ba68c8;
  }
}

:root[data-theme="dark"] {
  --ev-live: #66bb6a;
  --ev-paused: #ffb74d;
  --ev-urgent: #ef5350;
  --ev-score: #64b5f6;
  --ev-fp: #ba68c8;
}

/*
 * THE PICTIONARY PAPER DOES NOT FOLLOW THE THEME, and that is deliberate.
 *
 * `--ev-paper` is absent from both dark-mode blocks above. The eraser is a
 * stroke in the paper colour (see PAPER in pictionary-service.js), so a paper
 * colour that changed with the OS theme would stop the eraser erasing -- and
 * would change what every stroke already drawn looked like, halfway through
 * somebody's turn, differently on each device in the room.
 */

/* ==========================================================================
 * REDUCED MOTION
 * ======================================================================== */

@media (prefers-reduced-motion: reduce) {
  .ev-swatch--on { transform: none; }
}

/* ==========================================================================
 * PHASE 8B -- THE TELEVISION, AND THE STRIKE EFFECT
 * ========================================================================== */

/*
 * THE RAIL AND THE STAGE, NAMED.
 *
 * `.host__aside` is the scoreboard rail; everything else in the grid is the
 * stage. The stage gets `min-width: 0` so a long question cannot push the rail
 * off the screen -- a grid child's default `min-width: auto` lets its content
 * win, which is the other half of why the scoreboard was being crushed.
 */
[data-host="root"] > *:not(.host__head):not(.host__aside) {
  min-width: 0;
  max-width: 100%;
}

.host__aside {
  min-width: 0;
  /* On a television the rail is a panel, not a column of loose text. */
  gap: clamp(0.5rem, 1vw, 1.25rem);
}

/*
 * THE TOP BAR holds the session, the game and the clock, and it spans both
 * columns. `space-between` puts the clock hard right where an eye can find it
 * without reading the rest.
 */
.host__head {
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--line, #22413c);
}

/*
 * THE STAGE'S TYPE IS SIZED FOR A ROOM, and capped so a 4K panel does not
 * render a two-word question at 200px. `ch`-based ceilings keep a long prompt
 * on two or three lines instead of breaking mid-word, which is what the
 * playtest meant by "question text breaking awkwardly".
 */
.host__prompt {
  max-width: 34ch;
  margin-inline: auto;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.host__big h1,
.host__final h1 {
  text-wrap: balance;
  overflow-wrap: break-word;
}

/* The board and the options are the dominant element on their screens. */
.host__board,
.host__options {
  width: 100%;
}

.host__board-row {
  padding-inline: clamp(0.6rem, 1.2vw, 1.4rem);
}

/* The canvas takes the stage, and keeps its shape. */
.host__canvas {
  width: 100%;
  max-height: 70vh;
  margin-inline: auto;
}

/*
 * NARROWER THAN A TELEVISION: a browser window dragged small, or a laptop.
 * The rail moves BELOW the stage rather than being squeezed beside it, which
 * is Part 2's "stack sections deliberately rather than crushing the
 * scoreboard".
 */
@media (max-width: 1023px) {
  .host__head .ev-clock { font-size: clamp(1.6rem, 6vw, 2.6rem); }
  .host__aside {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .host__board-panel,
  .host__missions { flex: 1 1 16rem; min-width: 0; }
}

/* ==========================================================================
 * THE STRIKE: A LARGE RED X (Phase 8B, Problem 6)
 * ==========================================================================
 *
 * The strikes used to be a line of small red text in the content flow, which
 * the playtest described as "tiny and easy to miss". A strike is the loudest
 * moment in this game, so on the television it is an OVERLAY: it covers the
 * stage, it is unmissable from across a room, and it takes itself away.
 *
 * `position: fixed` over the whole viewport, because the television has no
 * other job while this is happening.
 */
.host__strike-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1vh;
  /* Dark enough to read against, translucent enough to keep the board visible. */
  background: rgb(0 0 0 / 0.55);
  pointer-events: none;
}

.host__strike-marks {
  display: flex;
  gap: clamp(1rem, 4vw, 5rem);
  line-height: 1;
}

/*
 * ONE X PER STRIKE, so the room can count them: X, then X X, then X X X.
 * Sized off the VIEWPORT because that is exactly the case where viewport units
 * are right -- this is meant to fill a television.
 */
.host__strike-x {
  font-size: clamp(5rem, 26vh, 18rem);
  font-weight: 900;
  color: var(--ev-urgent-text);
  text-shadow: 0 0 2vh rgb(0 0 0 / 0.8);
  animation: host-strike-pop 320ms ease-out both;
}

.host__strike-word {
  font-size: clamp(1.2rem, 4vh, 3rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 1vh rgb(0 0 0 / 0.9);
}

@keyframes host-strike-pop {
  from { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  to   { transform: scale(1); opacity: 1; }
}

/*
 * The strikes that stay on the board between questions, as marks rather than a
 * number -- large enough to see, but not the overlay.
 */
.host__strikes {
  font-size: clamp(1.8rem, 5vh, 4rem);
  letter-spacing: 0.3em;
}

@media (prefers-reduced-motion: reduce) {
  .host__strike-x { animation: none; }
}

/* ==========================================================================
 * THE ADMINISTRATOR'S BIG CONTROL (Phase 8B, Problem 5)
 * ========================================================================== */

/*
 * WRONG ANSWER is pressed in a hurry, while talking, without looking down. It
 * gets its own row and the height of a thing you hit with a thumb.
 */
.aev-controls--headline {
  margin: 0.2rem 0 0.1rem;
}

.aev-bigbutton {
  width: 100%;
  min-height: 64px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* The administrator's own strike marks, beside the question. */
.aev-game__strikes {
  margin: 0;
  min-height: 1.6rem;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--ev-urgent-text);
}

.aev-game__progress {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #eaf3f0);
}

/* ==========================================================================
 * THE REVEALED SURVEY SHOWDOWN QUESTION (Phase 8E, Problems 4-6)
 * ==========================================================================
 *
 * Phase 8 put a bar and a count on the television. The playtest's complaint
 * was that the revealed state was incomplete -- it never said who voted for
 * what, and it never said what anybody earned.
 *
 * Everything here is read from across a room, so the type is sized off the
 * viewport and the voter list is one wrapped line rather than a column: a
 * fifty-person Event must not try to print every name beside the whole
 * leaderboard, which is why the painter caps the list and says "and N more".
 *
 * Every rule that changes a background also sets a colour -- the Phase 8B
 * rule -- and every tint mixes towards the CARD rather than towards
 * `transparent`.
 * ======================================================================== */

.host__reveal {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.host__answers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.host__answer {
  color: var(--text, #eaf3f0);
  background: var(--bg-elev, #112220);
  border: 1px solid var(--line, #22413c);
  border-radius: var(--ev-radius);
  padding: 0.5rem 0.75rem;
  min-width: 0;
}

/*
 * THE WINNING ANSWER. Light text, the green as an accent -- the Problem 3
 * rule applied to the new component rather than relearned later.
 */
.host__answer--won {
  color: var(--text, #eaf3f0);
  background: color-mix(in srgb, var(--ev-live) 22%, var(--bg-elev, #112220));
  border-color: var(--ev-win);
}

.host__answer-head {
  margin: 0;
  display: grid;
  /* The text shrinks; the count and the share hold their width. */
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  align-items: baseline;
  font-size: clamp(1.1rem, 2.6vw, 2rem);
}

.host__answer-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.host__answer-votes {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.host__answer-share {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  color: var(--text-dim, #9fb8b2);
}

/*
 * THE VOTERS. One wrapped line, deliberately: a column of names per answer
 * would push the next answer off a 720p stage with six options.
 */
.host__answer-voters {
  margin: 0.3rem 0 0;
  font-size: clamp(0.85rem, 1.6vw, 1.2rem);
  line-height: 1.35;
  color: var(--text-dim, #9fb8b2);
  overflow-wrap: anywhere;
}

.host__answer--won .host__answer-voters { color: var(--text, #eaf3f0); }

.host__earned {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

/*
 * PLAYER | +EVENT SCORE | +FP, with the same column contract as every other
 * row on this screen: only the name shrinks, and the figures stay on one line
 * in tabular numerals.
 */
.host__earned-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  align-items: baseline;
  min-width: 0;
  font-size: clamp(0.95rem, 1.8vw, 1.4rem);
}

/* ==========================================================================
 * THE ADMINISTRATOR'S POST-REVEAL VIEW (Phase 8E, Problems 5-7)
 * ==========================================================================
 *
 * A phone, held in a crowded room, by the person running the game. Everything
 * is sized for a thumb and wraps rather than scrolls sideways: Part 20 requires
 * no horizontal overflow at 320px, and a voter list is the one thing here that
 * can be arbitrarily long.
 *
 * The RESULTS / STANDINGS pair are tabs rather than actions, and they look like
 * tabs: `aria-pressed` carries the state for a screen reader, and the selected
 * one is filled rather than merely a different shade, because a two-state
 * control distinguished only by colour is unreadable to a good number of
 * people.
 * ======================================================================== */

.aev-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.25rem;
}

.aev-tab {
  flex: 0 0 auto;
  min-height: 40px;
}

.aev-tab--on {
  color: var(--bg, #0b1614);
  background: var(--metal, #d8e3e0);
  border-color: var(--metal, #d8e3e0);
  font-weight: 700;
}

.aev-reveal {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.aev-reveal__answers,
.aev-reveal__earned,
.aev-reveal__standings {
  margin: 0;
  padding: 0 0 0 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.88rem;
}

.aev-reveal__answer {
  color: var(--text, #eaf3f0);
  background: var(--bg-elev-2, #16302c);
  border: 1px solid var(--line-soft, #1b332f);
  border-radius: var(--radius-sm, 10px);
  padding: 0.4rem 0.55rem;
  min-width: 0;
}

/* The winning answer: light text, the green as an accent. Problem 3's rule. */
.aev-reveal__answer--won {
  color: var(--text, #eaf3f0);
  background: color-mix(in srgb, var(--ev-live) 20%, var(--bg-elev-2, #16302c));
  border-color: var(--ev-win);
}

.aev-reveal__head {
  margin: 0;
  font-weight: 600;
  /* A long answer wraps; nothing here may push the card sideways on a 320. */
  overflow-wrap: anywhere;
}

.aev-reveal__voters {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-dim, #9fb8b2);
  overflow-wrap: anywhere;
}

.aev-reveal__answer--won .aev-reveal__voters { color: var(--text, #eaf3f0); }

.aev-reveal__earned li,
.aev-reveal__standings li {
  color: var(--text, #eaf3f0);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
