/* OD-LAYOUT-PRIMITIVES v1 — structure only: display, flex/grid, overflow, wrapping, ratio, geometry.
   Put this @layer first; product CSS outside the layer always wins. */
@layer od-layout {
  :where(.od-stack,.od-row,.od-row-top,.od-cluster,.od-grid,.od-field,.od-stat,.od-cell,.od-tile) > :where(*) { min-width: 0; }

  /* containers */
  .od-stack   { display: flex; flex-direction: column; gap: var(--od-gap, 8px); }
  .od-row     { display: flex; align-items: center; gap: var(--od-gap, 8px); }
  .od-row-top { display: flex; align-items: flex-start; gap: var(--od-gap, 8px); }
  .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); }
  .od-fill    { flex: 1 1 0; min-width: 0; }
  .od-fixed   { flex: none; }
  .od-grid    { display: grid; gap: var(--od-gap, 12px); grid-template-columns: repeat(var(--od-cols, 3), minmax(0, 1fr)); }

  /* stacked information: each piece is its own line — never sibling inline spans */
  .od-stat, .od-field, .od-cell { display: grid; gap: var(--od-gap, 2px); }
  :where(.od-stat,.od-field,.od-cell) > :where(*) { display: block; }
  .od-tile { display: grid; grid-template-rows: auto 1fr; }
  :where(.od-tile) > :where(*) { display: block; }

  /* media keeps its intrinsic ratio by default; never a distorted or cropped
     cover by accident. height:auto lets the ratio win over an <img height="…">
     attribute. Cropping to a uniform box is an explicit opt-in: set --od-ratio
     AND add .od-media-cover together (per the core rule, only where a crop is
     deliberate — tile thumbs, decorative fills — never on full-frame content). */
  .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); }
  .od-media-cover { object-fit: cover; }

  /* functional inline SVG icons opt into bounded geometry; content SVGs keep their own */
  .od-icon { display: inline-block; inline-size: var(--od-icon-size, 1em); block-size: var(--od-icon-size, 1em); flex: none; }

  /* data text only — authored copy is rewritten to its budget instead */
  .od-truncate { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .od-clamp-2, .od-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .od-clamp-2 { -webkit-line-clamp: 2; }
  .od-clamp-3 { -webkit-line-clamp: 3; }
  .od-lines-2 { min-height: calc(2 * 1.4em); }   /* block-level reservation for a shared baseline */
  .od-nowrap  { white-space: nowrap; }           /* 数字+单位 · 价格+起 · 日期+星期 */
  .od-keep    { word-break: keep-all; overflow-wrap: anywhere; } /* CJK labels break at spaces / <wbr> first */

  /* screen skeleton (optional): bars take their own space, the middle scrolls — no padding guessed for chrome */
  .od-screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
  .od-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }

  /* horizontal rail: the next item peeks at the edge; trailing room survives overflow */
  .od-rail { display: flex; gap: var(--od-gap, 8px); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
             padding-inline: var(--od-rail-pad, 16px); scroll-padding-inline: var(--od-rail-pad, 16px); }
  .od-rail::-webkit-scrollbar { display: none; }
  :where(.od-rail) > :where(*) { flex: none; scroll-snap-align: start; }
  :where(.od-rail) > :where(:last-child) { margin-inline-end: var(--od-rail-pad, 16px); }

  .od-spacer { flex: none; visibility: hidden; pointer-events: none; }
  .od-touch  { min-width: 44px; min-height: 44px; }
}
/* /OD-LAYOUT-PRIMITIVES v1 */


/* ===========================================================================
   Reading Lab · Leveled Readers — design tokens
   Direction "Blue on white": the page is plain white and mostly empty. Blue
   carries emphasis only — level badges, selected states, progress, primary
   buttons and links. Green is demoted to a status colour meaning "right";
   orange means "try again". The artwork brings all the warmth, so the
   interface stays out of its way. Every pair below was contrast-checked in
   both themes; the dark theme has its own values, not derived ones.
   =========================================================================== */
:root {
  --topbar-h: 74px;   /* 顶栏实测高度，筛选条靠它定位 */
  color-scheme: light;

  /* surfaces + ink — white ground, separation by hairline and shadow, not fill */
  --app-bg:      #ffffff;
  --card:        #ffffff;
  --card-2:      #f3f7fd;   /* faint blue, small chips only — never a panel */
  --paper:       #ffffff;
  --line:        #d8e3f3;
  --line-strong: #a9bedd;
  --ink:         #0f1f3d;   /* 16.4:1 on white — blue-black, not black */
  --ink-muted:   #4a5f85;   /* 6.4:1 on white */

  /* the one accent: blue */
  --primary:        #1559d6;   /* white text on it = 6.1:1 */
  --primary-ink:    #ffffff;
  --primary-tint:   #eaf1fe;
  --primary-deep:   #0b3f9e;   /* 9.5:1 on white, 8.3:1 on the tint */
  /* one step darker on hover, two on press — white stays readable throughout
     (6.1 → 9.5 → 12.2) */
  --primary-hover:  #0b3f9e;
  --primary-press:  #0a3178;
  --primary-tint-2: #dbe7fd;   /* the pressed secondary fill */

  /* status, not brand */
  --ok:        #047857;        /* 5.5:1 on white */
  --ok-tint:   #ecfdf5;
  --ok-ink:    #046c4e;        /* 6.1:1 on the tint */
  --warn:      #b45309;        /* 5.0:1 on white */
  --warn-tint: #fff7ed;
  --warn-ink:  #9a3412;        /* 6.9:1 on the tint */
  /* nothing in this prototype destroys anything, so red is reserved rather
     than used — kept so a real error state has a checked value waiting */
  --danger:    #b42318;        /* 6.6:1 on white */
  --danger-tint: #fdeceb;
  --focus:     #0b4fd0;

  /* Robo speaks from a white card with a blue edge, not a coloured block */
  --robo:        #0b3f9e;
  --robo-bubble: #ffffff;
  --robo-line:   #bcd3f7;

  /* One blue for every level A–M: the badge, the selected chip and the page
     bar are all the same accent, and the letter alone says which level it is.
     White on it = 6.1:1. */
  --lv:     var(--primary);
  --lv-ink: var(--primary-ink);

  /* type */
  --font-display: "Baloo 2", "Fredoka", "Segoe UI Variable Display", "Trebuchet MS", system-ui, sans-serif;
  --font-body:    "Nunito", "Segoe UI Variable Text", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  /* rem so the browser's own font-size setting still scales everything */
  --fs-xs: 0.9375rem;  /*  15px default */
  --fs-sm: 1.0625rem;  /*  17px */
  --fs-md: 1.25rem;    /*  20px — interface body floor for 5–10 year olds */
  --fs-lg: 1.4375rem;  /*  23px */
  --fs-read: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem);
  --fs-h2:   clamp(1.4375rem, 1.1rem + 1.2vw, 1.875rem);
  --fs-h1:   clamp(1.6875rem, 1.3rem + 2vw, 2.5rem);
  --lh-body: 1.6;
  --lh-read: 1.75;

  /* spacing — multiples of 4 */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:48px; --s8:64px;

  /* shape + depth */
  --r-s:10px; --r-m:16px; --r-l:22px; --r-pill:999px;
  --shadow-1: 0 1px 2px rgba(15,31,61,.06), 0 2px 8px rgba(15,31,61,.06);
  --shadow-2: 0 2px 4px rgba(15,31,61,.08), 0 10px 24px rgba(15,31,61,.10);

  /* motion */
  --t-fast: 160ms;
  --t-base: 240ms;
  --t-exit: 160ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
  --ease-in:  cubic-bezier(0.5, 0, 0.9, 0.4);

  /* Two different shapes, measured from the files: the PictureBooks covers
     are 600 × 900 (2:3), the interior pages are 660 × 1100 (3:5). */
  --cover-ratio: 600 / 900;
  --page-ratio: 660 / 1100;
  /* the printed paper tone inside the supplied artwork — used only as the
     placeholder behind an image that has not loaded, so there is no white
     flash against the art's own margins */
  --art-paper: #faf8f2;
  --tap: 56px;
}

/* Dark: a deep blue ground with light blue type — the same hue family turned
   inside out, audited on its own rather than derived from the light theme. */
[data-theme="dark"] {
  color-scheme: dark;
  --app-bg:      #0a1526;
  --card:        #11203a;
  --card-2:      #17294a;
  --paper:       #11203a;
  --line:        #24395e;
  --line-strong: #42608f;
  --ink:         #dce9ff;   /* 13.3:1 on card */
  --ink-muted:   #9db3d6;   /* 7.6:1 on card */

  --primary:        #5fa0ff;   /* dark text on it = 7.0:1 */
  --primary-ink:    #04132c;
  --primary-tint:   #16294a;
  --primary-deep:   #9cc4ff;   /* 8.1:1 on the tint */
  /* "deeper" inverts on a dark ground: the press state steps UP in luminance
     so the dark ink keeps its contrast (7.0 → 9.2 → 11.3) */
  --primary-hover:  #84baff;
  --primary-press:  #a8cdff;
  --primary-tint-2: #1d3561;

  --ok:        #4ade80;        /* 9.3:1 on card */
  --ok-tint:   #0e2a1e;
  --ok-ink:    #6ee7a7;        /* 10.0:1 on the tint */
  --warn:      #fcd34d;        /* 11.3:1 on card */
  --warn-tint: #2b2112;
  --warn-ink:  #fcd34d;        /* 11.0:1 on the tint */
  --danger:    #ff9b8a;        /* 8.0:1 on card */
  --danger-tint: #33201d;
  --focus:     #9ecbff;

  --robo:        #9cc4ff;
  --robo-bubble: #11203a;
  --robo-line:   #35507e;

  --lv:     var(--primary);
  --lv-ink: var(--primary-ink);   /* dark ink on the light blue badge = 7.0:1 */

  --shadow-1: 0 1px 2px rgba(0,0,0,.45);
  --shadow-2: 0 2px 6px rgba(0,0,0,.5), 0 12px 28px rgba(0,0,0,.45);
}

/* `data-lv` stays on cards, chips and the reader as a hook: every level now
   resolves to the same --lv, and per-level values would go here if the ramp
   is ever wanted back. */

/* ===========================  base  =========================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--app-bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-h1); line-height: 1.15; margin: 0; }
h2 { font-size: var(--fs-h2); line-height: 1.2;  margin: 0; }
h3 { font-size: var(--fs-lg); line-height: 1.3;  margin: 0; }
p  { margin: 0; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-s);
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s4); top: -200px; z-index: 50;
  background: var(--primary); color: var(--primary-ink);
  padding: var(--s3) var(--s4); border-radius: var(--r-s); font-weight: 700;
}
.skip-link:focus { top: var(--s4); }

#app { height: 100%; }
.view { display: none; height: 100%; }
.view[data-active="true"] { display: grid; grid-template-rows: auto minmax(0,1fr); }
.wrap { width: min(1180px, 100%); margin-inline: auto; padding-inline: var(--s4); }
/* 书架是一片卡片，宽屏上铺满更好看、一屏能多看两本；课程页不跟着放宽 ——
   那里是正文，一行太长反而难读，1180px 已经是舒服的阅读宽度上限。 */
#view-shelf .wrap { width: min(1760px, 100%); }
/* 导语不再卡在 60ch，宽屏上让它把标题右边那片空白填满 */
@media (min-width: 1024px) { .shelf-head__lede { max-width: 78ch; } }

/* ===========================  buttons  =========================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: var(--s3) var(--s5);
  border-radius: var(--r-pill); border: 2px solid transparent;
  background: var(--card); color: var(--ink);
  font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
/* Every button is blue. Primary is a blue fill with white text; secondary is
   white with a blue edge and blue label. Both deepen one step on hover and a
   second on press, and fade when disabled. Nothing here is ever green —
   green only ever reports a right answer. */
.btn--primary {
  background: var(--primary); color: var(--primary-ink);
  border-color: var(--primary); box-shadow: var(--shadow-1);
}
.btn--ghost,
.btn--quiet {
  background: var(--card); border-color: var(--primary); color: var(--primary-deep);
}
.btn--big     { min-height: 64px; padding-inline: var(--s6); font-size: var(--fs-lg); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
@media (hover: hover) {
  .btn--primary:not([disabled]):hover { background: var(--primary-hover); border-color: var(--primary-hover); }
  .btn--ghost:not([disabled]):hover,
  .btn--quiet:not([disabled]):hover { background: var(--primary-tint); border-color: var(--primary-hover); color: var(--primary-hover); }
}
.btn--primary:not([disabled]):active { background: var(--primary-press); border-color: var(--primary-press); transform: translateY(1px); }
.btn--ghost:not([disabled]):active,
.btn--quiet:not([disabled]):active { background: var(--primary-tint-2); border-color: var(--primary-press); color: var(--primary-press); transform: translateY(1px); }

/* compact buttons follow the secondary treatment */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-width: 48px; min-height: 48px; padding: var(--s2) var(--s3);
  border-radius: var(--r-pill); border: 2px solid var(--primary);
  background: var(--card); color: var(--primary-deep); cursor: pointer; font-weight: 700; font-size: var(--fs-sm);
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.icon-btn[disabled] { opacity: .45; cursor: not-allowed; }
@media (hover: hover) {
  .icon-btn:not([disabled]):hover { background: var(--primary-tint); border-color: var(--primary-hover); color: var(--primary-hover); }
}
.icon-btn:not([disabled]):active { background: var(--primary-tint-2); border-color: var(--primary-press); color: var(--primary-press); }

/* ===========================  top bar  =========================== */
.topbar {
  background: var(--card);
  border-bottom: 2px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar__inner { display: flex; align-items: center; gap: var(--s4); min-height: 72px; }
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; color: inherit; }
.brand__mark { inline-size: 44px; block-size: 44px; flex: none; }
.brand__text { display: grid; }
.brand__name { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-md); line-height: 1.1; }
.brand__sub  { font-size: var(--fs-xs); color: var(--ink-muted); line-height: 1.2; }

/* ===========================  shelf  =========================== */
.shelf-head { padding-block: var(--s6) var(--s4); }
.shelf-head h1 { max-width: 20ch; }
.shelf-head__lede { margin-top: var(--s3); color: var(--ink-muted); font-size: var(--fs-md); max-width: 60ch; }

/* 宽屏上标题和导语并排，省下约 90px 的竖向空间 —— 落地页第一屏要先看见书，
   不是先看见一段话。窄屏仍然上下排。 */
@media (min-width: 1024px) {
  .shelf-head {
    display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    align-items: end; column-gap: var(--s7);
    padding-block: var(--s5) var(--s4);
  }
  .shelf-head__lede { margin-top: 0; padding-bottom: 4px; }
  /* 「Pick a level」和级别条并排，再省一行 */
  .filters { padding-block: var(--s2); }
  .filters__label { margin-bottom: 0; padding-block: var(--s1); }
  .filters__row {
    display: block;
    padding-inline: var(--s4) !important;   /* 覆盖内联的 padding-inline:0 */
  }

  /* 29 个级别（All + A–Z + Z1 + Z2）一行排满、不横向滚动。等宽栅格，
     宽度不够时字号和内边距一起收，而不是把后面的级别推出视野 —— 整条梯子
     看得见才是这个控件的意义。窄屏仍然回到可横滑的 rail。 */
  .filters__row .lvrail {
    display: grid; grid-template-columns: repeat(29, minmax(0, 1fr));
    gap: clamp(3px, .45vw, 8px);
    overflow: visible; --od-rail-pad: 0px;
  }
  .filters__row .lvchip {
    min-width: 0; min-height: 44px;
    padding: 4px 2px; border-radius: var(--r-s);
  }
  .filters__row .lvchip__key { font-size: clamp(12px, 1.05vw, 17px); }
  .filters__row .lvchip__n   { font-size: clamp(9px, .62vw, 12px); line-height: 1.1; }
  /* 「All」那格的「13 books」在 1/29 宽里放不下，只留数字 */
  .filters__row .lvchip[data-lv] + .lvchip,
  .filters__row .lvchip:first-child .lvchip__n { font-size: clamp(9px, .62vw, 12px); }
}

/* 六步流程：替掉原先那段导语。六个小块平铺，一眼扫完就知道一节课怎么上。 */
.flow {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--s3) var(--s4);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.flow__step { display: flex; align-items: flex-start; gap: var(--s2); min-width: 0; }
.flow__n {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 22px; text-align: center;
}
.flow__body { display: grid; gap: 1px; min-width: 0; }
.flow__name { font-size: var(--fs-sm); font-weight: 800; line-height: 1.25; }
.flow__hint { font-size: var(--fs-xs); color: var(--ink-muted); line-height: 1.35; }

/* 还没有书的级别：看得见梯子有多长，但点不动 */
.lvchip[data-empty="true"] { opacity: .38; cursor: default; }
.lvchip[data-empty="true"] .lvchip__n { opacity: .8; }
@media (min-width: 1024px) {
}

/* sticky inside the shelf scroll area — the top bar is a grid row outside it,
   so this offsets from 0, not from the bar's height. */
/* 筛选条跟着滚动停在顶栏下面。原来 top:0 且 z-index 低于顶栏，一滚就钻到
   顶栏底下看不见了 —— 书架有十几本时，换级别得先滚回顶部，很别扭。 */
.filters { position: sticky; top: var(--topbar-h, 74px); z-index: 10; background: var(--app-bg); padding-block: var(--s3); border-bottom: 2px solid var(--line); }
.filters__label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-muted); padding-inline: var(--s4); margin-bottom: var(--s2); }
.lvrail { --od-gap: 10px; --od-rail-pad: 16px; padding-block: var(--s1); }
.lvchip {
  --lv: var(--primary);
  display: grid; grid-template-rows: auto auto; justify-items: center; align-content: center; gap: 0;
  min-width: 56px; min-height: 56px; padding: var(--s2) var(--s3);
  border-radius: var(--r-m); cursor: pointer;
  border: 2px solid var(--line);
  background: var(--card); color: var(--ink);
  font-family: var(--font-display); font-weight: 800;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.lvchip__key { display: block; font-size: var(--fs-lg); line-height: 1.1; }
.lvchip__n   { display: block; font-size: 13px; font-weight: 700; color: var(--ink-muted); line-height: 1.2; }
.lvchip[aria-pressed="true"] {
  background: var(--lv); border-color: var(--lv); color: var(--lv-ink);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.18);
}
.lvchip[aria-pressed="true"] .lvchip__n { color: var(--lv-ink); opacity: .85; }
@media (hover: hover) { .lvchip:hover { border-color: var(--lv); } }

/* The covers are full-bleed and very saturated, so the grid runs wide gutters:
   white space between them is what stops the shelf turning into one blur. */
.grid-books {
  --od-cols: 2; --od-gap: var(--s5);
  padding-block: var(--s5) var(--s8);
}
@media (min-width: 640px)  { .grid-books { --od-cols: 3; --od-gap: var(--s6); } }
@media (min-width: 1024px) { .grid-books { --od-cols: 4; --od-gap: var(--s6); } }
/* 超宽屏上继续按 4 栏会把卡片撑到 450px 一张，大得失真；改成多放一张，
   卡片维持在 330px 上下，空白才真正被书填满而不是被放大的书填满。 */
@media (min-width: 1700px) { .grid-books { --od-cols: 5; } }

.card {
  position: relative;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-1); overflow: hidden;
  color: var(--ink); text-decoration: none;
  text-align: left; padding: 0; cursor: pointer; width: 100%;
  transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out);
}
@media (hover: hover) { .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--lv); } }
.card:active { transform: translateY(0); }
/* The artwork runs edge to edge and already carries the book's title, so the
   cover is never overprinted — the title lives in the body below. */
.card__cover { position: relative; background: var(--art-paper); border-bottom: 2px solid var(--line); }
/* 封面统一按 2:3 的框裁切填满：13 张封面高 504~702 不等，不统一的话同一行里
   卡片高矮不齐、信息块对不上。整齐优先于"每张完整"——裁掉的是上下边缘，
   画面主体都在中间。 */
.card__cover { position: relative; display: block; aspect-ratio: var(--cover-ratio); overflow: hidden; }
.card__img { display: block; width: 100%; height: 100%;
             aspect-ratio: auto; object-fit: cover; background: var(--art-paper); }

.card__blurbbox { display: block; }   /* keeps .od-clamp-3 out of the grid, so the clamp survives */

/* How far this book has been read. Only rendered once a book has been opened,
   so an untouched shelf stays quiet. The bar is blue like every other progress
   indicator — the state is spelled out in the label, never carried by colour. */
.card__progress { display: grid; gap: var(--s2); margin-top: var(--s1); }
.card__bar {
  display: block; height: 8px; border-radius: var(--r-pill);
  background: var(--line); overflow: hidden;
}
.card__bar i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .25s ease; }
.card__progress-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 800; color: var(--primary-deep);
}
.card__progress-label .od-icon { --od-icon-size: 16px; }
.card__progress[data-done="true"] .card__bar i { background: var(--primary-deep); }
/* The badge's own solid fill carries the text contrast; the white ring and the
   drop shadow cut it out of whatever the art does underneath — sky blue, grass
   green, sunset orange. No scrim over the picture: dimming the art to serve the
   badge is backwards. */
.card__badge {
  position: absolute; bottom: var(--s3); left: var(--s3);
  display: grid; justify-items: center; gap: 0;
  min-width: 52px; padding: var(--s1) var(--s2);
  background: var(--lv); color: var(--lv-ink); border-radius: var(--r-s);
  box-shadow: 0 0 0 3px var(--card), 0 2px 6px rgba(15, 31, 61, .45);
  font-family: var(--font-display); font-weight: 800;
}
.card__badge b { display: block; font-size: var(--fs-lg); line-height: 1.05; }
.card__badge span { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .9; line-height: 1.2; }
.card__body { display: grid; gap: var(--s2); padding: var(--s5) var(--s4) var(--s4); }
.card__title { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; line-height: 1.2; }
.card__meta { --od-gap: var(--s2); font-size: var(--fs-xs); color: var(--ink-muted); }
.card__blurb { font-size: var(--fs-sm); color: var(--ink-muted); line-height: 1.5; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: var(--r-pill);
  background: var(--primary-tint); color: var(--primary-deep);
  font-size: 13px; font-weight: 800; letter-spacing: .02em;
}
.empty-note {
  grid-column: 1 / -1; padding: var(--s6);
  background: var(--card); border: 2px dashed var(--line-strong); border-radius: var(--r-l);
  color: var(--ink-muted); text-align: center;
}

/* ===========================  lesson shell  =========================== */
.lesson { grid-template-rows: auto minmax(0,1fr) auto !important; }
.lesson__bar { background: var(--card); border-bottom: 2px solid var(--line); position: sticky; top: 0; z-index: 20; }
.lesson__barinner { display: grid; gap: var(--s3); padding-block: var(--s3); }
.lesson__head { --od-gap: var(--s3); }
.lesson__book { display: grid; gap: 0; }
.lesson__title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-md); line-height: 1.2; }
.lesson__sub { font-size: var(--fs-xs); color: var(--ink-muted); }

.steps { --od-gap: var(--s1); list-style: none; margin: 0; padding: 0; display: flex; }
.steps li { flex: 1 1 0; min-width: 0; }
.step {
  position: relative; width: 100%; display: grid; gap: 6px; justify-items: center;
  background: none; border: 0; padding: var(--s2) 2px var(--s1); cursor: pointer; border-radius: var(--r-s);
  color: var(--ink-muted); font-size: 13px; font-weight: 700; font-family: var(--font-body);
}
.step__dot {
  display: grid; place-items: center;
  inline-size: 34px; block-size: 34px; border-radius: var(--r-pill);
  border: 3px solid var(--line-strong); background: var(--card);
  font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--ink-muted);
  transition: background-color var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}
.step__label { display: block; max-width: 100%; }
.step[data-state="done"] { color: var(--primary-deep); }
.step[data-state="done"] .step__dot { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.step[data-state="now"] { color: var(--ink); }
.step[data-state="now"] .step__dot { border-color: var(--primary); background: var(--card); color: var(--primary-deep); box-shadow: 0 0 0 4px var(--primary-tint); }
.step[disabled] { cursor: not-allowed; opacity: .75; }
.step__bar { position: absolute; inset-block-start: 19px; inset-inline-start: 50%; width: 100%; height: 4px; background: var(--line); z-index: -1; }
.steps li:last-child .step__bar { display: none; }
.step[data-state="done"] .step__bar { background: var(--primary); }
@media (max-width: 600px) { .step__label { display: none; } .steps { --od-gap: 0; } }
/* 窄屏上这行小字会折成三四行，把顶栏撑到半屏高，插图被挤到折叠线以下。
   书名留着，这行压成一行截断——级别和页数在书架卡片上已经看过一遍了。 */
@media (max-width: 600px) {
  .lesson__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lesson__sub   { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand__name, .brand__sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

.progress-meter { height: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.progress-meter i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width var(--t-base) var(--ease-out); }

.stage-scroll { padding-block: var(--s5) var(--s7); }
.stage { display: grid; gap: var(--s5); animation: rise var(--t-base) var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.stage__head { display: grid; gap: var(--s2); }
.eyebrow { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--primary-deep); }

.lesson__foot { background: var(--card); border-top: 2px solid var(--line); }
.lesson__footinner { --od-gap: var(--s3); padding-block: var(--s3); }
.foot-note { font-size: var(--fs-sm); color: var(--ink-muted); }

/* ===========================  Robo  =========================== */
.robo { --od-gap: var(--s3); }
.robo__avatar { inline-size: 64px; block-size: 64px; flex: none; }
.robo__avatar--lg { inline-size: 104px; block-size: 104px; }
.say {
  position: relative; flex: 1 1 auto;
  background: var(--robo-bubble); border: 2px solid var(--robo-line);
  border-radius: var(--r-l); border-top-left-radius: var(--s1);
  padding: var(--s4); color: var(--ink); font-size: var(--fs-md); line-height: 1.55;
}
.say strong { color: var(--robo); }
.say__who { display: block; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--robo); margin-bottom: var(--s1); }
.say p + p { margin-top: var(--s2); }
/* green only ever means "you got it"; orange only ever means "try again" */
.say--ok { background: var(--ok-tint); border-color: var(--ok); }
.say--ok .say__who, .say--ok strong { color: var(--ok-ink); }
.say--try { background: var(--warn-tint); border-color: var(--warn); }
.say--try .say__who, .say--try strong { color: var(--warn-ink); }

/* ===========================  panels  =========================== */
.panel {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-l);
  padding: var(--s5); display: grid; gap: var(--s4);
}
.panel--tight { padding: var(--s4); gap: var(--s3); }
.panel__title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg); }
.hint { font-size: var(--fs-sm); color: var(--ink-muted); }

.field { display: grid; gap: var(--s2); }
.field > label { font-weight: 800; font-size: var(--fs-md); }
.field__help { font-size: var(--fs-sm); color: var(--ink-muted); }
.input, .textarea {
  width: 100%; min-height: var(--tap); padding: var(--s3) var(--s4);
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--line-strong); border-radius: var(--r-m);
  font-size: var(--fs-md); line-height: 1.5;
}
.textarea { min-height: 112px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-muted); opacity: .8; }
.input:focus, .textarea:focus { border-color: var(--primary); }

.chipgrid { --od-cols: 1; --od-gap: var(--s2); }
@media (min-width: 560px) { .chipgrid { --od-cols: 2; } }
@media (min-width: 900px) { .chipgrid { --od-cols: 3; } }
/* white at rest — the blue arrives only once a chip is chosen */
.ideachip {
  display: grid; gap: 2px; text-align: left;
  min-height: var(--tap); padding: var(--s3) var(--s4);
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-m);
  color: var(--ink); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.ideachip b { display: block; font-family: var(--font-display); font-size: var(--fs-md); color: var(--primary-deep); }
.ideachip span { display: block; font-size: var(--fs-xs); color: var(--ink-muted); line-height: 1.35; }
.ideachip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-tint); }
.ideachip[aria-pressed="true"] b::after { content: " ✓"; }
@media (hover: hover) { .ideachip:hover { border-color: var(--primary); } }

/* ===========================  words  =========================== */
.wordlist { display: grid; gap: var(--s4); }
@media (min-width: 760px) { .wordlist { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.word {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-l);
  padding: var(--s4); display: grid; gap: var(--s3);
}
.word__top { --od-gap: var(--s3); }
.word__w { font-family: var(--font-display); font-weight: 800; font-size: clamp(26px, 5vw, 32px); line-height: 1.1; }
.word__say { display: block; font-size: var(--fs-xs); letter-spacing: .14em; color: var(--ink-muted); font-weight: 800; }
.word__pos { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); background: var(--card-2); color: var(--ink-muted); font-size: 13px; font-weight: 800; }
.word__d { font-size: var(--fs-md); }
.word__ex { font-size: var(--fs-sm); color: var(--ink-muted); font-style: italic; }
.word__more { display: grid; gap: var(--s2); border-top: 2px dashed var(--line); padding-top: var(--s3); }
.word__swap { font-size: var(--fs-sm); }
.word__swap b { color: var(--primary-deep); }
.syn { --od-gap: var(--s2); }
.syn__label { font-size: var(--fs-xs); font-weight: 800; color: var(--ink-muted); }
.syn__pill {
  display: inline-block; padding: 2px 10px; border-radius: var(--r-pill);
  background: var(--card-2); color: var(--ink); font-size: 14px; font-weight: 700;
}
.speak {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-width: 56px; min-height: 56px; padding: var(--s2) var(--s4);
  border-radius: var(--r-pill); border: 2px solid var(--primary); background: var(--card);
  color: var(--primary-deep); font-weight: 800; font-size: var(--fs-sm); cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.speak .od-icon { --od-icon-size: 22px; }
.speak[data-on="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
@media (hover: hover) { .speak:hover { background: var(--primary-tint); border-color: var(--primary-hover); color: var(--primary-hover); } }
.speak:active { background: var(--primary-tint-2); border-color: var(--primary-press); color: var(--primary-press); }

.quizbox { display: grid; gap: var(--s4); }
.qline { --od-gap: var(--s3); font-size: var(--fs-sm); color: var(--ink-muted); font-weight: 700; }
.q { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.3; }
.options { display: grid; gap: var(--s3); }
.option {
  display: flex; align-items: center; gap: var(--s3); text-align: left;
  min-height: 64px; padding: var(--s3) var(--s4);
  background: var(--card); border: 2px solid var(--line-strong); border-radius: var(--r-m);
  color: var(--ink); font-size: var(--fs-lg); font-weight: 700; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.option__key {
  display: grid; place-items: center; flex: none;
  inline-size: 36px; block-size: 36px; border-radius: var(--r-pill);
  background: var(--card-2); color: var(--ink-muted); font-family: var(--font-display); font-weight: 800; font-size: 17px;
}
.option__text { flex: 1 1 auto; min-width: 0; }
.option__mark { flex: none; font-weight: 800; font-size: var(--fs-sm); }
@media (hover: hover) { .option:not([disabled]):hover { border-color: var(--primary); background: var(--primary-tint); } }
.option[data-state="right"] { border-color: var(--ok); background: var(--ok-tint); }
.option[data-state="right"] .option__key { background: var(--ok); color: var(--card); }
.option[data-state="wrong"] { border-color: var(--warn); background: var(--warn-tint); }
.option[data-state="wrong"] .option__key { background: var(--warn); color: var(--card); }
.option[disabled] { cursor: default; }

/* ===========================  read · picture-book reader  ===========================
   One screen is one page of the book: the whole illustration, then the same
   sentence set large underneath so it can be tapped, glossed and read aloud. */
.reader { display: grid; gap: var(--s5); align-items: start; }
@media (min-width: 900px) { .reader { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); } }

.pagesheet {
  background: var(--art-paper); border: 2px solid var(--line); border-radius: var(--r-m);
  overflow: hidden; box-shadow: var(--shadow-2);
  transition: box-shadow var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out);
}
.pagesheet img { --od-ratio: var(--page-ratio); }
/* the same sheet treatment holding a cover instead of an interior page */
.pagesheet--cover img { --od-ratio: var(--cover-ratio); object-fit: cover; }
.pagesheet__cap { padding: var(--s2) var(--s3); font-size: 13px; color: var(--ink-muted); background: var(--card); border-top: 2px solid var(--line); }
.pagesheet[data-turned="true"] { border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-tint), var(--shadow-2); }
.page-turn { animation: pageIn var(--t-base) var(--ease-out) both; }
@keyframes pageIn { from { opacity: 0; transform: translateX(var(--turn-from, 14px)); } to { opacity: 1; transform: none; } }

.reader__side { display: grid; gap: var(--s4); }
.reader__meta { --od-gap: var(--s3); font-size: var(--fs-sm); color: var(--ink-muted); font-weight: 700; }
.reader__count { font-variant-numeric: tabular-nums; }
.pagebar { height: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.pagebar i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width var(--t-base) var(--ease-out); }

.readline {
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--r-l);
  padding: var(--s5); display: grid; gap: var(--s3);
}
.readline__label { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-deep); }
.readline__text { font-size: var(--fs-read); line-height: var(--lh-read); }
.readline[data-evidence="true"] {
  background: var(--warn-tint); border-color: var(--warn);
  animation: pulse 900ms var(--ease-out) 2;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 60%, transparent); }
  50%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--warn) 0%, transparent); }
}
.turnback-note {
  display: grid; gap: var(--s2);
  background: var(--warn-tint); border: 2px solid var(--warn); border-radius: var(--r-m);
  padding: var(--s4);
}
.turnback-note b { color: var(--warn-ink); }

.reader__nav { --od-gap: var(--s3); }
.reader__nav .btn { flex: 1 1 0; min-width: 0; }
/* horizontal swipe turns pages; the browser keeps vertical scrolling */
.pagesheet { touch-action: pan-y; }

/* ---- all-pages thumbnail grid ---- */
.thumbs {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  margin-top: var(--s3);
}
.thumb {
  display: grid; gap: 2px; padding: 0; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-s);
  overflow: hidden; color: var(--ink-muted); font-size: 12px; font-weight: 800;
  transition: border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.thumb img { --od-ratio: var(--page-ratio); background: var(--art-paper); }
.thumb span { display: block; padding: 2px 0 4px; }
.thumb[aria-current="true"] { border-color: var(--primary); color: var(--primary-deep); box-shadow: 0 0 0 2px var(--primary-tint); }
.thumb[disabled] { opacity: .35; cursor: not-allowed; }
.thumb[disabled] img { filter: grayscale(1); }
@media (hover: hover) { .thumb:not([disabled]):hover { border-color: var(--primary-hover); transform: translateY(-2px); } }
.thumbs-note { margin-top: var(--s3); font-size: var(--fs-xs); color: var(--ink-muted); }

/* ---- "read page N again" links in the report ---- */
.pagelink {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: var(--s1) var(--s3);
  background: var(--card); border: 2px solid var(--primary); border-radius: var(--r-pill);
  color: var(--primary-deep); font: inherit; font-weight: 800; font-size: var(--fs-sm); cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.pagelink .od-icon { --od-icon-size: 18px; }
@media (hover: hover) { .pagelink:hover { background: var(--primary-tint); border-color: var(--primary-hover); color: var(--primary-hover); } }
.pagelink:active { background: var(--primary-tint-2); border-color: var(--primary-press); color: var(--primary-press); }
.gl {
  border: 0; background: none; padding: 0 1px; font: inherit; color: inherit; cursor: help;
  border-bottom: 3px dotted var(--primary); border-radius: 2px;
}
@media (hover: hover) { .gl:hover { background: var(--primary-tint); } }
.gloss-pop {
  margin-top: var(--s3); padding: var(--s3) var(--s4);
  background: var(--primary-tint); border: 2px solid var(--primary); border-radius: var(--r-m);
  font-size: var(--fs-sm);
}
.gloss-pop b { font-family: var(--font-display); font-size: var(--fs-md); color: var(--primary-deep); }

.checkpoint { display: grid; gap: var(--s4); border-top: 3px dashed var(--line-strong); padding-top: var(--s4); }
.answerrow { --od-gap: var(--s3); }
.answerrow .input { flex: 1 1 220px; }

/* ===========================  create  =========================== */
.frames { display: grid; gap: var(--s4); }
@media (min-width: 760px) { .frames { grid-template-columns: repeat(3, minmax(0,1fr)); } }
/* the learner's own page: white like everything else, marked out by a blue edge */
.preview {
  display: grid; gap: var(--s3);
  background: var(--card); border: 2px solid var(--primary); border-radius: var(--r-l);
  padding: var(--s5); color: var(--ink);
}
.preview__head { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h2); line-height: 1.2; }
.preview__row { --od-gap: 2px; }
.preview__label { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .04em; color: var(--primary-deep); }
.preview__value { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-read); line-height: 1.35; overflow-wrap: anywhere; }
.preview__value.blank { font-family: var(--font-body); font-weight: 600; color: var(--ink-muted); font-style: italic; border-bottom: 3px dashed var(--line-strong); }

/* ===========================  report  =========================== */
.stats { --od-cols: 2; --od-gap: var(--s4); }
@media (min-width: 760px) { .stats { --od-cols: 4; } }
.stat {
  --od-gap: var(--s1);
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-l); padding: var(--s4);
}
.stat__n { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 6vw, 40px); line-height: 1.05; color: var(--primary-deep); }
.stat__c { font-size: var(--fs-xs); color: var(--ink-muted); font-weight: 700; }
.listy { display: grid; gap: var(--s3); margin: 0; padding: 0; list-style: none; }
.listy li { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--fs-md); }
.listy .od-icon { --od-icon-size: 26px; margin-top: 2px; }
.listy .ok   { color: var(--ok-ink); }
.listy .next { color: var(--warn-ink); }
.wordpills { --od-gap: var(--s2); }
.wordpill {
  display: inline-block; padding: var(--s1) var(--s3); border-radius: var(--r-pill);
  background: var(--ok-tint); color: var(--ok-ink); font-weight: 800; font-size: var(--fs-sm);
}
.wordpill--next { background: var(--warn-tint); color: var(--warn-ink); }

details.tip { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-m); padding: var(--s3) var(--s4); }
details.tip > summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; gap: var(--s2); }
details.tip > summary::marker { color: var(--primary); }
details.tip p { margin-top: var(--s2); font-size: var(--fs-sm); color: var(--ink-muted); }

/* ===========================  misc  =========================== */
.toast {
  position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%);
  background: var(--ink); color: var(--app-bg); padding: var(--s3) var(--s5);
  border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-sm);
  box-shadow: var(--shadow-2); z-index: 60;
  animation: rise var(--t-base) var(--ease-out) both;
}
.sr-status { font-size: var(--fs-sm); color: var(--ink-muted); }

/* ===========================================================================
   Narrow screens (375px is the reference). Content is reorganised, never
   cropped: the lesson footer stacks so the primary action gets the full width,
   the bar buttons drop their labels but keep their accessible names, and the
   reading column gives its width back to the words.
   =========================================================================== */
@media (max-width: 560px) {
  .wrap { padding-inline: var(--s3); }
  .lvrail { --od-rail-pad: 12px; }

  .topbar__inner { min-height: 64px; gap: var(--s2); }
  :root, body { --topbar-h: 66px; }
  .brand__sub { display: none; }
  .icon-btn .theme-label,
  .icon-btn .voice-label,
  #to-shelf span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* the shelf stays two-up and scannable: the blurb moves to the Hello screen */
  .card__title { font-size: var(--fs-md); }
  .card__blurb { display: none; }

  /* 窄屏上流程只留编号和名字：六条说明文字堆起来有 200px 高，会把书挤出首屏 */
  .flow__hint { display: none; }
  .flow { gap: var(--s2) var(--s3); grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }

  .lesson__footinner { flex-direction: column; align-items: stretch; }
  .lesson__footinner .btn { width: 100%; }
  .foot-note { font-size: var(--fs-xs); order: -1; }

  /* early readers get big type; at this width that trades line length for
     letter size on purpose, so claw some width back from the padding */
  :root { --fs-read: 1.25rem; }
  .readline, .panel { padding: var(--s4); }
  .readline__text { line-height: 1.7; }
  .stage { gap: var(--s4); }
  /* the page art leads on a phone; the sentence sits right under it */
  .reader { gap: var(--s4); }
  .reader__nav .btn { padding-inline: var(--s3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}

/* 本站字体栈：不取外部字体，只用设备已有的 */
:root{
  --font-display: "Baloo 2", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Nunito", -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

/* ---------------------------------------------------------- 语音设置面板 */
/* 朗读关掉时，所有发声按钮整个撤掉 —— 留一个点了没反应的按钮，
   对这个年纪的孩子比按钮消失更难理解。 */
:root[data-voice="off"] .speak { display: none; }

.vpanel {
  position: fixed; z-index: 60; width: min(280px, calc(100vw - 24px));
  display: grid; gap: var(--s4);
  padding: var(--s4); border-radius: var(--r-m);
  background: var(--card); border: 2px solid var(--line);
  box-shadow: 0 12px 32px rgba(15, 31, 61, .18);
}
.vpanel[data-off="true"] .vrow:not(:first-child) { opacity: .45; pointer-events: none; }
.vrow { display: flex; align-items: center; gap: var(--s3); }
.vrow--col { display: grid; gap: var(--s2); }
.vrow__label { font-weight: 700; font-size: var(--fs-sm); }

.vswitch {
  flex: none; width: 46px; height: 26px; padding: 3px; border: 0; cursor: pointer;
  border-radius: 99px; background: var(--line); transition: background .18s ease;
}
.vswitch > i { display: block; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s ease; }
.vswitch[aria-checked="true"] { background: var(--primary); }
.vswitch[aria-checked="true"] > i { transform: translateX(20px); }

.vsegs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.vseg {
  min-height: 40px; padding: var(--s2) var(--s3); cursor: pointer;
  border-radius: var(--r-s); border: 2px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 700;
}
.vseg[data-on="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }

.vrate__val { font-variant-numeric: tabular-nums; color: var(--primary); }
.vrate__in { width: 100%; accent-color: var(--primary); height: 28px; }
.vrate__ends { font-size: var(--fs-xs); color: var(--ink-muted); }
.vrate__ends--r { text-align: right; }
.vlink {
  border: 0; background: none; cursor: pointer; padding: 2px 6px;
  color: var(--primary); font: inherit; font-size: var(--fs-xs); font-weight: 700;
  text-decoration: underline; text-underline-offset: 2px;
}

/* Levels N-Z2 have no page art: keep the sheet's shape so the text does not
   jump when a reader moves between an illustrated book and a text-only one. */
.pagesheet__noart { display: block; min-height: 0; }
.thumb__noart { display: block; width: 100%; aspect-ratio: 3 / 2;
  background: var(--surface-2, #eef1f6); border-radius: var(--r2, 8px); }

/* Typographic cover for the levels that ship without cover art. Same 2:3 box
   as a real cover so the uniform-height grid is unaffected. */
.card__img--text {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: var(--s2, 6px); width: 100%; height: 100%; padding: 12% 10%;
  text-align: center; box-sizing: border-box;
  background: linear-gradient(160deg, var(--primary-deep, #1f3b63), var(--primary, #2f6fb5));
  color: #fff;
}
.card__imgtitle {
  font-weight: 800; line-height: 1.22; font-size: clamp(13px, 1.5vw, 19px);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card__imglv { font-size: clamp(10px, .95vw, 13px); font-weight: 700; opacity: .82;
  letter-spacing: .06em; text-transform: uppercase; }

/* 合规层：AI 内容标识与连续使用提醒。只有 config.js 打开 compliance 时才会出现。 */
.ai-tag {
  margin: var(--s2, 6px) 0 0; font-size: 12px; line-height: 1.4;
  color: var(--muted, #667); opacity: .85;
}
.ai-tag::before { content: "ⓘ "; }
.usage-note {
  position: fixed; left: 50%; bottom: calc(var(--s5, 20px) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 9999;
  display: flex; align-items: center; gap: var(--s4, 14px);
  max-width: min(520px, calc(100vw - 32px));
  padding: var(--s3, 10px) var(--s4, 14px);
  background: var(--surface, #fff); color: var(--ink, #1b2330);
  border: 1px solid var(--line, #d8dee8); border-radius: var(--r3, 12px);
  box-shadow: 0 8px 28px rgba(16, 24, 40, .16);
}
.usage-note p { margin: 0; font-size: 15px; }
