:root {
  color-scheme: light;
  --cream: #fbf7f0;
  --surface: #ffffff;
  --surface-muted: #f3eee4;
  --ink: #2e2a26;
  --muted: #6b6157;
  --mint-action: #28776f;
  --mint-soft: #d9f0ec;
  --coral-deep: #a64f3c;
  --coral-soft: #ffe6dc;
  --gold: #f4b860;
  --gold-deep: #805817;
  --gold-soft: #ffefd5;
  --line: #e8e0d5;
  --on-accent: #ffffff;
  --accent: var(--mint-action);
  --accent-soft: var(--mint-soft);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
}

:root[data-site-theme="dark"] {
  color-scheme: dark;
  --cream: #101714;
  --surface: #1b2723;
  --surface-muted: #22312c;
  --ink: #f7f1e8;
  --muted: #c3b9ad;
  --mint-action: #85e0d4;
  --mint-soft: #1a3b36;
  --coral-deep: #ffb199;
  --coral-soft: #482c27;
  --gold: #f3bd62;
  --gold-deep: #f6cc80;
  --gold-soft: #3e311e;
  --line: #33423d;
  --on-accent: #15201d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, var(--gold-soft) 0 5%, transparent 22%),
    radial-gradient(circle at 88% 26%, var(--mint-soft) 0 7%, transparent 25%),
    var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body[data-section="medial"] { --accent: var(--coral-deep); --accent-soft: var(--coral-soft); }
body[data-section="final"],
body[data-section="blend"] { --accent: var(--gold-deep); --accent-soft: var(--gold-soft); }

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 18px;
  top: 12px;
  z-index: 100;
  min-height: 48px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 4px;
}

.practice-header {
  width: min(1100px, calc(100% - 40px));
  min-height: 80px;
  margin: 12px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.practice-brand {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.practice-brand img { width: 48px; height: 48px; border-radius: 14px; }
.practice-brand > span { display: grid; line-height: 1.15; }
.practice-brand strong { font-size: 17px; font-weight: 900; }
.practice-brand small { margin-top: 4px; color: var(--accent); font-size: 12px; font-weight: 800; }

.back-home {
  min-height: 48px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.practice-main {
  width: min(1060px, calc(100% - 40px));
  margin: 22px auto 64px;
}

.lesson-heading {
  padding: 10px 4px 26px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
}

.eyebrow span { margin-right: 5px; font-size: 9px; vertical-align: 2px; }

.lesson-heading h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: -.055em;
}

.lesson-heading > div:first-child > p:last-child {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 650;
}

.symbol-count {
  min-width: 86px;
  padding: 12px 15px;
  display: grid;
  justify-items: center;
  border-radius: 22px;
  background: var(--accent-soft);
  color: var(--accent);
}

.symbol-count strong { font-size: 27px; font-weight: 950; line-height: 1; }
.symbol-count span { margin-top: 5px; font-size: 12px; font-weight: 900; }

.lesson-tabs {
  margin-bottom: 14px;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 76%, transparent);
}

.lesson-tab {
  min-height: 56px;
  padding: 7px 10px;
  display: grid;
  place-items: center;
  gap: 1px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
}

.lesson-tab small { font-size: 12px; font-weight: 800; opacity: .78; }
.lesson-tab.is-active { background: var(--accent); color: var(--on-accent); }

.symbol-lesson,
.blend-lesson {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(360px, .97fr);
  gap: 14px;
}

.symbol-focus,
.blend-stage {
  min-width: 0;
  min-height: 510px;
  padding: clamp(22px, 4vw, 38px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: 34px;
  background: color-mix(in srgb, var(--accent-soft) 82%, var(--surface));
}

.focus-label { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.focus-label span { color: var(--accent); font-size: 18px; font-weight: 900; }
.focus-label small { color: var(--muted); font-size: 13px; font-weight: 750; }

.symbol-rings {
  position: relative;
  min-height: 245px;
  margin-block: 4px 0;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.symbol-rings::before,
.symbol-rings::after {
  position: absolute;
  z-index: -1;
  width: min(225px, 64vw);
  aspect-ratio: 1;
  border: 8px solid color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 50%;
  content: "";
}

.symbol-rings::after {
  width: min(160px, 46vw);
  border-color: color-mix(in srgb, var(--accent) 12%, transparent);
}

.symbol-rings strong {
  color: var(--accent);
  font-size: clamp(116px, 16vw, 172px);
  font-weight: 900;
  line-height: 1;
  transition: opacity 150ms ease, transform 180ms ease;
}

.symbol-rings strong.is-changing { opacity: 0; transform: scale(.86); }

.listen-prompt { margin: 0 0 10px; color: var(--muted); text-align: center; font-size: 13px; font-weight: 800; }

.audio-source-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }

.audio-source {
  min-height: 56px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.audio-source span {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 10px;
}

.audio-source.is-selected { background: var(--accent); color: var(--on-accent); }
.audio-source.is-selected span { background: color-mix(in srgb, var(--surface) 22%, transparent); }

.audio-status { min-height: 22px; margin: 9px 0 0; color: var(--muted); text-align: center; font-size: 12px; font-weight: 750; }

.symbol-picker,
.blend-controls {
  min-width: 0;
  min-height: 510px;
  padding: clamp(22px, 3.2vw, 32px);
  display: flex;
  flex-direction: column;
  border-radius: 34px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.picker-heading,
.blend-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.picker-heading > div { display: flex; align-items: center; gap: 8px; }
.picker-heading > div > span { color: var(--accent); }
.picker-heading strong, .blend-heading strong { font-size: 16px; font-weight: 900; }
.picker-heading small, .blend-heading small { color: var(--muted); font-size: 12px; font-weight: 800; }

.symbol-group {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.symbol-choice {
  min-height: 54px;
  border: 0;
  border-radius: 17px;
  background: var(--surface-muted);
  color: var(--accent);
  cursor: pointer;
  font-size: 27px;
  font-weight: 900;
}

.symbol-choice:hover { background: var(--accent-soft); }
.symbol-choice.is-selected { background: var(--accent); color: var(--on-accent); }

.next-symbol,
.next-blend-step {
  min-height: 58px;
  margin-top: auto;
  padding: 13px 20px;
  border: 0;
  border-radius: 18px;
  background: var(--gold);
  color: #3b2b12;
  cursor: pointer;
  font-size: 16px;
  font-weight: 950;
}

.next-symbol span,
.next-blend-step span { margin-left: 8px; }

.blend-stage { justify-content: center; }
.blend-target { display: grid; justify-items: center; }

.step-cue {
  padding: 7px 13px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.blend-target > strong { margin-top: 9px; color: var(--accent); font-size: clamp(112px, 15vw, 164px); line-height: 1; }
.blend-reading { margin-top: 3px; color: var(--ink); font-size: 27px; font-weight: 900; letter-spacing: .08em; }

.sound-path {
  min-height: 92px;
  margin: 24px 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sound-step {
  min-width: 82px;
  padding: 10px 12px;
  display: grid;
  justify-items: center;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--muted);
  opacity: .42;
}

.sound-step.is-visible { color: var(--accent); opacity: 1; }
.sound-step strong { font-size: 28px; line-height: 1.1; }
.sound-step small { margin-top: 4px; font-size: 12px; font-weight: 850; }

.sound-plus { color: var(--muted); font-weight: 900; opacity: .5; }

.play-parts {
  min-height: 52px;
  border: 0;
  border-radius: 17px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 900;
}

.parts-note { margin: 10px auto 0; max-width: 370px; color: var(--muted); text-align: center; font-size: 12px; font-weight: 650; }

.example-strip {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.example-choice {
  min-height: 64px;
  padding: 7px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 17px;
  background: var(--surface-muted);
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
}

.example-choice small { color: var(--muted); font-size: 13px; font-weight: 800; }
.example-choice.is-selected { background: var(--accent); color: var(--on-accent); }
.example-choice.is-selected small { color: inherit; opacity: .78; }

.practice-note {
  margin-top: 20px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.practice-note img { width: 88px; height: 88px; border-radius: 30px 38px 28px 34px; }
.practice-note p { margin: 0; display: grid; }
.practice-note strong { font-size: 17px; }
.practice-note span { margin-top: 4px; color: var(--muted); font-size: 14px; font-weight: 650; }

.practice-footer {
  width: min(1060px, calc(100% - 40px));
  margin: 0 auto;
  padding: 25px 4px 38px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.practice-footer p { max-width: 650px; margin: 0; }
.practice-footer nav { display: flex; flex-wrap: wrap; justify-content: end; gap: 14px; }
.practice-footer a { color: var(--accent); font-weight: 800; }
.practice-footer nav a { min-height: 48px; display: inline-flex; align-items: center; }

[hidden] { display: none !important; }

@media (max-width: 820px) {
  .symbol-lesson, .blend-lesson { grid-template-columns: minmax(0, 1fr); }
  .symbol-focus, .blend-stage, .symbol-picker, .blend-controls { min-height: auto; }
  .next-symbol, .next-blend-step { margin-top: 22px; }
  .symbol-group { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .practice-footer { flex-direction: column; }
  .practice-footer nav { justify-content: start; }
}

@media (max-width: 580px) {
  .practice-header, .practice-main, .practice-footer { width: min(100% - 24px, 520px); }
  .practice-header { min-height: 68px; margin-top: 5px; }
  .practice-brand img { width: 42px; height: 42px; border-radius: 12px; }
  .practice-brand strong { font-size: 15px; }
  .back-home { min-height: 48px; padding-inline: 14px; font-size: 12px; }
  .practice-main { margin-top: 10px; }
  .lesson-heading { align-items: center; padding-bottom: 18px; }
  .lesson-heading h1 { font-size: clamp(34px, 11vw, 46px); }
  .lesson-heading > div:first-child > p:last-child { font-size: 14px; }
  .symbol-count { min-width: 68px; padding: 10px; border-radius: 18px; }
  .symbol-count strong { font-size: 23px; }
  .lesson-tabs { gap: 5px; padding: 5px; border-radius: 20px; }
  .lesson-tab { min-height: 54px; padding-inline: 5px; border-radius: 16px; font-size: 13px; }
  .lesson-tab small { font-size: 12px; }
  .symbol-focus, .blend-stage, .symbol-picker, .blend-controls { padding: 20px 16px; border-radius: 27px; }
  .symbol-rings { min-height: 220px; }
  .symbol-rings strong { font-size: 124px; }
  .audio-source-actions { grid-template-columns: 1fr; }
  .audio-source { min-height: 52px; }
  .symbol-group { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
  .symbol-choice { min-height: 51px; border-radius: 15px; font-size: 25px; }
  .example-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .example-choice { min-width: 68px; scroll-snap-align: start; }
  .practice-note { padding: 15px; border-radius: 24px; }
  .practice-note img { width: 66px; height: 66px; }
  .practice-note span { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
