:root { --ink: #5a2448; --cream: #fff6ea; --berry: #ff3f7f; --lemon: #ffc42e; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bfe3ee center / cover no-repeat; font-family: "Trebuchet MS", system-ui, sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; }
canvas { display: block; touch-action: none; position: fixed; inset: 0; z-index: 0; }
#glass { position: fixed; inset: 0; z-index: 0; -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3); background: rgba(255, 255, 255, .22); }
[hidden] { display: none !important; }
button { font: inherit; font-weight: 800; border: 0; cursor: pointer; color: #fff; background: var(--berry); border-radius: 999px; box-shadow: 0 4px 0 #c92460; transition: transform .08s; }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #c92460; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button { pointer-events: auto; }
small { font-size: 12px; font-weight: 700; letter-spacing: .06em; opacity: .75; }
.pill { position: absolute; background: rgba(255, 246, 234, .9); border-radius: 18px; padding: 8px 16px; box-shadow: 0 4px 0 rgba(201, 36, 96, .25); display: flex; flex-direction: column; align-items: center; }
#score-box { top: max(12px, env(safe-area-inset-top)); left: 16px; min-width: 110px; }
#score { font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
#score.bump { animation: bump .22s; }
#progress-box { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(38vw, 340px); text-align: center; background: rgba(255, 246, 234, .9); border-radius: 16px; padding: 6px 14px 9px; box-sizing: border-box; box-shadow: 0 4px 0 rgba(201, 36, 96, .25); }
#progress { height: 12px; margin-top: 3px; background: #ffe0ec; border-radius: 999px; overflow: hidden; box-shadow: inset 0 2px 0 rgba(90, 36, 72, .15); }
#progress-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7be04f, var(--lemon), var(--berry)); border-radius: 999px; transition: width .2s; }
#buttons { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 16px; display: flex; gap: 8px; }
#buttons button { font-size: 14px; padding: 8px 14px; }
#next-box { left: 16px; bottom: max(14px, env(safe-area-inset-bottom)); flex-direction: row; gap: 10px; }
#next { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset -4px -5px 0 rgba(0, 0, 0, .14), inset 4px 4px 0 rgba(255, 255, 255, .55); transition: background .15s; }
#powers { position: absolute; right: 16px; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 8px; }
#powers span { background: var(--berry); color: #fff; font-weight: 800; font-size: 14px; padding: 7px 13px; border-radius: 999px; }
#streak { position: absolute; left: 16px; top: 112px; font-weight: 800; font-size: 18px; color: var(--berry); text-shadow: 0 2px 0 #fff; }

#word { position: fixed; top: 24%; left: 0; right: 0; text-align: center; font-size: clamp(40px, 8vw, 84px); font-weight: 900; color: #fff; pointer-events: none; -webkit-text-stroke: 3px var(--berry); text-shadow: 0 6px 0 #c92460; opacity: 0; }
#word.show { animation: word .95s cubic-bezier(.2, 1.5, .4, 1); }
#fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.points { position: absolute; font-weight: 900; font-size: 26px; color: #fff; -webkit-text-stroke: 1.5px var(--ink); transform: translate(-50%, -50%); animation: rise .85s ease-out forwards; }
.points.big { font-size: 40px; color: var(--lemon); }
#danger { position: fixed; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px 40px rgba(255, 30, 80, .75); z-index: 1; }

.screen { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 16px; box-sizing: border-box; background: rgba(255, 214, 230, .82); }
#boot { background: #ffd0e2; }
.screen h1 { margin: 0; font-size: clamp(44px, 9vw, 92px); font-weight: 900; color: #fff; -webkit-text-stroke: 3px var(--berry); text-shadow: 0 6px 0 #c92460; }
.screen h1 em { font-style: normal; color: var(--lemon); }
.screen h2 { margin: 0; font-size: clamp(34px, 7vw, 60px); font-weight: 900; color: var(--berry); }
.screen p { margin: 0; font-size: 18px; font-weight: 700; }
.screen button { font-size: 24px; padding: 12px 42px; }
#bar { width: min(70vw, 380px); height: 20px; background: var(--cream); border-radius: 999px; overflow: hidden; box-shadow: inset 0 3px 0 rgba(90, 36, 72, .15); }
#bar-fill { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--berry) 0 14px, #ff7fae 14px 28px); border-radius: 999px; transition: width .2s; }
#end-score { font-size: 54px; font-weight: 900; }
#end table { font-size: 18px; font-weight: 700; border-spacing: 14px 3px; }
#end td:last-child { text-align: right; }

@keyframes bump { 40% { transform: scale(1.25); } }
@keyframes word { 0% { opacity: 0; transform: scale(.3) rotate(-6deg); } 25% { opacity: 1; transform: scale(1.12) rotate(2deg); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.05) translateY(-14px); } }
@keyframes rise { 0% { opacity: 0; margin-top: 10px; scale: .5; } 20% { opacity: 1; scale: 1.15; } 100% { opacity: 0; margin-top: -70px; scale: 1; } }
@media (max-height: 460px) { #swap-hint { display: none; } #score { font-size: 22px; } #streak { top: 86px; } }
@media (prefers-reduced-motion: reduce) { #word.show, .points { animation-duration: .01s; } }
