:root {
  --bg: #fbf8f3;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e7e1d6;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #e6f4f1;
  --gold: #f59e0b;
  --gold-soft: #fef3c7;
  --red: #b91c1c;
  --navy: #1e3a8a;
  --done: #15803d;
  --done-soft: #ecfdf3;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(60,40,10,.06);
  --r: 16px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fraunces', Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --card: #1d2026; --ink: #eceae6; --muted: #9ca3af; --line: #2e323a;
    --brand: #2dd4bf; --brand-ink: #062b27; --brand-soft: #123631; --gold-soft: #3a2e10;
    --done-soft: #12301f; --done: #4ade80; --navy: #93c5fd; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a; --card: #1d2026; --ink: #eceae6; --muted: #9ca3af; --line: #2e323a;
  --brand: #2dd4bf; --brand-ink: #062b27; --brand-soft: #123631; --gold-soft: #3a2e10;
  --done-soft: #12301f; --done: #4ade80; --navy: #93c5fd; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--font); }
body.modal-open { overflow: hidden; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 .3em; }
h1 { font-size: 2rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.25rem; }
h4 { margin: .8em 0 .2em; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
h5 { margin: 1em 0 .2em; font-size: .95rem; }
p { margin: .4em 0; }
ul, ol { margin: .3em 0; padding-left: 1.3em; }
li { margin: .15em 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.err { color: var(--red); }
.eyebrow { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.print-only { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: .35em; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: .55em 1em; border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: .6; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: .3em .8em; min-height: 34px; font-size: .9rem; }
.btn-lg { padding: .75em 1.4em; font-size: 1.05rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55em .7em; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { padding: 2px; width: 44px; height: 40px; }
label { display: block; font-weight: 700; font-size: .92rem; }
label > input, label > select, label > textarea { margin-top: .25em; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .8em 1em; margin: 0; }
legend { font-weight: 800; padding: 0 .4em; }
.editor { display: grid; gap: .9em; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8em; }
.kbd { border: 1px solid var(--line); border-radius: 6px; padding: 0 .35em; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; padding: .5rem max(16px, env(safe-area-inset-left)) 0;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 1100px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .4rem; font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); font-size: 1.1rem; }
.topbar nav { display: flex; gap: .15rem; max-width: 1100px; margin: .35rem auto 0; overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { padding: .55em .9em; color: var(--muted); text-decoration: none; font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; }
.topbar nav a:hover { color: var(--ink); }
.topbar nav a.active { color: var(--brand); border-bottom-color: var(--brand); }
.who { display: flex; align-items: center; gap: .5rem; }
.who select { width: auto; padding: .35em .5em; }
.who-btn { display: flex; align-items: center; gap: .4em; border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--c) 20%, var(--card)); border: 2px solid var(--c); font-size: 1.05rem; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.7rem; }
.avatar.xl { width: 84px; height: 84px; font-size: 2.6rem; border-width: 3px; }
.viewing { background: color-mix(in srgb, var(--c) 15%, var(--bg)); border-bottom: 2px solid var(--c); padding: .5rem 1rem; text-align: center; font-weight: 700; }

.page { max-width: 1000px; margin: 0 auto; padding: 1.2rem 16px 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: .5rem 0 1rem; font-weight: 700; }
.pager a { text-decoration: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.2rem; margin-bottom: 1.2rem; }
.notice { background: var(--gold-soft); border-radius: 12px; padding: .7em 1em; margin: .8rem 0; }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 60px; }
.bar span { display: block; height: 100%; background: var(--done); border-radius: 99px; }

/* ---------- login ---------- */
.login { max-width: 760px; margin: 0 auto; padding: 3rem 16px; text-align: center; }
.login h1 { font-size: 2.4rem; }
.profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-top: 2rem; }
.profile { display: flex; flex-direction: column; align-items: center; gap: .4rem; width: 150px; padding: 1.2rem .5rem; border-radius: 20px; border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; font: inherit; color: var(--ink); }
.profile:hover { transform: translateY(-2px); border-color: var(--brand); }
.pinform { display: grid; gap: 1rem; text-align: center; }
.pinform input { font-size: 1.5rem; text-align: center; letter-spacing: .2em; }
.setup { text-align: left; }
.setup h1, .setup > p { text-align: center; }
.setup-row { display: grid; grid-template-columns: 56px 1.4fr 1fr 70px 1.2fr 44px; gap: .4rem; margin-bottom: .5rem; }
.emoji-in { text-align: center; font-size: 1.3rem; padding: .3em; }
@media (max-width: 640px) { .setup-row { grid-template-columns: 50px 1fr 1fr; } }

/* ---------- day + lessons ---------- */
.dayhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: 1rem 0 .5rem; }
.dayhead h2 a { color: inherit; text-decoration: none; }
.bigidea { font-size: 1.05rem; color: var(--muted); }
.lessons { display: grid; gap: 1rem; margin-top: 1rem; }
.lesson { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }
.lesson.is-next { border-left-color: var(--gold); }
.lesson.is-done { border-left-color: var(--done); background: linear-gradient(var(--done-soft), var(--card) 120px); }
.lesson-head h3 a { color: inherit; text-decoration: none; }
.block-tag { font-weight: 800; color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4em; margin-bottom: .2em; }
.badge-next, .badge-done, .badge-edit { font-size: .72rem; font-weight: 800; padding: .1em .6em; border-radius: 99px; letter-spacing: .04em; }
.badge-next { background: var(--gold); color: #3b2300; }
.badge-done { background: var(--done); color: #fff; }
.badge-edit { background: var(--line); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.chip { font-size: .78rem; font-weight: 700; padding: .15em .6em; border-radius: 99px; background: var(--brand-soft); color: var(--ink); border: 0; font-family: inherit; }
button.chip { cursor: pointer; padding: .4em .8em; font-size: .85rem; }
.chip-only { background: var(--gold-soft); }
.lesson-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
@media (max-width: 700px) { .lesson-grid { grid-template-columns: 1fr; } }
.why { display: flex; gap: .6em; background: var(--brand-soft); border-radius: 12px; padding: .7em .9em; margin: .8rem 0; }
.why > span { font-size: 1.3rem; }
.kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .6rem; margin: .6rem 0; }
.kid { border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 8%, var(--card)); padding: .5em .8em; border-radius: 0 10px 10px 0; }
.kid.mine { --c: var(--brand); margin: .8rem 0; }
.moral { background: var(--gold-soft); border-radius: 12px; padding: .6em .9em; margin: .7rem 0; }
.tnotes { margin-top: .8rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
.tnotes summary { font-weight: 800; cursor: pointer; }
.tnotes-empty { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.discuss li::marker { content: '💬 '; }
.lesson-foot { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.kidstats { display: flex; gap: .4rem; flex-wrap: wrap; }
.kidstat { border: 2px solid var(--c); background: var(--card); color: var(--ink); border-radius: 99px; padding: .35em .8em; font: inherit; font-weight: 700; cursor: pointer; min-height: 40px; }
.kidstat small { font-weight: 600; color: var(--muted); }
.kidstat.is-taught { background: var(--c); color: #fff; }
.kidstat.is-taught small { color: #fff; }
.kidstat.is-done { background: color-mix(in srgb, var(--c) 18%, var(--card)); }
.kidstat.is-skipped { border-style: dashed; opacity: .7; }
.lesson-actions { display: flex; gap: .4rem; }
.kidcard { border-left-color: var(--c); }
.kidcard h3 { font-size: 1.5rem; }
.kidcard .lesson-foot { justify-content: center; }

/* ---------- resources & videos ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; margin: .8rem 0; }
.vbtn-wrap { position: relative; }
.vbtn { display: flex; flex-direction: column; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
  overflow: hidden; cursor: pointer; text-align: left; font: inherit; box-shadow: var(--shadow); transition: transform .15s; }
.vbtn:hover { transform: translateY(-2px); border-color: var(--brand); }
.vthumb { position: relative; aspect-ratio: 16/9; background: #111 center/cover no-repeat; display: grid; place-items: center; }
.vthumb-empty { background: var(--brand-soft); font-size: 2.2rem; }
.vplay { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: rgba(220,38,38,.92); color: #fff; font-size: 1.4rem; padding-left: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.vplay.big { width: 74px; height: 74px; font-size: 2rem; }
.vdur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.75); color: #fff; font-size: .75rem; padding: 0 .4em; border-radius: 4px; }
.vmeta { padding: .6em .8em; display: flex; flex-direction: column; gap: .2em; }
.vmeta strong { line-height: 1.25; }
.vbtn-missing { display: flex; flex-direction: column; border: 2px dashed var(--line); border-radius: 14px; overflow: hidden; }
.vswap { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: #111; cursor: pointer; font-size: 1.1rem; }
.res-list { list-style: none; padding: 0; display: grid; gap: .4rem; margin: .6rem 0; }
.res { display: flex; gap: .6em; align-items: flex-start; }
.res-ic { font-size: 1.2rem; }

/* video sheet */
.vsheet h2 { margin-top: .8rem; }
.vsheet-hero { aspect-ratio: 16/9; border-radius: 14px; background: #111 center/cover; display: grid; place-items: center; }
.vsheet-actions { display: grid; gap: .6rem; margin-top: 1rem; }
.vsheet-actions .btn { justify-content: center; }
.vsheet-tv { margin-top: 1rem; background: var(--brand-soft); border-radius: 12px; padding: .8rem 1rem; }
.vsheet-player iframe, .vsheet-player video { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; background: #000; }
.vsearch, .vpaste { display: flex; gap: .5rem; margin: .6rem 0; }
.vsearch .btn, .vpaste .btn { flex: none; }
.vlist { display: grid; gap: .7rem; margin-top: .8rem; }
.vitem { display: grid; grid-template-columns: 160px 1fr; gap: .8rem; border: 1px solid var(--line); border-radius: 12px; padding: .5rem; }
.vitem img { width: 100%; border-radius: 8px; }
.vitem.is-pick { border: 2px solid var(--gold); }
.pickwhy { background: var(--gold-soft); border-radius: 8px; padding: .2em .5em; margin: .3em 0; font-size: .9rem; }
.vitem-actions { display: flex; gap: .4rem; margin-top: .4rem; }
@media (max-width: 560px) { .vitem { grid-template-columns: 1fr; } }

/* ---------- week header ---------- */
.weekhead { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.weekmini .weekhead { padding: .8rem 1rem; }
.weekmini .weekhead-top { display: none; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .7rem; margin-top: .6rem; }
.fact { display: flex; flex-direction: column; background: var(--bg); border-radius: 12px; padding: .5em .8em; }
.fact span { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fact em { font-size: .88rem; color: var(--muted); }
.verse { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7em 1em; font-size: 1.05rem; }
.special { background: var(--gold-soft); border-radius: var(--r); padding: 1rem; margin-bottom: 1rem; }

/* ---------- year / semester / week ---------- */
.semester { margin-bottom: 1.6rem; }
.semester-head { display: block; text-decoration: none; color: inherit; padding: .5rem 0; }
.weeklist { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.weekrow { display: grid; grid-template-columns: 44px 1fr auto 90px; align-items: center; gap: .8rem; padding: .65rem 1rem; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.weekrow:first-child { border-top: 0; }
.weekrow:hover { background: var(--brand-soft); }
.weekrow.is-current { background: var(--gold-soft); }
.wnum { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); font-weight: 800; }
.wtitle { display: flex; flex-direction: column; }
@media (max-width: 560px) { .weekrow { grid-template-columns: 36px 1fr 60px; } .wdate { display: none; } }
.semgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.semweek { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.semweek:hover { border-color: var(--brand); }
.semweek .eyebrow { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.semweek dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; font-size: .9rem; margin: .5rem 0 0; }
.semweek dt { font-weight: 700; white-space: nowrap; } .semweek dd { margin: 0; }
.weekdays { display: grid; gap: .8rem; margin-top: 1rem; }
.wday { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.wday.is-current { border: 2px solid var(--gold); }
.wday-head { display: flex; justify-content: space-between; padding: .6rem 1rem; background: var(--bg); color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.wday ul { list-style: none; padding: 0; margin: 0; }
.wday li { border-top: 1px solid var(--line); margin: 0; }
.wday li:first-child { border-top: 0; }
.wday li a { display: flex; gap: .7rem; padding: .55rem 1rem; color: inherit; text-decoration: none; }
.wday li a > span:last-child { display: flex; flex-direction: column; }
.wday li.is-done { background: var(--done-soft); }
.wday li.is-done strong::after { content: ' ✓'; color: var(--done); }
.wday li.is-next { box-shadow: inset 4px 0 0 var(--gold); }
.wday.is-done .wday-head { background: var(--done-soft); }
.bl { font-size: 1.2rem; }

/* ---------- kids ---------- */
.kidhello { display: flex; align-items: center; gap: 1rem; background: color-mix(in srgb, var(--c) 12%, var(--card)); border-radius: 22px; padding: 1rem 1.2rem; flex-wrap: wrap; }
.kidhello h1 { font-size: 2.2rem; margin: 0; }
.stars { margin-left: auto; font-size: 2rem; font-weight: 800; text-align: center; display: flex; flex-direction: column; line-height: 1.1; }
.stars small { font-size: .8rem; color: var(--muted); }
body[data-mode=student] { font-size: 18px; }

/* ---------- progress ---------- */
.kidprog { border-top: 6px solid var(--c); }
.kidprog-head { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.subjbars { display: grid; gap: .35rem; }
.subjbar { display: grid; grid-template-columns: 150px 1fr 60px; gap: .6rem; align-items: center; font-size: .9rem; }
.weekdots { display: flex; flex-wrap: wrap; gap: .3rem; }
.wdot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; text-decoration: none; font-weight: 800; font-size: .8rem; color: var(--ink);
  background: color-mix(in srgb, var(--done) calc(var(--p) * 100%), var(--line)); }
.notes li { margin: .3em 0; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(15,20,25,.55); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { position: relative; background: var(--card); color: var(--ink); border-radius: 20px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 1.4rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-wide { width: min(860px, 100%); }
.modal-x { position: absolute; top: .6rem; right: .6rem; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); cursor: pointer; font-size: 1.1rem; z-index: 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.menu { display: grid; gap: .4rem; margin-top: .6rem; }
.menu button { text-align: left; padding: .8em 1em; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.menu button:hover { border-color: var(--brand); }
.menu .danger { color: var(--red); }
.rating { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.rating label { font-weight: 400; display: flex; gap: .2em; align-items: center; }
.resrow { display: grid; grid-template-columns: 110px 1.3fr 1.6fr 1fr 1fr 36px; gap: .3rem; margin-bottom: .4rem; }
@media (max-width: 720px) { .resrow { grid-template-columns: 1fr 1fr; } }
.breakrow { display: flex; gap: .4rem; align-items: center; margin: .3rem 0; flex-wrap: wrap; }
.breakrow input { width: auto; flex: 1; min-width: 130px; }
.dow { display: flex; flex-wrap: wrap; gap: .8rem; margin: .3rem 0; }
.dow label { font-weight: 600; }
.profile-edit { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; padding: .5rem 0; border-top: 1px solid var(--line); }
.profile-edit input[name=name] { flex: 1; min-width: 120px; }
.profile-edit input[name=secret] { flex: 1; min-width: 150px; }
.profile-edit .emoji-in { width: 56px; }
.profile-edit .grade-in { width: 70px; }
.chat { max-height: 50vh; overflow-y: auto; display: grid; gap: .5rem; margin: .6rem 0; }
.msg { padding: .6em .9em; border-radius: 14px; max-width: 90%; }
.msg.me { background: var(--brand); color: var(--brand-ink); justify-self: end; }
.msg.bot { background: var(--bg); }
.chatform { display: flex; gap: .5rem; align-items: flex-end; margin-top: .6rem; }
.quick { margin: .4rem 0; }
.busy { display: flex; gap: .6rem; align-items: center; padding: 1rem 0; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview, .gen-out { margin-top: 1rem; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; transition: .25s; z-index: 100;
  background: #1f2937; color: #fff; padding: .7em 1.2em; border-radius: 999px; font-weight: 700; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast-err { background: var(--red); }

@media (max-width: 640px) {
  .brand span:last-child { display: none; }
  .who-btn span:not(.avatar) { display: none; }
  h1 { font-size: 1.6rem; }
  .lesson { padding: .9rem; }
}


/* ---------- block colors ---------- */
[data-block=am] { --bc: #f59e0b; --bcs: #fef3c7; }
[data-block=math] { --bc: #16a34a; --bcs: #dcfce7; }
[data-block=lit] { --bc: #2563eb; --bcs: #dbeafe; }
[data-block=pm] { --bc: #9333ea; --bcs: #f3e8ff; }
[data-block=fri], [data-block=fri2] { --bc: #db2777; --bcs: #fce7f3; }
[data-block=seasonal], [data-block=extra] { --bc: #0f766e; --bcs: #ccfbf1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) [data-block] { --bcs: color-mix(in srgb, var(--bc) 22%, #1d2026); } }
:root[data-theme="dark"] [data-block] { --bcs: color-mix(in srgb, var(--bc) 22%, #1d2026); }
.lesson[data-block] { border-left-color: var(--bc); }
.lesson[data-block] .block-tag { color: var(--bc); }
.lesson.is-done { border-left-color: var(--done) !important; }

/* ---------- today at a glance ---------- */
.daystrip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; margin: 1rem 0 .4rem; }
.dschip { display: flex; align-items: center; gap: .6rem; text-align: left; padding: .6rem .75rem; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; box-shadow: var(--shadow); min-height: 56px; }
.dschip:hover { border-color: var(--bc); transform: translateY(-1px); }
.dsic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--bcs); font-size: 1.15rem; }
.dstx { display: flex; flex-direction: column; font-weight: 700; font-size: .92rem; line-height: 1.25; }
.dstx small { color: var(--bc); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
.dschip.is-done { opacity: .65; }
.dschip.is-done .dsic { background: var(--done); color: #fff; font-weight: 800; }

/* ---------- student mode: fun ---------- */
body[data-mode=student] h1, body[data-mode=student] h2, body[data-mode=student] h3 { font-family: 'Fredoka', var(--font); font-weight: 600; letter-spacing: .01em; }
body[data-mode=student] { background-image: radial-gradient(circle at 10% 0%, color-mix(in srgb, #fbbf24 12%, transparent) 0, transparent 40%),
  radial-gradient(circle at 90% 10%, color-mix(in srgb, #60a5fa 12%, transparent) 0, transparent 40%); background-attachment: fixed; }
.kidhello { position: relative; overflow: hidden; display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: 1.4rem 1.5rem; border-radius: 28px; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #f59e0b)); box-shadow: 0 10px 30px color-mix(in srgb, var(--c) 35%, transparent); }
.kidhello::after { content: "\2726 \2727 \2726"; position: absolute; right: 18px; top: 8px; opacity: .35; font-size: 1.4rem; letter-spacing: .4em; }
.kidhello .avatar { background: rgba(255,255,255,.25); border-color: #fff; }
.kidhello-tx { flex: 1; min-width: 220px; }
.kidhello .eyebrow { color: rgba(255,255,255,.85); }
.kidhello h1 { margin: .1em 0; font-size: 2.3rem; }
.kidhello p { margin: 0; font-size: 1.1rem; opacity: .95; }
.kidstats-hero { display: flex; align-items: center; gap: 1rem; }
.ring { width: 86px; height: 86px; }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: rgba(255,255,255,.3); }
.ring-fg { stroke: #fff; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .6s ease; }
.ring text { fill: #fff; font: 800 18px 'Fredoka', sans-serif; }
.kidhello .stars { margin: 0; color: #fff; text-decoration: none; background: rgba(255,255,255,.18); border-radius: 18px; padding: .4rem .8rem; }
.kidhello .stars small { color: rgba(255,255,255,.85); }
.kidcard { border-radius: 24px; border-left: 0; border-top: 8px solid var(--bc, var(--c)); padding: 1.3rem 1.4rem; }
.kidcard .block-tag { font-size: 1rem; }
.kidcard h4 { color: var(--bc, var(--muted)); }
.kidcard.is-next { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
.kidcard.is-next .badge-next { animation: pulse 1.6s ease-in-out infinite; }
.kidcard .lesson-foot .btn-primary { background: var(--bc, var(--brand)); border-color: var(--bc, var(--brand)); color: #fff; font-size: 1.15rem; padding: .8em 2em; box-shadow: 0 6px 16px color-mix(in srgb, var(--bc, #000) 35%, transparent); }
.kidcard .lesson-foot .btn-primary:active { transform: scale(.96); }
@keyframes pulse { 50% { transform: scale(1.08); } }
.verse { border-left: 6px solid var(--gold); }

/* ---------- badges ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .15rem; padding: .7rem .5rem; border-radius: 16px;
  border: 1px dashed var(--line); color: var(--muted); }
.badge-ic { font-size: 1.8rem; filter: grayscale(1); opacity: .5; }
.badge strong { font-size: .88rem; }
.badge small { font-size: .72rem; line-height: 1.2; }
.badge.got { border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent); background: var(--gold-soft); color: var(--ink); }
.badge.got .badge-ic { filter: none; opacity: 1; }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.confetti i { position: absolute; width: 9px; height: 14px; border-radius: 2px; animation: confetti 1.4s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes confetti {
  0% { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 260px)) rotate(var(--rot)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .kidcard.is-next .badge-next { animation: none; } }

/* ---------- print ---------- */
@media print {
  :root { --bg: #fff; --card: #fff; --ink: #000; --shadow: none; }
  body { font-size: 11pt; }
  .no-print, .topbar, .viewing, .vswap, .modal-wrap, .toast, .confetti, .daystrip { display: none !important; }
  .print-only { display: block !important; }
  .page { max-width: none; padding: 0; }
  .lesson, .weekhead, .card, .wday { break-inside: avoid; box-shadow: none; }
  .vgrid { display: none; }
  .lesson.is-done { background: none; }
  a { color: inherit; text-decoration: none; }
  .bar { display: none; }
}

details.weekmini { margin: .4rem 0 0; }
details.weekmini > summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: .5rem .2rem; list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.weekmini > summary::-webkit-details-marker { display: none; }
details.weekmini[open] > summary { white-space: normal; }

/* ---------- sign-in screen ---------- */
.login { min-height: 100vh; }
.login h1 { font-family: 'Fredoka', var(--display); font-weight: 600; font-size: 2.8rem; }
.profiles { gap: 1.2rem; }
.profile { width: 170px; padding: 1.5rem .5rem 1.2rem; border-radius: 26px; transition: transform .15s, box-shadow .15s; }
.profile:hover, .profile:focus-visible { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 14px 30px rgba(60,40,10,.12); }
.profile strong { font-family: 'Fredoka', var(--font); font-size: 1.25rem; font-weight: 600; }
body:has(.login) { background-image: radial-gradient(circle at 15% 15%, color-mix(in srgb, #fbbf24 18%, transparent) 0, transparent 35%),
  radial-gradient(circle at 85% 20%, color-mix(in srgb, #a855f7 14%, transparent) 0, transparent 35%),
  radial-gradient(circle at 50% 95%, color-mix(in srgb, #10b981 14%, transparent) 0, transparent 40%); }

.unlock { display: grid; gap: .8rem; max-width: 380px; margin: 1.5rem auto 0; }
.unlock input { font-size: 1.2rem; text-align: center; }

/* ---------- lesson chat beside "How to teach it" ---------- */
.teach { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 1rem; align-items: start; margin-top: .8rem; }
.teach > .tnotes { margin-top: 0; }
@media (max-width: 820px) { .teach { grid-template-columns: 1fr; } }
.tchat { position: sticky; top: 110px; display: flex; flex-direction: column; gap: .5rem; padding: .8rem; border-radius: 14px;
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.tchat-head { line-height: 1.3; }
.tchat-head .muted { display: block; }
.tchat-log { display: none; flex-direction: column; gap: .5rem; max-height: 380px; overflow-y: auto; }
.tchat.has-log .tchat-log { display: flex; }
.tchat .msg { max-width: 100%; font-size: .95rem; }
.tchat .msg.bot { background: var(--card); }
.tchat .msg p:first-child { margin-top: 0; } .tchat .msg p:last-child { margin-bottom: 0; }
.tchat-quick { display: flex; flex-wrap: wrap; gap: .3rem; }
.tchat-quick .chip { background: var(--card); }
.tchat-form { display: grid; gap: .4rem; }
.tchat-form .btn { justify-self: end; }
.tchat-form textarea { font-size: .95rem; resize: vertical; }

/* ---------- self-study ---------- */
.ss-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.ss-streak { font-weight: 800; background: var(--gold-soft); padding: .2em .7em; border-radius: 99px; }
.selfstudy-today { margin-top: 1.6rem; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.sslist { display: grid; gap: .6rem; }
.sscard { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.sscard.is-done { background: var(--done-soft); border-color: color-mix(in srgb, var(--done) 40%, transparent); }
.ss-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); font-size: 1.4rem; flex: none; }
.ss-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ss-actions { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
@media (max-width: 640px) { .sscard { grid-template-columns: auto 1fr; } .sscard .ss-actions { grid-column: 1 / -1; justify-content: flex-start; } }
.ss-subject { margin-top: 1.2rem; }
.sslib { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.sstool { display: flex; flex-direction: column; gap: .4rem; border: 1px solid var(--line); border-radius: 16px; padding: .8rem; background: var(--card); }
.sstool .ss-actions { justify-content: flex-start; margin-top: auto; }
.sstool-head { display: flex; gap: .6rem; align-items: center; }
.sstool-head > div { display: flex; flex-direction: column; }
.wv { align-self: flex-start; font-size: .75rem; font-weight: 800; padding: .15em .6em; border-radius: 99px; }
.wv-aligned { background: var(--gold-soft); }
.wv-neutral { background: var(--brand-soft); }
.wv-care { background: #fee2e2; color: #7f1d1d; }
.wv-custom { background: var(--line); }
.wv-note { background: #fff7ed; color: #7c2d12; border-radius: 8px; padding: .3em .6em; }
.ss-summary a { margin-left: .4rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wv-care, :root:not([data-theme="light"]) .wv-note { background: #3b1d12; color: #fed7aa; } }
:root[data-theme="dark"] .wv-care, :root[data-theme="dark"] .wv-note { background: #3b1d12; color: #fed7aa; }

/* ================= Language Quest ================= */
.lq-langs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.lq-lang { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: 1.4rem 1rem; border-radius: 24px; background: var(--card); border: 2px solid var(--line);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s; }
.lq-lang:hover { transform: translateY(-4px) rotate(-1deg); border-color: var(--brand); }
.lq-flag { font-size: 3.4rem; line-height: 1.1; }
.lq-lang strong { font-family: 'Fredoka', var(--font); font-size: 1.4rem; font-weight: 600; }

.lq-board .lq-row, .lq-teacher .lq-row { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: .6rem; align-items: center; padding: .55rem .4rem; border-top: 1px solid var(--line); }
.lq-teacher .lq-row { grid-template-columns: auto auto auto 1fr auto; }
.lq-board .lq-row.me { background: var(--gold-soft); border-radius: 12px; }
.lq-rank { font-size: 1.3rem; width: 1.8rem; text-align: center; }
.lq-xp { font-family: 'Fredoka', var(--font); }

.lq-hud { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.2rem; border-radius: 24px; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 50%, #0ea5e9)); box-shadow: 0 10px 28px color-mix(in srgb, var(--c) 30%, transparent); margin-bottom: 1rem; }
.lq-hud .eyebrow { color: rgba(255,255,255,.9); }
.lq-hud-flag { font-size: 3rem; }
.lq-hud-main { flex: 1; min-width: 180px; display: grid; gap: .3rem; }
.lq-lvlbar { background: rgba(255,255,255,.3); height: 12px; }
.lq-lvlbar span { background: #fde047; }
.lq-hud-stats { display: flex; gap: .6rem; }
.lq-hud-stats div { display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,.18); border-radius: 16px; padding: .45rem .75rem; min-width: 76px; }
.lq-hud-stats b { font-family: 'Fredoka', var(--font); font-size: 1.25rem; }
.lq-hud-stats span { font-size: .72rem; opacity: .9; }

.lq-modes { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1.4rem; }
.lq-mode { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .7rem; align-items: center; text-align: left; padding: .9rem 1rem;
  border-radius: 20px; border: 2px solid var(--line); border-bottom-width: 5px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.lq-mode > span { grid-row: span 2; font-size: 2rem; }
.lq-mode strong { font-family: 'Fredoka', var(--font); font-size: 1.15rem; font-weight: 600; }
.lq-mode small { color: var(--muted); }
.lq-mode:active { transform: translateY(2px); border-bottom-width: 3px; }
.lq-mode:disabled { opacity: .5; cursor: default; }

.lq-unit { margin: 1.2rem 0 2rem; }
.lq-unit-head { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 20px; color: #fff; background: var(--uc); box-shadow: 0 6px 0 color-mix(in srgb, var(--uc) 70%, #000); }
.lq-unit-head h2 { margin: 0; color: #fff; font-family: 'Fredoka', var(--font); font-weight: 600; }
.lq-unit-head .eyebrow { color: rgba(255,255,255,.85); }
.lq-unit-emoji { font-size: 2rem; }
.lq-unit-count { margin-left: auto; font-weight: 800; background: rgba(255,255,255,.25); padding: .2em .7em; border-radius: 99px; }
.lq-path { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.4rem 0 .4rem; }
.lq-node-wrap { position: relative; display: flex; flex-direction: column; align-items: center; transform: translateX(var(--x)); }
.lq-node { width: 76px; height: 70px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.9rem; color: #fff;
  background: var(--uc); box-shadow: 0 7px 0 color-mix(in srgb, var(--uc) 65%, #000); transition: transform .1s; }
.lq-node:active { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--uc) 65%, #000); }
.lq-node.done { background: #f59e0b; box-shadow: 0 7px 0 #b45309; font-weight: 800; }
.lq-node.locked { background: var(--line); box-shadow: 0 7px 0 color-mix(in srgb, var(--line) 70%, #000); cursor: default; font-size: 1.4rem; }
.lq-node.next { animation: lq-bob 1.4s ease-in-out infinite; outline: 5px solid color-mix(in srgb, var(--uc) 30%, transparent); outline-offset: 4px; }
@keyframes lq-bob { 50% { transform: translateY(-6px); } }
.lq-node-label { margin-top: .55rem; font-size: .82rem; font-weight: 700; text-align: center; max-width: 140px; color: var(--muted); }
.lq-mini-stars { display: block; color: #f59e0b; letter-spacing: .1em; }
.lq-start { position: absolute; top: -34px; background: var(--card); color: var(--uc); border: 2px solid var(--line); font-weight: 800; font-size: .8rem;
  padding: .2em .7em; border-radius: 10px; animation: lq-bob 1.4s ease-in-out infinite; white-space: nowrap; }
.lq-start::after { content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%) rotate(45deg); width: 10px; height: 10px; background: var(--card);
  border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); }

.lq-today { display: flex; align-items: center; gap: .9rem; margin-top: 1rem; padding: .9rem 1rem; border-radius: 20px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; }
.lq-today > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.lq-today-ic { font-size: 2.2rem; }
.lq-today-go { font-family: 'Fredoka', var(--font); font-weight: 600; background: #16a34a; color: #fff; padding: .45em 1em; border-radius: 14px; }

/* ----- player ----- */
.lq-overlay { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; font-size: 18px; }
.lq-top { display: flex; align-items: center; gap: .7rem; padding: max(12px, env(safe-area-inset-top)) 16px 10px; max-width: 760px; width: 100%; margin: 0 auto; }
.lq-x { border: 0; background: none; font-size: 1.35rem; color: var(--muted); cursor: pointer; width: 40px; height: 40px; border-radius: 12px; }
.lq-bar { flex: 1; height: 16px; border-radius: 99px; background: var(--line); overflow: hidden; }
.lq-bar span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #22c55e, #84cc16); transition: width .35s ease; }
.lq-combo { font-family: 'Fredoka', var(--font); font-weight: 700; color: var(--muted); min-width: 52px; text-align: right; }
.lq-combo.hot { color: #f97316; animation: lq-pop .35s; }
.lq-time { font-family: 'Fredoka', var(--font); font-weight: 700; color: #dc2626; }
@keyframes lq-pop { 50% { transform: scale(1.35); } }
.lq-stage { flex: 1; overflow-y: auto; padding: 8px 16px 24px; }
.lq-ex { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.lq-in { animation: lq-in .3s ease; }
@keyframes lq-in { from { opacity: 0; transform: translateX(30px); } }
.lq-center { align-items: center; text-align: center; padding-top: 2rem; }
.lq-kicker { font-family: 'Fredoka', var(--font); font-size: 1.4rem; font-weight: 600; }
.lq-prompt { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .9rem 1.1rem; border: 2px solid var(--line); border-radius: 20px; background: var(--card); }
.lq-prompt.target { font-family: 'Fredoka', var(--font); font-weight: 600; }
.lq-emoji { font-size: 4.5rem; line-height: 1.1; }
.lq-emoji.sm { font-size: 2.2rem; }
.lq-card.intro { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.6rem 1rem; border-radius: 28px; background: var(--card); border: 2px solid var(--line); border-bottom-width: 6px; }
.lq-target { font-family: 'Fredoka', var(--font); font-size: 2.1rem; font-weight: 600; text-align: center; color: var(--brand); }
.lq-en { font-size: 1.15rem; color: var(--muted); }
.lq-sayrow { display: flex; gap: .5rem; }
.lq-say { width: 52px; height: 52px; border-radius: 16px; border: 0; background: #0ea5e9; color: #fff; font-size: 1.4rem; cursor: pointer; box-shadow: 0 4px 0 #0369a1; }
.lq-say.slow { background: #84cc16; box-shadow: 0 4px 0 #4d7c0f; }
.lq-say:active, .lq-bigsay:active { transform: translateY(3px); box-shadow: none; }
.lq-listen { display: flex; justify-content: center; align-items: center; gap: .8rem; padding: .6rem; }
.lq-bigsay { width: 110px; height: 110px; border-radius: 30px; border: 0; background: #0ea5e9; color: #fff; font-size: 3rem; cursor: pointer; box-shadow: 0 7px 0 #0369a1; }
.lq-tip { text-align: center; color: var(--muted); font-weight: 700; margin: 0; }
.lq-options { display: grid; gap: .65rem; }
.lq-opt { display: flex; align-items: center; gap: .8rem; text-align: left; padding: .9rem 1rem; border-radius: 18px; border: 2px solid var(--line); border-bottom-width: 5px;
  background: var(--card); color: var(--ink); font: inherit; font-size: 1.15rem; font-weight: 700; cursor: pointer; }
.lq-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); font-size: .8rem; color: var(--muted); flex: none; }
.lq-opt.sel { border-color: #0ea5e9; background: color-mix(in srgb, #0ea5e9 12%, var(--card)); }
.lq-opt.right { border-color: #22c55e; background: color-mix(in srgb, #22c55e 18%, var(--card)); }
.lq-opt.wrong { border-color: #ef4444; background: color-mix(in srgb, #ef4444 15%, var(--card)); animation: lq-shake .35s; }
.lq-answer { min-height: 64px; display: flex; flex-wrap: wrap; gap: .45rem; align-content: flex-start; padding: .6rem 0; border-bottom: 2px solid var(--line); border-top: 2px solid var(--line); }
.lq-tiles { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; }
.lq-tile { padding: .55em .9em; border-radius: 14px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card); color: var(--ink); font: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; }
.lq-input { font-size: 1.4rem; padding: .8rem 1rem; border-radius: 16px; border: 2px solid var(--line); }
.lq-chars { display: flex; flex-wrap: wrap; gap: .35rem; }
.lq-char { min-width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.lq-mic { align-self: center; padding: .9rem 1.6rem; border-radius: 99px; border: 0; background: #ef4444; color: #fff; font: inherit; font-weight: 800; font-size: 1.15rem; cursor: pointer; box-shadow: 0 5px 0 #b91c1c; }
.lq-mic.on { animation: lq-pulse 1s infinite; }
@keyframes lq-pulse { 50% { box-shadow: 0 0 0 14px rgba(239,68,68,.25), 0 5px 0 #b91c1c; } }
.lq-match { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.lq-match > div { display: grid; gap: .55rem; align-content: start; }
.lq-mt { padding: .85rem .6rem; border-radius: 16px; border: 2px solid var(--line); border-bottom-width: 5px; background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; min-height: 58px; }
.lq-mt.sel { border-color: #0ea5e9; background: color-mix(in srgb, #0ea5e9 12%, var(--card)); }
.lq-mt.done { opacity: .35; border-color: #22c55e; cursor: default; transform: scale(.96); transition: .25s; }
.lq-mt.shake { border-color: #ef4444; animation: lq-shake .35s; }
@keyframes lq-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.lq-foot { border-top: 2px solid var(--line); padding: 14px 16px max(16px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: flex-end; gap: .8rem; }
.lq-foot > * { max-width: 760px; }
.lq-foot.good { background: color-mix(in srgb, #22c55e 18%, var(--bg)); border-color: transparent; }
.lq-foot.bad { background: color-mix(in srgb, #ef4444 15%, var(--bg)); border-color: transparent; }
.lq-fb { flex: 1; }
.lq-fb-title { font-family: 'Fredoka', var(--font); font-size: 1.5rem; font-weight: 700; }
.lq-foot.good .lq-fb-title { color: #15803d; }
.lq-foot.bad .lq-fb-title { color: #b91c1c; }
.lq-fb-note.small { font-size: .85rem; color: var(--muted); }
.lq-combo-note { font-size: 1rem; color: #f97316; margin-left: .4rem; }
.lq-btn { min-width: 150px; padding: .85em 1.6em; border-radius: 16px; border: 0; font: inherit; font-family: 'Fredoka', var(--font); font-weight: 600; font-size: 1.15rem;
  letter-spacing: .03em; text-transform: uppercase; cursor: pointer; background: #22c55e; color: #fff; box-shadow: 0 5px 0 #15803d; }
.lq-foot.bad .lq-btn { background: #ef4444; box-shadow: 0 5px 0 #b91c1c; }
.lq-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #15803d; }
.lq-btn:disabled { background: var(--line); color: var(--muted); box-shadow: none; cursor: default; }
.lq-btn.ghost { background: transparent; color: var(--muted); box-shadow: none; min-width: 0; text-transform: none; }
.lq-end h2 { font-family: 'Fredoka', var(--font); font-size: 2.2rem; margin: 0; }
.lq-mascot { font-size: 5rem; animation: lq-bob 1.2s ease-in-out infinite; }
.lq-stars { font-size: 2.6rem; color: #f59e0b; letter-spacing: .1em; }
.lq-stats { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.lq-stats div { display: flex; flex-direction: column; padding: .6rem 1rem; border-radius: 16px; border: 2px solid var(--line); min-width: 92px; }
.lq-stats b { font-family: 'Fredoka', var(--font); font-size: 1.5rem; color: var(--brand); }
.lq-stats span { font-size: .8rem; color: var(--muted); }
@media (max-width: 560px) {
  .lq-modes { grid-template-columns: 1fr; }
  .lq-hud-stats div { min-width: 64px; padding: .4rem .5rem; }
  .lq-btn { min-width: 120px; }
  .lq-target { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { .lq-node.next, .lq-start, .lq-mascot { animation: none; } }

/* ---------- user menu ---------- */
.who { position: relative; }
.who-btn { padding: .3rem .5rem; border-radius: 99px; }
.who-btn:hover { background: var(--brand-soft); }
.caret { color: var(--muted); font-size: .8rem; }
.usermenu { position: absolute; right: 0; top: calc(100% + 8px); width: 270px; z-index: 40; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.18); padding: .5rem; display: grid; gap: .1rem; }
.um-head { display: flex; gap: .7rem; align-items: center; padding: .4rem .5rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.um-head > div { display: flex; flex-direction: column; }
.um-item { display: block; width: 100%; text-align: left; padding: .6rem .7rem; border-radius: 10px; border: 0; background: none; color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.um-item:hover, .um-item.on { background: var(--brand-soft); }
.um-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .6rem .7rem .2rem; }
.um-sep { height: 1px; background: var(--line); margin: .3rem 0; }

/* ---------- sign-in ---------- */
.loginbox { display: grid; gap: .9rem; max-width: 380px; margin: 1.2rem auto 0; text-align: left; }
.loginbox input { font-size: 1.1rem; }
.recent { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin-top: 1.4rem; }
.recent-user { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 110px; padding: .8rem .4rem; border-radius: 20px; border: 2px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.recent-user.on, .recent-user:hover { border-color: var(--brand); }
.setup-row input[name=password] { min-width: 0; }

/* ---------- profile page ---------- */
.emoji-grid { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.emoji-pick { position: relative; font-weight: 400; }
.emoji-pick input[type=radio] { position: absolute; opacity: 0; }
.emoji-pick span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--line); font-size: 1.5rem; cursor: pointer; }
.emoji-pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.emoji-pick.custom input[type=text], .emoji-pick.custom input[name=emojiCustom] { width: 80px; height: 46px; text-align: center; font-size: 1.2rem; }
.emoji-pick.custom input[type=radio]:checked ~ input { border-color: var(--brand); }
.pf-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .8rem 0; border-top: 1px solid var(--line); }
.pf-row:first-of-type { border-top: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg-btn { border: 0; background: var(--card); color: var(--ink); font: inherit; font-weight: 700; padding: .55rem .9rem; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.on { background: var(--brand); color: var(--brand-ink); }
.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--card); background: var(--sw, var(--bg)); box-shadow: 0 0 0 1px var(--line); cursor: pointer; color: var(--muted); font-weight: 800; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }

/* ---------- edit affordances ---------- */
.pen { border: 0; background: none; cursor: pointer; font-size: .85rem; opacity: .35; padding: 0 .2rem; vertical-align: middle; }
.lesson:hover .pen, .pen:focus { opacity: .9; }
@media (hover: none) { .pen { opacity: .6; } }
.fact-edit { text-align: left; font: inherit; color: inherit; border: 1px dashed transparent; cursor: pointer; }
.fact-edit:hover { border-color: var(--brand); }
.pen-i { font-style: normal; opacity: .4; font-size: .8em; }
.fact-edit:hover .pen-i { opacity: 1; }
.weekhead-top { position: relative; }
.weekhead-edit { float: right; margin-left: .6rem; }
.flash { animation: flash 1.6s ease; border-radius: 8px; }
@keyframes flash { 0%, 40% { background: var(--gold-soft); box-shadow: 0 0 0 6px var(--gold-soft); } }

.backup-list { list-style: none; padding: 0; display: grid; gap: .4rem; }
.backup-list li { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.backup-list li > span { flex: 1; color: var(--ink); }

/* ================= Math Quest ================= */
.mq-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.mq-mode-main { border-color: #16a34a; background: color-mix(in srgb, #22c55e 10%, var(--card)); }
.mq-unit .lq-unit-head { flex-wrap: wrap; }
.mq-check-btn { border: 0; border-radius: 99px; padding: .35em .9em; font: inherit; font-weight: 800; font-size: .85rem; cursor: pointer; background: rgba(255,255,255,.95); color: var(--uc); }
.mq-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; padding-top: 1rem; }
.mq-tile-wrap { position: relative; }
.mq-tile { width: 100%; display: flex; align-items: center; gap: .7rem; text-align: left; padding: .7rem .8rem; border-radius: 18px; border: 2px solid var(--line); border-bottom-width: 5px;
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; transition: transform .1s; }
.mq-tile:hover { border-color: var(--uc); }
.mq-tile:active { transform: translateY(2px); border-bottom-width: 3px; }
.mq-tile.s-mastered { background: color-mix(in srgb, #f59e0b 12%, var(--card)); border-color: #f59e0b; }
.mq-tile-main { display: flex; flex-direction: column; min-width: 0; padding-right: 1.4rem; }
.mq-tile-main strong { font-size: .98rem; line-height: 1.25; }
.mq-ring { --p: 0; flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--uc) calc(var(--p) * 1%), var(--line) 0); }
.mq-ring > span { width: 34px; height: 34px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: var(--muted); }
.mq-ring.s-mastered { background: #f59e0b; }
.mq-ring.s-proficient > span { color: var(--uc); }
.mq-pin { position: absolute; top: 6px; right: 6px; border: 0; background: none; cursor: pointer; font-size: 1rem; opacity: .3; filter: grayscale(1); }
.mq-pin.on, .mq-pin:hover { opacity: 1; filter: none; }
.mq-picks .mq-tiles { padding-top: .2rem; }
.mq-unitlist { display: flex; flex-wrap: wrap; gap: .4rem; }
.mq-unitlist span { padding: .3em .8em; border-radius: 99px; background: color-mix(in srgb, var(--uc) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--uc) 40%, var(--line)); font-weight: 700; font-size: .9rem; }
.mq-unitlist small { color: var(--muted); }
.mq-trow { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: center; padding: .7rem .2rem; border-top: 1px solid var(--line); }
.mq-weak { color: var(--red); font-weight: 700; }
.mq-inline { display: inline; font-size: 1.1rem; }
.mq-critters { display: flex; flex-wrap: wrap; gap: .8rem; font-size: 2.2rem; }
.mq-critters span { display: flex; flex-direction: column; align-items: center; }
.mq-critters small { font-size: .8rem; font-weight: 800; color: var(--muted); }
@media (max-width: 640px) { .mq-trow { grid-template-columns: auto 1fr; } .mq-trow .btn { grid-column: 1 / -1; } }

/* fact grid */
.mq-grid { border-collapse: collapse; font-size: .78rem; margin: .8rem 0; width: 100%; max-width: 560px; }
.mq-grid th, .mq-grid td { text-align: center; padding: .3rem .1rem; border: 1px solid var(--card); }
.mq-grid th { color: var(--muted); font-weight: 800; }
.mq-grid td { border-radius: 6px; font-weight: 700; }
.g-n { background: var(--line); color: var(--muted); }
.g-w { background: #fecaca; color: #7f1d1d; }
.g-l { background: #fde68a; color: #78350f; }
.g-f { background: #86efac; color: #14532d; }
.mq-key-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-left: .6rem; }

/* player */
.mq-ex { gap: .8rem; }
.mq-kicker { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.mq-chip { display: inline-flex; gap: .3rem; align-items: center; padding: .25em .8em; border-radius: 99px; font-weight: 800; font-size: .9rem; color: #fff; background: var(--uc); }
.mq-lv { color: #f59e0b; letter-spacing: .1em; font-size: .85rem; }
.mq-q { display: flex; gap: .7rem; align-items: flex-start; padding: 1rem 1.1rem; border: 2px solid var(--line); border-radius: 20px; background: var(--card); }
.mq-qtext { flex: 1; font-size: 1.3rem; font-weight: 700; line-height: 1.5; }
.mq-read { flex: none; width: 42px; height: 42px; border-radius: 12px; border: 0; background: #0ea5e9; color: #fff; font-size: 1.1rem; cursor: pointer; box-shadow: 0 3px 0 #0369a1; }
.mq-big { font-family: 'Fredoka', var(--font); font-size: 1.7rem; font-weight: 600; margin-top: .3rem; }
.mq-box { color: var(--muted); }
.mq-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; margin: 0 .12em; font-size: .92em; }
.mq-frac sup, .mq-frac sub { font-size: 1em; vertical-align: baseline; position: static; padding: 0 .15em; }
.mq-frac sup { border-bottom: 2px solid currentColor; }
.mq-visual { display: flex; justify-content: center; padding: .4rem; border-radius: 18px; background: var(--card); border: 2px dashed var(--line); overflow-x: auto; }
.mq-svg { width: 100%; max-width: 420px; height: auto; font-family: var(--font); }
.mq-svg .sh { fill: #f59e0b; stroke: var(--ink); }
.mq-svg .sh2 { fill: #38bdf8; stroke: var(--ink); }
.mq-svg .em { fill: var(--card); stroke: var(--ink); }
.mq-svg .bed { fill: color-mix(in srgb, #84cc16 35%, var(--card)); stroke: #4d7c0f; }
.mq-svg .fence { fill: color-mix(in srgb, #a16207 10%, var(--card)); stroke: #a16207; stroke-dasharray: 8 4; }
.mq-svg .ln { stroke: var(--ink); }
.mq-svg .grid { stroke: var(--line); stroke-width: 1; }
.mq-svg .dot { fill: #ef4444; }
.mq-svg .tx { fill: var(--ink); }
.mq-svg .b { font-weight: 800; }
.mq-help { padding: .8rem 1rem; border-radius: 16px; background: color-mix(in srgb, #0ea5e9 10%, var(--card)); border: 2px solid color-mix(in srgb, #0ea5e9 35%, var(--line)); font-weight: 600; }
.mq-help.warn { background: color-mix(in srgb, #f59e0b 14%, var(--card)); border-color: color-mix(in srgb, #f59e0b 45%, var(--line)); }
.mq-help.steps { background: color-mix(in srgb, #22c55e 10%, var(--card)); border-color: color-mix(in srgb, #22c55e 40%, var(--line)); }
.mq-steps-title { font-weight: 800; margin-bottom: .3rem; }
.mq-steps { margin: 0; padding-left: 1.3rem; display: grid; gap: .3rem; }
.mq-entry { display: flex; align-items: center; justify-content: center; gap: .4rem; }
.mq-entry.shake { animation: lq-shake .35s; }
.mq-affix { font-family: 'Fredoka', var(--font); font-size: 1.8rem; font-weight: 600; color: var(--muted); }
.mq-input { width: 220px; max-width: 70vw; text-align: center; font-family: 'Fredoka', var(--font); font-size: 2rem; font-weight: 600; padding: .4rem .8rem; border-radius: 16px;
  border: 3px solid var(--line); background: var(--card); color: var(--ink); caret-color: var(--brand); }
.mq-input.wide { width: 100%; max-width: 420px; font-size: 1.6rem; }
.mq-input:focus { outline: none; border-color: #0ea5e9; }
.mq-preview { text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--brand); }
.mq-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; max-width: 330px; width: 100%; margin: 0 auto; }
.mq-pad.expr { grid-template-columns: repeat(4, 1fr); max-width: 380px; }
.mq-key { height: 54px; border-radius: 14px; border: 2px solid var(--line); border-bottom-width: 5px; background: var(--card); color: var(--ink); font: inherit;
  font-family: 'Fredoka', var(--font); font-size: 1.5rem; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.mq-key:active { transform: translateY(2px); border-bottom-width: 3px; }
.mq-key.op { background: color-mix(in srgb, #0ea5e9 12%, var(--card)); font-size: 1.15rem; }
.mq-key.del { background: color-mix(in srgb, #ef4444 10%, var(--card)); }
.mq-key:disabled { opacity: .5; }
.mq-choices .lq-opt > span:last-child { flex: 1; }
.mq-cards { display: flex; gap: .6rem; justify-content: center; margin-top: .7rem; }
.mq-cards span { width: 60px; height: 80px; display: grid; place-items: center; border-radius: 12px; background: #fff; color: #b91c1c; border: 2px solid var(--line);
  box-shadow: 0 4px 0 var(--line); font-family: 'Fredoka', var(--font); font-size: 2rem; }
.mq-clues { margin: .5rem 0; padding-left: 1.2rem; }
.mq-eq { font-size: 1.7rem; margin-top: .3rem; letter-spacing: .05em; }
.mq-deals { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.mq-deals span { padding: .4em .8em; border-radius: 12px; border: 2px solid var(--line); }
.mq-bigscore { font-family: 'Fredoka', var(--font); font-size: 2.6rem; font-weight: 700; color: var(--brand); }
.mq-events { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; font-weight: 700; }
.mq-events li { padding: .5rem .9rem; border-radius: 14px; background: var(--gold-soft); }

/* blitz */
.mq-opgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; width: 100%; max-width: 440px; }
.mq-opbtn { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .8rem; border-radius: 18px; border: 2px solid var(--line); border-bottom-width: 5px;
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.mq-opbtn b { font-family: 'Fredoka', var(--font); font-size: 2rem; color: #0ea5e9; }
.mq-opbtn small { color: var(--muted); }
.mq-opbtn.mix { grid-column: 1 / -1; }
.mq-blitz { align-items: center; }
.mq-fact { font-family: 'Fredoka', var(--font); font-size: 3.2rem; font-weight: 600; padding: .4rem 1.2rem; border-radius: 22px; }
.mq-fact.ok { background: color-mix(in srgb, #22c55e 18%, transparent); }
.mq-fact.no { background: color-mix(in srgb, #ef4444 16%, transparent); }
.mq-fact-ans s { color: #ef4444; }
.mq-pad.blitz .mq-key:last-child { grid-column: span 2; }

/* battle */
.mq-arena { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; border-radius: 20px; background: linear-gradient(180deg, color-mix(in srgb, #38bdf8 18%, var(--card)), color-mix(in srgb, #84cc16 22%, var(--card))); }
.mq-critter { font-size: 3.4rem; line-height: 1; animation: lq-bob 1.6s ease-in-out infinite; }
.mq-critter.big { font-size: 6rem; }
.mq-critter.hit { animation: mq-hit .45s; }
.mq-critter.grab { animation: mq-grab .5s; }
@keyframes mq-hit { 30% { transform: translateX(26px) rotate(18deg) scale(.85); filter: brightness(1.8); } }
@keyframes mq-grab { 40% { transform: translateX(-20px) scale(1.25); } }
.mq-arena-info { flex: 1; display: grid; gap: .25rem; }
.mq-hp { height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.mq-hp span { display: block; height: 100%; background: linear-gradient(90deg, #ef4444, #f97316); transition: width .4s ease; }
.mq-hearts { font-size: 1.2rem; }
.mq-hearts .gone { opacity: .2; filter: grayscale(1); }
@media (max-width: 560px) {
  .mq-qtext { font-size: 1.12rem; }
  .mq-key { height: 50px; }
  .mq-fact { font-size: 2.6rem; }
}
@media (prefers-reduced-motion: reduce) { .mq-critter { animation: none; } }
.mq-bigscore small { display: block; font-size: .9rem; color: var(--muted); font-weight: 700; }
@media (max-width: 560px), (max-height: 760px) {
  .mq-svg { max-height: 26vh; }
  .mq-q { padding: .7rem .8rem; }
  .mq-key { height: 44px; font-size: 1.3rem; }
  .mq-input { font-size: 1.6rem; padding: .25rem .6rem; }
  .mq-ex { gap: .55rem; }
}

/* ================= History Quest ================= */
.hq-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; padding-top: 1rem; }
.hq-lesson, .hq-vault-item { display: flex; align-items: center; gap: .7rem; text-align: left; padding: .7rem .8rem; border-radius: 18px; border: 2px solid var(--line); border-bottom-width: 5px;
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.hq-lesson:hover { border-color: var(--uc); }
.hq-lesson:active, .hq-vault-item:active { transform: translateY(2px); border-bottom-width: 3px; }
.hq-lesson.done { background: color-mix(in srgb, #f59e0b 10%, var(--card)); border-color: #f59e0b; }
.hq-lesson.week { outline: 4px solid color-mix(in srgb, var(--uc) 35%, transparent); outline-offset: 2px; }
.hq-lesson-ic, .hq-vault-ic { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: color-mix(in srgb, var(--uc, var(--brand)) 15%, var(--card)); }
.hq-lesson.done .hq-lesson-ic { background: #f59e0b; color: #fff; font-weight: 800; }
.hq-lesson-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.hq-lesson-main strong { line-height: 1.25; }
.hq-vault { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; }
.hq-vault-item.done { border-color: #f59e0b; }
.hq-lvl { color: #f59e0b; letter-spacing: .1em; font-weight: 800; }
.hq-otd p { margin: .3rem 0; }

/* hero cards */
.hq-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.hq-card-btn { border: 0; padding: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: center; }
.hq-card { --uc: var(--brand); display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .5rem .5rem .7rem; border-radius: 16px; text-align: center; height: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--uc) 22%, var(--card)), var(--card) 70%); border: 3px solid var(--uc); box-shadow: 0 4px 0 color-mix(in srgb, var(--uc) 60%, #000); color: var(--ink); }
.hq-card-top { align-self: stretch; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #fff; background: var(--uc); border-radius: 8px; padding: .1em .4em; }
.hq-card-art { font-size: 2.6rem; line-height: 1.2; }
.hq-card strong { font-size: .9rem; line-height: 1.2; }
.hq-card small { color: var(--muted); font-size: .75rem; }
.hq-card.locked { border: 2px dashed var(--line); box-shadow: none; background: var(--card); opacity: .65; }
.hq-card.big { width: 200px; height: auto; margin: 0 auto; padding: .7rem .7rem 1rem; }
.hq-card.big .hq-card-art { font-size: 4.5rem; }
.hq-card.big strong { font-size: 1.15rem; }
.hq-hero-modal { display: grid; gap: .8rem; text-align: center; }

/* map */
.hq-mapbox { display: flex; justify-content: center; }
.hq-map { width: 100%; max-width: 560px; height: auto; }
.hq-map .st rect { fill: var(--line); stroke: var(--card); stroke-width: 1; }
.hq-map .st text { fill: var(--muted); font-weight: 800; pointer-events: none; font-family: var(--font); }
.hq-map .st.home rect { stroke: #f59e0b; stroke-width: 2.5; }
.hq-map .st.hit rect, .hq-map .st.right rect { fill: #22c55e; }
.hq-map .st.pick rect { fill: #0ea5e9; }
.hq-map .st.wrong rect { fill: #ef4444; }
.hq-map .st.hit text, .hq-map .st.pick text, .hq-map .st.right text, .hq-map .st.wrong text { fill: #fff; }
.hq-map [data-q="state"] { cursor: pointer; }
.hq-map [data-q="state"]:hover rect { fill: color-mix(in srgb, #0ea5e9 45%, var(--line)); }
.hq-picked { text-align: center; }

/* player */
.hq-title { font-family: 'Fredoka', var(--font); font-size: 1.8rem; margin: 0; }
.hq-story { position: relative; display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.4rem 1.2rem 1.2rem; border-radius: 26px; background: var(--card);
  border: 2px solid var(--line); border-bottom-width: 6px; text-align: center; }
.hq-story p { font-size: 1.3rem; line-height: 1.6; margin: 0; }
.hq-story .mq-read { position: absolute; top: .7rem; right: .7rem; }
.hq-art { font-size: 5rem; line-height: 1.1; }
.hq-dots { display: flex; justify-content: center; gap: .4rem; }
.hq-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.hq-dots span.on { background: var(--brand); transform: scale(1.3); }
.hq-bigidea { display: grid; gap: .9rem; padding: 1.4rem 1.2rem; border-radius: 26px; background: var(--gold-soft); text-align: center; }
.hq-moral { font-family: 'Fredoka', var(--font); font-size: 1.6rem; font-weight: 600; line-height: 1.35; margin: 0; }
.hq-verse { font-size: 1rem; padding: .7rem 1rem; border-radius: 16px; background: var(--card); }
.hq-trait { font-weight: 700; }
.hq-quote { margin: 0; padding: .8rem 1.1rem; border-left: 5px solid var(--brand); background: var(--card); border-radius: 12px; font-style: italic; font-size: 1.1rem; text-align: left; }
.hq-quote cite { display: block; margin-top: .3rem; font-style: normal; font-weight: 800; font-size: .9rem; color: var(--muted); }
.hq-quote.big { font-size: 1.35rem; }
.hq-tf { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.hq-tf .lq-opt { justify-content: center; font-size: 1.3rem; padding: 1.2rem; }
.hq-hint { margin: 0; text-align: center; }
.hq-order { display: grid; gap: .55rem; }
.hq-ev { display: flex; align-items: center; gap: .7rem; text-align: left; padding: .8rem 1rem; border-radius: 16px; border: 2px solid var(--line); border-bottom-width: 5px;
  background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.hq-ev.sel { border-color: #0ea5e9; background: color-mix(in srgb, #0ea5e9 10%, var(--card)); }
.hq-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-weight: 800; }
.hq-ev.sel .hq-num { background: #0ea5e9; color: #fff; }
.hq-year { margin-left: auto; font-family: 'Fredoka', var(--font); color: var(--brand); }
.hq-tl-top { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.1rem; }
.hq-newcard { padding: 1rem 1.1rem; border-radius: 20px; background: color-mix(in srgb, #f59e0b 16%, var(--card)); border: 2px solid #f59e0b; font-size: 1.2rem; font-weight: 700; text-align: center; }
.hq-newcard small { display: block; color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.hq-line { display: grid; gap: .3rem; }
.hq-tl { padding: .6rem .9rem; border-radius: 14px; background: var(--card); border: 2px solid var(--line); font-weight: 600; }
.hq-tl b { font-family: 'Fredoka', var(--font); color: var(--brand); margin-right: .4rem; }
.hq-slot { border: 2px dashed color-mix(in srgb, #0ea5e9 50%, var(--line)); border-radius: 12px; background: transparent; color: #0369a1; font: inherit; font-weight: 800; font-size: .85rem; padding: .3rem; cursor: pointer; }
.hq-slot:hover { background: color-mix(in srgb, #0ea5e9 10%, transparent); }
.hq-passage { font-size: 1.25rem; line-height: 1.9; padding: 1rem 1.1rem; border-radius: 20px; background: var(--card); border: 2px solid var(--line); }
.hq-passage.read { font-family: Georgia, 'Times New Roman', serif; }
.hq-blank { display: inline-block; color: var(--muted); letter-spacing: .05em; }
.hq-blank.cur { color: #0ea5e9; background: color-mix(in srgb, #0ea5e9 14%, transparent); border-radius: 6px; padding: 0 .2em; }
.hq-fill { color: #15803d; font-weight: 800; }
.hq-readrow { display: flex; align-items: center; gap: .7rem; }
.hq-levels { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.hq-levels span { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--line); color: var(--muted); }
.hq-levels span.done { background: #f59e0b; color: #fff; }
.hq-levels span.on { background: #0ea5e9; color: #fff; }
.hq-levels small { color: var(--muted); font-weight: 700; margin-left: .3rem; }
.lq-tile.shake { border-color: #ef4444; animation: lq-shake .35s; }
.hq-clues { display: grid; gap: .4rem; margin: 0; padding-left: 1.4rem; font-size: 1.1rem; font-weight: 600; }
@media (max-width: 560px) { .hq-story p { font-size: 1.12rem; } .hq-art { font-size: 3.8rem; } .hq-moral { font-size: 1.3rem; } }

/* ================= Quiz engine (Word Quest + Lesson Quests) ================= */
.qk-kind { font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.qk-sentence { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; padding: .6rem; }
.qk-word { padding: .5em .7em; border-radius: 12px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card); color: var(--ink);
  font: inherit; font-size: 1.2rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.qk-word.sel { border-color: #0ea5e9; background: color-mix(in srgb, #0ea5e9 14%, var(--card)); }
.qk-word.right { border-color: #22c55e; background: color-mix(in srgb, #22c55e 20%, var(--card)); }
.qk-word.wrong { border-color: #ef4444; background: color-mix(in srgb, #ef4444 16%, var(--card)); animation: lq-shake .35s; }
.qk-blank { display: inline-block; min-width: 3.5em; padding: 0 .4em; border-bottom: 3px solid #0ea5e9; color: #0369a1; text-align: center; }
.lq-tile.sel { border-color: #0ea5e9; background: color-mix(in srgb, #0ea5e9 12%, var(--card)); }
.lq-tile.right { border-color: #22c55e; background: color-mix(in srgb, #22c55e 18%, var(--card)); }
.lq-tile.wrong { border-color: #ef4444; background: color-mix(in srgb, #ef4444 15%, var(--card)); }
.lq-input.right { border-color: #22c55e; }
.lq-input.wrong { border-color: #ef4444; animation: lq-shake .35s; }
.qk-type { width: 100%; background: var(--card); color: var(--ink); }
.qk-spell { padding-top: .6rem; gap: .5rem; display: flex; flex-direction: column; }
.qk-placed { justify-content: center; }
.qk-sortcard { align-self: center; padding: .9rem 1.4rem; border-radius: 18px; border: 2px solid #0ea5e9; border-bottom-width: 5px; background: var(--card);
  font-size: 1.3rem; font-weight: 800; text-align: center; animation: lq-in .25s ease; }
.qk-sortcard small { display: block; font-size: .8rem; color: var(--muted); font-weight: 700; margin-top: .2rem; }
.qk-bins { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.qk-bin { display: flex; flex-direction: column; gap: .5rem; padding: .6rem; border-radius: 18px; border: 2px dashed var(--line); min-height: 140px; }
.qk-bin-btn { padding: .8rem; border-radius: 14px; border: 0; background: var(--qc, #0ea5e9); color: #fff; font: inherit; font-family: 'Fredoka', var(--font); font-weight: 600; font-size: 1.15rem;
  cursor: pointer; box-shadow: 0 4px 0 color-mix(in srgb, var(--qc, #0ea5e9) 65%, #000); }
.qk-bin-btn:disabled { opacity: .55; cursor: default; }
.qk-bin-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.qk-bin-items { display: flex; flex-wrap: wrap; gap: .35rem; }
.qk-chip { padding: .3em .7em; border-radius: 99px; background: var(--card); border: 2px solid var(--line); font-weight: 700; font-size: .95rem; }
.qk-chip[data-res="right"] { border-color: #22c55e; background: color-mix(in srgb, #22c55e 18%, var(--card)); }
.qk-chip[data-res="wrong"] { border-color: #ef4444; background: color-mix(in srgb, #ef4444 15%, var(--card)); text-decoration: line-through; }
.qk-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }

/* ================= Word Quest ================= */
.wq-wotd { display: grid; gap: .3rem; background: linear-gradient(135deg, color-mix(in srgb, #d97706 12%, var(--card)), var(--card)); }
.wq-wotd p { margin: 0; }
.wq-wotd-word { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.wq-wotd-word b { font-family: 'Fredoka', var(--font); font-size: 2rem; color: #b45309; }
.wq-ex { font-style: italic; }
.wq-wall { margin-top: .2rem; }
.wq-wotd .btn { justify-self: start; }
.wq-hunt-title { flex: 1; text-align: center; }
.wq-hunt-ex { align-items: center; gap: .8rem; }
.wq-grid { display: grid; gap: .35rem; }
.wq-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
.wq-row.shake { animation: lq-shake .35s; }
.wq-cell { width: min(15vw, 58px); height: min(15vw, 58px); display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--line);
  font-family: 'Fredoka', var(--font); font-size: 1.7rem; font-weight: 700; text-transform: uppercase; background: var(--card); }
.wq-cell.typed { border-color: var(--muted); animation: lq-pop .15s; }
.wq-cell.g, .wq-key.g { background: #16a34a; border-color: #16a34a; color: #fff; }
.wq-cell.y, .wq-key.y { background: #eab308; border-color: #eab308; color: #fff; }
.wq-cell.n { background: var(--muted); border-color: var(--muted); color: #fff; }
.wq-key.n { opacity: .35; }
.wq-krow { display: flex; gap: .25rem; justify-content: center; }
.wq-key { min-width: min(8.4vw, 42px); height: 52px; padding: 0 .2rem; border-radius: 8px; border: 0; background: var(--line); color: var(--ink);
  font: inherit; font-weight: 800; text-transform: uppercase; cursor: pointer; touch-action: manipulation; }
.wq-key.wide { min-width: min(14vw, 66px); font-size: .75rem; }
.wq-key:disabled { cursor: default; }

/* ================= Lesson Quests ================= */
.lqst-btn { display: flex; align-items: center; gap: .8rem; width: 100%; margin: .8rem 0 .2rem; padding: .8rem 1rem; border-radius: 20px; text-align: left; cursor: pointer;
  border: 2px solid var(--qc); border-bottom-width: 5px; background: color-mix(in srgb, var(--qc) 10%, var(--card)); color: var(--ink); font: inherit; }
.lqst-btn:active { transform: translateY(2px); border-bottom-width: 3px; }
.lqst-ic { font-size: 2.2rem; }
.lqst-main { flex: 1; display: flex; flex-direction: column; }
.lqst-main strong { font-family: 'Fredoka', var(--font); font-size: 1.2rem; font-weight: 600; }
.lqst-main small { color: var(--muted); }
.lqst-go { font-family: 'Fredoka', var(--font); font-weight: 700; background: var(--qc); color: #fff; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.lqst-line { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; padding: .5rem .8rem; border-radius: 14px;
  background: color-mix(in srgb, var(--qc) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--qc) 35%, var(--line)); }
.lqst-line > span:first-child { flex: 1; min-width: 180px; }
.lqst-kid { font-size: .9rem; font-weight: 700; color: #b45309; padding: .1em .5em; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); }
.lqst-kids { padding-left: 1.2rem; }
.lqst-today .lqst-btn { margin: .4rem 0; }
.lqst-loading { align-items: center; justify-content: center; }
.lqst-dots { display: flex; gap: .5rem; justify-content: center; }
.lqst-dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); animation: lq-bob .9s ease-in-out infinite; }
.lqst-dots span:nth-child(2) { animation-delay: .15s; }
.lqst-dots span:nth-child(3) { animation-delay: .3s; }

/* Quests hub */
.qh-modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 .8rem; }
.qh-modules .lq-today { margin-top: .6rem; }
.qh-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.qh-head h2 { margin: 0; }
.qh-list { display: grid; gap: .4rem; }
.qh-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: inherit; text-align: left; width: 100%; }
.qh-row.today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.qh-play { cursor: pointer; border-bottom-width: 4px; }
.qh-play:active { transform: translateY(2px); border-bottom-width: 2px; }
.qh-ic { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; background: color-mix(in srgb, var(--qc) 16%, var(--card)); }
.qh-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.qh-kids { display: flex; gap: .3rem; flex-wrap: wrap; }
.qh-stars { color: #f59e0b; font-weight: 800; letter-spacing: .05em; }
@media (max-width: 560px) { .qh-modules { grid-template-columns: 1fr; } .qh-row { flex-wrap: wrap; } .qh-kids { width: 100%; padding-left: 3.2rem; } }
@media (prefers-reduced-motion: reduce) { .lqst-dots span { animation: none; } }

/* ================= Ask Mom (help list) ================= */
.help-notice { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.help-notice .btn { margin-left: auto; }
.help-item { border: 1px solid var(--line); border-radius: 16px; padding: .8rem 1rem; margin: .7rem 0; background: var(--card); }
.help-item.done { opacity: .6; }
.help-item header { display: flex; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.help-q { font-size: 1.1rem; font-weight: 600; padding: .6rem .8rem; border-radius: 12px; background: var(--bg); }
.help-q .mq-visual { margin-top: .4rem; }
.help-try { display: inline-block; padding: .1em .6em; margin: .1em; border-radius: 99px; background: color-mix(in srgb, #ef4444 14%, var(--card)); font-weight: 700; }
.help-ans { font-weight: 800; color: #15803d; }
.qk-retry { margin-top: .2rem; }

/* ================= Typing (shared pad) ================= */
.tk-pad { display: grid; gap: .7rem; position: relative; }
.tk-stats { display: flex; gap: 1rem; justify-content: center; font-weight: 700; color: var(--muted); }
.tk-stats b { font-family: 'Fredoka', var(--font); font-size: 1.3rem; color: var(--brand); }
.tk-text { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 1.6rem; line-height: 2.1; letter-spacing: .02em; padding: .8rem 1rem;
  border-radius: 18px; border: 2px solid var(--line); background: var(--card); max-height: 9.5em; overflow: hidden; position: relative; word-break: break-word; outline: none; }
.tk-c { color: var(--muted); border-radius: 4px; }
.tk-c.ok { color: #15803d; }
.tk-c.ok.was-bad { color: #b45309; }
.tk-c.cur { background: color-mix(in srgb, #0ea5e9 22%, transparent); color: var(--ink); box-shadow: inset 0 -3px 0 #0ea5e9; }
.tk-c.bad { animation: tk-bad .35s; }
@keyframes tk-bad { 30% { background: #ef4444; color: #fff; } }
.tk-finger { text-align: center; font-weight: 700; color: var(--muted); min-height: 1.4em; }
.tk-input { position: absolute; opacity: 0; width: 1px; height: 1px; left: 50%; bottom: 0; border: 0; padding: 0; }
.tk-tap { text-align: center; margin: 0; }
.tk-kb { display: grid; gap: .3rem; justify-content: center; user-select: none; }
.tk-row { display: flex; gap: .3rem; justify-content: center; }
.tk-row.r1 { padding-left: .9rem; } .tk-row.r2 { padding-left: 1.6rem; } .tk-row.r3 { padding-left: 2.6rem; }
.tk-key { min-width: 2.3rem; height: 2.3rem; display: grid; place-items: center; border-radius: 8px; font-weight: 800; font-size: .85rem;
  background: color-mix(in srgb, var(--f, #ccc) 30%, var(--card)); border: 1px solid color-mix(in srgb, var(--f, #ccc) 70%, var(--line)); color: var(--ink); }
.tk-key.bump { text-decoration: underline; }
.tk-key.space { min-width: 14rem; }
.tk-key.shift { min-width: 3.4rem; background: var(--card); }
.tk-key.next { background: var(--f, #0ea5e9); color: #111; transform: translateY(-2px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--f, #0ea5e9) 50%, transparent); }
.tk-key.shift.next { background: #0ea5e9; color: #fff; }
@media (max-width: 600px) { .tk-key { min-width: 1.75rem; height: 2rem; font-size: .7rem; } .tk-key.space { min-width: 9rem; } .tk-text { font-size: 1.25rem; } }

/* ================= Typing Quest ================= */
.tq-ex { max-width: 780px; }
.tq-title { flex: 1; text-align: center; }
.tq-step { text-align: center; font-weight: 800; color: var(--muted); margin-bottom: .4rem; }
.tq-tip { font-size: 1.15rem; max-width: 520px; }
.tq-keycap { display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 .3rem; border-radius: 8px; border: 2px solid var(--line);
  border-bottom-width: 4px; font-weight: 800; font-family: ui-monospace, Consolas, monospace; }
.tq-path { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .5rem; }
.tq-lesson { display: flex; align-items: center; gap: .6rem; text-align: left; padding: .6rem .7rem; border-radius: 16px; border: 2px solid var(--line); border-bottom-width: 4px;
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.tq-lesson.done { border-color: #f59e0b; }
.tq-lesson.next { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tq-lesson:disabled { opacity: .5; cursor: default; }
.tq-lesson-ic { font-size: 1.5rem; width: 2.2rem; text-align: center; }
.tq-cats { display: flex; flex-wrap: wrap; gap: .4rem; }
.tq-chart { display: flex; align-items: flex-end; gap: .35rem; height: 110px; margin-top: .9rem; padding: .4rem; border-bottom: 2px solid var(--line); }
.tq-chart span { flex: 1; min-height: 6px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #6366f1, #0ea5e9); position: relative; }
.tq-chart b { position: absolute; top: -1.3em; left: 0; right: 0; text-align: center; font-size: .75rem; }
.tq-game { display: grid; gap: .5rem; }
.tq-hud { display: flex; justify-content: space-between; font-weight: 800; }
.tq-field { position: relative; height: min(60vh, 460px); border-radius: 20px; overflow: hidden; border: 2px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, #38bdf8 20%, var(--card)), color-mix(in srgb, #84cc16 25%, var(--card))); }
.tq-fence { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 1.6rem; letter-spacing: .1em; background: color-mix(in srgb, #a16207 25%, transparent); }
.tq-foe { position: absolute; display: flex; flex-direction: column; align-items: center; transition: opacity .3s, transform .3s; }
.tq-critter { font-size: 2rem; }
.tq-word { font-family: ui-monospace, Consolas, monospace; font-weight: 800; font-size: 1.1rem; background: var(--card); padding: .1em .45em; border-radius: 8px; border: 2px solid var(--line); }
.tq-word b { color: #15803d; }
.tq-foe.locked .tq-word { border-color: #0ea5e9; }
.tq-foe.zapped { opacity: 0; transform: scale(1.6) rotate(20deg); }

/* ================= Maps (shared) ================= */
.mk-map { width: 100%; height: auto; max-height: 58vh; display: block; margin: 0 auto; }
.mk-sea { fill: color-mix(in srgb, #38bdf8 14%, var(--card)); stroke: var(--line); }
.mk-p { fill: color-mix(in srgb, #84cc16 30%, var(--card)); stroke: color-mix(in srgb, var(--ink) 45%, transparent); stroke-width: .7; vector-effect: non-scaling-stroke; }
.mk-p.off { fill: color-mix(in srgb, var(--muted) 18%, var(--card)); }
.mk-p.on[data-place] { cursor: pointer; }
.mk-p.on[data-place]:hover { fill: color-mix(in srgb, #0ea5e9 45%, var(--card)); }
.mk-p.pick, .mk-dot.pick { fill: #0ea5e9; }
.mk-p.right, .mk-dot.right { fill: #22c55e; }
.mk-p.wrong, .mk-dot.wrong { fill: #ef4444; }
.mk-dot { fill: color-mix(in srgb, #84cc16 55%, var(--card)); stroke: var(--ink); stroke-width: .8; vector-effect: non-scaling-stroke; cursor: pointer; }
.mk-outline { fill: none; stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.mk-l { fill: var(--ink); font-weight: 800; pointer-events: none; font-family: var(--font); }
.mk-ohio .mk-p { stroke-width: .8; }
.qk-map { border-radius: 16px; border: 2px solid var(--line); padding: .3rem; background: var(--card); }

/* ================= Map Quest ================= */
.mpq-stage .lq-ex, .mpq-stage { max-width: 980px; margin: 0 auto; width: 100%; }
.mpq-ask { text-align: center; font-size: 1.3rem; margin: .3rem 0 .6rem; display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.mpq-map { border-radius: 18px; border: 2px solid var(--line); padding: .3rem; background: var(--card); }
.mpq-info { margin-top: .6rem; font-size: 1.2rem; }
.mpq-opts { margin-top: .7rem; grid-template-columns: 1fr 1fr; }
.mpq-decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.mpq-deck { display: grid; gap: .5rem; padding: .8rem; border-radius: 18px; border: 2px solid var(--line); background: var(--card); }
.mpq-deck-head { display: flex; gap: .6rem; align-items: center; }
.mpq-deck-head > div { display: flex; flex-direction: column; }
.mpq-deck-ic { font-size: 2rem; }
.mpq-deck-btns { display: flex; gap: .35rem; flex-wrap: wrap; }
@media (max-width: 560px) { .mpq-opts { grid-template-columns: 1fr; } }

/* ================= Science Quest ================= */
.sq-wonder { background: linear-gradient(135deg, color-mix(in srgb, #0d9488 12%, var(--card)), var(--card)); }
.sq-wonder h2 { margin: .2rem 0; }
.sq-verse { font-style: italic; color: var(--muted); }
.sq-exp { display: flex; align-items: center; gap: .7rem; text-align: left; padding: .7rem .8rem; border-radius: 18px; border: 2px solid var(--line); border-bottom-width: 5px;
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.sq-exp:hover { border-color: var(--uc); }
.sq-exp.done { border-color: #f59e0b; }
.sq-exp-ic { font-size: 1.6rem; width: 2.4rem; text-align: center; }
.sq-expm h2 { margin: .2rem 0 .4rem; }
.sq-question { font-size: 1.15rem; font-weight: 700; }
.sq-stage { margin-top: .8rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.sq-stage textarea { width: 100%; margin: .3rem 0 .6rem; }
.sq-journal { padding: .2rem 0; }

/* ---------- Rewards ---------- */
.rw-meter { height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; margin: .5rem 0 .3rem; }
.rw-meter span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #f59e0b, #facc15); transition: width .6s; }
.kidhello .rw-meter { background: rgba(255,255,255,.3); max-width: 520px; }
.rw-card { display: block; color: inherit; text-decoration: none; margin: 1rem 0; }
.rw-card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.rw-ready { margin-top: .4rem; font-weight: 700; }
.rw-ladder { display: grid; gap: .6rem; margin: 1rem 0; }
.rw-step { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; border-radius: 18px; background: var(--card); border: 2px solid var(--line); flex-wrap: wrap; }
.rw-step.is-reached { border-color: #f59e0b; background: color-mix(in srgb, #facc15 14%, var(--card)); }
.rw-step.is-given { opacity: .75; }
.rw-emoji { font-size: 2rem; width: 2.6rem; text-align: center; }
.rw-body { flex: 1; min-width: 160px; }
.rw-tag { font-size: .85rem; font-weight: 700; padding: .25em .7em; border-radius: 99px; background: var(--line); }
.rw-tag.claimed { background: var(--gold-soft); }
.rw-tag.given { background: color-mix(in srgb, var(--done) 25%, var(--card)); }
.rw-kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.rw-kid { border-top: 5px solid var(--c); }
.rw-claim { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.rw-row { border: 1px solid var(--line); border-radius: 14px; padding: .7rem .8rem; margin-bottom: .7rem; }
.rw-row-top, .rw-row-kids { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.rw-row-kids { margin-top: .4rem; }
.rw-row-kids label { flex: 1; min-width: 200px; }
.rw-row-top label { min-width: 90px; }
.rw-row-top .rw-all { flex: 1; min-width: 200px; }
.rw-em { width: 4em; }
.rw-row [type=number] { width: 7em; }
.rw-lessonxp input { width: 6em; }

/* ---------- Nav: five tabs with drop-downs (no sideways scrolling) ---------- */
.topbar nav { overflow: visible; justify-content: flex-start; }
.navgroup { position: relative; display: flex; }
.topbar nav .navtab { display: flex; align-items: center; gap: .35em; padding: .55em .9em; color: var(--muted); text-decoration: none; font: inherit; font-weight: 700;
  white-space: nowrap; background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer; }
.topbar nav .navtab:hover { color: var(--ink); }
.topbar nav .navtab.active { color: var(--brand); border-bottom-color: var(--brand); }
.navtab .caret { font-size: .7em; opacity: .7; }
.navmenu { position: absolute; top: 100%; left: 0; z-index: 30; min-width: 230px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: .35rem; display: grid; }
.navmenu[hidden] { display: none; }
.topbar nav .navmenu a { padding: .6em .8em; border-radius: 10px; border: 0; color: var(--ink); font-weight: 700; text-decoration: none; }
.topbar nav .navmenu a:hover, .topbar nav .navmenu a.on { background: var(--brand-soft); }
.navgroup:last-child .navmenu { left: auto; right: 0; }
@media (max-width: 640px) {
  .topbar nav { gap: 0; }
  .topbar nav > a.navtab, .navgroup { flex: 1 1 0; min-width: 0; }
  .topbar nav .navtab { flex: 1; flex-direction: column; gap: 0; padding: .35em .1em .3em; font-size: .78rem; }
  .navtab .nt-ic { font-size: 1.35rem; line-height: 1.2; }
  .navtab .caret { display: none; }
  .navgroup { position: static; }
  .navmenu, .navgroup:last-child .navmenu { position: absolute; top: 100%; left: 12px; right: 12px; min-width: 0; }
}

/* ---------- Help: the always-visible pill and the Today banner ---------- */
.help-pill { margin-left: auto; margin-right: .5rem; display: inline-flex; align-items: center; gap: .3em; border: 0; border-radius: 99px; padding: .4em .9em;
  background: #dc2626; color: #fff; font: inherit; font-weight: 800; cursor: pointer; animation: helpPulse 2s ease-in-out infinite; }
.help-pill b { font-size: 1.1em; }
@keyframes helpPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 50% { box-shadow: 0 0 0 8px rgba(220,38,38,0); } }
@media (max-width: 640px) { .help-pill span { display: none; } }
@media (prefers-reduced-motion: reduce) { .help-pill { animation: none; } }
.help-banner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; padding: 1.1rem 1.3rem; border-radius: 20px;
  background: linear-gradient(135deg, #dc2626, #ea580c); color: #fff; box-shadow: 0 10px 28px rgba(220,38,38,.25); }
.help-banner h2 { margin: 0 0 .3rem; color: #fff; font-size: 1.35rem; }
.help-banner ul { margin: .2rem 0 .4rem; padding-left: 1.1rem; }
.help-banner p { margin: 0; opacity: .9; }
.hb-ic { font-size: 2.6rem; }
.hb-tx { flex: 1; min-width: 220px; }
.help-banner .hb-btn { background: #fff; color: #b91c1c; border: 0; font-weight: 800; }

/* ---------- Reading ---------- */
.rd-card { display: flex; gap: .9rem; align-items: center; color: inherit; text-decoration: none; margin: 1rem 0; }
.rd-cover { font-size: 2rem; width: 3rem; height: 3.6rem; display: grid; place-items: center; border-radius: 6px 12px 12px 6px; background: color-mix(in srgb, #f59e0b 22%, var(--card)); box-shadow: inset 5px 0 0 rgba(0,0,0,.12); }
.rd-cover.big { font-size: 3rem; width: 5rem; height: 6rem; margin: 0 auto; }
.rd-book { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; }
.rd-book .rd-cover.big { margin: 0; }
.rd-main { flex: 1; min-width: 220px; }
.rd-main h2 { margin: 0; }
.rd-note { background: var(--gold-soft); border-radius: 10px; padding: .5em .8em; }
.rd-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.rd-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.rd-spine { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .8rem; border-radius: 6px 12px 12px 6px; background: var(--bg); border-left: 6px solid #f59e0b; }
.rd-kid { border-top: 5px solid var(--c); }
.rd-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.rd-row-main { flex: 1; min-width: 200px; }
.rd-row-btns { display: flex; gap: .3rem; }
.rd-status { font-size: .85rem; font-weight: 700; padding: .25em .7em; border-radius: 99px; background: var(--line); white-space: nowrap; }
.rd-status.passed { background: color-mix(in srgb, var(--done) 25%, var(--card)); }
.rd-status.quiz { background: var(--gold-soft); }
.rd-status.late { background: color-mix(in srgb, #dc2626 18%, var(--card)); }
.rd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.rd-quizhead { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.rd-q { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem .7rem; margin: 0 0 .6rem; display: grid; gap: .35rem; }
.rd-q legend { font-weight: 800; padding: 0 .3rem; }
.rd-choice { display: flex; align-items: center; gap: .5rem; }
.rd-choice [type=radio] { width: 1.2rem; height: 1.2rem; flex: none; }
.rd-quiz .rd-qq { margin: 1rem 0; }
.rd-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .5rem; }
.rd-quiz .lq-opt.sel { outline: 3px solid var(--brand); }
.rd-result { padding: 1rem; }

/* ---------- Extra credit ---------- */
.ec-subj { display: inline-block; font-size: .75rem; font-weight: 800; padding: .15em .6em; border-radius: 99px; background: var(--brand-soft); color: var(--brand); margin-right: .3rem; }
.ec-quick { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }
.ec-quick input { width: 6em; }

/* ---------- Help Time (one problem at a time) ---------- */
.ht-head { display: flex; justify-content: space-between; align-items: flex-end; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.ht-head h1 { margin: .1rem 0 0; }
.ht-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 .8rem; }
.ht-chips .chip.on { background: var(--brand); color: #fff; }
.ht-progress { display: flex; align-items: center; gap: .8rem; margin: .4rem 0; }
.ht-progress span { white-space: nowrap; }
.ht-progress .rw-meter { flex: 1; margin: 0; }
.ht-card { border-top: 5px solid var(--c); }
.ht-q { font-size: 1.35rem; line-height: 1.45; margin: .6rem 0 .8rem; }
.ht-q small { font-size: .95rem; color: var(--muted); }
.ht-tries { margin: .3rem 0 .6rem; }
.ht-ans summary { cursor: pointer; font-weight: 800; padding: .5rem 0; }
.ht-lock { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .8rem 1rem; border-radius: 14px; background: var(--gold-soft); }
.ht-lock > div { flex: 1; min-width: 200px; }
.ht-nav { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0 2rem; }
.ht-nav .btn-primary { margin-left: auto; }
.ht-done { text-align: center; padding: 2rem 1rem; }
.ht-big { font-size: 4rem; }
.ht-kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.ht-kid { display: flex; align-items: center; gap: .9rem; color: inherit; text-decoration: none; border-left: 6px solid var(--c); }
.ht-kid > div { flex: 1; }
.ht-kid-emoji { font-size: 2rem; }
.ht-play { margin: 0 0 .6rem; }
/* The whole problem in Help Time and Mom's list (helpreplay.js) */
.hr-prev .hr-q { margin-bottom: .5rem; }
.hr-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; }
.hr-chip { padding: .3em .75em; border-radius: 12px; background: var(--card); border: 2px solid var(--line); font-size: .95rem; font-weight: 600; line-height: 1.3; }
.hr-match { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.hr-match .hr-chips { flex-direction: column; align-items: stretch; }
.hr-bins { display: flex; gap: .5rem; align-items: center; margin: .3rem 0; }
.hr-bin { padding: .3em .8em; border-radius: 12px; background: var(--c, #0ea5e9); color: #fff; font-weight: 700; font-size: .95rem; }
.hr-sentence { padding: .5rem .8rem; border-radius: 12px; background: var(--bg); border: 2px dashed var(--line); font-size: 1rem; }
.hr-map { max-width: 640px; }
.help-q.hr-prev .hr-bin { --c: #64748b; }
@media (max-width: 640px) { .ht-q { font-size: 1.15rem; } .ht-nav .btn-primary { width: 100%; margin-left: 0; order: -1; } }

/* ---------- First Flight theme ---------- */
/* Feather icon (drawn here because the 🪶 emoji is missing on Windows 10). */
.fthr { display: inline-block; width: 1em; height: 1em; vertical-align: -.15em; background: center / contain no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.5 3.5C14 3.6 8.4 7.6 6.5 13.6L5 18.5l1.4.4.9-2.6c4.4-.3 8.5-2.6 10.8-6.3l-3.3.4 3.9-2.2c.8-1.4 1.4-3 1.8-4.7z' fill='%23f59e0b'/%3E%3Cpath d='M3.5 21.5 13 9.5' stroke='%23b45309' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.logo { width: 1.25em; height: 1.25em; vertical-align: -.25em; border-radius: 22%; }
.brand .logo { width: 34px; height: 34px; vertical-align: middle; }
.brand-tx { display: inline-flex; flex-direction: column; line-height: 1.05; vertical-align: middle; }
.brand-tx small { font-family: Nunito, system-ui, sans-serif; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.tagline { font-family: Fredoka, Nunito, sans-serif; font-weight: 600; font-size: 1.15rem; color: var(--brand); margin: -.3rem 0 .4rem; }
.byline { margin-top: 1.4rem; font-size: .85rem; color: var(--muted); }
.byline a { color: inherit; font-weight: 700; }

/* Gracie, the mascot that grows from an egg to an eagle */
.mascot { display: inline-grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #e0f2fe, #bae6fd 60%, #7dd3fc); box-shadow: inset 0 -6px 0 rgba(15,118,110,.18); }
.mascot.lg { width: 92px; height: 92px; }
.mascot.xl { width: 140px; height: 140px; margin: 0 auto .6rem; }
.mascot-bird { font-size: 2.1rem; line-height: 1; }
.mascot.lg .mascot-bird { font-size: 3.1rem; }
.mascot.xl .mascot-bird { font-size: 4.8rem; }
.mascot.st-0 { background: radial-gradient(circle at 50% 40%, #fef3c7, #fde68a 60%, #d6a35c); } /* a cozy nest for the egg */
.mascot.st-6 { background: radial-gradient(circle at 50% 35%, #fef9c3, #fde68a 55%, #f59e0b); }
@media (prefers-reduced-motion: no-preference) {
  .mascot-bird { animation: gracie 3.2s ease-in-out infinite; }
  .mascot.st-0 .mascot-bird { animation: wobble 2.6s ease-in-out infinite; }
}
@keyframes gracie { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes wobble { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
.flight-card { display: flex; gap: 1rem; align-items: center; color: inherit; text-decoration: none; margin: 1rem 0; }
.flight-tx { flex: 1; min-width: 0; }
.flight-bubble { position: relative; display: inline-block; background: var(--brand-soft); border-radius: 14px; padding: .45em .8em; margin: .25rem 0 .4rem; font-weight: 700; }
.flight-meter { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; margin: .2rem 0 .3rem; }
.flight-meter span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #38bdf8, #0f766e); }
.flight-path { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: .5rem; margin: .4rem 0 .6rem; }
.fp-step { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .6rem .3rem; border-radius: 14px; background: var(--bg); border: 2px solid var(--line); opacity: .65; text-align: center; }
.fp-step.done { opacity: 1; }
.fp-step.now { opacity: 1; border-color: var(--brand); background: var(--brand-soft); }
.fp-bird { font-size: 1.8rem; }
.grow-modal h2 { margin: .3rem 0; }


/* ---------- WordPress plugin: family setup, "Who's learning?" picker, PIN pad ---------- */
.fam-row { display: grid; grid-template-columns: 3.2rem 1fr 7rem 8.5rem 9rem 3rem 2.2rem; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.fam-row [hidden] { visibility: hidden; display: block; }
@media (max-width: 720px) { .fam-row { grid-template-columns: 3.2rem 1fr 1fr; } }
.pick-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2rem; margin: 1.5rem 0; }
.pick { display: flex; flex-direction: column; align-items: center; gap: .3rem; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; padding: .4rem; border-radius: 18px; }
.pick:hover .pick-face, .pick:focus-visible .pick-face { transform: scale(1.06); box-shadow: 0 0 0 4px var(--c); }
.pick-face { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 26px; font-size: 3.4rem; background: color-mix(in srgb, var(--c) 22%, var(--card)); border: 3px solid var(--c); transition: transform .15s; }
.pick-face.big { width: 92px; height: 92px; margin: 0 auto; font-size: 2.8rem; }
.linkish { background: none; border: 0; color: var(--brand); font: inherit; text-decoration: underline; cursor: pointer; }
.pin-dots { font-size: 1.8rem; letter-spacing: .4em; min-height: 2.4rem; margin: .4rem 0; }
.pin-keys { display: grid; grid-template-columns: repeat(3, 72px); gap: .6rem; justify-content: center; margin: .4rem 0 1rem; }
.pin-key { height: 64px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 1.5rem; font-weight: 800; cursor: pointer; }
.pin-key:active { transform: scale(.95); }

/* Wings of Learning: consent checkbox, account deletion */
.agree { display: flex; gap: .6em; align-items: flex-start; text-align: left; font-size: .92em; line-height: 1.4; margin: .8em 0; }
.agree input { margin-top: .25em; flex: none; width: auto; }
.btn.danger { color: var(--red); border-color: var(--red); }
.danger-zone { border-color: color-mix(in srgb, var(--red) 40%, transparent); }
