:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #2563eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,0.04), 0 3px 10px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 20px rgba(15,23,42,0.09), 0 1px 4px rgba(15,23,42,0.04);
}

/* ── Dark Mode ───────────────────────────────────────────────────────────── */
body.dark {
  --bg: #0f1117;
  --surface: #1a1d2e;
  --sidebar-bg: #080c14;
  --sidebar-text: #7c85a0;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #2563eb;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #f87171;
  --text: #e8eaf0;
  --text-light: #7c85a0;
  --border: #2a2d3e;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.35);
}
body.dark .q-text { background: #141622; border-color: var(--border); }
body.dark .q-instruction { background: #1e2340; }
body.dark .textarea { background: #141622; color: var(--text); border-color: var(--border); }
body.dark .blank-select { background: #1e2340; color: var(--primary); }
body.dark .blank-input { background: #1e2340; color: var(--primary); }
body.dark .choice { background: var(--surface); }
body.dark .choice:hover { background: #1e2340; }
body.dark .choice.selected { background: #1e2340; }
body.dark .reorder-item { background: var(--surface); }
body.dark .audio-widget { background: #1e2340; }
body.dark .recorder-widget { border-color: var(--border); }
body.dark .recorder-widget.recording { background: #2a1a1a; }
body.dark .recorder-widget.done { background: #0f2a1a; }
body.dark .transcript-box { background: #141622; border-color: var(--border); }
body.dark .stat-card { background: var(--surface); }
body.dark .skill-card { background: var(--surface); }
body.dark .skill-card:hover { background: #1e2340; }
body.dark .record-btn.idle { background: #2a2d3e; }
body.dark .tabs { border-color: var(--border); }
body.dark .tab:hover { background: #1e2340; }
body.dark .timer { background: var(--surface); border-color: var(--border); }
body.dark #sidebar { background: var(--sidebar-bg); }
body.dark .nav-item:hover { background: rgba(255,255,255,0.04); }
body.dark #main::-webkit-scrollbar-thumb { background: #2a2d3e; }
body.dark .score-bar-track { background: #2a2d3e; }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.5; }
body.modal-open { overflow: hidden; }

#app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
#sidebar {
  width: 240px; min-width: 240px; background: var(--sidebar-bg);
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 18px 18px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.logo-icon { font-size: 20px; }
.logo-text { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: 0.2px; }
.auth-slot-desktop { margin-left: auto; display: flex; align-items: center; }
.auth-user-chip { display: flex; align-items: center; gap: 6px; }

/* 头像圆圈 — 点击退出 */
.auth-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.15s;
  user-select: none;
}
.auth-avatar:hover { opacity: 0.8; transform: scale(1.08); }

.auth-login-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
}

nav { padding: 10px 0 24px; }
.nav-section { margin-bottom: 2px; }
.nav-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(148,163,184,0.45); padding: 14px 18px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 16px 8px 15px; font-size: 12.5px; color: var(--sidebar-text);
  cursor: pointer; border-radius: 0; transition: all 0.12s; text-decoration: none;
  border-left: 2px solid transparent; overflow: hidden;
}
.nav-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.nav-item.active { background: rgba(37,99,235,0.20); color: #fff; border-left-color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }

/* MAIN */
#main { flex: 1; overflow-y: auto; padding: 36px 40px; }
#main::-webkit-scrollbar { width: 6px; }
#main::-webkit-scrollbar-thumb { background: #ddd; border-radius: 6px; }

/* PAGE HEADER */
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.page-header p { font-size: 13.5px; color: var(--text-light); margin-top: 5px; }
.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.lang-btn {
  min-width: 44px;
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.lang-btn:hover {
  color: var(--text);
  background: #f5f7fb;
}
.lang-btn.active {
  background: var(--primary);
  color: #fff;
}
.dashboard-section { margin-bottom: 28px; }
.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
  opacity: 0.85;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.section-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-light);
}
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  margin-left: 8px; vertical-align: middle;
}
.badge-speaking { background: #ede9fe; color: #6d28d9; }
.badge-writing { background: #dcfce7; color: #047857; }
.badge-reading { background: #fef3c7; color: #92400e; }
.badge-listening { background: #dbeafe; color: #1e40af; }

/* CARDS */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; border: 1px solid var(--border); }
.card + .card { margin-top: 16px; }
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text); letter-spacing: 0.1px; }
.continue-card,
.insight-card,
.module-card,
.stats-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}
.continue-card {
  padding: 32px 34px;
}
.hero-main {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.continue-title {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}
.continue-meta {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.continue-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.hero-side {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
}
.insight-card {
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
}
.compact-card {
  min-height: 0;
  padding: 18px 18px 16px;
}
.insight-title {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}
.insight-sub {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-light);
}
.goal-progress {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 14px;
}
.goal-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}
.insight-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  color: var(--text-light);
  font-size: 13px;
}
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}
.stats-bar-item {
  padding: 20px 24px;
  min-width: 0;
}
.stats-bar-item + .stats-bar-item {
  border-left: 1px solid var(--border);
}
.stats-bar-value {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.stats-bar-text {
  font-size: 15px;
  line-height: 1.3;
}
.stat-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.module-card {
  padding: 20px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  cursor: pointer;
}
.module-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: rgba(37,99,235,0.3);
}
.module-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.module-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #eff6ff;
  font-size: 24px;
  flex-shrink: 0;
}
.module-meta { min-width: 0; }
.module-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.module-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.1px;
}
.module-desc {
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-light);
}
.module-count {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
.module-stats {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-light);
}
.module-actions {
  display: flex;
  margin-top: 16px;
}
.module-actions .btn {
  width: 100%;
  justify-content: center;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* STAT CARDS */
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.stat-card .stat-label { font-size: 12px; color: var(--text-light); font-weight: 500; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-light); }
.stat-card .stat-icon { font-size: 24px; margin-bottom: 4px; }

/* HOME SKILL CARDS */
.skill-card {
  background: var(--surface); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); cursor: pointer; transition: all 0.18s; text-decoration: none;
  display: block; border: 2px solid transparent;
}
.skill-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary); }
.skill-card .skill-icon { font-size: 28px; margin-bottom: 10px; }
.skill-card .skill-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.skill-card .skill-desc { font-size: 13px; color: var(--text-light); line-height: 1.4; }
.skill-card .skill-count { font-size: 12px; color: var(--primary); font-weight: 500; margin-top: 8px; }

/* QUESTION AREA */
.question-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.q-number { font-size: 13px; color: var(--text-light); font-weight: 500; }
.q-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 16px; line-height: 1.5; }
.q-instruction {
  background: rgba(37,99,235,0.05); border-left: 3px solid var(--primary);
  padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px; color: var(--primary); margin-bottom: 18px; font-weight: 500;
}
.q-text {
  font-size: 15px; line-height: 1.8; color: var(--text); background: #fafafa;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 20px; margin-bottom: 20px;
}

/* AUDIO PLAYER */
.audio-widget {
  background: rgba(37,99,235,0.04); border: 1px solid rgba(37,99,235,0.12);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.audio-btn {
  width: 44px; height: 44px; border-radius: 50%; background: var(--primary);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white; transition: all 0.15s; flex-shrink: 0;
}
.audio-btn:hover { background: var(--primary-hover); transform: scale(1.05); }
.audio-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }
.audio-progress { flex: 1; }
.audio-progress-bar { height: 4px; background: #d1d5db; border-radius: 2px; overflow: hidden; cursor: pointer; }
.audio-progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.1s; }
.audio-time { font-size: 12px; color: var(--text-light); margin-top: 4px; display: flex; justify-content: space-between; }
.audio-label { font-size: 13px; font-weight: 600; color: var(--primary); }

/* RECORDER */
.recorder-widget {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 28px 24px; text-align: center; margin-bottom: 20px; transition: all 0.2s;
  background: #fafcfe;
}
.recorder-widget.recording { border-color: var(--danger); background: #fff8f8; }
.recorder-widget.done { border-color: #a7f3d0; background: #f0fdf6; }
.recorder-widget.result-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  text-align: left;
}
.recorder-result-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.recorder-result-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #e9f8ee;
  color: #16a34a;
  font-size: 28px;
  flex-shrink: 0;
}
.recorder-result-copy {
  min-width: 0;
}
.recorder-result-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.recorder-result-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.55;
}
.result-actions.compact {
  margin-top: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.recorder-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}
.recorder-note {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
}
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.retry-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.btn-refresh {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid rgba(37,99,235,0.4);
}
.btn-refresh:hover {
  background: rgba(37,99,235,0.06);
}
body.pink .btn-refresh:hover,
body.black-pink .btn-refresh:hover {
  background: rgba(236,72,153,0.10);
}
.status-card {
  width: min(720px, 100%);
  margin: 28px auto 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 34px 36px 26px;
  text-align: center;
}
.status-title {
  font-size: 17px;
  color: var(--text);
  margin-bottom: 18px;
}
.status-title strong {
  font-weight: 500;
}
.status-progress {
  width: 100%;
  height: 7px;
  background: #ececf3;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}
.status-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #c79c64 0%, #b9874f 100%);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.status-progress-fill.recording {
  background: linear-gradient(90deg, #ec4899 0%, #f06292 100%);
}
.status-btn {
  min-width: 132px;
  justify-content: center;
  background: #c79c64;
  color: #fff;
}
.status-btn:hover {
  background: #b9874f;
}
.status-btn.recording {
  background: #ec5d96;
}
.status-btn.recording:hover {
  background: #db2777;
}
.record-btn {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 24px; transition: all 0.2s; margin-bottom: 10px;
}
.record-btn.idle { background: #f3f4f6; }
.record-btn.recording { background: var(--danger); animation: pulse 1s infinite; }
.record-btn.done { background: #dcfce7; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.08)} }
.record-status { font-size: 14px; color: var(--text-light); }
.record-status.recording { color: var(--danger); font-weight: 600; }
.record-status.done { color: var(--success); font-weight: 600; }
.waveform { display: flex; align-items: center; justify-content: center; gap: 3px; height: 32px; margin: 8px 0; }
.waveform-bar { width: 4px; background: var(--danger); border-radius: 2px; animation: wave 0.8s infinite; }
.waveform-bar:nth-child(2){animation-delay:0.1s} .waveform-bar:nth-child(3){animation-delay:0.2s}
.waveform-bar:nth-child(4){animation-delay:0.3s} .waveform-bar:nth-child(5){animation-delay:0.4s}
@keyframes wave { 0%,100%{height:8px} 50%{height:24px} }

/* TIMER */
.timer {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 14px; font-size: 14px; font-weight: 600; color: var(--text);
}
.timer.warning { color: var(--warning); border-color: var(--warning); }
.timer.danger { color: var(--danger); border-color: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.5} }
.timer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.timer.warning .timer-dot { background: var(--warning); }
.timer.danger .timer-dot { background: var(--danger); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px;
  border-radius: 8px; border: none; cursor: pointer; font-size: 13.5px;
  font-weight: 500; transition: all 0.14s; text-decoration: none; letter-spacing: 0.1px;
}
.btn-primary { background: var(--primary); color: white; box-shadow: 0 1px 4px rgba(37,99,235,0.25); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid rgba(37,99,235,0.4); }
.btn-outline:hover { background: rgba(37,99,235,0.05); border-color: var(--primary); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* 2-button nav: Prev left, Next right */
.btn-group:has(> .btn + .btn):not(:has(> .btn:nth-child(3))) > .btn:last-child { margin-left: auto; }
/* 3-button nav: grid layout → [Prev] [Submit] [Next] always on one row */
.btn-group:has(> .btn:nth-child(3)) {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.btn-group:has(> .btn:nth-child(3)) > .btn:first-child { order: 2; justify-self: center; }
.btn-group:has(> .btn:nth-child(3)) > .btn:nth-child(2) { order: 1; justify-self: start; }
.btn-group:has(> .btn:nth-child(3)) > .btn:last-child  { order: 3; justify-self: end; }

/* TEXTAREA */
.textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 14px; line-height: 1.7; color: var(--text);
  resize: vertical; font-family: inherit; transition: border-color 0.15s;
  background: #fff;
}
.textarea:focus { outline: none; border-color: var(--primary); }
.word-count { font-size: 12px; color: var(--text-light); text-align: right; margin-top: 6px; }
.word-count.ok { color: var(--success); font-weight: 500; }
.word-count.warn { color: var(--danger); font-weight: 500; }

/* SCORE DISPLAY */
.score-panel {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  border-radius: var(--radius); padding: 24px; color: white; margin-bottom: 20px;
  box-shadow: 0 4px 18px rgba(37,99,235,0.28);
}
.score-panel .score-big { font-size: 48px; font-weight: 800; line-height: 1; }
.score-panel .score-label { font-size: 13px; opacity: 0.8; margin-top: 4px; }
.score-breakdown { display: flex; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.score-item { text-align: center; }
.score-item .score-val { font-size: 22px; font-weight: 700; }
.score-item .score-name { font-size: 11px; opacity: 0.75; }

.score-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.score-bar-label { font-size: 13px; color: var(--text); width: 120px; flex-shrink: 0; }
.score-bar-track { flex: 1; height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.7s cubic-bezier(0.4,0,0.2,1); }
.score-bar-val { font-size: 13px; font-weight: 600; color: var(--text); width: 36px; text-align: right; }

.speaking-result-shell {
  margin-top: 14px;
}
.speaking-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
}
.speaking-result-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.speaking-result-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.result-audio-player {
  width: 260px;
  max-width: 100%;
  height: 38px;
}
.result-audio-empty {
  min-width: 220px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-light);
  font-size: 12px;
}
.speaking-score-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.speaking-score-main,
.speaking-subscore,
.speaking-feedback-card {
  border: 1px solid var(--border);
}
.speaking-score-main {
  padding: 22px;
}
.speaking-score-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
}
.speaking-score-value {
  margin-top: 8px;
  font-size: 52px;
  line-height: 1;
  font-weight: 800;
  color: var(--text);
}
.speaking-score-note {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-light);
}
.speaking-subscore {
  padding: 20px;
}
.speaking-subscore-label {
  font-size: 13px;
  color: var(--text-light);
}
.speaking-subscore-value {
  margin-top: 10px;
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
}
.transcript-rich {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.transcript-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f5f7fb;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}
.transcript-chip.subtle-error {
  background: #fff5f5;
  color: #b45309;
  border: 1px solid #fde2e2;
}
.transcript-empty {
  color: var(--text-light);
  font-style: italic;
}
.speaking-feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.issue-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}
.issue-list li + li {
  margin-top: 10px;
}
.ai-suggestion {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.speaking-result-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

/* CHOICES */
.choice-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.choice {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s; font-size: 14px; line-height: 1.5;
}
.choice:hover { border-color: var(--primary); background: rgba(37,99,235,0.04); }
.choice.selected { border-color: var(--primary); background: rgba(37,99,235,0.05); }
.choice.correct { border-color: var(--success); background: #f0fdf4; }
.choice.incorrect { border-color: var(--danger); background: #fff5f5; }
.choice input[type=radio], .choice input[type=checkbox] { margin-top: 2px; accent-color: var(--primary); }

/* BLANKS */
.blank-input {
  display: inline-block; border: none; border-bottom: 2px solid var(--primary);
  background: rgba(37,99,235,0.06); padding: 2px 8px; border-radius: 4px 4px 0 0;
  font-size: 14px; min-width: 80px; color: var(--primary); font-weight: 500;
  outline: none; cursor: pointer;
}
.blank-select {
  border: 1.5px solid rgba(37,99,235,0.35); border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: 14px; color: var(--primary); background: rgba(37,99,235,0.04);
  cursor: pointer; outline: none;
}

/* REORDER */
.reorder-area { display: flex; gap: 20px; margin-bottom: 20px; }
.reorder-col { flex: 1; }
.reorder-col-title { font-size: 12px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.reorder-item {
  background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 8px; cursor: grab; font-size: 13.5px;
  line-height: 1.5; transition: all 0.15s; user-select: none;
}
.reorder-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(59,91,252,0.15); }
.reorder-item.dragging { opacity: 0.5; cursor: grabbing; }
.reorder-drop-zone {
  min-height: 80px; border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.reorder-drop-zone.over { border-color: var(--primary); background: rgba(37,99,235,0.06); }

/* HIGHLIGHT */
.highlightable span { cursor: pointer; border-radius: 3px; padding: 0 2px; transition: background 0.1s; }
.highlightable span:hover { background: #fef9c3; }
.highlightable span.highlighted-wrong { background: #fecaca; color: var(--danger); font-weight: 500; text-decoration: line-through; }
.highlightable span.highlighted-found { background: #bbf7d0; color: #15803d; font-weight: 500; }

/* PROGRESS PAGE */
.progress-ring { position: relative; display: inline-block; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  text-align: center;
}

/* TABS */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 9px 18px; font-size: 14px; font-weight: 500; color: var(--text-light);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.15s; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab:hover { color: var(--primary); background: rgba(37,99,235,0.06); }

/* ── 粉白 Pink + White (Apple-inspired) ───────────────────────────────────── */
body.pink {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --sidebar-bg: #ffffff;
  --sidebar-text: #86868b;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #ec4899;
  --primary: #ec4899;
  --primary-hover: #db2777;
  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;
  --text: #1d1d1f;
  --text-light: #6e6e73;
  --border: #d2d2d7;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 3px 10px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
}
body.pink #sidebar { background: #ffffff; border-right: 1px solid #d2d2d7; }
body.pink #mobile-header { background: #ffffff; border-color: #d2d2d7; }
body.pink #sidebar::-webkit-scrollbar-thumb { background: #d2d2d7; }
body.pink .logo { border-bottom: 1px solid #d2d2d7; }
body.pink .logo-text, body.pink .logo-icon { color: #ec4899; }
body.pink .nav-label { color: #86868b; }
body.pink .nav-item { color: #6e6e73; }
body.pink .nav-item:hover { background: #f5f5f7; color: #1d1d1f; }
body.pink .nav-item.active { background: #ec4899; color: #fff; box-shadow: none; border-left-color: transparent; }
body.pink .q-instruction { background: #fdf2f8; color: #c9002b; }
body.pink .audio-widget { background: #fdf2f8; }
body.pink .btn-outline:hover { background: #fdf2f8; }
body.pink .score-panel { background: linear-gradient(135deg, #ec4899 0%, #ff6b81 100%); }
body.pink .score-bar-track { background: #fce7f3; }
body.pink .choice:hover, body.pink .choice.selected { background: #fdf2f8; }
body.pink .blank-input, body.pink .blank-select { background: #fdf2f8; }
body.pink .reorder-item:hover { box-shadow: 0 2px 8px rgba(236,72,153,0.18); }
body.pink .reorder-drop-zone.over, body.pink .tab:hover { background: #fdf2f8; }
body.pink .module-card:hover { border-color: rgba(236,72,153,0.24); }
body.pink .module-icon { background: #fdf2f8; }
body.pink .goal-progress { background: #fce7f3; }
body.pink .transcript-chip { background: #fdf2f8; color: var(--text); }
body.pink .transcript-chip.subtle-error { background: #fdf2f8; border-color: #fbcfe8; color: #c9002b; }
body.pink .recorder-widget.done { border-color: #fbcfe8; background: #fffafc; }
body.pink .recorder-result-icon { background: #fdf2f8; color: #db2777; }
body.pink .btn-refresh:hover { background: rgba(236,72,153,0.08); }
body.pink .lang-btn:hover { background: #fdf2f8; }

/* ── 粉黑 Pink + Black (pastel pink on pure black) ───────────────────────── */
body.black-pink {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --sidebar-bg: #0d0d0d;
  --sidebar-text: #6e6e73;
  --sidebar-active: #1d1d1f;
  --sidebar-active-bg: #f4b8d8;
  --primary: #f4b8d8;
  --primary-hover: #e8a0c8;
  --success: #30d158;
  --warning: #ff9f0a;
  --danger: #ff453a;
  --text: #f5f5f7;
  --text-light: #86868b;
  --border: #2a2a2a;
  --shadow: 0 1px 3px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.7);
}
/* 粉黑主题下主按钮用深色文字（浅粉底色需要深色字） */
body.black-pink .btn-primary { color: #1d1d1f; }
body.black-pink .btn-primary:hover { color: #1d1d1f; }
body.black-pink .nav-item.active { color: #1d1d1f; }
body.black-pink .q-text { background: #111111; border-color: var(--border); }
body.black-pink .q-instruction { background: #221520; color: #e8a0c8; }
body.black-pink .textarea { background: #111111; color: var(--text); border-color: var(--border); }
body.black-pink .blank-select, body.black-pink .blank-input { background: #221520; color: var(--primary); }
body.black-pink .choice { background: var(--surface); }
body.black-pink .choice:hover, body.black-pink .choice.selected { background: #221520; }
body.black-pink .reorder-item { background: var(--surface); }
body.black-pink .audio-widget { background: #221520; }
body.black-pink .recorder-widget { border-color: var(--border); }
body.black-pink .recorder-widget.recording { background: #1e1020; }
body.black-pink .recorder-widget.done { background: #111a14; border-color: #1e3d28; }
body.black-pink .transcript-box { background: #111111; border-color: var(--border); }
body.black-pink .stat-card, body.black-pink .skill-card { background: var(--surface); }
body.black-pink .skill-card:hover { background: #221520; }
body.black-pink .record-btn.idle { background: #221520; color: var(--text); }
body.black-pink .tabs { border-color: var(--border); }
body.black-pink .tab:hover { background: #221520; }
body.black-pink .timer { background: var(--surface); border-color: var(--border); }
body.black-pink #sidebar { background: #0d0d0d; }
body.black-pink #mobile-header { background: #0d0d0d; border-color: var(--border); }
body.black-pink .nav-label { color: #3d3d3f; }
body.black-pink .nav-item { color: #6e6e73; }
body.black-pink .nav-item:hover { background: rgba(244,184,216,0.08); color: #f5f5f7; }
body.black-pink .nav-item.active { background: #f4b8d8; border-left-color: transparent; }
body.black-pink #main::-webkit-scrollbar-thumb { background: #2a2a2a; }
body.black-pink .score-bar-track { background: #221520; }
body.black-pink .score-panel { background: linear-gradient(135deg, #c084b0 0%, #f4b8d8 100%); }
body.black-pink .btn-outline { border-color: #3d3d3f; color: var(--text-light); }
body.black-pink .btn-outline:hover { background: #221520; border-color: #f4b8d8; color: #f4b8d8; }
body.black-pink .reorder-item:hover { box-shadow: 0 2px 8px rgba(244,184,216,0.15); }
body.black-pink .reorder-drop-zone.over { background: #221520; }
body.black-pink .continue-card, body.black-pink .insight-card,
body.black-pink .module-card, body.black-pink .stat-card-product { border-color: var(--border); }
body.black-pink .module-icon { background: #111111; }
body.black-pink .goal-progress { background: #221520; }
body.black-pink .module-card:hover { border-color: rgba(244,184,216,0.22); }
body.black-pink .stats-bar-item + .stats-bar-item { border-left-color: var(--border); }
body.black-pink .lang-btn:hover { background: #221520; color: var(--text); }
body.black-pink .transcript-chip { background: #1a1020; color: var(--text); }
body.black-pink .transcript-chip.subtle-error { background: #1a1020; border-color: #3d2a35; color: #f4b8d8; }
body.black-pink .recorder-result-icon { background: #111a14; color: #30d158; }
body.black-pink .btn-refresh:hover { background: rgba(244,184,216,0.08); }

/* ── 灰白 Grey + White (Apple minimal) ───────────────────────────────────── */
body.grey {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --sidebar-bg: #1d1d1f;
  --sidebar-text: #86868b;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #1d1d1f;
  --primary: #1d1d1f;
  --primary-hover: #3d3d3f;
  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;
  --text: #1d1d1f;                        /* Black 80%  rgba(0,0,0,0.80) */
  --text-light: rgba(0,0,0,0.48);         /* Black 48%  tertiary text    */
  --border: #d2d2d7;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 3px 10px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
}
body.grey #sidebar { background: #1d1d1f; }
body.grey #mobile-header { background: #1d1d1f; border-color: #3d3d3f; }
body.grey #sidebar::-webkit-scrollbar-thumb { background: #3d3d3f; }
body.grey .logo { border-bottom: 1px solid #3d3d3f; }
body.grey .logo-text, body.grey .logo-icon { color: #ffffff; }
body.grey .nav-label { color: rgba(134,134,139,0.7); }
body.grey .nav-item { color: #86868b; }
body.grey .nav-item:hover { background: rgba(255,255,255,0.06); color: #e8e8ed; }
body.grey .nav-item.active { background: rgba(255,255,255,0.14); color: #ffffff; border-left-color: #f5f5f7; }
body.grey .score-panel { background: linear-gradient(135deg, #1d1d1f 0%, #6e6e73 100%); }
body.grey .score-bar-track { background: #d2d2d7; }
body.grey .q-instruction { background: #f0f0f2; color: #1d1d1f; }
body.grey .audio-widget { background: #f0f0f2; }
body.grey .btn-outline:hover { background: #f0f0f2; }
body.grey .choice:hover, body.grey .choice.selected { background: #f0f0f2; }
body.grey .blank-input, body.grey .blank-select { background: #f0f0f2; }
body.grey .reorder-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
body.grey .reorder-drop-zone.over, body.grey .tab:hover { background: #f0f0f2; }
body.grey .module-card:hover { border-color: rgba(29,29,31,0.24); }
body.grey .module-icon { background: #f0f0f2; }
body.grey .goal-progress { background: #d2d2d7; }
body.grey .transcript-chip { background: #f0f0f2; color: var(--text); }
body.grey .transcript-chip.subtle-error { background: #fdf2f8; border-color: #fbcfe8; color: #c9002b; }
body.grey .recorder-widget.done { border-color: #d2d2d7; background: #f5f5f7; }
body.grey .recorder-result-icon { background: #e8e8ed; color: #1d1d1f; }
body.grey .btn-refresh:hover { background: rgba(29,29,31,0.06); }
body.grey .lang-btn:hover { background: #f0f0f2; }
body.grey .stats-bar-item + .stats-bar-item { border-left-color: var(--border); }
/* ── PTE Official Theme (Pearson brand) ───────────────────────────────────── */
body.pte-official {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --sidebar-bg: #1a2f4e;
  --sidebar-text: #8ba7c4;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #0066cc;
  --primary: #0066cc;
  --primary-hover: #0052a3;
  --success: #00875a;
  --warning: #d97706;
  --danger: #d32f2f;
  --text: #1a2f4e;
  --text-light: #5a7a94;
  --border: #ccd9e8;
  --shadow: 0 1px 3px rgba(26,47,78,0.08), 0 3px 10px rgba(26,47,78,0.06);
  --shadow-md: 0 4px 20px rgba(26,47,78,0.12);
}
body.pte-official #mobile-header { background: #1a2f4e; border-color: rgba(255,255,255,0.07); }
body.pte-official #sidebar { background: #1a2f4e; }
body.pte-official .nav-item.active { background: rgba(0,102,204,0.20); border-left-color: #0066cc; }
body.pte-official .nav-item:hover { background: rgba(255,255,255,0.06); }
body.pte-official .score-bar-track { background: #dce8f5; }
body.pte-official .q-instruction { background: #dce8f5; color: #0052a3; }
body.pte-official .logo-text { color: #fff; }
body.pte-official .status-progress-fill { background: linear-gradient(90deg, #0066cc 0%, #00a3e0 100%); }

/* ── Ocean Theme ──────────────────────────────────────────────────────────── */
body.ocean {
  --bg: #f0f9ff;
  --surface: #ffffff;
  --sidebar-bg: #0c2340;
  --sidebar-text: #7eb8d4;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #0891b2;
  --primary: #0891b2;
  --primary-hover: #0e7490;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #0c1a2e;
  --text-light: #5a7a94;
  --border: #bae6fd;
  --shadow: 0 1px 2px rgba(8,145,178,0.06), 0 3px 10px rgba(8,145,178,0.08);
  --shadow-md: 0 4px 20px rgba(8,145,178,0.12);
}
body.ocean #mobile-header { background: #0c2340; border-color: rgba(255,255,255,0.08); }
body.ocean #sidebar { background: #0c2340; }
body.ocean .nav-item.active { background: rgba(8,145,178,0.22); border-left-color: #0891b2; }
body.ocean .score-bar-track { background: #e0f2fe; }
body.ocean .q-instruction { background: #e0f2fe; color: #0e7490; }

/* ── Forest Theme ─────────────────────────────────────────────────────────── */
body.forest {
  --bg: #f0fdf4;
  --surface: #ffffff;
  --sidebar-bg: #052e16;
  --sidebar-text: #6db88a;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #16a34a;
  --primary: #16a34a;
  --primary-hover: #15803d;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #052e16;
  --text-light: #4d7c5e;
  --border: #bbf7d0;
  --shadow: 0 1px 2px rgba(22,163,74,0.06), 0 3px 10px rgba(22,163,74,0.08);
  --shadow-md: 0 4px 20px rgba(22,163,74,0.12);
}
body.forest #mobile-header { background: #052e16; border-color: rgba(255,255,255,0.08); }
body.forest #sidebar { background: #052e16; }
body.forest .nav-item.active { background: rgba(22,163,74,0.22); border-left-color: #16a34a; }
body.forest .score-bar-track { background: #dcfce7; }
body.forest .q-instruction { background: #dcfce7; color: #15803d; }

/* ── Lavender Theme ───────────────────────────────────────────────────────── */
body.lavender {
  --bg: #faf5ff;
  --surface: #ffffff;
  --sidebar-bg: #1e1040;
  --sidebar-text: #a78bce;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #7c3aed;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #1e1040;
  --text-light: #6e5a96;
  --border: #e9d5ff;
  --shadow: 0 1px 2px rgba(124,58,237,0.06), 0 3px 10px rgba(124,58,237,0.08);
  --shadow-md: 0 4px 20px rgba(124,58,237,0.12);
}
body.lavender #mobile-header { background: #1e1040; border-color: rgba(255,255,255,0.08); }
body.lavender #sidebar { background: #1e1040; }
body.lavender .nav-item.active { background: rgba(124,58,237,0.20); border-left-color: #7c3aed; }
body.lavender .score-bar-track { background: #ede9fe; }
body.lavender .q-instruction { background: #ede9fe; color: #6d28d9; }

.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* SECTION DIVIDER */
.section-divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* TRANSCRIPT */
.transcript-box {
  background: #fafafa; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: 14px; line-height: 1.8; min-height: 60px;
  color: var(--text);
}
.transcript-box .word-correct { color: var(--success); }
.transcript-box .word-wrong { color: var(--danger); text-decoration: underline; }
.transcript-box .word-missing { color: var(--warning); font-style: italic; }

/* RESPONSIVE */
@media (max-width: 900px) {
  #sidebar { width: 56px; min-width: 56px; }
  .logo-text, .nav-label, .nav-item span:not(.nav-icon) { display: none; }
  .nav-item { padding: 10px; justify-content: center; }
  #main { padding: 16px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { grid-template-rows: auto; }
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .dashboard-header { align-items: flex-start; }
  .speaking-result-top,
  .speaking-result-tools,
  .speaking-result-actions { align-items: stretch; }
  .speaking-result-top,
  .speaking-feedback-grid,
  .speaking-score-grid { grid-template-columns: 1fr; }
  .speaking-result-top { flex-direction: column; }
  .recorder-widget.result-state {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .recorder-result-main {
    flex-direction: column;
    text-align: center;
  }
  .result-actions.compact {
    flex-wrap: wrap;
    justify-content: center;
  }
  .result-audio-player,
  .result-audio-empty { width: 100%; min-width: 0; }
  .stats-bar-item:nth-child(3),
  .stats-bar-item:nth-child(4) { border-top: 1px solid var(--border); }
  .stats-bar-item:nth-child(3) { border-left: none; }
  .module-grid { grid-template-columns: 1fr; }
}

/* ── Mobile Header ──────────────────────────────────────────────────────────── */
#mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--sidebar-bg);
  z-index: 250;
  padding: 0 8px 0 12px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
#hamburger-btn {
  background: none; border: none; color: #fff;
  cursor: pointer; padding: 10px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.85;
}
#hamburger-btn:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.mobile-logo-text {
  flex: 1;
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 0.2px;
}
.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#auth-slot-mobile {
  display: flex;
  align-items: center;
}
#auth-slot-mobile .auth-login-btn,
#auth-slot-mobile .auth-user-btn,
#auth-slot-mobile .auth-logout-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
  color: #fff;
  border-color: rgba(255,255,255,0.22);
}
#auth-slot-mobile .auth-login-btn:hover,
#auth-slot-mobile .auth-user-btn:hover,
#auth-slot-mobile .auth-logout-btn:hover {
  background: rgba(255,255,255,0.08);
}
#theme-toggle-mobile {
  background: none; border: none; cursor: pointer;
  font-size: 17px; padding: 10px; opacity: 0.7;
}
#theme-toggle-mobile:hover { opacity: 1; }

/* ── Drawer Overlay ─────────────────────────────────────────────────────────── */
#drawer-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
#drawer-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Bottom Navigation ─────────────────────────────────────────────────────── */
#bottom-nav { display: none; }

/* ── Mobile Breakpoint ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #mobile-header { display: flex; }

  #drawer-overlay { display: block; }

  /* Sidebar → slide-in drawer */
  #sidebar {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    height: 100% !important;
    width: 260px !important; min-width: 260px !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    z-index: 300;
  }
  #sidebar.drawer-open { transform: translateX(0); }

  /* Restore text hidden by 900px rule */
  .logo-text { display: block !important; }
  .nav-label { display: block !important; }
  .nav-item span:not(.nav-icon) { display: inline !important; }
  .nav-item {
    padding: 9px 16px 9px 15px !important;
    justify-content: flex-start !important;
  }

  /* App layout — full height adaptive */
  #app { flex-direction: column; }
  #main {
    width: 100% !important;
    padding: 68px 14px 76px !important;
    display: flex;
    flex-direction: column;
  }
  /* Page container fills remaining height */
  #page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  /* Last card in page stretches to fill screen */
  #page-container > .card:last-of-type {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  /* Push nav buttons to bottom inside stretched card */
  #page-container > .card:last-of-type .section-divider ~ * { margin-top: auto; }
  #page-container > .card:last-of-type hr.section-divider { margin-top: auto; }

  /* Bottom Nav */
  #bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 150;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.07);
  }
  .bottom-tab {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    background: none; border: none;
    cursor: pointer; padding: 6px 0;
    color: var(--text-light);
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-tab.active { color: var(--primary); }
  .bottom-tab-icon { font-size: 19px; line-height: 1; }
  .bottom-tab-label { font-size: 10px; font-weight: 600; letter-spacing: 0.2px; }

  /* Grid adjustments */
  .grid-4 { grid-template-columns: 1fr 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  .hero-grid { grid-template-columns: 1fr !important; }
  .hero-side { grid-template-rows: auto !important; }
  .stats-bar { grid-template-columns: 1fr 1fr !important; }

  /* Module grid: 2 columns */
  .module-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .module-card {
    padding: 14px 12px !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .module-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .module-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
    border-radius: 10px !important;
  }
  .module-title { font-size: 13px !important; }
  .module-title-row { gap: 4px !important; }
  .module-desc { display: none !important; }
  .module-count {
    margin-top: 8px !important;
    font-size: 11px !important;
  }
  .module-stats {
    margin-top: 4px !important;
    font-size: 11px !important;
  }
  .module-actions { margin-top: auto !important; padding-top: 10px !important; }
  .module-actions .btn {
    font-size: 12px !important;
    padding: 8px 10px !important;
    min-height: 36px !important;
  }
  .badge {
    font-size: 10px !important;
    padding: 2px 7px !important;
    margin-left: 0 !important;
  }

  /* Compact status countdown card */
  .status-card {
    margin: 10px auto 8px !important;
    padding: 14px 16px 12px !important;
  }
  .status-title { font-size: 13.5px !important; margin-bottom: 10px !important; }
  .status-progress { margin-bottom: 12px !important; height: 5px !important; }
  .status-btn { min-width: 100px !important; min-height: 38px !important; font-size: 13px !important; }

  /* Page header */
  .page-header { margin-bottom: 14px !important; }
  .page-header h1 { font-size: 19px !important; }
  .page-header > p { display: none !important; }
  /* Question content spacing */
  .q-instruction { padding: 10px 14px !important; font-size: 13px !important; margin-bottom: 14px !important; }
  .q-text {
    padding: 14px 16px !important;
    font-size: 14px !important;
    line-height: 1.65 !important;
    margin-bottom: 14px !important;
  }
  .section-divider { margin: 16px 0 !important; }
  .recorder-widget { padding: 18px !important; }
  .question-nav { margin-bottom: 12px !important; }
  .card { padding: 20px 18px !important; }

  /* Progress page */
  .grid-2 { grid-template-columns: 1fr !important; }
  /* Stat cards: icon left, value+label right, no wrapping */
  .stat-card {
    display: grid !important;
    grid-template-columns: 36px 1fr !important;
    grid-template-rows: auto auto auto !important;
    align-items: center !important;
    padding: 14px 12px !important;
    gap: 0 10px !important;
    flex-direction: unset !important;
  }
  .stat-card .stat-icon {
    grid-column: 1 !important; grid-row: 1 / 4 !important;
    font-size: 26px !important; margin-bottom: 0 !important;
    align-self: center !important; text-align: center !important;
  }
  .stat-card .stat-value {
    grid-column: 2 !important; grid-row: 1 !important;
    font-size: 26px !important; line-height: 1.1 !important;
    align-self: end !important;
  }
  .stat-card .stat-label {
    grid-column: 2 !important; grid-row: 2 !important;
    font-size: 10.5px !important; text-transform: none !important;
    letter-spacing: 0 !important; white-space: nowrap !important;
    overflow: hidden !important; text-overflow: ellipsis !important;
    align-self: start !important;
  }
  .stat-card .stat-sub {
    grid-column: 2 !important; grid-row: 3 !important;
    font-size: 10px !important; white-space: nowrap !important;
  }
  /* Score bar: shrink label width */
  .score-bar-label { width: 105px !important; font-size: 11px !important; }
  .score-bar-val { font-size: 11px !important; }

  /* Toast above bottom nav */
  .toast { bottom: 72px !important; right: 14px !important; }

  /* Larger touch targets for buttons */
  .btn { min-height: 42px; }
  .record-btn { min-height: 48px !important; }
}

/* Pink theme mobile header */
body.pink #mobile-header { background: #2d1220; border-color: rgba(255,255,255,0.08); }
body.pink #hamburger-btn { color: #fff; }
body.pink .mobile-logo-text { color: #fff; }
body.pink #theme-toggle-mobile { color: #e879a8; }

/* Black-pink theme mobile header */
body.black-pink #mobile-header { background: #0d0d0d; border-color: #ec4899; }

/* AUTH MODAL */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
}
.auth-modal-overlay.hidden { display: none; }
.auth-modal {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: 26px;
  position: relative;
}
.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.auth-modal-header { margin-bottom: 18px; }
.auth-tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 18px;
}
.auth-tab {
  min-width: 110px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.auth-form { display: grid; gap: 10px; }
.auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.auth-input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.08);
}
.auth-message {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.auth-message.hidden { display: none; }
.auth-message.error {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}
.auth-message.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

/* Google / OAuth 登录按钮 */
.google-login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-sm, 10px);
  height: 44px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  margin-bottom: 4px;
}
.google-login-btn:hover {
  background: var(--hover, rgba(0,0,0,0.04));
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* 分隔线 */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--text-muted, #888);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #e2e8f0);
}

@media (max-width: 640px) {
  .auth-slot-desktop { display: none; }
  .auth-user-chip {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .auth-modal {
    padding: 22px 18px;
    border-radius: 18px;
  }
}

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #1a1d2e; color: white;
  padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px;
  box-shadow: var(--shadow-md); z-index: 1000; animation: slideUp 0.3s ease;
}
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

/* LOADING */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-light); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ── MOCK TEST STRUCTURE TABLE ───────────────────────────────────────────── */
.mt-part-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-weight: 600;
}
.mt-part-speaking { background: color-mix(in srgb, #2563eb 10%, transparent); }
.mt-part-reading  { background: color-mix(in srgb, #059669 10%, transparent); }
.mt-part-listening{ background: color-mix(in srgb, #7c3aed 10%, transparent); }
.mt-part-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
}
.mt-part-speaking .mt-part-badge { background: #2563eb; }
.mt-part-reading  .mt-part-badge { background: #059669; }
.mt-part-listening .mt-part-badge { background: #7c3aed; }
.mt-part-name { flex: 1; font-size: 14px; color: var(--text); }
.mt-part-time { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.mt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 4px;
}
.mt-table thead tr {
  background: var(--bg);
}
.mt-table th {
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.mt-table th:not(:first-child) { text-align: center; }
.mt-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.mt-table td:not(:first-child) { text-align: center; color: var(--text-light); font-size: 12px; }
.mt-table tbody tr:last-child td { border-bottom: none; }
.mt-table tbody tr:hover { background: var(--bg); }
.mt-row-divider td { border-top: 2px solid var(--border); }

/* ── WALKMAN ─────────────────────────────────────────────────────────────── */
.wm-player {
  margin-bottom: 14px;
}
.wm-now-playing {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.wm-track-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}
.wm-track-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.wm-track-meta {
  font-size: 12px;
  color: var(--text-light);
}
.wm-text-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  min-height: 60px;
  max-height: 120px;
  overflow-y: auto;
}
.wm-text-preview {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.wm-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.wm-progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.wm-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.2s linear;
}
.wm-time {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  min-width: 72px;
  text-align: right;
}
.wm-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wm-speed-btns {
  display: flex;
  gap: 4px;
}
.wm-speed-btn {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s;
}
.wm-speed-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.wm-main-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wm-ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.15s;
}
.wm-ctrl-btn:hover { background: var(--bg); }
.wm-play-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
  transition: background 0.15s;
}
.wm-play-btn:hover { background: var(--primary-hover); }
.wm-loop-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: opacity 0.15s;
}
.wm-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.wm-filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.wm-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.wm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wm-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.wm-list-item:hover { background: var(--bg); }
.wm-list-item.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.wm-li-icon { font-size: 20px; flex-shrink: 0; }
.wm-li-info { flex: 1; min-width: 0; }
.wm-li-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wm-li-meta { font-size: 11px; color: var(--text-light); }
.wm-li-dur { font-size: 12px; color: var(--text-light); flex-shrink: 0; }
