/* Tower shell: the provided sand-gold / moss palette, scoped away from the upgrade orbit. */
:root{--shell-gold:#86651f;--shell-shadow:#4b4c2e12;--shell-chip:#e9eadb;--shell-energy:#a78ac4}
:root[data-playroom-theme=dark]{--shell-gold:#ddcb8b;--shell-shadow:#11160e35;--shell-chip:#4b5141;--shell-energy:#c7a9e8}
@media(prefers-color-scheme:dark){:root[data-playroom-theme=auto]{--shell-gold:#ddcb8b;--shell-shadow:#11160e35;--shell-chip:#4b5141;--shell-energy:#c7a9e8}}
html,body,.game-shell,.battle-wrap{background-color:var(--play-base)}
body{color:var(--play-text)}
.top-ui{background:var(--play-panel);border:1px solid var(--play-border);border-radius:16px;box-shadow:0 5px 20px var(--shell-shadow);grid-template-columns:140px minmax(0,1fr) auto;gap:14px;min-height:72px;padding:10px 14px}
.top-ui .chapter{gap:8px}.top-ui .chapter img{width:32px;height:36px}.top-ui .chapter b{color:var(--play-text);font-size:14px;font-weight:700;letter-spacing:0}
.top-ui .hud{grid-template-columns:.85fr 1.1fr .95fr 1.3fr;gap:0;align-items:center}
.top-ui .hud>div{padding:0 14px;border-left:1px solid var(--play-border);min-height:34px}.top-ui .hud>div:first-child{padding-left:0;border-left:0}
.top-ui .resource-stat,.top-ui .energy-stat{gap:7px}
.top-ui .hud .stat-icon{width:34px;height:35px;filter:none}.top-ui .energy-stat .stat-icon{width:25px;height:36px}
.top-ui .hud strong{font-size:23px;line-height:1.1;font-weight:750;color:var(--play-text);text-shadow:none;font-variant-numeric:tabular-nums}.top-ui .hud strong.gold{color:var(--shell-gold)}
.top-ui .hud em{font-size:10px;color:var(--play-muted);margin-left:3px;white-space:nowrap}
.top-ui .energy-readout{width:100%;max-width:130px;min-width:46px;text-align:left}
.top-ui .energy-readout>span{color:var(--play-muted);font-size:11px;text-shadow:none;margin:0 0 7px;line-height:1}
.top-ui .hud .energy-track{height:7px;width:100%;background:var(--shell-chip);border-radius:5px;overflow:hidden;margin:0}
.top-ui .energy-channel{inset:0;width:100%;height:100%;border-radius:5px}.top-ui .energy-channel #compute-bar{border-radius:5px;background:var(--shell-energy);box-shadow:none}
.top-ui .energy-track>img{display:none}
.top-ui .view-tools{gap:4px}.top-ui .view-tools button{width:34px;min-height:36px;height:36px;border:1px solid transparent;border-radius:10px;color:var(--play-text);font-size:19px;background:transparent}
.top-ui .view-tools button:hover:enabled{background:var(--play-soft);border-color:var(--play-border)}.top-ui .view-tools button:focus-visible{outline-color:var(--play-accent)}
.top-ui .view-tools #pause,.top-ui .view-tools #speed{background:var(--play-soft);border-color:var(--play-border);font-size:18px}
.top-ui .view-tools a{color:var(--play-muted);font-size:10px;margin:0 3px}
.chapter-panel{background-color:var(--play-base);background-image:var(--play-art);background-position:center top;background-size:cover;backdrop-filter:none;color:var(--play-text)}
.chapter-header h1,.chapter-header small,.chapter-summary{color:var(--play-text)}.chapter-summary>span,.chapter-stars{color:var(--play-accent)}
.chapter-group-heading h2{color:var(--play-text)}.chapter-group-heading>span{color:var(--play-muted)}
.chapter-header button,.chapter-footer button{background:var(--play-panel);border-color:var(--play-border);color:var(--play-text)}
#difficulty-select button{background:var(--play-panel);border-color:var(--play-border);color:var(--play-muted)}#difficulty-select button[aria-pressed=true]{background:var(--play-accent);border-color:var(--play-accent);color:var(--play-onAccent)}
.level-card{background:var(--play-panel);border-color:var(--play-border)}.level-info>b{background:var(--play-soft);border-color:var(--play-border);color:var(--play-accent)}
.placement-roster,.panel:not(.dispatch-panel){background:var(--play-panel);border-color:var(--play-border);color:var(--play-text);box-shadow:0 4px 16px var(--shell-shadow)}
.placement-card{background:var(--play-soft);border-color:var(--play-border);color:var(--play-text)}.placement-card small{color:var(--shell-gold)}.placement-card[aria-pressed=true]{background:var(--play-panel);border-color:var(--play-accent);box-shadow:0 0 0 2px var(--play-border)}
.intel-toggle{background:var(--play-panel);border-color:var(--play-border);color:var(--play-muted);box-shadow:0 2px 10px var(--shell-shadow)}
.system-menu>button,.system-menu>a,.system-menu .control-setting button{background:var(--play-soft);border-color:var(--play-border);color:var(--play-text)}.system-menu .control-setting button[aria-pressed=true]{background:var(--play-accent);border-color:var(--play-accent);color:var(--play-onAccent)}.system-menu .control-setting span{color:var(--play-muted)}
.audio-panel label,.audio-panel .panel-heading button,.panel:not(.dispatch-panel) .panel-heading button{color:var(--play-text)}.audio-panel p,.audio-panel output{color:var(--play-muted)}
@media(max-width:1000px){
 .top-ui{grid-template-columns:1fr auto;gap:7px 10px;padding:9px 12px;min-height:0}
 .top-ui .hud{grid-column:1/-1;grid-row:2;grid-template-columns:.8fr 1.25fr .95fr 1.3fr}
 .top-ui .hud>div{padding:0 10px;min-height:34px}.top-ui .hud strong{font-size:21px}.top-ui .hud .stat-icon{width:32px;height:34px}
}
@media(max-width:560px){
 .top-ui{left:7px;right:7px;padding:7px 9px;gap:7px 6px;border-radius:14px}
 .top-ui .chapter{gap:5px}.top-ui .chapter img{width:25px;height:30px}.top-ui .chapter b{font-size:11px}
 .top-ui .hud{grid-template-columns:.8fr 1.3fr .95fr 1.35fr}.top-ui .hud>div{padding:0 6px;min-height:31px}.top-ui .resource-stat,.top-ui .energy-stat{gap:3px}
 .top-ui .hud .stat-icon{width:26px;height:29px}.top-ui .hud strong{font-size:18px}.top-ui .hud strong.gold{font-size:17px}.top-ui .hud em{font-size:9px;margin-left:1px}
 .top-ui .energy-stat .stat-icon{width:19px;height:30px}.top-ui .energy-readout>span{font-size:10px;margin-bottom:6px}.top-ui .view-tools a{display:none}
}
@media(pointer:coarse){.top-ui .view-tools button,.top-ui .view-tools #pause,.top-ui .view-tools #speed{width:44px;min-height:44px;height:44px}.top-ui .view-tools{gap:2px}}
@media(max-width:360px){.top-ui #focus{display:none}.top-ui .hud>div{padding:0 4px}.top-ui .hud .stat-icon{width:23px}.top-ui .hud strong{font-size:17px}.top-ui .hud strong.gold{font-size:16px}}
@media(max-height:480px) and (min-width:760px){
 .top-ui{grid-template-columns:96px minmax(0,1fr) auto;height:60px;min-height:60px;padding:4px 8px;gap:8px}
 .top-ui .hud{grid-column:auto;grid-row:auto}.top-ui .hud>div{padding:0 7px}.top-ui .hud strong{font-size:18px}.top-ui .hud .stat-icon{width:27px;height:30px}
 .top-ui .chapter img{width:23px}.top-ui .chapter b{font-size:10px}.top-ui .energy-readout>span{font-size:10px}
}
/* Local diagnostics follow the shell palette; visibility rules remain local-review only. */
:root[data-playroom-game] .local-debug{background:var(--play-panel);color:var(--play-text);border-color:var(--play-border);box-shadow:0 4px 16px var(--shell-shadow)}
:root[data-playroom-game] .local-debug summary{background:var(--play-soft)}
:root[data-playroom-game] .local-debug-row span,:root[data-playroom-game] .local-debug-note,:root[data-playroom-game] .local-debug-trace{color:var(--play-muted)}
:root[data-playroom-game] .local-debug h3{color:var(--play-accent);border-color:var(--play-border)}
:root[data-playroom-game] .local-debug td,:root[data-playroom-game] .local-debug th{border-color:var(--play-border)}
@media(max-width:360px){.top-ui .hud>div:nth-child(3){padding:0 2px}.top-ui .hud>div:nth-child(3) .stat-icon{width:20px}.top-ui .hud>div:nth-child(3) strong{font-size:16px}.top-ui .hud>div:nth-child(3) em{font-size:8px}}

.level-card .level-test{position:absolute;right:12px;top:12px;padding:3px 9px;border-radius:20px;background:#fff5d9;color:#796332;border:1px solid #d7c387;font:600 12px/1.5 system-ui}

.top-ui .chapter,.top-ui .chapter>div{min-width:0}.top-ui[data-testing=true] .chapter b{font-size:12px;white-space:normal;line-height:1.25;overflow-wrap:anywhere}

.top-ui #level-test{color:#99762c;font-size:10px;line-height:1.2;margin-top:3px;display:block}.top-ui #level-test[hidden]{display:none}
