:root { color-scheme: dark; font-family: PixelLocal, monospace; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: grid; place-items: center; overflow: hidden; background: #05070a; }
button, input { font: inherit; }
#game-shell { position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; background: rgb(4 10 17 / 82%); text-align: center; z-index: 2; }
.panel { width: min(94%, 370px); padding: 18px; border: 3px solid #f1d36c; background: #132235; box-shadow: 5px 5px 0 #060b12; }
.panel h1 { margin: 0 0 14px; color: #f1d36c; font-size: 18px; line-height: 1.45; }
.panel p { font-size: 10px; line-height: 1.7; }
.panel input { width: 100%; margin: 8px 0 12px; padding: 10px; border: 2px solid #6ab5d8; color: #fff; background: #07111d; text-align: center; outline: none; }
button { border: 2px solid #f4e5a1; padding: 10px 12px; color: #09111a; background: #f1d36c; cursor: pointer; text-transform: uppercase; }
button:focus-visible, input:focus-visible { outline: 3px solid #fa7d58; outline-offset: 2px; }
button + button { margin-left: 8px; }
.error { min-height: 18px; color: #fa9274; font-size: 9px; }
.progress { height: 12px; margin-top: 12px; border: 2px solid #b8d8e7; }
.progress > span { display: block; height: 100%; background: #62c68b; }
.icon-button { position: absolute; top: 8px; right: 8px; z-index: 4; min-width: 34px; padding: 6px; font-size: 8px; }
.milestone { position: absolute; top: 12px; left: 50%; z-index: 3; display: flex; align-items: center; gap: 10px; width: max-content; max-width: 90%; padding: 8px 12px; border: 2px solid #fff3b0; background: #253b4e; color: #fff; font-size: 9px; transform: translateX(-50%); animation: milestone-in 180ms ease-out, milestone-out 180ms ease-in 2320ms forwards; }
.milestone img { width: 40px; height: 40px; image-rendering: pixelated; }
@keyframes milestone-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes milestone-out { to { opacity: 0; transform: translate(-50%, -10px); } }
#touch-controls { position: absolute; inset: auto 0 8px; z-index: 3; display: flex; justify-content: space-between; padding: 0 12px; pointer-events: none; }
#touch-controls button { width: 42%; min-height: 54px; opacity: .72; pointer-events: auto; touch-action: none; user-select: none; -webkit-touch-callout: none; }
.rotate { z-index: 6; font-size: 15px; }
.scores { max-height: 145px; margin: 12px 0; overflow: auto; text-align: left; font-size: 9px; line-height: 1.8; }
.score-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 5px; }
.score-row.own { color: #f1d36c; }
@media (pointer: coarse) and (orientation: portrait) { #game-shell { width: 100vw; } }