/* =====================================================================
   Immersive Mystery — the case-file theme.

   The whole app reads as a modern detective dossier: documents on a desk in a
   dim room. Dark warm ink ground, dossier panels with file tabs, typewriter
   labels and rubber-stamp badges — restrained, not a scrapbook. One texture,
   two accent colours, generous whitespace.

   MOBILE-FIRST throughout. Everything is sized for a phone held one-handed in
   low light: single column, thumb-sized targets, 16px+ inputs (anything less
   makes iOS Safari zoom on focus). The queries at the bottom widen the HOST
   panel to a two-column admin layout on a laptop; the PLAYER view stays a
   single centred column at every width, because it is always read on a phone.

   Typography: body copy uses the system stack so it paints instantly on party
   wifi. Courier Prime (loaded in layout.php from jsdelivr, which is all the
   CSP permits) is used ONLY for case-file furniture — labels, stamps, codes,
   keywords, numbers — and falls back to plain monospace if it never arrives.
   ===================================================================== */

:root {
  /* --- ground and paper --- */
  --ink:        #0e0d0b;   /* the desk */
  --ink-2:      #14120f;
  --panel:      #1b1915;   /* a dossier panel */
  --panel-2:    #232019;   /* a panel raised off it */
  --edge:       rgba(226, 208, 170, .13);
  --edge-solid: #2e2a22;
  --text:       #ece6d9;   /* warm off-white, easier than pure white in a dim room */
  --text-dim:   #a29a89;

  /* --- accents --- */
  --amber:      #c8a45c;   /* the case accent: tabs, rules, headings */
  --amber-soft: rgba(200, 164, 92, .13);
  --amber-line: rgba(200, 164, 92, .38);
  --red:        #cf4436;   /* evidence, danger, the accused */
  --red-soft:   rgba(207, 68, 54, .13);
  --violet:     #8b7bd8;   /* missions */
  --violet-soft:rgba(139, 123, 216, .13);
  --green:      #4fb37d;   /* solved, correct */
  --green-soft: rgba(79, 179, 125, .13);

  --mono: "Courier Prime", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: .55rem;        /* documents have corners, not pills */
}

/* Steer Bootstrap's dark theme onto the case-file palette so its own
   components (alerts, forms, accordions, tables) inherit rather than fight. */
[data-bs-theme="dark"] {
  --bs-body-bg: var(--ink);
  --bs-body-color: var(--text);
  --bs-secondary-color: var(--text-dim);
  --bs-border-color: var(--edge-solid);
  --bs-primary: var(--amber);
  --bs-link-color: var(--amber);
  --bs-link-hover-color: #dcbd7d;
  --bs-emphasis-color: var(--text);
}

/* ---------------------------------------------------------------------
   ACCESSIBILITY — reader-chosen text size.

   These scale the ROOT font size. Because the whole app is laid out in
   rem/em, the entire interface grows with the text: cards, buttons, tap
   targets and spacing all keep their proportions instead of text spilling
   out of boxes that stayed put.

   The size is stamped on <html> server-side from a cookie (see layout.php),
   so a page paints at the reader's chosen size with no jump. app.js handles
   the buttons and persistence.
   --------------------------------------------------------------------- */
html                          { font-size: 100%; }         /* md — the default */
html[data-text-scale="sm"]    { font-size: 90%; }
html[data-text-scale="lg"]    { font-size: 112.5%; }
html[data-text-scale="xl"]    { font-size: 125%; }
html[data-text-scale="xxl"]   { font-size: 140%; }

/* The A- / A+ control in the navbar. */
.text-size {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin-left: .75rem;
}
.ts-btn {
  min-width: 2.5rem;
  min-height: 2.5rem;                 /* stays tappable at every scale */
  padding: 0 .4rem;
  border: 1px solid var(--edge-solid);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-weight: 700;
  line-height: 1;
}
.ts-btn:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }
.ts-btn:disabled { opacity: .35; cursor: default; }
.ts-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
/* The label is for screen readers and the aria-live announcement; sighted
   users get the same information from the A-/A+ buttons themselves. */
.ts-level {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus everywhere, not just on the size control. */
a:focus-visible, button:focus-visible,
.form-control:focus-visible, .form-select:focus-visible,
.pick-item:focus-within, .cc-toggle:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   The desk: warm ink, a faint fibre grain, and a pool of light overhead.
   The grain is two hairline repeating gradients — cheap, no image request.
   --------------------------------------------------------------------- */
body {
  background-color: var(--ink);
  background-image:
    radial-gradient(900px 480px at 50% -8%, rgba(200, 164, 92, .09), transparent 70%),
    repeating-linear-gradient(0deg,   rgba(255,255,255,.014) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg,  rgba(255,255,255,.010) 0 1px, transparent 1px 4px);
  background-attachment: fixed;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.58;
}

/* ---------------------------------------------------------------------
   Case-file furniture: the typewriter voice.
   --------------------------------------------------------------------- */
.code-pill,
.keyword,
.source-word,
.timer-badge,
.phase-step,
.facet-badge,
.script-flag, .mission-flag, .puzzle-flag, .confess-flag,
.lb-rank, .lb-score,
.feed-heading,
.accuse-clock, .comp-clock,
.entry-chip,
.navbar-brand {
  font-family: var(--mono);
}

.code-pill {
  letter-spacing: .18em;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--amber);
}
.timer-badge { font-variant-numeric: tabular-nums; }

.navbar {
  background: linear-gradient(180deg, rgba(0,0,0,.5), transparent);
  border-bottom: 1px solid var(--edge) !important;
}
/* One row at every width: brand, text size, then the links. The brand is the
   only part allowed to shrink, so the A-/A+ control and the nav links never
   wrap onto a second line on a phone. */
.navbar > .container {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .5rem;
}
.navbar-brand {
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: 1rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 0;
}
.navbar-brand i { color: var(--amber); }
.navbar .navbar-nav { flex-shrink: 0; }

@media (max-width: 575.98px) {
  /* Just the mark on a narrow phone — the nav and text size matter more. */
  .navbar-brand { font-size: 0; letter-spacing: 0; }
  .navbar-brand i { font-size: 1.35rem; }
  .text-size { margin-left: .35rem; }
}

/* ---------------------------------------------------------------------
   Dossier panels. Every .card is a document: hairline border, a hairline
   amber rule along the top edge, and a faint inner highlight so it reads as
   paper catching light rather than a flat rectangle.
   --------------------------------------------------------------------- */
.card {
  position: relative;
  background-color: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px -18px #000;
}
.card::before {                 /* the file rule along the top of the sheet */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--amber-line), transparent 62%);
  opacity: .8;
  pointer-events: none;
}
.card-body { padding: 1.15rem; }
.card-title { letter-spacing: .01em; }
.card-title .bi { color: var(--amber); }

/* A card that carries a coloured left edge (clue, mission, puzzle, script)
   drops the top rule — one accent per document is enough. */
.clue-card::before, .mission-card::before, .puzzle-card::before,
.script-card::before, .char-card::before, .confess-card::before { display: none; }

/* Rubber-stamp badge: outlined, letterspaced, very slightly askew. */
.stamp,
.script-flag, .mission-flag, .puzzle-flag, .confess-flag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.stamp {
  padding: .2rem .55rem;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  transform: rotate(-1.2deg);
  opacity: .9;
}

.trait-pill {
  display: inline-block;
  margin: 0 .3rem .35rem 0;
  padding: .18rem .6rem;
  border-radius: 3px;
  font-size: .78rem;
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
}

.phase-step {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  border-radius: 3px;
}

/* Live-dashboard connection dot (SSE state). */
[data-live-status] {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
[data-live-status]::before {
  content: "";
  width: .5rem; height: .5rem;
  border-radius: 50%;
  background: #6c757d;
}
[data-live-status][data-state="live"]::before {
  background: var(--green);
  box-shadow: 0 0 0 .15rem rgba(79, 179, 125, .22);
}
[data-live-status][data-state="down"]::before { background: var(--amber); }

/* ---------------------------------------------------------------------
   The character card — the top document in the file. A manila tab sits on
   its upper edge, and two punch holes anchor it to the folder.
   --------------------------------------------------------------------- */
.char-card {
  border-left: 3px solid var(--amber);
  /* Clearance for the manila tab, which sits above the panel's top edge. */
  margin-top: .9rem;
  padding-top: .35rem;
  background:
    radial-gradient(circle at 1.15rem 2.6rem, rgba(0,0,0,.55) 4.5px, transparent 5px),
    radial-gradient(circle at 1.15rem 5.2rem, rgba(0,0,0,.55) 4.5px, transparent 5px),
    var(--panel);
}
.char-card > .card-body { padding-left: 2.1rem; }
.char-card::after {                       /* the manila tab */
  content: "DOSSIER";
  position: absolute;
  top: -.72rem; right: 1.1rem;
  padding: .12rem .6rem;
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--ink);
  background: var(--amber);
  border-radius: 3px 3px 0 0;
}

.char-card-sections { margin-top: 1rem; }
.cc-section + .cc-section { margin-top: .45rem; }
.cc-toggle {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  min-height: 52px;                       /* thumb-sized */
  padding: .6rem .85rem;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--amber-line);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-align: left;
}
.cc-toggle:hover { background: #2a2620; }
.cc-toggle .bi:first-child { color: var(--amber); }
.cc-toggle > span { flex: 1; }
.cc-chev { transition: transform .18s ease; font-size: .8rem; opacity: .55; }
.cc-toggle.collapsed .cc-chev { transform: rotate(-90deg); }
.cc-body {
  padding: .85rem .95rem;
  margin: .4rem 0 0 .55rem;
  border-left: 2px solid var(--edge-solid);
}

.play-it-note {
  padding: .75rem .9rem;
  border-radius: 4px;
  background: var(--amber-soft);
  border: 1px dashed var(--amber-line);
  font-size: .92rem;
}
.play-it-note .bi { color: var(--amber); }

/* A guest's pronouns, shown wherever a character is chosen or assigned. */
.pronoun-tag {
  display: inline-block;
  margin-left: .4rem;
  padding: .05rem .4rem;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--text-dim);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--edge-solid);
  vertical-align: middle;
}

.guide-list { display: grid; gap: .6rem; }
.guide-char {
  padding: .6rem .75rem;
  border-radius: 4px;
  border: 1px solid var(--edge-solid);
  background: rgba(0, 0, 0, .18);
}
.guide-head { margin-bottom: .1rem; }

/* ---------------------------------------------------------------------
   Relationships — revealed on the dossier once the game begins.
   --------------------------------------------------------------------- */
.relationships {
  padding: .85rem .95rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, .2);
  border: 1px solid var(--edge-solid);
}
.rel-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .5rem 0;
}
.rel-row + .rel-row { border-top: 1px solid var(--edge); }
.rel-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-width: 8.5rem;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--amber);
}
.rel-body { min-width: 0; }
.rel-secret {
  display: inline-block;
  margin-left: .4rem;
  font-size: .72rem;
  color: var(--red);
}
/* Warm the loves, cool the loathes — a glance tells you which is which. */
.rel-lover  .rel-badge, .rel-friend .rel-badge          { color: #e08aa8; }
.rel-lover.rel-row, .rel-friend.rel-row                 { }
.rel-enemy  .rel-badge, .rel-archnemesis .rel-badge     { color: var(--red); }
.rel-ex_lover .rel-badge, .rel-frenemy .rel-badge       { color: var(--amber); }
.rel-business_partner .rel-badge                        { color: var(--text-dim); }

@media (max-width: 575.98px) {
  .rel-row { flex-direction: column; gap: .15rem; }
  .rel-badge { min-width: 0; }
}

/* ---------------------------------------------------------------------
   The holding screen: everything else is off; look at your host.
   --------------------------------------------------------------------- */
.stage-hold {
  padding: 3.25rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--amber-line);
  background:
    radial-gradient(circle at 50% 0%, rgba(200,164,92,.16), transparent 68%),
    var(--panel);
}
.stage-hold-icon {
  font-size: 3.4rem;
  color: var(--amber);
  animation: pulse-soft 2.4s ease-in-out infinite;
}
.stage-hold h3 {
  font-family: var(--mono);
  letter-spacing: .2em;
  text-transform: uppercase;
  font-size: 1.05rem;
}
@keyframes pulse-soft {
  0%, 100% { opacity: .55; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .stage-hold-icon { animation: none; opacity: 1; }
}
/* Phones down: dim, quiet, nothing worth reading. Fills the first screen so
   there's nothing else to scroll to while the host performs. */
.stage-hold.phones-down {
  min-height: 70vh;
  display: flex; flex-direction: column; justify-content: center;
  background: #070605;
  border-color: var(--edge);
  color: var(--text-dim);
}
.stage-hold.phones-down .lead { color: var(--text-dim); }
.stage-hold.phones-down .stage-hold-icon { color: rgba(200,164,92,.6); }

/* ---------------------------------------------------------------------
   New arrivals in the clue feed (app.js): a badge that pulses a few times,
   and a small banner on this phone only.
   --------------------------------------------------------------------- */
.new-badge {
  display: inline-block; margin-left: .5rem; padding: .05rem .45rem;
  border-radius: .3rem; font-family: var(--mono); font-size: .7rem;
  letter-spacing: .1em; text-transform: uppercase; vertical-align: middle;
  background: var(--amber); color: var(--ink);
  animation: pulse-soft 1.6s ease-in-out 4;
}
.feed-new { box-shadow: 0 0 0 1px var(--amber-line), 0 0 18px rgba(200,164,92,.18); }
.arrival-banner {
  position: fixed; left: 50%; top: .75rem; z-index: 1080;
  transform: translate(-50%, -160%); transition: transform .25s ease;
  max-width: calc(100vw - 2rem);
  border: 1px solid var(--amber-line); border-radius: 2rem;
  background: var(--panel-2); color: var(--text);
  padding: .5rem 1rem; font-size: .9rem; box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
.arrival-banner.show { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .new-badge { animation: none; }
  .arrival-banner { transition: none; }
}
.mission-done { color: var(--green); font-size: .9rem; }
.mission-card.is-done { opacity: .8; }

/* ---------------------------------------------------------------------
   The host's script — the page they perform from.
   --------------------------------------------------------------------- */
.script-card { border-left: 3px solid var(--amber); }
.script-card.performing {
  border-left-color: var(--red);
  box-shadow: 0 0 0 1px rgba(207, 68, 54, .3), 0 8px 24px -18px #000;
}
.script-flag { color: var(--amber); }
.script-body {
  margin: 0;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--amber-line);
  border-radius: 0 4px 4px 0;
  background: rgba(0, 0, 0, .28);
  font-size: 1.14rem;
  line-height: 1.68;
}
/* The script folds away once read, so it stops eating the screen the host
   needs for round controls. Label and chevron follow Bootstrap's .collapsed. */
.script-toggle .lbl-show,
.script-toggle.collapsed .lbl-hide { display: none; }
.script-toggle.collapsed .lbl-show,
.script-toggle .lbl-hide { display: inline; }
.script-chev { transition: transform .18s ease; }
.script-toggle.collapsed .script-chev { transform: rotate(-90deg); }

.script-notes {
  margin-top: .8rem;
  padding: .6rem .8rem;
  border-radius: 4px;
  background: var(--red-soft);
  border: 1px dashed rgba(207, 68, 54, .42);
  font-size: .88rem;
}

/* ---------------------------------------------------------------------
   The feed: evidence, filed by round.
   --------------------------------------------------------------------- */
.feed-heading {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 1.6rem 0 .85rem;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--text-dim);
}
.feed-heading::after {                    /* a rule running to the margin */
  content: "";
  flex: 1;
  height: 1px;
  background: var(--edge);
}

.clue-card { border-left: 3px solid var(--amber); }
.clue-card.secret  { border-left-color: var(--red); background: linear-gradient(180deg, var(--red-soft), var(--panel) 60%); }
.clue-card.suspect { border-left-color: var(--red); }
.clue-card .card-title { font-size: 1rem; }

.facet-badge {
  display: inline-block;
  margin-left: .5rem;
  padding: .1rem .45rem;
  border-radius: 3px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  vertical-align: middle;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
}

.past-round { margin-bottom: .7rem; }
.past-round .btn {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .08em;
  border-color: var(--edge-solid);
  color: var(--text-dim);
}

/* Missions — the one violet thing in the file, so they read as an interrupt. */
.mission-card {
  border-left: 3px solid var(--violet);
  background: linear-gradient(180deg, var(--violet-soft), var(--panel) 62%);
}
.mission-flag { color: var(--violet); }
.mission-target {
  padding: .6rem .75rem;
  border-radius: 4px;
  background: rgba(139, 123, 216, .12);
  border: 1px solid rgba(139, 123, 216, .32);
}

/* ---------------------------------------------------------------------
   Puzzles.
   --------------------------------------------------------------------- */
.puzzle-card { border-left: 3px solid var(--green); }
.puzzle-card.competition { border-left-color: var(--amber); }
.puzzle-flag { color: var(--green); }
.puzzle-flag.competition { color: var(--amber); }

.puzzle-piece {
  margin-top: .9rem;
  padding: .9rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, .25);
  border: 1px dashed var(--edge-solid);
}
.keyword-reveal {
  margin-top: .75rem;
  padding: .9rem;
  border-radius: 4px;
  text-align: center;
  background: var(--green-soft);
  border: 1px solid rgba(79, 179, 125, .42);
}
.keyword {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--green);
  word-break: break-word;
}
.puzzle-won {
  margin-top: .75rem;
  padding: .7rem .85rem;
  border-radius: 4px;
  background: var(--green-soft);
  border: 1px solid rgba(79, 179, 125, .42);
}
.puzzle-progress .progress { height: .5rem; background: rgba(0,0,0,.35); border-radius: 2px; }
.puzzle-progress .progress-bar { background: var(--green); }

.source-word {
  margin: .7rem 0;
  padding: .9rem;
  border-radius: 4px;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: .28em;
  text-indent: .28em;                     /* balance the trailing letterspace */
  color: var(--amber);
  background: rgba(0, 0, 0, .3);
  border: 1px dashed var(--amber-line);
  word-break: break-word;
}

.entry-chips, .entry-review { display: flex; flex-wrap: wrap; gap: .4rem; }
.entry-chip {
  padding: .22rem .6rem;
  border-radius: 3px;
  font-size: .82rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--edge-solid);
}
.entry-chip.struck { text-decoration: line-through; opacity: .42; }
.btn-reset { color: inherit; cursor: pointer; }

.leaderboard { border-top: 1px solid var(--edge); padding-top: .6rem; }
.lb-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem .5rem;
  border-radius: 3px;
}
.lb-row.me { background: var(--amber-soft); font-weight: 700; }
.lb-rank  { width: 1.4rem; text-align: center; opacity: .55; font-variant-numeric: tabular-nums; }
.lb-name  { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--amber); }

/* ---------------------------------------------------------------------
   The accusation clock and the confession.
   --------------------------------------------------------------------- */
.accuse-clock, .comp-clock {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .7rem;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(207, 68, 54, .48);
}
.comp-clock { color: var(--amber); background: var(--amber-soft); border-color: var(--amber-line); }
.accuse-clock.expired { opacity: .5; }
form.is-locked { opacity: .5; }

.confess-card {
  border: 1px solid rgba(207, 68, 54, .5);
  border-left: 3px solid var(--red);
  background: linear-gradient(180deg, var(--red-soft), var(--panel) 58%);
}
.confess-flag { color: var(--red); }
.confess-script {
  margin: .8rem 0;
  padding: 1.05rem;
  border-left: 3px solid var(--red);
  border-radius: 0 4px 4px 0;
  background: rgba(0, 0, 0, .34);
  font-size: 1.16rem;
  line-height: 1.7;
}

/* ---------------------------------------------------------------------
   Traitors mode: the role card, the night, the Round Table, the board.
   The night card is deliberately ONE look for every player, Traitor or
   Faithful: a glance across the room has to tell you nothing.
   --------------------------------------------------------------------- */
.role-stamp {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .12rem .5rem;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  vertical-align: middle;
}
.role-stamp.traitor  { color: var(--red); }
.role-stamp.faithful { color: var(--green); }

.role-card {
  border: 1px solid var(--edge-solid);
  border-radius: 4px;
  background: var(--panel-2);
}
.role-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem .5rem;
  width: 100%;
  min-height: 48px;
  padding: .6rem .8rem;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.role-hint {
  flex-basis: 100%;
  padding-left: 1.6rem;
  font-family: var(--bs-body-font-family);   /* body copy, not case-file furniture */
  font-size: .8rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-dim);
}
/* Bootstrap toggles .collapsed on the button; the hint and icon follow it. */
.role-toggle .lbl-show,
.role-toggle.collapsed .lbl-hide { display: none; }
.role-toggle.collapsed .lbl-show,
.role-toggle .lbl-hide { display: inline; }
.role-body { padding: 0 .9rem .9rem; }
.role-name {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: .4rem;
}
.role-card.traitor  .role-name { color: var(--red); }
.role-card.faithful .role-name { color: var(--green); }

.night-card {
  border-left: 3px solid var(--violet);
  background: linear-gradient(180deg, rgba(40, 34, 74, .55), var(--panel) 70%);
}
.night-icon { color: var(--violet); }
.night-pick + .night-pick {
  margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px dashed var(--edge-solid);
}
.dawn-card {
  border-left: 3px solid var(--amber);
  background: linear-gradient(180deg, var(--amber-soft), var(--panel) 65%);
}
.dawn-icon, .table-icon { color: var(--amber); }
.dawn-victim { padding: .6rem 0; border-top: 1px solid var(--edge); }
.dawn-victim:first-of-type { border-top: 0; }
.table-card { border-left: 3px solid var(--amber); }
/* A big table banishes two: said up front, in the case-file stamp style. */
.table-two {
  display: inline-block;
  padding: .2rem .6rem;
  border: 1px solid var(--amber);
  border-radius: 3px;
  color: var(--amber);
  font-family: var(--mono);
  letter-spacing: .04em;
}

.verdict-card.traitor {
  border-left: 3px solid var(--red);
  background: linear-gradient(180deg, var(--red-soft), var(--panel) 62%);
}
.verdict-card.traitor .display-3, .verdict-card.traitor .display-4 { color: var(--red); }
.verdict-card.faithful {
  border-left: 3px solid var(--green);
  background: linear-gradient(180deg, var(--green-soft), var(--panel) 62%);
}
.verdict-card.faithful .display-3, .verdict-card.faithful .display-4 { color: var(--green); }

.ballot {
  padding: .75rem .9rem;
  border: 1px solid var(--edge-solid);
  border-radius: 4px;
  background: var(--panel);
}
.ballot-label { letter-spacing: .12em; font-family: var(--mono); }
/* One row per name voted for, its voters underneath: 30 votes stay short. */
.ballot-row + .ballot-row {
  margin-top: .45rem;
  padding-top: .45rem;
  border-top: 1px solid var(--edge);
}

.board-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.board-chip {
  padding: .3rem .65rem;
  border-radius: 3px;
  background: var(--panel-2);
  border: 1px solid var(--edge-solid);
}
.board-chip.me { border-color: var(--amber); }
.board-out {
  padding: .45rem 0;
  border-top: 1px solid var(--edge);
  color: var(--text-dim);
}
.night-log ul { padding-left: 1.1rem; }

/* ---------------------------------------------------------------------
   Traitors mode: betrayal and the ghosts (src/traitors_social_view.php).
   Everything private folds shut like the role card, and looks the same on
   every phone that holds one.
   --------------------------------------------------------------------- */
.role-goal {
  font-weight: 700;
  color: var(--amber);
  margin-bottom: .45rem;
}
.role-turned { color: var(--red); font-size: .92rem; margin-bottom: .45rem; }
.traitor-ink { color: var(--red); }
.ghost-ink   { color: var(--violet); }

/* The midway round's sealed letter: the same envelope on every phone. */
.letter-card { border-color: var(--amber-line); }
.letter-card .role-toggle { color: var(--amber); }
.letter-card .role-name { font-size: 1.1rem; }

/* The out players: violet, the color of the night. */
.role-card.ghost { border-color: rgba(139, 123, 216, .45); }
.role-card.ghost .role-toggle { color: var(--violet); }
.ghost-card {
  border-left: 3px solid var(--violet);
  background: linear-gradient(180deg, var(--violet-soft), var(--panel) 65%);
}
.ghost-voter { color: var(--violet); font-style: italic; }
.ghost-hint { border-top: 1px dashed var(--edge-solid); padding-top: .6rem; }

/* A vote that broke a pact, stamped on the public ballot. */
.pact-stamp {
  display: inline-block;
  margin-left: .15rem;
  padding: 0 .35rem;
  border: 1.5px solid var(--red);
  border-radius: 3px;
  color: var(--red);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  transform: rotate(-2deg);
  white-space: nowrap;
}
.alibi-note {
  padding: .6rem .8rem;
  border: 1px solid rgba(207, 68, 54, .45);
  border-radius: 4px;
  background: var(--red-soft);
  font-size: .92rem;
}

.endgame-card {
  border-left: 3px solid var(--amber);
  background: linear-gradient(180deg, rgba(200, 164, 92, .18), var(--panel) 70%);
}
.endgame-icon { color: var(--amber); }
.endgame-choices .btn { min-height: 3.2rem; font-weight: 700; }

/* Rumors, notes and pacts in the feed. */
.social-card { border-left: 3px solid var(--edge-solid); }
.social-card .role-card { background: var(--panel); }
.rumor-card { border-left-color: var(--amber); }
.rumor + .rumor { margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--edge); }
.rumor-mark {
  font-family: var(--mono);
  font-size: 1.4rem;
  line-height: 0;
  color: var(--amber);
  margin-right: .2rem;
  vertical-align: -.25rem;
}
.note {
  padding: .5rem .65rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--edge);
}
.note + .note { margin-top: .5rem; }
.note.sent { opacity: .75; }
.note-to {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: .2rem;
}
.pact-row { padding: .45rem 0; border-top: 1px solid var(--edge); }
.pact-row:first-child { border-top: 0; }
.pact-row.invite {
  padding: .6rem .7rem;
  border: 1px solid var(--amber-line);
  border-radius: 4px;
  background: var(--amber-soft);
  margin-bottom: .4rem;
}

/* The ending's awards. */
.awards-card { border-left: 3px solid var(--amber); }
.award + .award { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--edge); }
.award-title {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--amber);
}

/* The host's "read this out" line, right above the next button. */
.host-facts {
  padding: .65rem .8rem;
  border: 1px solid var(--edge-solid);
  border-radius: 4px;
  background: var(--panel-2);
  font-size: 1.05rem;
}
.host-facts > div + div { margin-top: .35rem; }

/* ---------------------------------------------------------------------
   The wrap-up: share, newsletter, feedback.
   --------------------------------------------------------------------- */
.share-card { border-left: 3px solid var(--amber); }

.share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: .5rem;
}
.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 4.5rem;
  padding: .6rem .4rem;
  border: 1px solid var(--edge-solid);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: .78rem;
  text-align: center;
}
.share-btn .bi { font-size: 1.3rem; color: var(--amber); }
.share-btn:hover { border-color: var(--amber); color: var(--text); }

/* Star rating — radios styled as stars, still keyboard reachable. */
.rating-row { display: flex; gap: .3rem; }
.rating-star { cursor: pointer; }
.rating-star input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.rating-star span[aria-hidden] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;                 /* tappable at every text size */
  font-size: 1.5rem;
  color: var(--edge-solid);
  transition: color .12s ease;
}
.rating-star:hover span[aria-hidden],
.rating-star:has(input:checked) span[aria-hidden] { color: var(--amber); }
/* Light up every star up to the checked one. */
.rating-row:has(input:checked) .rating-star span[aria-hidden] { color: var(--amber); }
.rating-row .rating-star:has(input:checked) ~ .rating-star span[aria-hidden] { color: var(--edge-solid); }
.rating-star input:focus-visible + span[aria-hidden] {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------------
   Voting: big, unambiguous targets. This happens against a clock.
   --------------------------------------------------------------------- */
.pick-list { display: grid; gap: .5rem; }
.pick-item {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  min-height: 56px;
  padding: .75rem .9rem;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--edge-solid);
  cursor: pointer;
}
.pick-item:has(input:checked) {
  background: var(--amber-soft);
  border-color: var(--amber);
}
.pick-item input { margin-top: .2rem; flex-shrink: 0; }
.pick-item input:disabled { opacity: .4; }
/* A big party's ballot (more than 12 names, see pick_list_class()) goes two
   across, three on a wide screen, so 29 names are half the scroll with a
   90-second clock running. Each tile stays a full-height tap target. */
.pick-list-many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pick-list-many .pick-item { padding: .6rem .65rem; gap: .5rem; overflow-wrap: anywhere; }
@media (min-width: 768px) {
  .pick-list-many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* A long ballot on a phone pushes its button below the screen, with a clock
   running. The button rides along the bottom edge while the list is in view,
   then settles back under it. */
@media (max-width: 575.98px) {
  .vote-submit {
    position: sticky;
    bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 3;
    box-shadow: 0 .4rem 1.2rem rgba(0, 0, 0, .55);
  }
}

/* ---------------------------------------------------------------------
   Controls. 44px is the floor for anything tapped; inputs must be >=16px
   or iOS Safari zooms the whole page when they get focus.
   --------------------------------------------------------------------- */
.form-control, .form-select {
  min-height: 48px;
  font-size: 1rem;
  background-color: rgba(0,0,0,.28);
  border-color: var(--edge-solid);
  color: var(--text);
}
.form-control:focus, .form-select:focus {
  background-color: rgba(0,0,0,.34);
  border-color: var(--amber);
  box-shadow: 0 0 0 .2rem var(--amber-soft);
  color: var(--text);
}
.btn { min-height: 44px; border-radius: 4px; }
.btn-primary {
  --bs-btn-bg: var(--amber);
  --bs-btn-border-color: var(--amber);
  --bs-btn-color: #17140e;
  --bs-btn-hover-bg: #d8b571;
  --bs-btn-hover-border-color: #d8b571;
  --bs-btn-hover-color: #17140e;
  font-weight: 600;
}
.player-action {
  min-height: 56px;
  font-size: 1.02rem;
  font-family: var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.accordion-button:not(.collapsed) { background-color: var(--panel-2); color: var(--text); }
.accordion-button:focus { box-shadow: 0 0 0 .2rem var(--amber-soft); }
.alert { border-radius: 4px; }
.table-dark { --bs-table-bg: transparent; }

@media (max-width: 575.98px) {
  main.container { padding-left: .85rem; padding-right: .85rem; }
  .card-body { padding: 1rem; }
  .char-card > .card-body { padding-left: 1.9rem; }
  .script-body, .confess-script { font-size: 1.05rem; padding: .85rem .9rem; }
  .source-word { font-size: 1.35rem; letter-spacing: .18em; text-indent: .18em; }
  .keyword { font-size: 1.35rem; }
  /* Full-width button groups — nothing should be a 20px target. */
  .btn-group { display: flex; width: 100%; }
  .btn-group > .btn { flex: 1; }
}

/* The Run game header on a phone: a smaller title, then the phase and the
   clock side by side on one line. Every host tap reloads that page at the
   top, so each line saved here is one less to scroll past to the buttons. */
@media (max-width: 575.98px) {
  .run-head h3 { font-size: 1.25rem; }
  .run-head-status {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    text-align: left !important;
  }
  .run-head-status .timer-badge { font-size: 1.15rem; }
  .run-tools { margin-bottom: 1rem !important; }
  /* The host's next step spans the screen: easy to hit mid-performance. */
  form.phase-main { display: block !important; flex: 1 1 100%; }
  form.phase-main .btn { width: 100%; }
}

/* Host on a laptop keeps the two-column admin layout Bootstrap already
   gives it; just loosen the panels so it reads as a desk, not a phone. */
@media (min-width: 992px) {
  .card-body { padding: 1.35rem; }
}

/* ---------------------------------------------------------------------
   QR player badges (host shows or prints these).
   --------------------------------------------------------------------- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}
.player-badge {
  border: 1px solid var(--edge-solid);
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
  break-inside: avoid;
  background: var(--panel);
}
.player-badge .qr {
  width: 170px;
  max-width: 100%;
  margin: .5rem auto;
  background: #fff;                        /* QR must sit on white to scan */
  padding: 8px;
  border-radius: 3px;
}
.player-badge .qr svg { display: block; width: 100%; height: auto; }

/* ---------------------------------------------------------------------
   The pre-party screen — what a guest sees in the days before the party.
   --------------------------------------------------------------------- */
.preparty-when {
  border-left: 3px solid var(--amber);
  background:
    radial-gradient(circle at 50% 0%, rgba(200,164,92,.12), transparent 70%),
    var(--panel);
}
.preparty-when .script-flag { display: inline-flex; }
.preparty-when-line { font-size: 1.1rem; color: var(--text); }
.preparty-countdown {
  margin-top: .15rem;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--amber);
}

/* Where to turn up. The suite sits on its own line because it is the detail
   people miss and then stand outside wondering about. */
.preparty-venue {
  padding-top: .85rem;
  border-top: 1px solid var(--edge);
}
.venue-line { font-size: 1rem; color: var(--text); }
.venue-line .bi { color: var(--amber); }
.venue-suite {
  margin-top: .2rem;
  font-family: var(--mono);
  font-size: .92rem;
  letter-spacing: .06em;
  color: var(--text-dim);
}

/* The host's own note — a pinned card, so it reads as a person talking rather
   than more of the mystery's own copy. */
.host-note {
  border-left: 3px solid var(--violet);
  background: linear-gradient(180deg, var(--violet-soft), var(--panel) 62%);
}
.host-note .script-flag { color: var(--violet); }

/* The guest list. Two columns that collapse gracefully at any text size. */
.roster-list { display: grid; gap: .35rem; }
.roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .75rem;
  border-radius: 4px;
  border: 1px solid var(--edge-solid);
  background: rgba(0, 0, 0, .18);
}
.roster-row.taken { border-color: var(--amber-line); background: var(--amber-soft); }
.roster-char { min-width: 0; font-weight: 600; }
.roster-who  { flex-shrink: 0; text-align: right; font-size: .88rem; }
.roster-who .bi { color: var(--amber); }

/* ---------------------------------------------------------------------
   The join poster — held up, cast to a TV, or printed for the door.
   Sized in vmin so it fills whatever it is shown on.
   --------------------------------------------------------------------- */
.join-poster {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
  border: 1px solid var(--amber-line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 0%, rgba(200,164,92,.12), transparent 70%),
    var(--panel);
}
.join-poster-title {
  font-family: var(--mono);
  font-size: clamp(1rem, 3.5vmin, 1.6rem);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--amber);
}
.join-poster-lead {
  margin: .35rem 0 1.25rem;
  font-size: clamp(1rem, 3vmin, 1.5rem);
  color: var(--text-dim);
}
.join-qr {
  width: clamp(200px, 46vmin, 420px);
  margin: 0 auto;
  padding: 14px;
  background: #fff;                  /* QR must sit on white to scan */
  border-radius: 6px;
}
.join-qr svg { display: block; width: 100%; height: auto; }
.join-poster-or {
  margin: 1.5rem 0 .5rem;
  font-size: clamp(.9rem, 2.4vmin, 1.15rem);
  color: var(--text-dim);
}
.join-code {
  display: inline-block;
  padding: .4rem 1.1rem;
  border: 2px dashed var(--amber-line);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: clamp(2rem, 9vmin, 4.5rem);
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--amber);
}

@media print {
  .join-poster { border-color: #999 !important; }
  .join-code   { color: #000 !important; border-color: #666 !important; }
  .join-qr     { background: #fff !important; }
}

/* ---------------------------------------------------------------------
   Run-of-show sheet.
   --------------------------------------------------------------------- */
.ros-phase { break-inside: avoid; }
.ros-say {
  border-left: 3px solid var(--amber-line);
  padding-left: .9rem;
  font-size: 1.05rem;
}
.ros-do li { margin-bottom: .35rem; }

/* ---------------------------------------------------------------------
   Print: the host's prep sheet. Ink-friendly, chrome stripped.
   --------------------------------------------------------------------- */
@media print {
  .navbar, footer, .no-print, .alert-dismissible { display: none !important; }
  html { color-scheme: light !important; background: #fff !important; }  /* dark mode would tint the paper */
  body { background: #fff !important; }
  main.container { max-width: 100%; }
  body, .card, .player-badge, .ros-say, .script-body, .confess-script,
  h1, h2, h3, h4, h5, h6, p, li, small, span, div, blockquote {
    color: #000 !important;
    background: transparent !important;
  }
  .card::before, .char-card::after { display: none !important; }
  .player-badge, .card { border: 1px solid #999 !important; }
  .player-badge .qr { background: #fff !important; }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
  .script-body, .confess-script, .ros-say { border-left: 3px solid #666 !important; }
  .stage-hold, .mission-card, .puzzle-card, .script-card, .ros-phase { break-inside: avoid; }
  a[href]::after { content: ""; }
}

/* ---------------------------------------------------------------------
   Reveal pop-ups (render_wrapup): one-tap star rating, then the email list.
   --------------------------------------------------------------------- */
.wrap-modal .modal-content {
  background: var(--panel);
  border: 1px solid var(--amber-line);
  border-radius: var(--radius);
}
.wrap-modal .text-amber { color: var(--amber); }
/* Buttons are in the markup 5→1; row-reverse shows them 1→5, and that order is
   what lets ~ light every star BEFORE the hovered one. */
.star-pick {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: .25rem;
}
.star-pick-btn {
  background: none;
  border: 0;
  padding: 0;
  min-width: 3.25rem;
  min-height: 3.25rem;                 /* a thumb, at every text size */
  font-size: 2.25rem;
  line-height: 1;
  color: var(--edge-solid);
  transition: color .12s ease, transform .12s ease;
}
.star-pick-btn:hover,
.star-pick-btn:hover ~ .star-pick-btn,
.star-pick-btn:focus-visible,
.star-pick-btn:focus-visible ~ .star-pick-btn { color: var(--amber); }
.star-pick-btn:hover { transform: scale(1.12); }
.star-pick-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

/* "The game has moved on" — shown instead of an automatic reload when the
   guest is midway through typing something (see [data-watch] in app.js). */
.game-moved-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 1080;
  max-width: calc(100% - 2rem);
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .5);
}

/* ---------------------------------------------------------------------
   Host "Getting started" guide (src/host_guide.php). Calm and roomy on
   purpose: one short sentence per step, nothing competing for attention.
   --------------------------------------------------------------------- */
.host-guide .modal-content {
  background: var(--panel);
  border: 1px solid var(--amber-line);
  border-radius: var(--radius);
}
.guide-tabs { gap: .35rem; flex-wrap: wrap; }
.guide-tabs .nav-link {
  padding: .35rem .7rem;
  font-size: .9rem;
  color: var(--text-dim);
}
.guide-tabs .nav-link.active { background: var(--amber-soft); color: var(--amber); }
.guide-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-family: var(--mono);
  font-size: .8em;
}
.guide-steps { list-style: none; padding: 0; margin: 0; }
.guide-steps li {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .6rem 0;
  border-bottom: 1px solid var(--edge);
  line-height: 1.45;
}
.guide-steps li:last-child { border-bottom: 0; }
.guide-steps .bi { color: var(--amber); font-size: 1.25rem; line-height: 1.2; flex-shrink: 0; }
.guide-tip {
  margin: 1rem 0 0;
  padding: .6rem .8rem;
  border-radius: var(--radius);
  background: var(--amber-soft);
  font-size: .9rem;
}
.guide-tip .bi { color: var(--amber); }

/* ---------------------------------------------------------------------
   Login codes summary (host_assign mode of host/joincode.php). One card per
   seat: a single column on a phone, a grid on wider screens and on paper.
   The code is the biggest thing on the card because it's what gets read
   aloud or copied off a printout. All rem, so the text-size control scales it.
   --------------------------------------------------------------------- */
.login-howto { color: var(--text-dim); margin-bottom: .35rem; }
.login-howto strong { color: var(--text); }
.login-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
.login-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}
.login-card-char {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.login-card-char .pronoun-tag { margin-left: .3rem; vertical-align: middle; }
.login-card-guest { color: var(--text-dim); margin-top: .15rem; overflow-wrap: anywhere; }
.login-card-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .5rem .55rem .85rem;
  background: var(--ink-2);
  border: 1px dashed var(--amber-line);
  border-radius: var(--radius);
}
.login-code {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: .2em;
  line-height: 1.2;
  color: var(--amber);
}
.login-card-code .btn { min-width: 2.75rem; min-height: 2.75rem; flex-shrink: 0; }  /* a thumb-sized target */
@media print {
  .login-grid { grid-template-columns: repeat(3, 1fr); }
  .login-card {
    break-inside: avoid;
    background: #fff !important;
    border: 1px solid #999 !important;
  }
  .login-card-code { background: #fff !important; border-color: #666 !important; }
  .login-code, .login-card-guest, .login-howto, .login-howto strong { color: #000 !important; }
}

/* ---------------------------------------------------------------------
   The cheat sheet: three lines above the dossier (render_cheat_sheet()).
   --------------------------------------------------------------------- */
.cheat-sheet { border-color: var(--amber-line); background: var(--panel-2); }
.cheat-flag {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--amber); margin-bottom: .25rem;
}
.cheat-line { display: flex; gap: .6rem; padding: .2rem 0; font-size: .92rem; }
.cheat-label { flex: 0 0 6.2rem; color: var(--text-dim); font-size: .8rem; padding-top: .1rem; }
.cheat-body { flex: 1 1 auto; }

/* ---------------------------------------------------------------------
   The Host Guide (host/guide.php, rendered from docs/ by src/markdown.php)
   --------------------------------------------------------------------- */
.guide-doc h2 { font-size: 1.35rem; margin-top: 2rem; color: var(--amber); }
.guide-doc h3 { font-size: 1.12rem; margin-top: 1.6rem; }
.guide-doc h4, .guide-doc h5 { font-size: 1rem; margin-top: 1.2rem; }
.guide-doc li { margin-bottom: .3rem; }
.guide-doc hr { margin: 2rem 0; border-color: var(--edge-solid); opacity: 1; }
.guide-tip {
  border-left: 3px solid var(--amber); background: var(--amber-soft);
  padding: .6rem .9rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1rem 0;
}
.guide-code { background: var(--ink-2); padding: .6rem .8rem; border-radius: var(--radius); }
.guide-table { --bs-table-bg: transparent; font-size: .92rem; }

/* ---------------------------------------------------------------------
   Party night arrivals: How to play, the warm-up (preparty_view.php)
   --------------------------------------------------------------------- */
.howto-steps { padding-left: 0; list-style: none; counter-reset: none; }
.howto-steps li { display: flex; gap: .6rem; padding: .3rem 0; }
.howto-steps li > i { color: var(--amber); flex: 0 0 1.2rem; padding-top: .1rem; }
.warmup-card { border-color: var(--amber-line); }
.warmup-line { font-style: italic; font-size: 1.1rem; }
.warmup-find { padding: .45rem 0; border-top: 1px solid var(--edge); }
.ready-ticks { font-size: .78rem; }
[hidden] { display: none !important; }
/* Setup wizard: the host's name and character show only while "Yes, I'm playing"
   is picked. In CSS so it works even if the script is slow or an old copy. */
form:has(input[name="host_plays"][value="0"]:checked) [data-show-if="host_plays=1"] { display: none !important; }

/* The line under a host's main button saying what it leads to (next_beat_text()). */
.next-beat { font-size: .8rem; color: var(--text-dim); margin-top: .35rem; }
.guide-doc a { color: var(--amber); }
.guide-doc a:hover { color: #dcbd7d; }

.cheat-secret { filter: blur(5px); cursor: pointer; color: inherit; transition: filter .2s; }
.cheat-secret.revealed { filter: none; }
.cheat-secret { background: none; border: 0; padding: 0; font: inherit; }

/* ---------------------------------------------------------------------
   Traits & facts to share (render_share_card()) and What to wear & bring
   --------------------------------------------------------------------- */
.share-card { border: 1px solid var(--amber-line); border-radius: var(--radius); padding: .75rem .9rem; background: var(--amber-soft); }
.share-flag, .wear-flag {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--amber); margin-bottom: .35rem;
}
.share-head { font-size: .8rem; color: var(--text-dim); margin-top: .35rem; }
.share-list { margin: .2rem 0 .3rem; padding-left: 1.1rem; }
.share-list li { margin-bottom: .2rem; }
.wear-row { display: flex; gap: .6rem; padding: .3rem 0; }
.wear-row > i { color: var(--amber); flex: 0 0 1.2rem; padding-top: .1rem; }

/* ---------------------------------------------------------------------
   CORPORATE MODE (src/corporate_view.php, public/host/corporate.php).
   The guest's team card: which team, and the Zoom room to choose, big.
   --------------------------------------------------------------------- */
.corp-team-card { border-color: var(--amber-line); }
.corp-kicker {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em;
  font-size: .75rem; color: var(--text-dim); margin-bottom: .35rem;
}
.corp-team-name { font-family: var(--mono); color: var(--amber); overflow-wrap: anywhere; }
.corp-room {
  display: inline-block; margin-top: .5rem; padding: .35rem .8rem;
  border: 1px solid var(--amber-line); border-radius: var(--radius);
  background: var(--amber-soft); font-family: var(--mono); font-size: 1.15rem;
}
.corp-qr { width: 8.5rem; padding: 8px; flex-shrink: 0; }
.corp-move { width: auto; min-width: 6.5rem; }
.corp-members li + li { border-top: 1px solid var(--edge); }
.presence-dot {
  width: .55rem; height: .55rem; border-radius: 50%; flex-shrink: 0;
  background: var(--edge-solid);
}
.presence-dot.is-here { background: var(--green); }
/* Corporate guests mostly sit at a computer beside Zoom: one column on a
   phone, two from a half-screen laptop window up, never a sprawling page. */
.corp-stage { max-width: 62rem; margin: 0 auto; }
@media (min-width: 992px) {
  .corp-team-name { font-size: 2.6rem; }
  .corp-room { font-size: 1.4rem; }
}

/* Corporate rounds: the strip atop each screen, the lead, the question,
   the Zoom chat card and the standings. */
.corp-strip {
  display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: baseline;
  padding: .5rem .8rem; border: 1px solid var(--edge); border-radius: var(--radius);
  background: var(--panel); font-size: .9rem;
}
.corp-strip-round { font-family: var(--mono); color: var(--amber); text-transform: uppercase; letter-spacing: .08em; }
.corp-strip-title { color: var(--text); }
.corp-strip-team  { color: var(--text-dim); margin-left: auto; }
.corp-col-head { font-family: var(--mono); color: var(--amber); font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; }
.corp-lead-card { border-color: var(--amber-line); }
.corp-question-card { border-color: var(--amber-line); background: var(--panel-2); }
.corp-option {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .55rem .7rem; margin-bottom: .4rem;
  border: 1px solid var(--edge); border-radius: var(--radius);
}
.corp-option.form-check { padding-left: .7rem; }
.corp-option .form-check-input { margin: .25rem 0 0; flex-shrink: 0; float: none; }
.corp-option .form-check-label { cursor: pointer; flex: 1; }
.corp-option:has(.form-check-input:checked) { border-color: var(--amber); background: var(--amber-soft); }
.corp-letter {
  display: inline-block; min-width: 1.6rem; text-align: center;
  font-family: var(--mono); font-weight: 700; color: var(--amber);
}
.corp-locked { font-size: 1.1rem; color: var(--green); }
.corp-chat-card { border-color: var(--amber); background: var(--amber-soft); }
.corp-place { font-family: var(--mono); font-size: 2.6rem; color: var(--amber); line-height: 1.1; }
.corp-board { padding-left: 1.6rem; }
.corp-board li { padding: .3rem 0; border-bottom: 1px solid var(--edge); }
.corp-board li > span { display: inline-block; }
.corp-board li.is-mine { color: var(--amber); font-weight: 600; }
.corp-board .corp-points { float: right; font-family: var(--mono); }
.corp-earlier > summary { cursor: pointer; color: var(--text-dim); font-family: var(--mono); font-size: .85rem; }
.corp-run-card { border-color: var(--amber-line); }
.corp-host-script {
  padding: .75rem .9rem; border-left: 3px solid var(--amber);
  background: var(--panel-2); border-radius: var(--radius); font-size: 1.05rem; line-height: 1.55;
  max-height: 22rem; overflow-y: auto;
}
/* The A-F letter beside each choice on Admin -> Team questions. */
.input-group-text.corp-letter { min-width: 2.4rem; justify-content: center; line-height: 1.5; }
/* The admin bar: five links wrap onto a second line on a phone (layout.php). */
.navbar .nav-wrap { min-width: 0; flex: 1 1 0; }

/* ---------------------------------------------------------------------
   CORPORATE BIG SCREEN (host/bigscreen.php): shared in Zoom, so it is read
   in a small window. Everything scales with the viewport (vmin) and the
   stage fills the screen without scrolling.
   --------------------------------------------------------------------- */
body.is-bare { background: var(--ink); }
.big-screen { min-height: 100vh; display: flex; }
.big-stage {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 4vmin 6vmin 3vmin; text-align: center;
}
.big-inner { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1.6vmin; }
.big-kicker {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .16em;
  color: var(--amber); font-size: clamp(.9rem, 2.4vmin, 1.6rem);
}
.big-title { font-family: var(--mono); font-size: clamp(2rem, 8vmin, 6rem); line-height: 1.05; margin: 0; overflow-wrap: anywhere; }
.big-lead { font-size: clamp(1.2rem, 4vmin, 2.6rem); margin: 0; }
.big-sub { font-size: clamp(1rem, 2.8vmin, 1.8rem); color: var(--text-dim); margin: 0; }
.big-question { font-size: clamp(1.3rem, 4.4vmin, 3rem); max-width: 80vw; }
.big-answer { font-size: clamp(1.5rem, 6vmin, 4.2rem); color: var(--green); font-weight: 600; }
.big-letter { font-family: var(--mono); color: var(--amber); margin-right: .3em; }
.big-timer { font-family: var(--mono); font-size: clamp(2.5rem, 14vmin, 9rem); color: var(--amber); line-height: 1; }
.big-join { display: flex; align-items: center; justify-content: center; gap: 5vmin; margin-top: 2vmin; text-align: left; flex-wrap: wrap; }
.join-qr.big-qr { width: clamp(150px, 34vmin, 380px); margin: 0; padding: 1.4vmin; }
.big-url { font-size: clamp(1rem, 3.4vmin, 2.2rem); overflow-wrap: anywhere; }
.big-code { font-family: var(--mono); font-size: clamp(2rem, 9vmin, 6rem); color: var(--amber); letter-spacing: .12em; line-height: 1; }
.big-count { font-size: clamp(1.1rem, 3.4vmin, 2.2rem); color: var(--text-dim); margin-top: 1vmin; }
.big-count strong { color: var(--text); }
.big-progress { width: min(70vw, 60rem); margin-top: 2vmin; }
.big-progress-label { font-size: clamp(1.1rem, 3.4vmin, 2.2rem); margin-bottom: 1vmin; }
.big-bar { height: clamp(10px, 2vmin, 22px); border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.big-bar > span { display: block; height: 100%; background: var(--amber); transition: width .6s ease; }
.big-board {
  width: min(70vw, 50rem); margin: 1vmin auto 0; padding-left: 0; list-style-position: inside;
  font-size: clamp(1.1rem, 3.6vmin, 2.4rem); text-align: left;
}
.big-board li { display: flex; gap: 1em; padding: .35em .2em; border-bottom: 1px solid var(--edge); }
.big-board li::before { content: attr(value) "."; font-family: var(--mono); color: var(--amber); min-width: 1.8em; }
.big-board li > span:first-child { flex: 1; overflow-wrap: anywhere; }
.big-points { font-family: var(--mono); }
.big-winner { font-family: var(--mono); font-size: clamp(1.6rem, 6vmin, 4rem); color: var(--amber); }
.big-solution { display: flex; flex-wrap: wrap; justify-content: center; gap: 2vmin 6vmin; }
.big-solution .big-answer { font-size: clamp(1.2rem, 4.2vmin, 3rem); }
.big-foot { font-size: clamp(.85rem, 2.2vmin, 1.4rem); color: var(--text-dim); }
.big-foot strong { color: var(--text); }
.corp-copy-line { padding: .45rem 0; border-top: 1px solid var(--edge); }
/* Corporate reveal: your team's awards, and the Big Screen's awards row. */
.corp-my-awards .badge { font-size: .8rem; margin: .15rem; }
.big-awards { display: flex; flex-wrap: wrap; justify-content: center; gap: 1vmin 6vmin; margin: 1.5vmin 0 .5vmin; }
.big-award-name { font-family: var(--mono); font-size: clamp(1.1rem, 3.6vmin, 2.4rem); color: var(--text); }

/* ---------------------------------------------------------------------
   The host's Setup wizard (host/setup.php): a numbered step strip, one card
   per step, and Back / Next that span the screen on a phone.
   --------------------------------------------------------------------- */
.wizard { max-width: 40rem; margin: 0 auto; }
.wizard-steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: .35rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.wizard-steps a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .4rem .2rem;
  border-top: 3px solid var(--edge-solid);
  color: var(--text-dim);
  text-decoration: none;
  font-size: .8rem;
  text-align: center;
}
.wizard-num {
  font-family: var(--mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  border: 1px solid var(--edge-solid);
}
.wizard-steps .done a { border-top-color: var(--amber-line); color: var(--text); }
.wizard-steps .current a { border-top-color: var(--amber); color: var(--amber); font-weight: 600; }
.wizard-steps .current .wizard-num { border-color: var(--amber); background: var(--amber-soft); }
.wizard-number { max-width: 9rem; font-size: 1.25rem; }
.wizard-nav {
  display: flex;
  gap: .5rem;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--edge);
}
.wizard-nav .btn-primary { margin-left: auto; }
@media (max-width: 575.98px) {
  .wizard-label { font-size: .72rem; line-height: 1.15; }
  .wizard-nav .btn { flex: 1 1 0; }
}

/* ---------------------------------------------------------------------
   Secret Missions (src/sm_view.php): three tabs on one row at 375px.
   --------------------------------------------------------------------- */
.sm-tabs { flex-wrap: nowrap; }
.sm-tabs .nav-link { padding: .45rem .4rem; font-size: .9rem; white-space: nowrap; }
.sm-fact { border-left: 2px solid var(--amber-line); padding-left: .6rem; }
.sm-exchange summary, .sm-case summary { cursor: pointer; list-style: none; }
