:root {
    --page: #E8ECF1;
    --ink: #17212C;
    --muted: #586676;
    --line: #CBD3DC;
    --window: #FFFFFF;
    --chrome: #F3F5F8;
    --loop: #FF2E40;
    --sticky: #FFF29E;
    --pill: rgba(18, 24, 31, 0.86);
    --term: #1B2430;
    --term-ink: #D8E1EA;
    --term-dim: #8796A6;
    --shadow: 0 1px 2px rgba(23, 33, 44, 0.06), 0 12px 40px rgba(23, 33, 44, 0.12);
    color-scheme: light;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --page: #151B22;
      --ink: #E6ECF2;
      --muted: #97A5B4;
      --line: #2C3642;
      --window: #1E2630;
      --chrome: #252E39;
      --loop: #FF4757;
      --sticky: #F2E27A;
      --pill: rgba(6, 9, 12, 0.88);
      --term: #10161D;
      --term-ink: #D8E1EA;
      --term-dim: #7D8B9A;
      --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 48px rgba(0, 0, 0, 0.4);
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --page: #151B22;
    --ink: #E6ECF2;
    --muted: #97A5B4;
    --line: #2C3642;
    --window: #1E2630;
    --chrome: #252E39;
    --loop: #FF4757;
    --sticky: #F2E27A;
    --pill: rgba(6, 9, 12, 0.88);
    --term: #10161D;
    --term-ink: #D8E1EA;
    --term-dim: #7D8B9A;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 48px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }

  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 400 1.0625rem/1.6 "Schibsted Grotesk", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  a { color: inherit; }
  a:focus-visible, button:focus-visible {
    outline: 3px solid var(--loop);
    outline-offset: 3px;
    border-radius: 6px;
  }
  .wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

  /* Nav */
  .nav {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 22px; padding-bottom: 22px;
  }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; text-decoration: none; letter-spacing: -0.01em; }
  .brand svg { width: 22px; height: 22px; }
  .nav-links { display: flex; align-items: center; gap: 18px; font-weight: 500; }
  .nav-links a { text-decoration: none; color: var(--muted); }
  .nav-links a:hover { color: var(--ink); }
  .theme-btn {
    border: 1px solid var(--line); background: transparent; color: var(--muted);
    width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px;
  }

  /* Hero */
  .hero {
    display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 56px; align-items: center;
    padding-top: 48px; padding-bottom: 88px;
  }
  h1 {
    font-weight: 800; font-size: clamp(2.1rem, 8.4vw, 3.5rem); line-height: 1.02;
    letter-spacing: -0.035em; margin: 0 0 24px;
  }
  h1 .line { display: block; }
  h1 .hit { color: var(--loop); }
  h1 .show-it { font-size: 1.3em; line-height: 1; margin-top: 4px; }
  .lede { font-size: 1.2rem; color: var(--muted); max-width: 32em; margin: 0 0 32px; }
  .lede strong { color: var(--ink); font-weight: 500; }
  .ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
  .btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 13px 22px; border-radius: 999px; font-weight: 700; text-decoration: none;
    border: 1.5px solid var(--ink); font-size: 1rem;
  }
  .btn-primary { background: var(--ink); color: var(--page); }
  .btn-primary:hover { background: transparent; color: var(--ink); }
  .btn-ghost:hover { background: var(--ink); color: var(--page); }
  .fine { color: var(--muted); font-size: 0.92rem; margin: 0; }
  .download-btn {
    display: inline-flex; align-items: center; gap: 10px; margin-bottom: 14px;
    padding: 15px 28px; border-radius: 999px; text-decoration: none;
    background: var(--loop); color: #fff; border: 1.5px solid var(--loop);
    font: 700 1.05rem/1 "Schibsted Grotesk", system-ui, sans-serif;
    box-shadow: var(--shadow); transition: transform 0.15s, filter 0.15s;
  }
  .download-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
  .install-hint a { color: var(--ink); }
  .cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
  .cta-row .download-btn { margin-bottom: 0; }
  .star-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 17px; border-radius: 999px; text-decoration: none;
    border: 1.5px solid var(--line); background: var(--window); color: var(--ink);
    font: 600 0.92rem/1 "Schibsted Grotesk", system-ui, sans-serif;
  }
  .star-btn:hover { border-color: var(--ink); }
  .star-btn #starCount { color: var(--muted); font-weight: 500; }

  /* Demo window */
  .demo { position: relative; }
  .window {
    background: var(--window); border-radius: 14px; box-shadow: var(--shadow);
    overflow: hidden; border: 1px solid var(--line);
  }
  .titlebar { display: flex; gap: 7px; padding: 12px 14px; background: var(--chrome); border-bottom: 1px solid var(--line); }
  .titlebar i { width: 11px; height: 11px; border-radius: 50%; background: var(--line); display: block; }
  .app { position: relative; padding: 28px 28px 76px; }
  .app h3 { margin: 0 0 4px; font-size: 1.05rem; }
  .app p { margin: 0 0 18px; color: var(--muted); font-size: 0.9rem; }
  .row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
  .row span:last-child { font-weight: 700; }
  .actions { display: flex; gap: 10px; margin-top: 22px; align-items: flex-start; }
  .fake-btn { padding: 9px 16px; border-radius: 8px; font-size: 0.88rem; font-weight: 700; border: 1px solid var(--line); background: var(--chrome); }
  .fake-btn.pay { background: #2F6BFF; color: #fff; border-color: #2F6BFF; margin-top: 11px; margin-left: 9px; }
  svg.ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
  .ink path { fill: none; stroke: var(--loop); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
  .note {
    position: absolute; font: 600 1.45rem/1 "Caveat", cursive; color: var(--loop);
    transform: rotate(-4deg); opacity: 0; transition: opacity 0.3s;
  }
  .pill {
    position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
    background: var(--pill); color: #fff; border-radius: 999px; padding: 9px 16px;
    font-size: 0.86rem; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
    opacity: 0; transition: opacity 0.25s;
  }
  .pill::before { content: "● "; color: var(--loop); }
  .term {
    margin-top: 14px; background: var(--term); color: var(--term-ink); border-radius: 12px;
    padding: 16px 18px; font: 500 0.82rem/1.55 ui-monospace, "SF Mono", Menlo, monospace;
    min-height: 118px; box-shadow: var(--shadow);
  }
  .term .dim { color: var(--term-dim); }
  .term .ok { color: #7FD8A0; }
  .term .line { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
  .keycap {
    display: inline-block; min-width: 1.9em; padding: 1px 7px; border-radius: 6px;
    border: 1px solid var(--line); border-bottom-width: 2.5px; background: var(--window);
    font-weight: 700; font-size: 0.86em; text-align: center; line-height: 1.5;
  }

  /* Try it */
  .tryit {
    position: relative; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: 64px 0; text-align: left;
  }
  .tryit h2, .section h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); letter-spacing: -0.025em; line-height: 1.1; margin: 0 0 12px; }
  .tryit p { color: var(--muted); max-width: 36em; margin: 0 0 20px; }
  .try-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 48px; align-items: center; }
  .try-card {
    background: var(--window); border: 1px solid var(--line); border-radius: 18px;
    box-shadow: var(--shadow); padding: 28px; text-align: left;
  }
  .try-card p { margin: 16px 0 0; }
  .draw-toggle {
    position: relative; z-index: 55; width: 100%;
    font: inherit; font-size: 1.1rem; font-weight: 800; padding: 16px 24px; border-radius: 999px; cursor: pointer;
    border: 1.5px solid var(--loop); background: var(--loop); color: #fff;
    box-shadow: var(--shadow);
  }
  .draw-toggle:hover { filter: brightness(1.06); }
  .draw-toggle[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--page); }
  @media (max-width: 880px) { .try-grid { grid-template-columns: 1fr; gap: 28px; } }
  .gesture dt { display: flex; align-items: center; gap: 12px; }
  .gesture dt svg {
    width: 26px; height: 26px; flex: none; fill: none; stroke: var(--loop);
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  }
  .watch { text-align: center; }
  .watch h2 { margin-bottom: 24px; }
  .watch-figure { margin: 0 auto 14px; }
  .watch-figure img {
    display: block; width: 100%; max-width: 800px; height: auto; margin: 0 auto;
    border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .watch .fine { text-align: center; }
  .watch .fine a { color: var(--ink); }
  .privacy { max-width: 46em; }
  .privacy h2 { margin-bottom: 14px; }
  .privacy p { color: var(--muted); margin: 0 0 12px; }
  #canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }
  body.drawing { cursor: crosshair; user-select: none; -webkit-user-select: none; }
  body.drawing #canvas { pointer-events: auto; }
  .toast {
    position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px);
    background: var(--pill); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 0.95rem;
    opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 60; pointer-events: none;
    max-width: calc(100vw - 32px); text-align: center;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  /* Gestures */
  .section { padding-top: 72px; padding-bottom: 72px; }
  .gestures { margin-top: 36px; border-top: 1.5px solid var(--ink); }
  .gesture {
    display: grid; grid-template-columns: 280px 1fr; gap: 32px; padding: 26px 0;
    border-bottom: 1px solid var(--line); align-items: baseline;
  }
  .gesture dt { font-weight: 700; font-size: 1.15rem; }
  .gesture dd { margin: 0; color: var(--muted); max-width: 40em; }
  .gesture dd strong { color: var(--ink); font-weight: 500; }

  /* Private + sticky */
  .split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
  .sticky-card {
    background: var(--sticky); color: #2A2615; border-radius: 12px; padding: 22px 24px 18px;
    box-shadow: var(--shadow); transform: rotate(1.2deg); max-width: 420px; justify-self: center;
    font-size: 1rem;
  }
  .sticky-card b { display: block; font-size: 0.8rem; color: #6B6440; margin-bottom: 8px; }
  .sticky-card p { margin: 0 0 6px; }
  .sticky-card small { display: block; margin-top: 14px; color: #6B6440; font-size: 0.78rem; }

  /* Install */
  .steps { counter-reset: step; list-style: none; padding: 0; margin: 32px 0 0; max-width: 46em; }
  .steps li { counter-increment: step; position: relative; padding: 0 0 26px 52px; }
  .steps li::before {
    content: counter(step); position: absolute; left: 0; top: -2px; width: 34px; height: 34px;
    border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; font-weight: 700;
  }
  .steps li strong { display: block; font-size: 1.08rem; margin-bottom: 4px; }
  .steps li span { color: var(--muted); }
  code, pre { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.86em; }
  :not(pre) > code { overflow-wrap: anywhere; background: var(--window); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
  pre { background: var(--term); color: var(--term-ink); padding: 14px 16px; border-radius: 10px; overflow-x: auto; margin: 10px 0 0; }

  .cmd { position: relative; margin-top: 10px; }
  .cmd pre { margin: 0; padding-right: 84px; }
  .copy {
    position: absolute; top: 8px; right: 8px; font: inherit; font-size: 0.82rem; font-weight: 700;
    padding: 6px 12px; border-radius: 7px; cursor: pointer;
    border: 1px solid var(--term-dim); background: transparent; color: var(--term-ink);
  }
  .copy:hover { border-color: var(--term-ink); }
  footer { border-top: 1px solid var(--line); padding: 28px 0 48px; color: var(--muted); font-size: 0.92rem; }
  footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

  @media (max-width: 880px) {
    .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 24px; }
    .split { grid-template-columns: 1fr; }
    .gesture { grid-template-columns: 1fr; gap: 6px; }
  }
  @media (max-width: 480px) {
    .wrap { padding: 0 16px; }
    .app { padding: 22px 18px 84px; }
    .nav-links .hide-sm { display: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    .note, .pill, .toast { transition: none; }
  }
