: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; height: 100dvh; padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 12px); display: flex; flex-direction: column; gap: 8px; }

.topbar { display: flex; align-items: center; gap: 14px; 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; }

.stage { position: relative; flex: 1; min-height: 0; border-radius: 22px; overflow: hidden; border: 3px solid var(--ink); background: #CFEBF2; }
#board { width: 100%; height: 100%; display: block; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(255, 244, 227, .72); }
.card { background: var(--card); border: 3px solid var(--ink); border-radius: 22px; padding: 22px 20px; text-align: center; max-width: 340px; width: 100%; box-shadow: 0 6px 0 var(--ink); }
.card h1, .card h2 { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; margin: 6px 0 10px; color: var(--pink); }
.card p { margin: 0 0 14px; font-size: 16px; line-height: 1.35; }
.hero-pup { width: 170px; margin: 0 auto; }
.final { display: flex; flex-direction: column; align-items: center; margin: 4px 0 10px; }
.final b { font-family: var(--display); font-weight: 800; font-size: 56px; line-height: 1; }
.final small { font-size: 14px; color: var(--muted); }
#finalNote { font-size: 14px; color: var(--muted); }
.big-btn { display: block; width: 100%; padding: 14px; border-radius: 16px; background: var(--pink); color: #fff; font-family: var(--display); font-weight: 800; font-size: 24px; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); margin-top: 6px; }
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }

.stage { background: #BFE3F5; }
.hint { position: absolute; left: 0; right: 0; top: 56px; text-align: center; font-size: 14px; color: var(--ink); pointer-events: none; }
.hint span { background: rgba(255, 244, 227, .9); border: 2px solid var(--ink); border-radius: 12px; padding: 4px 10px; }
.mini-btn { position: absolute; right: 10px; top: 10px; background: var(--card); border: 2px solid var(--ink); border-radius: 12px; padding: 6px 12px; font-family: var(--display); font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 var(--ink); }
.card.wide { max-width: 420px; max-height: 100%; overflow-y: auto; }
.card.wide .hero-pup { width: 120px; }
.card.wide h1 { font-size: 30px; }
.world { text-align: left; margin: 8px 0 10px; }
.world h3 { font-family: var(--display); font-weight: 800; font-size: 18px; margin: 0 0 6px; display: flex; justify-content: space-between; }
.world h3 small { font-family: var(--body); font-size: 12px; color: var(--muted); align-self: center; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.lvl { position: relative; padding: 8px 0 6px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--ink); font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1; }
.lvl small { display: block; font-family: var(--body); font-size: 11px; margin-top: 4px; min-height: 14px; }
.lvl:disabled { background: #EBD9BF; color: var(--muted); box-shadow: none; cursor: default; }
.lvl.done { background: #FFE9A8; }
.big-btn.soft { background: #fff; color: var(--ink); }
#overLoaves { font-size: 44px; letter-spacing: 4px; }

.mini-btn.retry { right: 92px; }

/* the header shows the level number; its name sits on the sky. Heroes show as small pictures, next one first */
.stage-title { position: absolute; left: 12px; top: 12px; right: 170px; font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.05; color: var(--ink); pointer-events: none; }
.topbar .stat:nth-of-type(2) { flex: 1; }
#heroes { display: flex; gap: 1px; font-size: 20px; line-height: 26px; height: 26px; }
#heroes .h { font-style: normal; display: inline-grid; place-items: center; width: 24px; height: 26px; }
#heroes .h svg { width: 24px; height: 20px; }
#heroes .h:first-child { transform: scale(1.15); }
