:root {
  --ink: #111111;
  --muted: #5c5c5c;
  --line: #e6e6e6;
  --paper: #ffffff;
  --mist: #f4f4f4;
  --pandy: #fbf1e3;
  --lana: #fde9e7;
  --radius: 22px;
  --header: 76px;
  --shadow: 0 16px 40px rgba(17, 17, 17, 0.06);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

main { flex: 1; }

img { max-width: 100%; height: auto; }

button, input { font: inherit; color: inherit; }

a { color: inherit; }

h1, h2, h3, p { margin-top: 0; }

h1, h2, h3 {
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
}

::selection { background: var(--ink); color: #fff; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  z-index: 80;
  border-radius: 8px;
}

.skip:focus { top: 12px; }

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

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px);
}

.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header);
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark { display: block; width: 34px; height: 28px; }

.brand-name {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-toggle-lines,
.nav-toggle-lines::before,
.nav-toggle-lines::after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  position: relative;
}

.nav-toggle-lines::before,
.nav-toggle-lines::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-lines::before { top: -6px; }
.nav-toggle-lines::after { top: 6px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.96rem;
}

.nav-links a[aria-current="page"] { font-weight: 700; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 650;
  cursor: pointer;
}

.btn-small { min-height: 40px; padding: 0 16px; font-size: 0.92rem; }

.btn-ghost { background: #fff; color: var(--ink); }

.nav-links a.btn { color: #fff; }

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

.kicker {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 40rem;
}

.hero { padding: 36px 0 80px; }

.hero-grid {
  display: grid;
  grid-template-columns: 52fr 48fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(3rem, 5.6vw, 5.15rem);
  max-width: 12ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-visual { position: relative; }

.hero-stage {
  min-height: 580px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--pandy);
  border-radius: 32px;
  overflow: hidden;
}

.hero-stage img { width: auto; height: 430px; max-width: 86%; }

.float-card {
  position: absolute;
  z-index: 2;
  width: min(210px, 48%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
}

.vocab-card { left: 16px; bottom: 24px; }
.practice-card { right: 16px; top: 18px; }

.float-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.vocab-word {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0;
  line-height: 1;
}

.vocab-pinyin, .float-meta, .float-en { margin: 6px 0 0; color: var(--muted); }

.float-title { margin: 0; font-size: 1.15rem; letter-spacing: -0.03em; }

.text-link {
  display: inline-flex;
  margin-top: 8px;
  font-weight: 700;
  text-underline-offset: 4px;
}

.section { padding: 88px 0; }
.section-mist { background: var(--mist); }

.section-head { max-width: 640px; margin-bottom: 32px; }
.section-head h2, .page-head h1 {
  margin: 0 0 14px;
  font-size: clamp(2.3rem, 4.6vw, 3.8rem);
}

.page-head { padding: 56px 0 12px; }

.journey, .card-grid, .tool-grid, .meet-grid, .slot-grid {
  display: grid;
  gap: 16px;
}

.journey {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.card-grid, .meet-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meet-grid, .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.slot-grid { grid-template-columns: 1.4fr 0.8fr; }

.step, .card, .character-card, .slot, .level-block, .review {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.step, .card, .character-card { padding: 22px; }

.step-no {
  display: block;
  margin-bottom: 28px;
  color: #b5b5b5;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.step h3, .card h2, .card h3, .character-card h2, .character-card h3 { margin: 0 0 8px; font-size: 1.35rem; }
.card .btn, .card .text-link { margin-top: auto; align-self: flex-start; }
#pandy, #lana { scroll-margin-top: 96px; }
.step p, .card p, .character-card p { margin: 0; color: var(--muted); }

.card, .character-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.card-top, .level-head, .review-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.badge-wait { border-color: #d0d0d0; color: #666; background: #fff; }

.card-empty { gap: 10px; max-width: 640px; }

.portrait {
  border-radius: 24px;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.portrait-pandy { background: var(--pandy); }
.portrait-lana { background: var(--lana); }
.portrait img { width: auto; height: 400px; max-width: 100%; }

.level-block {
  padding: 28px;
  margin-top: 16px;
  scroll-margin-top: 96px;
}

.level-head h2 { margin: 0 0 8px; font-size: clamp(1.8rem, 3vw, 2.4rem); }
.level-head p, .empty-line { margin: 0; color: var(--muted); }
.subhead { margin: 22px 0 8px; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; }

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

.plain-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.stack { display: grid; gap: 16px; margin-top: 8px; }

.site-footer {
  background: #111;
  color: #fff;
  padding: 64px 0 28px;
}

.site-footer a { color: #fff; text-decoration: none; }
.site-footer .brand { color: #fff; }
.site-footer .brand-mark { filter: invert(1); }
.site-footer .lede, .footer-base { color: #c6c6c6; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 32px;
}

.footer-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a3a3a3;
}

.footer-links {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.footer-base {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid #2c2c2c;
}

.footer-base p { margin: 0; }

.video-frame, .video-empty {
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  background: #111;
  color: #fff;
}

.video-frame iframe { width: 100%; height: 100%; border: 0; }

.video-empty, .slot-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
}

.slot-empty {
  min-height: 160px;
  border: 1px dashed #d5d5d5;
  border-radius: 18px;
  color: var(--muted);
}

.vocab-list { list-style: none; margin: 0; padding: 0; }
.vocab-list li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.hanzi { font-size: 1.6rem; font-weight: 700; letter-spacing: 0; }
.pinyin, .english { margin: 0; color: var(--muted); }

.quiz-shell { max-width: 760px; padding-bottom: 72px; }
.quiz-note {
  display: inline-flex;
  margin: 8px 0 20px;
}

.q-block {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 18px 8px;
  margin: 0 0 14px;
}

.q-block legend {
  font-weight: 700;
  padding: 0 6px;
}

.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  margin: 8px 0;
  border-radius: 12px;
  cursor: pointer;
}

.choice:hover { background: var(--mist); }
.choice:has(input:checked) { background: var(--ink); color: #fff; }
.choice input { margin-top: 4px; accent-color: #fff; }

.quiz-actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.form-alert { margin: 0; color: var(--ink); font-weight: 700; }

.score-num {
  margin: 0;
  font-size: clamp(3rem, 8vw, 4.5rem);
  letter-spacing: -0.05em;
}

#quiz-root > .btn { margin-top: 20px; }

.review { padding: 18px; margin-top: 12px; }
.review.is-correct { border-color: var(--ink); }
.review p { margin: 6px 0 0; color: var(--muted); }
.review strong { color: var(--ink); }

@media (max-width: 980px) {
  .journey { grid-template-columns: 1fr 1fr; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .slot-grid, .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .wrap { width: min(1120px, calc(100% - 32px)); }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 20px 20px;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }
  .site-header.is-open .nav-links { display: flex; }
  .nav-links a { padding: 12px 0; }
  .nav-links a.btn { margin-top: 8px; }
  .hero { padding-top: 18px; }
  .hero-grid, .tool-grid, .meet-grid, .card-grid, .journey { grid-template-columns: 1fr; }
  .hero h1 { max-width: none; }
  .hero-stage { min-height: 420px; }
  .hero-stage img { height: 380px; }
  .float-card {
    position: static;
    width: auto;
    margin-top: 12px;
    box-shadow: none;
  }
  .section { padding: 64px 0; }
  .portrait { min-height: 320px; }
  .portrait img { height: 300px; }
  .level-head, .card-top { flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .vocab-card, .practice-card { animation: floaty 7s ease-in-out infinite; }
  .practice-card { animation-delay: -2.4s; }
  .hero-copy > * { animation: rise 0.7s ease both; }
  .hero-copy > *:nth-child(2) { animation-delay: 0.08s; }
  .hero-copy > *:nth-child(3) { animation-delay: 0.16s; }
  .card, .step, .btn { transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease; }
  .card:hover, .step:hover { transform: translateY(-3px); border-color: #111; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover, .card:hover, .step:hover { transform: none; }
}

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

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (max-width: 800px) and (prefers-reduced-motion: no-preference) {
  .vocab-card, .practice-card { animation: none; }
}
