/* Independent OpenSciEd B.3 Lessons 3–4 companion pilot. */
.lab-header .crumbs { flex-wrap: wrap; }
.step-nav ol { justify-content: flex-start; }
.cycle-map { display:grid; grid-template-columns:minmax(0,1fr) 34px minmax(0,1fr) 34px minmax(0,1fr) 34px minmax(0,1fr); align-items:center; gap:8px; margin:18px 0; }
.cycle-stage { min-width:0; min-height:140px; box-sizing:border-box; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:9px; padding:20px 12px; border:1px solid var(--line); border-radius:var(--r); background:var(--surface); text-align:center; }
.cycle-stage span { display:block; width:100%; margin:0; font-family:var(--f-mono); font-size:1.05rem; line-height:1.3; color:var(--accent); font-weight:700; text-align:center; }
.cycle-stage strong { display:block; width:100%; margin:0; font-family:var(--f-display); font-size:1.5rem; line-height:1.2; text-align:center; }
.cycle-stage small { display:block; width:100%; margin:0; font-size:1.05rem; line-height:1.4; color:var(--muted); text-align:center; }
.cycle-arrow { display:flex; align-items:center; justify-content:center; width:100%; height:100%; margin:0; color:var(--accent); }
.cycle-arrow svg { display:block; width:30px; height:30px; flex:none; }
.panel { min-width:0; padding:16px; background:var(--surface); border:1px solid var(--line); border-radius:var(--r); }
.game-setup, .game-panel, .submit-card { display:grid; gap:12px; }
.mode-choice, .evidence-checks, #prediction-set { border:1px solid var(--line); border-radius:var(--r); padding:12px 14px; }
.mode-choice legend, .evidence-checks legend, #prediction-set legend { font-weight:700; padding:0 5px; }
.choice { display:flex; gap:9px; align-items:flex-start; margin:6px 0; padding:7px 9px; border-radius:var(--r-sm); }
.choice input { flex:none; margin-top:5px; }
.choice:hover { background:var(--surface-2); }
.game-topline { display:flex; gap:8px; flex-wrap:wrap; }
.game-rule { border-left:3px solid var(--accent); background:var(--surface-2); padding:8px 12px; border-radius:0 var(--r-sm) var(--r-sm) 0; }
.game-feedback { padding:12px 14px; border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:var(--r-sm); background:var(--surface-2); }
.game-feedback h4 { margin:0 0 5px; }
.round-summary { padding:12px; background:var(--accent-soft); border-radius:var(--r-sm); }
.sim-grid { display:grid; grid-template-columns:minmax(220px,.75fr) minmax(0,1.5fr); gap:14px; align-items:start; }
.controls { display:grid; gap:14px; }
.controls .field { display:grid; gap:5px; }
.controls input[type=range] { width:100%; }
.sim-output { display:grid; gap:10px; }
.model-note { padding:10px 12px; border-left:4px solid var(--warn); border-radius:0 var(--r-sm) var(--r-sm) 0; background:var(--warn-soft); }
.chart-wrap { min-height:100px; }
.chart-wrap svg { display:block; width:100%; height:auto; }
.table-wrap { max-width:100%; overflow-x:auto; }
#trial-table { min-width:700px; }
#trial-table caption { text-align:left; padding:8px 10px; font-weight:700; color:var(--ink); }
#trial-table td[colspan] { text-align:center; color:var(--muted); }
.precheck { display:grid; gap:3px; max-width:760px; margin-top:16px; padding:14px; border:1px solid var(--line); border-radius:var(--r); background:var(--surface); }
.mechanism-check { display:grid; gap:4px; border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:var(--r); background:var(--surface); }
.mechanism-check legend { padding:0 5px; font-weight:800; }
.mechanism-check > p { margin:4px 0; }
.feedback { min-height:1.4em; }
.field { display:grid; gap:5px; }
.field small { color:var(--muted); }
.field textarea { width:100%; max-width:80ch; }
.attribution { border-top:1px solid var(--line); margin-top:18px; padding-top:14px; font-size:.9rem; }
.attribution h3 { margin-top:0; }
.row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.row .btn { max-width:100%; }
[role=status]:empty { display:none; }
@media(max-width:760px) {
  .sim-grid { grid-template-columns:1fr; }
  .cycle-map { grid-template-columns:minmax(0,1fr); gap:0; }
  .cycle-arrow { height:42px; transform:none; }
  .cycle-arrow svg { transform:rotate(90deg); }
  .cycle-stage { width:100%; min-height:140px; }
}
@media(max-width:520px) {
  .step-nav a { padding-inline:8px; }
  .panel { padding:12px; }
  .row .btn { width:100%; justify-content:center; }
}
@media print {
  .step-nav, .theme-switch, .game-setup, #reveal-outcome, #next-scenario, #start-round1, #start-round2,
  #run-trials, #clear-trials, #download-work, #print-work, #reset-work, .skip-link { display:none!important; }
  body { background:#fff; color:#111; }
  .panel, .cycle-stage, .callout { break-inside:avoid; }
  textarea { min-height:3.5em; }
}


/* Cell-cycle game board: a responsive, touch-friendly play surface. */
.board-game { display:grid; gap:14px; margin-top:16px; }
.game-statusbar { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:16px 18px; border:1px solid var(--line); border-left:5px solid var(--accent); border-radius:var(--r); background:linear-gradient(120deg,var(--surface),var(--surface-2)); }
.game-statusbar h3 { margin:3px 0 2px; font-size:1.35rem; }
.game-statusbar p { margin:0; }
.game-kicker { display:block; color:var(--accent); font:600 .74rem var(--f-mono); letter-spacing:.08em; text-transform:uppercase; }
.game-status-pills { display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.board-legend { display:flex; flex-wrap:wrap; gap:6px 16px; padding:2px 4px; color:var(--muted); font-size:.82rem; }
.board-legend span { display:inline-flex; align-items:center; gap:6px; }
.legend-swatch { width:13px; height:13px; border-radius:4px; border:1px solid var(--line); display:inline-block; }
.swatch-g1 { background:#bde8d9; } .swatch-s { background:#d5e9fb; } .swatch-g2 { background:#f7e3ad; } .swatch-m { background:#d9cef8; } .swatch-check { background:#173f38; } .swatch-chance { background:#e6f6ff; border:2px solid #46a6c3; }
.board-scroll { overflow-x:auto; padding:2px 1px 9px; }
.cell-board { min-width:850px; display:grid; grid-template-columns:repeat(11,minmax(60px,1fr)); gap:5px; }
.board-tile { position:relative; min-height:76px; border:1px solid rgba(21,39,47,.16); border-radius:10px; padding:6px; display:flex; flex-direction:column; justify-content:space-between; box-shadow:0 2px 5px rgba(10,26,33,.08); overflow:hidden; }
.board-tile.phase-g1 { background:linear-gradient(145deg,#d9f1e8,#bde4d6); }
.board-tile.phase-s { background:linear-gradient(145deg,#eaf4ff,#d1e4f7); }
.board-tile.phase-g2 { background:linear-gradient(145deg,#fff4d5,#f1dfae); }
.board-tile.phase-m { background:linear-gradient(145deg,#efe9ff,#dcd3f5); }
.board-tile.phase-check { background:linear-gradient(145deg,#1a5b4b,#123d35); color:#f3fff9; border:2px solid #43b996; }
.board-tile.phase-start { background:linear-gradient(145deg,#253440,#111a20); color:#f4fff9; border:2px solid #51c7a3; }
.board-tile.phase-finish { background:linear-gradient(145deg,#b9f083,#84ca4e); color:#152313; border:2px solid #63a92f; }
.board-tile.chance-space:not(.phase-check) { outline:2px solid #51aaca; outline-offset:-4px; }
.tile-number { font:600 .66rem var(--f-mono); opacity:.68; }
.tile-label { font-weight:800; font-size:.87rem; line-height:1.05; }
.tile-note { font-size:.67rem; opacity:.76; line-height:1.05; }
.tile-tokens { display:flex; flex-wrap:wrap; gap:3px; min-height:15px; align-items:center; }
.cell-token { width:18px; height:18px; border:2px solid rgba(255,255,255,.95); border-radius:50%; display:inline-grid; place-items:center; color:#13201c; font:700 .65rem var(--f-mono); box-shadow:0 1px 4px #18292d77; }
.token-1 { background:#58d4b4; } .token-2 { background:#ffcb62; } .token-3 { background:#70baff; } .token-4 { background:#fc8fa3; }
.tile-active { box-shadow:0 0 0 3px var(--accent),0 5px 12px rgba(10,26,33,.22); z-index:1; transform:translateY(-2px); }
.board-gap { min-height:1px; }
.board-route-note { display:flex; justify-content:center; flex-wrap:wrap; align-items:center; gap:6px 10px; padding:8px 12px; border-radius:var(--r-sm); background:var(--surface-2); color:var(--muted); font-size:.78rem; text-align:center; }
.board-route-note strong { color:var(--ink); }
.route-arrow { color:var(--accent); font:700 .75rem var(--f-mono); }
.game-play-grid { display:grid; grid-template-columns:minmax(280px,.82fr) minmax(0,1.18fr); gap:14px; align-items:start; }
.dice-station,.scorecard { display:grid; gap:11px; }
.station-heading { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.station-heading h3 { margin:2px 0 0; font-size:1.15rem; }
.turn-count { font:600 .75rem var(--f-mono); color:var(--muted); background:var(--surface-2); padding:6px 9px; border-radius:99px; }
.dice-station > p { color:var(--muted); margin:0; min-height:2.8em; }
.dice-tray { display:grid; grid-template-columns:repeat(4,minmax(54px,1fr)); gap:9px; padding:10px; border-radius:12px; background:radial-gradient(ellipse at center,#71807b,#35413f 68%,#252e2e); box-shadow:inset 0 4px 14px #0005; }
.die { aspect-ratio:1; min-width:0; border-radius:14px; padding:8px; background:linear-gradient(145deg,#fff,#d8e2df); border:1px solid #fff; box-shadow:0 5px 0 #aab8b4,0 7px 12px #10171699; display:grid; place-items:center; transition:transform .12s; }
.die.rolling { animation:dice-tumble .55s ease-in-out infinite alternate; }
@keyframes dice-tumble { from { transform:rotate(-8deg) translateY(-2px); } to { transform:rotate(8deg) translateY(2px); } }
.die-face { width:100%; height:100%; display:grid; grid-template:repeat(3,1fr)/repeat(3,1fr); align-items:center; justify-items:center; }
.die-pip { width:8px; height:8px; border-radius:50%; background:#253c39; box-shadow:inset 0 1px 1px #0005; }
.die-value { color:#52706a; font:700 1.6rem var(--f-mono); }
.dice-result { min-height:2.6em; font-weight:700; color:var(--ink); padding:9px 11px; border-radius:var(--r-sm); background:var(--surface-2); }
.roll-button { min-height:52px; font-size:1.05rem; box-shadow:0 4px 0 color-mix(in srgb,var(--accent) 62%,#26352e); }
.roll-button:active:not(:disabled) { transform:translateY(3px); box-shadow:0 1px 0 color-mix(in srgb,var(--accent) 62%,#26352e); }
.dice-key { display:flex; flex-wrap:wrap; gap:5px 11px; font-size:.76rem; color:var(--muted); }
.dice-key strong { width:100%; color:var(--ink); }
.scorecard-grid { display:grid; gap:8px; }
.player-score { display:grid; grid-template-columns:minmax(90px,.8fr) repeat(4,minmax(50px,1fr)); gap:4px; align-items:stretch; padding:5px; border-radius:10px; border:1px solid var(--line); background:var(--surface-2); }
.player-score.is-active { border:2px solid var(--accent); background:var(--accent-soft); }
.player-score.is-done { opacity:.72; }
.score-player { display:flex; align-items:center; gap:6px; font-weight:700; font-size:.8rem; }
.score-cell { display:grid; justify-items:center; align-content:center; gap:1px; border-radius:7px; background:var(--surface); padding:4px 2px; }
.score-cell strong { font:700 1rem var(--f-mono); }
.score-cell small { font-size:.58rem; color:var(--muted); text-align:center; line-height:1; }
.checkpoint-card { padding:11px; border:1px solid var(--line); border-radius:11px; background:linear-gradient(140deg,var(--surface-2),var(--surface)); }
.checkpoint-heading { display:flex; gap:9px; align-items:center; margin-bottom:8px; }
.checkpoint-heading strong,.checkpoint-heading small { display:block; }
.checkpoint-heading small { color:var(--muted); margin-top:2px; }
.checkpoint-icon { width:27px; height:27px; display:grid; place-items:center; flex:none; border-radius:50%; background:var(--accent-soft); color:var(--accent); font-weight:900; }
.checkpoint-requirements { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; }
.requirement { display:flex; justify-content:space-between; gap:5px; padding:5px 7px; border-radius:7px; background:var(--surface); color:var(--muted); font-size:.75rem; }
.requirement.met { color:var(--ink); background:var(--accent-soft); }
.requirement strong { font:700 .75rem var(--f-mono); }
.turn-event { display:grid; grid-template-columns:42px minmax(0,1fr); align-items:start; gap:10px; border-left:4px solid var(--accent); }
.event-icon { width:38px; height:38px; display:grid; place-items:center; border-radius:10px; background:var(--accent-soft); font-size:1.25rem; }
.turn-event h3 { margin:2px 0; font-size:1.05rem; }
.turn-event p { margin:0; color:var(--muted); }
.turn-log summary { cursor:pointer; font-weight:700; }
.turn-log summary span { margin-left:7px; font-weight:400; color:var(--muted); font-size:.83rem; }
.turn-log ol { max-height:240px; overflow:auto; padding-left:1.4rem; }
.turn-log li { padding:4px 0; color:var(--muted); font-size:.84rem; }
.game-end { border-color:var(--accent); background:linear-gradient(130deg,var(--accent-soft),var(--surface)); }
.game-end h3 { margin-top:0; }
.game-end .round-compare { width:100%; }
.game-actions { justify-content:flex-start; }
.game-setup { grid-template-columns:minmax(0,1.2fr) minmax(220px,.8fr); align-items:start; }
.game-setup-copy { grid-row:span 2; }
.game-setup-copy h3 { margin:3px 0 5px; }
.game-setup-copy p { color:var(--muted); margin:0; }
.round-start-actions { display:flex; flex-wrap:wrap; gap:8px; }
.game-setup > .small { grid-column:1/-1; margin:0; }
.board-game[hidden], .game-setup[hidden], .game-end[hidden] { display:none!important; }
@media(max-width:760px) {
  .game-play-grid { grid-template-columns:1fr; }
  .game-setup { grid-template-columns:1fr; }
  .game-setup-copy { grid-row:auto; }
  .game-statusbar { align-items:flex-start; flex-direction:column; }
  .game-status-pills { justify-content:flex-start; }
}
@media(max-width:520px) {
  .cell-board { min-width:790px; }
  .board-tile { min-height:66px; }
  .dice-tray { gap:6px; padding:8px; }
  .die { border-radius:11px; padding:6px; }
  .die-pip { width:7px; height:7px; }
  .player-score { grid-template-columns:minmax(78px,.8fr) repeat(4,minmax(38px,1fr)); gap:3px; }
  .score-player { font-size:.71rem; }
  .score-cell small { font-size:.53rem; }
  .checkpoint-requirements { grid-template-columns:1fr 1fr; }
}
@media(prefers-reduced-motion:reduce) { .tile-active,.die.rolling { animation:none; transition:none; } }
@media print {
  .dice-station,.game-actions,.game-setup { display:none!important; }
  .cell-board { min-width:0; }
  .board-tile { min-height:50px; break-inside:avoid; }
}

/* Each board row is a serpentine run of spaces; keep the route readable on small screens. */
.cell-board { display:block; min-width:850px; }
.board-row { display:grid; grid-template-columns:repeat(11,minmax(60px,1fr)); gap:5px; margin-bottom:5px; }
.board-row.row-2 { direction:rtl; }
.board-row.row-2 > * { direction:ltr; }
.scorecard-grid { gap:10px; }
.player-score { display:grid; grid-template-columns:1fr; gap:4px; padding:8px; }
.score-player { display:flex; align-items:center; gap:7px; min-height:24px; }
.score-player small { margin-left:auto; color:var(--muted); font-weight:400; font-size:.7rem; }
.score-phase-head,.score-phase-row { display:grid; grid-template-columns:52px repeat(4,minmax(0,1fr)); gap:4px; align-items:center; }
.score-phase-head { color:var(--muted); font-size:.62rem; text-align:center; padding:0 3px; }
.score-phase-row > * { text-align:center; padding:4px 2px; border-radius:6px; background:var(--surface); font-size:.72rem; }
.score-phase-row > strong { background:transparent; text-align:left; color:var(--ink); }
.score-phase-row b { font:700 .8rem var(--f-mono); }
.score-phase-row .score-met { color:var(--ink); background:var(--accent-soft); }
.score-phase-row .score-na { color:var(--muted); }
@media(max-width:520px) {
  .score-phase-head,.score-phase-row { grid-template-columns:36px repeat(4,minmax(0,1fr)); gap:3px; }
  .score-phase-head { font-size:.55rem; }
  .score-phase-row > * { font-size:.67rem; }
}

.board-game.is-pregame .game-statusbar,
.board-game.is-pregame .game-play-grid,
.board-game.is-pregame .turn-event,
.board-game.is-pregame .turn-log,
.board-game.is-pregame .game-actions { display:none; }
.board-game.is-pregame .board-legend { margin-top:3px; }
.board-game.is-pregame .board-tile { min-height:88px; }
.checkpoint-card.checkpoint-ready { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.tile-active .cell-token { animation:cell-token-pop .55s ease-out; }
@keyframes cell-token-pop { 0% { transform:scale(.72); } 65% { transform:scale(1.24); } 100% { transform:scale(1); } }
.turn-event.is-card { border-left-color:#42a4c7; background:linear-gradient(110deg,#d8f4ff,var(--surface)); }
@media(prefers-reduced-motion:reduce) { .tile-active .cell-token { animation:none; } }

.swatch-flag { background:#d34e59; border-color:#a9313a; }
.cell-token.unchecked-token { background:#d34e59!important; color:#fff; border-color:#fff; }
.board-row { position:relative; }
.board-row.row-1::after,.board-row.row-2::after { position:absolute; bottom:-15px; color:var(--accent); font:700 1rem var(--f-mono); z-index:2; }
.board-row.row-1::after { content:'↴'; right:3px; }
.board-row.row-2::after { content:'↳'; left:3px; }
.die-value { grid-column:2; grid-row:2; place-self:center; }

/* Responsive serpentine layout: 11 columns on desktop, 5 on narrow screens. */
.cell-board { min-width:0; }
.board-row { grid-template-columns:repeat(var(--board-columns,11),minmax(0,1fr)); }
.board-row.row-reverse { direction:rtl; }
.board-row.row-reverse > * { direction:ltr; }
.board-row.row-odd::after { content:'↴'; right:3px; }
.board-row.row-even::after { content:'↳'; left:3px; }
@media(max-width:760px) {
  .cell-board { min-width:0; }
  .board-tile { min-height:72px; }
  .board-row { gap:4px; }
}
@media(max-width:520px) {
  .cell-board { min-width:0; }
  .board-row { gap:4px; margin-bottom:4px; }
  .board-tile { min-height:66px; padding:4px; border-radius:8px; }
  .tile-label { font-size:.75rem; }
  .tile-note { font-size:.58rem; }
}
.board-row.row-last::after { content:none!important; }


/* Multiplayer turn clarity and checkpoint progress */
.player-score.player-color-1 { --player-glow: #55e9ba; --player-tint: rgba(48,174,132,.23); }
.player-score.player-color-2 { --player-glow: #ffd36a; --player-tint: rgba(195,139,30,.23); }
.player-score.player-color-3 { --player-glow: #7bbcff; --player-tint: rgba(49,117,200,.23); }
.player-score.player-color-4 { --player-glow: #ff92b5; --player-tint: rgba(202,67,121,.23); }
.player-score.is-active { border:2px solid var(--player-glow,var(--accent)); background:linear-gradient(125deg,var(--player-tint,var(--accent-soft)),var(--surface-2)); box-shadow:0 0 0 2px var(--player-tint,var(--accent-soft)),0 0 24px var(--player-tint,var(--accent-soft)); }
.player-score.is-active .score-phase-row > span { background:var(--player-tint,var(--accent-soft)); }
.player-score.is-active .score-phase-row > span.score-met { background:var(--surface); box-shadow:inset 0 0 0 2px var(--player-glow,var(--accent)); }
.score-phase-row .score-check { font-style:normal; font-weight:900; margin-left:3px; color:var(--accent); }
.player-score.is-active .score-player small { color:var(--player-glow,var(--accent)); font-weight:900; letter-spacing:.04em; }
.checkpoint-card { border-width:2px; border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft); }
.checkpoint-heading strong { font-size:1.12rem; }
.checkpoint-requirements .requirement { display:grid; gap:5px; padding:10px; border:1px solid var(--line); border-radius:10px; }
.checkpoint-requirements .requirement strong { font-size:1.1rem; }
.requirement-meter { display:block; height:7px; border-radius:99px; background:var(--line); overflow:hidden; }
.requirement-meter > span { display:block; height:100%; border-radius:inherit; background:var(--accent); }
.requirement.met .requirement-meter > span { background:#46cf8e; }
@media(prefers-reduced-motion:no-preference){ .player-score { transition:background .2s,border-color .2s,box-shadow .2s; } }

/* Round 2 cellular chance card reveal */
.chance-reveal[hidden] { display:none!important; }
/* Above the enlarged board (.scene-expanded, z-index 10000), so a card drawn there is not hidden behind it. */
.chance-reveal { position:fixed; inset:0; z-index:10001; display:grid; place-items:center; padding:18px; background:rgba(3,9,19,.84); backdrop-filter:blur(7px); overflow-y:auto; }
.chance-reveal-panel { width:min(100%,490px); max-height:calc(100dvh - 36px); overflow-y:auto; padding:clamp(18px,4vw,30px); text-align:center; border:3px solid #ba83ff; border-radius:24px; background:linear-gradient(145deg,#34205d,#19152d 72%); color:#fff; box-shadow:0 0 0 5px #8e51e133,0 0 55px #9b4dff88; }
.chance-reveal-kicker { display:block; color:#e5c9ff; font-weight:900; letter-spacing:.1em; font-size:.85rem; }
.chance-reveal-art { display:grid; place-items:center; min-height:135px; margin:16px auto; border-radius:20px; background:radial-gradient(circle,#7a3ac9 0%,#392269 42%,#211736 80%); box-shadow:inset 0 0 32px #a76cff55; }
.chance-reveal-art span { font-size:clamp(4rem,12vw,6rem); filter:drop-shadow(0 0 18px #d9a9ff); }
.chance-reveal-player { color:#e4cbff; font-weight:800; margin:0; }
.chance-reveal-panel h2 { color:#fff; font-size:clamp(1.5rem,5vw,2rem); line-height:1.2; margin:12px 0; }
.chance-reveal-panel #chance-reveal-copy { font-size:1.12rem; line-height:1.55; color:#fff; }
.chance-reveal-note { font-size:.85rem; color:#d5c8e6; }
.chance-reveal-panel button { width:100%; min-height:48px; margin-top:10px; font-weight:800; }
@media(prefers-reduced-motion:no-preference){ .chance-reveal-panel { animation:chance-arrive .35s ease-out both; } @keyframes chance-arrive { from { opacity:0; transform:translateY(22px) scale(.94); } to { opacity:1; transform:translateY(0) scale(1); } } }
@media print { .chance-reveal { display:none!important; } }

/* Keep the live board and all turn information in one desktop viewport. */
@media(min-width:1100px) {
  #game-panel:not(.is-pregame) {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(310px,330px);
    grid-template-areas:
      "status status"
      "legend legend"
      "board hud"
      "board event"
      "route route"
      "rules rules"
      "history history"
      "summary summary"
      "actions actions"
      "reasoning reasoning";
    gap:10px 16px;
    align-items:start;
  }
  #game-panel:not(.is-pregame) > .game-statusbar {grid-area:status}
  #game-panel:not(.is-pregame) > .board-legend {grid-area:legend}
  #game-panel:not(.is-pregame) > .specimen-stage {grid-area:board;min-width:0}
  #game-panel:not(.is-pregame) > .board-route-note {grid-area:route}
  #game-panel:not(.is-pregame) > .game-rules {grid-area:rules}
  #game-panel:not(.is-pregame) > .game-play-grid {
    grid-area:hud;display:flex;flex-direction:column;gap:10px;min-width:0;
    max-height:calc(100dvh - 160px);overflow-y:auto;
    scrollbar-width:thin;align-self:start;
  }
  #game-panel:not(.is-pregame) > .turn-event {grid-area:event;align-self:start;margin:0}
  #game-panel:not(.is-pregame) > .turn-log {grid-area:history}
  #game-panel:not(.is-pregame) > .game-end {grid-area:summary}
  #game-panel:not(.is-pregame) > .game-actions {grid-area:actions}
  #game-panel:not(.is-pregame) > .mechanism-check {grid-area:reasoning;min-width:0}
  #game-panel:not(.is-pregame) .scorecard {order:0}
  #game-panel:not(.is-pregame) .dice-station {order:1}
  #game-panel:not(.is-pregame) .scorecard,
  #game-panel:not(.is-pregame) .dice-station {padding:12px;gap:8px}
  #game-panel:not(.is-pregame) .score-phase-head {font-size:.58rem}
  #game-panel:not(.is-pregame) .score-phase-row > * {padding:3px 1px}
  #game-panel:not(.is-pregame) .checkpoint-requirements {gap:5px}
  #game-panel:not(.is-pregame) .checkpoint-requirements .requirement {padding:6px}
  #game-panel:not(.is-pregame) .dice-tray {max-width:380px}
}
/* On smaller screens retain a readable full-size board and scorecard rather than shrinking both into illegibility. */

/* Give the interactive scene the unused horizontal space, without sacrificing HUD readability. */
@media(min-width:1100px){
  #game-panel:not(.is-pregame) > .specimen-stage{width:100%;max-width:none;justify-self:stretch}
  #game-panel:not(.is-pregame) > .specimen-stage canvas{display:block;width:100%;height:auto;max-width:none}
  #game-panel:not(.is-pregame) > .game-play-grid{width:100%;box-sizing:border-box}
  #game-panel:not(.is-pregame) .scorecard{min-width:0}
  #game-panel:not(.is-pregame) .score-phase-head,
  #game-panel:not(.is-pregame) .score-phase-row{grid-template-columns:42px repeat(4,minmax(0,1fr))}
}

/* Guided analysis with evidence visible while students answer */
#analyze [data-analysis-page][hidden]{display:none!important}
.analysis-workspace{display:grid;grid-template-columns:minmax(260px,.8fr) minmax(0,1.2fr);gap:20px;align-items:start}
.analysis-reference{position:sticky;top:14px;max-height:calc(100dvh - 28px);overflow:auto;padding:18px;border:2px solid var(--accent);border-radius:14px;background:var(--surface-2);scrollbar-width:thin}
.analysis-reference h3{margin:0 0 6px;font-size:1.3rem}.analysis-reference h4{margin:16px 0 8px}.analysis-reference p{margin:5px 0 9px}
.analysis-evidence-set{padding:10px;margin:9px 0;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.analysis-evidence-set strong{font-size:.87rem}.analysis-evidence-set p{font-size:.8rem}
.analysis-evidence-bar{height:9px;border-radius:99px;background:var(--line);overflow:hidden}.analysis-evidence-bar span{display:block;height:100%;background:var(--accent);border-radius:inherit}
.analysis-questions{min-width:0}.analysis-page-nav{display:flex;justify-content:space-between;align-items:center;gap:9px;margin:14px 0;padding:10px;border-radius:12px;background:var(--surface-2);border:1px solid var(--line)}
.analysis-page-nav button{min-width:100px}.analysis-page-nav span{font-weight:800;text-align:center;font-size:.85rem}
@media(max-width:850px){.analysis-workspace{grid-template-columns:1fr}.analysis-reference{position:static;max-height:340px}.analysis-page-nav{flex-wrap:wrap}.analysis-page-nav span{order:-1;width:100%}}
@media print{#analyze [data-analysis-page][hidden]{display:block!important}.analysis-reference{position:static;max-height:none}.analysis-page-nav{display:none}}

/* "What each phase needs": always-visible requirements for G1, S, G2 and M, with the active player's phase highlighted. */
.phase-guide { margin:14px 0 4px; padding:14px; border:2px solid var(--accent); border-radius:14px; background:var(--surface-2); }
.phase-guide h3 { margin:0 0 10px; font-size:1.05rem; }
.phase-cards { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.phase-card { position:relative; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); display:grid; gap:6px; align-content:start; }
.phase-card p { margin:0; font-size:.86rem; line-height:1.4; }
.phase-top { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.phase-name { font:800 1.25rem var(--f-mono, monospace); color:var(--accent); }
.phase-what { font-weight:700; }
.phase-status { margin-left:auto; font:700 .75rem var(--f-mono, monospace); color:var(--muted); }
.phase-check { color:var(--ink); }
.phase-why { color:var(--muted); }
.phase-card.is-current { border:2px solid var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.phase-card.is-current .phase-status { color:var(--accent); }
.phase-card.is-met .phase-status { color:var(--ok, #2e9e6b); }
@media(max-width:900px){ .phase-cards { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:520px){ .phase-cards { grid-template-columns:1fr; } .phase-guide { padding:12px; } }
@media(min-width:1100px){ #game-panel:not(.is-pregame) > .phase-guide { grid-area:route; margin:0; } }

/* Cell chips: blue = non-cancer cell, red = cancer cell (game model). Text labels always accompany the colour. */
.chip { display:inline-block; width:13px; height:13px; border-radius:50%; vertical-align:-2px; margin-right:4px; box-shadow:inset 0 0 0 2px rgba(255,255,255,.65); }
.chip-blue { background:#2f7fd8; border:1px solid #1b4f8f; }
.chip-red { background:#d23b3b; border:1px solid #8c1f1f; }
.chip-tally { white-space:nowrap; font:700 .78rem var(--f-mono); }
.chip-tally .chip-red { margin-left:8px; }
.score-chips { margin:0; font-size:.76rem; color:var(--muted); }
.turn-event.is-red { border-left-color:#d23b3b; }
.chance-reveal-effect { font-weight:700; color:#fff3c9; }
/* Effect label under a card's printed title (several printed cards share a title). */
.chance-reveal-label { display:inline-block; margin:-4px 0 6px; padding:3px 12px; border-radius:99px; background:#ffffff1f; border:1px solid #ffffff55; color:#fff; font-weight:800; font-size:.92rem; letter-spacing:.02em; }
.event-label { display:inline-block; margin:2px 0 6px; padding:2px 10px; border-radius:99px; border:1px solid var(--line); background:var(--surface-2,transparent); color:var(--ink); font-weight:700; font-size:.82rem; }
.event-label[hidden] { display:none; }
.event-notice { margin:8px 0 0; padding:6px 10px; border-left:4px solid var(--warn,#c98a1b); background:color-mix(in srgb,var(--warn,#c98a1b) 12%,transparent); font-weight:700; }
.event-notice[hidden] { display:none; }
.chance-reveal.is-not-working .chance-reveal-panel { border-color:#ff8f8f; box-shadow:0 0 0 5px #e1515133,0 0 55px #ff4d4d66; }
.round-compare td { text-align:center; font-variant-numeric:tabular-nums; }
table.data.round-compare th, table.data.round-compare td { white-space:normal; }
@media(max-width:520px){ table.data.round-compare { font-size:.8rem; } table.data.round-compare th, table.data.round-compare td { padding:6px 7px; } }

/* Lesson 3 Making Sense (handout table and questions) */
.making-sense { margin-top:16px; display:grid; gap:8px; }
.making-sense h3 { margin:0; }
.making-sense h4 { margin:12px 0 0; }
.making-sense > p { margin:0; }
.making-sense-table { width:100%; table-layout:fixed; }
.making-sense-table th[scope=row] { width:20%; text-align:left; white-space:normal; }
.making-sense-table textarea { width:100%; box-sizing:border-box; min-height:3.4em; resize:vertical; font:inherit; }
@media(max-width:640px){
  .making-sense-table, .making-sense-table thead, .making-sense-table tbody, .making-sense-table tr, .making-sense-table th, .making-sense-table td { display:block; width:100%; box-sizing:border-box; }
  .making-sense-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
  .making-sense-table tr { padding:8px 0; border-bottom:1px solid var(--line); }
  .making-sense-table th[scope=row] { width:auto; }
  .making-sense-table td::before { display:block; font-size:.8rem; color:var(--muted); margin:6px 0 2px; }
  .making-sense-table td:nth-child(2)::before { content:'What happened in the game?'; }
  .making-sense-table td:nth-child(3)::before { content:'What could it represent in a cell?'; }
}
.making-sense .analysis-question { margin:0 0 14px; gap:6px; }
.making-sense .analysis-question label { display:flex; align-items:baseline; gap:9px; font-size:1rem; font-weight:700; line-height:1.45; }
.making-sense .analysis-question > p { margin:0; font-size:.86rem; color:var(--muted); }
.making-sense .analysis-question textarea { width:100%; max-width:83ch; min-height:80px; box-sizing:border-box; }
@media print { .making-sense textarea { border:1px solid #999; } }
/* Cell cycle data reference (OpenSciEd B.3 Lesson 3 "Cell Cycle Data"), recreated as a chart and tables. */
.cycle-data { display:grid; gap:10px; margin-top:8px; padding:14px; border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:var(--r); background:var(--surface-2); }
.cycle-data h4 { margin:0; }
.cycle-data .eyebrow { margin:0; }
.cycle-data-intro { margin:0; max-width:83ch; }
.cycle-data-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr)); gap:14px; align-items:start; }
.cycle-data-figure { margin:0; min-width:0; display:grid; gap:8px; padding:12px; border:1px solid var(--line); border-radius:var(--r-sm); background:var(--surface); }
.cycle-data-figure figcaption { line-height:1.45; }
.cycle-data-table { width:100%; }
table.data.cycle-data-table th, table.data.cycle-data-table td { white-space:normal; text-align:left; vertical-align:top; }
@media(max-width:520px){ table.data.cycle-data-table th, table.data.cycle-data-table td { padding:6px 7px; } }
.cycle-data-note, .cycle-data-credit { margin:0; font-size:.84rem; color:var(--muted); }
.cycle-data-credit a { color:var(--accent); font-weight:700; }
.size-key { display:flex; align-items:center; gap:8px; font-size:.8rem; color:var(--muted); font-family:var(--f-mono); flex-wrap:wrap; }
.size-key-bar { flex:1 1 80px; min-width:80px; height:12px; border-radius:6px; border:1px solid var(--line); background:linear-gradient(90deg,#1b2c8f,#2f6ee0,#3cc0d8,#55c27a,#e3d34a,#ef8a2f,#d8322c); }
.swatch { display:inline-block; width:.95em; height:.95em; margin-right:6px; vertical-align:-.12em; border-radius:3px; border:1px solid var(--line); }
.swatch-blue { background:#2f6ee0; } .swatch-green { background:#55c27a; } .swatch-yellow { background:#e3d34a; } .swatch-navy { background:#0d1a5c; }
.dna-chart { display:block; width:100%; height:auto; max-width:560px; color:var(--ink); }
.dna-chart text { fill:currentColor; font-family:var(--f-mono); font-size:16px; }
.dna-chart .dna-axis-label { font-family:inherit; font-size:16px; fill:var(--muted); }
@media(max-width:520px){ .dna-chart text, .dna-chart .dna-axis-label { font-size:24px; } }
.dna-axis line { stroke:currentColor; stroke-width:1.5; }
.dna-grid line { stroke:var(--line); stroke-dasharray:4 4; }
.dna-phases rect { stroke:currentColor; stroke-width:1; }
.dna-phases .phase-g1 { fill:var(--surface); } .dna-phases .phase-s { fill:var(--accent-soft); } .dna-phases .phase-g2 { fill:var(--surface-2); }
.dna-line { fill:none; stroke:var(--accent); stroke-width:3.5; stroke-linejoin:round; }
.dna-points circle { fill:var(--accent); }
@media print { .cycle-data { break-inside:avoid; } }

/* Analyze: evidence panel heading doubles as a fold-away toggle on phones; on wide screens it reads as a plain heading. */
.analysis-reference-toggle > summary { list-style:none; cursor:pointer; }
.analysis-reference-toggle > summary::-webkit-details-marker { display:none; }
.analysis-reference-toggle > summary h3 { display:inline; margin:0; }
.analysis-page-nav { scroll-margin-top:72px; }
@media(max-width:850px){
  .analysis-reference-toggle > summary::after { content:" ▸ show"; font-size:.8rem; color:var(--muted); }
  .analysis-reference-toggle[open] > summary::after { content:" ▾ hide"; }
  .analysis-reference{max-height:none}
}
@media(min-width:851px){ .analysis-reference-toggle > summary { pointer-events:none; } }

/* Analyze: a one-line section heading keeps each question part close to one screen. */
#analyze > header h2 { font-size:clamp(1.5rem, 2.6vw, 2.1rem); line-height:1.15; }
#analyze > header { margin-bottom:6px; }
#analyze .analysis-question textarea { min-height:64px; field-sizing:content; max-height:320px; }

/* "Your data" box placed between each Analyze question's hint and its answer box. */
.q-evidence { margin:6px 0 8px; padding:8px 12px; border-left:4px solid var(--accent); border-radius:0 8px 8px 0; background:var(--surface-2); max-width:83ch; }
.q-evidence-title { margin:0 0 2px; font:700 .72rem var(--f-mono, monospace); letter-spacing:.06em; text-transform:uppercase; color:var(--accent); }
.q-evidence ul { margin:0; padding-left:1.1rem; font-size:.86rem; line-height:1.45; }
.baseline-prompt { max-width:83ch; margin:14px 0 18px; padding:12px 14px; border:1px solid var(--line, currentColor); border-left:4px solid var(--accent); border-radius:0 10px 10px 0; background:var(--surface-2); }
.baseline-prompt label { font-weight:700; }
.baseline-prompt p { margin:4px 0 8px; font-size:.88rem; }
.baseline-prompt textarea { width:100%; }
.baseline-echo-text { margin:0; white-space:pre-wrap; font-size:.9rem; }
.baseline-echo-text.is-empty { font-style:italic; color:var(--muted); }
@media print { .q-evidence { break-inside:avoid; } }

/* Single-column step bodies may not grow wider than the page: a wide report table (Wrap up) scrolls inside its
   .table-wrap instead of widening the grid track and the whole page at 390px. */
main > .step > .step-body:not(.split) { grid-template-columns:minmax(0,1fr); }

/* Checkpoint card dialog (G1 / G2 / M Checkpoint cards, Teacher Reference: Game Cards 1). It reuses the chance-card
   overlay (.chance-reveal) but draws a printed paper card: a phase-coloured band with the p53 protein (as on the card's
   back), the printed text on a dashed-edged face, then the player's scorecard checked against it. Band colours follow
   the board's phase colours (G1 green, G2 amber, M violet). */
:root { --cp-g1-band:#cfeee2; --cp-g1-ink:#0b3d2e; --cp-g1-edge:#1d7d5d;
  --cp-g2-band:#f7e5b6; --cp-g2-ink:#4a3200; --cp-g2-edge:#946500;
  --cp-m-band:#e6ddfb; --cp-m-ink:#2e1f63; --cp-m-edge:#6747c2; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --cp-g1-band:#123d31; --cp-g1-ink:#c4f2df; --cp-g1-edge:#5fd3a8;
    --cp-g2-band:#3b2d0e; --cp-g2-ink:#f8e2a8; --cp-g2-edge:#e8c786;
    --cp-m-band:#2a2250; --cp-m-ink:#e0d7ff; --cp-m-edge:#b6a3f2; }
}
:root[data-theme="dark"] { --cp-g1-band:#123d31; --cp-g1-ink:#c4f2df; --cp-g1-edge:#5fd3a8;
  --cp-g2-band:#3b2d0e; --cp-g2-ink:#f8e2a8; --cp-g2-edge:#e8c786;
  --cp-m-band:#2a2250; --cp-m-ink:#e0d7ff; --cp-m-edge:#b6a3f2; }
.checkpoint-card-panel { --cp-band:var(--cp-g1-band); --cp-ink:var(--cp-g1-ink); --cp-edge:var(--cp-g1-edge);
  display:flex; flex-direction:column; width:min(100%,520px); max-height:calc(100dvh - 36px); overflow:hidden; padding:0 0 clamp(12px,3vw,18px); border:3px solid var(--cp-edge); border-radius:22px;
  background:var(--surface); color:var(--ink); box-shadow:0 18px 48px rgba(0,0,0,.45),0 0 0 5px color-mix(in srgb,var(--cp-edge) 25%,transparent); text-align:left; }
.checkpoint-card-scroll { flex:1 1 auto; min-height:0; overflow-y:auto; padding-bottom:4px; }
.checkpoint-card-scroll:focus-visible { outline:3px solid var(--accent); outline-offset:-3px; }
.checkpoint-card-panel.cp-g2 { --cp-band:var(--cp-g2-band); --cp-ink:var(--cp-g2-ink); --cp-edge:var(--cp-g2-edge); }
.checkpoint-card-panel.cp-m { --cp-band:var(--cp-m-band); --cp-ink:var(--cp-m-ink); --cp-edge:var(--cp-m-edge); }
.checkpoint-card-band { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px clamp(14px,4vw,24px) 10px; background:var(--cp-band); color:var(--cp-ink); border-bottom:2px solid var(--cp-edge); }
.checkpoint-card-kicker { display:block; font:800 .78rem var(--f-mono); letter-spacing:.08em; }
.checkpoint-card-band h2 { margin:2px 0 0; color:var(--cp-ink); font-family:var(--f-display); font-size:clamp(1.45rem,5vw,1.9rem); line-height:1.15; }
.checkpoint-card-player { margin:2px 0 0; font-weight:700; font-size:.92rem; }
.checkpoint-card-p53 { flex:0 0 auto; width:clamp(58px,15vw,78px); height:auto; filter:drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.checkpoint-card-face { margin:12px clamp(12px,3.5vw,20px) 0; padding:12px clamp(10px,3vw,16px); border:1.5px dashed var(--line); border-radius:12px; background:var(--surface-2); }
.checkpoint-card-printed-label { margin:0 0 4px; font:700 .72rem var(--f-mono); letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.checkpoint-card-intro { margin:0 0 8px; font-weight:600; }
.checkpoint-card-lines { list-style:none; margin:0; padding:0; display:grid; gap:4px; }
.checkpoint-card-line { margin:0; padding:2px 10px; border-radius:10px; line-height:1.4; }
.checkpoint-card-line.is-applies { padding:5px 8px; border:2px solid var(--cp-edge); background:color-mix(in srgb,var(--cp-edge) 16%,var(--surface)); font-weight:600; }
.checkpoint-card-house { margin:10px clamp(12px,3.5vw,20px) 0; }
.checkpoint-card-house[hidden] { display:none; }
.checkpoint-card-marker { display:block; font:800 .74rem var(--f-mono); letter-spacing:.06em; text-transform:uppercase; color:var(--ink); }
.checkpoint-card-label { display:inline-block; margin:2px 0; padding:2px 10px; border-radius:99px; border:1.5px solid var(--cp-edge); background:var(--cp-band); color:var(--cp-ink); font-weight:800; font-size:.86rem; white-space:normal; }
.checkpoint-card-subhead { margin:12px clamp(14px,4vw,24px) 6px; font-size:1rem; }
.checkpoint-card-checks { list-style:none; margin:0 clamp(12px,3.5vw,20px); padding:0; display:grid; gap:4px; }
.checkpoint-check { display:grid; grid-template-columns:24px minmax(0,auto) minmax(0,1fr) auto; grid-template-areas:"glyph name have verdict"; column-gap:8px; align-items:center; padding:4px 10px; border:1px solid var(--line); border-radius:10px; background:var(--surface); line-height:1.3; }
@media(max-width:480px){ .checkpoint-check { grid-template-columns:24px minmax(0,1fr) auto; grid-template-areas:"glyph name verdict" "glyph have verdict"; } }
.checkpoint-check-glyph { grid-area:glyph; display:grid; place-items:center; width:24px; height:24px; border-radius:50%; font-weight:900; }
.checkpoint-check.is-met .checkpoint-check-glyph { background:var(--ok-soft); color:var(--ok); border:1.5px solid var(--ok); }
.checkpoint-check.is-short .checkpoint-check-glyph { background:var(--bad-soft); color:var(--bad); border:1.5px dashed var(--bad); }
.checkpoint-check-name { grid-area:name; font-weight:700; }
.checkpoint-check-have { grid-area:have; font-variant-numeric:tabular-nums; }
.checkpoint-check-need { color:var(--muted); font-size:.88rem; }
.checkpoint-check-verdict { grid-area:verdict; font-weight:800; font-size:.86rem; }
.checkpoint-check.is-met .checkpoint-check-verdict { color:var(--ok); }
.checkpoint-check.is-short .checkpoint-check-verdict { color:var(--bad); }
.checkpoint-card-result { margin:10px clamp(14px,4vw,24px) 0; line-height:1.45; }
.checkpoint-card-why { margin:6px clamp(14px,4vw,24px) 0; font-size:.9rem; color:var(--muted); line-height:1.4; }
.checkpoint-card-why strong { color:var(--ink); }
.checkpoint-card-panel button { flex:0 0 auto; display:flex; justify-content:center; width:calc(100% - 2 * clamp(14px,4vw,24px)); min-height:48px; margin:10px auto 0; font-weight:800; }
/* The button stays below the scrolling card text; a hairline shows there is more above it when the card scrolls. */
.checkpoint-card-scroll + button { box-shadow:0 -11px 0 -10px var(--line); }
@media(max-height:820px){ .checkpoint-card-band { padding-top:9px; padding-bottom:8px; } .checkpoint-card-p53 { width:56px; } .checkpoint-card-face { margin-top:10px; padding-top:9px; padding-bottom:9px; } .checkpoint-card-subhead { margin-top:9px; } }
@media(prefers-reduced-motion:no-preference){ .checkpoint-card-panel { animation:checkpoint-flip .38s ease-out both; } @keyframes checkpoint-flip { from { opacity:0; transform:perspective(900px) rotateY(-24deg) translateY(14px) scale(.95); } to { opacity:1; transform:none; } } }
@media print { .checkpoint-reveal { display:none!important; } }
