* { box-sizing: border-box }
:root { color-scheme: light; font-family: system-ui, -apple-system, sans-serif; background: #b5a7d9; color: #4d356e; }
html, body, main { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
main { position: relative; isolation: isolate; touch-action: none; background: radial-gradient(ellipse at 48% 29%, #c6b9e7 0, #b9abdc 53%, #a798ce 100%); }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; z-index: 1; cursor: grab; }
#world:active { cursor: grabbing; }
#world:focus { outline: none; }
#progress { position: absolute; z-index: 2; pointer-events: none; left: 50%; transform: translateX(-50%); top: max(5.5%, calc(env(safe-area-inset-top) + 14px)); width: min(71%, 410px); height: clamp(4px, .62vh, 6px); border-radius: 50px; background: #fff0dc; box-shadow: 0 1px 2px #62447a19; overflow: hidden; }
#progress i { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(#a45ef1, #7a30cb); transform: scaleX(0); transform-origin: left; transition: transform 110ms linear; }
footer { position: absolute; bottom: max(calc(env(safe-area-inset-bottom) + 18px), 3.2%); left: 50%; transform: translateX(-50%); width: max-content; z-index: 3; pointer-events: none; }
#tools { display: flex; gap: clamp(12px, 3.15vw, 20px); padding: 4px; justify-content: center; }
#tools button { position: relative; width: clamp(70px, 23vw, 107px); height: auto; aspect-ratio: 1; pointer-events: auto; border: 1px solid #fff5e7; border-radius: 25%; background: radial-gradient(ellipse at 35% 12%, #fff6eb, #f8e8d5 75%, #f2dec5); box-shadow: inset 0 -3px 2px #bca0802c, inset 0 2px 2px #fffcf6, 0 9px 13px #6543943c; cursor: grab; padding: 0; outline: 0 solid transparent; touch-action: none; transition: outline-color 120ms, transform 120ms, box-shadow 120ms; }
#tools button canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
#tools button:hover, #tools button:focus-visible { outline: 3px solid #a45cde; }
#tools button[aria-pressed="true"] { outline: 4px solid #9945e6; transform: scale(1.035); cursor: grabbing; box-shadow: 0 8px 12px #7540a977; }
#tools button[aria-pressed="true"] canvas { opacity: .32; }
#instructions { position: absolute; white-space: nowrap; bottom: -14px; left: 50%; transform: translateX(-50%); margin: 0; font-size: 11px; font-weight: 550; letter-spacing: .015em; color: #4b3567; transition: opacity .35s; }
#instructions.dismissed { opacity: 0; }
dialog { background: #fff0de; color: #4d356e; padding: 25px 32px 27px; border: 1px solid white; border-radius: 26px; text-align: center; box-shadow: 0 14px 55px #3d245c43; }
dialog::backdrop { background: #6e48902a; }
dialog h2 { margin: 0 0 17px; font-size: 24px; }
#again { font: inherit; font-weight: 650; color: #fff; background: #7743aa; border: 0; border-radius: 999px; min-height: 43px; padding: 7px 21px; cursor: pointer; }
#again:focus-visible { outline: 3px solid #ae74e5; outline-offset: 3px; }
#failure { position: absolute; padding: 16px; background: #fff0de; border-radius: 16px; top: 44%; left: 50%; transform: translateX(-50%); z-index: 4; text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (min-aspect-ratio: 1/1) { #tools button { width: clamp(58px, 11vh, 96px); } footer { bottom: max(3.3%, 22px); } }
@media (max-height: 430px) { #progress { top: max(4%, 8px); } footer { bottom: 16px; } #tools button { width: 50px; } }
@media (prefers-reduced-motion: reduce) { *, *::before { transition-duration: 0s!important; } }
#sound { position: absolute; bottom: max(6px, calc(env(safe-area-inset-bottom) + 4px)); right: max(8px, calc(env(safe-area-inset-right) + 4px)); z-index: 3; display: grid; place-items: center; width: 34px; height: 34px; color: #5b447b; border: 0; background: transparent; opacity: .68; border-radius: 50%; cursor: pointer; }
#sound:hover, #sound:focus-visible { opacity: 1; background: #fff5e745; }
#sound svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; fill: none; }
#sound .mute, #sound[aria-pressed="true"] .wave { display: none; }
#sound[aria-pressed="true"] .mute { display: inline; }
