:root {
  --bg: #f4f2fb;
  --bg2: #e7e2fb;
  --card: #ffffff;
  --card-2: #f6f4ff;
  --ink: #221a4a;
  --ink-soft: #6f6796;
  --line: #ece8fb;
  --brand: #5b3df0;
  --brand-2: #8a5bff;
  --accent: #ff3d81;
  --cyan: #12c8d6;
  --lime: #27c96a;
  --amber: #ffb020;
  --good: #23c069;
  --bad: #ff4d6d;
  --shadow: 0 10px 26px rgba(60, 34, 150, 0.14);
  --shadow-sm: 0 4px 12px rgba(60, 34, 150, 0.12);
  --radius: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14112a;
    --bg2: #1c1740;
    --card: #211b45;
    --card-2: #2a2356;
    --ink: #f3f0ff;
    --ink-soft: #a99fe0;
    --line: #322a63;
    --shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; touch-action: manipulation; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 60% at 80% -10%, rgba(138,91,255,0.20), transparent 60%),
              radial-gradient(120% 60% at -10% 0%, rgba(255,61,129,0.12), transparent 55%),
              linear-gradient(170deg, var(--bg), var(--bg2));
  background-attachment: fixed;
  -webkit-user-select: none; user-select: none;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 540px; margin: 0 auto; min-height: 100%; padding: calc(var(--safe-top) + 10px) 16px calc(var(--safe-bottom) + 20px); }

.screen { display: none; animation: fade .28s ease; }
.screen.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none; } }

/* ---------------- profiles ---------------- */
.screen--profiles { padding-top: 8vh; }
.profiles-head { text-align: center; margin-bottom: 26px; }
.profiles__title { font-size: 34px; font-weight: 900; margin: 0;
  background: linear-gradient(120deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.profiles__sub { color: var(--ink-soft); font-weight: 700; margin: 6px 0 0; }
.profiles-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 420px; margin: 0 auto; }
.pcard { border: none; background: var(--card); border-radius: 22px; padding: 22px 12px 16px; box-shadow: var(--shadow);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); }
.pcard:active { transform: scale(.95); }
.pcard__av { font-size: 54px; line-height: 1; }
.pcard__name { font-size: 19px; font-weight: 800; }
.pcard__meta { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.pcard--add { border: 2px dashed var(--line); background: transparent; box-shadow: none; justify-content: center; min-height: 130px; }
.pcard--add .pcard__av { color: var(--brand); }
.pcard--signin { border: 2px dashed var(--line); background: transparent; box-shadow: none; justify-content: center; min-height: 130px; }
.pcard--signin .pcard__av { color: #37b7ff; }

.player-switch { display: inline-flex; align-items: center; gap: 7px; border: none; background: var(--card);
  box-shadow: var(--shadow-sm); border-radius: 999px; padding: 6px 12px 6px 8px; margin: 0 0 8px; cursor: pointer; color: var(--ink); }
.player-switch:active { transform: scale(.95); }
.player-switch__av { font-size: 22px; }
.player-switch__name { font-weight: 800; font-size: 15px; }
.player-switch__caret { color: var(--ink-soft); font-weight: 900; font-size: 12px; }

.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.av-btn { border: none; background: var(--card); border-radius: 12px; padding: 8px 0; font-size: 24px; cursor: pointer; box-shadow: var(--shadow-sm); }
.av-btn:active { transform: scale(.9); }
.av-btn.is-on { background: linear-gradient(140deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 14px rgba(91,61,240,.4); }
.name-input { width: 100%; text-align: center; font-size: 22px; font-weight: 800; padding: 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.name-input:focus { outline: none; border-color: var(--brand); }

.players-manage { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pm-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-sm); }
.pm-av { font-size: 24px; }
.pm-name { flex: 1; font-weight: 800; }
.pm-name .pm-active { color: var(--brand); font-size: 11px; font-weight: 800; margin-left: 6px; }
.pm-btn { border: none; background: var(--card-2); color: var(--brand); font-weight: 800; font-size: 13px; padding: 7px 11px; border-radius: 9px; cursor: pointer; }
.pm-btn--del { color: var(--bad); }
.pm-btn--cloud { color: #2f9ad0; }
.pm-cloud { font-size: 12px; color: #2f9ad0; font-weight: 800; padding: 0 4px; }
.pm-btn:active { transform: scale(.92); }

/* cloud sign-in / save-online */
.cloud-badge { font-size: 13px; margin-left: 4px; opacity: .95; }
.cloud-signin-link { display: block; margin: 20px auto 0; border: none; background: transparent; color: var(--brand);
  font-family: inherit; font-weight: 800; font-size: 14px; cursor: pointer; }
.cloud-signin-link:active { opacity: .55; }
.cloud-intro { text-align: center; padding: 16px 18px 2px; }
.cloud-intro__emoji { font-size: 42px; line-height: 1; }
.cloud-intro__text { font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); max-width: 34ch; margin: 10px auto 0; }
.cloud-err { color: var(--bad, #ff5c6c); font-weight: 800; font-size: 13.5px; text-align: center; margin: 12px 0 0; }
.cloud-msg { color: var(--good, #23c069); font-weight: 800; font-size: 13px; text-align: center; margin: 12px 0 0; }
.link-btn { display: block; margin: 14px auto 0; background: none; border: none; color: var(--brand); font-family: inherit; font-weight: 800; font-size: 14px; cursor: pointer; text-decoration: underline; }
.kids-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; }
.kid-added { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-sm); }
.kid-added__av { font-size: 26px; }
.kid-added__name { font-weight: 800; font-size: 16px; }
.gate__input--pw { width: 240px; max-width: 82%; font-size: 20px; letter-spacing: .08em; }
.screen--signin .btn-primary, .screen--signup .btn-primary, .screen--kids .btn-primary, .screen--kids .btn-secondary,
.screen--reset .btn-primary, .screen--account .btn-secondary { margin-top: 16px; }
#manage-account { display: block; width: 100%; margin-bottom: 10px; }

/* ===================== landing / front door (8-bit) ===================== *
 * Commits to a bright daytime-arcade look; every colour is explicit so the
 * OS dark-mode vars can't bleed in. Full-bleed inside the 540px #app column. */
.screen--landing.is-active { display: block; min-height: 100%; }
/* while the landing is up, let it use the full browser width (the game stays a phone column) */
body.lp-full #app { max-width: none; padding: 0; }
.lp {
  --lp-ink:#241a4a; --lp-ink-soft:#3a2e63; --lp-shadow:#1a1330;
  --lp-gold:#ffd23f; --lp-gold-lo:#c9930a; --lp-pink:#ff4fa3;
  --lp-purple:#8b6cf0; --lp-purple-d:#5b3fc0; --lp-cream:#fff7e6; --lp-paper:#fdf4dd;
  --lp-mono:'DejaVu Sans Mono',ui-monospace,"SF Mono","Roboto Mono",Menlo,Consolas,monospace;
  margin: 0; text-align: left; color: var(--lp-ink); background: var(--lp-paper);
}
.lp b { font-weight: 800; }

/* ---- hero ---- */
.lp-hero {
  position: relative; min-height: min(88vh, 760px); overflow: hidden;
  background: linear-gradient(180deg,#6ea3ff 0%,#5c94fc 46%,#8fc0ff 100%);
  display: flex; flex-direction: column;
}
.lp-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.lp-hero__copy { position: relative; z-index: 3; padding: calc(34px + var(--safe-top)) 18px 0; text-align: center; max-width: 860px; margin: 0 auto; width: 100%; }
.lp-eyebrow {
  display: inline-block; font-family: var(--lp-mono); font-weight: 700; font-size: 10px;
  letter-spacing: .06em; color: var(--lp-ink); background: var(--lp-gold);
  padding: 7px 11px; border: 3px solid var(--lp-ink); box-shadow: 4px 4px 0 var(--lp-shadow); margin-bottom: 16px;
}
.lp-logo {
  font-family: var(--lp-mono); font-weight: 700; font-size: clamp(32px,7vw,76px);
  line-height: 1.06; letter-spacing: .01em; color: var(--lp-gold); margin: 6px 0 0;
  text-shadow: 3px 3px 0 var(--lp-ink), -2px 0 0 var(--lp-ink), 2px 0 0 var(--lp-ink),
               0 -2px 0 var(--lp-ink), 0 2px 0 var(--lp-ink), 6px 7px 0 rgba(26,19,48,.32);
}
.lp-logo span { color: #fff; }
.lp-tag {
  max-width: 34ch; margin: 16px auto 0; font-size: 15.5px; font-weight: 600; line-height: 1.5;
  color: var(--lp-ink); background: rgba(255,247,230,.85); border: 3px solid var(--lp-ink);
  border-radius: 14px; padding: 12px 16px; box-shadow: 4px 4px 0 rgba(26,19,48,.26);
}
.lp-cta { display: flex; flex-direction: column; gap: 12px; margin: 22px auto 0; max-width: 340px; }
.lp-cta[hidden] { display: none; }
#lp-cta-in { justify-content: center; align-items: center; }
#lp-cta-in .lp-btn { flex: 0 0 auto; width: 100%; max-width: 290px; }
.lp-signedin { margin: 14px auto 0; max-width: 40ch; font-family: var(--lp-mono); font-size: 12.5px; font-weight: 700; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,.45); }
.lp-signedin b { color: var(--lp-gold); }
.lp-linkbtn { border: none; background: none; color: var(--lp-gold); font-family: inherit; font-weight: 700; font-size: 12.5px; text-decoration: underline; cursor: pointer; padding: 0; }
.lp-btn {
  font-family: var(--lp-mono); font-weight: 700; letter-spacing: .02em; cursor: pointer;
  border: 4px solid var(--lp-ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s, box-shadow .06s; color: var(--lp-ink);
}
.lp-btn--play {
  font-size: 15px; background: linear-gradient(180deg,#ffe27a,var(--lp-gold));
  padding: 15px 22px; box-shadow: 0 6px 0 var(--lp-gold-lo), 0 6px 0 4px var(--lp-ink);
}
.lp-btn--play:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--lp-gold-lo), 0 3px 0 4px var(--lp-ink); }
.lp-btn--ghost { font-size: 12px; color: #fff; background: var(--lp-purple); padding: 13px 18px; box-shadow: 0 5px 0 var(--lp-purple-d); }
.lp-btn--ghost:active { transform: translateY(2px); box-shadow: 0 3px 0 var(--lp-purple-d); }
.lp-trust {
  position: relative; z-index: 3; margin-top: auto; padding: 16px 12px 14px; text-align: center;
  font-family: var(--lp-mono); font-weight: 700; font-size: 9px; letter-spacing: .04em; color: #fff;
  text-shadow: 2px 2px 0 rgba(26,19,48,.6);
}

/* ---- generic section (content centered, capped for readability on wide screens) ---- */
.lp-sec { padding: 54px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.lp-sec > * { width: 100%; max-width: 1080px; }
.lp-kicker { font-family: var(--lp-mono); font-weight: 700; font-size: 11px; color: var(--lp-pink); text-align: center; margin-bottom: 12px; }
.lp-h2 { font-family: var(--lp-mono); font-weight: 700; font-size: clamp(17px,5vw,24px); line-height: 1.35; text-align: center; color: var(--lp-ink); margin: 0 0 8px; }
.lp-h2--light { color: #fff; text-shadow: 3px 3px 0 var(--lp-shadow); }
.lp-sub { text-align: center; font-size: 15px; font-weight: 600; color: var(--lp-ink-soft); max-width: 42ch; margin: 0 auto 30px; line-height: 1.45; }

/* ---- worlds ---- */
.lp-worlds { background: var(--lp-cream); border-top: 5px solid var(--lp-ink); border-bottom: 5px solid var(--lp-ink); }
.lp-wgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.lp-wcard { background: var(--lp-paper); border: 4px solid var(--lp-ink); box-shadow: 5px 5px 0 var(--lp-shadow); overflow: hidden; }
.lp-wcard__scene { display: block; width: 100%; height: auto; image-rendering: pixelated; border-bottom: 4px solid var(--lp-ink); }
.lp-wcard__body { padding: 12px 10px 14px; text-align: center; }
.lp-wcard__name { font-family: var(--lp-mono); font-weight: 700; font-size: 11px; margin: 10px 0 6px; color: var(--lp-ink); }
.lp-wcard__desc { font-size: 13px; font-weight: 600; color: var(--lp-ink-soft); line-height: 1.3; }

/* ---- heroes ---- */
.lp-heroes { background: var(--lp-ink); }
.lp-heroes .lp-kicker { color: var(--lp-gold); }
.lp-heroes .lp-h2 { color: #fff; }
.lp-heroes .lp-sub { color: #c7cdf0; }
.lp-hgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.lp-hcard { background: #2f2560; border: 3px solid #4a3d8a; border-radius: 14px; padding: 16px 10px 14px; text-align: center; position: relative; }
.lp-hcard--star { border-color: var(--lp-gold); box-shadow: 0 0 0 3px rgba(255,210,63,.22), 5px 5px 0 rgba(0,0,0,.3); }
.lp-hcard--locked { opacity: .62; }
.lp-lock { position: absolute; top: 8px; right: 10px; font-size: 13px; }
.lp-hcard__ava { display: block; width: 72px; height: 54px; margin: 0 auto; image-rendering: pixelated; filter: drop-shadow(0 3px 0 #0006); }
.lp-hcard__name { font-family: var(--lp-mono); font-weight: 700; font-size: 11px; margin: 10px 0 4px; color: #fff; }
.lp-hcard__role { font-size: 13px; font-weight: 600; color: #c7cdf0; }
.lp-tag2 { display: inline-block; margin-top: 10px; font-family: var(--lp-mono); font-weight: 700; font-size: 8px; letter-spacing: .04em; padding: 4px 7px; border-radius: 6px; }
.lp-tag2--free { background: #7cd04a; color: #123; }
.lp-tag2--power { background: var(--lp-gold); color: #3a2a00; }
.lp-tag2--secret { background: var(--lp-pink); color: #fff; }
.lp-note { text-align: center; margin-top: 24px; font-family: var(--lp-mono); font-weight: 700; font-size: 9px; color: #9aa0d8; line-height: 1.7; }

/* ---- how it plays ---- */
.lp-how { background: var(--lp-paper); }
.lp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 26px; align-items: start; margin-top: 30px; }
.lp-step { background: #fff; border: 4px solid var(--lp-ink); box-shadow: 5px 5px 0 var(--lp-shadow); padding: 24px 20px 20px; text-align: center; position: relative; }
.lp-step__n { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); width: 38px; height: 38px; display: grid; place-items: center; font-family: var(--lp-mono); font-weight: 700; font-size: 14px; color: #fff; background: var(--lp-pink); border: 4px solid var(--lp-ink); border-radius: 50%; }
.lp-step__ill { margin: 10px auto 14px; display: flex; align-items: center; justify-content: center; }
.lp-step__scene { display: block; width: 100%; max-width: 190px; height: auto; image-rendering: pixelated; border: 4px solid var(--lp-ink); box-shadow: 4px 4px 0 var(--lp-shadow); }
.lp-emoji { font-size: 38px; }
.lp-gate { font-family: var(--lp-mono); font-weight: 700; font-size: 16px; color: #fff; background: linear-gradient(180deg,#3a2e63,#241a4a); border: 4px solid var(--lp-ink); border-radius: 12px; padding: 14px 16px; box-shadow: 0 0 0 4px rgba(255,210,63,.32), 0 7px 0 rgba(26,19,48,.32); display: flex; align-items: center; gap: 8px; }
.lp-gate__q { color: var(--lp-gold); }
.lp-step__t { font-family: var(--lp-mono); font-weight: 700; font-size: 12px; margin-bottom: 10px; color: var(--lp-ink); }
.lp-step__d { font-size: 15px; font-weight: 600; color: var(--lp-ink-soft); line-height: 1.45; }

/* ---- final CTA ---- */
.lp-final { background: repeating-linear-gradient(90deg,#c9803f 0 24px,#a8632f 24px 26px); border-top: 6px solid var(--lp-ink); }
.lp-final__grass { height: 20px; background: repeating-linear-gradient(90deg,#7cd04a 0 16px,#3a9e2a 16px 18px); }
.lp-final__inner { padding: 52px 18px 60px; text-align: center; }
.lp-final__sub { color: #fff7e6; font-weight: 700; font-size: 15px; line-height: 1.5; max-width: 40ch; margin: 0 auto 26px; }
.lp-final .lp-btn--play { margin: 0 auto; }

@media (max-width: 360px) { .lp-wgrid, .lp-hgrid { grid-template-columns: 1fr; } }
@media (min-width: 720px) {
  .lp-sec { padding: 72px 32px; }
  .lp-hero__copy { padding-top: calc(52px + var(--safe-top)); }
  .lp-eyebrow { font-size: 12px; }
  .lp-tag { font-size: 18px; max-width: 52ch; }
  .lp-h2 { font-size: clamp(24px, 3vw, 34px); }
  .lp-sub { font-size: 17px; }
  .lp-cta { flex-direction: row; max-width: 600px; }
  .lp-cta .lp-btn { flex: 1; }
  .lp-wgrid, .lp-hgrid { grid-template-columns: repeat(4, 1fr); }
  .lp-final__inner { padding: 72px 20px 84px; }
}
@media (prefers-reduced-motion: reduce) { .lp-btn { transition: none; } }

.rep-who { font-weight: 800; color: var(--brand); margin: 0 0 12px; font-size: 15px; }

/* ---------------- dashboard ---------------- */
.dash-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px 14px; }
.dash-level { display: flex; align-items: center; gap: 12px; }
.ring { position: relative; width: 52px; height: 52px; }
.ring svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.ring__bg { fill: none; stroke: var(--line); stroke-width: 5; }
.ring__fg { fill: none; stroke: url(#g); stroke: var(--brand); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 119.4; stroke-dashoffset: 119.4; transition: stroke-dashoffset .6s ease; }
.ring__num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 19px; }
.dash-level__meta { display: flex; flex-direction: column; line-height: 1.15; }
.dash-rank { font-weight: 900; font-size: 17px; }
.dash-xp { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.streak-pill { border: none; background: linear-gradient(135deg, #ff7a3d, var(--accent)); color: #fff;
  border-radius: 999px; padding: 9px 15px 9px 12px; display: flex; align-items: center; gap: 5px;
  font-weight: 900; font-size: 18px; box-shadow: 0 8px 18px rgba(255,61,129,.35); cursor: pointer; }
.streak-pill:active { transform: scale(.95); }
.streak-freeze { font-size: 15px; margin-left: 1px; }
.streak-flame { font-size: 20px; filter: grayscale(1) opacity(.55); }
.streak-pill.is-lit .streak-flame { filter: none; animation: flick 1.6s ease-in-out infinite; }
@keyframes flick { 0%,100%{transform:scale(1) rotate(-3deg);} 50%{transform:scale(1.12) rotate(3deg);} }

.daily-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.daily-card__head { display: flex; justify-content: space-between; align-items: baseline; }
.daily-card__title { font-weight: 800; }
.daily-card__count { color: var(--ink-soft); font-weight: 800; }
.daily-card__count b { color: var(--brand); font-size: 18px; }
.goalbar { height: 14px; background: var(--line); border-radius: 999px; margin: 10px 0 8px; overflow: hidden; }
.goalbar__fill { height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--lime)); transition: width .5s ease; }
.daily-card__msg { margin: 0; font-size: 13px; color: var(--ink-soft); font-weight: 600; }

.cta { width: 100%; border: none; margin-top: 14px; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(120deg, var(--brand), var(--brand-2) 55%, var(--accent));
  color: #fff; padding: 18px; display: flex; align-items: center; gap: 14px; text-align: left;
  box-shadow: 0 12px 26px rgba(91,61,240,.4); }
.cta:active { transform: scale(.98); }
.cta__icon { font-size: 34px; }
.cta__text { display: flex; flex-direction: column; flex: 1; }
.cta__title { font-size: 21px; font-weight: 900; }
.cta__sub { font-size: 13px; opacity: .9; font-weight: 600; }
.cta__go { font-size: 26px; font-weight: 900; }
.cta--practice { background: linear-gradient(120deg, #43c56f, #2fa457); box-shadow: 0 12px 26px rgba(47, 157, 85, .38); }
.cta--badges { background: linear-gradient(120deg, #ffca4a, #ff9e2e); box-shadow: 0 12px 26px rgba(255, 150, 60, .38); }
.cta--badges .cta__sub { color: #3a2600; opacity: 1; }

.practice-intro { text-align: center; padding: 22px 18px; margin-top: 8px; }
.practice-intro__emoji { font-size: 56px; display: block; line-height: 1; }
.practice-intro__title { font-size: 22px; font-weight: 900; margin: 12px 0 6px; }
.practice-intro__text { font-size: 14px; line-height: 1.55; color: var(--ink-soft); max-width: 30ch; margin: 0 auto; }

.menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.tile { border: none; border-radius: 18px; padding: 16px 6px 12px; background: var(--card); box-shadow: var(--shadow-sm);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--ink); }
.tile:active { transform: scale(.94); }
.tile__emoji { font-size: 28px; }
.tile__label { font-size: 13px; font-weight: 800; }

.grownup-link { display: block; margin: 20px auto 0; border: none; background: transparent;
  color: var(--ink-soft); font-weight: 700; font-size: 14px; padding: 10px; cursor: pointer; }
.grownup-link:active { opacity: .6; }

/* ============ QUEST HUB (home) ============ */
canvas[data-pix] { image-rendering: pixelated; display: block; }
body[data-screen="home"] #app { max-width: 1000px; }
.hub { display: flex; flex-direction: column; gap: 14px; }
.hub-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player-switch__av { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; background: #0e0930; border-radius: 5px; overflow: hidden; }
.player-switch__av canvas { width: 36px; height: 36px; image-rendering: pixelated; }
.streak-pill { display: flex; align-items: center; gap: 8px; padding: 7px 13px; color: #fff; }
.streak-flame-c { width: 16px; height: 20px; image-rendering: pixelated; filter: grayscale(1) opacity(.5); }
.streak-pill.is-lit .streak-flame-c { filter: none; animation: flick 1.6s ease-in-out infinite; }
.streak-meta { display: flex; flex-direction: column; line-height: 1; text-align: left; }
.streak-meta .streak-num { font-size: 16px; font-weight: 800; }
.streak-meta small { font-size: 8px; letter-spacing: .12em; opacity: .9; margin-top: 2px; }

.hub-grid { display: flex; flex-direction: column; gap: 14px; }
.hub-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.hub-hero { display: flex; align-items: center; gap: 12px; background: var(--card); padding: 12px 14px; }
.hub-hero .ring { width: 52px; height: 52px; flex: none; }
.hub-hero__meta { flex: 1; min-width: 0; }
.hub-hero__meta .dash-rank { font-size: 18px; }
.xpbar { height: 9px; background: #0b0e24; border: 2px solid #4a3f8a; margin: 6px 0 4px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffe27a, #ffd23f); width: 0; }
.hub-hero .dash-xp { font-size: 11px; color: var(--ink-soft); font-weight: 700; letter-spacing: .04em; }
.purse { display: flex; flex-direction: column; gap: 6px; flex: none; }
.coinpill { display: flex; align-items: center; gap: 5px; background: #0e0930; border: 2px solid #3a2f72; border-radius: 6px; padding: 4px 8px 4px 5px; font-weight: 800; font-size: 13px; color: #fff; }
.coinpill canvas { width: 10px; height: 10px; }

.mapcard { background: var(--card); border: 3px solid #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 11px 12px 12px; }
.mapcard__lab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.mapcard__lab span { font-size: 10px; letter-spacing: .12em; color: var(--ink-soft); font-weight: 800; }
.mapcard__go { border: none; background: none; color: #ffd23f; font-family: inherit; font-weight: 800; font-size: 10px; letter-spacing: .06em; cursor: pointer; }
.worlds { display: flex; gap: 6px; align-items: flex-end; }
.world { flex: 1; position: relative; }
.world__tile { width: 100%; aspect-ratio: 1; border: 2px solid #0b0722; border-radius: 4px; box-shadow: 0 2px 0 rgba(0,0,0,.35); position: relative; overflow: hidden; }
.world__tile::after { content: ""; position: absolute; inset: 0 0 55% 0; background: rgba(255,255,255,.16); }
.world.cur { transform: translateY(-4px); }
.world.cur .world__tile { border-color: #ffd23f; box-shadow: 0 0 0 2px #ffd23f, 0 3px 0 rgba(0,0,0,.4); }
.world.lock .world__tile { filter: grayscale(.6) brightness(.6); }
.world__b { position: absolute; top: -6px; right: -4px; width: 15px; height: 15px; display: grid; place-items: center; font-size: 9px; border-radius: 50%; border: 2px solid #0b0722; }
.world__b--done { background: #57c84a; color: #0b3d12; }
.world__b--cur { background: #ffd23f; color: #3a2400; }
.world__nm { font-size: 7px; color: #ffd23f; text-align: center; margin-top: 4px; letter-spacing: .02em; white-space: nowrap; min-height: 9px; }

.pips { display: flex; gap: 3px; margin: 11px 0 9px; }
.pips i { flex: 1; height: 12px; background: #0b0e24; border: 2px solid #4a3f8a; }
.pips i.on { background: linear-gradient(180deg, #ffe27a, #ffd23f); border-color: #c9930a; }

.hub .cta { position: relative; margin-top: 0; align-items: center; }
.cta__tag { position: absolute; top: -9px; left: 14px; font-size: 8px; letter-spacing: .1em; background: #0b0722; color: #ffd23f; border: 2px solid #ffd23f; border-radius: 20px; padding: 2px 7px; font-weight: 800; }
.hub .cta__icon { width: 46px; height: 46px; flex: none; background: rgba(255,255,255,.26); border: 2px solid rgba(0,0,0,.22); border-radius: 9px; display: grid; place-items: center; font-size: 0; }
.hub .cta__icon canvas { width: auto; height: 30px; }
.hub .cta__go { width: 24px; flex: none; display: grid; place-items: center; font-size: 0; }
.hub .cta__go canvas { width: 14px; height: auto; }

.hub .grownup-link { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 4px; }
.hub .grownup-link canvas { width: 13px; height: 15px; }

/* desktop: two balanced columns — info on the left, quest cards on the right
   as equal vertical cards that stretch to match the left column's height */
/* quest map banner — the in-game Quest Land, big across the top */
.hub-map { display: block; width: 100%; position: relative; padding: 0; overflow: hidden; cursor: pointer;
  border: 3px solid #fff; border-radius: var(--radius); box-shadow: var(--shadow); background: #1f5fa8; height: 150px; }
.hub-map canvas { display: block; width: 100%; height: 100%; }
.hub-map__lab { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; background: linear-gradient(0deg, rgba(8,10,24,.9), rgba(8,10,24,0)); font-family: var(--mono); text-align: left; }
.hub-map__lab b { color: #ffd23f; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-shadow: 1px 1px 0 #000; }
.hub-map__lab span { color: #cfd6ff; font-size: 9px; letter-spacing: .08em; }
.hub-map:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.85); }

@media (min-width: 820px) {
  body[data-screen="home"] #app { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; }
  .hub { width: 100%; margin: auto 0; }
  .hub-map { height: 220px; }
  .hub-grid { display: block; }
  .hub-col--a { margin-bottom: 16px; }
  .hub-col--b { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .hub-col--b .cta { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px 16px; min-height: 158px; }
  .hub-col--b .cta__text { flex: none; align-items: center; }
  .hub-col--b .cta__title { font-size: 22px; }
  .hub-col--b .cta__sub { font-size: 12px; }
  .hub-col--b .cta__go { display: none; }
  .hub-col--b .cta__icon { width: 58px; height: 58px; }
  .hub-col--b .cta__icon canvas { height: 36px; }
  .hub-col--b .cta__tag { left: 50%; transform: translateX(-50%); }
}

/* ============ GROWN-UPS report — desktop-fluid masonry ============ */
body[data-screen="parent"] #app { max-width: 1080px; }
.rep-section { margin: 0 0 16px; }
.rep-section > .rep-h:first-child { margin-top: 0; }
.rep-section--snap { display: flex; flex-direction: column; gap: 12px; }
.rep-section .btn-secondary { display: block; width: 100%; }
.rep-section .btn-secondary + .btn-secondary { margin-top: 10px; }
.rep-section .btn-reset { margin-top: 10px; }
@media (min-width: 720px) {
  #parent-report .rep-grid { grid-template-columns: repeat(4, 1fr); }
  .rep-cols { columns: 2; column-gap: 20px; margin-top: 6px; }
  .rep-section { break-inside: avoid; -webkit-column-break-inside: avoid; display: inline-block; width: 100%; vertical-align: top; }
}

/* ============ other screens on desktop ============ */
body[data-screen="badges"] #app { max-width: 820px; }
@media (min-width: 720px) { #badge-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 980px) { #badge-grid { grid-template-columns: repeat(6, 1fr); } }

/* quiz — a bigger centered arcade stage on desktop */
body[data-screen="play"] #app { max-width: 640px; }
@media (min-width: 720px) {
  .screen--play .question { font-size: 88px; margin: 7vh 0 3vh; }
  .answer-box { max-width: 340px; }
  .keypad { max-width: 400px; gap: 12px; }
  .keypad .key { font-size: 26px; padding: 20px 0; }
  .answers { max-width: 460px; margin-left: auto; margin-right: auto; }
}


/* ---------------- topbar ---------------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 4px 0 14px; min-height: 52px; }
.topbar__title { font-size: 21px; font-weight: 900; margin: 0; }
.topbar__spacer { flex: 1; }
.btn-back { border: none; background: var(--card); color: var(--brand); width: 42px; height: 42px; border-radius: 50%;
  font-size: 28px; font-weight: 900; cursor: pointer; box-shadow: var(--shadow-sm); display: flex; align-items: center;
  justify-content: center; padding-bottom: 4px; flex: none; }
.btn-back:active { transform: scale(.9); }

/* ---------------- pickers ---------------- */
.picker-label { text-align: center; color: var(--ink-soft); font-weight: 700; margin: 6px 0 12px; }
.number-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }
.num-btn { border: none; aspect-ratio: 1/1; border-radius: 16px; background: var(--card); color: var(--ink);
  font-size: 24px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow-sm); position: relative; }
.num-btn:active { transform: scale(.92); }
.num-btn.is-selected { background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff;
  box-shadow: 0 8px 18px rgba(91,61,240,.4); }
.num-btn.is-selected::after { content: "✓"; position: absolute; top: 3px; right: 7px; font-size: 12px; }

.setup-actions { display: flex; gap: 9px; justify-content: center; margin: 16px 0 4px; flex-wrap: wrap; }
.chip { border: none; background: var(--card); color: var(--brand); font-weight: 800; padding: 10px 15px;
  border-radius: 999px; cursor: pointer; box-shadow: var(--shadow-sm); font-size: 14px; }
.chip:active { transform: scale(.94); }
.chip--accent { color: var(--accent); }

.seg { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.seg__label { color: var(--ink-soft); font-weight: 700; }
.seg__btn { border: none; background: var(--card); color: var(--ink-soft); font-weight: 800; padding: 9px 15px;
  border-radius: 999px; cursor: pointer; box-shadow: var(--shadow-sm); min-width: 46px; }
.seg__btn.is-on { background: var(--brand); color: #fff; }
.seg__btn:active { transform: scale(.94); }
.seg--wrap { gap: 7px; margin: 8px 0 4px; }
.seg--wrap .seg__btn { padding: 8px 12px; font-size: 14px; min-width: 0; }

/* ---------------- buttons ---------------- */
.btn-primary, .btn-secondary { display: block; width: 100%; border: none; border-radius: 16px; padding: 17px;
  font-size: 18px; font-weight: 900; cursor: pointer; margin-top: 14px; }
.btn-primary { background: linear-gradient(120deg, var(--brand), var(--accent)); color: #fff;
  box-shadow: 0 10px 22px rgba(91,61,240,.38); }
.btn-primary:disabled { opacity: .45; box-shadow: none; }
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-secondary { background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm); }
.btn-secondary:active { transform: scale(.98); }

/* ---------------- learn ---------------- */
.table-list { margin-top: 8px; }
.table-row { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--card);
  border-radius: 14px; padding: 13px 16px; margin-bottom: 9px; box-shadow: var(--shadow-sm); font-size: 21px;
  font-weight: 700; animation: pop .3s ease backwards; }
.table-row .eq { color: var(--ink-soft); }
.table-row .res { color: var(--brand); font-weight: 900; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96);} to { opacity: 1; transform: none; } }

/* ---------------- play (quiz) ---------------- */
.quiz-progress { flex: 1; height: 12px; background: var(--card); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.12); }
.quiz-progress__bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 999px; transition: width .35s ease; }
.combo { font-weight: 900; font-size: 16px; color: var(--accent); min-width: 52px; text-align: right; animation: pop .25s ease; }
.play-scoreline { display: flex; justify-content: space-between; color: var(--ink-soft); font-weight: 800; font-size: 14px; margin: 6px 2px 0; }
#play-xp { color: var(--brand); }

.timerbar { height: 6px; background: var(--line); border-radius: 999px; margin: 10px 0 0; overflow: hidden; }
.timerbar__fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--lime), var(--amber)); }
.timerbar__fill.low { background: linear-gradient(90deg, var(--amber), var(--bad)); }

.question { text-align: center; font-size: 60px; font-weight: 900; letter-spacing: -1px; margin: 5vh 0 2vh; }
.answer-box { max-width: 260px; margin: 0 auto; background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 14px; text-align: center; border: 3px solid transparent; }
.answer-box.good { border-color: var(--good); }
.answer-box.bad { border-color: var(--bad); animation: shake .4s ease; }
.answer-display { font-size: 46px; font-weight: 900; color: var(--brand); letter-spacing: 2px; }
.answer-display.placeholder { color: var(--ink-soft); opacity: .5; }

.feedback { text-align: center; font-size: 20px; font-weight: 800; min-height: 30px; margin-top: 12px; }
.feedback.good { color: var(--good); } .feedback.bad { color: var(--bad); }
.feedback.reveal { font-size: 15px; font-weight: 700; line-height: 1.35; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 14px auto 0; }
.key { border: none; border-radius: 16px; padding: 16px 0; font-size: 26px; font-weight: 800; background: var(--card);
  color: var(--ink); box-shadow: var(--shadow-sm); cursor: pointer; }
.key:active { transform: scale(.93); background: var(--card-2); }
.key--del { color: var(--ink-soft); }
.key--enter { background: linear-gradient(120deg, var(--brand), var(--accent)); color: #fff; }

.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.answer { border: none; border-radius: 18px; padding: 24px 10px; font-size: 30px; font-weight: 900; background: var(--card);
  color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm); }
.answer:active { transform: scale(.94); }
.answer.is-correct { background: var(--good); color: #fff; animation: rightpop .4s ease; }
.answer.is-wrong { background: var(--bad); color: #fff; }
@keyframes rightpop { 0%{transform:scale(1);}50%{transform:scale(1.08);}100%{transform:scale(1);} }
@keyframes shake { 0%,100%{transform:translateX(0);}25%{transform:translateX(-7px);}75%{transform:translateX(7px);} }

/* ---------------- adventure — 8-bit Quest Land ---------------- */
.screen--adv { animation: none; }
.screen--adv.is-active { position: fixed; inset: 0; z-index: 60; }
.screen--splash { animation: none; }
.screen--splash.is-active { position: fixed; inset: 0; z-index: 90; display: block; background: #0a0820; }
#splash-c { display: block; width: 100vw; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: manipulation; cursor: pointer; }
#adv-game { position: fixed; inset: 0; width: 100vw; height: 100%;
  background: #0b0d18; overflow: hidden;
  font-family: ui-monospace, "Courier New", monospace; }
#adv-c { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none;
  /* iOS Safari won't composite a canvas inside a position:fixed layer until a repaint is forced — give it its own GPU layer so every frame paints */
  transform: translateZ(0); -webkit-transform: translateZ(0); backface-visibility: hidden; -webkit-backface-visibility: hidden; }

.adv8-hud { position: absolute; top: calc(var(--safe-top) + 8px); left: 10px; right: 10px; display: flex;
  align-items: flex-start; justify-content: space-between; pointer-events: none; z-index: 5; }
.adv8-hud.hidden { display: none; }
.adv8-box { background: #101828; border: 3px solid #fff; box-shadow: 3px 3px 0 #000; color: #fff; font-weight: 700;
  padding: 5px 9px; font-size: 13px; letter-spacing: .02em; image-rendering: pixelated; }
#adv-hearts { display: flex; gap: 3px; } #adv-hearts canvas { width: 20px; height: 18px; image-rendering: pixelated; }
.adv8-hmid { text-align: center; line-height: 1.15; } .adv8-hmid small { display: block; font-size: 10px; color: #ffd23f; letter-spacing: .1em; }
#adv-coins { display: flex; align-items: center; gap: 6px; } #adv-coin-icon { width: 16px; height: 16px; image-rendering: pixelated; }

#adv-pmap { position: absolute; left: 12px; right: 12px; top: calc(var(--safe-top) + 52px); height: 16px; z-index: 5; pointer-events: none; }
#adv-pmap.hidden { display: none; }
#adv-pmapTrack { position: absolute; left: 0; right: 0; top: 5px; height: 6px; background: #101828; border: 2px solid #fff; }
#adv-pmapFill { position: absolute; left: 2px; top: 7px; height: 4px; background: #ffd23f; width: 0%; }
#adv-pmap .tick { position: absolute; top: 0; width: 12px; height: 12px; margin-left: -6px; background: #101828; border: 2px solid #fff; }
#adv-pmap .tick.done { background: #3ad44a; }
#adv-pmapHero { position: absolute; top: -6px; margin-left: -9px; width: 18px; height: 18px; image-rendering: pixelated; }

#adv-tapHint { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 12px); text-align: center;
  color: #fff; font-size: 11px; text-shadow: 2px 2px 0 #000; pointer-events: none; z-index: 5; }
#adv-tapHint.hidden { display: none; }

#adv-quit { position: absolute; left: 10px; bottom: calc(var(--safe-bottom) + 10px); z-index: 13;
  background: #101828; color: #fff; border: 3px solid #fff; box-shadow: 3px 3px 0 #000; font-family: inherit;
  font-weight: 800; font-size: 13px; padding: 6px 10px; cursor: pointer; }
#adv-quit.hidden { display: none; } #adv-quit:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }

.adv8-ov { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; color: #fff; padding: 18px; z-index: 10; }
.adv8-ov.hidden { display: none; }
.adv8-scrim { position: absolute; inset: 0; background: rgba(8,8,20,.82); }
.adv8-panel { position: relative; background: #141a2e; border: 4px solid #fff; box-shadow: 6px 6px 0 #000; padding: 18px 16px; max-width: 520px; width: 100%; }
.adv8-panel h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; text-shadow: 2px 2px 0 #000; letter-spacing: .02em; color: #ffd23f; }
.adv8-panel p { font-size: 12.5px; line-height: 1.5; color: #cfd6ff; max-width: 40ch; margin: 0 auto; }
.adv8-close { position: absolute; top: 8px; right: 8px; background: #2a3350; color: #fff; border: 3px solid #fff;
  box-shadow: 2px 2px 0 #000; font-family: inherit; font-weight: 800; font-size: 13px; padding: 3px 9px; cursor: pointer; }
.adv8-starrow { display: flex; gap: 8px; justify-content: center; } .adv8-starrow canvas { width: 36px; height: 36px; image-rendering: pixelated; }
.adv8-btn { background: #ffb020; color: #241000; border: 3px solid #fff; box-shadow: 3px 3px 0 #000; padding: 12px 20px;
  font-family: inherit; font-size: 15px; font-weight: 800; cursor: pointer; letter-spacing: .02em; }
.adv8-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }
.adv8-btn.ghost { background: #2a3350; color: #fff; }
.adv8-btnrow { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.adv8-unlocks { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.adv8-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

#adv-charRow { display: flex; gap: 8px; justify-content: flex-start; margin: 4px 0; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
#adv-charRow .adv8-charBtn { flex: 0 0 auto; }
.adv8-charBtn { background: #0e1424; border: 3px solid #46507a; box-shadow: 2px 2px 0 #000; padding: 6px 6px 3px; cursor: pointer; width: 64px; }
.adv8-charBtn.on { border-color: #ffd23f; }
.adv8-charBtn canvas { width: 48px; height: 44px; image-rendering: pixelated; display: block; margin: 0 auto; }
.adv8-charName { font-size: 10px; color: #cfd6ff; text-align: center; margin-top: 2px; }
#adv-mapCanvas { width: 100%; height: auto; image-rendering: pixelated; margin: 8px 0 4px; cursor: pointer; }
.adv8-hint { font-size: 11px; color: #8f9ac9; }
#adv-gemInfo { color: #d6a8ff; font-weight: 700; }

/* ---- full-screen Quest Land map ---- */
.adv8-ov--map { padding: 0; gap: 0; }
.map-stage { position: absolute; inset: 0; overflow: hidden; }
.adv8-ov--map #adv-mapCanvas { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; image-rendering: pixelated; cursor: pointer; touch-action: manipulation;
  transform: translateZ(0); -webkit-transform: translateZ(0); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.map-title { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 2; text-align: center;
  font-size: 22px; font-weight: 800; color: #ffd23f; text-shadow: 2px 2px 0 #000, 0 0 12px rgba(0,0,0,.6); letter-spacing: .04em; pointer-events: none; margin: 0; }
.adv8-ov--map .adv8-close { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); z-index: 3; }
.map-dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(8,8,20,.9) 55%, rgba(8,8,20,0)); }
.map-dock #adv-charRow { justify-content: center; margin: 0 auto; max-width: 520px; }
.map-foot { text-align: center; margin-top: 3px; }
#adv-gemInfo.flash { animation: gemflash .7s; }
@keyframes gemflash { 0%,100%{color:#d6a8ff;} 40%{color:#fff;transform:scale(1.06);} }
.adv8-gem { color: #c088ff; margin-left: 8px; font-size: 12px; }
.adv8-charBtn.locked { opacity: .8; }
.adv8-charBtn.locked .adv8-charName { color: #8f9ac9; }
.adv8-charCost { font-size: 8px; color: #d6a8ff; text-align: center; margin-top: 1px; letter-spacing: .04em; }

#adv-math { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; z-index: 12; }
#adv-math.hidden { display: none; }
#adv-sheet { position: relative; pointer-events: auto; width: 100%; max-width: 440px; margin: 0 8px calc(var(--safe-bottom) + 12px);
  background: #141a2e; border: 4px solid #fff; box-shadow: 0 -6px 0 #000, 6px 0 0 #000, -6px 0 0 #000; padding: 14px 14px 16px; }
.adv8-tag { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: #ff4fa3; color: #fff; border: 3px solid #fff;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 4px 12px; white-space: nowrap; }
#adv-sheet.escape { border-color: #ff4f5a; box-shadow: 0 -6px 0 #7a0010, 6px 0 0 #7a0010, -6px 0 0 #7a0010; animation: shake .3s; }
#adv-sheet.escape .adv8-tag { background: #ff3b30; }
#adv-mq { text-align: center; font-size: 34px; font-weight: 800; color: #ffd23f; margin: 10px 0 8px; text-shadow: 2px 2px 0 #000; }
#adv-mabox { max-width: 200px; margin: 0 auto 8px; background: #0e1424; border: 3px solid #46507a; padding: 8px; text-align: center; }
#adv-mabox.good { border-color: #3ad44a; } #adv-mabox.bad { border-color: #ff4f5a; animation: shake .3s; }
#adv-mhint { min-height: 15px; text-align: center; font-size: 13px; font-weight: 800; color: #ffd27a; margin: 2px auto 8px; max-width: 320px; line-height: 1.3; text-shadow: 1px 1px 0 #000; }
#adv-mhint.reveal { color: #9fe4ff; font-size: 12px; }
#adv-mhint:empty { min-height: 0; margin: 0; }
#adv-mdisp { font-size: 32px; font-weight: 800; color: #fff; letter-spacing: 3px; } #adv-mdisp.ph { color: #46507a; }
.adv8-kpad { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; max-width: 320px; margin: 0 auto; }
.adv8-kpad .key { background: #e8ecff; color: #141a2e; border: 3px solid #fff; box-shadow: 2px 2px 0 #000; padding: 12px 0;
  font-family: inherit; font-size: 22px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 0; }
.adv8-kpad .key:active { transform: translate(2px,2px); box-shadow: 0 0 0 #000; }
.adv8-kpad .key.key--enter { background: #3ad44a; color: #06210a; } .adv8-kpad .key.key--del { background: #ff8ea0; }

/* ---------------- results ---------------- */
.screen--results { text-align: center; padding-top: 5vh; position: relative; }
.results__title { font-size: 32px; font-weight: 900; margin: 6px 0; }
.results__score { font-size: 54px; font-weight: 900; color: var(--brand); }
.results__stars { font-size: 40px; margin: 6px 0; min-height: 48px; letter-spacing: 4px; }
.results__row { display: flex; justify-content: center; gap: 10px; margin: 10px 0 6px; }
.results__stat { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); min-width: 90px; }
.results__stat b { display: block; font-size: 22px; font-weight: 900; color: var(--brand); }
.results__stat span { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.badge-unlocks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.badge-pop { background: linear-gradient(120deg, var(--amber), var(--accent)); color: #fff; border-radius: 999px;
  padding: 8px 14px; font-weight: 800; font-size: 14px; box-shadow: var(--shadow-sm); animation: pop .4s cubic-bezier(.2,1.3,.4,1) backwards; }
.results__msg { color: var(--ink-soft); font-weight: 700; font-size: 16px; margin: 6px 18px 18px; }
.results-actions { max-width: 320px; margin: 0 auto; }
.results-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(120vh) rotate(720deg); opacity: .9; } }

/* ---------------- badges screen ---------------- */
.hero-stats { display: flex; gap: 10px; margin-bottom: 18px; }
.hero-stat { flex: 1; background: var(--card); border-radius: 16px; padding: 14px 6px; text-align: center; box-shadow: var(--shadow-sm); }
.hero-stat b { display: block; font-size: 26px; font-weight: 900; color: var(--brand); }
.hero-stat span { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.badge { background: var(--card); border-radius: 16px; padding: 14px 6px; text-align: center; box-shadow: var(--shadow-sm); }
.badge.locked { opacity: .4; filter: grayscale(1); }
.badge__icon { font-size: 34px; }
.badge__name { font-size: 12px; font-weight: 800; margin-top: 4px; }
.badge__desc { font-size: 10px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; line-height: 1.2; }

/* ---------------- parent report ---------------- */
.gate { text-align: center; background: var(--card); border-radius: var(--radius); padding: 26px 20px; box-shadow: var(--shadow); margin-top: 10px; }
.gate__lock { font-size: 40px; }
.gate__label { color: var(--ink-soft); font-weight: 700; margin: 8px 0; }
.gate__q { font-size: 40px; font-weight: 900; margin: 4px 0 14px; }
.gate__input { width: 160px; text-align: center; font-size: 28px; font-weight: 800; padding: 12px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--card-2); color: var(--ink); }
.gate__err { color: var(--bad); font-weight: 700; margin: 10px 0 0; }
.gate .btn-primary { max-width: 220px; margin: 14px auto 0; }

.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rep-cell { background: var(--card); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm); }
.rep-cell b { display: block; font-size: 26px; font-weight: 900; color: var(--brand); }
.rep-cell span { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.rep-h { font-size: 16px; font-weight: 900; margin: 22px 0 10px; }
.rep-sub { font-weight: 600; color: var(--ink-soft); font-size: 12px; }
.rep-note { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin: 0 0 10px; }

.activity { display: flex; align-items: flex-end; gap: 6px; height: 110px; background: var(--card); border-radius: 14px;
  padding: 12px 10px 8px; box-shadow: var(--shadow-sm); }
.act-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.act-bar { width: 100%; max-width: 22px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 6px 6px 3px 3px; min-height: 3px; transition: height .4s ease; }
.act-bar.met { background: linear-gradient(180deg, var(--lime), #16a34a); }
.act-bar.zero { background: var(--line); }
.act-day { font-size: 10px; color: var(--ink-soft); font-weight: 700; }

.tablebars { display: flex; flex-direction: column; gap: 7px; }
.tbar { display: flex; align-items: center; gap: 8px; }
.tbar__n { width: 26px; text-align: right; font-weight: 800; font-size: 14px; }
.tbar__track { flex: 1; height: 16px; background: var(--line); border-radius: 999px; overflow: hidden; }
.tbar__fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.tbar__pct { width: 58px; font-size: 12px; color: var(--ink-soft); font-weight: 700; text-align: right; }

.tricky { display: flex; flex-wrap: wrap; gap: 8px; }
.tricky__item { background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-sm); text-align: center; }
.tricky__fact { font-weight: 900; font-size: 17px; }
.tricky__pct { font-size: 11px; color: var(--bad); font-weight: 800; }
.tricky--none { color: var(--ink-soft); font-weight: 700; }

.heatmap { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
.hm-cell { aspect-ratio: 1/1; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; }
.hm-head { color: var(--ink-soft); background: transparent !important; }

.goal-setter { display: flex; align-items: center; justify-content: space-between; background: var(--card);
  border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-sm); font-weight: 800; }
.goal-stepper { display: flex; align-items: center; gap: 10px; }
.goal-stepper b { min-width: 34px; text-align: center; font-size: 20px; color: var(--brand); }
.goal-unit { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.step { border: none; width: 34px; height: 34px; border-radius: 10px; background: var(--card-2); color: var(--brand);
  font-size: 22px; font-weight: 900; cursor: pointer; }
.step:active { transform: scale(.9); }
.focus-block { background: var(--card); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm); margin-top: 12px; }
.focus-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; gap: 8px; flex-wrap: wrap; }
.focus-actions { display: flex; gap: 6px; }
.chip--sm { padding: 6px 11px; font-size: 12px; box-shadow: none; background: var(--card-2); }
.mini-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 10px; }
.mini-btn { border: none; padding: 10px 0; border-radius: 10px; background: var(--card-2); color: var(--ink);
  font-weight: 800; font-size: 15px; cursor: pointer; }
.mini-btn:active { transform: scale(.9); }
.mini-btn.is-on { background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card);
  border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-sm); margin-top: 12px; }
.toggle-row__label { font-weight: 800; }
.toggle-row__hint { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 600; margin-top: 3px; max-width: 240px; }
.switch { flex: none; width: 52px; height: 30px; border-radius: 999px; border: none; background: var(--line); cursor: pointer; position: relative; transition: background .2s ease; }
.switch__dot { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s ease; }
.switch[aria-checked="true"] { background: var(--lime); }
.switch[aria-checked="true"] .switch__dot { transform: translateX(22px); }

.btn-reset { margin-top: 20px; color: var(--bad); }

/* ---- richer parent report: mastery, insight, trend, fluency ---- */
.rep-mastery { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; padding: 16px 18px; margin-top: 16px; }
.mst-head { display: flex; align-items: center; gap: 12px; }
.mst-big { font-size: 44px; font-weight: 900; line-height: .9; text-shadow: 2px 2px 0 rgba(0,0,0,.25); }
.mst-of { font-size: 13px; font-weight: 800; line-height: 1.15; }
.mst-bar { height: 12px; background: rgba(255,255,255,.28); border: 2px solid rgba(0,0,0,.25); margin: 12px 0 10px; }
.mst-bar span { display: block; height: 100%; background: #ffd23f; transition: width .5s ease; }
.mst-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.mst-tag { font-size: 11px; font-weight: 800; background: rgba(0,0,0,.2); padding: 5px 9px; border-radius: 8px; }
.rep-insight { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 3px solid var(--amber); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); margin-top: 12px; }
.rep-insight .insight-i { font-size: 20px; line-height: 1.2; }
.rep-insight p { margin: 0; font-weight: 700; font-size: 14px; line-height: 1.45; color: var(--ink); }
.rep-trend { background: var(--card); padding: 14px; box-shadow: var(--shadow-sm); }
.tr-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tr-c { text-align: center; }
.tr-c b { display: block; font-size: 24px; font-weight: 900; color: var(--brand); }
.tr-c > span { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.tr-delta { display: inline-block; margin-top: 4px; font-size: 10.5px; font-weight: 800; }
.tr-up { color: var(--good); } .tr-down { color: var(--bad); } .tr-flat { color: var(--ink-soft); }
.tr-bars { display: flex; align-items: flex-end; justify-content: space-around; gap: 10px; height: 96px; border-top: 2px solid var(--line); padding-top: 10px; }
.tr-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; }
.tr-bar { width: 30px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); min-height: 4px; }
.tr-bar.tr-empty { background: var(--line); }
.tr-p { font-size: 10px; font-weight: 800; color: var(--ink); }
.tr-l { font-size: 10px; font-weight: 700; color: var(--ink-soft); }
.fluency-list { display: flex; flex-wrap: wrap; gap: 7px; }
.fchip { background: var(--card); border: 2.5px solid var(--amber); color: var(--ink); border-radius: 10px; padding: 7px 10px; font-weight: 800; font-size: 14px; }
.btn-practice { display: block; width: 100%; margin: 12px 0 4px; padding: 13px; cursor: pointer; font-family: inherit;
  background: linear-gradient(140deg, var(--lime), #16a34a); color: #fff; font-weight: 900; font-size: 15px; }
.btn-practice:active { transform: scale(.98); }

/* ---------------- sound ---------------- */
.sound-toggle { position: fixed; right: calc(env(safe-area-inset-right,0px) + 12px); bottom: calc(var(--safe-bottom) + 12px);
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--card); box-shadow: var(--shadow-sm);
  font-size: 20px; cursor: pointer; z-index: 20; }
.sound-toggle:active { transform: scale(.9); }

@media (max-width: 350px) {
  .question { font-size: 46px; }
  .menu { gap: 8px; } .key { font-size: 22px; padding: 13px 0; }
}

/* ==================== 32-BIT ARCADE MENU THEME (portrait) ==================== */
:root {
  --bg: #0d1030; --bg2: #0a0c22;
  --card: #1b2144; --card-2: #28316a;
  --ink: #ffffff; --ink-soft: #9fabe0;
  --line: #3a4680;
  --brand: #ffd23f; --brand-2: #ffb020;
  --accent: #ff4fa3; --cyan: #37e0ff; --lime: #3ad44a;
  --good: #3ad44a; --bad: #ff5a6a; --amber: #ffd23f;
  --radius: 5px;
  --shadow: 5px 5px 0 rgba(0,0,0,.9);
  --shadow-sm: 3px 3px 0 rgba(0,0,0,.85);
}
body {
  font-family: ui-monospace, "SF Mono", "Roboto Mono", "Courier New", monospace;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 2px, transparent 2px 4px),
    radial-gradient(130% 60% at 82% -8%, rgba(124,92,255,.22), transparent 60%),
    radial-gradient(130% 60% at -10% 0%, rgba(255,79,163,.14), transparent 55%),
    linear-gradient(180deg, #12163a, #0a0c22);
  background-attachment: fixed;
}
/* pixel borders on panels + interactive tiles */
.daily-card, .pcard, .tile, .num-btn, .chip, .seg__btn, .btn-primary, .btn-secondary, .key, .answer,
.answer-box, .table-row, .results__stat, .hero-stat, .badge, .rep-cell, .gate, .activity, .tricky__item,
.goal-setter, .focus-block, .toggle-row, .mini-btn, .step, .btn-back, .player-switch, .av-btn, .name-input,
.gate__input, .pm-row, .pm-btn, .cta, .streak-pill, .sound-toggle, .pcard--add, .pcard--signin,
.rep-mastery, .rep-trend, .btn-practice {
  border: 3px solid #ffffff; border-radius: var(--radius);
}
.num-btn, .tile, .av-btn, .mini-btn, .step, .chip, .seg__btn, .key, .answer, .btn-back { border-color: #e6ecff; }
/* progress tracks: thin dark-bordered pixel bars */
.goalbar, .quiz-progress, .tbar__track, .timerbar { border: 2px solid #0b0e24; border-radius: 0; }
.goalbar__fill, .quiz-progress__bar, .tbar__fill, .timerbar__fill, .act-bar, .tr-bar { border-radius: 0; }
/* headings — gold arcade with hard shadow */
.topbar__title, .results__title, .rep-h, .cta__title, .dash-rank { color: #ffd23f; text-shadow: 2px 2px 0 #000; letter-spacing: .02em; font-weight: 800; }
.cta__title { color: #fff; }
.profiles__title { -webkit-text-fill-color: #ffd23f; color: #ffd23f; background: none; text-shadow: 3px 3px 0 #000; }
.picker-label { color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 800; }
/* flatten gradient/pill buttons into flat pixel colours */
.cta { background: #ff4fa3; color: #fff; border-radius: var(--radius); }
.cta.cta--practice { background: #33b866; }
.cta.cta--badges { background: #ffbf3f; }
.cta.cta--badges .cta__title { color: #241000; text-shadow: 1px 1px 0 rgba(255, 255, 255, .35); }
.cta.cta--badges .cta__sub, .cta.cta--badges .cta__go { color: #3a2600; }
.btn-primary { background: #ffd23f; color: #241000; }
.num-btn.is-selected, .mini-btn.is-on { background: #3ad44a; color: #06210a; box-shadow: var(--shadow-sm); }
.seg__btn.is-on { background: #ffd23f; color: #241000; }
.streak-pill { background: #ff4fa3; border-radius: var(--radius); }
.badge-pop { background: #ffd23f; color: #241000; border: 3px solid #fff; border-radius: var(--radius); }
.act-bar { background: #ffd23f; } .act-bar.met { background: #3ad44a; } .act-bar.zero { background: var(--line); }
.player-switch, .sound-toggle { border-radius: var(--radius); }
.chip { color: #ffd23f; } .chip--accent { color: #ff9ec7; } .chip--sm { background: var(--card-2); }
.num-btn, .tile, .answer { color: #fff; } .num-btn.is-selected { color: #06210a; }
.seg__btn { color: var(--ink-soft); }
/* both keypads share the light-key arcade look */
.keypad .key { background: #e8ecff; color: #141a2e; }
.key--enter { background: #3ad44a; color: #06210a; } .key--del { background: #ff8ea0; color: #3a1020; }
/* pixel "press" feel — sink into the shadow */
.tile:active, .num-btn:active, .chip:active, .seg__btn:active, .btn-primary:active:not(:disabled),
.key:active, .answer:active, .btn-back:active, .mini-btn:active, .step:active, .av-btn:active,
.pcard:active, .cta:active, .streak-pill:active, .pm-btn:active, .sound-toggle:active, .btn-secondary:active {
  transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.85);
}

/* ============ badges card icon — dark tile so the gold star reads ============ */
.cta--badges .cta__icon { background: rgba(36,16,0,.24); border-color: rgba(0,0,0,.3); }

/* ============ game-over / win overlay — breathing room + graphic ============ */
.adv8-btnrow { margin-top: 18px; }
.adv8-panel--fail { padding: 24px 22px 22px; }
.adv8-panel--fail h1 { color: #ff6a7a; font-size: 30px; margin-bottom: 4px; }
.adv8-fail-hearts { display: flex; gap: 12px; justify-content: center; margin-bottom: 12px; }
.adv8-fail-hearts canvas { width: 42px; height: 42px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.adv8-btn--big { font-size: 16px; padding: 14px 26px; }

/* ============ who's-playing — character stage cards ============ */
.pcard { padding: 14px 12px 14px; }
.pcard__stage { display: block; width: 100%; height: 92px; border-radius: 14px; margin-bottom: 12px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #6ea8ff 0%, #a7d1ff 60%, #7cd04a 60%, #7cd04a 76%, #c9803f 76%);
  border: 3px solid #241a4a; box-shadow: inset 0 -4px 0 rgba(0,0,0,.16), 4px 4px 0 rgba(0,0,0,.28); }
.pcard__hero { position: absolute; left: 50%; bottom: 7px; transform: translateX(-50%); width: 86px; height: 63px; image-rendering: pixelated; }
.pcard__name { font-size: 20px; }

/* ============ who's-playing — cosy arcade den ============ */
body[data-screen="profiles"] { background:
    radial-gradient(120% 80% at 50% 120%, rgba(120,70,180,.42), transparent 60%),
    radial-gradient(90% 60% at 50% -12%, rgba(60,45,120,.42), transparent 60%),
    linear-gradient(180deg, #16102e, #0b0820) !important; }
.profiles__sub { letter-spacing: .04em; }
.pcard { position: relative; --pc: #ffd23f; border: 3px solid var(--pc); background: #1b1633; padding: 15px 12px 14px;
  box-shadow: 0 0 0 2px rgba(0,0,0,.45), 0 0 26px -5px var(--pc), 6px 6px 0 rgba(0,0,0,.5); }
.pcard__tag { position: absolute; top: -12px; left: 12px; z-index: 3; font-family: var(--mono); font-weight: 700; font-size: 12px;
  color: #180d02; background: var(--pc); border: 2px solid #0b0722; border-radius: 9px 9px 9px 0; padding: 2px 9px; box-shadow: 2px 2px 0 rgba(0,0,0,.5); }
.pcard__stage { position: relative; overflow: hidden; height: 116px; border-radius: 12px; border: 3px solid #0b0722;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); background: #241d3a; margin-bottom: 12px; }
.pcard__room { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.pcard__hero { position: absolute; left: 50%; bottom: 11px; transform: translateX(-50%); width: 88px; height: 65px; image-rendering: pixelated; z-index: 2;
  filter: drop-shadow(0 3px 2px rgba(0,0,0,.5)); }
.pcard__name { color: #fff; }
.pcard__meta { color: #b7a9f0; }
.pcard--add { border-style: dashed; border-color: #4a3d8a; background: rgba(30,22,60,.4); box-shadow: 6px 6px 0 rgba(0,0,0,.4); }
.pcard--add .pcard__av { color: #ffd23f; }

/* ============ feedback + admin ============ */
.hub-foot-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.screen--feedback .fb-wrap { max-width: 620px; margin: 0 auto; padding: 8px 16px 40px; }
.fb-intro { text-align: center; margin: 6px 0 18px; }
.fb-lead { font-size: 17px; font-weight: 800; color: var(--ink); margin: 0; }
.fb-lead b { color: var(--brand); }
.fb-sub { color: var(--ink-soft); font-weight: 600; margin: 6px 0 0; }
.fb-form { display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 18px; }
.fb-label { font-weight: 800; color: var(--ink); font-size: 13px; margin-top: 4px; }
.fb-label span { color: var(--ink-soft); font-weight: 600; }
.fb-input { width: 100%; font: inherit; font-weight: 600; color: var(--ink); background: var(--card-2); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fb-input:focus { outline: none; border-color: var(--brand-2); }
.fb-textarea { resize: vertical; min-height: 96px; line-height: 1.4; }
.fb-rate { display: flex; align-items: center; gap: 4px; margin: 6px 0 2px; }
.fb-rate__lab { font-weight: 700; color: var(--ink-soft); font-size: 13px; margin-right: 6px; }
.fb-star { font-size: 26px; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--line); padding: 0 2px; transition: transform .1s; }
.fb-star.on { color: #ffc531; }
.fb-star:hover { transform: scale(1.15); }
.fb-send { margin-top: 10px; }
.fb-status { text-align: center; font-weight: 700; margin: 8px 0 0; }
.fb-status--err { color: var(--accent); }
.fb-thanks { text-align: center; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 34px 20px; }
.fb-thanks__ic { font-size: 46px; }
.fb-thanks__t { font-size: 22px; font-weight: 900; color: var(--ink); margin: 8px 0 2px; }
.fb-thanks__s { color: var(--ink-soft); font-weight: 600; margin: 0 0 18px; }
.fb-admin { margin-top: 26px; border-top: 2px dashed var(--line); padding-top: 18px; }
.fb-admin__h { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 18px 0 10px; }
.fb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fb-stat { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; }
.fb-stat b { display: block; font-size: 24px; font-weight: 900; color: var(--brand); }
.fb-stat span { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.fb-list { display: flex; flex-direction: column; gap: 10px; }
.fb-empty { color: var(--ink-soft); font-weight: 600; text-align: center; padding: 14px; }
.fb-item { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.fb-item__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-item__who { color: var(--ink); font-size: 14px; }
.fb-item__rate { color: #ffc531; font-size: 13px; letter-spacing: 1px; }
.fb-item__date { margin-left: auto; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.fb-item__msg { margin: 6px 0 0; color: var(--ink); font-weight: 500; line-height: 1.4; white-space: pre-wrap; }
.fb-item__email { display: block; margin-top: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
@media (min-width: 560px) { .fb-stats { gap: 12px; } }

/* ============ Quest Land home / world-select ============ */
.screen--home { padding: 0; }
.ql { --ql-pink:#ff4f8b; --ql-pink-lo:#d62f6b; --ql-ink:#eaf3ff; --ql-dim:#9fb8d8; --ql-panel:#16223f; --ql-edge:#2b6fb0;
  display: flex; flex-direction: column; min-height: 100dvh; background: #0b1428; font-family: var(--lp-mono); }
/* HUD */
.ql-hud { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: linear-gradient(180deg,#14213e,#0e1a33); border-bottom: 3px solid #08122a; flex-wrap: wrap; }
.ql-chip { display: flex; align-items: center; gap: 7px; background: var(--ql-panel); border: 2px solid #0a1428; border-top-color: var(--ql-edge); border-radius: 12px; padding: 6px 10px; box-shadow: inset 0 2px 0 rgba(74,166,230,.18); color: var(--ql-ink); font-weight: 700; }
.ql-who { cursor: pointer; }
.ql-av { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%,#3a4f86,#1b2748); border: 2px solid var(--ql-edge); overflow: hidden; }
.ql-av canvas { width: 34px; height: 34px; image-rendering: pixelated; }
.ql-who__meta { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.ql-who__name { font-size: 17px; font-weight: 800; }
.ql-who__lvl { font-size: 11px; color: var(--ql-dim); margin-top: 2px; }
.ql-who__lvl b { color: var(--ql-ink); }
.ql-star { color: #ffd23f; }
.ql-xp { flex: 1; min-width: 120px; }
.ql-xpbar { position: relative; flex: 1; height: 13px; border-radius: 8px; background: #0a1730; border: 2px solid #08101f; overflow: hidden; }
.ql-xpbar i { position: absolute; inset: 0; width: 3%; background: linear-gradient(180deg,#ffe27a,#ffb02e); border-right: 2px solid #c97a00; }
.ql-xpnum { font-size: 12px; color: #b98bff; font-weight: 700; white-space: nowrap; }
.ql-spacer { flex: 1; min-width: 0; }
.ql-stat { font-size: 15px; }
.ql-stat canvas, .ql-stat .streak-flame-c { width: 18px; height: 20px; }
.ql-stat__col { display: flex; flex-direction: column; line-height: 1; }
.ql-stat__col small { font-size: 8px; letter-spacing: .06em; color: var(--ql-dim); margin-top: 2px; }
.ql-stat .streak-num { font-size: 15px; }
/* stage with the background scene */
.ql-stage { position: relative; flex: 1; display: flex; flex-direction: column; background: #63b7f0 url("../assets/worlds/map-bg.jpg") center 42%/cover no-repeat; }
.ql-titlebar { text-align: center; padding: 10px 12px 2px; }
.ql-title { font-size: clamp(22px,5vw,34px); font-weight: 700; margin: 0; letter-spacing: .05em; color: #fff; text-shadow: 0 3px 0 #1d5fa0,0 4px 0 #0d3f78,3px 3px 0 rgba(0,0,0,.25); }
.ql-s { color: #ffd23f; text-shadow: 0 2px 0 #b8860b; }
.ql-sub { margin: 2px 0 0; font-size: 12px; color: #fff; text-shadow: 0 2px 0 #1d5fa0,0 0 6px rgba(13,63,120,.6); }
.ql-rows { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 6px 14px 2px; }
.ql-row { position: relative; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; align-items: end; }
.ql-row::before { content: ""; position: absolute; left: 14%; right: 14%; top: 50%; height: 7px; z-index: 0;
  background: repeating-linear-gradient(90deg,#8a5a2e 0 7px,#6b4420 7px 11px),linear-gradient(180deg,#a9713f,#6b4420);
  border-top: 2px solid #c98a4e; border-bottom: 2px solid #4a2c16; border-radius: 3px; box-shadow: 0 3px 5px rgba(0,0,0,.35); }
.ql-isle { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; cursor: pointer; border: 0; background: none; padding: 0; font-family: inherit; color: inherit; }
.ql-flag { position: absolute; left: 14%; top: -2px; z-index: 3; width: 28px; height: 32px; }
.ql-flag__pole { position: absolute; left: 3px; top: 0; width: 3px; height: 32px; background: #eef2ff; border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.ql-flag__cloth { position: absolute; left: 6px; top: 0; width: 20px; height: 14px; background: var(--ql-pink); clip-path: polygon(0 0,100% 0,100% 100%,0 100%,6px 50%); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; box-shadow: 0 2px 0 var(--ql-pink-lo); }
.ql-art { position: relative; width: 100%; display: flex; justify-content: center; }
.ql-isleimg { width: 100%; max-width: 116px; height: auto; display: block; filter: drop-shadow(0 6px 5px rgba(0,20,45,.45)); transition: transform .12s ease; }
.ql-isle:hover .ql-isleimg { transform: translateY(-5px); }
.ql-isle.is-locked .ql-isleimg { filter: grayscale(.85) brightness(.62) drop-shadow(0 5px 4px rgba(0,20,45,.4)); }
.ql-isle.is-current .ql-isleimg { animation: qlbob 2.4s ease-in-out infinite; }
@keyframes qlbob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
.ql-plate { position: relative; z-index: 3; margin-top: -4px; width: 94%; max-width: 128px; min-width: 0; text-align: center; background: linear-gradient(180deg,var(--pl,#2a3a5e),var(--pl-lo,#1a2744)); border: 2px solid #0a1428; border-radius: 10px; padding: 4px 6px 5px; box-shadow: 0 3px 0 #0a1428, inset 0 2px 0 rgba(255,255,255,.14); }
.ql-plate__nm { display: block; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35); white-space: nowrap; }
.ql-plate__st { display: block; font-size: 10px; font-weight: 700; margin-top: 1px; }
.ql-st--play { color: #ffe27a; } .ql-st--done { color: #a8f0c8; } .ql-st--lock { color: #cdd8ea; }
.ql-isle.is-locked .ql-plate { filter: saturate(.5) brightness(.9); }
.ql-warp { position: absolute; right: -2px; top: 52%; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 2px; transform: rotate(6deg); }
.ql-warp__b { width: 22px; height: 26px; border-radius: 6px; background: linear-gradient(180deg,#8f5ad8,#5a2fa0); border: 2px solid #2a0f52; position: relative; }
.ql-warp__b::before { content: ""; position: absolute; inset: 5px 3px; border-radius: 3px; background: repeating-linear-gradient(180deg,#c9a8f0 0 3px,#7a4fc8 3px 6px); }
.ql-warp__t { font-size: 8px; font-weight: 700; color: #2a0f52; background: #ffd23f; border: 2px solid #a37a10; border-radius: 5px; padding: 0 4px; }
.ql-shake { animation: qlshake .4s; }
@keyframes qlshake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-5px)} 40%,80%{transform:translateX(5px)} }
.w1{--pl:#3a7a30;--pl-lo:#255020} .w2{--pl:#b98a3e;--pl-lo:#8a6428} .w3{--pl:#e06aa8;--pl-lo:#b34a82} .w4{--pl:#2f8fbf;--pl-lo:#1f6e90}
.w5{--pl:#6f9fca;--pl-lo:#4f7ba8} .w6{--pl:#357a35;--pl-lo:#235023} .w7{--pl:#c8461f;--pl-lo:#93300f} .w8{--pl:#6a4aa8;--pl-lo:#48307e}
/* bottom nav over the grass+brick band */
.ql-ground { position: relative; z-index: 2; padding: 11px 12px 12px; background: linear-gradient(180deg,rgba(20,60,20,0),rgba(40,22,10,.14) 34%,rgba(30,16,8,.32)); }
.ql-primary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.ql-btn { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; font-family: inherit; border: 3px solid #2a1a0e; border-radius: 14px; padding: 9px 12px; color: #fff; box-shadow: 0 5px 0 rgba(0,0,0,.32), inset 0 3px 0 rgba(255,255,255,.22); transition: transform .08s, box-shadow .08s; }
.ql-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.32), inset 0 3px 0 rgba(255,255,255,.22); }
.ql-bic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(0,0,0,.16); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.ql-bic canvas { width: 26px; height: 26px; }
.ql-bt { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.ql-bt b { font-size: 15px; } .ql-bt small { font-size: 10px; opacity: .92; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-btn--daily { background: linear-gradient(180deg,#ff6fa3,#e63f7d); }
.ql-btn--practice { background: linear-gradient(180deg,#59c95a,#33a13a); }
.ql-btn--badges { background: linear-gradient(180deg,#ffd24a,#f0a91e); color: #3a2a06; border-color: #7a5410; }
.ql-btn--badges .ql-bic { background: rgba(0,0,0,.12); }
.ql-secondary { display: flex; justify-content: center; gap: 10px; margin-top: 11px; flex-wrap: wrap; }
.ql-schip { display: flex; align-items: center; gap: 7px; font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: .03em; color: #fff8ea; background: rgba(20,12,6,.6); border: 2px solid #1c1108; border-radius: 10px; padding: 7px 13px; cursor: pointer; }
.ql-schip:active { transform: translateY(1px); }
.ql-schip__ic { font-size: 14px; }
@media (max-width: 620px) {
  .ql-hud { gap: 6px; padding: 8px; }
  .ql-xp { order: 5; flex-basis: 100%; }
  .ql-primary { grid-template-columns: 1fr; gap: 8px; }
  .ql-bt small { white-space: normal; }
  .ql-rows { padding: 6px 8px 2px; }
  .ql-row { gap: 3px; }
  .ql-isleimg { max-width: 80px; }
  .ql-plate { padding: 3px 3px 4px; }
  .ql-plate__nm { font-size: 10.5px; letter-spacing: 0; }
  .ql-plate__st { font-size: 8.5px; }
  .ql-flag { left: 6%; width: 24px; }
  .ql-flag__cloth { width: 17px; font-size: 10px; }
  .ql-title { font-size: 24px; }
  .ql-warp__t { font-size: 7px; padding: 0 3px; }
  .ql-warp__b { width: 18px; height: 22px; }
}
@media (max-width: 380px) { .ql-plate__nm { font-size: 9.5px; } .ql-isleimg { max-width: 72px; } }
@media (prefers-reduced-motion: reduce) { .ql-isle.is-current .ql-isleimg { animation: none; } }
