/* ============================================================================
 * styles.css — presentation layer only. Colours & radii live as CSS variables
 * in :root so the whole "warm paper terminal" theme can be retuned in one place.
 * ========================================================================== */

:root {
  /* surfaces */
  --paper:        #ece7db;   /* page backdrop */
  --card:         #f7f3ea;   /* the phone-width column */
  --surface:      #fffdf8;   /* raised cards / options */
  --surface-2:    #fdfaf3;   /* poll cards */
  --surface-sunk: #f2ead9;   /* prompt bodies, copy chips */
  --terminal:     #16130d;   /* command rows */
  --terminal-ink: #f2ecdd;

  /* ink */
  --ink:      #1b1a17;
  --ink-soft: #6c675b;
  --ink-mute: #9b9483;
  --ink-faint:#b8b0a0;

  /* accent (amber) */
  --accent:       #d68a1e;
  --accent-deep:  #b3560f;
  --accent-hover: #8a4109;
  --accent-tint:  #f3d9a6;
  --accent-wash:  #fbf1dd;

  /* lines */
  --line:      #e2dac9;
  --line-soft: #e6dfd0;

  /* semantic */
  --ok:      #3f8f5f;
  --ok-bg:   #e9f4ec;
  --bad:     #c0563f;
  --bad-bg:  #f7e9e6;

  --radius:  14px;
  --shadow:  0 0 80px -30px rgba(80, 60, 20, .35);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  font-family: var(--mono);
  color: var(--ink);
}
a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent-hover); }
input, button { font-family: inherit; }
input:focus { outline: none; }
::selection { background: var(--accent-tint); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- app shell */
.page { min-height: 100vh; display: flex; justify-content: center; background: var(--paper); }
.app  {
  width: 100%; max-width: 640px; min-height: 100vh;
  background: var(--card); display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}

/* On phones the sheet runs edge-to-edge (above). From tablet up it becomes a
 * centred, floating "paper" sheet: wider measure, more air, real separation
 * from the backdrop, and a larger type ramp. Content stays a single column —
 * each step is a heading plus one widget, so columns would only leave gaps. */
@media (min-width: 720px) {
  .page { align-items: flex-start; padding: 40px 24px; }
  .app {
    max-width: 780px;
    min-height: calc(100vh - 80px);
    border: 1px solid var(--line-soft);
    border-radius: 22px;
    box-shadow: 0 32px 90px -48px rgba(70, 52, 18, .55), 0 2px 10px -6px rgba(70, 52, 18, .2);
  }
  /* Round the sticky bars to match the sheet without clipping (which would
   * break position:sticky). */
  .header { padding: 28px 44px 16px; border-top-left-radius: 22px; border-top-right-radius: 22px; }
  .content { padding: 40px 44px; gap: 26px; }
  .footer { padding: 20px 44px 26px; border-bottom-left-radius: 22px; border-bottom-right-radius: 22px; }

  .nav-row { margin-top: 18px; }
  .intro { font-size: 15px; }
  h1.xl { font-size: 42px; }
  h1.lg { font-size: 32px; }
  h1.md { font-size: 26px; }
}

@media (min-width: 1100px) {
  .page { padding: 56px 24px; }
  .app {
    max-width: 860px;
    min-height: calc(100vh - 112px);
    border-radius: 26px;
  }
  .header { padding: 32px 56px 18px; border-top-left-radius: 26px; border-top-right-radius: 26px; }
  .content { padding: 48px 56px; gap: 28px; }
  .footer { padding: 22px 56px 30px; border-bottom-left-radius: 26px; border-bottom-right-radius: 26px; }

  h1.xl { font-size: 48px; }
  h1.lg { font-size: 36px; }
}

/* ----------------------------------------------------------------- header */
.header {
  position: sticky; top: 0; z-index: 5; background: var(--card);
  padding: 22px 26px 14px; border-bottom: 1px solid var(--line-soft);
}
.header-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.header-row .ctx b { font-weight: 600; }
.header-row .pct { color: var(--accent-deep); }
.header-row .zone { color: var(--ink-mute); letter-spacing: .08em; text-transform: uppercase; }

.progress { height: 3px; background: var(--line-soft); border-radius: 2px; margin-top: 9px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }

.nav-row { display: flex; align-items: center; gap: 7px; margin-top: 14px; }
.steps { display: flex; gap: 6px; flex: 1; overflow-x: auto; padding-bottom: 2px; }
.lang  { display: flex; gap: 4px; flex: none; }

.chip {
  flex: none; min-width: 34px; height: 32px; padding: 0 9px; border-radius: 8px;
  font-size: 12px; cursor: pointer; transition: all .2s ease;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
}
.chip.is-active { border-color: var(--accent); background: var(--accent); color: #fff; }
.chip.is-future { color: var(--ink-faint); }

.lang-btn {
  min-width: 34px; height: 32px; border-radius: 8px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-mute);
}
.lang-btn.is-on { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-deep); }

/* ---------------------------------------------------------------- content */
.content { flex: 1; padding: 26px; display: flex; flex-direction: column; gap: 22px; animation: rise .35s ease; }
.block   { display: flex; flex-direction: column; gap: 12px; }
.block.gap-16 { gap: 16px; }

.kicker { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep); }
h1 { margin: 0; font-weight: 600; line-height: 1.15; }
h1.xl { font-size: 34px; line-height: 1.12; letter-spacing: -0.01em; }
h1.lg { font-size: 28px; }
h1.md { font-size: 24px; line-height: 1.25; }
.intro { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-soft); }

.badge {
  align-self: flex-start; border: 1px solid var(--accent); color: var(--accent-deep);
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
}

.mode { display: flex; gap: 6px; background: #efe7d6; padding: 4px; border-radius: 11px; align-self: flex-start; }
.mode-btn {
  border: none; cursor: pointer; font-size: 12.5px; padding: 8px 14px; border-radius: 8px;
  transition: all .2s ease; background: transparent; color: var(--ink-soft); font-weight: 400;
}
.mode-btn.is-on { background: var(--accent); color: #fff; font-weight: 600; }

/* ------------------------------------------------------------------- poll */
.poll-card {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 16px;
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.poll-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); }
.poll-q { font-size: 15px; font-weight: 600; }
.poll-opts { display: flex; flex-direction: column; gap: 8px; }
.poll-opt {
  position: relative; overflow: hidden; text-align: left; width: 100%;
  border-radius: 10px; padding: 12px 14px; font-size: 13px; cursor: pointer;
  transition: all .25s ease; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.poll-opt.is-voted { cursor: default; background: #f4ecdb; }
.poll-opt.is-you   { border-color: var(--accent); }
.poll-opt .row { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; }
.poll-opt .pct { font-weight: 600; color: var(--ink-mute); }
.poll-opt.is-you .pct { color: var(--accent-deep); }
.poll-opt .bar { position: absolute; left: 0; top: 0; bottom: 0; z-index: 0; background: #ece2cd; transition: width .5s ease; }
.poll-opt.is-you .bar { background: var(--accent-tint); }
.poll-foot { font-size: 11px; color: var(--ink-mute); }

/* ------------------------------------------------------------------- quiz */
.quiz-head { display: flex; justify-content: space-between; align-items: baseline; }
.quiz-score { font-size: 12px; color: var(--ink-mute); }
.quiz-opts { display: flex; flex-direction: column; gap: 9px; }
.quiz-opt {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  text-align: left; width: 100%; cursor: pointer; border-radius: 10px; padding: 13px 14px;
  font-size: 13.5px; transition: all .2s ease; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.quiz-opt.answered { cursor: default; }
.quiz-opt.is-correct { border-color: var(--ok); background: var(--ok-bg); }
.quiz-opt.is-wrong   { border-color: var(--bad); background: var(--bad-bg); }
.quiz-opt.is-dim     { background: #f4ecdb; }
.quiz-tag { font-weight: 600; }
.quiz-tag.ok  { color: var(--ok); }
.quiz-tag.bad { color: var(--bad); }

.verdict {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.verdict-text { font-size: 13px; line-height: 1.55; color: #4a463c; }
.verdict-text b { font-weight: 600; }

.btn-primary {
  align-self: flex-start; background: var(--accent); color: #fff; border: none;
  font-size: 13px; font-weight: 600; padding: 10px 18px; border-radius: 9px; cursor: pointer;
}

/* ---------------------------------------------------------------- prompts */
.prompt {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.prompt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.prompt-title { font-size: 14px; font-weight: 600; }
.prompt-body {
  font-size: 12.5px; line-height: 1.55; color: #4a463c; background: var(--surface-sunk);
  border-radius: 8px; padding: 12px; white-space: pre-wrap;
}
.copy-btn {
  flex: none; border: 1px solid var(--line); background: var(--surface-sunk); color: var(--ink-soft);
  font-size: 11px; padding: 6px 11px; border-radius: 7px; cursor: pointer; transition: all .2s ease;
}
.copy-btn.is-done { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.copy-btn.dark { border: 1px solid #3a342a; background: #26221a; color: #d8cfbd; }
.copy-btn.dark.is-done { border-color: var(--ok); background: #1f2a20; color: #7fd6a0; }

/* ------------------------------------------------------------------ setup */
.cmd-row {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line);
  background: var(--terminal); border-radius: 10px; padding: 12px 14px;
}
.cmd-row .sigil { color: var(--accent); }
.cmd-row code { flex: 1; font-size: 13px; color: var(--terminal-ink); }

.join-card {
  display: flex; align-items: center; gap: 14px; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--radius); padding: 16px;
}
/* Real scannable QR (generated by qr.js as inline SVG). */
.share-card {
  display: flex; align-items: center; gap: 14px; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--radius); padding: 14px 16px;
}
.share-qr { width: 84px; height: 84px; flex: none; }
.share-qr svg { display: block; width: 100%; height: 100%; border-radius: 6px; border: 1px solid var(--line); }
.join-body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.join-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-mute); }
.join-url { font-size: 15px; font-weight: 600; word-break: break-all; }
.join-hint { font-size: 12px; color: var(--ink-soft); }

/* ------------------------------------------------ live room + presence */
/* Compact count that lives in the header row. */
.room-pill {
  font-size: 12px; color: var(--accent-deep); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Full breakdown card on the start screen. */
.room-card {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 12px 15px; font-size: 13px; color: var(--ink-soft); min-height: 46px;
}
.room-card:empty { display: none; }
.room-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none;
  box-shadow: 0 0 0 0 rgba(63, 143, 95, .5); animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(63, 143, 95, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(63, 143, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 143, 95, 0); }
}
.room-count { color: var(--ink); }
.room-count b { color: var(--accent-deep); font-weight: 700; font-size: 15px; }
.room-breakdown { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.room-seg { color: var(--ink-mute); font-size: 12px; }
.room-seg b { color: var(--ink-soft); font-weight: 600; }
.room-off { color: var(--ink-mute); font-size: 12px; }

/* -------------------------------------------------- named roster (rail) */
/* Sticky side rail beside the sheet on wide screens; hidden on phones (where
 * the same people show as chips inside the start room-card instead). */
.roster {
  flex: none; width: 210px; align-self: flex-start;
  position: sticky; top: 56px; max-height: calc(100vh - 96px);
  display: none; flex-direction: column;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px;
  padding: 14px; box-shadow: var(--shadow);
}
.roster-head {
  display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-mute);
  padding: 2px 4px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .06em;
}
.roster-head b { color: var(--accent-deep); font-size: 15px; font-weight: 700; }
.roster-list { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.roster-empty { font-size: 12px; color: var(--ink-mute); padding: 6px 4px; }

.rmate { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 9px; }
.rmate.is-me { background: var(--accent-wash); }
.rmate-av {
  flex: none; width: 28px; height: 28px; border-radius: 50%; color: #fff;
  font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.rmate-name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmate.is-me .rmate-name { font-weight: 600; }

/* In-card chips — the phone / narrow fallback for the rail. */
.room-mates { display: flex; flex-wrap: wrap; gap: 6px; }
.room-mates:empty { display: none; }
.room-mates .rmate {
  gap: 6px; padding: 4px 11px 4px 4px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface);
}
.room-mates .rmate-av { width: 22px; height: 22px; font-size: 10px; }
.room-mates .rmate-name { font-size: 12px; }

@media (min-width: 1200px) {
  .page { gap: 28px; }
  .roster { display: flex; }          /* the media query; JS may still inline-hide it in local mode */
  .room-mates { display: none; }      /* rail replaces the chips on desktop */
}

/* ------------------------------------------------------------ join step */
.join-card {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--accent-tint); background: var(--accent-wash);
  border-radius: var(--radius); padding: 18px;
}
.join-card.shake { animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.join-tag { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep); }
.join-input {
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px;
  padding: 12px 13px; font-size: 15px; color: var(--ink);
}
.join-input:focus { border-color: var(--accent); }
.join-exp-label { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.exp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.exp-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  font-size: 13px; padding: 9px 15px; border-radius: 999px; cursor: pointer; transition: all .18s ease;
}
.exp-chip:hover { border-color: var(--accent-tint); }
.exp-chip.is-sel { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.join-btn {
  align-self: flex-start; background: var(--accent); color: #fff; border: none;
  font-size: 14px; font-weight: 600; padding: 11px 24px; border-radius: 9px; cursor: pointer; margin-top: 2px;
}
.join-privacy { font-size: 11px; color: var(--ink-mute); line-height: 1.45; }
.join-done {
  border: 1px solid var(--ok); background: var(--ok-bg); border-radius: 11px;
  padding: 12px 15px; font-size: 14px; font-weight: 600; color: var(--ok);
}

/* --------------------------------------------- poll results by segment */
.poll-seg[hidden] { display: none; }
.poll-seg { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.poll-seg summary {
  cursor: pointer; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-mute); list-style: none; display: flex; align-items: center; gap: 7px;
}
.poll-seg summary::-webkit-details-marker { display: none; }
.poll-seg summary::before { content: "▸"; color: var(--accent-deep); }
.poll-seg[open] summary::before { content: "▾"; }
.seg-body { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.seg-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 2px; }
.seg-key { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-soft); }
.seg-key i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.seg-row { display: flex; align-items: center; gap: 10px; }
.seg-lab { flex: none; width: 92px; font-size: 12px; color: var(--ink-soft); }
.seg-lab b { color: var(--ink); font-weight: 600; }
.seg-bar {
  flex: 1; height: 14px; border-radius: 5px; overflow: hidden; display: flex;
  background: var(--surface-sunk); border: 1px solid var(--line);
}
.seg-bar span { height: 100%; transition: width .5s ease; }

/* ------------------------------------------------------ live reactions */
/* Floats just above the footer (which is position:relative), right-aligned, so
 * it tracks the footer height and never covers poll content. */
.react-dock {
  position: absolute; right: 20px; bottom: 100%; margin-bottom: 12px; z-index: 20;
  display: flex; flex-direction: row; gap: 8px;
}
.react-fab {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); box-shadow: 0 6px 18px -8px rgba(70, 52, 18, .5);
  font-size: 20px; line-height: 1; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.react-fab:hover { transform: scale(1.12); box-shadow: 0 8px 22px -8px rgba(70, 52, 18, .6); }
.react-fab:active { transform: scale(.92); }
/* Floating emoji (appended to <body>, so it survives re-renders). */
.fly-react {
  position: fixed; z-index: 40; pointer-events: none; font-size: 30px;
  transform: translate(-50%, -50%); animation: fly 1.7s ease-out forwards;
}
@keyframes fly {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  15%  { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -180px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .room-dot, .join-card.shake, .fly-react { animation-duration: .01ms; }
}

/* -------------------------------------------------------------------- ref */
.ref-link {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--line); background: var(--surface); border-radius: 11px;
  padding: 14px 15px; color: var(--ink);
}
.ref-link .txt { display: flex; flex-direction: column; gap: 2px; }
.ref-label { font-size: 14px; font-weight: 600; }
.ref-url { font-size: 11px; color: var(--ink-mute); }
.ref-arrow { color: var(--accent-deep); }

.session-row {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 12px; padding: 14px 15px;
}
.session-row .url { flex: 1; font-size: 13px; color: #4a463c; }

/* ----------------------------------------------------------------- footer */
.footer {
  position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line-soft);
  padding: 16px 26px 22px; display: flex; justify-content: space-between; align-items: center;
}
.btn-back {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  font-size: 13px; padding: 11px 20px; border-radius: 10px; cursor: pointer;
}
.btn-back.is-disabled { color: #cfc7b6; cursor: default; opacity: .5; }
.step-counter { font-size: 11px; color: var(--ink-faint); }
.btn-next {
  border: none; background: var(--accent); color: #fff; font-weight: 600;
  font-size: 13px; padding: 11px 26px; border-radius: 10px; cursor: pointer;
}
.btn-next.is-hidden { visibility: hidden; }

.foot-mid { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pres-toggle {
  background: none; border: none; color: var(--ink-mute); font-size: 11px;
  cursor: pointer; text-decoration: underline; padding: 0;
}
.pres-toggle.is-on { color: var(--accent-deep); }

/* ============================================================================
 * Components ported from the v1 deck (foundations → reference).
 * ========================================================================== */

/* progress meter zones */
.progress > i.is-warn { background: var(--accent-deep); }
.progress > i.is-dumb { background: var(--bad); }

/* rich prose inside intros / lists / cards */
.intro strong, .intro em { color: var(--ink); font-weight: 600; font-style: normal; }

/* generic card + section tag */
.card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px; }
.tag  { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep); margin-bottom: 10px; }

/* badges row (start screen) */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge.live  { border-color: var(--ok);  color: var(--ok); }
.badge.local { border-color: var(--bad); color: var(--bad); }
.badge.pres  { border-color: var(--accent); color: var(--accent-deep); }

/* lists */
.lede-list, .plain-list {
  margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px;
  font-size: 14px; line-height: 1.55; color: var(--ink-soft);
}
.plain-list { gap: 8px; font-size: 13.5px; }
.lede-list li, .plain-list li { margin: 0; }
.lede-list strong, .plain-list strong { color: var(--ink); font-weight: 600; }
.lede-list a, .plain-list a { font-weight: 600; }
.try-block { display: flex; flex-direction: column; gap: 12px; }

/* "what you'd see" watch card */
.watch-card { font-size: 13.5px; line-height: 1.55; color: #4a463c; }
.watch-card strong { color: var(--ink); font-weight: 600; }

/* inline quiz (question + options live inside a .card) */
.quiz-q { font-size: 16px; font-weight: 600; line-height: 1.3; margin-bottom: 14px; }
.quiz-explain {
  margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--ok);
  background: var(--surface-sunk); border-radius: 0 10px 10px 0;
  font-size: 13px; line-height: 1.55; color: #4a463c;
}
.quiz-explain b.ok  { color: var(--ok); }
.quiz-explain b.bad { color: var(--bad); }

/* context-window widget */
.ctx-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.ctx-widget input[type=range] { width: 100%; margin: 14px 0 10px; accent-color: var(--accent); }
.ctx-bar {
  position: relative; height: 24px; border-radius: 8px; overflow: hidden;
  background: var(--surface-sunk); border: 1px solid var(--line);
}
.ctx-fill { height: 100%; width: 0; background: var(--accent); transition: width .1s, background-color .3s; }
.ctx-fill.warn { background: var(--accent-deep); }
.ctx-fill.dumb { background: var(--bad); }
.ctx-marks { position: absolute; inset: 0; pointer-events: none; }
.ctx-marks span { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(60, 45, 15, .18); }
.ctx-read { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: 13px; color: var(--ink-soft); }
.ctx-read b { color: var(--accent-deep); font-weight: 600; }
.ctx-verdict {
  margin-top: 12px; font-size: 13px; line-height: 1.5; padding: 10px 12px;
  border-radius: 8px; background: var(--surface-sunk); border: 1px solid var(--line);
}
.ctx-verdict b.ok   { color: var(--ok); }
.ctx-verdict b.warn { color: var(--accent-deep); }
.ctx-verdict b.bad  { color: var(--bad); }

/* bloat exercise */
.bloat-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.bloat-lines { margin-top: 12px; border-top: 1px solid var(--line); }
.bloat-line {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  padding: 10px 6px; color: var(--ink); font-size: 12.5px; line-height: 1.5; cursor: pointer;
}
.bloat-line:hover { background: var(--surface-sunk); }
.bloat-line .ln { color: var(--accent); min-width: 22px; flex: none; }
.bloat-line.cut { text-decoration: line-through; color: var(--ink-mute); }
.bloat-line.cut .ln { color: var(--bad); }
.bloat-line.reveal-keep { background: var(--ok-bg); }
.bloat-line.reveal-cut  { background: var(--bad-bg); }
.bloat-why { display: none; color: var(--ink-soft); }
.bloat-revealed .bloat-why { display: inline; }
.bloat-foot { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.bloat-score { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }

/* seven-phase workflow */
.phases { display: flex; flex-direction: column; }
.phase {
  display: flex; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.4;
}
.phase:last-child { border-bottom: none; }
.phase .num { color: var(--accent-deep); font-weight: 700; min-width: 22px; flex: none; }
.phase b { color: var(--ink); font-weight: 600; }

/* accordions (take-home + reference) */
.det { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.det summary {
  cursor: pointer; padding: 13px 15px; font-size: 14px; font-weight: 500; color: var(--ink);
  list-style: none; display: flex; align-items: center; gap: 9px;
}
.det summary::-webkit-details-marker { display: none; }
.det summary::before { content: "+"; color: var(--accent-deep); font-weight: 700; }
.det[open] summary::before { content: "–"; }
.det .inner { padding: 0 15px 14px; }
.det .inner ul {
  margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 7px;
}
.det .inner p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }
.det .inner p:last-child { margin-bottom: 0; }
.det .inner strong, .det .inner em { color: var(--ink); font-style: normal; }
.det code {
  background: var(--surface-sunk); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; font-size: 12px;
}
.table-wrap { overflow-x: auto; }
.det table { width: 100%; border-collapse: collapse; font-size: 13px; }
.det th, .det td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.det th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-deep); font-weight: 600; white-space: nowrap; }
.det td { color: var(--ink-soft); }
.det td:first-child { color: var(--ink); white-space: nowrap; }
.det-note { margin-top: 10px; font-size: 12px; color: var(--ink-mute); line-height: 1.5; }

/* presenter notes */
.presenter-note { border: 1px dashed var(--accent); border-radius: 12px; padding: 14px 16px; background: var(--accent-wash); }
.pn-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep); margin-bottom: 8px; }
.presenter-note p { margin: 0 0 10px; font-size: 13px; line-height: 1.6; color: #4a463c; }
.presenter-note p:last-child { margin-bottom: 0; }
.presenter-note strong { color: var(--accent-deep); }

/* ------------------------------------------- presenter-controlled room */
/* "Live" chip in the header: where the presenter is; one tap follows. */
.live-chip {
  border: 1px solid var(--accent); background: var(--accent-wash); color: var(--accent-deep);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; white-space: nowrap;
  border-radius: 999px; padding: 3px 10px; cursor: pointer;
}
.live-chip:hover { background: var(--accent-tint); }

/* Question-timer banner (broadcast by the console; fixed so it survives
 * re-renders and scrolling). */
.timer-banner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 60; background: var(--terminal); color: var(--terminal-ink);
  font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums;
  border-radius: 999px; padding: 8px 18px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.5);
  animation: rise .25s ease;
}

/* Quiz: pick locked in, verdict pending the presenter's reveal. */
.quiz-opt.is-picked { border-color: var(--accent); background: var(--accent-wash); }
.quiz-explain.quiz-wait { border-left-color: var(--accent); color: var(--ink-mute); font-style: italic; }

/* ========================================================================
 * Presenter console (presenter.html) — reuses the theme above.
 * ===================================================================== */
.pc-app { max-width: 900px; margin: 0 auto; min-height: 100vh; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pc-head {
  position: sticky; top: 0; z-index: 10; background: var(--card);
  border-bottom: 1px solid var(--line); padding: 12px 18px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pc-title { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-deep); margin-right: auto; }
.pc-meta { font-size: 12px; color: var(--ink-soft); display: flex; gap: 14px; align-items: center; font-variant-numeric: tabular-nums; }
.pc-clock { font-weight: 700; color: var(--ink); }
.pc-clock.over { color: var(--bad); }
.pc-steps { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); }
.pc-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.pc-kicker { font-size: 12px; color: var(--ink-mute); letter-spacing: .08em; }
.pc-h1 { font-size: 22px; margin: 2px 0 0; line-height: 1.2; }
.pc-panel {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.pc-panel-title { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); }
.pc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pc-btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 9px; cursor: pointer;
}
.pc-btn:hover { border-color: var(--accent); }
.pc-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.pc-btn.danger { color: var(--bad); }
.pc-btn.is-done { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); cursor: default; }
.pc-btn:disabled { opacity: .55; cursor: default; }
.pc-q { font-size: 14px; font-weight: 600; line-height: 1.35; }
.pc-tally { display: flex; flex-direction: column; gap: 6px; }
.pc-tally-row { display: grid; grid-template-columns: 1fr 42px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-soft); }
.pc-tally-bar { position: relative; height: 18px; background: var(--surface-sunk); border-radius: 5px; overflow: hidden; }
.pc-tally-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent-tint); border-right: 2px solid var(--accent); transition: width .3s ease; }
.pc-tally-bar > span { position: relative; z-index: 1; display: block; padding: 2px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.pc-tally-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.pc-script { border: 1px dashed var(--accent); background: var(--accent-wash); border-radius: var(--radius); padding: 16px 18px; }
.pc-script p { margin: 0 0 12px; font-size: 14px; line-height: 1.65; color: #4a463c; }
.pc-script p:last-child { margin-bottom: 0; }
.pc-script strong { color: var(--accent-deep); }
.pc-foot {
  position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.pc-lock { max-width: 460px; margin: 18vh auto 0; padding: 24px; text-align: center; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.pc-note { font-size: 12px; color: var(--ink-mute); line-height: 1.5; }
.pc-offline { border: 1px solid var(--bad); background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-size: 13px; }

/* ------------------------------------------------ classify exercise (skills) */
.cz-items { margin-top: 12px; border-top: 1px solid var(--line); }
.cz-item { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.cz-text { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.cz-text .ln { color: var(--accent); min-width: 22px; flex: none; }
.cz-opts { display: flex; gap: 6px; margin: 8px 0 0 32px; flex-wrap: wrap; }
.cz-opt {
  font: inherit; font-size: 12px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.cz-opt:hover { border-color: var(--accent); }
.cz-opt.is-sel { border-color: var(--accent-deep); background: var(--accent-wash); color: var(--accent-deep); font-weight: 600; }
.cz-item.revealed .cz-opt { cursor: default; }
.cz-opt.is-correct { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.cz-opt.is-wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.cz-why { margin: 7px 0 0 32px; font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); }

/* --------------------------------------------------- artifact walkthrough */
.walkthrough .wt-step { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }
.walkthrough .wt-step:last-child { border-bottom: none; }
.walkthrough .wt-step .num {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent-wash); border: 1px solid var(--accent); color: var(--accent-deep); font-size: 12px; font-weight: 600;
}
.walkthrough .wt-step strong { color: var(--ink); }
.walkthrough .wt-step code { background: var(--surface-sunk); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ------------------------------------------------------- comparison table */
.compare table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare th { text-align: left; padding: 7px 10px; border-bottom: 2px solid var(--line); color: var(--accent-deep); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; }
.compare td { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--ink-soft); line-height: 1.45; vertical-align: top; }
.compare tr:last-child td { border-bottom: none; }
.compare td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------ practice card */
.practice { margin-top: 18px; border-style: dashed; }
.practice summary { color: var(--accent-deep); }
.practice .prac-line { font-size: 13px; line-height: 1.55; color: var(--ink-soft); margin: 0 0 10px; }
.practice .prac-line b { color: var(--ink); text-transform: uppercase; font-size: 11px; letter-spacing: .1em; }
.practice .prompt { margin-bottom: 10px; }

/* ------------------------------------------------------------- stage mode */
/* ?stage=1 — the projector view: follows the live step, personal controls
 * hidden, larger type for the back row, persistent join QR in the corner.  */
.is-stage .join-card, .is-stage .react-dock, .is-stage .mode { display: none !important; }
.is-stage .live-chip { display: none !important; }        /* it IS the live view */
.is-stage .content button { pointer-events: none; }       /* the screen never votes */
.is-stage .app { max-width: 1200px; }
.is-stage h1.xl { font-size: 56px; }
.is-stage h1.lg { font-size: 44px; }
.is-stage .intro { font-size: 18px; }
.is-stage .lede-list, .is-stage .plain-list { font-size: 16px; }
.is-stage .poll-q, .is-stage .quiz-q { font-size: 18px; }
.is-stage .poll-opt, .is-stage .quiz-opt { font-size: 15px; }
.is-stage .walkthrough .wt-step, .is-stage .cz-text { font-size: 15px; }
.is-stage .compare table { font-size: 14.5px; }
.is-stage .share-card .share-qr { width: 148px; height: 148px; }
.is-stage .share-card .join-url { font-size: 19px; }

.stage-strip {
  position: fixed; right: 18px; bottom: 84px; z-index: 60;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; box-shadow: 0 8px 30px -12px rgba(70, 52, 18, .4);
}
.stage-strip .share-qr { width: 96px; height: 96px; }
.stage-url { font-size: 15px; font-weight: 600; max-width: 230px; word-break: break-all; }

/* --------------------------------------------- presenter console on phones */
/* The console is driven from the presenter's phone during a ~3h talk: give
 * the 17 step chips and action buttons proper touch-target sizes.           */
@media (max-width: 480px) {
  .pc-app .chip { min-width: 42px; height: 40px; font-size: 13px; }
  .pc-btn { padding: 12px 16px; font-size: 14px; }
  .pc-foot .pc-btn { padding: 12px 18px; }
}
