/* WenWen landing page + web onboarding. Colours and shapes copy the app's theme (app/src/lib/theme.tsx). */

:root {
  --bg: #f4ecdf;
  --surface: #ffffff;
  --text: #13213d;
  --muted: #5c667c;
  --border: #e6d9c4;
  --primary: #c8372d;
  --primary-shadow: #9e2a22;
  --primary-text: #fffaf2;
  --blue: #1f3a6b;
  --blue-shadow: #13213d;
  --gold: #d9a23a;
  --gold-shadow: #b5832a;
  --success: #3e8e5a;
  --danger: #a8231c;
  --primary-tint: #c8372d17;
  --blue-tint: #1f3a6b14;
  --gold-tint: #d9a23a22;
  --success-tint: #3e8e5a1f;
  --danger-tint: #a8231c1a;
  --new-word: #dfe5f0;
  --narrate-word: #f0cf7e;
  --ai-gradient: linear-gradient(135deg, #1f3a6b, #6b3a6e 55%, #c8372d);
  --art-bg: #fcf7f1;
  --radius: 16px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hanzi: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color-scheme: light;
}


* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 600 16px/1.5 var(--font);
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--blue); font-weight: 800; }
button { font: inherit; color: inherit; }
.hanzi { font-family: var(--hanzi); font-weight: 500; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }

/* ---------- Shared pieces ---------- */

/* The Duolingo "chunky" card: 2px outline with a thicker bottom ledge. */
.chunky {
  background: var(--surface);
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: var(--radius);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 16px;
  border: 2px solid var(--primary);
  border-bottom: 5px solid var(--primary-shadow);
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.06); }
/* Sinks the face onto the ledge, as in the app. */
.btn:active { border-bottom-width: 2px; transform: translateY(3px); }
.btn.secondary { background: var(--surface); color: var(--blue); border-color: var(--border); border-bottom-color: var(--border); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 13px; border-bottom-width: 4px; }
.btn.block { width: 100%; }
.btn:disabled { background: var(--border); border-color: var(--border); color: var(--muted); cursor: default; filter: none; transform: none; border-bottom-width: 5px; }

.text-btn { background: none; border: 0; color: var(--blue); font-weight: 800; cursor: pointer; padding: 6px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gold-tint);
  color: var(--gold-shadow);
  font-size: 13px;
  font-weight: 800;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 900; font-size: 20px; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.site-header .spacer { flex: 1; }
.lang-switch { background: none; border: 0; color: var(--blue); font-weight: 800; font-size: 14px; cursor: pointer; padding: 8px; }

/* ---------- Hero ---------- */

.hero { position: relative; padding: 40px 0 56px; overflow: hidden; }
.hero .wrap { position: relative; display: grid; gap: 32px; align-items: center; }
@media (min-width: 860px) { .hero .wrap { grid-template-columns: 1.1fr 0.9fr; } .hero { padding: 72px 0 88px; } }
.hero h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.08; font-weight: 900; margin: 14px 0 12px; letter-spacing: -0.5px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero .lede { color: var(--muted); font-size: 18px; max-width: 34em; margin: 0 0 24px; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero .fine { color: var(--muted); font-size: 14px; margin-top: 14px; }

/* Characters drifting behind the hero, kept to the edges so they never sit under text. */
.glyphs { position: absolute; inset: 0; pointer-events: none; }
.glyphs span {
  position: absolute;
  font-family: var(--hanzi);
  font-weight: 900;
  opacity: 0.12;
  animation: drift var(--period, 5s) ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translateY(0) rotate(-8deg); } to { transform: translateY(14px) rotate(8deg); } }

.hero-art { position: relative; display: grid; place-items: center; }
/* The app icon as a raised tile that floats over a soft shadow. */
.halo { position: relative; width: 260px; height: 260px; display: grid; place-items: center; }
.tile {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 42px;
  overflow: hidden;
  border: 2px solid var(--border);
  border-bottom-width: 7px;
  background: var(--surface);
  animation: pop 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) both, bob 3.6s ease-in-out 0.7s infinite alternate;
}
.tile img { width: 100%; height: 100%; }
.tile::after {
  content: '';
  position: absolute;
  top: -40px;
  left: 0;
  width: 44px;
  height: 260px;
  background: rgba(255, 255, 255, 0.55);
  transform: translateX(-120px) rotate(20deg);
  animation: shine 4.5s ease-in-out 1.2s infinite;
}
.floor { position: absolute; bottom: 30px; width: 130px; height: 16px; border-radius: 50%; background: var(--text); opacity: 0.08; animation: floor 3.6s ease-in-out 0.7s infinite alternate; }
.spark { position: absolute; color: var(--gold); animation: twinkle 1.8s ease-in-out infinite alternate; }
@keyframes pop { from { opacity: 0; transform: scale(0.5) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes bob { to { transform: translateY(-10px); } }
@keyframes floor { to { transform: scaleX(0.8); opacity: 0.04; } }
@keyframes shine { 0%, 20% { transform: translateX(-120px) rotate(20deg); } 45%, 100% { transform: translateX(220px) rotate(20deg); } }
@keyframes twinkle { from { opacity: 0.15; transform: scale(0.4); } to { opacity: 1; transform: scale(1) rotate(45deg); } }

/* The tapped-word ticker: a word, a sparkle, and its meaning typed out. */
.ticker { margin-top: 8px; height: 48px; display: grid; place-items: center; }
.ticker-frame { padding: 2px; border-radius: 24px; background: var(--ai-gradient); }
.ticker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  height: 42px;
  padding: 0 14px;
  border-radius: 22px;
  background: var(--surface);
  transition: opacity 0.22s, transform 0.22s;
}
.ticker-row.out { opacity: 0; transform: translateY(6px); }
.ticker-word { padding: 2px 8px; border-radius: 8px; background: var(--narrate-word); font-family: var(--hanzi); font-weight: 600; }
.ticker-spark { color: var(--gold); font-size: 14px; }
.ticker-meaning { color: var(--primary); font-weight: 800; }
.caret { width: 2px; height: 18px; border-radius: 1px; background: var(--primary); animation: blink 0.9s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Sections ---------- */

section { padding: 56px 0; }
.section-head { max-width: 640px; margin-bottom: 28px; }
.section-head .kicker { color: var(--primary); font-weight: 900; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; }
.section-head h2 { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; font-weight: 900; margin: 6px 0 8px; }
.section-head p { color: var(--muted); font-size: 17px; margin: 0; }
.center { text-align: center; margin-left: auto; margin-right: auto; }

/* Try it: the reader demo. */
.try { display: grid; gap: 20px; align-items: start; }
@media (min-width: 860px) { .try { grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; } }
.demo-card { border-radius: 24px; padding: 28px 12px; }
.sentence { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.word {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.word:disabled { cursor: default; }
.word .py { color: var(--muted); font-size: 13px; min-height: 19px; }
.word .zh { font-family: var(--hanzi); font-size: 32px; font-weight: 500; line-height: 1.25; }
.word.fresh { background: var(--new-word); }
.word.tapped { background: var(--narrate-word); }
.word:not(:disabled):active { transform: scale(0.96); }
.sheet { padding: 16px; margin-top: 14px; animation: rise 0.25s ease-out; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-word { font-family: var(--hanzi); font-size: 30px; font-weight: 500; line-height: 1.2; }
.sheet-py { color: var(--muted); }
.sheet-meaning { font-size: 18px; font-weight: 800; margin-top: 4px; }
.speak { margin-left: auto; width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--blue-tint); color: var(--blue); cursor: pointer; display: grid; place-items: center; }
.speak svg { width: 24px; height: 24px; }
.hint { color: var(--muted); font-size: 14px; text-align: center; margin: 12px 0 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* How it works: three steps with the pandas. */
.steps { display: grid; gap: 16px; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.step .art { aspect-ratio: 4 / 3; border-radius: 12px; background: var(--art-bg); overflow: hidden; display: grid; place-items: center; margin-bottom: 8px; }
.step .art img { width: 78%; }
.step .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--primary-text); font-weight: 900; font-size: 14px; }
.step h3 { margin: 0; font-size: 19px; font-weight: 900; line-height: 1.3; }
.step p { margin: 0; color: var(--muted); }

/* The path: HSK 1 → 3 plus business. */
.path { display: grid; gap: 16px; }
@media (min-width: 760px) { .path { grid-template-columns: 1.2fr 1fr; } }
.track-card { padding: 22px; }
.track-card h3 { margin: 0 0 6px; font-size: 20px; font-weight: 900; }
.track-card p { margin: 0 0 16px; color: var(--muted); }
.levels { display: grid; gap: 10px; }
.level { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--blue-tint); }
.level .badge { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fffaf2; font-weight: 900; font-size: 13px; line-height: 1.1; text-align: center; border-bottom: 4px solid rgba(0, 0, 0, 0.22); }
.level strong { display: block; font-weight: 900; }
.level span { color: var(--muted); font-size: 14px; }
.biz-list { display: grid; gap: 10px; }
.biz { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--gold-tint); }
.biz .flag { font-size: 24px; line-height: 1.2; }
.biz strong { display: block; font-weight: 900; }
.biz span { color: var(--muted); font-size: 14px; }

/* Feature grid. */
.features { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.feature { padding: 18px; }
.feature .glyph { font-size: 28px; line-height: 1; }
.feature h3 { margin: 10px 0 4px; font-size: 17px; font-weight: 900; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }
.ai-card { position: relative; border: 0; padding: 3px; background: var(--ai-gradient); border-radius: var(--radius); }
.ai-card > div { background: var(--surface); border-radius: 13px; padding: 16px 17px 18px; height: 100%; }
.new-pill { position: absolute; top: -10px; right: 12px; background: var(--primary); color: var(--primary-text); font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 6px; letter-spacing: 0.8px; }

/* FAQ. */
.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.faq details { padding: 0; }
.faq summary { cursor: pointer; padding: 16px 18px; font-weight: 900; font-size: 17px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--primary); font-size: 22px; line-height: 1; transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0; padding: 0 18px 16px; color: var(--muted); }

/* Final call to action. */
.final { padding: 64px 0 72px; }
.final-card { position: relative; overflow: hidden; border-radius: 28px; padding: 36px 20px; text-align: center; background: var(--blue); color: #f8f0e4; }
.final-card img { width: 120px; margin: 0 auto 8px; border-radius: 28px; }
.final-card h2 { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; font-weight: 900; margin: 6px 0 8px; }
.final-card p { color: #c9d2e6; margin: 0 auto 22px; max-width: 30em; }
.quick-form { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 520px; margin: 0 auto; }
.quick-form input { flex: 1 1 240px; }
.quick-form .btn { flex: 0 0 auto; }
.final-card .alt { margin-top: 14px; color: #c9d2e6; font-size: 14px; }
.final-card .alt button { color: #fffaf2; text-decoration: underline; }
.form-msg { margin: 12px auto 0; font-weight: 800; min-height: 1.5em; }
.form-msg.ok { color: #9fe0b4; }
.form-msg.err { color: #ffb4ab; }

input[type='email'] {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 700 16px var(--font);
}
input[type='email']::placeholder { color: var(--muted); font-weight: 600; }
input[type='email']:focus { outline: none; border-color: var(--blue); }

.site-footer { padding: 28px 0 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.site-footer .brand { font-size: 16px; }
.site-footer .brand img { width: 28px; height: 28px; border-radius: 8px; }
.site-footer .spacer { flex: 1; }

/* Reveal on scroll. */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease-out, transform 0.5s ease-out; }
.reveal.shown { opacity: 1; transform: none; }

/* ---------- Onboarding (a phone-sized column over the page) ---------- */

.ob {
  position: fixed;
  inset: 0;
  z-index: 50;
  color: var(--text);
  display: none;
  overflow-y: auto;
}
.ob.open { display: block; }
/* The page behind the onboarding column: background plus the drifting characters. It sits under
   .ob (which scrolls) so the characters stay put and never cover the text. */
.ob-bg { position: fixed; inset: 0; z-index: 49; background: var(--bg); display: none; overflow: hidden; pointer-events: none; }
.ob.open + .ob-bg { display: block; }
.ob-bg .glyphs { position: absolute; inset: 0; }
@media (prefers-reduced-motion: reduce) { .ob-bg .glyphs span { animation: none; } }
.ob-col { min-height: 100%; max-width: 480px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.ob-top { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.icon-btn { width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 10px; flex: none; }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:disabled { visibility: hidden; }
.bar { flex: 1; height: 16px; border-radius: 8px; background: var(--border); overflow: hidden; }
.bar > div { height: 100%; border-radius: 8px; background: var(--primary); transition: width 0.35s ease-out; }
.level-tag { color: var(--muted); font-weight: 800; font-size: 15px; }
.ob-body { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.ob-body.centered { justify-content: center; align-items: center; text-align: center; }
.ob-foot { display: grid; gap: 10px; padding-bottom: 8px; }

.mascot-row { display: flex; align-items: center; gap: 12px; }
.mascot-sm { width: 64px; height: 64px; border-radius: 18px; flex: none; }
.mascot { width: 112px; height: 112px; border-radius: 28px; margin: 0 auto 8px; }
.bubble { flex: 1; padding: 10px 14px; border-radius: 18px; border-bottom-left-radius: 4px; font-weight: 700; font-size: 15px; line-height: 1.4; }
.q-title { font-size: 24px; line-height: 1.25; font-weight: 900; margin: 0; }
.q-sub { color: var(--muted); font-size: 15px; margin: 4px 0 0; }
.ob-title { font-size: 26px; font-weight: 900; margin: 0; line-height: 1.2; }
.ob-sub { color: var(--muted); font-size: 16px; max-width: 340px; margin: 6px auto 0; }
.big-glyph { display: grid; place-items: center; width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; background: var(--gold-tint); color: var(--gold-shadow); }
.big-glyph svg { width: 48px; height: 48px; }

.choices { display: grid; gap: 12px; }
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.choice:hover { border-color: color-mix(in srgb, var(--blue) 40%, var(--border)); }
.choice:active { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.choice[aria-checked='true'], .choice[aria-pressed='true'] { border-color: var(--blue); background: var(--blue-tint); }
.choice .g, .plan-row .g { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-tint); color: var(--primary); font-family: var(--hanzi); font-size: 22px; font-weight: 700; line-height: 1; }
.choice .g svg, .plan-row .g svg { width: 24px; height: 24px; }
.choice[aria-checked='true'] .g { background: var(--primary); color: var(--primary-text); }
.choice .l { display: block; font-size: 17px; font-weight: 800; }
.choice .h { display: block; color: var(--muted); font-size: 14px; }
.choice .grow { flex: 1; }
.choice .tick { color: var(--blue); width: 20px; height: 20px; visibility: hidden; flex: none; }
.choice[aria-checked='true'] .tick, .choice[aria-pressed='true'] .tick { visibility: visible; }
.choice .badge { padding: 3px 8px; border-radius: 8px; background: var(--gold-tint); color: var(--gold-shadow); font-size: 12px; font-weight: 800; }

.stagger > * { animation: rise 0.35s ease-out both; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.12s; }
.stagger > *:nth-child(4) { animation-delay: 0.18s; }
.stagger > *:nth-child(5) { animation-delay: 0.24s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.ob.still .stagger > * { animation: none; }

/* Level check. */
.ask { color: var(--muted); font-weight: 800; font-size: 15px; margin: 0; }
.q-card { border-radius: 24px; padding: 20px; text-align: center; cursor: pointer; width: 100%; }
.q-card .zh { font-family: var(--hanzi); font-size: 56px; font-weight: 500; line-height: 1.2; }
.q-card .py { color: var(--muted); font-size: 20px; }
.options { display: grid; gap: 10px; }
.option { min-height: 56px; padding: 12px 16px; text-align: left; font-weight: 700; font-size: 16px; cursor: pointer; }
.option.right { border-color: var(--success); background: var(--success-tint); }
.option.wrong { border-color: var(--danger); background: var(--danger-tint); }
.option:disabled { cursor: default; }
.feedback { border-radius: 16px; padding: 14px; background: var(--danger-tint); }
.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.btn.danger { background: var(--danger); border-color: var(--danger); border-bottom-color: #7d1913; }

/* Tour. */
.dots { display: flex; justify-content: center; gap: 8px; }
.dots span { width: 8px; height: 8px; border-radius: 4px; background: var(--border); transition: width 0.25s, background 0.25s; }
.dots span.on { width: 24px; background: var(--primary); }

/* Building the plan. */
.ring { position: relative; width: 144px; height: 144px; margin: 0 auto 8px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--border); }
.ring .fill { stroke: var(--primary); transition: stroke-dashoffset 0.1s linear; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; font-weight: 900; }
.build-list { display: grid; gap: 12px; margin-top: 8px; text-align: left; }
.build-row { display: flex; align-items: center; gap: 10px; font-weight: 700; transition: opacity 0.2s; }
.build-row.waiting { opacity: 0.35; }
.build-row .ic { width: 18px; height: 18px; color: var(--success); display: grid; place-items: center; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--muted); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.plan-card { padding: 16px; display: grid; gap: 16px; }
.plan-row { display: flex; align-items: center; gap: 14px; }
.plan-row .g { width: 40px; height: 40px; }
.plan-row small { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.plan-row strong { display: block; font-weight: 800; }
.footnote { color: var(--muted); font-size: 13px; text-align: center; margin: 0; }

/* Charts (plan teaser, plan, progress mockup). Final states are the resting styles, so they show with reduced motion. */
.line-chart { display: block; width: 100%; height: auto; overflow: visible; }
.line-chart .line { fill: none; stroke: var(--blue); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; animation: draw 1.2s 0.25s cubic-bezier(0.33, 1, 0.68, 1) backwards; }
.line-chart .dot { fill: var(--primary); stroke: var(--surface); stroke-width: 3; }
.line-chart .dot.end { animation: pop 0.3s 1.3s backwards; transform-box: fill-box; transform-origin: center; }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.3); } }
.ob.still .line-chart .line, .ob.still .line-chart .dot { animation: none; }

.teaser { width: 100%; padding: 16px; display: grid; gap: 12px; border-radius: 24px; text-align: center; }
.chart-wrap { position: relative; }
.chart-wrap.grid { background: repeating-linear-gradient(to bottom, transparent 0 42px, var(--border) 42px 43.5px); }
.chart-pill { position: absolute; right: 0; padding: 4px 12px; border-radius: 14px; background: var(--surface); border: 2px solid var(--border); font-weight: 900; font-size: 14px; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; }
.cmp-wrap { position: relative; margin-top: 8px; }
.cmp .cmp-grid { stroke: var(--border); stroke-width: 1.5; stroke-dasharray: 4 5; }
.cmp .line.ours { stroke: var(--primary); }
.cmp .line.other { stroke: #c9bfb0; animation-delay: 0.1s; }
.cmp .cmp-dot { fill: var(--surface); }
.cmp .cmp-halo { opacity: 0.25; }
.cmp .cmp-halo.now { fill: var(--gold); }
.cmp .cmp-halo.ours { fill: var(--primary); }
.cmp .cmp-halo.other { fill: #a39887; }
.cmp .cmp-dot, .cmp .cmp-halo { animation: pop 0.3s 1.3s backwards; transform-box: fill-box; transform-origin: center; }
.ob.still .cmp .cmp-dot, .ob.still .cmp .cmp-halo { animation: none; }
.cmp-pill { position: absolute; transform: translate(-50%, -50%); padding: 4px 10px; border-radius: 12px; color: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; animation: fade-in 0.3s 1.4s backwards; }
@keyframes fade-in { from { opacity: 0; } }
.ob.still .cmp-pill { animation: none; }
.cmp-pill.now { background: var(--gold-shadow); transform: translate(-25%, -50%); }
.cmp-pill.ours { background: var(--primary); transform: translate(-75%, -50%); }
.cmp-pill.other { background: #a39887; transform: translate(-75%, -50%); }
.cmp-axis { position: relative; height: 18px; font-size: 13px; font-weight: 800; }
.cmp-axis span { position: absolute; transform: translateX(-50%); }
.cmp-axis .now { color: var(--gold-shadow); }
.cmp-axis .ours { color: var(--primary); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); align-items: end; gap: 8px; padding: 8px 4px 0; border-bottom: 2px solid var(--border); }
.tcol { position: relative; display: grid; justify-items: center; gap: 6px; }
.tstack { display: flex; flex-wrap: wrap-reverse; justify-content: center; gap: 3px; width: 55px; }
.tile { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--new-word); color: var(--blue); font-family: var(--hanzi); font-size: 14px; animation: pop 0.3s ease-out backwards; }
.tcol.locked .tile { background: transparent; border: 1.5px dashed var(--border); color: var(--muted); font: 900 13px var(--font); }
.tlock { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--primary-text); }
.tlock svg, .ulock svg { width: 14px; }
.tlabel { color: var(--muted); font-size: 12px; font-weight: 700; padding-bottom: 6px; }
.tcol.locked .tlabel { color: var(--primary); font-weight: 900; }
.ob.still .tile { animation: none; }
.unknowns { display: grid; gap: 8px; text-align: left; }
.unknowns div { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--gold-tint); font-size: 14px; font-weight: 700; }
.unknowns span:nth-child(2) { flex: 1; }
.unknowns b { color: var(--primary); font-weight: 900; }
.ulock { color: var(--muted); display: grid; }

/* Why Mandarin: horizontal bars and the sourced facts. */
.facts-chart { text-align: left; }
.hbar-row { display: grid; grid-template-columns: 112px 1fr 44px; align-items: center; gap: 10px; font-size: 14px; font-weight: 800; }
.hbar-row b { text-align: right; font-weight: 900; }
.hbar-track { height: 22px; }
.hbar { display: block; height: 100%; border-radius: 6px 11px 11px 6px; background: var(--border); transform-origin: left; animation: growx 0.8s cubic-bezier(0.33, 1, 0.68, 1) backwards; }
.hbar.lead { background: var(--primary); }
@keyframes growx { from { transform: scaleX(0); } }
.ob.still .hbar { animation: none; }
.facts-lead { margin: 0; color: var(--muted); font-size: 16px; }
.facts-box { padding: 16px 18px; }
.facts-box ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.facts-box li b { color: var(--text); }

/* Phone mockups in the tour; they cut off at the bottom like a screenshot. */
.phone-halo { padding: 14px; border-radius: 60px; background: var(--gold-tint); margin: 0 auto 8px; }
.phone { position: relative; height: clamp(360px, 62vh, 540px); aspect-ratio: 0.5; overflow: hidden; border: 5px solid var(--text); border-radius: 34px; background: var(--bg); padding: 14px 10px 0; display: flex; flex-direction: column; gap: 10px; text-align: left; font-size: 11px; line-height: 1.3; }
.phone svg:not(.line-chart) { width: 16px; height: 16px; flex: none; }
.m-head { display: flex; align-items: center; gap: 8px; }
.m-head b { flex: 1; font-size: 14px; font-weight: 900; }
.m-head b.m-big-title { font-size: 16px; }
.m-tag { padding: 2px 6px; border-radius: 6px; background: var(--blue-tint); color: var(--blue); font-size: 9px; font-weight: 800; }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m-mute { color: var(--muted); font-size: 9px; font-weight: 700; }
.m-caps { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; }
.m-card { background: var(--surface); border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 14px; padding: 10px; display: grid; gap: 6px; }
.m-text { display: flex; flex-wrap: wrap; gap: 2px; }
.m-word { display: grid; justify-items: center; padding: 2px 3px; border-radius: 6px; font-family: var(--hanzi); font-size: 19px; line-height: 1.2; }
.m-word i { font: normal 600 8px/1.2 var(--font); color: var(--muted); }
.m-word.fresh { background: var(--new-word); }
.m-word.tapped { background: var(--narrate-word); }
.m-sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border: 2px solid var(--border); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 12px 14px 16px; display: grid; gap: 4px; animation: rise 0.35s 0.4s ease-out backwards; }
.m-sheet svg { color: var(--blue); width: 20px; height: 20px; }
.m-handle { justify-self: center; width: 32px; height: 4px; border-radius: 2px; background: var(--border); margin-bottom: 4px; }
.m-sheet-word { font-family: var(--hanzi); font-size: 24px; font-weight: 500; line-height: 1.2; }
.m-sheet-meaning { font-size: 15px; font-weight: 800; }
.m-ai-btn { justify-self: start; margin-top: 6px; padding: 5px 10px; border-radius: 10px; background: var(--ai-gradient); color: var(--primary-text); font-size: 11px; font-weight: 800; }
.m-ai-note { padding: 8px 10px; border-radius: 12px; background: var(--blue-tint); font-size: 10px; font-weight: 700; line-height: 1.45; animation: rise 0.35s 0.9s ease-out backwards; }
.m-group { display: inline-flex; }
.m-chips { display: flex; gap: 6px; }
.m-chip { flex: 1; display: grid; padding: 6px 8px; border-radius: 12px; background: var(--surface); border: 2px solid var(--border); border-bottom-width: 4px; }
.m-chip b { font-family: var(--hanzi); font-size: 18px; font-weight: 500; }
.m-chip i { font-style: normal; color: var(--muted); font-size: 9px; font-weight: 700; }
.m-typed { padding: 10px; border-radius: 12px; border: 2px solid var(--blue); background: var(--surface); font-family: var(--hanzi); font-size: 16px; }
.m-result { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 6px; padding: 12px 14px 16px; background: #fbf1dd; border-top: 4px solid var(--gold); animation: rise 0.35s 0.5s ease-out backwards; }
.m-verdict { display: flex; align-items: center; gap: 8px; color: var(--gold-shadow); font-size: 18px; font-weight: 900; }
.m-verdict span { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); display: grid; place-items: center; font-size: 13px; }
.m-fix { font-family: var(--hanzi); font-size: 18px; }
.m-fix ins { text-decoration: none; background: var(--success-tint); color: var(--success); border-radius: 4px; padding: 0 2px; }
.m-fix del { color: var(--danger); }
.m-feedback { font-size: 10px; font-weight: 700; line-height: 1.45; }
.m-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--primary-text); display: grid; place-items: center; font-family: var(--hanzi); font-size: 13px; }
.m-chat { display: grid; gap: 8px; }
.m-chat > * { animation: rise 0.35s ease-out backwards; }
.m-chat > :nth-child(2) { animation-delay: 0.3s; }
.m-chat > :nth-child(3) { animation-delay: 0.6s; }
.m-chat > :nth-child(4) { animation-delay: 0.9s; }
.m-ai, .m-me { max-width: 88%; padding: 7px 10px; border-radius: 14px; font-family: var(--hanzi); font-size: 14px; }
.m-ai { justify-self: start; background: var(--surface); border: 2px solid var(--border); border-bottom-width: 4px; border-bottom-left-radius: 4px; }
.m-ai small { display: block; margin-top: 2px; font: 600 9px/1.3 var(--font); color: var(--muted); }
.m-me { justify-self: end; background: var(--blue); color: var(--primary-text); border-bottom-right-radius: 4px; }
.m-ok { display: flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 10px; background: var(--success-tint); color: var(--success); font-size: 9px; font-weight: 700; }
.m-ok svg { width: 12px; height: 12px; }
.m-input { position: absolute; left: 10px; right: 10px; bottom: 12px; padding: 8px 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 700; }

/* Waitlist step. */
.wl-form { display: grid; gap: 12px; text-align: left; }
.wl-form label { font-weight: 800; font-size: 14px; color: var(--muted); }
.wl-form input[type='email'] { width: 100%; }
.platforms { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.platforms .choice { padding: 12px; justify-content: center; }
.err-text { color: var(--danger); font-weight: 800; font-size: 14px; min-height: 1.4em; margin: 0; }
.legal { color: var(--muted); font-size: 12px; text-align: center; margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Confetti on the done screen. */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
