:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #657181;
  --line: #e5e9f1;
  --teal: #18a999;
  --teal-dark: #087f73;
  --coral: #ff6b57;
  --lemon: #ffd166;
  --violet: #6c63ff;
  --green: #33b864;
  --red: #e85252;
  --shadow: 0 16px 44px rgba(35, 44, 62, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

button,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

#recordBtn,
#listenBtn {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background:
    radial-gradient(circle at 15% 0%, rgba(24, 169, 153, 0.16), transparent 26rem),
    radial-gradient(circle at 100% 12%, rgba(255, 209, 102, 0.32), transparent 18rem),
    var(--bg);
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 18px 10px;
}

.header-copy h1 {
  margin: 8px 0 6px;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: 0;
}

.header-copy p,
.hero-card p,
.teacher-note p,
.speak-card p,
.quiz-feedback {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.pill,
.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pill {
  border: 1px solid rgba(24, 169, 153, 0.26);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.74);
}

.icon-button,
.text-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(35, 44, 62, 0.08);
}

.text-button {
  box-shadow: none;
  color: var(--teal-dark);
  font-weight: 800;
}

.content {
  padding: 8px 14px 0;
}

.hero-card,
.teacher-note,
.speak-card,
.quiz-card,
.learn-item,
.map-card,
.mission-card,
.empty-card {
  border: 1px solid rgba(229, 233, 241, 0.92);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: 1fr 94px;
  gap: 14px;
  align-items: center;
  padding: 18px;
}

.hero-card h2 {
  margin: 4px 0 8px;
  font-size: 23px;
  line-height: 1.18;
  letter-spacing: 0;
}

.score-ring {
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    conic-gradient(var(--teal) var(--rate, 0%), #edf0f6 0),
    #edf0f6;
  box-shadow: inset 0 0 0 10px white;
}

.score-ring strong {
  font-size: 22px;
}

.score-ring span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.unit-strip {
  margin: 14px -14px 0;
  overflow-x: auto;
  padding: 0 14px 4px;
  scrollbar-width: none;
}

.unit-strip::-webkit-scrollbar {
  display: none;
}

.unit-tabs {
  display: flex;
  gap: 9px;
  width: max-content;
}

.unit-tab {
  min-width: 106px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 22px rgba(35, 44, 62, 0.06);
}

.unit-tab strong,
.unit-tab span {
  display: block;
}

.unit-tab strong {
  font-size: 13px;
}

.unit-tab span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.unit-tab.active {
  border-color: var(--teal);
  background: #e9fbf8;
}

.view {
  display: none;
  padding-top: 18px;
}

.active-view {
  display: block;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 2px 12px;
}

.section-title h2 {
  margin: 2px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.section-title > span {
  min-width: 58px;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.mission-list,
.course-map,
.learn-panel,
.compact-list,
.review-list {
  display: grid;
  gap: 12px;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(35, 44, 62, 0.07);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  line-height: 1;
}

.mission-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 14px;
}

.mission-index {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f0fbf9;
  color: var(--teal-dark);
  font-weight: 900;
}

.mission-card h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.mission-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.55;
}

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

.primary-button,
.accent-button,
.plain-button,
.success-button,
.danger-button {
  min-height: 42px;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 850;
}

.primary-button {
  background: var(--teal);
  color: white;
}

.accent-button {
  background: var(--coral);
  color: white;
}

.plain-button {
  background: #eef2f7;
  color: var(--ink);
}

.success-button {
  background: rgba(51, 184, 100, 0.12);
  color: #168241;
}

.danger-button {
  background: rgba(232, 82, 82, 0.12);
  color: #c83737;
}

.full {
  width: 100%;
}

.teacher-note {
  margin-top: 14px;
  padding: 16px;
  border-left: 5px solid var(--lemon);
}

.teacher-note h3,
.learn-item h3,
.map-card h3,
.speak-card h2,
.quiz-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.map-card {
  padding: 15px;
}

.map-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.map-card h3 {
  font-size: 18px;
}

.map-card p {
  margin: 8px 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  border-radius: 999px;
  padding: 5px 8px;
  background: #f0f3f8;
  color: #475466;
  font-size: 12px;
  font-weight: 750;
}

.segment-control {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 5px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 3;
}

.segment {
  min-height: 36px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.segment.active {
  background: var(--ink);
  color: white;
}

.learn-panel {
  padding-top: 12px;
}

.library-summary {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
  color: var(--muted);
  line-height: 1.6;
}

.library-summary strong {
  color: var(--ink);
}

.learn-item {
  padding: 15px;
}

.learn-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.learn-item h3 {
  font-size: 24px;
  line-height: 1.15;
}

.learn-item .cn {
  margin: 6px 0 0;
  color: var(--ink);
  font-weight: 800;
}

.learn-item .example,
.learn-item .tip {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.58;
}

.knowledge-grid {
  display: grid;
  gap: 10px;
}

.knowledge-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
}

.knowledge-block strong {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
}

.knowledge-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.speak-card {
  padding: 18px;
}

.speak-card h2 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.18;
}

.speak-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.playback-button {
  grid-column: 1 / -1;
}

.accent-button.recording {
  background: #c83737;
  box-shadow: 0 0 0 6px rgba(232, 82, 82, 0.16);
}

.record-tip {
  margin-top: 10px;
  font-size: 13px;
}

.score-board {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  border-radius: 12px;
  padding: 12px;
  background: #f4f7fb;
}

.score-board strong {
  display: block;
  font-size: 30px;
  color: var(--teal-dark);
  line-height: 1;
}

.score-board span,
.transcript-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.transcript-box {
  margin-top: 12px;
  border: 1px dashed #cad2de;
  border-radius: 12px;
  padding: 12px;
}

.transcript-box p {
  margin-top: 4px;
  color: var(--ink);
}

.audio-player {
  display: none;
  width: 100%;
  margin-top: 12px;
}

.audio-player.ready {
  display: block;
}

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface);
}

.compact-item div {
  min-width: 0;
}

.compact-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.compact-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.quiz-card {
  padding: 16px;
}

.quiz-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.quiz-head h2 {
  margin-top: 4px;
  font-size: 21px;
  line-height: 1.28;
}

#quizStep {
  color: var(--muted);
  font-weight: 850;
}

.option-list {
  display: grid;
  gap: 9px;
  margin: 14px 0;
}

.option-button {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-align: left;
}

.option-button.correct {
  border-color: var(--green);
  background: rgba(51, 184, 100, 0.12);
}

.option-button.wrong {
  border-color: var(--red);
  background: rgba(232, 82, 82, 0.12);
}

.quiz-feedback {
  min-height: 30px;
  margin-bottom: 12px;
  font-weight: 750;
}

.quiz-summary {
  display: none;
  margin: 14px 0;
  border-radius: 14px;
  padding: 14px;
  background: #f4f7fb;
}

.quiz-summary.active {
  display: block;
}

.quiz-summary h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.quiz-summary p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.6;
}

.quiz-summary ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.empty-card {
  padding: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 7px 7px calc(7px + env(safe-area-inset-bottom));
  backdrop-filter: blur(14px);
  z-index: 10;
}

.nav-item {
  min-width: 0;
  min-height: 48px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.nav-item.active {
  background: #e9fbf8;
  color: var(--teal-dark);
}

@media (min-width: 760px) {
  .app-shell {
    margin-top: 18px;
    margin-bottom: 18px;
    min-height: calc(100vh - 36px);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
  }

  .bottom-nav {
    border-radius: 18px 18px 0 0;
  }
}
