/* ---------- Tokens ---------- */
:root {
  --bg: #08090c;
  --bg-elevated: #101218;
  --surface: rgba(255,255,255,0.045);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.09);
  --border-soft: rgba(255,255,255,0.06);
  --text: #f5f6f8;
  --text-secondary: rgba(245,246,248,0.66);
  --text-tertiary: rgba(245,246,248,0.42);
  --accent-1: #8B7CFF;
  --accent-2: #4C9AFF;
  --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --again: #FF7A6B;
  --hard: #FFB86B;
  --good: #6BCB8A;
  --easy: #6BB8FF;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 26px;
  --radius-full: 999px;
  --ease-out-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --container-w: 1120px;
}

* { 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(--text);
  font: 100%/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; }

.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* subtle grain to keep flat dark surfaces from looking sterile */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 18px 0;
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s var(--ease-out-spring), border-color 0.4s var(--ease-out-spring), padding 0.3s var(--ease-out-spring);
}
.nav.scrolled {
  background: rgba(8,9,12,0.6);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom-color: var(--border-soft);
  padding: 12px 0;
}
.nav-inner {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.nav-links {
  display: flex;
  gap: 28px;
}
.nav-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--text); }

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

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  background: var(--surface);
}
.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out-spring), color 0.2s ease, transform 0.12s ease-out;
}
.lang-btn:active { transform: scale(0.94); }
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active {
  background: var(--accent-gradient);
  color: #07080a;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease-out, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:active { transform: scale(0.965); }

.btn-primary {
  background: var(--accent-gradient);
  color: #07080a;
  box-shadow: 0 8px 24px -8px rgba(139,124,255,0.55);
}
.btn-primary:hover { box-shadow: 0 10px 30px -6px rgba(139,124,255,0.7); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface); border-color: rgba(255,255,255,0.16); }

.btn-small { padding: 9px 18px; font-size: 0.85rem; }
.btn-large { padding: 15px 26px; font-size: 1rem; }

/* ---------- Typography ---------- */
.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 14px;
}

h1 {
  font-size: clamp(2.75rem, 6vw, 5.25rem);
  line-height: 1.03;
  letter-spacing: -0.03em;
  font-weight: 650;
  margin: 0 0 24px;
}

h2 {
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 650;
  margin: 0 0 20px;
}

h3 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 0 0 10px;
}

p { color: var(--text-secondary); margin: 0 0 16px; }
strong { color: var(--text); font-weight: 600; }

.center { text-align: center; }
.center.h2-wrap, h2.center, .eyebrow.center { margin-left: auto; margin-right: auto; }

.section-sub {
  max-width: 560px;
  margin: -8px auto 56px;
  font-size: 1.05rem;
}

/* ---------- Layout sections ---------- */
.section { padding: 120px 0; position: relative; z-index: 2; }
.section-alt { background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0) 40%); }

@media (max-width: 760px) {
  .section { padding: 80px 0; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 170px 0 120px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 900px;
  background:
    radial-gradient(600px 420px at 18% 10%, rgba(139,124,255,0.22), transparent 60%),
    radial-gradient(560px 420px at 82% 25%, rgba(76,154,255,0.16), transparent 60%);
  filter: blur(10px);
  z-index: 0;
  pointer-events: none;
}
.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 130px; }
}

.hero-sub {
  font-size: 1.15rem;
  max-width: 520px;
  margin-bottom: 32px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-meta { font-size: 0.85rem; color: var(--text-tertiary); margin: 0; }

/* ---------- Hero card mock ---------- */
.hero-visual { perspective: 1400px; }
.card-mock {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.02) inset;
  overflow: hidden;
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  will-change: transform;
}
.card-mock-top {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.02);
}
.dot { width: 9px; height: 9px; border-radius: 50%; opacity: 0.85; }
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }
.card-mock-title {
  margin-left: 10px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.card-mock-body {
  padding: 48px 32px 40px;
  text-align: center;
}
.card-mock-tag {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 22px;
}
.card-mock-word {
  font-size: 2.1rem;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.card-mock-phonetic {
  color: var(--accent-2);
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.card-mock-def {
  color: var(--text-secondary);
  margin: 0;
}
.card-mock-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border-soft);
}
.grade {
  appearance: none;
  border: none;
  border-right: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text);
  padding: 14px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  font: inherit;
}
.grade:last-child { border-right: none; }
.grade:hover { background: rgba(255,255,255,0.04); }
.grade span { font-size: 0.85rem; font-weight: 600; }
.grade small { font-size: 0.72rem; color: var(--text-tertiary); }
.grade-again span { color: var(--again); }
.grade-hard span { color: var(--hard); }
.grade-good span { color: var(--good); }
.grade-easy span { color: var(--easy); }

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 56px;
}
@media (max-width: 860px) {
  .feature-grid { grid-template-columns: 1fr; }
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 30px 26px;
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.3s var(--ease-out-spring);
}
.feature-card:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  transform: translateY(-3px);
}
.feature-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-gradient);
  color: #07080a;
  margin-bottom: 18px;
}
.feature-card p { font-size: 0.95rem; margin: 0; }

/* ---------- FSRS band ---------- */
.fsrs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 900px) {
  .fsrs-grid { grid-template-columns: 1fr; }
}
.fsrs-points li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.fsrs-points li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-gradient);
}
.fsrs-chart {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.fsrs-svg { width: 100%; height: auto; display: block; }
.curve-fsrs { stroke-dasharray: 900; stroke-dashoffset: 900; transition: stroke-dashoffset 1.4s var(--ease-out-spring); }
.curve-forget { stroke-dasharray: 500; stroke-dashoffset: 500; transition: stroke-dashoffset 1.4s var(--ease-out-spring) 0.15s; }
.fsrs-chart.is-visible .curve-fsrs,
.fsrs-chart.is-visible .curve-forget { stroke-dashoffset: 0; }

/* ---------- AI demo ---------- */
.ai-demo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
  max-width: 880px;
  margin: 0 auto;
}
@media (max-width: 760px) {
  .ai-demo { grid-template-columns: 1fr; }
  .ai-arrow { transform: rotate(90deg); justify-self: center; }
}
.ai-panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 24px;
}
.ai-panel-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.ai-panel-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}
.ai-arrow { color: var(--accent-2); justify-self: center; }
.ai-card {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.9rem;
}
.ai-card:last-child { border-bottom: none; }
.ai-card strong { color: var(--text); }
.ai-card span { color: var(--text-tertiary); text-align: right; }

/* ---------- Roadmap ---------- */
.roadmap-grid {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}
.roadmap-card {
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
}
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #07080a;
  background: var(--accent-gradient);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}
.roadmap-note {
  margin-top: 28px;
  font-size: 0.9rem;
  color: var(--text-tertiary);
}
.inline-link { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Download ---------- */
.download-section { text-align: center; }
.download-grid { display: flex; flex-direction: column; align-items: center; }
.download-copy { max-width: 560px; }
.download-copy .eyebrow { text-align: center; }
.download-fineprint {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin: 16px 0 32px;
}
.requirements {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  font-size: 0.88rem;
  color: var(--text-tertiary);
}
.requirements li { position: relative; padding-left: 18px; }
.requirements li::before {
  content: "";
  position: absolute; left: 0; top: 7px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-tertiary);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border-soft);
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.brand-footer { font-size: 0.95rem; }
.footer-copy { color: var(--text-tertiary); font-size: 0.82rem; margin: 0; }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease-out-spring), transform 0.7s var(--ease-out-spring);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .curve-fsrs, .curve-forget {
    stroke-dashoffset: 0;
    transition: none;
  }
  .card-mock { transform: none !important; }
}
