:root { --ink: #1b1b2f; --sun: #FFC52E; --red: #E8402A; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); --scoreR: 0px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f2a93b; overscroll-behavior: none; }
body { position: fixed; inset: 0; font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; color: #fff; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
#cv { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#row2 { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
#score { display: flex; align-items: center; gap: .1em; pointer-events: none; font-weight: 900; font-size: 1.5em; line-height: 1; color: #fff; text-shadow: 0 2px 0 rgba(27, 27, 47, .55); opacity: 0; transition: opacity .25s; font-variant-numeric: tabular-nums; margin-left: auto; }
#score svg { display: block; filter: drop-shadow(0 2px 0 rgba(27, 27, 47, .4)); }
html[data-streak="1"] #score { opacity: 1; }

#hud-btns { position: absolute; top: calc(var(--sat) + 8px); right: calc(var(--sar) + 10px); display: flex; gap: 8px; z-index: 5; opacity: .85; }
html[data-mode="play"] #hud-btns { opacity: .45; }
.ibtn { min-width: 46px; height: 46px; padding: 0 10px; border: 3px solid var(--ink); border-radius: 14px; background: rgba(255, 255, 255, .92); color: var(--ink); font: 900 16px "Trebuchet MS", system-ui, sans-serif; display: flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; }
.ibtn:focus-visible, #btn-replay:focus-visible { outline: 4px solid var(--sun); outline-offset: 2px; }
.ibtn svg { display: block; }

#ask { position: absolute; left: 0; right: var(--scoreR); top: 0; text-align: center; font-weight: 900; font-size: clamp(30px, 8vmin, 60px); letter-spacing: .02em; color: #fff; text-shadow: 0 3px 0 rgba(27, 27, 47, .7), 0 0 20px rgba(0, 0, 0, .35); pointer-events: none; opacity: 0; transition: opacity .25s; z-index: 2; }
html[data-ask="1"] #ask { opacity: 1; }
#goalbar { position: absolute; top: calc(var(--sat) + 8px); left: 10px; z-index: 5; pointer-events: none; background: rgba(27,27,47,.78); border: 2px solid rgba(255,255,255,.85); border-radius: 14px; padding: 5px 10px 6px; font-weight: 800; font-size: clamp(13px, 3.4vmin, 18px); color: #fff; line-height: 1.15; max-width: calc(100% - 140px); }
#goalbar b { color: #FFE27A; font-size: 1.15em; margin-left: .2em; }
#stars { margin-left: .5em; white-space: nowrap; }
#stars svg, #ovStars svg { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }
#ovStars { margin-left: 14px; white-space: nowrap; }
#shopdots { display: flex; gap: 5px; }
#shopdots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,.35); border: 2px solid #fff; }
#shopdots i.on { background: #FFD25A; }
#goal { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 24px 22px; background: radial-gradient(ellipse at center, rgba(242,169,59,.98), rgba(200,110,30,.98)); text-align: center; }
#goal[hidden] { display: none; }
#goalTxt { font-weight: 900; font-size: clamp(34px, 9vmin, 76px); line-height: 1.1; max-width: 16em; text-shadow: 0 4px 0 rgba(27,27,47,.5); }
#btn-play { display: flex; align-items: center; gap: 14px; padding: 14px 34px 14px 24px; border: 5px solid var(--ink); border-radius: 60px; background: var(--sun); color: var(--ink); font: 900 clamp(28px, 7vmin, 46px) "Trebuchet MS", system-ui, sans-serif; cursor: pointer; box-shadow: 0 7px 0 rgba(27,27,47,.55); animation: breathe 1.4s ease-in-out infinite; touch-action: manipulation; min-height: 64px; }
#btn-play:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }

#hint { position: absolute; left: 0; top: 0; width: 90px; height: 112px; pointer-events: none; display: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .4)); will-change: transform; z-index: 3; }
html[data-mode="ready"][data-first="1"] #hint { display: block; }

#over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(ellipse at center, rgba(40, 20, 10, .62), rgba(40, 20, 10, .38) 70%); z-index: 4; animation: fadein .35s ease-out; padding: calc(var(--sat) + 10px) 16px calc(var(--sab) + 10px); }
#over[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
#ovScore { display: flex; align-items: center; gap: .15em; font-weight: 900; font-size: clamp(70px, 18vmin, 140px); line-height: 1; color: #fff; text-shadow: 0 5px 0 rgba(27, 27, 47, .5), 0 0 30px rgba(255, 210, 80, .6); font-variant-numeric: tabular-nums; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#ovNew { min-height: 1.2em; font-weight: 900; font-size: clamp(20px, 5vmin, 30px); color: var(--sun); text-shadow: 0 2px 0 rgba(27, 27, 47, .6); letter-spacing: .04em; text-transform: uppercase; }
#ovBest { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: clamp(26px, 6vmin, 40px); text-shadow: 0 2px 0 rgba(27, 27, 47, .55); }
#btn-replay { width: clamp(84px, 18vmin, 112px); height: clamp(84px, 18vmin, 112px); margin-top: 8px; border-radius: 50%; border: 5px solid var(--ink); background: var(--sun); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 0 rgba(27, 27, 47, .55); animation: breathe 1.4s ease-in-out infinite; touch-action: manipulation; }
#btn-replay svg { width: 50%; height: 50%; margin-left: 6%; }

@media (min-aspect-ratio: 11/10) { :root { --scoreR: 36%; } #ask { font-size: clamp(24px, 6vmin, 40px); left: 250px; } }
@media (max-height: 460px) { #over { flex-direction: row; flex-wrap: wrap; gap: 6px 22px; } #ovScore { font-size: clamp(54px, 15vmin, 96px); } #ovNew { width: 100%; text-align: center; order: -1; min-height: 0; } }
html[data-rm="1"] #btn-play, html[data-rm="1"] #btn-replay { animation: none; }
@media (prefers-reduced-motion: reduce) { #btn-play, #btn-replay { animation: none; } }
