:root { color-scheme: dark; font-family: Inter, system-ui, sans-serif; background:#09111d; color:#fff; }
* { box-sizing:border-box; }
html,body { width:100%; min-height:100%; margin:0; overscroll-behavior:none; }
body { min-height:100dvh; display:grid; place-items:center; padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); background:radial-gradient(circle at top,#183552,#09111d 65%); }
.shell { width:min(100%,430px); display:grid; gap:10px; }
header,footer { display:flex; justify-content:space-between; align-items:center; letter-spacing:.08em; }
header img { display:block; width:170px; height:42px; object-fit:contain; object-position:left center; } header span,footer { color:#91a5bb; font-size:.72rem; }
.game-wrap { position:relative; width:100%; aspect-ratio:9/16; max-height:calc(100dvh - 110px); margin:auto; border:2px solid #31cfff; border-radius:18px; overflow:hidden; box-shadow:0 0 18px #19bfff55,0 24px 70px #000a,inset 0 0 16px #19bfff22; touch-action:none; user-select:none; }
canvas { display:block; width:100%; height:100%; background:#030a13; }
#score { position:absolute; inset:28px 0 auto; text-align:center; font:800 42px/1 system-ui; color:#ffe100; text-shadow:0 0 8px #ffe600,0 0 18px #ffe60088; pointer-events:none; transform-origin:center; will-change:transform,opacity; }
body:not(.playing) #score { display:none; }
.overlay { position:absolute; inset:0; display:grid; place-content:center; justify-items:center; padding:28px; text-align:center; background:#000e; backdrop-filter:blur(3px); }
.overlay > section { width:100%; display:grid; place-items:center; }
.auth-panel[hidden],#game-menu[hidden],.auth-panel form[hidden],.leaderboard-panel[hidden] { display:none!important; }
.overlay.hidden { display:none; } h1 { margin:0 0 8px; font-size:1.55rem; } p { color:#d2dfeb; min-height:2.5em; }
.start-mark { width:96px; height:96px; margin-bottom:14px; filter:drop-shadow(0 0 14px #19bfff66); }
h1 { color:#eafaff; text-shadow:0 0 12px #31cfff55; letter-spacing:.04em; }
.result-card { width:min(100%,270px); display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:8px 0 22px; padding:16px; border:1px solid #31cfff; border-radius:16px; background:linear-gradient(145deg,#102a43dd,#02070df2); box-shadow:0 0 20px #19bfff44,inset 0 0 16px #19bfff18; }
.result-card[hidden] { display:none; }
.result-card div { display:grid; gap:5px; padding:9px; border-radius:10px; background:#02070d99; }
.result-card span { color:#75dcff; font-size:.64rem; letter-spacing:.14em; }
.result-card strong { color:#ffe100; font-size:2rem; line-height:1; text-shadow:0 0 10px #ffe600aa; }
.result-card small { grid-column:1/-1; color:#b8cbd9; }
.result-card .verified-badge { color:#75dcff; padding-top:8px; border-top:1px solid #31cfff44; letter-spacing:.09em; text-shadow:0 0 8px #19bfff88; }
.attempts-left { min-height:0; margin:-8px 0 18px; color:#5bdcff; font-size:.72rem; font-weight:700; letter-spacing:.06em; text-shadow:0 0 8px #19bfff77; }
.prize-card { width:min(100%,265px); display:grid; gap:3px; margin:0 0 17px; padding:11px 15px; border:1px solid #f4d900; border-radius:13px; background:linear-gradient(135deg,#332d00aa,#0b1119); box-shadow:0 0 18px #ffe60033,inset 0 0 14px #ffe60014; }
.prize-card span { color:#fff18a; font-size:.58rem; font-weight:800; letter-spacing:.12em; }
.prize-card strong { color:#ffe100; font-size:1.45rem; text-shadow:0 0 11px #ffe600aa; }
.prize-card small { color:#879baa; font-size:.58rem; }
button { border:1px solid #fff86a; border-radius:999px; padding:14px 22px; background:#ffe100; color:#02070d; font:800 1rem system-ui; cursor:pointer; box-shadow:0 0 14px #ffe600aa,0 5px 0 #806f00; }
button:active { transform:translateY(3px); box-shadow:0 0 10px #ffe60088,0 2px 0 #806f00; }
.secondary-button { margin-top:14px; border-color:#31cfff; background:#071827; color:#7de4ff; box-shadow:0 0 12px #19bfff55,0 4px 0 #08374a; }
.secondary-button:active { box-shadow:0 0 8px #19bfff44,0 1px 0 #08374a; }
.auth-panel { width:min(100%,310px)!important; }
.auth-panel .start-mark { width:72px; height:72px; margin-bottom:8px; }
.eyebrow { min-height:0; margin:0 0 8px; color:#56d7ff; font-size:.68rem; font-weight:800; letter-spacing:.22em; }
.auth-panel h1 { margin-bottom:2px; }
.profile-panel h1 { margin-bottom:2px; }
.auth-panel > p:not(.eyebrow) { margin:8px 0 18px; font-size:.88rem; }
.auth-panel form { width:100%; display:grid; gap:10px; }
.auth-panel label { text-align:left; color:#65d9ff; font-size:.66rem; font-weight:800; letter-spacing:.16em; }
.auth-panel input { width:100%; border:1px solid #31cfff; border-radius:12px; padding:14px 15px; outline:0; background:#071421; color:#fff; font:600 1rem system-ui; box-shadow:inset 0 0 14px #19bfff12,0 0 12px #19bfff22; }
.auth-panel input:focus { border-color:#93e9ff; box-shadow:inset 0 0 14px #19bfff20,0 0 18px #19bfff66; }
.auth-panel input::placeholder { color:#60788d; }
.auth-panel .code-input { text-align:center; font-size:1.45rem; letter-spacing:.35em; padding-left:calc(15px + .35em); }
.auth-panel button[type="submit"] { width:100%; margin-top:4px; }
.text-button { border:0; padding:8px; background:none; color:#79dfff; font-size:.78rem; font-weight:700; box-shadow:none; text-decoration:underline; text-underline-offset:3px; }
.text-button:active { transform:none; box-shadow:none; }
.dev-skip { margin-top:14px; color:#8197a9; }
.footer-action { border:0; padding:0; background:none; color:#54d9ff; font-size:.72rem; box-shadow:none; text-decoration:underline; }
.footer-action:active { transform:none; box-shadow:none; }
.leaderboard-panel { width:min(100%,320px)!important; }
.leaderboard-panel h1 { margin-bottom:2px; }
.tournament-countdown { min-height:0; margin:7px 0 15px; color:#91a5bb; font-size:.72rem; }
.leaderboard-fund { width:100%; margin:0 0 10px; padding:9px; border:1px solid #ccb900; border-radius:9px; background:#24200077; color:#ffe86a; font-size:.68rem; font-weight:700; }
.leaderboard-list { width:100%; max-height:330px; overflow:auto; margin:0 0 14px; padding:0; list-style:none; display:grid; gap:7px; }
.leaderboard-list li { min-height:42px; display:grid; grid-template-columns:36px 1fr auto; align-items:center; gap:8px; padding:8px 12px; border:1px solid #174762; border-radius:10px; background:#06131f; text-align:left; }
.leaderboard-list li strong { width:27px; height:27px; display:grid; place-items:center; border-radius:50%; background:#0d2c42; color:#6ce0ff; }
.leaderboard-list li:nth-child(1) strong { background:#ffe100; color:#07111a; box-shadow:0 0 10px #ffe60088; }
.leaderboard-list li span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#e8f7ff; font-size:.82rem; }
.leaderboard-list li b { color:#ffe100; font-size:1rem; text-shadow:0 0 8px #ffe60088; }
.leaderboard-list .loading-row { display:block; padding:18px; color:#91a5bb; text-align:center; }
.my-rank { width:100%; margin-bottom:10px; padding:10px; border:1px solid #31cfff; border-radius:10px; color:#77e2ff; background:#0b2639; font-size:.78rem; font-weight:700; }
footer { color:#54d9ff; text-shadow:0 0 8px #19bfff88; }
@media (max-height:620px) { header { display:none; } .game-wrap { max-height:calc(100dvh - 55px); } }

body.playing { padding:0; overflow:hidden; background:#09111d; }
body.playing .shell { width:100%; height:100dvh; display:grid; place-items:center; gap:0; }
body.playing header, body.playing footer { display:none; }
body.playing .game-wrap { width:min(100vw,calc(100dvh * 9 / 16)); height:min(100dvh,calc(100vw * 16 / 9)); max-height:none; margin:0; border:0; border-radius:0; box-shadow:none; }

@media (orientation:portrait) and (max-aspect-ratio:9/16) {
  body.playing .game-wrap { width:100vw; height:calc(100vw * 16 / 9); }
}
