*{box-sizing:border-box}
[hidden]{display:none!important}
:root{color-scheme:dark;--ink:#e9edff;--muted:#a6b1cf;--night:#0b1022;--panel:#17203b;--blue:#83dfff;--amber:#ffc479}
body{margin:0;background:radial-gradient(ellipse at 50% -15%,#283454,var(--night) 62%);color:var(--ink);font-family:system-ui,sans-serif;min-height:100vh}
main{width:min(100% - 32px,680px);margin:auto;padding:32px 0 24px}
header,.toolbar,.legend{display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap}
header{border-bottom:1px solid #435074;padding-bottom:13px;color:var(--muted);font:600 .78rem monospace}
.wordmark{color:#c9d8ff;letter-spacing:.18em}
h1{font-size:clamp(2.3rem,7vw,4.5rem);letter-spacing:-.07em;line-height:1;margin:24px 0 8px}
p{color:var(--muted);line-height:1.5;margin:8px 0 16px}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-bottom:9px}
.stats div{background:var(--panel);padding:8px 12px;border-radius:7px}
.stats span,.legend{font:.72rem monospace;color:var(--muted)}
.stats strong{display:block;font-size:1.1rem}
[data-phase=blue]{color:var(--blue)}[data-phase=amber]{color:var(--amber)}
#board{display:grid;grid-template-columns:repeat(var(--columns),1fr);gap:4px;border:1px solid #445174;border-radius:12px;padding:7px;background:#0b1226}
.tile{background:#202d50;min-width:0;min-height:28px;height:clamp(30px,8vw,52px);display:grid;place-items:center;border-radius:5px;color:#b2f297;font-weight:bold;font-size:clamp(.95rem,3vw,1.55rem)}
.tile.wall{background:repeating-linear-gradient(135deg,#0e162b,#0e162b 6px,#151e37 6px,#151e37 12px)}
.tile.depot{color:#faf1b3;border:1px dashed #c6b76e}
.tile.gate{border:1px solid currentColor}
.tile.blue{color:var(--blue);background:#214059}
.tile.amber{color:var(--amber);background:#513827}
.tile.gate.open{background:#202d50;border-style:dashed}
.tile.cart{color:#0d1b35;background:#d0e2ff;box-shadow:inset 0 0 0 2px #809ae1}
#map-text{margin:6px 0 10px;padding-left:1.8em;color:var(--muted);line-height:1.45}
details{margin-top:8px}
summary{cursor:pointer;color:var(--ink)}
summary:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
#status{min-height:1.5em;margin:8px 0 10px;color:var(--ink)}
.controls,.actions{display:flex;flex-wrap:wrap;gap:5px}
button{border:1px solid #495b86;background:#232f51;color:var(--ink);min-height:42px;min-width:42px;border-radius:6px;padding:7px 11px;font:inherit;font-weight:650;cursor:pointer}
button:hover{background:#354871}button:focus-visible{outline:2px solid var(--blue);outline-offset:2px}button:disabled{opacity:.47;cursor:default}
#advance{background:#c4deff;color:#0d1b35}
.legend{margin-top:15px;justify-content:flex-start}
footer{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 16px;margin-top:18px;padding-top:10px;border-top:1px solid #435074;color:var(--muted);font-size:.8rem}
footer a{display:inline-block;padding:4px 0;color:var(--blue);text-underline-offset:3px}
footer a:focus-visible{outline:2px solid var(--blue);outline-offset:3px}
@media(max-width:380px){main{padding-top:16px}.stats div{padding:7px}.legend{gap:7px}}
