:root { --ink: #1b1b2f; --sun: #FFC52E; --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); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a2150; 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); }
button { font-family: inherit; }

#gauge { position: absolute; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 12px); display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 23px; background: rgba(14, 12, 40, .5); border: 2px solid rgba(255, 255, 255, .35); font-weight: 800; font-size: clamp(13px, 3.3vmin, 17px); text-shadow: 0 1px 2px rgba(0, 0, 0, .5); pointer-events: none; max-width: calc(100% - 140px); }
#gLabel { white-space: nowrap; flex: none; }
#gauge .bar { min-width: 28px; flex: 0 1 clamp(60px, 16vmin, 130px); height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .25); overflow: hidden; }
#gFill { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, #ffd96a, #ff9ed8); transition: width .5s ease-out; }
#gNum { flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
html[data-mode="goal"] #gauge { opacity: 0; }
#gauge.bump { animation: bump .35s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }

#hud-btns { position: absolute; top: calc(var(--sat) + 10px); right: calc(var(--sar) + 12px); display: flex; gap: 8px; z-index: 5; }
.ibtn { min-width: 46px; height: 46px; padding: 0 10px; border: 2px solid rgba(255, 255, 255, .5); border-radius: 23px; background: rgba(14, 12, 40, .5); color: #fff; font: 800 15px "Trebuchet MS", system-ui, sans-serif; display: flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; }
.ibtn:focus-visible, .dot:focus-visible, #btn-play:focus-visible { outline: 4px solid var(--sun); outline-offset: 2px; }

#dots { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 10px); display: flex; gap: 6px; padding: 4px 8px; border-radius: 32px; background: rgba(14, 12, 40, .42); z-index: 5; }
html[data-mode="goal"] #dots { opacity: 0; pointer-events: none; }
.dot { position: relative; width: 52px; height: 52px; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; touch-action: manipulation; color: #fff; }
.dot svg { width: 100%; height: 100%; display: block; }
.dot .ring { fill: none; stroke-width: 3.5; }
.dot .trk { stroke: rgba(255, 255, 255, .28); }
.dot .prg { stroke: #ffd96a; stroke-linecap: round; transition: stroke-dashoffset .5s ease-out; }
.dot.on { background: rgba(255, 255, 255, .18); }
.dot.locked { opacity: .45; cursor: default; }
.dot.pulse { animation: pulse 1s ease-in-out 4; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

#toast { position: absolute; left: 50%; top: 22%; transform: translate(-50%, -10px); padding: 12px 22px; border-radius: 28px; background: rgba(14, 12, 40, .72); border: 2px solid #ffd96a; font-weight: 900; font-size: clamp(18px, 4.6vmin, 30px); text-align: center; max-width: 90%; opacity: 0; pointer-events: none; transition: opacity .4s, transform .4s; z-index: 6; text-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#hint, #swhint { position: absolute; left: 50%; top: 36%; width: clamp(64px, 14vmin, 110px); height: clamp(80px, 17vmin, 135px); margin-left: calc(clamp(64px, 14vmin, 110px) / -2); pointer-events: none; display: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .4)); z-index: 3; }
html[data-mode="play"][data-first="1"] #hint { display: block; }
#hint .hand { transform-origin: 52px 40px; animation: tap 1.3s ease-in-out infinite; }
#hint .ripple { transform-origin: 52px 40px; animation: rip 1.3s ease-out infinite; }
@keyframes tap { 0%, 100% { transform: translateY(0) scale(1); } 40%, 60% { transform: translateY(10px) scale(.93); } }
@keyframes rip { 0%, 35% { opacity: 0; transform: scale(.5); } 50% { opacity: .95; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }
html[data-swipe="1"] #swhint { display: block; animation: swipe 1.8s ease-in-out infinite; top: 50%; }
@keyframes swipe { 0% { transform: translateX(60px); opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateX(-90px); opacity: 0; } }

#goal { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: calc(var(--sat) + 16px) 20px calc(var(--sab) + 16px); background: radial-gradient(ellipse at center, rgba(14, 12, 40, .55), rgba(14, 12, 40, .8)); }
html:not([data-mode="goal"]) #goal { display: none; }
#goal .card { display: flex; flex-direction: column; align-items: center; gap: clamp(14px, 3.5vmin, 26px); max-width: 640px; text-align: center; }
#goalText { margin: 0; font-weight: 900; font-size: clamp(26px, 6.4vmin, 46px); line-height: 1.18; text-shadow: 0 3px 0 rgba(27, 27, 47, .55), 0 0 26px rgba(255, 200, 80, .35); }
#btn-play { min-width: 190px; height: 64px; padding: 0 36px; border-radius: 32px; border: 4px solid var(--ink); background: var(--sun); color: var(--ink); font-weight: 900; font-size: 26px; letter-spacing: .06em; cursor: pointer; box-shadow: 0 6px 0 rgba(27, 27, 47, .55); animation: breathe 1.5s ease-in-out infinite; touch-action: manipulation; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

@media (max-height: 460px) { #goal .card { flex-direction: row; flex-wrap: wrap; justify-content: center; } #goalText { font-size: clamp(20px, 5vmin, 30px); flex-basis: 60%; } #hint { top: 30%; } #toast { top: 18%; } }
@media (max-width: 460px) { #gauge { gap: 6px; padding: 0 10px; font-size: 12px; } #gauge .bar { flex-basis: 34px; } }
@media (prefers-reduced-motion: reduce) { #btn-play, .dot.pulse { animation: none; } #hint .hand { animation-duration: 2.4s; } html[data-swipe="1"] #swhint { animation-duration: 3s; } }
