:root {
  --cream: #FFF4E3; --card: #FFFFFF; --line: #EBD9BF; --ink: #3B2416; --muted: #7A5A44;
  --pink: #C93D63; --pink-dk: #8E2443;
  --display: 'Baloo 2', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --body: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--cream); color: var(--ink); font-family: var(--body); font-weight: 700; touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; padding: 0; }
button:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
svg { display: block; }

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

.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.stat { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.stat small { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat b { font-family: var(--display); font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
#best { color: var(--muted); }
.stat.next { margin-left: auto; align-items: center; gap: 2px; }
#nextCv { width: 40px; height: 40px; }
.round-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--card); border: 2px solid var(--line); display: grid; place-items: center; }
.round-btn svg { width: 22px; height: 22px; }

.stage { position: relative; width: 100%; aspect-ratio: 400 / 640; max-height: calc(100dvh - 190px); margin: 0 auto; }
.stage { height: min(calc(100dvh - 190px), calc((100vw - 32px) * 1.6)); width: auto; max-width: 100%; }
#board { width: 100%; height: 100%; display: block; border-radius: 22px; background: #FFFAF1; touch-action: none; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 244, 227, .78); border-radius: 22px; padding: 16px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 18px 20px 20px; text-align: center; max-width: 300px; width: 100%; box-shadow: 0 6px 0 rgba(59, 36, 22, .12); }
.card h1, .card h2 { margin: 4px 0 6px; font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1; }
.card p { margin: 0 0 14px; font-size: 15px; color: var(--muted); line-height: 1.35; }
.hero-pup { width: 150px; margin: 0 auto; }
.big-btn { display: block; width: 100%; min-height: 52px; border-radius: 16px; background: var(--pink); color: #fff; font-family: var(--display); font-weight: 800; font-size: 22px; box-shadow: 0 4px 0 var(--pink-dk); }
.big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--pink-dk); }
.final { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 10px; }
.final b { font-family: var(--display); font-weight: 800; font-size: 48px; line-height: 1; font-variant-numeric: tabular-nums; }
.final small { color: var(--muted); font-size: 14px; }
#postNote { margin: 0 0 12px; }

.wow { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; pointer-events: none; animation: wow 2.6s ease-out forwards; }
.wow > div { width: 190px; }
.wow b { font-family: var(--display); font-weight: 800; font-size: 38px; color: var(--pink); text-shadow: 0 3px 0 #fff, 0 -3px 0 #fff, 3px 0 0 #fff, -3px 0 0 #fff; }
.wow small { font-family: var(--display); font-weight: 800; font-size: 24px; color: var(--ink); }
@keyframes wow { 0% { opacity: 0; transform: scale(.4); } 12% { opacity: 1; transform: scale(1.08); } 20% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1); } }

.ladder { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.ladder canvas { width: 100%; max-width: 40px; aspect-ratio: 1; flex: 1 1 0; min-width: 0; }
.ladder i { flex: none; width: 6px; height: 6px; border-top: 2px solid var(--line); border-right: 2px solid var(--line); transform: rotate(45deg) scale(.7); }

@media (prefers-reduced-motion: reduce) { .wow { animation-duration: 0.01s; animation-delay: 2s; } }
