body:has(.game) {height:100dvh}
body:has(.game) footer, #error:empty {display:none}
body:has(.game) .bar {height:clamp(44px,7vh,64px)}
body:has(.game) header {flex:none}
.game {width:min(1000px,94vw); min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr); gap:14px; padding:clamp(8px,2.2vh,22px) 0 12px}
.game-info {display:grid; gap:8px}
.heading {display:flex; align-items:end; justify-content:space-between; gap:12px; flex-wrap:wrap}
.game .eyebrow {margin:0 0 4px}
.game .gamehead {font-size:clamp(25px,3.7vh,40px); margin:0}
.game .stats {margin:0; gap:8px; font-size:.94rem}
.stats b {color:var(--lime); padding-left:4px}
.rules {color:#dce1ee; background:#20253d; border-left:3px solid #a798ed; border-radius:0 8px 8px 0; padding:8px 13px; margin:0; line-height:1.4}
.rules strong {color:#fff}
.game .notice {margin:0}
.workbench {--side:clamp(156px,18vw,212px); --gap:clamp(12px,2vw,24px); container-type:size; display:flex; gap:var(--gap); align-items:flex-start; min-height:0}
.workbench .grid {flex:none; min-width:0; width:min(calc(100% - var(--side) - var(--gap)),calc(100cqh * var(--cols) / var(--rows)),calc(var(--cols) * 90px)); aspect-ratio:var(--cols) / var(--rows); grid-template-columns:repeat(var(--cols),minmax(0,1fr)); grid-template-rows:repeat(var(--rows),minmax(0,1fr)); border-radius:5px; overflow:hidden}
.workbench .tile {aspect-ratio:auto; min-width:0; min-height:0}
.controls {width:var(--side); display:grid; gap:8px}
.controls .stats {display:grid; gap:5px; margin-bottom:5px}
.controls .stats span {display:flex; justify-content:space-between; align-items:center}
.controls button {margin:0; width:100%; font-weight:600}
.controls button:last-child:not(.primary) {background:transparent}
dialog {width:min(420px,92vw); border:1px solid #565d80; border-radius:18px; padding:26px; background:#20243c; color:#f4f6ff; box-shadow:0 18px 70px #0008}
dialog::backdrop {background:#080b1abd; backdrop-filter:blur(3px)}
dialog h2 {font-size:26px}
dialog p {color:var(--muted)}
.dialog-actions {display:flex; justify-content:flex-end; gap:10px}
.dialog-actions .primary {margin:0; width:auto; padding:11px 16px}
@media(max-width:620px) and (orientation:portrait) {
 .game {gap:8px}
 .game .heading {gap:6px}
 .game .stats {gap:4px; font-size:14px}
 .game .stats span {padding:3px 6px}
 .game .rules {font-size:14px}
 .workbench {flex-direction:column; gap:8px}
 .workbench .grid {width:min(100%,calc((100cqh - 120px) * var(--cols) / var(--rows)),calc(var(--cols) * 90px))}
 .controls {width:100%; grid-template-columns:repeat(3,1fr); gap:4px}
 .controls .stats {grid-column:1 / -1; grid-template-columns:1fr 1fr}
 .controls button {font-size:14px; padding:7px 3px; line-height:1.2}
}
@media(max-height:520px) {
 .game {gap:5px; padding:5px 0}
 .game-info,.heading {gap:4px}
 .game .rules {font-size:14px; padding:3px 8px}
 .game .eyebrow {margin:0}
 .game .stats span {padding:2px 6px}
 .controls button {padding:6px}
}
