/* Language labels stay readable at every supported size. */
.brand-compact{display:none}.language-picker{display:block;flex-shrink:0}.language-picker select{min-height:36px;padding:6px 9px;border:1px solid #c8b58150;border-radius:7px;background:#1d343c;color:#ecdbb6;font:12px system-ui,sans-serif}.brand-wordmark{white-space:nowrap}.brand:lang(en){font-size:21px;letter-spacing:1px}.header-caption{flex-shrink:1}.header-caption:lang(en){display:none}
.history-row>span:nth-child(2){min-width:0;overflow-wrap:anywhere}.section-label{gap:7px}.section-label>span{min-width:0}.studio-tab:lang(en){font-size:11px;letter-spacing:0}.rank-rule:lang(en){font-size:11px;line-height:1.8;white-space:pre-line}.dialog-actions{flex-wrap:wrap}dialog button{overflow-wrap:anywhere}.touch-action strong{max-width:100%}
/* Phone/tablet play shell. Board, HUD and actions each have a permanent region. */
html,body{height:100%;overscroll-behavior:none}body{overflow:hidden}main{min-height:0}
.ai-panel{padding:12px;margin-bottom:18px;border:1px solid #cbbfa3;border-radius:7px;background:#e9e3d4}.ai-panel select{width:100%;min-height:38px;margin-top:9px;padding:8px 5px;border:1px solid #c9bda1;border-radius:4px;background:#f9f4e8;font-size:11px}.ai-panel p{font-size:10px;line-height:1.85;margin:10px 0 5px;color:#596958}.ai-panel small{font:9px monospace;color:#8b8169}
.effect-demos{padding-top:13px}.effect-demos>div:last-child{display:flex;gap:5px;margin-top:9px}.effect-demos button{flex:1;min-height:40px;padding:8px 3px;border:1px solid #cbbc9e;border-radius:5px;font-size:10px;background:#eae0cb;color:#755635;white-space:normal;line-height:1.35}.effect-demos button:hover{background:#dfccaa}
.mobile-help-actions,.touch-theme-label,.touch-action,.touch-route,.node-name,.mobile-dock,.close-controls{display:none}.controls-backdrop{position:fixed;inset:0;z-index:45;background:#07121bb8;backdrop-filter:blur(4px)}
.capture-fx-canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:15}
.special-vfx-banner{position:absolute;top:20%;left:50%;transform:translateX(-50%);z-index:16;pointer-events:none;width:max-content;max-width:88%;padding:13px 22px;border:1px solid #f8d484;border-radius:10px;text-align:center;color:#fff0bd;background:linear-gradient(125deg,#422b13ed,#84602bea,#422b13ed);box-shadow:0 5px 35px #d8a23935}.special-vfx-banner strong{display:block;font:700 23px "Songti TC",serif;letter-spacing:2px}.special-vfx-banner span{display:block;margin-top:5px;font-size:10px}.special-vfx-banner[data-effect="cannon"]{border-color:#ffad65;background:linear-gradient(125deg,#401614ee,#81331bed,#401614ee)}.special-vfx-banner[data-effect="assassin"]{border-color:#98d8ff;background:linear-gradient(125deg,#102642ed,#373264ed,#102642ed);color:#dbf7ff}
.small-settings{flex-wrap:wrap;gap:8px}.small-settings>span{width:100%}#capture-effects{white-space:nowrap}


/* Mobile play first: a clear board, one fixed status line, four primary actions. */
@media(max-width:1180px),(any-pointer:coarse){
 :root{--play-footer:38px;--play-header:48px;--play-hud:58px}

 html,body{height:100%;height:100dvh;overflow:hidden;overscroll-behavior:none}
 body{display:flex;flex-direction:column;background:#0c1c26;color:#edf0e8}
 .app-header{position:relative;flex:0 0 auto;height:calc(var(--play-header) + env(safe-area-inset-top));min-height:var(--play-header);padding:env(safe-area-inset-top) max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));gap:7px;background:#132630;border-bottom:1px solid #b4c7cb24;z-index:3}
 .brand{font-size:18px;letter-spacing:1px;gap:7px;white-space:nowrap;flex-shrink:0}.brand-seal{width:24px;height:29px;font-size:22px}.brand-wordmark,.header-caption{display:none}.brand-compact{display:block}
 .touch-theme-label{display:block;flex:1 1 130px;min-width:0;max-width:145px;margin-left:auto}.touch-theme-label select{width:100%;max-width:140px;min-height:36px;padding:6px 3px 6px 7px;border:1px solid #c8b58150;border-radius:7px;color:#ecdbb6;background:#1d343c;font-size:12px}
 .app-header nav{gap:0;flex-shrink:0}.language-picker{flex:0 0 76px}.language-picker select{width:100%;min-height:36px;padding:5px 3px;background:#1d343c;color:#ecdbb6;border-color:#c8b58150;font-size:11px}.app-header nav #album-button,.app-header nav #rules-button,.app-header nav #sound{display:none}#music-shortcut{width:36px;min-height:36px;border:1px solid #bfd1d329;border-radius:7px;color:#e5e4d4;font-size:21px;padding:3px!important}#music-shortcut span{display:none}#music-shortcut.playing{color:#ffe0a1;background:#e5ba5a15;border-color:#dfbd6660}
 .mobile-toolbar{display:grid;position:relative;top:auto;left:auto;flex:0 0 var(--play-hud);height:var(--play-hud);min-height:var(--play-hud);grid-template-columns:minmax(0,1fr) 100px minmax(0,1fr);align-items:center;gap:7px;padding:5px max(12px,env(safe-area-inset-right)) 5px max(12px,env(safe-area-inset-left));background:#0e222e;border-bottom:1px solid #b1c8cd25;z-index:2}
 .mobile-toolbar .touch-player{display:flex;align-items:center;gap:6px;min-width:0;height:46px;padding:5px 7px;border:1px solid #c92c4d66;border-radius:9px;background:#59233838;color:#ffe6e5}.mobile-toolbar .touch-player.blue{border-color:#3d82ec77;background:#1b407c44;color:#e6eeff;justify-content:flex-end;text-align:right}
 .touch-player>b{display:grid;place-items:center;flex:0 0 25px;width:25px;height:30px;border-radius:6px;background:#bd2446;border:1px solid #ffb8bc88;color:#fff0ed;font:700 20px serif}.touch-player.blue>b{background:#235fc4;border-color:#9ec7ff88}
 .touch-player>div{min-width:0}.touch-player strong{display:block;white-space:nowrap;font-size:11px;line-height:1.3}.touch-player small{display:block;font-size:9px;color:#c0a7ae;margin-top:3px}.touch-player.blue small{color:#adbfdb}.touch-player>span{display:flex;align-items:baseline;gap:2px;margin-left:auto}.touch-player.blue>span{margin-left:0;margin-right:auto}.touch-player>span em{font:700 19px monospace;color:#fff3e9}.touch-player>span small{font-size:8px;margin:0}
 .touch-player.current{border-color:#ff8ba4!important;box-shadow:inset 0 0 0 1px #ff8ba455}.touch-player.blue.current{border-color:#88baff!important;box-shadow:inset 0 0 0 1px #88baff55}
 .mobile-toolbar .touch-turn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;color:#dfd6bc}.touch-turn>strong{font-size:12px;line-height:1.2;white-space:nowrap;color:#efd9a6}.touch-turn[data-side="red"]>strong{color:#ffb4bf}.touch-turn[data-side="black"]>strong{color:#a2c7ff}.touch-turn>small{display:flex;align-items:center;justify-content:center;gap:1px;font-size:8px;color:#91a8b7;white-space:nowrap}.touch-turn>small b{font:600 10px monospace;color:#d8e2e3}.touch-turn>small i{font-style:normal;margin:0 2px;color:#57707c}
 .play-tools{display:none}
 main{display:flex;position:relative;flex:1 1 0;height:0;min-height:0;overflow:hidden}.stage,.stage.scenic{flex:1;height:100%!important;min-height:0!important;max-height:none!important;width:100%;border:0;border-radius:0;overflow:hidden}
 .stage-heading,.scene-picker,.stage-stats,.stage-footnote,.mobile-turn,.column-labels{display:none}
 .scene-background,.scene-shade{inset:0 0 var(--play-footer);transform:none!important;background:none!important}.scene-shade{background:linear-gradient(90deg,#0b1a2618,transparent 22%,transparent 78%,#0b1a2618)!important;pointer-events:none}
 .board-shell{position:absolute;inset:0!important;top:0!important;left:0!important;width:100%!important;height:100%!important;max-width:none!important;transform:none!important;perspective:none}
 .board-grid{position:absolute;inset:0;display:block;width:100%;height:100%;transform:none!important;pointer-events:none}
 .slot,.slot:has(.node-button.red,.node-button.black){position:absolute;min-width:0;max-width:none;aspect-ratio:auto!important;transform:translate(-50%,-50%);pointer-events:none}
 .node-button,.node-button.red,.node-button.black,.node-button.empty,.node-button:hover,.node-button.red:hover,.node-button.black:hover{position:relative;display:block;width:100%;height:100%;padding:0!important;border:0!important;border-radius:9px;background:transparent!important;box-shadow:none!important;color:transparent!important;font-size:0!important;opacity:1!important;outline:none;pointer-events:none;touch-action:none}
 .node-button .cell-hit{display:block;position:absolute;inset:0;pointer-events:auto;clip-path:var(--cell-shape);touch-action:none}.node-button:disabled .cell-hit{pointer-events:none}
 .node-button:before{content:''!important;display:block!important;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:calc(var(--cell-size)*.74);height:calc(var(--cell-size)*.74);max-width:95px;max-height:95px;margin:0!important;border:1px solid #bfd6ed28;border-radius:50%;background:#bbceeb16;box-shadow:none;pointer-events:none}
 #board .node-button:after{display:none!important;content:none!important}
 .node-button .node-coord{display:block;opacity:0;position:absolute;top:2px;left:3px;padding:1px 3px;border:0;border-radius:3px;background:#0a2034a8;color:#d6e1df;font:9px monospace;line-height:1.2;pointer-events:none;transform:none}
 .coordinates-visible .node-button .node-coord,.node-button.selected .node-coord,.node-button.can-move .node-coord,.node-button.can-capture .node-coord,.node-button.last-from .node-coord,.node-button.last-to .node-coord{opacity:1}
 .node-button .node-name{display:grid;place-items:center;position:absolute;bottom:1px;left:50%;transform:translateX(-50%);width:20px;height:20px;padding:0;border:1px solid #fff9;border-radius:50%;background:#243b4f;color:#fff;font:700 14px serif;line-height:1;white-space:nowrap;text-shadow:none;box-shadow:0 1px 3px #07152366;pointer-events:none}.node-button .node-name:empty{display:none}.node-button.red .node-name{background:#c12243}.node-button.black .node-name{background:#2464d0}
 .node-button.selected:before{border:3px solid #ffe59a;background:#ffdb6a1f;box-shadow:0 0 12px #ffcd6644}.node-button.can-capture:before{border:3px solid #ffd66c;background:#ffbf3b26}.node-button.can-move:before{border:2px solid #83edbd;background:#53c99725}.node-button.can-move .node-name{top:50%;bottom:auto;transform:translate(-50%,-50%);color:#bcffdf;font-size:17px;background:none;border:0;box-shadow:none}
 .node-button.last-from:not(.selected):before{border:2px dashed #bbd4e499;background:#9bb8cd0c}.node-button.last-to:not(.selected):not(.can-capture):before{border:2px solid #fff0bb99}.node-button:focus-visible{outline:2px solid #ffe29c!important;outline-offset:-2px!important}
 .board-turned .node-button .node-coord{top:calc(50% - var(--cell-size)*.22);left:50%;transform:translate(-50%,-100%)}.board-turned .node-button .node-name{top:calc(50% + var(--cell-size)*.22);bottom:auto}.board-turned .node-button.can-move .node-name{top:50%;transform:translate(-50%,-50%)}
 .touch-route{display:block;position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2;overflow:visible}.touch-route line{stroke:#ffe6a0;stroke-width:2;stroke-dasharray:4 5;opacity:.38}.touch-route circle{fill:#b7d4e4;stroke:#102333;stroke-width:2}.stage.scenic .touch-route{display:none}
 .touch-action{display:flex;position:absolute;left:0;right:0;bottom:0;height:38px;align-items:center;gap:8px;padding:3px max(12px,env(safe-area-inset-right)) 3px max(12px,env(safe-area-inset-left));border-top:1px solid #b9cdd32b;background:#11232e;color:#e7dbc0;z-index:4}
 .touch-action>div{flex:1;min-width:0}.touch-action strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;font-weight:500;line-height:1.5}.touch-action span{display:none}.touch-action button{min-width:44px;min-height:32px;padding:3px 9px;border:1px solid #b39e6b55;border-radius:5px;color:#e8d6ab;font-size:11px}


.scene-background canvas{touch-action:none}
 .stage #toast,.stage .special-vfx-banner{display:none!important}.capture-fx-canvas{z-index:10;clip-path:inset(0 0 var(--play-footer) 0);opacity:1}
 .mobile-dock{display:grid;flex:0 0 auto;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;padding:5px max(12px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));background:#0f222e;border-top:1px solid #b4c7cb25;z-index:5}.mobile-dock button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:46px;padding:6px 3px;border:1px solid #a9bfc342;border-radius:8px;background:#1a3240;color:#e5e3d2;font-size:13px;white-space:nowrap}.mobile-dock button b{font-weight:400}.mobile-dock button>span:first-child{font-size:18px;color:#cbb994}.mobile-dock button>span[data-t]{font-size:inherit;color:inherit}.mobile-dock .touch-new{background:#bc7e3c;border-color:#db9f56;color:#fff4dc}.mobile-dock .touch-new>span:first-child{color:#fff0c7}.mobile-dock button[aria-expanded="true"]{background:#ead7a1;color:#263740}.mobile-dock button:disabled{opacity:.32}
 #game-controls{display:flex;position:fixed;inset:auto auto 0 50%;transform:translate(-50%,105%);width:min(490px,100%);height:calc(100dvh - 40px - env(safe-area-inset-top));max-height:calc(100dvh - 40px);margin:0;border:1px solid #d2c8ae;border-radius:16px 16px 0 0;background:var(--paper);color:var(--ink);z-index:50;visibility:hidden;pointer-events:none;overflow-y:auto;overscroll-behavior:contain;padding-bottom:env(safe-area-inset-bottom);transition:transform .16s,visibility .16s}
 .controls-open #game-controls{transform:translate(-50%,0);visibility:visible;pointer-events:auto}.close-controls{display:block;position:sticky;top:0;flex-shrink:0;z-index:3;min-height:44px;padding:11px 18px;background:#e8e0cf;border-bottom:1px solid #d5c8ae;text-align:right;font-size:13px}
 .side-heading{display:block;padding:12px 16px}.side-heading .eyebrow,.side-heading h2{display:none}.mode button{min-height:42px;font-size:13px}.side-content{display:flex;flex-direction:column;gap:14px;padding:14px 16px}.side-content>.game-label,.side-content>.turn-label,.side-content>#status,.side-content>.players,.side-content>.game-actions,.side-content>.selected-section,.side-content>.capture-section{display:none}
 .mobile-help-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px;order:-1}.mobile-help-actions button{min-height:42px;padding:8px;border:1px solid #c6bda8;border-radius:6px;background:#e8e1d2;font-size:12px}.mobile-help-actions #coordinates-toggle{grid-column:span 2;min-height:38px}.mobile-help-actions button[aria-pressed="true"]{background:#d9c9a8}
 .side-content .ai-panel{order:0;margin:0;padding:12px}.ai-panel select{min-height:44px;font-size:12px}.ai-panel p{font-size:11px}.ai-panel small{font-size:9px}.side-content .demo-button{order:1;min-height:48px}.demo-button>span{font-size:13px}.demo-button>small{font-size:10px}

 .side-content .effect-demos{order:3;padding:0}.effect-demos button{min-height:44px;font-size:11px}.side-content .music-player{order:4;margin:0}.side-content .small-settings{order:5;margin:0;padding-top:12px;gap:8px;flex-wrap:wrap}.small-settings button{min-height:40px;padding:5px 9px;border:1px solid #c6bda8;border-radius:5px;font-size:11px}.side-content .history-section{order:6;margin:0;padding-top:12px}#history{height:95px}.history-row{font-size:11px}.side-content .section-label{font-size:11px}.side-content .section-label>span{font-size:9px}
 .stage.scenic .scene-background,.stage.scenic .scene-shade{inset:0 0 var(--play-footer)}.stage.scenic .camera-controls{display:none}.stage.scenic #scenic-caption{left:20px;bottom:calc(var(--play-footer) + 20px);z-index:3}.stage.scenic #scenic-caption>span{font-size:24px}.stage.scenic #scenic-caption p{display:none}.stage.scenic #return-game{min-height:42px;font-size:12px}
 dialog{max-height:calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow:auto;overscroll-behavior:contain}.album-dialog{padding:22px 16px}.album-dialog h2{font-size:22px}.model-studio{height:clamp(220px,40dvh,430px)}.studio-controls button{min-height:38px}.studio-description{min-height:0;font-size:12px}
 .scene-error .board-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));gap:5px;padding:8px 12px var(--play-footer);pointer-events:auto}.scene-error .slot{position:relative;left:auto!important;top:auto!important;width:100%!important;height:100%!important;transform:none}.scene-error .node-button{pointer-events:auto}.scene-error .cell-hit{clip-path:none}.scene-error .node-button .node-coord{opacity:1}.stage:fullscreen{height:100dvh!important;min-height:0!important}
}
@media(max-width:370px){.brand-seal{display:none}.brand{font-size:17px}.app-header{gap:5px;padding-left:10px;padding-right:10px}.language-picker{flex-basis:68px}.touch-player>b{display:none}.mobile-toolbar{gap:5px;padding-left:10px;padding-right:10px;grid-template-columns:minmax(0,1fr) 94px minmax(0,1fr)}.touch-player strong{font-size:11px}.touch-player>span em{font-size:18px}.touch-theme-label select{max-width:128px;font-size:10px}.brand{letter-spacing:0;font-size:16px}.mobile-dock{gap:5px;padding-left:10px;padding-right:10px}.mobile-dock button{font-size:12px;gap:4px}}
@media(max-height:650px) and (max-width:1180px){:root{--play-header:38px;--play-hud:48px}.app-header nav #music-shortcut{min-height:32px;height:32px}.touch-theme-label select,.language-picker select{min-height:32px}.mobile-toolbar .touch-player{height:40px}.mobile-dock button{min-height:44px}.mobile-dock{padding-top:4px;padding-bottom:calc(4px + env(safe-area-inset-bottom))}.touch-turn>strong{font-size:11px}.brand-seal{height:27px}}
@media(max-height:480px) and (orientation:landscape) and (max-width:1180px){:root{--play-header:34px;--play-hud:42px;--play-footer:32px}.mobile-toolbar .touch-player{height:34px}.touch-player>b{height:25px}.mobile-toolbar{padding-top:3px;padding-bottom:3px}.app-header nav #music-shortcut,.touch-theme-label select,.language-picker select{min-height:28px;height:28px}.touch-action{height:32px}.touch-action button{min-height:27px}.mobile-dock{padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom));padding-left:max(12px,calc((100% - 660px)/2));padding-right:max(12px,calc((100% - 660px)/2))}.mobile-dock button{min-height:44px}.touch-player small{margin-top:1px}.mobile-toolbar{grid-template-columns:minmax(0,1fr) 130px minmax(0,1fr)}}
@media(min-width:700px) and (min-height:481px) and (max-width:1180px){:root{--play-header:52px;--play-hud:68px}.app-header,.mobile-toolbar{padding-left:22px;padding-right:22px}.mobile-toolbar{grid-template-columns:minmax(0,1fr) 170px minmax(0,1fr);gap:14px}.mobile-toolbar .touch-player{height:54px}.touch-player strong{font-size:14px}.touch-player>span em{font-size:24px}.touch-player small{font-size:10px}.touch-turn>strong{font-size:14px}.touch-turn>small{font-size:11px}.mobile-dock{padding-left:max(22px,calc((100% - 900px)/2));padding-right:max(22px,calc((100% - 900px)/2));gap:12px}.mobile-dock button{min-height:50px;font-size:14px}.touch-action strong{font-size:13px}}
.reduced-motion #game-controls{transition:none}@media(prefers-reduced-motion:reduce){#game-controls{transition:none}}

@media(max-width:1180px),(any-pointer:coarse){.brand:lang(en){font-size:18px;letter-spacing:0}.brand-seal{display:none}.mobile-toolbar .touch-player small:lang(en){font-size:8px}.camera-controls{display:none}.mobile-dock button{touch-action:manipulation}.touch-turn>small:lang(ja){font-size:8px}}
@media(max-width:370px){.brand:lang(en){font-size:17px}.touch-player>span{gap:1px}.touch-player>span small{font-size:7px}.touch-turn>small{font-size:8px}.touch-player strong:lang(ja){font-size:10px}}

/* Keep the native language menu while displaying a stable Language label. */
.language-picker{position:relative;cursor:pointer}.language-picker .language-label{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:88px;min-height:36px;padding:6px 9px;border:1px solid #c8b58150;border-radius:7px;background:#1d343c;color:#ecdbb6;font:12px system-ui,sans-serif;pointer-events:none}.language-label:after{content:'⌄';font-size:14px;line-height:1}.language-picker select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}.language-picker:focus-within .language-label{outline:2px solid #ffe39e;outline-offset:2px}
@media(max-width:1180px),(any-pointer:coarse){.language-picker .language-label{min-width:0;width:100%;padding:5px 6px;font-size:11px;gap:3px}}
@media(max-height:650px) and (max-width:1180px){.language-picker .language-label{min-height:32px}}
@media(max-height:480px) and (orientation:landscape) and (max-width:1180px){.language-picker .language-label{min-height:28px}}
