/* ============================================
   组件样式 — 卡片/按钮/面板/评分等
   ============================================ */

/* === 通用卡片 === */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: border-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
}

.card--elevated {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}

.card--inset {
  background: var(--bg-inset);
  border-color: var(--border-subtle);
}

.card--accent {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

/* === 按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
}

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

.btn--primary {
  background: var(--accent);
  color: var(--text-primary);
  border-color: var(--accent);
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--primary:active:not(:disabled) {
  transform: translateY(0);
  background: var(--accent-active);
}

.btn--secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.btn--secondary:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-bg);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn--ghost:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-bg);
}

.btn--lg {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--fs-md);
}

.btn--sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--fs-sm);
}

.btn--block {
  width: 100%;
}

/* 全局日/夜主题切换。避开移动端底部提交栏与安全区。 */
.global-theme-toggle {
  position: fixed;
  z-index: 80;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(76px + env(safe-area-inset-bottom));
  display: inline-flex;
  min-width: 48px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  font: 500 var(--fs-sm)/1 var(--font-body);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.global-theme-toggle:hover,
.global-theme-toggle:focus-visible {
  color: var(--accent-hover);
  border-color: var(--accent);
  outline: 2px solid var(--accent-bg-strong);
  outline-offset: 2px;
}

@media (max-width: 380px) {
  .global-theme-toggle__label { display: none; }
}

/* 账号入口与登录页 */
.home-account-bar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.home-account__identity {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.home-account__avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  color: var(--text-primary);
  background: var(--accent-bg-strong);
  border: 1px solid var(--border-accent);
  border-radius: 50%;
}

.auth-page {
  display: grid;
  width: 100%;
  min-height: 100dvh;
  padding: max(var(--space-md), env(safe-area-inset-top)) var(--space-sm) max(var(--space-md), env(safe-area-inset-bottom));
  place-items: center;
  background:
    radial-gradient(circle at 15% 15%, var(--accent-bg-strong), transparent 34rem),
    var(--bg-base);
}

.boot-page {
  display: grid;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(var(--space-md), env(safe-area-inset-top)) var(--space-sm) max(var(--space-md), env(safe-area-inset-bottom));
  place-items: center;
  color: var(--text-primary);
  background: var(--bg-base);
}

.boot-card {
  width: min(440px, 100%);
  padding: var(--space-lg);
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.boot-card__mark { color: var(--accent-hover); font-size: var(--fs-2xl); }
.boot-card h1 { margin: var(--space-xs) 0; }
.boot-card p { color: var(--text-secondary); }
.boot-card--error { text-align: left; border-color: var(--danger); }
.boot-card__diagnostic { max-height: 12rem; margin: var(--space-sm) 0; padding: var(--space-sm); overflow: auto; color: var(--danger); background: var(--bg-inset); border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; }

.auth-card {
  width: min(480px, 100%);
  padding: clamp(var(--space-md), 5vw, var(--space-lg));
}

.auth-brand { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.auth-brand__mark { display: grid; width: 52px; height: 52px; flex: 0 0 52px; place-items: center; color: var(--accent-hover); background: var(--accent-bg); border: 1px solid var(--border-accent); border-radius: var(--radius-lg); font-size: var(--fs-xl); }
.auth-brand h1 { margin-top: 0.2rem; font-size: clamp(var(--fs-lg), 6vw, var(--fs-xl)); }
.auth-intro { margin-bottom: var(--space-md); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: var(--space-md); border-bottom: 1px solid var(--border-subtle); }
.auth-tab { min-height: 44px; color: var(--text-muted); background: transparent; border: 0; border-bottom: 2px solid transparent; font: 500 var(--fs-base)/1 var(--font-body); cursor: pointer; }
.auth-tab--active { color: var(--accent-hover); border-bottom-color: var(--accent); }
.auth-form { display: grid; gap: var(--space-sm); }
.auth-field { display: grid; gap: 0.35rem; color: var(--text-secondary); font-size: var(--fs-sm); }
.auth-message { min-height: 1.5rem; color: var(--warning); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.auth-message--error { color: var(--danger); }
.auth-divider { display: flex; align-items: center; gap: var(--space-xs); margin: var(--space-md) 0; color: var(--text-muted); font-size: var(--fs-xs); }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; content: ''; background: var(--border-subtle); }
.auth-privacy { margin-top: var(--space-sm); color: var(--text-muted); font-size: var(--fs-xs); text-align: center; }

@media (max-width: 480px) {
  .home-account-bar { justify-content: space-between; }
  .home-account__identity { max-width: 42%; }
  .home-account__identity > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .home-account-bar .btn { min-width: 44px; padding-inline: var(--space-xs); }
  .auth-card { padding: var(--space-md) var(--space-sm); }
  .auth-brand { align-items: flex-start; }
  .auth-brand__mark { width: 44px; height: 44px; flex-basis: 44px; }
}

/* === 标签/徽章 === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.6em;
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--accent-bg);
  color: var(--accent-hover);
  border: 1px solid var(--border-accent);
}

.badge--success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(122, 154, 122, 0.3);
}

.badge--warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(196, 164, 122, 0.3);
}

.badge--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(176, 112, 112, 0.3);
}

.badge--neutral {
  background: var(--bg-inset);
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

/* === 头部栏 === */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  min-height: var(--header-height);
}

.header-bar__title {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
}

.header-bar__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* === 进度条 === */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-inset);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-active), var(--accent));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow) ease;
}

/* === 输入框 === */
.input,
.textarea {
  width: 100%;
  padding: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
  outline: none;
}

.input:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}

.textarea {
  resize: vertical;
  min-height: 120px;
  line-height: var(--lh-relaxed);
}

/* === 选择器 === */
.select {
  appearance: none;
  width: 100%;
  padding: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a756c' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-sm) center;
  padding-right: var(--space-lg);
}

.select:focus {
  border-color: var(--accent);
  outline: none;
}

/* === 单选/复选组 === */
.radio-group {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.radio-option:hover {
  border-color: var(--accent-muted);
  color: var(--text-primary);
}

.radio-option--active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent-hover);
}

/* === 标签按钮 === */
.tag-btn {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full, 999px);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
}

.tag-btn:hover {
  border-color: var(--accent-muted);
  color: var(--text-primary);
}

.tag-btn--active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent-hover);
  font-weight: 500;
}

/* === 推荐卡片 === */
.recommend-card:hover {
  border-color: var(--accent-muted) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* === 方向选择卡片 === */
.direction-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg) var(--space-md);
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
  min-height: 160px;
}

.direction-card:hover {
  border-color: var(--accent-muted);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.direction-card--active {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: var(--shadow-glow);
}

.direction-card__icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  color: var(--accent);
}

.direction-card__title {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.direction-card__subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.direction-card__count {
  margin-top: var(--space-sm);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* === 专家面板 === */
.expert-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  text-align: center;
}

.expert-panel--active {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.expert-panel__avatar {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  border: 2px solid currentColor;
}

.expert-panel__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.expert-panel__status {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* === 阶段指示器 === */
.phase-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.phase-step {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.phase-step__number {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: all var(--transition-base);
}

.phase-step--active .phase-step__number {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: var(--shadow-glow);
}

.phase-step--active {
  color: var(--text-primary);
}

.phase-step--done .phase-step__number {
  background: var(--success);
  border-color: var(--success);
  color: var(--bg-base);
}

.phase-step--done {
  color: var(--success);
}

.phase-divider {
  width: 32px;
  height: 1px;
  background: var(--border-strong);
}

/* === 评分卡片 === */
.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: center;
}

.score-card__label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.score-card__value {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.score-card__max {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.score-card__bar {
  width: 100%;
  height: 6px;
  background: var(--bg-inset);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-sm);
}

.score-card__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-active), var(--accent));
  border-radius: var(--radius-full);
  width: 0;
  transition: width var(--transition-slow) ease;
}

/* === 反馈项 === */
.feedback-item {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  margin-bottom: var(--space-xs);
}

.feedback-item__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--accent-bg);
  color: var(--accent-hover);
}

.feedback-item__content {
  flex: 1;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}

.feedback-item__role {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === 辩论时间线 === */
.debate-entry {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.debate-entry:last-child {
  border-bottom: none;
}

.debate-entry__from {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent-hover);
  min-width: 80px;
}

.debate-entry__arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

.debate-entry__to {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--warning);
  min-width: 80px;
}

.debate-entry__content {
  flex: 1;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}

/* === 题目展示 === */
.question-display {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.question-display__title {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.question-display__body {
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-md);
}

.question-display__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* === 答题编辑器 === */
.answer-editor {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.answer-editor__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.answer-editor__textarea {
  width: 100%;
  min-height: 200px;
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  background: var(--bg-inset);
  border: none;
  outline: none;
  resize: vertical;
  line-height: var(--lh-relaxed);
}

.answer-editor__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
}

/* === 可折叠面板 === */
.collapsible {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.collapsible__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}

.collapsible__header:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.collapsible__icon {
  transition: transform var(--transition-base);
}

.collapsible--open .collapsible__icon {
  transform: rotate(180deg);
}

.collapsible__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow) ease;
}

.collapsible--open .collapsible__body {
  max-height: 2000px;
}

.collapsible__body-inner {
  padding: var(--space-md);
}

/* === 设置面板 === */
.settings-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row__label {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.settings-row__control {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* === 难度选择器 === */
.difficulty-dots {
  display: inline-flex;
  gap: 4px;
}

.difficulty-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
  transition: all var(--transition-fast);
}

.difficulty-dot--filled {
  background: var(--accent);
  border-color: var(--accent);
}

/* === 标签组 === */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15em 0.5em;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

/* === 空状态 === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-md);
  text-align: center;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state__text {
  font-size: var(--fs-sm);
}

/* === 加载指示器 === */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === 分割标题 === */
.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
}

.section-title__marker {
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: var(--radius-full);
}

/* === 开关 === */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle__input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}

.toggle__slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}

.toggle__input:checked + .toggle__slider {
  background: var(--accent-bg);
  border-color: var(--accent);
}

.toggle__input:checked + .toggle__slider::before {
  transform: translateX(18px);
  background: var(--accent);
}

/* === 雷达图容器 === */
.radar-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.radar-container canvas {
  max-width: 100%;
}

/* === 粘性定位 === */
.sticky {
  position: sticky;
}

/* === Markdown 内容 === */
.markdown-content {
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

.markdown-content p {
  margin-bottom: var(--space-sm);
}

.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
}

.markdown-content ul,
.markdown-content ol {
  margin-bottom: var(--space-sm);
  padding-left: var(--space-md);
}

.markdown-content li {
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.markdown-content pre {
  margin: var(--space-sm) 0;
}

.markdown-content blockquote {
  margin: var(--space-sm) 0;
}

.markdown-content code {
  font-size: 0.9em;
}

.markdown-content strong {
  color: var(--text-primary);
}

/* === 三阶段首页 === */
.home-hero {
  text-align: center;
  padding: var(--space-lg) 0 var(--space-xl);
}

.home-hero__eyebrow {
  margin-bottom: var(--space-xs);
  color: var(--accent-hover);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
}

.home-hero__title { font-size: clamp(2.2rem, 8vw, 4rem); }
.home-hero__description { max-width: 680px; margin: var(--space-sm) auto; }

button,
.btn,
.tag-btn,
.radio-option,
.select,
.input {
  min-height: 44px;
}

.ai-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--space-sm);
  color: var(--text-muted);
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
}

.ai-status--online { color: var(--success); border-color: rgba(122, 154, 122, 0.4); }

.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
}

.stage-card {
  display: flex;
  min-width: 0;
  min-height: 190px;
  padding: var(--space-md);
  color: var(--text-primary);
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: border-color var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}

.stage-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stage-card--active { background: var(--accent-bg); border-color: var(--accent); box-shadow: var(--shadow-glow); }
.stage-card__index { flex: 0 0 42px; color: var(--accent-hover); font-family: var(--font-mono); font-size: var(--fs-sm); }
.stage-card__body { display: flex; min-width: 0; flex-direction: column; gap: 0.35rem; }
.stage-card__title { font-family: var(--font-serif); font-size: var(--fs-lg); }
.stage-card__subtitle { color: var(--accent-hover); font-size: var(--fs-sm); }
.stage-card__description { color: var(--text-secondary); line-height: var(--lh-relaxed); font-size: var(--fs-sm); }

.direction-category__title {
  margin: var(--space-lg) 0 var(--space-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.direction-card {
  width: 100%;
  min-width: 0;
  min-height: 176px;
  color: var(--text-primary);
  text-align: left;
}

.direction-card__content { display: flex; min-width: 0; flex-direction: column; gap: 0.25rem; }
.direction-card__name { font-family: var(--font-serif); font-size: var(--fs-md); }
.direction-card__description { display: -webkit-box; overflow: hidden; color: var(--text-secondary); font-size: var(--fs-xs); line-height: var(--lh-normal); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.direction-card--disabled { opacity: 0.45; cursor: not-allowed; }
.direction-card--disabled:hover { transform: none; border-color: var(--border-subtle); }

.mode-summary-card {
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
}
.mode-summary-card p { margin: var(--space-xs) 0; }
.settings-row__select { width: min(220px, 100%); }
.interview-tags { padding-top: var(--space-sm); border-top: 1px solid var(--border-subtle); }
.settings-hint { margin-bottom: var(--space-sm); }
.tag-category { margin-top: var(--space-sm); }
.tag-category__label { display: block; margin-bottom: var(--space-xs); font-size: var(--fs-sm); }
.tag-options, .recommendations { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }

.sticky-action-bar {
  position: sticky;
  z-index: 20;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) max(var(--space-sm), env(safe-area-inset-right)) max(var(--space-sm), env(safe-area-inset-bottom)) max(var(--space-sm), env(safe-area-inset-left));
  background: linear-gradient(to top, var(--bg-base) 72%, transparent);
}

.sticky-action-bar__primary { width: min(520px, 100%); }

/* === 通用状态提示 === */
.notice { padding: var(--space-sm); color: var(--text-secondary); background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); line-height: var(--lh-relaxed); }
.notice--warning { color: var(--warning); background: var(--warning-bg); border-color: rgba(196, 164, 122, 0.35); }
.notice--success { color: var(--success); background: var(--success-bg); border-color: rgba(122, 154, 122, 0.35); }
.notice--info { background: var(--accent-bg); border-color: var(--border-accent); }

/* === 初来乍到 === */
.app-header { top: 0; z-index: 30; }
.header-bar__subtitle { margin-left: var(--space-sm); color: var(--text-muted); font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 400; }
.learning-layout { display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: var(--space-md); align-items: start; }
.learning-nav { position: sticky; top: calc(var(--header-height) + var(--space-sm)); display: flex; max-height: calc(100dvh - var(--header-height) - var(--space-lg)); flex-direction: column; gap: var(--space-xs); padding: var(--space-sm); overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.learning-nav__heading { display: flex; flex-direction: column; margin-bottom: var(--space-xs); }
.learning-chapter-label { margin-top: var(--space-sm); padding: var(--space-xs) var(--space-sm); color: var(--accent-hover); font-family: var(--font-mono); font-size: var(--fs-xs); border-top: 1px solid var(--border-subtle); }
.learning-unit-link { display: flex; width: 100%; min-width: 0; padding: var(--space-sm); gap: var(--space-xs); color: var(--text-secondary); text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; }
.learning-unit-link:hover { background: var(--bg-hover); }
.learning-unit-link--active { color: var(--text-primary); background: var(--accent-bg); border-color: var(--border-accent); }
.learning-unit-link__order { color: var(--accent-hover); font-family: var(--font-mono); font-size: var(--fs-xs); }
.learning-unit-link__body { display: flex; min-width: 0; flex-direction: column; }
.learning-unit-link__meta { margin-top: 0.2rem; color: var(--text-muted); font-size: var(--fs-xs); }
.learning-content { display: flex; min-width: 0; flex-direction: column; gap: var(--space-md); }
.lesson-hero { padding: clamp(var(--space-md), 5vw, var(--space-lg)); }
.lesson-hero h1 { margin: var(--space-xs) 0 var(--space-md); font-size: clamp(var(--fs-xl), 5vw, var(--fs-2xl)); }
.lesson-hero__meta { color: var(--accent-hover); font-family: var(--font-mono); font-size: var(--fs-xs); }
.lesson-objectives { margin-top: var(--space-md); }
.lesson-section__title { margin-bottom: var(--space-sm); font-size: var(--fs-lg); }
.lesson-lead { font-size: var(--fs-md); }
.lesson-analogy { background: var(--accent-bg); padding-block: var(--space-sm); padding-right: var(--space-sm); }
.term-grid, .connection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.term-card, .connection-card { display: flex; min-width: 0; flex-direction: column; gap: 0.35rem; padding: var(--space-sm); background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.term-card p, .connection-card p { font-size: var(--fs-sm); }
.worked-steps { margin-bottom: var(--space-sm); }
.misconception-list { display: grid; gap: var(--space-xs); }
.misconception-item { padding: var(--space-sm); color: var(--warning); background: var(--warning-bg); border-radius: var(--radius-md); }
.quiz-question { margin-bottom: var(--space-md); padding: 0; border: 0; }
.quiz-question legend, .quiz-open-label > strong { display: block; margin-bottom: var(--space-xs); color: var(--text-primary); font-weight: 600; }
.quiz-option { display: flex; min-height: 48px; align-items: center; gap: var(--space-xs); margin-bottom: var(--space-xs); padding: var(--space-xs) var(--space-sm); background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); cursor: pointer; }
.quiz-option:has(input:checked) { background: var(--accent-bg); border-color: var(--accent); }
.quiz-option input { width: 20px; height: 20px; accent-color: var(--accent); }
.quiz-open-label { display: block; margin-bottom: var(--space-md); }
.quiz-open-answer { margin-top: var(--space-xs); resize: vertical; }
.learning-result, .practice-result { display: flex; gap: var(--space-md); margin-top: var(--space-md); padding: var(--space-md); background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.learning-result--mastered { border-color: rgba(122, 154, 122, 0.45); }
.learning-result__score, .practice-result__score, .stage-report-score { flex: 0 0 auto; font-family: var(--font-serif); font-size: var(--fs-3xl); font-weight: 700; color: var(--accent-hover); }
.learning-result__body, .practice-result__body { min-width: 0; flex: 1; }
.learning-result__actions, .practice-result__actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-sm); }
.source-list a { overflow-wrap: anywhere; }

/* === 粗通皮毛 === */
.practice-content { display: flex; flex-direction: column; gap: var(--space-md); }
.practice-intro { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.practice-intro h1 { margin-top: var(--space-xs); font-size: var(--fs-lg); }
.practice-context-grid, .practice-feedback-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.practice-context-card h2 { margin-bottom: var(--space-xs); font-size: var(--fs-md); }
.revealed-hints { display: grid; gap: var(--space-xs); margin-bottom: var(--space-sm); }
.practice-answer .answer-editor__textarea { min-height: 220px; margin-bottom: var(--space-sm); }
.practice-feedback-grid { margin-top: var(--space-sm); }

/* === 分阶段报告 === */
.stage-report-hero { display: flex; align-items: center; gap: var(--space-lg); margin-bottom: var(--space-lg); padding: var(--space-lg); }
.report-unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.report-unit-card h2, .practice-report-item h2 { margin: var(--space-xs) 0; font-size: var(--fs-md); }
.progress-track { height: 8px; margin: var(--space-sm) 0 var(--space-xs); overflow: hidden; background: var(--bg-inset); border-radius: var(--radius-full); }
.progress-track__bar { height: 100%; background: var(--accent); border-radius: inherit; }
.report-chapter { margin-bottom: var(--space-lg); }
.practice-report-list { display: grid; gap: var(--space-sm); }
.practice-report-item__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }

@media (max-width: 768px) {
  .stage-grid { grid-template-columns: 1fr; }
  .stage-card { min-height: 0; }
  .learning-layout { grid-template-columns: 1fr; }
  .learning-nav { position: static; display: grid; max-height: none; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .learning-nav__heading { grid-column: 1 / -1; }
  .learning-chapter-label { grid-column: 1 / -1; }
  .term-grid, .connection-grid, .practice-context-grid, .practice-feedback-grid, .report-unit-grid { grid-template-columns: 1fr; }
  .practice-intro { align-items: flex-start; flex-direction: column; }
  .stage-report-hero { align-items: flex-start; gap: var(--space-sm); padding: var(--space-md); }
  .answer-editor__footer,
  .quiz-submit,
  .practice-submit {
    position: sticky;
    z-index: 18;
    bottom: env(safe-area-inset-bottom);
  }
  .answer-editor__footer {
    padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.22);
  }
  .answer-editor { overflow: visible; }
  .quiz-submit,
  .practice-submit {
    width: 100%;
    margin-bottom: max(var(--space-xs), env(safe-area-inset-bottom));
    box-shadow: var(--shadow-md);
  }
}

@media (max-width: 480px) {
  .header-bar { gap: var(--space-xs); padding: var(--space-xs); }
  .header-bar__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-bar__subtitle { display: none; }
  .header-bar__meta { max-width: 42%; text-align: right; font-size: var(--fs-xs); }
  .header-bar > .flex { flex-shrink: 0; gap: 0; }
  .header-bar > .flex .btn:not(:last-child) { display: none; }
  .learning-nav { display: flex; flex-direction: row; overflow-x: auto; scroll-snap-type: x proximity; }
  .learning-nav__heading { display: none; }
  .learning-chapter-label { min-width: 150px; margin-top: 0; border-top: 0; border-right: 1px solid var(--border-subtle); }
  .learning-unit-link { min-width: 230px; scroll-snap-align: start; }
  .learning-result, .practice-result, .stage-report-hero { flex-direction: column; }
  .sticky-action-bar { margin-inline: calc(var(--space-xs) * -1); }
  .settings-row { align-items: stretch; flex-direction: column; gap: var(--space-xs); }
  .settings-row__select { width: 100%; }
  .stage-report-actions { flex-direction: column-reverse; }
  .stage-report-actions .btn { width: 100%; }
}

@media (pointer: coarse) {
  .btn, .tag-btn, .radio-option, .direction-card, .learning-unit-link, .select, .input { min-height: 44px; }
}

/* === 深度学习课程 v2 === */
.page-loading { display: grid; min-height: 50dvh; place-items: center; color: var(--text-muted); }
.storage-limited { margin-top: var(--space-sm); padding-block: var(--space-sm); }
.progress-entry { width: 100%; margin-top: var(--space-xs); }
.lesson-section__meta, .resource-card__meta { margin-bottom: var(--space-xs); color: var(--accent-hover); font-family: var(--font-mono); font-size: var(--fs-xs); }
.lesson-prose { color: var(--text-secondary); font-size: var(--fs-md); line-height: var(--lh-relaxed); }
.lesson-prose p { margin-bottom: var(--space-sm); overflow-wrap: anywhere; }
.course-stepper { display: flex; gap: var(--space-xs); padding: var(--space-xs); overflow-x: auto; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); scroll-snap-type: x proximity; }
.course-step { display: flex; min-width: 112px; max-width: 160px; align-items: center; gap: 0.35rem; padding: var(--space-xs); color: var(--text-muted); text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); scroll-snap-align: start; }
.course-step > span { display: grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; background: var(--bg-inset); border-radius: 50%; font-size: var(--fs-xs); }
.course-step small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-step--active { color: var(--text-primary); background: var(--accent-bg); border-color: var(--border-accent); }
.course-step--done > span { color: var(--bg-base); background: var(--success); }
.term-ref-list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); margin: var(--space-md) 0; padding-top: var(--space-sm); border-top: 1px solid var(--border-subtle); }
.term-token { min-height: 32px; padding: 0.2rem 0.55rem; color: var(--accent-hover); background: var(--accent-bg); border: 1px dashed var(--border-accent); border-radius: var(--radius-full); font: inherit; cursor: pointer; }
.term-token:hover, .term-token:focus-visible { border-style: solid; outline: 2px solid var(--accent); outline-offset: 2px; }
.drawer-backdrop { position: fixed; z-index: 1000; inset: 0; display: flex; justify-content: flex-end; background: rgba(0, 0, 0, 0.58); }
.glossary-drawer { width: min(460px, 100%); height: 100dvh; padding: var(--space-md); overflow-y: auto; color: var(--text-primary); background: var(--bg-surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
.glossary-drawer__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-md); }
.glossary-drawer__header h2 { margin-top: var(--space-xs); }
.content-block { min-width: 0; margin: var(--space-sm) 0; }
.content-block h4 { margin-bottom: var(--space-xs); color: var(--text-primary); }
.content-block p, .content-block li { color: var(--text-secondary); line-height: var(--lh-relaxed); overflow-wrap: anywhere; }
.content-block pre, .solution-code { max-width: 100%; padding: var(--space-sm); overflow-x: auto; white-space: pre; background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.inline-checks { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--border-subtle); }
.inline-check { margin-top: var(--space-md); padding: var(--space-sm); background: var(--bg-inset); border-radius: var(--radius-md); }
.quiz-options { display: grid; gap: var(--space-xs); margin: var(--space-sm) 0; }
.quiz-option--button { width: 100%; color: var(--text-primary); text-align: left; }
.quiz-option--selected { background: var(--accent-bg); border-color: var(--accent); }
.answer-reveal { margin-top: var(--space-sm); }
.worked-example { border-color: var(--border-accent); }
.worked-example > h2 { margin-bottom: var(--space-md); }
.lesson-pagination { justify-content: space-between; border-top: 1px solid var(--border-subtle); }
.final-checks { scroll-margin-top: calc(var(--header-height) + var(--space-sm)); }
.answer-review-list { display: grid; gap: var(--space-sm); margin-top: var(--space-md); }
.learning-result-summary { display: flex; align-items: baseline; gap: var(--space-sm); padding: var(--space-md); background: var(--accent-bg); border-radius: var(--radius-md); }
.learning-result-summary strong { color: var(--accent-hover); font-family: var(--font-serif); font-size: var(--fs-2xl); }
.answer-review { padding: var(--space-md); background: var(--bg-inset); border-left: 4px solid var(--border-strong); border-radius: var(--radius-md); }
.answer-review--correct { border-left-color: var(--success); }
.answer-review--wrong { border-left-color: var(--warning); }
.answer-review > p { margin: var(--space-xs) 0; }
.deep-dive-grid, .resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.deep-dive-card, .resource-card { min-width: 0; padding: var(--space-md); background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.deep-dive-card h3, .resource-card h3 { margin-bottom: var(--space-sm); }
.resource-card__actions, .backup-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-sm); }
.tutor-panel { border-style: dashed; }
.tutor-input { margin: var(--space-sm) 0; resize: vertical; }
.tutor-response { margin-top: var(--space-sm); }
.solution-guide { margin-top: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--border-subtle); }
.practice-ladder { display: grid; gap: var(--space-md); }
.ladder-task { padding: var(--space-md); background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.ladder-task h3 { margin: var(--space-sm) 0; font-size: var(--fs-md); }
.ladder-task textarea { margin: var(--space-sm) 0; resize: vertical; }
.ladder-task details { margin: var(--space-sm) 0; }
.ladder-task summary { min-height: 44px; color: var(--accent-hover); cursor: pointer; }
.alternative-solution { margin-top: var(--space-xs); padding: var(--space-sm); background: var(--bg-surface); border-radius: var(--radius-sm); }

/* 预定义算法推演 */
.trace { margin-top: var(--space-md); padding: var(--space-md); overflow: hidden; background: var(--bg-inset); }
.trace__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-sm); }
.trace__header h3 { margin-top: var(--space-xs); }
.trace__step { flex: 0 0 auto; color: var(--text-muted); font-family: var(--font-mono); font-size: var(--fs-xs); }
.trace__grid { display: grid; grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1.25fr); gap: var(--space-sm); margin-top: var(--space-sm); }
.trace__code { margin: 0; padding: var(--space-sm) var(--space-sm) var(--space-sm) 2.4rem; overflow-x: auto; background: var(--bg-base); border-radius: var(--radius-md); }
.trace__code li { padding: 0.25rem; color: var(--text-muted); white-space: nowrap; }
.trace__code-line--active { color: var(--accent-hover) !important; background: var(--accent-bg); border-radius: var(--radius-sm); }
.trace__stage { display: grid; min-width: 0; gap: var(--space-sm); }
.trace-array, .trace-nodes, .trace-stack, .trace-returned { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-xs); }
.trace-cell { display: grid; min-width: 48px; min-height: 54px; place-items: center; padding: 0.25rem; background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.trace-cell small { color: var(--text-muted); font-size: 0.65rem; }
.trace-cell--active, .trace-node--active { color: var(--bg-base); background: var(--accent-hover) !important; border-color: var(--accent-hover) !important; }
.trace-cell--done, .trace-node--visited { border-color: var(--success); }
.trace-cell--outside { opacity: 0.35; }
.trace-node, .trace-stack span, .trace-returned span { min-width: 44px; padding: var(--space-xs); text-align: center; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-full); }
.trace-node--frontier { box-shadow: 0 0 0 2px var(--accent); }
.trace-vars dl { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem var(--space-sm); margin-top: var(--space-xs); }
.trace-vars dt { color: var(--text-muted); font-family: var(--font-mono); }
.trace-vars dd { margin: 0; overflow-wrap: anywhere; }
.trace-table-wrap { overflow-x: auto; }
.trace-table { width: 100%; min-width: 340px; margin-top: var(--space-xs); border-collapse: collapse; }
.trace-table th, .trace-table td { padding: var(--space-xs); text-align: center; border: 1px solid var(--border-subtle); }
.trace-table .trace-cell--active { color: var(--bg-base); background: var(--accent-hover); }
.trace__controls { justify-content: flex-start; padding-inline: 0; }

/* 学习痕迹 */
.progress-content { display: flex; flex-direction: column; gap: var(--space-lg); }
.progress-hero { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.progress-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-sm); }
.progress-stat { display: flex; min-width: 0; flex-direction: column; }
.progress-stat strong { color: var(--accent-hover); font-family: var(--font-serif); font-size: var(--fs-xl); }
.progress-course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.progress-unit-card { min-width: 0; }
.progress-unit-card h3 { margin: var(--space-sm) 0; overflow-wrap: anywhere; }
.progress-list, .progress-timeline { display: grid; gap: var(--space-xs); }
.progress-list-item { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-sm); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.progress-list-item > div { min-width: 0; }
.progress-list-item p { overflow-wrap: anywhere; }
.progress-list-item--warning { border-left: 4px solid var(--warning); }
.progress-attempt { display: block; }
.progress-attempt__head { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.progress-attempt__head > div { min-width: 0; }
.attempt-details { margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: 1px solid var(--border-subtle); }
.attempt-details summary { min-height: 44px; color: var(--accent-hover); cursor: pointer; }
.attempt-details pre { max-height: 260px; padding: var(--space-sm); overflow: auto; white-space: pre-wrap; background: var(--bg-inset); border-radius: var(--radius-md); }
.progress-timeline { list-style: none; padding: 0; }
.progress-timeline li { display: grid; grid-template-columns: minmax(90px, auto) minmax(0, 1fr) auto; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm); border-left: 2px solid var(--border-accent); }
.backup-panel { padding: var(--space-md); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }

/* 开放题多维反馈 */
.assessment-dimensions, .assessment-insights { display: grid; gap: var(--space-xs); }
.assessment-dimensions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.assessment-dimension, .assessment-insight { min-width: 0; padding: var(--space-sm); background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.assessment-dimension__head { display: flex; justify-content: space-between; gap: var(--space-sm); }
.assessment-dimension__bar { height: 6px; margin: var(--space-xs) 0; overflow: hidden; background: var(--bg-elevated); border-radius: var(--radius-full); }
.assessment-dimension__bar span { display: block; height: 100%; background: var(--accent-hover); border-radius: inherit; }
.assessment-insight--positive { border-left: 4px solid var(--success); }
.assessment-insight--warning { border-left: 4px solid var(--warning); }
.assessment-insight blockquote { margin: var(--space-xs) 0; padding-left: var(--space-sm); color: var(--text-secondary); border-left: 2px solid var(--border-accent); overflow-wrap: anywhere; }

/* 持久化对话式助教 */
.tutor-panel { min-width: 0; }
.tutor-panel__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-sm); }
.tutor-thread-tools { display: flex; max-width: 320px; gap: var(--space-xs); }
.tutor-thread-select { min-width: 0; }
.tutor-chat { display: flex; max-height: 520px; min-height: 180px; flex-direction: column; gap: var(--space-sm); margin: var(--space-sm) 0; padding: var(--space-sm); overflow: auto; background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overscroll-behavior: contain; }
.tutor-chat__empty { margin: auto; color: var(--text-muted); text-align: center; }
.tutor-bubble { width: fit-content; max-width: min(82%, 680px); padding: 0.75rem var(--space-sm); overflow-wrap: anywhere; border-radius: var(--radius-lg); }
.tutor-bubble p { margin: 0; white-space: pre-wrap; }
.tutor-bubble time { display: block; margin-top: 0.35rem; color: var(--text-muted); font-size: var(--fs-xs); text-align: right; }
.tutor-bubble--assistant { align-self: flex-start; background: var(--bg-elevated); border-bottom-left-radius: var(--radius-sm); }
.tutor-bubble--user { align-self: flex-end; background: var(--accent-bg-strong); border: 1px solid var(--border-accent); border-bottom-right-radius: var(--radius-sm); }
.tutor-bubble__name { margin-bottom: 0.25rem; color: var(--accent-hover); font-size: var(--fs-xs); }
.tutor-bubble--thinking { color: var(--text-muted); }
.tutor-quick-prompts { display: flex; gap: var(--space-xs); padding-bottom: var(--space-xs); overflow-x: auto; }
.tutor-quick-prompts .btn { flex: 0 0 auto; }
.tutor-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-xs); align-items: end; }
.tutor-composer__actions { display: flex; gap: var(--space-xs); }
.tutor-input { min-width: 0; resize: vertical; }

@media (max-width: 768px) {
  .deep-dive-grid, .resource-grid, .progress-course-grid { grid-template-columns: 1fr; }
  .progress-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trace__grid { grid-template-columns: 1fr; }
  .trace__code { max-height: 190px; }
  .progress-hero { align-items: flex-start; flex-direction: column; }
  .progress-timeline li { grid-template-columns: 1fr; gap: 0.2rem; }
  .assessment-dimensions { grid-template-columns: 1fr; }
  .tutor-panel__heading, .tutor-composer { grid-template-columns: 1fr; flex-direction: column; }
  .tutor-thread-tools { width: 100%; max-width: none; }
  .tutor-thread-select { flex: 1; }
  .tutor-composer { display: grid; }
  .tutor-composer__actions { justify-content: flex-end; }
  .tutor-bubble { max-width: 92%; }
}

@media (max-width: 480px) {
  .course-step { min-width: 96px; }
  .lesson-section, .trace, .glossary-drawer { padding: var(--space-sm); }
  .lesson-pagination { margin-inline: calc(var(--space-xs) * -1); }
  .lesson-pagination .btn { min-width: 0; padding-inline: var(--space-xs); }
  .trace__header { flex-direction: column; }
  .trace__controls { display: grid; grid-template-columns: repeat(3, 1fr); }
  .trace__controls .btn { min-width: 0; padding-inline: 0.3rem; }
  .progress-stat-grid { grid-template-columns: 1fr 1fr; }
  .progress-list-item { align-items: flex-start; flex-direction: column; }
  .resource-card__actions .btn { width: 100%; }
  .backup-actions { flex-direction: column; }
  .backup-actions > * { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer-backdrop, .glossary-drawer, .trace * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
