* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { background: #141a33; color: #fff; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
#app { --ink: #1d2a5c; --gold: #ffd23a; --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); position: fixed; inset: 0; width: min(100vw, calc(100dvh * 9 / 16)); margin: auto; overflow: hidden; background: #153c38; }
[hidden] { display: none !important; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; font-size: 19px; font-weight: 900; line-height: 1.2; min-height: 52px; border: 0; border-radius: 16px; cursor: pointer; touch-action: manipulation; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 12px 18px; background: #e9ecf5; color: var(--ink); box-shadow: 0 4px 0 #bbc2d8; transition: transform .08s, box-shadow .08s; }
button svg { width: 23px; height: 23px; flex: none; }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #bbc2d8; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
button:disabled { cursor: default; opacity: .55; }
.primary { background: #2fae55; color: white; min-height: 62px; font-size: 25px; font-weight: 900; box-shadow: 0 5px 0 #1d7a3a, 0 8px 18px #0003; }
.primary:active:not(:disabled) { box-shadow: 0 1px 0 #1d7a3a; transform: translateY(4px); }
.chip { min-height: 46px; border-radius: 24px; padding: 10px 15px; font-size: 15px; font-weight: 800; background: #1d2a5ce8; color: white; box-shadow: 0 3px 0 #0e173e; }
.chip:active:not(:disabled) { box-shadow: 0 1px 0 #0e173e; transform: translateY(2px); }
#start { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; align-items: center; text-align: center; padding: calc(var(--safe-top) + 42px) 24px calc(var(--safe-bottom) + 28px); background: linear-gradient(#141a33b8, #141a3314 35%, #141a3320 50%, #141a33ee), url('menu.jpg') center/cover; }
.start-title { text-shadow: 0 3px 0 #111a3c, 0 4px 15px #0008; }
h1 { font-size: clamp(50px, 16vw, 70px); font-weight: 900; letter-spacing: -2px; line-height: .91; margin: 0; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
h1 span { display: block; color: var(--gold); }
.start-title p { font-size: 16px; line-height: 1.4; font-weight: 800; margin: 12px 0 0; }
.start-actions { width: min(330px, 100%); }
.start-stats { display: flex; justify-content: center; gap: 10px; align-items: center; margin-bottom: 14px; }
.start-stats p { margin: 0; background: #1d2a5cdb; border-radius: 22px; padding: 8px 12px; font-weight: 800; font-size: 14px; }
#coins { display: inline-flex; align-items: center; gap: 7px; color: var(--gold); }
#coins::before, .coin { content: ''; display: inline-block; width: 20px; height: 20px; border-radius: 50%; flex: none; background: radial-gradient(circle, #ffe994 0 22%, #efb821 25% 55%, #ffda5a 59% 74%, #c48a00 78%); box-shadow: 0 1px 2px #0005; }
#play { width: 100%; font-size: 28px; }
#play svg { width: 26px; height: 26px; }
.start-how { margin: 12px 0 16px; font-size: 14px; font-weight: 800; text-shadow: 0 2px 2px #111a3c; }
.menu-actions { display: flex; gap: 10px; justify-content: center; }
.menu-actions button { flex: 1; padding-inline: 10px; }
#offline-status, .save-status { font-size: 12px; line-height: 1.4; margin: 8px 0 0; }
#offline-status:empty, .save-status:empty { display: none; }
#hud { position: absolute; inset: 0; padding: calc(var(--safe-top) + 12px) 12px 0; pointer-events: none; }
#hud-panel { padding: 10px 12px 12px; border-radius: 22px; background: #1d2a5cf2; border: 1px solid #ffffff55; box-shadow: 0 5px 0 #101a3e80, 0 7px 18px #0002; }
.hud-top { display: grid; grid-template-columns: 48px 1fr 88px; gap: 12px; align-items: center; }
#pause-button { min-height: 48px; width: 48px; padding: 0; border-radius: 50%; pointer-events: auto; color: var(--ink); background: #fff; box-shadow: 0 3px 0 #a8b3d1; }
#pause-button:active { box-shadow: 0 1px 0 #a8b3d1; }
.hud-time, .hud-size { text-align: center; }
.hud-label { display: block; font-size: 10px; font-weight: 800; letter-spacing: 1px; color: #c1c9e5; }
#timer { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
#timer.urgent { color: #ff947f; }
#player-size { font-size: 22px; color: var(--gold); font-weight: 900; font-variant-numeric: tabular-nums; }
#sizes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #ffffff25; }
.size { --rim: #ffd23a; display: grid; grid-template-columns: 1fr; gap: 3px; font-size: 11px; font-weight: 800; text-align: center; }
.size-1 { --rim: #df8da8; } .size-2 { --rim: #6196ac; } .size-3 { --rim: #70c798; }
.size span:first-child { color: var(--rim); } .size span:last-child { font-size: 14px; font-variant-numeric: tabular-nums; }
.size meter { order: 2; width: 100%; height: 5px; background: #ffffff25; border-radius: 4px; border: 0; }
.size meter::-webkit-meter-bar { background: #ffffff25; border: 0; border-radius: 4px; }
.size meter::-webkit-meter-optimum-value { background: var(--rim); border-radius: 4px; }
.size meter::-moz-meter-bar { background: var(--rim); border-radius: 4px; }
#drag-hint { position: absolute; bottom: calc(var(--safe-bottom) + 20px); left: 50%; transform: translateX(-50%); display: flex; gap: 7px; align-items: center; width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 15px; border-radius: 24px; background: #1d2a5ce8; color: white; font-size: 14px; font-weight: 800; box-shadow: 0 3px 0 #101a3e50; }
#drag-hint svg { width: 21px; height: 21px; }
#respawn, #asset-status { margin: 10px auto 0; padding: 8px 14px; border-radius: 14px; background: #1d2a5ceb; width: fit-content; max-width: 100%; text-align: center; font-size: 15px; font-weight: 800; }
#respawn:empty, #asset-status:empty { display: none; }
#result, #pause, #shop { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(var(--safe-top) + 20px) 22px calc(var(--safe-bottom) + 20px); background: #0e12288f; }
#shop { background: linear-gradient(#141a33d9, #141a33d9), url('menu.jpg') center/cover; }
.card { width: min(340px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 24px 22px; border-radius: 26px; background: #fffdf7; color: var(--ink); text-align: center; box-shadow: 0 12px 40px #0006; }
.card h2 { margin: 0; font-size: 30px; line-height: 1.05; font-weight: 900; letter-spacing: -.7px; }
.card p { font-size: 14px; color: #616982; line-height: 1.4; }
.card button { width: 100%; font-weight: 900; margin-top: 14px; font-size: 18px; }
.card .primary { font-size: 23px; margin-top: 18px; }
.card-mark { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: #fff0b2; color: #ae7c00; }
.card-mark svg { width: 29px; height: 29px; }
#place { display: inline-grid; place-items: center; border: 5px solid #ffe693; border-radius: 50%; width: 90px; height: 90px; margin: 0 0 16px; color: var(--ink); background: var(--gold); box-shadow: 0 4px 0 #d3a914; font-size: 42px; font-weight: 900; line-height: 1; }
#earned { margin: 12px 0 0; font-weight: 800; color: var(--ink); }
#bonus-box { border-radius: 12px; background: #fff0b2; padding: 10px; margin: 10px 0 0; }
#bonus { font-size: 15px; color: var(--ink); margin: 0; font-weight: 900; }
#bonus-seconds { display: block; color: #806523; font-size: 12px; margin-top: 2px; }
#result-coins { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 900; font-size: 17px; color: var(--ink); margin: 12px 0 0; }
#ranking { counter-reset: rank; padding: 0; margin: 18px 0 0; list-style: none; text-align: left; }
#ranking li { counter-increment: rank; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; font-size: 14px; font-weight: 800; }
#ranking li::before { content: counter(rank); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #e8ebf4; font-size: 12px; }
#ranking .you { background: #fff0b2; } #ranking .you::before { background: var(--gold); }
#ranking strong { margin-left: auto; font-variant-numeric: tabular-nums; }
#wallet { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; background: #fff0b2; color: var(--ink); font-weight: 900; border-radius: 22px; margin: 12px 0 0; }
.card .skin { min-height: 70px; display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 16px; background: #edf0f8; box-shadow: 0 3px 0 #c9d0e3; margin-top: 10px; }
.skin-preview { display: block; width: 48px; height: 29px; border: 6px solid #ffcf55; border-radius: 50%; background: #071b1a; box-shadow: 0 4px 0 #112745; }
.skin-lotus .skin-preview { border: 7px dotted #df8da8; } .skin-tiles .skin-preview { border: 6px dashed #6196ac; }
.skin-neon .skin-preview { border-color: #70c798; box-shadow: 0 0 7px #49d49a, 0 4px 0 #112745; }
.skin-name { font-size: 17px; } .skin-price { display: block; font-size: 12px; font-weight: 700; color: #616982; margin-top: 3px; }
.skin-state { font-size: 12px; font-weight: 900; color: #285d3a; }
.skin[aria-pressed='true'] { opacity: 1; background: #e0f4dd; box-shadow: 0 3px 0 #96c48d; }
#shop-status { min-height: 20px; margin: 10px 0 0; }
.number-pop { position: absolute; z-index: 3; pointer-events: none; color: white; text-shadow: 0 2px 0 #1d2a5c, 0 1px 4px #1d2a5c; font-size: 20px; font-weight: 900; white-space: nowrap; animation: float-pop .65s ease-out forwards; }
@keyframes float-pop { from { transform: translate(-50%, -50%) scale(.7); opacity: 1; } 20% { transform: translate(-50%, -70%) scale(1.15); } to { transform: translate(-50%, -160%); opacity: 0; } }
#result:not([hidden]) .card { animation: card-pop .25s cubic-bezier(.2, 1.5, .5, 1); }
@keyframes card-pop { from { transform: scale(.7); } to { transform: scale(1); } }
#debug { position: absolute; bottom: 4px; left: 6px; padding: 4px; border-radius: 5px; color: white; background: #071b1ae6; font: 11px monospace; pointer-events: none; }
@media (pointer: coarse) and (orientation: portrait) { #app { width: 100vw; } }
@media (max-height: 700px) { #start { padding-top: calc(var(--safe-top) + 24px); padding-bottom: calc(var(--safe-bottom) + 20px); } h1 { font-size: 50px; } .start-title p { font-size: 14px; margin-top: 8px; } .card { padding: 20px 18px; } #place { width: 68px; height: 68px; font-size: 32px; margin-bottom: 12px; } #ranking { margin-top: 12px; } #ranking li { padding-block: 5px; } }
@media (prefers-reduced-motion: reduce) { .number-pop, #result .card { animation: none !important; } button { transition: none; } }
