/* Fit the tactical surface; keep long reference lists reachable by scrolling. */
#gameScreen{min-width:0}.masthead,.masthead nav,.battle-status,.assist-bar{flex-wrap:wrap;min-width:0}.masthead nav{overflow:visible;gap:6px}.masthead nav button{white-space:normal}
.assist-bar{position:static}.assist-bar label{display:flex;align-items:center;gap:6px;min-width:0}.assist-bar select{max-width:180px}.assist-bar span{flex:1 1 200px}
.map-column,.crew-column,.action-column{min-width:0}.map-frame{position:relative;min-width:0!important}.piece{font-family:var(--font);overflow:visible}.piece-initial{max-width:100%;font-size:clamp(12px,1.4vw,23px)}.piece sup{position:absolute;left:2px;top:1px;font:700 9px var(--font)}.piece small{right:2px;bottom:1px}
#diceStage{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:5;display:flex;gap:12px;padding:16px;background:#f5f6f3f5;border:1px solid var(--ink);pointer-events:none;max-width:90%}
#diceStage[hidden]{display:none}.stage-die{display:grid;text-align:center;gap:6px;min-width:76px;color:var(--owner)}.stage-die>span{font-size:12px;white-space:nowrap}.stage-face{width:70px;height:70px;display:grid;place-items:center;font:64px/1 Arial,sans-serif;background:var(--owner);color:#fff;border:1px solid var(--owner)}.stage-die strong{font-size:20px;font-variant-numeric:tabular-nums}
#presenceDialog{width:min(440px,calc(100vw - 24px));max-height:calc(100dvh - 24px);margin:auto;overflow:auto;padding:28px!important}#presenceDialog h2{font-size:26px}#presenceDialog button{width:100%;min-height:48px}#presenceDialog::backdrop{background:#1c38377a}
@media(min-width:1101px) and (min-height:650px){
 #gameScreen{height:100dvh;display:flex;flex-direction:column;overflow:hidden}#gameScreen[hidden]{display:none}.masthead{width:100%;padding:12px 20px;gap:14px;flex:none}
 #gameScreen main{display:flex;flex:1;flex-direction:column;min-height:0;width:100%;padding:0 20px 12px}.battle-status{min-height:52px;flex:none}.arena{flex:1;min-height:0;grid-template-columns:minmax(175px,21%) minmax(0,1fr) minmax(240px,26%);gap:18px}
 .crew-unit{display:grid;grid-template-columns:minmax(0,1fr) 48px;gap:6px;align-items:center}.crew-unit .inspect-button{padding:6px;min-height:44px;font-size:11px}.unit-card{padding:8px!important;margin-bottom:0!important}.unit-title .system-card{width:30px!important}.hp-row{margin:8px 0 6px}.player-crew{margin-bottom:14px}.crew-heading{margin-bottom:6px}.crew-unit{margin-bottom:8px}.crew-note{display:none}
 .arena>.crew-column,.arena>.action-column,.arena>.map-column{max-height:100%;overflow:auto;scrollbar-gutter:stable;padding-right:5px}
 .map-frame{width:min(100%,var(--board-fit,calc((100dvh - 340px)*1.2)));margin:auto}.map-scroll{overflow:visible}.map-heading{flex-wrap:wrap;gap:8px}.collapse-clock{flex-wrap:wrap}.map-rule-note{line-height:1.5}.terrain-key{grid-template-columns:repeat(3,minmax(0,1fr))}.terrain-key button{white-space:normal}.log-list{max-height:100px}#gameScreen footer{display:none}
}
@media(max-width:1100px){
 .masthead{padding:10px 12px;gap:8px;flex-wrap:wrap!important}.masthead nav{width:100%!important;flex-basis:100%!important;display:flex;flex-wrap:wrap}.masthead nav #saveButton,.masthead nav #importButton,.masthead nav #newButton{display:inline-block}
 .assist-bar{flex-wrap:wrap;padding:10px 12px}.assist-bar label{flex:1 1 130px}.assist-bar select{width:100%}.battle-status{gap:8px}.phase-track{margin-left:0;flex-wrap:wrap}
 .map-frame{max-width:620px;margin:auto;width:100%!important}.tile{min-height:0!important}.map-heading{flex-wrap:wrap}.map-heading>div:first-child{flex-wrap:wrap}.map-caption{overflow-wrap:anywhere}.terrain-key{grid-template-columns:repeat(3,minmax(0,1fr))}.terrain-key button{min-width:0}
 .piece-initial{font-size:clamp(12px,3vw,24px)}.piece sup,.piece small{font-size:8px!important}.touch-tools{justify-content:center}.touch-tools #touchPad{flex-wrap:wrap}.shell-header{flex-wrap:wrap!important}
 #gameScreen{padding-bottom:calc(84px + env(safe-area-inset-bottom))}.mobile-tabs{padding-bottom:calc(8px + env(safe-area-inset-bottom))}
}
@media(max-height:500px){dialog{max-height:calc(100dvh - 16px)!important;overflow:auto}.masthead{padding-block:6px}.tutorial-panel{max-height:45dvh;overflow:auto}}
