:root {
    color-scheme: light dark;
    --paper: #fbfbf9;
    --surface: #ffffff;
    --surface-2: #f4f4f0;
    --ink: #1a1a1f;
    --muted: #6a6a76;
    --gutter: #b3b3bb;
    --line: #e7e7e0;
    --accent: #4f46e5;
    --accent-soft: #eeecfb;
    --tok-key: #c42e63;
    --tok-str: #0b7a57;
    --tok-num: #a8600c;
    --shadow: 0 1px 2px rgba(20,20,40,.04), 0 8px 28px rgba(20,20,40,.07);
    --shadow-lift: 0 2px 6px rgba(20,20,40,.06), 0 18px 46px rgba(20,20,40,.12);
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius: 14px;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --paper: #141419;
      --surface: #1c1c22;
      --surface-2: #232329;
      --ink: #e9e9ee;
      --muted: #9494a1;
      --gutter: #47474f;
      --line: #2a2a31;
      --accent: #8b93f9;
      --accent-soft: #232338;
      --tok-key: #ff86bc;
      --tok-str: #7fe0a6;
      --tok-num: #ecb574;
      --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.4);
      --shadow-lift: 0 2px 6px rgba(0,0,0,.35), 0 20px 50px rgba(0,0,0,.5);
    }
  }
  :root[data-theme="light"] {
    color-scheme: light;
    --paper: #fbfbf9; --surface: #ffffff; --surface-2: #f4f4f0; --ink: #1a1a1f;
    --muted: #6a6a76; --gutter: #b3b3bb; --line: #e7e7e0; --accent: #4f46e5;
    --accent-soft: #eeecfb; --tok-key: #c42e63; --tok-str: #0b7a57; --tok-num: #a8600c;
    --shadow: 0 1px 2px rgba(20,20,40,.04), 0 8px 28px rgba(20,20,40,.07);
    --shadow-lift: 0 2px 6px rgba(20,20,40,.06), 0 18px 46px rgba(20,20,40,.12);
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #141419; --surface: #1c1c22; --surface-2: #232329; --ink: #e9e9ee;
    --muted: #9494a1; --gutter: #47474f; --line: #2a2a31; --accent: #8b93f9;
    --accent-soft: #232338; --tok-key: #ff86bc; --tok-str: #7fe0a6; --tok-num: #ecb574;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.4);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.35), 0 20px 50px rgba(0,0,0,.5);
  }

  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  a { color: inherit; }
  ::selection { background: var(--accent); color: #fff; }

  .wrap { max-width: 1060px; margin: 0 auto; padding: 0 24px; }

  /* ---- top bar ---- */
  header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--paper) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .bar { display: flex; align-items: center; gap: 14px; height: 60px; }
  .brand { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-weight: 600; letter-spacing: -.02em; text-decoration: none; }
  .brand .name { font-size: 16px; }
  .brand .name b { color: var(--accent); }
  nav.top { margin-left: auto; display: flex; align-items: center; gap: 4px; }
  nav.top a {
    font-family: var(--mono); font-size: 13px; color: var(--muted);
    text-decoration: none; padding: 8px 12px; border-radius: 8px;
  }
  nav.top a:hover { color: var(--ink); background: var(--surface-2); }
  .toggle {
    display: inline-grid; place-items: center; width: 36px; height: 36px;
    border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
    color: var(--muted); cursor: pointer; margin-left: 6px;
  }
  .toggle:hover { color: var(--ink); border-color: var(--gutter); }
  .toggle svg { width: 17px; height: 17px; }
  .toggle .moon { display: none; }
  /* Icon swap also enforced in CSS so it's correct before JS runs / if JS is off. */
  :root[data-theme="dark"] .toggle .sun { display: none; }
  :root[data-theme="dark"] .toggle .moon { display: block; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .toggle .sun { display: none; }
    :root:not([data-theme="light"]) .toggle .moon { display: block; }
  }

  /* ---- section label (code-comment motif) ---- */
  .eyebrow {
    font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
    color: var(--muted); display: flex; align-items: center; gap: 8px;
  }
  .eyebrow .ln { color: var(--gutter); font-variant-numeric: tabular-nums; }
  .eyebrow .cm { color: var(--tok-str); }

  /* ---- hero ---- */
  .hero { padding: 74px 0 40px; }
  .hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
  h1 {
    font-family: var(--mono); font-weight: 650; letter-spacing: -.03em;
    font-size: clamp(34px, 5vw, 54px); line-height: 1.06; margin: 18px 0 0;
    text-wrap: balance;
  }
  h1 .tok-key { color: var(--tok-key); }
  h1 .tok-str { color: var(--tok-str); }
  .lede { font-size: 18px; color: var(--muted); margin: 20px 0 0; max-width: 46ch; }
  .cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; align-items: center; }
  .btn {
    font-family: var(--mono); font-size: 14px; font-weight: 550;
    display: inline-flex; align-items: center; gap: 9px;
    padding: 13px 20px; border-radius: 11px; text-decoration: none; cursor: pointer;
    border: 1px solid transparent; transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  }
  .btn svg { width: 17px; height: 17px; }
  .btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
  .btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
  .btn-ghost:hover { border-color: var(--gutter); }
  .cta-sub { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 14px; }
  .cta-sub a { color: var(--accent); text-decoration: none; }
  .cta-sub a:hover { text-decoration: underline; }

  /* ---- editor window mock ---- */
  .editor {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-lift); overflow: hidden; font-family: var(--mono);
  }
  .ed-bar { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
  .dot { width: 11px; height: 11px; border-radius: 50%; }
  .dot.r { background: #ff5f57; } .dot.y { background: #febc2e; } .dot.g { background: #28c840; }
  .ed-tab { margin-left: 10px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
  .ed-tab .fdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
  .ed-body { display: grid; grid-template-columns: 46px 1fr; font-size: 13.5px; line-height: 1.85; }
  .ed-gutter { text-align: right; padding: 16px 12px 20px 0; color: var(--gutter); user-select: none; font-variant-numeric: tabular-nums; border-right: 1px solid var(--line); }
  .ed-code { padding: 16px 16px 20px 16px; white-space: pre; overflow-x: auto; }
  .ed-code .k { color: var(--tok-key); }
  .ed-code .s { color: var(--tok-str); }
  .ed-code .n { color: var(--tok-num); }
  .ed-code .c { color: var(--muted); font-style: italic; }
  .caret { display: inline-block; width: 8px; height: 1.05em; vertical-align: -0.18em; background: var(--accent); margin-left: 1px; animation: blink 1.1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }

  /* ---- download ---- */
  section { padding: 56px 0; }
  .sec-head { max-width: 62ch; }
  h2 { font-family: var(--mono); font-weight: 640; letter-spacing: -.02em; font-size: clamp(24px, 3.4vw, 32px); margin: 12px 0 0; text-wrap: balance; }
  .sec-head p { color: var(--muted); font-size: 16.5px; margin: 12px 0 0; }

  .dl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 34px; }
  .card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow);
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  }
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
  .card.rec { border-color: var(--accent); }
  .card-top { display: flex; align-items: center; gap: 12px; }
  .os-ico { width: 34px; height: 34px; color: var(--ink); flex: 0 0 auto; }
  .os-ico svg { width: 100%; height: 100%; }
  .card h3 { margin: 0; font-family: var(--mono); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
  .card .plat-sub { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 2px; }
  .rec-badge { margin-left: auto; font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 8px; border-radius: 20px; }
  .primary-dl {
    font-family: var(--mono); font-size: 13.5px; font-weight: 550;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 14px; border-radius: 10px; text-decoration: none;
    background: var(--accent); color: #fff; margin-top: auto;
  }
  .primary-dl:hover { filter: brightness(1.06); }
  .primary-dl .sz { font-weight: 450; opacity: .8; font-variant-numeric: tabular-nums; }
  .alts { display: flex; flex-wrap: wrap; gap: 8px; }
  .alt {
    font-family: var(--mono); font-size: 12px; text-decoration: none; color: var(--muted);
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
    display: inline-flex; gap: 7px; align-items: center;
  }
  .alt:hover { color: var(--ink); border-color: var(--gutter); }
  .alt .sz { color: var(--gutter); font-variant-numeric: tabular-nums; }
  .card.soon { opacity: .82; }
  .soon-tag { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: auto; padding: 11px 0 2px; border-top: 1px dashed var(--line); }

  .dl-note {
    margin-top: 22px; font-family: var(--mono); font-size: 12.5px; color: var(--muted);
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 15px; display: flex; gap: 10px; align-items: flex-start;
  }
  .dl-note b { color: var(--ink); font-weight: 600; }

  /* ---- features ---- */
  .feat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 40px; margin-top: 34px; }
  .feat { display: flex; flex-direction: column; gap: 8px; }
  .feat h4 { margin: 4px 0 0; font-family: var(--mono); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
  .feat p { margin: 0; color: var(--muted); font-size: 15px; }
  .feat .tag { font-family: var(--mono); font-size: 12px; color: var(--tok-str); }
  .feat .tag::before { content: "// "; color: var(--gutter); }

  .parity {
    margin-top: 40px; border-top: 1px solid var(--line); padding-top: 30px;
    display: flex; flex-wrap: wrap; gap: 10px;
  }
  .chip {
    font-family: var(--mono); font-size: 12.5px; color: var(--muted);
    border: 1px solid var(--line); border-radius: 20px; padding: 6px 13px; background: var(--surface);
  }
  .chip b { color: var(--ink); }

  /* ---- themes strip ---- */
  .themes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 30px; }
  .swatch { border-radius: 12px; border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow); }
  .sw-canvas { height: 74px; display: flex; align-items: flex-end; gap: 5px; padding: 12px; }
  .sw-canvas i { width: 12px; border-radius: 3px; display: block; }
  .sw-name { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding: 8px 11px; border-top: 1px solid var(--line); background: var(--surface); }

  /* ---- footer ---- */
  footer { border-top: 1px solid var(--line); padding: 40px 0 60px; margin-top: 30px; }
  .foot { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: center; justify-content: space-between; }
  .foot .col { display: flex; flex-direction: column; gap: 6px; }
  .foot .muted { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
  .foot a { font-family: var(--mono); font-size: 13px; color: var(--muted); text-decoration: none; }
  .foot a:hover { color: var(--accent); }
  .foot .links { display: flex; gap: 18px; flex-wrap: wrap; }

  @media (max-width: 860px) {
    .hero-grid { grid-template-columns: 1fr; gap: 34px; }
    .hero { padding: 44px 0 20px; }
    .dl-grid { grid-template-columns: 1fr; }
    .feat-grid { grid-template-columns: 1fr; }
    .themes { grid-template-columns: repeat(3, 1fr); }
    nav.top a:not(.gh) { display: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    .caret { animation: none; }
    .btn, .card { transition: none; }
  }

  /* ---- SEO content prose ---- */
  .prose { max-width: 68ch; }
  .prose p { color: var(--ink); font-size: 16px; margin: 14px 0 0; }
  .prose p:first-child { margin-top: 0; }
  .prose a { color: var(--accent); text-decoration: none; }
  .prose a:hover { text-decoration: underline; }
  .prose h3 { font-family: var(--mono); font-size: 18px; margin: 30px 0 0; letter-spacing: -.01em; }

  /* ---- FAQ (accordion) ---- */
  .faq { margin-top: 30px; display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
  .faq details { border-bottom: 1px solid var(--line); }
  .faq summary {
    list-style: none; cursor: pointer; padding: 18px 4px; display: flex;
    justify-content: space-between; align-items: center; gap: 16px;
    font-family: var(--mono); font-size: 15.5px; font-weight: 550; color: var(--ink);
  }
  .faq summary::-webkit-details-marker { display: none; }
  .faq summary::after { content: "+"; font-family: var(--mono); font-size: 20px; color: var(--accent); flex: 0 0 auto; transition: transform .15s ease; }
  .faq details[open] summary::after { content: "\2013"; }
  .faq .ans { padding: 0 4px 20px; color: var(--muted); font-size: 15px; max-width: 70ch; }
  .faq .ans a { color: var(--accent); text-decoration: none; }
  .faq .ans a:hover { text-decoration: underline; }

  /* ---- Ad slot ---- */
  .ad-slot {
    margin: 40px 0; text-align: center; min-height: 90px;
    display: flex; align-items: center; justify-content: center;
    border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2);
  }
  .ad-slot .ph { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gutter); }
  .ad-slot ins { display: block; width: 100%; }

  /* ---- Legal / content pages ---- */
  .doc { padding: 60px 0 40px; }
  .doc .prose { max-width: 72ch; }
  .doc h1 { font-family: var(--mono); font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; margin: 12px 0 6px; }
  .doc .updated { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
  .doc h2 { font-size: 22px; margin-top: 34px; }
  .doc ul { color: var(--ink); padding-left: 22px; margin: 12px 0 0; }
  .doc li { margin: 6px 0; }
  .doc .prose p { margin-top: 12px; }
  .breadcrumb { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
  .breadcrumb a { color: var(--accent); text-decoration: none; }

  /* contact form */
  .cform { display: flex; flex-direction: column; gap: 14px; max-width: 480px; margin-top: 24px; }
  .cform label { font-family: var(--mono); font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
  .cform input, .cform textarea {
    font-family: var(--sans); font-size: 15px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  }
  .cform input:focus, .cform textarea:focus { outline: none; border-color: var(--accent); }
  .cform button { align-self: flex-start; }

  .lang-sel {
    font-family: var(--mono); font-size: 12.5px; color: var(--muted);
    background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
    padding: 7px 8px; margin-left: 6px; cursor: pointer;
  }
  .lang-sel:hover { color: var(--ink); border-color: var(--gutter); }
  /* Keep the language picker on mobile — it's the only way to switch languages
     there (nav links collapse); just tighten it. */
  @media (max-width: 860px) { .lang-sel { font-size: 11.5px; padding: 6px 5px; max-width: 96px; } }

/* ---- Animated hero AI demo ---- */
.ai-demo-body { display: block; min-height: 232px; position: relative; padding: 18px 18px 64px 18px; }
.ai-badge {
  margin-left: auto; font-size: 10.5px; letter-spacing: .04em; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  padding: 4px 9px; border-radius: 20px;
}
.ai-demo-code { display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; line-height: 1.7; }
.ai-line { white-space: pre-wrap; word-break: break-word; }
.ai-line.ctx { color: var(--muted); font-style: italic; }
.ai-line.active {
  position: relative; border-radius: 6px; padding: 3px 8px; margin: -3px -8px;
  transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}
.ai-line.active.selected { background: var(--accent); color: #fff; }
.ai-line.active.selected .sel-caret { background: #fff; }
.ai-line.active.applied {
  background: color-mix(in srgb, var(--tok-str) 16%, transparent);
  box-shadow: inset 2px 0 0 var(--tok-str);
  color: var(--tok-str);
}
.sel-caret {
  display: inline-block; width: 7px; height: 1.05em; vertical-align: -0.18em;
  background: var(--accent); margin-left: 2px; animation: blink 1.1s steps(1) infinite;
}
.ai-line.applied .sel-caret { display: none; }

.ai-bar {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--accent);
  border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.12);
  opacity: 0; transform: translateY(10px);
  transition: opacity .28s ease, transform .28s ease;
}
.ai-bar.show { opacity: 1; transform: translateY(0); }
.ai-bar-ic { color: var(--accent); }
.ai-bar-text { color: var(--fg); flex: 1 1 auto; min-width: 0; }
.ai-bar-status { color: var(--accent); font-weight: 600; white-space: nowrap; }
.ai-bar-status.thinking::after {
  content: "●●●"; letter-spacing: 1px; margin-left: 5px;
  animation: ai-dots 1.1s ease-in-out infinite;
}
@keyframes ai-dots { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .sel-caret, .ai-bar-status.thinking::after { animation: none; }
  .ai-bar { transition: none; }
}

/* Accessibility: visible keyboard focus (site had none) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Form fields already indicate focus via border-color; don't double up */
.cform input:focus-visible,
.cform textarea:focus-visible {
  outline: none;
}
/* Download cards are links — give them a clear focus ring on their own radius */
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---- Support & waitlist section ---- */
#support { padding-top: 8px; }
.support-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 26px;
}
.support-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.support-card h3 { margin: 0 0 6px; font-size: 18px; }
.support-card .muted { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.support-card .muted.sm { font-size: 12.5px; margin: 10px 0 0; }
.donate-row { display: flex; flex-wrap: wrap; gap: 10px; }
.wait-form { display: flex; gap: 8px; flex-wrap: wrap; }
.wait-form input[type="email"] {
  flex: 1 1 200px;
  min-width: 0;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.wait-form input[type="email"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.wait-msg { font-size: 13.5px; margin: 12px 0 0; min-height: 1em; }
.wait-msg.ok { color: var(--tok-str); }
.wait-msg.err { color: #c0392b; }
@media (max-width: 720px) {
  .support-grid { grid-template-columns: 1fr; }
}
