@font-face { font-family: Fredoka; font-weight: 500; font-display: swap; src: url(fonts/fredoka-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Fredoka; font-weight: 700; font-display: swap; src: url(fonts/fredoka-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #120630; --panel: rgba(255,255,255,.07); --line: rgba(255,255,255,.12);
  --text: #fff; --muted: rgba(255,255,255,.65); --gold: #ffcf3a; --pink: #ff5edb; --theme-accent: #ff5edb;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Fredoka, system-ui, -apple-system, 'Segoe UI', sans-serif; overflow: hidden; overscroll-behavior: none; }
body { background: radial-gradient(120% 80% at 50% 0%, #2a0b52 0%, #120630 60%, #0a0320 100%); }
button { font: inherit; color: inherit; }

#app { height: 100%; height: 100dvh; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); gap: 8px; }

#hud { flex: none; }
#hud .row { display: flex; align-items: center; gap: 10px; }
.lbl { display: block; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lvl b, .score b { font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lvl small { font-size: 13px; color: var(--muted); font-weight: 500; }
.score { text-align: right; min-width: 72px; }
.mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
#hName { font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#discs { display: flex; gap: 5px; }
#discs i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18); transition: transform .2s, background .2s; }
#discs i.in { background: radial-gradient(circle at 35% 30%, #d6ffe4, #3ddc84 55%, #1a9c55); box-shadow: 0 0 6px rgba(61,220,132,.6); }
#discs i.out { background: radial-gradient(circle at 35% 30%, #ffd0d0, #ff4d5e 55%, #b3122a); box-shadow: 0 0 6px rgba(255,77,94,.5); }
#discs i.fly { background: rgba(255,207,58,.35); box-shadow: inset 0 0 0 1.5px rgba(255,207,58,.7); }
#discs i.on { background: radial-gradient(circle at 35% 30%, #fff6c2, #ffcf3a 45%, #d98200); box-shadow: 0 0 8px rgba(255,190,40,.6); }
.icon { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; flex: none; }
.icon:active { transform: scale(.94); }

.barrow { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
#lives { display: flex; gap: 2px; flex: none; }
#lives svg { width: 18px; height: 18px; display: block; transition: transform .25s; }
#lives svg.on { filter: drop-shadow(0 0 4px rgba(255,79,138,.7)); }
#lives svg.pop { animation: heartpop .6s ease; }
@keyframes heartpop { 40% { transform: scale(1.6); } }
.lifeline { display: flex; justify-content: center; gap: 4px; margin: 10px 0; }
.lifeline svg { width: 30px; height: 30px; }
#bar { flex: 1; position: relative; height: 22px; border-radius: 11px; background: rgba(255,255,255,.08); overflow: hidden; border: 1px solid var(--line); }
#barFill { height: 100%; width: 0; border-radius: 11px; background: linear-gradient(90deg, var(--theme-accent), var(--gold)); transition: width .35s cubic-bezier(.2,.9,.3,1.2); }
#bar.hit #barFill { background: linear-gradient(90deg, #3ddc84, #a6ff6b); }
#barTxt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.6); font-variant-numeric: tabular-nums; }

#stage { flex: 1; min-height: 0; display: grid; place-items: center; }
#board { display: block; border-radius: 18px; box-shadow: 0 0 0 1px var(--line), 0 18px 50px rgba(0,0,0,.5); touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }

#modal { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8,2,24,.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 10; animation: fade .25s ease; }
#modal.hidden, .hidden { display: none !important; }
.card { width: 100%; max-width: 380px; max-height: 100%; overflow-y: auto; padding: 26px 22px 22px; border-radius: 26px; text-align: center;
  background: linear-gradient(180deg, rgba(58,20,120,.96), rgba(24,8,56,.97)); border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 24px 60px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.12); animation: pop .35s cubic-bezier(.2,.9,.3,1.25); }
.card h1, .card h2 { margin: 6px 0 10px; line-height: 1.1; }
.card h2 { font-size: 26px; }
.card p { margin: 8px 0; }
.wordmark { font-size: 52px; font-weight: 700; letter-spacing: .02em; background: linear-gradient(180deg, #fff3b0, #ffcf3a 50%, #ff8a1f); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #1a0533) drop-shadow(0 0 18px rgba(255,180,40,.35)); }
.lead { color: var(--muted); font-size: 16px; line-height: 1.4; }
.best { font-size: 15px; } .best b { color: var(--gold); }
.kicker { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pink); }
.tip { color: var(--muted); font-size: 15px; line-height: 1.4; }
.target b, .sub b { color: var(--gold); }
.sub { color: var(--muted); }
.prizebox { display: flex; align-items: center; gap: 14px; margin: 14px 0; padding: 10px 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); text-align: left; }
.prizebox span, .nextup span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.prizebox b { font-size: 20px; }
.bigprize { display: grid; place-items: center; margin: 4px 0; }
.bigprize canvas { animation: wobble 2.4s ease-in-out infinite; filter: drop-shadow(0 8px 18px rgba(255,200,60,.35)); }
.newbox { margin: 12px 0; padding: 10px 14px; border-radius: 16px; text-align: left; background: rgba(77,243,255,.1); border: 1px solid rgba(77,243,255,.35); }
.newbox span { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #4df3ff; }
.newbox p { margin: 4px 0 0; font-size: 14px; line-height: 1.35; }
.newbox.reward { background: rgba(124,255,107,.1); border-color: rgba(124,255,107,.4); }
.newbox.reward span { color: #7cff6b; }
.wheelwrap { display: grid; place-items: center; margin: 8px 0; }
.giftrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; min-height: 10px; }
.unwrap { display: grid; place-items: center; margin: 4px 0; }
.wheelres { min-height: 2.6em; }
.raincount { font-size: 13px; font-weight: 700; color: #4df3ff; }
#lives { flex-wrap: nowrap; }
.btn:disabled { opacity: .7; }
.nextup { margin: 14px 0 6px; padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); text-align: left; }
.nextup b { display: block; font-size: 16px; margin: 2px 0; } .nextup small { color: var(--muted); font-size: 13px; }
.badge.breaker { background: #4df3ff; color: #12052e; margin-left: 4px; }
.badge { display: inline-block; padding: 5px 14px; border-radius: 99px; background: var(--pink); font-weight: 700; font-size: 14px; }
.cardprev img { width: 100%; max-width: 260px; aspect-ratio: 4/5; border-radius: 16px; border: 1px solid var(--line); background: #1a0638; margin: 8px auto; display: block; }
.hint { font-size: 13px; color: var(--muted); }
.rate { margin: 10px 0 2px; } .rate span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.stars { display: flex; justify-content: center; gap: 2px; }
.star { background: none; border: 0; padding: 4px; cursor: pointer; line-height: 0; }
.star path { fill: rgba(255,255,255,.14); stroke: rgba(255,255,255,.45); stroke-width: 1.2; transition: fill .12s; }
.star.on path { fill: #ffcf3a; stroke: #ffe680; }
.star:focus-visible { outline: 3px solid #4df3ff; outline-offset: 1px; border-radius: 8px; }
.rated { color: var(--gold); font-weight: 700; font-size: 15px; margin: 10px 0 2px; }

.btn { display: block; width: 100%; margin-top: 12px; padding: 14px 18px; border-radius: 16px; border: 0; font-size: 18px; font-weight: 700; cursor: pointer; transition: transform .1s; }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .icon:focus-visible { outline: 3px solid #4df3ff; outline-offset: 2px; }
.btn.primary { color: #2a0b00; background: linear-gradient(180deg, #ffe680, #ffb81f); box-shadow: 0 5px 0 #b86e00, 0 10px 24px rgba(255,170,30,.3); }
.btn.primary:active { box-shadow: 0 2px 0 #b86e00; transform: translateY(3px); }
.btn.ghost { background: var(--panel); border: 1px solid var(--line); }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(4deg) translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .card, #modal, .bigprize canvas { animation: none; } }
@media (max-height: 640px) { .card { padding: 18px 18px 16px; } .wordmark { font-size: 42px; } }
