/* =====================================================================
   The app shell — topbar, scene frame, hub, and the shared furniture every
   scene is built out of.

   Tokens come from base.css. Nothing here re-declares a colour; if a value
   is needed that base.css does not have, it gets a token there first.

   Two rules this file exists to enforce:
     1. One primary action per screen. `.btn.primary` is filled; everything
        else is quiet. Two filled buttons on one screen is a bug.
     2. Player is ALWAYS ember, opponent ALWAYS cyan. `.side-you` and
        `.side-them` carry that and nothing else may.
   ===================================================================== */

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--void);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* Keyboard users must always be able to see where they are. All four source
   builds shipped with no focus state at all. */
:focus-visible {
  outline: 2px solid var(--lantern);
  outline-offset: 3px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---------------------------------------------------------------- shell */
#app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--void) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--edge2);
}
.topbar[hidden] { display: none; }

/* The one way home. Same mark, same behaviour, every screen. */
.brand {
  appearance: none;
  border: 0;
  background: none;
  padding: 4px 2px;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--paper);
  line-height: 1;
}
.brand span { color: var(--lantern); }
.brand:hover { color: var(--lantern); }

.topbar .spacer { flex: 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--edge2);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--paper); font-weight: 600; }
.chip.gold b { color: var(--gold); }
.chip.cyan b { color: var(--cyan); }
.chip.ember b { color: var(--lantern); }

/* ---------------------------------------------------------------- scene */
#scene {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}
#scene.wide { max-width: 1280px; }

/* Every scene opens with this: where you are, and how to leave. */
.scene-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.scene-head h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1;
  letter-spacing: .01em;
  text-transform: uppercase;
  margin: 0;
}
.scene-head h1 em { font-style: normal; color: var(--lantern); }
.scene-head .spacer { flex: 1; }
.scene-sub {
  color: var(--soft);
  font-size: 15.5px;
  margin: 6px 0 22px;
  max-width: 62ch;
}

/* ------------------------------------------------------------- surfaces */
.panel {
  background: var(--panel);
  border: 1px solid var(--edge2);
  border-radius: var(--r-md);
  padding: 18px;
}
.panel + .panel { margin-top: 14px; }
.panel h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .01em;
  margin: 0 0 10px;
}
.well {
  background: var(--well);
  border: 1px solid var(--edge2);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row .spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--dim); }
.small { font-size: 13px; }
.center { text-align: center; }
.nums { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- buttons */
.btn {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;              /* touch target floor */
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--edge);
  background: var(--raise);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover:not(:disabled) { background: var(--raise2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

/* Exactly one of these per screen. */
.btn.primary {
  background: var(--lantern);
  border-color: var(--lantern);
  color: #170A04;
  font-weight: 800;
}
.btn.primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--lantern) 84%, white);
  border-color: color-mix(in srgb, var(--lantern) 84%, white);
}
.btn.ghost { background: transparent; border-color: var(--edge); color: var(--soft); }
.btn.ghost:hover:not(:disabled) { background: var(--raise); color: var(--paper); }
.btn.big { min-height: 54px; padding: 14px 26px; font-size: 17px; }
.btn.block { width: 100%; }

/* ------------------------------------------------------------ the field */
.field {
  background: var(--sunk);
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  padding: 11px 13px;
  min-height: 44px;
}
.field::placeholder { color: var(--dim); }
.field.code {
  font-family: var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------- the hub */
/* Locked rooms are shown, not hidden: curiosity is the motivator, mystery
   is not. Each locked card states its own unlock condition. */
.hub-stage {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-bottom: 24px;
}
.hub-bot {
  position: relative;
  background: linear-gradient(180deg, var(--panel), var(--well));
  border: 1px solid var(--edge2);
  border-radius: var(--r-lg);
  padding: 14px;
  overflow: hidden;
}
.hub-bot canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; }
.hub-bot canvas:active { cursor: grabbing; }
.hub-bot .bot-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: .02em;
  margin: 6px 0 0;
}
.hub-bot .bot-meta { color: var(--dim); font-size: 13px; font-family: var(--mono); }

.hub-next { display: flex; flex-direction: column; gap: 14px; }
.next-card {
  background: var(--panel);
  border: 1px solid var(--edge2);
  border-left: 3px solid var(--lantern);
  border-radius: var(--r-md);
  padding: 18px 20px;
}
.next-card .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--lantern);
  margin: 0 0 6px;
}
.next-card h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 27px;
  text-transform: uppercase;
  letter-spacing: .01em;
  margin: 0 0 6px;
}
.next-card p { margin: 0 0 14px; color: var(--soft); max-width: 46ch; }

/* ---- PLAY: the one control this screen exists for ------------------- */
.hub-play {
  border: 1px solid var(--edge2);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255,90,45,.10), transparent 70%), var(--panel);
  padding: 22px 20px 20px;
  text-align: center;
}
.play-btn {
  width: 100%;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(28px, 6vw, 42px);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 18px 20px;
  border-radius: var(--r-md);
}
.play-sub {
  margin: 12px 0 0;
  color: var(--soft);
  font-size: 14.5px;
  max-width: 44ch;
  margin-inline: auto;
}
.play-best {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--gold);
}
.join-class {
  display: block;
  width: 100%;
  margin: 16px 0 0;
  padding: 11px 14px;
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--edge2);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--cyan);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  transition: border-color .12s ease, background .12s ease;
}
.join-class:hover { border-color: var(--cyan); background: rgba(61,214,255,.06); }

/* ==================================================================== */
/* The Lobby — a student's live class round.                            */
/* ==================================================================== */
.lobby-join { text-align: center; max-width: 460px; margin-inline: auto; }
.lobby-code-input {
  display: block;
  width: 100%;
  margin: 16px 0 12px;
  text-align: center;
  font-family: var(--mono);
  font-size: clamp(28px, 8vw, 44px);
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: 14px 10px;
}
.lobby-error { margin: 12px 0 0; color: var(--coral); font-size: 14px; }

.lobby-waiting, .lobby-done { text-align: center; }
.lobby-class {
  font-family: var(--display);
  font-size: clamp(24px, 6vw, 34px);
  margin: 4px 0 18px;
  color: var(--paper);
}
.lobby-pulse {
  width: 54px; height: 54px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 3px solid var(--jade);
  animation: lobby-breathe 1.8s ease-in-out infinite;
}
@keyframes lobby-breathe {
  0%, 100% { transform: scale(.82); opacity: .45; }
  50%      { transform: scale(1);   opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .lobby-pulse { animation: none; opacity: .8; }
}
.lobby-hold { color: var(--soft); max-width: 40ch; margin: 0 auto 16px; }

.lobby-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.lobby-q { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--dim); text-transform: uppercase; }
.lobby-clock {
  font-family: var(--mono); font-weight: 700; font-size: 15px;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--edge2); color: var(--jade);
}
.lobby-clock.hot { color: var(--coral); border-color: currentColor; }

.lobby-prompt {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 9vw, 60px);
  text-align: center;
  color: var(--gold);
  margin: 18px 0 26px;
  line-height: 1.15;
}
.lobby-options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.lobby-answer {
  min-height: 76px;
  font-size: clamp(20px, 4.5vw, 28px);
  font-weight: 700;
}
.lobby-locked { text-align: center; padding: 18px 0; }
.lobby-verdict { font-family: var(--display); font-size: 22px; margin: 0 0 6px; }
.lobby-verdict.right { color: var(--jade); }
.lobby-verdict.wrong { color: var(--coral); }

.lobby-scores { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; }
.lobby-scores .chip {
  font-family: var(--mono); font-size: 12px;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--edge2); color: var(--soft);
}

.lobby-podium { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.lobby-podium .place {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--edge2);
  border-radius: var(--r-md);
  background: var(--panel2, var(--panel));
}
.lobby-podium .place.is-you { border-color: var(--gold); }
.lobby-podium .medal {
  font-family: var(--mono); font-weight: 700; font-size: 16px;
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--edge2); color: var(--paper);
}
.lobby-podium .p1 .medal { background: var(--gold);   color: #1A1205; }
.lobby-podium .p2 .medal { background: #C8CEDA;       color: #10141C; }
.lobby-podium .p3 .medal { background: #C98B5A;       color: #1A0F06; }
.lobby-podium .who { font-weight: 600; text-align: left; }
.lobby-podium .score { margin-left: auto; font-family: var(--mono); color: var(--soft); }
.lobby-rest { margin-bottom: 16px; text-align: left; }
.lobby-rest summary { cursor: pointer; color: var(--soft); font-size: 14px; }
.lobby-earned {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--gold);
}

/* "Now settle it" — the round ends pointing at a fight, not a dead board. */
.lobby-fight {
  margin: 4px 0 18px;
  padding-top: 16px;
  border-top: 1px solid var(--edge2);
}
.lobby-mates {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 10px;
}
.lobby-mate { min-height: 46px; font-weight: 600; }

/* The progression nudge — present, but never competing with PLAY. */
.hub-nudge {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  text-align: left;
  appearance: none;
  cursor: pointer;
  padding: 12px 14px;
  border: 1px dashed var(--edge2);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--paper);
  font-family: var(--sans);
  transition: border-color .12s ease;
}
.hub-nudge:hover { border-color: var(--lantern); }
.nudge-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}
.nudge-title { font-weight: 600; font-size: 14.5px; }
.nudge-cta { margin-left: auto; font-size: 13px; color: var(--lantern); }

/* Rooms are a quiet strip you visit between runs, not the main event. */
.rooms {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.room {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  appearance: none;
  cursor: pointer;
  padding: 11px 12px 12px;
  min-height: 72px;
  border: 1px solid var(--edge2);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--paper);
  font-family: var(--sans);
  transition: border-color .12s ease, background .12s ease, transform .08s ease;
}
.room:hover:not(:disabled) { border-color: var(--room, var(--lantern)); transform: translateY(-2px); }
.room .r-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: .01em;
  color: var(--room, var(--paper));
}
.room .r-q { font-size: 13px; color: var(--soft); }
.room .r-note { margin-top: auto; padding-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.room.is-locked { opacity: .5; }
.room.is-locked .r-title { color: var(--dim); }
.room.is-locked:hover { border-color: var(--edge); transform: none; }
.room .lock {
  position: absolute;
  top: 12px; right: 13px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--edge2);
  border-radius: 3px;
  padding: 1px 5px;
}
.room.forge  { --room: var(--lantern); }
.room.brain  { --room: var(--cyan); }
.room.locker { --room: var(--violet); }
.room.arena  { --room: var(--coral); }
.room.boards { --room: var(--gold); }

/* -------------------------------------------------------------- sides */
/* The only two classes allowed to assign a fighter colour. */
.side-you   { color: var(--lantern); }
.side-them  { color: var(--cyan); }
.bg-you     { background: var(--lantern); }
.bg-them    { background: var(--cyan); }

/* --------------------------------------------------------------- toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  z-index: 90;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: var(--r-sm);
  background: var(--raise);
  border: 1px solid var(--edge);
  color: var(--paper);
  font-size: 14.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------- state */
.loading, .empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
  color: var(--dim);
  text-align: center;
}
.spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--edge);
  border-top-color: var(--lantern);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- key/val */
.kv {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--edge2);
  font-size: 14px;
}
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--soft); }
.kv b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ progress */
.bar-track {
  height: 8px;
  background: var(--sunk);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--edge2);
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--cyan);
  border-radius: 999px;
  transition: width .25s ease;
}
.bar-fill.over { background: var(--coral); }

/* -------------------------------------------------------------- mobile */
@media (max-width: 860px) {
  .hub-stage { grid-template-columns: 1fr; }
  .hub-bot { max-width: 340px; margin: 0 auto; }
}
@media (max-width: 560px) {
  #scene { padding: 16px 12px 56px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar .chip.hide-sm { display: none; }
  .rooms { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
  .room { min-height: 96px; padding: 13px 14px; }
}

/* A fight must stay readable with motion off: shake and slow-mo go, the
   functional animation stays. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ----------------------------------------------------- viewer controls */
/* Under every character preview. Zoom lives here rather than on the wheel,
   so the page can always be scrolled past a preview that fills the screen. */
.viewer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
/* Rotate/zoom controls sit under a 3D model a child drags with a finger —
   34px was below the touch floor. */
.viewer-controls .icon-btn {
  appearance: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge2);
  border-radius: 7px;
  background: var(--raise);
  color: var(--soft);
  font-size: 15px;
  line-height: 1;
}
.viewer-controls .icon-btn:hover { background: var(--raise2); color: var(--paper); }
.viewer-controls .view-hint { margin: 0 0 0 6px; }

/* ==================================================================== */
/* Onboarding — rung 0.                                                  */
/* Deliberately narrower and quieter than the rest of the app: one thing */
/* on screen at a time is the entire point of the first ninety seconds.  */
/* ==================================================================== */
.ob-shell {
  max-width: 620px;
  margin: 12px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ob-shell.wide { max-width: 940px; }

.ob-step {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--lantern);
  margin: 0;
}
.ob-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(28px, 5.5vw, 44px);
  line-height: 1.05;
  letter-spacing: .01em;
  margin: 0;
  text-wrap: balance;
}
.ob-lead { color: var(--soft); margin: 0; max-width: 52ch; }

.ob-power { display: flex; align-items: center; gap: 12px; }
.ob-power-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  flex: none;
}
.ob-power .bar-track { flex: 1; height: 12px; }
.ob-power .bar-fill { background: var(--gold); }

/* Three cards, equal weight — the choice is meant to be a guess, and a
   highlighted "recommended" option would remove the only decision in the
   opening minute. */
.tactic-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.tactic-card {
  appearance: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  padding: 16px 17px 18px;
  min-height: 132px;
  border: 1px solid var(--edge2);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--paper);
  font-family: var(--sans);
  transition: border-color .12s ease, transform .1s ease;
}
.tactic-card:hover { border-color: var(--lantern); transform: translateY(-2px); }
.tactic-card b {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: .01em;
}
.tactic-blurb { font-size: 13.5px; color: var(--soft); line-height: 1.4; }
.tactic-beats { margin-top: auto; font-size: 12px; color: var(--dim); font-family: var(--mono); }

.ob-log {
  margin: 0;
  min-height: 1.6em;
  text-align: center;
  color: var(--soft);
  font-size: 14.5px;
}
.ob-name { flex: 1; min-width: 0; }

/* ==================================================================== */
/* Teacher, Claim, and the Boards class-join strip.                     */
/* ==================================================================== */
.dojo-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--edge2);
  flex-wrap: wrap;
}

.teach-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}

.class-code {
  font-family: var(--display);
  font-weight: 700;
  font-size: 56px;
  letter-spacing: .12em;
  text-align: center;
  color: var(--gold);
  padding: 10px 0;
}
.class-code.small-code {
  font-size: 22px;
  letter-spacing: .04em;
  color: var(--jade);
  word-break: break-all;
  text-align: left;
}
.code-panel { text-align: center; }
.code-panel .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0;
}

.roster { min-height: 60px; }
.report-line { margin: 0 0 8px; color: var(--soft); font-size: 14px; }

.class-join { margin-bottom: 14px; }

.quiz-host { margin-bottom: 14px; }
.quiz-prompt-live {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  text-align: center;
  color: var(--gold);
  padding: 14px 0;
}
.quiz-host h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  text-align: center;
  color: var(--gold);
  margin: 6px 0 14px;
}
.quiz-host .row {
  flex-wrap: wrap;
  gap: 10px;
}
.quiz-host .row .btn { flex: 1 1 auto; min-width: 120px; }

.quiz-countdown {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--edge2);
  color: var(--jade);
}
.quiz-countdown.hot {
  color: var(--red, #FF5A2D);
  border-color: currentColor;
}

/* ==================================================================== */
/* Class tournament bracket — one renderer, both screens.               */
/* ==================================================================== */
.bracket { display: grid; gap: 16px; margin-top: 12px; text-align: left; }
.bracket-round { display: grid; gap: 6px; }

.bracket-champ {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--gold);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255,181,60,.10), transparent);
}
.bracket-champ strong { font-family: var(--display); font-size: 20px; color: var(--gold); }

.match {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--edge2);
  border-radius: var(--r-sm, 8px);
  font-size: 14px;
}
.match.is-you { border-color: var(--cyan); background: rgba(61,214,255,.05); }
.match .side { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .side.won  { color: var(--paper); font-weight: 600; }
.match .side.lost { color: var(--dim); text-decoration: line-through; }
.match .vs { font-family: var(--mono); font-size: 11px; color: var(--dim); flex: none; }
.match.is-bye .bye-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dim);
}
.lobby-bracket { margin: 4px 0 18px; }
.tourn-host { margin-top: 12px; }

/* A beaten student's debrief: the reason, and a one-tap way to act on it. */
.loss-lesson {
  margin: 8px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--cyan);
  border-radius: var(--r-md);
  background: rgba(61,214,255,.05);
  text-align: left;
}
.lesson-head {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cyan);
}
.lesson-text { margin: 0 0 12px; font-size: 15.5px; color: var(--paper); }
.lesson-paid { margin: 10px 0 0; font-family: var(--mono); font-size: 12px; color: var(--gold); }

/* ==================================================================== */
/* The AI Lab — measuring whether a student's rules actually work.      */
/* ==================================================================== */
.lab-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim);
}
.lab-intro { color: var(--soft); font-size: 14.5px; margin: 2px 0 14px; }
.lab-section { margin-top: 18px; }
.lab-section h3 {
  font-family: var(--display); font-size: 15px; margin: 0 0 8px; color: var(--paper);
}
.lab-scroll { overflow-x: auto; }
.lab-table { font-size: 13.5px; width: 100%; }
.lab-table td:first-child { font-family: var(--mono); font-size: 12px; }

.lab-rate { font-family: var(--mono); font-weight: 700; }
.lab-rate.good { color: var(--jade); }
.lab-rate.mid  { color: var(--gold); }
.lab-rate.bad  { color: var(--coral); }
.lab-thin { font-size: 11.5px; color: var(--dim); font-style: italic; }

/* Policy coverage: the one number that explains a bot ignoring your rules. */
.lab-coverage {
  border: 1px solid var(--edge2);
  border-left: 3px solid var(--jade);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 4px;
}
.lab-coverage.weak { border-left-color: var(--coral); }
.cov-big {
  font-family: var(--display); font-weight: 700; font-size: 34px;
  margin: 2px 0 4px; color: var(--jade);
}
.lab-coverage.weak .cov-big { color: var(--coral); }
.cov-note { margin: 0 0 6px; font-size: 13px; color: var(--soft); }
.cov-lesson { margin: 0; font-size: 13.5px; color: var(--paper); }

.lab-verdict {
  margin-top: 18px; padding: 13px 15px;
  border: 1px dashed var(--edge2); border-radius: var(--r-md);
}
.lab-foot { margin-top: 16px; font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.rule-spotlight { outline: 2px solid var(--lantern); outline-offset: 3px; border-radius: 6px; }

/* ==================================================================== */
/* The AI learning journey.                                             */
/* ==================================================================== */
.ai-link { color: var(--cyan); }
.ai-progress { text-align: center; }
.ai-count {
  font-family: var(--display); font-weight: 700; font-size: 34px;
  margin: 2px 0 10px; color: var(--cyan);
}
.ai-bar { height: 8px; border-radius: 999px; background: var(--sunk); overflow: hidden; margin-bottom: 10px; }
.ai-bar-fill { height: 100%; background: var(--cyan); transition: width .3s ease; }

.ai-concepts { display: grid; gap: 14px; margin-top: 14px; }
.concept.locked { opacity: .62; }
.concept.earned { border-left: 3px solid var(--jade); }
.concept-head { margin-bottom: 6px; }
.concept-idea {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim);
}
.concept-state {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim);
}
.concept-state.yes { color: var(--jade); }
.concept-formal { font-family: var(--mono); font-size: 12px; color: var(--soft); margin: 0 0 10px; }
.concept-what { margin: 0 0 12px; font-size: 15px; }
.concept-did, .concept-real {
  border-left: 2px solid var(--edge2); padding-left: 12px; margin: 10px 0 0;
}
.concept-did p:last-child, .concept-real p:last-child { margin: 0; font-size: 14px; color: var(--soft); }
.concept-todo { margin: 10px 0 0; font-size: 13.5px; color: var(--dim); font-style: italic; }

.ai-map { margin-top: 16px; }
.idea-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--edge2); border-radius: var(--r-sm);
}
.idea-row.uncovered { opacity: .5; }
.idea-n {
  font-family: var(--mono); font-weight: 700; flex: none;
  width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 50%; background: var(--cyan); color: #06131A; font-size: 13px;
}
.idea-row.uncovered .idea-n { background: var(--edge2); color: var(--dim); }
.idea-name { margin: 0; font-weight: 600; font-size: 14.5px; }
.idea-blurb { margin: 2px 0 0; font-size: 13px; color: var(--soft); }
.idea-tag { font-family: var(--mono); font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.ai-honest { margin-top: 12px; font-size: 13px; color: var(--soft); line-height: 1.55; }
.ai-outcomes summary {
  cursor: pointer; font-family: var(--display); font-size: 18px; font-weight: 600;
}
.ai-outcomes .stack { margin: 12px 0; }

/* First run: no wall of locked doors, just a promise. */
.rooms-soon {
  text-align: center; color: var(--dim); font-size: 13.5px;
  margin: 4px 0 0; font-style: italic;
}

/* Touch targets. Children have less precise aim than adults, so 44px is a
   floor here rather than a guideline — several footer controls sat at 34. */
.btn.small-btn { min-height: 44px; }
.join-class { min-height: 44px; }

/* Locked AI concepts collapse to a line — the page should be mostly what
   the child has earned, not a syllabus of what they have not. */
.concept.locked summary {
  cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.concept-lockname { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--soft); }
.concept-todo-inline { font-size: 12.5px; color: var(--dim); font-style: italic; }
.concept.locked[open] summary { margin-bottom: 10px; }

/* ==================================================================== */
/* "You just learned an AI idea" — the moment, not the essay.           */
/* Reads in three words so it lands for a seven-year-old who cannot yet */
/* read the AI journey page.                                            */
/* ==================================================================== */
.concept-earned-pop {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 26px);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 18px 12px 12px;
  border: 1px solid var(--cyan);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, var(--cyan));
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  color: var(--paper);
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transition: opacity .28s ease, transform .28s cubic-bezier(.2, .9, .3, 1.2);
}
.concept-earned-pop.show { opacity: 1; transform: translate(-50%, 0); }
.cep-badge {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--cyan);
  color: #06131A;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
}
.cep-body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cep-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--cyan);
}
.cep-name { font-weight: 700; font-size: 15px; }
@media (prefers-reduced-motion: reduce) {
  .concept-earned-pop { transition: opacity .2s ease; transform: translate(-50%, 0); }
}
