:root {
  --bg: #f8f7f4;
  --bg-subtle: #efeee8;
  --surface: #ffffff;
  --surface-warm: #faf9f6;
  --ink: #171c1a;
  --ink-soft: #4c5651;
  --muted: #7c8680;
  --line: #e6e4dc;
  --line-strong: #d3d1c7;
  --brand: #155c4b;
  --brand-hover: #0f483a;
  --brand-soft: #e7f3ef;
  --brand-ring: rgba(21, 92, 75, 0.16);
  --accent: #b3621c;
  --accent-soft: #fcf1e5;
  --math: #1c539e;
  --math-bg: #ebf2fc;
  --chinese: #9d372a;
  --chinese-bg: #fceceb;
  --english: #176950;
  --english-bg: #e7f4ef;
  --ok: #177843;
  --ok-bg: #e8f7ee;
  --err: #b83327;
  --err-bg: #fdeceb;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-sm: 0 1px 3px rgba(18, 24, 21, 0.04);
  --shadow: 0 8px 24px rgba(18, 24, 21, 0.06);
  --shadow-lg: 0 22px 56px rgba(12, 18, 16, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  line-height: 1.62;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.ic { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; }
.ic-sm { width: 15px; height: 15px; }

/* ==================== SHELL ==================== */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark, .mob-brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.mob-brand-mark { display: none; width: 28px; height: 28px; font-size: 13.5px; border-radius: 8px; }
.brand-txt strong { display: block; font-size: 15px; line-height: 1.25; }
.brand-txt small { color: var(--muted); font-size: 11.5px; }

.nav-scroll { flex: 1; overflow-y: auto; }
.nav-section-label { font-size: 11px; font-weight: 600; color: var(--muted); padding: 12px 10px 5px; letter-spacing: 0.04em; }
.nav-section-label:first-child { padding-top: 2px; }
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  color: var(--ink-soft); font-size: 14px; font-weight: 500; text-align: left;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-item-ai:not(.active) { color: var(--brand); }
.badge {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 99px;
  background: var(--bg); color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.badge-live { background: var(--brand-soft); color: var(--brand); }
.nav-item.active .badge { background: rgba(255,255,255,0.22); color: #fff; }

.rail-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.rail-action-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 9px;
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  border: 1px solid var(--line); background: var(--surface-warm);
  transition: border-color .14s, color .14s, background .14s;
}
.rail-action-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.countdown-box {
  background: var(--bg); border-radius: 10px; padding: 8px 11px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.countdown-box small { color: var(--ink-soft); font-size: 12px; }
.countdown-box strong { color: var(--brand); font-size: 16px; font-variant-numeric: tabular-nums; }
.auth-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #c5c5bd; flex-shrink: 0; }
.dot.online { background: var(--ok); }

/* ==================== TOPBAR & STAGE ==================== */
.stage { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 25;
  background: rgba(248, 247, 244, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 26px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title-wrap { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.topbar-title-wrap strong { font-size: 15.5px; font-weight: 700; white-space: nowrap; }
.subtitle { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mob-only-btn { display: none; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); display: grid; place-items: center;
  transition: border-color .14s, color .14s, background .14s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.content { width: min(1140px, 100%); margin: 0 auto; padding: 24px 26px 56px; flex: 1; }
.content.ai-mode-content { padding: 14px 20px 18px; width: min(1240px, 100%); }

/* ==================== BUTTONS & CONTROLS ==================== */
.btn-solid {
  background: var(--brand); color: #fff;
  padding: 9px 17px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: background .14s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-solid:hover { background: var(--brand-hover); }
.btn-solid:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink);
  padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  transition: border-color .14s, color .14s, background .14s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn-outline:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-compact { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-full { width: 100%; }
.primary-sm { background: var(--brand); color: #fff; padding: 6px 13px; border-radius: 9px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ghost-sm { margin-left: auto; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 500; white-space: nowrap; }
.btn-tiny {
  padding: 5px 11px; border-radius: 8px; font-size: 12.5px;
  border: 1px solid var(--line); background: var(--surface-warm); color: var(--ink-soft); font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  transition: border-color .14s, color .14s, background .14s;
}
.btn-tiny:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn-tiny.primary-tiny { background: var(--brand-soft); border-color: rgba(21,92,75,0.26); color: var(--brand); font-weight: 600; }
.btn-tiny.danger-tiny:hover { border-color: var(--err); color: var(--err); background: var(--err-bg); }
.link-btn { font-size: 12px; color: var(--brand); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

.seg-group { display: inline-flex; flex-wrap: wrap; background: var(--bg); padding: 3px; border-radius: 10px; border: 1px solid var(--line); gap: 2px; }
.seg { padding: 5px 11px; border-radius: 7px; font-size: 13px; color: var(--ink-soft); font-weight: 500; transition: color .14s, background .14s; }
.seg.active { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }
.input-select, .input-search, .input-full {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 11px; font-size: 13.5px; outline: none;
  transition: border-color .14s, background .14s;
}
.input-search { flex: 1; min-width: 150px; }
.input-full { width: 100%; padding: 10px 13px; margin: 10px 0; }
.input-select:focus, .input-search:focus, .input-full:focus {
  border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-ring);
}

/* ==================== HOME (RESTRAINED, HIGH SIGNAL, ZERO CARD BLOAT) ==================== */
.hero-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 18px;
}
.hero-copy h1 {
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.28; letter-spacing: -0.02em; font-weight: 800;
  margin-bottom: 10px;
}
.hero-copy p { color: var(--ink-soft); font-size: 14.5px; max-width: 52ch; margin-bottom: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi-cell { background: var(--bg); border-radius: 12px; padding: 14px 16px; }
.kpi-cell strong { display: block; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-cell span { font-size: 12px; color: var(--muted); }

/* Clean Horizontal Subject List (replaces generic 3-col cards) */
.subject-strip {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px;
}
.subject-row {
  width: 100%; padding: 15px 20px; text-align: left;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid var(--line);
  transition: background .14s;
}
.subject-row:last-child { border-bottom: 0; }
.subject-row:hover { background: var(--surface-warm); }
.subj-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.subj-dot.math { background: var(--math); }
.subj-dot.chinese { background: var(--chinese); }
.subj-dot.english { background: var(--english); }
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sr-main strong { font-size: 15px; font-weight: 700; }
.sr-main small { font-size: 13px; color: var(--muted); }
.sr-go { font-size: 13px; font-weight: 600; color: var(--brand); flex-shrink: 0; }

.section-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.section-head h2 { font-size: 16.5px; font-weight: 700; }
.section-head small { color: var(--muted); font-size: 12.5px; }

.matrix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.matrix-chip {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--surface-warm); text-align: left; font-size: 13px;
  transition: border-color .14s, background .14s;
}
.matrix-chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.matrix-chip b { font-weight: 600; }
.matrix-chip em { font-style: normal; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ==================== FILTER & SINGLE-QUESTION PAST ==================== */
.filter-bar, .drill-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line);
  padding: 10px 13px; border-radius: var(--radius);
}
.year-banner {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 16px; margin-bottom: 14px; font-size: 13px;
}
.year-banner h3 { font-size: 14.5px; font-weight: 700; }
.year-banner p { color: var(--ink-soft); margin-top: 5px; }
.year-banner .cov { font-size: 12px; color: var(--muted); margin-top: 4px; }
.year-banner details summary { cursor: pointer; font-size: 12.5px; color: var(--brand); font-weight: 600; margin-top: 3px; }

.past-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 256px; gap: 16px; align-items: start; }
.past-main-col { min-width: 0; }
.single-q-stage { display: flex; flex-direction: column; gap: 12px; }
.q-pager-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px;
}
.q-pager-info { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); }
.q-pager-info strong { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.q-pager-btns { display: flex; align-items: center; gap: 7px; }
.kbd-hint { font-size: 11.5px; color: var(--muted); }

.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px 26px; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.q-yr { background: var(--ink); color: #fff; padding: 2px 9px; border-radius: 6px; font-weight: 700; }
.q-mod { background: var(--brand-soft); color: var(--brand); padding: 2px 9px; border-radius: 6px; font-weight: 600; }
.q-top { color: var(--ink-soft); font-weight: 500; }
.q-sc { margin-left: auto; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; font-weight: 700; }
.q-status-tag { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: #fff4df; color: #8c5a0b; font-weight: 600; }

.q-ctx-wrap { background: var(--surface-warm); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
.q-ctx-summary { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; background: var(--bg-subtle); cursor: pointer; font-size: 13px; font-weight: 700; list-style: none; }
.q-ctx-summary::-webkit-details-marker { display: none; }
.q-ctx-summary small { font-weight: 500; color: var(--muted); font-size: 12px; }
.q-ctx-body { padding: 14px 16px; font-size: 14.5px; line-height: 1.85; white-space: pre-wrap; max-height: 340px; overflow-y: auto; }
.q-ctx-body .hl-blank { display: inline-block; padding: 0 7px; margin: 0 2px; border-radius: 5px; background: var(--brand-soft); color: var(--brand); font-weight: 700; border-bottom: 2px solid var(--brand); }

.q-stem { font-size: 16px; font-weight: 600; line-height: 1.8; white-space: pre-wrap; margin-bottom: 16px; }
.q-stem .u-word { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--brand); color: var(--brand); background: var(--brand-soft); padding: 0 4px; border-radius: 4px; font-weight: 700; }
.q-stem .blank-slot { display: inline-block; min-width: 52px; text-align: center; border-bottom: 2px solid var(--brand); color: var(--brand); font-weight: 700; padding: 0 6px; margin: 0 3px; }

.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 16px; }
.opt-grid.opt-stack { grid-template-columns: 1fr; }
.opt-btn { border: 1px solid var(--line-strong); background: var(--surface-warm); border-radius: 11px; padding: 12px 14px; text-align: left; font-size: 14.5px; line-height: 1.6; display: flex; gap: 10px; align-items: flex-start; transition: border-color .14s, background .14s; }
.opt-btn:hover { border-color: var(--brand); background: var(--surface); }
.opt-key { width: 24px; height: 24px; border-radius: 6px; background: var(--bg-subtle); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.opt-text { flex: 1; word-break: break-word; }
.opt-btn.correct { border-color: var(--ok); background: var(--ok-bg); color: #0e4f2b; font-weight: 600; }
.opt-btn.correct .opt-key { background: var(--ok); color: #fff; }
.opt-btn.wrong { border-color: var(--err); background: var(--err-bg); color: #7e1f17; }
.opt-btn.wrong .opt-key { background: var(--err); color: #fff; }

.q-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.q-explain { margin-top: 16px; padding: 16px 18px; background: var(--surface-warm); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 11px; font-size: 14.5px; line-height: 1.75; }
.exp-ans { font-weight: 700; color: var(--ok); background: var(--ok-bg); padding: 9px 13px; border-radius: 9px; white-space: pre-wrap; }
.exp-formula { background: #fff9ec; border: 1px solid #f0dfa8; padding: 9px 13px; border-radius: 9px; color: #5c3e07; }
.exp-steps-title { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.exp-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.exp-trap { background: var(--err-bg); border: 1px solid #f3c6c2; padding: 9px 13px; border-radius: 9px; color: #792018; font-size: 13.5px; }

.past-sheet-aside {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; position: sticky; top: 68px; max-height: calc(100vh - 88px);
  display: flex; flex-direction: column; gap: 10px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head strong { display: block; font-size: 14px; }
.sheet-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); }
.sheet-legend span { display: inline-flex; align-items: center; gap: 4px; }
.lg-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.lg-dot.cur { background: var(--brand); }
.lg-dot.done { background: var(--ok-bg); border: 1px solid var(--ok); }
.lg-dot.wrong { background: var(--err-bg); border: 1px solid var(--err); }
.sheet-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; overflow-y: auto; }
.sheet-num { height: 35px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-warm); font-size: 12.5px; font-weight: 600; color: var(--ink-soft); display: grid; place-items: center; }
.sheet-num.done { background: var(--ok-bg); border-color: rgba(23,120,67,0.35); color: var(--ok); }
.sheet-num.wrong { background: var(--err-bg); border-color: rgba(184,51,39,0.4); color: var(--err); }
.sheet-num.current { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ==================== VOCAB ENGINE (5 LEARNING MODES) ==================== */
.vocab-header {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.vocab-stats-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); }
.vocab-stats-row strong { color: var(--ink); font-variant-numeric: tabular-nums; margin-right: 3px; }
.vocab-stage {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px 26px; max-width: 720px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 18px;
}
.vocab-stage-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.vocab-word-hero { text-align: center; padding: 14px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.vocab-word-hero .vw-term { font-size: clamp(30px, 5vw, 42px); font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1.15; }
.vocab-word-hero .vw-phon { font-size: 15px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.vocab-meaning-box {
  background: var(--surface-warm); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; text-align: center; font-size: 17px; font-weight: 600; color: var(--ink);
  cursor: pointer; min-height: 62px; display: grid; place-items: center;
}
.vocab-meaning-box.hidden-meaning { color: var(--muted); font-size: 14px; font-weight: 500; }
.vocab-rate-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rate-btn {
  padding: 12px 10px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface-warm); display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: border-color .14s, background .14s;
}
.rate-btn strong { font-size: 14.5px; }
.rate-btn small { font-size: 11.5px; color: var(--muted); }
.rate-btn.r-again:hover { border-color: var(--err); background: var(--err-bg); color: var(--err); }
.rate-btn.r-hard:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.rate-btn.r-good:hover { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }

.spell-form { display: flex; gap: 10px; flex-wrap: wrap; }
.spell-input {
  flex: 1; min-width: 180px; padding: 12px 14px; font-size: 18px; font-weight: 600;
  letter-spacing: 0.04em; border-radius: 12px; border: 1.5px solid var(--line-strong);
  background: var(--bg); outline: none;
}
.spell-input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-ring); }
.spell-feedback { font-size: 14px; font-weight: 600; min-height: 22px; }
.spell-feedback.ok { color: var(--ok); }
.spell-feedback.err { color: var(--err); }

.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.word-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; display: flex; flex-direction: column; gap: 4px;
}
.word-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.word-card strong { font-size: 17px; color: var(--brand); }
.word-card em { font-size: 12px; color: var(--muted); font-style: normal; }
.word-card p { margin-top: 4px; font-size: 13.5px; cursor: pointer; }
.word-card.masked p { filter: blur(5px); user-select: none; }
.word-mastery-tag { font-size: 11px; color: var(--ok); font-weight: 600; }

/* ==================== AI WORKSPACE ==================== */
.view-ai { display: flex; flex-direction: column; }
.ai-workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; height: calc(100vh - 88px); min-height: 520px; }
.ai-sidebar {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 15px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto;
}
.ai-side-block { display: flex; flex-direction: column; gap: 6px; }
.ai-side-head { display: flex; justify-content: space-between; align-items: center; }
.ai-side-label { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.ai-mode-list { display: flex; flex-direction: column; gap: 5px; }
.ai-mode-btn { text-align: left; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-warm); }
.ai-mode-btn:hover { border-color: var(--brand); }
.ai-mode-btn strong { display: block; font-size: 13px; }
.ai-mode-btn small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.ai-mode-btn.active { background: var(--brand-soft); border-color: var(--brand); }
.ai-mode-btn.active strong { color: var(--brand); }
.ai-ctx-card { background: var(--accent-soft); border: 1px solid rgba(179,98,28,0.22); border-radius: 10px; padding: 9px 11px; }
.ai-ctx-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--accent); font-weight: 700; margin-bottom: 3px; }
.ai-ctx-title { font-size: 12.5px; color: var(--ink); line-height: 1.45; }
.ai-quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { font-size: 12px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-warm); color: var(--ink-soft); }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.ai-side-foot { margin-top: auto; padding-top: 6px; }

.ai-chat-main {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
}
.ai-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface);
  min-height: 46px; flex-shrink: 0;
}
.ai-toolbar-left, .ai-toolbar-right { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pill-control {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border-radius: 99px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.pill-control:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.pill-sep { font-weight: 500; color: var(--brand); }
.pill-sep::before { content: "· "; color: var(--muted); }
.pill-caret { font-size: 11px; color: var(--muted); }
.pill-ctx {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600;
  max-width: 220px; min-width: 0;
}
.pill-ctx span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-ctx em { font-style: normal; opacity: 0.75; }
.pill-unlock { padding: 5px 11px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }
.icon-text-btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-soft); white-space: nowrap; }
.icon-text-btn:hover { background: var(--bg); color: var(--ink); }

.chat-box { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; background: var(--surface); }
.chat-welcome { margin: auto; padding: 14px 4px; max-width: 620px; width: 100%; }
.chat-welcome h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.chat-welcome p { font-size: 14px; color: var(--ink-soft); margin-bottom: 18px; }
.cw-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.starter-card { background: var(--surface-warm); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; text-align: left; transition: border-color .14s, background .14s; }
.starter-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.starter-card strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.starter-card span { font-size: 12px; color: var(--muted); }

.chat-msg { font-size: 15px; line-height: 1.76; word-break: break-word; }
.chat-msg.user { align-self: flex-end; max-width: 82%; padding: 10px 15px; border-radius: 16px 16px 4px 16px; background: var(--brand); color: #fff; white-space: pre-wrap; }
.chat-msg.assistant { align-self: stretch; max-width: 72ch; padding: 4px 2px; color: var(--ink); }
.chat-body p { margin: 0 0 10px; }
.chat-body p:last-child { margin-bottom: 0; }
.chat-body h4 { font-size: 15.5px; color: var(--brand); margin: 14px 0 6px; font-weight: 700; }
.chat-body h4:first-child { margin-top: 0; }
.chat-body ul, .chat-body ol { margin: 6px 0 10px 20px; display: flex; flex-direction: column; gap: 5px; }
.chat-body code { background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: 13.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.chat-body blockquote { border-left: 3px solid var(--brand); padding: 6px 12px; margin: 8px 0; background: var(--brand-soft); border-radius: 0 8px 8px 0; color: var(--ink-soft); }
.chat-msg-img { display: block; max-width: 220px; max-height: 160px; border-radius: 9px; margin-bottom: 7px; border: 1px solid rgba(255,255,255,0.28); }
.chat-refs { font-size: 12px; color: var(--muted); margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.chat-msg-tools { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.ai-composer { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.img-preview { display: flex; flex-direction: column; gap: 7px; background: var(--surface-warm); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; }
.img-preview-top { display: flex; align-items: center; gap: 10px; }
.img-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex-shrink: 0; }
.img-preview-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.img-preview-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-target-inp { width: 100%; padding: 6px 10px; font-size: 12.5px; }
.img-send-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; white-space: nowrap; }

.composer-bar { display: flex; align-items: flex-end; gap: 8px; background: var(--bg); border: 1.5px solid var(--line); border-radius: 16px; padding: 6px 8px; transition: border-color .14s, background .14s; }
.composer-bar:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-ring); }
.composer-attach { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-soft); cursor: pointer; flex-shrink: 0; }
.composer-attach:hover { background: var(--bg-subtle); color: var(--brand); }
.composer-bar textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; outline: none; font-size: 15px; line-height: 1.5; padding: 5px 2px; max-height: 128px; }
.composer-send { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.composer-send:disabled { opacity: 0.45; }
.composer-stop { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--err); color: var(--err); background: var(--err-bg); display: grid; place-items: center; flex-shrink: 0; }

/* ==================== SETTINGS & CUSTOM MODELS ==================== */
.models-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.model-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-warm);
}
.model-row.active-model { border-color: var(--brand); background: var(--brand-soft); }
.model-row-info { min-width: 0; flex: 1; }
.model-row-info strong { display: block; font-size: 13.5px; }
.model-row-info small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-row-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.add-model-box { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.tts-setting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Floating TTS Mini Status Pill */
.tts-toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  background: var(--ink); color: #fff;
  padding: 9px 14px; border-radius: 99px;
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; box-shadow: var(--shadow-lg);
}
.tts-stop-btn {
  padding: 3px 9px; border-radius: 99px;
  background: rgba(255,255,255,0.18); color: #fff; font-size: 12px; font-weight: 600;
}
.tts-stop-btn:hover { background: rgba(255,255,255,0.28); }

/* ==================== OTHER VIEWS ==================== */
.drill-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.drill-stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; min-height: 320px; }
.drill-prog { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.mock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 9px; margin-bottom: 14px; }
.mock-btn { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; text-align: left; background: var(--surface-warm); display: flex; flex-direction: column; gap: 3px; }
.mock-btn.active, .mock-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.mock-btn strong { font-size: 13.5px; }
.mock-btn small { font-size: 12px; color: var(--muted); }
.iframe-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; height: 74vh; }
.iframe-wrap.tall { height: 80vh; }
.iframe-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.essay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 13px; }
.person-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.person-card h4 { font-size: 15.5px; color: var(--chinese); line-height: 1.4; }
.person-card .themes { font-size: 12px; background: var(--chinese-bg); color: var(--chinese); padding: 3px 9px; border-radius: 6px; align-self: flex-start; }
.person-card p { font-size: 13.5px; color: var(--ink-soft); white-space: pre-wrap; line-height: 1.7; }
.q-list { display: flex; flex-direction: column; gap: 12px; }
.locked-banner { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 13px; }
.v-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.v-card h4 { font-size: 15px; line-height: 1.45; margin: 0; }
.v-card pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; color: var(--ink-soft); max-height: 180px; overflow-y: auto; background: var(--bg); padding: 10px 12px; border-radius: 9px; }

.clickable-card { cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .14s ease; }
.clickable-card:hover { border-color: var(--brand); box-shadow: 0 6px 20px rgba(15, 23, 20, 0.06); transform: translateY(-1px); }
.clickable-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.card-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-tag-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--bg-subtle, var(--bg)); color: var(--ink-soft); }
.card-tag.tag-essay { background: var(--chinese-bg); color: var(--chinese); }
.card-tag.tag-review { background: rgba(217, 119, 6, 0.12); color: #b45309; }
.card-open-hint { font-size: 12px; color: var(--brand); font-weight: 500; white-space: nowrap; }
.card-preview { font-size: 13.5px; color: var(--ink-soft); line-height: 1.65; background: var(--bg); padding: 10px 12px; border-radius: 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; flex: 1; }
.v-card .q-actions, .person-card .q-actions { margin-top: auto; padding-top: 2px; }

/* ==================== MODALS & SHEETS ==================== */
.modal { border: 0; border-radius: 18px; padding: 0; width: min(440px, 92vw); margin: auto; box-shadow: var(--shadow-lg); }
.modal-wide { width: min(760px, 95vw); }
.modal::backdrop { background: rgba(15, 20, 18, 0.42); backdrop-filter: blur(4px); }
.modal-box { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.close-btn { width: 32px; height: 32px; border-radius: 9px; background: var(--bg); display: grid; place-items: center; flex-shrink: 0; color: var(--ink-soft); }
.close-btn:hover { background: var(--bg-subtle); color: var(--ink); }
.muted { font-size: 13px; color: var(--muted); }
.err-txt { font-size: 13px; color: var(--err); min-height: 18px; }
.chat-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.scan-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pre-box { background: var(--bg); padding: 12px; border-radius: 10px; white-space: pre-wrap; font-size: 13px; max-height: 280px; overflow-y: auto; }
.imp-panel { display: flex; flex-direction: column; gap: 10px; }
.imp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.imp-textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); font-size: 13.5px; line-height: 1.55; resize: vertical; outline: none; }
.imp-opts { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 13px; color: var(--ink-soft); }
.imp-opts label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.imp-opts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.drafts-list { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; }
.draft-card { background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.draft-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; font-size: 13px; color: var(--ink-soft); }
.draft-opts .is-ans { color: var(--ok); font-weight: 700; }

.modal-sheet { margin: auto auto 0 auto; width: min(520px, 100vw); border-radius: 20px 20px 0 0; }

/* Universal Card / Essay Detail Modal */
.modal-detail { width: min(800px, 94vw); max-width: 94vw; max-height: 88vh; overflow: hidden; }
.modal-detail[open] { display: flex; flex-direction: column; }
.detail-box { padding: 0; gap: 0; height: 100%; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.detail-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0; align-items: flex-start; }
.detail-head-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.detail-badge-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.detail-badge.is-essay { background: var(--chinese-bg); color: var(--chinese); }
.detail-status-tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(217, 119, 6, 0.14); color: #b45309; }
.detail-head h3 { font-size: 18px; line-height: 1.4; margin: 0; word-break: break-word; }
.detail-sub { font-size: 13px; color: var(--chinese); background: var(--chinese-bg); padding: 4px 10px; border-radius: 8px; align-self: flex-start; margin: 0; line-height: 1.5; }
.detail-body { flex: 1; min-height: 180px; overflow-y: auto; padding: 18px 24px 22px; -webkit-overflow-scrolling: touch; }
.detail-md { font-size: 15px; line-height: 1.82; color: var(--ink); word-break: break-word; }
.detail-md h4 { font-size: 16px; line-height: 1.45; margin: 18px 0 8px; padding-left: 10px; border-left: 3px solid var(--brand); color: var(--ink); }
.detail-md h4:first-child { margin-top: 0; }
.detail-md p { margin: 0 0 11px; }
.detail-md p:last-child { margin-bottom: 0; }
.detail-md ul, .detail-md ol { margin: 6px 0 12px 20px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.detail-md li { line-height: 1.75; }
.detail-md blockquote { margin: 10px 0 14px; padding: 12px 16px; background: var(--surface-warm, var(--bg)); border-left: 3.5px solid var(--chinese); border-radius: 0 10px 10px 0; color: var(--ink); font-size: 14.5px; line-height: 1.85; }
.detail-md code { background: var(--bg); padding: 1px 6px; border-radius: 5px; font-size: 0.92em; }
.detail-md hr { border: 0; border-top: 1px dashed var(--line); margin: 18px 0; }
.detail-foot { padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-warm, var(--bg)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0; }
.detail-nav { display: flex; align-items: center; gap: 8px; }
.detail-counter { font-size: 12.5px; color: var(--muted); min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.sheet-sec { display: flex; flex-direction: column; gap: 6px; }
.sheet-seg { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
.sheet-seg .seg { text-align: center; padding: 7px 4px; font-size: 12.5px; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more-item { background: var(--surface-warm); border: 1px solid var(--line); border-radius: 13px; padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.more-item .ic { color: var(--brand); margin-bottom: 2px; }
.more-item strong { font-size: 14px; }
.more-item small { font-size: 12px; color: var(--muted); }

/* ==================== RESPONSIVE ==================== */
.mob-nav { display: none; }

@media (max-width: 1024px) {
  .past-workspace { grid-template-columns: 1fr; }
  .past-sheet-aside {
    display: none; position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom));
    top: auto; max-height: 58vh; z-index: 40; box-shadow: var(--shadow-lg);
  }
  .past-sheet-aside.open { display: flex; }
  .past-sheet-aside .mob-only-btn { display: grid; }
  .ai-workspace { grid-template-columns: 1fr; }
  .ai-sidebar { display: none; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .mob-brand-mark { display: grid; }
  .mob-only-btn { display: inline-flex; }
  .topbar { padding: 9px 14px; }
  .subtitle { display: none; }
  .content { padding: 14px 14px calc(78px + env(safe-area-inset-bottom)); }
  .content.ai-mode-content { padding: 0 0 calc(58px + env(safe-area-inset-bottom)); }
  .ai-workspace { height: calc(100dvh - 51px - 58px - env(safe-area-inset-bottom)); min-height: 360px; }
  .ai-chat-main { border: 0; border-radius: 0; }
  .chat-box { padding: 16px 16px 20px; }
  .chat-welcome h2 { font-size: 19px; }
  .cw-starters, .tts-setting-grid, .opt-grid, .imp-opts-grid { grid-template-columns: 1fr; }
  .hero-surface { grid-template-columns: 1fr; padding: 20px 18px; }
  .q-card { padding: 18px 15px; }
  .q-stem { font-size: 15.5px; }
  .vocab-stage { padding: 20px 16px; }
  .kbd-hint { display: none; }
  .tts-toast { left: 14px; right: 14px; bottom: calc(68px + env(safe-area-inset-bottom)); justify-content: space-between; }

  .mob-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 35;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 5px 6px calc(6px + env(safe-area-inset-bottom));
    gap: 2px;
  }
  .mob-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); padding: 4px 0; border-radius: 10px; min-height: 44px; }
  .mob-nav .ic { width: 19px; height: 19px; }
  .mob-nav small { font-size: 11px; font-weight: 500; }
  .mob-nav button.active { color: var(--brand); background: var(--brand-soft); font-weight: 700; }
  .mob-nav button.mn-ai:not(.active) { color: var(--brand); }

  .modal-detail { margin: auto 0 0 0; width: 100vw; max-width: 100vw; height: 90dvh; max-height: 90dvh; border-radius: 20px 20px 0 0; }
  .detail-box { max-height: 90dvh; }
  .detail-head { padding: 16px 16px 12px; }
  .detail-head h3 { font-size: 16.5px; }
  .detail-body { padding: 14px 16px 18px; }
  .detail-md { font-size: 14.5px; line-height: 1.78; }
  .detail-foot { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); flex-direction: column; align-items: stretch; gap: 9px; }
  .detail-nav { justify-content: space-between; }
  .detail-actions { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
