:root {
  --page-bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #1e2530;
  --subtle: #6d7482;
  --line: #dde3ec;
  --shadow: 0 18px 48px rgba(28, 39, 61, 0.08);
  --green: #49af53;
  --green-deep: #32923e;
  --orange: #f29a2e;
  --orange-soft: #fff2dc;
  --brown: #9d6b45;
  --blue: #4388d8;
  --gold: #c8a337;
  --active-theme: var(--green);
  --active-theme-soft: #eff8e9;
  --active-theme-deep: #2f8b39;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(
      circle at top left,
      color-mix(in srgb, var(--active-theme) 18%, transparent) 0%,
      transparent 32%
    ),
    linear-gradient(180deg, #eef2f8 0%, #f7f8fb 100%);
}

body[data-theme="orange"] {
  --active-theme: var(--orange);
  --active-theme-soft: #fff1dd;
  --active-theme-deep: #c97412;
}

body[data-theme="brown"] {
  --active-theme: var(--brown);
  --active-theme-soft: #f5e9df;
  --active-theme-deep: #7b4c28;
}

body[data-theme="green"] {
  --active-theme: var(--green);
  --active-theme-soft: #eff8e9;
  --active-theme-deep: #2f8b39;
}

body[data-theme="blue"] {
  --active-theme: var(--blue);
  --active-theme-soft: #e8f1fe;
  --active-theme-deep: #2f68b3;
}

body[data-theme="gold"] {
  --active-theme: var(--gold);
  --active-theme-soft: #fbf1d7;
  --active-theme-deep: #9d7712;
}

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

a {
  color: inherit;
}

#app {
  min-height: 100vh;
}

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

.hero {
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(
      140deg,
      color-mix(in srgb, var(--active-theme) 88%, white) 0%,
      var(--active-theme) 58%,
      color-mix(in srgb, var(--active-theme) 88%, black 4%) 100%
    );
  color: #fffef9;
  padding: 48px 24px 116px;
}

body[data-page="home"] .hero {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.22), transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(255, 255, 255, 0.16), transparent 22%),
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--orange) 88%, white) 0%,
      color-mix(in srgb, var(--brown) 72%, var(--orange) 28%) 24%,
      color-mix(in srgb, var(--green) 84%, white) 47%,
      color-mix(in srgb, var(--blue) 84%, white) 73%,
      color-mix(in srgb, var(--gold) 86%, white) 100%
    );
}

.hero__content,
.selector-panel,
.practice-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
}

.hero__mark {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hero h1 {
  margin: 18px 0 10px;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1.06;
}

.hero__subtitle {
  max-width: 600px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
}

.selector-panel {
  margin-top: -82px;
  padding-bottom: 52px;
}

.selector-panel--levels {
  margin-top: -84px;
}

.hero--compact {
  padding-bottom: 92px;
}

.selector-panel__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.selector-panel--levels .selector-panel__header {
  align-items: end;
}

.section-label {
  margin: 0 0 10px;
  color: #fffef9;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.selector-panel__header h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  color: #fffef9;
}

.selector-panel__note {
  max-width: 320px;
  margin: 12px 0 0;
  color: #fffef9;
  line-height: 1.55;
}

.certificate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.certificate-card,
.feature-panel,
.level-card,
.practice-topbar,
.mode-card,
.sentence-card,
.input-card,
.keyword-card {
  background: var(--panel);
  border: 1px solid rgba(30, 37, 48, 0.06);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.certificate-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.feature-panel {
  position: relative;
  overflow: hidden;
  padding: 24px 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 252, 246, 0.98)),
    #ffffff;
}

.feature-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: linear-gradient(
    180deg,
    var(--orange) 0%,
    var(--brown) 24%,
    var(--green) 48%,
    var(--blue) 74%,
    var(--gold) 100%
  );
}

.level-card {
  --theme-color: var(--active-theme);
  padding: 22px;
}

.certificate-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--theme-color, var(--green));
}

.certificate-card--orange {
  --theme-color: var(--orange);
}

.certificate-card--brown {
  --theme-color: var(--brown);
}

.certificate-card--green {
  --theme-color: var(--green);
}

.certificate-card--blue {
  --theme-color: var(--blue);
}

.certificate-card--gold {
  --theme-color: var(--gold);
}

.certificate-card__chip {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-color) 12%, white);
  color: color-mix(in srgb, var(--theme-color) 88%, black);
  font-weight: 700;
}

.feature-panel__eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f1f3f7 0%, #e5e9f0 100%);
  color: #5f6b7a;
  font-weight: 800;
}

.level-card__badge {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--active-theme-deep);
  background: var(--active-theme-soft);
  font-weight: 700;
}

.certificate-card h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
}

.feature-panel h3 {
  margin: 0 0 12px;
  font-size: 1.42rem;
}

.level-card h2 {
  margin: 0 0 10px;
  font-size: 1.72rem;
}

.certificate-card p {
  margin: 0;
  color: var(--subtle);
  line-height: 1.6;
}

.feature-panel__list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 1.4rem;
  color: #445062;
  line-height: 1.7;
}

.feature-panel__list li::marker {
  color: #5f6b7a;
  font-weight: 800;
}

.feature-panel__subnote {
  display: inline-block;
  margin-top: 6px;
  color: #7b8491;
  font-size: 0.94rem;
  line-height: 1.65;
}

.level-card p {
  margin: 0;
  color: var(--subtle);
  line-height: 1.7;
}

.certificate-card__button,
.mode-pill,
.audio-row button,
.next-row button,
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
}

.certificate-card__button {
  min-width: 110px;
  margin-top: 16px;
  padding: 10px 16px;
  border: 0;
  text-decoration: none;
  color: #ffffff;
  background: var(--theme-color, var(--green));
}

.certificate-card__button.is-disabled {
  color: #717988;
  background: #eceff4;
}

.practice-shell {
  padding: 14px 0 36px;
}

.practice-topbar,
.mode-card,
.sentence-card,
.input-card,
.keyword-card,
.progress-track,
.next-row {
  margin-bottom: 10px;
}

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

.practice-filter__pill {
  display: inline-flex;
  align-items: center;
  min-width: 112px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #7a8493;
  background: #ffffff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 10px;
}

.stat-box {
  text-align: center;
}

.stat-box strong {
  display: block;
  color: var(--active-theme);
  font-size: clamp(1.02rem, 2vw, 1.34rem);
  font-weight: 800;
}

.stat-box span {
  color: var(--subtle);
  font-size: 0.72rem;
}

.mode-card,
.sentence-card,
.input-card,
.keyword-card {
  padding: 12px 14px;
}

.mode-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mode-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-pill {
  padding: 6px 10px;
  background: #eff3f7;
}

.mode-pill--soft {
  color: var(--active-theme-deep);
  background: color-mix(in srgb, var(--active-theme) 12%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--active-theme) 18%, white);
}

.back-link {
  padding: 8px 12px;
  text-decoration: none;
  color: #476170;
  background: #f2f5f8;
}

.sentence-card {
  border-left: 5px solid var(--active-theme);
}

.sentence-row {
  margin-bottom: 10px;
}

.sentence-row:last-child {
  margin-bottom: 12px;
}

.sentence-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.sentence-row__label {
  color: #526070;
  font-size: 0.78rem;
  font-weight: 700;
}

.sentence-row__text {
  margin: 0;
  font-size: clamp(0.98rem, 1.7vw, 1.24rem);
  line-height: 1.45;
  word-break: break-word;
}

.sentence-row__text.is-hidden {
  color: #8e97a6;
  font-style: italic;
}

.eye-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #516072;
  cursor: pointer;
}

.eye-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eye-icon--off {
  color: #8d96a4;
}

.sentence-text {
  margin: 0 0 8px;
  font-size: clamp(0.98rem, 1.8vw, 1.28rem);
  line-height: 1.42;
  word-break: break-word;
}

.sentence-meaning {
  margin: 0 0 10px;
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.45;
}

.sentence-char--correct {
  color: var(--ink);
}

.sentence-char--incorrect {
  color: #d84c4c;
  background: rgba(216, 76, 76, 0.12);
  border-radius: 6px;
}

.sentence-char--pending {
  color: var(--ink);
}

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

.audio-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.audio-row button {
  border: 0;
  padding: 7px 11px;
  color: #ffffff;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--active-theme) 96%, white),
    color-mix(in srgb, var(--active-theme) 88%, black 8%)
  );
  cursor: pointer;
}

.audio-row button:hover {
  filter: brightness(1.03);
}

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

.accent-pill {
  border: 1px solid color-mix(in srgb, var(--active-theme) 22%, white);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--active-theme-deep);
  background: color-mix(in srgb, var(--active-theme) 10%, white);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.accent-pill--active {
  color: #ffffff;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--active-theme) 96%, white),
    color-mix(in srgb, var(--active-theme) 88%, black 8%)
  );
  border-color: transparent;
}

.audio-message {
  min-height: 1.25rem;
  margin: 12px 0 0;
  color: #8e5e1c;
  font-size: 0.94rem;
}

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

.progress-value {
  height: 100%;
  width: 0;
  background: linear-gradient(
    90deg,
    var(--active-theme),
    color-mix(in srgb, var(--active-theme) 68%, white)
  );
}

.input-card textarea {
  width: 100%;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  resize: vertical;
  background: #ffffff;
}

.input-card textarea:focus {
  outline: 3px solid rgba(47, 141, 237, 0.16);
  border-color: #7daee6;
}

.nav-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}

.nav-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  font: inherit;
  font-weight: 700;
}

.nav-button--secondary {
  color: #556273;
  background: #e7ebf1;
}

.nav-button--secondary:disabled {
  color: #98a1ae;
  background: #eff2f6;
}

.nav-button--primary {
  color: #ffffff;
  background: #b8bec8;
}

.nav-button--primary:not([disabled]) {
  cursor: pointer;
  background: #969daa;
}

.next-row {
  display: flex;
  justify-content: center;
}

.next-row button {
  border: 0;
  padding: 14px 28px;
  color: #ffffff;
  background: #b8bec8;
}

.next-row button:not([disabled]) {
  cursor: pointer;
  background: #969daa;
}

.keyword-card {
  background: var(--orange-soft);
  border-left: 5px solid var(--orange);
}

.keyword-card h2 {
  margin: 0 0 16px;
  color: #a75c00;
  font-size: 1.2rem;
}

.keyword-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.keyword-list li {
  color: #5b4934;
  line-height: 1.7;
}

.keyword-word {
  font-weight: 800;
  color: #d45d24;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.levels-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.levels-main {
  min-width: 0;
}

.site-footer {
  width: min(960px, calc(100% - 32px));
  margin: 12px auto 40px;
  padding: 18px 20px 0;
  border-top: 1px solid rgba(30, 37, 48, 0.08);
  color: var(--subtle);
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 18px;
}

.site-footer__nav a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.site-footer__nav a:hover,
.site-footer__nav a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

.info-shell {
  width: min(960px, calc(100% - 32px));
  margin: 56px auto 24px;
}

.info-page {
  padding: 36px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(30, 37, 48, 0.06);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.info-page__eyebrow {
  margin: 0 0 12px;
  color: var(--active-theme-deep);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.info-page h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
}

.info-page__lead {
  margin: 0 0 28px;
  color: var(--subtle);
  font-size: 1.02rem;
  line-height: 1.75;
}

.info-section + .info-section {
  margin-top: 28px;
}

.info-section h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.info-section p,
.info-section li {
  color: var(--ink);
  line-height: 1.8;
}

.info-section ul {
  margin: 14px 0 0;
  padding-left: 20px;
}

.contact-placeholder {
  padding: 18px 20px;
  border: 1px solid rgba(30, 37, 48, 0.08);
  border-radius: 20px;
  background: color-mix(in srgb, var(--active-theme-soft) 78%, white);
}

@media (max-width: 860px) {
  .selector-panel__header,
  .practice-topbar,
  .mode-card {
    flex-direction: column;
    align-items: stretch;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (min-width: 980px) {
  .certificate-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .feature-panel {
    grid-column: 2 / span 3;
    min-height: 100%;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 56px 18px 140px;
  }

  .hero__content,
  .selector-panel,
  .practice-shell {
    width: min(100% - 20px, 1120px);
  }

  .mode-card,
  .sentence-card,
  .input-card,
  .keyword-card,
  .practice-topbar {
    padding: 18px;
  }

  .stats {
    gap: 12px;
  }

  .audio-row {
    flex-direction: column;
  }

  .nav-row {
    flex-direction: column;
  }

  .site-footer,
  .info-shell {
    width: min(100% - 20px, 1120px);
  }

  .info-page {
    padding: 24px 20px;
  }
}
