/* The simulation is the primary surface; controls sit around the scene. */
#cell-game { max-width:1440px; }
#cell-game > header h2 { font-size:clamp(2.4rem,5vw,4.5rem); letter-spacing:-.055em; line-height:1.05; margin:8px 0 14px; }
#cell-game .step-body > .prose { max-width:70ch; font-size:1.08rem; }
#cell-game .step-body > .callout--safety { display:none; }
#cell-game .game-setup { display:flex; align-items:center; flex-wrap:wrap; gap:18px 24px; background:transparent; border:0; border-top:1px solid var(--line); padding:20px 0 6px; }
#cell-game .game-setup-copy { flex:1 1 300px; max-width:480px; }
#cell-game .game-setup-copy h3 { font-size:1.25rem; }
#cell-game .game-setup-copy .eyebrow,#cell-game .game-setup > .small { display:none; }
#cell-game .mode-choice { border:0; padding:0; margin:0; }
#cell-game .mode-choice legend { font-size:.75rem; color:var(--muted); }
#cell-game .mode-choice .choice { padding:2px 0; font-size:.88rem; }
#cell-game .game-setup .field { max-width:145px; font-size:.85rem; }
#cell-game .round-start-actions { flex-basis:100%; }
#cell-game #start-round1 { font-size:.9rem; border-radius:999px; padding:10px 21px; }
#cell-game .board-game { gap:0; }
#cell-game .board-legend,#cell-game .board-route-note { display:none; }
#cell-game .game-statusbar { padding:12px 4px; margin:0; border:0; background:transparent; border-radius:0; }
#cell-game .game-statusbar h3 { font-size:1.1rem; }
#cell-game .game-statusbar .game-kicker { font-size:.67rem; }
#cell-game .game-statusbar p { font-size:.82rem; }
.specimen-stage { position:relative; width:100%; overflow:hidden; border-radius:15px; background:#12242a; box-shadow:0 12px 45px #071a221f,inset 0 0 0 1px #b6d7cb22; margin:10px 0 0; }
#cycle-scene { display:block; width:100%; height:auto; aspect-ratio:1160 / 760; touch-action:pan-y; }
.scene-action { position:absolute; right:3.4%; bottom:4.8%; width:25%; }
#cell-game .scene-action .roll-button { width:100%; min-height:48px; border-radius:999px; box-shadow:0 4px 14px #001a1899; font-size:clamp(.8rem,1.4vw,1.07rem); font-weight:700; background:#b3e8c6; border:1px solid #d0f6da; color:#17362e; padding:10px; }
#cell-game .scene-action .roll-button:hover { background:#cef7db; }
#cell-game .scene-action .roll-button:disabled { opacity:.55; }
.specimen-tip { position:absolute; max-width:240px; pointer-events:none; margin:0; padding:10px 12px; color:#def2e7; background:#0b1e24f0; border:1px solid #9ac4b34d; border-radius:9px; box-shadow:0 8px 24px #0005; font-size:.8rem; line-height:1.45; }
.specimen-tip[hidden] { display:none; }
#cell-game .game-play-grid { grid-template-columns:minmax(0,.82fr) minmax(0,1.18fr); gap:26px; margin-top:18px; }
#cell-game .game-play-grid .panel { background:transparent; border:0; padding:0; border-radius:0; }
#cell-game .dice-tray,#cell-game .dice-key,#cell-game .dice-station > .station-heading,#cell-game #dice-prompt { display:none; }
#cell-game .dice-result { background:transparent; padding:0; font-size:.9rem; min-height:0; font-weight:600; }
#cell-game .scorecard > .station-heading { display:none; }
#cell-game .checkpoint-card { background:transparent; border:0; padding:12px 0 0; box-shadow:none; }
#cell-game .checkpoint-requirements { display:flex; gap:7px; flex-wrap:wrap; }
#cell-game .requirement { border-radius:999px; gap:8px; padding:5px 10px; border:1px solid var(--line); background:transparent; }
#cell-game .requirement.met { background:var(--accent-soft); }
/* Checkpoint requirement cards stack label, count and meter, so they need card corners, not a pill that clips them. */
#cell-game .checkpoint-requirements .requirement { border-radius:10px; min-width:0; }
#cell-game .checkpoint-requirements .requirement > span:first-child { overflow-wrap:anywhere; }
#cell-game .player-score { border:0; background:transparent; border-radius:0; padding:7px 10px; border-bottom:1px solid var(--line); }
#cell-game .player-score.is-active { border:0; border-bottom:2px solid var(--accent); background:transparent; }
#cell-game .score-phase-row > * { border-radius:3px; background:transparent; }
#cell-game .score-phase-row .score-met { background:var(--accent-soft); }
#cell-game .turn-event { border:0; border-top:1px solid var(--line); padding:14px 0; border-radius:0; background:transparent; margin-top:18px; }
#cell-game .turn-event .event-icon { background:transparent; border-radius:0; }
#cell-game .turn-event h3 { font-size:1.05rem; }
#cell-game .turn-log { border:0; border-top:1px solid var(--line); padding:12px 0; background:transparent; border-radius:0; }
#cell-game .game-rules { margin:8px 0; order:8; }
#cell-game .game-actions { margin:12px 0; }
#cell-game .game-end { margin-top:14px; }
#cell-game .is-pregame .scene-action { display:none; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
@media(max-width:760px) {
  #cell-game .game-play-grid { grid-template-columns:1fr; gap:16px; }
  .scene-action { right:3.4%; bottom:3.8%; width:27%; }
  #cell-game .scene-action .roll-button { min-height:34px; font-size:.72rem; padding:6px 4px; }
  .specimen-stage { border-radius:10px; }
  #cell-game .game-setup { gap:12px; }
  #cell-game .game-setup-copy { max-width:none; }
}
/* Phones and small tablets: the scene is redrawn as a tall 360 × 612 composition (see cell-cycle-scene.js), shown at about
   1 canvas px = 1 CSS px so every label is at least 12 px. The Roll button sits under the board instead of over it. */
#cycle-scene { --scene-ar:1.526; }
#cycle-scene[data-layout="portrait"] { --scene-ar:.5882; aspect-ratio:360 / 612; max-width:560px; margin:0 auto; }
.specimen-stage.is-portrait .scene-action { position:static; width:auto; margin:4px 12px 14px; }
#cell-game .specimen-stage.is-portrait .scene-action .roll-button { min-height:52px; font-size:1rem; padding:10px 14px; }
@media print { .scene-action { display:none!important; } }

.scene-expand { position:absolute; top:9px; right:14px; z-index:2; border:1px solid #abc6b455; border-radius:99px; padding:6px 12px; background:#142b2e; color:#d4e9df; font:600 .72rem Arial,sans-serif; cursor:pointer; }
.scene-expand:hover { background:#28514c; }
.specimen-stage.scene-expanded { position:fixed; inset:10px; z-index:10000; width:calc(100vw - 20px); height:calc(100dvh - 20px); margin:0; overflow:auto; border:1px solid #a7d7bc55; }
.specimen-stage.scene-expanded { display:flex; align-items:center; justify-content:center; overflow:hidden; }
/* Fit the whole board inside the window: as wide as possible without getting taller than the window (canvas is 1160×760). */
.specimen-stage.scene-expanded canvas, #cell-board.scene-expanded #cycle-scene { min-width:0; max-width:none; width:min(100%, calc((100vh - 40px) * var(--scene-ar,1.526))); width:min(100%, calc((100dvh - 40px) * var(--scene-ar,1.526))); height:auto; }
/* Enlarged on a portrait phone: the Roll button sits under the board, so the board is a little shorter than the window. */
.specimen-stage.scene-expanded.is-portrait { flex-direction:column; gap:8px; }
.specimen-stage.scene-expanded.is-portrait canvas, #cell-board.scene-expanded #cycle-scene[data-layout="portrait"] { max-width:none; margin:0; width:min(100%, calc((100vh - 120px) * var(--scene-ar))); width:min(100%, calc((100dvh - 120px) * var(--scene-ar))); }
.specimen-stage.scene-expanded.is-portrait .scene-action { position:static; width:min(320px,86%); margin:0; }
.specimen-stage.scene-expanded .scene-action { position:fixed; right:30px; bottom:30px; width:230px; }
.specimen-stage.scene-expanded .scene-expand { position:fixed; right:30px; top:24px; }
body.scene-open { overflow:hidden; }
/* Keep the complete artwork and Roll control visible during a desktop turn. */
.game-reset-dialog{width:min(480px,calc(100% - 32px));padding:24px;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--ink)}
/* Round complete / Game over (play-test item 17). A top-layer modal, so it also sits over the enlarged board. */
.round-end-dialog{width:min(760px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:clamp(16px,3vw,28px);border:3px solid var(--accent);border-radius:18px;background:var(--surface);color:var(--ink);box-sizing:border-box}
.round-end-dialog::backdrop{background:#000a}
.round-end-dialog h2{margin:4px 0 8px;font-size:clamp(1.6rem,5vw,2.3rem);line-height:1.1}
.round-end-dialog h2:focus{outline:none}.round-end-dialog h2:focus-visible{outline:3px solid var(--accent);outline-offset:4px}
.round-end-reason{font-weight:700}
.round-end-table{width:100%;min-width:0;font-size:.86rem}
.round-end-table caption{text-align:left;font-weight:700;margin-bottom:4px}
.round-end-dialog table.data.round-end-table th,.round-end-dialog table.data.round-end-table td{padding:5px 7px;white-space:normal;overflow-wrap:anywhere}
.round-end-dialog table.data.round-end-table thead th{overflow-wrap:normal}
.round-end-dialog table.data.round-end-table td{text-align:center;font-variant-numeric:tabular-nums}
.round-end-players{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:10px 16px;margin:10px 0}
.round-end-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
@media(max-width:520px){.round-end-dialog table.data.round-end-table,.round-end-dialog table.data.round-end-table th{font-size:.72rem}.round-end-dialog table.data.round-end-table th,.round-end-dialog table.data.round-end-table td{padding:4px 3px;line-height:1.25}.round-end-actions .btn{width:100%;justify-content:center}}
@media print{.round-end-dialog{display:none!important}}
.game-reset-dialog::backdrop{background:#0009}.game-reset-dialog p{margin:16px 0}
@media(min-width:1100px){
  #cell-game{max-width:1880px;width:100%}
  body.cell-game-active .lab-header{padding-block:8px}
  body.cell-game-active .lab-header .crumbs{margin-bottom:0}
  body.cell-game-active .lab-header .wrap > .eyebrow,
  body.cell-game-active .lab-header h1,
  body.cell-game-active .lab-header .driving-q,
  body.cell-game-active .lab-header .tags{display:none}
  #cell-game.game-running{padding-top:16px}
  #cell-game.game-running > header h2{font-size:2rem;margin:4px 0 8px}
  #cell-game.game-running .step-body > .prose{display:none}
  #game-panel:not(.is-pregame){grid-template-columns:minmax(0,1fr) minmax(320px,360px)}
  #game-panel:not(.is-pregame) > .specimen-stage:not(.scene-expanded){height:var(--game-scene-height,calc(100dvh - 260px));margin-top:0}
  #game-panel:not(.is-pregame) > .specimen-stage:not(.scene-expanded) canvas{width:100%;height:100%;object-fit:contain;aspect-ratio:auto}
  #game-panel:not(.is-pregame) > .game-play-grid{margin-top:0;max-height:calc(var(--game-scene-height,100dvh - 260px) - 140px);overflow-y:auto;overscroll-behavior:contain;padding:2px 10px 10px;box-sizing:border-box}
  #game-panel:not(.is-pregame) > .turn-event{max-height:130px;overflow-y:auto;font-size:.86rem;padding-inline:10px;box-sizing:border-box}
  #cell-game .scene-action{width:210px;right:14px;bottom:14px}
  #cell-game .scene-action .roll-button{min-height:44px;font-size:.95rem}
}
@media(max-width:760px){.scene-expand { font-size:.78rem; top:6px; right:7px; padding:4px 10px; min-height:28px; }.scene-expanded .scene-expand{font-size:.8rem;padding:8px 12px;}}
