:root { --f: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd3ff; font-family: var(--f); touch-action: none; overscroll-behavior: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
#hud > * { pointer-events: none; }
#hud button { pointer-events: auto; }
.pill { background: rgba(255,255,255,.92); border-radius: 999px; padding: 8px 18px; font-size: 26px; font-weight: 900; color: #1b2336; box-shadow: 0 4px 0 rgba(0,0,0,.18); display: inline-block; }
.pill.small { font-size: 18px; border: 0; cursor: pointer; pointer-events: auto; }
#coins { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); }
.round { width: 54px; height: 54px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); font-size: 28px; box-shadow: 0 4px 0 rgba(0,0,0,.2); cursor: pointer; }
.round:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
#home { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
#mute2 { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 64px); right: max(10px, env(safe-area-inset-right)); }

#qcard { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 58px); left: 50%; transform: translateX(-50%); width: min(92vw, 560px);
  background: #fff; border: 6px solid #ffc400; border-radius: 28px; padding: 12px 70px 12px 18px; text-align: center; box-shadow: 0 8px 0 rgba(0,0,0,.2); animation: pop .35s ease-out; }
#qcard .round { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: #2b7bff; color: #fff; pointer-events: auto; }
#qcard.center { top: 38%; width: min(92vw, 640px); padding: 28px 24px; animation: popc .4s ease-out; transform: translate(-50%, -50%); }
#qcard.center .q-text { font-size: clamp(40px, 11vw, 78px); }
#qcard.center .round { display: none; }
@keyframes popc { 0% { transform: translate(-50%, -50%) scale(.5); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.q-emojis { font-size: clamp(26px, 6vw, 38px); line-height: 1.15; letter-spacing: 2px; word-break: break-all; }
.q-text { font-size: clamp(24px, 6vw, 36px); font-weight: 900; color: #1b2336; }
.q-text b { color: #e8344a; }
.blank { display: inline-block; min-width: 1.1em; border-bottom: 5px solid #ff8a1f; color: #ff8a1f; }

#progress { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(70vw, 420px); height: 16px; background: rgba(255,255,255,.85); border-radius: 99px; box-shadow: 0 3px 0 rgba(0,0,0,.2); }
#progFill { height: 100%; width: 0; background: linear-gradient(90deg, #ffd23f, #ff8a1f); border-radius: 99px; }
#progCar { position: absolute; top: -18px; left: 0; font-size: 30px; transform: translateX(-50%); }
#hint { position: absolute; bottom: 14vh; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; font-size: 28px; font-weight: 900; padding: 12px 24px; border-radius: 99px; animation: bob 1s infinite ease-in-out; white-space: nowrap; }

#toast { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(0); font-size: clamp(36px, 10vw, 72px); font-weight: 900; color: #fff; text-shadow: 0 5px 0 rgba(0,0,0,.35), 0 0 20px rgba(0,0,0,.3); pointer-events: none; text-align: center; z-index: 5; }
#toast.show { animation: toast 1.4s ease-out forwards; }
#count { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: clamp(90px, 28vw, 220px); font-weight: 900; color: #fff; text-shadow: 0 8px 0 rgba(0,0,0,.35); pointer-events: none; z-index: 5; }
#count.tick { animation: tick .8s ease-out; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; }
#flash.on { animation: flash .6s ease-out; }

#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(rgba(20,40,90,.35), rgba(20,40,90,.55)); z-index: 10; overflow-y: auto; touch-action: pan-y; }
.menu-inner { text-align: center; padding: 20px 14px; width: min(100%, 980px); }
h1 { margin: 0; font-size: clamp(40px, 9vw, 76px); color: #fff; text-shadow: 0 6px 0 #e8344a, 0 10px 14px rgba(0,0,0,.35); }
.sub { color: #fff; font-size: clamp(18px, 4vw, 26px); font-weight: 800; margin: 8px 0 18px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
#cards { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 16px; }
.card { width: min(44vw, 170px); background: #fff; border: 0; border-radius: 26px; padding: 14px 8px; font-family: var(--f); cursor: pointer; box-shadow: 0 8px 0 rgba(0,0,0,.25); transition: transform .1s; }
.card:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.card .em { font-size: 54px; }
.card .nm { font-size: 19px; font-weight: 900; color: #1b2336; margin-top: 2px; }
.card .st { font-size: 22px; margin-top: 4px; min-height: 28px; }
.card .num { display: inline-block; background: #ffc400; color: #1b2336; border-radius: 99px; font-weight: 900; padding: 0 10px; font-size: 14px; }

#result { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,20,50,.55); z-index: 10; }
.res-card { background: #fff; border-radius: 34px; padding: 22px 26px; text-align: center; width: min(92vw, 460px); box-shadow: 0 10px 0 rgba(0,0,0,.25); animation: pop .5s ease-out; }
.trophy { font-size: 80px; animation: bob 1.2s infinite ease-in-out; }
.res-card h2 { margin: 0; font-size: 44px; color: #e8344a; }
#resStars { font-size: 56px; margin: 6px 0; }
#resText { font-size: 20px; font-weight: 800; color: #1b2336; margin: 4px 0 14px; }
.res-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
button.big { font-family: var(--f); font-size: 24px; font-weight: 900; border: 0; border-radius: 99px; padding: 12px 22px; background: #ff8a1f; color: #fff; box-shadow: 0 6px 0 rgba(0,0,0,.25); cursor: pointer; }
button.big.green { background: #16b85a; } button.big.blue { background: #2b7bff; }
button.big:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }

@keyframes pop { 0% { transform: translateX(-50%) scale(.6); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
.res-card { animation-name: pop2; } @keyframes pop2 { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-8px); } }
.trophy { animation-name: bob2; } @keyframes bob2 { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
@keyframes toast { 0% { transform: translate(-50%,-50%) scale(0); } 20% { transform: translate(-50%,-50%) scale(1.15); } 30% { transform: translate(-50%,-50%) scale(1); } 80% { transform: translate(-50%,-50%) scale(1); opacity: 1; } 100% { transform: translate(-50%,-80%) scale(1); opacity: 0; } }
@keyframes tick { 0% { transform: translate(-50%,-50%) scale(1.8); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(-50%,-50%) scale(1); opacity: .9; } }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
