:root { color-scheme: dark; --ink: #f4f7ff; --accent: #ffcf4a; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0b1026; overflow: hidden; overscroll-behavior: none; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
#stage { position: fixed; inset: 0; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#hud { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.stat { display: flex; flex-direction: column; }
.stat.right { align-items: flex-end; margin-right: 52px; }
.label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.stat span:last-child { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
#mute { position: absolute; right: 0; top: 0; pointer-events: auto; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: var(--ink); font-size: 18px; cursor: pointer; backdrop-filter: blur(6px); }
#mute:hover { background: rgba(255,255,255,.22); }

.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; pointer-events: none; text-shadow: 0 3px 16px rgba(0,0,0,.55); transition: opacity .25s ease; }
.overlay.hidden, #hud.hidden, .badge.hidden { opacity: 0; visibility: hidden; }
h1 { font-size: clamp(44px, 11vw, 88px); margin: 0; font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: clamp(36px, 9vw, 64px); margin: 0; font-weight: 900; color: #ff7a6b; }
.sub { font-size: clamp(16px, 3.5vw, 22px); opacity: .85; margin: 6px 0 28px; }
.cta { font-size: 16px; font-weight: 700; color: var(--accent); animation: pulse 1.4s ease-in-out infinite; margin: 18px 0 6px; }
.best-line { opacity: .75; margin: 4px 0; }
.result { display: flex; flex-direction: column; margin-top: 8px; }
.result span { font-size: clamp(56px, 14vw, 96px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.result small { letter-spacing: .16em; text-transform: uppercase; opacity: .7; }
.badge { background: var(--accent); color: #2a2000; font-weight: 800; padding: 5px 14px; border-radius: 99px; margin: 12px 0 0; text-shadow: none; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.97); } }
@media (prefers-reduced-motion: reduce) { .cta { animation: none; } }

.nick-wrap { display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .95; }
#nick { pointer-events: auto; width: min(260px, 80vw); padding: 12px 14px; font: inherit; font-size: 18px; letter-spacing: 0; text-transform: none; text-align: center; color: var(--ink); background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.25); border-radius: 12px; outline: none; backdrop-filter: blur(6px); user-select: text; -webkit-user-select: text; }
#nick:focus { border-color: var(--accent); }
#nick.bad { border-color: #ff7a6b; animation: shake .3s; }
#play { pointer-events: auto; margin-top: 14px; padding: 12px 44px; font: inherit; font-size: 18px; font-weight: 800; color: #2a2000; background: var(--accent); border: 0; border-radius: 99px; cursor: pointer; box-shadow: 0 6px 20px rgba(255,207,74,.3); }
#play:hover { filter: brightness(1.08); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.lb { width: min(320px, 90vw); margin-top: 10px; padding: 10px 14px; background: rgba(8,10,30,.55); border-radius: 14px; backdrop-filter: blur(6px); text-shadow: none; }
.lb h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; opacity: .7; }
.lb ol { list-style: none; margin: 0; padding: 0; text-align: left; font-size: 14px; }
.lb li { display: flex; gap: 10px; padding: 3px 6px; border-radius: 6px; }
.lb li.you { background: rgba(255,207,74,.22); color: var(--accent); font-weight: 700; }
.lb .pos { width: 1.6em; opacity: .6; }
.lb .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .sc { font-variant-numeric: tabular-nums; }
#boardNote { margin: 6px 0 0; font-size: 12px; opacity: .7; }
@media (max-height: 640px) { .result span { font-size: 48px; } h2 { font-size: 32px; } .lb { margin-top: 4px; } .lb li { padding: 1px 6px; font-size: 13px; } .cta { margin: 8px 0 0; } }
