/* 作文研究室 · 视觉系统
 * 低饱和纸感浅色 / 炭黑深色；不使用渐变、玻璃拟态与外部字体。
 */

:root {
  color-scheme: light;
  --bg: #f2f0e9;
  --bg-deep: #ece9e0;
  --surface: #faf8f2;
  --surface-2: #f6f3eb;
  --surface-3: #eeeae0;
  --text: #252620;
  --text-soft: #4f5048;
  --muted: #5b5b52;
  --faint: #6d6d63;
  --line: #ddd9cf;
  --line-strong: #c9c4b8;
  --accent: #4d6855;
  --accent-strong: #39513f;
  --accent-soft: #e3eae1;
  --accent-line: #b9cab9;
  --warm: #7d5f39;
  --warm-soft: #f0e7d8;
  --danger: #93483c;
  --danger-soft: #f2e3df;
  --success: #3f6650;
  --shadow: 0 1px 0 rgba(37, 38, 32, 0.04);
  --radius: 6px;
  --radius-sm: 4px;
  --tap: 44px;
  --text-base: 15.5px;
  --line-body: 1.78;
  --sidebar-w: 228px;
  --content-w: 940px;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141513;
  --bg-deep: #10110f;
  --surface: #1a1b18;
  --surface-2: #1f201c;
  --surface-3: #262721;
  --text: #e9e7df;
  --text-soft: #c9c7bd;
  --muted: #a9a89e;
  --faint: #8f8e84;
  --line: #30322c;
  --line-strong: #41443b;
  --accent: #9db59e;
  --accent-strong: #b8cbb8;
  --accent-soft: #252d25;
  --accent-line: #4a5c4b;
  --warm: #c1a278;
  --warm-soft: #302a20;
  --danger: #d08e82;
  --danger-soft: #352421;
  --success: #9dbd9f;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.24);
}

html[data-font="sm"] { --text-base: 14.5px; }
html[data-font="md"] { --text-base: 15.5px; }
html[data-font="lg"] { --text-base: 17px; --line-body: 1.82; }
html[data-font="xl"] { --text-base: 18.5px; --line-body: 1.86; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: var(--line-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

/* 默认禁止非编辑区域选中，避免 Android Chrome 长按触发轻触搜索。
   输入控件、复制后的正文和“允许选择正文”模式单独放开。 */
body,
.app-shell,
button,
a,
label,
summary,
nav,
h1, h2, h3, h4,
.tag,
.badge,
.stat,
.nav-item,
.icon-btn,
.bottom-nav {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body.allow-select .prose,
body.allow-select .selectable,
body.allow-select .reading-text,
body.allow-select .material-text,
body.allow-select .demo-text,
body.allow-select .detail-text,
body.allow-select .short-text {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

input,
textarea,
select,
option,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
}

[hidden] { display: none !important; }

img, svg { max-width: 100%; }
img { -webkit-user-drag: none; user-drag: none; }
button, .button, .chip, .tag, .nav-item, .icon-btn, summary {
  touch-action: manipulation;
}
button { font-family: inherit; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
::selection { background: var(--accent-soft); color: var(--text); }

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.32;
}
p { margin: 0.65em 0; }
ul, ol { margin: 0.5em 0; padding-left: 1.25em; }
li { margin: 0.28em 0; }
strong, b { font-weight: 650; }
small { font-size: 0.82em; }
hr { border: none; border-top: 1px solid var(--line); margin: 24px 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  z-index: 999;
}
.skip-link:focus { top: 12px; }

/* ---------- 框架 ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  padding-top: max(26px, env(safe-area-inset-top));
  border-right: 1px solid var(--line);
  background: var(--bg-deep);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 0 8px 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-decoration: none;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--bg);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  border-radius: 3px;
}
.brand-name {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.25;
}
.brand-sub {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-top: 2px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 0;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
}
.nav-item .nav-icon { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.86; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item.active .nav-icon { opacity: 1; color: var(--accent); }
.nav-item .nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.side-foot {
  margin-top: auto;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}
.side-foot .dot-line { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex: 0 0 6px;
}
.status-dot.offline { background: var(--warm); }

.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 9px max(18px, env(safe-area-inset-left)) 9px max(18px, env(safe-area-inset-right));
  padding-top: max(9px, env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.mobile-brand { display: none; }
.topbar-title {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
}
.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
}
.icon-btn {
  width: var(--tap);
  height: var(--tap);
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { width: 19px; height: 19px; }
.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-width: 210px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--text); }
.search-trigger svg { width: 16px; height: 16px; flex: 0 0 16px; }
.search-trigger .kbd { margin-left: auto; }
.kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  background: var(--surface-2);
}

.view {
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 38px max(22px, env(safe-area-inset-left)) 80px max(22px, env(safe-area-inset-right));
  flex: 1;
}
.view.page-enter { animation: view-in 220ms ease-out both; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

.bottom-nav { display: none; }
.footer-note {
  max-width: var(--content-w);
  width: 100%;
  margin: 0 auto;
  padding: 20px 22px 32px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.7;
  border-top: 1px solid var(--line);
}

/* ---------- 页头 ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 9px;
}
.page-head h1 {
  font-size: clamp(27px, 4.2vw, 38px);
  letter-spacing: 0.015em;
}
.page-head .lede {
  max-width: 620px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.section { margin-top: 34px; }
.section:first-child { margin-top: 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.section-title {
  font-size: 19px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.section-title::before {
  content: "";
  width: 3px;
  height: 16px;
  background: var(--accent);
  display: inline-block;
  flex: 0 0 3px;
}
.section-note { color: var(--muted); font-size: 12px; }
.section-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px;
  min-height: 38px;
}
.section-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 首页 ---------- */
.hero {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 28px 28px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "文";
  position: absolute;
  right: 18px;
  bottom: -36px;
  font-family: var(--serif);
  font-size: 160px;
  line-height: 1;
  color: var(--text);
  opacity: 0.035;
  pointer-events: none;
  user-select: none;
}
.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  max-width: 620px;
}
.hero .lede {
  max-width: 600px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14.5px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: 14px;
  overflow: hidden;
}
.stat {
  padding: 17px 16px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.stat:first-child { border-left: 0; }
.stat b {
  display: block;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat span { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.stat .stat-unit { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 2px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.85fr);
  gap: 14px;
  margin-top: 14px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.panel-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.panel-sub { color: var(--muted); font-size: 12px; margin-bottom: 13px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-action {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 62px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.quick-action:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.quick-action svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--accent); margin-top: 2px; }
.quick-action b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.quick-action small { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 1px; }

.progress-line {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin: 12px 0 7px;
}
.progress-line i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 320ms ease;
}
.progress-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11.5px;
  margin-bottom: 12px;
}
.recent-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.recent-item:first-of-type { border-top: 0; }
.recent-item .muted { font-size: 11px; white-space: nowrap; }

/* ---------- 通用 ---------- */
.stacked { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.divider { border-top: 1px solid var(--line); margin: 16px 0; }
.top-gap { margin-top: 14px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
}
.button svg { width: 16px; height: 16px; flex: 0 0 16px; }
.button:hover { border-color: var(--text-soft); }
.button:active { transform: translateY(1px); }
.button.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
html[data-theme="dark"] .button.primary:hover { color: #10110f; }
.button.accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
html[data-theme="dark"] .button.accent { color: #10110f; }
.button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.button.ghost:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.button.danger:hover { background: var(--danger-soft); }
.button.small { min-height: 38px; padding: 5px 10px; font-size: 12px; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.wide { width: 100%; }

.icon-svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.tag-row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tag {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}
.tag.core { color: var(--accent-strong); border-color: var(--accent-line); background: var(--accent-soft); }
.tag.extension { color: var(--warm); border-color: var(--warm); background: transparent; }
.tag.status-learning { color: var(--warm); border-color: var(--warm); }
.tag.status-mastered { color: var(--success); border-color: var(--accent-line); background: var(--accent-soft); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10.5px;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.badge.verify { color: var(--warm); border-color: var(--line); background: var(--warm-soft); }
.badge.custom { color: var(--accent-strong); border-color: var(--accent-line); background: var(--accent-soft); }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.chip.active .chip-count { color: var(--bg); opacity: 0.75; }
.chip .chip-count { margin-left: 5px; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }

/* ---------- 工具栏与搜索 ---------- */
.toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.field { min-width: 0; }
.search-field {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}
.search-field svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}
.search-field input { padding-left: 35px; }
input[type="text"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="search"]::-webkit-search-cancel-button {
  filter: grayscale(1);
  opacity: 0.65;
  cursor: pointer;
}
textarea { min-height: 108px; resize: vertical; line-height: 1.7; }
select { cursor: pointer; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.form-hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(106px, 1fr));
  gap: 6px;
}
.check-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
}
.check-chip input { width: 14px; height: 14px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
.check-chip:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.filter-chips .chip { min-height: 38px; }
.toolbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 2px 13px;
  color: var(--muted);
  font-size: 12px;
}
.result-count { font-variant-numeric: tabular-nums; }

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 2px;
  gap: 2px;
}
.segmented button {
  border: 0;
  min-height: 38px;
  padding: 5px 12px;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

.year-nav {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 3px;
  margin-bottom: 14px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.year-nav .chip { flex: 0 0 auto; min-width: 58px; font-variant-numeric: tabular-nums; }

/* ---------- 真题 ---------- */
.entry-list { border-top: 1px solid var(--line); }
.q-entry {
  border-bottom: 1px solid var(--line);
  padding: 17px 2px 15px;
}
.q-entry:first-child { border-top: 0; }
.q-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.q-entry-main { min-width: 0; flex: 1; }
.q-year {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.q-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  margin: 3px 0 4px;
  line-height: 1.35;
}
.q-material {
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.7;
  margin: 5px 0 8px;
}
.q-cta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
}
.q-expand {
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.q-expand:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.q-detail {
  margin-top: 14px;
  padding: 15px 16px;
  border-left: 2px solid var(--accent-line);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  animation: detail-in 180ms ease both;
}
@keyframes detail-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-block { margin-bottom: 14px; }
.detail-block:last-child { margin-bottom: 0; }
.detail-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--faint);
  font-weight: 650;
  margin-bottom: 5px;
}
.detail-block p { font-size: 13.5px; line-height: 1.75; margin: 5px 0; }
.detail-block ul { font-size: 13.5px; line-height: 1.75; }
.core-idea {
  font-size: 14px;
  color: var(--text);
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.related-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.person-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
}
.person-link:hover { border-color: var(--accent-line); color: var(--accent-strong); background: var(--accent-soft); }
.copy-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}
.status-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 11px;
}
.status-label { font-size: 11px; color: var(--faint); margin-right: 2px; }
.status-btn {
  min-height: 38px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}
.status-btn:hover { border-color: var(--line-strong); color: var(--text); }
.status-btn.active[data-status="unset"] { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
.status-btn.active[data-status="learning"] { background: var(--warm-soft); color: var(--warm); border-color: var(--warm); }
.status-btn.active[data-status="mastered"] { background: var(--accent-soft); color: var(--success); border-color: var(--accent-line); }
.fav-btn {
  min-width: 40px;
  min-height: 38px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.fav-btn.active { color: var(--warm); border-color: var(--warm); background: var(--warm-soft); }
.fav-btn svg { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- 趋势 ---------- */
.trend-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.trend-summary .item { font-size: 12px; color: var(--muted); }
.trend-summary .item b { font-size: 17px; color: var(--text); font-family: var(--serif); margin-right: 3px; }
.chart {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
}
.chart-row { margin: 12px 0; }
.chart-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  margin-bottom: 4px;
}
.chart-label .chart-nums { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 1px;
  overflow: hidden;
  display: flex;
}
.chart-fill { height: 100%; display: block; }
.chart-fill.core { background: var(--accent); }
.chart-fill.extension { background: var(--warm); opacity: 0.78; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.legend-key { display: inline-flex; align-items: center; gap: 5px; }
.legend-key i { width: 9px; height: 9px; display: inline-block; }
.legend-key i.core { background: var(--accent); }
.legend-key i.extension { background: var(--warm); }
.chart-note { color: var(--muted); font-size: 11.5px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
.trend-filter { margin: 16px 0; }
.theme-role-note {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

/* ---------- 人物 ---------- */
.people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.person-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
}
.person-card:hover { border-color: var(--line-strong); }
.person-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.person-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}
.person-headline { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.person-short {
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.72;
  margin: 10px 0 9px;
  flex: 1;
}
.person-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.person-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.recite-mask {
  margin: 9px 0;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
.recite-mask button {
  margin-top: 7px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 3px;
  cursor: pointer;
}
.recalled-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.recalled-actions .button { min-height: 34px; font-size: 12px; padding: 4px 10px; }

/* ---------- 方法 ---------- */
.method-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.method-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  min-width: 0;
}
.method-cat {
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
}
.method-title {
  font-family: var(--serif);
  font-size: 18px;
  margin: 4px 0 6px;
}
.method-summary { color: var(--text-soft); font-size: 13px; line-height: 1.7; }
.method-steps { margin-top: 8px; font-size: 12.5px; line-height: 1.75; color: var(--text-soft); padding-left: 1.2em; }
.method-example {
  margin-top: 10px;
  padding: 9px 10px;
  border-left: 2px solid var(--accent-line);
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-soft);
}
.method-pitfall { margin-top: 8px; color: var(--warm); font-size: 11.5px; line-height: 1.65; }
.method-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- 复习 ---------- */
.review-top {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}
.review-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.review-number {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.05;
  font-weight: 600;
}
.review-number small { font-family: var(--sans); font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.review-split {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.review-split .mini-stat {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  min-width: 0;
}
.mini-stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.mini-stat span { font-size: 10.5px; color: var(--muted); }
.review-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.weak-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.weak-item:first-child { border-top: 0; }
.weak-item .rate { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.advice-list { margin: 0; padding: 0; list-style: none; }
.advice-list li {
  position: relative;
  padding: 9px 0 9px 21px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.7;
}
.advice-list li:first-child { border-top: 0; }
.advice-list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 16px;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}
.activity-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-soft);
}
.activity-row:first-child { border-top: 0; }
.activity-row time { color: var(--faint); font-size: 10.5px; white-space: nowrap; }
.review-empty { padding: 18px 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.fav-list { border-top: 1px solid var(--line); }
.fav-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.fav-line:last-child { border-bottom: 0; }
.fav-line .fav-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 设置 ---------- */
.settings-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}
.settings-head {
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: 0; }
.settings-copy { min-width: 0; }
.settings-copy b { display: block; font-size: 13.5px; font-weight: 600; }
.settings-copy span { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.6; margin-top: 2px; }
.settings-control { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; }
.theme-options { display: flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; flex-wrap: wrap; }
.theme-options button {
  min-height: 40px;
  padding: 5px 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.theme-options button:first-child { border-left: 0; }
.theme-options button.active { background: var(--text); color: var(--bg); }
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-3);
  cursor: pointer;
  padding: 0;
  transition: background 160ms ease, border-color 160ms ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-soft);
  transition: transform 160ms ease, background 160ms ease;
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: #fff; }
html[data-theme="dark"] .switch[aria-checked="true"]::after { background: #10110f; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 17px; }
.storage-status {
  padding: 11px 17px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.storage-status.warn { color: var(--danger); background: var(--danger-soft); }
.about-copy { padding: 15px 17px; font-size: 12.5px; line-height: 1.8; color: var(--text-soft); }
.about-copy p { margin: 0.4em 0; }
.source-list { margin: 0; padding: 0; list-style: none; }
.source-list li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.source-list li:first-child { border-top: 0; }
.source-list a { overflow-wrap: anywhere; }
.install-note { padding: 0 17px 14px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }

/* ---------- 弹窗 / 抽屉 / Toast ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 17, 15, 0.46);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fade-in 160ms ease both;
}
html[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.64); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(640px, 100%);
  max-height: min(88vh, 900px);
  max-height: min(88dvh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  animation: modal-in 190ms ease both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal.wide { width: min(820px, 100%); }
.modal.narrow { width: min(460px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 17px 19px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.modal-head h2 { font-size: 20px; }
.modal-head p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.modal-close {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.modal-close:hover { color: var(--text); border-color: var(--line); }
.modal-body {
  padding: 18px 19px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 13px 19px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.modal-foot .spacer { margin-right: auto; }
.modal-section { margin-bottom: 17px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section h3 { font-size: 16px; margin-bottom: 6px; }
.modal-section p { font-size: 13.5px; line-height: 1.78; }
.modal-prose { font-size: 13.5px; line-height: 1.82; color: var(--text-soft); }
.modal-prose p { margin: 0.55em 0; }
.modal-prose ul { margin: 0.4em 0; padding-left: 1.3em; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.modal-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.search-modal .modal { height: min(80vh, 720px); height: min(80dvh, 720px); }
.search-input-wrap { position: relative; padding: 14px 19px; border-bottom: 1px solid var(--line); background: var(--surface); }
.search-input-wrap svg { position: absolute; left: 31px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search-input-wrap input {
  padding-left: 41px;
  font-size: 16px;
  background: var(--bg);
}
.search-results { padding: 4px 19px 18px; overflow-y: auto; flex: 1; }
.search-group-title {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--faint);
  font-weight: 650;
  padding: 14px 0 5px;
  border-bottom: 1px solid var(--line);
}
.search-result {
  display: block;
  width: 100%;
  padding: 10px 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.search-result:hover { background: var(--surface-2); }
.search-result b { display: block; font-size: 13.5px; font-weight: 600; }
.search-result span { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; line-height: 1.55; }
.search-empty { padding: 32px 0; text-align: center; color: var(--muted); font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  z-index: 300;
  max-width: min(88vw, 420px);
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  line-height: 1.55;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 170ms ease, transform 170ms ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.warn { background: var(--danger); color: #fff; }

.update-bar {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 240;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(92vw, 460px);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  font-size: 12.5px;
}
.update-bar .button { min-height: 32px; padding: 4px 10px; font-size: 12px; }
.offline-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 11.5px;
  border-bottom: 1px solid var(--line);
}

/* ---------- 空状态 / 提示 ---------- */
.empty {
  padding: 38px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.empty b { display: block; color: var(--text); font-family: var(--serif); font-size: 17px; margin-bottom: 3px; }
.notice {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.72;
}
.notice.warm { border-left-color: var(--warm); }
.notice.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.notice b { color: var(--text); }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }

/* ---------- 桌面 / 平板 ---------- */
@media (min-width: 1020px) {
  .view { padding-top: 46px; }
}
@media (max-width: 840px) {
  .sidebar { display: none; }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    width: auto;
    min-height: 44px;
    padding: 0;
    border-bottom: 0;
  }
  .mobile-brand .brand-mark { width: 28px; height: 28px; flex-basis: 28px; font-size: 16px; }
  .mobile-brand .brand-name { font-size: 15px; letter-spacing: 0.03em; }
  .mobile-brand .brand-sub { display: none; }
  .topbar { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); gap: 7px; }
  .topbar-title { display: none; }
  .search-trigger { min-width: 0; width: 44px; height: 44px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-trigger span, .search-trigger .kbd { display: none; }
  .search-trigger svg { width: 19px; height: 19px; }
  .top-actions { gap: 2px; }
  .view { padding: 25px max(16px, env(safe-area-inset-left)) 100px max(16px, env(safe-area-inset-right)); }
  .footer-note { padding-bottom: 100px; }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding: 4px 3px calc(4px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .bottom-nav button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 1px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    cursor: pointer;
    border-radius: 0;
  }
  .bottom-nav button svg { width: 19px; height: 19px; }
  .bottom-nav button.active { color: var(--accent-strong); }
  .bottom-nav button.active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 22px;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
  }
  .bottom-nav button { position: relative; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: 1fr; }
  .method-list { grid-template-columns: 1fr; }
  .review-top { grid-template-columns: 1fr; }
  .review-cols { grid-template-columns: 1fr; }
  .hero { padding: 22px 18px 20px; }
  .hero h1 { font-size: 31px; }
  .stat { padding: 13px 11px; }
  .stat b { font-size: 23px; }
  .stat span { font-size: 10.5px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 20px; }
  .head-actions { justify-content: flex-start; }
  .q-detail { padding: 13px 12px; }
  .settings-row { align-items: flex-start; }
  .settings-control { align-self: flex-start; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.wide, .modal.narrow {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 10px 10px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    animation: sheet-in 210ms ease both;
  }
  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .modal-head { padding-top: 15px; }
  .modal-foot { padding-bottom: calc(13px + env(safe-area-inset-bottom)); }
  .search-modal .modal { height: 88vh; height: 88dvh; }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .theme-options button { padding: 5px 8px; }
}

@media (max-width: 480px) {
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(4) { border-top: 1px solid var(--line); }
  .quick-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .review-split { grid-template-columns: 1fr 1fr 1fr; }
  .settings-row { flex-direction: column; gap: 9px; }
  .settings-control { width: 100%; justify-content: flex-start; }
  .theme-options { width: 100%; }
  .theme-options button { flex: 1; }
  .settings-actions .button { flex: 1 1 auto; }
  .q-entry-head { gap: 7px; }
  .q-cta { flex-direction: column; align-items: flex-end; gap: 2px; }
  .q-expand { font-size: 11px; }
  .button { padding-left: 12px; padding-right: 12px; }
  .modal-body { padding: 15px 14px; }
  .modal-head { padding: 14px 14px 11px; }
  .modal-foot { padding: 11px 14px calc(11px + env(safe-area-inset-bottom)); }
  .search-input-wrap { padding: 11px 14px; }
  .search-input-wrap svg { left: 26px; }
  .search-results { padding: 4px 14px 16px; }
  .chart { padding: 14px 12px; }
  .trend-summary { gap: 10px; padding: 12px; }
}

@media (prefers-contrast: more) {
  :root { --line: #bdb8aa; --muted: #5b5b52; }
  html[data-theme="dark"] { --line: #55584d; --muted: #b9b7ac; }
}

/* 运行时补充 */
.chart-row-btn {
  display: block;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.chart-row-btn:first-of-type { border-top: 0; }
.chart-row-btn:hover .chart-label { color: var(--accent-strong); }
.chart-row-btn[aria-pressed="true"] .chart-label { color: var(--accent-strong); font-weight: 650; }
.chart-row-btn[aria-pressed="true"] .chart-track { outline: 1px solid var(--accent-line); outline-offset: 2px; }

.person-name-btn {
  display: inline-block;
  min-height: 36px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}
.person-name-btn:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.person-link svg, .q-expand svg, .nav-item svg, .bottom-nav svg { flex: 0 0 auto; }
.person-link svg { width: 14px; height: 14px; }
.q-expand svg { width: 13px; height: 13px; vertical-align: -2px; }

.search-modal .modal-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-modal .search-results { flex: 1; }
.search-modal .modal-head { border-bottom: 1px solid var(--line); }
.search-modal .search-input-wrap { flex: 0 0 auto; }

.settings-group code,
.about-copy code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}

.copy-line .button { min-height: 34px; padding: 4px 9px; font-size: 11.5px; }
.reading-text { overflow-wrap: anywhere; }
.q-material, .person-short, .demo-text, .detail-text, .method-example, .method-steps,
.modal-prose p, .modal-prose li, .about-copy, .notice, .advice-list li, .review-empty {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.q-detail textarea, .modal-prose textarea { width: 100%; }
.modal-prose .core-idea { margin-top: 4px; }
.modal-prose .detail-label { margin-top: 0; }
.modal-section .copy-line { margin-top: 6px; }
.modal-prose .modal-meta .fav-btn { display: inline-flex; align-items: center; }
.modal-prose .tag { vertical-align: middle; }
.modal-prose .status-row { margin-top: 8px; }
.modal-prose .person-link { margin: 2px 3px 2px 0; }
.modal-prose h3 { line-height: 1.4; }
.modal-prose .notice { margin: 12px 0; }

@media (max-width: 840px) {
  .search-modal .modal-body { overflow: hidden; }
  .search-modal .search-results { overflow-y: auto; }
}
