/* ============================================================
   中小学数学知识图谱 - 样式表
   风格：Linear / Apple 极简风格
   ============================================================ */

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

/* 全局 hidden 类 —— JS 用 classList.add/remove('hidden') 控制元素显隐 */
.hidden {
  display: none !important;
}

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f4f4f5;
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-tertiary: #a1a1aa;
  --border-color: #e4e4e7;
  --border-light: #f0f0f0;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-green: #22c55e;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* ============================================================
   顶部工具栏
   ============================================================ */
.toolbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.toolbar .logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.toolbar .title {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.toolbar .controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

.toolbar select,
#search-input {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.toolbar select:focus,
#search-input:focus {
  border-color: var(--accent-blue);
}

#search-input {
  width: 180px;
}

#btn-reset {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 15px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-reset:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-tertiary);
}

/* ============================================================
   主布局
   ============================================================ */
.container {
  display: flex;
  height: calc(100vh - 56px);
}

/* ---- 左侧图例 ---- */
.legend-panel {
  width: 180px;
  flex-shrink: 0;
  padding: 20px 16px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
}

.legend-panel h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

#legend-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-item .dot {
  width: 18px;
  height: 0;
  border-top: 2px solid;
  flex-shrink: 0;
}

.legend-item.dashed .dot { border-top-style: dashed; }
.legend-item.dotted .dot { border-top-style: dotted; }

.legend-tip {
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.legend-tip p { margin-bottom: 4px; }
.legend-tip strong { color: var(--text-primary); }
.legend-tip em { font-style: normal; color: var(--accent-blue); }

.version-info {
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.version-info .count-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-blue);
}

.version-info .count-row {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.version-info .count-row span {
  color: var(--text-tertiary);
  font-size: 11px;
}

/* ---- 图谱区 ---- */
.graph-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
}

.graph-area svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* SVG 分组容器 */
.graph-area .background,
.graph-area .links,
.graph-area .nodes,
.graph-area .link-labels {
  pointer-events: all;
}
.graph-area .links { pointer-events: none; }
.graph-area .link-labels { pointer-events: none; }

/* 年级行带背景 */
.graph-area .grade-band rect {
  opacity: 0.5;
}

/* 年级徽章（节点角落的小标签） */
.grade-tag {
  font-size: 9px;
  fill: var(--text-tertiary);
}

/* ---- 连线（本身就是 path.link，不是容器+子元素结构）---- */
.link {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: opacity 0.25s ease, stroke-width 0.2s ease;
  pointer-events: none;
}

/* 状态变化：用 !important 覆盖 JS 设置的 inline stroke attr */
.link-highlighted {
  opacity: 0.92 !important;
  stroke-width: 2.8 !important;
}

.link-dimmed {
  opacity: 0.08 !important;
  stroke-width: 1.2 !important;
}

.link:hover {
  stroke-width: 3 !important;
  opacity: 1 !important;
}

.link-hover {
  stroke-width: 3 !important;
  opacity: 1 !important;
}

/* ---- 节点交互状态 ---- */
.node-selected .node-rect {
  stroke: var(--accent-blue) !important;
  stroke-width: 2px !important;
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.4));
}

.node-highlighted .node-rect {
  filter: brightness(1.05) saturate(1.1) drop-shadow(0 0 3px rgba(59, 130, 246, 0.3));
}

.node-dimmed .node-rect,
.node-dimmed .node-title {
  opacity: 0.15 !important;
}

/* ---- 缩放控件 ---- */
.zoom-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zoom-controls button {
  width: 36px;
  height: 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-controls button:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-tertiary);
}

/* ============================================================
   SVG 节点 & 连线
   ============================================================ */
.node { cursor: pointer; }

.node-rect {
  transition: filter 0.15s;
}

.node-title {
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-primary);
  pointer-events: none;
}

.node:hover .node-rect {
  filter: brightness(0.97);
}

/* 连线 Tooltip */
.link-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
  background: rgba(24, 24, 27, 0.95);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transition: opacity 0.15s;
  min-width: 180px;
}
.link-tooltip.visible { opacity: 1; }

/* 年级徽章 */
.node-grade-badge {
  font-size: 9px;
  fill: var(--text-tertiary);
}

/* ============================================================
   右侧详情面板
   ============================================================ */
.detail-panel {
  width: 420px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
}

.detail-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 40px;
  text-align: center;
}

.detail-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.detail-content.hidden { display: none; }

/* ---- 面板 Header ---- */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border-light);
}

.detail-header-left {
  flex: 1;
  min-width: 0;
}

.detail-header-left h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.35;
  word-break: break-word;
}

.detail-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-tertiary);
  transition: all 0.12s;
  flex-shrink: 0;
}

.detail-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ---- 语音控件独立一行 ---- */
.voice-controls-row {
  padding: 10px 20px 0;
  display: flex;
  justify-content: flex-start;
}

/* 徽章 */
.detail-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 500;
}

.stage-badge {
  background: var(--accent-blue);
  color: white;
}

.grade-badge {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.category-badge {
  background: #fef3c7;
  color: #92400e;
}

/* ---- 语音控制栏 ---- */
.voice-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.voice-btn {
  width: 30px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-btn:hover { background: var(--bg-tertiary); }
.voice-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.voice-btn.active {
  background: var(--accent-blue);
  color: white;
}

.voice-btn.speaking {
  background: var(--accent-green);
  color: white;
  animation: voicePulse 1.2s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.voice-speed, .voice-select {
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  height: 26px;
}

.voice-status {
  font-size: 11px;
  color: var(--text-tertiary);
  min-width: 36px;
  text-align: right;
}

.voice-status.speaking { color: var(--accent-green); }
.voice-status.paused { color: var(--accent-pink); }

/* ---- Section ---- */
.detail-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

.detail-section.hidden { display: none; }

.detail-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* 前置依赖 */
.prereq-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prereq-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}

.prereq-item:hover {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.prereq-item .rel-tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-weight: 500;
}

.prereq-item:hover .rel-tag {
  background: rgba(255,255,255,0.2);
}

/* ---- 白话/课本/进阶 切换 ---- */
.content-section {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
}

.content-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.toggle-btn {
  flex: 1;
  padding: 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all 0.12s;
  border-bottom: 2px solid transparent;
}

.toggle-btn:hover {
  color: var(--text-primary);
}

.toggle-btn.active {
  color: var(--accent-blue);
  background: var(--bg-primary);
  border-bottom-color: var(--accent-blue);
  font-weight: 600;
}

.content-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.content-body.hidden { display: none; }

.content-p { margin-bottom: 10px; }

.content-note {
  padding: 8px 12px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 12px;
  color: #92400e;
}

.empty-hint {
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 12px;
}

/* ---- 破题思路 ---- */
.thinking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.thinking-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.7;
}

.thinking-item .num {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: var(--accent-blue);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

/* ---- 例题 ---- */
.example-card {
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: 10px;
  margin-bottom: 10px;
}

.example-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.example-level {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.example-level.basic { background: #dcfce7; color: #15803d; }
.example-level.advanced { background: #fce7f3; color: #be185d; }

.example-question {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.example-toggle {
  font-size: 11px;
  color: var(--accent-blue);
  font-weight: 500;
}

.example-answer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  font-size: 12.5px;
}

.example-answer.hidden { display: none; }
.example-answer .ans-row,
.example-answer .think-row {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.example-answer .label {
  font-weight: 600;
  color: var(--text-tertiary);
}

.example-answer .ans-text { color: var(--accent-blue); font-weight: 600; }

/* ---- 常见坑 ---- */
.pitfall-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: #fef2f2;
  border-radius: 8px;
  margin-bottom: 8px;
}

.pitfall-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

.pitfall-body .pitfall-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 3px;
}

.pitfall-body .pitfall-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ---- 下一步 ---- */
.next-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.next-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}

.next-item:hover {
  background: var(--accent-green);
  color: white;
  border-color: var(--accent-green);
}

/* ============================================================
   学习进度 + 错题本 + 小测
   ============================================================ */

/* ---- 节点状态角标（右上小圆点） ---- */
.node .status-dot {
  display: none;
  stroke: #fff;
  stroke-width: 1.5;
}

.node-status-learning .status-dot {
  display: block;
  fill: #f59e0b;
}

.node-status-mastered .status-dot {
  display: block;
  fill: #22c55e;
}

/* ---- 详情面板：进度标记行 ---- */
.progress-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px 20px 0;
  flex-wrap: wrap;
}

.progress-btn {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  transition: all 0.12s;
}

.progress-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.progress-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

.quiz-btn {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: var(--accent-blue);
  color: white;
  transition: all 0.12s;
}

.quiz-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* ---- 侧栏：进度面板 ---- */
.progress-panel,
.wrongbook-panel {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: 10px;
}

.progress-panel h3,
.wrongbook-panel h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.progress-stage-row {
  margin-bottom: 10px;
}

.ps-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.ps-nums {
  font-weight: 600;
  color: var(--accent-blue);
}

.ps-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.ps-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.ps-sub {
  font-size: 11px;
  color: #f59e0b;
  margin-top: 2px;
}

.link-btn {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
  text-decoration: underline;
  transition: color 0.12s;
}

.link-btn:hover {
  color: #dc2626;
}

/* ---- 侧栏：错题本 ---- */
.wrongbook-summary {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.primary-btn {
  width: 100%;
  padding: 8px 0;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--accent-blue);
  color: white;
  transition: all 0.12s;
}

.primary-btn:hover:not(:disabled) {
  background: #2563eb;
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---- 测验弹窗 ---- */
.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(24, 24, 27, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.quiz-modal {
  width: 560px;
  max-width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

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

.quiz-mode-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--accent-blue);
  color: white;
  flex-shrink: 0;
}

.quiz-node-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}

.quiz-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.quiz-body {
  padding: 20px;
  flex: 1;
}

.quiz-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.quiz-progress {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.quiz-question {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text-primary);
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 10px;
  margin-bottom: 14px;
}

.quiz-answer {
  padding: 14px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  margin-bottom: 14px;
}

.quiz-answer .ans-row,
.quiz-answer .think-row {
  display: flex;
  gap: 6px;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 6px;
}

.quiz-answer .label {
  font-weight: 600;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.quiz-answer .ans-text {
  color: #15803d;
  font-weight: 600;
}

.quiz-answer .think-text {
  color: var(--text-secondary);
}

.quiz-summary {
  padding: 14px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1d4ed8;
  line-height: 1.7;
}

.quiz-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}

.quiz-actions .primary-btn {
  width: auto;
  padding: 9px 22px;
}

.quiz-judge {
  display: flex;
  gap: 8px;
}

.judge-btn {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.12s;
}

.judge-btn.correct {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.judge-btn.correct:hover {
  background: #22c55e;
  color: white;
  border-color: #22c55e;
}

.judge-btn.wrong {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.judge-btn.wrong:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* ============================================================
   补课计划 V1
   ============================================================ */

/* ---- 工具栏入口 ---- */
.plan-entry {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent-purple);
  color: white;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.12s;
  white-space: nowrap;
}

.plan-entry:hover {
  background: #7c3aed;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* ---- 侧栏计划面板 ---- */
.plan-panel {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, #f5f3ff, #faf5ff);
  border: 1px solid #ddd6fe;
  border-radius: 10px;
}

.plan-panel h3 {
  font-size: 11px;
  font-weight: 600;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.plan-notice {
  font-size: 11px;
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
  line-height: 1.6;
}

.plan-streak-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.streak-badge {
  font-size: 12px;
  font-weight: 700;
  color: #c2410c;
}

.plan-total-text {
  font-size: 12px;
  font-weight: 600;
  color: #7c3aed;
}

.plan-total-bar {
  margin-bottom: 10px;
}

.plan-total-bar .ps-fill {
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
}

.plan-today-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.plan-review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 8px;
  background: white;
  border-radius: 6px;
  margin-bottom: 4px;
}

.plan-review-row.done {
  color: var(--text-tertiary);
}

.plan-lesson-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
  padding: 7px 8px;
  background: white;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.12s;
}

.plan-lesson-row:hover {
  background: #ede9fe;
  transform: translateX(2px);
}

.plan-lesson-row.done {
  opacity: 0.65;
}

.plan-lesson-row .pt-status {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.plan-lesson-row .pt-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-lesson-row.done .pt-title {
  text-decoration: line-through;
}

.plan-lesson-row .pt-min {
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--text-tertiary);
}

.plan-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.mini-btn {
  flex: 1;
  padding: 6px 4px;
  font-size: 11.5px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: white;
  color: var(--text-secondary);
  transition: all 0.12s;
  white-space: nowrap;
}

.mini-btn:hover {
  border-color: #8b5cf6;
  color: #7c3aed;
}

.mini-btn.danger:hover {
  border-color: #ef4444;
  color: #dc2626;
}

/* ---- 计划弹窗 ---- */
.plan-modal {
  width: 520px;
}

.plan-tag {
  background: #8b5cf6 !important;
}

.plan-setup-row {
  margin-bottom: 16px;
}

.plan-setup-row label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.plan-setup-row select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  background: white;
  outline: none;
}

.plan-setup-row select:focus {
  border-color: #8b5cf6;
}

.plan-mins-options {
  display: flex;
  gap: 8px;
}

.mins-opt {
  flex: 1;
  padding: 10px 4px;
  font-size: 12.5px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: white;
  color: var(--text-secondary);
  transition: all 0.12s;
}

.mins-opt:hover {
  border-color: #8b5cf6;
}

.mins-opt.active {
  border-color: #8b5cf6;
  background: #f5f3ff;
  color: #7c3aed;
  font-weight: 700;
}

.plan-setup-note {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.7;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 10px 12px;
}

.plan-result-hero {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 14px 16px;
  background: linear-gradient(135deg, #f5f3ff, #fce7f3);
  border-radius: 10px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.plan-result-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.plan-result-stats > div {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.plan-result-stats strong {
  color: #7c3aed;
  font-size: 15px;
}

/* ---- 路径查看器 ---- */
.pp-grade-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-align: center;
  margin: 12px 0 6px;
  letter-spacing: 1px;
}

.pp-grade-head:first-child {
  margin-top: 0;
}

.pp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.pp-row:hover {
  background: var(--bg-secondary);
}

.pp-row.done {
  opacity: 0.55;
}

.pp-row.current {
  background: #f5f3ff;
  font-weight: 700;
}

.pp-row.current .pp-title {
  color: #7c3aed;
}

.pp-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.pp-title {
  flex: 1;
}

.pp-opt {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 400;
}

.pp-min {
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--text-tertiary);
}

.plan-path-legend {
  font-size: 11px;
  color: var(--text-tertiary);
  width: 100%;
  text-align: center;
}

/* ============================================================
   账号 / 云同步 / 应用升级
   ============================================================ */

/* 同步状态小圆点 */
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  flex-shrink: 0;
  transition: background 0.2s;
}

.sync-dot.sync-ok {
  background: var(--accent-green);
}

.sync-dot.sync-err {
  background: #ef4444;
}

.sync-dot.sync-busy {
  background: var(--accent-blue);
  animation: sync-pulse 1s ease-in-out infinite;
}

@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 顶栏账号按钮 */
.account-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-btn:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

/* 顶栏升级按钮 */
.update-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: white;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.12s;
  white-space: nowrap;
  animation: update-glow 2s ease-in-out infinite;
}

.update-btn:hover {
  filter: brightness(1.1);
}

.update-btn:disabled {
  opacity: 0.7;
  animation: none;
}

@keyframes update-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0); }
}

/* 登录弹窗 */
.auth-modal {
  width: 400px;
}

.auth-tag {
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: white;
}

.auth-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  outline: none;
  transition: border-color 0.12s;
}

.auth-input:focus {
  border-color: var(--accent-purple);
}

.auth-code-input {
  letter-spacing: 6px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

.auth-code-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  line-height: 1.6;
}

.auth-error {
  font-size: 12.5px;
  color: #ef4444;
  margin-top: 10px;
}

.auth-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}

.auth-info-row:last-of-type {
  border-bottom: none;
}

.auth-info-row .label {
  color: var(--text-tertiary);
  flex-shrink: 0;
  width: 60px;
}
