:root {
  --paper: #fffedf;
  --ink: #233046;
  --muted: #667085;
  --line: #cdd3ce;
  --blue: #2367e8;
  --teal: #1f9d9a;
  --yellow: #fff1a6;
  --rose: #e45b7f;
  --green: #5aa469;
  --card: #fafdfb;
  --mist: #f2fefe;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: #e8ece3;
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.stage {
  width: min(1280px, 100%);
  height: min(608px, calc(100vh - 36px));
  min-height: 572px;
  background: linear-gradient(180deg, #fffedf 0%, #fff8cc 100%);
  border: 1px solid #cbd5c8;
  box-shadow: 0 18px 45px rgba(35, 48, 70, 0.16);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  padding: 22px 28px 14px;
  overflow: hidden;
}

.course-hero {
  min-height: 108px;
  border: 2px solid #5b6472;
  background: linear-gradient(90deg, #fafdfb 0%, #fffef0 68%, #f2fefe 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  box-shadow: 6px 7px 0 rgba(35, 48, 70, 0.08);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.paper-plane {
  width: 155px;
  height: 76px;
  position: relative;
  flex: 0 0 auto;
}

.paper-plane::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 12px;
  width: 52px;
  height: 31px;
  border-radius: 14px;
  background: var(--teal);
  box-shadow: 32px 10px 0 -8px #74d2d0;
}

.paper-plane::after {
  content: "";
  position: absolute;
  right: 0;
  top: 5px;
  width: 92px;
  height: 58px;
  background: linear-gradient(135deg, #ff7aa2 0 48%, #273247 49% 53%, #ffd166 54%);
  clip-path: polygon(0 42%, 100% 0, 63% 100%, 48% 61%);
}

.paper-plane span {
  position: absolute;
  left: 47px;
  top: 40px;
  width: 66px;
  height: 4px;
  border-top: 3px dashed #8992a3;
}

.module-strip {
  display: grid;
  grid-template-columns: repeat(10, minmax(84px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.module-card {
  min-height: 72px;
  border: 1px solid #8993a2;
  background: linear-gradient(180deg, var(--card), #fffef0);
  border-radius: 4px;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 4px;
  color: var(--ink);
}

.module-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px var(--blue);
  background: #fffef0;
}

.module-card strong {
  font-size: 13px;
}

.module-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.lesson-board {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 14px;
  min-height: 0;
}

.lesson-panel,
.practice-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid #9098a4;
  background: rgba(250, 253, 251, 0.94);
  border-radius: 6px;
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  overflow: hidden;
}

.practice-panel {
  grid-template-rows: auto 1fr;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
  color: #344054;
}

.panel-head button,
.mode-pills button,
.playbar button,
.dialog-head button {
  border: 1px solid #98a2b3;
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
}

.panel-head > button {
  padding: 5px 10px;
  font-size: 13px;
}

.mode-pills {
  display: flex;
  gap: 6px;
}

.mode-pills button {
  padding: 4px 12px;
  font-size: 13px;
}

.mode-pills button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.tab-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-row button {
  border: 1px solid #98a2b3;
  background: #fff;
  border-radius: 4px;
  padding: 7px 12px;
  color: #344054;
  cursor: pointer;
}

.tab-row button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.unit-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, #fff 0%, #fffef5 100%);
  padding: 18px;
  overflow: auto;
  min-height: 0;
}

.unit-label {
  color: var(--blue);
  font-weight: 800;
  margin-bottom: 6px;
}

.unit-card h2 {
  font-size: 27px;
  line-height: 1.12;
  margin-bottom: 10px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.focus-line {
  color: var(--muted);
  margin-bottom: 16px;
}

.quote-box {
  display: grid;
  gap: 10px;
}

.quote {
  border-left: 5px solid #f3cf4c;
  background: #fffedf;
  padding: 10px 12px;
  line-height: 1.45;
  font-size: 15px;
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 10px;
  align-items: center;
}

.speak-quote,
.voice-actions button {
  border: 1px solid #98a2b3;
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
}

.speak-quote {
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 900;
}

.speech-studio {
  border: 1px solid #d5d9d4;
  background: var(--mist);
  border-radius: 6px;
  padding: 10px;
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.voice-row,
.voice-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.voice-row label,
.rate-control {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.voice-row select {
  min-width: min(310px, 100%);
  max-width: 100%;
  border: 1px solid #98a2b3;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 5px 8px;
}

.voice-actions button {
  padding: 5px 10px;
  font-size: 13px;
}

.rate-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rate-control input {
  width: 120px;
}

.learn-view {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
  min-height: 0;
}

.knowledge-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #fafdfb);
  padding: 12px;
  min-height: 112px;
}

.knowledge-card .tag {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  color: #fff;
  font-weight: 900;
  margin-bottom: 8px;
}

.knowledge-card:nth-child(1) .tag {
  background: var(--rose);
}

.knowledge-card:nth-child(2) .tag {
  background: var(--teal);
}

.knowledge-card:nth-child(3) .tag {
  background: var(--blue);
}

.knowledge-card:nth-child(4) .tag {
  background: var(--green);
}

.knowledge-card h3 {
  margin-bottom: 7px;
  font-size: 16px;
  letter-spacing: 0;
}

.knowledge-card p {
  margin-bottom: 0;
  color: #475467;
  line-height: 1.45;
  font-size: 14px;
}

.word-bank {
  border: 1px solid var(--line);
  background: #fafdfb;
  border-radius: 6px;
  padding: 12px;
}

.word-bank h3 {
  font-size: 15px;
  margin-bottom: 9px;
}

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

.chips span {
  border: 1px solid #cad1dc;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f8fafc;
  font-size: 13px;
}

.hidden {
  display: none;
}

.quiz-view {
  align-content: start;
  gap: 14px;
}

.quiz-prompt {
  font-size: 23px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 16px;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quiz-options button {
  min-height: 56px;
  border: 1px solid #98a2b3;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  padding: 10px 12px;
}

.quiz-options button.correct {
  border-color: var(--green);
  background: #ecfdf3;
}

.quiz-options button.wrong {
  border-color: var(--rose);
  background: #fff1f3;
}

.quiz-result {
  min-height: 24px;
  color: var(--muted);
  font-weight: 700;
}

.playbar {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 12px;
  align-items: center;
}

.playbar button {
  height: 34px;
  font-size: 24px;
  line-height: 1;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #cfd6dd;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 10%;
  background: var(--blue);
}

.page-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 1px solid #98a2b3;
  border-radius: 8px;
  padding: 0;
  background: #fff;
}

.page-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dialog-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

.dialog-head button {
  width: 32px;
  height: 32px;
  font-size: 22px;
}

.page-dialog img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 0;
    place-items: stretch;
  }

  .stage {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 100vh;
    border: 0;
    padding: 14px;
    overflow: visible;
  }

  .course-hero {
    padding: 14px;
    overflow: hidden;
  }

  .paper-plane {
    display: none;
  }

  .module-strip {
    grid-template-columns: repeat(10, 118px);
  }

  .lesson-board {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .unit-card h2 {
    font-size: 24px;
  }

  .knowledge-grid,
  .quiz-options {
    grid-template-columns: 1fr;
  }
}
