/* WenWen landing page + web onboarding. Colours and shapes copy the app's theme (app/src/lib/theme.tsx). */

:root {
  --bg: #f4ecdf;
  --surface: #ffffff;
  --soft: #faf5ec;
  --text: #13213d;
  --muted: #5c667c;
  --faint: #8a8f9c;
  --border: #e6d9c4;
  --primary: #c8372d;
  --primary-shadow: #9e2a22;
  --primary-text: #fffaf2;
  --blue: #1f3a6b;
  --blue-shadow: #13213d;
  --gold: #d9a23a;
  --gold-shadow: #b5832a;
  --success: #3e8e5a;
  --success-shadow: #2e6c44;
  --danger: #a8231c;
  --primary-tint: #c8372d17;
  --blue-tint: #1f3a6b14;
  --gold-tint: #d9a23a22;
  --success-tint: #3e8e5a1f;
  --danger-tint: #a8231c1a;
  --new-word: #dfe5f0;
  --narrate-word: #f0cf7e;
  --hover-word: #d9a23a2e;
  /* The desktop home hero's peach paper. */
  --peach: linear-gradient(135deg, #fff5ea, #fde3d1);
  --peach-line: #f0d2bb;
  --peach-ledge: #e2b898;
  --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; }
/* height:auto keeps the width/height attributes (there to reserve space) from stretching images. */
img { max-width: 100%; height: auto; 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(--text);
  font-size: 13px;
  font-weight: 800;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

/* ---------- 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; }
.hero-art .tile {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 42px;
  overflow: hidden;
  border: 2px solid var(--peach-line);
  border-bottom: 7px solid var(--peach-ledge);
  background: var(--peach);
  animation: pop 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) both, bob 3.6s ease-in-out 0.7s infinite alternate;
}
.hero-art .tile img { width: 100%; height: 100%; }
.hero-art .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; border-radius: 50%; background: 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 8px 2px 2px; background: var(--hover-word); border-bottom: 2px solid var(--blue); font-family: var(--hanzi); font-weight: 500; }
.ticker-arrow { width: 16px; height: 16px; color: var(--gold); flex: none; }
.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; }
.demo-from { margin: -12px 0 14px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .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; } }

/* The landing demo: pinyin over every word, the picked word's card below. */
.demo { display: flex; flex-direction: column; gap: 14px; }
.demo .demo-card { padding: 24px 16px; container-type: inline-size; }
/* One line always: the words shrink with the card instead of wrapping. */
.demo-sentence { display: flex; flex-wrap: nowrap; justify-content: center; align-items: flex-end; gap: min(6px, 1cqi); }
.dword {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 12px 12px 4px 4px;
  background: none;
  cursor: pointer;
  transition: background 0.15s;
}
.dword:hover { background: var(--hover-word); }
.dword.fresh { background: var(--new-word); }
.dword.on { background: var(--hover-word); border-bottom-color: var(--blue); }
.dword { padding: 6px min(8px, 1.4cqi) 4px; }
.dword .py { color: var(--muted); font-size: 13px; font-size: min(13px, 2.6cqi); font-weight: 700; line-height: 1.3; min-height: 17px; white-space: nowrap; }
.dword .zh, .demo-punct { font-family: var(--hanzi); font-size: 40px; font-size: min(40px, 6.6cqi); font-weight: 500; line-height: 1.2; white-space: nowrap; }
.demo-punct { padding-bottom: 6px; }
.demo-tail { display: inline-flex; align-items: flex-end; }
.demo-detail { display: flex; align-items: center; gap: 14px; min-height: 104px; padding: 16px 18px; }
.demo-detail .big { font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif; font-size: 43px; font-weight: 500; line-height: 1.15; }
.demo-detail .py { color: var(--muted); font-size: 17px; font-weight: 700; }
.demo-detail .arti { font-size: 19px; font-weight: 900; margin-top: 4px; }
.demo-detail .speak { width: 52px; height: 52px; border-radius: 14px; flex: none; }
.demo-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; text-align: center; }
.demo-foot .hint { margin: 0; font-size: 15px; }
.demo-next { min-height: 44px; font-size: 15px; text-decoration: underline; }

/* Bento cards: a small drawn app screen on top, a title and a line below. */
.bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bento .span2 { grid-column: span 2; }
@media (max-width: 860px) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .bento { grid-template-columns: minmax(0, 1fr); } .bento .span2 { grid-column: auto; } }
.bcard { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.bcard .copy { padding: 0 4px 4px; }
.bcard h3 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.bcard .copy p { margin: 0; color: var(--muted); font-size: 15px; }
.ai-card { position: relative; padding: 3px; border-radius: var(--radius); background: var(--ai-gradient); }
.ai-card > .mock { border-radius: 13px; }
.mock { flex: 1; min-height: 210px; border-radius: 14px; background: var(--soft); overflow: hidden; }
.mock .muted { color: var(--muted); font-weight: 700; }
.mock .grow { flex: 1; }
.mock .sel { background: var(--hover-word); border-bottom: 2px solid var(--blue); border-radius: 8px 8px 2px 2px; }
.mock .fresh { background: var(--new-word); border-radius: 8px; }

.mock-tap { padding: 22px 18px 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.mock-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-size: 30px; }
.mock-line .sel { padding: 0 4px; }
.mock-sheet { width: 100%; max-width: 380px; margin-top: 18px; padding: 8px 18px 16px; background: var(--surface); border: 2px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; }
.mock-sheet .handle { width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 2px; background: var(--border); }
.mock-sheet .row { display: flex; align-items: center; gap: 12px; }
.mock-sheet .big { font-size: 28px; }
.mock-sheet .sep { color: var(--border); }
.mock-sheet strong { font-size: 18px; font-weight: 900; }
.mini-speak { width: 36px; height: 36px; border-radius: 10px; background: var(--blue-tint); color: var(--blue); display: grid; place-items: center; }
.mini-speak svg { width: 18px; height: 18px; }

.mock-photo { padding-top: 16px; display: flex; justify-content: center; }
.phone-frame { width: 200px; padding: 10px 10px 12px; background: var(--surface); border: 6px solid var(--text); border-bottom: 0; border-radius: 26px 26px 0 0; }
.menu-shot { position: relative; padding: 8px 12px; border-radius: 12px; background: var(--blue); border-bottom: 4px solid var(--blue-shadow); color: var(--primary-text); font-size: 15px; line-height: 1.75; }
.menu-shot div { display: flex; justify-content: space-between; }
.menu-shot .corner { position: absolute; width: 12px; height: 12px; border: 0 solid var(--gold); }
.menu-shot .tl { left: 6px; top: 6px; border-left-width: 3px; border-top-width: 3px; border-radius: 3px 0 0 0; }
.menu-shot .br { right: 6px; bottom: 6px; border-right-width: 3px; border-bottom-width: 3px; border-radius: 0 0 3px 0; }
.mock-photo .chips { display: flex; justify-content: center; gap: 4px; margin-top: 10px; font-size: 15px; white-space: nowrap; }
.mock-photo .chips span { padding: 2px 7px; }
.mock-photo .gloss { margin-top: 8px; padding: 6px 8px; border-radius: 10px; background: var(--soft); text-align: center; font-size: 13px; font-weight: 800; }

.mock-chat { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble-ai, .bubble-me { max-width: 85%; padding: 8px 12px; font-size: 14px; }
.bubble-ai { align-self: flex-start; background: var(--surface); border: 2px solid var(--border); border-radius: 4px 14px 14px 14px; }
.bubble-me { align-self: flex-end; background: var(--blue); color: var(--primary-text); border-radius: 14px 4px 14px 14px; font-size: 18px; }
.bubble-ai.fix { max-width: 92%; padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.fixed { font-size: 20px; }
.fixed ins { text-decoration: none; padding: 0 2px; border-radius: 4px; background: var(--success-tint); color: var(--success); }
.fixed del { color: var(--danger); text-decoration-thickness: 2px; }
.bubble-ai .score { padding: 2px 10px; border-radius: 999px; background: var(--success); color: var(--primary-text); font-size: 13px; font-weight: 900; }
.bubble-ai .why { flex-basis: 100%; color: var(--muted); font-size: 13px; }

/* The HSK route: the HSK 2 line, drawn like the desktop course map. */
.metro { padding: 24px 20px 16px; background: var(--soft); border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 24px; }
.metro-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 8px 4px; color: var(--muted); font-size: 15px; font-weight: 800; }
.metro-top .line-name { font-weight: 900; letter-spacing: 1.6px; }
.metro-scroll { overflow-x: auto; }
.metro-map { position: relative; min-width: 860px; }
.metro-map svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.metro-panda { position: absolute; left: 46.2%; top: 6.6%; width: 7.6%; border-radius: 16px; border: 2px solid var(--peach-line); border-bottom: 5px solid var(--peach-ledge); }

/* How you learn: tabs for the HSK route, grammar and AI practice, each with a real screen. */
.pillar { display: grid; gap: 24px; align-items: center; }
.pillar[hidden] { display: none; }
@media (min-width: 860px) {
  .pillar { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 40px; }
  /* The route map needs the full width. */
  #panel-hsk { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  #panel-hsk .pillar-copy { max-width: 640px; }
}
.pillar-copy .kicker { color: var(--primary); font-weight: 900; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; }
.pillar-copy h3 { font-size: clamp(22px, 3vw, 30px); line-height: 1.15; font-weight: 900; margin: 6px 0 8px; }
.pillar-copy p { color: var(--muted); font-size: 17px; margin: 0; }
.pillar-shot { min-width: 0; }

.mock.gram { padding: 16px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 600px) { .mock.gram { grid-template-columns: minmax(0, 1fr); } }
.gram-card, .gram-quiz { padding: 14px; background: var(--surface); border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 16px; }
.gram-top { display: flex; align-items: center; gap: 10px; }
.gram-key { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-tint); color: var(--primary); font-size: 24px; }
.gram-level { display: inline-block; margin-bottom: 2px; padding: 1px 8px; border-radius: 999px; background: var(--blue-tint); color: var(--blue); font-size: 11px; font-weight: 900; }
.gram-top strong { display: block; font-size: 16px; font-weight: 900; line-height: 1.2; }
.gram-pattern { margin: 12px 0 6px; padding: 8px 12px; border-radius: 10px; background: var(--soft); text-align: center; font-weight: 800; }
.gram-pattern b, .gram-ex b { color: var(--primary); font-weight: 500; }
.gram-use { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.gram-tip { padding: 8px 10px; border-radius: 10px; background: var(--gold-tint); font-size: 13px; font-weight: 700; }
.gram-ex { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 14px; }
.gram-ex .hanzi { font-size: 17px; }
.gram-mistake { display: grid; gap: 2px; margin-top: 8px; font-size: 15px; }
.gram-mistake i { margin-right: 6px; font-style: normal; font-weight: 900; }
.gram-mistake .bad { color: var(--danger); }
.gram-mistake .bad .hanzi { text-decoration: line-through; }
.gram-mistake .good { color: var(--success); }
.gram-mistake small { color: var(--muted); font-size: 12px; font-weight: 700; }
.gram-quiz .label { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.gram-quiz .q { margin: 8px 0 12px; text-align: center; font-size: 24px; }
.gram-quiz .blank { display: inline-block; min-width: 1.4em; margin: 0 2px; border-bottom: 3px solid var(--success); color: var(--success); }
.gram-quiz .opts { display: grid; gap: 8px; }
.gram-quiz .opt { padding: 8px; text-align: center; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 12px; font-size: 18px; }
.gram-quiz .opt.right { border-color: var(--success); background: var(--success-tint); color: var(--success); }
.gram-quiz .explain { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--success-tint); font-size: 13px; font-weight: 700; }

.ai-shot { min-height: 280px; }
.ai-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.ai-modes span { padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 2px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 800; }
.ai-modes .on { background: var(--blue); border-color: var(--blue); color: var(--primary-text); }

.tabs-box { padding: 20px; background: var(--surface); border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 24px; }
.tab-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tab-list [role='tab'] { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 2px solid var(--border); background: var(--soft); color: var(--blue); font-weight: 800; cursor: pointer; }
.tab-list [aria-selected='true'] { background: var(--blue); border-color: var(--blue); color: var(--primary-text); }

/* The closing call to action. */
.end { padding: 64px 0 72px; }
.end-card { padding: 36px 20px; text-align: center; border-radius: 28px; background: var(--peach); border: 2px solid var(--peach-line); border-bottom: 5px solid var(--peach-ledge); }
.end-card img { width: 96px; margin: 0 auto 8px; border-radius: 24px; }
.end-card h2 { margin: 6px 0 8px; font-size: clamp(26px, 4vw, 38px); line-height: 1.15; font-weight: 900; }
.end-card p { max-width: 30em; margin: 0 auto 22px; color: var(--muted); }

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; }
.pc-card { margin-top: 18px; padding: 16px; display: grid; gap: 8px; text-align: left; }
.pc-card[hidden] { display: none; }
.pc-card p { margin: 0; color: var(--muted); font-size: 14px; }
.pc-card .pc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-card .pc-tip { font-size: 13px; }
.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; }
}
