:root {
  --purple-primary: #9333EA;
  --purple-light: #C084FC;
  --purple-bg-start: #E9D5FF;
  --purple-bg-end: #F3E8FF;
  --surface: #FFFFFF;
  --surface-alt: #F8F5FF;
  --text-primary: #1A1A2E;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --accent-teal: #14B8A6;
  --accent-orange: #F59E0B;
  --accent-green: #10B981;
  --danger: #EF4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: linear-gradient(180deg, var(--purple-bg-start) 0%, var(--purple-bg-end) 40%, #FFFFFF 100%);
  min-height: 100vh;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* Status bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.status-bar-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 12px;
}

.page-header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  text-wrap: balance;
}

.page-header-back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  position: relative;
}
.page-header-back::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
}

.page-header-action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  position: relative;
}
.page-header-action::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
}

/* Brand header */
.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px 16px;
  position: relative;
}

.brand-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.brand-badge {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Search bar */
.search-bar {
  margin: 0 20px 20px;
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
}

.search-bar-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--purple-primary), var(--purple-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-bar-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text-muted);
  background: transparent;
}

.search-bar-voice {
  width: 40px;
  height: 40px;
  background: var(--text-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
}

/* Icon grid (金刚区) */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 0 20px 24px;
}

.icon-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.icon-grid-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  position: relative;
}

.icon-grid-icon.purple { background: linear-gradient(135deg, #A78BFA, #7C3AED); }
.icon-grid-icon.teal { background: linear-gradient(135deg, #5EEAD4, #14B8A6); }
.icon-grid-icon.orange { background: linear-gradient(135deg, #FCD34D, #F59E0B); }
.icon-grid-icon.pink { background: linear-gradient(135deg, #F9A8D4, #EC4899); }
.icon-grid-icon.blue { background: linear-gradient(135deg, #93C5FD, #3B82F6); }

.icon-grid-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-wrap: balance;
}

.section-more {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.tool-chip { padding:8px 14px; border-radius:var(--radius-full); border:1.5px solid var(--border); background:var(--surface); font-size:13px; cursor:pointer; white-space:nowrap; font-family:inherit; transition:transform 0.15s; display:inline-flex; align-items:center; gap:4px; flex-shrink:0; }
.tool-chip:active { transform:scale(0.96); }
.tool-chip.purple { border-color:var(--purple-primary); color:var(--purple-primary); background:#F5F3FF; }

.practice-entry { display:flex; align-items:center; gap:12px; padding:14px 16px; background:var(--surface); border-radius:var(--radius-md); box-shadow:var(--shadow-sm); cursor:pointer; transition:transform 0.15s, box-shadow 0.15s; font-family:inherit; border:none; width:100%; text-align:left; }
.practice-entry:active { transform:scale(0.97); }
.practice-entry-icon { width:44px; height:44px; border-radius:var(--radius-md); display:flex; align-items:center; justify-content:center; font-size:22px; flex-shrink:0; }
.practice-entry-icon.purple { background:#F5F3FF; }
.practice-entry-icon.green { background:#ECFDF5; }
.practice-entry-icon.blue { background:#DBEAFE; }
.practice-entry-title { font-size:14px; font-weight:600; color:var(--text-primary); }
.practice-entry-desc { font-size:12px; color:var(--text-muted); margin-top:2px; }

.unit-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.unit-item { display:flex; flex-direction:column; align-items:center; gap:6px; padding:14px 8px; background:var(--surface); border-radius:var(--radius-md); box-shadow:var(--shadow-sm); cursor:pointer; transition:transform 0.15s, box-shadow 0.15s; border:none; font-family:inherit; }
.unit-item:active { transform:scale(0.96); }
.unit-item .unit-icon { width:40px; height:40px; border-radius:var(--radius-sm); background:#F5F3FF; display:flex; align-items:center; justify-content:center; font-size:20px; }
.unit-item .unit-label { font-size:12px; font-weight:500; color:var(--text-primary); }

.chip-wrap { display:flex; gap:8px; flex-wrap:wrap; padding:4px 0; }

/* Subject tabs */
.subject-tabs {
  display: flex;
  gap: 10px;
  padding: 0 20px 16px;
  overflow-x: auto;
}

.subject-tab {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.subject-tab.active {
  background: var(--text-primary);
  color: var(--surface);
  border-color: var(--text-primary);
}

/* Version badge */
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--text-primary);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 0;
  font-size: 14px;
  font-weight: 600;
  margin: 0 20px 16px;
}

/* Lesson list */
.lesson-list {
  padding: 0 20px;
}

.lesson-unit-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lesson-unit-title .more-link {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.lesson-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s;
}

.lesson-card:active {
  transform: scale(0.96);
}

.lesson-card-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  position: relative;
}

.lesson-card-thumb .vip-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-orange);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 4px;
}

.lesson-card-thumb .lock-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.lesson-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.lesson-card-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
  flex-shrink: 0;
}

.lesson-card-tag.orange {
  background: #FEF3C7;
  color: #D97706;
}

.lesson-card-play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}

/* Page content wrapper */
.page-content {
  padding-bottom: 100px;
}

/* AI作文 hub page */
.subject-switcher {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 16px 20px 24px;
}

.subject-switcher-item {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  position: relative;
  transition: color 0.2s;
}

.subject-switcher-item.active {
  color: var(--text-primary);
}

.subject-switcher-item.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-teal);
  border-radius: 2px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 20px 24px;
}

.action-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
}

.action-card:active {
  transform: scale(0.96);
}

.action-card-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.action-card-icon.writing {
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
}

.action-card-icon.correction {
  background: linear-gradient(135deg, #5EEAD4, #14B8A6);
}

.action-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.action-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* AI Writing page */
.input-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin: 0 20px 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.input-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.input-card-indicator {
  width: 4px;
  height: 16px;
  background: var(--purple-primary);
  border-radius: 2px;
}

.input-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.input-card-body {
  min-height: 60px;
}

.input-field {
  width: 100%;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text-primary);
  background: transparent;
  resize: none;
  font-family: inherit;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.voice-input-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px auto 0;
  padding: 10px 20px;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.word-count-row {
  background: var(--surface);
  border-radius: var(--radius-md);
  margin: 0 20px 24px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.word-count-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.word-count-value {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.generate-btn {
  margin: 0 20px 32px;
  padding: 16px;
  background: var(--text-primary);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: calc(100% - 40px);
  transition: opacity 0.2s;
}

.generate-btn:active {
  opacity: 0.8;
}

/* Essay correction page */
.correction-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

.correction-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: white;
}

.correction-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

.correction-actions {
  display: flex;
  gap: 8px;
}

.correction-action-btn {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.correction-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.correction-paper {
  background: #FFF8E7;
  border-radius: var(--radius-sm);
  padding: 24px;
  max-width: 320px;
  font-family: 'KaiTi', 'STKaiti', serif;
  font-size: 14px;
  line-height: 2;
  color: #333;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.correction-paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: rgba(255,0,0,0.15);
}

.correction-paper-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.correction-guide-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  white-space: nowrap;
}

.correction-bottom-bar {
  padding: 16px 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.correction-camera-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid white;
  background: transparent;
  position: relative;
  cursor: pointer;
}

.correction-camera-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--danger);
  border: 3px solid white;
}

.correction-next-btn {
  padding: 12px 24px;
  background: var(--text-primary);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.correction-nav-items {
  display: flex;
  gap: 24px;
  justify-content: center;
  padding-bottom: 8px;
}

.correction-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  cursor: pointer;
}

.correction-nav-item.active {
  color: white;
}

.correction-nav-item .nav-icon {
  font-size: 22px;
}

/* Record tabs (写作记录 / 批改记录) */
.record-tabs {
  display: flex;
  gap: 24px;
  padding: 0 20px 16px;
}

.record-tab {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  position: relative;
  transition: color 0.2s;
}

.record-tab.active {
  color: var(--text-primary);
}

.record-tab.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--purple-primary);
  border-radius: 2px;
}

.record-panel {
  display: none;
}

.record-panel.active {
  display: block;
}

/* Writing record cards — no thumb, just text */
.writing-record-list,
.correction-record-list {
  padding: 0 20px;
}

.writing-record-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s;
}

.writing-record-card:active {
  transform: scale(0.96);
}

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

.writing-record-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.writing-record-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.record-view-btn {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--purple-primary);
  background: transparent;
  color: var(--purple-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.record-view-btn:active {
  background: var(--purple-primary);
  color: white;
}

/* Correction record cards — thumb, title, score, time */
.correction-record-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s;
}

.correction-record-card:active {
  transform: scale(0.96);
}

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

.correction-record-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.correction-record-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Essay examples */
.example-list {
  padding: 0 20px 24px;
}

.example-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s;
}

.example-card:active {
  transform: scale(0.96);
}

.example-card-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #E9D5FF, #C084FC);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 20px;
}

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

.example-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.example-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Correction record thumb */
.correction-record-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  position: relative;
  overflow: hidden;
}

.correction-record-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 6px,
    rgba(0,0,0,0.06) 6px,
    rgba(0,0,0,0.06) 7px
  );
}

/* Utility */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }

/* Bottom nav (5 items) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding: 6px 8px 20px;
  border-top: 1px solid var(--border);
  z-index: 100;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  padding: 4px 0;
  transition: color 0.2s;
}

.bottom-nav-item.active {
  color: var(--purple-primary);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
}

/* Grade & subject selector */
.grade-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 20px 16px;
}

.grade-selector-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.grade-selector-pill:active {
  box-shadow: var(--shadow-md);
}

.grade-selector-subject {
  display: flex;
  gap: 6px;
}

.grade-selector-subject button {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-family: inherit;
}

.grade-selector-subject button:active,
.grade-selector-subject button.active {
  background: var(--text-primary);
  color: var(--surface);
  border-color: var(--text-primary);
}

/* Four-step flow section */
.flow-section {
  padding: 0 20px 8px;
}

.flow-section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.flow-card:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-md);
}

.flow-card-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.flow-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.flow-card-icon.preview { background: linear-gradient(135deg, #5EEAD4, #14B8A6); }
.flow-card-icon.learn { background: linear-gradient(135deg, #C084FC, #7C3AED); }
.flow-card-icon.review { background: linear-gradient(135deg, #6EE7B7, #10B981); }
.flow-card-icon.practice { background: linear-gradient(135deg, #FCD34D, #F59E0B); }

.flow-card-icon svg { color: white; }

.flow-card-body { flex: 1; min-width: 0; }

.flow-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.flow-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-card-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.flow-card-status.pending {
  background: #FEF3C7;
  color: #D97706;
}

.flow-card-status.ready {
  background: #DBEAFE;
  color: #2563EB;
}

.flow-card-status.done {
  background: #D1FAE5;
  color: #059669;
}

/* Daily tip */
.daily-tip {
  margin: 8px 20px 24px;
  padding: 16px;
  background: linear-gradient(135deg, #F5F3FF, #EDE9FE);
  border-radius: var(--radius-lg);
  display: flex;
  gap: 12px;
}

.daily-tip-icon {
  width: 36px;
  height: 36px;
  background: var(--purple-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 18px;
}

.daily-tip-body { flex: 1; }

.daily-tip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple-primary);
  margin-bottom: 2px;
}

.daily-tip-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Subject page */
.subj-page {
  padding: 0 20px;
  padding-bottom: 80px;
}

.unit-group {
  margin-bottom: 20px;
}

.unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  transition: background 0.2s;
  margin-bottom: 1px;
}

.unit-header:active { background: var(--surface-alt); }

.unit-progress {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.unit-progress-bar {
  width: 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.unit-progress-fill {
  height: 100%;
  background: var(--accent-teal);
  border-radius: 2px;
}

.unit-lesson {
  background: var(--surface);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}

.unit-lesson:first-of-type { border-top: none; }
.unit-lesson:active { background: var(--surface-alt); }
.unit-lesson:last-of-type { border-radius: 0 0 var(--radius-md) var(--radius-md); }

.unit-lesson-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

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

.unit-lesson-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.unit-lesson-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.lesson-step-dots {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.lesson-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.lesson-step-dot.done { background: var(--accent-green); border-color: var(--accent-green); }
.lesson-step-dot.active { border-color: var(--purple-primary); background: var(--purple-light); }

/* Error notebook page */
.err-page {
  padding: 0 20px;
  padding-bottom: 80px;
}

.err-filter-bar {
  display: flex;
  gap: 8px;
  padding: 0 0 16px;
  overflow-x: auto;
}

.err-filter-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-family: inherit;
}

.err-filter-btn:active,
.err-filter-btn.active {
  background: var(--text-primary);
  color: var(--surface);
  border-color: var(--text-primary);
}

.err-stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.err-stat {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.err-stat-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--purple-primary);
}

.err-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.err-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s;
}

.err-card:active { transform: scale(0.96); }

.err-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.err-card-question {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.4;
}

.err-card-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.err-card-badge.math { background: #DBEAFE; color: #2563EB; }
.err-card-badge.chinese { background: #FCE7F3; color: #DB2777; }
.err-card-badge.english { background: #D1FAE5; color: #059669; }
.err-card-badge.science { background: #FEF3C7; color: #D97706; }

.err-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.err-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.err-card-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.err-card-action {
  font-size: 11px;
  color: var(--purple-primary);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Growth page */
.growth-page {
  padding: 0 20px;
  padding-bottom: 80px;
}

.growth-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.growth-stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.growth-stat-icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.growth-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.growth-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.badge-wall {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.badge-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.badge-icon.gold { background: linear-gradient(135deg, #FCD34D, #F59E0B); }
.badge-icon.silver { background: linear-gradient(135deg, #E5E7EB, #9CA3AF); }
.badge-icon.purple { background: linear-gradient(135deg, #C084FC, #7C3AED); }
.badge-icon.green { background: linear-gradient(135deg, #6EE7B7, #10B981); }
.badge-icon.locked { background: var(--border); color: var(--text-muted); }

.badge-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
}

.growth-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* Calendar dots mini */
.calendar-mini {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 50%;
  color: var(--text-secondary);
}

.calendar-day.filled {
  background: var(--purple-primary);
  color: white;
  font-weight: 600;
}

.calendar-day.filled-light {
  background: var(--purple-bg-end);
  color: var(--purple-primary);
  font-weight: 600;
}

.calendar-day.today {
  border: 2px solid var(--purple-primary);
  font-weight: 700;
}

/* Profile page */
.profile-page {
  padding-bottom: 80px;
}

.profile-header {
  text-align: center;
  padding: 24px 20px 20px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-bg-start), var(--purple-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 12px;
  color: var(--purple-primary);
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-grade {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-group {
  margin: 0 20px 16px;
}

.settings-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-left: 4px;
}

.settings-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}

.settings-row:active { background: var(--surface-alt); }
.settings-row + .settings-row { border-top: 1px solid var(--border); }

.settings-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.settings-row-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.settings-row-icon.purple { background: #F5F3FF; color: var(--purple-primary); }
.settings-row-icon.teal { background: #F0FDFA; color: var(--accent-teal); }
.settings-row-icon.orange { background: #FFFBEB; color: var(--accent-orange); }
.settings-row-icon.green { background: #ECFDF5; color: var(--accent-green); }
.settings-row-icon.blue { background: #EFF6FF; color: #3B82F6; }

.settings-row-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-row-value {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.settings-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
}

.settings-toggle.on {
  background: var(--purple-primary);
}

.settings-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}

.settings-toggle.on::after {
  transform: translateX(20px);
}

/* Page header with title */
.page-header-with-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header-back-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 18px;
}

.page-main-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ========================================
   Grade-adaptive framework (学段自适应)
   ======================================== */

/* Base scale variables */
:root {
  --grade-scale: 1;
  --grade-btn-h: 48px;
  --grade-btn-fs: 15px;
  --grade-body-fs: 15px;
  --grade-body-lh: 1.6;
  --grade-card-p: 16px;
  --grade-icon-s: 48px;
  --grade-space: 16px;
  --grade-title-fs: 17px;
}

/* Grade 1-2: large, playful, voice-first */
.grade-lower {
  --grade-scale: 1.15;
  --grade-btn-h: 56px;
  --grade-btn-fs: 17px;
  --grade-body-fs: 17px;
  --grade-body-lh: 1.8;
  --grade-card-p: 20px;
  --grade-icon-s: 56px;
  --grade-space: 20px;
  --grade-title-fs: 20px;
}

/* Grade 3-4: balanced */
.grade-middle {
  --grade-scale: 1;
  --grade-btn-h: 48px;
  --grade-btn-fs: 15px;
  --grade-body-fs: 15px;
  --grade-body-lh: 1.6;
  --grade-card-p: 16px;
  --grade-icon-s: 48px;
  --grade-space: 16px;
  --grade-title-fs: 17px;
}

/* Grade 5-6: compact, adult-like */
.grade-upper {
  --grade-scale: 0.9;
  --grade-btn-h: 42px;
  --grade-btn-fs: 14px;
  --grade-body-fs: 14px;
  --grade-body-lh: 1.5;
  --grade-card-p: 14px;
  --grade-icon-s: 42px;
  --grade-space: 12px;
  --grade-title-fs: 16px;
}

/* Grade adaptive component overrides */
.grade-lower .flow-card { padding: calc(var(--grade-card-p) * 1.2); }
.grade-lower .flow-card-title { font-size: calc(var(--grade-title-fs) * 1.15); }
.grade-lower .flow-card-desc { font-size: calc(13px * 1.15); }
.grade-lower .flow-card-icon { width: 56px; height: 56px; font-size: 26px; }
.grade-lower .flow-card-status { font-size: 12px; padding: 4px 14px; }
.grade-lower .grade-selector-pill { font-size: 17px; padding: 10px 20px; }
.grade-lower .grade-selector-subject button { font-size: 16px; padding: 10px 22px; }

.grade-upper .flow-card-title { font-size: 15px; }
.grade-upper .flow-card-desc { font-size: 12px; }
.grade-upper .flow-card-icon { width: 40px; height: 40px; font-size: 18px; }
.grade-upper .flow-card { padding: 12px; gap: 10px; }
.grade-upper .flow-card-status { font-size: 10px; padding: 2px 8px; }
.grade-upper .grade-selector-pill { font-size: 13px; padding: 6px 12px; }
.grade-upper .grade-selector-subject button { font-size: 13px; padding: 6px 16px; }

/* Grade badge pill */
.grade-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.grade-badge.lower { background: #FEF3C7; color: #D97706; }
.grade-badge.middle { background: #DBEAFE; color: #2563EB; }
.grade-badge.upper { background: #D1FAE5; color: #059669; }

/* ========================================
   Sub-page common components
   ======================================== */

.subpage-container {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 80px;
}

.subpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.subpage-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subpage-back-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 18px;
  position: relative;
}
.subpage-back-btn::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
}

.subpage-step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.grade-lower .subpage-step-title { font-size: 20px; }
.grade-upper .subpage-step-title { font-size: 15px; }

.subpage-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.subpage-header-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.header-lesson {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grade-lower .header-lesson { font-size: 18px; }
.grade-upper .header-lesson { font-size: 15px; }

/* Plain text preview goals (no icons, no card) */
.preview-goals {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}
.preview-goals > div {
  padding: 4px 0;
}
.preview-goals .think-hint {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

/* Vocab cards (shared by preview & learn pages) */
.vocab-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.vocab-chip { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); cursor: pointer; }
.vocab-chip:active { transform: scale(0.96); }
.vocab-chip-char { width: 36px; height: 36px; background: var(--surface-alt); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: var(--text-primary); }
.vocab-chip-info { white-space: nowrap; }
.vocab-chip-word { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.vocab-chip-pinyin { font-size: 11px; color: var(--text-muted); }

/* Math challenge levels (口算闯关) */
.challenge-list { display: flex; flex-direction: column; gap: 8px; }
.challenge-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform 0.15s; }
.challenge-item:active { transform: scale(0.96); }
.challenge-item-left { display: flex; align-items: center; gap: 10px; }
.challenge-item-num { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-alt); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--accent-teal); flex-shrink: 0; }
.challenge-item-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.challenge-item-arrow { font-size: 14px; color: var(--text-muted); }

.grade-lower .challenge-item { padding: 14px 18px; }
.grade-lower .challenge-item-num { width: 34px; height: 34px; font-size: 14px; }
.grade-lower .challenge-item-name { font-size: 16px; }
.grade-upper .challenge-item { padding: 8px 12px; }
.grade-upper .challenge-item-name { font-size: 13px; }

/* Section heading for direct topic display */
.section-head { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.word-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.grade-lower .word-list { max-height: 280px; }
.grade-upper .word-list { max-height: 200px; }
.word-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.word-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.word-text { font-size: 15px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.word-meaning { font-size: 12px; color: var(--text-muted); }
.word-play { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--surface-alt); color: var(--accent-teal); display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; flex-shrink: 0; transition: transform 0.2s, background 0.2s, color 0.2s; }
.word-play:active { transform: scale(0.96); background: var(--purple-light); color: var(--purple-primary); }

.grade-lower .word-row { padding: 14px 18px; border-radius: var(--radius-lg); }
.grade-lower .word-text { font-size: 18px; }
.grade-lower .word-meaning { font-size: 14px; }
.grade-lower .word-play { width: 44px; height: 44px; font-size: 20px; }
.grade-upper .word-row { padding: 8px 12px; }
.grade-upper .word-text { font-size: 14px; }
.grade-upper .word-play { width: 32px; height: 32px; font-size: 14px; }

/* 田字格 character cards (for 趣学汉字) */
.tianzige-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0;
}
.tianzige-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tzg-cell {
  width: 64px;
  height: 64px;
  border: 2px solid #D1D5DB;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  border-radius: 4px;
}
.tzg-cell::before,
.tzg-cell::after {
  content: '';
  position: absolute;
  background: #E5E7EB;
  pointer-events: none;
}
.tzg-cell::before {
  width: 100%;
  height: 1px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}
.tzg-cell::after {
  height: 100%;
  width: 1px;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}
.tzg-pinyin {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.subpage-content {
  padding: 0 20px;
  padding-bottom: 100px;
}

/* Section layout (shared by preview & learn pages) */
.section { margin: 0 0 14px; }
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Grade toggle chip */
.grade-chip-group {
  display: flex;
  gap: 6px;
  margin: 0 20px 16px;
}

.grade-chip {
  flex: 1;
  padding: 6px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-family: inherit;
}

.grade-chip.active {
  background: var(--text-primary);
  color: var(--surface);
  border-color: var(--text-primary);
}

.grade-chip.lower.active { background: #D97706; border-color: #D97706; color: white; }
.grade-chip.middle.active { background: #2563EB; border-color: #2563EB; color: white; }
.grade-chip.upper.active { background: #059669; border-color: #059669; color: white; }

/* Step navigation bar */
.step-nav {
  display: flex;
  gap: 6px;
  margin: 0 20px 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.step-nav-item {
  flex: 1;
  min-width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  position: relative;
}

.step-nav-item.active {
  color: var(--surface);
  background: var(--purple-primary);
  box-shadow: 0 4px 12px rgba(147,51,234,0.3);
}

.step-nav-item .step-nav-icon { font-size: 18px; line-height: 1; }
.step-nav-item .step-nav-label { font-size: 10px; font-weight: 600; white-space: nowrap; }
.grade-lower .step-nav-item { padding: 14px 8px; min-width: 72px; }
.grade-lower .step-nav-item .step-nav-icon { font-size: 24px; }
.grade-lower .step-nav-item .step-nav-label { font-size: 12px; }
.grade-upper .step-nav-item { padding: 8px 6px; min-width: 56px; }

/* Content card for sub-pages */
.subpage-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--grade-card-p);
  margin-bottom: var(--grade-space);
  box-shadow: var(--shadow-sm);
}

.subpage-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.subpage-card-indicator {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  flex-shrink: 0;
}

.subpage-card-title {
  font-size: var(--grade-title-fs);
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.subpage-card-body {
  font-size: var(--grade-body-fs);
  line-height: var(--grade-body-lh);
  color: var(--text-secondary);
}

/* Primary action button */
.action-btn {
  display: block;
  width: 100%;
  height: var(--grade-btn-h);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--grade-btn-fs);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  font-family: inherit;
}

.action-btn:active { opacity: 0.8; transform: scale(0.96); }
.action-btn.primary { background: var(--text-primary); color: var(--surface); }
.action-btn.teal { background: var(--accent-teal); color: white; }
.action-btn.purple { background: var(--purple-primary); color: white; }
.action-btn.green { background: var(--accent-green); color: white; }
.action-btn.orange { background: var(--accent-orange); color: white; }
.action-btn.outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-primary); }

.grade-lower .action-btn { border-radius: var(--radius-lg); }
.grade-upper .action-btn { border-radius: var(--radius-sm); }

/* Grade-specific content panels */
.grade-content {
  display: none;
}
.grade-content.active {
  display: block;
}

/* Sub-page specific shared components */
.text-block {
  font-size: var(--grade-body-fs);
  line-height: var(--grade-body-lh);
  color: var(--text-secondary);
}

.text-block p {
  margin-bottom: 8px;
  text-indent: 2em;
}

.question-card {
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: var(--grade-card-p);
  margin-bottom: var(--grade-space);
}

.question-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple-primary);
  margin-bottom: 6px;
}

.question-card-text {
  font-size: var(--grade-body-fs);
  font-weight: 500;
  color: var(--text-primary);
  line-height: var(--grade-body-lh);
}

/* Audio player pill */
.audio-player {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.2s;
}
.audio-player:active { background: var(--border); }
.audio-player-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--purple-primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.audio-player-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }

.grade-lower .audio-player { padding: 12px 20px 12px 16px; }
.grade-lower .audio-player-icon { width: 40px; height: 40px; font-size: 18px; }
.grade-lower .audio-player-label { font-size: 16px; }

/* Pinyin text */
.pinyin-text {
  font-size: var(--grade-body-fs);
  line-height: 2.2;
  color: var(--text-primary);
}
.pinyin-text ruby rt { font-size: 0.6em; color: var(--text-muted); }

/* Vocabulary card grid */
.vocab-grid {
  display: grid;
  gap: 10px;
}
.grade-lower .vocab-grid { grid-template-columns: 1fr; }
.grade-middle .vocab-grid { grid-template-columns: 1fr 1fr; }
.grade-upper .vocab-grid { grid-template-columns: 1fr 1fr; }

.vocab-card {
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s;
}
.vocab-card:active { transform: scale(0.97); }

.vocab-char {
  width: 48px; height: 48px;
  background: white;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: var(--text-primary);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.vocab-info { flex: 1; min-width: 0; }
.vocab-word { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.vocab-pinyin { font-size: 12px; color: var(--text-muted); }
.vocab-meaning { font-size: 13px; color: var(--text-secondary); }

.grade-lower .vocab-char { width: 60px; height: 60px; font-size: 30px; }
.grade-lower .vocab-card { padding: 18px; }
.grade-lower .vocab-word { font-size: 18px; }
.grade-lower .vocab-pinyin { font-size: 14px; }
.grade-lower .vocab-meaning { font-size: 15px; }

/* Flash card for review */
.flip-card {
  perspective: 600px;
  cursor: pointer;
  margin-bottom: 16px;
}
.flip-card-inner {
  position: relative;
  width: 100%;
  min-height: 200px;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-shadow: var(--shadow-md);
}
.flip-card-front {
  background: var(--surface);
  color: var(--text-primary);
}
.flip-card-back {
  background: var(--purple-primary);
  color: white;
  transform: rotateY(180deg);
}
.flip-card-main {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}
.flip-card-sub {
  font-size: 14px;
  color: var(--text-muted);
}
.flip-card-back .flip-card-sub {
  color: rgba(255,255,255,0.7);
}
.flip-card-hint {
  position: absolute;
  bottom: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.grade-lower .flip-card-inner { min-height: 260px; }
.grade-lower .flip-card-main { font-size: 36px; }
.grade-lower .flip-card-sub { font-size: 16px; }
.grade-upper .flip-card-inner { min-height: 180px; }
.grade-upper .flip-card-main { font-size: 24px; }

/* Option buttons for practice */
.option-grid {
  display: grid;
  gap: 10px;
}
.grade-lower .option-grid { grid-template-columns: 1fr; gap: 14px; }
.grade-middle .option-grid { grid-template-columns: 1fr 1fr; }
.grade-upper .option-grid { grid-template-columns: 1fr 1fr; }

.option-btn {
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--grade-body-fs);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.option-btn:active { border-color: var(--purple-primary); background: var(--surface-alt); }
.option-btn.correct { border-color: var(--accent-green); background: #ECFDF5; color: var(--accent-green); }
.option-btn.wrong { border-color: var(--danger); background: #FEF2F2; color: var(--danger); }

.grade-lower .option-btn { padding: 18px 20px; border-radius: var(--radius-lg); font-size: 17px; }
.grade-upper .option-btn { padding: 12px 14px; }

/* Fill-in-blank */
.fill-blank {
  display: inline-block;
  width: 80px;
  border-bottom: 2px solid var(--purple-primary);
  margin: 0 4px;
  color: var(--purple-primary);
  font-weight: 600;
}

/* Mind map placeholder */
.mind-map {
  width: 100%;
  padding: 20px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.mind-map-center {
  padding: 12px 24px;
  background: var(--purple-primary);
  color: white;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 16px;
}
.mind-map-branches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.mind-map-branch {
  padding: 8px 16px;
  background: var(--surface);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

/* Spaced repetition timeline */
.rep-timeline {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
}
.rep-day {
  flex-shrink: 0;
  width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.rep-day.active { background: var(--purple-primary); color: white; }
.rep-day .rep-date { font-size: 10px; color: var(--text-muted); }
.rep-day.active .rep-date { color: rgba(255,255,255,0.7); }
.rep-day .rep-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.rep-day .rep-dot.done { background: var(--accent-green); }
.rep-day .rep-dot.today { background: var(--purple-primary); }
.rep-day .rep-label { font-size: 9px; font-weight: 600; }

/* ========================================
   Lesson selector drawer (课时选择器)
   ======================================== */
.lesson-drawer-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 100; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.lesson-drawer-overlay.open { display: block; opacity: 1; pointer-events: auto; }
.lesson-drawer { display: none; position: fixed; left: 0; right: 0; bottom: 0; max-width: 430px; margin: 0 auto; background: var(--surface); border-radius: 16px 16px 0 0; z-index: 101; padding: 0 0 24px; max-height: 55vh; overflow-y: auto; transform: translateY(100%); transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1); }
.lesson-drawer.open { display: block; transform: translateY(0); }
.lesson-drawer-handle { width: 36px; height: 4px; background: #D1D5DB; border-radius: 2px; margin: 8px auto 4px; }
.lesson-drawer-title { font-size: 17px; font-weight: 700; color: var(--text-primary); padding: 8px 20px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.lesson-drawer-item { padding: 14px 20px; font-size: 15px; color: var(--text-primary); cursor: pointer; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.lesson-drawer-item:last-child { border-bottom: none; }
.lesson-drawer-item:active { background: #F5F3FF; }
.lesson-drawer-item.active { color: var(--purple-primary); font-weight: 600; }
.lesson-drawer-item .di-check { color: var(--purple-primary); font-size: 16px; }
.lesson-trigger-btn { background: none; border: none; padding: 0; cursor: pointer; font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 3px; }

/* ========================================
   Grade selection drawer (公共年级选择器)
   ======================================== */
.grade-drawer-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 100; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.grade-drawer-overlay.open { display: block; opacity: 1; pointer-events: auto; }
.grade-drawer { display: none; position: fixed; left: 0; right: 0; bottom: 0; max-width: 430px; margin: 0 auto; background: var(--surface); border-radius: 16px 16px 0 0; z-index: 101; padding: 0 0 24px; max-height: 70vh; overflow-y: auto; transform: translateY(100%); transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1); }
.grade-drawer.open { display: block; transform: translateY(0); }
.grade-drawer-handle { width: 36px; height: 4px; background: #D1D5DB; border-radius: 2px; margin: 8px auto 4px; }
.grade-drawer-title { font-size: 17px; font-weight: 700; color: var(--text-primary); padding: 8px 20px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.grade-drawer-section { padding: 10px 20px 2px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.grade-drawer-item { padding: 14px 20px; font-size: 15px; color: var(--text-primary); cursor: pointer; display: flex; align-items: center; justify-content: space-between; transition: background 0.15s; }
.grade-drawer-item:active { background: #F5F3FF; }
.grade-drawer-item:last-of-type { border-bottom: none; }
.grade-drawer-item .di-mark { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 10px; }
.grade-drawer-item .di-mark.low { background: #F59E0B; }
.grade-drawer-item .di-mark.mid { background: #3B82F6; }
.grade-drawer-item .di-mark.upp { background: #10B981; }
.grade-drawer-item .di-check { color: var(--purple-primary); font-size: 16px; font-weight: 700; }
.grade-drawer-item .di-page-badge { font-size: 11px; color: var(--text-muted); background: #F3F4F6; padding: 2px 8px; border-radius: var(--radius-full); }

/* Voice input component */
.voice-input-wrap { display: flex; gap: 0; position: relative; width: 100%; }
.voice-text-mode { display: flex; gap: 6px; width: 100%; }
.voice-hold-mode { display: none; width: 100%; }
.voice-input-wrap.voice-active .voice-text-mode { display: none; }
.voice-input-wrap.voice-active .voice-hold-mode { display: block; }
.voice-input { flex: 1; padding: 10px 14px; border-radius: var(--radius-full); border: 1.5px solid var(--border); background: #F9FAFB; font-size: 15px; font-family: inherit; outline: none; }
.voice-input:focus { border-color: var(--purple-primary); }
.voice-btn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--border); background: #F9FAFB; color: var(--text-muted); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.voice-btn:active { background: #EDE9FE; }
.voice-hold-btn { width: 100%; padding: 10px 0; border-radius: var(--radius-full); border: 2px dashed #D1D5DB; background: #F9FAFB; font-size: 15px; font-weight: 600; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; transition: background 0.15s, border-color 0.15s, color 0.15s; user-select: none; -webkit-user-select: none; }
.voice-hold-btn:active { background: #EDE9FE; border-color: var(--purple-primary); color: var(--purple-primary); }
.voice-hold-btn .rec-icon { font-size: 20px; }
.voice-hold-btn.recording { background: #FEE2E2; border-color: #EF4444; border-style: solid; color: #EF4444; animation: pulse-hold 0.8s infinite; }
@keyframes pulse-hold { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); } 50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } }

/* ========================================
   Subject color variables
   ======================================== */
:root {
  --subject-chinese: #9333EA;
  --subject-math: #10B981;
  --subject-english: #3B82F6;
}

/* Tool chip color variants */
.tool-chip.green { border-color:var(--accent-green); color:var(--accent-green); background:#D1FAE5; }
.tool-chip.blue { border-color:var(--subject-english); color:var(--subject-english); background:#DBEAFE; }
.tool-chip.teal { border-color:var(--accent-teal); color:var(--accent-teal); background:#F0FDFA; }

/* Audio card (预习 pages) */
.audio-card { background:var(--surface); border-radius:var(--radius-md); padding:14px; box-shadow:var(--shadow-sm); display:flex; align-items:center; gap:12px; }
.play-btn { width:44px; height:44px; border-radius:50%; background:var(--purple-primary); color:white; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; cursor:pointer; border:none; }
.play-btn:active { opacity:0.8; }
.audio-info { flex:1; }
.audio-label { font-size:14px; font-weight:600; color:var(--text-primary); }
.audio-progress { font-size:11px; color:var(--text-muted); margin-top:2px; }

/* AI dialogue */
.ai-dialogue { background:var(--surface); border-radius:var(--radius-md); box-shadow:var(--shadow-sm); overflow:hidden; }
.ai-msg { display:flex; gap:8px; padding:12px 14px; }
.ai-msg + .ai-msg { border-top:1px solid var(--border); }
.ai-avatar { width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg, var(--purple-primary), var(--purple-light)); display:flex; align-items:center; justify-content:center; color:white; font-size:14px; flex-shrink:0; }
.ai-bubble { flex:1; font-size:14px; color:var(--text-primary); line-height:1.5; }
.ai-bubble .ai-name { font-size:12px; font-weight:600; color:var(--purple-primary); margin-bottom:2px; }
.ai-bubble .ai-name.you { color:var(--accent-teal); }
.ai-reply-options { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.ai-reply-opt { padding:6px 14px; border-radius:var(--radius-full); border:1.5px solid var(--border); background:var(--surface); font-size:13px; color:var(--text-secondary); cursor:pointer; font-family:inherit; transition:border-color 0.15s, color 0.15s; }
.ai-reply-opt:active { border-color:var(--purple-primary); color:var(--purple-primary); }

/* Goal card */
.goal-card { background:var(--surface); border-radius:var(--radius-md); padding:16px; box-shadow:var(--shadow-sm); }
.goal-item { display:flex; align-items:flex-start; gap:10px; padding:8px 0; font-size:14px; color:var(--text-primary); line-height:1.5; }
.goal-item + .goal-item { border-top:1px solid var(--border); }
.goal-icon { width:28px; height:28px; border-radius:var(--radius-sm); background:#EDE9FE; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0; }
.goal-text { flex:1; }
.goal-think { display:flex; align-items:flex-start; gap:10px; padding:10px 0 4px; margin-top:8px; border-top:1px dashed var(--border); font-size:13px; color:var(--text-secondary); }
.think-icon { font-size:16px; flex-shrink:0; line-height:1.5; }
.think-text { flex:1; line-height:1.5; }

/* Section group (同步练) */
.section-group { margin-bottom:20px; }
.section-group-header { display:flex; align-items:center; gap:8px; padding:12px 16px; background:var(--surface); border-radius:var(--radius-md) var(--radius-md) 0 0; font-size:15px; font-weight:700; color:var(--text-primary); box-shadow:var(--shadow-sm); }
.section-group-header .group-icon { font-size:18px; }
.section-group-body { background:var(--surface); border-radius:0 0 var(--radius-md) var(--radius-md); box-shadow:var(--shadow-sm); overflow:hidden; }
.section-group-body > :first-child { border-top:none; }
.group-entry { display:flex; align-items:center; gap:12px; padding:14px 16px; cursor:pointer; transition:background 0.15s; border-top:1px solid var(--border); text-decoration:none; color:inherit; }
.group-entry:active { background:var(--surface-alt); }
.group-entry-icon { width:40px; height:40px; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; }
.group-entry-icon.purple { background:#F5F3FF; }
.group-entry-icon.green { background:#ECFDF5; }
.group-entry-icon.blue { background:#DBEAFE; }
.group-entry-body { flex:1; min-width:0; }
.group-entry-title { font-size:14px; font-weight:600; color:var(--text-primary); }
.group-entry-desc { font-size:12px; color:var(--text-muted); margin-top:2px; }
.group-entry-action { font-size:14px; color:var(--text-muted); flex-shrink:0; }

/* Section plain (专题/工具) */
.section-plain { margin-bottom:16px; }
.section-plain-title { font-size:14px; font-weight:700; color:var(--text-primary); margin-bottom:10px; display:flex; align-items:center; gap:6px; }

/* Bottom spacer */
.bottom-spacer { height:20px; }

/* Hide scrollbar utility */
.no-scrollbar::-webkit-scrollbar,
.vocab-strip::-webkit-scrollbar,
.rec-items::-webkit-scrollbar,
.shortcuts::-webkit-scrollbar,
.subj-tabs::-webkit-scrollbar { display: none; }
.no-scrollbar,
.vocab-strip,
.rec-items,
.shortcuts,
.subj-tabs { -ms-overflow-style: none; scrollbar-width: none; user-select: none; -webkit-user-select: none; }

/* Camera nav button */
.nav-camera { flex: none; width: 60px; }
.nav-camera .nav-camera-circle { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #A78BFA, #7C3AED); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(124,58,237,0.35); margin-top: -34px; }
.nav-camera .nav-camera-circle svg { width: 28px; height: 28px; stroke: white; }

/* Popup overlay (拍一拍) */
.popup-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.35); z-index: 100; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.popup-overlay.open { display: block; opacity: 1; pointer-events: auto; }
.popup-menu { display: none; position: fixed; left: 0; right: 0; bottom: 90px; max-width: 430px; margin: 0 auto; z-index: 101; padding: 0 16px; opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
.popup-menu.open { display: block; opacity: 1; transform: translateY(0); pointer-events: auto; }
.popup-menu-inner { background: var(--surface); border-radius: var(--radius-lg); padding: 24px 16px 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.15); position: relative; animation: popupSlideUp 0.25s ease-out both; }
.popup-menu-inner::after { content: ''; position: absolute; bottom: -8px; left: 50%; margin-left: -8px; width: 16px; height: 16px; background: var(--surface); transform: rotate(45deg); border-radius: 0 0 3px 0; }
.popup-row { display: flex; gap: 12px; justify-content: center; margin-bottom: 12px; }
.popup-row:last-child { margin-bottom: 0; }
.popup-item { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; border: none; background: none; padding: 0; font-family: inherit; min-width: 0; flex: 1; max-width: 100px; animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.popup-item:active .popup-icon { transform: scale(0.96); }
.popup-item:nth-child(1) { animation-delay: 0ms; }
.popup-item:nth-child(2) { animation-delay: 40ms; }
.popup-item:nth-child(3) { animation-delay: 80ms; }
.popup-item:nth-child(4) { animation-delay: 120ms; }
.popup-item:nth-child(5) { animation-delay: 160ms; }
.popup-icon { width: 56px; height: 56px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 26px; transition: transform 0.15s; }
.popup-label { font-size: 13px; font-weight: 600; color: var(--text-primary); text-align: center; }
@keyframes popIn { 0% { opacity: 0; transform: scale(0.3) translateY(16px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes popupSlideUp { 0% { opacity: 0; transform: translateY(20px) scale(0.95); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
