:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1d2a32;
  --muted: #5b6b74;
  --line: #d9d3c7;
  --accent: #0b6e4f;
  --accent-ink: #ffffff;
  --pete: #1d4e89;
  --anna: #9b3d12;
  --jonathan: #6b3fa0;
  --marsha: #0b6e4f;
  --man: #5b6b74;
  --caty: #8a1c4a;
  --anne: #b85c38;
  --amelia: #2a6f97;
  --phone: #4a5568;
  --ashley: #c05621;
  --coworkers: #2f6f4e;
  --bot: #3d5a80;
  --weaver: #9b2226;
  --kaveh: #0077b6;
  --penelope: #6a4c93;
  --mimi: #bc4749;
  --dan: #2b6cb0;
  --trudy: #9c4221;
  --kate: #2f855a;
  --piper: #805ad5;
  --shadow: 0 10px 30px rgba(29, 42, 50, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(circle at top left, #fff7e8 0, transparent 38%),
    linear-gradient(180deg, #f7f4ee 0%, var(--bg) 100%);
  color: var(--ink);
  line-height: 1.55;
  overflow-x: clip;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.page {
  width: min(860px, calc(100% - 32px));
  margin: 24px auto 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.header,
.nav,
.site-nav,
.video-section,
.dialogue-section,
.quiz-section,
.catalog-section,
.checkin-section,
.wrongbook-section,
.pricing-section,
.redeem-section,
.paywall-section,
.excerpt-section,
.directory-section,
.footer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.header,
.nav,
.dialogue-section,
.quiz-section,
.catalog-section,
.checkin-section,
.wrongbook-section,
.pricing-section,
.redeem-section,
.paywall-section,
.excerpt-section,
.directory-section,
.footer {
  padding: 22px 24px;
}

.nav {
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.site-nav,
.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 4px 16px;
}

.site-nav a,
.site-nav-inline a,
.back-link,
.section-more a,
.level-progress-hint a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-nav a,
.site-nav-inline a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  justify-content: center;
  min-width: 44px;
  padding: 0 6px;
}

.site-nav a:hover,
.site-nav-inline a:hover,
.section-more a:hover {
  text-decoration: underline;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  box-shadow: 0 2px 0 var(--accent);
}

.site-nav a.is-unlocked,
.site-nav-inline a.is-unlocked {
  color: var(--accent);
}

.site-nav-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-nav-inline a {
  color: var(--accent);
}

.site-nav > .script-switch {
  margin-left: auto;
}

.script-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.script-switch a {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.script-switch a[aria-current="true"] {
  background: var(--accent);
  color: #fff;
}

.script-switch a:hover {
  text-decoration: none;
}

.back-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  padding: 0 4px;
}

.back-link:hover {
  text-decoration: underline;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

h1,
h2,
h3,
.subtitle,
.eyebrow {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 16px;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.subtitle,
.lesson-intro,
.catalog-note,
.en,
.zh,
.wrong-prompt,
.video-fallback,
h2,
h3 {
  overflow-wrap: anywhere;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.lesson-intro {
  margin: 10px 0 0;
}

.catalog {
  display: grid;
  gap: 14px;
}

@media (min-width: 720px) {
  .catalog {
    grid-template-columns: 1fr 1fr;
  }
}

.lesson-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf7;
}

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

.lesson-number,
.lesson-subtitle,
.lesson-score {
  margin: 0;
  color: var(--muted);
}

.lesson-number {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lesson-card .btn {
  justify-self: start;
  margin-top: 6px;
  text-decoration: none;
}

.lesson-card.is-locked {
  background: #f3efe6;
}

.lesson-card[hidden] {
  display: none;
}

.catalog-note {
  margin: 0 0 14px;
  color: var(--muted);
}

.level-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.level-tab {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 8px 16px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.level-tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.level-progress {
  display: grid;
  gap: 10px;
  margin: -4px 0 16px;
}

.level-progress-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 16px;
}

.level-progress-count,
.level-progress-hint {
  margin: 0;
}

.level-progress-count {
  font-weight: 700;
}

.level-progress-count strong {
  color: var(--accent);
  font-size: 1.15em;
}

.level-progress-hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.level-progress-hint a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.level-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #efeae0;
  overflow: hidden;
}

.level-progress-bar span {
  display: block;
  height: 100%;
  min-width: 0;
  background: var(--accent);
  border-radius: inherit;
}

.level-clear {
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: #eef7f2;
}

.level-clear h2 {
  margin-bottom: 8px;
}

.level-clear p {
  margin: 0 0 12px;
}

.level-clear .quiz-actions {
  margin-top: 4px;
}

.level-clear .btn {
  text-decoration: none;
}

.catalog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
}

.filter-chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.filter-empty {
  margin: 0 0 12px;
  color: var(--muted);
}

.lesson-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.lesson-pager .btn {
  text-decoration: none;
}

.lesson-pager .is-locked-link {
  border-color: #d4b483;
  background: #fff8ee;
}

.pager-placeholder {
  color: var(--muted);
  font-size: 0.92rem;
}

.quiz-result .clear-note {
  display: block;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #e4f4ed;
  color: var(--accent);
}

.quiz-result .clear-note a {
  color: var(--accent);
}

.status-badge {
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-not-started {
  background: #efeae0;
  color: var(--muted);
}

.status-in-progress {
  background: #e7f0ff;
  color: var(--pete);
}

.status-done {
  background: #e4f4ed;
  color: var(--accent);
}

.status-locked {
  background: #efe6d4;
  color: #8a5a12;
}

.status-locked::before {
  content: "🔒 ";
}

.video-section {
  padding: 12px;
}

.video-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 16 / 9;
  background: #111;
}

#lesson-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-fallback {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.video-fallback a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
}

.dialogue {
  display: grid;
  gap: 12px;
}

.line {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf7;
}

.speaker {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.line[data-speaker="Pete"] .speaker {
  color: var(--pete);
}

.line[data-speaker="Anna"] .speaker {
  color: var(--anna);
}

.line[data-speaker="Jonathan"] .speaker {
  color: var(--jonathan);
}

.line[data-speaker="Marsha"] .speaker {
  color: var(--marsha);
}

.line[data-speaker="Man"] .speaker {
  color: var(--man);
}

.line[data-speaker="Caty"] .speaker {
  color: var(--caty);
}

.line[data-speaker="Anne"] .speaker {
  color: var(--anne);
}

.line[data-speaker="Amelia"] .speaker {
  color: var(--amelia);
}

.line[data-speaker="Phone"] .speaker {
  color: var(--phone);
}

.line[data-speaker="Ashley"] .speaker {
  color: var(--ashley);
}

.line[data-speaker="Co-Workers"] .speaker {
  color: var(--coworkers);
}

.line[data-speaker="Professor Bot"] .speaker {
  color: var(--bot);
}

.line[data-speaker="Ms. Weaver"] .speaker {
  color: var(--weaver);
}

.line[data-speaker="Kaveh"] .speaker {
  color: var(--kaveh);
}

.line[data-speaker="Penelope"] .speaker {
  color: var(--penelope);
}

.line[data-speaker="Mimi"] .speaker {
  color: var(--mimi);
}

.line[data-speaker="Dan"] .speaker {
  color: var(--dan);
}

.line[data-speaker="Trudy"] .speaker {
  color: var(--trudy);
}

.line[data-speaker="Kate"] .speaker {
  color: var(--kate);
}

.line[data-speaker="Piper"] .speaker {
  color: var(--piper);
}

.en,
.zh {
  margin: 0;
}

.en {
  font-size: 1.05rem;
}

.zh {
  margin-top: 4px;
  color: var(--muted);
}

.question {
  margin: 0 0 16px;
  padding: 14px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.question legend {
  padding: 0 6px;
  font-weight: 700;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0 0 10px;
  cursor: pointer;
}

.choice input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
}

.quiz-preview {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.excerpt-note {
  margin: 0 0 12px;
  color: var(--muted);
}

.lesson-directory ol {
  margin: 0 0 16px;
  padding-left: 1.2em;
}

.lesson-directory li {
  margin: 0;
}

.lesson-directory a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.lesson-directory a:hover {
  color: var(--accent);
}

#quiz,
.header,
.catalog-section {
  scroll-margin-top: 96px;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.72;
  cursor: not-allowed;
  color: var(--muted);
  background: #f4f1ea;
}

.btn:disabled:hover,
.btn[disabled]:hover {
  transform: none;
}

.quiz-result {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-weight: 700;
}

.footer {
  color: var(--muted);
  font-size: 0.92rem;
}

.footer p {
  margin: 0;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
}

.legal-doc h2 {
  font-size: 1.05rem;
  margin: 1.3rem 0 0.4rem;
}

.legal-doc p {
  line-height: 1.65;
}

.checkin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.checkin-stats p {
  margin: 0;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf7;
  text-align: center;
}

.checkin-stats strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--accent);
}

.checkin-stats span {
  color: var(--muted);
  font-size: 0.82rem;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cal-title {
  margin: 0;
  font-size: 1.05rem;
}

.cal-nav {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 12px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-weekday,
.cal-day {
  min-height: 38px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}

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

.cal-day {
  border-radius: 10px;
  background: #fbfaf7;
}

.cal-day.is-empty {
  background: transparent;
}

.cal-day.is-checked {
  background: #d8efe4;
  color: var(--accent);
  font-weight: 700;
}

.cal-day.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.checkin-note,
.section-more,
.empty-state {
  margin: 14px 0 0;
  color: var(--muted);
}

.section-more {
  margin-bottom: 0;
}

.section-more a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.header .quiz-actions {
  margin-top: 14px;
}

.wrong-group + .wrong-group {
  margin-top: 22px;
}

.wrong-group h3 {
  margin-bottom: 10px;
}

.wrong-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf7;
}

.wrong-card + .wrong-card {
  margin-top: 12px;
}

.wrong-prompt {
  margin: 0;
  font-weight: 700;
}

.wrong-choices {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.wrong-choice {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
}

.wrong-choice em {
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.wrong-choice.is-chosen {
  border-color: #c9866a;
  background: #fff4ee;
}

.wrong-choice.is-correct {
  border-color: var(--accent);
  background: #e4f4ed;
}

.wrong-choice.is-correct em {
  color: var(--accent);
}

.wrong-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wrong-actions .btn {
  text-decoration: none;
}

.plan-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .plan-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.plan-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf7;
}

.plan-card.is-featured {
  border-color: var(--accent);
  background: #eef7f2;
}

.plan-name,
.plan-note {
  margin: 0;
  color: var(--muted);
}

.plan-name {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plan-price {
  margin: 4px 0;
  font-size: 2rem;
  font-weight: 750;
  line-height: 1.1;
}

.plan-card .waffo-pay {
  width: 100%;
  margin-top: 12px;
}

.pay-alt {
  font-size: 0.88rem;
}

.perk-list {
  margin: 16px 0 0;
  padding-left: 1.2em;
}

.perk-list li + li {
  margin-top: 6px;
}

.pay-steps-title {
  margin: 20px 0 0;
  font-size: 1rem;
}

.pay-steps {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.pay-steps li + li {
  margin-top: 6px;
}

.pay-note,
.unlock-status {
  margin: 16px 0 0;
  color: var(--muted);
}

.redeem-form {
  display: grid;
  gap: 8px;
}

.redeem-form label {
  font-weight: 700;
}

.terms-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 16px 0;
  font-weight: 400;
  line-height: 1.5;
}

.terms-consent input {
  width: 1.25rem;
  max-width: none;
  min-height: 1.25rem;
  margin-top: 0.2rem;
  flex: none;
}

.redeem-form input {
  width: 100%;
  max-width: 360px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.paywall-section {
  border-color: #d4b483;
  background: #fff8ee;
}

.paywall-section h2 {
  margin-bottom: 10px;
}

.paywall-section p {
  margin: 0 0 10px;
}

.paywall-section .quiz-actions {
  margin-top: 12px;
}

.paywall-section .btn {
  text-decoration: none;
}

@media (min-width: 720px) {
  .lesson-directory ol {
    columns: 2;
    column-gap: 28px;
  }

  .lesson-directory li {
    break-inside: avoid;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100%, calc(100% - 20px));
    margin-top: 14px;
  }

  .header,
  .nav,
  .site-nav,
  .dialogue-section,
  .quiz-section,
  .catalog-section,
  .checkin-section,
  .wrongbook-section,
  .pricing-section,
  .redeem-section,
  .paywall-section,
  .excerpt-section,
  .directory-section,
  .footer {
    padding: 18px 16px;
  }

  .checkin-stats strong {
    font-size: 1.35rem;
  }

  .checkin-stats span {
    font-size: 0.75rem;
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .level-progress-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .level-switcher,
  .catalog-filters {
    gap: 8px;
  }

  .filter-chip {
    padding: 8px 12px;
  }

  .lesson-pager {
    flex-direction: column;
    align-items: stretch;
  }

  .lesson-pager .btn,
  .lesson-pager .pager-placeholder {
    text-align: center;
  }
}
