[hidden] { display: none !important; }

:root {
  --bg-page: #FCFAF6;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F3F0EA;
  --bg-cream: #FAF7F1;
  --text-main: #3F4954;
  --text-sub: #5F6B76;
  --text-muted: #6B7682;
  --primary: #7E9A84;
  --primary-hover: #698670;
  --primary-soft: #EAF2EB;
  --primary-border: #AEC4B3;
  --border-color: rgba(120, 130, 140, 0.20);
  --ok-main: #5D8A6A;
  --ok-bg: #EAF2EB;
  --warn-main: #9A7452;
  --warn-bg: #F6EDE3;
  --warn-border: #E5D2BC;
  --danger-main: #C0786B;
  --danger-bg: #F9ECE9;
  --danger-border: #E9C7C0;
  --rough-text: #7A6551;
  --rough-bg: #F7F4EE;
  --rough-border: #C5B8A8;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(63, 73, 84, 0.05);
  --shadow-pop: 0 14px 32px rgba(63, 73, 84, 0.14);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-main);
}

body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}

body.lock-scroll {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ==================== 1. 顶部品牌与孩子档案融合栏 ==================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left, 0px));
  background: rgba(252, 250, 246, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  white-space: nowrap;
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 桌面端主导航 */
.top-tabs {
  display: none;
  align-items: center;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 11px;
}

.top-tabs button {
  height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.top-tabs button.on {
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--danger-main);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* 档案胶囊与二级抽屉 */
.profile-switcher {
  position: relative;
  flex-shrink: 0;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 5px 12px 5px 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--text-main);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  max-width: 240px;
}

.profile-pill:hover,
.profile-pill[aria-expanded="true"] {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.profile-pill.is-temp-override {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.avatar,
.avatar-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: #5D7D66;
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.profile-pill.is-temp-override .avatar {
  background: #EFE2D0;
  color: var(--warn-main);
}

.profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  min-width: 0;
  text-align: left;
}

.child-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-context {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 165px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.profile-pill[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.profile-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(336px, calc(100vw - 24px));
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 14px;
  z-index: 60;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.section-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.section-header .section-label {
  margin-bottom: 0;
}

.btn-text {
  background: none;
  border: none;
  color: #5D7D66;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
}
.btn-text:hover {
  background: var(--primary-soft);
}

.account-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 11px;
}

.account-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.account-card-info {
  min-width: 0;
  flex: 1;
}

.account-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.account-card-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.account-card-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-pop {
  flex: 1;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-pop.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.popover-divider {
  height: 1px;
  background: var(--border-color);
  margin: 12px 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-full {
  grid-column: 1 / -1;
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.field-item select {
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}
.field-item select:focus {
  border-color: var(--primary);
  background: #fff;
}

.lowconf-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-sub);
  cursor: pointer;
  user-select: none;
}
.lowconf-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

/* ==================== 2. 主容器与高频主控栏 ==================== */
.main-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 14px 28px;
}

.workspace-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.workspace-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-color);
}

.subject-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
  flex: 1;
  min-width: 200px;
}
.subject-tabs::-webkit-scrollbar { display: none; }

.subject-chip {
  flex-shrink: 0;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.subject-chip:hover {
  color: var(--text-main);
  border-color: var(--primary-border);
}
.subject-chip.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: #55735D;
  font-weight: 600;
}

.view-segmented {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--bg-subtle);
  border-radius: 10px;
  flex-shrink: 0;
}

.seg-btn {
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.seg-btn.is-active {
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.seg-btn.seg-action {
  color: #55735D;
  font-weight: 600;
}
.seg-btn.seg-action:hover {
  background: var(--primary-soft);
}

/* 搜索与判题规则行 */
.search-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-cream);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: #8E98A2;
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 34px;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input-wrap input:focus {
  border-color: var(--primary);
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.btn-prefs {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  background: var(--bg-surface);
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-prefs:hover {
  border-color: var(--primary);
  color: #55735D;
}

/* 动态版本/跨年级提示条 */
.context-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 14px;
  background: var(--warn-bg);
  border-top: 1px solid var(--warn-border);
  color: #7A5A3C;
  font-size: 12.5px;
  line-height: 1.45;
}

.notice-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.notice-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 5px;
  background: #EAD8C3;
  color: #6E4E32;
  font-weight: 700;
  font-size: 11px;
}

.notice-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice-link {
  border: 0;
  background: rgba(154, 116, 82, 0.14);
  color: #6E4E32;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.notice-link:hover {
  background: rgba(154, 116, 82, 0.24);
}

/* ==================== 3. 概览摘要条与章节折叠列表 ==================== */
.book-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 13px;
  font-size: 12.5px;
}

.summary-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stat-item strong {
  color: var(--text-main);
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-mastered { background: var(--ok-main); }
.dot-reviewing { background: #B9A28C; }
.dot-blocked { background: var(--danger-main); }
.dot-untested { background: #C8C4BC; }

.summary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-continue {
  background: var(--primary-soft);
  color: #55735D;
  border: 1px solid var(--primary-border);
  min-height: 30px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-continue:hover {
  background: #DCE9DE;
}

.catalog-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 原生 <details> 章节单元组 */
details.chapter-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

summary.chapter-header {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  cursor: pointer;
  user-select: none;
  background: #F7F4EE;
  transition: background 0.15s;
}
summary.chapter-header::-webkit-details-marker {
  display: none;
}
summary.chapter-header:hover {
  background: #F2EEE5;
}

details.chapter-group[open] > summary.chapter-header {
  background: var(--primary-soft);
  border-bottom: 1px solid var(--border-color);
}

.chapter-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.chapter-index {
  font-size: 11.5px;
  font-weight: 600;
  color: #7A6551;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(120, 130, 140, 0.14);
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

details.chapter-group[open] .chapter-index {
  color: #4E6B56;
}

.chapter-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.badge-rough {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--rough-text);
  background: var(--rough-bg);
  border: 1px dashed var(--rough-border);
  border-radius: 4px;
  flex-shrink: 0;
}

.chapter-right {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.btn-unit-quiz {
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-sub);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-unit-quiz:hover {
  border-color: var(--primary);
  color: #55735D;
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-track {
  width: 52px;
  height: 6px;
  background: rgba(120, 130, 140, 0.16);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--ok-main);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}

.chapter-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

details.chapter-group[open] .chapter-chevron {
  transform: rotate(180deg);
  color: #55735D;
}

/* 知识点四态卡片 */
.kp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 13px;
  background: var(--bg-page);
}

.kp-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 15px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kp-card:hover {
  box-shadow: 0 3px 10px rgba(63, 73, 84, 0.06);
}

.kp-card.is-mastered {
  border-left-color: var(--ok-main);
}
.kp-card.is-reviewing {
  border-left-color: #B9A28C;
  background: #FFFEFC;
}
.kp-card.is-blocked {
  border-left-color: var(--danger-main);
  background: #FFFDFC;
}
.kp-card.is-untested {
  border-left-color: #D5D0C7;
}

.kp-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.kp-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
}
.tag-mastered { background: var(--ok-bg); color: var(--ok-main); }
.tag-reviewing { background: var(--warn-bg); color: var(--warn-main); }
.tag-blocked { background: var(--danger-bg); color: var(--danger-main); }
.tag-untested { background: var(--bg-subtle); color: var(--text-muted); }

.subj-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: #F3F0EA;
  color: #7A6551;
  flex-shrink: 0;
}

.kp-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
}

.kp-link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-main);
  font-size: 15.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  line-height: 1.35;
}
.kp-link:hover {
  color: #55735D;
  text-decoration: underline;
}

.kp-card.is-mastered .kp-link {
  color: #4F5B66;
}

.kp-desc-hint {
  font-size: 12.5px;
  color: var(--text-sub);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kp-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.prereq-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.prereq-trigger:hover {
  border-color: var(--primary);
  color: #55735D;
  background: var(--primary-soft);
}

.prereq-trigger.is-alert {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #A65A4D;
  font-weight: 600;
}

.kp-qcount {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.kp-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-action {
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: transform 0.1s, background 0.15s;
}
.btn-action:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-warn {
  background: var(--danger-main);
  color: #fff;
}

.btn-amber {
  background: #A98463;
  color: #fff;
}

.btn-ghost {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-sub);
}
.btn-ghost:hover {
  border-color: var(--primary);
  color: #55735D;
}

.more {
  text-align: center;
  margin: 16px 0 6px;
}

.more button {
  height: 38px;
  padding: 0 22px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

/* ==================== 4. 先修关系三段式响应式抽屉 (<dialog>) ==================== */
.pathway-drawer {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100dvh;
  position: fixed;
  inset: 0;
  z-index: 90;
}

.pathway-drawer:not([open]) {
  display: none !important;
}

.pathway-drawer::backdrop {
  background: rgba(40, 45, 50, 0.36);
  backdrop-filter: blur(2px);
}

.drawer-shell {
  position: absolute;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100%;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 32px rgba(40, 45, 50, 0.16);
  animation: slideInRight 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-grabber {
  display: none;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.drawer-eyebrow {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #5D7D66;
  margin-bottom: 3px;
}

.drawer-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.btn-icon-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-icon-close:hover {
  background: #E6E1D7;
  color: var(--text-main);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px;
  overscroll-behavior: contain;
}

.remedy-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
}

.remedy-icon {
  font-size: 16px;
  line-height: 1.4;
}

.remedy-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #6E4E32;
}

.pathway-flow {
  display: flex;
  flex-direction: column;
}

.stage-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stage-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.dot-prereq  { background: #8A9A9B; }
.dot-current { background: var(--primary); }
.dot-next    { background: #B9A28C; }

.stage-nodes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.node-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.node-info {
  min-width: 0;
  flex: 1;
}

.node-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.grade-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: #55735D;
  font-weight: 600;
}

.grade-pill.is-cross-grade {
  background: var(--warn-bg);
  color: var(--warn-main);
  font-weight: 600;
}

.state-text {
  font-size: 11px;
  font-weight: 700;
}
.text-ok     { color: var(--ok-main); }
.text-warn   { color: var(--warn-main); }
.text-danger { color: var(--danger-main); }

.node-name {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}
.node-name:hover {
  color: #55735D;
}

.node-tip {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.node-card.is-mastered {
  border-left: 3px solid var(--ok-main);
}

.node-card.is-root-cause {
  background: #FFFDFC;
  border-color: var(--danger-border);
  border-left: 4px solid var(--danger-main);
}

.node-card.is-current-target {
  background: var(--primary-soft);
  border: 1.5px solid var(--primary);
}

.btn-mini {
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-mini-warn {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-main);
}

.flow-connector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 6px 9px;
}

.connector-line {
  width: 2px;
  height: 22px;
  background: #C9C3B8;
}
.connector-line.is-dashed {
  background: repeating-linear-gradient(to bottom, #C9C3B8 0 4px, transparent 4px 8px);
}

.connector-tag {
  font-size: 11px;
  color: var(--text-muted);
}

.unlock-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px dashed #C8C1B4;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.unlock-chip:hover {
  border-style: solid;
  border-color: var(--primary);
  background: #fff;
}

.unlock-grade {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: #7A6551;
  flex-shrink: 0;
}

.unlock-title {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-sub);
  font-weight: 500;
}

.unlock-arrow {
  color: var(--text-muted);
  font-size: 13px;
}

.drawer-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.btn-secondary-full {
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: #fff;
  color: #55735D;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-remedy-start {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1.15;
  padding: 0 10px;
}
.btn-remedy-start:hover {
  background: var(--primary-hover);
}
.btn-remedy-start span {
  font-size: 14px;
  font-weight: 700;
}
.btn-remedy-start small {
  font-size: 11px;
  opacity: 0.92;
}

/* ==================== 5. 沉浸式诊断与手写演算视图 ==================== */
.quiz-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  height: 100dvh;
}

.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  z-index: 20;
  flex-shrink: 0;
}

.btn-exit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.quiz-stepper-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.remedy-stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.remedy-stepper::-webkit-scrollbar { display: none; }

.step-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.step-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #BFB8AC;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.step-node.is-done {
  background: var(--ok-bg);
  color: var(--ok-main);
}
.step-node.is-done .step-badge {
  background: var(--ok-main);
}

.step-node.is-current {
  background: var(--primary-soft);
  color: #4E6B56;
  font-weight: 700;
  border: 1px solid var(--primary);
}
.step-node.is-current .step-badge {
  background: var(--primary);
}

.step-divider {
  width: 12px;
  height: 2px;
  background: #D5CFC4;
  flex-shrink: 0;
}

.btn-scratch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-scratch-toggle[aria-pressed="true"] {
  background: var(--warn-bg);
  border-color: #C9A27F;
  color: #7A5A3C;
}

.quiz-stage {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 32px;
}

.question-wrap {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.adaptive-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: #46634E;
  font-size: 13px;
}

.adaptive-hint.is-confirm {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: #7A5A3C;
}

.hint-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.hint-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hint-body span {
  font-size: 12px;
  opacity: 0.92;
}

.question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 20px;
  box-shadow: var(--shadow-sm);
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.q-kp-tag {
  background: var(--bg-subtle);
  color: #7A6551;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 600;
}

.q-stem {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.65;
  color: var(--text-main);
  margin-bottom: 20px;
  word-break: break-word;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 15.5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.option-btn:hover:not(:disabled) {
  border-color: var(--primary-border);
  background: #fff;
}
.option-btn.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}
.option-btn.is-correct {
  border-color: var(--ok-main);
  background: var(--ok-bg);
  color: #3D6348;
}
.option-btn.is-wrong {
  border-color: var(--danger-main);
  background: var(--danger-bg);
  color: #8F4D41;
}

.opt-key {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.option-btn.is-selected .opt-key {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.option-btn.is-correct .opt-key {
  background: var(--ok-main);
  border-color: var(--ok-main);
  color: #fff;
}
.option-btn.is-wrong .opt-key {
  background: var(--danger-main);
  border-color: var(--danger-main);
  color: #fff;
}

.quiz-text-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 16px;
  outline: none;
}
.quiz-text-input:focus {
  border-color: var(--primary);
  background: #fff;
}

.feedback-panel {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
}
.feedback-panel.is-correct {
  background: var(--ok-bg);
  border: 1px solid #B7D3BE;
  color: #3D6348;
}
.feedback-panel.is-wrong {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #8F4D41;
}
.feedback-panel.is-neutral {
  background: var(--bg-subtle);
  border: 1px solid #DFD7C8;
  color: var(--text-main);
}

.fb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.fb-title {
  font-weight: 700;
}

.fb-report-btn {
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 4px;
}

/* 半透明手写演算草稿层 */
.scratch-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  background-color: rgba(252, 250, 244, 0.32);
  background-image: radial-gradient(rgba(126, 154, 132, 0.34) 1px, transparent 1px);
  background-size: 20px 20px;
  touch-action: none;
  cursor: crosshair;
}

.scratch-canvas.is-passthrough {
  pointer-events: none;
  background-color: transparent;
  background-image: none;
}

.scratch-toolbar {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: rgba(252, 250, 246, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(63, 73, 84, 0.14);
}

.tool-btn {
  height: 32px;
  padding: 0 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tool-btn.is-active {
  background: var(--primary-soft);
  color: #4E6B56;
}
.tool-btn.tool-danger {
  color: var(--danger-main);
}

.tool-sep {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 2px;
}

.quiz-bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  z-index: 20;
  flex-shrink: 0;
}

.btn-skip {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  height: 42px;
  padding: 0 14px;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-skip:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.btn-submit {
  min-width: 148px;
  height: 44px;
  padding: 0 24px;
  border-radius: 11px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
}
.btn-submit:hover:not(:disabled) {
  background: var(--primary-hover);
}
.btn-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==================== 6. 错题本、盲区、进度、说明与通用弹层 ==================== */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  font-size: 17px;
  margin: 20px 0 8px;
  color: var(--text-main);
}
.panel h2:first-child {
  margin-top: 0;
}

.panel h3 {
  font-size: 14.5px;
  margin: 16px 0 8px;
  color: var(--text-main);
}

.panel p {
  font-size: 14px;
  color: var(--text-sub);
  margin: 0 0 10px;
  line-height: 1.6;
}

.muted {
  color: var(--text-muted) !important;
  font-size: 13px !important;
}

.mistake-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 13px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  margin-bottom: 16px;
}

.mistake-hero.is-all-clear {
  background: var(--primary-soft);
  border-color: var(--primary-border);
}

.mistake-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin: 18px 0 8px;
}

.mistake-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mistake-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  background: var(--bg-page);
}

.mistake-item-info {
  min-width: 0;
  flex: 1;
}

.mistake-item-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}
.mistake-item-name:hover {
  color: #55735D;
}

.mistake-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.backup-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: #6E4E32;
  font-size: 13px;
}

.statline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.stat {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
}

.stat b {
  display: block;
  font-size: 22px;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: 12px;
  color: var(--text-muted);
}

.hist {
  border-bottom: 1px solid var(--border-color);
  padding: 10px 2px;
  font-size: 13.5px;
}

.pmeta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.btn {
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 38px;
  cursor: pointer;
}
.btn:hover {
  background: var(--primary-hover);
}
.btn.ghost {
  background: #fff;
  color: #55735D;
  border: 1px solid var(--primary);
}
.btn.ghost:hover {
  background: var(--primary-soft);
}
.btn.small {
  padding: 6px 11px;
  min-height: 32px;
  font-size: 12.5px;
}

/* 通用弹层与完整图谱支持 */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-bg {
  position: absolute;
  inset: 0;
  background: rgba(40, 45, 50, 0.36);
  backdrop-filter: blur(2px);
}

.sheet-box {
  position: relative;
  background: var(--bg-page);
  width: min(100%, 700px);
  max-height: 90dvh;
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(28px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  box-shadow: var(--shadow-pop);
}

.sheet .close {
  position: absolute;
  right: 12px;
  top: 12px;
  border: 0;
  background: var(--bg-subtle);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 20px;
  color: var(--text-muted);
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sheet h2 {
  font-size: 18px;
  margin: 0 38px 8px 0;
}

.sheet h3 {
  font-size: 14.5px;
  margin: 16px 0 8px;
}

.formrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 12px 0 4px;
}

#sheetBody input,
#sheetBody select,
#sheetBody textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14.5px;
  background: #fff;
  color: var(--text-main);
  outline: none;
}
#sheetBody input:focus,
#sheetBody select:focus,
#sheetBody textarea:focus {
  border-color: var(--primary);
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge {
  font-size: 11.5px;
  border-radius: 6px;
  padding: 2px 8px;
  background: var(--bg-subtle);
  color: #7A6551;
  font-weight: 600;
}
.badge.stage {
  background: var(--primary-soft);
  color: #55735D;
}

.seg {
  display: flex;
  gap: 6px;
  margin: 12px 0 14px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}
.seg button {
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-muted);
  border-radius: 8px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  min-height: 34px;
  cursor: pointer;
}
.seg button.on {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: #55735D;
}
.seg.small button {
  padding: 4px 10px;
  font-size: 12px;
  min-height: 30px;
}

.edition-note {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #4E6B56;
  margin-bottom: 10px;
}

ul.plain {
  padding-left: 18px;
  margin: 6px 0;
  color: var(--text-sub);
  font-size: 14px;
}
ul.plain li { margin: 4px 0; }

.prereq {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prereq button {
  text-align: left;
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text-main);
  cursor: pointer;
}
.prereq button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.pathlist {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}
.pathrow {
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: 11px;
  padding: 10px 12px;
  cursor: pointer;
}
.pathrow.target {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.pathrow .num {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  color: #55735D;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.pname {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* 横向列图谱与 SVG 网状关系图（完整沿用原配色） */
.graphcols {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 6px 2px 12px;
  margin-top: 8px;
  scrollbar-width: thin;
}
.gcol {
  flex: 0 0 144px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ghead {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 8px;
}
.gcol.me .ghead { color: #55735D; }
.gcol.me .ghead::after { content: ' ●'; color: var(--primary); }
.gempty { font-size: 13px; color: var(--text-muted); padding: 10px; }
.gnode {
  text-align: left;
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: 11px;
  padding: 10px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
}
.gnode.soft { border-style: dashed; }
.gname { display: block; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--text-main); }
.gmeta { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.gcol.pre .gnode { border-color: #A9C2C4; background: #F1F6F6; }
.gcol.me .gnode { border-color: var(--primary); background: var(--primary-soft); }
.gcol.next .gnode { border-color: #D6B596; background: #FBF4EC; }
.gcol.early .gnode { background: #F6F7F8; }
.garrow { flex: 0 0 24px; text-align: center; color: var(--text-muted); padding-top: 24px; font-size: 17px; }

.netsvg {
  width: 100%;
  height: 460px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  touch-action: none;
  cursor: grab;
}
.netsvg:active { cursor: grabbing; }
.netedge { stroke: #6F8E76; stroke-width: 2.4; }
.netedge.soft { stroke: #9FB59F; stroke-dasharray: 8 5; stroke-width: 2.2; }
.netnode { fill: #EDF3F4; stroke: #7E9A84; stroke-width: 1.8; cursor: pointer; }
.netnode.me { fill: #7E9A84; stroke: #5F7D66; }
.netnode.next { fill: #F6EDE3; stroke: #B98F68; }
.netlabel { font-size: 13.5px; font-weight: 600; fill: #3F4954; cursor: pointer; }
.sheet-box.fullgraph {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  border-radius: 0 !important;
}

/* 手机底部主导航 */
.bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
}

.bottom button {
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 60px;
  padding: 2px 4px;
  cursor: pointer;
}

.bottom button.on {
  color: #55735D;
  font-weight: 700;
}

.nav-ico {
  font-size: 19px;
  line-height: 1.1;
}

.nav-ico-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-ico-wrap .nav-badge {
  position: absolute;
  top: -5px;
  right: -13px;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
  padding: 0 4px;
}

/* ==================== 7. 响应式适配（桌面 / 平板 / 窄屏手机） ==================== */
@media (min-width: 860px) {
  body {
    padding-bottom: 24px;
  }
  .top-tabs {
    display: inline-flex;
  }
  .bottom {
    display: none;
  }
  .sheet {
    align-items: center;
  }
  .sheet-box {
    border-radius: 18px;
    max-height: 86dvh;
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .brand-subtitle {
    display: none;
  }
  .view-segmented {
    width: 100%;
  }
  .seg-btn {
    flex: 1;
    text-align: center;
  }
  .progress-track {
    display: none;
  }
  .kp-card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .kp-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px dashed var(--bg-subtle);
  }
  .kp-actions .btn-action {
    flex: 1;
  }
  .option-grid {
    grid-template-columns: 1fr;
  }
  .step-name {
    display: none;
  }
  .step-node.is-current .step-name {
    display: inline;
  }
  .scratch-toolbar {
    left: 12px;
    right: 12px;
    justify-content: space-between;
    overflow-x: auto;
  }
  .drawer-shell {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: 86dvh;
    border-radius: 20px 20px 0 0;
    animation: slideUpBottom 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .drawer-grabber {
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: #D0C9BD;
    margin: 8px auto 2px;
    flex-shrink: 0;
  }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slideUpBottom {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ==================== 8. 教学增强（v36）：微任务 / 微讲 / 分式 / 符号条 / 朗读 / 跨科 / 多孩 / 周报 / 打印 ==================== */

/* 今日 8 分钟微任务 */
.today-card {
  background: linear-gradient(135deg, #FFFFFF, #FAF7F1);
  border: 1px solid var(--primary-border);
  border-radius: 16px;
  padding: 14px 15px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.today-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.today-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}
.today-streak {
  font-size: 11.5px;
  font-weight: 700;
  color: #9A7452;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.today-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 11px;
}
.today-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-sub);
}
.today-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.today-name { line-height: 1.4; }
.today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.today-actions .btn-action { flex: 1; min-width: 120px; }

/* 母题微讲卡（测前 30 秒） */
.micro-intro {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.micro-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 16.5px;
  color: var(--text-main);
  margin-bottom: 10px;
}
.micro-badge {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 6px;
  padding: 3px 8px;
}
.micro-desc {
  font-size: 13.5px;
  color: var(--text-sub);
  margin: 0 0 12px;
  line-height: 1.6;
}
.micro-block {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 10px;
}
.micro-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.micro-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--text-sub);
  line-height: 1.6;
}
.micro-list li { margin: 3px 0; }
.micro-text {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-sub);
  line-height: 1.6;
}
.micro-example { border-color: var(--primary-border); background: #FCFDFB; }
.micro-q {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 8px;
}
.micro-example details summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 0;
}
.micro-a {
  font-size: 13.5px;
  color: var(--text-sub);
  line-height: 1.6;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  margin-top: 6px;
}
.micro-tip {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* 分式与上标 */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 3px;
  line-height: 1.05;
  font-size: 0.86em;
  transform: translateY(-1px);
}
.frac .num {
  padding: 0 3px;
  border-bottom: 1.4px solid currentColor;
}
.frac .den {
  padding: 0 3px;
}
.q-stem sup, .print-q-text sup, .micro-q sup {
  font-size: 0.72em;
  vertical-align: super;
}

/* 数学填空快捷符号条 */
.math-keypad {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.key-btn {
  min-width: 38px;
  height: 34px;
  padding: 0 9px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.key-btn:active { background: var(--primary-soft); }
.key-btn.key-unit {
  font-size: 12.5px;
  color: #55735D;
  border-color: var(--primary-border);
  background: var(--primary-soft);
}
.key-btn.key-del { margin-left: auto; color: var(--text-muted); }

/* 英语朗读 */
.speak-bar {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
}
.speak-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--primary-border);
  background: var(--primary-soft);
  color: #4E6B56;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.speak-btn:active { background: #DCE9DE; }

/* 变式题标记 */
.variant-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: #7A5A3C;
  background: var(--warn-bg);
  border: 1px dashed var(--warn-border);
  border-radius: 6px;
  padding: 2px 8px;
  margin-bottom: 10px;
}

/* 跨学科数学地基 */
.badge-math {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #6B5B7B;
  background: #F4EFF7;
  border: 1px solid #D9CBE4;
  border-radius: 5px;
  flex-shrink: 0;
  cursor: help;
}
.dot-math { background: #8B7BA8; font-size: 12px; }

/* 多孩免密秒切 */
.family-strip {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}
.family-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.family-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.family-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  text-align: left;
  cursor: pointer;
}
.family-row:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.family-row.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  cursor: default;
  opacity: 0.85;
}
.family-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.family-meta strong { font-size: 13px; color: var(--text-main); }
.family-meta span { font-size: 11px; color: var(--text-muted); }

/* 近 7 天练习周报 */
.week-report {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 13px 14px 10px;
  margin-bottom: 14px;
}
.week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.week-title { font-size: 13px; font-weight: 700; color: var(--text-main); }
.week-streak {
  font-size: 11.5px;
  font-weight: 700;
  color: #9A7452;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  padding: 2px 8px;
}
.week-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 92px;
}
.week-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
}
.week-bar {
  width: 100%;
  max-width: 30px;
  background: linear-gradient(180deg, #93AFA0, #7E9A84);
  border-radius: 5px 5px 3px 3px;
  transition: height 0.3s ease;
}
.week-bar.is-empty { background: #E4E0D8; }
.week-num {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-height: 13px;
}
.week-label {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* A4 打印卷 */
#printArea { display: none; }
body.printing #printArea { display: block; }
body.printing > *:not(#printArea) { display: none !important; }

.print-head { text-align: center; margin-bottom: 16px; }
.print-head h1 { font-size: 20pt; margin: 0 0 8px; }
.print-meta { font-size: 11pt; color: #444; }
.print-q { margin-bottom: 16px; page-break-inside: avoid; }
.print-q-title { font-size: 11pt; font-weight: 700; margin-bottom: 4px; }
.print-q-text { font-size: 12pt; line-height: 1.75; }
.print-opts { margin-top: 6px; }
.print-opt { font-size: 11.5pt; line-height: 1.8; }
.print-blank { margin-top: 10px; height: 42px; border-bottom: 1px solid #BBB; }
.print-fig { margin: 8px 0; }
.print-fig svg { width: 45%; max-width: 260px; height: auto; }
.print-answers { page-break-before: always; }
.print-answers h2 { font-size: 15pt; margin-bottom: 10px; }
.print-ans { font-size: 11.5pt; line-height: 1.9; }

@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff !important; }
  body.printing > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  .frac { font-size: 0.9em; }
}

/* 英语选项内嵌朗读 */
.opt-speak {
  margin-left: auto;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--primary-border);
  background: var(--primary-soft);
  color: #4E6B56;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.opt-speak:active { background: #DCE9DE; }

/* ==================== 桌面宽屏布局增强（>=861px） ==================== */
@media (min-width: 861px) {
  .main-wrap { max-width: 1140px; padding: 20px 24px 40px; }
  .site-header { padding: 14px 28px; }
  .panel { padding: 22px; }
  .workspace-bar { padding: 14px 18px; }
  .catalog-list { gap: 12px; }
  .kp-card { padding: 16px 18px; }

  /* 答题界面：桌面下改为随内容高度，底栏紧跟题目，不再钉死屏幕底 */
  .quiz-screen { height: auto; min-height: 100dvh; }
  .quiz-stage { flex: 0 0 auto; min-height: 300px; padding: 20px 28px 18px; }
  .question-wrap { max-width: 960px; gap: 16px; }
  .quiz-topbar, .quiz-bottombar {
    padding-left: max(28px, calc((100vw - 1016px) / 2));
    padding-right: max(28px, calc((100vw - 1016px) / 2));
  }
  .quiz-bottombar { position: sticky; bottom: 0; justify-content: center; gap: 16px; }
  .btn-submit { min-width: 200px; height: 48px; font-size: 16px; }
  .btn-skip { height: 46px; }


  /* 草稿纸开关按钮：从屏幕最右上角移到答题栏右缘（与题目区对齐） */
  .quiz-topbar { position: relative; }
  .btn-scratch-toggle {
    position: absolute;
    right: max(28px, calc((100vw - 1016px) / 2 + 16px));
  }

  /* 草稿纸工具条移到题目区右下，靠近演算区而非右上角 */
  .scratch-toolbar {
    top: auto; bottom: 84px;
    right: max(28px, calc((100vw - 1016px) / 2 + 16px));
  }
}

/* 首开引导提示 */
.onboard-hint {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: #46634E;
  font-size: 13px;
  line-height: 1.5;
}
