:root {
  --bg: #FAF8F5;
  --card: #FFFFFF;
  --ink: #1C232B;
  --muted: #64707D;
  --line: #EBE5DC;
  --primary: #FF6B4A;
  --primary-dark: #E65232;
  --primary-soft: #FFF0EC;
  --teal: #0EA5A4;
  --teal-soft: #E6F7F7;
  --amber: #D97706;
  --amber-soft: #FEF3C7;
  --green: #16A34A;
  --green-soft: #DCFCE7;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(28, 35, 43, 0.055);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: #F1EDE7;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

.app-shell {
  max-width: 680px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(80px + var(--safe-bottom));
  box-shadow: 0 0 44px rgba(0, 0, 0, 0.05);
}

.app-shell.in-lesson {
  padding-bottom: calc(20px + var(--safe-bottom));
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 248, 245, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.page {
  padding: 16px 18px;
}

.lesson-fullscreen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 14px 18px calc(22px + var(--safe-bottom));
}

.hidden {
  display: none !important;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

/* 顶部极简总进度条（不与下方按钮打架） */
.journey-bar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.journey-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.journey-title {
  font-weight: 800;
  font-size: 15px;
}

.journey-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

.science-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: #4B5563;
  line-height: 1.7;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease;
  font-family: inherit;
}

.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(255, 107, 74, 0.24); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 6px 16px rgba(14, 165, 164, 0.22); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-ghost { background: #F3EFE9; color: var(--ink); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 11px; box-shadow: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-ready { background: var(--green-soft); color: var(--green); }
.pill-planned { background: #F1F5F9; color: #64748B; }
.pill-warn { background: var(--amber-soft); color: var(--amber); }
.pill-count { background: #F4F1EC; color: var(--ink); }

/* 五阶段可折叠卡片 */
.stage-card {
  padding: 15px 16px;
}

.stage-head {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.stage-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}

.stage-name {
  font-weight: 800;
  font-size: 15.5px;
  margin: 0;
}

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

.stage-chevron {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  flex-shrink: 0;
}

.stage-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.stage-goal {
  font-size: 13px;
  color: #4B5563;
  background: #FAF8F5;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.unit-title {
  font-size: 13px;
  font-weight: 800;
  color: #374151;
  margin: 12px 0 8px;
}

.summary-unit {
  background: #FAF9F6;
  border: 1px dashed #E2DBD0;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.summary-unit-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #374151;
}

.summary-unit-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* 单节课条目（当前主线课高亮唯一主按钮，杜绝重复入口） */
.lesson-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  margin-bottom: 9px;
  background: #fff;
  transition: border-color 0.15s, transform 0.12s;
}

.lesson-row.clickable { cursor: pointer; }
.lesson-row.clickable:hover { border-color: #FFB29F; }

.lesson-row.current-focus {
  border-color: var(--primary);
  background: linear-gradient(180deg, #FFFBF9 0%, #FFF4F0 100%);
  box-shadow: 0 8px 22px rgba(255, 107, 74, 0.12);
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 15px 16px;
}

.lesson-row.locked {
  opacity: 0.68;
  background: #FAF9F7;
}

.lesson-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lesson-num {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lesson-row.current-focus .lesson-num {
  background: var(--primary);
  color: #fff;
}

.lesson-row.locked .lesson-num {
  background: #ECEEF2;
  color: #7C8794;
}

.lesson-info { flex: 1; min-width: 0; }
.lesson-title { font-weight: 800; font-size: 14.5px; }
.lesson-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ========== 沉浸式单轨私教闯关教室 ========== */
.tutor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  height: 10px;
  background: #EAE4DC;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF7D5C 0%, #FF5A36 100%);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
}

.tutor-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
  align-self: flex-start;
}

.tutor-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.tutor-footer {
  margin-top: auto;
  padding-top: 10px;
}

.big-audio-orb {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #FF7B59 0%, #FF5733 100%);
  color: #fff;
  font-size: 38px;
  cursor: pointer;
  margin: 12px auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(255, 91, 58, 0.3);
  transition: transform 0.14s ease;
}

.big-audio-orb:active { transform: scale(0.94); }

.big-audio-orb.playing {
  animation: pulseOrb 1.2s infinite;
}

@keyframes pulseOrb {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 74, 0.45); }
  70% { box-shadow: 0 0 0 18px rgba(255, 107, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 74, 0); }
}

.sound-emoji {
  font-size: 64px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.sound-word {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0;
}

.sound-meaning {
  font-size: 17px;
  color: var(--primary);
  font-weight: 800;
  margin: 4px 0 14px;
}

.tip-box {
  text-align: left;
  background: #FAF8F5;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13.5px;
  margin: 10px 0;
}

.tip-label {
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 3px;
  font-size: 12.5px;
}

.dual-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

/* 听音选图互动卡片 */
.quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.quiz-option {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 20px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.quiz-option:active { transform: scale(0.97); }
.quiz-option .q-emoji { font-size: 46px; line-height: 1.1; }
.quiz-option .q-zh { font-size: 15px; font-weight: 800; margin-top: 8px; color: var(--ink); }

.quiz-option.correct {
  border-color: var(--green);
  background: #F0FDF4;
}

.quiz-option.wrong {
  border-color: #EF4444;
  background: #FEF2F2;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.feedback-banner {
  margin-top: 14px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.feedback-banner.ok { background: var(--green-soft); color: #15803D; }
.feedback-banner.err { background: #FEE2E2; color: #B91C1C; }

/* 拆读合一 & 顿悟复听 */
.rhythm-card {
  text-align: left;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: 14px;
  padding: 11px 13px;
  font-size: 13.5px;
  margin: 12px 0;
}

.rhythm-text {
  font-weight: 800;
  color: #C2410C;
  font-size: 14.5px;
  margin-bottom: 3px;
}

.word-tok {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 7px;
  cursor: pointer;
}

.word-tok:hover, .word-tok:active {
  background: var(--primary-soft);
  color: var(--primary);
}

.chunk-hl {
  background: #FFE5DD;
  color: #C23A1C;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.mode-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.mode-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.dialogue-line {
  padding: 11px 13px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  margin-bottom: 8px;
  cursor: pointer;
}

.dialogue-line.active {
  border-color: var(--primary);
  background: #FFFBF9;
}

.blind-mask {
  background: #F4F1EC;
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  text-align: center;
}

/* AI 实战聊天区 */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  max-height: 44dvh;
  overflow-y: auto;
  padding: 4px 2px;
}

.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 15px;
}

.bubble-ai {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.bubble-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mini-chip {
  border: 1px solid var(--line);
  background: #FAF8F5;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.lifeline-panel {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 14px;
  padding: 10px 12px;
  margin: 10px 0;
}

.hint-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed #FCD34D;
}

.hint-item:last-child { border-bottom: none; padding-bottom: 0; }

.mic-big-btn {
  width: 100%;
  padding: 15px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #FF6B4A 0%, #EE4D2D 100%);
  color: #fff;
  font-size: 15.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 107, 74, 0.28);
}

.mic-big-btn.recording {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  animation: pulseRec 1.1s infinite;
}

@keyframes pulseRec {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  70% { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.target-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.target-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #F4F1EC;
  color: #555;
}

.target-chip.hit { background: var(--green-soft); color: var(--green); }

/* SRS 复习卡片 */
.srs-card { text-align: center; padding: 26px 18px; }
.srs-grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }

/* 极简 3-Tab 底部导航栏 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 680px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 7px 10px calc(9px + var(--safe-bottom));
  z-index: 30;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 0;
  cursor: pointer;
  position: relative;
}

.nav-item .nav-ico { font-size: 21px; line-height: 1.1; }
.nav-item.active { color: var(--primary); }

.nav-badge {
  position: absolute;
  top: 0;
  right: 28%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 999px;
  padding: 0 4px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: 680px;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(22px + var(--safe-bottom));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.14);
}

.input-box {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.input-box:focus { border-color: var(--primary); }

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 35, 43, 0.94);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  z-index: 80;
  max-width: 90%;
  text-align: center;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.stat-tile {
  background: #FAF8F5;
  border-radius: 14px;
  padding: 12px;
}

.stat-val { font-size: 20px; font-weight: 900; color: var(--ink); }
.stat-lbl { font-size: 12px; color: var(--muted); }
