/* ============================================================
   Tone Matrix — shared styles
   ============================================================ */

:root {
  --ink: #131f2b;
  --ink-2: #1c2b39;
  --ink-3: #26384a;
  --paper: #f7f4ee;
  --paper-2: #fbfaf6;
  --white: #ffffff;
  --accent: #c0392b;
  --accent-soft: #f4e4e0;
  --gold: #a9803e;
  --muted: #6e6a62;
  --muted-2: #96918a;
  --line: #ded7cb;
  --line-dark: #33475b;
  --ok: #2f6b5e;
  --warn: #c0392b;

  --sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Songti SC", "STSong", serif;

  --max: 1120px;
  --radius: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

p {
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
}

.kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* ---------------------------------------------------------- nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 244, 238, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand .zh {
  font-size: 17px;
}

.brand .en {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 13.5px;
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.18s ease, background 0.18s ease;
}

.nav-cta:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
  }
}

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease,
    border-color 0.18s ease;
}

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

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

.btn-primary:hover {
  background: #a93226;
}

.btn-dark {
  background: var(--ink);
  color: var(--paper);
}

.btn-dark:hover {
  background: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
}

.btn-sm {
  height: 42px;
  padding: 0 18px;
  font-size: 13.5px;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   Landing page
   ============================================================ */

.hero {
  padding: 76px 0 64px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 60px;
  align-items: center;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 5.6vw, 68px);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 18px 0 22px;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-size: 17px;
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 32px 0 22px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 12.5px;
  color: var(--muted);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

/* tone stack visual */
.tone-stack {
  position: relative;
  background: var(--ink);
  border-radius: 22px;
  padding: 30px 30px 24px;
  color: var(--paper);
  box-shadow: 0 30px 60px -30px rgba(19, 31, 43, 0.55);
}

.tone-stack::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.ts-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(247, 244, 238, 0.55);
  margin-bottom: 18px;
}

.ts-glyph {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.ts-glyph .hz {
  font-family: var(--serif);
  font-size: 62px;
  line-height: 1;
}

.ts-glyph .py {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: rgba(247, 244, 238, 0.6);
  padding-bottom: 10px;
}

.ts-rows {
  margin-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ts-row {
  display: grid;
  grid-template-columns: 24px 128px 1fr 26px;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ts-row:last-child {
  border-bottom: 0;
}

.ts-row .n {
  font-size: 11px;
  color: rgba(247, 244, 238, 0.45);
  letter-spacing: 0.08em;
}

.ts-row .lbl {
  font-size: 13px;
  color: rgba(247, 244, 238, 0.72);
}

.ts-row svg {
  width: 100%;
  height: 26px;
  overflow: visible;
}

.ts-row .mark {
  font-family: var(--serif);
  font-size: 24px;
  text-align: right;
  line-height: 1;
}

/* stat strip */
.strip {
  background: var(--ink);
  color: var(--paper);
}

.strip-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.strip-cell {
  background: var(--ink);
  padding: 26px 8px;
  text-align: center;
}

.strip-cell b {
  display: block;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 6px;
}

.strip-cell span {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247, 244, 238, 0.55);
}

@media (max-width: 760px) {
  .strip-inner {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* sections */
.section {
  padding: 84px 0;
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 48px;
  align-items: end;
  margin-bottom: 48px;
}

.section h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 500;
  letter-spacing: -0.025em;
  margin-top: 14px;
}

.section-head p {
  color: var(--muted);
  font-size: 15.5px;
  max-width: 46ch;
  padding-bottom: 4px;
}

@media (max-width: 860px) {
  .hero-grid,
  .section-head {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero {
    padding: 48px 0 44px;
  }

  .section {
    padding: 60px 0;
  }
}

/* pair cards */
.pairs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.pair {
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.pair:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.pair .side {
  min-width: 0;
}

.pair .zh {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.1;
}

.pair .py {
  font-size: 12.5px;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.pair .en {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.pair .arrow {
  color: var(--muted-2);
  font-size: 16px;
}

.pair .tag {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

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

/* matrices */
.matrices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.matrix {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px 24px;
  background: var(--paper-2);
}

.matrix .idx {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--gold);
  font-weight: 700;
}

.matrix h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  margin: 12px 0 4px;
}

.matrix .sub {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.matrix p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

@media (max-width: 860px) {
  .matrices {
    grid-template-columns: 1fr;
  }
}

/* curriculum */
.curriculum {
  border-top: 1px solid var(--ink);
}

.lesson {
  display: grid;
  grid-template-columns: 64px 1.3fr 2fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.lesson .num {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--accent);
}

.lesson h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.lesson .wk {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-top: 5px;
}

.lesson p {
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .lesson {
    grid-template-columns: 40px 1fr;
    gap: 14px;
  }

  .lesson p {
    grid-column: 2;
  }
}

/* included + pricing */
.pricing {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 18px;
  align-items: start;
}

.price-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px;
  background: var(--paper-2);
}

.price-card.dark {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.price-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}

.price-top h3 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.price-card.dark .badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--gold);
}

.amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 4px;
}

.amount .cur {
  font-size: 18px;
  color: var(--muted);
}

.price-card.dark .amount .cur {
  color: rgba(247, 244, 238, 0.55);
}

.amount .num {
  font-family: var(--serif);
  font-size: 58px;
  line-height: 1;
}

.amount .was {
  font-size: 15px;
  color: var(--muted-2);
  text-decoration: line-through;
}

.price-note {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
}

.price-card.dark .price-note {
  color: rgba(247, 244, 238, 0.6);
}

.includes {
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
  display: grid;
  gap: 11px;
}

.includes li {
  position: relative;
  padding-left: 26px;
  font-size: 14px;
  color: var(--ink);
}

.includes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 11px;
  height: 6px;
  border-left: 1.6px solid var(--accent);
  border-bottom: 1.6px solid var(--accent);
  transform: rotate(-45deg);
}

.price-card.dark .includes li {
  color: rgba(247, 244, 238, 0.86);
}

.price-card.dark .includes li::before {
  border-color: var(--gold);
}

.price-card.dark .price-top {
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 8px;
}

.price-card.dark .price-top h3 {
  font-size: 24px;
}

.price-card.dark .btn-ghost {
  color: var(--paper);
  border-color: rgba(255, 255, 255, 0.24);
}

.price-card.dark .btn-ghost:hover {
  border-color: var(--paper);
}

.price-card .btn {
  width: 100%;
}

.fineprint {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 12px;
  text-align: center;
}

@media (max-width: 860px) {
  .pricing {
    grid-template-columns: 1fr;
  }
}

/* quote */
.quote {
  padding: 64px 0;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.quote blockquote {
  margin: 0 auto;
  max-width: 760px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.8vw, 30px);
  font-style: italic;
  line-height: 1.4;
  color: var(--ink);
}

.quote cite {
  display: block;
  margin-top: 18px;
  font-family: var(--sans);
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* faq */
.faq {
  max-width: 820px;
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-size: 20px;
  font-weight: 400;
  color: var(--muted-2);
  transition: transform 0.2s ease;
}

.faq details[open] summary::after {
  content: "–";
}

.faq details p {
  padding: 0 0 22px;
  color: var(--muted);
  font-size: 14.5px;
  max-width: 66ch;
}

/* final cta */
.final {
  padding: 92px 0;
  background: var(--ink);
  color: var(--paper);
}

.final h2 {
  font-family: var(--serif);
  font-size: clamp(34px, 4.6vw, 56px);
  font-weight: 500;
  max-width: 16ch;
  letter-spacing: -0.03em;
}

.final p {
  color: rgba(247, 244, 238, 0.62);
  margin-top: 18px;
  max-width: 46ch;
}

.final .hero-actions {
  margin-top: 32px;
}

.final .btn-ghost {
  color: var(--paper);
  border-color: rgba(255, 255, 255, 0.24);
}

.final .btn-ghost:hover {
  border-color: var(--paper);
}

/* footer */
.footer {
  padding: 44px 0 54px;
  background: var(--ink);
  color: rgba(247, 244, 238, 0.5);
  font-size: 12.5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.footer a:hover {
  color: var(--paper);
}

.footer .brand {
  color: var(--paper);
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--paper);
  padding: 13px 20px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.5);
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============================================================
   Tone test (dark tool)
   ============================================================ */

body.tool {
  background: var(--ink);
  color: var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tool-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tool-head .nav-inner {
  height: 62px;
}

.tool-head .brand .en {
  color: rgba(247, 244, 238, 0.45);
}

.tool-head .back {
  font-size: 12.5px;
  color: rgba(247, 244, 238, 0.55);
  letter-spacing: 0.04em;
}

.tool-head .back:hover {
  color: var(--paper);
}

.tool-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 24px 64px;
}

@media (max-width: 700px) {
  .tool-main {
    padding-top: 30px;
  }
}

.screen {
  display: none;
  width: 100%;
  max-width: 780px;
}

.screen.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* intro */
.intro {
  text-align: center;
}

.intro .kicker {
  color: var(--gold);
}

.intro h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 4.6vw, 52px);
  font-weight: 500;
  margin: 18px auto 18px;
  max-width: 20ch;
  letter-spacing: -0.03em;
}

.intro p {
  color: rgba(247, 244, 238, 0.62);
  max-width: 54ch;
  margin: 0 auto 30px;
  font-size: 15px;
}

.intro .meta {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247, 244, 238, 0.4);
  margin-top: 26px;
}

.text-link {
  background: none;
  border: 0;
  color: rgba(247, 244, 238, 0.55);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  margin-top: 22px;
  font-family: var(--sans);
}

.text-link:hover {
  color: var(--paper);
}

/* test */
.test-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 244, 238, 0.4);
  margin-bottom: 14px;
}

.progress {
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 34px;
}

.progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.4s ease;
}

.card {
  --word-size: clamp(84px, 14vw, 132px);
  background: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 34px 34px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.card .word {
  font-family: var(--serif);
  font-size: var(--word-size);
  line-height: 1;
  letter-spacing: 0.02em;
}

.card .pinyin {
  font-size: var(--word-size);
  line-height: 1.05;
  color: var(--gold);
  letter-spacing: 0.02em;
  margin-top: 8px;
}

.card .meaning {
  font-size: 13px;
  color: rgba(247, 244, 238, 0.5);
  margin-top: 4px;
}

.card .hint {
  display: inline-block;
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247, 244, 238, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 7px 12px;
  border-radius: 999px;
}

.rec-zone {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.rec-btn {
  width: 96px;
  height: 96px;
  cursor: default;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.rec-btn .inner {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.2s ease, border-radius 0.35s ease, background 0.2s ease;
}

.rec-btn.recording .inner {
  border-radius: 10px;
  transform: scale(0.72);
  background: var(--paper);
}

.rec-btn.recording {
  border-color: var(--accent);
}

.rec-ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  opacity: 0;
}

.rec-btn.recording .rec-ring {
  opacity: 1;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.rec-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 244, 238, 0.45);
  min-height: 18px;
}

.level {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 30px;
}

.level i {
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 2px;
  transition: height 0.08s linear, background 0.2s ease;
}

.level.active i {
  background: var(--accent);
}

.result-chip {
  margin-top: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(247, 244, 238, 0.8);
}

.result-chip.show {
  display: flex;
}

.result-chip b {
  font-size: 18px;
  color: var(--paper);
}

.contour-preview {
  margin: 18px auto 0;
  display: none;
  width: 300px;
  max-width: 100%;
}

.contour-preview.show {
  display: block;
}

.contour-preview canvas {
  width: 100%;
  height: 90px;
}

/* results */
.results-head {
  text-align: center;
  margin-bottom: 30px;
}

.results-head h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  margin-top: 10px;
}

.score-ring {
  width: 200px;
  height: 200px;
  margin: 0 auto 8px;
  position: relative;
}

.score-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-ring .num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 64px;
  line-height: 1;
}

.score-ring .num small {
  font-family: var(--sans);
  font-size: 12px;
  color: rgba(247, 244, 238, 0.4);
  display: block;
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.1em;
}

.verdict {
  text-align: center;
  font-size: 15px;
  color: rgba(247, 244, 238, 0.72);
  max-width: 52ch;
  margin: 0 auto 34px;
}

.tone-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}

.tone-bar {
  background: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 14px 12px;
}

.tone-bar .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.tone-bar .t {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247, 244, 238, 0.45);
}

.tone-bar .s {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
}

.tone-bar .track {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.tone-bar .track i {
  display: block;
  height: 100%;
  background: var(--gold);
  width: 0;
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.items {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.item {
  display: grid;
  grid-template-columns: 64px 1fr 120px 60px;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.item .w {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  white-space: nowrap;
}

.item .w.long {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.item .p {
  font-size: 12px;
  color: rgba(247, 244, 238, 0.55);
}

.item canvas {
  width: 120px;
  height: 34px;
}

.item .sc {
  text-align: right;
  font-size: 13px;
  color: rgba(247, 244, 238, 0.75);
}

.item .sc b {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--paper);
}

.item.bad .sc b {
  color: #e0796b;
}

.insight {
  margin: 28px 0 0;
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 18px;
  font-size: 14px;
  color: rgba(247, 244, 238, 0.72);
}

.insight b {
  color: var(--paper);
}

.results-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 32px;
}

.results-actions .btn {
  width: 100%;
  min-width: 0;
}

.hint-line {
  text-align: center;
  margin-top: 20px;
  font-size: 12.5px;
  color: rgba(247, 244, 238, 0.38);
}

.tool-foot {
  text-align: center;
  font-size: 11.5px;
  color: rgba(247, 244, 238, 0.3);
  padding: 0 24px 30px;
}

@media (max-width: 640px) {
  .card {
    padding: 26px 20px;
  }

  .tone-bars {
    grid-template-columns: repeat(2, 1fr);
  }

  .item {
    grid-template-columns: 48px 1fr 60px;
  }

  .item canvas {
    display: none;
  }

  .score-ring {
    width: 170px;
    height: 170px;
  }
}

/* error */
.error-box {
  background: rgba(192, 57, 43, 0.12);
  border: 1px solid rgba(192, 57, 43, 0.35);
  color: #f0b7ae;
  padding: 16px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  margin-top: 22px;
  display: none;
}

.error-box.show {
  display: block;
}

/* hero tone words */
.ts-words {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 4px 0 18px;
}

.ts-words > div {
  text-align: center;
  padding: 10px 0 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ts-words .hz {
  display: block;
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1;
}

.ts-words .py {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(247, 244, 238, 0.55);
}

@media (max-width: 420px) {
  .ts-words .hz {
    font-size: 34px;
  }
}

@media (max-width: 520px) {
  .ts-row {
    grid-template-columns: 22px 1fr 64px;
  }

  .ts-row .mark {
    display: none;
  }
}

body.tool .btn-ghost {
  color: var(--paper);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-outline {
  background: transparent;
  color: #e0564a;
  border-color: rgba(224, 86, 74, 0.45);
}

.btn-outline:hover {
  background: rgba(192, 57, 43, 0.12);
  border-color: #e0564a;
}

body.tool .btn-ghost:hover {
  border-color: var(--paper);
}

/* ============================================================
   Setup, practice picker, word grid
   ============================================================ */

.setup-intro {
  text-align: center;
  max-width: 660px;
  margin: 0 auto 30px;
}

.setup-intro h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 16px auto 14px;
  max-width: 20ch;
}

.setup-intro p {
  color: rgba(247, 244, 238, 0.6);
  font-size: 14.5px;
  max-width: 52ch;
  margin: 0 auto;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: max-content;
  margin: 0 auto 28px;
}

.segmented button {
  border: 0;
  background: transparent;
  color: rgba(247, 244, 238, 0.6);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 22px;
  border-radius: 999px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--paper);
  color: var(--ink);
}

.setup-panel {
  max-width: 640px;
  margin: 0 auto;
}

.field {
  margin-bottom: 22px;
}

.field > label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 244, 238, 0.42);
  margin-bottom: 10px;
}

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

.chips button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(247, 244, 238, 0.78);
  border-radius: 999px;
  padding: 9px 15px;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chips button span {
  color: rgba(247, 244, 238, 0.35);
  font-size: 11px;
  margin-left: 3px;
}

.chips button:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.chips button.active {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}

.chips button.active span {
  color: var(--muted);
}

.chips button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.field-note {
  font-size: 12px;
  color: rgba(247, 244, 238, 0.38);
  margin-top: 10px;
}

.btn.wide {
  width: 100%;
  max-width: 320px;
  margin: 6px auto 0;
  display: flex;
}

#demo-btn {
  display: block;
  margin: 24px auto 0;
}

.privacy-line {
  text-align: center;
  font-size: 11px;
  color: rgba(247, 244, 238, 0.28);
  margin-top: 24px;
}

/* picker */
.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
}

.picker-head h2 {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  margin-top: 8px;
}

.tone-filter {
  margin-bottom: 6px;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin-top: 16px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 6px;
}

.word-chip {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 10px 6px;
  cursor: pointer;
  color: var(--paper);
  font-family: var(--sans);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.word-chip:hover {
  border-color: var(--accent);
  background: rgba(192, 57, 43, 0.08);
}

.word-chip .zh {
  display: block;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.2;
}

.word-chip .py {
  display: block;
  font-size: 10.5px;
  color: rgba(247, 244, 238, 0.45);
  margin-top: 3px;
}

/* practice */
.practice-tools {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: rgba(247, 244, 238, 0.75);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.listen-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.listen-btn .spk {
  font-size: 9px;
}

.feedback {
  list-style: none;
  padding: 0;
  margin: 16px auto 0;
  max-width: 440px;
  text-align: left;
}

.feedback li {
  position: relative;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(247, 244, 238, 0.72);
  padding: 5px 0 5px 16px;
}

.feedback li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.practice-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.practice-actions .btn {
  flex: 1 1 auto;
  min-width: 0;
}

.card .word.long {
  font-size: clamp(52px, 8vw, 82px);
}

.card .pinyin.long {
  font-size: clamp(52px, 8vw, 82px);
}

.item .meta .tones {
  font-size: 12px;
  color: rgba(247, 244, 238, 0.55);
  margin-top: 2px;
}

@media (max-width: 640px) {
  .practice-actions {
    flex-direction: column;
  }

  .word-grid {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    max-height: none;
  }

  .picker-head {
    align-items: center;
  }

  .picker-head h2 {
    font-size: 26px;
  }
}

.results-footer {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.results-footer .btn {
  width: 100%;
  min-width: 0;
}

@media (max-width: 620px) {
  .results-actions,
  .results-footer {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .results-footer {
    margin-top: 18px;
    padding-top: 18px;
  }
}

.practice-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.voice-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(247, 244, 238, 0.7);
  border-radius: 999px;
  padding: 8px 28px 8px 14px;
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  max-width: 220px;
  background-image: linear-gradient(45deg, transparent 50%, rgba(247, 244, 238, 0.5) 50%),
    linear-gradient(135deg, rgba(247, 244, 238, 0.5) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.voice-select:hover {
  border-color: var(--gold);
}

.voice-select option {
  background: #1c2b39;
  color: #f7f4ee;
}
