:root{color-scheme:dark;--ink:#e9f1f4;--muted:#a2b6c3;--gold:#e4c18b;--cyan:#8edbd9;--panel:#152634;--border:#355263}
body{background:radial-gradient(ellipse at 50% 0,#253947 0,#101923 45%,#0b131d 100%);font-size:14px;color:var(--ink)}
main{max-width:540px;padding:12px max(12px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
h1{font-size:25px;letter-spacing:.13em;color:var(--gold);font-weight:800}main>p:first-of-type{font-size:11px;letter-spacing:.04em;color:var(--muted)}
.walletbar,.panel,.hud{background:linear-gradient(145deg,#1e3342,#14232f);border:1px solid var(--border);border-radius:14px;box-shadow:0 5px 16px #0002}
.walletbar{padding:10px;display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px}.walletbar nav{grid-column:1/-1;width:100%}.walletbar strong{font-size:19px;letter-spacing:-.02em}nav button{font-weight:650}button,select{background:linear-gradient(#2c4452,#223542);border:1px solid #496473;border-radius:10px;min-height:44px;transition:background .12s,transform .12s;box-shadow:0 2px 4px #0002}button:active:not(:disabled){transform:scale(.97)}button[aria-pressed=true]{background:#29535b;border-color:#81c9ca;color:#d5f9f5}button:disabled{opacity:.4}button:focus-visible,summary:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}
.hud{display:grid;grid-template-columns:1fr 1fr 1fr;padding:9px;gap:7px;text-align:center;font-size:12px}.hud span:first-child{color:#acebd7}.hud span:nth-child(2){color:#efad9e}.hud span:nth-child(3){color:var(--gold)}#progressbar{grid-column:1/-1;height:5px;border-radius:5px;background:#354957;overflow:hidden}#progressfill{width:0;height:100%;background:#8ddac7;transition:width .2s}
canvas{border-radius:14px;border-color:#58717a;box-shadow:0 8px 25px #0005;max-width:100%}.tools-panel{padding:10px}.playactions,.retryrow{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;margin-bottom:8px}.retryrow{grid-template-columns:1fr 1fr;margin-top:8px}.playactions #start{background:linear-gradient(#d8bc83,#ae874d);color:#17202a;font-weight:800;border-color:#e7c997}.toolgrid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.toolgrid button{font-size:12px;min-height:58px;color:#f3dfbd;padding:6px 3px}.toolgrid #release,.toolgrid #scout{color:#c1e8e8}.retryrow button{font-size:12px}.scenariofield{font-size:12px}.scenariofield select{min-width:0;width:100%;font-size:12px}.advanced{margin:9px 0;color:var(--muted);font-size:12px}.advanced summary{cursor:pointer;min-height:36px;padding:8px 0}.advanced small{display:block;line-height:1.55}#hint{min-height:44px;min-width:68px;font-size:12px}#hinttext{display:block;margin:7px 0;line-height:1.45}#message{min-height:0;font-size:12px;margin:7px 0}#controlstatus{font-size:11px;color:var(--muted);margin:8px 0}#result.win,#result.loss{padding:11px;border-radius:9px;margin-top:8px;background:#264b48;color:#b4f4df;font-weight:800}#result.loss{background:#593f40;color:#f5c8c0}.metricgrid .eco-row,.shopitem{background:#223a49;border:1px solid #395766}.metricgrid strong{font-size:20px}.shopitem button{color:var(--gold);font-weight:700}.rankrow.self{border:1px solid #67a4a7}.adminnav button{font-size:12px}#econstatus{margin:6px 0;font-size:11px}footer button{border-style:dashed;min-height:44px}#medalbutton,#xpbutton{min-width:48px;background:#192a36;box-shadow:none}#xpbutton strong{font-size:13px}
@media(max-width:360px){main{padding:8px}.hud{font-size:11px}.toolgrid{grid-template-columns:repeat(2,minmax(0,1fr))}.walletbar{padding:7px;gap:4px}.walletbar strong{font-size:16px}.playactions button{font-size:12px}.adminnav{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}button:active:not(:disabled){transform:none}}

.hud{grid-template-columns:repeat(4,minmax(0,1fr))}.hud #timer{color:#cce4ea}.hud span{overflow-wrap:anywhere}@media(max-width:360px){.hud{grid-template-columns:1fr 1fr}}

/* P0.4: graphical tool controls. Source C atlas optional; line-art fallback. */
.toolgrid button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:68px;font-weight:650;line-height:1.2}.toolgrid button[aria-pressed=true]{outline:2px solid #8de1d4;outline-offset:-2px}.toolgrid button:disabled{filter:saturate(.55)}.toolgrid button::before{content:'';width:28px;height:28px;flex:0 0 28px;background-position:center;background-size:contain;background-repeat:no-repeat}.toolgrid #release::before,.toolgrid #scout::before{display:none}.toolgrid #release,.toolgrid #scout{min-height:44px}.fx-ready .toolgrid #bridge::before,.fx-ready .toolgrid #para::before,.fx-ready .toolgrid #ladder::before,.fx-ready .toolgrid #bomb::before{background-image:url('../visual-09-2c/assets/fx-atlas.webp');background-size:1066.6667% 533.3333%;background-repeat:no-repeat}
.toolgrid #bridge::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%2020V13L9%207l5%206%205-6%2010%206v7M3%2016h26M9%2016v4m5-4v4m5-4v4m5-4v4%22%2F%3E%3C%2Fsvg%3E")}
.toolgrid #bomb::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2215%22%20cy%3D%2217%22%20r%3D%2210%22%2F%3E%3Cpath%20d%3D%22m20%209%204-4m0%200%204%202m-4-2-1-3M10%2015l3-3%22%2F%3E%3C%2Fsvg%3E")}
.toolgrid #ladder::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M8%2028V3M24%2028V3M8%207h16M8%2013h16M8%2019h16M8%2025h16%22%2F%3E%3C%2Fsvg%3E")}
.toolgrid #para::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%2014a13%2013%200%200%201%2026%200ZM3%2014l13%2013%2013-13M10%2014l6%2013%206-13%22%2F%3E%3C%2Fsvg%3E")}
.toolgrid #shovel::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%209v9l5%205%205-5v-5l-3-2-2%204-2-6zM27%209v9l-5%205-5-5v-5l3-2%202%204%202-6zM16%202v7m-4-4%204%204%204-4M4%2027h24%22%2F%3E%3C%2Fsvg%3E")}
.toolgrid #block::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M8%2028V13l3-2%202%203V5l3-2%203%202v7l2-2%203%201%202%208-4%209z%22%2F%3E%3C%2Fsvg%3E")}
.toolgrid #scooter::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%227%22%20cy%3D%2225%22%20r%3D%224%22%2F%3E%3Ccircle%20cx%3D%2225%22%20cy%3D%2225%22%20r%3D%224%22%2F%3E%3Cpath%20d%3D%22M7%2021h14l4-16h5M19%2012h4%22%2F%3E%3C%2Fsvg%3E")}
.toolgrid #upper::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%2025h10V5m-8%208%208-8%208%208%22%2F%3E%3C%2Fsvg%3E")}
.toolgrid #lower::before{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2032%2032%22%20fill%3D%22none%22%20stroke%3D%22%23e6c184%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%205h10v20m-8-8%208%208%208-8%22%2F%3E%3C%2Fsvg%3E")}
.fx-ready .toolgrid #bridge::before{background-position:0.21551724137931033% 84.13461538461539%}
.fx-ready .toolgrid #para::before{background-position:10.991379310344827% 84.13461538461539%}
.fx-ready .toolgrid #ladder::before{background-position:21.767241379310345% 84.13461538461539%}
.fx-ready .toolgrid #bomb::before{background-position:32.543103448275865% 84.13461538461539%}
.toolgrid{grid-template-columns:repeat(3,minmax(0,1fr))}@media(max-width:340px){.toolgrid{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* P0.5: a shorter tool panel, preserve 44px targets and keyboard focus. */
.toolgrid button{min-height:60px;padding:5px;gap:3px;font-size:12px}.toolgrid button::before{width:26px;height:26px;flex-basis:26px}.toolgrid #release,.toolgrid #scout{min-height:44px}.toolgrid button:focus-visible{outline:2px solid #b4f4eb;outline-offset:2px}

.reinforcement{border-color:#d9b478;background:#21343e}.reinforcement button{display:block;width:100%;margin-top:6px;min-height:44px}.reinforcement #reinforcement-buy:not(:disabled){background:#806137;color:white}.reinforcement strong{color:#f1c98a}

/* P2A fixed-map HUD and readable explicit selection, no changes to simulation. */
.hud{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;padding:8px}.hudmetric{display:flex;flex-direction:column;justify-content:center;gap:3px;min-width:0;padding:6px 2px;border-radius:8px;background:#101f2c99}.hudmetric small{color:#a9bdc7;font-size:10px;font-weight:600}.hudmetric strong{font-size:16px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.hudmetric #saved{color:#a7ead1}.hudmetric #lost{color:#f4b0a0}.hudmetric #goal{color:#f2d39d}.hudmetric #timer{color:#cbeaf1}.toolheading{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:3px 0 7px}.toolheading small{font-size:10px}.selection-guide{min-height:30px;font-size:12px;color:#9ce0d7;padding:6px 8px;background:#162d36;border-radius:7px}.toolgrid button[aria-pressed=true]{background:#1e5054;box-shadow:0 0 0 1px #a9eee1 inset}.toolgrid button:not(:disabled){border-color:#55717b}.toolgrid button:disabled{opacity:.46}.reinforcement{position:relative;border:1px solid #c9a76d}.reinforcement h2{color:#f0c987}#reinforcement-price{display:block;padding:8px;border-radius:8px;background:#17232c}#reinforcement-retry{border-color:#7b9d99;color:#c9f1e8}@media(max-width:360px){.hudmetric strong{font-size:13px}.hudmetric small{font-size:9px}.toolheading small{font-size:9px}}

.training{border-color:#6eaaa6;padding:9px 12px;margin:6px 0}.training small{font-size:11px;color:#93d8cd}.training h2{margin:3px 0;color:#e9d2a4;font-size:16px}.training p{margin:4px 0;color:#e1eeec;line-height:1.4}.training button{width:100%;margin-top:5px;color:#d3f4e7}

/* P4A: local menu, responsive fixed-map navigation. */
.brand{display:flex;align-items:center;gap:10px;margin:0 0 10px}.brandmark{width:47px;height:47px;flex:none}.brand h1{font-size:clamp(19px,5.5vw,26px);letter-spacing:.1em}.brand p{margin:2px 0;font-size:11px;color:#adc0c9}.walletbar nav{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.walletbar nav button{font-size:12px;min-height:44px}.homehero{min-height:300px;display:flex;align-items:end;background:linear-gradient(0deg,#0f202df5 10%,#0e1d2d15 95%),url('../visual-08/art/assets/canyon-hd.webp') center 45%/cover;border:1px solid #536b73;border-radius:15px;overflow:hidden;margin:10px 0}.herocopy{padding:18px;width:100%}.herocopy small{color:#f2cc91;letter-spacing:.1em}.herocopy h2{font-size:25px;margin:8px 0}.herocopy p{line-height:1.45;color:#e0e9ec}.herocopy button{width:100%;background:#d9bb80;color:#17212a;font-weight:800}#home-levels,#practice-open{width:100%}#save-status{display:block;margin-top:8px}.levelcard{display:block;width:100%;text-align:left;margin:6px 0;padding:10px;color:#e8dec8}.levelcard:disabled{opacity:.5}#profile-results{margin:8px 0}#profile-training{color:#9fe2d3}

#normal-title{font-size:16px;color:#e6c48e;margin:9px 0 3px}#normal-next{width:100%;margin-top:7px;background:#d9bb80;color:#17212a;font-weight:800}

.reviewmaps{margin-top:14px;border-top:1px solid #355263;padding-top:4px}.reviewmaps button{width:100%;margin:4px 0}#review-notice{font-size:12px;color:#e8c58c;background:#243846;border-radius:8px;padding:8px}

.settings label{justify-content:space-between;padding:10px 0;border-bottom:1px solid #344b58}.settings input[type=checkbox]{width:24px;height:24px;accent-color:#8acdc2}.settings input[type=range]{width:min(48%,190px);accent-color:#8acdc2}.settings select{max-width:48%}.settings button,#home-settings{width:100%;margin-top:6px}.settings #setting-status{color:#a6ddcf;font-size:12px}

.adminnav{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.admin-filters{display:flex;gap:8px;margin-top:12px}.admin-filters button{flex:1}.admin-kpis{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.admin-kpi{padding:12px;border:1px solid #355263;border-radius:12px;background:#11232f;min-width:0;display:flex;flex-direction:column;gap:6px}.admin-kpi strong{font-size:19px;color:#e5c28b;overflow-wrap:anywhere}.admin-kpi small{font-size:11px}.admin-chart{display:flex;align-items:flex-end;gap:3px;min-height:95px;overflow-x:auto;padding:7px 0}.admin-day{flex:1;min-width:13px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:4px}.admin-day small{font-size:9px}.admin-bar{width:75%;background:#75c6bf;border-radius:3px 3px 0 0}.admin-profile{padding:10px;margin:8px 0}.admin-profile>strong{color:#e6c48e}#admin-result-query,#admin-player-query,#backup-input{max-width:100%;box-sizing:border-box}#backup-download,#backup-check{width:100%;margin:8px 0}#backup-input{width:100%;margin:6px 0}#backup-preview{overflow-wrap:anywhere}

#draft-load,#draft-run{width:100%;margin:8px 0}#draft-tools label{margin:5px 0}#draft-tools input,#draft-goal,#draft-seconds{max-width:90px}#draft-base{color:#c4decf;font-size:12px}

.resultcard{margin:10px 0;border:1px solid #58717a;border-radius:14px;padding:14px;background:linear-gradient(145deg,#243a46,#132430)}.resultcard.victory{border-color:#8dbda7}.resultcard.defeat,.resultcard.pending{border-color:#ac8066}.resultcard h2{font-size:20px;margin:0 0 10px;color:#e7c58e}.resultgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.resultgrid>div{background:#0e1e28;border-radius:9px;padding:9px;display:flex;flex-direction:column;gap:4px}.resultgrid strong{font-size:20px;color:#dcece8}.resultcard button{width:100%}.freedraft{margin:10px 0;padding:10px;border:1px solid #355263;border-radius:10px}.freedraft>div{display:flex;gap:5px;flex-wrap:wrap;margin:7px 0}.freedraft button{flex:1;min-width:90px;font-size:12px}#free-draft-status{display:block;color:#acd8cc}#recordnotice{margin:8px 0;padding:10px;border:1px solid #a88d57;background:#253c40;color:#f1d6a2;border-radius:10px}.achievement-pop{animation:achievement-in .45s ease-out}@keyframes achievement-in{from{opacity:.25;transform:translateY(-6px) scale(.98)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.achievement-pop{animation:none}}

/* QA compact gameplay: preserve the actual controls and fixed world coordinates. */
.game-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.game-top #normal-title{margin:0}.game-top #game-menu{display:none}
@media(max-width:540px){
 main:has(>#view-game:not([hidden]) #training-guide[hidden])>.brand,main:has(>#view-game:not([hidden]) #training-guide[hidden])>.walletbar,main:has(>#view-game:not([hidden]) #training-guide[hidden])>#econstatus{display:none}
 #view-game:has(#training-guide[hidden]) .game-top #game-menu{display:block;margin-left:auto;flex:none;min-height:44px;padding:5px 12px}
 #view-game:has(#training-guide[hidden]) #review-notice{padding:4px 7px;margin:3px 0;font-size:10px}
 #view-game:has(#training-guide[hidden]) .hud{margin:4px 0;gap:4px;padding:4px}
 #view-game:has(#training-guide[hidden]) .hudmetric{padding:3px 2px;gap:1px}
 #view-game:has(#training-guide[hidden]) #scene{width:min(100%,max(196px,calc((var(--futur-visible-height,100svh) - 338px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))*.75)));height:auto;margin:0 auto;touch-action:none}
 #view-game:has(#training-guide[hidden]) .tools-panel{padding:5px;margin:5px 0}
 #view-game:has(#training-guide[hidden]) .playactions{gap:4px;margin-bottom:4px}
 #view-game:has(#training-guide[hidden]) .toolheading{display:none}
 #view-game:has(#training-guide[hidden]) .toolgrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 #view-game:has(#training-guide[hidden]) .toolgrid button{min-height:44px;padding:3px 2px;gap:1px;font-size:11px;line-height:1.1;overflow-wrap:anywhere}
 #view-game:has(#training-guide[hidden]) .toolgrid button::before{width:19px;height:19px;flex-basis:19px}
 #view-game:has(#training-guide[hidden]) .selection-guide{margin:4px 0;padding:4px 6px;min-height:26px;font-size:11px}
}
@media(max-width:540px) and (max-height:680px){#view-game:has(#training-guide[hidden]) .toolgrid{grid-template-columns:repeat(5,minmax(0,1fr))}#view-game:has(#training-guide[hidden]) .toolgrid button{font-size:10px;padding:2px;gap:1px}#view-game:has(#training-guide[hidden]) .toolgrid button::before{width:15px;height:15px;flex-basis:15px}}

#device-diagnostic{margin-top:12px}#device-diagnostic summary{min-height:44px;display:flex;align-items:center;cursor:pointer}#device-diagnostic textarea{width:100%;box-sizing:border-box;resize:vertical;font-size:12px;margin-top:6px}
/* D20: respect the WebView safe area; scrolling remains available on very short screens. */
html,body{overscroll-behavior-y:none}main{padding-top:max(12px,env(safe-area-inset-top,0px))}
@media(max-width:540px) and (max-height:680px){#view-game:has(#training-guide[hidden]) #para{font-size:9px;overflow-wrap:normal}}
@media(max-width:540px) and (min-height:681px){#view-game:has(#training-guide[hidden]) #scene{width:min(100%,max(196px,calc((var(--futur-visible-height,100svh) - 365px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))*.75)))}}
