  /* Plato Pod operator console.
     The arena is the subject; the chrome is a map room's: a command bar
     above, a rail of sheets on the left, a strip of units on the right.
     Flat: solid fills, hairline rules, no gradients, shadows or blur.
     Every size, weight and colour is a token (tokens.css): four type sizes,
     two weights, sentence case, one accent (docs/ui-plan-2026-11.md). */
  :root {
    --rail:   64px;
    --sheet:  300px;
    --units:  300px;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    background: var(--bg); color: var(--text); overflow: hidden;
    font-family: var(--sans); font-size: var(--fs-14); line-height: var(--lh-14);
    -webkit-font-smoothing: antialiased;
  }
  button, input, select, textarea { font: inherit; }
  h1, h2, h3 { font-weight: var(--w-strong); font-size: var(--fs-14); }
  .num { font-variant-numeric: tabular-nums; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

  #app { display: flex; flex-direction: column; height: 100vh; }
  #body { position: relative; display: flex; flex: 1; min-height: 0; }

  /* ── Command bar ─────────────────────────────────────── */
  #statusbar {
    flex: none; height: 52px; min-width: 0;
    display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-3);
    background: var(--panel); border-bottom: 1px solid var(--line);
  }
  #brand { display: flex; align-items: center; gap: var(--sp-2); color: var(--accent); }
  #brand h1 { font-size: var(--fs-14); font-weight: var(--w-strong); color: var(--text); white-space: nowrap; }
  #brand #build { font-size: var(--fs-12); color: var(--text-dim); }
  #role-chip {
    flex: none; padding: 5px 10px; border-radius: var(--r); cursor: pointer;
    background: var(--raised); color: var(--text); border: 1px solid var(--line);
    font-weight: var(--w-strong); white-space: nowrap;
  }
  #role-chip.team  { background: var(--accent-dim); color: var(--accent-ink); border-color: var(--accent-line); }
  #role-chip.watch { background: var(--accent-dim); color: var(--accent-ink); border-color: var(--accent-line); }
  #role-chip.infil { background: var(--blue-dim);   color: var(--blue-ink);   border-color: var(--blue-line); }
  #role-chip.out   { background: var(--raised);     color: var(--text-dim);   border-color: var(--line); }

  #sb-scenario {
    display: flex; align-items: center; gap: var(--sp-3); min-width: 0; flex: 1;
    margin: 0 auto; padding: var(--sp-1) var(--sp-3); height: 36px;
    border: 1px solid var(--line); border-radius: var(--r); background: var(--bg);
  }
  #sb-name { font-weight: var(--w-strong); white-space: nowrap; }
  #sb-phase {
    font-size: var(--fs-12); line-height: var(--lh-12);
    padding: 1px var(--sp-2); border-radius: var(--r); white-space: nowrap;
    background: var(--raised); color: var(--text-dim);
  }
  #sb-phase.running  { background: var(--good-dim);   color: var(--good-ink); }
  #sb-phase.placing  { background: var(--accent-dim); color: var(--accent-ink); }
  #sb-phase.armed    { background: var(--raised);     color: var(--text-dim); }
  #sb-phase.complete { background: var(--good-dim);   color: var(--good-ink); }
  #sb-phase.error    { background: var(--red-dim);    color: var(--red-ink); }
  /* Two lines before it is cut: "Round 1: team A watches, team B infiltrates" is
     the round, and one line cut it to "Round 1: team A watches..." or "R.". */
  #sb-summary {
    color: var(--text-dim); flex: 1; min-width: 0; font-size: var(--fs-12); line-height: var(--lh-12);
    overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  }
  #sb-progress {
    width: 120px; height: 3px; border-radius: 2px;
    background: var(--raised); overflow: hidden; display: none; flex: none;
  }
  #sb-progress.visible { display: block; }
  #sb-progress > i {
    display: block; height: 100%; width: 0%; background: var(--accent);
    transition: width .3s linear;
  }
  #sb-score { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-dim); }
  #sb-score b { color: var(--text); word-spacing: 2px; }
  #sb-score b + b::before { content: "·"; margin: 0 var(--sp-2); color: var(--text-dim); font-weight: var(--w-regular); }
  #best { font-size: var(--fs-12); font-variant-numeric: tabular-nums; color: var(--text-dim); white-space: nowrap; }
  #clock {
    font-variant-numeric: tabular-nums; font-size: var(--fs-20); line-height: var(--lh-20);
    font-weight: var(--w-strong); color: var(--text-dim); white-space: nowrap; min-width: 72px; text-align: right;
  }
  #clock.running  { color: var(--accent); }
  #clock.finished { color: var(--good-ink); }

  #sb-readouts { display: flex; align-items: center; gap: var(--sp-1); flex: none; }
  .readout {
    display: inline-flex; align-items: center; gap: 6px; padding: var(--sp-1) var(--sp-2);
    border-radius: var(--r); background: var(--raised);
    font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim); white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
  .dot.on  { background: var(--good); }
  .dot.off { background: var(--red); }
  #camera-chip, #view3d-chip {
    display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: var(--sp-1) var(--sp-2);
    border: 1px solid var(--line); border-radius: var(--r);
    color: var(--text-dim); cursor: pointer; font-size: var(--fs-12); line-height: var(--lh-12);
  }
  #camera-chip input, #view3d-chip input { accent-color: var(--accent); }
  #bigscreen, #join-chip {
    flex: none; padding: 5px 10px; border-radius: var(--r); cursor: pointer;
    background: transparent; color: var(--text-dim); border: 1px solid var(--line);
  }
  #bigscreen:hover, #join-chip:hover { color: var(--text); border-color: var(--line-strong); }
  #bs-run { display: none; flex: none; padding: 5px 14px; border-radius: var(--r); cursor: pointer;
            font-weight: var(--w-strong); color: var(--on-accent); background: var(--accent); border: 1px solid var(--accent); }
  #bs-run.stop { background: var(--red); border-color: var(--red); color: var(--on-red); }

  /* ── Rail ────────────────────────────────────────────── */
  #rail {
    flex: none; width: var(--rail); display: flex; flex-direction: column; gap: 2px;
    padding: var(--sp-2) 6px; background: var(--panel); border-right: 1px solid var(--line); z-index: 6;
  }
  .rail-btn {
    display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
    padding: 9px 0; border: 0; border-radius: var(--r); cursor: pointer;
    background: transparent; color: var(--text-dim);
    font-size: var(--fs-12); line-height: var(--lh-12);
    position: relative;
  }
  .rail-btn:hover { color: var(--text); background: var(--raised); }
  .rail-btn[aria-pressed="true"] { color: var(--accent); background: var(--raised); }
  .rail-btn.last { margin-top: auto; }
  /* The step to do now carries a mark, so the rail says where the session is. */
  .rail-btn.now::after {
    content: ""; position: absolute; right: 8px; top: 8px;
    width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  }

  /* ── Sheets ──────────────────────────────────────────── */
  /* The open sheet pushes the arena over rather than covering it: nothing
     on the map is ever under a panel. */
  #sidebar {
    flex: none; width: var(--sheet); z-index: 5;
    background: var(--panel); border-right: 1px solid var(--line);
    overflow-y: auto; padding-bottom: var(--sp-3);
  }
  #sidebar::-webkit-scrollbar { width: 8px; }
  #sidebar::-webkit-scrollbar-thumb { background: var(--line); }
  #sidebar .sheet { display: none; }
  #sidebar .sheet.open { display: block; }
  .section { padding: var(--sp-4); border-bottom: 1px solid var(--line); }
  .section > h2 { color: var(--text); margin-bottom: var(--sp-3); }
  .step > h2 { display: flex; align-items: center; gap: var(--sp-2); }
  .step > h2 i {
    font-style: normal; width: 20px; height: 20px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--raised); color: var(--text-dim); font-size: var(--fs-12);
  }
  .step.now > h2 i { background: var(--accent); color: var(--on-accent); }
  h3.sub { color: var(--text-dim); margin: var(--sp-4) 0 6px; }

  /* The chosen activity's own settings, under its entry */
  #activity-settings { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
  .settings h3.sub:first-child { margin-top: 6px; }
  .settings input[type=radio], .settings input[type=checkbox] { accent-color: var(--accent); }
  /* Who plays: a chip per pod, pressed when it is in; or a chooser per role */
  .chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-1); }
  .chips button.act { padding: 2px var(--sp-2); }
  .roles label.twinrow { margin-top: 2px; }
  .chase-pair { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-1); }
  .chase-pair select { flex: 1; min-width: 0; }
  .chase-pair button.act { padding: 2px 7px; }
  .chips button.act[data-side="runs"] { border-color: var(--blue); }
  .chips button.act[data-side="chases"] { border-color: var(--red); }
  #chase-scores div { line-height: var(--lh-14); }
  #chase-scores small { color: var(--text-dim); margin-right: 2px; }
  .settings[aria-disabled="true"] { opacity: .55; pointer-events: none; }
  /* The debrief: the result as a tag, the headline, then the marks */
  .debrief { margin-top: var(--sp-3); padding: 10px var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-card);
             background: var(--raised); }
  .debrief .result { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: 6px; }
  .debrief .result span:first-child { font-size: var(--fs-12); line-height: var(--lh-12);
             padding: 1px 6px; border-radius: var(--r); border: 1px solid var(--line); }
  .debrief[data-result="done"] .result span:first-child { color: var(--good-ink); border-color: var(--good); }
  .debrief[data-result="failed"] .result span:first-child { color: var(--red-ink); border-color: var(--red); }
  .debrief[data-result="stopped"] .result span:first-child { color: var(--text-dim); }
  .debrief .result span:last-child { font-weight: var(--w-strong); }
  .debrief .row { display: flex; justify-content: space-between; gap: var(--sp-2); }
  .debrief .row span:first-child { color: var(--text-dim); }
  .debrief .row span:last-child { font-variant-numeric: tabular-nums; }

  /* Scenario chooser */
  .scenario {
    display: block; width: 100%; text-align: left; cursor: pointer;
    background: var(--raised); border: 1px solid var(--line);
    border-radius: var(--r); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-1);
    color: var(--text-dim);
  }
  .scenario:hover { color: var(--text); border-color: var(--line-strong); }
  .scenario[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
  .scenario .t { font-weight: var(--w-strong); color: var(--text); display: flex; gap: 6px; }
  .scenario .t .live { display: none; }
  .scenario .b { font-size: var(--fs-12); line-height: var(--lh-12); margin-top: 2px; color: var(--text-dim); }
  .scenario .len { margin-top: var(--sp-1); }
  #scenario-list .chooser-head { color: var(--text); margin: var(--sp-4) 0 2px; }
  #scenario-list .chooser-head:first-child { margin-top: 0; }
  #scenario-list .chooser-note { margin: 0 0 var(--sp-2); }

  /* Buttons: a primary (amber, the next step: one at a time), the rest
     secondary, a danger outline for what stops or removes. */
  .btnrow { display: flex; gap: var(--sp-1); margin-top: var(--sp-1); }
  .btnrow:first-of-type { margin-top: 10px; }
  a.act { text-decoration: none; text-align: center; display: inline-block; }
  button.act, a.act {
    flex: 1; padding: var(--sp-2) 10px; border-radius: var(--r); cursor: pointer;
    background: var(--raised); color: var(--text); border: 1px solid var(--line);
    font-weight: var(--w-regular);
  }
  button.act:hover:not(:disabled), a.act:hover { border-color: var(--line-strong); }
  button.act:disabled { color: var(--text-disabled); border-color: var(--line-soft); cursor: default; }
  button.act.go, button.act.next:not(:disabled) {
    background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: var(--w-strong);
  }
  button.act.go:hover:not(:disabled), button.act.next:hover:not(:disabled) { background: var(--accent-ink); border-color: var(--accent-ink); }
  button.act.go:disabled { background: var(--raised); border-color: var(--line-soft); color: var(--text-disabled); }
  /* A team game: only the next step stands out (game.js markNextStep). */
  body.game-steps #step-run button.act.go:not(.next):not(:disabled) { background: var(--raised); border-color: var(--line);
                                                       color: var(--text); font-weight: var(--w-regular); }
  button.act.stop { background: transparent; border-color: var(--red); color: var(--red-ink); }
  button.act.stop:hover:not(:disabled) { background: var(--red-dim); }
  /* A toggle that is on: the accent's tint, not its fill (the fill is the primary's). */
  button.act[aria-pressed="true"] {
    background: var(--accent-dim); border-color: var(--accent); color: var(--accent-ink);
  }

  /* Layers */
  #controls label {
    display: flex; align-items: center; gap: var(--sp-2); padding: 3px 0;
    cursor: pointer; user-select: none; color: var(--text-dim);
  }
  #controls label:hover { color: var(--text); }
  #controls input[type=checkbox] {
    accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer;
  }
  #clear-path {
    margin-top: 10px; width: 100%; padding: var(--sp-2) 0; border-radius: var(--r);
    background: var(--raised); color: var(--text);
    border: 1px solid var(--line); cursor: pointer;
  }
  #clear-path:hover:not(:disabled) { border-color: var(--line-strong); }
  #clear-path:disabled { color: var(--text-disabled); cursor: default; }

  /* Pods, the links list in the Pods sheet */
  .pod {
    display: flex; align-items: center; gap: var(--sp-2);
    padding: 7px 9px; border-radius: var(--r); background: var(--raised);
    margin-bottom: var(--sp-1); border-left: 3px solid var(--line);
  }
  .pod .chip { display: none; }
  .pod.blue { border-left-color: var(--blue); }
  .pod.red  { border-left-color: var(--red); }
  .pod .who { font-weight: var(--w-strong); }
  .pod .state {
    margin-left: auto; font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim);
    text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums;
  }
  .pod .state b { display: block; font-weight: var(--w-strong); }
  .pod .state b.up   { color: var(--good-ink); }
  .pod .state b.down { color: var(--red-ink); }
  .pod .state b.wait { color: var(--accent-ink); }
  #pods .none, #unit-list .none { color: var(--text-dim); }

  #diag { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim); font-variant-numeric: tabular-nums; }
  #diag b { color: var(--text); font-weight: var(--w-strong); }

  /* ── Unit strip ──────────────────────────────────────── */
  #units {
    flex: none; width: var(--units); display: flex; flex-direction: column; gap: var(--sp-2);
    padding: var(--sp-3); background: var(--panel); border-left: 1px solid var(--line);
    overflow-y: auto;
  }
  .strip-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
  .strip-head:first-child { margin-top: 0; }
  .strip-head h2 { color: var(--text); }
  .strip-head span { font-size: var(--fs-12); color: var(--text-dim); }
  .unit {
    display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line);
    border-radius: var(--r-card); background: var(--raised); cursor: pointer;
  }
  .unit:hover { border-color: var(--line-strong); }
  .unit.selected { border-color: var(--accent); }
  .unit .bar { flex: none; width: 4px; border-radius: 2px; background: var(--text-disabled); }
  .unit .facts .power.warn { color: var(--accent-ink); }
  .unit .facts .power.low { color: var(--red-ink); font-weight: var(--w-strong); }
  .unit.blue .bar { background: var(--blue); }
  .unit.red .bar  { background: var(--red); }
  .unit.green .bar { background: var(--good); }
  .unit .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
  .unit .head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
  .unit .who { font-weight: var(--w-strong); white-space: nowrap; }
  .unit .who span { color: var(--text-dim); font-weight: var(--w-regular); }
  .unit .link { font-size: var(--fs-12); white-space: nowrap; }
  .unit .link.up { color: var(--good-ink); }
  .unit .link.down { color: var(--red-ink); }
  .unit .link.wait { color: var(--accent-ink); }
  .unit .link.virtual { color: var(--text-dim); }
  .unit .facts {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
    font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim); font-variant-numeric: tabular-nums;
  }
  .unit .facts span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .unit .health { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
  .unit .health i { display: block; height: 100%; border-radius: 2px; background: var(--good); }
  .unit .health i.warn { background: var(--accent); }
  .unit .health i.bad { background: var(--red); }
  #scenario-card {
    padding: 10px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--raised);
    display: flex; flex-direction: column; gap: 6px;
  }
  #scenario-card .row { display: flex; justify-content: space-between; gap: var(--sp-2); }
  #scenario-card .row span:last-child { font-variant-numeric: tabular-nums; color: var(--text); }
  #scenario-card .row span:first-child { color: var(--text-dim); }
  #scenario-card .summary { color: var(--text-dim); font-size: var(--fs-12); line-height: var(--lh-12); }
  #scenario-card .prog { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
  #scenario-card .prog i { display: block; height: 100%; background: var(--accent); }
  #scenario-card .none { color: var(--text-dim); }

  /* ── Stage ───────────────────────────────────────────── */
  #stage { position: relative; display: flex; flex-direction: column; min-width: 0; flex: 1; }
  #view3d-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--stage); z-index: 4; }
  #view3d-frame[hidden] { display: none; }
  #view3d-chip.paused { opacity: 0.55; font-style: italic; }   /* 3D wanted, the map up for a click mode */
  #container { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--stage); }
  #camera-feed {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain; display: none;
  }
  #camera-feed.visible { display: block; }
  #overlay {
    position: absolute; inset: 0; width: 100%; height: 100%;
    /* Without touch-action the browser claims a drag on the canvas for
       panning or zooming and pointermove never arrives: a tap still becomes
       a click, so selecting a pod works while drawing silently does not. */
    touch-action: none;
    user-select: none; -webkit-user-select: none;
  }
  #overlay.interactive { pointer-events: auto; cursor: crosshair; }

  /* Under the arena: the work this laptop does now. A team reads it from a
     metre away: the body size here is the 16 px step. */
  #dock {
    flex: none; max-height: 42vh; overflow-y: auto; background: var(--panel);
    border-top: 1px solid var(--line); padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-16); line-height: var(--lh-16);
  }
  #game-panel, #strategy-panel {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px;
  }
  #dock #game-out, #dock #game-all-orders, #dock #strategy-out, #dock #game-mates,
  #dock .game-help { font-size: var(--fs-14); line-height: var(--lh-14); }
  #game-text, #strategy-text { font-size: var(--fs-16) !important; }
  #game-you { font-size: var(--fs-16) !important; }
  /* What this team is this round, big enough to notice from the back row. */
  #game-role { font-size: var(--fs-20); line-height: var(--lh-20); font-weight: var(--w-strong); padding: var(--sp-2) var(--sp-3);
               border-radius: var(--r); margin-bottom: 6px; }
  #game-role.watch { background: var(--accent-dim); color: var(--accent-ink); border: 1px solid var(--accent-line); }
  #game-role.infil { background: var(--blue-dim); color: var(--blue-ink); border: 1px solid var(--blue-line); }
  #game-role.out   { background: var(--raised); color: var(--text-dim); border: 1px solid var(--line); }
  .dock-note { color: var(--text-dim); padding: 6px 0; }
  #game-all-orders { display: grid; gap: var(--sp-3);
                     grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  #game-all-orders > div { background: var(--raised); border-radius: var(--r); padding: var(--sp-2) 10px; }
  #game-feedback { margin-top: var(--sp-3); padding: 10px var(--sp-3); background: var(--raised);
                   border-left: 3px solid var(--accent); border-radius: var(--r); }
  #game-feedback h3, #game-all-orders .fb h3 { color: var(--accent-ink); margin: 0 0 var(--sp-1); }
  #game-feedback ul, #game-all-orders .fb ul { margin: 0 0 var(--sp-2) 18px; padding: 0; }
  #game-feedback li, #game-all-orders .fb li { margin: 2px 0; }

  #sidebar input[type=number], #sidebar input[type=text], #arena-actions input,
  #sidebar select {
    background: var(--raised); color: var(--text); border: 1px solid var(--line);
    border-radius: var(--r); padding: 3px 6px;
  }

  /* Dialogs: who is at this laptop (once), how many teams. */
  #role-picker, #teams-picker {
    position: fixed; inset: 0; background: var(--scrim); z-index: 50;
    display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
  }
  #teams-picker[hidden] { display: none; }
  #role-picker .card, #teams-picker .card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card);
    padding: var(--sp-5); width: min(440px, 100%);
  }
  #role-picker h2, #teams-picker h2 { font-size: var(--fs-16); line-height: var(--lh-16); margin-bottom: var(--sp-3); }
  #role-picker #role-row { flex-wrap: wrap; }
  #role-picker #role-row button, #teams-row button { flex: 1 1 40%; padding: 14px; font-size: var(--fs-16); }
  #role-close, #teams-cancel { margin-top: 14px; width: 100%; }
  #teams-picker .picker-note { color: var(--text-dim); margin-bottom: 14px; }
  #teams-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
  #teams-row button.current { border-color: var(--accent); }

  /* How to join, for the room: large on the projector. */
  #join-card {
    position: fixed; inset: 0; background: var(--scrim); z-index: 60;
    display: flex; align-items: center; justify-content: center; padding: var(--sp-4); cursor: pointer;
  }
  #join-card .card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card);
    padding: var(--sp-6); display: flex; flex-wrap: wrap; gap: var(--sp-6); align-items: center;
    justify-content: center; max-width: 100%;
  }
  #join-card .join-qr { width: min(38vh, 70vw); aspect-ratio: 1; }
  #join-card .join-qr svg { width: 100%; height: 100%; display: block; border-radius: var(--r-card); }
  #join-card .join-step { color: var(--text-dim); font-size: var(--fs-20); line-height: var(--lh-20); }
  #join-card .join-addr { font-size: var(--fs-32); line-height: var(--lh-32); font-weight: var(--w-strong);
                          margin-bottom: var(--sp-3); overflow-wrap: anywhere; }
  #join-card .join-code { font-family: var(--mono); font-size: var(--fs-72); line-height: var(--lh-72);
                          font-weight: var(--w-strong); letter-spacing: .1em; color: var(--accent-ink);
                          margin-bottom: var(--sp-3); }

  /* Big screen: the arena, the score and every team's orders, nothing to press. */
  body.bigscreen #bs-run { display: inline-block; }
  body.bigscreen #sidebar, body.bigscreen #rail, body.bigscreen #units { display: none !important; }
  body.bigscreen #statusbar { height: 64px; font-size: var(--fs-20); line-height: var(--lh-20); }
  body.bigscreen #clock { font-size: var(--fs-32); line-height: var(--lh-32); }
  body.bigscreen #game-you, body.bigscreen #game-orders, body.bigscreen #game-pod-row,
  body.bigscreen #game-sensors, body.bigscreen #game-mates, body.bigscreen #strategy-panel .btnrow,
  body.bigscreen #strategy-text { display: none !important; }

  /* Floating arena notices. Flat panels, no blur. */
  #detail, #drawbanner, #toast {
    position: absolute; left: 50%; transform: translateX(-50%);
    border-radius: var(--r); white-space: nowrap; pointer-events: none;
    z-index: 10;
  }
  #detail {
    bottom: 14px; background: var(--panel); border: 1px solid var(--line);
    padding: var(--sp-2) 14px; display: none; color: var(--text-dim); font-size: var(--fs-12);
    font-variant-numeric: tabular-nums;
  }
  #detail.visible { display: block; }
  #drawbanner {
    top: 14px; background: var(--accent-dim); border: 1px solid var(--accent-line);
    color: var(--accent-ink); padding: 7px 14px; display: none; z-index: 15;
  }
  #drawbanner.visible { display: block; }
  #toast {
    top: 14px; background: var(--raised); border: 1px solid var(--line);
    padding: var(--sp-2) 14px; z-index: 20; opacity: 0;
    transition: opacity .2s linear;
  }
  #toast.visible { opacity: 1; }
  #toast.bad { background: var(--red-dim); border-color: var(--red-line); color: var(--red-ink); }

  /* Plain English: the student's words, then the plan they became */
  #strategy-text {
    width: 100%; resize: vertical; min-height: 84px; padding: var(--sp-2) 10px;
    background: var(--raised); color: var(--text); border: 1px solid var(--line);
    border-radius: var(--r);
  }
  #strategy-text:focus { outline: none; border-color: var(--accent); }
  #strategy-out { margin-top: 10px; }
  #strategy-out .q {
    background: var(--panel); border-left: 2px solid var(--accent);
    padding: 7px 9px; border-radius: var(--r); color: var(--text);
  }
  #strategy-out .plan { white-space: pre-wrap; color: var(--text); margin: 0; font: inherit; }
  #strategy-out .bad { color: var(--red-ink); }
  #strategy-out .by { color: var(--text-dim); font-size: var(--fs-12); margin-top: 6px; }
  #strategy-events { margin-top: var(--sp-2); font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim);
                     list-style: none; padding: 0; }
  #strategy-events li { padding: 2px 0; border-top: 1px solid var(--line-soft); }
  #twin { margin-top: var(--sp-2); }
  .twinrow { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
             color: var(--text-dim); margin-top: 6px; }
  .twinrow select { background: var(--raised); color: var(--text);
                    border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-1) 6px; }
  #arena-state { color: var(--text-dim); margin-bottom: var(--sp-2); }
  #arena-state b { color: var(--text); font-weight: var(--w-strong); }
  #arena-state .bad, #arena-state b.bad { color: var(--red-ink); }

  /* Who is at this laptop. A team's laptop sees its game and nothing that
     changes the arena for everyone; those are the teacher's. */
  #role-row { display: flex; gap: 6px; }
  #role-row button { flex: 1; }
  #role-note { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim); margin-top: 6px; }
  body.locked .teacher-only { display: none !important; }
  /* Rows laid out with flex would otherwise ignore the hidden attribute. */
  [hidden] { display: none !important; }

  /* Get through unseen */
  #game-round { color: var(--text); }
  #game-round .w { color: var(--accent-ink); font-weight: var(--w-strong); }
  #game-round .i { color: var(--blue-ink); font-weight: var(--w-strong); }
  #game-score { width: 100%; margin-top: var(--sp-2); border-collapse: collapse; }
  #game-score td { padding: 3px 6px; border-top: 1px solid var(--line-soft); color: var(--text-dim); }
  #game-score td.n { text-align: right; font-variant-numeric: tabular-nums; }
  #game-score tr.me td { color: var(--text); font-weight: var(--w-strong); }
  #game-you { margin-top: 10px; padding: var(--sp-2) 10px;
              background: var(--raised); border-left: 2px solid var(--accent); }
  #game-you.watch { border-left-color: var(--accent); }
  #game-you.out { border-left-color: var(--text-disabled); color: var(--text-dim); }
  #game-sensor-list, #game-events { list-style: none; padding: 0; margin: var(--sp-2) 0 0;
                                    font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim); }
  #game-sensor-list li { display: flex; justify-content: space-between; align-items: center;
                         padding: var(--sp-1) 0; border-top: 1px solid var(--line-soft); }
  #game-sensor-list button { background: none; border: none; color: var(--text-dim);
                             cursor: pointer; font-size: var(--fs-14); }
  #game-events li { padding: var(--sp-1) 0; border-top: 1px solid var(--line-soft); }
  #game-text { width: 100%; box-sizing: border-box; margin-top: 10px; background: var(--raised);
               color: var(--text); border: 1px solid var(--line); border-radius: var(--r);
               padding: var(--sp-2); resize: vertical; }
  #game-text:focus { outline: none; border-color: var(--accent); }
  #game-out, #game-all-orders { margin-top: 10px; }
  #game-out .plan, #game-all-orders .plan { white-space: pre-wrap; margin: 0; color: var(--text); font: inherit; }
  #game-out .q { background: var(--panel); border-left: 2px solid var(--accent); padding: 6px var(--sp-2); }
  #game-out .bad { color: var(--red-ink); }
  #game-out .by { color: var(--text-dim); font-size: var(--fs-12); margin-top: 6px; }
  #game-mates { margin-top: var(--sp-2); color: var(--text-dim); }
  #game-mates pre { white-space: pre-wrap; margin: 2px 0 6px; font: inherit; }
  #game-setup-form summary { cursor: pointer; color: var(--text-dim); margin-bottom: var(--sp-1); }
  #team-wait { margin-top: var(--sp-2); }
  #game-all-orders h3 { color: var(--text-dim); margin: var(--sp-2) 0 2px; }
  .game-help { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim); margin-top: 6px; }
  /* Plain buttons and fields in the sheets (no class of their own): secondary. */
  #sidebar button:not(.act):not(.scenario) {
    padding: var(--sp-1) 10px; border-radius: var(--r); cursor: pointer;
    background: var(--raised); color: var(--text); border: 1px solid var(--line);
  }
  #sidebar button:not(.act):not(.scenario):hover:not(:disabled) { border-color: var(--line-strong); }
  #sidebar button:not(.act):not(.scenario):disabled { color: var(--text-disabled); border-color: var(--line-soft); cursor: default; }
  #sidebar button:not(.act):not(.scenario)[aria-pressed="true"] { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-ink); }
  #sidebar .mname { background: var(--raised); color: var(--text); border: 1px solid var(--line);
                    border-radius: var(--r); padding: 3px 6px; }
  #sidebar a { color: var(--accent-ink); }
  /* The Mission sheet: a palette of kinds, the elements as rows of fields. */
  .mpalette { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--sp-2) 0; }
  .mside-row { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-3); }
  .mside-row .mnote { min-width: 40px; }
  #sidebar .mside-btn[data-side="blue"][aria-pressed="true"] { background: var(--blue-dim); border-color: var(--blue); color: var(--blue-ink); }
  #sidebar .mside-btn[data-side="red"][aria-pressed="true"] { background: var(--red-dim); border-color: var(--red); color: var(--red-ink); }
  .mside { flex: none; width: 10px; height: 10px; border-radius: 50%; }
  .mlabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mflag { flex: none; color: var(--red-ink); font-weight: var(--w-strong); }
  .melement.bad { border-color: var(--red-line); }
  .melement .mhead { cursor: pointer; }
  .mpalette button[aria-pressed="true"] { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-ink); }
  .mfield { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); margin: 3px 0; }
  .mfield span { min-width: 72px; color: var(--text-dim); }
  .mfield input, .mfield select { flex: 1 1 0; width: 0; min-width: 0; font-size: var(--fs-12); }
  .mnote { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-dim); }
  .mproblems { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--red-ink); margin: var(--sp-1) 0; }
  #mission-list h3 { margin: 10px 0 var(--sp-1); color: var(--text-dim); }
  .melement { border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--sp-1) 6px; margin: var(--sp-1) 0; }
  .melement:hover { border-color: var(--line-strong); }
  .melement.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
  .mhead { display: flex; align-items: center; gap: 6px; }
  .mname { flex: 1; min-width: 0; font-weight: var(--w-strong); }
  .mremove, .mcopy { flex: none; }
  .mstands { margin-top: var(--sp-1); font-size: var(--fs-12); }
  .mproblem { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--red-ink); margin: 2px 0; }
  .mfields { display: grid; grid-template-columns: 1fr; margin-top: var(--sp-1); }   /* one field a row: two clip at 300px */
  .mchooser { display: flex; gap: 6px; margin-top: 10px; }
  .mchooser select { flex: 1; min-width: 0; }
  .mchooser a { font-size: var(--fs-12); align-self: center; color: var(--accent-ink); }
  .join-row { display: flex; gap: 6px; width: 100%; margin-bottom: var(--sp-2); }
  #class h3 { margin: 6px 0 var(--sp-1); color: var(--text-dim); }
  .who-row { display: flex; align-items: center; gap: var(--sp-2); padding: 3px 0; }
  .who-row i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
  .who-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .who-pod { color: var(--text-dim); font-size: var(--fs-12); }
  .who-clear { flex: none; }
  .who-color { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-strong); flex: none; padding: 0; cursor: pointer; }
  .who-palette { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
  .who-swatch { width: 14px; height: 14px; border-radius: 50%; cursor: pointer; border: 1px solid var(--line-strong); }
  .join-row input { flex: 1; min-width: 0; padding: 6px var(--sp-2); }

  /* The big screen: the round's words are in the dock below; the bar keeps
     the activity, its phase and the clock, large. */
  body.bigscreen #sb-summary, body.bigscreen #sb-readouts .readout { display: none; }

  /* The end of a match, on every screen: the result first, large. */
  #game-final { border: 1px solid var(--accent); border-radius: var(--r-card); padding: 14px var(--sp-4);
                margin-bottom: var(--sp-3); background: var(--accent-dim); }
  #game-final .final-head { font-size: var(--fs-20); line-height: var(--lh-20); font-weight: var(--w-strong); color: var(--accent-ink); }
  #game-final .final-score { font-variant-numeric: tabular-nums; font-size: var(--fs-32); line-height: var(--lh-32);
                             font-weight: var(--w-strong); margin: var(--sp-1) 0 var(--sp-2); }
  #game-final .final-rounds { margin: 0 0 var(--sp-2) 18px; color: var(--text-dim); }
  body.bigscreen #game-final .final-head { font-size: var(--fs-32); line-height: var(--lh-32); }
  body.bigscreen #game-final .final-score { font-size: var(--fs-48); line-height: var(--lh-48); }
  body.bigscreen #game-final .btnrow { display: none; }
  /* The match over, the round's instructions and the orders box go; the comments stay. */
  #game-final:not([hidden]) ~ #game-role, #game-final:not([hidden]) ~ #game-you,
  #game-final:not([hidden]) ~ #game-pod-row, #game-final:not([hidden]) ~ #game-orders { display: none !important; }

  /* Narrow: the unit strip goes, the sheet takes the width it has. */
  @media (max-width: 1100px) {
    #units { display: none; }
    #sb-readouts .readout { display: none; }
  }
  @media (max-width: 820px) {
    #game-panel, #strategy-panel { grid-template-columns: 1fr; }
    #sb-summary, #best, #sb-phase { display: none; }
    #sidebar { width: calc(100% - var(--rail)); }
  }

  /* A phone: the bar wraps (the activity and its clock on a row of their own),
     the arena takes the top of the screen and the work under it the rest,
     scrolled. Nothing is wider than the screen: a 723 px bar had the browser
     shrink the whole page (2026-11-18). */
  @media (max-width: 640px) {
    #app { height: 100dvh; }
    #statusbar { height: auto; flex-wrap: wrap; gap: 6px var(--sp-2); padding: var(--sp-2) 10px; }
    #sb-scenario { order: 3; flex: 1 1 100%; margin: 0; height: 34px; gap: var(--sp-2); }
    #sb-score { display: none; }
    #sb-readouts { margin-left: auto; gap: var(--sp-1); }
    #camera-chip, #bigscreen, #bs-run, #join-chip { display: none !important; }
    #rail { width: 48px; }
    #body { flex-direction: row; }
    #stage { min-width: 0; }
    #container { flex: none; height: 46dvh; }
    #dock { flex: 1; max-height: none; padding: 10px var(--sp-3); }
    #game-text, #strategy-text { font-size: var(--fs-16) !important; }   /* no zoom on focus */
    /* The teacher's rail: a bar along the foot, its labels whole; an open sheet
       covers the arena (a phone has no room beside it) until its button again. */
    #body { position: relative; padding-bottom: 56px; }
    #rail { position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: 56px;
            flex-direction: row; justify-content: space-around; padding: var(--sp-1) var(--sp-1) env(safe-area-inset-bottom, 0px);
            border-right: 0; border-top: 1px solid var(--line); z-index: 20; }
    .rail-btn { flex: 1; padding: 6px 0; }
    .rail-btn.last { margin-top: 0; }
    #sidebar { position: absolute; top: 0; left: 0; right: 0; bottom: 56px; width: 100% !important;
               z-index: 15; border-right: 0; }
  }
