:root {
    --bg: #07070c;
    --panel: rgba(255, 255, 255, 0.04);
    --panel-2: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.09);
    --text: #f4f5fb;
    --muted: #9aa0b8;
    --cyan: #22d3ee;
    --indigo: #6366f1;
    --magenta: #e879f9;
    --warn: #fbbf24;
    --grad: linear-gradient(100deg, #22d3ee 0%, #6366f1 50%, #e879f9 100%);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; scroll-padding-top: 84px; }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }
  a { color: inherit; text-decoration: none; }
  button { font: inherit; color: inherit; }
  .wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
  :focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
  kbd {
    font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    padding: 4px 7px; border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 6px; background: var(--panel-2); color: var(--text); white-space: nowrap;
  }
  code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; color: var(--cyan); }

  /* ---------- Ambient background ---------- */
  .glow { position: fixed; border-radius: 50%; filter: blur(120px); opacity: 0.5; z-index: 0; pointer-events: none; }
  .glow.cyan { width: 520px; height: 520px; background: #0891b2; top: -160px; left: -140px; }
  .glow.mag  { width: 560px; height: 560px; background: #a21caf; top: 120px; right: -180px; }
  .glow.blue { width: 480px; height: 480px; background: #1e3a8a; bottom: -220px; left: 30%; }

  /* ---------- Nav ---------- */
  header {
    position: sticky; top: 0; z-index: 20; padding: 14px 0;
    transition: background 0.25s, border-color 0.25s, backdrop-filter 0.25s;
    border-bottom: 1px solid transparent;
  }
  header.stuck { background: rgba(7,7,12,0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom-color: var(--border); }
  .nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: 0.5px; font-size: 20px; }
  .brand img { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 0 24px rgba(34,211,238,0.35); }
  .brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .nav-links { display: flex; gap: 6px; font-size: 14.5px; color: var(--muted); }
  .nav-links a { padding: 7px 13px; border-radius: 999px; transition: color 0.15s, background 0.15s; }
  .nav-links a:hover { color: var(--text); }
  .nav-links a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border); }
  @media (max-width: 760px) {
    .nav { flex-direction: column; align-items: stretch; gap: 8px; }
    .brand { justify-content: center; }
    .nav-links { overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; scrollbar-width: none; }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a { white-space: nowrap; }
  }

  /* scroll progress */
  #progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--grad); z-index: 30; }

  /* ---------- Hero ---------- */
  .hero { position: relative; z-index: 2; text-align: center; padding: 40px 0 40px; }
  .hero-logo {
    width: 112px; height: 112px; border-radius: 26px; margin: 0 auto 28px; display: block;
    box-shadow: 0 0 60px rgba(34,211,238,0.35), 0 0 90px rgba(232,121,249,0.25);
    animation: float 6s ease-in-out infinite;
  }
  @keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

  .badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--panel);
    font-size: 13px; color: var(--muted); margin-bottom: 26px; backdrop-filter: blur(8px);
  }
  .badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

  h1 { font-size: clamp(2.5rem, 6.4vw, 4.4rem); line-height: 1.05; font-weight: 800; letter-spacing: -1.5px; margin-bottom: 22px; }
  h1 .grad, .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .sub { font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--muted); max-width: 680px; margin: 0 auto 36px; }

  .cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
  .btn {
    display: inline-block; padding: 14px 28px; border: none; border-radius: 12px; background: var(--grad);
    color: #07070c; font-weight: 700; font-size: 15px; cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s; box-shadow: 0 8px 30px rgba(99,102,241,0.4);
  }
  .btn:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(99,102,241,0.55); }
  .btn.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
  .btn.ghost:hover { border-color: rgba(34,211,238,0.4); box-shadow: none; }

  .platforms { margin-top: 36px; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
  .chip { padding: 8px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-weight: 600; color: var(--text); }

  /* App window frame */
  .shot-hero { position: relative; z-index: 2; margin: 28px auto 20px; max-width: 1040px; perspective: 1400px; }
  .window {
    border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #0b0c12;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 80px rgba(99,102,241,0.18), 0 0 120px rgba(34,211,238,0.08);
  }
  .window .bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; background: rgba(255,255,255,0.04); border-bottom: 1px solid var(--border); }
  .window .bar i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,0.16); }
  .window .bar span { margin-left: 10px; font-size: 12px; color: var(--muted); }
  .window img { display: block; width: 100%; height: auto; }
  .shot-hero .window { transition: transform 0.4s ease; transform: rotateX(2.5deg); transform-origin: 50% 100%; }
  .shot-hero:hover .window { transform: rotateX(0); }

  /* ---------- Sections ---------- */
  section.block { position: relative; z-index: 2; padding: 40px 0 90px; }
  .section-head { text-align: center; margin-bottom: 44px; }
  .eyebrow { display: inline-block; font-size: 12.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--cyan); font-weight: 700; margin-bottom: 10px; }
  .section-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.5px; margin-bottom: 12px; }
  .section-head p { color: var(--muted); max-width: 640px; margin: 0 auto; }

  /* Reveal on scroll (only when JS is running) */
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; transition-delay: var(--d, 0ms); }
  .js .reveal.in { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) {
    .js .reveal { opacity: 1; transform: none; transition: none; }
    .hero-logo { animation: none; }
    html { scroll-behavior: auto; }
  }

  /* Why / drift explainer */
  .why {
    max-width: 880px; margin: 0 auto; padding: 34px 36px; border-radius: 20px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  }
  .why p { color: var(--muted); font-size: 1.05rem; margin-bottom: 14px; }
  .why p:last-child { margin-bottom: 0; }
  .why strong { color: var(--text); }

  /* Drift demo */
  .demo { max-width: 880px; margin: 24px auto 0; padding: 26px 30px 28px; border-radius: 20px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); }
  .demo-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; justify-content: space-between; margin-bottom: 18px; }
  .demo h3 { font-size: 1.1rem; }
  .demo label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 12px; }
  .demo output { min-width: 4.2em; text-align: right; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
  input[type=range] { -webkit-appearance: none; appearance: none; width: 220px; max-width: 46vw; height: 6px; border-radius: 999px; background: var(--border); outline-offset: 6px; }
  input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--grad); border: 2px solid #07070c; box-shadow: 0 0 14px rgba(34,211,238,0.6); cursor: pointer; }
  input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--cyan); border: 2px solid #07070c; cursor: pointer; }
  .lane { margin-top: 10px; }
  .lane .cap { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
  .lane .cap b { color: var(--text); }
  .lane svg { display: block; width: 100%; height: 54px; background: rgba(0,0,0,0.25); border-radius: 10px; border: 1px solid var(--border); }
  .axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 6px 2px 0; }
  .readout { margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: rgba(232,121,249,0.08); border: 1px solid rgba(232,121,249,0.25); font-size: 15px; }
  .readout b { color: var(--magenta); font-variant-numeric: tabular-nums; }
  .legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13px; color: var(--muted); }
  .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

  /* Tabs (shared) */
  .tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
  .tab {
    padding: 9px 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel);
    color: var(--muted); cursor: pointer; font-size: 14.5px; font-weight: 600; transition: all 0.15s;
  }
  .tab:hover { color: var(--text); border-color: rgba(34,211,238,0.4); }
  .tab[aria-selected="true"], .tab.on { color: #07070c; background: var(--grad); border-color: transparent; }

  /* Screenshots */
  .gallery { max-width: 1040px; margin: 0 auto; }
  .gallery .window { cursor: zoom-in; }
  .gallery figure { display: none; }
  .gallery figure.on { display: block; animation: fade 0.35s ease; }
  @keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .gallery figcaption { text-align: center; color: var(--muted); font-size: 15px; margin-top: 18px; max-width: 700px; margin-inline: auto; }
  .gallery figcaption strong { color: var(--text); }
  .legend-keys { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
  .legend-keys i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 7px; vertical-align: -2px; }

  /* Lightbox */
  #lightbox { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(4,4,8,0.88); backdrop-filter: blur(6px); padding: 3vmin; cursor: zoom-out; }
  #lightbox.open { display: grid; }
  #lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 80px rgba(0,0,0,0.7); }
  #lightbox .x { position: absolute; top: 16px; right: 20px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; font-size: 20px; line-height: 1; }

  /* Features grid */
  .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
  .card {
    padding: 30px; border: 1px solid var(--border); border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    transition: transform 0.2s, border-color 0.2s, opacity 0.3s;
  }
  .card:hover { transform: translateY(-4px); border-color: rgba(34,211,238,0.4); }
  .card.off { display: none; }
  .card .ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 18px; background: rgba(34,211,238,0.12); font-size: 24px; }
  .card h3 { font-size: 1.2rem; margin-bottom: 10px; }
  .card p { color: var(--muted); font-size: 15px; }
  .card .tag { display: inline-block; margin-top: 14px; font-size: 12px; color: var(--cyan); letter-spacing: 0.5px; }

  /* Shortcuts */
  .keys { margin-top: 56px; }
  .keys h3 { text-align: center; font-size: 1.35rem; margin-bottom: 22px; }
  .keygrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
  .keyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); font-size: 14.5px; color: var(--muted); }
  .keyrow .k { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

  /* Getting started */
  .steps { max-width: 880px; margin: 0 auto; counter-reset: step; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .step {
    position: relative; padding: 24px 26px 24px 78px; border: 1px solid var(--border); border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015)); counter-increment: step;
  }
  .step::before {
    content: counter(step); position: absolute; left: 22px; top: 22px; width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 800; color: #07070c; background: var(--grad);
    box-shadow: 0 0 22px rgba(99,102,241,0.45);
  }
  .step { min-width: 0; }
  .step.cli { counter-increment: none; }
  .step.cli::before { content: ">_"; font-size: 14px; }
  .step h3 { font-size: 1.1rem; margin-bottom: 6px; }
  .step p, .step li { color: var(--muted); font-size: 15px; }
  .step ul { margin: 8px 0 0 18px; display: grid; gap: 4px; }
  .step strong { color: var(--text); }
  .note { margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-size: 14px; background: rgba(251,191,36,0.07); border: 1px solid rgba(251,191,36,0.28); color: #f3dba2; }
  .os-pane { display: none; }
  .os-pane.on { display: block; }
  .os-tabs { display: flex; gap: 8px; margin: 12px 0 6px; }
  .os-tabs .tab { padding: 6px 14px; font-size: 13.5px; }

  .code { position: relative; margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; background: rgba(0,0,0,0.4); }
  .code pre { overflow-x: auto; padding: 16px 18px; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #cfe9f3; }
  .copy { position: absolute; top: 8px; right: 8px; padding: 5px 11px; font-size: 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; color: var(--muted); }
  .copy:hover { color: var(--text); border-color: rgba(34,211,238,0.4); }

  .compat { max-width: 880px; margin: 26px auto 0; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
  .compat table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
  .compat th, .compat td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--border); }
  .compat tr:last-child td { border-bottom: none; }
  .compat th { color: var(--text); background: rgba(255,255,255,0.04); font-weight: 700; }
  .compat td { color: var(--muted); }
  .compat td:first-child { color: var(--text); font-weight: 600; }
  @media (max-width: 560px) { .compat th, .compat td { padding: 10px 12px; font-size: 13.5px; } .step { padding-left: 66px; } .step::before { left: 16px; } .demo, .why { padding-left: 20px; padding-right: 20px; } }

  /* Troubleshooting */
  .ts-tools { max-width: 880px; margin: 0 auto 18px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
  .ts-tools input[type=search] {
    flex: 1 1 260px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); font: inherit; font-size: 15px;
  }
  .ts-tools input::placeholder { color: var(--muted); }
  .ts-tools input:focus { outline: none; border-color: rgba(34,211,238,0.6); box-shadow: 0 0 0 3px rgba(34,211,238,0.15); }
  .ts-tools .tab { padding: 10px 16px; }
  .ts-cats { max-width: 880px; margin: 0 auto 18px; display: flex; gap: 8px; flex-wrap: wrap; }
  .ts-cats .tab { padding: 6px 14px; font-size: 13.5px; }
  .faq { max-width: 880px; margin: 0 auto; display: grid; gap: 10px; }
  .faq details { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); transition: border-color 0.2s, background 0.2s; }
  .faq details[open] { border-color: rgba(34,211,238,0.35); background: rgba(255,255,255,0.055); }
  .faq summary { list-style: none; cursor: pointer; padding: 16px 52px 16px 20px; font-weight: 600; position: relative; }
  .faq summary::-webkit-details-marker { display: none; }
  .faq summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--cyan); transition: transform 0.2s; }
  .faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
  .faq .a { padding: 0 20px 18px; color: var(--muted); font-size: 15px; }
  .faq .a p + p, .faq .a ul, .faq .a ol { margin-top: 10px; }
  .faq .a ul, .faq .a ol { margin-left: 20px; display: grid; gap: 4px; }
  .faq .a strong { color: var(--text); }
  .faq .pill { display: inline-block; margin-left: 8px; padding: 2px 9px; font-size: 11px; letter-spacing: 0.5px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); vertical-align: 2px; font-weight: 600; }
  .faq .hidden { display: none; }
  #ts-empty { max-width: 880px; margin: 18px auto 0; text-align: center; color: var(--muted); display: none; }

  /* ---------- Footer ---------- */
  footer { position: relative; z-index: 2; border-top: 1px solid var(--border); padding: 34px 0; text-align: center; color: var(--muted); font-size: 14px; }
  footer .brand { justify-content: center; font-size: 16px; margin-bottom: 12px; }
  footer .brand img { width: 30px; height: 30px; }
  footer .flinks { display: flex; gap: 20px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
  footer .flinks a:hover { color: var(--text); }

  /* ---------- Multi-page additions ---------- */
  .page-top { position: relative; z-index: 2; padding: 56px 0 0; }
  .teaser { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
  .teaser a.card { display: block; }
  .teaser .more { display: inline-block; margin-top: 14px; font-size: 14px; color: var(--cyan); font-weight: 600; }
  .teaser a.card:hover .more { text-decoration: underline; }
  .cta-band { max-width: 880px; margin: 0 auto; padding: 34px; text-align: center; border-radius: 20px; border: 1px solid var(--border); background: linear-gradient(120deg, rgba(34,211,238,0.08), rgba(99,102,241,0.08), rgba(232,121,249,0.08)); }
  .cta-band h3 { font-size: 1.4rem; margin-bottom: 8px; }
  .cta-band p { color: var(--muted); margin-bottom: 20px; }
  section.block.tight { padding-top: 10px; }
  .dl-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
  .dl-row .btn { padding: 11px 20px; font-size: 14px; }
