:root {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #efeae0;
  --text: #22201b;
  --text-2: #5d574c;
  --muted: #8a8374;
  --line: #e2dbcc;
  --accent: #2f5d46;
  --accent-2: #3f7a5c;
  --accent-soft: #e3ece4;
  --warn: #9a5b13;
  --good: #2f6b3d;
  --good-soft: #e2efe3;
  --bad: #a23b2a;
  --bad-soft: #f6e2dd;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 16px rgba(40, 30, 10, .05);
  --radius: 12px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161714;
    --surface: #1e201c;
    --surface-2: #262923;
    --text: #ebe7dd;
    --text-2: #bdb7aa;
    --muted: #8d887c;
    --line: #34372f;
    --accent: #8cc4a2;
    --accent-2: #a6d6b8;
    --accent-soft: #24332a;
    --warn: #e0a95c;
    --good: #8fd09c;
    --good-soft: #1f3324;
    --bad: #ec9a8a;
    --bad-soft: #3a2420;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161714; --surface: #1e201c; --surface-2: #262923; --text: #ebe7dd; --text-2: #bdb7aa;
  --muted: #8d887c; --line: #34372f; --accent: #8cc4a2; --accent-2: #a6d6b8; --accent-soft: #24332a;
  --warn: #e0a95c; --good: #8fd09c; --good-soft: #1f3324; --bad: #ec9a8a; --bad-soft: #3a2420;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.75 var(--sans); min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; outline: none; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.35; letter-spacing: .01em; }
button, input, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.loading { color: var(--muted); padding: 48px 0; text-align: center; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: var(--serif); font-weight: 700; font-size: 18px; }
.brand img { border-radius: 6px; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a, .topnav button { font-size: 14px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  text-decoration: none; cursor: pointer; font-size: 15px; line-height: 1.4; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 首页 */
.hero { padding: 48px 0 32px; max-width: 760px; }
.hero .eyebrow { color: var(--accent); font-size: 14px; letter-spacing: .12em; margin: 0 0 12px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin: 0 0 16px; }
.hero p.lead { font-size: 18px; color: var(--text-2); margin: 0 0 24px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0 40px; }
.pillar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.pillar b { font-family: var(--serif); font-size: 17px; display: block; margin-bottom: 4px; }
.pillar span { color: var(--text-2); font-size: 14px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.section-title h2 { margin: 0; font-size: 24px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-head { display: flex; align-items: center; gap: 12px; }
.mono {
  width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 18px;
}
.card h3 { margin: 0; font-size: 19px; }
.card .meta { font-size: 13px; color: var(--muted); }
.card p { margin: 0; color: var(--text-2); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.card-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: auto; }

/* 表单 */
.auth { max-width: 420px; margin: 32px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow); }
.auth h1 { margin: 0 0 6px; font-size: 26px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; margin: 16px 0 20px; }
.tabs a { flex: 1; text-align: center; padding: 6px; border-radius: 999px; text-decoration: none; color: var(--text-2); font-size: 15px; }
.tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-size: 14px; color: var(--text-2); }
.field input, .field textarea {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; color: var(--text);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.error { color: var(--bad); font-size: 14px; min-height: 1.4em; margin: 4px 0 10px; }
.auth .btn { width: 100%; }

/* 课程页 */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.course-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; padding: 8px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.course-hero h1 { margin: 6px 0 8px; font-size: clamp(26px, 4vw, 36px); }
.course-hero p { color: var(--text-2); margin: 0; max-width: 720px; }
.course-stats { text-align: right; min-width: 180px; }
.course-stats .big { font-family: var(--serif); font-size: 28px; color: var(--accent); }
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; }
.chapter { margin-bottom: 28px; }
.chapter h2 { font-size: 21px; margin: 0 0 4px; }
.chapter .intro { color: var(--text-2); margin: 0 0 12px; font-size: 15px; }
.lessons { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.lessons li + li { border-top: 1px solid var(--line); }
.lessons a { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 12px 16px; text-decoration: none; color: var(--text); }
.lessons a:hover { background: var(--surface-2); }
.lessons .n { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.lessons .t small { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
.lessons .s { font-size: 13px; color: var(--muted); white-space: nowrap; }
.lessons .done .n { color: var(--good); }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.side-box h3 { margin: 0 0 8px; font-size: 16px; }
.side-box p, .side-box li { font-size: 14px; color: var(--text-2); }
.side-box ul { padding-left: 18px; margin: 0; }
.glossary dt { font-weight: 600; font-size: 14px; margin-top: 8px; }
.glossary dd { margin: 0; font-size: 13px; color: var(--text-2); }

/* 课时页 */
.lesson-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; }
.toc { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font-size: 14px; }
.toc h4 { margin: 14px 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .05em; }
.toc a { display: block; padding: 5px 10px; border-radius: 8px; text-decoration: none; color: var(--text-2); line-height: 1.45; }
.toc a:hover { background: var(--surface-2); }
.toc a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc a.done::before { content: "✓ "; color: var(--good); }
.lesson { min-width: 0; max-width: 760px; }
.lesson header h1 { font-size: clamp(24px, 3.6vw, 32px); margin: 4px 0 8px; }
.lesson header .sum { color: var(--text-2); font-size: 17px; margin: 0 0 8px; }
.prose { font-size: 16.5px; }
.prose h3 { font-size: 20px; margin: 28px 0 8px; }
.prose h4 { font-size: 17px; margin: 22px 0 6px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose blockquote { margin: 16px 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text); }
.prose blockquote p:last-child { margin: 0; }
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.table-wrap { overflow-x: auto; margin: 14px 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.6; }
.prose th, .prose td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.takeaways { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 28px 0; }
.takeaways h3 { margin: 0 0 8px; font-size: 17px; }
.takeaways ul { margin: 0; padding-left: 20px; }

.quiz { margin: 32px 0; }
.quiz > h2 { font-size: 22px; margin: 0 0 4px; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.q .qt { font-weight: 600; margin: 0 0 10px; }
.q .kind { font-size: 12px; color: var(--accent); letter-spacing: .08em; margin-bottom: 4px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; cursor: pointer; }
.opt input { margin-top: 6px; accent-color: var(--accent); }
.opt:hover { border-color: var(--accent); }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.explain { margin-top: 10px; font-size: 15px; color: var(--text-2); padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.q textarea { width: 100%; min-height: 96px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); resize: vertical; }
.q .row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-radius: var(--radius); background: var(--accent-soft); margin: 18px 0; }
.result b { font-family: var(--serif); font-size: 20px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { max-width: 48%; }

/* 我的 / 管理 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel h2 { margin: 0 0 12px; font-size: 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-family: var(--serif); font-size: 26px; color: var(--accent); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13px; color: var(--muted); }
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th, .data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data th { color: var(--muted); font-weight: 600; }
.data td.num { font-variant-numeric: tabular-nums; }
.codes { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 12px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; }

.footer { border-top: 1px solid var(--line); padding: 20px 16px 28px; text-align: center; font-size: 13px; color: var(--text-2); }
.footer p { max-width: 760px; margin: 4px auto; }

@media (max-width: 900px) {
  .course-layout, .lesson-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--surface); }
  .toc details summary { cursor: pointer; padding: 4px 6px; font-weight: 600; }
  .course-hero { grid-template-columns: 1fr; }
  .course-stats { text-align: left; }
}
@media (min-width: 901px) { .toc details { display: none; } }
@media (max-width: 900px) { .toc-flat { display: none; } }
@media (max-width: 520px) {
  .lessons a { grid-template-columns: 24px 1fr; }
  .lessons .s { grid-column: 2; }
  .pager { flex-direction: column; }
  .pager a { max-width: 100%; }
}
.brand span { white-space: nowrap; }
@media (max-width: 520px) {
  .topbar { padding: 8px 12px; }
  .topnav { gap: 2px; flex-wrap: nowrap; }
  .topnav .btn { padding: 6px 10px; font-size: 14px; }
  .topnav .nav-home { display: none; }
}
.kind { display: inline-block; font-family: var(--sans); font-size: 11.5px; font-weight: 600; line-height: 1.6; padding: 0 7px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; letter-spacing: .04em; }
.kind.basics { background: #e6eef6; color: #2c5a85; }
.kind.essentials { background: #f6ecdc; color: #8a5a12; }
.kind.logic { background: var(--accent-soft); color: var(--accent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kind.basics { background: #1f2c3a; color: #9cc3ea; }
  :root:not([data-theme="light"]) .kind.essentials { background: #3a2e1c; color: #e6bf7f; }
}
:root[data-theme="dark"] .kind.basics { background: #1f2c3a; color: #9cc3ea; }
:root[data-theme="dark"] .kind.essentials { background: #3a2e1c; color: #e6bf7f; }
.pillar b .kind { font-size: 12px; }
@media (max-width: 360px) {
  .brand span { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
  .topbar { padding: 8px 10px; }
  .topnav { gap: 0; }
  .topnav .btn { padding: 5px 8px; font-size: 13px; }
}
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--bad); color: var(--surface); font-size: 11px; line-height: 18px; text-align: center; }
.habit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.habit-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px; display: flex; flex-direction: column; }
.habit-item b { font-family: var(--serif); font-size: 22px; }
.habit-item span { font-size: 13px; color: var(--muted); }
.warmup { background: var(--surface); border: 1px dashed var(--accent); border-radius: var(--radius); padding: 16px 20px; margin: 8px 0 24px; }
.warmup .kind-line { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.warmup .qt { font-weight: 600; margin: 0 0 10px; }
.opt.guess { width: 100%; text-align: left; background: var(--bg); font-size: 15px; }
.opt.guess:disabled { cursor: default; opacity: .75; }
.opt.guess.picked { opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.reveal-box { border-style: solid; }
.model-task { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); padding: 16px 20px; margin: 24px 0; }
.model-task h3 { margin: 0 0 4px; font-size: 17px; }
.model-task ol { padding-left: 20px; margin: 8px 0; }
.model-task .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.hook { font-family: var(--serif); font-size: 17.5px; line-height: 1.85; color: var(--text); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border-radius: var(--radius); padding: 18px 22px; margin: 4px 0 20px; }
.can-answer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 28px; }
.can-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.can-head h2 { margin: 0 0 8px; font-size: 19px; }
.can-answer ol { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 6px 20px; }
.can-answer li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--text-2); }
.can-answer li.yes { color: var(--text); }
.tick { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface-2); color: var(--muted); margin-top: 3px; }
.can-answer li.yes .tick { background: var(--accent); color: var(--surface); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.save-state { font-size: 13px; min-height: 1.2em; margin-top: 4px; }
.celebrate { text-align: center; background: linear-gradient(160deg, var(--accent-soft), var(--surface)); border: 1px solid var(--accent); border-radius: var(--radius); padding: 24px 20px; margin: 20px 0; animation: pop .35s ease-out; }
.celebrate .big-emoji { font-size: 44px; line-height: 1; }
.celebrate h3 { font-size: 22px; margin: 10px 0 6px; }
.celebrate ul { text-align: left; max-width: 560px; margin: 12px auto; }
.celebrate .bar { max-width: 360px; margin: 12px auto 4px; }
.celebrate .row { justify-content: center; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .celebrate { animation: none; } }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; max-width: 820px; margin: 0 auto 20px; }
.sheet h1 { margin: 4px 0 8px; }
.sheet .eyebrow { color: var(--accent); margin: 0; font-size: 14px; }
.sheet-unit { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.sheet-unit.pending h3 { color: var(--muted); }
.sheet-unit h3 { font-size: 17px; margin: 0 0 8px; }
.sheet-unit ul { margin: 4px 0 8px; padding-left: 20px; font-size: 15px; }
.my-answer { background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; margin: 6px 0; }
.my-answer p { margin: 2px 0 0; white-space: pre-wrap; }
.my-answer .muted { font-size: 13px; }
.sheet-foot { text-align: center; font-size: 12px; margin-top: 16px; }
.cert-wrap { max-width: 540px; margin: 0 auto 16px; }
.cert-wrap canvas { width: 100%; height: auto; border-radius: 8px; box-shadow: var(--shadow); }
@media print {
  .topbar, .footer, .no-print { display: none !important; }
  body { background: #fff; }
  .sheet { border: 0; padding: 0; }
}
@media (max-width: 520px) { .sheet { padding: 20px 16px; } }
.ai-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.model-pick { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.chip { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.chip small { margin-left: 3px; font-size: 10.5px; color: var(--muted); }
.chip.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.quota { font-size: 13px; }
.ai-card { margin-top: 12px; border-radius: 10px; padding: 12px 16px; border: 1px solid var(--line); background: var(--bg); }
.ai-card.mastered { border-color: var(--good); }
.ai-card.partial { border-color: var(--warn); }
.ai-card.missing { border-color: var(--bad); }
.ai-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ai-head .muted { font-size: 12.5px; }
.ai-card ul { margin: 4px 0 8px; padding-left: 0; list-style: none; font-size: 15px; }
.ai-card .hits li::before { content: "✓ "; color: var(--good); font-weight: 700; }
.ai-card .misses li::before { content: "✗ "; color: var(--bad); font-weight: 700; }
.ai-card p { margin: 6px 0; }
.followup { color: var(--accent); }
.field select { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; color: var(--text); }
.credit-pill { font-variant-numeric: tabular-nums; }
.asof { white-space: nowrap; }
.stale { font-size: 13.5px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 6px 12px; margin: 6px 0 14px; }
.stale.warn { background: #fbefd9; color: #7a4a0c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stale.warn { background: #3a2e1c; color: #e6bf7f; } }
.ask-fab { position: fixed; right: 20px; bottom: 84px; z-index: 20; border: 0; border-radius: 999px; padding: 12px 18px; background: var(--accent); color: var(--surface); font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.18); cursor: pointer; }
.ask-panel { position: fixed; right: 16px; bottom: 16px; z-index: 30; width: min(440px, calc(100vw - 32px)); height: min(640px, calc(100vh - 96px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.2); overflow: hidden; }
.ask-panel[hidden] { display: none; }
.ask-panel header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.ask-panel header b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.msg { max-width: 92%; padding: 8px 12px; border-radius: 12px; line-height: 1.65; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--surface); white-space: pre-wrap; }
.msg.ai { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.msg.ai p { margin: 0 0 8px; } .msg.ai p:last-child { margin: 0; }
.msg.ai ul, .msg.ai ol { padding-left: 20px; margin: 4px 0 8px; }
.ask-suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; }
.ask-suggest .chip { background: var(--surface-2); }
.ask-panel form { border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.ask-panel textarea { width: 100%; resize: none; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 15px; }
.ask-panel .row { justify-content: space-between; margin-top: 6px; }
.ask-meta { font-size: 12.5px; margin-top: 4px; }
@media (max-width: 520px) { .ask-panel { right: 0; bottom: 0; width: 100vw; height: 85vh; border-radius: 14px 14px 0 0; } }
@media print { .ask-fab, .ask-panel { display: none !important; } }
.lesson header { position: relative; }
.mode-toggle { float: right; font-size: 13px; padding: 4px 10px; margin: -4px 0 0 8px; }
.deck { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); margin: 8px 0 20px; overflow: hidden; }
.deck-stage { position: relative; }
.card-slide { padding: 24px 28px; height: var(--card-h, 520px); overflow-y: auto; overscroll-behavior: contain; }
.card-slide.enter { animation: slideIn .22s ease-out; }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card-slide.enter { animation: none; } }
.card-slide > :first-child { margin-top: 0; }
.card-slide .hook, .card-slide .warmup, .card-slide .takeaways, .card-slide .model-task, .card-slide .q, .card-slide .result { margin: 0 0 16px; }
.card-slide h3 { font-size: 21px; }
.card-slide > p, .card-slide > ul, .card-slide > ol, .card-slide > blockquote, .card-slide > .table-wrap { font-size: 16.5px; }
.card-slide > blockquote { margin: 16px 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.card-slide > ul, .card-slide > ol { padding-left: 22px; }
.card-slide .table-wrap table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.6; }
.card-slide .table-wrap th, .card-slide .table-wrap td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.card-slide .table-wrap th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.deck-ctrl { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.deck-mid { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.deck-progress { flex: 1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.deck-progress i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s; }
.deck-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 520px) {
  .card-slide { padding: 18px 16px; }
  .deck-ctrl { padding: 8px 10px; gap: 8px; }
  .deck-ctrl .btn { padding: 8px 12px; font-size: 14px; }
  .mode-toggle { float: none; margin: 0 0 6px; }
}
table.xl { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.xl th, table.xl td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: top; }
table.xl th:first-child { text-align: left; white-space: normal; min-width: 160px; font-weight: 500; }
table.xl thead th { background: var(--surface-2); font-weight: 600; }
table.xl.out td { font-weight: 600; }
.xl-in { display: inline-flex; align-items: center; gap: 2px; }
.xl-in input { width: 84px; text-align: right; padding: 4px 6px; border: 1px solid #a9c4e3; border-radius: 6px; background: #eef5fd; color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
.xl-in.changed input { border-color: var(--warn); background: #fdf3e2; font-weight: 600; }
.xl-in span { font-size: 12px; color: var(--muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .xl-in input { background: #1f2c3a; border-color: #3b5674; } :root:not([data-theme="light"]) .xl-in.changed input { background: #3a2e1c; border-color: #8a6a32; } }
.delta { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.delta.up, .delta.down { color: var(--warn); }
.xl-err { color: var(--muted); font-size: 12px; }
.model-task .table-wrap { margin: 10px 0; }
.model-links { font-size: 13px; margin: 8px 0 0; }
.model-bar { margin: 8px 0 12px; }
.model-sheet { max-height: calc(100vh - 230px); overflow: auto; }
table.xl.full thead th { position: sticky; top: 0; z-index: 2; }
table.xl.full th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 220px; max-width: 280px; }
table.xl.full thead th:first-child { z-index: 3; background: var(--surface-2); }
table.xl.full tr.sec th { background: var(--accent-soft); color: var(--accent); position: static; font-weight: 700; }
table.xl.full th.ind { padding-left: 22px; color: var(--text-2); }
table.xl.full td.hist { color: var(--text-2); }
table.xl.full td.moved { background: #fdf3e2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) table.xl.full td.moved { background: #3a2e1c; } }
.note { cursor: help; color: var(--muted); font-size: 12px; }
.model-notes { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin: 8px 0; font-size: 14px; }
.model-notes summary { cursor: pointer; font-weight: 600; }
.model-notes ul { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); }
.model-disclaimer { background: var(--surface-2); border-left: 3px solid var(--warn); border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 8px 0; font-size: 14.5px; color: var(--text-2); }
.legal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.legal-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.legal-nav a { padding: 4px 12px; border-radius: 999px; text-decoration: none; color: var(--text-2); font-size: 14px; }
.legal-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.legal { max-width: 780px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 32px; }
.legal h1 { margin-top: 0; }
.legal h2 { font-size: 19px; margin: 24px 0 8px; }
@media (max-width: 520px) { .legal { padding: 18px 16px; } }
.footer-links a { color: var(--text-2); }
.buy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 8px 0; }
.buy-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.buy-card p { margin: 0; font-size: 14px; flex: 1; }
.buy-price { font-family: var(--serif); font-size: 22px; color: var(--accent); }
.buy-note { font-size: 13px; }
