/* Purpose-built arcade presentation: high contrast, no stock dashboard gradients. */
:root { --arcade-bg:#0b141d; --arcade-panel:#192b37; --arcade-gold:#f4b83f; --arcade-cheat:#ee592b; --arcade-ink:#f3ecdd; --arcade-muted:#b9c8ce; --arcade-line:#526572; color-scheme:dark; color:var(--arcade-ink); background:var(--arcade-bg); }
body { background:var(--arcade-bg); }
.shell { max-width:1280px; }
.mast { border-bottom:2px solid var(--arcade-gold); }
h1 { font-size:clamp(34px,5vw,55px); letter-spacing:-.07em; color:#fff7df; }
.brand-dot { color:var(--arcade-cheat); }
.brand p { color:var(--arcade-muted); }
.engine-label b { color:#ecf4ed; }
.engine-label small { color:#a8b7bf; }
.help-open { background:transparent; border:1px solid var(--arcade-gold); color:var(--arcade-gold); font-weight:800; transform:none; box-shadow:none; }
.help-open:hover { background:#3c3422; transform:none; }
.sidebar { border-left-color:#44515b; }
.sidebar section { border-bottom-color:#33414d; }
.section-heading h2 { color:#fff; font-size:19px; }
.section-heading p,.setup-note,.helper-text,.power-help { color:#adbec5; }
.field { color:#e4edee; }
.field output { color:#ffcb35; }
select { background:#172533; color:#fff; border-color:#55707a; }
input[type=range] { accent-color:#ffad1f; }
.powers button,.quick-powers button { background:#152632; border:2px solid #4c7380; color:#fff; box-shadow:3px 3px 0 #081014; }
.powers button b { font-size:15px; }
.power-desc { color:#b5d1d9; }
.charge { color:#ffb72b; }
.powers button.chosen,.quick-powers .chosen { background:#733424; border:2px solid #ffbd43; color:#fff; box-shadow:0 0 20px #ff6b1d77, 3px 3px 0 #000; }
.board-header #turnLabel { color:#fff4ce; font-size:19px; }
.board-header small { color:#93aebc; }
.board-tools strong { color:#ffc443; }
#hintQuick { background:#11232c; color:var(--arcade-ink); border:1px solid var(--arcade-line); }
#hintQuick[aria-pressed=true]{ background:var(--arcade-gold); color:#13202b; border-color:var(--arcade-gold); box-shadow:none; }
.board-container { position:relative; overflow:hidden; border:7px solid #5d402b; box-shadow:0 0 0 2px #c98e42, 0 14px 45px #000a; background:#dfbc85; isolation:isolate; }
.board-container svg {position:relative;z-index:0;}
.board-line {stroke:#63462a;}
.stone-black {fill:#0e1217;stroke:#48505b;stroke-width:1.5;filter:drop-shadow(1px 4px 2px #0009);}
.stone-white {fill:#fff7e7;stroke:#ada18c;stroke-width:1.6;filter:drop-shadow(2px 4px 2px #0007);}
.stone-black,.stone-white { transform-box:fill-box; transform-origin:center; }
.last-ring{stroke:#f9632d;stroke-width:5;}
.preview-ring {stroke:#fcbd30;stroke-width:5;}
.tutorial-target {fill:#ffbe1460;stroke:#ff4a11;stroke-width:8;pointer-events:none;transform-box:fill-box;transform-origin:center;animation:tutorial-pulse .78s ease-in-out infinite alternate;filter:drop-shadow(0 0 8px #fff09f);}
.tutorial-pin {font-size:25px;text-anchor:middle;fill:#ffffff;stroke:#9c1e00;stroke-width:5;paint-order:stroke fill;font-weight:950;pointer-events:none;animation:pin-bounce .55s ease-in-out infinite alternate;}
@keyframes tutorial-pulse {from {opacity:.65;transform:scale(.8);}to{opacity:1;transform:scale(1.22);}}
@keyframes pin-bounce {from{transform:translateY(0);}to{transform:translateY(-8px);}}
#message {color:#ffe4a8;}
.status-line,.situation-details {color:#aac0cc;}
.game-status {min-height:60px;}
.situation {border-color:#3e5660;}
.situation-top h2 {color:#fff; font-size:16px;}
.situation-top h2 small {color:#9ab4b9;}
.situation-tools button {color:var(--arcade-ink);border:1px solid var(--arcade-line);background:var(--arcade-panel);}
.situation-tools button[aria-pressed=true] {background:var(--arcade-gold);border-color:var(--arcade-gold);color:#13202b;}
.odds-labels{color:#fff4db;font-weight:850;}
.odds-track{background:#fff1db;border:1px solid #dfb95b;height:13px;box-shadow:0 0 0 1px #0d1620; }
.odds-black{background:#1e2629;transition:width .55s cubic-bezier(.2,1,.3,1);}
.situation-caveat{color:#9eb3bc;}
.situation.advantage-swing .odds-track{animation:odds-boom .85s ease-out;}
@keyframes odds-boom {0%,40%{box-shadow:0 0 0 7px #fc992b,0 0 24px #fe5b1d;}100%{box-shadow:0 0 0 0 #fc992b00;}}
.actions button,.result-actions button{min-height:50px;color:#f4f7ed;border:2px solid #54707a;background:#162834;}
.actions .primary,.result-actions .primary {background:var(--arcade-gold);border:2px solid var(--arcade-gold);color:#16202b;font-size:16px;font-weight:950;box-shadow:0 4px 0 #8d4e08;}
.actions .primary:not(:disabled):active,.result-actions .primary:active {transform:translateY(3px);box-shadow:none;}
.actions .quiet {color:#b5cfda;}
.quick-powers button{background:var(--arcade-panel)!important;color:var(--arcade-ink)!important;border:1px solid var(--arcade-line)!important;box-shadow:0 4px 0 #050f15!important;}
.quick-powers button.chosen{background:#672c1d!important;border-color:var(--arcade-cheat)!important;box-shadow:0 0 0 1px var(--arcade-cheat)!important;}
.quick-powers small{color:var(--arcade-gold)!important;}
.rules-dialog {color:#18242d;background:#fff2d7;}
.rules-heading h2{color:#1c272e;}
.rules-body h3 {color:#973b0d;}
.guide {background:#ffba21;border:3px solid #101a24;color:#111b25;box-shadow:8px 8px 0 #ff5b1c;margin-bottom:22px;}
.guide h2 {font-size:clamp(20px,3vw,26px);font-weight:950;letter-spacing:-.05em;margin:10px 0 8px;color:#151b24;}
.guide p {font-size:14px;font-weight:650;line-height:1.65;color:#202730;}
.guide-heading{color:#242931;font-weight:950;letter-spacing:.04em;}
.guide-heading button{color:#26313d;}
.guide-feedback {color:#0c2535;font-size:14px;font-weight:950;border-top:2px solid #b9750f;padding-top:9px;}
.guide #guideNext {display:block;background:#101923;color:#fff;padding:13px 16px;margin-top:12px;border:0;font-size:15px;font-weight:950;text-decoration:none;}
.guide-target {outline:4px solid #ffb31b!important;outline-offset:5px;animation:control-focus 1.4s ease-in-out infinite alternate;}
@keyframes control-focus{from{filter:drop-shadow(0 0 0 #ffcc63);}to{filter:drop-shadow(0 0 15px #ffbc3d);}}
#quickPowers[hidden],#powersSection[hidden],#secondarySection[hidden],#situation[hidden]{display:none!important;}
.board-stage {position:relative;min-width:0;overflow:visible;isolation:isolate;}
.board-stage > .fx-layer {position:absolute;inset:7px;z-index:10;pointer-events:none;overflow:visible;}
.fx-layer {pointer-events:none;overflow:visible;}
.fx-layer>div {position:absolute;pointer-events:none;transform:translate(-50%,-50%);will-change:transform,opacity;}
.fx-impact {width:27%;aspect-ratio:1;border:9px solid #fff2bc;border-radius:50%;box-shadow:0 0 24px #ff7b29;background:#ffeb982b;animation:impact-ring .55s cubic-bezier(.1,.75,.2,1) both;}
.fx-impact.fx-white {border-color:#fff;box-shadow:0 0 27px #47d0ff;}
@keyframes impact-ring{0%{opacity:1;transform:translate(-50%,-50%) scale(.10);}65%{opacity:1;}100%{opacity:0;transform:translate(-50%,-50%) scale(1.7);}}
.fx-grit {width:9px;height:9px;border-radius:2px;background:#fbeac8;box-shadow:0 0 8px #9a5319;animation:grit .75s cubic-bezier(.15,.6,.25,1) both;}
@keyframes grit{to{opacity:0;transform:translate(calc(-50% + var(--tx)),calc(-50% + var(--ty))) rotate(220deg) scale(.15);}}
.fx-capture-ring {width:38%;aspect-ratio:1;border:13px solid #f95827;border-radius:50%;filter:drop-shadow(0 0 15px #ff6e20);animation:impact-ring .85s both;}
.fx-shatter {width:7%;aspect-ratio:1;border-radius:100%;background:radial-gradient(circle at 30% 20%,white,#c8cbd0 70%,#86909b);box-shadow:0 0 6px #fff;animation:shatter .95s cubic-bezier(.1,.5,.25,1) both;}
@keyframes shatter{0%{opacity:1;transform:translate(-50%,-50%) scale(1);}30%{opacity:1;}100%{opacity:0;transform:translate(calc(-50% + var(--tx)),calc(-50% + var(--ty))) rotate(360deg) scale(.14);}}
.fx-announcement,.fx-combo,.fx-win,.fx-convert {z-index:4;white-space:nowrap;font-weight:1000;letter-spacing:-.065em;font-style:italic;text-shadow:4px 5px #111,0 0 30px #f4510c;-webkit-text-stroke:1px #2c1707;font-size:clamp(28px,9vw,72px);color:#fff7cc;animation:pop-hit 1.25s cubic-bezier(.15,.8,.3,1) both;}
.fx-announcement-bomb,.fx-win {font-size:clamp(44px,13vw,100px);color:#ffeb45;text-shadow:6px 8px #a3180d,0 0 45px #f73616;}
.fx-announcement-guide{font-size:clamp(30px,8vw,67px);color:#b7ffff;text-shadow:4px 5px #002f4e,0 0 20px #22dbe2;}
.fx-announcement-swing{font-size:clamp(23px,6vw,48px);color:#8dffff;text-shadow:3px 4px #033b4f;}
.fx-combo{font-size:clamp(47px,13vw,105px);color:#ffea30;text-shadow:6px 8px #c0200b,0 0 40px #ff4621;}
.fx-convert{font-size:clamp(23px,6vw,54px);color:#53f6ff;text-shadow:3px 5px #124982;}
@keyframes pop-hit{0%{opacity:0;transform:translate(-50%,-50%) scale(3.2) rotate(-10deg);}18%{opacity:1;transform:translate(-50%,-50%) scale(.95) rotate(4deg);}30%{transform:translate(-50%,-50%) scale(1.14) rotate(-2deg);}75%{opacity:1;}100%{opacity:0;transform:translate(-50%,-75%) scale(1.2);}}
.fx-bomb-core {width:70%;aspect-ratio:1;border-radius:50%;background:radial-gradient(circle,#fff8b9 0 10%,#ff9d10 28%,#f12c16 50%,#f12c1600 71%);mix-blend-mode:screen;animation:bomb-core .85s ease-out both;}
@keyframes bomb-core{0%{opacity:1;transform:translate(-50%,-50%) scale(.07);}40%{opacity:1;transform:translate(-50%,-50%) scale(1.4);}100%{opacity:0;transform:translate(-50%,-50%) scale(2);}}
.fx-bomb-ring{width:35%;aspect-ratio:1;border:24px solid #fff8ce;border-radius:50%;box-shadow:0 0 35px #f63718;animation:impact-ring .95s both;}
.fx-bomb-spark {width:16px;height:8px;border-radius:2px;background:#fdf5a6;box-shadow:0 0 13px #f44311;animation:grit .95s both;}
.fx-freeze{width:100%;padding:26% 2%;text-align:center;font-size:clamp(34px,9vw,70px);font-weight:1000;color:#b1ffff;text-shadow:4px 6px #104d77,0 0 40px #00caff;letter-spacing:-.08em;animation:freeze-burst 1s ease-out both;}
@keyframes freeze-burst{0%{opacity:0;transform:translate(-50%,-50%) scale(2.5);}30%{opacity:1;transform:translate(-50%,-50%) scale(1);}75%{opacity:1;}100%{opacity:0;transform:translate(-50%,-50%) scale(.9);}}
.freeze-active .fx-layer{background:#6dd4ff69;animation:freeze-field .8s ease-out both;}
@keyframes freeze-field{0%{opacity:0;filter:brightness(2);}20%{opacity:1;}100%{opacity:0;}}
.board-shake{animation:board-shake .42s steps(1) both;}
@keyframes board-shake {0%,100%{transform:translate(0,0);}10%{transform:translate(-7px,4px);}23%{transform:translate(6px,-5px);}38%{transform:translate(-5px,-3px);}55%{transform:translate(4px,3px);}70%{transform:translate(-2px,2px);}}
.fx-confetti{width:12px;height:21px;background:#ffc928;box-shadow:0 0 12px #ff2e18;animation:confetti 1.3s cubic-bezier(.16,.35,.4,1) both;}
.fx-confetti:nth-child(3n){background:#42faff;}
.fx-confetti:nth-child(5n){background:#f05b42;}
@keyframes confetti{0%{opacity:1;transform:translate(-50%,-50%) scale(.6);}55%{opacity:1;}100%{opacity:0;transform:translate(calc(-50% + var(--tx)),calc(-50% + var(--ty))) rotate(var(--rot));}}
footer{border-top-color:#405663;color:#91a4b2;}
footer a {color:#70d6e4;}
@media(max-width:600px){
 .shell{padding:13px 12px 27px;}
 h1{font-size:32px;}
 .brand p{font-size:10px;}
 .board-container{border-width:4px;}
 .guide {padding:12px;box-shadow:4px 5px 0 #f35717;margin-bottom:18px;}
 .guide h2{font-size:20px;}
 .guide p{font-size:13px;line-height:1.5;margin:0 0 8px;}
 .guide-feedback{font-size:12px;}
 .board-header #turnLabel{font-size:16px;}
 .quick-powers button{font-size:11px;min-height:53px;}
 .sidebar{border-top:2px solid #f0b33a;padding-top:23px;}
}
@media(prefers-reduced-motion:reduce){
 .fx-layer>*{animation-duration:.01ms!important;}
 .tutorial-target,.tutorial-pin,.guide-target,.odds-black{animation:none!important;transition:none!important;}
 .board-shake{animation:none!important;}
}

.fx-shatter-black{background:radial-gradient(circle at 25% 20%,#596675,#11171f 67%,#090b0e);box-shadow:0 0 10px #24b2e4;}


/* Ruleset controls are part of match setup, not gameplay skill buttons. */
.tactic-line {color:#e5ffbe;background:#153d31;border-left:4px solid #89f1ac;font-size:13px;font-weight:850;padding:10px 12px;margin:2px 0 10px;line-height:1.4;}
.tactic-target{fill:none;stroke:#ff4b18;stroke-width:6;stroke-dasharray:10 6;pointer-events:none;animation:tactic-flash 1.3s linear infinite;transform-box:fill-box;transform-origin:center;}
@keyframes tactic-flash{to{stroke-dashoffset:32;opacity:.55;}}
/* Victory is a real screen with a dismiss action, not a 1.4s overlay on an offscreen board. */
.result-curtain[hidden]{display:none!important;}
.result-curtain{position:fixed;inset:0;z-index:120;display:flex;align-items:center;justify-content:center;
 background:#071019ed;overflow:hidden;isolation:isolate;padding:20px;overscroll-behavior:contain;}
.result-curtain::before{content:"";position:absolute;inset:0;background:
 repeating-conic-gradient(from 15deg at 50% 48%,#ffdf3f13 0deg 10deg,transparent 10deg 25deg);
 animation:curtain-spin 12s linear infinite;pointer-events:none;}
@keyframes curtain-spin{to{transform:rotate(360deg) scale(1.4);}}
.result-curtain.is-win{background:#271500f0;}
.result-curtain.is-loss{background:#0d1832f1;}
.result-curtain-inner{position:relative;z-index:4;text-align:center;display:grid;justify-items:center;gap:17px;max-width:min(93vw,660px);}
#resultCurtainKicker{font-weight:950;letter-spacing:.28em;font-size:clamp(12px,3vw,20px);color:#ffe180;margin:0;}
#resultCurtainTitle{font-weight:1000;line-height:1.12;font-size:clamp(74px,19vw,190px);letter-spacing:-.1em;
 white-space:nowrap;transform:skew(-8deg);font-style:italic;color:#ffe550;-webkit-text-stroke:2px #ff5a11;
 text-shadow:7px 11px #b42c08,0 0 45px #ffbf2a,0 0 85px #ff591c;}
.result-curtain.is-loss #resultCurtainTitle{color:#d7e5ee;-webkit-text-stroke:1px #748da5;text-shadow:5px 7px #203550;}
#resultCurtainScore{font-size:clamp(15px,4vw,28px);font-weight:900;color:#fff0c4;}
#resultCurtainNext{min-height:56px;background:#ffe040;border:3px solid #fff;color:#1b2330;box-shadow:5px 6px #fc5113;
 border-radius:2px;font-size:clamp(14px,4vw,19px);font-weight:1000;padding:13px 30px;cursor:pointer;}
.result-title-pop{animation:curtain-impact 1.2s cubic-bezier(.17,.82,.25,1) both;}
@keyframes curtain-impact{0%{opacity:0;transform:scale(3) skew(-9deg) rotate(-8deg);}24%{opacity:1;transform:scale(.88) skew(-8deg) rotate(3deg);}
 38%{transform:scale(1.11) skew(-8deg) rotate(-2deg);}50%,100%{transform:scale(1) skew(-8deg);}}
.result-particles{position:absolute;inset:0;pointer-events:none;z-index:2;}
.result-particle{position:absolute;top:48%;left:50%;width:12px;height:22px;background:#ffdc25;
 box-shadow:0 0 12px #ff7422;animation:result-burst 2.6s cubic-bezier(.13,.4,.28,1) var(--delay) both;}
.result-particle:nth-child(3n){background:#3cedff;}.result-particle:nth-child(4n){background:#ff5e32;}
.result-particle:nth-child(7n){background:#fff6d3;}
@keyframes result-burst{0%{opacity:0;transform:translate(-50%,-50%) scale(.3) rotate(0);}
 8%{opacity:1;}70%{opacity:1;}100%{opacity:0;transform:translate(calc(-50% + var(--dx)),calc(-50% + var(--dy))) rotate(var(--rotation));}}
@media(prefers-reduced-motion:reduce){.result-title-pop,.result-particle,.result-curtain::before,.tactic-target{animation:none!important;}}
/* The limited-use combo is the one decision worth drawing the eye to. */
.actions {flex-wrap:wrap;}
.game-panel #burstBtn {flex:1 1 100%;background:#e64b13;border:3px solid #ffce43;color:#fff9db;
 font-size:17px;font-weight:1000;letter-spacing:.01em;min-height:58px;
 text-shadow:2px 2px #6a1706;box-shadow:0 4px 0 #742910;}
.game-panel #burstBtn.urgent {animation:burst-cue .9s ease-in-out infinite alternate;}
.game-panel #burstBtn:disabled {opacity:.48;box-shadow:none;animation:none;}
@keyframes burst-cue {from{box-shadow:0 4px 0 #742910,0 0 6px #fa651c;}to{box-shadow:0 4px 0 #742910,0 0 22px #ffbc2c;}}
#turnModeNote {margin:5px 0 12px;color:#b9ced4;}
#burstCountField[hidden] {display:none!important;}
@media(prefers-reduced-motion:reduce){.game-panel #burstBtn.urgent{animation:none;}}

.game-panel #burstBtn[hidden]{display:none!important;}

.game-panel #burstBtn{display:block;width:100%;margin:8px 0 4px;text-align:center;}

/* Endgame review: unobtrusive markings, no automatic deletion of disputed stones. */
.stone-dead { opacity: .42; }
.dead-mark { stroke: #ff3f25; stroke-width: 7; stroke-linecap: round; pointer-events: none; }
.scoring-panel { padding: 18px 16px; margin: 10px 0 16px; border: 2px solid #f6ae31; background: #142330; color: #f2e9d4; }
.scoring-panel h2 { font-size: 21px; margin: 0 0 8px; color: #ffcc62; }
.scoring-panel p { font-size: 13px; line-height: 1.55; margin: 7px 0; }
.scoring-warning { color: #ffb8a6; }
#scoringScore { display: block; font-size: 18px; margin: 11px 0 4px; color: #fff4d2; }
#scoringCount { color: #bbd0d9; }
.scoring-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; margin-top: 12px; }
.scoring-actions button { min-width: 0; min-height: 46px; padding: 10px 6px; background: #1f3947; border: 1px solid #547783; color: white; font-weight: 800; }
.scoring-actions .primary { grid-column: 1/-1; background: #ffbd35; color: #13222e; border-color: #ffbd35; }

/* Scoring review: result first, adjustments only when applicable. */
.scoring-panel h2{font-size:clamp(23px,2.5vw,29px);margin:0 0 10px;}
.scoring-panel .scoring-instruction{color:#cbd6d6;font-size:13px;line-height:1.5;margin:0 0 15px;}
.scoring-panel #scoringScore{font-size:clamp(19px,2vw,25px);margin:0 0 6px;color:#fff3cc;}
.scoring-panel #scoringCount{margin:2px 0 8px;color:#d4e1e5;font-weight:700;font-size:12px;}
.scoring-panel .scoring-notice{margin:7px 0;color:#b9ced4;font-size:12px;line-height:1.4;}
.scoring-panel .scoring-notice.scoring-warning{color:#ffbf9e;font-weight:850;}
.scoring-panel .scoring-tools{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 0;}
.scoring-panel .scoring-tools:has(> button:not([hidden])){padding-bottom:8px;}
.scoring-panel .scoring-tools button{
  min-height:44px;min-width:0;padding:9px 12px;border:1px solid #627c89;
  background:#213b49;color:#e7f0ec;font-size:12px;font-weight:850;
}
.scoring-panel .scoring-actions{display:flex;flex-direction:column;gap:9px;margin-top:16px;}
.scoring-panel .scoring-actions button{width:100%;min-height:48px;font-size:14px;}
.scoring-panel .scoring-actions #resumeGame{
  background:transparent;color:#d1e1e4;border:1px solid #566f7b;
}
.scoring-panel [hidden]{display:none!important;}

/* Finale polish: extra impact only on verified captures, full combos and results. */
.fx-capture-big { border-width:18px; box-shadow:0 0 45px #ff5b23aa; animation-duration:1s; }
.fx-capture-second { border-width:7px; animation-delay:.13s; animation-duration:1.05s; opacity:.85; }
.fx-capture-loss { border-color:#4db8ff!important; filter:drop-shadow(0 0 23px #3984ff); box-shadow:0 0 22px #247fdc88; }
.fx-capture-flash { width:86%; aspect-ratio:1; border-radius:50%; background:radial-gradient(circle,#fff9c76e 0%,#ffab3250 32%,transparent 72%); mix-blend-mode:screen; animation:capture-glow .65s ease-out both; }
.fx-capture-flash-loss { background:radial-gradient(circle,#d9f6ff7c 0%,#277ac64b 33%,transparent 72%); }
@keyframes capture-glow {0%{opacity:0;transform:translate(-50%,-50%) scale(.2)}20%{opacity:1}100%{opacity:0;transform:translate(-50%,-50%) scale(1.7)}}
.fx-announcement-capture-big { color:#fff3a1; font-size:clamp(38px,10vw,82px); text-shadow:5px 7px #a72606,0 0 34px #ff892b; }
.fx-announcement-capture-loss {color:#e0f8ff; font-size:clamp(24px,6vw,54px); text-shadow:4px 5px #092c67,0 0 32px #2286dd; }
.fx-burst-ignition { width:75%; aspect-ratio:1; border-radius:50%; background:repeating-conic-gradient(from 3deg,#ffe5a855 0deg 8deg,transparent 9deg 24deg); box-shadow:0 0 30px #ff9c24aa; animation:burst-ignite .77s ease-out both; }
@keyframes burst-ignite {0%{opacity:0;transform:translate(-50%,-50%) rotate(-22deg) scale(.1)}30%{opacity:1}100%{opacity:0;transform:translate(-50%,-50%) rotate(34deg) scale(1.45)}}
.fx-burst-spark{width:17px;height:5px;border-radius:2px;background:#ffe38a;box-shadow:0 0 13px #f95a20;animation:grit .95s ease-out both;}
.fx-announcement-burst{color:#fff1af;font-size:clamp(36px,11vw,90px);text-shadow:6px 8px #a3260c,0 0 48px #ff9b1c;}
.fx-combo-ring {width:68%;aspect-ratio:1;border:14px double #ffdd44;border-radius:50%;box-shadow:0 0 30px #fa6318a8;animation:impact-ring 1.05s both;}
.result-curtain::after {content:"";position:absolute;inset:0;background:radial-gradient(circle at 50% 48%,#fff7bb99,transparent 54%);pointer-events:none;animation:result-flare 1.1s ease-out both;}
.result-curtain.is-loss::after{background:radial-gradient(circle at 50% 48%,#b1dcff3a,transparent 54%)}
@keyframes result-flare{0%{opacity:0;transform:scale(.25)}23%{opacity:1}100%{opacity:0;transform:scale(2)}}
#resultCurtainMargin{display:block;font-size:clamp(24px,7vw,47px);font-weight:1000;letter-spacing:-.045em;line-height:1.1;color:#fff6b9;text-shadow:0 3px 0 #a23309,0 0 28px #ffab2e;}
.result-curtain.is-loss #resultCurtainMargin{color:#d6e9f7;text-shadow:0 2px 0 #294364;}
.result-curtain-inner{gap:16px;}
.result-particle:nth-child(6n){width:18px;height:10px;border-radius:3px;}
.result-particle:nth-child(9n){width:7px;height:27px;}
@media(prefers-reduced-motion:reduce){.fx-capture-flash,.fx-burst-ignition,.fx-burst-spark,.fx-combo-ring,.result-curtain::after{animation:none!important;display:none!important;}}

/* Small phones: don't split the game title, or hide the training move below the fold. */
@media(max-width:380px){
 .mast {gap:4px;margin-bottom:7px;padding-bottom:10px;}
 .brand{min-width:0;flex:1;}
 .brand h1{font-size:24px;letter-spacing:-.07em;white-space:nowrap;}
 .brand p{font-size:10px;line-height:1.3;max-width:135px;}
 .engine-label{column-gap:3px;row-gap:3px;}
 .engine-label b{font-size:9px;}
 .help-open{padding:7px 5px;font-size:10px;}
 .guide {padding:10px 11px;margin-bottom:10px;}
 .guide h2{margin:6px 0 4px;font-size:18px;}
 .guide p{font-size:12px;line-height:1.4;margin-bottom:6px;}
 .guide-feedback{font-size:12px;padding-top:6px;}
 .board-header{min-height:44px;}
 #resultCurtainTitle{font-size:66px;-webkit-text-stroke:1px #ff5a11;text-shadow:4px 6px #b42c08,0 0 27px #ffbf2a;}
 #resultCurtainScore{font-size:14px;}
 .result-curtain-inner{gap:13px;}
}

/* Cinematic match replay, separate from the playable board. */
.replay-dialog{box-sizing:border-box;width:min(680px,calc(100vw - 12px));max-height:96dvh;overflow:auto;border:2px solid #f3b53c;background:#0b1721;color:#fff5da;padding:14px 18px 18px;box-shadow:0 22px 85px #000e;margin:auto;}
.replay-dialog::backdrop{background:#030b13df;backdrop-filter:blur(8px);}
.replay-header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;border-bottom:1px solid #4a6570;padding-bottom:11px;}
.replay-eyebrow{color:#ffb431;font-size:11px;font-weight:900;letter-spacing:.19em;}
.replay-header h2{font-size:clamp(20px,5vw,30px);margin:2px 0 0;letter-spacing:-.06em;}
.replay-header button,.replay-controls button,.replay-controls select{border:1px solid #67818b;background:#172a36;color:#fff8e0;font-size:13px;font-weight:900;padding:10px 12px;min-height:44px;border-radius:2px;}
.replay-header button{white-space:nowrap;}
.replay-arena{max-width:520px;margin:auto;}
.replay-board-container{margin:0 auto;border-color:#e0aa57;}
.replay-board-container .intersect{pointer-events:none;}
.replay-readout{display:flex;gap:16px;align-items:center;justify-content:space-between;min-height:54px;max-width:520px;margin:auto;}
.replay-readout strong{font-size:clamp(13px,3vw,18px);color:#ffd874;}
.replay-readout span{white-space:nowrap;color:#d2e5e5;font-variant-numeric:tabular-nums;font-size:12px;}
#replaySeek{display:block;width:100%;max-width:520px;margin:4px auto 10px;accent-color:#ffaf24;min-height:25px;cursor:pointer;}
.replay-controls{display:flex;gap:7px;align-items:stretch;justify-content:center;flex-wrap:wrap;max-width:520px;margin:0 auto;}
.replay-controls .replay-primary{background:#ffbe37;color:#13202b;border-color:#ffbe37;flex:1;min-width:110px;}
.replay-controls #replayHighlights{border-color:#ff9c33;color:#ffca70;flex:1;}
.replay-controls select{min-width:72px;}
.replay-note{max-width:520px;margin:12px auto 0;color:#a8c0c9;font-size:11px;line-height:1.5;}
.replay-previous{display:block;width:100%;padding:11px 12px;margin:8px 0 12px;border:1px solid #e7a63d;background:#1f2c33;color:#ffe2aa;font-size:14px;font-weight:850;}
@media(max-width:600px){.replay-dialog{padding:9px 10px 15px;max-height:98dvh;}.replay-header{margin-bottom:7px;padding-bottom:6px;}.replay-readout{min-height:45px;}.replay-controls button,.replay-controls select{padding:9px;}.replay-arena{width:100%;}}
@media(prefers-reduced-motion:reduce){.replay-board-container .fx-layer>div{animation-duration:.01ms!important;}}

.replay-controls{display:grid;grid-template-columns:44px minmax(100px,1fr) 44px 82px;gap:7px;}
.replay-controls #replayHighlights{grid-column:1/-1;min-height:40px;}
.replay-controls button,.replay-controls select{min-width:0;}
.replay-board-container.replay-punch{animation:replay-camera-punch .68s cubic-bezier(.15,.8,.2,1) both;}
@keyframes replay-camera-punch{0%{transform:scale(.985);box-shadow:0 0 0 2px #fff,0 0 32px #ffbd3d;}33%{transform:scale(1.015);}100%{transform:scale(1);}}
@media(prefers-reduced-motion:reduce){.replay-board-container.replay-punch{animation:none!important;}}

/* First-run showdown: the capture is the hero, not a small rules illustration. */
.concept-dialog {
  box-sizing:border-box;
  width:min(810px,calc(100vw - 12px));
  max-height:96dvh;
  padding:0;
  border:4px solid #ffc837;
  background:#0b1722;
  color:#fff5da;
  box-shadow:0 0 0 5px #482313,0 28px 100px #000f,0 0 75px #db5a2850;
  overflow:auto;
  margin:auto;
}
.concept-dialog::backdrop {
  background:radial-gradient(circle at 50% 45%,#3b1c17ed 0%,#080f19f2 70%);
  backdrop-filter:blur(7px);
}
.concept-inner {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  padding:clamp(20px,4.5vw,36px);
  background:radial-gradient(ellipse at 50% 32%,#56301e70,transparent 68%),#0d1923;
}
.concept-inner::before {
  content:"";
  position:absolute;
  inset:-65% -30%;
  z-index:-1;
  background:repeating-conic-gradient(from 6deg at 50% 43%,#ff9a2421 0deg 5deg,transparent 5deg 16deg);
  opacity:.6;
  pointer-events:none;
  animation:concept-ray-turn 26s linear infinite;
}
@keyframes concept-ray-turn {to{transform:rotate(18deg);}}
.concept-eyebrow {
  position:relative;
  display:inline-block;
  font-size:clamp(11px,1.8vw,14px);
  font-weight:1000;
  letter-spacing:.2em;
  color:#ffcc4b;
  margin:0 0 11px;
}
.concept-dialog h2 {
  position:relative;
  z-index:1;
  font-weight:1000;
  letter-spacing:-.075em;
  font-size:clamp(43px,7vw,79px);
  line-height:1.03;
  margin:0 0 22px;
  color:#fff9e5;
  text-shadow:3px 5px 0 #0009;
}
.concept-dialog h2 em {
  display:block;
  width:max-content;
  max-width:100%;
  font-style:normal;
  color:#ffcc38;
  text-shadow:3px 3px 0 #a93214,6px 7px 0 #6b1f14,0 0 26px #fb642b80;
  transform:skew(-5deg);
  transform-origin:left center;
}
.concept-demo {
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr);
  align-items:center;
  gap:clamp(15px,3vw,38px);
  padding:clamp(12px,3vw,24px);
  margin:0 0 20px;
  border:2px solid #da7936;
  background:radial-gradient(circle at 36% 50%,#82442658,transparent 68%),#172630;
  box-shadow:0 10px 0 #080d12,0 0 24px #f75c2a30;
  overflow:hidden;
}
.concept-demo::before {
  content:"";
  position:absolute;
  inset:-50%;
  background:repeating-conic-gradient(from -10deg at 44% 50%,#ffbd3e18 0deg 8deg,transparent 8deg 24deg);
  pointer-events:none;
}
.concept-demo-board {
  position:relative;
  width:100%;
  max-width:340px;
  aspect-ratio:1;
  justify-self:center;
  isolation:isolate;
  background-color:#e6bf7b;
  background-image:linear-gradient(#6e472d9e 2px,transparent 2px),linear-gradient(90deg,#6e472d9e 2px,transparent 2px);
  background-size:25% 25%;
  background-position:center;
  border:9px solid #966334;
  outline:3px solid #f4b755;
  box-shadow:0 0 0 7px #3b271b,0 18px 22px #0009,0 0 40px #f68a3880;
  animation:concept-board-hit 5.6s ease-in-out infinite;
}
.concept-demo-board > span {
  position:absolute;
  display:block;
  border-radius:50%;
  transform:translate(-50%,-50%);
  width:18%;
  aspect-ratio:1;
}
.concept-demo-board .cd-black {
  background:radial-gradient(circle at 28% 20%,#525e62,#1a2229 55%,#030609 78%);
  border:2px solid #0a121a;
  box-shadow:inset -3px -4px 3px #0008,2px 5px 4px #402b1e91;
  z-index:3;
}
.concept-demo-board .base {left:25%;top:50%;}
.concept-demo-board .move-one {left:50%;top:25%;animation:concept-place-one 5.6s step-end infinite;}
.concept-demo-board .move-two {left:75%;top:50%;animation:concept-place-two 5.6s step-end infinite;}
.concept-demo-board .move-three {left:50%;top:75%;animation:concept-place-three 5.6s step-end infinite;}
.concept-demo-board .cd-white {
  left:50%;top:50%;z-index:2;
  background:radial-gradient(circle at 30% 20%,#fff,#eee4d0 64%,#b6a890);
  border:2px solid #ada089;
  box-shadow:1px 4px 4px #5c432b80;
  animation:concept-capture-white 5.6s step-end infinite;
}
.concept-demo-board .cd-ring {
  left:50%;top:50%;width:46%;z-index:5;
  border:6px solid #fff2a2;
  background:transparent;
  box-shadow:0 0 12px 6px #ff6d22,0 0 30px 13px #ff4f1b;
  animation:concept-capture-ring 5.6s ease-out infinite;
}
.concept-demo-board .cd-impact {
  left:50%;top:50%;width:87%;z-index:4;
  border-radius:0;
  background:radial-gradient(circle,#fffde2 0%,#ffd12c 24%,#ff5622 44%,transparent 73%);
  clip-path:polygon(50% 0,58% 36%,80% 12%,67% 40%,100% 50%,68% 57%,86% 90%,56% 67%,50% 100%,43% 68%,14% 89%,33% 57%,0 50%,34% 42%,18% 15%,43% 35%);
  filter:drop-shadow(0 0 10px #ffc025);
  pointer-events:none;
  animation:concept-flash 5.6s ease-out infinite;
}
.concept-demo-board .cd-spark {
  left:50%;top:50%;width:16%;height:5%;
  aspect-ratio:auto;
  border-radius:3px;
  z-index:6;
  background:#fff5b0;
  box-shadow:0 0 8px #ff4e18;
  animation:concept-sparks 5.6s ease-out infinite;
}
.concept-demo-board .spark-b{--spark-rotation:120deg;}
.concept-demo-board .spark-c{--spark-rotation:240deg;}
.concept-demo-board .cd-capture {
  left:50%;top:54%;
  width:max-content;aspect-ratio:auto;border-radius:0;
  z-index:7;
  color:#fff7d5;
  font-size:clamp(22px,4.2vw,44px);
  font-weight:1000;
  letter-spacing:-.07em;
  white-space:nowrap;
  -webkit-text-stroke:1px #813018;
  text-shadow:3px 4px 0 #93240e,0 0 17px #ff670b;
  animation:concept-capture-tag 5.6s ease-out infinite;
}
@keyframes concept-place-one {0%,12%,88%,100%{opacity:0}13%,87%{opacity:1}}
@keyframes concept-place-two {0%,25%,88%,100%{opacity:0}26%,87%{opacity:1}}
@keyframes concept-place-three {0%,39%,88%,100%{opacity:0}40%,87%{opacity:1}}
@keyframes concept-capture-white {0%,42%,88%,100%{opacity:1}43%,87%{opacity:0}}
@keyframes concept-capture-ring {
  0%,39%,71%,100% {opacity:0;transform:translate(-50%,-50%) scale(.12);}
  43%{opacity:1;transform:translate(-50%,-50%) scale(.9);}
  62%{opacity:0;transform:translate(-50%,-50%) scale(1.9);}
}
@keyframes concept-flash {
  0%,39%,51%,100%{opacity:0;transform:translate(-50%,-50%) scale(.1) rotate(-10deg);}
  42%{opacity:1;transform:translate(-50%,-50%) scale(1.23) rotate(7deg);}
  50%{opacity:0;transform:translate(-50%,-50%) scale(1.7) rotate(19deg);}
}
@keyframes concept-sparks {
  0%,39%,54%,100%{opacity:0;transform:translate(-50%,-50%) rotate(var(--spark-rotation,0deg)) translateX(0);}
  42%{opacity:1;transform:translate(-50%,-50%) rotate(var(--spark-rotation,0deg)) translateX(58%);}
  53%{opacity:0;transform:translate(-50%,-50%) rotate(var(--spark-rotation,0deg)) translateX(320%);}
}
@keyframes concept-capture-tag {
  0%,41%,78%,100%{opacity:0;transform:translate(-50%,-50%) scale(.15) rotate(-14deg);}
  47%{opacity:1;transform:translate(-50%,-50%) scale(1.25) rotate(-10deg);}
  54%,73%{opacity:1;transform:translate(-50%,-50%) scale(1) rotate(-10deg);}
}
@keyframes concept-board-hit {
  0%,38%,47%,100%{transform:translate(0,0) rotate(0);}
  41%{transform:translate(-3px,2px) rotate(-1deg);}
  43%{transform:translate(4px,-2px) rotate(1deg);}
  45%{transform:translate(-2px,1px) rotate(-.5deg);}
}
.concept-demo-description {
  position:relative;
  z-index:2;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:3px;
  min-width:0;
}
.concept-demo-mini {font-size:clamp(10px,1.8vw,14px);color:#d9e2dc;font-weight:950;letter-spacing:.045em;}
.concept-ai-one {font-size:clamp(35px,5.4vw,65px);font-weight:1000;line-height:1.03;color:#f8f5e6;}
.concept-demo-vs {font-size:clamp(15px,2.4vw,22px);font-weight:1000;color:#ff772d;font-style:italic;margin:0 0 4px;text-shadow:2px 2px 0 #000;}
.concept-you-label {color:#ffbc51;}
.concept-you-burst {
  font-size:clamp(29px,5.5vw,60px);
  font-weight:1000;
  line-height:1;
  letter-spacing:-.07em;
  white-space:nowrap;
  color:#ffcc36;
  text-shadow:3px 4px 0 #992b16,0 0 18px #ff632a90;
  transform:skew(-4deg);
}
.concept-you-burst span {font-size:1.35em;}
.concept-demo-tagline {margin-top:12px;font-size:clamp(10px,1.6vw,14px);font-weight:850;line-height:1.4;color:#ffe2af;}
.concept-rule {position:relative;font-weight:900;font-size:clamp(14px,2vw,19px);line-height:1.55;margin:0 0 19px;}
.concept-actions {position:relative;display:grid;grid-template-columns:1.3fr .9fr;gap:12px;}
.concept-actions button {
  min-width:0;
  border:2px solid #ffe06b;
  padding:13px 12px;
  font-size:clamp(14px,2vw,18px);
  font-weight:1000;
  min-height:58px;
  color:#111820;
  background:linear-gradient(180deg,#ffe66c,#ffab2c);
  box-shadow:0 5px 0 #9c3c19,0 0 17px #ffad3360;
}
.concept-actions #conceptPlay {
  background:#142736;
  border:2px solid #6d8190;
  color:#e5f0ee;
  box-shadow:none;
  font-size:clamp(12px,1.6vw,15px);
}
.concept-actions button:focus-visible {outline:3px solid #fff9e1;outline-offset:3px;}
@media(max-width:600px) {
  .concept-dialog{width:calc(100vw - 10px);max-height:96dvh;border-width:3px;}
  .concept-inner{padding:clamp(17px,5vw,23px);}
  .concept-dialog h2{font-size:clamp(34px,9.4vw,53px);margin-bottom:17px;}
  .concept-demo{grid-template-columns:minmax(0,1.45fr) minmax(0,.87fr);gap:13px;padding:12px;margin-bottom:16px;}
  .concept-demo-board{border-width:6px;outline-width:2px;box-shadow:0 0 0 4px #3b271b,0 11px 18px #000b,0 0 26px #f68a3860;}
  .concept-demo-description{gap:3px;}
  .concept-ai-one{font-size:clamp(30px,9vw,44px);}
  .concept-you-burst{font-size:clamp(24px,7.7vw,39px);}
  .concept-you-burst span{font-size:1.36em;}
  .concept-demo-tagline{font-size:11px;margin-top:7px;}
  .concept-demo-board .cd-capture{font-size:clamp(20px,7vw,32px);}
  .concept-rule{font-size:clamp(13px,3.9vw,16px);margin-bottom:17px;}
  .concept-actions{grid-template-columns:1fr;gap:10px;}
  .concept-actions button{min-height:54px;font-size:16px;}
  .concept-actions #conceptPlay{min-height:43px;font-size:13px;}
}
@media(max-width:355px){
  .concept-inner{padding:14px;}
  .concept-dialog h2{font-size:33px;}
  .concept-demo{gap:9px;padding:10px;}
  .concept-demo-tagline{font-size:10px;}
}
@media(max-height:680px) and (min-width:601px){
  .concept-inner{padding:18px 26px;}
  .concept-dialog h2{font-size:clamp(39px,6vw,58px);margin-bottom:12px;}
  .concept-demo{padding:10px 20px;margin-bottom:12px;}
  .concept-demo-board{max-width:200px;}
  .concept-rule{margin-bottom:10px;}
}
@media(prefers-reduced-motion:reduce){
  .concept-inner::before,.concept-demo-board,.concept-demo-board .move-one,
  .concept-demo-board .move-two,.concept-demo-board .move-three,
  .concept-demo-board .cd-white,.concept-demo-board .cd-ring,
  .concept-demo-board .cd-impact,.concept-demo-board .cd-spark,
  .concept-demo-board .cd-capture {animation:none!important;}
  .concept-demo-board .move-one,.concept-demo-board .move-two,.concept-demo-board .move-three {opacity:1;}
  .concept-demo-board .cd-white,.concept-demo-board .cd-ring,.concept-demo-board .cd-impact,
  .concept-demo-board .cd-spark,.concept-demo-board .cd-capture {opacity:0;}
}

/* Burst is an upfront choice, so keep it before the board instead of below a long board. */
.game-panel #burstBtn{margin:3px 0 12px;min-height:52px;}
@media(max-width:600px){.game-panel #burstBtn{min-height:47px;font-size:15px;margin:4px 0 9px;}}

/* Low-emphasis utilities, not another full-sized game control row. */
.match-export{padding-top:7px;text-align:right;}
.match-export-actions{display:flex;gap:12px;flex-wrap:wrap;justify-content:flex-end;}
.match-export summary{display:inline-block;cursor:pointer;list-style:none;font-size:12px;color:var(--arcade-muted);padding:8px 0;text-decoration:underline;text-underline-offset:3px;}
.match-export summary::-webkit-details-marker{display:none;}
.match-export button{border:0;background:transparent;color:var(--arcade-muted);font-size:12px;text-decoration:underline;text-underline-offset:3px;padding:7px 0;min-height:34px;cursor:pointer;}
.match-export button:focus-visible{outline:2px solid #ffc441;outline-offset:2px;}


/* One visual hierarchy: gold for primary actions, vermilion for unfair moves. */
:where(button,select,input,summary,svg):focus-visible { outline:3px solid var(--arcade-gold); outline-offset:3px; }
#message,.status-line,.situation-details { line-height:1.45; }
.situation-caveat {font-size:12px;}
.situation-info {font-size:12px;line-height:1.55;color:var(--arcade-muted);margin-top:5px;}
.situation-info summary {display:inline-block;list-style:none;cursor:pointer;text-decoration:underline;text-underline-offset:3px;padding:6px 0;}
.situation-info summary::-webkit-details-marker {display:none;}
.situation-info .situation-caveat {margin-top:4px;max-width:66ch;}
#hintQuick {min-height:44px;font-size:12px;}
.situation-tools button {min-height:44px;font-size:12px;}
.help-open {min-height:44px;font-size:13px;}
.board-zoom-tools {display:none;}
.sr-only {position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;}
.keyboard-ring {fill:none;stroke:#723516;stroke-width:10;pointer-events:none;}
.keyboard-ring-inner {fill:none;stroke:#ffe599;stroke-width:5;pointer-events:none;}
#board:focus-visible {outline:3px solid var(--arcade-gold);outline-offset:3px;}

/* One PC board/rail layout for setup, turns and tutorial. The body never scrolls. */
@media (min-width:851px) {
  .shell {
    width:100%;
    max-width:1450px;
    height:100dvh;
    min-height:0;
    padding:8px clamp(14px,2.1vw,28px);
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }
  .mast {flex:none;padding-bottom:6px;margin-bottom:6px;min-height:66px;gap:14px;}
  .mast h1{font-size:clamp(27px,3.2vw,39px);}
  .brand p{font-size:11px;margin:2px 0 0;}
  .layout {
    display:grid;
    grid-template-columns:minmax(0,min(calc(100vw - 455px),calc(100dvh - 140px))) minmax(295px,365px);
    gap:clamp(16px,2.5vw,32px);
    width:100%;
    flex:1 1 auto;
    min-height:0;
    align-items:stretch;
    justify-content:center;
  }
  .game-panel {
    width:100%;
    min-width:0;
    height:100%;
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:46px 58px minmax(0,min(690px,calc(100dvh - 374px))) 74px 56px;
    align-content:center;
    align-items:start;
    overflow:visible;
  }
  .board-header {grid-row:1;min-height:0;height:46px;}
  .burst-slot {grid-row:2;height:58px;display:flex;align-items:center;justify-content:stretch;}
  .burst-slot #burstBtn {margin:0;width:100%;height:50px;min-height:50px;flex:none;}
  .board-zoom-tools {display:none!important;}
  .board-stage {
    grid-row:3;
    height:calc(100% - 24px);
    min-height:0;
    max-height:690px;
    aspect-ratio:1;
    width:auto;
    max-width:100%;
    justify-self:center;
    align-self:center;
  }
  #boardContainer {width:100%;height:100%;max-width:none;margin:0;}
  #boardContainer svg {width:100%;height:100%;display:block;}
  #engineLoadingPanel {grid-row:4;grid-column:1;height:54px;min-height:54px;max-height:54px;margin:0;padding:5px 11px;position:relative;z-index:2;}
  #mainActions {
    grid-row:4;grid-column:1;display:grid;
    grid-template-columns:minmax(0,1fr) 104px 102px;
    gap:12px;width:min(100%,550px);
    justify-self:center;align-self:center;
    height:54px;min-height:54px;margin:0;
  }
  #mainActions.done-actions {grid-template-columns:1fr;width:min(100%,420px);}

  #mainActions[hidden] {display:none!important;}
  #mainActions > button {min-width:0;height:52px;min-height:52px;margin:0;padding:8px;font-size:12px;}
  #mainActions > #endTurn {grid-column:1;grid-row:1;}
  #mainActions > #passBtn {grid-column:2;grid-row:1;}
  #mainActions > #reset {grid-column:3;grid-row:1;}
  .game-panel:has(#engineLoadingPanel:not([hidden])) #mainActions {visibility:hidden;}
  .game-status {grid-row:5;min-height:0;height:56px;padding:3px 0 0;overflow:hidden;}
  #message {height:22px;min-height:22px;max-height:22px;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0 0 4px;}
  .status-line {font-size:11px;gap:5px;}
  #scoreLabel {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  #gamePhase {white-space:nowrap;}
  .sidebar {
    height:100%;
    min-height:0;
    overflow-y:auto;
    overflow-x:hidden;
    scrollbar-width:thin;
    padding:0 8px 8px 16px;
    overscroll-behavior:contain;
  }
  .sidebar .guide {position:relative;top:auto;z-index:2;box-shadow:4px 5px 0 #ff5b1c;margin:0 4px 10px 0;}
  .sidebar .guide h2 {font-size:19px;}
  .sidebar .guide p {font-size:12px;line-height:1.5;}
  .sidebar .guide-feedback {font-size:12px;}
  .sidebar .guide #guideNext {width:100%;font-size:13px;padding:9px;}
  .sidebar .situation {margin:0 0 14px;padding:8px 0 10px;}
  .sidebar .situation-top {align-items:flex-start;flex-wrap:wrap;}
  .sidebar .situation-top h2 {font-size:13px;}
  .sidebar .situation-top h2 small {font-size:10px;}
  .sidebar .situation-tools {margin-left:auto;}
  .sidebar .situation-details {flex-wrap:wrap;}
  .sidebar .situation-info {font-size:11px;}
  .sidebar .setup-section,.sidebar .powers-section,.sidebar .secondary-section,.sidebar .record-section {padding-bottom:12px;margin-bottom:12px;}
  .shell.training-mode .sidebar {border:0;padding-top:0;}
  .shell.training-mode .game-status {visibility:hidden;}
  .shell footer {flex:none;height:20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:5px 0 0;padding:2px 0 0;font-size:10px;line-height:16px;}
  .shell:has(#scoringPanel:not([hidden])) {overflow:auto;height:auto;min-height:100dvh;}
  .shell:has(#scoringPanel:not([hidden])) .game-panel {display:block;height:auto;}
  .shell:has(#scoringPanel:not([hidden])) .board-stage {width:min(100%,430px);height:auto;margin:auto;}
}
@media (max-width:850px) {
  .layout {display:flex;flex-direction:column;gap:18px;}
  .game-panel,.sidebar {width:100%;min-width:0;}
  .board-zoom-tools:has(#boardZoom:not([hidden])) {display:flex;justify-content:flex-end;align-items:center;gap:10px;padding:3px 0 7px;}
  #boardZoom {min-height:44px;border:1px solid var(--arcade-line);background:var(--arcade-panel);color:var(--arcade-ink);padding:8px 14px;font-weight:750;font-size:13px;}
  #boardZoom[aria-pressed=true] {border-color:var(--arcade-gold);color:var(--arcade-gold);}
  #boardZoomHelp:not([hidden]) {color:var(--arcade-muted);font-size:12px;}
  #boardContainer.zoomed {aspect-ratio:1;overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y;scrollbar-width:thin;}
  #boardContainer.zoomed svg {max-width:none;height:auto;touch-action:pan-x pan-y;}
  #boardContainer.zoomed.size-13 svg {width:190%;}
  #boardContainer.zoomed.size-19 svg {width:250%;}
  .board-stage:has(#boardContainer.zoomed) > .fx-layer {display:none;}
  .board-header small {font-size:12px;}
  .engine-label small {display:none;}
  .brand p {display:none;}
  .status-line {font-size:12px;}
  .situation-top {flex-wrap:wrap;}
  .situation-top h2 {font-size:14px;}
  .situation-tools {margin-left:auto;}
  .section-heading h2 {font-size:19px;}
  .setup-note,.helper-text,.power-help {font-size:13px;}
  .field {font-size:14px;}
}
@media(max-width:380px){
  .shell {padding-inline:10px;}
  .mast {flex-wrap:wrap;}
  .brand p {display:none;}
  .engine-label {margin-left:auto;}
  .board-tools {gap:5px;}
  .board-header #turnLabel {font-size:15px;}
  #hintQuick {padding:7px 8px;font-size:11px;}
}
@media(prefers-reduced-motion:reduce){
  .situation.advantage-swing .odds-track {animation:none!important;}
}

/* Browser zoom can leave less than 300 CSS px inside the shell. Wrap rather than clip controls. */
.shell {container-type:inline-size;}
@container (max-width:300px) {
  .mast {display:flex;align-items:center;flex-wrap:nowrap;gap:3px;padding-bottom:6px;}
  .mast .brand {grid-column:auto;}
  .mast .brand h1 {font-size:21px;white-space:nowrap;}
  .mast .header-actions {gap:3px;}
  .mast .header-actions button {font-size:11px;padding-inline:6px;}
  .section-heading {flex-wrap:wrap;align-items:center;}
  .section-heading h2 {font-size:18px;}
  .field.mode-field {flex-wrap:wrap;}
  .field.mode-field select {width:100%;max-width:100%;}
  .board-header {flex-wrap:wrap;}
  .board-tools {margin-left:auto;}
}



/* In-match power controls reflect the enabled setup choices and remaining charges. */
.powers button {position:relative;transition:background-color .12s,border-color .12s;min-width:0;}
.powers button[aria-pressed="true"] .charge {color:#182330;background:var(--arcade-gold);padding:3px 9px;border-radius:3px;align-self:flex-start;font-weight:900;}
.shell.preparing .powers button[aria-pressed="false"] .charge {color:#a5b1b8;}
.visits-note {margin:3px 0 12px;line-height:1.6;}
.record-section .record-line {margin:0;padding:0;border:0;}
.record-section #record {font-weight:750;}

/* On phones, the lesson instructions precede the board; no duplicate board layout. */
@media(max-width:850px){
  .shell.training-mode .layout {display:flex;flex-direction:column;}
  .shell.training-mode .sidebar {display:contents;}
  .shell.training-mode .sidebar > .guide {order:-1;position:relative;top:auto;margin-bottom:9px;}
  .shell.training-mode .game-panel {order:0;}
  .board-stage > .fx-layer {inset:4px;}
}


/* Short desktop screens show the entire opening challenge, including both choices. */
@media(min-width:601px) and (max-height:800px) {
  .concept-dialog {max-height:calc(100dvh - 20px);}
  .concept-inner {padding:clamp(12px,2.4dvh,20px) 24px;}
  .concept-eyebrow {margin-bottom:6px;}
  .concept-dialog h2 {font-size:clamp(38px,6.4dvh,53px);margin-bottom:12px;}
  .concept-demo {padding:10px 15px;margin-bottom:13px;}
  .concept-demo-board {max-width:min(240px,calc(100dvh - 422px));}
  .concept-rule {font-size:15px;margin-bottom:12px;}
  .concept-actions button {min-height:47px;padding:9px 12px;}
}
/* Wide PCs can show match settings and optional powers simultaneously without a long sidebar. */
@media(min-width:1200px){
  .layout {
    grid-template-columns:minmax(0,min(calc(100vw - 780px),calc(100dvh - 140px))) minmax(590px,650px);
  }
  .shell:not(.preparing):not(.training-mode) .sidebar {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    grid-auto-rows:min-content;
    column-gap:18px;
    align-content:start;
  }
  .shell:not(.preparing):not(.training-mode) .sidebar #tacticLine {grid-column:1 / -1;grid-row:1;}
  .shell:not(.preparing):not(.training-mode) .sidebar .situation {grid-column:1;grid-row:2 / 5;}
  .shell:not(.preparing):not(.training-mode) .sidebar .powers-section {grid-column:2;grid-row:2;}
  .shell:not(.preparing):not(.training-mode) .sidebar .secondary-section {grid-column:2;grid-row:3;}
  .shell:not(.preparing):not(.training-mode) .sidebar .record-section {grid-column:2;grid-row:4;}
}


/* The action bar keeps the same footprint during the AI/player handoff on phones. */
@media(max-width:850px){
  .shell.training-mode .game-panel {position:relative;}
  .shell.training-mode .burst-slot {
    position:absolute;
    z-index:22;
    top:54px;
    left:0;
    right:0;
    height:0;
    pointer-events:none;
  }
  .shell.training-mode .burst-slot #burstBtn {
    margin:0;
    width:100%;
    min-height:47px;
    pointer-events:auto;
    box-shadow:0 4px 0 #742910;
  }
}


/* Replay is a real viewport-filling scene, not a tall document inside a modal. */
@media(min-width:851px){
  .replay-dialog:not([open]) {display:none!important;}
  .replay-dialog {
    height:min(96dvh,850px);
    max-height:96dvh;
    overflow:hidden;
    display:flex;
    flex-direction:column;
    gap:6px;
  }
  .replay-header {flex:none;margin:0;padding:0 0 7px;}
  .replay-header h2 {font-size:23px;}
  .replay-arena {
    flex:1 1 auto;
    min-height:0;
    width:100%;
    max-width:none;
    display:flex;
    justify-content:center;
    align-items:center;
  }
  .replay-arena > .board-stage {
    height:100%;
    width:auto;
    max-width:100%;
    aspect-ratio:1;
  }
  .replay-board-container {height:100%;width:100%;margin:0;}
  .replay-board-container svg {display:block;width:100%;height:100%;}
  .replay-readout {flex:none;min-height:32px;width:100%;}
  #replaySeek {flex:none;height:18px;margin:0;}
  .replay-controls {flex:none;}
  .replay-controls #replayHighlights {min-height:32px;}
  .replay-controls button,.replay-controls select {min-height:38px;padding:7px 10px;}
  .replay-note {flex:none;margin:0 auto;font-size:10px;line-height:1.3;}
}


/* Final scene is a photographable board + score composition, not a modal. */
.result-panel[hidden] {display:none!important;}
.shell.result-mode {
  background:radial-gradient(ellipse at 42% 48%,#4d331527,transparent 65%),#0b141e;
}
.shell.result-mode .engine-label,
.shell.result-mode .help-open,
.shell.result-mode footer,
.shell.result-mode .sidebar,
.shell.result-mode .mast {border-bottom-color:#a67b32;}
.shell.result-mode .layout {
  display:grid;
  grid-template-columns:minmax(0,1.12fr) minmax(0,.88fr);
  gap:clamp(14px,3vw,44px);
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:0;
}
.shell.result-mode .game-panel {
  min-width:0;
  min-height:0;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
}
.shell.result-mode .game-panel > :not(.board-stage) {display:none!important;}
.shell.result-mode .board-stage {
  width:min(100%,calc(100dvh - 155px),650px);
  max-width:100%;
  max-height:none;
  height:auto;
  aspect-ratio:1;
  flex:none;
  margin:auto;
  filter:drop-shadow(0 14px 20px #0009);
}
.shell.result-mode #boardContainer {
  width:100%;height:100%;
  max-width:100%;overflow:hidden;touch-action:pan-y;
}
.shell.result-mode #boardContainer svg {width:100%;height:100%;}
.shell.result-mode .result-panel {
  min-width:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:clamp(12px,2.7vw,33px);
  width:100%;
  max-width:570px;
  max-height:100%;
  margin:0;
  border:0;
  border-top:5px solid #f6b836;
  border-radius:0;
  background:linear-gradient(165deg,#192b33 0%,#15232d 55%,#0f202b 100%);
  color:#fff5d8;
  box-shadow:9px 12px 0 #050c12,0 0 35px #ffbc2530;
  overflow:visible;
  align-self:center;
}
.shell.result-mode .result-panel.won {background:linear-gradient(165deg,#362816,#1b2724 64%,#142321);border-top-color:#ffc54a;}
.shell.result-mode .result-panel.clean-win {
  background:linear-gradient(160deg,#403616,#253022 70%,#182820);
  border-top-color:#fff0a7;
  box-shadow:0 0 0 1px #b2a265,9px 12px 0 #050c12,0 0 40px #f9d06445;
}
.shell.result-mode .result-top {display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 12px;}
.shell.result-mode .result-kicker {font-size:11px;letter-spacing:.09em;font-weight:1000;color:#ffcd67;}
.shell.result-mode .result-opponent {font-weight:800;font-size:11px;color:#b7c5c9;white-space:nowrap;}
.shell.result-mode #resultTitle {
  font-size:clamp(32px,4vw,58px);
  letter-spacing:-.065em;
  line-height:1.06;
  margin:0;
  color:#fff6dc;
  font-weight:1000;
  outline:none;
}
.shell.result-mode #resultMargin {
  display:block;
  font-size:clamp(45px,5vw,75px);
  line-height:1.12;
  letter-spacing:-.07em;
  color:#ffc339;
  font-weight:1000;
  margin:8px 0 2px;
}
.shell.result-mode .clean-win #resultMargin{color:#ffe78b;}
.shell.result-mode #resultDetail{font-size:clamp(12px,1.4vw,16px);font-weight:800;color:#e9d9b8;margin:0 0 18px;}
.shell.result-mode .result-quip {
  border-left:3px solid #e7ad44;
  padding:8px 4px 8px 15px;
  margin:0 0 20px;
  background:transparent;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:7px;
}
.shell.result-mode .clean-win .result-quip {border-color:#fff0a7;}
.shell.result-mode #resultQuip {
  color:#ffe0a0;
  font-size:clamp(17px,2.3vw,25px);
  line-height:1.36;
  letter-spacing:-.04em;
  font-weight:1000;
  text-wrap:pretty;
}
.shell.result-mode .clean-win #resultQuip{color:#fff5cf;}
.shell.result-mode .result-facts {
  display:flex;gap:7px;flex-wrap:wrap;
  border-top:1px solid #576166;
  border-bottom:1px solid #576166;
  padding:12px 0;margin:0 0 18px;
}
.shell.result-mode .result-facts span {
  padding:5px 8px;background:#293a43;
  color:#e9f0ee;font-size:11px;font-weight:850;
}
.shell.result-mode .result-actions {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}
.shell.result-mode .result-actions button,
.shell.result-mode .result-actions .primary,
.shell.result-mode .result-actions #share,
.shell.result-mode .result-actions #goTitle {
  width:100%;grid-column:auto;
  min-width:0;min-height:48px;padding:8px 6px;
  font-size:clamp(11px,1.15vw,14px);
  font-weight:900;
  line-height:1.35;
  text-decoration:none;
  border:1px solid #65808b;
  border-radius:2px;
  background:#263844;color:#f5f4e9;
  box-shadow:none;cursor:pointer;
}
.shell.result-mode .result-actions #retry {
  color:#13202a;background:#ffc040;border:1px solid #ffc040;
}
.shell.result-mode .result-actions button:focus-visible{outline:3px solid #fff;outline-offset:3px;}
.shell.result-mode.result-reveal .result-quip {animation:result-line-reveal .7s .24s backwards cubic-bezier(.16,.78,.2,1);}
@keyframes result-line-reveal {
  from{opacity:0;transform:translateY(13px);}
  to{opacity:1;transform:translateY(0);}
}
@media(min-width:851px) and (max-height:680px){
  .shell.result-mode .result-panel{padding:12px 21px;}
  .shell.result-mode #resultTitle{font-size:33px;}
  .shell.result-mode #resultMargin{font-size:51px;margin:1px 0;}
  .shell.result-mode #resultDetail{margin-bottom:9px;}
  .shell.result-mode .result-quip{margin-bottom:10px;padding-top:5px;padding-bottom:4px;}
  .shell.result-mode #resultQuip{font-size:17px;}
  .shell.result-mode .result-facts{padding:7px 0;margin-bottom:10px;}
  .shell.result-mode .result-actions button{min-height:44px;}
}
@media(max-width:850px){
  .shell.result-mode {
    height:100dvh;
    min-height:0;
    padding:8px 12px 10px;
    overflow:hidden;
    display:flex;
    flex-direction:column;
  }
  .shell.result-mode .mast {
    display:flex;
    padding:0 0 5px;margin:0 0 8px;
    min-height:39px;
    flex:none;
  }
  .shell.result-mode .mast h1 {font-size:clamp(23px,6vw,30px);}
  .shell.result-mode .mast .brand p {display:none;}
  .shell.result-mode .layout {
    flex:1 1 auto;min-height:0;
    display:flex;flex-direction:column;justify-content:center;
    gap:clamp(7px,1.5dvh,15px);
  }
  .shell.result-mode .game-panel {height:auto;min-height:0;flex:none;}
  .shell.result-mode .board-stage {
    width:min(76vw,37dvh,355px);
    height:auto;max-width:none;
  }
  .shell.result-mode .result-panel {
    align-self:center;flex:none;
    padding:12px 14px;
    max-width:430px;max-height:none;
    box-shadow:4px 5px 0 #070e15;
  }
  .shell.result-mode .result-top {margin:0 0 6px;}
  .shell.result-mode .result-kicker{font-size:9px;letter-spacing:.04em;}
  .shell.result-mode .result-opponent{font-size:9px;}
  .shell.result-mode #resultTitle{font-size:clamp(27px,7.5vw,37px);}
  .shell.result-mode #resultMargin{font-size:clamp(35px,10vw,52px);margin:2px 0 0;}
  .shell.result-mode #resultDetail{font-size:11px;margin:0 0 7px;}
  .shell.result-mode .result-quip{margin:0 0 10px;padding:4px 5px 3px 10px;gap:1px;}
  .shell.result-mode #resultQuip{font-size:clamp(14px,3.9vw,18px);line-height:1.28;}
  .shell.result-mode .result-facts{padding:6px 0;margin:0 0 10px;gap:4px;}
  .shell.result-mode .result-facts span{font-size:9px;padding:3px 5px;}
  .shell.result-mode .result-actions{grid-template-columns:1.05fr .75fr 1fr;gap:5px;}
  .shell.result-mode .result-actions button,
  .shell.result-mode .result-actions #retry,
  .shell.result-mode .result-actions #share,
  .shell.result-mode .result-actions #goTitle{min-height:44px;font-size:11px;padding:6px 3px;}
}
@media(max-width:850px) and (max-height:650px){
  .shell.result-mode .board-stage{width:min(66vw,34dvh);}
  .shell.result-mode .result-panel{padding:8px 10px;}
  .shell.result-mode .result-quip{margin-bottom:6px;}
  .shell.result-mode .result-facts{margin-bottom:6px;}
  .shell.result-mode .result-actions button {min-height:44px;}
}
@media(prefers-reduced-motion:reduce){
  .shell.result-mode.result-reveal .result-quip {animation:none;}
}

/* Title-only exit links; during play the navigation is deliberately absent. */
.concept-nav {
  display:flex;justify-content:center;gap:23px;
  margin:13px 0 0;font-size:11px;font-weight:750;
}
.concept-nav a{color:#c5d2d6;text-underline-offset:3px;}
.concept-nav a:focus-visible{outline:3px solid #ffca52;outline-offset:3px;}
@media(min-width:601px) and (max-height:800px){
  .concept-nav{margin:8px 0 0;font-size:10px;}
  .concept-demo-board{max-width:min(222px,calc(100dvh - 436px));}
}

/* The board header communicates whose turn it is; repeated stone counts
   and the second "black turn" status are assistive text only. */
.status-line.sr-only {display:block;}
.engine-label.sr-only{display:block;}
#detailsToggle[hidden],#detailsDismiss[hidden],#detailsClose[hidden]{display:none!important;}
#detailsToggle,#detailsClose {
  min-height:44px;padding:7px 10px;
  font-size:12px;font-weight:850;
  border:1px solid var(--arcade-line);
  color:var(--arcade-ink);background:var(--arcade-panel);
}
.details-dismiss{display:none;}
@media(max-width:850px){
  /* A match is one screen, not the entire settings and analytics document. */
  .shell.playing{
    height:100dvh;min-height:0;
    display:flex;flex-direction:column;
    overflow:hidden;
    padding:env(safe-area-inset-top,0px) 12px env(safe-area-inset-bottom,0px);
    padding-top:max(7px,env(safe-area-inset-top,0px));
    padding-bottom:max(8px,env(safe-area-inset-bottom,0px));
  }
  .shell.playing .mast {
    flex:none;min-height:38px;
    padding:0 0 5px;margin:0 0 6px;flex-wrap:nowrap;
    display:flex;align-items:center;justify-content:space-between;
  }
  .shell.playing .brand h1{font-size:clamp(22px,6vw,28px);}
  .shell.playing .help-open{min-height:34px;font-size:11px;padding:5px 9px;}
  .shell.playing .layout {
    flex:1 1 auto;min-height:0;
    display:flex;flex-direction:column;justify-content:center;
    gap:0;align-items:center;
  }
  .shell.playing .game-panel{
    width:100%;height:100%;min-height:0;
    display:flex;flex-direction:column;align-items:stretch;
    justify-content:center;gap:0;
  }
  .shell.playing .board-header{
    flex:none;min-height:40px;height:40px;margin:0;
    flex-wrap:nowrap;
  }
  .shell.playing .board-header #turnLabel{font-size:16px;}
  .shell.playing .board-header small{font-size:11px;}
  .shell.playing .board-tools{gap:5px;flex:none;margin:0;}
  .shell.playing #hintQuick,.shell.playing #detailsToggle{min-height:38px;padding:6px 8px;font-size:11px;}
  .shell.playing .burst-slot{
    height:52px;flex:none;display:flex;align-items:center;
  }
  .shell.playing .burst-slot #burstBtn{margin:0;min-height:46px;max-height:46px;}
  .shell.playing .board-zoom-tools:has(#boardZoom:not([hidden])){min-height:43px;flex:none;}
  .shell.playing .board-stage{align-self:center;max-width:100%;}
  .shell.playing #boardContainer{width:100%;height:100%;margin:0;}
  .shell.playing #mainActions{
    width:100%;flex:none;margin:8px 0 0;
    min-height:49px;height:49px;gap:7px;
  }
  .shell.playing #mainActions > button{min-height:47px;height:47px;}
  .shell.playing #gameStatus{
    flex:none;min-height:27px;height:27px;max-height:27px;
    margin:0;padding:5px 0 0;overflow:hidden;
  }
  .shell.playing #message{
    margin:0;min-height:20px;max-height:20px;
    line-height:20px;font-size:12px;white-space:nowrap;
    overflow:hidden;text-overflow:ellipsis;
  }
  .shell.playing .quick-powers{
    flex:none;min-height:0;margin:6px 0 0;
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;
  }
  .shell.playing .quick-powers[hidden]{display:none!important;}
  .shell.playing .quick-powers button{
    min-height:45px;max-height:49px;padding:5px 2px;
    font-size:10px;min-width:0;
  }
  .shell.playing footer{display:none!important;}
  .shell.playing #gameSidebar:not([hidden]) {
    display:flex;flex-direction:column;position:fixed;z-index:101;
    left:0;right:0;top:auto;bottom:0;
    width:100%;height:min(79dvh,670px);
    max-height:calc(100dvh - 40px);
    padding:12px 16px max(18px,env(safe-area-inset-bottom));
    background:#111f2a;border:2px solid #dfaa43;border-radius:13px 13px 0 0;
    overflow-y:auto;overscroll-behavior:contain;
    box-shadow:0 -13px 40px #000a;
  }
  .shell.playing #gameSidebar > #detailsClose {
    display:block;align-self:flex-end;position:sticky;top:0;z-index:3;
    min-width:86px;margin:0 0 8px;
    background:#243845;
  }
  .shell.playing .details-dismiss:not([hidden]){
    display:block;position:fixed;inset:0;z-index:100;
    width:100%;height:100%;
    border:0;background:#010812af;
  }
  .shell.playing .sidebar .guide{display:none;}
}
@media(max-width:380px){
  .shell.playing{padding-left:9px;padding-right:9px;}
  .shell.playing .brand h1{font-size:23px;}
  .shell.playing .board-header #turnLabel{font-size:14px;}
  .shell.playing .board-header small{font-size:10px;}
  .shell.playing #hintQuick,.shell.playing #detailsToggle{padding:5px;font-size:10px;}
  .shell.playing #mainActions > button{padding:5px 2px;font-size:11px;}
}

/* Expose high-frequency actions directly. No hidden menu or overlapping popover. */
.mast {position:relative;z-index:26;}
.mast .brand {min-width:0;flex:none;}
.header-actions {display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-left:auto;min-width:0;}
.header-actions button {
  flex:none;min-height:44px;padding:8px 12px;
  background:#152733;color:#f6e9cf;
  border:1px solid #6b7880;border-radius:2px;
  font-size:13px;font-weight:850;white-space:nowrap;
}
.header-actions #hintQuick {font-size:13px;padding:8px 12px;}
.header-actions #detailsToggle {font-size:13px;padding:8px 12px;min-height:44px;min-width:44px;}
.header-actions #hintQuick[aria-pressed="true"] {background:var(--arcade-gold);border-color:var(--arcade-gold);color:#15212b;}
body:has(#conceptDialog[open]) .header-actions {visibility:hidden;}
@media(min-width:381px){
  .header-actions #hintQuick::after {content:' OFF';font-size:10px;font-weight:750;}
  .header-actions #hintQuick[aria-pressed="true"]::after {content:' ON';}
}
@media(max-width:850px){
  .mast {gap:6px;}
  .header-actions {gap:5px;}
  .header-actions button,
  .header-actions #hintQuick,
  .header-actions #detailsToggle,
  .shell.playing #hintQuick,
  .shell.playing #detailsToggle {min-height:44px;font-size:12px;padding:7px 8px;}
}
@media(max-width:380px){
  .mast {gap:4px;}
  .header-actions {gap:4px;}
  .header-actions button,
  .header-actions #hintQuick,
  .header-actions #detailsToggle,
  .shell.playing #hintQuick,
  .shell.playing #detailsToggle {min-height:44px;font-size:11px;padding:6px 6px;}
}

/* One shared action row beneath the board in all playing modes. */
.action-deck{
  display:grid;grid-template-columns:minmax(0,1.33fr) minmax(0,.8fr) minmax(0,.9fr);
  align-items:stretch;gap:8px;min-width:0;
}
.action-deck .burst-slot {
  grid-column:1;grid-row:1;
  display:flex;min-width:0;height:auto;align-items:stretch;
  margin:0;padding:0;
}
.action-deck .burst-slot #burstBtn,
.game-panel .action-deck #burstBtn {
  width:100%;height:48px;min-height:48px;max-height:48px;
  margin:0;flex:none;font-size:clamp(12px,1.7vw,15px);
  padding:5px 5px;border-width:2px;line-height:1.15;
}
.action-deck #mainActions{display:contents!important;}
.action-deck #mainActions[hidden]{display:none!important;}
.action-deck #mainActions > button {
  min-width:0;width:100%;height:48px;min-height:48px;max-height:48px;
  margin:0;padding:7px 4px;font-size:clamp(12px,1.4vw,14px);
  line-height:1.3;
}
#actionDeck #endTurn,#actionDeck #passBtn{grid-row:1;grid-column:2;}
#actionDeck #reset{grid-row:1;grid-column:3;}
#actionDeck:has(#burstBtn[hidden]) #endTurn:not([hidden]){grid-column:1;}
.action-deck:has(#burstBtn[hidden]) #passBtn:not([hidden]){grid-column:2;}
.action-deck:has(#burstBtn[hidden]) #reset{grid-column:3;}
.game-panel:has(#engineLoadingPanel:not([hidden])) .action-deck{visibility:hidden;}
.shell.training-mode .action-deck{position:relative;}
.shell.training-mode .action-deck .burst-slot{position:relative;}

/* Snapshot of ordinary Go analysis: always on screen, not mislabeled as
   an advantage in the cheating ruleset. */
.match-outlook[hidden]{display:none!important;}
.match-outlook {
  display:flex;flex-direction:column;justify-content:center;
  gap:4px;width:100%;min-width:0;
  height:53px;padding:5px 1px;
  color:#dae6e6;
}
.outlook-line {display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:11px;font-weight:850;line-height:1.35;}
.outlook-line small{font-size:10px;color:#8eacb8;margin-left:5px;font-weight:600;}
.outlook-line strong{display:flex;gap:12px;font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap;}
.outlook-track{height:10px;border:1px solid #bd9252;border-radius:2px;background:#f6e6c8;overflow:hidden;}
#outlookBlackBar{display:block;height:100%;width:50%;background:#33434d;transition:width .28s ease;}

/* PC board is still the largest element, with a compact analysis strip. */
@media(min-width:851px){
  .game-panel > .board-stage{grid-row:2;height:calc(100% - 12px);}
  .game-panel > .action-deck{
    grid-row:3;grid-column:1;
    justify-self:center;align-self:center;
    width:min(100%,550px);height:48px;
  }
  .game-panel > #engineLoadingPanel{grid-row:3;grid-column:1;justify-self:center;width:min(100%,550px);}
  .game-panel > .game-status{grid-row:5;height:36px;}
  .game-panel #message{height:24px;min-height:24px;max-height:24px;}
  .shell.training-mode .action-deck{
    grid-row:3;position:relative;z-index:22;pointer-events:none;
  }
  .shell.training-mode .action-deck .burst-slot{
    grid-column:1/-1;display:flex;pointer-events:auto;
  }
  .shell.training-mode .action-deck .burst-slot #burstBtn{width:100%;}
}
@media(max-width:850px){
  .shell.playing .game-panel > .action-deck{
    order:2;flex:none;width:100%;height:48px;min-height:48px;
    margin:7px 0 0;gap:5px;
  }
  .shell.playing .game-panel > .board-stage{order:1;}
  .shell.playing .game-panel > .board-header{order:0;}
  .shell.playing .game-panel > .match-outlook{
    order:3;flex:none;height:48px;min-height:48px;
    padding:5px 0 0;
  }
  .shell.playing .game-panel > .game-status{order:4;height:24px;min-height:24px;max-height:24px;padding:4px 0 0;}
  .shell.playing .game-panel > .quick-powers{order:5;}
  .shell.playing .game-panel > .board-zoom-tools{order:0;}
  .shell.playing .game-panel > .engine-loading-panel{order:3;}
  .shell.playing .burst-slot{position:static;height:48px;flex:none;}
  .shell.playing .action-deck .burst-slot #burstBtn{font-size:clamp(11px,3.4vw,14px);}
  .shell.playing .action-deck #mainActions{margin:0;min-height:0;height:auto;width:auto;}
  .shell.playing .action-deck #mainActions > button{font-size:clamp(11px,3vw,13px);}
  .shell.playing .game-panel > .board-header{height:38px;min-height:38px;}
  .shell.playing .board-tools{display:none;}
  .shell.playing .board-header #turnLabel{font-size:16px;}
  .shell.playing .outlook-line{font-size:10px;}
  .shell.playing .outlook-line strong{font-size:10px;gap:8px;}
  .shell.playing .outlook-line small{font-size:9px;}
  .shell.playing .quick-powers{margin-top:5px;}
  .shell.training-mode .game-panel > .action-deck{position:relative;height:50px;order:2;margin-top:6px;}
  .shell.training-mode .action-deck .burst-slot {width:100%;grid-column:1/-1;pointer-events:auto;}
  .shell.training-mode .action-deck .burst-slot #burstBtn {width:100%;max-height:47px;min-height:47px;}
  .shell.training-mode .game-panel > .board-stage{order:1;}
  .shell.training-mode .game-panel > .board-header{order:0;}
}
@media(max-width:380px){
  .shell.playing .action-deck .burst-slot #burstBtn{font-size:11px;padding-inline:1px;}
  .shell.playing .action-deck #mainActions > button{font-size:11px;padding-inline:1px;}
}
@media(prefers-reduced-motion:reduce){
  #outlookBlackBar{transition:none;}
}


/* On PC the full-width analysis already lives in the sidebar: don't repeat it. */
@media(min-width:851px){
  .game-panel > #matchOutlook{display:none!important;}
  .game-panel{grid-template-rows:46px minmax(0,min(690px,calc(100dvh - 260px))) 56px 0px 36px;}
}
/* The photographic result screen contains no utility navigation. */
.shell.result-mode .header-actions{display:none!important;}


/* Consistent, visible keyboard focus and reliable touch targets. */
:where(button,a,select,input,summary,#board):focus-visible {
  outline:3px solid #ffe07b;
  outline-offset:3px;
}
:where(button,a,select,summary){
  touch-action:manipulation;
}
.header-actions button:focus-visible,
#detailsClose:focus-visible {
  outline:3px solid #fff1bb;
  outline-offset:3px;
}

@media(max-width:380px) {
  .shell.playing .quick-powers button{font-size:11px;}
  .shell.playing .outlook-line small{font-size:10px;}
}

/* Finished-match actions: three ways to share on one row, navigation below. */
.shell.result-mode .result-actions {
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:7px;
}
.shell.result-mode .result-actions #share,
.shell.result-mode .result-actions #imageSave,
.shell.result-mode .result-actions #imageCopy {
  grid-column:span 2;
  min-height:44px;
  padding:7px 4px;
  text-decoration:none;
}
.shell.result-mode .result-actions #retry,
.shell.result-mode .result-actions #goTitle {
  grid-column:span 3;
  min-height:44px;
}
@media(max-width:850px){
  .shell.result-mode .result-actions #share,
  .shell.result-mode .result-actions #imageSave,
  .shell.result-mode .result-actions #imageCopy {font-size:11px;min-height:44px;}
}

/* Rule selection is its own onboarding screen, not a hidden sidebar behind a board. */
.shell.preparing {
  height:100dvh;min-height:0;overflow:hidden;
  display:flex;flex-direction:column;
  padding-top:max(8px,env(safe-area-inset-top));
  padding-bottom:max(7px,env(safe-area-inset-bottom));
}
.shell.preparing .layout {display:none!important;}
.shell.preparing footer {display:none!important;}
.shell.preparing .mast {flex:none;}
.shell.preparing #setupScreen {
  display:flex;flex-direction:column;
  width:min(100%,860px);flex:1 1 auto;min-height:0;
  margin:0 auto; padding:clamp(12px,3.2dvh,36px) clamp(4px,2vw,15px) 22px;
  overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;
}
.shell.preparing #setupScreen:has(#setupCustomization[hidden]) {justify-content:center;}
.setup-screen-heading {margin-bottom:clamp(15px,3dvh,28px);}
.setup-screen-heading p {font-weight:950;color:var(--arcade-gold);font-size:12px;letter-spacing:.13em;margin:0 0 7px;}
.setup-screen-heading h2 {font-size:clamp(27px,5vw,45px);font-weight:950;line-height:1.12;letter-spacing:-.06em;margin:0 0 10px;color:#fff6dd;}
.setup-screen-heading > span {color:var(--arcade-muted);font-size:clamp(12px,1.45vw,15px);line-height:1.5;}
.preset-options {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:11px;}
.preset-options button {
  position:relative;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;
  text-align:left;gap:8px;min-width:0;min-height:154px;padding:18px;
  color:var(--arcade-ink);background:#172934;border:2px solid #506574;
  border-radius:4px;cursor:pointer;box-shadow:none;
}
.preset-options button strong {font-size:clamp(22px,2.6vw,30px);font-weight:950;letter-spacing:-.05em;}
.preset-options button span {font-size:13px;line-height:1.45;font-weight:750;color:#d6e3e7;}
.preset-options button small {font-size:12px;line-height:1.35;color:#abbfc8;font-weight:800;}
.preset-options button[aria-pressed="true"] {border-color:var(--arcade-gold);background:#312b20;box-shadow:inset 0 0 0 1px #d99e3b;}
.preset-options button[aria-pressed="true"] strong {color:#ffd477;}
.preset-options button[aria-pressed="true"]::after {content:'✓';position:absolute;top:12px;right:15px;color:#ffca5f;font-size:19px;font-weight:900;}
.custom-toggle {
  margin-top:15px;padding:12px 3px;width:100%;min-height:52px;
  display:flex;align-items:center;gap:9px;text-align:left;
  border:0;border-bottom:1px solid #475865;background:transparent;color:#f0ddaa;
  font-size:14px;font-weight:900;cursor:pointer;
}
.custom-toggle small {margin-left:auto;color:#bccbd0;font-size:11px;font-weight:700;white-space:nowrap;}
.custom-toggle b {font-size:22px;font-weight:500;color:var(--arcade-gold);width:24px;text-align:center;}
.custom-toggle[aria-expanded="true"] b {transform:rotate(45deg);}
.setup-customization {
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;
  margin:18px 0 15px;padding:18px;border:1px solid #3a5260;background:#111f2b;
}
.setup-customization .setup-section,.setup-customization .setup-power-section {margin:0;padding:0;border:0;min-width:0;}
.setup-customization h3 {font-size:17px;color:#f9ecce;font-weight:900;margin:0 0 16px;}
.setup-customization .field {margin:13px 0 5px;}
.setup-customization select {max-width:205px;}
.setup-customization .setup-note {font-size:12px;line-height:1.55;}
.setup-power-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.setup-power-list button {
  display:flex;flex-direction:column;align-items:flex-start;gap:5px;min-width:0;
  padding:12px;min-height:103px;text-align:left;
  border:1px solid #58717a;background:#182d3a;color:#f2f5ef;cursor:pointer;
}
.setup-power-list button[aria-pressed="true"] {border:2px solid var(--arcade-gold);padding:11px;background:#443323;}
.setup-power-list strong {font-size:14px;font-weight:900;}
.setup-power-list span {font-size:11px;line-height:1.35;color:#c2d4dc;}
.setup-power-list small {font-size:11px;font-weight:900;color:var(--arcade-gold);margin-top:auto;}
.handicap-placement {margin:13px 0 0;border-top:1px solid #51616c;padding:9px 0;}
.handicap-placement summary {cursor:pointer;font-size:13px;color:#ffd477;font-weight:850;min-height:40px;padding:9px 0;}
.handicap-placement svg {display:block;background:#dfbc85;width:min(100%,420px);height:auto;aspect-ratio:1;border:5px solid #6e4d2c;touch-action:manipulation;}
.handicap-placement #handicapProgress {font-size:12px;color:#c5d6dd;}
.setup-screen .replay-previous {align-self:flex-start;margin:12px 0 0;}
.shell.preparing #setupConfirmBar {
  width:min(100%,860px);align-self:center;flex:none;
  border-top:1px solid #526570;background:#0b141d;
  padding:10px clamp(4px,2vw,15px) 3px;
}
.setup-confirm-inner {display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:center;}
#setupEngineStatus:empty {display:none;}
#setupEngineStatus {flex:1 1 100%;text-align:center;font-size:12px;color:#ffd17d;}
.shell.preparing #startBtn {
  width:100%;height:56px;min-height:56px;
  border:2px solid var(--arcade-gold);border-radius:3px;
  background:var(--arcade-gold);color:#17202a;
  font-size:18px;font-weight:950;letter-spacing:.02em;
  box-shadow:0 4px 0 #8d4e08;cursor:pointer;
}
.shell.preparing #startBtn:active:not(:disabled) {transform:translateY(3px);box-shadow:none;}
.shell.preparing #startBtn:disabled {opacity:.5;cursor:not-allowed;box-shadow:none;}
#setupRetry {min-height:42px;border:1px solid #bb963f;background:transparent;color:#ffe4a2;font-size:12px;font-weight:850;}
@media(max-width:850px){
  .shell.preparing #setupScreen {padding:12px 2px 14px;}
  .setup-screen-heading {margin-bottom:14px;}
  .preset-options {grid-template-columns:1fr;gap:9px;}
  .preset-options button {
    display:grid;grid-template-columns:73px minmax(0,1fr);align-content:center;
    gap:4px 9px;min-height:81px;padding:10px 15px;
  }
  .preset-options button strong {grid-row:1 / 3;font-size:25px;align-self:center;}
  .preset-options button span {font-size:12px;padding-right:13px;}
  .preset-options button small {font-size:11px;}
  .preset-options button[aria-pressed="true"]::after {top:7px;right:9px;font-size:15px;}
  .custom-toggle {margin-top:11px;min-height:51px;}
  .setup-customization {grid-template-columns:1fr;gap:23px;margin-top:12px;padding:14px 12px;}
  .shell.preparing #setupConfirmBar {padding:8px 2px 3px;}
  .shell.preparing #startBtn {height:54px;min-height:54px;font-size:17px;}
}
@media(max-width:360px){
  .preset-options button {min-height:73px;grid-template-columns:64px minmax(0,1fr);}
  .preset-options button strong {font-size:22px;}
  .preset-options button span {font-size:11px;}
  .setup-screen-heading > span {font-size:11px;}
}


/* Entry is about starting a match; hands-on training is always optional. */
.concept-actions #conceptPlay{
  background:linear-gradient(180deg,#ffe66c,#ffab2c);
  border:2px solid #ffe06b;color:#111820;
  box-shadow:0 5px 0 #9c3c19,0 0 17px #ffad3360;
  font-size:clamp(14px,2vw,18px);
}
.concept-actions #conceptPractice{
  background:#142736;border:2px solid #6d8190;color:#e5f0ee;
  box-shadow:none;font-size:clamp(12px,1.6vw,15px);
}
.concept-dialog.returning{width:min(94vw,490px);}
.concept-dialog.returning .concept-demo,
.concept-dialog.returning .concept-rule {display:none!important;}
.concept-dialog.returning .concept-actions{grid-template-columns:1fr;gap:10px;}
.concept-dialog.returning .concept-inner{padding:clamp(20px,5vw,32px);}
.concept-dialog.returning h2{margin-bottom:20px;}
.concept-dialog.returning .concept-nav{margin-top:14px;}

/* A fixed-height match cannot center overflowing content above its own header. */
@media(max-width:850px){
  .shell.playing .brand p,
  .shell.training-mode .brand p,
  .shell:has(#scoringPanel:not([hidden])) .brand p{display:none!important;}
  .shell.playing .mast{min-height:49px;height:49px;max-height:49px;}
  .shell.playing .layout{justify-content:flex-start;}
  .shell.playing .game-panel{justify-content:flex-start;}
  .shell.playing .board-stage{flex-shrink:1;min-height:0;}
  .shell.playing .board-header{height:40px;min-height:40px;}
  .shell.playing .mast .brand{min-width:0;}
  .shell.playing .mast h1{line-height:1.1;}
}

/* The whole final composition is one photo. Never leave the sidebar or
   body footer beneath it, and budget the remaining height for the board. */
.shell.result-mode .sidebar,
.shell.result-mode footer {display:none!important;}
@media(max-width:850px){
  .shell.result-mode .layout{
    align-items:center;
    justify-content:center;
    min-height:0;
  }
  .shell.result-mode .game-panel{flex:0 0 auto;height:auto;min-height:0;}
  .shell.result-mode .board-stage{
    width:min(76vw,355px,max(120px,calc(100dvh - 430px)));
    height:auto;aspect-ratio:1;
  }
}
@media(max-width:850px) and (max-height:650px){
  .shell.result-mode .layout{justify-content:flex-start;gap:8px;}
  .shell.result-mode .board-stage{
    width:min(66vw,max(115px,calc(100dvh - 430px)));
  }
  .shell.result-mode .result-panel{padding:7px 10px;}
  .shell.result-mode .result-top{margin-bottom:3px;}
  .shell.result-mode .result-quip{margin-bottom:6px;}
  .shell.result-mode .result-facts{margin-bottom:6px;padding:4px 0;}
  .shell.result-mode #resultDetail{margin-bottom:5px;}
}


/* Small-screen tutorial: keep the highlighted move and guidance within the viewport. */
@media(max-width:850px){
  .shell.training-mode{
    height:100dvh;min-height:0;overflow:hidden;
    display:flex;flex-direction:column;
    padding: max(8px,env(safe-area-inset-top)) 12px max(8px,env(safe-area-inset-bottom));
  }
  .shell.training-mode .mast{
    min-height:48px;height:48px;flex:none;margin-bottom:6px;padding-bottom:5px;
  }
  .shell.training-mode .layout{
    flex:1 1 auto;min-height:0;
    gap:4px;overflow:hidden;justify-content:flex-start;
  }
  .shell.training-mode .sidebar > .guide{
    flex:none;min-height:0;height:clamp(150px,21dvh,184px);
    max-height:clamp(150px,21dvh,184px);
    overflow-y:auto;overscroll-behavior:contain;
    margin:0 0 3px;box-shadow:3px 3px 0 #ff5b1c;
  }
  .shell.training-mode .guide{padding:8px 10px;}
  .shell.training-mode .guide h2{margin:4px 0;font-size:17px;}
  .shell.training-mode .guide p{font-size:11px;line-height:1.35;margin:0 0 4px;}
  .shell.training-mode .guide-feedback{font-size:11px;line-height:1.3;padding-top:4px;}
  .shell.training-mode .game-panel{
    display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;
    flex:1 1 auto;min-height:0;overflow:hidden;
  }
  .shell.training-mode .game-panel > .board-header{
    flex:none;min-height:33px;height:33px;margin:0;order:0;
  }
  .shell.training-mode .game-panel > .board-stage{
    flex:none;width:min(100%,390px,max(155px,calc(100dvh - 360px)));
    height:auto;aspect-ratio:1;align-self:center;order:1;
  }
  .shell.training-mode .game-panel > .action-deck{
    flex:none;order:2;height:48px;min-height:48px;margin-top:6px;
  }
  .shell.training-mode .action-deck .burst-slot{
    position:relative;top:auto;left:auto;right:auto;
    width:100%;height:48px;min-height:48px;margin:0;padding:0;
  }
  .shell.training-mode .action-deck .burst-slot #burstBtn{
    position:static;margin:0;height:48px;min-height:48px;max-height:48px;
  }
  .shell.training-mode .action-deck:has(#burstBtn[hidden]){display:none!important;}
  .shell.training-mode .game-status{display:none!important;}
  .shell.training-mode footer,
  .shell.training-mode .sidebar > :not(.guide){display:none!important;}
}

/* Scoring needs an interactive board and a compact review pane. Only the
   review text scrolls; the document, header and board stay in place. */
@media(max-width:850px){
  .shell:has(#scoringPanel:not([hidden])){
    height:100dvh;min-height:0;overflow:hidden;
    display:flex;flex-direction:column;
    padding: max(8px,env(safe-area-inset-top)) 12px max(8px,env(safe-area-inset-bottom));
  }
  .shell:has(#scoringPanel:not([hidden])) .mast{
    flex:none;height:48px;min-height:48px;margin-bottom:5px;padding-bottom:5px;
  }
  .shell:has(#scoringPanel:not([hidden])) .layout{
    flex:1 1 auto;min-height:0;display:flex;flex-direction:column;
    gap:0;overflow:hidden;
  }
  .shell:has(#scoringPanel:not([hidden])) .game-panel{
    flex:1 1 auto;min-height:0;min-width:0;width:100%;
    display:flex;flex-direction:column;align-items:stretch;
    justify-content:flex-start;overflow:hidden;
  }
  .shell:has(#scoringPanel:not([hidden])) .board-header{
    height:34px;min-height:34px;flex:none;margin:0;
  }
  .shell:has(#scoringPanel:not([hidden])) .board-stage{
    flex:none;height:auto;width:min(78vw,36dvh,315px);
    max-width:100%;aspect-ratio:1;align-self:center;margin:0;
  }
  .shell:has(#scoringPanel:not([hidden])) .game-panel >
  :not(.board-header):not(.board-zoom-tools):not(.board-stage):not(#scoringPanel){display:none!important;}
  .shell:has(#scoringPanel:not([hidden])) .board-zoom-tools:has(#boardZoom:not([hidden])){
    flex:none;min-height:38px;padding:2px 0 4px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel{
    flex:0 1 auto;min-height:0;max-height:100%;
    overflow-y:auto;overscroll-behavior:contain;
    margin:7px 0 0;padding:10px 12px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel .scoring-actions{
    position:sticky;bottom:0;z-index:2;background:#142330;
    padding:8px 0 max(7px,env(safe-area-inset-bottom));
  }
  .shell:has(#scoringPanel:not([hidden])) .sidebar,
  .shell:has(#scoringPanel:not([hidden])) footer{display:none!important;}
}


/* On desktop scoring review is alongside the board, never below the fold. */
@media(min-width:851px){
  .shell:has(#scoringPanel:not([hidden])) .layout{
    display:grid;grid-template-columns:minmax(0,1fr);
    flex:1 1 auto;min-height:0;gap:0;overflow:hidden;
  }
  .shell:has(#scoringPanel:not([hidden])) .game-panel{
    height:100%;min-width:0;min-height:0;
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    grid-template-rows:46px minmax(0,1fr);
    column-gap:clamp(18px,3vw,45px);
    align-items:stretch;align-content:stretch;overflow:hidden;
  }
  .shell:has(#scoringPanel:not([hidden])) .game-panel >
  :not(.board-header):not(.board-stage):not(#scoringPanel){display:none!important;}
  .shell:has(#scoringPanel:not([hidden])) .board-header{
    grid-column:1 / -1;grid-row:1;height:46px;min-height:46px;margin:0;
  }
  .shell:has(#scoringPanel:not([hidden])) .board-stage{
    grid-column:1;grid-row:2;
    width:min(100%,calc(100dvh - 150px),560px);
    height:auto;max-height:100%;max-width:100%;
    aspect-ratio:1;align-self:center;justify-self:center;
    margin:0;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel{
    grid-column:2;grid-row:2;align-self:center;min-height:0;max-height:100%;
    overflow-y:auto;overscroll-behavior:contain;
    margin:0;padding:14px 16px;
  }
  .shell:has(#scoringPanel:not([hidden])) .sidebar,
  .shell:has(#scoringPanel:not([hidden])) footer{display:none!important;}
}


/* The position is stationary through warning, confirmation and ordinary turns.
   Reserve a two-line message slot from the start. Never resize the board on
   warning, since the second tap must hit exactly the same intersection. */
#gameStatus #message{
  white-space:normal;overflow:hidden;text-overflow:clip;
  overflow-wrap:anywhere;
}
#gameStatus.is-important #message{
  color:#ffe4a8;font-weight:800;
}
@media(min-width:851px){
  .game-panel > #gameStatus,
  .game-panel > #gameStatus.is-important{
    height:36px;min-height:36px;max-height:36px;
    padding:1px 0 0;overflow:hidden;
  }
  .game-panel #message{
    height:auto;min-height:0;max-height:34px;
    font-size:12px;line-height:16px;
  }
}
@media(max-width:850px){
  .shell.playing .game-panel > #gameStatus,
  .shell.playing .game-panel > #gameStatus.is-important{
    height:46px;min-height:46px;max-height:46px;
    padding:4px 0 0;overflow:hidden;
  }
  .shell.playing #message,
  .shell.playing #gameStatus.is-important #message{
    height:auto;min-height:0;max-height:38px;
    margin:0;font-size:12px;line-height:18px;
    white-space:normal;overflow:hidden;text-overflow:clip;
  }
  /* The board stays square even while a restored match reloads KataGo. */
  .shell.playing{--board-fixed-ui:267px;}
  .shell.playing:has(#quickPowers:not([hidden])){--board-fixed-ui:322px;}
  .shell.playing:has(#boardZoom:not([hidden])){--board-fixed-ui:318px;}
  .shell.playing:has(#boardZoom:not([hidden])):has(#quickPowers:not([hidden])){
    --board-fixed-ui:374px;
  }
  .shell.playing .board-stage{
    width:min(100%,calc(100dvh - var(--board-fixed-ui)));
    height:auto;aspect-ratio:1;flex:0 0 auto;min-height:0;
  }
  /* Replace the 48px action row while KataGo loads; never add a second
     vertical row and force the board to shrink during a match. */
  .shell.playing .game-panel:has(#engineLoadingPanel:not([hidden])) > #actionDeck{
    display:none!important;
  }
  .shell.playing .game-panel > #engineLoadingPanel:not([hidden]){
    order:2;flex:0 0 48px;position:relative;
    width:100%;height:48px;min-height:48px;max-height:48px;
    margin:7px 0 0;padding:4px 9px;gap:8px;
    font-size:11px;line-height:1.2;
    overflow:hidden;
  }
  .shell.playing #engineLoadingPanel .engine-loading-copy{
    min-width:0;line-height:1.2;
  }
  .shell.playing #engineLoadingTitle{font-size:11px;}
  .shell.playing #engineLoadingDetail{
    font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  }
  .shell.playing #engineLoadingPanel.failed{padding-block:2px;}
  .shell.playing #engineRetry:not([hidden]){min-height:44px;padding:6px 9px;}
}

/* Score review fits a short phone without obscuring a reference-score warning. */
@media(max-width:850px) and (max-height:650px){
  .shell:has(#scoringPanel:not([hidden])) .board-stage{
    width:min(78vw,30dvh,300px);
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel{
    padding:8px 10px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel h2{
    font-size:20px;margin:0 0 5px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel .scoring-instruction,
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel .scoring-notice{
    font-size:11px;line-height:1.35;margin:3px 0 8px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringScore{
    font-size:17px;margin:0 0 4px;
  }
  .shell:has(#scoringPanel:not([hidden])) .scoring-tools{
    gap:6px;margin:6px 0 0;
  }
  .shell:has(#scoringPanel:not([hidden])) .scoring-tools button{
    min-height:44px;padding:5px 7px;font-size:11px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel .scoring-actions{
    flex-direction:row;gap:6px;margin-top:8px;padding:6px 0 7px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel .scoring-actions button{
    flex:1 1 0;min-width:0;min-height:44px;font-size:12px;
  }
}

/* The score is primary, with correction controls explicitly optional. */
.scoring-panel .scoring-adjust-toggle{
  display:block;width:max-content;max-width:100%;margin:9px 0 0;
  min-height:44px;padding:7px 2px;border:0;border-bottom:1px solid #829baa;
  border-radius:0;background:transparent;box-shadow:none;
  color:#d8e4e8;font-size:12px;font-weight:800;
}
.scoring-panel .scoring-edit{margin:6px 0 0;padding:8px 0 0;border-top:1px solid #516571;}
.scoring-panel .scoring-edit .scoring-instruction{font-size:12px;margin:0 0 7px;}
.scoring-panel .scoring-edit #useScoringAdvice{
  min-height:44px;padding:9px 12px;border:1px solid #627c89;
  background:#213b49;color:#e7f0ec;font-size:12px;font-weight:850;
}
.scoring-panel .scoring-actions{margin-top:14px;}
.scoring-panel [hidden]{display:none!important;}

/* Small-phone score correction keeps restore and confirmation both tappable. */
@media(max-width:850px) and (max-height:650px){
  .shell:has(#scoringPanel:not([hidden])) .board-stage{
    width:min(76vw,26dvh,270px);
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel{
    margin-top:4px;padding:6px 10px 0;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel h2{margin-bottom:3px;}
  .shell:has(#scoringPanel:not([hidden])) #scoringAdvice{
    margin:3px 0 4px;line-height:1.3;
  }
  .shell:has(#scoringPanel:not([hidden])) #adjustScoring{
    margin-top:1px;min-height:44px;padding:5px 2px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringEdit{
    margin-top:1px;padding-top:3px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringInstruction{
    margin:0 0 3px;font-size:11px;
  }
  .shell:has(#scoringPanel:not([hidden])) #useScoringAdvice{
    min-height:44px;padding:7px 9px;
  }
  .shell:has(#scoringPanel:not([hidden])) #scoringPanel .scoring-actions{
    margin-top:4px;padding:4px 0 6px;
  }
}
