/* ============================================
   错题台账 · ElevenLabs 风格设计
   ============================================ */

/* --- CSS 变量 --- */
:root {
  /* 背景色 */
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-warm: rgba(245, 242, 239, 0.8);

  /* 文字色 */
  --ink: #000000;
  --ink-secondary: #4e4e4e;
  --muted: #777169;

  /* 分割线 */
  --line: #e5e5e5;
  --line-subtle: rgba(0, 0, 0, 0.05);

  /* 阴影 - 多层系统 */
  --shadow-outline: rgba(0, 0, 0, 0.06) 0 0 0 1px,
                    rgba(0, 0, 0, 0.04) 0 1px 2px,
                    rgba(0, 0, 0, 0.04) 0 2px 4px;
  --shadow-card: rgba(0, 0, 0, 0.06) 0 0 0 1px,
                 rgba(0, 0, 0, 0.04) 0 1px 2px,
                 rgba(0, 0, 0, 0.04) 0 2px 4px;
  --shadow-button: rgba(0, 0, 0, 0.4) 0 0 1px,
                   rgba(0, 0, 0, 0.04) 0 4px 4px;
  --shadow-elevated: rgba(0, 0, 0, 0.04) 0 4px 4px;

  /* 功能色 - 保留原有用法 */
  --accent: #000000;
  --accent-soft: #f5f5f5;
  --danger: #a34235;
  --danger-bg: #f8e3dc;
  --ok: #2c735d;
  --ok-bg: #e3f3ec;
  --warn: #b86f2d;
  --warn-bg: #f8e8d8;

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;
}

/* --- 基础重置 --- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.14px;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

/* --- 布局 --- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

/* --- 侧边栏 --- */
.sidebar {
  background: var(--surface);
  box-shadow: var(--shadow-outline);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--surface-warm);
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
  box-shadow: rgba(78, 50, 23, 0.04) 0 6px 16px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3 {
  margin: 0;
}

.brand h1 {
  font-family: Inter, sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: normal;
}

.brand p {
  color: var(--muted);
  margin-top: 2px;
  font-size: 12px;
}

/* --- 导航 --- */
.nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  border-radius: var(--radius-md);
  min-height: 40px;
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.14px;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--ink);
}

.nav-item.active {
  background: var(--surface-warm);
  color: var(--ink);
  box-shadow: rgba(78, 50, 23, 0.04) 0 6px 16px;
}

/* --- 用户面板 --- */
.profile-panel {
  margin-top: auto;
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.profile-panel .label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14px;
}

.profile-panel select {
  min-height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  padding: 0 var(--space-md);
  background: var(--surface);
  font-size: 13px;
}

.label,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14px;
}

/* --- Ghost 按钮 --- */
.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-secondary);
  border-radius: var(--radius-md);
  min-height: 38px;
  text-align: left;
  padding: 0 var(--space-md);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.ghost-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* --- 主内容区 --- */
.main {
  padding: var(--space-2xl);
  overflow: hidden;
}

/* --- 顶部栏 --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.topbar h2 {
  font-family: Inter, sans-serif;
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.5px;
}

.topbar-actions,
.form-actions,
.toolbar,
.ai-tools {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* --- 按钮系统 --- */
.primary-btn,
.secondary-btn,
.chip-btn {
  border-radius: var(--radius-pill);
  border: none;
  min-height: 40px;
  padding: 0 var(--space-lg);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.14px;
  transition: all 0.15s ease;
}

.primary-btn {
  background: var(--ink);
  color: #fff;
  border: none;
}

.primary-btn:hover {
  opacity: 0.85;
}

.secondary-btn {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-button);
}

.secondary-btn:hover {
  border-color: var(--ink);
  box-shadow: rgba(0, 0, 0, 0.4) 0 0 1px, rgba(0, 0, 0, 0.08) 0 4px 8px;
}

.chip-btn {
  background: var(--bg);
  color: var(--ink-secondary);
  border: 1px solid transparent;
  min-height: 32px;
  padding: 0 var(--space-md);
  font-size: 13px;
  border-radius: var(--radius-pill);
}

.chip-btn:hover {
  background: var(--surface-warm);
  color: var(--ink);
}

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

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

/* --- 视图切换 --- */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* --- 指标网格 --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

/* --- 指标卡片 --- */
.metric,
.panel,
.form-panel {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.metric {
  padding: var(--space-xl);
  display: grid;
  gap: var(--space-sm);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.14px;
}

.metric strong {
  font-size: 34px;
  font-weight: 400;
  color: var(--ink);
}

/* --- 内容网格 --- */
.content-grid,
.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-md);
}

/* --- 面板 --- */
.panel,
.form-panel {
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
}

.weekly-panel {
  margin-top: var(--space-md);
}

/* --- 周报样式 --- */
.weekly-report {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.report-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.report-date {
  font-size: 13px;
  color: var(--muted);
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius-lg);
  text-align: center;
}

.stat-card.success {
  background: var(--ok-bg);
}

.stat-card.warning {
  background: var(--warn-bg);
}

.stat-icon {
  font-size: 20px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
}

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

.report-sections {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.report-section {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.section-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
  font-size: 13px;
  color: var(--ink-secondary);
  border-bottom: 1px solid var(--line-subtle);
}

.section-item:last-child {
  border-bottom: none;
}

.section-item .count {
  color: var(--muted);
}

.report-tip {
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.6;
}

.report-tip.warning {
  background: var(--warn-bg);
  color: var(--warn);
}

.report-tip.success {
  background: var(--ok-bg);
  color: var(--ok);
}

@media (max-width: 640px) {
  .report-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-sections {
    grid-template-columns: 1fr;
  }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  align-items: baseline;
  margin-bottom: var(--space-md);
}

.panel-head h3 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: normal;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14px;
}

/* --- 列表项 --- */
.rank-list,
.mistake-list,
.heatmap,
.tree,
.migration-list,
.trend-list {
  display: grid;
  gap: var(--space-sm);
}

.rank-item,
.mistake-card,
.heat-item,
.tree div {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: var(--space-md);
}

.rank-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm);
  align-items: center;
  background: transparent;
  border: none;
  padding: var(--space-xs) 0;
}

.bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: var(--radius-pill);
}

.report-text {
  color: var(--ink-secondary);
  line-height: 1.7;
  white-space: pre-line;
  font-size: 14px;
}

/* --- 表单 --- */
.form-panel,
.dialog-form {
  display: grid;
  gap: var(--space-md);
}

.mobile-capture-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.mobile-capture-panel strong,
.mobile-capture-panel p {
  margin: 0;
}

.mobile-capture-panel p {
  margin-top: var(--space-xs);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.capture-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: #fff;
  padding: 0 var(--space-lg);
  font-weight: 500;
  font-size: 14px;
  transition: opacity 0.15s ease;
}

.capture-button:hover {
  opacity: 0.85;
}

.capture-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-preview-panel {
  display: grid;
  grid-template-columns: minmax(0, 200px) 1fr;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.image-preview-panel.hidden {
  display: none;
}

.image-preview-panel img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-subtle);
  background: var(--bg);
}

.image-preview-info {
  display: grid;
  gap: var(--space-xs);
}

.image-preview-info span {
  color: var(--muted);
  font-size: 12px;
}

.inline-check {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 40px;
  color: var(--muted);
  font-size: 13px;
}

.inline-check input {
  width: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

label {
  display: grid;
  gap: var(--space-xs);
  color: var(--ink-secondary);
  font-size: 13px;
  letter-spacing: 0.14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.5);
}

textarea {
  resize: vertical;
}

.toolbar {
  margin-bottom: var(--space-md);
}

.toolbar input {
  flex: 1 1 280px;
}

.toolbar select {
  flex: 0 0 150px;
}

.ai-tools {
  align-items: center;
  padding: var(--space-md);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.ai-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ai-status.ok {
  color: var(--ok);
}

.ai-status.error {
  color: var(--danger);
}

/* --- 错误/启动页面 --- */
.startup-error {
  width: min(720px, calc(100vw - 36px));
  margin: 12vh auto;
  padding: var(--space-2xl);
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.startup-error code {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

/* --- 认证遮罩 --- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--space-xl);
  background: rgba(0, 0, 0, 0.5);
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: var(--space-md);
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.auth-card h1,
.auth-card p {
  margin: 0;
}

.auth-card p {
  color: var(--ink-secondary);
  line-height: 1.6;
}

.auth-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

/* --- 错题卡片 --- */
.mistake-card {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
}

.mistake-card.no-image {
  grid-template-columns: 1fr;
}

.mistake-image {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-subtle);
  background: var(--bg);
}

.mistake-main {
  min-width: 0;
}

.mistake-meta,
.tag-row,
.review-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.mistake-meta {
  margin-bottom: var(--space-sm);
}

/* --- 标签 --- */
.tag {
  min-height: 24px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14px;
}

.tag.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.tag.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.question {
  margin: 0 0 var(--space-sm);
  line-height: 1.6;
  font-size: 14px;
}

.answer-line {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: var(--space-sm);
}

.explanation-block {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-left: 3px solid var(--ink);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--bg);
}

.explanation-block strong {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 13px;
  font-weight: 600;
}

.explanation-block p {
  margin: 0;
  color: var(--ink-secondary);
  line-height: 1.7;
  white-space: pre-line;
  font-size: 13px;
}

.review-actions {
  margin-top: var(--space-sm);
}

.compact .mistake-card {
  grid-template-columns: 1fr;
}

/* --- 复习规则 --- */
.rules {
  color: var(--ink-secondary);
  line-height: 1.9;
  padding-left: var(--space-lg);
  margin: 0;
  font-size: 13px;
}

/* --- 热力图 --- */
.heat-item {
  display: grid;
  gap: var(--space-sm);
  background: transparent;
  border: none;
  padding: var(--space-xs) 0;
}

.heat-label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
}

.heat-label strong {
  font-size: 14px;
  font-weight: 500;
}

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

.heat-scale {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  overflow: hidden;
}

/* --- 分析指标 --- */
.analysis-metrics {
  margin-bottom: var(--space-md);
}

.analysis-grid {
  margin-top: var(--space-md);
}

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

.heat-cell {
  min-height: 116px;
  display: grid;
  align-content: space-between;
  gap: var(--space-md);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.heat-cell.low {
  background: #f8faf8;
}

.heat-cell.mid {
  background: #fdf8f0;
}

.heat-cell.high {
  background: #fdf4f2;
}

.heat-cell-title {
  display: grid;
  gap: var(--space-xs);
}

.heat-cell-title strong {
  font-size: 15px;
  font-weight: 500;
}

.heat-cell-title span,
.heat-cell-meta {
  color: var(--muted);
  font-size: 12px;
}

.heat-cell-meta {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.heat-cell-meta span {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  font-size: 11px;
}

/* --- 迁移风险 --- */
.migration-item {
  display: grid;
  gap: var(--space-sm);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.migration-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  align-items: flex-start;
}

.migration-head span {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.migration-item p {
  margin: 0;
  color: var(--ink-secondary);
  line-height: 1.6;
  font-size: 13px;
}

.migration-item .action {
  color: var(--ink);
  font-weight: 500;
}

.risk-高 {
  background: #fdf4f2;
}

.risk-中 {
  background: #fdf8f0;
}

/* --- 趋势 --- */
.trend-item {
  display: grid;
  grid-template-columns: 80px 1fr 56px;
  gap: var(--space-sm);
  align-items: center;
}

.trend-item span,
.trend-item strong {
  color: var(--muted);
  font-size: 12px;
}

.trend-item strong {
  text-align: right;
}

.trend-bars {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  overflow: hidden;
}

.trend-bars i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--radius-pill);
}

.trend-total {
  background: #d0d0d0;
}

.trend-mastered {
  background: var(--ink);
}

/* --- 知识树 --- */
.tree div {
  display: grid;
  gap: var(--space-xs);
  background: transparent;
  border: none;
  padding: var(--space-xs) 0;
}

.tree strong {
  font-size: 14px;
  font-weight: 600;
}

.tree span {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

/* --- Dialog --- */
dialog {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  box-shadow: var(--shadow-card);
  max-width: 420px;
  width: min(420px, calc(100vw - 32px));
}

.dialog-form {
  padding: var(--space-xl);
  background: var(--surface);
}

.dialog-form h3 {
  margin: 0 0 var(--space-sm);
  font-size: 18px;
  font-weight: 500;
}

.form-actions {
  margin-top: var(--space-md);
}

/* --- 空状态 --- */
.empty {
  color: var(--muted);
  padding: var(--space-lg);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
  font-size: 13px;
  text-align: center;
}

/* --- 响应式 --- */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: var(--space-lg);
    height: auto;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-item {
    flex: 1 1 auto;
    text-align: center;
    padding: var(--space-sm);
  }

  .profile-panel {
    margin-top: 0;
  }

  .metrics-grid,
  .content-grid,
  .review-layout,
  .heatmap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .main {
    padding: var(--space-lg);
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .topbar h2 {
    font-size: 24px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics-grid,
  .content-grid,
  .review-layout,
  .form-grid,
  .heatmap-grid {
    grid-template-columns: 1fr;
  }

  .mobile-capture-panel,
  .image-preview-panel {
    grid-template-columns: 1fr;
  }

  .capture-button {
    width: 100%;
    min-height: 48px;
  }

  .form-actions .primary-btn,
  .form-actions .secondary-btn {
    flex: 1 1 140px;
  }

  .trend-item {
    grid-template-columns: 1fr;
  }

  .trend-item strong {
    text-align: left;
  }

  .mistake-card {
    grid-template-columns: 1fr;
  }

  .mistake-image {
    width: 100%;
    height: 180px;
  }
}

/* --- 移动端底部导航 --- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  padding: var(--space-sm) var(--space-md);
  padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  z-index: 100;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  font-size: 11px;
  min-width: 60px;
  transition: all 0.15s ease;
}

.bottom-nav-item .nav-icon {
  font-size: 20px;
  line-height: 1;
}

.bottom-nav-item.active {
  color: var(--ink);
  background: var(--surface-warm);
}

.bottom-nav-item:active {
  transform: scale(0.95);
}

@media (max-width: 640px) {
  .bottom-nav {
    display: flex;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding-bottom: 90px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  /* 移动端录入页面优化 */
  .form-panel {
    gap: var(--space-md);
  }

  .mobile-capture-panel {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .mobile-capture-panel > div {
    order: 2;
  }

  .capture-button {
    order: 1;
    width: 100%;
    min-height: 120px;
    font-size: 16px;
    margin-bottom: var(--space-md);
  }

  .capture-button::before {
    content: "📷 ";
    font-size: 32px;
  }

  .image-preview-panel {
    grid-template-columns: 1fr;
  }

  .image-preview-panel img {
    height: 200px;
  }

  .form-actions {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: var(--bg);
    padding: var(--space-md);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  }

  .primary-btn,
  .secondary-btn {
    flex: 1;
    min-height: 48px;
    font-size: 15px;
  }

  .eyebrow {
    display: none;
  }

  .topbar {
    margin-bottom: var(--space-md);
  }

  .topbar-actions {
    display: none;
  }
}
