/* 每日医练 · 医学专业青绿风 (零蓝紫渐变，三端自适应) */

:root {
  --bg: #F6F7F5;
  --surface: #FFFFFF;
  --surface-muted: #F1F3F0;
  --border: #E4E7E2;
  --border-strong: #CBD2C9;
  --text: #18201D;
  --text-secondary: #52605A;
  --text-muted: #7C8A84;

  --primary: #0F766E;
  --primary-hover: #0C5F59;
  --primary-soft: #EBF7F5;
  --primary-border: #99D5CE;

  --success: #15803D;
  --success-soft: #ECFDF3;
  --success-border: #A7F3D0;

  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --danger-border: #FECACA;

  --warning: #D97706;
  --warning-soft: #FFFBEB;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 20, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 20, 0.08);

  --q-font-size: 16px;
  --opt-font-size: 15px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="sepia"] {
  --bg: #F4EFE4;
  --surface: #FBF8F1;
  --surface-muted: #EFE8D8;
  --border: #E2D9C5;
  --border-strong: #CEC2A8;
  --text: #2C251C;
  --text-secondary: #5D5242;
  --text-muted: #867966;
  --primary: #0F766E;
  --primary-soft: #E3F1EC;
}

html[data-theme="dark"] {
  --bg: #111514;
  --surface: #1A201E;
  --surface-muted: #222927;
  --border: #2C3633;
  --border-strong: #3C4945;
  --text: #ECF1EF;
  --text-secondary: #B4C2BC;
  --text-muted: #84948E;
  --primary: #2DD4BF;
  --primary-hover: #14B8A6;
  --primary-soft: rgba(45, 212, 191, 0.14);
  --primary-border: rgba(45, 212, 191, 0.35);
  --success: #4ADE80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --success-border: rgba(74, 222, 128, 0.35);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --danger-border: rgba(248, 113, 113, 0.35);
  --warning: #FBBF24;
  --warning-soft: rgba(251, 191, 36, 0.14);
}

html[data-font="sm"] { --q-font-size: 14.5px; --opt-font-size: 14px; }
html[data-font="md"] { --q-font-size: 16px; --opt-font-size: 15px; }
html[data-font="lg"] { --q-font-size: 18px; --opt-font-size: 16.5px; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted-text { color: var(--text-muted); font-size: 13px; }

.page { display: none; min-height: 100vh; min-height: 100dvh; }
.page.active { display: block; }

/* ── Buttons & Inputs ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
}
html[data-theme="dark"] .btn-primary { color: #0B1917; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); }

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }

.btn-danger { background: var(--danger); color: #FFFFFF; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}
.icon-btn:hover { background: var(--surface-muted); color: var(--text); }
.font-btn { font-weight: 700; font-size: 15px; }

.chip-btn {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border: 1px solid transparent;
  transition: all 0.15s;
}
.chip-btn.active, .chip-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

.text-btn { color: var(--primary); font-size: 13.5px; font-weight: 500; }
.text-btn.sm { font-size: 12.5px; }
.text-btn:hover { text-decoration: underline; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.field input, .field textarea, .inline-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus, .inline-search:focus {
  border-color: var(--primary);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.tag-primary { background: var(--primary-soft); color: var(--primary); }
.tag-neutral { background: var(--surface-muted); color: var(--text-secondary); }

/* ── Login Page ─────────────────────────────────────────── */
#login-page.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-wrap {
  width: 100%;
  max-width: 416px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
html[data-theme="dark"] .brand-mark { color: #0B1917; }
.brand-mark.sm { width: 34px; height: 34px; border-radius: 10px; }

.brand-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.brand-sub { font-size: 13.5px; color: var(--text-secondary); }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.login-tab {
  height: 36px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.login-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.login-tab-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 10px;
  align-items: stretch;
}
.captcha-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
}
.captcha-box img { width: 100%; height: 100%; object-fit: cover; display: block; }

.form-error {
  min-height: 18px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--danger);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-footer-links {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.icp-link:hover { color: var(--text-secondary); }

/* ── App Header & Layout Shell ──────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 54px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left, .header-right { display: flex; align-items: center; gap: 6px; }
.header-brand-mini { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.mini-mark {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}

.workspace-shell {
  display: block;
  max-width: 1440px;
  margin: 0 auto;
}

.left-rail, .right-sheet-panel { display: none; }

.main-stage {
  padding: 16px 16px calc(80px + var(--safe-bottom));
  max-width: 820px;
  margin: 0 auto;
}

.view { display: none; }
.view.active { display: block; }

/* ── Home / Subject Hub ─────────────────────────────────── */
.home-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.greeting-kicker { font-size: 13px; color: var(--text-secondary); }
.page-heading { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

.subject-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
}
.subject-switcher:hover { border-color: var(--primary); }
.switcher-label { font-size: 12px; color: var(--text-muted); }

.overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.overview-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.overview-main h3 { font-size: 18px; margin-top: 6px; }
.overview-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.overview-actions { display: flex; gap: 8px; }

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}
.progress-track.thin { height: 5px; }
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.metric-item { text-align: center; }
.metric-item strong { display: block; font-size: 18px; font-weight: 700; }
.metric-item span { font-size: 12px; color: var(--text-muted); }

.section-block { margin-bottom: 22px; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.section-head h3 { font-size: 15.5px; font-weight: 700; }
.inline-search { max-width: 220px; padding: 7px 12px; }

.type-filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
html[data-theme="dark"] .pill.active { color: #0B1917; }

.mode-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.mode-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: border-color 0.15s, transform 0.15s;
}
.mode-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.mode-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.mode-card strong { display: block; font-size: 15px; margin-bottom: 3px; }
.mode-card p { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }

/* Chapter Tree */
.chapter-tree { display: flex; flex-direction: column; gap: 10px; }
.chapter-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.chapter-row:hover { background: var(--surface-muted); }
.chapter-info { flex: 1; min-width: 0; }
.chapter-title { font-size: 14.5px; font-weight: 600; margin-bottom: 6px; }
.chapter-sub-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); }
.chapter-mini-bar { width: 90px; height: 5px; background: var(--surface-muted); border-radius: 99px; overflow: hidden; }
.chapter-mini-bar > i { display: block; height: 100%; background: var(--primary); }
.chapter-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.subchapter-list {
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: none;
}
.chapter-item.expanded .subchapter-list { display: block; }
.subchapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px 11px 28px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.subchapter-row:last-child { border-bottom: none; }
.subchapter-row:hover { background: var(--surface-muted); }

/* Directory */
.exam-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.subject-tile {
  text-align: left;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s;
}
.subject-tile:hover, .subject-tile.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.subject-tile strong { display: block; font-size: 14.5px; margin-bottom: 4px; }
.subject-tile span { font-size: 12.5px; color: var(--text-muted); }

/* ── Practice View ──────────────────────────────────────── */
.practice-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.practice-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scope-text { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.practice-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timer-badge {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
}
.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.practice-progress-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.progress-counter { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }

.case-stem-card {
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.case-stem-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.case-stem-body { font-size: calc(var(--q-font-size) - 1px); line-height: 1.7; white-space: pre-wrap; }
.case-stem-card.collapsed .case-stem-body {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.question-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.q-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.q-num { font-size: 13.5px; font-weight: 700; color: var(--text); }
.q-actions { display: flex; align-items: center; gap: 6px; }
.icon-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
}
.icon-text-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-text-btn.collected {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}
.icon-text-btn.collected svg { fill: currentColor; }

.question-stem {
  font-size: var(--q-font-size);
  font-weight: 500;
  line-height: 1.75;
  margin-bottom: 16px;
  white-space: pre-wrap;
}
.multi-hint {
  font-size: 12.5px;
  color: var(--primary);
  margin: -8px 0 12px;
}

.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: var(--opt-font-size);
  line-height: 1.55;
  transition: all 0.14s;
}
.option-btn:hover:not(.disabled) { border-color: var(--primary); background: var(--primary-soft); }
.option-letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.option-btn.selected { border-color: var(--primary); background: var(--primary-soft); }
.option-btn.selected .option-letter { background: var(--primary); border-color: var(--primary); color: #fff; }
.option-btn.correct { border-color: var(--success-border); background: var(--success-soft); }
.option-btn.correct .option-letter { background: var(--success); border-color: var(--success); color: #fff; }
.option-btn.wrong { border-color: var(--danger-border); background: var(--danger-soft); }
.option-btn.wrong .option-letter { background: var(--danger); border-color: var(--danger); color: #fff; }
.option-btn.disabled { cursor: default; }

.submit-row { margin-top: 16px; display: flex; justify-content: flex-end; }

/* Analysis Panel */
.analysis-panel {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.analysis-verdict {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}
.analysis-verdict.good { color: var(--success); }
.analysis-verdict.bad { color: var(--danger); }

.answer-compare {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  margin-bottom: 14px;
}
.answer-compare span { display: block; font-size: 12px; }
.answer-compare strong { font-size: 16px; }
.ans-good { color: var(--success); }
.ans-bad { color: var(--danger); }

.user-note-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  border-left: 3px solid var(--warning);
  font-size: 13.5px;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.analysis-body { font-size: 14.5px; line-height: 1.75; color: var(--text-secondary); }
.analysis-section-title { font-size: 13px; font-weight: 700; color: var(--text); margin: 10px 0 4px; }
.analysis-section-title:first-child { margin-top: 0; }

/* Sticky Practice Dock */
.practice-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.sheet-trigger { gap: 8px; padding: 0 14px; }

/* ── Answer Sheet Grid ──────────────────────────────────── */
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head h3 { font-size: 15px; font-weight: 700; }
.sheet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot-correct { background: var(--success); }
.dot-wrong { background: var(--danger); }
.dot-empty { background: var(--border-strong); }
.dot-star { background: var(--warning); }

.sheet-filters { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 7px;
  max-height: 56vh;
  overflow-y: auto;
  padding-right: 2px;
}
.sheet-cell {
  position: relative;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text-secondary);
  border: 1.5px solid transparent;
}
.sheet-cell.current { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.sheet-cell.correct { background: var(--success-soft); color: var(--success); }
.sheet-cell.wrong { background: var(--danger-soft); color: var(--danger); }
.sheet-cell.answered { background: var(--primary-soft); color: var(--primary); }
.sheet-cell.starred::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
}
.sheet-empty { grid-column: 1 / -1; text-align: center; padding: 28px 12px; color: var(--text-muted); font-size: 13px; }

/* Mobile Bottom Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 20, 0.45);
  display: none;
  align-items: flex-end;
}
.drawer-backdrop.open { display: flex; }
.sheet-drawer {
  width: 100%;
  max-height: 78vh;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(18px + var(--safe-bottom));
  box-shadow: var(--shadow-md);
}
.drawer-handle { width: 38px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 0 auto 12px; }

/* ── Library & Profile ──────────────────────────────────── */
.segmented-bar {
  display: inline-flex;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.seg-btn {
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.seg-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.library-list { display: flex; flex-direction: column; gap: 10px; }
.lib-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.lib-card:hover { border-color: var(--primary); }
.lib-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--text-muted); }
.lib-card-stem { font-size: 14.5px; line-height: 1.55; margin-bottom: 8px; }
.lib-card-foot { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--text-secondary); flex-wrap: wrap; }

.library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.inline-select, .field select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 34px 8px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2352605A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px 15px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.inline-select:hover, .field select:hover { border-color: var(--primary-border); }
.inline-select:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Brand Logo Images */
.brand-logo-img { width: 52px; height: 52px; border-radius: 14px; display: block; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.brand-logo-img.sm { width: 36px; height: 36px; border-radius: 10px; }
.mini-logo-img { width: 26px; height: 26px; border-radius: 7px; display: block; }

/* Email Reminder Banner */
.reminder-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  margin-bottom: 16px;
  background: var(--warning-soft);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text);
}

/* Independent Subpage Header & Picker Grid */
.subpage-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.picker-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.picker-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.picker-card strong { font-size: 16px; margin-bottom: 6px; display: block; }
.picker-card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }

/* Independent Pre-Practice Sheet Config */
.sheet-config-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.config-block { margin-bottom: 16px; }
.config-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.mode-seg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 720px) { .mode-seg-grid { grid-template-columns: repeat(4, 1fr); } }
.mode-seg-btn {
  text-align: left;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: all 0.15s;
}
.mode-seg-btn strong { display: block; font-size: 13.5px; color: var(--text); }
.mode-seg-btn span { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.mode-seg-btn:hover { border-color: var(--primary-border); }
.mode-seg-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.mode-seg-btn.active strong { color: var(--primary); }
.config-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.large-sheet-grid { max-height: 460px; margin-top: 12px; }

/* Modern Fast-Mode Pill Switch */
.fast-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.18s ease;
}
.fast-switch-btn:hover { border-color: var(--primary-border); }
.switch-track {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.18s ease;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}
.fast-switch-btn.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}
.fast-switch-btn.active .switch-track { background: var(--primary); }
.fast-switch-btn.active .switch-knob { transform: translateX(13px); }
.wrong-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--danger-soft);
  color: var(--danger);
}
.lib-card-actions { display: flex; align-items: center; gap: 6px; }

/* Comments & Mnemonics */
.comments-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.comments-head h4 { font-size: 14.5px; font-weight: 700; }
.comment-composer {
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 14px;
}
.comment-tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.comment-input-row { display: flex; gap: 8px; align-items: flex-end; }
.comment-input-row textarea {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13.5px;
  resize: vertical;
  outline: none;
}
.comment-input-row textarea:focus { border-color: var(--primary); }
.comments-list { display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.comment-item.pinned { border-color: var(--primary-border); background: var(--primary-soft); }
.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.comment-author { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comment-body { font-size: 14px; line-height: 1.65; white-space: pre-wrap; color: var(--text); }
.comment-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.like-btn.liked { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); font-weight: 600; }

/* Full-Bank Search */
.search-hero-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.search-hero-box input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 15px;
  outline: none;
}
.search-hero-box input:focus { border-color: var(--primary); }
.search-hero-box .btn { height: 44px; padding: 0 22px; border-radius: var(--radius-md); }

.search-history-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
mark.hl {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  padding: 0 2px;
  border-radius: 3px;
}

/* Daily Check-in & Heatmap */
.checkin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.checkin-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.checkin-title-row { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.checkin-right-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.streak-pill strong { color: var(--primary); font-size: 15px; }
.checkin-bar-row { display: flex; align-items: center; gap: 12px; }

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  max-width: 320px;
}
.hm-cell {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  max-width: 32px;
  border-radius: 6px;
  background: var(--surface-muted);
}
.hm-cell.lv1 { background: #CCFBF1; }
.hm-cell.lv2 { background: #5EEAD4; }
.hm-cell.lv3 { background: var(--primary); }
html[data-theme="dark"] .hm-cell.lv1 { background: rgba(45, 212, 191, 0.22); }
html[data-theme="dark"] .hm-cell.lv2 { background: rgba(45, 212, 191, 0.52); }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.heatmap-legend .hm-cell { width: 14px; height: 14px; }

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar-circle.lg { width: 52px; height: 52px; font-size: 20px; }
.profile-meta { flex: 1; min-width: 0; }
.profile-meta h2 { font-size: 18px; }
.profile-meta p { font-size: 13px; color: var(--text-muted); }

.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}
.stat-box strong { display: block; font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-box span { font-size: 12.5px; color: var(--text-muted); }

.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  overflow: hidden;
}
.panel-title { padding: 12px 16px; font-size: 13px; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.setting-row:last-child { border-bottom: none; }
.segmented-inline { display: flex; gap: 6px; }

.list-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
  text-align: left;
}
.list-action:last-child { border-bottom: none; }
.list-action:hover { background: var(--surface-muted); }
.list-action.danger { color: var(--danger); }
.list-action .arrow { color: var(--text-muted); font-size: 18px; }

/* Bottom Nav (Mobile/Tablet) */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 56px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.bottom-nav-item.active { color: var(--primary); font-weight: 600; }

/* Modal & Toast */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 20, 0.48);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { font-size: 16.5px; font-weight: 700; }
.modal-body { font-size: 14px; color: var(--text-secondary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  background: #1E2926;
  box-shadow: var(--shadow-md);
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

.simple-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* ── Tablet (>= 768px) ──────────────────────────────────── */
@media (min-width: 768px) {
  .mode-cards { grid-template-columns: repeat(4, 1fr); }
  .stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
  .main-stage { padding: 24px 28px 96px; }
}

/* ── Desktop (>= 1180px) Three-Column Workbench ─────────── */
@media (min-width: 1180px) {
  .app-header { display: none; }
  .bottom-nav { display: none; }

  .workspace-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr) 296px;
    min-height: 100vh;
    align-items: start;
  }

  .left-rail {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 14px;
    background: var(--surface);
    border-right: 1px solid var(--border);
  }
  .rail-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 20px;
  }
  .rail-brand strong { display: block; font-size: 16px; }
  .rail-brand span { font-size: 12px; color: var(--text-muted); }

  .rail-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .rail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
  }
  .rail-item:hover { background: var(--surface-muted); color: var(--text); }
  .rail-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

  .rail-footer { border-top: 1px solid var(--border); padding-top: 14px; }
  .rail-user { display: flex; align-items: center; gap: 10px; padding: 6px; margin-bottom: 10px; }
  .rail-user-meta { min-width: 0; }
  .rail-user-meta strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail-user-meta span { font-size: 12px; color: var(--text-muted); }
  .rail-quick-tools { display: flex; gap: 6px; }

  .main-stage {
    padding: 28px 34px 48px;
    max-width: 860px;
    width: 100%;
  }

  .practice-dock {
    position: static;
    margin-top: 20px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    grid-template-columns: 140px 1fr 140px;
  }
  .sheet-trigger { visibility: hidden; pointer-events: none; }

  .right-sheet-panel {
    display: block;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
  }
  .right-sheet-panel .sheet-grid { max-height: calc(100vh - 180px); }
}

/* ── Horizontal Exam Unit Tabs (基础知识 / 相关专业知识 / 专业知识 / 专业实践能力) ── */
.column-tabs-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 6px 12px 0;
}

.column-tabs-track {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}
.column-tabs-track::-webkit-scrollbar { display: none; }

.column-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  border-radius: 8px 8px 0 0;
}
.column-tab-btn:hover {
  color: var(--text);
  background: var(--surface-muted);
}
.column-tab-btn.active {
  color: var(--primary);
  font-weight: 700;
  border-bottom-color: var(--primary);
  background: var(--primary-soft);
}
.column-tab-count {
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
}
.column-tab-btn.active .column-tab-count {
  background: var(--primary);
  color: #FFFFFF;
}
html[data-theme="dark"] .column-tab-btn.active .column-tab-count {
  color: #0B1917;
}
.column-tab-action {
  flex-shrink: 0;
  margin-bottom: 6px;
}

.practice-back-btn {
  flex-shrink: 0;
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}

/* ── Password Visibility Toggle ───────────────────────────── */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-input-wrap input {
  padding-right: 42px;
}
.pwd-eye-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.pwd-eye-btn:hover {
  color: var(--primary);
  background: var(--surface-muted);
}

/* ── Mobile Layout Refinements (< 768px) ─────────────────── */
@media (max-width: 767px) {
  /* 移动端顶部 .app-header 已有返回箭头，隐藏子页内部重复返回按钮，避免标题被挤压 */
  #btn-sheet-back,
  #btn-picker-back {
    display: none;
  }

  .subpage-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .subpage-header > div {
    width: 100%;
  }
  .subpage-header .page-heading {
    font-size: 18px;
    line-height: 1.35;
    word-break: break-word;
  }
  #btn-sheet-start {
    width: 100%;
    height: 42px;
  }
  #picker-search-input {
    max-width: 100% !important;
    width: 100%;
  }

  .sheet-config-card {
    padding: 14px;
  }
  .sheet-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .config-filter-row {
    gap: 12px;
  }
  .config-filter-group {
    width: 100%;
  }
  .config-filter-group .inline-select {
    width: 100%;
  }
  .segmented-inline {
    flex-wrap: wrap;
  }

  /* 刷题页顶部栏在移动端自然换行，不挤压范围文案 */
  .practice-topbar {
    gap: 8px;
  }
  .practice-meta {
    width: 100%;
    flex-wrap: wrap;
  }
  .scope-text {
    max-width: 100%;
    white-space: normal;
  }
  .practice-controls {
    width: 100%;
    justify-content: flex-end;
  }

  /* 横向科目单元标签栏移动端紧凑排布 */
  .column-tabs-wrap {
    padding: 4px 8px 0;
    gap: 6px;
  }
  .column-tab-btn {
    padding: 8px 10px;
    font-size: 13px;
  }
  .column-tab-action {
    padding: 0 10px;
    height: 30px;
    font-size: 12px;
  }
}

/* ── Mobile Audit Fixes (Header Ellipsis, No Double-Back, iOS 16px, Scroll Lock) ── */
body.overlay-open {
  overflow: hidden;
  touch-action: none;
}

.header-left {
  min-width: 0;
  flex: 1;
}
.header-brand-mini {
  min-width: 0;
  flex: 1;
}
#header-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  min-width: 0;
}
.header-right {
  flex-shrink: 0;
}

.chapter-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 14px;
  transition: transform 0.18s ease, background 0.15s;
}
.chapter-item.expanded .chapter-chevron {
  transform: rotate(90deg);
  color: var(--primary);
}

.subchapter-info {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.subchapter-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.subject-switcher {
  max-width: 100%;
}
#current-subject-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.desktop-only-inline { display: none; }
.desktop-only-flex { display: none !important; }
@media (min-width: 1180px) {
  .desktop-only-inline { display: inline; }
  .desktop-only-flex { display: flex !important; }
}

/* 只要顶部 .app-header 可见（< 1180px），统一隐藏子页内重复的返回按钮 */
@media (max-width: 1179px) {
  #btn-sheet-back,
  #btn-picker-back,
  #btn-practice-back {
    display: none;
  }
}

@media (max-width: 767px) {
  /* 防止 iOS Safari 聚焦输入框时自动放大页面 */
  input,
  textarea,
  select,
  .field input,
  .field textarea,
  .field select,
  .inline-search,
  .inline-select,
  .search-hero-box input,
  .comment-input-row textarea {
    font-size: 16px;
  }

  .profile-hero {
    flex-wrap: wrap;
    padding: 16px;
    gap: 12px;
  }
  .profile-hero > div:last-child {
    width: 100%;
    justify-content: flex-end;
  }

  .setting-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .subject-switcher {
    width: 100%;
    justify-content: space-between;
  }
  #current-subject-label {
    flex: 1;
    max-width: none;
    text-align: left;
  }

  .chapter-mini-bar {
    width: 64px;
  }
  .subchapter-row {
    padding: 11px 12px 11px 18px;
  }
}
