:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1a2332;
  --ink-2: #4a5568;
  --ink-3: #8a94a6;
  --line: #e3e8ef;
  --brand: #0f6e56;
  --brand-2: #e1f5ee;
  --brand-ink: #085041;
  --accent: #534ab7;
  --accent-2: #eeedfe;
  --danger: #a32d2d;
  --danger-2: #f7c1c1;
  --ok: #0f6e56;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(26, 35, 50, .07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.65; font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- nav ---------- */
.nav {
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 24px; height: 56px;
  position: sticky; top: 0; z-index: 50;
}
.nav .logo { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.nav .logo .mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.nav .links { display: flex; gap: 4px; margin-left: 8px; }
.nav .links a {
  padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px;
}
.nav .links a.active { background: var(--brand-2); color: var(--brand-ink); font-weight: 500; }
.nav .spacer { flex: 1; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink-2); font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- layout ---------- */
.wrap { max-width: 1060px; margin: 0 auto; padding: 28px 24px 80px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 18px;
}
.card h2 { font-size: 17px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 15px; font-weight: 600; margin: 14px 0 6px; }
.muted { color: var(--ink-3); font-size: 13px; }
.sub { color: var(--ink-2); font-size: 13.5px; }
.tag {
  display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px;
  background: var(--brand-2); color: var(--brand-ink); border: 1px solid #bfe3d4;
}
.tag.gray { background: var(--bg); color: var(--ink-3); border-color: var(--line); }
.tag.purple { background: var(--accent-2); color: var(--accent); border-color: #cecbf6; }
.tag.red { background: #fcebeb; color: var(--danger); border-color: var(--danger-2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; border: none; border-radius: 10px;
  padding: 10px 22px; font-size: 14.5px; cursor: pointer; font-weight: 500;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn.ghost { background: var(--card); color: var(--brand); border: 1px solid var(--brand); }
.btn.small { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- home hero ---------- */
.hero { display: flex; flex-direction: column; gap: 6px; padding: 34px 30px; }
.hero .code { font-size: 13px; letter-spacing: 2px; color: var(--brand); font-weight: 600; }
.hero h1 { font-size: 27px; font-weight: 700; }
.hero .zh { color: var(--ink-2); font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.chcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); cursor: pointer; position: relative;
  transition: transform .15s, box-shadow .15s; display: block; color: var(--ink);
}
.chcard:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(26,35,50,.1); text-decoration: none; }
.chcard .no { font-size: 12px; color: var(--ink-3); letter-spacing: 1px; }
.chcard .t { font-weight: 600; margin: 3px 0 2px; font-size: 15px; }
.chcard .z { color: var(--ink-2); font-size: 13px; }
.chcard.locked { cursor: default; opacity: .62; }
.chcard.locked:hover { transform: none; box-shadow: var(--shadow); }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 240px 1fr 46px; align-items: center; gap: 10px; font-size: 13.5px; }
.bar { height: 9px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 5px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  flex: 1; min-width: 96px; border: none; background: transparent; border-radius: 9px;
  padding: 8px 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.tabs button.active { background: var(--brand-2); color: var(--brand-ink); font-weight: 600; }
.sec-list .sec { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.sec > summary {
  cursor: pointer; padding: 13px 18px; background: var(--card); list-style: none;
  display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px;
}
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "▾"; margin-left: auto; color: var(--ink-3); }
.sec[open] > summary::after { content: "▴"; }
.sec .body { padding: 4px 18px 16px; }
.sec .body ul { padding-left: 20px; }
.sec .body li { margin: 6px 0; color: var(--ink-2); font-size: 14px; }
.obj-list li { margin: 7px 0; color: var(--ink-2); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } .bar-row { grid-template-columns: 150px 1fr 42px; } }

/* ---------- podcast scenes ---------- */
.scene { display: grid; grid-template-columns: 74px 1fr; gap: 14px; padding: 14px 4px; border-bottom: 1px dashed var(--line); }
.scene:last-child { border-bottom: none; }
.scene .sl {
  width: 64px; height: 40px; border-radius: 8px; background: var(--brand-2); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
  border: 1px solid #bfe3d4;
}
.scene .t { font-weight: 600; font-size: 14px; }
.scene .n { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }
.videobox { background: #10161f; border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.videobox video { width: 100%; display: block; }

/* ---------- quiz ---------- */
.qcard { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; background: var(--card); }
.qcard .stem { font-weight: 600; margin-bottom: 12px; white-space: pre-wrap; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; cursor: pointer;
  font-size: 14px; transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--brand); }
.opt.sel { border-color: var(--brand); background: var(--brand-2); }
.opt .letter { font-weight: 700; color: var(--ink-3); }
.opt.sel .letter { color: var(--brand-ink); }
.opt.right { border-color: var(--ok); background: var(--brand-2); }
.opt.wrong { border-color: var(--danger); background: #fcebeb; }
.qcard.done .opt { cursor: default; }
.expl { margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: var(--bg);
  font-size: 13.5px; color: var(--ink-2); }
.expl.good { background: var(--brand-2); color: var(--brand-ink); }
.expl.bad { background: #fcebeb; color: var(--danger); }
.score-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 34px 10px 10px; }
.score-hero .num { font-size: 44px; font-weight: 700; }
.kpbar { display: grid; grid-template-columns: 1fr 210px 42px; gap: 10px; align-items: center; margin: 7px 0; font-size: 13px; }
.kpbar .bar i.weak { background: var(--danger); }
.reco { border: 1px solid var(--danger-2); background: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.reco .t { font-weight: 600; color: var(--danger); font-size: 14px; }
.reco ul { padding-left: 20px; margin-top: 6px; }
.reco li { font-size: 13.5px; color: var(--ink-2); margin: 4px 0; }

/* ---------- mistake notebook ---------- */
.mk-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.mk-stat { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; text-align: center; }
.mk-stat .n { font-size: 22px; font-weight: 800; line-height: 1.15; }
.mk-stat .n.bad { color: var(--danger); }
.mk-stat .n.good { color: var(--ok); }
.mk-stat .l { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.mk-chap { font-weight: 700; margin: 18px 0 8px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.mk-item { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 10px; overflow: hidden; }
.mk-item summary { cursor: pointer; padding: 12px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; list-style: none; }
.mk-item summary::-webkit-details-marker { display: none; }
.mk-item summary::before { content: '▸'; color: var(--ink-3); }
.mk-item[open] summary::before { content: '▾'; }
.mk-item[open] summary { border-bottom: 1px dashed var(--line); }
.mk-item .mk-stem { flex: 1; min-width: 220px; font-weight: 600; }
.mk-body { padding: 12px 14px 14px; }
.mk-body .opt { cursor: default; }
@media (max-width: 640px) {
  .mk-stats { grid-template-columns: repeat(2, 1fr); }
  .kpbar { grid-template-columns: 1fr 140px 42px; }
}

/* ---------- tutor chat ---------- */
.tutor-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  background: var(--brand); color: #fff; border: none; border-radius: 999px;
  padding: 13px 20px; font-size: 14.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 20px rgba(15,110,86,.35); display: flex; gap: 8px; align-items: center;
}
.tutor-fab:hover { opacity: .9; }
.tutor-fab .fab-meow { width: 30px; height: 30px; margin: -4px 0 -4px -7px; flex: none; }

/* ---------- look picker (click any Super Meow) ---------- */
.meow-pop {
  position: fixed; z-index: 220; width: 272px; padding: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(26,35,50,.22);
}
.mp-head b { display: block; font-size: 14px; }
.mp-head em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.mp-lab { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.mp-coats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mp-coat {
  display: flex; align-items: center; gap: 6px; padding: 6px 7px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  cursor: pointer; font-size: 11.5px; color: var(--ink); text-align: left;
}
.mp-coat i { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid; flex: none; }
.mp-coat.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(15,110,86,.12); }
.mp-eyes { display: flex; gap: 10px; }
.mp-eye {
  width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 34% 30%, #cfeafd 0 16%, var(--c) 46%, #2a6295 100%);
  box-shadow: 0 0 0 1.5px var(--line);
}
.mp-eye.on { box-shadow: 0 0 0 2px var(--brand); }
.mp-note { margin-top: 12px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.drawer {
  position: fixed; top: 0; right: -420px; width: 400px; max-width: 92vw; height: 100vh;
  background: var(--card); border-left: 1px solid var(--line); z-index: 70;
  display: flex; flex-direction: column; transition: right .22s ease, width .22s ease;
  box-shadow: -12px 0 30px rgba(26,35,50,.12);
}
.drawer.open { right: 0; }
/* fullscreen tutor: chat expanded to the whole viewport */
.drawer.max { width: 100vw; max-width: 100vw; right: 0; border-left: none; }
/* native fullscreen: macOS reveals its menu bar when the pointer reaches the
   very top edge — a header flush with y=0 loses the first click there (the
   minimize button looked dead). Keep the controls below that strip. */
html:fullscreen .drawer { padding-top: max(30px, env(safe-area-inset-top)); }
.drawer.max .msg { max-width: min(760px, 82%); }
/* image / transcript split is user-draggable: --stages-h is the height of the
   slide panel, everything below it belongs to the transcript */
.drawer.max .stages { flex: 0 0 var(--stages-h, 32vh); min-height: 96px; }
/* no slide / textbook open: the panel must not reserve empty space */
.drawer.max .stages.empty { flex: 0 0 0; min-height: 0; }
.drawer.max .slide-stage { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.drawer.max .slide-stage .slide-cap { flex: none; }
/* narrow panel (user dragged the divider): keep the caption on one line */
.drawer.max .slide-stage .slide-cap > span {
  flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer.max .slide-stage .slide-cap > button { flex: none; }
.drawer.max .slide-stage img {
  flex: 1 1 auto; min-height: 0; max-height: 100%;  /* fill the panel we give it */
  object-fit: contain;
}
/* transcript keeps a floor height so it can never be squeezed out */
.drawer.max .msgs {
  flex: 1 1 0; min-height: 150px;
  /* on a wide screen a centred reading column beats a bubble glued to the
     left edge — the whole transcript (rich blocks + quiz cards) uses it */
  padding-left: max(16px, calc((100vw - 920px) / 2));
  padding-right: max(16px, calc((100vw - 920px) / 2));
}
.drawer .head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer .head .t { font-weight: 600; }
/* voice & speed picker: two compact segmented controls under the drawer head */
.tutor-prefs {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 18px; border-bottom: 1px solid var(--line); background: var(--card);
}
.pref-group { display: flex; align-items: center; gap: 4px; }
.pref-lab { font-size: 13px; opacity: .55; margin-right: 2px; }
.pref-btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.pref-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.pref-btn.on {
  background: var(--brand-2); border-color: var(--brand); color: var(--brand-ink);
  font-weight: 600;
}
/* close button: plain text style; other head buttons use .icon-btn squares */
.drawer .head .close-btn { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--ink-3); }
.drawer .msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.bot.thinking { color: var(--ink-3); font-style: italic; }
/* spoken-sentence highlight: the sentence Super Meow is reading lights up */
.msg.bot .sen {
  border-radius: 6px; padding: 1px 3px; margin: 0 -3px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background .25s ease, box-shadow .25s ease;
}
.msg.bot .sen.spk { background: #e3efff; box-shadow: 0 0 0 3px #e3efff; }
/* ---------- rich transcript: hierarchy while Super Meow speaks ----------
   **term** → .kw   ==takeaway== → .hl   "### heading" → .rh   "- " → .li
   money / % → .num   → → .arw   `code` → .ic  (built by renderSenSpans)     */
.msg.bot.rich { padding: 12px 15px; }
.msg.bot .pl { margin: 0 0 7px; }
.msg.bot > div:last-child { margin-bottom: 0; }
.msg.bot .gap { height: 5px; }
.msg.bot .rh {
  font-size: 16.5px; font-weight: 700; color: var(--brand-ink);
  line-height: 1.35; letter-spacing: .1px; margin: 11px 0 7px;
}
.msg.bot .rh:first-child { margin-top: 0; }
.msg.bot .li { display: flex; gap: 8px; margin: 0 0 6px; }
.msg.bot .li > i {
  flex: none; width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand); margin-top: 9px;
}
.msg.bot .li.n > i { background: var(--accent); }
.msg.bot .li > .lt { flex: 1; min-width: 0; }
.msg.bot .kw { color: var(--brand-ink); font-weight: 650; font-size: 14.6px; }
.msg.bot .hl {
  background: linear-gradient(transparent 56%, #ffe6a3 56%);
  color: #6a4a00; font-weight: 600; font-size: 15px;
  padding: 0 2px; border-radius: 3px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.msg.bot .num { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
.msg.bot .arw { color: var(--brand); font-weight: 700; padding: 0 2px; }
.msg.bot .ic {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px;
}
/* ---------- clickable check question ([[QUIZ]] block) ---------- */
.msg.bot.has-quiz { max-width: min(680px, 92%); }
.quiz {
  margin-top: 12px; padding: 12px 13px 11px;
  border: 1px solid var(--line); border-radius: 13px;
  background: linear-gradient(180deg, #f7fbf9, #ffffff);
}
.quiz-tag {
  display: flex; align-items: center; gap: 7px; margin-bottom: 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--brand);
}
.quiz-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-2); }
.quiz-stem { font-size: 14.5px; font-weight: 600; line-height: 1.5; margin-bottom: 10px; color: var(--ink); }
.quiz-opt {
  display: flex; align-items: flex-start; gap: 9px; width: 100%;
  text-align: left; font-family: inherit; font-size: 13.8px; line-height: 1.5;
  color: var(--ink); background: var(--card); cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 11px;
  padding: 9px 11px; margin-bottom: 7px;
  transition: border-color .12s, background .12s, transform .06s;
}
.quiz-opt:last-of-type { margin-bottom: 0; }
.quiz-opt > b {
  flex: none; width: 21px; height: 21px; border-radius: 7px; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; color: var(--ink-2);
}
.quiz-opt > span { flex: 1; min-width: 0; }
.quiz-opt:hover:not(:disabled) { border-color: var(--brand); background: #f4fbf8; }
.quiz-opt:hover:not(:disabled) > b { background: var(--brand); border-color: var(--brand); color: #fff; }
.quiz-opt:active:not(:disabled) { transform: scale(.99); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { border-color: var(--ok); background: #eaf6f0; }
.quiz-opt.right > b { background: var(--ok); border-color: var(--ok); color: #fff; }
.quiz-opt.wrong { border-color: var(--danger); background: #fdf1f1; }
.quiz-opt.wrong > b { background: var(--danger); border-color: var(--danger); color: #fff; }
.quiz-opt.picked { border-color: var(--brand); background: #f0f8f5; }
.quiz-verdict { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 13.5px; }
.quiz-verdict.ok b { color: var(--ok); }
.quiz-verdict.no b { color: var(--danger); }
.quiz-why { margin-top: 6px; color: var(--ink-2); line-height: 1.62; }
.quiz-why .kw { font-size: 13.9px; }
.drawer .input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--card); align-items: flex-end; }
.drawer .input textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; resize: none; height: 44px;
  max-height: 220px; overflow-y: auto; line-height: 1.45;
}
.drawer .input button { background: var(--brand); color: #fff; border: none; border-radius: 10px; padding: 0 16px; cursor: pointer; font-size: 14px; height: 44px; align-self: flex-end; }
.suggests { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.suggests button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.suggests button:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- slide stage: PPT page Luna pulls up while explaining ---------- */
.slide-stage {
  border-bottom: 1px solid var(--line); background: #0a1626;
  padding: 8px 10px 10px; animation: slide-pop .25s ease;
}
.slide-stage .slide-cap {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  color: #a0beeb; font-size: 11.5px;
}
.slide-stage .slide-cap b { color: #fff; }
.slide-stage .slide-cap .cap-note { font-style: normal; }   /* <i> is a hook for mobile hiding, not italics */
.slide-stage .slide-cap button {
  margin-left: auto; border: none; background: none; color: #a0beeb;
  font-size: 16px; cursor: pointer; line-height: 1; padding: 2px 4px;
}
.slide-stage img {
  width: 100%; display: block; border-radius: 6px; cursor: zoom-in;
  border: 1px solid rgba(255,255,255,.12); background: #fff;
  max-height: 28vh; object-fit: contain;   /* keep chat visible when 2 stages open; tap to zoom */
}
.slide-stage img.loading { min-height: 110px; object-fit: contain; }
.drawer .msgs { min-height: 120px; }
@keyframes slide-pop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* textbook page stage (same pattern, paper-warm tint) */
.book-stage { background: #12291c; }
.book-stage .slide-cap { color: #a8cf9f; }
.book-stage .slide-cap b { color: #fff; }
.book-stage .slide-cap button { color: #a8cf9f; }

/* stages wrapper: PPT + textbook pages stack in the normal drawer, but in
   fullscreen the two images sit side by side (photos laid out horizontally)
   so the chat transcript keeps its space instead of being pushed off-screen.
   The PPT / textbook width ratio is draggable via --duo-a / --duo-b. */
.stages { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; overflow: hidden; }
.drawer.max .stages.duo { flex-direction: row; }
.drawer.max .stages.duo #slide-stage { flex: var(--duo-a, 1) 1 0; min-width: 0; }
.drawer.max .stages.duo #book-stage { flex: var(--duo-b, 1) 1 0; min-width: 0; }

/* ---- drag handles (fullscreen only) ---- */
.split-h, .split-v { display: none; }
.drawer.max .split-h.on {
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 11px; height: 11px; cursor: row-resize; touch-action: none;
  background: var(--card); border-top: 1px solid var(--line);
  position: relative; z-index: 3;
}
.drawer.max .split-h.on .grip {
  width: 56px; height: 5px; border-radius: 3px;
  background: rgba(26,35,50,.22); transition: background .15s, width .15s;
}
.drawer.max .split-h.on:hover .grip,
.drawer.max .split-h.on.dragging .grip,
.drawer.max .split-h.on:focus-visible .grip { background: var(--brand); width: 72px; }
/* fat invisible hit area so it is easy to grab (mouse and finger) */
.drawer.max .split-h.on::after { content: ""; position: absolute; inset: -7px 0; }
.drawer.max .stages.duo .split-v.on {
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 11px; cursor: col-resize; touch-action: none;
  position: relative; background: transparent;
}
.drawer.max .stages.duo .split-v.on .grip {
  width: 5px; height: 46px; border-radius: 3px;
  background: rgba(255,255,255,.42); transition: background .15s, height .15s;
}
.drawer.max .stages.duo .split-v.on:hover .grip,
.drawer.max .stages.duo .split-v.on.dragging .grip,
.drawer.max .stages.duo .split-v.on:focus-visible .grip { background: var(--brand); height: 62px; }
.drawer.max .stages.duo .split-v.on::after { content: ""; position: absolute; inset: 0 -7px; }
body.split-dragging { user-select: none; -webkit-user-select: none; cursor: row-resize; }
body.split-dragging.col { cursor: col-resize; }

/* full-screen slide viewer */
.slide-zoom {
  position: fixed; inset: 0; z-index: 200; background: rgba(8,14,26,.9);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px; cursor: zoom-out;
}
.slide-zoom img { max-width: min(1400px, 96vw); max-height: 88vh; border-radius: 8px; background: #fff; }
.slide-zoom .cap { color: #cbd9ef; margin-top: 12px; font-size: 13px; }


/* ---------- luna avatar + voice ---------- */
.drawer .head { gap: 10px; }
.luna-wrap {
  position: relative; width: 52px; height: 52px; flex: none;
  border-radius: 50%; background: var(--brand-2);
}
/* clip the cat, not the frame: the speaking ring is a ::after at inset -4px and
   would be cut off by overflow on the wrapper itself */
.luna-wrap .meow-art { border-radius: 50%; overflow: hidden; }
.luna-wrap img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  animation: luna-bob 3.2s ease-in-out infinite;
}
/* ---------- Super Meow: one art module, many sizes (assets/meow.js) ----------
   .meow-art is a plain box; the SVG fills it. Two detail levels are chosen by
   pixel size inside the module, so a 28px chip and a 240px hero share the same
   drawing code and still read correctly. */
.meow-art { position: relative; display: block; }
.meow-pick { cursor: pointer; }
.meow-pick:focus-visible, .meow-pick:hover { filter: brightness(1.03); }
/* width drives the size; the square viewBox supplies the height. Never rely on
   the host having an explicit height — an auto-height box would let the SVG
   overflow its frame (the drawer avatar bug). No `overflow: visible` here: the
   bust crop depends on the viewport actually clipping the body. */
.meow-art > svg { width: 100%; height: auto; display: block; }
.meow-art .mw-bob { animation: mw-bob 3.8s ease-in-out infinite; }
.meow-art[data-state="speaking"] .mw-bob { animation-duration: 1.9s; }
.meow-art[data-state="thinking"] .mw-bob { animation-duration: 5.4s; }

/* blinking: squashing the eyeballs reads better than swapping in a line */
.meow-art .mw-blink { opacity: 0; }
.meow-art.blink .mw-eyes { opacity: 0; }
.meow-art.blink .mw-blink { opacity: 1; }

/* thinking: eyes glance up, three dots float at the corner of the avatar */
.meow-art[data-state="thinking"] .mw-eyes { transform: translate(2px, -3.5px); transition: transform .25s ease; }
.meow-art .mw-dots {
  position: absolute; top: -4px; right: -5px; display: none; gap: 2px;
  padding: 2px 4px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(26,35,50,.12);
}
.meow-art[data-state="thinking"] .mw-dots { display: flex; }
.meow-art .mw-dots i {
  width: 4px; height: 4px; border-radius: 50%; background: var(--brand);
  animation: mw-dot 1.1s ease-in-out infinite;
}
.meow-art .mw-dots i:nth-child(2) { animation-delay: .16s; }
.meow-art .mw-dots i:nth-child(3) { animation-delay: .32s; }

/* speaking: while the lip-sync ellipse is open it replaces the drawn mouth */
.meow-art.talking .mw-mouth { opacity: 0; }
.meow-art .mw-talk { transition: opacity .08s linear; }

/* listening: eyes widen a touch, blush warms up */
.meow-art[data-state="listening"] .mw-eyes { transform: scale(1.06); transform-origin: 120px 100px; }

@keyframes mw-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes mw-dot { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes mw-twinkle { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes mw-drip { 0% { opacity: 0; transform: translateY(-4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
@keyframes mw-fly1 { 0% { transform: translate(0,0); } 25% { transform: translate(9px,-7px); } 50% { transform: translate(3px,-13px); } 75% { transform: translate(-6px,-5px); } 100% { transform: translate(0,0); } }
@keyframes mw-fly2 { 0% { transform: translate(0,0); } 30% { transform: translate(-8px,-6px); } 60% { transform: translate(-2px,-12px); } 100% { transform: translate(0,0); } }
.meow-art .mw-tw { animation: mw-twinkle 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.meow-art .mw-drip { animation: mw-drip 1.6s ease-in infinite; }
.meow-art .mw-fly1 { animation: mw-fly1 3.2s ease-in-out infinite; }
.meow-art .mw-fly2 { animation: mw-fly2 3.9s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .meow-art .mw-bob, .meow-art .mw-tw, .meow-art .mw-drip,
  .meow-art .mw-fly1, .meow-art .mw-fly2, .meow-art .mw-dots i { animation: none; }
}

/* ---------- quiz result: Super Meow reacts to your score ---------- */
.score-meow { position: relative; flex: none; }
.score-meow .luna-wrap { width: 84px; height: 84px; }
.meow-bubble {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; background: #fff; border: 1.5px solid #dbe4f8;
  color: var(--ink); font-size: 12.5px; font-weight: 600;
  padding: 6px 11px; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(30, 45, 90, .08);
  opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.meow-bubble.show { opacity: 1; }
.meow-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #fff;
}
/* sparkles around the celebrating cat */
.score-meow .sp { position: absolute; width: 8px; height: 8px; border-radius: 2px; background: #f3c64f; opacity: 0; pointer-events: none; }
.score-meow .sp1 { top: 26px; right: 0; }
.score-meow .sp2 { top: 44px; left: -6px; }
.score-meow .sp3 { top: 68px; right: -6px; }
.score-meow .sp4 { top: 86px; left: 4px; }
#meow[data-mood="happy"] .sp { animation: meow-spark 1.3s ease-in-out infinite; }
#meow[data-mood="happy"] .sp2 { animation-delay: .25s; }
#meow[data-mood="happy"] .sp3 { animation-delay: .5s; }
#meow[data-mood="happy"] .sp4 { animation-delay: .75s; }
@keyframes meow-spark { 0%,100% { opacity: 0; transform: scale(.3) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
.luna-wrap::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2.5px solid transparent;
}
.drawer .luna-speaking .luna-wrap::after {
  border-color: var(--brand); animation: luna-ring 1.1s ease-in-out infinite;
}
.drawer .luna-thinking .luna-wrap::after {
  border-color: var(--gold, #e1b25a); border-top-color: transparent;
  animation: luna-spin 1s linear infinite;
}
/* pause button: only meaningful while Super Meow talks (or is paused) */
#pause-btn { display: none; }
.drawer.luna-speaking #pause-btn, .drawer.luna-paused #pause-btn { display: flex; }
.drawer.luna-paused #pause-btn { border-color: var(--gold, #e1b25a); color: var(--gold, #e1b25a); }
.drawer.luna-paused .luna-status .dot { background: #e1b25a; }
@keyframes luna-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(2.5px); } }
@keyframes luna-ring { 0%,100% { transform: scale(1); opacity: .45; } 50% { transform: scale(1.12); opacity: 1; } }
@keyframes luna-spin { to { transform: rotate(360deg); } }
.head-meta { line-height: 1.25; min-width: 0; flex: 1; }   /* flex:1 → head buttons cluster right at any width */
.head-meta .t { font-weight: 600; font-size: 14.5px; }
.luna-status { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.luna-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #2fa876; }
.luna-status .dot.busy { background: #e1b25a; }
.luna-status .dot.talk { background: var(--brand); animation: luna-ring 1s infinite; }
.wave { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.wave i { width: 2.5px; background: var(--brand); border-radius: 2px; animation: wv .8s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: .15s; } .wave i:nth-child(3) { animation-delay: .3s; }
.wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wv { 0%,100% { height: 3px; } 50% { height: 10px; } }
.icon-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 9px;
  width: 34px; height: 34px; cursor: pointer; font-size: 15px; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { border-color: var(--brand); }
.icon-btn.off { opacity: .45; }
.icon-btn.rec { background: var(--danger); border-color: var(--danger); color: #fff; animation: micpulse 1.2s infinite; }
@keyframes micpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(214,69,69,.4); } 50% { box-shadow: 0 0 0 7px rgba(214,69,69,0); } }
.lang-chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 7px;
  height: 34px; padding: 0 9px; font-size: 12px; color: var(--ink-2); cursor: pointer; flex: none;
}
.v-hint { font-size: 11.5px; color: var(--ink-3); padding: 2px 14px 6px; background: var(--card); }

/* ---------- login modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16,22,31,.45); z-index: 90;
  display: none; align-items: center; justify-content: center; }
.overlay.open { display: flex; }
.modal { width: 380px; max-width: 92vw; background: var(--card); border-radius: 16px; padding: 26px 28px; }
.modal h3 { margin-bottom: 14px; font-size: 17px; }
.modal input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; margin-bottom: 10px; font-family: inherit;
}
.modal input:focus { outline: 2px solid var(--brand-2); border-color: var(--brand); }
.modal .err { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.modal .alt { text-align: center; font-size: 13px; color: var(--ink-3); margin-top: 12px; }
.modal .alt a { cursor: pointer; }

/* ---------- table ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--ink-3); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--bg); }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .v { font-size: 24px; font-weight: 700; }
.stat .k { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.gloss .g { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-size: 13px; }
.gloss .g b { font-weight: 600; }
footer.foot { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 26px 0 34px; }

/* ================= responsive: tablets & phones ================= */
body { -webkit-tap-highlight-color: transparent; }

/* dvh-aware drawer (iOS URL bar / Android keyboard) */
.drawer { height: 100vh; height: 100dvh; }

/* safe areas: iPhone notch / home indicator */
.tutor-fab { right: calc(22px + env(safe-area-inset-right, 0px)); bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
.drawer .input { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }

/* ---------- iPad / small tablet ---------- */
@media (max-width: 1024px) {
  .wrap { padding: 22px 20px 70px; }
  .nav { padding: 0 18px; }
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  /* nav: logo + user chip on row 1, links scroll on row 2 */
  .nav { flex-wrap: wrap; height: auto; padding: 8px 14px 4px; row-gap: 0; }
  .nav .links { order: 3; width: 100%; margin: 2px 0 0 -10px; overflow-x: auto;
                -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav .links::-webkit-scrollbar { display: none; }
  .nav .links a { padding: 6px 10px; font-size: 13px; white-space: nowrap; }

  .wrap { padding: 16px 12px 56px; }
  .card { padding: 16px 14px; margin-bottom: 12px; border-radius: 12px; }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 22px; }
  .split { gap: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

  /* voice/speed picker stays one compact row on phones */
  .tutor-prefs { padding: 6px 10px; gap: 8px; }
  .pref-lab { display: none; }
  .pref-btn { padding: 3px 8px; font-size: 11.5px; }

  /* tabs become a single scrollable row */
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { min-width: 0; flex: 1 0 auto; padding: 8px 12px; }

  .bar-row { grid-template-columns: 120px 1fr 40px; font-size: 12.5px; }

  /* knowledge-point mastery rows: title on its own line, bar + % below */
  .kpbar { grid-template-columns: 1fr 48px; }
  .kpbar > span:first-child { grid-column: 1 / -1; }

  .qcard { padding: 14px 12px; }
  .opt { padding: 12px 12px; font-size: 15px; }      /* bigger touch targets */
  .score-hero .num { font-size: 38px; }
  .btn { margin: 3px 4px; }
  .score-hero { gap: 4px; }
  .score-meow .luna-wrap { width: 68px; height: 68px; }
  .meow-bubble { font-size: 11.5px; }

  /* tables (teacher dashboard): horizontal scroll instead of squashing */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl th, .tbl td { white-space: nowrap; }

  /* tutor drawer = full screen */
  .drawer { width: 100vw; max-width: 100vw; right: -100vw; border-left: none; }
  .drawer.open { right: 0; }
  .luna-wrap { width: 44px; height: 44px; }
  .drawer .head { padding: 10px 12px; }
  .icon-btn { width: 36px; height: 36px; }
  .msg { max-width: 90%; font-size: 14.5px; }
  /* 16px inputs stop iOS Safari from zooming on focus */
  .drawer .input textarea { font-size: 16px; }
  .modal input { font-size: 16px; }
  .slide-zoom { padding: 12px; }
  .slide-zoom img { max-height: 82vh; }

  /* PPT/textbook stages become compact thumbnail bars so the chat column keeps
     its full space — tap the thumbnail for the full-screen viewer instead */
  .drawer .slide-stage { display: flex; align-items: center; gap: 10px; padding: 7px 10px; }
  .drawer .slide-stage .slide-cap { flex: 1; min-width: 0; margin-bottom: 0; }
  .drawer .slide-stage .slide-cap .cap-note { display: none; }
  .drawer .slide-stage img { width: 84px; height: 56px; max-height: none; object-fit: cover; flex: none; border-radius: 5px; }
  .drawer .slide-stage img.loading { min-height: 0; }
  /* side-by-side stages are a desktop-fullscreen affordance — phones keep the
     compact thumbnail bars stacked so each caption keeps its room */
  .drawer.max .stages.duo { flex-direction: column; }
  .drawer.max .stages.duo .slide-stage img { max-height: none; }
  /* dragging a split is desktop-only: on phones stages stay thumbnail bars */
  .drawer.max .stages { flex: 0 1 auto; min-height: 0; }
  .drawer.max .slide-stage { display: flex; flex-direction: row; align-items: center; }
  .drawer.max .slide-stage img { flex: none; height: 56px; max-height: none; }
  .split-h, .split-v { display: none !important; }
  .drawer .msgs { min-height: 0; }   /* let chat shrink instead of overflowing the screen */
}


/* ================= visual overview (chapter) ================= */
.ov-hero {
  display: flex; gap: 22px; align-items: center;
  background: linear-gradient(120deg, #e8f6f0 0%, #f4effd 70%, #eef4ff 100%);
  border: 1px solid #d7e7e0;
}
.ov-meow {
  width: 96px; height: 96px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 50% 34%, #fff 0 58%, #f3eefb 100%);
  border: 3px solid var(--brand-2); box-shadow: 0 6px 14px rgba(15,110,86,.18);
  padding: 3px; cursor: pointer;
  /* the mood effects (smell squiggles, tears, sparkles) live in the corners of
     the square viewBox — inside a round badge they must be clipped, not left
     floating on the card */
  overflow: hidden;
}
.ov-hero-main { min-width: 0; }
.ov-summary { color: var(--ink-2); font-size: 14.5px; margin: 4px 0 10px; }
.ov-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ov-chip {
  background: rgba(255,255,255,.85); border: 1px solid #cfe5db; color: var(--brand-ink);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px;
}
.objgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.objcard {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  transition: border-color .15s, transform .15s;
}
.objcard:hover { border-color: var(--brand); transform: translateY(-1px); }
.oc-ic { font-size: 22px; line-height: 1.2; flex: none; }
.oc-t { font-size: 13.8px; color: var(--ink-2); }
.chip-list { display: flex; flex-direction: column; gap: 8px; }
.kchip {
  border: 1px solid #dcd2f4; background: #f7f5fd; color: #453a8a;
  border-radius: 10px; padding: 8px 13px; font-size: 13.5px;
}
.kchip.warn { border-color: var(--danger-2); background: #fdf1f1; color: #7c2626; }
.flow { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }
.flow-step {
  flex: 1; min-width: 148px; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; background: var(--bg); cursor: pointer; position: relative;
  transition: border-color .15s;
}
.flow-step:hover { border-color: var(--brand); }
.fs-no {
  width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
  margin-bottom: 7px;
}
.fs-t { font-weight: 600; font-size: 13.8px; margin-bottom: 5px; line-height: 1.4; }
.flow-arrow { align-self: center; color: var(--ink-3); font-size: 18px; flex: none; }

/* ================= knowledge graph ================= */
.kg-hint { color: var(--ink-3); font-size: 12.5px; margin-bottom: 8px; }
.kg-box {
  overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line);
  border-radius: 12px; background: #fbfcfe; padding: 6px;
}
.kgraph { display: block; width: 100%; min-width: 560px; height: auto; }
.kg-edge { fill: none; stroke: #b9c7da; stroke-width: 1.6; }
.kg-edge:hover { stroke: var(--brand); }
.kg-node { cursor: pointer; }
.kg-node rect { transition: stroke-width .12s; }
.kg-node:hover rect { stroke-width: 2.6; filter: drop-shadow(0 2px 3px rgba(26,35,50,.18)); }
.kg-node.sel rect { stroke-width: 3; }
.kg-node-label { font-size: 12px; font-weight: 600; font-family: inherit; }
.kg-detail { margin-top: 14px; display: block; }
.kg-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.kg-type-chip {
  border: 1px solid; border-radius: 999px; padding: 2px 10px; font-size: 11.5px; font-weight: 600;
}
.kg-detail-title { font-size: 16px; }
.kg-desc { color: var(--ink-2); font-size: 14px; }
.kg-example {
  margin-top: 10px; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 13.5px; color: var(--ink-2);
}
.kg-ask { margin-top: 12px; }

/* ================= glossary term modal ================= */
.gloss-term { cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.gloss-term:hover { border-color: var(--brand); transform: translateY(-1px); }
.gloss-def { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.gloss-more { display: block; margin-top: 4px; font-size: 11px; color: var(--brand); opacity: .75; }
.term-modal { width: 460px; max-height: 86vh; overflow-y: auto; }
.term-head { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.term-en { font-size: 22px; font-weight: 700; color: var(--brand-ink); }
.term-zh { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.term-sec { margin-bottom: 13px; font-size: 13.8px; color: var(--ink-2); }
.term-sec b { color: var(--ink); font-size: 12.5px; letter-spacing: .3px; display: block; margin-bottom: 3px; }
.term-quote {
  background: #f3f7f2; border-left: 3px solid var(--brand); border-radius: 0 8px 8px 0;
  padding: 9px 12px; font-style: italic; margin-bottom: 8px;
}
.term-tip { background: #fdf8e7; border: 1px solid #ecd9a0; border-radius: 10px; padding: 10px 14px; }
.term-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ================= homepage redesign ================= */
.hp-hero {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(125deg, #0b5a46 0%, #0f6e56 45%, #14547e 100%);
  border: none; padding: 38px 36px;
}
.hp-hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  border-radius: 50%; background: rgba(255,255,255,.07);
}
.hp-hero::before {
  content: ""; position: absolute; right: 60px; bottom: -90px; width: 200px; height: 200px;
  border-radius: 50%; background: rgba(255,255,255,.05);
}
.hp-hero-grid { display: flex; gap: 26px; align-items: center; }
.hp-hero-meow { flex: none; text-align: center; }
.hp-meow-tip { margin-top: 9px; font-size: 11.5px; letter-spacing: .02em; color: rgba(255,255,255,.66); }
.hp-meow {
  width: 132px; height: 132px; border-radius: 50%; flex: none; margin: 0 auto;
  /* the badge is a circle on a coloured banner: clip the mood effects (smell
     squiggles, tears, sparkles) to it instead of letting them float on the green */
  overflow: hidden;
  background: radial-gradient(circle at 50% 34%, #fff 0 58%, #f3eefb 100%);
  border: 4px solid rgba(255,255,255,.65); box-shadow: 0 10px 24px rgba(0,0,0,.25);
  padding: 3px; cursor: pointer;
}
.hp-meow:hover { border-color: #fff; }
.hp-code { font-size: 12.5px; letter-spacing: 2.5px; opacity: .85; font-weight: 600; margin-bottom: 6px; }
.hp-hero h1 { font-size: 30px; font-weight: 700; line-height: 1.25; }
.hp-sub { opacity: .92; font-size: 15px; margin-top: 8px; }
.hp-ctas { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.hp-ctas .btn { background: #fff; color: var(--brand-ink); }
.hp-ctas .btn.ghost { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.4); }
.hp-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 18px;
}
.hp-stat { background: var(--card); padding: 14px 10px; text-align: center; }
.hp-stat .n { font-size: 22px; font-weight: 700; color: var(--brand-ink); }
.hp-stat .l { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.loop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.loop-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg);
  position: relative; counter-increment: loop;
}
.loop-ic { font-size: 24px; margin-bottom: 6px; }
.loop-card b { font-size: 14px; display: block; margin-bottom: 3px; }
.loop-card span { font-size: 12.8px; color: var(--ink-3); display: block; line-height: 1.5; }
.outcome-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.outcome-chip {
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
  padding: 7px 14px; font-size: 13px; color: var(--ink-2); cursor: default;
}
.outcome-chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chcard2 {
  position: relative; overflow: hidden;
}
.chcard2 .ch-ic { font-size: 21px; margin-bottom: 6px; }
.chcard2 .bar-mini {
  height: 5px; border-radius: 999px; background: var(--bg); margin-top: 10px; overflow: hidden;
}
.chcard2 .bar-mini i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

@media (max-width: 760px) {
  .ov-hero { flex-direction: column; text-align: center; padding: 20px 16px; }
  .ov-hero-main { width: 100%; }
  .ov-chips { justify-content: center; }
  .hp-hero { padding: 26px 20px; }
  .hp-hero-grid { flex-direction: column; text-align: center; }
  .hp-hero h1 { font-size: 23px; }
  .hp-ctas { justify-content: center; }
  .objgrid { grid-template-columns: 1fr; }
  .flow-arrow { display: none; }
  .term-modal { width: 92vw; }
  .kgraph { min-width: 460px; }
}

/* ================= CUHK-SZ logo badge (hero) ================= */
.hp-uni-badge {
  display: inline-flex; background: #fff; border-radius: 10px; padding: 7px 14px;
  margin-bottom: 12px; box-shadow: 0 3px 10px rgba(0,0,0,.18); position: relative; z-index: 1;
}
.hp-uni-badge img { display: block; height: 34px; width: auto; }

/* ================= nav chapters dropdown ================= */
.nav-drop { position: relative; }
.nav-drop-btn {
  display: flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 8px;
  color: var(--ink-2); font-size: 14px; background: none; border: none; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.nav-drop-btn:hover { color: var(--brand-ink); }
.nav-drop-btn .caret { font-size: 11px; transition: transform .15s; }
.nav-drop.open .nav-drop-btn { background: var(--brand-2); color: var(--brand-ink); }
.nav-drop.open .caret { transform: rotate(180deg); }
.nav-drop-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 300px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(26,35,50,.16); padding: 6px; z-index: 120;
  max-height: 70vh; overflow-y: auto;
}
.nav-drop.open .nav-drop-menu { display: block; }
.nav-drop-item {
  display: flex; gap: 9px; align-items: baseline; padding: 8px 12px; border-radius: 8px;
  font-size: 13.5px; color: var(--ink-2); white-space: nowrap;
}
.nav-drop-item b { color: var(--brand-ink); font-size: 11.5px; flex: none; letter-spacing: .5px; }
.nav-drop-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-drop-item em { margin-left: auto; font-style: normal; flex: none; }
.nav-drop-item:hover { background: var(--bg); text-decoration: none; }
.nav-drop-item.cur { background: var(--brand-2); color: var(--brand-ink); font-weight: 500; }
.nav-drop-item.locked { opacity: .55; cursor: default; }
@media (max-width: 760px) {
  /* full-width sheet under the nav on phones */
  .nav-drop-menu { position: fixed; left: 10px; right: 10px; top: 96px; min-width: 0; max-height: 60vh; }
  .nav-drop-item span { white-space: normal; }
}

/* ================= my progress (homepage) ================= */
.prog-row { padding: 13px 0 11px; border-bottom: 1px dashed var(--line); }
.prog-row:last-child { border-bottom: none; }
.prog-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.prog-title { color: var(--ink); font-size: 14px; flex: 1; min-width: 0; }
.prog-title b { color: var(--brand-ink); font-size: 12px; letter-spacing: .5px; margin-right: 4px; }
.prog-title:hover { text-decoration: underline; }
.prog-pct { font-weight: 700; color: var(--brand-ink); font-size: 14px; }
.prog-bar { height: 7px; }
.prog-comps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.prog-comp {
  border: 1px solid var(--line); background: var(--bg); border-radius: 999px;
  padding: 3px 10px; font-size: 11.5px; color: var(--ink-3);
}
.prog-comp i { font-style: normal; opacity: .8; }
.prog-comp.done { border-color: #bfe3d6; background: var(--brand-2); color: var(--brand-ink); }

/* ================= hold-to-talk mic (WeChat style) ================= */
.drawer .input .mic-btn {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink-2);
  border-radius: 10px; width: 44px; padding: 0; flex: none; font-size: 19px;
  cursor: pointer; touch-action: none;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  transition: border-color .15s, background .15s, transform .1s;
}
.drawer .input .mic-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.drawer .input .mic-btn:active { background: var(--brand-2); transform: scale(.96); }
.drawer .input .mic-btn.rec {
  background: var(--danger); border-color: var(--danger); color: #fff;
  animation: micpulse 1.1s infinite;
}
.rec-bar {
  display: flex; align-items: center; gap: 10px; margin: 0 12px 8px; padding: 7px 12px;
  background: #fdeeee; border: 1px solid var(--danger-2); border-radius: 10px;
  font-size: 12.5px; color: #7c2626;
  /* the row is always present (visibility, not display) so inserting it never
     shifts the input row — the mic button must not move out from under the
     pointer while the user is holding it down */
  visibility: hidden; border-color: transparent; background: transparent;
}
.rec-bar.on { visibility: visible; background: #fdeeee; border-color: var(--danger-2); }
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
  flex: none; animation: micpulse 1.1s infinite;
}
/* live mic level meter — 5 bars that bounce with your voice while recording */
.vu {
  display: flex; align-items: center; gap: 2.5px; height: 16px; flex: none;
  padding: 0 1px;
}
.vu i {
  width: 3px; height: 16px; border-radius: 2px; background: var(--danger);
  transform: scaleY(.14); transform-origin: center;
  transition: transform .07s linear; will-change: transform;
}
.rec-bar b { font-variant-numeric: tabular-nums; }
.rec-tip { margin-left: auto; opacity: .75; }
/* desktop-only cancel button inside the recording bar (click-to-record mode) */
.rec-x {
  display: none; flex: none;
  width: 20px; height: 20px; padding: 0;
  align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--danger-2); color: #7c2626;
  border-radius: 50%; font-size: 11.5px; line-height: 1; cursor: pointer;
  transition: background .12s, color .12s;
}
body.no-touch .rec-bar.on .rec-x { display: inline-flex; }
.rec-x:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (max-width: 760px) {
  .drawer .input .mic-btn { width: 48px; font-size: 21px; }
}

/* ==================== chapter header progress bar ==================== */
.chp {
  margin-top: 14px;
}
.chp-head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px;
  font-size: 12.5px; color: var(--ink-3);
}
.chp-head b {
  margin-left: auto; font-size: 13px; color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
}
.chp-bar {
  height: 10px; border-radius: 999px; background: #eef1f4; overflow: hidden;
  border: 1px solid var(--line);
}
.chp-bar i {
  display: block; height: 100%; width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #17a27a, #0f6e56);
  transition: width .6s cubic-bezier(.3,.7,.3,1);
}
.chp.done .chp-bar i { background: linear-gradient(90deg, #0f6e56, #0a4d3c); }
.chp .chp-comps {
  display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-3);
}
.chp .cc {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 8px; border-radius: 999px; background: var(--bg);
  border: 1px solid var(--line); white-space: nowrap;
}
.chp .cc.done { background: var(--brand-2); color: var(--brand-ink); border-color: #bfe3d4; }

/* ==================== iPad app-style left sidebar ==================== */
.pnav { display: none; }

body.pad .nav { display: none; }
body.pad {
  padding-left: 254px;
  min-height: 100dvh;
}
body.pad .pnav {
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; width: 254px;
  z-index: 80;
  background: rgba(250, 251, 252, .88);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  backdrop-filter: blur(28px) saturate(1.6);
  border-right: 1px solid var(--line);
  padding: 16px 12px 14px;
}
body.pad .pnav-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 14px; color: var(--ink); text-decoration: none;
}
body.pad .pnav-logo .mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex: none;
}
body.pad .pnav-logo-txt { display: flex; flex-direction: column; line-height: 1.15; }
body.pad .pnav-logo-txt b { font-size: 14.5px; letter-spacing: .5px; }
body.pad .pnav-logo-txt i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
body.pad .pnav-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
body.pad .pnav-scroll::-webkit-scrollbar { width: 3px; }
body.pad .pnav-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
body.pad .pnav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: 11px;
  color: var(--ink-2); font-size: 14.5px; font-weight: 500;
  text-decoration: none; transition: background .12s;
}
body.pad .pnav-item:active { background: var(--bg); }
body.pad .pnav-item.active {
  background: var(--brand-2); color: var(--brand-ink); font-weight: 600;
}
body.pad .pnav-label {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--ink-3); padding: 16px 12px 5px;
}
body.pad .pnav-chap {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: 13px; text-decoration: none;
  transition: background .12s;
}
body.pad .pnav-chap b {
  color: var(--brand); font-size: 11px; letter-spacing: .5px; flex: none;
  font-variant-numeric: tabular-nums;
}
body.pad .pnav-chap span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.pad .pnav-chap em { margin-left: auto; font-style: normal; flex: none; font-size: 12px; }
body.pad .pnav-chap.cur { background: var(--brand-2); color: var(--brand-ink); }
body.pad .pnav-chap.cur b { color: var(--brand-ink); }
body.pad .pnav-chap.locked { opacity: .5; }
body.pad .pnav-foot {
  border-top: 1px solid var(--line); padding-top: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
body.pad .wrap { padding: 24px 26px 80px; }


/* ==================== collapsible iPad sidebar ==================== */
/* « button in the sidebar header folds it away; a floating ☰ (pnav-fab) brings
   it back. The tutor drawer auto-collapses it via padSidebarAuto(). */
body.pad .pnav {
  transition: transform .3s cubic-bezier(.4,.8,.3,1), opacity .3s;
}
body.pad { transition: padding-left .3s cubic-bezier(.4,.8,.3,1); }
body.pad.sb-collapsed { padding-left: 0; }
body.pad.sb-collapsed .pnav {
  transform: translateX(-104%);
  opacity: 0;
  pointer-events: none;
}
/* skip the slide animation when the stored state is applied on page load */
body.sb-instant, body.sb-instant .pnav { transition: none !important; }

body.pad .pnav-head {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 6px 14px 8px;
}
body.pad .pnav-head .pnav-logo { flex: 1; padding: 4px 8px; min-width: 0; }
.pnav-fold {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); font-size: 17px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.pnav-fold:active { background: var(--bg); }

.pnav-fab {
  display: none;   /* shown via body.pad.sb-collapsed below */
  position: fixed; top: 12px; left: 12px; z-index: 82;
  width: 44px; height: 44px; border-radius: 13px;
  background: rgba(250,251,252,.92);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(26,35,50,.16);
  font-size: 19px; color: var(--ink); cursor: pointer;
  align-items: center; justify-content: center;
  transition: transform .15s;
}
.pnav-fab:active { transform: scale(.94); }
body.pad.sb-collapsed .pnav-fab { display: flex; }

/* ---------- TTS replay + iPhone mute-switch hint ---------- */
.msg-replay {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin: 4px 0 0 6px;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink-3); font-size: 13px;
  cursor: pointer; vertical-align: middle; transition: .15s;
}
.msg-replay:hover { background: #eef4fb; color: var(--ink); border-color: var(--brand); }
.msg-replay:active { transform: scale(.92); }
.mute-hint {
  margin: 8px 10px 4px; padding: 8px 12px;
  background: #fff6de; border: 1px solid #e8d48b; border-radius: 10px;
  color: #7a5d00; font-size: 12.5px; line-height: 1.45; cursor: pointer;
}
.mute-hint b { color: #5c4500; }

/* ---------- Let's Get Real ---------- */
.lgr-speech { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; }
.lgr-meow { width: 72px; height: 72px; flex: none; }
.lgr-bubble {
  background: var(--brand-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; flex: 1; min-width: 0;
  line-height: 1.7;
}
.lgr-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.lgr-qhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.lgr-q { font-size: 15.5px; font-weight: 600; margin: 10px 0 12px; line-height: 1.6; }
.lgr-opts { display: grid; grid-template-columns: 1fr; gap: 8px; }
.lgr-opt {
  text-align: left; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 11px 14px; font-size: 14px; cursor: pointer;
  transition: border-color .12s, background .12s; line-height: 1.55; color: var(--ink);
}
.lgr-opt:hover:not(:disabled) { border-color: var(--brand); background: #f4fbf8; }
.lgr-opt:disabled { cursor: default; opacity: .92; }
.lgr-opt.right { border-color: var(--ok); background: #eaf6f0; }
.lgr-opt.wrong { border-color: var(--danger); background: #fdf1f1; }
.lgr-verdict { margin-top: 14px; padding: 14px 16px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); }
.lgr-verdict b.ok { color: var(--ok); }
.lgr-verdict b.no { color: var(--danger); }
.lgr-verdict #lgr-v-exp { margin: 8px 0 4px; line-height: 1.65; }
.lgr-notes { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.6; }
.lgr-ta { width: 100%; margin-top: 4px; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 14px; line-height: 1.6; font-family: inherit; outline: none; }
.lgr-ta:focus { border-color: var(--brand); }
/* voice answer: the button turns red and counts the seconds, so a live mic is
   never mistaken for a dead one; failures are said here rather than swallowed */
.btn.rec {
  background: #c0392b; border-color: #c0392b; color: #fff;
  animation: cnPulse 1.5s ease-in-out infinite;
}
@keyframes cnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .38); }
  50% { box-shadow: 0 0 0 7px rgba(192, 57, 43, 0); }
}
.cn-voice-note { margin: 8px 2px 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); }
.cn-voice-note.warn { color: #a5321c; }
.cn-voice-note.good { color: #2b7a4b; }
.lgr-eval { margin-top: 6px; }
.lgr-eval-head { color: var(--ink-3); font-size: 13px; margin-bottom: 6px; }
.lgr-eval .lgr-q { font-weight: 400; }

/* ---- structured debrief: bullets + flow diagram ---- */
.lgr-intro, .lgr-outro { font-size: 14.5px; line-height: 1.7; }
.lgr-intro { margin-bottom: 4px; }
.lgr-outro { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.lgr-bsec {
  margin: 12px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px;
}
.lgr-bsec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.lgr-bullets { display: grid; grid-template-columns: 1fr; gap: 8px; }
.lgr-b {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  border-left: 4px solid var(--brand); transition: border-color .2s, background .2s, box-shadow .2s;
}
.lgr-b-dot {
  flex: none; width: 22px; height: 22px; border-radius: 50%; margin-top: 1px;
  background: var(--brand-2); color: var(--brand); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
.lgr-b-title { font-size: 14px; font-weight: 700; line-height: 1.45; margin-bottom: 2px; }
.lgr-b-text { font-size: 13.5px; line-height: 1.62; color: var(--ink-2); }
/* the bullet being spoken lights up (title or body sentence carries .sen.spk) */
.lgr-b:has(.sen.spk) {
  border-color: var(--brand); border-left-color: var(--brand);
  background: #fff; box-shadow: 0 3px 14px rgba(46, 125, 92, .18);
}
.lgr-b:has(.sen.spk) .lgr-b-dot { background: var(--brand); color: #fff; }
.lgr-b:has(.sen.spk) .lgr-b-title { color: var(--brand); }
.lgr-flow { display: grid; grid-template-columns: 1fr; }
.lgr-step { display: flex; gap: 10px; align-items: flex-start; position: relative; padding: 4px 0 4px 2px; }
.lgr-step:not(:last-child)::before {          /* vertical connector between dots */
  content: ''; position: absolute; left: 12px; top: 30px; bottom: -10px;
  width: 2.5px; background: #a8cdb9; border-radius: 2px; z-index: 0;
}
.lgr-s-dot {
  flex: none; width: 26px; height: 26px; border-radius: 50%; z-index: 1;
  background: #fff; border: 2px solid var(--brand); color: var(--brand);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
.lgr-s-body { padding-top: 2px; min-width: 0; }
.lgr-s-label { font-size: 13.5px; font-weight: 700; line-height: 1.45; }
.lgr-s-note { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.lgr-step:has(.sen.spk) .lgr-s-dot { background: var(--brand); color: #fff; }
.lgr-step:has(.sen.spk) .lgr-s-label { color: var(--brand); }
/* spoken-sentence highlight inside the LGR bubble (same look as chat) */
#lgr-debrief .sen, #cnc .sen {
  border-radius: 6px; padding: 1px 3px; margin: 0 -3px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background .25s ease, box-shadow .25s ease;
}
#lgr-debrief .sen.spk, #cnc .sen.spk { background: #e3efff; box-shadow: 0 0 0 3px #e3efff; }

@media (max-width: 560px) {
  .lgr-speech { gap: 8px; }
  .lgr-meow { width: 48px; height: 48px; }
  .lgr-b { padding: 9px 10px; }
  .lgr-intro, .lgr-outro { font-size: 13.5px; }
}

/* ---------- wallet chip + sheet (B1) ---------- */
.wallet-slot { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.lvl-pill {
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--brand-ink); background: var(--brand-2);
  border: 1px solid #c9e9dd; border-radius: 999px; padding: 3px 8px 3px 7px;
  white-space: nowrap;
  /* B9: the pill became the door to the class board, so it is a <button> */
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; line-height: 1.3; cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.lvl-pill:hover { background: #d3f0e5; border-color: #9fd8c6; }
.lvl-pill .lvl-lv { font-weight: 600; }
.lvl-rank {
  font-size: 10.5px; font-weight: 650; color: #0b7a5f;
  padding-left: 6px; border-left: 1px solid #b9e2d3;
  font-variant-numeric: tabular-nums;
}
.lvl-rank:empty { display: none; }
/* top three wear the same gold as the podium */
.lvl-pill.gold { background: #fff6e1; border-color: #f0dcae; color: #7a5410; }
.lvl-pill.gold:hover { background: #fdf0d2; border-color: #e2c382; }
.lvl-pill.gold .lvl-rank { color: #8a6416; border-left-color: #efd9a8; }
.coin-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff8e8; border-color: #f0dcae; color: #8a5f10;
  font-variant-numeric: tabular-nums;
}
.coin-chip:hover { border-color: #d9ab4a; color: #6d4a09; }
.coin-chip .fish { font-size: 13px; line-height: 1; }
.coin-chip b { font-size: 13.5px; font-weight: 650; }
.coin-chip .cap-mini { font-size: 10.5px; color: #b08c4e; margin-left: 1px; }
.coin-chip.full { background: #f4f1ea; border-color: #ddd5c4; color: #8a8172; }
.coin-chip.full .cap-mini { color: #9d9484; }

.modal.wallet { width: 420px; max-width: 94vw; padding: 22px 24px 18px; }
.wallet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wallet-head h3 { margin: 0; font-size: 17px; }
.wallet-coins { font-size: 26px; font-weight: 700; color: #8a5f10; font-variant-numeric: tabular-nums; }
.wallet-coins em { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); font-style: normal; text-align: right; margin-top: -3px; }
.wallet-lv { margin: 14px 0 12px; }
.wallet-lv-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.wallet-lv-line b { color: var(--ink); }
.wallet-bar { height: 8px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.wallet-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #18a179, #0f6e56); }
.wallet-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.wallet-hint b { color: var(--brand); }
.wallet-stats { display: flex; gap: 10px; margin: 14px 0 8px; }
.wallet-stats > div {
  flex: 1; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 11px; font-size: 12.5px; color: var(--ink-3);
}
.wallet-stats b { display: block; color: var(--ink); font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.wallet-stats em { font-style: normal; font-size: 10.5px; color: var(--ink-3); margin-left: 4px; }
.wallet-capline { font-size: 12px; color: var(--ink-3); margin-bottom: 12px; }
.wallet-capline.hit { color: #96702a; }
.wl-title { font-size: 12px; color: var(--ink-3); letter-spacing: .02em; margin: 2px 0 6px; }
.wl-list { border: 1px solid var(--line); border-radius: 10px; max-height: 208px; overflow: auto; }
.wl-row { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border-bottom: 1px solid #f1f4f8; font-size: 12.5px; }
.wl-row:last-child { border-bottom: 0; }
.wl-why { flex: 1; color: var(--ink-2); }
.wl-why em { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-3); }
.wl-amt { font-weight: 650; font-variant-numeric: tabular-nums; }
.wl-amt.plus { color: #0f6e56; }
.wl-amt.minus { color: #a32d2d; }
.wl-bal { width: 62px; text-align: right; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.wl-empty { padding: 16px 12px; text-align: center; font-size: 12.5px; color: var(--ink-3); }
.wallet-note { font-size: 11.5px; color: var(--ink-3); margin: 11px 0 14px; line-height: 1.5; }
/* Four equal buttons in a 372 px row squeezed "Spend them in the shop" onto
   four lines. The shop is the action the sheet exists for, so it gets a line
   of its own; the three doors next to it only need one line each. */
.wallet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.wallet-actions .btn { flex: 1 1 0; padding: 9px 6px; font-size: 13px; white-space: nowrap; }
.wallet-actions .wallet-shop { flex: 1 1 100%; padding: 10px 12px; font-size: 14.5px; }
.wallet-actions .wallet-close { flex: 0 0 auto; padding: 9px 14px; }
.wallet-close { flex: 0 0 34%; }

@media (max-width: 560px) {
  .coin-chip .cap-mini { display: none; }
  .wallet-slot { margin-right: 4px; }
  /* the level still lives in the wallet sheet; on a phone the header only has
     room for one of the two, and the rank is the new thing worth a chip */
  .lvl-pill { padding: 3px 7px; }
  .lvl-pill .lvl-lv { display: none; }
  .lvl-rank { border-left: 0; padding-left: 0; }
}

/* ---------- quiz payout strip (B1) ---------- */
.reward-strip { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.rw-line { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rw-chip {
  display: inline-flex; align-items: baseline; gap: 5px; border-radius: 999px;
  padding: 5px 12px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.rw-chip em { font-style: normal; font-size: 11px; font-weight: 500; opacity: .75; }
.rw-chip.coins { background: #fff8e8; border: 1px solid #f0dcae; color: #8a5f10; }
.rw-chip.xp { background: var(--brand-2); border: 1px solid #c9e9dd; color: var(--brand-ink); }
.rw-chip.up { background: #f3f0ff; border: 1px solid #ddd6f7; color: #4b3fa0; }
.rw-chip.bal { background: var(--bg); border: 1px solid var(--line); color: var(--ink-3); font-weight: 500; font-size: 12.5px; }
.rw-chip.zero { opacity: .6; }
.rw-note { margin-top: 8px; text-align: center; font-size: 12px; color: var(--ink-3); }

/* ---------- wardrobe / shop (B3) ---------- */
body.ms-lock { overflow: hidden; }

.ms-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(16, 24, 40, .46);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; visibility: hidden;
  transition: opacity .18s ease, visibility .18s;
}
.ms-overlay.open { opacity: 1; visibility: visible; }
.ms-panel {
  position: relative; display: flex; flex-direction: column;
  width: min(880px, 100%); max-height: min(86vh, 760px);
  background: #fff; border-radius: 20px;
  box-shadow: 0 26px 70px rgba(8, 18, 36, .3);
  overflow: hidden;
  transform: translateY(10px) scale(.99);
  transition: transform .2s ease;
}
.ms-overlay.open .ms-panel { transform: none; }

.ms-head { display: flex; flex: none; align-items: center; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.ms-title b { font-size: 16px; letter-spacing: .01em; }
.ms-title span { display: block; font-size: 12px; color: var(--ink-3); }
.ms-purse {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  background: #fff8e8; border: 1px solid #f0dcae; color: #8a6416;
  padding: 5px 13px; border-radius: 999px; font-size: 14px;
}
.ms-purse b { font-variant-numeric: tabular-nums; }
.ms-close {
  width: 32px; height: 32px; flex: none; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 13px;
}
.ms-close:hover { border-color: var(--ink-3); }

.ms-tabs { display: flex; flex: none; gap: 4px; padding: 10px 16px 0; overflow-x: auto; scrollbar-width: none; }
.ms-tabs::-webkit-scrollbar { display: none; }
.ms-tab {
  flex: none; border: 0; background: transparent; cursor: pointer;
  padding: 7px 11px; border-radius: 9px; font-size: 13.5px; color: var(--ink-2);
}
.ms-tab em { font-style: normal; font-size: 10.5px; color: var(--ink-3); margin-left: 4px; }
.ms-tab.on { background: var(--brand-2); color: var(--brand-ink); font-weight: 600; }
.ms-tab.on em { color: var(--brand); }

.ms-body { flex: 1; overflow-y: auto; padding: 14px 18px 18px; }
.ms-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.ms-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 10px 8px 12px; cursor: pointer; text-align: center;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.ms-card:hover { border-color: #bcd3ca; box-shadow: 0 6px 16px rgba(15, 110, 86, .08); }
.ms-card:active { transform: translateY(1px); }
.ms-card.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(15, 110, 86, .13); }
.ms-card.poor { opacity: .6; }
.ms-card.armed { border-color: #d99a56; box-shadow: 0 0 0 2px rgba(217, 154, 86, .2); }

.ms-prev { display: block; width: 124px; height: 124px; }
.ms-info { display: flex; flex-direction: column; gap: 1px; line-height: 1.35; }
.ms-info b { font-size: 13.5px; }
.ms-info em { font-style: normal; font-size: 10.5px; color: var(--ink-3); }
.ms-act { margin-top: 3px; font-size: 12px; padding: 3px 11px; border-radius: 999px; background: var(--bg); color: var(--ink-2); }
.ms-act.buy { background: #fff6e3; color: #8a6416; font-weight: 600; }
.ms-act.wear { background: var(--brand-2); color: var(--brand-ink); font-weight: 600; }
.ms-act.on { background: #eef0f4; color: var(--ink-3); }
.ms-card.armed .ms-act.buy { background: #f6d9b8; color: #8a4a12; }
.ms-tip { margin-top: 12px; font-size: 11.5px; line-height: 1.6; color: var(--ink-3); }

.ms-coatwrap { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: start; }
.ms-coatcat {
  width: 200px; height: 200px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 16px;
  background: radial-gradient(circle at 50% 38%, #fff 0 58%, #f4f1fb 100%);
}
.ms-coats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ms-coat {
  display: flex; align-items: center; gap: 7px; padding: 8px 9px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12.5px;
}
.ms-coat i { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid; flex: none; }
.ms-coat.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(15, 110, 86, .12); }
.ms-eyes { display: flex; gap: 10px; }
.ms-eye {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line);
}
.ms-eye.on { box-shadow: 0 0 0 2px var(--brand); }
.ms-coatlab { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 2px 0 6px; }
.ms-coatnote { margin-top: 12px; font-size: 11.5px; line-height: 1.55; color: var(--ink-3); }

.ms-foot {
  display: flex; flex: none; align-items: center; gap: 10px;
  padding: 10px 20px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3); background: #fcfdfc;
}
.ms-hint { margin-left: auto; }
.ms-loading { padding: 40px 1px; text-align: center; color: var(--ink-3); font-size: 13px; }
.ms-loading.bad { color: var(--danger); }

.ms-toast {
  position: absolute; left: 50%; bottom: 66px; z-index: 2;
  transform: translate(-50%, 8px); max-width: 82%;
  background: #1f2a3a; color: #fff; font-size: 12.5px; line-height: 1.5;
  padding: 8px 15px; border-radius: 10px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.ms-toast.show { opacity: 1; transform: translate(-50%, 0); }
.ms-toast.bad { background: #8f2f2f; }

/* the picker's door into the wardrobe */
/* two doors out of the look picker: the pet, and the wardrobe */
.mp-doors {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line);
  display: grid; gap: 6px;
}
.mp-door {
  width: 100%; padding: 8px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  border: 1px dashed #cfe0d9; border-radius: 10px; background: #f6fbf8;
  color: var(--brand-ink); font-family: inherit;
}
.mp-door:hover { background: #eef8f3; border-color: var(--brand); }
.mp-door span { font-size: 13px; font-weight: 600; }
.mp-door em { font-style: normal; font-size: 10.5px; color: var(--ink-3); }

@media (max-width: 640px) {
  .ms-overlay { padding: 0; align-items: flex-end; }
  .ms-panel { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .ms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ms-prev { width: 108px; height: 108px; }
  .ms-coatwrap { grid-template-columns: 1fr; gap: 12px; }
  .ms-coatcat { width: 100%; height: 180px; }
  .ms-coatnote { margin-top: 8px; }
  .ms-foot .ms-hint { display: none; }
  .ms-tab em { display: none; }        /* six tabs must fit 390px without scrolling */
  .ms-tabs { padding: 10px 8px 0; gap: 3px; }
  .ms-tab { padding: 6px 9px; font-size: 12px; }
  .ms-toast { bottom: 96px; }
}

/* ================= Super Meow as a virtual pet (B4) =================
   The four care buttons are the same markup in the hero strip (dark, small)
   and in the panel (light, large); only the container changes, so a bar can
   never look different depending on where it is drawn. */

/* ---- home hero strip ---- */
.hp-hero-meow { flex: none; width: 236px; }
.hp-pet { margin-top: 11px; }
.strip-mood {
  min-height: 32px; font-size: 12.4px; line-height: 1.45;
  color: rgba(255,255,255,.9); text-align: center;
}
.strip-mood b { color: #fff; font-weight: 600; }
.strip-mood .say-flash { color: #fff3cf; }
.strip-login {
  border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.14); color: #fff;
  border-radius: 999px; padding: 6px 15px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.strip-login:hover { background: rgba(255,255,255,.24); }
.strip-care { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.strip-bond {
  margin-top: 8px; text-align: center; font-size: 11px;
  color: rgba(255,255,255,.74); letter-spacing: .02em;
}

/* ---- the button itself: strip defaults ---- */
.care-btn {
  display: grid; grid-template-columns: 17px 1fr; grid-template-rows: auto 3px;
  align-items: center; gap: 3px 5px; padding: 6px 7px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.26); background: rgba(255,255,255,.12);
  color: #fff; font-family: inherit; font-size: 11.4px; line-height: 1.3;
  cursor: pointer; text-align: left;
  transition: background .15s, transform .1s, opacity .15s;
}
.care-btn:hover { background: rgba(255,255,255,.22); }
.care-btn:active { transform: scale(.97); }
.care-btn .cb-ic { grid-area: 1 / 1; font-size: 13px; line-height: 1; }
.care-btn .cb-lab { grid-area: 1 / 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.care-btn .cb-bar {
  grid-area: 2 / 1 / 3 / -1; height: 4px; border-radius: 999px;
  background: rgba(255,255,255,.18); overflow: hidden;
}
.care-btn .cb-bar i { display: block; height: 100%; border-radius: 999px; background: #a5efcd; transition: width .4s; }
.care-btn .cb-num { display: none; }
.care-btn.full { opacity: .58; }
.care-btn.full .cb-bar i { background: #e6f7ef; }
.care-btn.busy { opacity: .45; pointer-events: none; }

/* ---- out on a visit (B11) ----
   A cat that is at a classmate's is not at home to be fed. The four buttons are
   disabled rather than hidden — the bars still say how the bowls look — and
   carry the same dashed outline as the empty spot in the room, so "paused"
   reads the same on every surface. */
.care-btn.away { border-style: dashed; opacity: .55; cursor: default; }
.care-btn.away:hover { background: rgba(255,255,255,.12); }
.care-btn.away:active { transform: none; }
.care-btn.away .cb-bar i { background: rgba(255,255,255,.5); }
.pet-panel .care-btn.away {
  background: var(--bg); border-color: var(--line); border-style: dashed;
}
.pet-panel .care-btn.away:hover { background: var(--bg); border-color: var(--line); }
.pet-panel .care-btn.away .cb-bar i { background: #cfd8e2; }
.care-paused {
  margin-top: 9px; padding: 7px 10px; border-radius: 9px;
  border: 1px dashed var(--line); background: var(--bg);
  font-size: 12px; line-height: 1.5; color: var(--ink-2);
}
.strip-paused {
  margin-top: 7px; text-align: center; font-size: 10.6px; letter-spacing: .02em;
  color: rgba(255,255,255,.8);
}

/* ================= Care animations (B12) =================
   A one-second scene drawn over the cat when Feed / Water / Play / Scoop is
   tapped: kibble into a bowl, a bottle pouring, a feather wand, a scoop. Every
   scene is drawn in a 100 x 100 box with the floor at y = 88 (carefx.js) and
   scaled to the cat, so the same markup reads at 132 px on the home badge and
   at 400 px in the pet panel. The layer is fixed-position and throwaway: it
   outlives the panel repaint it usually sits on top of. */
.carefx { position: fixed; pointer-events: none; z-index: 500; }
.carefx svg { display: block; overflow: visible; }
.fx-root { animation: fx-out .34s ease 1s forwards; }

.fx-bowl { transform-box: fill-box; transform-origin: 50% 100%;
  animation: fx-pop .34s cubic-bezier(.2,1.5,.4,1) both; }
.fx-mound { transform-box: fill-box; transform-origin: 50% 100%;
  animation: fx-grow .42s cubic-bezier(.2,1.4,.4,1) .6s both; }

.fx-kib { transform-box: fill-box; transform-origin: 50% 50%;
  animation: fx-fall .34s cubic-bezier(.55,.05,.85,.42) both; }

.fx-bottle { transform-box: fill-box; transform-origin: 50% 0%;
  animation: fx-tip .95s cubic-bezier(.3,1.2,.5,1) both; }
.fx-water { transform-box: fill-box; transform-origin: 50% 100%;
  animation: fx-grow .5s ease .2s both; }
.fx-stream {
  stroke-dasharray: 72; stroke-dashoffset: 72;
  animation: fx-draw .3s ease .18s forwards, fx-vanish .26s ease .92s forwards;
}
.fx-ripple { transform-box: fill-box; transform-origin: 50% 50%;
  animation: fx-ripple .7s ease both; }

.fx-wand { transform-box: fill-box; transform-origin: 100% 0%;
  animation: fx-wag 1.05s ease-in-out both; }
.fx-ball { transform-box: fill-box; transform-origin: 50% 100%;
  animation: fx-bounce .78s cubic-bezier(.4,0,.6,1) .1s both; }
.fx-shadow { animation: fx-fade .78s ease .1s both; }

.fx-sweep { transform-box: fill-box; transform-origin: 15% 100%;
  animation: fx-sweep .82s cubic-bezier(.35,.7,.4,1) .08s both; }
.fx-clump { transform-box: fill-box; transform-origin: 50% 50%;
  animation: fx-clump .3s ease both; }

.fx-spark { transform-box: fill-box; transform-origin: 50% 50%;
  animation: fx-spark .52s ease both; }

/* the cat itself answers: a small hop, then a settle. Applied by pet.js to the
   freshly painted cat, because the care repaint replaces the element. */
.care-hop { animation: care-hop .64s cubic-bezier(.3,1.35,.5,1) both;
  transform-origin: 50% 100%; }

@keyframes fx-pop {
  0% { opacity: 0; transform: translateY(10px) scale(.62); }
  100% { opacity: 1; transform: none; }
}
@keyframes fx-grow {
  0% { opacity: 0; transform: scaleY(.06); }
  40% { opacity: 1; }
  100% { opacity: 1; transform: scaleY(1); }
}
@keyframes fx-fall {
  0% { opacity: 0; transform: translateY(-20px); }
  18% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@keyframes fx-tip {
  0% { opacity: 0; transform: translate(12px,-10px); }
  30% { opacity: 1; transform: none; }
  55% { transform: rotate(22deg); }
  88% { transform: rotate(22deg); }
  100% { transform: none; }
}
@keyframes fx-draw { to { stroke-dashoffset: 0; } }
@keyframes fx-vanish { to { opacity: 0; } }
@keyframes fx-ripple {
  0% { opacity: 0; transform: scale(.3); }
  35% { opacity: .9; }
  100% { opacity: 0; transform: scale(1.5); }
}
@keyframes fx-wag {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-12deg); }
  45% { transform: rotate(9deg); }
  70% { transform: rotate(-5deg); }
}
@keyframes fx-bounce {
  0% { transform: translateY(0) scale(1.12,.86); }
  18% { transform: translateY(0) scale(.94,1.06); }
  45% { transform: translateY(-22px) scale(1); }
  72% { transform: translateY(0) scale(1.14,.82); }
  86% { transform: translateY(-7px) scale(1); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes fx-fade { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: .35; } }
@keyframes fx-sweep {
  0% { opacity: 0; transform: translate(-26px,10px) rotate(-8deg); }
  22% { opacity: 1; transform: translate(-14px,0) rotate(0); }
  72% { opacity: 1; transform: translate(13px,0); }
  100% { opacity: 0; transform: translate(30px,-2px); }
}
@keyframes fx-clump {
  0% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-7px) scale(.4); }
}
@keyframes fx-spark {
  0% { opacity: 0; transform: scale(.2) rotate(-30deg); }
  45% { opacity: 1; transform: scale(1) rotate(0); }
  100% { opacity: 0; transform: scale(.7) rotate(20deg); }
}
@keyframes fx-out { to { opacity: 0; } }
@keyframes care-hop {
  0%, 100% { transform: none; }
  26% { transform: translateY(-7px); }
  52% { transform: translateY(0) scale(1.04,.96); }
  70% { transform: translateY(-3px) scale(1); }
  86% { transform: translateY(0) scale(1.01,.99); }
}

@media (prefers-reduced-motion: reduce) {
  /* the props still answer the tap — one second, once, no loop; what a
     reduce-motion student does not get is the character jumping */
  .care-hop { animation: none !important; }
}

/* ---- panel: same button, light and bigger ---- */
.pet-overlay {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center;
  justify-content: center; padding: 20px;
  background: rgba(16, 24, 38, .42);
  opacity: 0; visibility: hidden; transition: opacity .18s;
}
.pet-overlay.open { opacity: 1; visibility: visible; }
.pet-panel {
  position: relative; width: 452px; max-width: 100%;
  background: var(--card); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(16, 24, 38, .3);
  transform: translateY(10px) scale(.985); transition: transform .2s;
  /* B19 added a skill banner and a cupboard row; without a ceiling the header
     (and the close button) slid off the top of a 900px laptop viewport */
  max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
}
.pet-overlay.open .pet-panel .pet-head { flex: none; }
.pet-panel .pet-body { overflow-y: auto; overscroll-behavior: contain; }
.pet-overlay.open .pet-panel { transform: none; }
.pet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px 10px; border-bottom: 1px solid var(--line);
}
.pet-title b { font-size: 15.5px; letter-spacing: .01em; }
.pet-title em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.pet-close {
  margin-left: auto; width: 30px; height: 30px; flex: none;
  border: 1px solid var(--line); border-radius: 50%; background: #fff;
  color: var(--ink-2); font-size: 13px; cursor: pointer;
}
.pet-close:hover { border-color: var(--ink-3); }
.pet-body { padding: 14px 18px 16px; }
.pet-loading { padding: 42px 0; text-align: center; color: var(--ink-3); font-size: 13px; }

.pet-stage { display: flex; gap: 14px; align-items: center; }
.pet-cat { flex: none; width: 150px; padding-top: 6px; }
.pet-say { flex: 1; min-width: 0; }
.pet-moodname {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--brand-2); color: var(--brand-ink);
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
}
.pet-line { margin-top: 7px; font-size: 14px; line-height: 1.55; }
.pet-wb {
  margin-top: 9px; padding: 6px 9px; border-radius: 9px; line-height: 1.5;
  font-size: 12.2px; color: #8a6a2a; background: #fdf6e4; border: 1px solid #f0e0b6;
}

.pet-panel .care-btn {
  grid-template-columns: 24px 1fr auto; grid-template-rows: auto 5px;
  gap: 5px 7px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font-size: 13.5px;
}
.pet-panel .care-btn:hover { background: #fff; border-color: var(--brand); }
.pet-panel .care-btn .cb-ic { font-size: 16px; }
.pet-panel .care-btn .cb-num {
  display: block; grid-area: 1 / 3; font-style: normal;
  font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.pet-panel .care-btn .cb-bar { background: #e6ecf2; height: 5px; }
.pet-panel .care-btn .cb-bar i { background: linear-gradient(90deg, #3fbb8c, #0f6e56); }
.pet-panel .care-btn.full .cb-bar i { background: #dfe6ee; }
.care-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

.pet-foot { margin-top: 13px; }
.pet-bond { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.pet-bond b { color: var(--ink); }
.pet-bond em { font-style: normal; font-variant-numeric: tabular-nums; }
.pb-bar { flex: 1; height: 6px; border-radius: 999px; background: #f2e9ee; overflow: hidden; }
.pb-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f2a7bd, #e05a72); transition: width .4s; }
.pet-note { margin-top: 7px; font-size: 11.8px; line-height: 1.5; color: var(--ink-3); }

.pet-line.flash { color: var(--brand-ink); font-weight: 500; }
.pet-wb.warm {
  color: #fff; border-color: transparent;
  background: linear-gradient(120deg, #9c4038, #c06a4a);
}

@media (max-width: 760px) {
  /* four in a row under the title — the hero is centred here, so a 2x2 block
     would make the column twice as tall as it needs to be */
  .hp-hero-meow { width: 100%; }
  .strip-care { grid-template-columns: repeat(4, 1fr); }
  .strip-mood { min-height: 0; margin-bottom: 9px; }
  .care-btn { grid-template-columns: 15px 1fr; font-size: 11px; padding: 6px 6px; }
}

@media (max-width: 640px) {
  .pet-overlay { padding: 0; align-items: flex-end; }
  .pet-panel { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; overflow-y: auto; }
  .pet-body { padding: 12px 14px 15px; }
  .pet-cat { width: 112px; }
  .pet-line { font-size: 13.2px; }
}

/* ================= Growth: streaks, daily missions (B5) ================= */
.pet-growth {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2, #f6f7fb); color: var(--ink); cursor: pointer;
  font: inherit; font-size: 13.5px; text-align: left;
}
.pet-growth:hover { border-color: var(--brand); }
.pet-growth em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--ink-3); }

.gr-overlay {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(16, 24, 40, .42); backdrop-filter: blur(2px);
  align-items: center; justify-content: center; padding: 24px;
}
.gr-overlay.open { display: flex; }
.gr-panel {
  position: relative; width: min(560px, 100%); max-height: min(88vh, 780px);
  display: flex; flex-direction: column; background: #fff; border-radius: 20px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .28); overflow: hidden;
}
.gr-head {
  display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.gr-title b { display: block; font-size: 18px; }
.gr-title span { font-size: 12.5px; color: var(--ink-3); }
.gr-purse {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  background: var(--panel-2, #f6f7fb); border-radius: 999px; padding: 5px 11px;
  font-size: 13px; color: var(--ink-2);
}
.gr-close {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); cursor: pointer; font-size: 14px;
}
.gr-body { padding: 16px 20px 46px; overflow-y: auto; }
.gr-loading { padding: 28px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.gr-loading.bad { color: var(--err, #d64545); }

.gr-streaks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gr-streak {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 14px; background: #fbfafe;
}
.gr-streak .gr-ico { font-size: 20px; }
.gr-streak-main b { font-size: 22px; line-height: 1; }
.gr-streak-main b em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.gr-streak-main span { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.gr-today { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.gr-today.on { color: #1d8f5f; }

.gr-sec {
  display: flex; align-items: baseline; gap: 8px; margin: 16px 0 8px;
  font-size: 13px; color: var(--ink-2);
}
.gr-sec .gr-count { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.gr-week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  background: #fbfafe; border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px;
}
.gr-day { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--ink-3); }
.gr-day.today { color: var(--ink); font-weight: 600; }
.gr-dot { width: 9px; height: 9px; border-radius: 50%; background: #e3e2ea; display: inline-block; }
.gr-dot.care.on { background: #f0a35e; }
.gr-dot.study.on { background: var(--brand); }
.gr-legend { display: flex; gap: 14px; margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.gr-legend span { display: inline-flex; align-items: center; gap: 5px; }

.gr-missions { display: flex; flex-direction: column; gap: 8px; }
.gr-mission {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.gr-mission.done { background: #f4fbf7; border-color: #bfe6d2; }
.gr-mission.claimed { background: #f7f7fa; }
.gr-mico { font-size: 19px; }
.gr-mmain { flex: 1; min-width: 0; }
.gr-mmain b { display: block; font-size: 13.5px; }
.gr-mmain span { font-size: 11.5px; color: var(--ink-3); }
.gr-mbar {
  display: block; height: 4px; border-radius: 2px; background: #ecebf2;
  margin-top: 6px; overflow: hidden;
}
.gr-mbar i { display: block; height: 100%; background: #7fd0a5; border-radius: 2px; }
.gr-mend { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.gr-mend em { font-style: normal; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.gr-claim {
  border: 0; border-radius: 9px; padding: 6px 11px; background: var(--brand);
  color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.gr-claim:hover { filter: brightness(1.06); }
.gr-claimed { font-size: 11.5px; color: #1d8f5f; }
.gr-reward { font-size: 12px; color: var(--ink-3); }
.gr-note { margin-top: 14px; font-size: 11.5px; line-height: 1.5; color: var(--ink-3); }

.gr-toast {
  position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 8px);
  background: #1f2937; color: #fff; font-size: 12.5px; padding: 8px 14px;
  border-radius: 10px; opacity: 0; pointer-events: none; transition: .18s;
  max-width: 88%;
}
.gr-toast.show { opacity: 1; transform: translate(-50%, 0); }
.gr-toast.bad { background: #b3261e; }

@media (max-width: 640px) {
  .gr-overlay { padding: 0; align-items: flex-end; }
  .gr-panel { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; }
  .gr-streaks { grid-template-columns: 1fr; }
  .gr-body { padding: 14px 16px 22px; }
}

/* ================= how to earn fish treats (B7) =================
   Students could not find the earning rules, so they now appear wherever a
   balance is shown: an inline list in the wallet, a button in the wardrobe
   footer, a question in the pet panel, a link in the growth sheet, a chip on
   the chapter video and a line under every quiz payout. One sheet explains it
   in full; it sits above the wardrobe (z 900) and the growth sheet (z 90). */
.earn-overlay {
  position: fixed; inset: 0; z-index: 960; background: rgba(16, 24, 40, .5);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.earn-panel {
  width: min(540px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--card, #fff); border-radius: 20px; padding: 22px 24px 18px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .3);
}
.earn-head { display: flex; align-items: flex-start; gap: 12px; }
.earn-title b { display: block; font-size: 17px; }
.earn-title span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.earn-close {
  margin-left: auto; flex: none; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  cursor: pointer; font-size: 14px;
}
.earn-list { list-style: none; margin: 14px 0 0; padding: 0; }
.earn-row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px;
  align-items: start; padding: 11px 0; border-top: 1px solid var(--line);
}
.earn-ico { font-size: 19px; line-height: 1.25; }
.earn-main b { display: block; font-size: 13.5px; font-weight: 650; color: var(--ink); }
.earn-sub { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--ink-3); }
.earn-amt {
  font-size: 13px; font-weight: 700; color: #8a5f10; text-align: right;
  background: #fff8e8; border: 1px solid #f0dcae; border-radius: 999px;
  padding: 4px 10px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.earn-amt em { display: block; font-style: normal; font-size: 9.5px; font-weight: 500; opacity: .8; }
.earn-row.spend .earn-amt { background: var(--bg, #f6f7fb); border-color: var(--line); color: var(--ink-2); }
.earn-cap {
  margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: var(--bg, #f6f7fb);
  font-size: 11.5px; line-height: 1.5; color: var(--ink-2);
}
.earn-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.earn-actions .btn { font-size: 13px; }

/* inline copy inside the wallet: titles and amounts only, the detail lives in
   the sheet so a phone-sized wallet stays one screen tall */
.earn-list.tight { margin-top: 4px; }
.earn-list.tight .earn-row { padding: 8px 0; }
.earn-list.tight .earn-sub { display: none; }
.earn-list.tight .earn-ico { font-size: 16px; }
.earn-list.tight .earn-amt { font-size: 12px; padding: 3px 9px; }
.earn-list.tight .earn-amt em { display: inline; margin-left: 4px; font-size: 10px; }

.linkish {
  border: 0; background: none; padding: 0; margin-left: 4px;
  color: var(--brand-ink, #1d6b52); font: inherit; font-size: inherit;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}

/* wardrobe footer: replaces the tiny grey line that phones hid entirely */
.ms-earn {
  margin-left: 10px; border: 1px solid #f0dcae; background: #fff8e8;
  color: #8a5f10; border-radius: 999px; padding: 5px 11px;
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.ms-earn:hover { filter: brightness(1.03); }
.ms-foot .ms-hint { margin-left: auto; }

/* pet panel: a question instead of a statement, because it invites a tap */
.pet-earn { margin: 6px 0 0; text-align: center; }
.pet-earn button {
  border: 0; background: none; padding: 2px 4px; cursor: pointer;
  font: inherit; font-size: 11.5px; color: var(--ink-3);
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.pet-earn button:hover { color: var(--brand-ink, #1d6b52); }

/* chapter video: the bonus is stated before play, then becomes a receipt */
.video-earn {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 5px;
  margin: 0 0 10px; padding: 5px 12px; border-radius: 999px;
  background: #fff8e8; border: 1px solid #f0dcae; color: #8a5f10; font-size: 12.5px;
}
.video-earn em { font-style: normal; font-size: 11px; opacity: .75; }
.video-earn.paid { background: #eefaf3; border-color: #b9e6cd; color: #14683f; }

/* quiz result: always says what else pays, even after a good payout */
.rw-earn { margin-top: 9px; text-align: center; font-size: 11.5px; line-height: 1.6; color: var(--ink-3); }
.rw-earn-list { font-variant-numeric: tabular-nums; }

/* growth sheet: the purse itself is the door */
button.gr-purse { font: inherit; cursor: pointer; border: 1px solid transparent; }
button.gr-purse:hover { border-color: #f0dcae; background: #fff8e8; }

/* a wallet can now carry the earn list, so cap its height and let it scroll */
.modal.wallet { max-height: 88vh; overflow-y: auto; }

@media (max-width: 640px) {
  .earn-overlay { padding: 0; align-items: flex-end; }
  .earn-panel { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; padding: 18px 18px 16px; }
  /* only the full sheet stacks the amount under the title; the wallet keeps
     its rows on one line, otherwise three rules fill the whole phone screen */
  .earn-panel .earn-row { grid-template-columns: 26px 1fr; }
  .earn-panel .earn-amt { grid-column: 2; justify-self: start; margin-top: 4px; }
  .earn-panel .earn-amt em { display: inline; margin-left: 4px; }
  .earn-list.tight .earn-row { grid-template-columns: 22px 1fr auto; align-items: center; }
  .earn-list.tight .earn-amt { grid-column: auto; margin-top: 0; text-align: right; }
  .earn-actions .btn { flex: 1 1 auto; }
  .ms-foot .ms-hint { display: none; }
  .ms-foot .ms-earn { margin-left: auto; }
  .video-earn { display: flex; }
}

/* ================= collection goal (B8) =================
   The wardrobe used to say "Collected 8 / 15" in the footer, which states a
   fraction without stating a direction. The bar and the "next piece" line sit
   under the title so the goal is visible before any tab is opened. */
.ms-goal { flex: none; padding: 13px 20px 2px; }
.ms-goal-bar {
  display: block; height: 8px; border-radius: 999px; overflow: hidden;
  background: #f0efea;
}
.ms-goal-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f5c451, #e0950f);
  transition: width .45s ease;
}
.ms-goal-line {
  display: block; margin-top: 7px; font-size: 12px; line-height: 1.5;
  color: var(--ink-2);
}
.ms-goal-line b { color: var(--ink-2); font-weight: 650; }

@media (max-width: 640px) {
  .ms-goal { padding: 9px 16px 0; }
  .ms-goal-line { font-size: 11px; }
}

/* the promise behind the prices, stated once, where the rules already are */
.earn-goal {
  margin-top: 8px; padding: 9px 12px; border-radius: 10px;
  background: #fffaf0; border: 1px solid #f3e4c4;
  font-size: 11.5px; line-height: 1.55; color: #7a5a12;
}

/* ============================================================================
   B9 — class board: the rank in the level pill, the podium sheet, the close-up
   ----------------------------------------------------------------------------
   The podium is three CSS blocks, not an image: the cats are the same SVG the
   rest of the site draws, so a student's own outfit is on the steps. Gold,
   silver and bronze are the only saturated colours in the sheet — everything
   else stays on the app's neutral surfaces, so the steps read as a ranking at a
   glance rather than as decoration.
   ========================================================================== */

/* ---------- the rank line in the wallet (under the level bar) ---------- */
.wallet-rank {
  display: flex; align-items: baseline; gap: 8px;
  margin: 2px 0 12px; padding: 7px 11px;
  background: #fffaf0; border: 1px solid #f3e7cb; border-radius: 10px;
}
.wallet-rank-lab { font-size: 11.5px; color: #8a6416; }
.wallet-rank b { font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.wallet-rank .linkish { margin-left: auto; font-size: 11.5px; }

/* ---------- sheet ---------- */
.rk-overlay {
  position: fixed; inset: 0; z-index: 94; display: none;
  align-items: center; justify-content: center; padding: 22px;
  background: rgba(16, 22, 31, .52);
}
.rk-overlay.open { display: flex; }
.rk-panel {
  position: relative; width: 580px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border-radius: 18px;
  box-shadow: 0 26px 60px rgba(16, 22, 31, .3);
}
.rk-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 15px 18px 12px; border-bottom: 1px solid var(--line);
}
.rk-title b { font-size: 16px; letter-spacing: .01em; }
.rk-title span { display: block; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.rk-close {
  margin-left: auto; width: 30px; height: 30px; flex: none; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-3);
  font-size: 13px; cursor: pointer;
}
.rk-close:hover { border-color: var(--ink-3); color: var(--ink); }
.rk-body { flex: 1; overflow-y: auto; }
.rk-loading { padding: 54px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- the steps ---------- */
.rk-stage {
  position: relative; padding: 16px 14px 0;
  background: radial-gradient(112% 92% at 50% 0%, #fffaee 0%, #fdf1d6 44%, #f5e2bd 100%);
}
/* confetti, as a texture rather than 60 elements: cheap on a phone */
.rk-stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .2;
  background-image:
    radial-gradient(#e6b34a 1.4px, transparent 1.5px),
    radial-gradient(#8fb0d6 1.3px, transparent 1.4px);
  background-size: 44px 44px, 58px 58px;
  background-position: 0 0, 22px 29px;
}
.rk-steps {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1fr 1.16fr 1fr;
  align-items: end; gap: 6px;
}
.rk-step { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.rk-catwrap {
  position: relative; width: 100%; display: flex; justify-content: center;
  cursor: pointer; border-radius: 14px;
}
.rk-catwrap:hover .rk-cat { transform: translateY(-3px); }
.rk-catwrap:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.rk-cat { width: 108px; transition: transform .18s ease; }
.rk-p1 .rk-cat { width: 126px; }
.rk-p2 .rk-cat { width: 112px; }
.rk-p3 .rk-cat { width: 102px; }
.rk-cat-blank {
  width: 74px; height: 74px; margin-bottom: 16px; border-radius: 50%;
  border: 2px dashed rgba(120, 95, 45, .32);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: rgba(120, 95, 45, .38);
}
.rk-you-tag {
  position: absolute; top: 2px; right: 8px; z-index: 2;
  padding: 2px 8px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  letter-spacing: .05em; box-shadow: 0 2px 7px rgba(15, 110, 86, .38);
}
.rk-pedestal {
  position: relative; width: 100%; padding: 7px 6px 9px;
  border-radius: 10px 10px 0 0; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}
.rk-p1 .rk-pedestal { height: 138px; background: linear-gradient(180deg, #f8da81, #e4ae46); color: #573a04; }
.rk-p2 .rk-pedestal { height: 112px; background: linear-gradient(180deg, #e1e7f0, #b2beda); color: #2b3648; }
.rk-p3 .rk-pedestal { height: 94px; background: linear-gradient(180deg, #efc39e, #cc8f63); color: #45270e; }
.rk-medal { font-size: 19px; line-height: 1.15; }
.rk-p3 .rk-medal { font-size: 16px; }
.rk-place {
  font-size: 10px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; opacity: .7;
}
.rk-name {
  font-size: 12.5px; font-weight: 700; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rk-p3 .rk-name { font-size: 11.5px; }
.rk-earn { font-size: 11px; opacity: .88; font-variant-numeric: tabular-nums; }
.rk-p1 .rk-earn { font-size: 12px; font-weight: 650; }
.rk-pedestal .rk-name, .rk-pedestal .rk-earn { padding: 0 2px; }

/* ---------- your own row ---------- */
.rk-body-in { padding: 14px 16px 16px; }
.rk-you {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg);
}
.rk-you.new { background: #fffaf0; border-color: #f2e4c6; }
.rk-you.side p { font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.rk-you-rank { flex: none; display: flex; align-items: baseline; color: var(--brand); }
.rk-you-rank em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.rk-you-rank b { font-size: 22px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.rk-you-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rk-you-main b { font-size: 13px; }
.rk-you-main span { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.rk-you-main em { font-style: normal; font-size: 11px; color: #8a6416; }
.rk-you-bar {
  display: block; height: 5px; margin: 3px 0 2px;
  border-radius: 999px; background: #e6eaf0; overflow: hidden;
}
.rk-you-bar i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f2cd6b, #d99a2b); }
.rk-you-earn {
  flex: none; text-align: right; font-size: 14px; font-weight: 700;
  color: #8a5f10; font-variant-numeric: tabular-nums;
}
.rk-you-earn em { display: block; font-style: normal; font-size: 10px; font-weight: 500; color: var(--ink-3); }

/* ---------- the rest of the board ---------- */
.rk-boardhead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin: 16px 0 8px;
}
.rk-boardhead b { font-size: 13px; }
.rk-boardhead span { font-size: 11px; color: var(--ink-3); text-align: right; }
.rk-rows { display: flex; flex-direction: column; gap: 6px; }
.rk-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 10px; text-align: left; font: inherit; color: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  cursor: pointer;
}
.rk-row:hover { border-color: #bcd3ca; background: #fbfdfc; }
.rk-row.me { border-color: #cfe8dd; background: #f6fcf9; }
.rk-row-rank {
  width: 20px; flex: none; text-align: center; font-size: 12px; font-weight: 700;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.rk-row-cat { width: 38px; height: 38px; flex: none; }
.rk-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rk-row-main b {
  font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rk-row-main em { font-style: normal; font-size: 10.5px; color: var(--ink-3); }
.rk-row-earn { font-size: 12px; font-weight: 650; color: #8a5f10; font-variant-numeric: tabular-nums; }
.rk-note { margin-top: 12px; font-size: 11.5px; line-height: 1.6; color: var(--ink-3); }
.rk-note b { color: var(--ink-2); }

/* ---------- close-up ---------- */
.rk-zoom {
  position: absolute; inset: 0; z-index: 3; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(16, 22, 31, .5);
}
.rk-zoom.open { display: flex; }
.rk-zoom-card {
  position: relative; width: 340px; max-width: 100%;
  padding: 16px 18px 18px; text-align: center;
  background: var(--card); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(16, 22, 31, .3);
}
.rk-zoom-x {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-3); font-size: 12px; cursor: pointer;
}
.rk-zoom-cat { width: 200px; margin: 2px auto 4px; }
.rk-zoom-name { display: block; font-size: 16px; }
.rk-zoom-meta { display: block; font-size: 11.5px; color: var(--ink-3); }
.rk-zoom-earn { display: block; margin-top: 6px; font-size: 13px; font-weight: 650; color: #8a5f10; }
.rk-zoom-kit {
  display: flex; flex-wrap: wrap; gap: 5px; justify-content: center;
  margin-top: 10px; font-size: 11px; color: var(--ink-3);
}
.rk-zoom-kit span {
  width: 100%; font-size: 10px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3);
}
.rk-zoom-kit i {
  font-style: normal; padding: 2px 9px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink-2);
}

@media (max-width: 600px) {
  .rk-overlay { padding: 0; align-items: flex-end; }
  .rk-panel { width: 100%; max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .rk-stage { padding: 12px 10px 0; }
  .rk-steps { gap: 4px; }
  .rk-p1 .rk-cat { width: 100px; }
  .rk-p2 .rk-cat { width: 88px; }
  .rk-p3 .rk-cat { width: 80px; }
  .rk-p1 .rk-pedestal { height: 118px; }
  .rk-p2 .rk-pedestal { height: 98px; }
  .rk-p3 .rk-pedestal { height: 84px; }
  .rk-name { font-size: 11px; }
  .rk-p3 .rk-name { font-size: 10px; }
  .rk-earn { font-size: 10px; }
  .rk-p1 .rk-earn { font-size: 11px; }
  .rk-you-tag { top: -2px; right: 2px; }
  .rk-body-in { padding: 12px 12px 16px; }
  .rk-zoom-cat { width: 176px; }
}

/* ============================================================================
   B10 — the room: furniture, and the scene it is placed in
   ----------------------------------------------------------------------------
   One scene, drawn in a 420×260 space (meow.js owns the art). Everything here
   only positions it: `.room-stage` keeps the aspect ratio, `.room-art` fills it,
   and `.room-cat` puts the cat on the floor line at 196/420 with its paws at
   232/260. The cat is a sibling of the SVG, so it can blink and change mood
   without re-rendering the room.
   ========================================================================== */

.room-stage { position: relative; overflow: hidden; }
.room-art, .room-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.room-cat {
  position: absolute; left: 46.7%; bottom: 9%; width: 32.4%;
  transform: translateX(-50%);
}
.room-cat svg { display: block; width: 100%; height: auto; }
/* the cat is out on a visit: the room keeps its furniture, the cat's spot is a
   dashed outline, so an empty room never reads as a broken one */
.room-stage.away .room-cat { display: none; }
.room-gone {
  position: absolute; left: 46.7%; bottom: 9%; transform: translateX(-50%);
  width: 32.4%; aspect-ratio: 1; border-radius: 50%;
  border: 2px dashed #d3c4a8; background: rgba(255, 253, 246, .5);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; color: #8d7c5e; text-align: center; pointer-events: none;
}
.room-gone span { font-size: clamp(15px, 3.2vw, 26px); line-height: 1; }
.room-gone em {
  font-style: normal; font-size: clamp(8px, 1.4vw, 10.5px);
  letter-spacing: .04em; text-transform: uppercase; opacity: .85;
}

/* ---------- the pet panel: the room is the stage ---------- */
.pet-stage { display: block; }
.pet-room {
  position: relative; aspect-ratio: 420 / 260; margin-bottom: 12px;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
  background: #f3ebda;
}
.pet-say { min-height: 0; }
.pet-roomlink {
  margin-top: 9px; padding: 5px 11px; cursor: pointer; font-family: inherit;
  font-size: 11.5px; color: var(--brand-ink); background: var(--brand-2);
  border: 1px solid #cfe9dd; border-radius: 999px;
}
.pet-roomlink:hover { background: #e5f5ee; border-color: var(--brand); }

/* ---------- wardrobe: the goal strip now has two acts ---------- */
.ms-goal-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-top: 7px;
}
.ms-goal-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--ink-2);
  padding: 2px 8px; border-radius: 999px; background: var(--bg);
  border: 1px solid var(--line);
}
.ms-goal-chip b { font-variant-numeric: tabular-nums; font-weight: 650; }
.ms-goal-next { font-size: 11.5px; line-height: 1.5; color: var(--ink-3); }
.ms-goal-next b { color: var(--ink-2); }
.ms-goal-next.done { color: var(--brand-ink); }

/* ---------- wardrobe: the Room tab ---------- */
.ms-tab-room { margin-left: 2px; }
.ms-roomwrap {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px; align-items: start;
  padding: 2px 0 16px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.ms-roomstage {
  position: relative; aspect-ratio: 420 / 260;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
  background: #f3ebda;
}
.ms-roomside { padding-top: 6px; }
.ms-roomside b { display: block; font-size: 14px; }
.ms-roomside span { display: block; margin-top: 3px; font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.ms-roomside p { margin-top: 8px; font-size: 11.5px; color: var(--ink-3); line-height: 1.55; }

.ms-sect { margin-top: 14px; }
.ms-secthead {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px;
}
.ms-secthead b { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.ms-secthead em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.ms-grid-room { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.ms-card.room { padding: 8px 8px 11px; }
.ms-prev-room {
  width: 100%; height: auto; aspect-ratio: 4 / 3; display: block;
  border-radius: 9px; overflow: hidden; background: #f3ebda;
}
.ms-prev-room svg { display: block; width: 100%; height: 100%; }

@media (max-width: 640px) {
  .ms-roomwrap { grid-template-columns: 1fr; gap: 10px; }
  .ms-roomside p { display: none; }
  .ms-roomside span { font-size: 11.5px; }
  .ms-grid-room { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ms-goal-next { flex-basis: 100%; }
}

/* ---------- B10: the two-act promise, written where students ask for it ----------
   The earn sheet's closing line used to be one sentence about the wardrobe. The
   shop now has two acts, so the line is a bold claim plus the schedule that
   backs it — the same two sentences the goal strip and the model agree on. */
.earn-goal b { display: block; margin-bottom: 2px; color: #5c4210; }

/* ============================================================================
   B11 — travelling: the sheet, the visiting-cat banner, the souvenir cards
   ----------------------------------------------------------------------------
   The sheet is the third drawer in the app (shop 900, travel 950, earn 960), so
   it sits above the shop when a student opens it from there and below the
   earning rules. Everything is on the app's own surfaces: cream cards, one
   green accent, the season's own colour only inside a season block.
   ========================================================================== */
.tv-overlay {
  position: fixed; inset: 0; z-index: 950;
  display: none; place-items: center;
  background: rgba(20, 28, 38, .42);
  backdrop-filter: blur(2px);
  padding: 18px;
}
.tv-overlay.open { display: grid; }
body.tv-lock { overflow: hidden; }

.tv-panel {
  position: relative;
  width: min(660px, 96vw); max-height: 88vh;
  display: flex; flex-direction: column;
  background: #fffdf9; border: 1px solid #e7dcc9; border-radius: 20px;
  box-shadow: 0 26px 70px rgba(28, 38, 52, .28);
  overflow: hidden;
}
.tv-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 15px 18px 13px; border-bottom: 1px solid #efe5d4;
  background: linear-gradient(180deg, #fffaf0, #fffdf9);
}
.tv-title { flex: 1; min-width: 0; }
.tv-title b { display: block; font-size: 17px; color: var(--ink-1, #22303f); }
.tv-title span { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3, #7e8894); }
.tv-close {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid #e3d8c6; background: #fff; color: #6b7381;
  font-size: 15px; line-height: 1; cursor: pointer;
}
.tv-close:hover { background: #f7f0e4; }

.tv-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 20px; }
.tv-loading { padding: 26px 0; text-align: center; font-size: 13px; color: #8a929d; }
.tv-loading.bad { color: #b4453c; }

/* ---- today ---- */
.tv-now {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 14px; border-radius: 14px;
  background: #f7f3ea; border: 1px solid #ece1cf;
}
.tv-now.away { background: #eef4fb; border-color: #d7e4f2; }
.tv-nowic { flex: none; font-size: 20px; line-height: 1.1; }
.tv-nowtxt b { display: block; font-size: 14px; color: #26333f; }
.tv-nowtxt span { display: block; margin-top: 3px; font-size: 12px; line-height: 1.55; color: #6c7783; }

/* ---- the form ---- */
.tv-form { margin-top: 16px; }
.tv-form label {
  display: block; margin-bottom: 7px;
  font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: #7b8492;
}
.tv-row { display: flex; gap: 8px; }
.tv-row input {
  flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 13px;
  font-size: 14px; color: #22303f;
  border: 1.5px solid #e0d5c2; border-radius: 11px; background: #fff;
}
.tv-row input:focus { outline: none; border-color: #2f8f6b; box-shadow: 0 0 0 3px rgba(47, 143, 107, .13); }
.tv-send {
  flex: none; height: 44px; padding: 0 18px; border-radius: 11px; cursor: pointer;
  border: 1px solid #24795a; background: #2f8f6b; color: #fff;
  font-size: 13.5px; font-weight: 600;
}
.tv-send:hover { background: #27805f; }
.tv-send:disabled { opacity: .65; cursor: default; }
.tv-err { margin: 8px 0 0; min-height: 0; font-size: 12.5px; color: #b4453c; display: none; }
.tv-err.on { display: block; }
.tv-fine { margin: 8px 0 0; font-size: 11.5px; line-height: 1.55; color: #8b939e; }
.tv-note {
  margin: 14px 0 0; padding: 11px 13px; border-radius: 11px;
  background: #eef4fb; border: 1px solid #d7e4f2; font-size: 12.5px; line-height: 1.55; color: #4a6a86;
}

/* ---- sections ---- */
.tv-sect { margin-top: 20px; }
.tv-sect h3 {
  display: flex; align-items: center; gap: 6px; margin: 0 0 9px;
  font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: #6f7885;
}
.tv-h-ic { font-size: 13px; }
.tv-count {
  padding: 1px 7px; border-radius: 9px; background: #eaf3ee; color: #2f7f61;
  font-size: 11px; letter-spacing: 0;
}
.tv-sectlead { margin: -3px 0 11px; font-size: 12px; line-height: 1.55; color: #7d8794; }

/* ---- visitors ---- */
.tv-guests { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tv-guest {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px 9px 9px; border-radius: 13px;
  background: #fff; border: 1px solid #ece2d2;
}
.tv-guestcat { flex: none; width: 62px; height: 62px; }
.tv-guestcat svg { display: block; width: 100%; height: 100%; }
.tv-guesttxt { min-width: 0; }
.tv-guesttxt b { display: block; font-size: 13.5px; color: #26333f; }
.tv-from { display: block; margin-top: 2px; font-size: 11.5px; color: #8a929d; }
.tv-from em { font-style: normal; font-weight: 600; color: #5d7d9b; }
.tv-more { margin: 8px 0 0; font-size: 11.5px; color: #8a929d; }

/* ---- souvenirs ---- */
.tv-season {
  margin-bottom: 10px; padding: 12px 13px 11px; border-radius: 14px;
  background: #fff; border: 1px solid #ece2d2;
}
.tv-season.open { border-color: #bfdccd; background: linear-gradient(180deg, #f4faf6, #fff); }
.tv-seasonhead { display: flex; align-items: center; gap: 10px; }
.tv-badge { flex: none; font-size: 20px; }
.tv-seasonttl { flex: 1; min-width: 0; }
.tv-seasonttl b { display: block; font-size: 14px; color: #26333f; }
.tv-seasonline { display: block; margin-top: 1px; font-size: 11.5px; color: #8a929d; }
.tv-seasonline b { display: inline; font-size: 11.5px; color: #2f7f61; }
.tv-trips {
  flex: none; padding: 2px 8px; border-radius: 9px;
  background: #f4efe3; color: #857a66; font-size: 11px;
}
.tv-seasontext { margin: 7px 0 9px; font-size: 12px; line-height: 1.5; color: #7d8794; }
.tv-gifts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tv-gift {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px;
  border-radius: 11px; background: #faf7f0; border: 1px dashed #e5dac6;
}
.tv-gift.got { background: #fff; border-style: solid; border-color: #e5dcc9; }
.tv-prev {
  flex: none; width: 46px; height: 46px; border-radius: 9px;
  background: #f3ecdd; overflow: hidden; display: grid; place-items: center;
}
.tv-prev svg { display: block; width: 100%; height: 100%; }
.tv-prev-room { width: 56px; height: 42px; }
.tv-locked { border: 1px dashed #d9cdb6; background: #f6f1e6; }
.tv-locked b { font-size: 17px; color: #c3b6a0; }
.tv-giftinfo { min-width: 0; }
.tv-giftinfo b { display: block; font-size: 12.5px; color: #2b3742; }
.tv-giftinfo em { display: block; margin-top: 1px; font-style: normal; font-size: 10.5px; color: #9aa1ab; }

/* ---- the everyday shelf (B18) -------------------------------------------
   One tile per souvenir, sixteen in all, in the order they came home. The
   empty ones are a row of hooks: they say "there is more out there" without
   saying what, and they are never a checklist you can fail. */
.tv-souvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.tv-souv {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 5px 7px; border-radius: 12px; background: #fff;
  border: 1px solid #ece2d2; text-align: center;
}
.tv-souvart { display: block; width: 44px; height: 44px; margin-bottom: 2px; }
.tv-souvart svg { display: block; width: 100%; height: 100%; }
.tv-souv b { font-size: 10.8px; line-height: 1.25; color: #2b3742; }
.tv-souv em { font-style: normal; font-size: 9.5px; line-height: 1.3; color: #9aa1ab; }
/* the one placeholder: how many are still out there, without a wall of empty
   cards that reads like an unfinished checklist */
.tv-souv.more {
  justify-content: center; gap: 0; background: #f8f4ea;
  border-style: dashed; border-color: #e2d6bf;
}
.tv-souv.more span { font-size: 17px; font-weight: 700; color: #b9a988; letter-spacing: .01em; }
.tv-souv.more em { margin-top: 2px; }
/* the wardrobe's one line about the shelf, under the room */
.ms-shelfcount { display: block; margin-top: 3px; color: #5d7d6b; }
.tv-pill {
  display: inline-block; margin-top: 4px; padding: 1px 6px; border-radius: 8px;
  background: #f2ece0; color: #8a7f6b; font-size: 10.5px;
}
.tv-pill.got { background: #e7f4ec; color: #2f7f61; }
.tv-season.past { opacity: .82; }
.tv-season.upcoming { background: #fbf9f4; }
/* hosting pays XP, not fish — the chip has to look like a thank-you, not a price */
.tv-xp {
  display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 999px;
  background: #eef7f1; color: #2f7a4f; border: 1px solid #cfe9dd;
  font-size: 10.5px; font-weight: 600;
}

/* ---- history ---- */
.tv-hlist { list-style: none; margin: 0; padding: 0; }
.tv-hlist li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 0; border-bottom: 1px dashed #eee5d6; font-size: 12.5px;
}
.tv-hlist li:last-child { border-bottom: 0; }
.tv-hday { flex: none; width: 58px; color: #9aa1ab; font-size: 11.5px; }
.tv-hlist b { color: #2b3742; }
.tv-hlist em { margin-left: auto; font-style: normal; color: #8a929d; font-size: 11.5px; }

.tv-foot {
  margin: 16px 0 0; padding-top: 12px; border-top: 1px solid #f0e7d8;
  font-size: 11.5px; line-height: 1.5; color: #9aa1ab;
}

.tv-toast {
  position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 12px);
  padding: 9px 16px; border-radius: 11px; white-space: nowrap;
  background: #22303f; color: #fff; font-size: 12.5px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
.tv-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- the home banner ---- */
#hp-visitor { margin: 0 0 14px; }
.hv-banner {
  width: 100%; display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 10px 14px 10px 10px; border-radius: 15px; text-align: left;
  background: linear-gradient(180deg, #f2f8f4, #fbfdfb);
  border: 1px solid #cfe3d6; box-shadow: 0 2px 10px rgba(47, 127, 97, .07);
}
.hv-banner:hover { border-color: #a9ccb7; }
.hv-cat { flex: none; width: 46px; height: 46px; }
.hv-cat svg { display: block; width: 100%; height: 100%; }
.hv-txt { flex: 1; min-width: 0; }
.hv-txt b { display: block; font-size: 13.5px; color: #234233; }
.hv-txt span { display: block; margin-top: 1px; font-size: 11.5px; color: #6f8579; }
.hv-txt em { font-style: normal; font-weight: 600; }
.hv-txt em.hv-xp { color: #2f7a4f; }
.hv-more {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px;
  background: #dcefe3; color: #2f7f61; font-size: 11px;
}
.hv-go { flex: none; font-size: 12px; font-weight: 600; color: #2f7f61; }

/* ---- the pet panel's own line ---- */
.pet-away {
  margin: 7px 0 0; padding: 7px 10px; border-radius: 9px;
  background: #eef4fb; border: 1px solid #d7e4f2;
  font-size: 11.5px; line-height: 1.45; color: #4a6a86;
}

@media (max-width: 640px) {
  .tv-overlay { padding: 0; align-items: end; }
  .tv-panel { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .tv-gifts { grid-template-columns: 1fr; }
  .tv-guests { grid-template-columns: 1fr; }
  .tv-row { flex-wrap: wrap; }
  .tv-send { width: 100%; }
  .hv-go { display: none; }
}

/* the pet panel's travel button: same shape as the room link, one step cooler */
.pet-travel {
  display: block; width: 100%; margin-top: 6px; padding: 7px 11px;
  border-radius: 9px; cursor: pointer; text-align: left;
  border: 1px solid #d7e4f2; background: #eef4fb;
  font-size: 11.5px; color: #3f6382;
}
.pet-travel:hover { background: #e3eefa; border-color: #bfd6ea; }

/* ---------- B11: the Secret tab — pieces that are found, never sold ---------- */
.ms-tab-secret em { background: #f6e7c8; color: #8a6a1f; }
.ms-secretlead {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 11px;
  background: #fff8e8; border: 1px solid #f0e2c2;
  font-size: 12px; line-height: 1.55; color: #7a6220;
}
.ms-secretlead span { display: block; margin-top: 4px; font-weight: 600; color: #6b5316; }
/* Mixed slots (hats and room pieces) so the grid sizes itself rather than
   guessing: five across on a wide panel, two on a phone. */
.ms-grid-secret { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
/* An unfound souvenir is a question mark, always the same square, whatever slot
   it belongs to — the shape stays a surprise and the cards keep one height. */
.ms-card.secret .ms-prev.ms-locked {
  width: 124px; height: 124px; aspect-ratio: auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: #f4eee2;
  border: 1px dashed #ded2ba;
}
.ms-card.secret .ms-prev.ms-locked b {
  font-size: 32px; font-weight: 700; color: #cdc0a6; line-height: 1;
}
.ms-card.secret.locked .ms-info b { color: #9d968a; }
.ms-act.lock {
  display: inline-block; padding: 3px 9px; border-radius: 9px;
  background: #f2ece0; color: #8a7f6b; font-size: 11px;
}
@media (max-width: 640px) {
  .ms-grid-secret { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- B15: the teacher's gift note on the homepage ----------
   One card, once per gift. The palette is the coin chip's (#fff8e8 / #f0dcae /
   #8a5f10) so a present reads as *fish treats* rather than as a system alert —
   the message is money you can spend, and it should feel like the wallet. */
.gift-overlay { z-index: 96; }
.gift-note {
  position: relative; width: 408px; max-width: 92vw;
  padding: 24px 28px 20px; text-align: center;
  background: #fffdf8; border: 1px solid #f0e2c4; border-radius: 20px;
  box-shadow: 0 24px 60px rgba(84, 60, 10, .26);
  animation: giftIn .34s cubic-bezier(.2, .9, .3, 1.12) both;
}
@keyframes giftIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .gift-note { animation: none; } }

.gift-x {
  position: absolute; top: 10px; right: 12px; padding: 6px;
  border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: #bcae8f; font-size: 15px; line-height: 1;
}
.gift-x:hover { background: #f7efdd; color: #8a5f10; }

.gift-art { position: relative; width: 92px; height: 92px; margin: 0 auto 2px; display: grid; place-items: center; }
.gift-art .gift-glow {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 46%, #ffe7b0 0%, #fff6e2 56%, rgba(255, 246, 226, 0) 72%);
}
.gift-art .gift-fish {
  position: relative; font-size: 46px; line-height: 1;
  transform: rotate(-8deg);
  filter: drop-shadow(0 7px 11px rgba(160, 110, 20, .22));
}
.gift-art .spark { position: absolute; color: #e2b55f; font-style: normal; }
.gift-art .s1 { top: 14px; right: 8px; font-size: 13px; }
.gift-art .s2 { bottom: 16px; left: 6px; font-size: 9px; color: #eccd92; }
.gift-art .s3 { top: 22px; left: 14px; font-size: 16px; color: #f0d6a4; }

.gift-kicker {
  font-size: 11px; font-weight: 650; letter-spacing: .09em;
  text-transform: uppercase; color: #a58d5c;
}
.gift-amt {
  margin: 2px 0 0; font-size: 40px; font-weight: 750; line-height: 1.12;
  color: #8a5f10; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.gift-amt em {
  display: block; margin-top: 1px; font-size: 12px; font-weight: 550;
  font-style: normal; letter-spacing: .02em; color: #ab9569;
}
.gift-quote {
  margin: 14px 0 8px; padding: 12px 15px; text-align: left;
  background: #fff7e6; border: 1px solid #f3e4c4; border-radius: 12px;
  font-size: 14.5px; line-height: 1.55; color: var(--ink);
}
.gift-from { font-size: 12.5px; color: var(--ink-3); }

.gift-list {
  list-style: none; margin: 14px 0 0; padding: 0; max-height: 208px; overflow-y: auto;
  text-align: left;
}
.gift-list li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 9px 2px; border-top: 1px dashed #efe2c6;
}
.gift-list li:first-child { border-top: 0; }
.gift-list b {
  flex: none; min-width: 44px; color: #8a5f10; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.gift-list span { font-size: 13px; line-height: 1.45; }
.gift-list q { display: block; color: var(--ink); quotes: none; }
.gift-list i { display: block; margin-top: 2px; font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.gift-quiet { font-style: normal; color: var(--ink-3); }
.gift-more { margin-top: 8px; font-size: 11.5px; color: #ab9569; }

.gift-actions { display: flex; gap: 8px; margin-top: 18px; }
.gift-actions .btn { flex: 1; justify-content: center; }
.gift-wallet, .gift-shop { background: #8a5f10; border-color: #8a5f10; }
.gift-wallet:hover, .gift-shop:hover { background: #74500d; border-color: #74500d; }
.gift-actions .btn.ghost { color: #8a5f10; border-color: #e6d3ab; }

/* B20: the starting gift card reuses the gift envelope, so only the sentence
   and the button that opens the shop are new */
.gift-welcomeline {
  margin: 12px 4px 0; font-size: 13.5px; line-height: 1.55;
  color: var(--ink-2);
}

.gift-foot { margin-top: 11px; font-size: 11px; color: #b6a888; }

@media (max-width: 420px) {
  .gift-note { padding: 20px 20px 16px; }
  .gift-amt { font-size: 34px; }
  .gift-actions { flex-direction: column-reverse; }
}

/* ============================================================
   Sign-in gate (2026-11-19)
   The home page shows nothing but this card until a student signs
   in; supporting styles for assets/gate.js dialogs live below.
   ============================================================ */
/* Both rules are scoped to the one page that carries the gate (index.html,
   <body class="gate-page">). They used to key on the document alone, which
   blanked every other page that happens to use #app — teacher.html showed
   nothing at all to a signed-in teacher, and chapter / quiz / mistakes lost
   the course nav because only index.html ever set .has-auth. */
html:not(.has-auth) body.gate-page #app { display: none; }
html.has-auth #gate { display: none; }
/* the gate is a front door, not a page of the site: no course chrome above it */
html:not(.has-auth) body.gate-page .nav { display: none; }

.gate-wrap {
  max-width: 980px; margin: 0 auto; padding: 40px 20px;
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center;
}
.gate-card {
  display: grid; grid-template-columns: 1.05fr .95fr;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  overflow: hidden; box-shadow: 0 14px 44px rgba(26, 35, 50, .09);
}
.gate-info {
  padding: 34px 34px 28px; display: flex; flex-direction: column;
  background: linear-gradient(165deg, #eef8f4 0%, #ffffff 72%);
}
.gate-logo { height: 44px; width: auto; align-self: flex-start; }
.gate-code {
  margin-top: 26px; font-size: 12.5px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--brand);
}
.gate-title { font-size: 29px; line-height: 1.2; margin: 8px 0 10px; letter-spacing: -.015em; }
.gate-sub { color: var(--ink-2); font-size: 13.5px; }
.gate-mini { display: none; }   /* the phone one-liner; see the media query */
.gate-facts { list-style: none; margin: 22px 0 0; display: flex; flex-direction: column; gap: 12px; }
.gate-facts li { display: flex; gap: 10px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.gate-facts li span:first-child { flex: 0 0 auto; font-size: 15px; line-height: 1.35; }
.gate-facts b { color: var(--ink); font-weight: 600; }
.gate-inst { margin-top: auto; padding-top: 26px; font-size: 11.5px; color: var(--ink-3); line-height: 1.55; }

.gate-form { padding: 34px 36px 30px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.gate-form h2 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.gate-hint { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.gate-form input, .auth-modal input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; color: var(--ink); background: #fff;
}
.auth-modal input { margin-bottom: 0; }
.gate-form input:focus, .auth-modal input:focus {
  outline: 2px solid var(--brand-2); border-color: var(--brand); outline-offset: 0;
}
.gate-submit { width: 100%; margin-top: 10px; padding: 11px 16px; font-size: 15px; }
/* the reveal toggle lives inside the field, the way iOS puts it there */
.gate-field { position: relative; }
.gate-field input { padding-right: 48px; }
.gate-eye {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px;
  background: none; color: var(--ink-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.gate-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.gate-eye.on { color: var(--brand); }
.gate-eye.on svg .slash { opacity: 0; }
.gate-eye:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.gate-links { text-align: center; font-size: 13px; margin-top: 14px; }
.gate-links a { cursor: pointer; }
.gate-note {
  margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line);
  font-size: 11.5px; color: var(--ink-3); line-height: 1.55;
}
.gate-foot { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 26px; }

/* ---- dialogs (login / first-login change / forgot password) ---- */
.auth-modal { width: 400px; max-width: 94vw; padding: 24px 26px 22px; }
.auth-modal.wide { width: 450px; }
.auth-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.auth-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: var(--brand); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 16px;
}
.auth-head h3 { font-size: 16.5px; font-weight: 600; margin: 0 0 3px; }
.auth-sub { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.auth-lab { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin: 12px 0 6px; }
.auth-modal .auth-lab:first-of-type { margin-top: 0; }
.auth-msg { min-height: 16px; font-size: 12.5px; color: var(--ink-3); margin: 5px 0 2px; line-height: 1.4; }
.auth-msg.bad { color: var(--danger); }
.auth-msg.good { color: var(--ok); }
.auth-btn { width: 100%; margin-top: 6px; }
.auth-links { text-align: center; font-size: 13px; margin-top: 12px; color: var(--ink-3); }
.auth-links a { cursor: pointer; }
.auth-note {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
  font-size: 11.5px; color: var(--ink-3); line-height: 1.55;
}
.pw-rules { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.pw-rules li {
  font-size: 11.5px; color: var(--ink-3); background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}
.pw-rules li::before { content: '○ '; }
.pw-rules li.ok { color: var(--brand-ink); background: var(--brand-2); border-color: #bfe6d8; }
.pw-rules li.ok::before { content: '✓ '; }
.auth-sent {
  background: var(--brand-2); border: 1px solid #cfeadf; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; color: var(--brand-ink); line-height: 1.55;
  margin-bottom: 4px; word-break: break-word;
}
.auth-warn {
  display: inline-block; margin-top: 7px; color: #8a5f10; background: #fff8e8;
  border: 1px solid #f0dcae; border-radius: 8px; padding: 6px 8px; font-size: 12px;
}

/* ============================================================
   phone: the gate is the whole screen, and it is not a web page
   ------------------------------------------------------------
   A student opens this on an iPhone in a corridor. There is no
   navigation to browse, no card to admire and no brochure to read:
   just the crest, the course, two fields and one button. The three
   facts collapse into a single line, the sheet loses its border and
   shadow, and the block is centred with auto margins so that a short
   phone scrolls instead of clipping the title.
   ============================================================ */
@media (max-width: 760px) {
  html:not(.has-auth) body { background: #fff; }

  .gate-wrap {
    max-width: 520px;
    padding: calc(env(safe-area-inset-top) + 28px) 22px
             calc(env(safe-area-inset-bottom) + 12px);
    min-height: 100vh; min-height: 100dvh;
    justify-content: flex-start;
    background: linear-gradient(180deg, #eef7f3 0%, #f8fbfa 190px, #fff 380px);
  }
  .gate-card { display: contents; }        /* info + form become siblings */
  .gate-info {
    order: 1; margin-top: auto; padding: 0; background: none;
    align-items: center; text-align: center;
  }
  .gate-form { order: 2; padding: 30px 0 0; border: 0; text-align: left; }
  .gate-foot {
    order: 3; margin-top: auto; padding-top: 28px;
    font-size: 11px; line-height: 1.5; color: var(--ink-3); letter-spacing: .01em;
  }

  /* the wordmark is 697x100: at 38px the English line under it is 4px of
     mush, so show the crest alone. cover + left crops the seal out of the
     same file — no second asset to keep in sync. */
  .gate-logo {
    height: 38px; width: 38px; align-self: center;
    object-fit: cover; object-position: left center;
  }
  .gate-code { margin-top: 20px; font-size: 11px; letter-spacing: .1em; }
  .gate-title {
    font-size: 27px; line-height: 1.15; letter-spacing: -.022em;
    margin: 7px 0 0; max-width: 22ch;
  }
  .gate-sub { font-size: 12.5px; margin-top: 7px; }
  .gate-mini { display: block; margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
  .gate-facts, .gate-inst { display: none; }

  .gate-form h2 { font-size: 17px; font-weight: 600; }
  .gate-hint { font-size: 13px; margin: 3px 0 2px; }
  .auth-lab { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 16px 0 7px; }

  /* filled fields, no hairline box, 52px tall: the shape of an iOS form */
  .gate-form input, .auth-modal input {
    height: 52px; padding: 0 15px; font-size: 16px;   /* 16px: no iOS zoom */
    border: 1.5px solid transparent; border-radius: 14px; background: #f2f5f3;
  }
  .gate-form .gate-field input { padding-right: 54px; }
  .gate-form input:focus, .auth-modal input:focus {
    outline: none; background: #fff; border-color: var(--brand);
    box-shadow: 0 0 0 3.5px rgba(15, 110, 86, .13);
  }
  .gate-eye { right: 4px; width: 44px; height: 44px; }   /* 44pt tap target */
  .gate-submit, .auth-btn {
    height: 52px; min-height: 52px; margin-top: 20px;
    border-radius: 14px; font-size: 16.5px; font-weight: 600;
  }
  .gate-submit:active, .auth-btn:active { transform: scale(.988); }
  .gate-submit, .gate-eye, .gate-links a { touch-action: manipulation; }  /* no 300ms tap zoom */
  .gate-links { margin-top: 14px; font-size: 14.5px; }
  .gate-links a { display: inline-block; padding: 8px 6px; }   /* a real tap target */
  .gate-note {
    margin-top: 22px; padding-top: 16px; border-top: 1px solid #edf1ef;
    font-size: 11.5px; line-height: 1.55; color: var(--ink-3);
  }
  .auth-msg { font-size: 12.5px; margin: 6px 2px 0; }

  .auth-modal { max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; }
  .auth-modal { max-height: calc(100dvh - 24px); }   /* dvh: the URL bar retracts */
}

/* a 4.7" iPhone (SE, 8) and any small Android: ~667px before Safari takes
   its bars, so every gap and the footer give way to the two fields */
@media (max-width: 760px) and (max-height: 700px) {
  .gate-wrap { padding-top: calc(env(safe-area-inset-top) + 10px); }
  .gate-mini, .gate-foot { display: none; }
  .gate-logo { height: 32px; width: 32px; }
  .gate-code { margin-top: 14px; font-size: 10.5px; }
  .gate-title { font-size: 23px; }
  .gate-sub { font-size: 12px; margin-top: 4px; }
  .gate-form { padding-top: 14px; }
  .auth-lab { margin: 12px 0 6px; }
  .gate-form input, .auth-modal input { height: 48px; }
  .gate-submit, .auth-btn { height: 50px; min-height: 50px; margin-top: 16px; }
  .gate-note { margin-top: 14px; padding-top: 10px; font-size: 11px; }
}

/* ============================================================ B19 — treats
   A treat is a costume, not a mood: the mask and the aura are drawn by meow.js
   on top of the cat, so the only thing CSS does is make the stars breathe. */
@keyframes mw-twinkle {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1; }
}
.mw-star { animation: mw-twinkle 2.6s ease-in-out infinite; }
.mw-star:nth-child(2) { animation-delay: .5s; }
.mw-star:nth-child(3) { animation-delay: 1.1s; }
.mw-star:nth-child(4) { animation-delay: 1.7s; }
@media (prefers-reduced-motion: reduce) {
  .mw-star { animation: none; }
}

/* the super pill in the pet panel: the clock is the point, so it is a number */
.pet-super {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px;
  margin: 8px 0 2px; padding: 8px 11px;
  background: linear-gradient(100deg, #eefaf3, #f3efff);
  border: 1px solid #d8e8f2; border-radius: 11px;
}
.pet-super .ps-badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: .07em;
  color: #fff; background: #2f8f68; padding: 2px 7px; border-radius: 999px;
}
.pet-super b { font-size: 13.5px; color: var(--brand-ink); }
.pet-super em { font-size: 11.5px; color: var(--ink-3); font-style: normal; }
.pet-super p { flex-basis: 100%; font-size: 11.5px; color: var(--ink-2); line-height: 1.45; }

/* the cupboard under the four care buttons */
.pet-treats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.pet-treats .pt-lab { font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.pet-treats em { font-size: 11.5px; color: var(--ink-3); font-style: normal; }
.pt-give {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px 4px 5px; font: inherit; color: var(--ink);
}
.pt-give:hover { border-color: #b9d8c9; background: #f4fbf7; }
.pt-give .pt-art { width: 22px; height: 22px; display: block; }
.pt-give .pt-art svg { width: 100%; height: 100%; display: block; }
.pt-give .pt-name { font-size: 12.5px; font-weight: 600; }
.pt-give .pt-name em { margin-left: 3px; color: var(--ink-3); font-style: normal; }
.pt-more {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 11.5px; color: var(--brand); text-decoration: underline;
}
.pet-treats .pt-note { flex-basis: 100%; color: var(--ink-3); }
.strip-super {
  font-size: 11px; color: var(--brand-ink); background: #e8f7f0;
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}

/* the quiz lifeline */
.q-sniffnote {
  margin: 12px 0 0; padding: 8px 12px; font-size: 12.5px; color: #6a4fa3;
  background: #f5f1ff; border: 1px solid #e4dbfa; border-radius: 10px;
}
.qsniff {
  float: right; margin: -2px 0 0 10px; cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 600;
  color: #6a4fa3; background: #fff; border: 1px solid #d9cff3;
  border-radius: 999px; padding: 3px 10px;
}
.qsniff:hover:not(:disabled) { background: #f7f3ff; }
.qsniff.used { color: var(--ink-3); border-color: var(--line); background: #fafbfc; cursor: default; }
.opt.gone { opacity: .32; text-decoration: line-through; pointer-events: none; background: #f7f8fa; }

/* travel sheet: giving one away */
.tv-souv { position: relative; }
.tv-souvgive {
  position: absolute; top: 3px; right: 3px; opacity: 0; transition: opacity .12s;
  font: inherit; font-size: 10px; line-height: 1; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 6px; cursor: pointer;
}
.tv-souv:hover .tv-souvgive, .tv-souvgive:focus-visible { opacity: 1; }
/* No hover means no reveal: the button has to be on the card, and it has to be
   big enough to hit with a thumb — a 18px corner chip is a quarter of a
   fingertip. So on touch it drops into the flow, full width of the tile. */
@media (hover: none), (max-width: 560px) {
  .tv-souvgive {
    position: static; opacity: 1; display: block; width: 100%;
    margin: 5px 0 0; padding: 8px 0; font-size: 11px; border-radius: 8px;
  }
}
.tv-souvgive:hover { border-color: #b9d8c9; color: var(--brand-ink); }
.tv-recent {
  margin: 2px 0 10px; padding: 8px 11px; font-size: 12px; line-height: 1.6;
  color: var(--ink-2); background: #f7fbf9; border: 1px solid #dcece4; border-radius: 10px;
}
.tv-next { color: var(--ink-3); }
.tv-giftform {
  margin-top: 12px; padding: 11px 12px; border: 1px solid #e4dbfa;
  background: #faf8ff; border-radius: 11px;
}
.tv-giftform p { font-size: 12.5px; color: var(--ink-2); }
.tv-giftrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tv-giftrow input {
  flex: 1 1 200px; min-width: 0; height: 38px; padding: 0 11px; font: inherit;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.tv-giftrow button {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 9px; padding: 0 14px; height: 38px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
}
.tv-giftcancel { background: #fff !important; color: var(--ink-2) !important; border-color: var(--line) !important; }
.tv-gifterr { margin-top: 7px; font-size: 12px; color: var(--danger); display: none; }
.tv-gifterr.on { display: block; }

/* shop: the Treats tab */
.ms-tab-treat em { background: #eef7f1; }
.ms-grid-treat { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.ms-card.treat { padding-bottom: 12px; }
.ms-card.treat .ms-prev-treat { width: 46px; height: 46px; }
.ms-card.treat .ms-prev-treat svg { width: 100%; height: 100%; display: block; }
.ms-card.treat .ms-skill {
  width: 100%; font-size: 11.5px; line-height: 1.45; color: var(--ink-2);
}
.ms-card.treat .ms-info em { color: #6a4fa3; }

/* quiz: the five question types (B22)
   One card per question, one input idiom per type. The journal builder is a
   four-column grid on a laptop and stacks to two columns on a phone — an entry
   typed into four side-by-side boxes on a 375px screen is unreadable. */
.quiz-aim {
  margin: -4px 0 14px; padding: 10px 14px; border-radius: 10px;
  background: var(--brand-2); color: var(--brand-ink);
  border: 1px solid #cfe8de; font-size: 13.5px; line-height: 1.55;
}
.tag.amber { background: #fdf3e2; color: #8a5a00; border-color: #f0dcb4; }
.qtype { margin-left: 6px; }

/* journal entry */
.je { margin-top: 6px; }
.je-head, .je-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px 26px;
  gap: 8px; align-items: center;
}
.je-head {
  font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 2px 5px;
}
.je-row { margin-bottom: 8px; }
.je-row input {
  width: 100%; height: 40px; padding: 0 10px; font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
.je-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-2); }
.je-row .je-dr, .je-row .je-cr { text-align: right; font-variant-numeric: tabular-nums; }
.je-del {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-3); font-size: 15px; line-height: 1; cursor: pointer;
}
.je-del:hover { color: var(--danger); border-color: var(--danger-2); }
.je-add { margin-top: 2px; font-size: 13px; padding: 7px 12px; }
.je-hint { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }

/* numeric */
.numwrap { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.num-unit {
  min-width: 30px; height: 44px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 8px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line);
  font-weight: 600; color: var(--ink-2);
}
.num-in {
  flex: 1; height: 44px; padding: 0 12px; font: inherit; font-size: 16px;
  font-variant-numeric: tabular-nums; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink);
}
.num-in:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-2); }

/* short answer */
.short-in {
  width: 100%; padding: 11px 13px; font: inherit; font-size: 14.5px; line-height: 1.6;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); resize: vertical; min-height: 110px;
}
.short-in:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-2); }
.short-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 12px; }

/* review */
.je-review { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13.5px; }
.je-review th {
  text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; padding: 0 8px 6px;
}
.je-review td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.je-review td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.je-review td.mine { color: var(--ink-2); font-size: 12.5px; }
.je-review tr.je-ok td:first-child { color: var(--ok); font-weight: 700; }
.je-review tr.je-bad td:first-child { color: var(--danger); font-weight: 700; }
.je-review tr.je-bad { background: #fdf6f6; }

.numcmp { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.numcmp > div {
  flex: 1; min-width: 150px; padding: 10px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff;
}
.numcmp span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.numcmp b { font-size: 17px; font-variant-numeric: tabular-nums; }
.numcmp .ok { border-color: #bfe3d5; background: var(--brand-2); }
.numcmp .bad { border-color: var(--danger-2); background: #fdf6f6; }

.short-your, .short-model { margin-top: 8px; }
.short-your > span, .short-model > span {
  display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3); margin-bottom: 3px;
}
.short-your p, .short-model p {
  font-size: 14px; line-height: 1.6; padding: 10px 13px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); white-space: pre-wrap;
}
.short-model p { background: var(--brand-2); border-color: #cfe8de; color: var(--brand-ink); }
.rubric { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rub {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line);
}
.rub.hit { background: var(--brand-2); border-color: #bfe3d5; color: var(--brand-ink); }
.rub.miss { background: #fdf6f6; border-color: var(--danger-2); color: var(--danger); }

@media (max-width: 560px) {
  .je-head { display: none; }
  /* account name on its own line, debit and credit side by side under it */
  .je-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 24px; gap: 6px; }
  .je-row .je-acct { grid-column: 1 / -1; }
  .je-row .je-del { grid-row: 2; grid-column: 3; }
  .je-row input { height: 38px; padding: 0 8px; font-size: 13.5px; }
  .je-row { padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px dashed var(--line); }
  .short-foot { flex-direction: column; gap: 2px; }
}
