/* KinPella Adventure — hub + game styles, adapted from the prototype to the
   site's design tokens and fonts (Lexend UI / Andika reading). Kid rules:
   everything BIG, tap targets >= 52px, no knob toggles, press = sink. */
/* Wave 2 repair (2026-11-30): this sheet's tokens were never defined on
   the adventure page — every var() below silently fell back (the Back
   button rendered white-on-transparent, the gold Play fill and the
   done-state teal never painted). Brand values, matching the site:
   logo navy #17244b, Play-now gold #ffc94d, success teal. */
:root {
  --navy: #17244b; --gold: #ffc94d; --gold-deep: #d99a26;
  --teal: #2e9e7b; --teal-dark: #17705c;
  --line: #dbe2f2; --paper: #ffffff; --muted: #5a6a8f;
  --radius: 20px; --shadow: 0 10px 30px rgba(16,25,53,.12);
}
.adv-wrap { max-width: 1060px; margin: 0 auto; padding: 18px 16px 30px; }
.adv-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; font-family: var(--font-ui); }
.adv-note a { color: var(--teal-dark); font-weight: 700; }

.adv-head { text-align: center; margin: 6px 0 4px; }
.adv-title { font-family: var(--font-read); font-size: clamp(30px, 6vw, 44px); color: var(--navy); margin: 0; }
.adv-sub { font-family: var(--font-read); font-size: clamp(16px, 3.4vw, 20px); color: var(--muted); margin: 8px auto 0; max-width: 640px; }
.adv-home-link { display: inline-block; margin-top: 10px; font-family: var(--font-ui); font-weight: 800; font-size: 15px; color: var(--teal-dark); text-decoration: none; }

/* age band: big tappable tiles (never a dropdown, never a knob toggle) */
.adv-band-label { text-align: center; font-family: var(--font-ui); font-weight: 800; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; }
.adv-band-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.adv-band-tile {
  font-family: var(--font-read); font-weight: 700; font-size: 18px; color: var(--navy);
  background: #fff; border: 3px solid var(--line); border-radius: 999px;
  min-height: 56px; padding: 10px 22px; cursor: pointer;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), border-color .15s, background .15s;
}
.adv-band-tile:active { transform: scale(.94); }
.adv-band-tile.on { background: var(--gold); border-color: var(--gold-deep); }

/* world cards */
.adv-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 18px; margin-top: 22px; }
.adv-card { background: linear-gradient(180deg, #ffffff, #fdf6e3); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.adv-banner { display: block; width: 100%; height: auto; }
.adv-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.adv-world-name { font-family: var(--font-read); font-size: 24px; color: var(--navy); margin: 0; }
.adv-world-sub { font-family: var(--font-read); font-size: 16px; color: var(--muted); margin: 0; }
.adv-badge { font-family: var(--font-read); font-size: 16px; font-weight: 700; color: var(--teal-dark); margin: 0; }
.adv-nodes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.adv-node {
  font-family: var(--font-read); font-weight: 700; font-size: 17px; color: var(--navy);
  background: var(--paper); border: 3px solid var(--line); border-radius: 16px;
  min-width: 52px; min-height: 52px; padding: 8px 10px; cursor: pointer;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), border-color .15s;
}
.adv-node:active { transform: scale(.92); }
.adv-node.boss { background: #fdeeda; }
.adv-node.done { border-color: var(--teal); background: #e7f7f3; }
.adv-sources-btn {
  align-self: flex-start; font-family: var(--font-ui); font-weight: 800; font-size: 14px;
  color: var(--teal-dark); background: none; border: none; cursor: pointer; padding: 8px 2px; min-height: 44px;
}

/* game view chrome */
.adv-game-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.adv-game-title { min-width: 0; }
.adv-back {
  font-family: var(--font-read); font-weight: 700; font-size: 17px; color: #fff;
  background: var(--navy); border: none; border-radius: 999px; min-height: 52px;
  padding: 10px 20px; cursor: pointer; transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.adv-back:active { transform: scale(.94); }
.adv-game-title { font-family: var(--font-read); font-size: clamp(20px, 4.6vw, 27px); color: var(--navy); margin: 0; flex: 1 1 140px; }

/* ── engine stage (kp-adv-* — the engine's own DOM, prototype styling
      carried over with site tokens) ─────────────────────────────────── */
.kp-adv { max-width: 900px; margin: 0 auto; font-family: var(--font-read); }
.kp-adv-banner { background: linear-gradient(180deg, #ffffff, #fdf6e3); border: 3px solid var(--navy); border-radius: 16px; padding: 12px 16px; font-size: 21px; font-weight: 800; text-align: center; min-height: 56px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; box-shadow: 0 10px 24px rgba(16,25,53,.10); color: var(--navy); }
.kp-adv-banner[hidden] { visibility: hidden; display: flex; }
.kp-adv-stage { position: relative; border-radius: 20px; overflow: hidden; box-shadow: 0 10px 30px rgba(16,25,53,.25); background: var(--navy); touch-action: none; }
.kp-adv-stage canvas { display: block; width: 100%; }
.kp-adv-hud { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; gap: 14px; align-items: center; pointer-events: none; font-size: 19px; font-weight: 800; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.45); }
.kp-adv-mute { pointer-events: auto; margin-left: auto; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); font-size: 20px; cursor: pointer; display: grid; place-items: center; transition: transform .55s cubic-bezier(.34,1.4,.64,1); }
.kp-adv-mute:active { transform: scale(.92); transition: transform .08s ease-in; }
.kp-adv-mute svg { width: 24px; height: 24px; display: block; stroke: var(--navy); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.kp-adv-teach { position: absolute; left: 12px; right: 12px; bottom: 12px; background: linear-gradient(160deg, rgba(38,54,92,.97), rgba(16,25,53,.97)); border: 1px solid rgba(255,201,77,.35); color: #fff; border-radius: 16px; padding: 14px 18px; font-size: 19px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: kpAdvRise .28s cubic-bezier(.22,1,.36,1); }
.kp-adv-hint { color: var(--gold); font-size: 16.5px; margin-top: 4px; }
@keyframes kpAdvRise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.kp-adv-ceremony { position: absolute; inset: 0; background: rgba(16,25,53,.55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 18px; }
.kp-adv-ceremony[hidden] { display: none; }
.kp-adv-ceremony-card { background: linear-gradient(180deg, #ffffff, #fdf6e3); border-top: 6px solid var(--gold); border-radius: 24px; padding: 26px 22px; text-align: center; max-width: 420px; width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.45); animation: kpAdvRise .35s cubic-bezier(.22,1,.36,1); }
.kp-adv-ceremony-stars { font-size: 44px; letter-spacing: 6px; filter: drop-shadow(0 4px 10px rgba(255,183,3,.55)); }
.kp-adv-ceremony-card h2 { margin: 8px 0 4px; font-size: 27px; color: var(--navy); }
.kp-adv-ceremony-card p { font-size: 19px; color: var(--muted); margin: 4px 0 16px; }
.kp-adv-ceremony-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.kp-adv-ceremony-btns button { font-family: var(--font-read); font-size: 18px; font-weight: 800; border: 0; border-radius: 999px; padding: 14px 22px; min-height: 56px; cursor: pointer; background: linear-gradient(180deg, #ffd968, var(--gold)); color: var(--navy); box-shadow: 0 10px 20px -6px rgba(217,154,38,.5), inset 0 1px 0 rgba(255,255,255,.5); transition: transform .55s cubic-bezier(.34,1.4,.64,1), box-shadow .2s ease; }
.kp-adv-ceremony-btns button + button { background: var(--navy); color: #fff; box-shadow: 0 10px 20px -8px rgba(16,25,53,.5), inset 0 1px 0 rgba(255,255,255,.25); }
.kp-adv-ceremony-btns button:active { transform: scale(.95); transition: transform .08s ease-in; }
.kp-adv-controls { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px 20px; gap: 12px; }
.kp-adv-pad { display: flex; gap: 12px; }
.kp-adv-pad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; font-size: 28px; box-shadow: 0 10px 20px -8px rgba(16,25,53,.55), inset 0 1px 0 rgba(255,255,255,.2); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .55s cubic-bezier(.34,1.4,.64,1), box-shadow .2s ease; }
.kp-adv-pad button:active { transform: scale(.94); transition: transform .08s ease-in; }
.kp-adv-jump { width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--gold); color: var(--navy); font-size: 19px; font-weight: 900; box-shadow: 0 10px 20px -6px rgba(217,154,38,.55), inset 0 1px 0 rgba(255,255,255,.5); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .55s cubic-bezier(.34,1.4,.64,1), box-shadow .2s ease; }
.kp-adv-jump:active { transform: scale(.94); transition: transform .08s ease-in; }

/* ── Wave 2 port (2026-11-30): progress head, per-card state, the one
   Play button per world, and the full-stage world frame. The Academy
   list-head pattern: a count pill over a grid whose cards carry their
   own state (done = green wash + badge). */
.adv-progress { display: flex; justify-content: center; margin: 18px 0 2px; }
.adv-progress-pill {
  font-family: var(--font-ui); font-weight: 800; font-size: 16px; color: var(--navy);
  background: #e7f7f3; border: 2px solid var(--teal); border-radius: 999px; padding: 9px 20px;
}
.adv-progress-pill.all { background: var(--gold); border-color: var(--gold-deep); }
.adv-card.done { background: linear-gradient(180deg, #eefaf5, #fdf6e3); border-color: var(--teal); }
.adv-round { font-family: var(--font-read); font-size: 14.5px; color: var(--muted); margin: 0; }
.adv-playbtn {
  margin-top: auto; font-family: var(--font-read); font-weight: 800; font-size: 19px;
  color: var(--navy); background: linear-gradient(180deg, #ffd968, var(--gold));
  border: 0; border-radius: 999px; min-height: 56px; padding: 12px 22px; cursor: pointer;
  box-shadow: 0 10px 20px -6px rgba(217,154,38,.5), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.adv-playbtn:active { transform: scale(.95); }
.adv-world-frame { flex: 1 0 auto; width: 100%; min-height: 0; border: 0; display: block; background: var(--navy); }
.adv-wrap:has(.adv-world-frame) { max-width: none; padding: 10px 0 0; }
/* While a world is playing, the stage owns the screen (the Academy
   play-view rule: footer hidden while playing) — the note and the
   site footer return on the hub. */
.adv-wrap:has(.adv-world-frame) .adv-note { display: none; }
body:has(.adv-world-frame) .kp-foot { display: none; }

/* grown-ups' sources sheet */
.adv-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(23,36,75,.5); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.adv-sheet {
  background: #fff; width: min(680px, 100%); max-height: 82vh; overflow: auto;
  border-radius: 24px 24px 0 0; padding: 20px 20px 28px;
}
.adv-sheet h2 { font-family: var(--font-ui); font-size: 21px; color: var(--navy); margin: 0 0 6px; }
.adv-sheet p { font-family: var(--font-ui); font-size: 14.5px; color: var(--muted); line-height: 1.5; }
.adv-src-area { font-family: var(--font-ui); font-weight: 800; font-size: 15px; color: var(--navy); margin: 16px 0 4px; }
.adv-src-list { margin: 0; padding-left: 18px; font-family: var(--font-ui); font-size: 14px; color: var(--ink); line-height: 1.55; }
.adv-sheet-close {
  font-family: var(--font-read); font-weight: 700; font-size: 17px; color: #fff; background: var(--navy);
  border: none; border-radius: 999px; min-height: 52px; padding: 10px 26px; cursor: pointer; margin-top: 18px;
}

/* ── Desktop full width (owner's correction, 2026-11-28) ─────────── */
@media (min-width:1024px){
  .adv-wrap{max-width:1280px}
}

/* ── Account-fit + FULL-STAGE game view (owner 2026-11-28/29) ───────
   The page is a flex column: the wrap flexes, the footer closes the
   bottom. When a game is open the stage takes the whole viewport —
   edge to edge, the game's own navy behind the painted scene, the
   canvas letterboxed INSIDE that colour (object-fit) so nothing sits
   on dead white. Back (one step) / Home / Menu stay in the game head
   above the stage. */
body{display:flex;flex-direction:column;min-height:100vh;min-height:100dvh}
.adv-wrap{flex:1 0 auto;width:100%;display:flex;flex-direction:column}
#adv-app{flex:1 0 auto;display:flex;flex-direction:column;justify-content:center;width:100%}
#adv-stage{display:flex;flex-direction:column;flex:1 0 auto;min-height:0}
.adv-wrap:has(.kp-adv-stage){max-width:none;padding:10px 0 0}
.kp-adv-wrap{display:flex;flex-direction:column;flex:1 0 auto;min-height:0}
.kp-adv-stage{flex:1 0 auto;display:flex;align-items:stretch;justify-content:center;border-radius:0;min-height:300px}
.kp-adv-stage canvas{width:100%;height:100%;object-fit:contain}
.adv-game-head{padding:0 12px}
@media(max-width:480px){
  .adv-game-head{gap:8px}
  .adv-home-link{font-size:14px;margin-top:0}
  .adv-back{min-height:44px;padding:8px 14px}
}
