:root {
  color-scheme: light;
  --bg: #f4f7ff;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #62708a;
  --blue: #2f6fed;
  --blue-dark: #164cb8;
  --yellow: #ffd66b;
  --orange: #ff8a4c;
  --green: #22a06b;
  --red: #f25f5c;
  --line: rgba(31, 53, 92, 0.12);
  --shadow: 0 16px 40px rgba(25, 55, 120, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 214, 107, 0.38), transparent 32rem),
    linear-gradient(180deg, #eef5ff 0%, var(--bg) 42%, #fff8ea 100%);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  background: rgba(244, 247, 255, 0.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.65);
}

.app-header h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--blue);
  text-transform: uppercase;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 20px;
}

main {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 16px 14px 40px;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr 104px;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: 26px;
  background: linear-gradient(135deg, #1f4fb8, #3b82f6 58%, #72b8ff);
  color: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-panel h2 {
  margin: 10px 0 8px;
  font-size: clamp(25px, 7vw, 42px);
  line-height: 1.12;
}

.hero-panel p {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.65;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff !important;
  font-size: 12px;
  font-weight: 700;
}

.hero-mascot {
  display: grid;
  place-items: center;
  width: 104px;
  height: 132px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 30% 20%, #fff, transparent 22px),
    linear-gradient(160deg, var(--yellow), #ffb347);
  transform: rotate(4deg);
  box-shadow: inset 0 -14px 24px rgba(146, 86, 0, 0.16);
}

.hero-mascot span {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: white;
  color: var(--blue-dark);
  font-weight: 900;
  font-size: 22px;
}

.unit-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 16px 2px 8px;
  scrollbar-width: none;
}

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

.unit-pill {
  flex: 0 0 154px;
  min-height: 76px;
  padding: 12px;
  border-radius: 18px;
  text-align: left;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(25, 55, 120, 0.08);
  font-weight: 850;
}

.unit-pill span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
}

.unit-pill.active {
  background: #102a5f;
  color: white;
}

.unit-pill.active span {
  color: rgba(255, 255, 255, 0.72);
}

.unit-pill.locked::after {
  content: "样板后补";
  display: inline-block;
  margin-top: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f4fa;
  color: #8090ad;
  font-size: 11px;
}

.progress-card,
.word-card,
.quiz-card,
.role-box,
.sentence-card,
.dialogue-line,
.plan-list div {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 28px rgba(25, 55, 120, 0.09);
}

.progress-card {
  padding: 16px;
  border-radius: 22px;
  margin: 8px 0 16px;
}

.progress-card h2 {
  margin: 0;
  font-size: 18px;
}

.progress-card p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.voice-panel {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #f7f9ff;
  border: 1px solid var(--line);
}

.voice-panel label,
.spell-box label {
  color: #43536f;
  font-size: 13px;
  font-weight: 850;
}

.voice-panel select,
.spell-box input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
}

.progress-bar {
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: #e8edf7;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: width 0.25s ease;
}

.lesson-tabs {
  position: sticky;
  top: 70px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px;
  margin: 0 -4px 12px;
  border-radius: 18px;
  background: rgba(234, 241, 255, 0.88);
  backdrop-filter: blur(14px);
}

.tab {
  padding: 10px 4px;
  border-radius: 13px;
  color: #42516d;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.tab.active {
  background: white;
  color: var(--blue-dark);
  box-shadow: 0 8px 18px rgba(25, 55, 120, 0.1);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  padding: 12px 2px 10px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.word-card {
  padding: 18px;
  border-radius: 28px;
}

.word-top,
.card-actions,
.sentence-actions,
.quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.word-top p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.primary-mini,
.example-box button,
.primary-btn,
.card-actions button,
.sentence-actions button,
.quiz-actions button,
.danger-btn {
  border-radius: 14px;
  padding: 10px 12px;
  background: #edf3ff;
  color: var(--blue-dark);
  font-weight: 850;
}

.primary-mini,
.primary-btn,
#knownWordBtn,
.quiz-actions .main {
  background: var(--blue);
  color: white;
}

.word-card h3 {
  margin: 18px 0 4px;
  font-size: clamp(40px, 14vw, 74px);
  line-height: 1;
  letter-spacing: 0;
  color: #102a5f;
}

#wordPhonetic {
  margin: 0;
  color: var(--orange);
  font-size: 18px;
  font-weight: 800;
}

#wordCn {
  margin: 12px 0 0;
  font-size: 22px;
  font-weight: 800;
}

.study-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: #f7fbff;
  border: 1px solid rgba(47, 111, 237, 0.14);
}

.study-box div:not(.study-actions) {
  display: grid;
  gap: 4px;
}

.study-box span {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.study-box strong {
  color: #102a5f;
  font-size: 20px;
  line-height: 1.35;
}

.study-box p {
  margin: 0;
  color: #43536f;
  line-height: 1.55;
}

.study-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.study-actions button {
  border-radius: 14px;
  padding: 10px 12px;
  background: #edf3ff;
  color: var(--blue-dark);
  font-weight: 850;
}

.example-box {
  margin: 18px 0;
  padding: 14px;
  border-radius: 18px;
  background: #fff8df;
}

.example-box p {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.4;
  color: #523a00;
}

.spell-box {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 14px;
  border-radius: 18px;
  background: #f2f7ff;
  border: 1px solid rgba(47, 111, 237, 0.16);
}

.spell-box div {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
}

.spell-box button,
.talk-actions button {
  border-radius: 14px;
  padding: 10px 12px;
  background: #edf3ff;
  color: var(--blue-dark);
  font-weight: 850;
}

#spellResult {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

#spellResult.ok {
  color: #126341;
}

#spellResult.no {
  color: #a43531;
}

.card-actions button {
  flex: 1;
}

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

.mini-word {
  padding: 12px;
  border-radius: 16px;
  background: white;
  border: 1px solid var(--line);
  text-align: left;
}

.mini-word.done {
  border-color: rgba(34, 160, 107, 0.55);
  background: #effaf5;
}

.practice-list,
.dialogue-list,
.plan-list {
  display: grid;
  gap: 12px;
}

.sentence-card {
  padding: 14px;
  border-radius: 20px;
}

.sentence-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.sentence-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.sentence-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.role-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.role-box select {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.talk-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.talk-actions .primary-btn {
  grid-column: 1 / -1;
}

.dialogue-line {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 18px;
}

.speaker {
  font-weight: 900;
  color: var(--blue-dark);
}

.dialogue-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}

.dialogue-line.mine {
  border-color: rgba(255, 138, 76, 0.55);
  background: #fff7ef;
}

.dialogue-line.recited {
  border-color: rgba(34, 160, 107, 0.5);
  background: #effaf5;
}

.dialogue-line.hidden-text .dialogue-text {
  color: transparent;
  text-shadow: 0 0 9px rgba(23, 32, 51, 0.2);
  user-select: none;
}

.line-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.line-tools button {
  border-radius: 12px;
  padding: 8px 10px;
  background: #edf3ff;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 850;
}

.quiz-card {
  padding: 18px;
  border-radius: 24px;
}

.quiz-card h3 {
  margin: 0 0 12px;
  font-size: 22px;
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-option {
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  background: #f4f7ff;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.quiz-option.correct {
  background: #eaf8f0;
  color: #126341;
}

.quiz-option.wrong {
  background: #ffeceb;
  color: #a43531;
}

.quiz-feedback {
  min-height: 28px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.plan-list div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
}

.plan-list strong {
  color: var(--blue-dark);
}

.danger-btn {
  width: 100%;
  margin-top: 14px;
  background: #ffeceb;
  color: #a43531;
}

.recorder-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  padding: 14px;
  border-radius: 22px;
  background: #102a5f;
  color: white;
  box-shadow: var(--shadow);
}

.recorder-panel p {
  margin: 0 0 10px;
  font-weight: 800;
}

.recorder-panel div {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.recorder-panel button {
  flex: 1;
  padding: 10px;
  border-radius: 14px;
  background: white;
  color: #102a5f;
  font-weight: 850;
}

.recorder-panel audio {
  width: 100%;
}

footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (min-width: 720px) {
  main {
    padding-top: 24px;
  }

  .hero-panel {
    grid-template-columns: 1fr 160px;
  }

  .hero-mascot {
    width: 150px;
    height: 160px;
  }

  .mini-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 380px) {
  .app-header h1 {
    font-size: 18px;
  }

  .hero-panel {
    grid-template-columns: 1fr 86px;
    padding: 16px;
  }

  .hero-mascot {
    width: 86px;
    height: 112px;
  }

  .lesson-tabs {
    gap: 4px;
    padding: 6px;
  }

  .tab {
    font-size: 12px;
  }
}
