/* In-world puzzle stations. Loaded last. The outer sheet is only a layout container; opaque
   materials belong to the board, console and small text plaques, not to a page-sized rectangle. */
body[data-screen="exam"] {
  --st-panel:#142f28;
  --st-face:#18382f;
  --st-edge:#71856a;
  --st-ink:#f4f3df;
  --st-muted:#c5d6c4;
  --st-accent:#ead092;
  --st-focus:#b9e6ff;
  --st-shadow:#071b18;
  --st-frame:0 3px 0 var(--st-shadow),inset 0 1px 0 #ffffff20;
}
body[data-screen="exam"][data-game="pipes"] {
  --st-panel:#102e36;--st-face:#173e47;--st-edge:#b18b4e;--st-ink:#fff0d2;
  --st-muted:#b9d8d6;--st-accent:#f3ce87;--st-shadow:#061c23;
}
body[data-screen="exam"][data-game="numbers"] {
  --st-panel:#101c31;--st-face:#172941;--st-edge:#526b8d;--st-ink:#eaf5ff;
  --st-muted:#b5c9df;--st-accent:#86f1d8;--st-shadow:#060d1d;
}
body[data-screen="exam"][data-game="shaper"] {
  --st-panel:#17102e;--st-face:#24133e;--st-edge:#8865af;--st-ink:#f6eeff;
  --st-muted:#d5c1ec;--st-accent:#8cf5ff;--st-shadow:#09051a;
}

/* Open space between the small foreground surfaces exposes the scene without putting moving art
   behind text. No blur or filters are applied to the full-screen canvas. */
body[data-screen="exam"] .academy-root::after { opacity:.04 }
body[data-screen="exam"] .sheet.puzzle-station {
  padding:0 0 20px;background:transparent;border:0;border-radius:0;box-shadow:none;
  color:var(--st-ink);--muted:var(--st-muted);--good:#9ce2b7;--bad:#ffb6a7;
}
body[data-screen="exam"] .masthead {
  background:var(--st-panel);border-color:var(--st-edge);box-shadow:var(--st-frame);
  margin-bottom:10px;
}
body[data-screen="exam"] .tagline { color:var(--st-accent) }
/* The timer bar already carries round and star progress. Avoid a second progress strip. */
body[data-screen="exam"] .pips { display:none }
body[data-screen="exam"] .pip { background:#111b32a8;box-shadow:0 0 0 1px #fff4 }
body[data-screen="exam"] .pip.cur { background:var(--st-accent) }
body[data-screen="exam"] .pip.ok { background:#76ce9c }
body[data-screen="exam"] .pip.no { background:#e58f82 }
body[data-screen="exam"] .practice-banner {
  width:fit-content;max-width:100%;margin:0 auto 9px;padding:5px 10px;
  background:var(--st-panel);color:var(--st-muted);border:1px solid var(--st-edge);border-radius:6px;
  font:11px/1.4 var(--sans);box-shadow:0 2px 0 var(--st-shadow);
}
body[data-screen="exam"] .timerbar {
  display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;
  padding:8px 12px;margin:0 0 12px;background:var(--st-panel);color:var(--st-ink);
  border:1px solid var(--st-edge);box-shadow:var(--st-frame);border-radius:8px;
}
.timerbar .station-readout { display:flex;gap:12px;flex-wrap:wrap;justify-content:flex-start;min-width:0 }
.timerbar .station-readout .eyebrow { color:var(--st-ink);font:600 11px/1.2 var(--mono);letter-spacing:.03em;text-align:left }
.timerbar .difficulty-chip { color:var(--st-muted);font-size:10px }
.timerbar .difficulty-chip i,.timerbar .exam-stars .label { display:none }
body[data-screen="exam"] .timerbar .practice-banner {
  margin:0;padding:0;border:0;background:none;box-shadow:none;font:10px/1.3 var(--sans);color:var(--st-muted);
}
body[data-screen="exam"] #timer { color:var(--st-ink);font:600 18px/1 var(--mono);min-width:78px }
body[data-screen="exam"] .puzzle-station .quiz-title {
  display:table;max-width:100%;margin:0 auto 13px;padding:7px 16px;
  background:var(--st-panel);color:var(--st-ink);border:1px solid var(--st-edge);border-radius:7px;
  font:600 clamp(21px,4vw,27px)/1.15 var(--pixel);box-shadow:var(--st-frame);
}
.puzzle-station .instruction {
  width:fit-content;max-width:100%;margin:12px auto 0;padding:7px 12px;
  color:var(--st-ink);background:var(--st-panel);border:1px solid var(--st-edge);border-radius:7px;
  font:12px/1.5 var(--sans);box-shadow:0 2px 0 var(--st-shadow);text-wrap:pretty;
}
.puzzle-station .keyboard-hint { color:var(--st-muted);border-color:var(--st-edge);white-space:normal }
.puzzle-station .skip {
  width:fit-content;max-width:100%;min-height:44px;margin:9px auto 0;padding:8px 14px;
  color:var(--st-muted);background:var(--st-panel);border:1px solid var(--st-edge);border-radius:7px;
  font-size:12px;box-shadow:0 2px 0 var(--st-shadow);
}
.puzzle-station .feedback:not(:empty) {
  width:fit-content;max-width:100%;margin:12px auto 0;padding:8px 12px;
  background:var(--st-panel);border:1px solid var(--st-edge);border-radius:7px;
}
.puzzle-station :is(button,summary):focus-visible,body[data-screen="exam"] .quiz-title:focus-visible {
  outline:3px solid var(--st-focus);outline-offset:3px;
}

/* Academy: a framed chalkboard holds just the printed figures. The answer tiles rest on a narrow
   wooden shelf. Ivory remains inside the figures and is never spread behind the full puzzle. */
body[data-screen="exam"][data-game=""] .sequence {
  width:fit-content;max-width:100%;margin:0 auto 16px;padding:14px 12px 12px;
  border:5px solid #785639;border-top-color:#a98052;border-left-color:#a98052;border-radius:5px;
  background:radial-gradient(ellipse at 30% 10%,#34584b,#1b3a30 75%);
  box-shadow:inset 0 0 0 2px #10291f,0 4px 0 #382719,0 10px 22px #081d2155;
}
body[data-screen="exam"][data-game=""] .sequence.matrix { width:min(100%,320px);padding:10px;gap:5px }
body[data-screen="exam"][data-game=""] .seq-item small { color:#e0e7d3 }
body[data-screen="exam"][data-game=""] .answers {
  width:min(100%,450px);padding:12px 10px 8px;margin-top:10px;gap:12px;
  background:linear-gradient(180deg,#68472d,#89603c);border:2px solid #3d2b1d;border-radius:6px;
  box-shadow:0 4px 0 #36251b,inset 0 2px 0 #b48b5a;
}

/* Pipe Run: the board is the brass-framed instrument panel. */
body[data-screen="exam"][data-game="pipes"] .pipes-wrap { width:min(100%,520px);margin:0 auto }
body[data-screen="exam"][data-game="pipes"] .pipes-board {
  border:4px solid #9e773e;border-top-color:#e0ba74;border-left-color:#d2a968;
  border-radius:9px;box-shadow:inset 0 0 0 2px #071d23,0 4px 0 #30200d,0 12px 26px #03172477;
  background:#12343b;
}
.puzzle-station .flowbar {
  width:min(100%,520px);margin:10px auto 12px;padding:8px 10px;color:var(--st-accent);
  background:var(--st-panel);border:1px solid var(--st-edge);border-radius:7px;box-shadow:var(--st-frame);
}
.puzzle-station .flowbar.ended output { color:var(--st-muted) }
.puzzle-station .flowbar.urgent output { color:#ffc2a1 }

/* Number Run: a compact spacecraft console, with solid instrument displays and tactile keys. */
body[data-screen="exam"][data-game="numbers"] .num-wrap {
  width:min(100%,520px);margin:0 auto;padding:18px 18px 16px;border:2px solid #637c9a;
  border-top:4px solid #9bb1c5;border-bottom:6px solid #1c2d48;border-radius:14px 14px 20px 20px;
  background:linear-gradient(135deg,#263d56,#16263c 52%,#1b3048);
  box-shadow:inset 0 0 0 2px #0c1728,0 5px 0 #080f20,0 14px 26px #040b2570;
}
.puzzle-station .num-terms { gap:8px }
.puzzle-station .num-chip {
  min-width:58px;padding:17px 10px 10px;background:#071424;border:1px solid #577d99;border-radius:6px;
  box-shadow:inset 0 2px 5px #0008,0 1px 0 #8ab3d144;
}
.puzzle-station .num-chip b { color:#eef8ff;font-size:28px }
.puzzle-station .num-chip small { color:#aac8de }
.puzzle-station .num-slot { background:#0c2c36;border:2px solid #86f1d8;min-width:80px }
.puzzle-station .num-slot b,.puzzle-station .num-slot small { color:#afffe8 }
.puzzle-station .num-slot b.empty { animation:none;opacity:1 }
.puzzle-station .num-answer.is-right { background:#103b31;border-color:#9ce2b7 }
.puzzle-station .num-answer.is-wrong { background:#48252a;border-color:#ffb6a7 }
.puzzle-station .num-hint { color:#c0d3e4;margin:13px 0 0 }
.puzzle-station .num-pad { width:min(100%,284px);gap:9px;margin-top:15px }
.puzzle-station .num-key {
  color:#eef8ff;background:linear-gradient(#354d66,#283b54);border-color:#0a1628;
  box-shadow:inset 0 1px 0 #91a7bd,0 3px 0 #080f20;font-family:var(--num);min-height:48px;
}
.puzzle-station .num-key.k-enter { background:#8aefd5;color:#082b2d;box-shadow:inset 0 1px 0 #d6fff1,0 3px 0 #164e51 }
.puzzle-station .num-key.k-back { background:#26354e;color:#d2e2f1 }
.puzzle-station .num-key:is(:active,.is-pressed) { background:#476781;box-shadow:0 1px 0 #080f20 }

/* Line Shaper: the grid stands on its own; its lightly tinted glass exposes the city beneath it.
   Checkpoints, walls and the signal stay opaque. The narrow dock is a dark equipment rail. */
body[data-screen="exam"][data-game="shaper"] .sh-wrap { width:100%;margin:0 auto }
body[data-screen="exam"][data-game="shaper"] .sh-board {
  background:linear-gradient(180deg,#160c36e8,#120a2dd9);border:2px solid #9470c4;
  box-shadow:inset 0 0 0 1px #4df3ff55,0 4px 0 #09051a,0 0 18px #9860e026;
}
.puzzle-station .sh-status {
  width:fit-content;max-width:100%;margin:10px auto 0;padding:6px 10px;background:var(--st-panel);
  color:var(--st-muted);border:1px solid var(--st-edge);border-radius:6px;font-size:11px;
}
.puzzle-station .sh-wrap.is-solved .sh-status { color:#a8edbc }
.puzzle-station .sh-dock {
  width:fit-content;max-width:100%;gap:12px 20px;margin:12px auto 0;padding:15px 16px 10px;
  background:#17102eef;border:1px solid #8865af;border-bottom:4px solid #09051a;border-radius:9px;
  box-shadow:inset 0 1px 0 #b69cdd44;
}
.puzzle-station .sh-slot small { color:#e2ccf4 }
.puzzle-station .sh-empty { color:var(--st-muted) }

/* Marking: a compact verdict with an optional review drawer, not another page-length sheet. */
.puzzle-station .result {
  width:min(100%,560px);margin:12px auto 0;background:var(--st-panel);color:var(--st-ink);
  border:1px solid var(--st-edge);border-radius:9px;box-shadow:var(--st-frame);
}
/* The verdict already states the outcome. Keep the feedback node for live announcements without
   repeating it as a second plaque, and remove instructions once input is locked. */
.puzzle-station.is-marked>.instruction,.puzzle-station.is-marked>.feedback { display:none }
.puzzle-station .result-head { padding:11px 13px;color:#a9edbf;border-color:var(--st-edge) }
.puzzle-station .result-wrong .result-head { color:#ffbeac }
.puzzle-station .result-skip .result-head { color:var(--st-accent) }
.puzzle-station .result-head small,.puzzle-station .rankbadge small,.puzzle-station .rstat span { color:var(--st-muted) }
.puzzle-station .verdict { background:transparent;color:inherit }
.station-review>summary {
  min-height:44px;padding:12px 14px;color:var(--st-ink);cursor:pointer;font:600 12px/1.5 var(--sans);
}
.station-review[open]>summary { border-bottom:1px solid var(--st-edge) }
.puzzle-station .result-body { padding:12px 15px 15px }
.puzzle-station .next-wrap { width:min(100%,340px);margin:12px auto 0;position:relative;bottom:auto }
.puzzle-station .next-wrap .action {
  width:100%;min-height:48px;background:var(--st-accent);color:var(--st-shadow);border-color:var(--st-shadow);
  box-shadow:0 3px 0 var(--st-shadow);
}

@media(max-width:580px){
  body[data-screen="exam"] .shell { padding-inline:12px;padding-top:12px }
  body[data-screen="exam"] .timerbar { padding:8px;gap:8px }
  .timerbar .station-readout { display:grid;gap:3px }
  .timerbar .station-readout .eyebrow { font-size:10px }
  .timerbar .difficulty-chip { font-size:9px }
  .timerbar .exam-stars { gap:2px }
  .timerbar .exam-stars .star { width:14px;height:14px }
  .puzzle-station .quiz-title { font-size:22px;padding:7px 12px }
  .puzzle-station .instruction { font-size:11.5px;padding:7px 9px }
  body[data-screen="exam"][data-game=""] .sequence { padding:12px 7px 10px;gap:5px }
  body[data-screen="exam"][data-game=""] .sequence.matrix { width:min(100%,290px);padding:8px }
  body[data-screen="exam"][data-game=""] .answers { padding:12px 8px 7px;gap:10px }
  body[data-screen="exam"][data-game="pipes"] .pipes-wrap { width:100%;margin-inline:0 }
  body[data-screen="exam"][data-game="numbers"] .num-wrap { padding:15px 10px 13px }
  .puzzle-station .num-chip { min-width:48px;padding:15px 8px 8px }
  .puzzle-station .num-chip b { font-size:23px }
  .puzzle-station .num-slot { min-width:68px }
  .puzzle-station .num-pad { width:min(100%,268px) }
  .puzzle-station .sh-stage { padding-inline:15px }
  .puzzle-station .sh-dock { gap:12px 16px;padding:14px 12px 10px }
}

/* Accessible fallbacks: strong focus on dark materials; no translucent surfaces or material effects
   when the system requests high contrast. The game geometry remains unchanged. */
@media(prefers-contrast:more){
  body[data-screen="exam"] { --st-edge:#d9e5ed;--st-muted:#e3edf2;--st-focus:#fff }
  body[data-screen="exam"][data-game="shaper"] .sh-board { background:#120a2d }
}
@media(forced-colors:active){
  body[data-screen="exam"] .sheet.puzzle-station { color:CanvasText }
  body[data-screen="exam"] :is(.timerbar,.quiz-title,.instruction,.skip,.result,.num-wrap,.num-chip,.num-key,.sh-dock,.sh-status) {
    background:Canvas;color:CanvasText;border-color:CanvasText;box-shadow:none;forced-color-adjust:auto;
  }
  .puzzle-station :is(button,summary):focus-visible { outline-color:Highlight }
  .puzzle-station .num-chip b { color:CanvasText }
}
