:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --ink: #1d1b18;
  --muted: #6b655c;
  --line: #e3ddd2;
  --accent: #b23a2b;
  --accent-ink: #fffdf9;
  --accent-soft: rgba(178, 58, 43, 0.08);
  --blue: #2f5d8a;
  --green: #3c7a52;
  --amber: #c08a1e;
  --radius: 14px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1c1a17;
    --ink: #ece7de;
    --muted: #9a9388;
    --line: #2e2b27;
    --accent: #e0664f;
    --accent-ink: #141311;
    --accent-soft: rgba(224, 102, 79, 0.1);
    --blue: #7fa8d1;
    --green: #7fbf93;
    --amber: #e0b04f;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.3; margin: 0; }
p { margin: 0; }
a { color: inherit; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.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;
}

/* Nav */
.nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 18px; }
.latin { font-family: var(--sans); font-weight: 500; color: var(--muted); font-size: 15px; margin-left: 2px; }
.seal {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  background: var(--accent); color: var(--accent-ink); border-radius: 6px; font-size: 16px;
}
.nav-cta { font-size: 15px; color: var(--muted); text-decoration: none; }
.nav-cta:hover { color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 46px; padding: 0 22px; border-radius: 10px;
  font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s, border-color .15s, opacity .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--muted); }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center;
  padding-top: 72px; padding-bottom: 96px;
}
.eyebrow { color: var(--accent); font-family: var(--serif); font-size: 15px; letter-spacing: .08em; margin-bottom: 20px; }
.hero h1 { font-size: clamp(40px, 6vw, 64px); letter-spacing: .02em; }
.lede { margin-top: 24px; font-size: 19px; color: var(--muted); max-width: 30em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; padding: 0; margin: 32px 0 0; font-size: 14px; color: var(--muted); }
.facts li::before { content: "·"; color: var(--accent); margin-right: 8px; font-weight: 700; }

/* Card mock */
.card {
  margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 1px 0 var(--line), 0 24px 48px -32px rgba(0,0,0,.25);
}
.card-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.tag { background: var(--accent-soft); color: var(--accent); padding: 2px 10px; border-radius: 999px; }
.card-q { font-family: var(--serif); font-size: 21px; font-weight: 700; margin: 16px 0 8px; }
.viz { width: 100%; height: auto; display: block; margin: 8px 0; }
.card-a { font-size: 15px; color: var(--muted); line-height: 1.7; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 20px; }
.grades span {
  text-align: center; font-size: 14px; padding: 8px 0; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted);
}
.grades .on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* SVG shared */
svg .axis { stroke: var(--line); stroke-width: 1.5; }
svg .lbl { fill: var(--muted); font-size: 12px; font-family: var(--sans); }
.viz { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.viz:active { cursor: grabbing; }
.viz .ring { fill: none; stroke: var(--muted); stroke-width: 1.5; opacity: .6; }
.viz .radius { stroke: var(--ink); stroke-width: 1.2; opacity: .7; }
.viz .sin { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.viz .cos { stroke: var(--blue); stroke-width: 3; stroke-linecap: round; }
.viz .vel { stroke: var(--green); stroke-width: 2; }
.viz .vel-head { fill: var(--green); }
.viz .vel-y { stroke: var(--blue); stroke-width: 3; stroke-linecap: round; opacity: .85; }
.viz .tangent { stroke: var(--blue); stroke-width: 2; stroke-linecap: round; }
.viz .link { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.viz .wave { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .5; }
.viz .dot { fill: var(--accent); }
.viz .handle { stroke: var(--surface); stroke-width: 2; }
.viz .hit { fill: transparent; }
.viz-readout { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin: 2px 0 10px; }
.viz-readout .sep { display: inline-block; width: 14px; }
.t-sin { color: var(--accent); }
.t-cos { color: var(--blue); }

/* Sliders */
.slider { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.slider span { white-space: nowrap; min-width: 7.5em; }
.slider b { color: var(--ink); font-variant-numeric: tabular-nums; }
.slider input { flex: 1; min-width: 0; accent-color: var(--accent); }

/* Sections */
.section { padding-top: 56px; padding-bottom: 56px; border-top: 1px solid var(--line); }
.section-title { font-size: clamp(26px, 3.4vw, 34px); }
.section-lede { margin-top: 14px; color: var(--muted); max-width: 36em; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 36px; }
.pair h3 { font-size: 21px; margin-bottom: 10px; }
.pair p:not(.num) { color: var(--muted); }
.num { font-family: var(--serif); color: var(--accent); font-size: 15px; margin-bottom: 6px; }

.curve { margin: 48px 0 0; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.curve-head, .kmap-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 12px; }
.curve-head .slider { width: min(320px, 100%); }
.curve-title { font-family: var(--serif); font-weight: 700; font-size: 17px; }
.curve svg { width: 100%; height: auto; display: block; overflow: visible; }
.curve svg .lbl { font-size: 11px; }
svg .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
svg .target { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 4; opacity: .6; }
svg .lbl.accent { fill: var(--accent); }
.curve .forget { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 5; opacity: .7; }
.curve .keep { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.curve .marks circle { fill: var(--accent); }
.curve-stats { display: flex; flex-wrap: wrap; gap: 6px 32px; font-size: 15px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.curve-stats .muted { margin-right: 6px; }
.accent-t { color: var(--accent); }
.nw { white-space: nowrap; }
.curve figcaption, .kmap figcaption { color: var(--muted); font-size: 13px; margin-top: 12px; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 32px; }
.tile { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.tile-head { display: flex; align-items: center; gap: 10px; }
.tile-head .tag { font-size: 12px; }
.tile-q { font-family: var(--serif); font-weight: 700; font-size: 16px; }
.tile svg { width: 100%; height: auto; display: block; }
.tile .slider span { min-width: 6.5em; }
.tile figcaption { font-size: 14px; color: var(--muted); min-height: 3.4em; line-height: 1.7; }
.tile figcaption b { color: var(--ink); }
.tile .traj { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.tile .ghost { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .6; }
.tile .aim { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; opacity: .6; }
.tile .dot { fill: var(--accent); }
.tile .area { fill: var(--accent); opacity: .14; }
.tile .pct { font-size: 13px; font-weight: 600; }
.bsearch { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 6px 0; }
.bsearch span {
  text-align: center; font-size: 14px; padding: 6px 0; border-radius: 6px; border: 1px solid var(--line);
  font-variant-numeric: tabular-nums; transition: opacity .2s, background-color .2s, border-color .2s;
}
.bsearch .goal { border-color: var(--muted); border-style: dashed; }
.bsearch .out { opacity: .25; }
.bsearch .mid { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.bsearch .found { border-color: var(--green); color: var(--accent-ink); background: var(--green); }
.tile-actions { display: flex; gap: 8px; }
.btn-small { height: 34px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
.btn-quiet { color: var(--muted); background: none; }
.btn-quiet:hover { color: var(--ink); }
.btn-small:disabled { opacity: .45; cursor: default; }

/* Knowledge map */
.kmap { margin: 24px 0 0; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 0; font-size: 14px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; cursor: default; border-radius: 6px; }
.legend li:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.legend b { color: var(--ink); font-weight: 600; }
.kmap-grid { display: grid; grid-template-columns: repeat(24, 1fr); gap: 6px; }
.k { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.kmap-grid .k { width: 100%; height: auto; aspect-ratio: 1; transition: opacity .2s; }
.k.known { background: var(--green); }
.k.fading { background: var(--amber); }
.k.wrong { background: var(--accent); }
.k.new { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.kmap-grid[data-focus] .k { opacity: .15; }
.kmap-grid[data-focus="known"] .known, .kmap-grid[data-focus="fading"] .fading,
.kmap-grid[data-focus="wrong"] .wrong, .kmap-grid[data-focus="new"] .new { opacity: 1; }

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 32px; }
.trio article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.trio h3 { font-size: 19px; margin-bottom: 8px; }
.trio p { color: var(--muted); font-size: 16px; }

.principles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 48px; margin: 28px 0 0; }
.principles > div { padding: 20px 0; border-bottom: 1px solid var(--line); }
.principles dt { font-family: var(--serif); font-weight: 700; font-size: 18px; }
.principles dd { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.principles .no { font-size: 14px; color: var(--accent); }
.principles .no::before { content: "× "; }

.roadmap { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; counter-reset: none; }
.roadmap li { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 15px; color: var(--muted); }
.roadmap span { display: block; font-family: var(--serif); font-weight: 700; color: var(--ink); font-size: 15px; margin-bottom: 2px; }

/* Waitlist */
.waitlist { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 88px 0; margin-top: 40px; }
.waitlist-inner { text-align: center; max-width: 640px; }
.waitlist h2 { font-size: clamp(28px, 4vw, 38px); }
.waitlist-inner > p { color: var(--muted); margin-top: 14px; }
#waitlist-form { display: flex; gap: 10px; margin: 32px auto 0; max-width: 480px; }
#waitlist-form input[type="email"] {
  flex: 1; min-width: 0; height: 46px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px;
}
#waitlist-form input[type="email"]::placeholder { color: var(--muted); opacity: .7; }
#waitlist-form input[aria-invalid="true"] { border-color: var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-status { min-height: 1.75em; margin-top: 14px; font-size: 15px; color: var(--muted); }
.form-status.ok { color: var(--green); }
.form-status.err { color: var(--accent); }

/* Footer */
.footer { padding-top: 40px; padding-bottom: 48px; font-size: 14px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.muted { color: var(--muted); }

/* Responsive */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 48px; padding-top: 40px; padding-bottom: 64px; }
  .pair, .principles { grid-template-columns: 1fr; }
  .trio, .roadmap, .gallery { grid-template-columns: 1fr; }
  .kmap-grid { grid-template-columns: repeat(12, 1fr); }
}
@media (max-width: 600px) {
  .curve, .kmap { padding: 18px; }
  .curve svg .lbl { font-size: 19px; }
  .curve svg { width: calc(100% - 16px); margin-left: 12px; }
}
@media (max-width: 480px) {
  #waitlist-form { flex-direction: column; }
  .hero-actions .btn { flex: 1; }
  .card { padding: 18px; }
}
