:root{color-scheme:dark;font-family:system-ui,-apple-system,sans-serif;background:#10172c;color:#fff4dc;--muted:#a9b5cb;--ink:#13192a;--gold:#ffce83}
*{box-sizing:border-box}
body{margin:0;min-height:100dvh;background:radial-gradient(ellipse at 50% 20%,#2c3153 0%,#10172c 68%);padding:0 12px}
.game{width:min(100%,760px);margin:auto;padding:14px 0 16px}
header,footer,.title{display:flex;align-items:center;justify-content:space-between;gap:12px}
header a{color:var(--muted);font-size:.875rem;text-decoration:none}
header a:hover{text-decoration:underline}
header .brand{color:#fff4dc;font-weight:800}
.brand span{color:#9ff4f2;margin-right:4px}
.title{padding:9px 0 10px;flex-wrap:wrap;gap:2px;align-items:baseline}
h1,h2,p{margin:0}
h1{font-size:clamp(1.4rem,4.5vw,2.4rem);font-weight:900;letter-spacing:-.05em}
.title p{color:var(--muted);font-size:.875rem}
.arena{position:relative;overflow:hidden;border:1px solid #536281;border-radius:20px;isolation:isolate;background:#252e50;box-shadow:0 20px 55px #080c19a0}
canvas{display:block;width:100%;height:auto;max-height:58dvh;aspect-ratio:1;object-fit:fill}
.hud{position:absolute;inset:10px 12px auto;display:flex;justify-content:space-between;gap:7px;pointer-events:none}
.hud div{display:grid;min-width:76px;padding:6px 11px;background:#141e38e6;border:1px solid #aaced139;border-radius:11px}
.hud div:last-child{text-align:right}
small{font-size:.68rem;letter-spacing:.1em;color:#adbace;font-weight:750}
strong,output{font-variant-numeric:tabular-nums}
.hud strong{font-size:1.04rem}
.fort-health{position:absolute;right:13px;bottom:15px;display:flex;gap:7px;align-items:center;background:#141e38ef;border:1px solid #aaced139;border-radius:8px;padding:5px 8px;font-size:.8rem}
meter{width:63px;height:12px;accent-color:#f9ad7d}
.feedback{position:absolute;left:12px;bottom:15px;max-width:45%;font-size:.8rem;color:#fce5cc;background:#141e38e6;padding:6px 8px;border-radius:7px;pointer-events:none}
.feedback:empty{display:none}
.controls{display:grid;grid-template-columns:1fr 1fr auto;align-items:center;gap:11px;padding:13px 0 4px}
label{display:grid;grid-template-columns:auto auto;gap:3px 4px;align-items:center;font-size:.89rem;font-weight:750;color:#c6d1e4}
output{justify-self:end;color:var(--gold)}
input{grid-column:span 2;width:100%;min-width:0;margin:0;height:29px;accent-color:#90e6e9;cursor:pointer}
button{border:0;border-radius:10px;background:var(--gold);color:var(--ink);font:800 1rem system-ui;cursor:pointer;min-height:48px;padding:0 22px}
button:active{transform:translateY(1px)}
button:disabled{opacity:.55;cursor:default}
:focus-visible{outline:2px solid #affbff;outline-offset:4px}
footer{padding-top:7px;color:var(--muted);font-size:.78rem}
footer strong{color:#fff4dc}
.overlay{position:absolute;z-index:2;inset:0;display:grid;place-items:center;background:#12192bd4;padding:20px}
.overlay[hidden]{display:none}
.result{max-width:295px;text-align:center;padding:24px;border:1px solid #637798;border-radius:16px;background:#1f2c47}
.result h2{font-size:1.5rem}
.result p{margin:7px 0 16px;color:#c4cce1}
@media(min-width:660px){canvas{aspect-ratio:640/540;max-height:65dvh}}
@media(max-width:420px){.controls{gap:7px}.controls button{padding:0 12px}.hud div{min-width:63px;padding:5px 8px}.fort-health{bottom:8px;right:8px}.feedback{bottom:8px;left:8px}}
.crew{display:flex;justify-content:space-between;align-items:center;gap:6px;flex-wrap:wrap;padding:9px 0 0}
.crew-group{display:flex;align-items:center;gap:4px}
.crew-group span{font-size:.73rem;color:var(--muted);margin-right:3px}
.crew button{padding:0 8px;min-height:34px;background:#243350;color:#dde7f4;border:1px solid #536281;font-size:.75rem}
.crew button[aria-pressed=true]{background:#9be7e5;color:#111a2b;border-color:#aef8ee}
.crew button:disabled{opacity:.55}
.terrain-name{position:absolute;top:66px;left:13px;font-size:.75rem;font-weight:800;letter-spacing:.04em;color:#e3def3;background:#141e38bf;padding:4px 8px;border-radius:6px}
