/* One measured cockpit geometry replaces fixed minimum-board height budgets. */
.shell{padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));overflow:visible}
.cockpit-viewport{position:fixed;left:0;top:0;width:0;height:100svh;visibility:hidden;pointer-events:none;contain:strict}
.console.cockpit{--board-edge:500px;display:grid;gap:7px 10px;align-items:start;grid-template-columns:minmax(0,1fr);width:min(100%,610px);grid-template-areas:"header" "status" "board" "hud" "readout" "controls" "results" "log" "footer";grid-template-rows:none}
.cockpit>header{grid-area:header;margin:0;padding-bottom:8px;min-width:0;align-items:center}
.cockpit>.status{grid-area:status;margin:0;min-height:54px;padding:7px 9px;font-size:11px;min-width:0;display:grid;grid-template-columns:7px minmax(0,1fr) auto;grid-template-rows:16px 18px;gap:4px 8px;align-content:center}
.cockpit .analysis-readout{grid-area:2/1/3/-1;margin:0;padding-top:2px;height:18px;min-width:0}
.cockpit>.status:has(.online-link:not(.hidden)){min-height:84px;grid-template-rows:16px minmax(36px,auto)}
.cockpit>.status .online-link{grid-area:2/1/3/-1;min-width:0}
.cockpit>.board-frame{grid-area:board;width:var(--board-edge);max-width:100%;aspect-ratio:1;padding:5px;justify-self:center}
.cockpit .board{height:100%;aspect-ratio:1}
.board-row{display:contents}.board-cell{min-width:0;min-height:0}.board-cell>.square{width:100%;height:100%}
.cockpit .square small{font-size:9px;opacity:.8}
/* SpicyGame's shared pixel shapes: mint fill vs dark fill/green outline. */
.chess-piece{display:block;width:100%;height:100%;pointer-events:none;overflow:visible}
.chess-piece.white{--piece-fill:#baffd0;--piece-edge:#17472b;--piece-detail:#17472b}
.chess-piece.black{--piece-fill:#031109;--piece-edge:#51e980;--piece-detail:#51e980}
.chess-piece .piece-edge{fill:var(--piece-edge)}.chess-piece .piece-detail{fill:var(--piece-detail)}
.cockpit .square>.piece,.sequence-board-host .square>.piece{display:grid;place-items:center;width:88%;height:92%;max-width:68px;max-height:72px;font-size:0;line-height:0;text-shadow:none;transform:none}
.promotion-grid>button>span{display:block;width:56px;height:56px;max-width:100%;margin:auto;line-height:0;text-shadow:none}
.cockpit .captured-group i{display:block;width:16px;height:18px;flex:0 0 16px;font-style:normal;text-shadow:none}
/* Two dense capture rows must fit the existing 32px phone-landscape HUD. */
.cockpit.cockpit-landscape .captured-group i{height:12px}
.cockpit.cockpit-landscape .captured-group{line-height:12px}
/* Check is a persistent, non-moving warning, not a change to square colors. */
.cockpit .board-frame.in-check,.cockpit>.status.in-check{border-color:#ffd17f}
.cockpit>.status.in-check #state{color:#ffd17f;opacity:1;font-weight:900}
.cockpit .square.in-check{outline:2px solid #ffd17f;outline-offset:-3px;box-shadow:inset 0 0 14px rgba(255,183,69,.2)}
.cockpit .square.in-check::after{content:"!";position:absolute;right:2px;top:2px;width:12px;height:12px;display:grid;place-items:center;background:#ffd17f;color:#081007;border-radius:50%;font-size:10px;line-height:1;font-weight:900;z-index:3;pointer-events:none}
.cockpit>.match-hud{grid-area:hud;min-height:46px;border-top:1px solid rgba(65,255,114,.38)}
.cockpit>.readout{grid-area:readout;margin:0;font-size:10px;line-height:1.5;gap:8px}
.cockpit>.match-controls{grid-area:controls;display:flex;gap:5px;min-width:0}
.match-controls>button{flex:1;min-width:0;min-height:44px;margin:0;padding:7px 5px;font-size:11px;line-height:1.3;letter-spacing:.03em;border:1px solid #31864a;color:#9affb4;background:#04130a;white-space:normal;cursor:pointer}
.match-controls>.new{flex:1.65;color:#a2ffb8}.match-controls>button:hover{background:#113b21}
.cockpit>.result-controls{grid-area:results}.result-controls button{width:100%;min-height:42px;background:#092916;border:1px solid #41ff72;color:#a2ffba;font-size:12px;cursor:pointer}
.cockpit>.game-log{grid-area:log;min-height:0;height:auto;max-height:100%;margin:0;contain:none;overflow:hidden}
.cockpit .log-head{flex-direction:row}.cockpit .log-head button{min-height:36px;padding:7px;font-size:11px}.cockpit .log-head #undo{border-top:0;border-left:1px solid #28643a;text-align:center}
.cockpit .log-body{height:85px;max-height:85px;overflow:auto;min-height:0;transition:none}.cockpit .log-body.collapsed{visibility:hidden;overflow:hidden}
.cockpit .log-row{grid-template-columns:28px 1fr 1fr;font-size:11px;gap:4px;padding:4px 0}.cockpit .log-row span:last-child{grid-column:auto}
.cockpit>footer{grid-area:footer;margin:0;padding-top:6px;opacity:1;font-size:10px;color:#68bb7e;flex-wrap:wrap;gap:8px}
.cockpit.cockpit-wide{width:min(100%,860px);grid-template-columns:minmax(0,var(--board-edge)) minmax(240px,1fr);grid-template-areas:"header header" "status status" "board log" "hud log" "readout log" "controls log" "results log"}
.cockpit-wide>footer,.cockpit-landscape>footer{display:none}
.cockpit-wide>.game-log{height:100%;contain:size layout paint;display:flex;flex-direction:column}.cockpit-wide .log-body{flex:1;height:0;max-height:none}
.cockpit-wide header h1{font-size:30px}.cockpit-wide header p{font-size:10px}
.cockpit.cockpit-landscape{height:auto;min-height:var(--board-edge);width:100%;max-width:1000px;grid-template-columns:var(--board-edge) minmax(210px,1fr);grid-template-rows:auto auto auto auto auto auto minmax(104px,1fr);grid-template-areas:"board header" "board status" "board hud" "board readout" "board controls" "board results" "board log";gap:5px 10px}
.cockpit-landscape>header{padding-bottom:4px}.cockpit-landscape header h1{font-size:25px}.cockpit-landscape header p{font-size:9px;letter-spacing:.06em;margin-top:5px}
.cockpit-landscape .config{min-width:58px;min-height:40px;padding:4px;font-size:10px}.cockpit-landscape>.status{min-height:48px;padding:5px 7px;font-size:10px;gap:6px}
.cockpit-landscape .analysis-readout{font-size:10px;padding-top:2px;grid-template-columns:1fr}.cockpit-landscape .analysis-readout>span{display:none}
.cockpit-landscape>.game-log{height:104px;min-height:104px;max-height:none;contain:layout paint;display:flex;flex-direction:column}.cockpit-landscape .log-body{height:0;flex:1;max-height:none;padding:0 7px}.cockpit-landscape .log-head{flex-shrink:0}.cockpit-landscape .log-head button{min-height:36px;font-size:10px}.cockpit-landscape .log-row{font-size:10px}
.cockpit-landscape .match-controls>button{font-size:10px;min-height:40px}.cockpit-landscape>.readout{font-size:9px}
.cockpit .hud-side{gap:5px;padding:5px;min-width:0;height:50px}.cockpit .hud-side>div{min-width:0;gap:2px;flex-direction:column;align-items:flex-start;flex:1}.cockpit .hud-side strong{font-size:10px;color:#83d99a;flex-shrink:0}.cockpit .hud-side time{font-size:16px;letter-spacing:0;flex-shrink:0}
.cockpit .captured-list{overflow:visible;white-space:normal;display:flex;flex-wrap:wrap;gap:2px 5px;font-size:10px;color:#83c797;min-height:13px;line-height:1.25}
.captured-group{display:inline-flex;align-items:center;gap:2px;white-space:nowrap}.cockpit .captured-group i{margin:0;font-size:15px}.captured-group small{font-size:10px}
@media(max-width:440px){.cockpit>.match-hud{grid-template-columns:1fr}.cockpit .hud-side{height:32px;min-height:32px;padding:3px 6px}.cockpit .hud-side>div{flex-direction:row;align-items:center;gap:7px}.cockpit header h1{font-size:27px}.cockpit header p{font-size:9px;letter-spacing:.05em}.cockpit .config{min-width:64px;padding:5px;font-size:10px}.cockpit>.status{font-size:10px}.cockpit .match-controls>button{font-size:10px}}
.cockpit.cockpit-compact.cockpit-portrait{gap:2.5px;grid-template-areas:"header" "status" "board" "hud" "readout" "controls" "results" "log"}.cockpit-compact.cockpit-portrait>footer{display:none}.cockpit-compact.cockpit-portrait .log-body{height:24px;max-height:24px;padding:0 7px}.cockpit-compact.cockpit-portrait header h1{font-size:24px}
@media(max-width:660px){.cockpit-landscape>.match-hud{grid-template-columns:1fr}.cockpit-landscape .hud-side{height:32px;min-height:32px;padding:3px 6px}.cockpit-landscape .hud-side>div{flex-direction:row;align-items:center;gap:7px}.cockpit-landscape .hud-side+.hud-side{border-left:0;border-top:1px solid rgba(65,255,114,.2)}}
/* Dialogs scroll internally, leaving every action reachable at high zoom/short heights. */
.modal,.startup{overflow-y:auto;overscroll-behavior:contain;align-items:safe center;padding:12px}
.startup{transition:opacity .2s}
/* Text-first cold start: reserve the log area so each printed row stays put. */
.splash-screen.terminal-boot{width:min(100%,720px);max-height:calc(100svh - 24px);padding:clamp(16px,4vw,30px);border:1px solid #408955;background:#010a04;text-align:left;display:flex;flex-direction:column;animation:none;box-shadow:0 0 35px rgba(65,255,114,.08);font-family:inherit;overflow:hidden}
.terminal-boot .boot-header{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid #245b35;margin:0 0 24px;padding:0 0 12px;font-size:11px;letter-spacing:.08em;color:var(--green);flex-shrink:0}
.terminal-boot h1{margin:0 0 8px;font-size:clamp(28px,7vw,44px);line-height:1;letter-spacing:-.05em;color:var(--green);text-shadow:0 0 12px rgba(65,255,114,.25)}
.terminal-boot-sub{margin:0 0 26px;font-size:11px;letter-spacing:.12em;color:var(--green)}
.terminal-boot .boot-command{margin:0 0 16px;color:var(--green);font-size:13px;letter-spacing:.02em}
.terminal-boot .boot-lines{width:100%;height:276px;min-height:80px;flex:0 1 276px;overflow:auto;margin:0;display:block;font-size:13px;line-height:23px;color:var(--green);scrollbar-color:#41ff72 #031109}
.boot-row{display:flex;justify-content:space-between;gap:12px;min-height:23px}.boot-row>span{min-width:0}.boot-row>strong{flex-shrink:0;font-weight:400;color:var(--green);text-align:right}
.terminal-boot .boot-prompt{display:flex;align-items:center;gap:8px;margin:18px 0 22px;font-size:11px;letter-spacing:.06em;color:var(--green);flex-shrink:0}
.boot-cursor{display:inline-block;width:8px;height:13px;background:var(--green);animation:terminalCursor 1.2s step-end infinite}
.terminal-boot .boot-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;border-top:1px solid #245b35;margin:0;padding:12px 0 0;opacity:1;font-size:10px;color:var(--green);flex-shrink:0}
.boot-percent{font-weight:400;color:var(--green)}.skip-boot{appearance:none;-webkit-appearance:none;min-height:44px;padding:8px 12px;border:1px solid #448b58;background:#061b0d;color:var(--green);-webkit-text-fill-color:currentColor;font:inherit;font-size:11px;cursor:pointer}.skip-boot:hover{background:#123a21}
@keyframes terminalCursor{0%,49%{opacity:1}50%,100%{opacity:0}}
@media(max-width:440px){.terminal-boot .boot-header{font-size:9px;letter-spacing:0}.terminal-boot .boot-lines{font-size:11px}.terminal-boot .boot-command{font-size:11px}.boot-row{gap:6px}.terminal-boot .boot-footer{font-size:9px}}
@media(max-height:550px){.terminal-boot .boot-header{margin-bottom:12px}.terminal-boot-sub{margin-bottom:12px}.terminal-boot .boot-command{margin-bottom:8px}.terminal-boot .boot-prompt{margin:10px 0}.terminal-boot .boot-lines{min-height:46px}.terminal-boot h1{font-size:26px}}
@media(prefers-reduced-motion:reduce),(forced-colors:active){.boot-cursor{animation:none}.startup:has(.terminal-boot){transition:none}}
@media(forced-colors:active){.splash-screen.terminal-boot,.skip-boot{border-color:ButtonText;background:Canvas;color:CanvasText}.terminal-boot h1,.terminal-boot .boot-header,.terminal-boot-sub,.terminal-boot .boot-command,.terminal-boot .boot-lines,.boot-row>strong,.terminal-boot .boot-prompt,.terminal-boot .boot-footer,.boot-percent{color:CanvasText}.boot-cursor{background:CanvasText}}
.modal>.panel,.onboarding{max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;scrollbar-color:#41ff72 #031109}
.panel small,.onboarding small{font-size:11px}.panel .session-panel small,.panel .career-head small,.panel .personality-card span{font-size:11px}.panel .career-stats span,.panel .match-record,.panel .recent-matches h3{font-size:10px}
.panel button:not(.close),.onboarding button{min-height:40px}.panel .close{min-width:44px;min-height:44px;top:4px}.panel .match-record button{min-width:40px}.panel p,.panel .hint{font-size:12px}.panel .career-stats strong,.panel .match-record b,.panel .career-head button{font-size:11px}
button:focus-visible,a:focus-visible,input:focus-visible{outline:2px solid #ceffd9;outline-offset:2px}.board .square:focus-visible{outline:3px solid #ceffd9;outline-offset:-4px;z-index:3}
/* Global scanlines are a static body-level overlay, never a blur/filter. */
.shell:before{opacity:.5}
@media(forced-colors:active),print{.scanlines{display:none}}
/* A short signal hiccup on its own layer: content never moves or blurs. */
.terminal-signal{position:fixed;inset:0;z-index:1001;pointer-events:none;opacity:0;background:linear-gradient(to bottom,transparent calc(var(--terminal-band-y,50%) - 7px),rgba(135,255,165,.14) calc(var(--terminal-band-y,50%) - 5px),transparent var(--terminal-band-y,50%),rgba(0,0,0,.23) calc(var(--terminal-band-y,50%) + 2px),transparent calc(var(--terminal-band-y,50%) + 7px)),rgba(0,0,0,.09)}
@media(prefers-reduced-motion:reduce),(forced-colors:active),print{.terminal-signal{display:none!important}}
fieldset#matchSettings{border:0;padding:0;margin:0;min-width:0}fieldset#matchSettings:disabled{opacity:.65}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.reconnect-link{min-height:30px;border:1px solid #51bf70;background:#0b2a16;color:#a1ffb8;padding:4px 7px;font-size:10px;cursor:pointer}
.online-link{gap:6px;flex-wrap:wrap}.online-link>span{min-width:0}.online-link .reconnect-link{margin-left:auto}
.mission-links{display:flex;gap:18px;justify-content:center;margin-top:18px;font-size:12px}.mission-links a{color:#9cffb6}.menu-panel p{font-size:13px;line-height:1.6}
/* These buttons have no shared initialize/review class: never inherit native paint. */
.menu-panel button{appearance:none;-webkit-appearance:none;min-height:48px;padding:12px 14px;border:1px solid #65d982;background:#04130a;color:#b5ffc8;-webkit-text-fill-color:currentColor;font-size:13px;font-weight:800;line-height:1.35;cursor:pointer}
.panel.menu-panel button{min-height:48px}
.menu-panel button:hover{background:#123a21;color:#d5ffe0}
.menu-panel #confirmMenu{border-color:#41ff72;background:#41ff72;color:#010603}
.menu-panel #confirmMenu:hover{background:#a3ffb8;color:#010603}
.restart-panel #confirmNewGame{border-color:#41ff72;color:#b5ffc8;background:#04130a}
.restart-panel .outcome-actions{display:flex;flex-wrap:wrap;gap:10px}.restart-panel .outcome-actions>button{flex:1 1 150px}
.outcome-recovery{color:#96e9ad;font-size:11px;text-align:left;margin:12px 0}.outcome-recovery summary{cursor:pointer;min-height:36px;padding:8px 0}.outcome-recovery pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:140px;overflow:auto;font:inherit;line-height:1.5}
.menu-panel button:focus-visible{outline:2px solid #e1ffe9;outline-offset:3px}
.containment-sequence:not(.hidden){overflow-y:auto;max-height:100dvh}.sequence-frame{max-height:calc(100dvh - 24px);overflow-y:auto}
@media(max-height:600px) and (orientation:landscape){.onboarding{padding:15px 20px}.onboarding h2{margin:12px 0 8px}.onboard-sides{grid-template-columns:1fr 1fr}.onboarding .eyebrow{margin-bottom:12px}.begin-match{margin-top:14px}}
