/* ---------- tokens ---------- */
:root {
  /* kid area: deep spruce space */
  --spruce-900: #0b231d;
  --spruce-800: #0f2b24;
  --spruce-700: #163a31;
  --spruce-600: #1e4b3f;
  --spruce-500: #2a6152;
  --mint: #5be7a9;
  --mint-deep: #2fbf83;
  --coin: #ffc94d;
  --coin-deep: #d99a12;
  --amber: #ffb86b;
  --ink-hi: #eafff5;
  --ink-mid: #a9d4c2;
  --ink-low: #6f9e8c;

  /* parent portal: dark grey-green, quieter styling */
  --p-top: #151b19;
  --p-input: #151b19;
  --p-off: #3e504a;
  --p-bg: #1b2321;
  --p-card: #222c29;
  --p-line: #34433e;
  --p-ink: #e3eee9;
  --p-muted: #9db3aa;
  --p-green: #5bd69c;
  --p-green-ink: #10241c;
  --p-green-soft: rgba(91, 214, 156, .14);
  --p-warn: #f0b45c;
  --p-warn-soft: rgba(240, 180, 92, .1);
  --p-warn-line: rgba(240, 180, 92, .45);
  --p-danger: #ff8a80;

  --display: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --text: 'Lexend', 'Segoe UI', system-ui, sans-serif;
  --scale: 1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: calc(17px * var(--scale)); }
body {
  margin: 0;
  font-family: var(--text);
  line-height: 1.5;
  background: var(--spruce-800);
  color: var(--ink-hi);
  -webkit-font-smoothing: antialiased;
}
body.parent-mode { background: var(--p-bg); color: var(--p-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--coin); outline-offset: 2px; }
.parent-mode :focus-visible { outline-color: var(--p-green); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; max-width: 68ch; }
.muted { color: var(--ink-mid); }
.parent-mode .muted { color: var(--p-muted); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .6em 1.2em;
  border: 0; border-radius: 12px;
  font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: .01em;
  background: var(--mint); color: var(--spruce-900);
  box-shadow: 0 4px 0 var(--mint-deep);
  text-decoration: none;
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--mint-deep); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--ink-hi); box-shadow: inset 0 0 0 2px var(--spruce-500); }
.btn.gold { background: var(--coin); box-shadow: 0 4px 0 var(--coin-deep); }
.btn.small { min-height: 38px; padding: .35em .9em; font-size: .9rem; }
.btn.wide { width: 100%; }
.parent-mode .btn { background: var(--p-green); color: var(--p-green-ink); box-shadow: none; font-family: var(--text); font-weight: 600; font-size: .95rem; border-radius: 8px; min-height: 42px; }
.parent-mode .btn.ghost { background: transparent; color: var(--p-ink); box-shadow: inset 0 0 0 1px var(--p-line); }
.parent-mode .btn.small { min-height: 34px; font-size: .85rem; }
.parent-mode .btn.danger { background: transparent; color: var(--p-danger); box-shadow: inset 0 0 0 1px rgba(255, 138, 128, .4); }

/* ---------- forms ---------- */
label { display: block; font-weight: 500; margin: 0 0 .3em; }
.field { margin-bottom: 1rem; }
.field small { display: block; color: var(--ink-low); margin-top: .25em; }
.parent-mode .field small { color: var(--p-muted); }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 46px; padding: .55em .8em;
  border-radius: 10px; border: 2px solid var(--spruce-500);
  background: var(--spruce-900); color: var(--ink-hi);
}
.parent-mode input, .parent-mode select, .parent-mode textarea {
  border: 1px solid var(--p-line); background: var(--p-input); color: var(--p-ink); border-radius: 8px;
}
textarea { min-height: 80px; resize: vertical; }
.error { color: var(--amber); font-weight: 500; min-height: 1.5em; }
.parent-mode .error { color: var(--p-danger); }

/* ---------- auth screens ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(circle at 20% 15%, rgba(91, 231, 169, .14), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(255, 201, 77, .08), transparent 35%),
    var(--spruce-800);
}
.auth-box { width: 100%; max-width: 460px; }
.auth-box h1 { font-size: 2.4rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; color: var(--mint); margin-bottom: 1.5rem; }
.brand img { width: 40px; height: 40px; }
.who { display: grid; gap: 12px; margin: 1.5rem 0; }
.who button {
  display: flex; align-items: center; gap: 1rem; text-align: left;
  padding: 1rem 1.2rem; border-radius: 16px; border: 2px solid var(--spruce-500);
  background: var(--spruce-700); font-family: var(--display); font-size: 1.3rem; font-weight: 700;
}
.who button span.big { font-size: 2rem; }
.who button small { display: block; font-family: var(--text); font-weight: 400; font-size: .85rem; color: var(--ink-mid); }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 1.2rem 0; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--mint); }
.pin-dots i.on { background: var(--mint); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto; }
.pinpad button {
  min-height: 64px; border-radius: 14px; border: 0; background: var(--spruce-600);
  font-family: var(--display); font-size: 1.6rem; font-weight: 700;
}
.pinpad button:active { background: var(--spruce-500); }
.setup-section { padding: 1.2rem; border-radius: 16px; background: var(--spruce-700); margin-bottom: 1rem; }

/* ---------- kid shell ---------- */
.kid { min-height: 100vh; display: flex; flex-direction: column; }
.hud {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--spruce-900);
  border-bottom: 2px solid var(--spruce-600);
}
.hud .me { display: flex; align-items: center; gap: 12px; margin-right: auto; text-decoration: none; color: inherit; }
.avatar {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 30px; flex: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}
.avatar.lg { width: 96px; height: 96px; font-size: 56px; border-radius: 24px; }
.me-name { font-family: var(--display); font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.me-title { font-size: .8rem; color: var(--mint); }
.xp { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.tier {
  font-family: var(--display); font-weight: 700; font-size: .85rem;
  padding: 4px 10px; border-radius: 8px; background: var(--spruce-600); color: var(--mint); white-space: nowrap;
}
.bar { flex: 1; height: 14px; border-radius: 7px; background: var(--spruce-600); overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--mint-deep), var(--mint)); border-radius: 7px; transition: width .6s ease; }
.xp small { font-family: var(--display); color: var(--ink-mid); white-space: nowrap; font-size: .8rem; }
.coins {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--coin);
  padding: 4px 12px; border-radius: 10px; background: rgba(255, 201, 77, .1);
  box-shadow: inset 0 0 0 2px rgba(255, 201, 77, .35);
}
.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, var(--coin) 45%, var(--coin-deep)); vertical-align: -.12em; }

.kid-nav { display: flex; gap: 4px; padding: 8px 16px; background: var(--spruce-900); overflow-x: auto; }
.kid-nav a {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px;
  color: var(--ink-mid); text-decoration: none; font-family: var(--display); font-weight: 600; white-space: nowrap;
}
.kid-nav a[aria-current=page] { background: var(--spruce-600); color: var(--ink-hi); }
.kid-main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 28px 20px 96px; }

/* ---------- kid panels ---------- */
.panel { background: var(--spruce-700); border-radius: 18px; padding: 20px; margin-bottom: 18px; }
.panel.flat { background: transparent; padding: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }

.subject-card { display: flex; flex-direction: column; gap: .6rem; }
.subject-card .icon { font-size: 2.4rem; line-height: 1; }
.stars { color: var(--coin); letter-spacing: 2px; font-size: 1.05rem; white-space: nowrap; }
.stars .off { color: var(--spruce-500); }

.task { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--spruce-600); }
.task:first-of-type { border-top: 0; }
.task .t-body { flex: 1; }
.task .t-title { font-weight: 600; font-size: 1.05rem; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 6px; background: var(--spruce-600); color: var(--ink-mid); margin-right: 6px; }
.tag.gold { background: rgba(255, 201, 77, .15); color: var(--coin); }
.tag.wait { background: rgba(255, 184, 107, .15); color: var(--amber); }

/* planet path */
.planet { margin-bottom: 34px; }
.planet-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.planet-head .icon { font-size: 2.6rem; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: var(--spruce-700); flex: none; }
.planet.locked .planet-head { opacity: .55; }
.path { display: grid; gap: 10px; padding-left: 30px; border-left: 3px dashed var(--spruce-500); margin-left: 31px; }
.level {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: 14px; border: 0; text-align: left;
  background: var(--spruce-700); color: var(--ink-hi); text-decoration: none;
}
.level:hover { background: var(--spruce-600); }
.level .l-name { font-weight: 600; }
.level.boss { box-shadow: inset 0 0 0 2px rgba(255, 201, 77, .45); }
.level.next { box-shadow: inset 0 0 0 2px var(--mint); }
.lock-note { padding: 14px 16px; border-radius: 14px; background: var(--spruce-900); color: var(--ink-mid); }

/* ---------- play ---------- */
.play { max-width: 720px; margin: 0 auto; }
.play-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.steps { display: flex; gap: 6px; flex: 1; }
.steps i { flex: 1; height: 10px; border-radius: 5px; background: var(--spruce-600); }
.steps i.done { background: var(--mint); }
.steps i.half { background: var(--amber); }
.steps i.now { background: var(--ink-hi); }
.mission-coins { font-family: var(--display); font-weight: 700; color: var(--coin); white-space: nowrap; }
.q-card { background: var(--spruce-700); border-radius: 22px; padding: 28px 24px; }
.learn-title { font-size: 1.45rem; margin: .2rem 0 .6rem; color: var(--mint); }
.learn-text { font-size: 1.25rem; line-height: 1.55; max-width: 40ch; margin: 0 0 .8rem; }
.learn-links { padding-left: 1.2rem; line-height: 1.9; font-size: 1.1rem; }
.learn-links a { color: var(--mint); }
.l-book { font-size: .85rem; opacity: .8; }
/* Words from the past: a real source, set apart from the site's own writing. */
.source { margin: .4rem 0 1rem; padding: 14px 18px; border-left: 4px solid var(--coin); background: var(--spruce-800); border-radius: 0 14px 14px 0; max-width: 46ch; }
.source p { font-family: Georgia, 'Times New Roman', serif; font-size: 1.15rem; line-height: 1.6; margin: 0 0 .6rem; }
.source footer { color: var(--coin); font-size: .95rem; }
/* Story choices are sentences, so one per row. */
.story-choices { grid-template-columns: 1fr; }
.story-choices .choice { text-align: left; }
.q-count { font-family: var(--display); color: var(--ink-mid); margin-bottom: .4rem; }
.q-text { font-size: 1.55rem; font-weight: 500; line-height: 1.35; margin-bottom: 1rem; max-width: 34ch; }
.q-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 1.2rem; }
.hint { background: var(--spruce-900); border-left: 4px solid var(--coin); padding: 12px 16px; border-radius: 10px; margin-bottom: 1.2rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.choice {
  min-height: 64px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--spruce-500);
  background: var(--spruce-800); font-size: 1.1rem; text-align: left;
}
.choice:hover:not(:disabled) { border-color: var(--mint); }
.choice.right { border-color: var(--mint); background: rgba(91, 231, 169, .15); }
.choice.wrong { border-color: var(--amber); opacity: .7; }
.choice:disabled { cursor: default; }
.num-answer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.num-answer input { max-width: 220px; font-size: 1.6rem; font-family: var(--display); text-align: center; min-height: 64px; }
.num-answer .unit { font-size: 1.2rem; color: var(--ink-mid); }
.feedback { margin-top: 1.2rem; padding: 16px 18px; border-radius: 14px; }
.feedback.good { background: rgba(91, 231, 169, .14); }
.feedback.try { background: rgba(255, 184, 107, .12); }
.feedback .f-head { font-family: var(--display); font-weight: 700; font-size: 1.25rem; margin-bottom: .2rem; }
.feedback.good .f-head { color: var(--mint); }
.feedback.try .f-head { color: var(--amber); }
.gain { font-family: var(--display); color: var(--coin); font-weight: 700; }
.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.result { text-align: center; padding: 20px 0; }
.result .big-stars { font-size: 4rem; letter-spacing: 8px; color: var(--coin); line-height: 1.1; margin: .2em 0; }
.result .big-stars .off { color: var(--spruce-600); }
.result-gains { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 1.2rem 0; }
.result-gains div { background: var(--spruce-700); border-radius: 14px; padding: 12px 20px; font-family: var(--display); }
.result-gains b { display: block; font-size: 1.6rem; }

/* ---------- pass ---------- */
.tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tier-card { background: var(--spruce-700); border-radius: 16px; padding: 14px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.tier-card .t-num { font-family: var(--display); font-weight: 700; color: var(--ink-mid); }
.tier-card .t-reward { font-size: 2rem; min-height: 52px; display: grid; place-items: center; }
.tier-card .t-label { font-size: .85rem; min-height: 2.5em; }
.tier-card.ready { box-shadow: inset 0 0 0 2px var(--coin); }
.tier-card.claimed { opacity: .6; }
.tier-card.locked { opacity: .45; }
.swatch { width: 52px; height: 36px; border-radius: 8px; }

/* ---------- shop ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { border: 0; padding: 10px 16px; border-radius: 10px; background: var(--spruce-700); color: var(--ink-mid); font-family: var(--display); font-weight: 600; }
.tabs button[aria-selected=true] { background: var(--mint); color: var(--spruce-900); }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.item { background: var(--spruce-700); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.item .i-preview { height: 72px; display: grid; place-items: center; }
.item .title-preview { font-family: var(--display); font-weight: 700; color: var(--mint); font-size: 1.1rem; }
.item.on { box-shadow: inset 0 0 0 2px var(--mint); }
.look { display: flex; gap: 18px; align-items: center; }

/* ---------- chill ---------- */
.breathe { display: grid; place-items: center; height: 300px; }
.breathe-circle {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--mint), var(--mint-deep));
  animation: breathe 12s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { transform: scale(1); } 33%, 50% { transform: scale(2); } }
.toggle { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--spruce-600); }
.toggle input { width: 24px; height: 24px; accent-color: var(--mint); }
.toggle label { margin: 0; flex: 1; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.pick { border: 0; text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--spruce-700); color: var(--ink-hi); display: flex; flex-direction: column; gap: 2px; font: inherit; cursor: pointer; }
.pick small { color: var(--ink-mid); }
.pick[aria-pressed=true] { box-shadow: inset 0 0 0 2px var(--mint); background: var(--spruce-600); }
.pick[aria-pressed=true] b::after { content: '  ✓'; color: var(--mint); }
.pick-head { font-size: 1rem; margin: 18px 0 8px; }
.pick-head + .muted { margin-top: -4px; }
.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; margin-top: 16px; }
.slider label { display: flex; justify-content: space-between; margin-bottom: 4px; }
.slider output { color: var(--ink-mid); font-weight: 400; }
.slider input { width: 100%; accent-color: var(--mint); min-height: 0; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(150%);
  background: var(--spruce-900); color: var(--ink-hi); border: 2px solid var(--mint);
  padding: 12px 20px; border-radius: 12px; z-index: 50; transition: transform .25s, visibility .25s; max-width: calc(100% - 32px);
  visibility: hidden;
}
#toast.show { transform: translateX(-50%) translateY(0); visibility: visible; }
.parent-mode #toast { background: var(--p-top); color: var(--p-ink); border-color: var(--p-green); }

/* ---------- parent portal ---------- */
.p-shell { min-height: 100vh; }
.p-top { background: var(--p-top); border-bottom: 1px solid var(--p-line); }
.p-top-inner { max-width: 1040px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.p-top .brand { margin: 0 auto 0 0; color: var(--p-green); font-size: 1.1rem; }
.p-tabs { display: flex; gap: 2px; }
.p-tabs a { padding: 8px 14px; border-radius: 8px; color: var(--p-muted); text-decoration: none; font-weight: 500; }
.p-tabs a[aria-current=page] { background: var(--p-green-soft); color: var(--p-green); }
.p-main { max-width: 1040px; margin: 0 auto; padding: 28px 20px 80px; }
.p-main h1 { font-family: var(--text); font-weight: 600; font-size: 1.6rem; }
.p-main h2 { font-family: var(--text); font-weight: 600; font-size: 1.15rem; margin-bottom: .8rem; }
.p-card { background: var(--p-card); border: 1px solid var(--p-line); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.p-card.attention { border-color: var(--p-warn-line); background: var(--p-warn-soft); }
.p-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.p-stat { background: var(--p-card); border: 1px solid var(--p-line); border-radius: 12px; padding: 14px 16px; }
.p-stat b { display: block; font-size: 1.5rem; font-weight: 600; }
.p-stat span { color: var(--p-muted); font-size: .9rem; }
.p-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.p-list { list-style: none; margin: 0; padding: 0; }
.p-list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--p-line); flex-wrap: wrap; }
.p-list li:first-child { border-top: 0; }
.p-list .grow { flex: 1; min-width: 180px; }
.p-list .note { display: block; color: var(--p-muted); font-size: .9rem; }
.week { display: flex; gap: 10px; align-items: flex-end; height: 150px; padding-top: 10px; }
.week div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.week i { width: 100%; max-width: 46px; background: var(--p-green); border-radius: 6px 6px 0 0; min-height: 2px; }
.week span { font-size: .8rem; color: var(--p-muted); }
.week b { font-size: .8rem; font-weight: 600; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; background: var(--p-green-soft); color: var(--p-green); }
.pill.warn { background: var(--p-warn-soft); color: var(--p-warn); }
.p-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.p-table th { text-align: left; font-weight: 500; color: var(--p-muted); padding: 6px 8px; border-bottom: 1px solid var(--p-line); }
.p-table td { padding: 8px; border-bottom: 1px solid var(--p-line); }
.p-table .stars { color: var(--coin); }
.p-table .stars .off { color: var(--p-off); }
.p-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.p-form .full { grid-column: 1 / -1; }
.pill.grey { background: var(--p-input); color: var(--p-muted); }
.link { color: var(--p-green); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.pre { white-space: pre-wrap; }
.p-main h3 { font-family: var(--text); font-weight: 600; font-size: 1rem; margin: 1rem 0 .3rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--p-muted); }
.kv dd { margin: 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.thumb { width: 150px; display: flex; flex-direction: column; gap: 6px; font-size: .8rem; color: var(--p-muted); word-break: break-word; }
.thumb img, .thumb .pdf { width: 150px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--p-line); background: var(--p-input); display: grid; place-items: center; font-size: 2.4rem; }
.trend-up { color: var(--p-green); }
.trend-down { color: var(--p-danger); }
.actions { margin: 0; padding-left: 1.2rem; display: grid; gap: 6px; }
.topic { border-top: 1px solid var(--p-line); padding: 14px 0; }
.topic:first-of-type { border-top: 0; }
.topic-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.topic p { margin: .4rem 0; }
.scroll-x { overflow-x: auto; }
.breadth { display: grid; gap: 8px; }
.breadth div { display: grid; grid-template-columns: 170px 1fr minmax(64px, auto); gap: 12px; align-items: center; }
.breadth i { height: 10px; border-radius: 5px; background: var(--p-green); display: block; }
.breadth b { font-weight: 500; text-align: right; white-space: nowrap; }
.nc-strand { border-top: 1px solid var(--p-line); padding: 10px 0; }
.nc-strand:first-of-type { border-top: 0; }
.nc-strand summary { cursor: pointer; padding: 4px 0; }
.nc-stage { margin: 1.6rem 0 .3rem; font-size: 1.15rem; }
.review-level { border-top: 1px solid var(--p-line); padding: 10px 0; }
.review-level:first-of-type { border-top: 0; }
.review-level summary { cursor: pointer; padding: 4px 0; }
.review-level .row { margin-top: .6rem; gap: 8px; }
.review-learn h3 { font-size: 1rem; margin: .9rem 0 .4rem; }
.review-card { border-left: 3px solid var(--p-line); padding: 2px 0 2px 12px; margin: .5rem 0; }
.review-card p { margin: .25rem 0; }
.review-qs { margin: .6rem 0 0; padding-left: 1.4rem; }
.review-qs li { padding: .6rem 0; border-top: 1px dashed var(--p-line); }
.review-qs li:first-child { border-top: 0; }
.review-qs p { margin: .25rem 0; }
.review-qs .rq { font-weight: 600; }
@media (max-width: 640px) { .breadth div { grid-template-columns: 100px 1fr minmax(56px, auto); font-size: .88rem; } }

/* ---------- council report (paper) ---------- */
.report-wrap { background: #e9ece9; min-height: 100vh; padding: 20px 16px 60px; color-scheme: light; }
.report-tools { max-width: 820px; margin: 0 auto 16px; display: flex; justify-content: space-between; gap: 12px; }
.report-tools .btn.ghost { color: #134a36; border-color: #134a36; background: transparent; }
.report { max-width: 820px; margin: 0 auto; background: #fff; color: #1d2320; padding: 40px 44px; border-radius: 4px; font-family: var(--text); line-height: 1.5; }
.report h1 { font-family: var(--text); font-size: 1.7rem; font-weight: 700; color: #134a36; margin: 0 0 4px; }
.report h2 { font-size: 1.2rem; font-weight: 700; color: #134a36; border-bottom: 2px solid #134a36; padding-bottom: 4px; margin: 28px 0 10px; }
.report h3 { font-size: 1rem; font-weight: 600; margin: 0 0 2px; }
.report .muted { color: #5c6661; }
.report .lesson { padding: 10px 0; border-bottom: 1px solid #dde2df; break-inside: avoid; }
.report .lesson p { margin: .25rem 0; }
.report table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.report th { text-align: left; font-weight: 600; border-bottom: 1px solid #9aa59f; padding: 5px 6px; }
.report td { border-bottom: 1px solid #dde2df; padding: 5px 6px; vertical-align: top; }
.report .thumbs { gap: 10px; }
.report .thumb { width: 130px; color: #5c6661; }
.report .thumb img { width: 130px; height: 98px; border-color: #dde2df; background: #f3f5f4; }
.report footer { margin-top: 28px; font-size: .85rem; }
@media (max-width: 640px) { .report { padding: 24px 18px; } }
@media print {
  body, .report-wrap { background: #fff !important; padding: 0; }
  .no-print, #toast { display: none !important; }
  .report { max-width: none; padding: 0; border-radius: 0; }
  @page { margin: 16mm; }
}
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0; }
.check input { width: 18px; height: 18px; accent-color: var(--p-green); min-height: 0; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  .hud { padding: 8px 16px; gap: 10px; }
  .xp { order: 3; width: 100%; min-width: 0; }
  .kid-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; justify-content: space-between; border-top: 2px solid var(--spruce-600); padding: 6px 8px; }
  .kid-nav { gap: 0; padding: 6px 2px; }
  .kid-nav a { flex: 1; flex-direction: column; gap: 0; font-size: .68rem; padding: 6px 2px; }
  .kid-nav a .n-icon { font-size: 1.3rem; }
  .kid-main { padding: 20px 16px 110px; }
  .q-card { padding: 22px 16px; }
  .q-text { font-size: 1.3rem; }
  .path { padding-left: 16px; margin-left: 20px; }
  .p-main { padding: 20px 16px 60px; }
  .p-top-inner { padding: 10px 16px; }
  /* Six tabs don't fit on a phone: let them scroll sideways inside the bar, not the page. */
  .p-tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .p-tabs a { white-space: nowrap; padding: 8px 10px; }
}

/* ---------- comfort settings ---------- */
.calm *, .calm *::before, .calm *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Gold tag on level tiles that have a story. */
.l-story { margin-left: .5rem; padding: 1px 8px; border-radius: 999px; font-size: .8rem; background: var(--coin); color: var(--spruce-800); font-weight: 700; white-space: nowrap; }

/* ---------- read aloud: pause bar and the word being read ---------- */
.speech-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 999px;
  background: var(--spruce-600); box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
}
.speech-bar.hidden { display: none; }
.w { border-radius: 4px; transition: background-color .08s; }
.w.reading-word { background: var(--coin); color: var(--spruce-800); }
.source .w.reading-word { color: var(--spruce-800); }
@media (prefers-reduced-motion: reduce) { .w { transition: none; } }

/* ---------- tap-to-explain words ---------- */
.term {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help;
  text-decoration: underline dotted var(--mint); text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.term:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; border-radius: 4px; }
.term-pop {
  position: absolute; z-index: 50; padding: 12px 14px; border-radius: 14px;
  background: var(--spruce-600); border: 2px solid var(--mint); box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
  font-family: Lexend, sans-serif; font-size: 1rem; line-height: 1.45;
}
.term-pop.hidden { display: none; }
.term-pop b { color: var(--mint); font-size: 1.1rem; text-transform: capitalize; }
.term-pop p { margin: .3rem 0 .6rem; }
