/* Adaptive shell. Chrome is measured by layout, never subtracted as guesses. */
body{height:100vh;height:var(--game-viewport-height,100dvh);grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;width:100%;min-width:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
.game-workspace{height:auto;align-self:stretch;grid-template-rows:minmax(0,1fr)}
.game-workspace>main{margin:0;max-height:100%;align-self:stretch}
body:has(.match-view):not(.game-focus){grid-template-rows:auto minmax(0,1fr)}
body:has(.match-view)>footer{display:none}
.sitebar{height:auto;min-height:56px;min-width:0;flex-wrap:wrap;padding:8px clamp(10px,2vw,28px);max-width:none;gap:10px;margin:0}
.sitebar #home{min-height:44px}
.game-workspace>main.match-view{max-width:none;padding:8px 38px;gap:8px;min-width:0}
body>footer{height:auto;min-height:24px;padding:4px 38px;font-size:.68rem;white-space:normal;line-height:1.2}
.match-view .hud{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 20px;align-items:center}
.match-view .hud h1{font-size:clamp(1rem,1.8vw,1.5rem);line-height:1.2;letter-spacing:-.025em;overflow-wrap:break-word}
.match-view .hud .eyebrow{font-size:.6rem;margin:0 0 3px}
.match-view .metrics{display:flex;gap:clamp(12px,2vw,28px);flex:none;align-items:start;justify-content:space-between}
.match-view .metric{min-width:46px;max-width:160px;overflow:hidden}
.match-view .metric strong{font-size:clamp(1.25rem,2vw,1.8rem);line-height:1.2;white-space:nowrap}
.match-view .metric span{font-size:.72rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal}
.match-view .local-turn-note{font-size:.8rem;line-height:1.25;margin:3px 0 0}
.match-details{position:relative;font-size:.72rem;margin-top:3px}
.match-details summary{margin:0;width:fit-content;min-height:24px;line-height:24px;color:#c8b6dc}
.match-details[open]{z-index:6}
.match-details[open]>p{position:relative;background:#251b35;margin:0;padding:6px 10px;border-left:2px solid #bf9fdf;max-height:15vh;overflow:auto;font-size:.8rem}
.match-view .instruction{font-size:.8rem;padding:6px 10px;max-height:3.5em;overflow:auto;line-height:1.35;border-radius:10px}
.match-view .board-region{flex:1 1 0;min-height:0;min-width:0;display:flex;flex-direction:column;gap:4px}
.board-viewport{flex:1 1 0;min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y pinch-zoom;border-radius:12px;scrollbar-width:thin;scrollbar-color:#a88bc266 transparent}
.board-viewport:focus-visible{outline:2px solid #f4ce83;outline-offset:-2px}
.board-stage{display:grid;place-items:center;box-sizing:border-box;padding:4px;min-width:100%;min-height:100%}
.match-view .board-region .board-fit{display:grid;flex:none;min-width:0;min-height:0;margin:0;overflow:visible;scrollbar-gutter:auto;touch-action:pan-x pan-y pinch-zoom;align-items:stretch;justify-items:stretch;align-content:start;justify-content:start}
.match-view .board-region .playcard-cell{min-width:0;min-height:0}
.match-view .board-region .playcard{min-width:0;min-height:0;border-radius:clamp(3px,.7vw,8px);outline-offset:-3px}
.match-view .board-region .playcard-cell:focus-within{z-index:2}
.match-view .board-region .playcard:focus-visible{outline-offset:-3px}
.board-tools{display:flex;flex:none;align-items:center;justify-content:center;gap:4px;min-width:0;color:#cfbfdd}
.board-tools button{min-width:44px;min-height:44px;padding:7px 10px;font-size:.75rem;border-radius:10px;background:#1c152bb3;border-color:#b89bd333;font-weight:550}
.board-tools button:hover,.board-tools button[aria-pressed="true"]{background:#62448380;border-color:#c6a3e0}
.board-tools [data-viewport-action^="zoom-"]{font-size:1.3rem;line-height:1}
.board-tools output{min-width:48px;text-align:center;font-size:.72rem;font-variant-numeric:tabular-nums}
.board-tools output[data-mode=auto]{color:#f1d08f;font-weight:700}
.viewport-status:empty{display:none}.viewport-status{font-size:.7rem;max-width:170px}
.match-view .board-actions{justify-content:center;padding:5px;gap:6px;border-radius:13px}
.match-view .board-actions button{min-height:44px;font-size:.78rem;padding:7px 12px}
.viewport-focus-exit{position:fixed;right:max(8px,env(safe-area-inset-right));top:max(5px,env(safe-area-inset-top));z-index:145;background:#251b35f5;min-height:44px;padding:7px 12px;font-size:.75rem}
.viewport-focus-exit[hidden]{display:none}
body.pm-panel-modal .viewport-focus-exit{visibility:hidden}
.match-view .board-region .card-magnify{min-width:0;min-height:0;width:32px;height:32px;max-width:45%;max-height:45%;line-height:1;padding:0}
#notice:not([hidden]){position:static;transform:none;max-width:none;max-height:15vh;overflow:auto;margin:0 38px;padding:7px 12px;font-size:.8rem;grid-row:2}
body:has(>#notice:not([hidden])){grid-template-rows:auto auto minmax(0,1fr) auto}
body:has(>#notice:not([hidden]))>.game-workspace{grid-row:3}
body:has(>#notice:not([hidden]))>footer{grid-row:4}
body:has(.match-view):has(>#notice:not([hidden])):not(.game-focus){grid-template-rows:auto auto minmax(0,1fr)}
.game-focus{grid-template-rows:minmax(0,1fr)}
.game-focus>.sitebar,.game-focus>footer{display:none}
.game-focus .game-workspace>main{padding-top:52px}
.game-focus .hud .eyebrow{display:none}
body.game-focus:has(>#notice:not([hidden])){grid-template-rows:auto minmax(0,1fr);padding-top:50px}
body.game-focus:has(>#notice:not([hidden]))>#notice{grid-row:1}
body.game-focus:has(>#notice:not([hidden]))>.game-workspace{grid-row:2}
.match-view.phase-completed .result{flex:1;display:block;padding:clamp(18px,5vh,60px) 10px}
.match-view .question-scroll,.match-view .set-reading{min-width:0}
.viewport-font-probe{position:fixed;visibility:hidden;pointer-events:none;width:1rem;height:1rem;top:0;left:0}
.match-view .instruction.instruction-details{max-height:none;padding:0;overflow:visible}
.instruction-details>summary{display:flex;gap:6px;align-items:center;margin:0;padding:6px 10px;min-width:0;cursor:pointer;list-style:none}
.instruction-details>summary::-webkit-details-marker{display:none}
.instruction-details>summary::before{content:'▸';flex:none;color:#e8c881}
.instruction-details[open]>summary::before{content:'▾'}
.instruction-preview{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.instruction-label{display:none}.instruction-details[open] .instruction-label{display:inline}
.instruction-details[open] .instruction-preview{display:none}
.instruction-details .instruction-full{margin:0;padding:0 10px 8px;max-height:22vh;overflow:auto;line-height:1.4;font-size:inherit;color:inherit}
.instruction-details>summary:focus-visible{outline:2px solid #f4ce83;outline-offset:-2px;border-radius:10px}
@media(orientation:landscape) and (min-width:700px){
 .match-view .board-region{flex-direction:row;gap:8px}
 .board-tools{width:112px;flex-wrap:wrap;align-content:center;gap:4px}
 .board-tools output{order:-1;width:100%}
 .board-tools button{padding:6px;font-size:.72rem}
 .match-view .instruction-preview{-webkit-line-clamp:1}
}
@media(max-width:650px){
 .sitebar{padding:6px 10px;gap:6px;min-height:54px}.brand{font-size:0;gap:0}.brand .mark{font-size:25px}
 .view-switch a{font-size:.7rem;padding:8px}.sitebar #home{font-size:0;padding:7px}.sitebar #home::after{content:'Pause';font-size:.72rem}
 .game-workspace>main.match-view{padding:6px 32px;gap:6px}
 .match-view .hud{grid-template-columns:minmax(0,1fr);gap:4px}
 .match-view .hud h1{font-size:1rem;max-height:2.4em;overflow:auto}
 .match-view .hud .eyebrow{display:none}
 .match-view .hud>.metrics{width:100%;gap:8px}
 .match-view .metric{flex:1;min-width:0;max-width:none}.match-view .metric strong{font-size:1.2rem}.match-view .metric span{font-size:.68rem}
 .match-view .instruction{font-size:.72rem;padding:5px 8px;max-height:3.3em}
 .board-tools{gap:2px;flex-wrap:wrap}.board-tools button{padding:5px 7px;font-size:.7rem}.board-tools output{min-width:40px;font-size:.65rem}

 .match-view .board-actions button{font-size:.7rem;padding:6px 8px;flex:1 1 auto}
 body>footer{padding:4px 32px;font-size:.6rem}.footer-motto{display:none}
 .game-side-tab{width:26px;min-height:90px;font-size:.65rem}
 .match-view .board-region .card-magnify{width:24px;height:24px;padding:0;font-size:.8rem}
}
/* At large text sizes use a bounded reading/playing surface. Do not cancel the
   user's font preference merely to force all chrome into a tiny screen. */
.game-large-text .game-workspace>main{overflow:auto}
.game-large-text .game-workspace>main.match-view{padding-inline:32px}
.game-large-text .match-view .hud{grid-template-columns:minmax(0,1fr)}
.game-large-text .match-view .hud>.metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.game-large-text .match-view .metric{max-width:none;min-width:0;overflow:visible}
.game-large-text .match-view .metric strong{font-size:1.05rem}
.game-large-text .match-view .board-region{flex:none;min-height:300px;height:60vh;flex-direction:column}
.game-large-text .board-tools{width:100%;flex-wrap:wrap;flex-shrink:0}
.game-large-text .board-tools output{order:0;width:auto}
.game-large-text .board-tools button{white-space:normal;max-width:100%}
.game-large-text .board-actions{flex-wrap:wrap}
.game-large-text .board-actions button{min-width:0;white-space:normal;overflow-wrap:break-word}
.game-large-text .match-view .hud h1{max-height:none}
.game-large-text .match-details[open]>p{max-height:none}
.game-large-text .instruction-details .instruction-full{max-height:none}
.game-large-text .view-switch{min-width:0;flex-wrap:wrap;margin-left:0}
.game-large-text .view-switch a{white-space:normal}
.game-large-text .local-turn-note{overflow-wrap:anywhere}
.game-large-text .game-side-tab{font-size:12px}
.game-large-text>footer{display:none}
@media(max-height:540px) and (min-width:651px){
 .sitebar{min-height:46px;padding:2px 12px}.sitebar .mark{width:28px;height:28px;font-size:22px}.sitebar .brand{font-size:.95rem}.sitebar .view-switch a{padding:5px 10px}
 body>footer{display:none}body{grid-template-rows:auto minmax(0,1fr)}
 .game-workspace>main.match-view{padding:3px 34px;gap:3px}
 .match-view .hud h1{font-size:.95rem;max-height:1.25em;overflow:auto}.match-view .hud .eyebrow{display:none}
 .match-view .metric strong{font-size:1.1rem}.match-view .metric span{font-size:.65rem}.match-details{margin:0}.match-details summary{min-height:20px;line-height:20px}
 .match-view .local-turn-note{font-size:.7rem;margin:0}.match-view .instruction{padding:3px 8px;max-height:2.8em;font-size:.7rem}
 .match-view .board-region{flex-direction:row;gap:6px}.board-tools{width:112px;flex-wrap:wrap;align-content:center;gap:2px}.board-tools button{font-size:.68rem;padding:4px 6px;min-width:44px}.board-tools output{order:-1;width:100%;min-height:18px}

 .match-view .board-actions{padding:2px;gap:6px}.match-view .board-actions button{padding:5px 10px;font-size:.72rem}
 .game-focus{grid-template-rows:minmax(0,1fr)}.game-focus .game-workspace>main{padding-top:50px}
}

/* Playable-Space-70: one existing disclosure; score/turn/actions stay outside. */
.match-details>.match-info-body{max-height:min(28dvh,220px);overflow:auto;overscroll-behavior:contain;padding:6px 10px;background:#251b35;border-left:2px solid #bf9fdf}
.match-info-body>p,.match-info-body>.instruction{margin:4px 0;max-height:none;overflow:visible}
.match-view .guided-run.guidance-actions{padding:3px 6px;flex:none}
.match-view .guidance-actions button{min-height:44px;margin:2px}
@media(max-width:650px),(max-height:540px){
 .match-details>summary{min-height:44px;line-height:1.2;display:flex;align-items:center;cursor:pointer}
 .match-details>.match-info-body{max-height:24dvh}
}
.game-large-text .match-details>.match-info-body{max-height:none;overflow:visible}

.match-view .mission-essentials{font-size:.72rem;line-height:1.25;margin:3px 0;color:#e8ce95;overflow-wrap:anywhere}
@media(max-height:540px){.match-view .mission-essentials{font-size:.65rem;margin:1px 0}}


/* Let the existing3D canvas use the remaining space instead of clipping a220px child.
   Keyboard's retained accessible2D surface keeps its separate sizing contract. */
.match-view.web3d-active:not(.web3d-keyboard)>.web3d-region .web3d-stage{min-height:0;height:auto;flex:1 1 0}

/* Remove the old spacious desktop margins from the bounded match shell. */
.match-view .hud{margin-bottom:0}
.match-view .board-actions{margin-top:0}
.match-details>summary{list-style:none;cursor:pointer}
.match-details>summary::-webkit-details-marker{display:none}
.match-details>summary::before{content:'▸';margin-right:6px;color:#e8c881}
.match-details[open]>summary::before{content:'▾'}

/* Keep the existing3D controls compact; neither explanatory spacing nor status grows at the canvas expense. */
.match-view .web3d-tools{flex:0 0 auto;padding:3px 6px;min-height:50px;max-height:50px;box-sizing:border-box}
.match-view .web3d-tools button,.match-view .web3d-tools summary{min-height:44px;height:44px;padding:4px 8px;line-height:1.2;box-sizing:border-box}
.match-view .web3d-status{flex:0 0 auto;margin:0;padding:0 6px 2px;line-height:1.2;font-size:.64rem}
