/* ==========================================================================
   MI Drive · Commercial Design System  —  unified visual layer
   --------------------------------------------------------------------------
   Purpose: bring every page back to ONE visual system derived from the home
   page (warm off-white #f6f5f1 + deep pine green #2f8f54). Loaded last, so it
   only overrides colour / elevation / interaction — never layout, never the
   home hero composition, never the data layer.

   Design rules applied:
   · ONE accent hue. No orange / purple / cyan stage colours, no rainbow icons.
   · Stage differentiation by LIGHTNESS within the same green hue, not by hue.
   · Tinted shadows (shadow colour follows the warm-ink background hue).
   · One radius scale, one type-weight scale, one motion curve.
   · Full interaction cycle: hover / active / focus-visible / disabled.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens — single source of truth
   -------------------------------------------------------------------------- */
:root {
  /* Brand ramp: one hue, five steps. Used for stages, badges and progress. */
  --brand-50:  #f0f7f1;
  --brand-100: #e2f0e5;
  --brand-200: #cbe3cf;
  --brand-300: #9fcca9;
  --brand-400: #63bb78;
  --brand-500: #3f9160;
  --brand-600: #2f8f54;
  --brand-700: #277946;
  --brand-800: #1e663b;
  --brand-900: #174f2e;

  /* Neutral warm ramp — never mix cool and warm greys. */
  --paper:      #fffdfa;
  --canvas:     #f6f5f1;
  --canvas-alt: #f0f4ed;
  --hairline:   #dde4da;
  --hairline-2: #e9eee6;
  --ink:        #1f2a24;
  --ink-2:      #435148;
  --ink-3:      #6a766e;

  /* Semantic — all desaturated, all belonging to the same family. */
  --ok:        #2c7a4d;
  --ok-soft:   #e5f2e7;
  --caution:   #8a6a1e;
  --caution-soft: #f7efd8;
  --critical:  #b85145;
  --critical-soft: #f9ebe8;

  /* Radius scale */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Elevation — tinted, layered, no outer glow */
  --shadow-1: 0 1px 2px rgba(31,42,36,.035), 0 4px 14px rgba(31,42,36,.045);
  --shadow-2: 0 2px 6px rgba(31,42,36,.05),  0 14px 34px rgba(31,42,36,.085);
  --shadow-3: 0 18px 52px rgba(31,42,36,.15);
  --shadow-brand: 0 10px 28px rgba(31,102,59,.16);

  /* Motion */
  --ease: cubic-bezier(.22,.61,.36,1);
  --t-fast: .14s;
  --t: .2s;
}

/* Keep the established home palette exactly as-is; only add derived tokens. */
html:not([data-theme="dark"]) {
  --green:   #2f8f54;
  --green-d: #277946;
  --green2:  #63bb78;
  --lime:    #dceac7;
  --ink:     #1f2a24;
  --muted:   #6a766e;
  --bg:      #f6f5f1;
  --panel:   #fffdfa;
  --line:    #dde4da;
  --soft:    #f0f4ed;
  --danger:      #b85145;
  --danger-soft: #f9ebe8;
  --warn:        #8a6a1e;
  --warn-soft:   #f7efd8;
  --surface-tint: #eef5ed;
  --focus-ring:   #2f8f54;
  --desk-accent:  #2f8f54;
  --desk-pale:    #e2f0e5;
  --desk-pine:    #1e663b;
  --shadow-soft:  var(--shadow-1);
  --shadow-float: var(--shadow-3);
}

/* --------------------------------------------------------------------------
   2. Type — one weight scale, tabular figures everywhere numbers matter
   -------------------------------------------------------------------------- */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body, button, input, select { font-family: Inter, "PingFang SC", "Hiragino Sans GB",
  "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; }

.pagehead h1, .chapter-overview h2, .study-report h2, .benefits h2,
.order-ledger h2, .record-summary h2, .section-title h2,
.plan-section-head h2, .member-details h2 { font-weight: 700; }
h2, h3, b, strong { letter-spacing: -.015em; }
.metric, .score, .price, .plan-price, .offer-price, .review-overview strong,
.report-totals strong, .stamp-count strong, .chapter-meter,
.paper-cover-no, .catalog-score, .q-counter, .qnum, #readinessPct,
.paper-route-count, .paper-route-total, .paper-best,
.entitle-chip, .exam-specs, .stat b, .tag, .badge {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   3. Surfaces — elevation communicates hierarchy
   -------------------------------------------------------------------------- */
.card, .question, .qside, .dialog, .device, .stat, .row, .offer,
.review-overview, .record-insights > div, .scene-group {
  border-color: var(--hairline);
  box-shadow: var(--shadow-1);
}
.card, .question, .qside, .dialog, .device, .stat, .row { border-radius: var(--r-lg); }
.card.hero, .question, .qside { border-radius: var(--r-xl); }
.dialog { box-shadow: var(--shadow-3); }

/* Home hero and mock card: keep their exact colours, add only craft. */
.hero-home, .mock-card { border-radius: var(--r-xl); }
.mock-card { box-shadow: var(--shadow-brand); }

/* --------------------------------------------------------------------------
   4. Controls — one shape, one press behaviour, one focus ring
   -------------------------------------------------------------------------- */
.btn {
  border-radius: var(--r-sm);
  font-weight: 650;
  letter-spacing: -.005em;
  transition: transform var(--t-fast) var(--ease),
              box-shadow var(--t) var(--ease),
              background-color var(--t) var(--ease),
              border-color var(--t) var(--ease),
              color var(--t) var(--ease), filter var(--t) var(--ease);
}
.btn.primary {
  background: linear-gradient(180deg, #338f57 0%, #2b814d 100%);
  border-color: #2b814d;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 4px 12px rgba(31,102,59,.14);
}
.btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #2f8a52 0%, #257446 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.16) inset, 0 8px 20px rgba(31,102,59,.22);
  transform: translateY(-1px);
}
.btn.secondary { background: var(--brand-100); border-color: var(--brand-200); color: #245331; }
.btn.secondary:hover:not(:disabled) { background: var(--brand-200); transform: translateY(-1px); }
.btn.ghost { border-color: var(--hairline); background: var(--paper); }
.btn.ghost:hover:not(:disabled) {
  border-color: var(--brand-300); background: var(--brand-50); transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.btn.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #a8483d; box-shadow: 0 6px 18px rgba(184,81,69,.22); }
.btn.warn { background: var(--caution-soft); border-color: #e7d9ae; color: var(--caution); }
.btn.warn:hover:not(:disabled) { background: #f2e6c4; }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .45; }

button:focus-visible, input:focus-visible, select:focus-visible,
[tabindex]:focus-visible, .switch:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.top-action:focus-visible { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--focus-ring); }

input, select {
  border-radius: var(--r-sm);
  border-color: var(--hairline);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
input:hover, select:hover { border-color: var(--brand-300); }
input:focus, select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47,143,84,.13);
  outline: none;
}

/* --------------------------------------------------------------------------
   5. Chrome — sidebar, topbar, tabs
   -------------------------------------------------------------------------- */
.sidebar { border-right: 1px solid var(--hairline); }
.topbar { border-bottom: 1px solid var(--hairline-2); }
html:not([data-theme="dark"]) .nav button.active {
  background: linear-gradient(180deg, #e9f3dd 0%, #dcebcc 100%);
  color: #174a29;
  box-shadow: inset 3px 0 0 var(--brand-600), 0 3px 10px rgba(47,143,84,.08);
}
.nav button { transition: background-color var(--t) var(--ease), color var(--t) var(--ease); }
.theme-chip, .cat-switch-btn { border-radius: var(--r-pill); }
.kicker { border-radius: var(--r-pill); }

/* --------------------------------------------------------------------------
   6. Exam / paper library — ONE green hue, three lightness steps
      Replaces the old green / orange / purple stage palette. Stage identity is
      preserved by depth of the same hue (kickoff → progress → final), which
      reads as a progression instead of three unrelated products.
   -------------------------------------------------------------------------- */
:root {
  --paper-s1: #3f9160; --paper-s1-soft: #e3f1e7;
  --paper-s1-wash: linear-gradient(115deg, #e9f5ec, #f8fcf8);
  --paper-s2: #2c7a4d; --paper-s2-soft: #dcecdd;
  --paper-s2-wash: linear-gradient(115deg, #e2f0e5, #f5fbf5);
  --paper-s3: #1e6039; --paper-s3-soft: #d2e4d5;
  --paper-s3-wash: linear-gradient(115deg, #dbeadd, #f0f8f1);
}

/* Stage tabs / ribbons / cover cards (experience.css legacy nodes) */
.paper-route-total { color: var(--brand-700); }
.paper-card.current { box-shadow: 0 0 0 3px var(--paper-soft); }

/* Active paper-library tokens: keep the deep pine, refine the surfaces. */
#paperLibrary {
  --paper-active: #225d41;
  --paper-active-text: #fff;
  --paper-current-surface: #eaf4ea;
  --paper-hover: #f4f7f1;
  --paper-fail-surface: #f9ebe8;
  --paper-fail-text: #9e463b;
}

.chapter-tab {
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: background-color var(--t) var(--ease),
              border-color var(--t) var(--ease), color var(--t) var(--ease),
              box-shadow var(--t) var(--ease);
}
.chapter-tab:not(:disabled):hover { border-color: var(--brand-400); background: var(--brand-50); }
.chapter-tab[aria-pressed="true"] {
  /* Same token as .exam-state.live: the running paper and its active stage
     must read as one state, not two unrelated greens. */
  background: var(--paper-active, #225d41);
  border-color: var(--paper-active, #225d41);
  color: var(--paper-active-text, #fff);
  box-shadow: 0 3px 10px rgba(31,102,59,.18);
}
.chapter-tab small { border-radius: var(--r-xs); }
.chapter-overview h2 { font-weight: 700; }
.chapter-meter .progress { border-radius: var(--r-pill); }

.catalog-toolbar { background: var(--canvas-alt); border-color: var(--hairline); }
.catalog-paper {
  transition: background-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  border-bottom-color: var(--hairline-2);
}
.catalog-paper:not(.current):hover { background: var(--brand-50); }
.catalog-paper.current { background: var(--paper-current-surface); }
.catalog-arrow { color: var(--brand-500); transition: transform var(--t) var(--ease); }
.catalog-paper:hover .catalog-arrow { transform: translateX(3px); }
.catalog-name strong { font-weight: 650; }

/* Paper "sheet" chips — three depths of one green, no orange / purple. */
.paper-sheet {
  border-radius: 4px var(--r-xs) 4px 4px;
  box-shadow: 0 1px 3px rgba(31,42,36,.06);
  font-weight: 700;
}
.paper-sheet.stage-0 { color: var(--brand-700); border-color: #b9d6c0; background: var(--brand-50); }
.paper-sheet.stage-1 { color: #256c43;       border-color: #a9cdb5; background: #eaf5ec; }
.paper-sheet.stage-2 { color: var(--brand-900); border-color: #8fbb9d; background: #dfeee2; }
.paper-sheet:before { background: currentColor; opacity: .32; }

/* Stage emblems */
.paper-stage-emblem { border-radius: var(--r-sm); }
.paper-stage-emblem.stage-0 { background: var(--brand-50);  color: var(--brand-700); }
.paper-stage-emblem.stage-1 { background: #e6f3e8; color: #256c43; }
.paper-stage-emblem.stage-2 { background: #d8e9dc; color: var(--brand-900); }

/* Status pills */
.exam-state { border-radius: var(--r-xs); font-weight: 600; }
.exam-state.passed { color: var(--ok); background: var(--ok-soft); }
.exam-state.pending { color: var(--caution); background: var(--caution-soft); }
.exam-state.failed  { color: var(--paper-fail-text); background: var(--paper-fail-surface); }

/* Exam intro card: same pine gradient as the home "mock exam" card. */
html:not([data-theme="dark"]) .exam-sidebar > .exam-intro,
html:not([data-theme="dark"]) .offer-vip .offer-head {
  background: linear-gradient(160deg, #277946 0%, #1e663b 100%);
  border-color: #1e663b;
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.exam-intro .exam-specs span {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.24);
  color: #eaf4e7;
  border-radius: var(--r-sm);
  backdrop-filter: blur(2px);
}
.exam-intro-actions .btn.primary {
  background: #f2f7e9; border-color: #f2f7e9; color: #1c4a2c;
  box-shadow: 0 6px 18px rgba(12,40,22,.18);
}
.exam-intro-actions .btn.primary:hover { background: #fff; color: #174028; }
.exam-intro-actions .btn.ghost {
  background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.34); color: #fff;
}
.exam-intro-actions .btn.ghost:hover { background: rgba(255,255,255,.20); color: #fff; }

/* Readiness ring and empty states */
.mock-ring { box-shadow: 0 2px 10px rgba(31,42,36,.06); }
.mock-ring-in { box-shadow: 0 0 0 1px var(--hairline-2) inset; }
.empty-symbol { border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-600); }

/* --------------------------------------------------------------------------
   7. Rainbow accents → one hue. Knowledge-point icons, tile icons, badges,
      explanation highlights. Home's four mode tiles are intentionally left
      untouched (they are part of the approved home composition).
   -------------------------------------------------------------------------- */
.topic-icon { background: var(--brand-50); color: var(--brand-700); }
.topic-icon-signs,   .topic-icon-signals     { background: #e7f2e8; color: #2b7048; }
.topic-icon-speed,   .topic-icon-expressway  { background: #eef5e9; color: #4a7c3f; }
.topic-icon-hazard,  .topic-icon-accident    { background: #e9f1e7; color: #336b46; }
.topic-icon-route_towing, .topic-icon-comprehensive { background: #e2efe6; color: #22663f; }
.topic-icon-maintenance,  .topic-icon-physics { background: #eaf3ea; color: #35704c; }

/* Home's four mode tiles keep their original low-saturation accent tints —
   the home page is the approved reference and its colours must not change.
   Only the shared radius is normalised here. */
.tile-icon { border-radius: var(--r-sm); }

/* Explanation highlights: keep the semantic split, desaturate to the family. */
.explain-text .hl-a  { background: #e9f1ea; color: #2b6641; }
.explain-text .hl-b  { background: #f6efd9; color: #7d611d; }
.explain-text .hl-ban{ background: var(--critical-soft); color: #a4443a; }
.explain-text .hl-sentence { background: #f7f2e2; color: #6d5a26; }

.student-avatar { background: var(--brand-100); color: var(--brand-700); }
.learner-level  { background: var(--brand-100); color: var(--brand-700); border-radius: var(--r-xs); }
.offer-head:after { border-color: rgba(47,143,84,.22); }
.offer-vip .offer-head:after { border-color: rgba(220,234,199,.3); }

/* Answer feedback — quieter, still unambiguous */
.answer-feedback.good { background: #f1f9f0 !important; border-color: #bcdcc0 !important; }
.answer-feedback.bad  { background: #fdf3f1 !important; border-color: #eccac5 !important; }
.answer-feedback { border-radius: var(--r-lg) !important; }
.answer-feedback.good .feedback-title { color: #1e663b; }
.feedback-answer-strip { border-radius: var(--r-sm); }
.good .feedback-answer-strip { background: #e2f0e3; border-color: #c5e0c6; }
.bad  .feedback-answer-strip { background: #f8e6e2; border-color: #eecdc7; }

/* AI 解析反馈卡（2026-11-25）：主标题中性，正确/错误判定收进内容区顶部 */
#practice .answer-feedback .feedback-title { color: var(--ink) !important; }
#practice .answer-feedback .feedback-icon {
  background: var(--brand-600) !important; color: #fff !important;
  font-size: 18px !important; font-weight: 700 !important;
}
.feedback-verdict {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 0 0 11px; padding: 5px 12px 5px 6px;
  border: 1px solid transparent; border-radius: 999px;
  font-size: 13px; font-weight: 800; line-height: 1.2;
}
.feedback-verdict .verdict-mark {
  display: inline-grid; place-items: center;
  width: 19px; height: 19px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 900;
}
.good .feedback-verdict { background: #e2f0e3; border-color: #c5e0c6; color: #1e663b; }
.good .feedback-verdict .verdict-mark { background: #2f8f54; }
.bad  .feedback-verdict { background: #f8e6e2; border-color: #eecdc7; color: #a4443a; }
.bad  .feedback-verdict .verdict-mark { background: #b85145; }
.explain-hidden { display: block; padding: 2px 0 4px; }

/* --------------------------------------------------------------------------
   8. Dark theme — fix contrast regressions and keep the same single hue
   -------------------------------------------------------------------------- */
html[data-theme="dark"] {
  --paper:      #18211b;
  --canvas:     #111713;
  --canvas-alt: #1c261e;
  --hairline:   #2d3930;
  --hairline-2: #263128;
  --ink:        #eef4f0;
  --ink-2:      #c2d0c4;
  --ink-3:      #9dab9f;
  --brand-50:  #1d2c22; --brand-100: #22392a; --brand-200: #2c4a34;
  --brand-300: #3f6a49; --brand-400: #5fae72; --brand-500: #6fc584;
  --brand-600: #79c997; --brand-700: #8ed5a4; --brand-800: #a9dfb8;
  --brand-900: #c2ecc9;
  --ok: #8ed5a4;      --ok-soft: #203628;
  --caution: #dfc273; --caution-soft: #332c18;
  --critical: #f08d82; --critical-soft: #3b2321;
  --shadow-1: 0 1px 2px rgba(0,0,0,.16), 0 4px 14px rgba(0,0,0,.20);
  --shadow-2: 0 2px 6px rgba(0,0,0,.22), 0 14px 34px rgba(0,0,0,.30);
  --shadow-3: 0 18px 52px rgba(0,0,0,.48);
  --shadow-brand: 0 10px 30px rgba(0,0,0,.30);
  --focus-ring: #79c997;
  --paper-s1: #6fc584; --paper-s1-soft: #22392a;
  --paper-s1-wash: linear-gradient(115deg, #1f3225, #17211b);
  --paper-s2: #8ed5a4; --paper-s2-soft: #264030;
  --paper-s2-wash: linear-gradient(115deg, #223628, #18211b);
  --paper-s3: #a9dfb8; --paper-s3-soft: #2c4a34;
  --paper-s3-wash: linear-gradient(115deg, #263b2c, #1a241d);
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .question,
html[data-theme="dark"] .qside,
html[data-theme="dark"] .dialog,
html[data-theme="dark"] .device,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .row { border-color: var(--hairline); }

/* Home mock-card CTA was nearly invisible on dark: restore a light CTA. */
html[data-theme="dark"] .mock-card .btn.ghost,
html[data-theme="dark"] .restored-heroes .mock-card .btn.ghost {
  background: #f2f7e9;
  border-color: #f2f7e9;
  color: #1c4a2c;
  font-weight: 700;
}
html[data-theme="dark"] .mock-card .btn.ghost:hover { background: #fff; color: #174028; }
html[data-theme="dark"] .btn.primary {
  background: linear-gradient(180deg, #86d29a 0%, #6cbb82 100%);
  border-color: #6cbb82; color: #102b1a;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 14px rgba(0,0,0,.24);
}
html[data-theme="dark"] .btn.primary:hover:not(:disabled) { background: #92db9f; }
html[data-theme="dark"] .btn.ghost { background: #1b241d; border-color: var(--hairline); color: var(--ink); }
html[data-theme="dark"] .btn.ghost:hover:not(:disabled) { background: #22392a; border-color: #3f6a49; }
html[data-theme="dark"] .btn.danger { background: #a8483d; border-color: #a8483d; color: #fff; }
html[data-theme="dark"] .btn.warn { background: #332c18; border-color: #554824; color: #dfc273; }

html[data-theme="dark"] :is(.kicker, .tile-icon, .category-icon, .topic-icon,
  .paper-stage-emblem, .empty-symbol, .member-status-icon, .plan-number,
  .student-avatar, .learner-level, .device-icon) {
  background: var(--brand-100);
  color: var(--brand-700);
}
html[data-theme="dark"] .nav button.active {
  background: linear-gradient(180deg, #24402c 0%, #1d3424 100%);
  color: #c8ecc9;
  box-shadow: inset 3px 0 0 #79c997;
}
html[data-theme="dark"] .chapter-tab { background: #1b241d; border-color: var(--hairline); color: var(--ink-3); }
html[data-theme="dark"] .chapter-tab:not(:disabled):hover { background: #22392a; border-color: #3f6a49; }
html[data-theme="dark"] .chapter-tab[aria-pressed="true"] {
  background: var(--paper-active, #a9dfb8);
  border-color: var(--paper-active, #a9dfb8);
  color: var(--paper-active-text, #183526);
}
html[data-theme="dark"] .chapter-tab[aria-pressed="true"] small { color: inherit; }
html[data-theme="dark"] .chapter-tab small { background: #263128; color: var(--ink-3); }
html[data-theme="dark"] .catalog-toolbar { background: #1c261e; border-color: var(--hairline); }
html[data-theme="dark"] .catalog-paper { border-bottom-color: var(--hairline-2); }
html[data-theme="dark"] .catalog-paper:not(.current):hover { background: #1d2c22; }
html[data-theme="dark"] .catalog-paper.current { background: #22392a; }
html[data-theme="dark"] .catalog-arrow { color: var(--brand-500); }
html[data-theme="dark"] .paper-sheet { background: #1c2a20; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
html[data-theme="dark"] .paper-sheet.stage-0 { color: var(--brand-500); border-color: #3f6a49; }
html[data-theme="dark"] .paper-sheet.stage-1 { color: var(--brand-700); border-color: #4f7c5a; }
html[data-theme="dark"] .paper-sheet.stage-2 { color: var(--brand-900); border-color: #6c9c79; }
html[data-theme="dark"] #paperLibrary {
  --paper-current-surface: #24382a;
  --paper-hover: #1d2a21;
  --paper-fail-surface: #3b2321;
  --paper-fail-text: #f0b3aa;
}
html[data-theme="dark"] .exam-state.passed { color: #b9e6c5; background: #22392a; }
html[data-theme="dark"] .exam-state.pending { color: #dfc273; background: #332c18; }
html[data-theme="dark"] .exam-intro .exam-specs span { color: #e4f0e3; }
html[data-theme="dark"] .exam-intro-actions .btn.primary { background: #eaf2de; color: #274c35; border-color: #eaf2de; }
html[data-theme="dark"] .exam-intro-actions .btn.ghost { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.3); color: #fff; }
html[data-theme="dark"] .answer-feedback.good { background: #16271a !important; border-color: #315d37 !important; }
html[data-theme="dark"] .answer-feedback.bad  { background: #2b1d1b !important; border-color: #6b3833 !important; }
html[data-theme="dark"] .good .feedback-answer-strip { background: #203a24; border-color: #345e39; }
html[data-theme="dark"] .bad  .feedback-answer-strip { background: #422522; border-color: #653a35; }
html[data-theme="dark"] #practice .answer-feedback .feedback-icon { background: var(--brand-600) !important; color: #12201a !important; }
html[data-theme="dark"] .good .feedback-verdict { background: #203a24; border-color: #345e39; color: #a8d8b4; }
html[data-theme="dark"] .bad  .feedback-verdict { background: #422522; border-color: #653a35; color: #f0b3aa; }
html[data-theme="dark"] .selection-summary { background: #1d2c22; }
html[data-theme="dark"] .mock-ring { box-shadow: 0 2px 10px rgba(0,0,0,.28); }
html[data-theme="dark"] .mock-ring-in { box-shadow: 0 0 0 1px var(--hairline) inset; }
html[data-theme="dark"] .explain-text .hl-a { background: #1f3a2a; color: #a8d8b4; }
html[data-theme="dark"] .explain-text .hl-b { background: #332c18; color: #e5cd8a; }
html[data-theme="dark"] .explain-text .hl-ban { background: #3b2321; color: #f0b3aa; }
html[data-theme="dark"] .explain-text .hl-sentence { background: #4a3c1a; color: #ffe6a8; }

/* --------------------------------------------------------------------------
   9. Motion, selection, scrollbar
   -------------------------------------------------------------------------- */
.page-enter { animation: pageEnter .24s var(--ease) both; }
@keyframes pageEnter { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
::selection { background: var(--brand-200); color: #173d25; }
html[data-theme="dark"] ::selection { background: #2f7d4f; color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(47,143,84,.22);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(47,143,84,.42); background-clip: padding-box; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(121,201,151,.24); background-clip: padding-box; }

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

/* ==========================================================================
   10. Specificity hardening
   Older layers declare `.btn{box-shadow:none!important}` and several
   `html:not([data-theme="dark"]) :is(.brandmark,.btn.primary)` rules whose
   specificity outranks plain `.btn.*`. Re-assert the commercial treatment with
   equal-or-higher weight so buttons and chips actually get their elevation,
   gradients and readable contrast in both themes.
   ========================================================================== */

/* Primary CTA — one gradient, one press feel, one tinted shadow. */
html:not([data-theme="dark"]) body .btn.primary {
  background: linear-gradient(180deg, #338f57 0%, #2b814d 100%);
  background-color: #2f8f54;
  border-color: #2b814d;
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 4px 12px rgba(31,102,59,.16) !important;
}
html:not([data-theme="dark"]) body .btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #2f8a52 0%, #257446 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.16) inset, 0 8px 20px rgba(31,102,59,.24) !important;
}
html[data-theme="dark"] body .btn.primary {
  background: linear-gradient(180deg, #86d29a 0%, #6cbb82 100%);
  background-color: #79c997;
  border-color: #6cbb82;
  color: #102b1a;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 14px rgba(0,0,0,.26) !important;
}

/* Secondary / ghost / warn / danger: consistent elevation + readable text. */
html:not([data-theme="dark"]) body .btn.secondary {
  background: #e2f0e5; border-color: #cbe3cf; color: #245331;
}
html:not([data-theme="dark"]) body .btn.ghost:hover:not(:disabled) {
  box-shadow: var(--shadow-1) !important;
}
html:not([data-theme="dark"]) body .btn.danger:hover:not(:disabled) {
  box-shadow: 0 6px 18px rgba(184,81,69,.24) !important;
}
html[data-theme="dark"] body .btn.secondary {
  background: #22392a; border-color: #3f6a49; color: #a9dfb8;
}
html[data-theme="dark"] body .btn.ghost {
  background: #1b241d; border-color: var(--hairline); color: var(--ink);
}
html[data-theme="dark"] body .btn.ghost:hover:not(:disabled) {
  background: #22392a; border-color: #3f6a49;
  box-shadow: 0 4px 14px rgba(0,0,0,.26) !important;
}
html[data-theme="dark"] body .btn.primary:hover:not(:disabled) {
  box-shadow: 0 8px 22px rgba(0,0,0,.34) !important;
}
html[data-theme="dark"] body .btn.danger:hover:not(:disabled) {
  box-shadow: 0 6px 18px rgba(168,72,61,.3) !important;
}

/* In-card exam CTA: keep it light and legible on the pine panel in both themes. */
html:not([data-theme="dark"]) body .exam-intro-actions .btn.primary,
html[data-theme="dark"] body .exam-intro-actions .btn.primary {
  background: #f2f7e9; background-color: #f2f7e9;
  border-color: #f2f7e9; color: #1c4a2c;
  box-shadow: 0 6px 18px rgba(12,40,22,.18) !important;
}
html:not([data-theme="dark"]) body .exam-intro-actions .btn.primary:hover,
html[data-theme="dark"] body .exam-intro-actions .btn.primary:hover {
  background: #fff; color: #174028;
}

/* Exam intro panel in dark: same pine gradient family as the home mock card. */
html[data-theme="dark"] body .exam-sidebar > .exam-intro {
  background: linear-gradient(160deg, #277946 0%, #1e663b 100%);
  border-color: #1e663b; color: #fff;
  box-shadow: var(--shadow-brand);
}

/* Chips / tags / answer-sheet cells: no bright light-mode blocks in the dark. */
html[data-theme="dark"] body :is(.kicker, .tag, .tag.good, .tag.gray,
  .badge.gray, .theme-chip, .chapter-tab small, .member-pill.free) {
  background: #22392a; color: #a9dfb8; border-color: #3f6a49;
}
html[data-theme="dark"] body .tag.good { background: #203628; color: #8ed5a4; }
html[data-theme="dark"] body .qnum.current {
  background: #22392a; border-color: #79c997; color: #c2ecc9;
}
html[data-theme="dark"] body .qnum.done { background: #2c4a34; border-color: #3f6a49; color: #d8efdb; }
html[data-theme="dark"] body .option.selected {
  background: #1d3023; border-color: #3f6a49;
}
html[data-theme="dark"] body .topic-tile.selected { background: #1d2c22; border-color: #3f6a49; }

/* Light-mode chips stay in the same warm-green family. */
html:not([data-theme="dark"]) body .tag { background: #eef4eb; color: #526256; }
html:not([data-theme="dark"]) body .tag.good { background: #e5f2e7; color: var(--ok); }
html:not([data-theme="dark"]) body .tag.bad { background: #f9ebe8; color: #a4443a; }
html:not([data-theme="dark"]) body .kicker { background: #e8f1df; color: #3b6645; }

/* Focus ring must win over the legacy per-component outlines. */
html body button:focus-visible,
html body input:focus-visible,
html body select:focus-visible,
html body [tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ==========================================================================
   11. Final craft
   · Stage differentiation now comes from a clear lightness ladder within ONE
     hue, so switching stages gives feedback without reintroducing clashing
     colours. Kickoff is airy, Final is the deepest pine.
   · Scrollbar: quiet, neutral, never a bright green rail.
   · Secondary CTA reads as a real button, not a disabled-looking chip.
   ========================================================================== */
html:not([data-theme="dark"]) body .paper-sheet.stage-0 {
  color: #3f9160; border-color: #c6e0cd; background: #f4faf5;
}
html:not([data-theme="dark"]) body .paper-sheet.stage-1 {
  color: #256c43; border-color: #a9cdb5; background: #e9f5ec;
}
html:not([data-theme="dark"]) body .paper-sheet.stage-2 {
  color: #174f2e; border-color: #86b697; background: #daecdf;
  font-weight: 800;
}
html:not([data-theme="dark"]) body .paper-stage-emblem.stage-0 { background: #f0f8f2; color: #3f9160; }
html:not([data-theme="dark"]) body .paper-stage-emblem.stage-1 { background: #e2f1e6; color: #256c43; }
html:not([data-theme="dark"]) body .paper-stage-emblem.stage-2 { background: #d2e7d8; color: #174f2e; }

html[data-theme="dark"] body .paper-sheet.stage-0 { color: #6fc584; border-color: #3f6a49; background: #1a2a20; }
html[data-theme="dark"] body .paper-sheet.stage-1 { color: #8ed5a4; border-color: #4f7c5a; background: #1e3225; }
html[data-theme="dark"] body .paper-sheet.stage-2 { color: #c2ecc9; border-color: #6c9c79; background: #243a2b; font-weight: 800; }

/* Stage differentiation lives in the paper-number chips above. The selected
   stage tab keeps ONE shared token with the running-paper badge on purpose. */

/* Quiet scrollbar — no saturated rail. */
::-webkit-scrollbar-thumb {
  background: rgba(31,42,36,.16);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(31,42,36,.3); background-clip: padding-box; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(160,190,168,.2); background-clip: padding-box; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(160,190,168,.36); background-clip: padding-box; }

/* Secondary CTA: a visible border + weight so it never looks disabled. */
html:not([data-theme="dark"]) body .btn.secondary {
  border: 1px solid #b9d7c1;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(31,42,36,.05) !important;
}
html:not([data-theme="dark"]) body .btn.secondary:hover:not(:disabled) {
  background: #d5e9d9; border-color: #93bea0;
  box-shadow: 0 4px 12px rgba(31,102,59,.12) !important;
}
html[data-theme="dark"] body .btn.secondary { border: 1px solid #3f6a49; font-weight: 700; }

/* Destructive action: keep the semantic red, but settle it into the palette. */
html:not([data-theme="dark"]) body .btn.danger {
  background: #b4554a; border-color: #b4554a;
}
html:not([data-theme="dark"]) body .btn.danger:hover:not(:disabled) {
  background: #a34a40; border-color: #a34a40;
}

/* Warm neutral "mark" action, no saturated yellow. */
html:not([data-theme="dark"]) body .btn.warn { border: 1px solid #e7d9ae; font-weight: 700; }

/* VIP panel: legacy cream text on the pine gradient reads yellow. Use a clean
   cool white so the header belongs to the same palette as the home mock card. */
html:not([data-theme="dark"]) body .offer-vip .offer-head,
html[data-theme="dark"] body .offer-vip .offer-head { color: #f4f9f0; }
html:not([data-theme="dark"]) body .offer-vip .offer-head :is(h2, p, .pass-mark, svg, use),
html[data-theme="dark"] body .offer-vip .offer-head :is(h2, p, .pass-mark, svg, use) {
  color: inherit; border-color: rgba(244,249,240,.72);
}
html:not([data-theme="dark"]) body .exam-intro h2,
html:not([data-theme="dark"]) body .exam-intro-copy > p { color: #f4f9f0; }

/* ==========================================================================
   12. Study overview - activity report only (check-in removed 2026-11-23)
   ========================================================================== */
.study-overview { padding: 0; overflow: hidden; }
.study-overview > .study-pane { min-width: 0; }
.study-overview > .study-activity#recordReport { padding: 22px 24px 18px; }
.study-overview .report-head { margin-bottom: 14px; }
.study-overview .report-head h2 { font-size: 16px; font-weight: 650; margin: 0; }
.study-overview .report-head p { font-size: 11px; margin: 3px 0 0; }
.study-overview .report-totals { margin: 16px 0 16px; }
.study-overview .report-totals strong { font-size: 22px; }
.study-overview .heat-day { border-radius: 4px; }

/* Detail pass - ledger empty state */
.order-ledger:has(.order-empty) { min-height: 0; }
.order-ledger .order-empty { padding: 38px 16px 40px; }
.order-ledger .order-empty .tile-icon { width: 40px; height: 40px; margin: 0 auto 12px; }
.order-ledger .order-empty h3 { font-size: 14px; font-weight: 650; margin: 0 0 8px; }
.order-ledger .order-empty { padding: 30px 16px 32px; }

@media (max-width: 760px) {
  .study-overview > .study-activity { padding-left: 16px; padding-right: 16px; }
  .study-overview .report-totals { flex-wrap: wrap; }
}

/* ==========================================================
   Submit exam dialog — two states, no stat tiles, equal actions
   ----------------------------------------------------------
   All answered: plain "cannot edit after submit" confirmation.
   Unanswered:   one alert line carrying the exact missing count.
   The legacy .stat4 tiles remain in the DOM as hidden count nodes
   so the answer-count regression can still verify the tally.
   ========================================================== */
#submitModal .submit-dialog { padding: 26px 26px 24px; }
#submitModal .dialog h2 { margin: 0 0 10px; text-align: center; }
#submitModal .dialog > p.muted { margin: 0; line-height: 1.65; text-align: center; }
#submitModal #smStats { display: none !important; }

#submitModal .submit-alert {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 0; padding: 12px 14px;
  border: 1px solid rgba(180, 85, 74, .22); border-radius: 12px;
  background: var(--danger-soft, #f9ebe8);
}
#submitModal .submit-alert[hidden] { display: none; }
#submitModal .submit-alert-icon {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: #b4554a; color: #fff; font-size: 15px; font-weight: 800;
}
#submitModal #smWarn { flex: 1; margin: 0; font-size: 13px; font-weight: 700; line-height: 1.5; }

#submitModal .dialog-actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; margin-top: 22px;
}
#submitModal .dialog-actions > .btn { width: 100%; padding: 11px 14px; font-size: 13px; }
#submitModal.submit-complete .dialog-actions { margin-top: 24px; }

/* 红色只属于「还有题没答完」的警示态；全部答完是一次正常确认，用墨绿主按钮。
   状态类由 mockOpenSubmit() 按未答题数挂在 #submitModal 上，class 仍是 .btn.danger
   （bindExtraButtons / 回归都靠它绑定真实交卷），这里只覆盖配色。 */
html:not([data-theme="dark"]) body #submitModal.submit-complete .btn.danger,
html[data-theme="dark"] body #submitModal.submit-complete .btn.danger {
  background: linear-gradient(180deg, #338f57 0%, #2b814d 100%);
  border-color: #2b814d;
  color: #fff;
}
html:not([data-theme="dark"]) body #submitModal.submit-complete .btn.danger:hover:not(:disabled),
html[data-theme="dark"] body #submitModal.submit-complete .btn.danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #2f8a52 0%, #257446 100%);
  border-color: #257446;
  box-shadow: 0 8px 20px rgba(31,102,59,.22) !important;
}

html[data-theme=dark] #submitModal .submit-alert {
  border-color: rgba(184, 81, 69, .38); background: rgba(184, 81, 69, .12);
}

@media (max-width: 480px) {
  #submitModal .submit-dialog { padding: 22px 18px 20px; }
  #submitModal .dialog-actions { gap: 10px; }
}

/* ==========================================================
   Mock exam page: align both columns' bottom edges
   ----------------------------------------------------------
   The sidebar used to run much longer than the paper library
   because it listed five recent scores. Now only three are
   rendered (app.js) and the two columns stretch to one height
   on wide screens; the last sidebar card absorbs spare space.
   ========================================================== */
@media (min-width: 981px) {
  #mock .mock-layout { align-items: stretch; }
  #mock #paperLibrary { display: flex; flex-direction: column; }
  #mock #paperGrid { flex: 1; }
  #mock .exam-sidebar { display: flex; flex-direction: column; }
  #mock .exam-sidebar > .card:last-child {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
  }
  #mock .exam-sidebar > .card:last-child .list { flex: 1; min-height: 0; }
}
#mock .recent-exam { padding: 11px 0; }
#mock .recent-exam:first-child { padding-top: 0; }
#mock .recent-exam:last-child { padding-bottom: 0; }

/* ==========================================================
   Combo practice: hide search, show every topic, dense 5-col grid
   ----------------------------------------------------------
   The search / selected-only toolbar is hidden from the UI, but its
   functions stay in app.js (regressions and old links still call
   searchCombo / comboShowSelected). Paging is disabled there, so all
   topics render at once; the two cards share one bottom edge.
   ========================================================== */
#combo .topic-toolbar { display: none; }

/* 重复小标签收敛：标题右侧「25 个知识点」、下方「共 25 个知识点」（同一总数
   出现两次），以及默认已全选时多余的「全选当前结果」都不再展示，只留「清空」。
   三个节点保留在 DOM 里，updateComboSummary() 与回归仍可读写其计数数据。 */
#combo #comboSel,
#combo #comboMatchCount,
#combo #comboSelectAll { display: none; }
#combo .topic-tools { justify-content: flex-end; margin: 0 0 8px; }

@media (min-width: 981px) {
  #combo .combo-layout { align-items: stretch; }
  #combo .combo-settings { display: flex; flex-direction: column; }
  #combo .combo-settings #comboStart { margin-top: auto; }
  #combo .topic-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }
  #combo .topic-tile {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px; min-height: 62px; padding: 9px 10px;
  }
  #combo .topic-icon { display: none; }
  /* 勾选框视觉去掉后不再占位：卡片只剩文字，选中态靠底色 + 边框。 */
  #combo .topic-tile input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
  #combo .topic-copy { gap: 3px; }
  #combo .topic-copy strong { font-size: 12px; line-height: 1.4; }
  #combo .topic-copy small { font-size: 10px; }
}

/* 分类练习 · 翻组引导条（2026-11-24）
   滚轮翻组是隐藏交互：引导条放在卡片区上方保证首屏必见，
   常驻给出「文字提示 + 组数 + 可点上一组/下一组 + 细进度轨」；
   不恢复两侧大箭头 / 页码 / 圆点 / 传统分页，保持纯净视觉。 */
.cat-rail-hint {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0 0 12px; padding: 9px 12px 11px; overflow: hidden;
  border: 1px solid var(--brand-200); border-radius: var(--r-md, 12px);
  background: var(--brand-50); color: var(--brand-800);
  font-size: 12.5px; line-height: 1.5;
  animation: catHintIn .45s ease both;
}
.cat-rail-hint[hidden] { display: none !important; }
.cat-rail-hint-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cat-rail-hint-ico { flex: none; display: grid; place-items: center; width: 22px; height: 22px; color: var(--brand-600); }
.cat-rail-hint-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cat-rail-hint-copy { color: var(--brand-800); }
.cat-rail-hint-group {
  flex: none; padding-left: 8px; border-left: 1px solid var(--brand-200);
  color: var(--brand-700); font-weight: 650; font-variant-numeric: tabular-nums;
}
.cat-rail-hint-actions { flex: none; display: flex; gap: 6px; }
.cat-rail-step {
  height: 28px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 0 10px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--brand-300); border-radius: 999px;
  background: #fff; color: var(--brand-700); font-size: 12px; font-weight: 600;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.cat-rail-step svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cat-rail-step:hover:not(:disabled) { background: var(--brand-600); border-color: var(--brand-600); color: #fff; transform: translateY(-1px); }
.cat-rail-step:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.cat-rail-step:disabled { opacity: .42; cursor: default; }
.cat-rail-hint-track { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand-100); }
.cat-rail-hint-track i { display: block; height: 100%; background: var(--brand-500); transition: width .3s; }
/* 用户翻过一次组后收敛为低调提示，不再高亮、不再动画 */
.cat-rail-hint.seen {
  background: transparent; border-color: var(--line, #d9e5e8); color: var(--muted, #536b74); animation: none;
}
.cat-rail-hint.seen .cat-rail-hint-copy { color: var(--muted, #536b74); }
.cat-rail-hint.seen .cat-rail-hint-track { background: transparent; }
@keyframes catHintIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cat-rail-hint { animation: none; } }
html[data-theme="dark"] .cat-rail-hint { background: #1d2d23; border-color: #345040; color: #a9d6b8; }
html[data-theme="dark"] .cat-rail-hint-copy { color: #a9d6b8; }
html[data-theme="dark"] .cat-rail-hint-group { color: #8fdda8; border-left-color: #345040; }
html[data-theme="dark"] .cat-rail-step { background: #1b241d; border-color: #345040; color: #a9d6b8; }
html[data-theme="dark"] .cat-rail-step:hover:not(:disabled) { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
html[data-theme="dark"] .cat-rail-hint.seen { background: transparent; border-color: #334036; }
@media (max-width: 700px) {
  .cat-rail-hint { flex-wrap: wrap; gap: 8px; padding: 8px 10px 10px; font-size: 11.5px; }
  .cat-rail-hint-main { flex: 1 1 auto; flex-wrap: wrap; }
  .cat-rail-hint-group { border-left: 0; padding-left: 0; }
  .cat-rail-step { padding: 0 8px; }
}

/* ==========================================================
   首页页头（2026-11-24）
   ----------------------------------------------------------
   左侧「头像 + 学习总览 + 学员名 / 会员等级 / 学员 ID」与右上角
   头像入口（点击弹出学员信息面板）内容完全重复，用户端不再展示。
   DOM 节点保留：renderStudent() 仍会写 data-learner-* 和
   #homeCopyId 的 aria-label，复制按钮绑定与回归脚本照常工作。
   右侧日期保持在原来的右对齐位置。
   ========================================================== */
#home > .pagehead .home-ident { display: none !important; }
#home > .pagehead { justify-content: flex-end; }

/* ==========================================================
   顶栏语言切换（2026-11-24）
   ----------------------------------------------------------
   界面语言只有简体中文 / 日本語两种：不再弹下拉菜单，改为顶栏常驻
   「中 / 日」双段按钮，点一下直接切，当前语言高亮。
   #langMenu 节点保留在数据层（buildLangMenu / 设置页下拉 / 回归仍读），
   但用户端永不可见；.top-action 的 36px 方形限制在此覆盖。
   ========================================================== */
.lang-wrap .lang-menu { display: none !important; }
#langButton.lang-toggle {
  width: auto !important; min-width: 62px; height: 34px !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  gap: 1px; padding: 0 7px !important;
  border: 1px solid var(--line) !important; border-radius: 999px !important;
  background: var(--panel) !important; font-size: 12px; line-height: 1;
  white-space: nowrap; cursor: pointer;
}
#langButton.lang-toggle:hover { background: var(--hover) !important; border-color: var(--brand-300, var(--line)) !important; }
#langButton.lang-toggle:focus-visible { outline: 2px solid var(--brand-500, #3f9160); outline-offset: 2px; }
#langButton .lang-opt {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  color: var(--muted); font-size: 12px; font-weight: 650;
  transition: background .18s, color .18s;
}
#langButton .lang-opt.active { background: var(--brand-600, #2c7a4d); color: #fff; }
#langButton .lang-sep { color: var(--line); font-size: 11px; padding: 0 1px; }
html[data-theme="dark"] #langButton.lang-toggle { background: #1b241d !important; border-color: #345040 !important; }
html[data-theme="dark"] #langButton .lang-opt { color: #a9d6b8; }
html[data-theme="dark"] #langButton .lang-opt.active { background: var(--brand-600, #2c7a4d); color: #fff; }

/* ==========================================================
   顶栏「学习类别」选择器升级（2026-11-24）
   ----------------------------------------------------------
   原形态＝白胶囊按钮 + 下拉白卡列表：要点两下才看到 5 个类别，
   4 个未开通只在点开后可见，绿色横条 / 灰色小字显得廉价。
   宽屏改为常驻分段控件：当前类别墨绿实心、未开通低饱和 + 小锁，
   点一下直接切换，不再弹窗。数据层零改动：#catSwitch /
   #catSwitchBtn / #catSwitchName / #catMenu / 5 个 .cat-menu-item
   全部保留，回归照常读取与点击；窄屏仍走原下拉。
   ========================================================== */
@media (min-width: 981px) {
  .topbar .cat-switch {
    display: flex; align-items: center; gap: 9px;
    position: static; margin-right: auto; min-width: 0;
    max-width: min(660px, 52vw);
  }
  /* 纯 CSS 四格小图标（无文字，不参与三语文案回归） */
  .topbar .cat-switch::before {
    content: ""; width: 14px; height: 14px; flex: none; opacity: .8;
    background:
      linear-gradient(var(--brand-600, #2c7a4d), var(--brand-600, #2c7a4d)) 0 0 / 6px 6px no-repeat,
      linear-gradient(var(--brand-600, #2c7a4d), var(--brand-600, #2c7a4d)) 8px 0 / 6px 6px no-repeat,
      linear-gradient(var(--brand-600, #2c7a4d), var(--brand-600, #2c7a4d)) 0 8px / 6px 6px no-repeat,
      linear-gradient(var(--brand-600, #2c7a4d), var(--brand-600, #2c7a4d)) 8px 8px / 6px 6px no-repeat;
  }
  .topbar .cat-switch > #catSwitchBtn { display: none !important; }
  .topbar .cat-switch > #catMenu {
    display: flex !important; position: static !important;
    width: auto !important; max-width: 100%; max-height: none !important;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    align-items: center; gap: 3px; padding: 3px;
    border: 1px solid var(--brand-200, #d9e9dc); border-radius: 999px;
    background: var(--brand-50, #f2f8f2);
    box-shadow: inset 0 1px 2px rgba(30, 60, 40, .05);
    z-index: auto;
  }
  .topbar .cat-switch > #catMenu::-webkit-scrollbar { display: none; }
  .cat-menu-head { display: none !important; }
  #catMenu .cat-menu-item {
    flex: 0 0 auto; width: auto !important;
    padding: 6px 13px !important; border-radius: 999px;
    font-size: 12px; font-weight: 650; line-height: 1.35;
    color: var(--muted); background: transparent; gap: 6px;
    white-space: nowrap; text-align: center;
    transition: background .18s, color .18s, box-shadow .18s, transform .18s;
  }
  #catMenu .cat-menu-item .cm-name { flex: 0 0 auto; min-width: 0; overflow: visible; text-overflow: clip; }
  /* 题量与「未开通」文字不挤顶栏；节点保留（回归读 textContent） */
  #catMenu .cat-menu-item .cm-meta,
  #catMenu .cat-menu-item .cm-lock { display: none !important; }
  #catMenu .cat-menu-item[data-locked="1"]::after {
    content: ""; width: 10px; height: 10px; flex: none; opacity: .62;
    background: no-repeat center / contain
      url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%236b7d70'%20stroke-width='2.4'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Crect%20x='5'%20y='11'%20width='14'%20height='10'%20rx='2'/%3E%3Cpath%20d='M8%2011V7a4%204%200%200%201%208%200v4'/%3E%3C/svg%3E");
  }
  #catMenu .cat-menu-item[data-locked="1"] { opacity: .72; }
  #catMenu .cat-menu-item:hover { background: rgba(255, 255, 255, .85); color: var(--ink); transform: translateY(-1px); }
  #catMenu .cat-menu-item.active,
  #catMenu .cat-menu-item.active:hover {
    background: var(--brand-600, #2c7a4d); color: #fff; opacity: 1;
    box-shadow: 0 2px 8px rgba(44, 122, 77, .28); transform: none;
  }
  #catMenu .cat-menu-item.active[data-locked="1"]::after { filter: brightness(0) invert(1); opacity: .9; }
  html[data-theme="dark"] .topbar .cat-switch > #catMenu { background: #1d2d23; border-color: #345040; }
  html[data-theme="dark"] #catMenu .cat-menu-item { color: #a9d6b8; }
  html[data-theme="dark"] #catMenu .cat-menu-item:hover { background: #26382b; color: #e6f5e9; }
  html[data-theme="dark"] #catMenu .cat-menu-item.active { background: var(--brand-600, #2c7a4d); color: #fff; }
}
/* 窄屏放不下 5 段：保留下拉，但面板沿用同一套设计语言（圆角卡片 / 胶囊选中 / 锁徽章） */
@media (max-width: 980px) {
  .topbar .cat-switch > #catMenu {
    border: 1px solid var(--brand-200, #d9e9dc); border-radius: 16px; padding: 8px;
    background: var(--panel); box-shadow: 0 12px 32px rgba(30, 60, 40, .14);
  }
  .cat-menu-head {
    padding: 6px 10px 8px; font-size: 11px; font-weight: 700;
    letter-spacing: .04em; color: var(--brand-700, #2c7a4d);
  }
  #catMenu .cat-menu-item { border-radius: 999px; padding: 9px 12px !important; font-size: 12.5px; font-weight: 600; }
  #catMenu .cat-menu-item.active { background: var(--brand-600, #2c7a4d); color: #fff; border-radius: 999px; }
  #catMenu .cat-menu-item .cm-lock {
    font-size: 10px; padding: 2px 7px; border-radius: 999px;
    background: rgba(120, 130, 120, .12); color: var(--muted);
  }
  #catMenu .cat-menu-item.active .cm-lock { background: rgba(255, 255, 255, .2); color: #fff; }
}

/* ==========================================================
   随机练习主面板与其它练习页对齐（2026-11-25）
   ----------------------------------------------------------
   原 #random > .card.hero 被内联写死 max-width:720px 且靠左，
   宽屏下只有其它练习页主卡（分类 / 顺序 / 组合，满内容区宽）的一半，
   右侧留出一大片空白，视觉上明显不搭。
   宽屏改为满宽对齐 + 内部两栏重排（题量 / 偏好 / 开始按钮），
   窄屏保留紧凑单列但水平居中。纯 CSS，HTML 底稿与 app.js 不动：
   renderRandomSettings() 只改 class / 属性，DOM 顺序不变。
   ========================================================== */
@media (min-width: 981px) {
  #random > .card.hero {
    max-width: none !important; width: 100%; box-sizing: border-box;
    padding: 30px 34px 34px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 28px; row-gap: 14px; align-items: start;
  }
  #random > .card.hero > h3 {
    grid-column: 1 / -1; grid-row: 1;
    margin: 0 0 4px; font-size: 16px; font-weight: 750; letter-spacing: -.01em;
  }
  #random > .card.hero > div:nth-child(2) {
    grid-column: 1; grid-row: 2;
    display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
    margin: 0 !important;
  }
  #random > .card.hero .qty { width: 100% !important; }
  #random > .card.hero > .setting:nth-child(3) { grid-column: 2; grid-row: 2; }
  #random > .card.hero > .setting:nth-child(4) { grid-column: 2; grid-row: 3; }
  #random > .card.hero > .btn.primary {
    grid-column: 1; grid-row: 3; justify-self: start;
    margin-top: 8px !important; padding: 11px 28px; font-size: 14px;
  }
  /* 两个偏好项从「带下划线的列表行」升级为浅色小卡 */
  #random > .card.hero > .setting {
    padding: 14px 18px !important;
    border: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
    border-radius: 12px; background: var(--soft);
    min-height: 74px; box-sizing: border-box;
  }
  html[data-theme="dark"] #random > .card.hero > .setting { background: #1d2d23; border-color: #345040 !important; }
}
@media (max-width: 980px) {
  /* 窄屏放不下两栏：保留原来的紧凑卡片，但水平居中不再贴左 */
  #random > .card.hero { margin-left: auto !important; margin-right: auto !important; }
}

/* ===== PL-01 练习临时锁屏 ==========================================
   全屏遮罩盖住题目与解析，回来后由用户明确选择继续练习或返回首页。
   样式自带浅色 / 深色两套配色，不依赖主题切换的加载顺序。 */
.practice-lock {
  position: fixed; inset: 0; z-index: 3000; display: none; place-items: center;
  padding: 24px; overflow-y: auto; background: rgba(16, 26, 19, .62);
  -webkit-backdrop-filter: blur(13px) saturate(.85);
  backdrop-filter: blur(13px) saturate(.85);
}
.practice-lock.show { display: grid; }
body.pl-locked { overflow: hidden; }
body.pl-locked .app { pointer-events: none; user-select: none; }
.pl-card {
  width: min(470px, 100%); margin: auto; background: #fff; color: var(--ink, #1f2a24);
  border: 1px solid var(--line, #dde4da); border-radius: 22px;
  padding: 28px 30px 22px; box-shadow: 0 30px 90px rgba(6, 20, 10, .36);
  animation: pl-in .26s ease-out both;
}
@keyframes pl-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.pl-lock-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: #eaf6ea; color: var(--green, #2f8f54); margin-bottom: 16px; }
.pl-kicker { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px; background: #eaf6ea; color: #277946; font-size: 11px; font-weight: 800; }
.pl-card h2 { font-size: 23px; line-height: 1.3; letter-spacing: -.02em; margin: 12px 0 8px; }
.pl-sub { font-size: 13.5px; line-height: 1.7; color: var(--muted, #6a766e); margin: 0 0 20px; }
.pl-progress { background: #f5f9f4; border: 1px solid var(--line, #dde4da); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.pl-progress-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.pl-progress-top span { font-size: 12.5px; font-weight: 800; }
.pl-progress-top b { font-size: 12px; font-weight: 700; color: var(--muted, #6a766e); }
.pl-progress .progress { height: 7px; background: #e1ebe0; }
.pl-progress .progress > i { background: var(--green, #2f8f54); }
.pl-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.pl-meta > div { background: #fafcf9; border: 1px solid var(--line, #dde4da); border-radius: 12px; padding: 11px 13px; }
.pl-meta span { display: block; font-size: 11px; color: var(--muted, #6a766e); margin-bottom: 4px; }
.pl-meta b { font-size: 14px; }
.pl-safe { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #277946; background: #eef8ed; border-radius: 10px; padding: 9px 12px; margin-bottom: 18px; }
.pl-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; }
.pl-actions .btn { width: 100%; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.pl-actions .btn.primary { background: var(--green, #2f8f54); color: #fff; }
.pl-actions .btn.ghost { background: #fff; color: var(--ink, #1f2a24); border: 1px solid var(--line, #dde4da); }

html[data-theme="dark"] .practice-lock { background: rgba(6, 12, 8, .74); }
html[data-theme="dark"] .pl-card { background: #1c261e; border-color: #2d3930; color: #eef4f0; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
html[data-theme="dark"] .pl-lock-icon { background: #22392a; color: #8ed5a4; }
html[data-theme="dark"] .pl-kicker { background: #22392a; color: #8ed5a4; }
html[data-theme="dark"] .pl-sub,
html[data-theme="dark"] .pl-progress-top b,
html[data-theme="dark"] .pl-meta span { color: #9dab9f; }
html[data-theme="dark"] .pl-progress { background: #19221b; border-color: #2d3930; }
html[data-theme="dark"] .pl-progress .progress { background: #2b3a2f; }
html[data-theme="dark"] .pl-progress .progress > i { background: #6fc584; }
html[data-theme="dark"] .pl-meta > div { background: #19221b; border-color: #2d3930; }
html[data-theme="dark"] .pl-safe { background: #203628; color: #8ed5a4; }
html[data-theme="dark"] .pl-actions .btn.primary { background: #6fc584; color: #102014; }
html[data-theme="dark"] .pl-actions .btn.ghost { background: #223027; border-color: #3f6a49; color: #eef4f0; }

@media (max-width: 560px) {
  .practice-lock { padding: 14px; align-items: start; }
  .pl-card { padding: 22px 20px 18px; border-radius: 18px; }
  .pl-actions, .pl-meta { grid-template-columns: 1fr; }
}

/* 2026-11-25：未开通类别 → 会员中心岔路。意图段只给低调描边，
   真正的 .active 仍留在当前已开通类别（未购类别绝不标成已选）。 */
#catMenu .cat-menu-item.cat-intent:not(.active) {
  box-shadow: inset 0 0 0 1.5px var(--brand-500, #3f9160);
  color: var(--brand-700, #2c7a4d); opacity: 1;
}
html[data-theme="dark"] #catMenu .cat-menu-item.cat-intent:not(.active) {
  box-shadow: inset 0 0 0 1.5px #5bb87c; color: #b6e6c5;
}
/* 会员中心页头：只在「从类别跳转过来」时显示返回按钮 */
#memberBackBtn[hidden] { display: none !important; }
.pagehead-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
