:root {
  color-scheme: light dark;
  --bg: #fbfbfd;
  --surface: #ffffff;
  --sunken: #f0f1f4;
  --text: #15161a;
  --muted: #6b6f7b;
  --line: #e2e4ea;
  --accent: #2f6bff;
  --accent-soft: #2f6bff1f;
  --finger: #2f6bff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f12;
    --surface: #17191e;
    --sunken: #1f2228;
    --text: #f2f3f5;
    --muted: #9a9fad;
    --line: #2a2d35;
    --accent: #5b8cff;
    --accent-soft: #5b8cff2b;
    --finger: #7aa2ff;
  }
}

* { box-sizing: border-box; }

html[data-lang="zh"] [lang="en"],
html[data-lang="en"] [lang="zh"] { display: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

header.top { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.brand { font-weight: 700; font-size: 19px; letter-spacing: 0.02em; color: var(--text); }
#lang-toggle {
  border: 1px solid var(--line); background: none; color: var(--muted);
  border-radius: 999px; padding: 4px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
#lang-toggle:hover { color: var(--text); }

/* Hero */
.hero { text-align: center; padding: 56px 0 40px; }
.hero h1 { font-size: clamp(40px, 7vw, 68px); line-height: 1.08; margin: 0 0 18px; letter-spacing: -0.02em; text-wrap: balance; }
.hero p { font-size: clamp(18px, 2.4vw, 22px); color: var(--muted); margin: 0 auto 32px; max-width: 34em; text-wrap: balance; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.button {
  display: inline-block; padding: 13px 26px; border-radius: 12px; font-weight: 600;
  border: 1px solid var(--line); color: var(--text); background: var(--surface);
}
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button:hover { text-decoration: none; filter: brightness(1.06); }
.button[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.fineprint { margin-top: 16px; font-size: 14px; color: var(--muted); }

/* Demo */
.demo { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: center; padding: 24px 0 72px; }
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }

.browser { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--sunken); }
.tabs { display: flex; gap: 4px; padding: 6px; min-height: 44px; }
.tab {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 5px 8px; border-radius: 8px; font-size: 14px; white-space: nowrap; overflow: hidden;
  transition: background 0.18s, flex-grow 0.25s, opacity 0.25s, padding 0.25s;
}
.tab.selected { background: var(--surface); box-shadow: 0 1px 2px #0002; }
.tab.closing { flex-grow: 0.0001; opacity: 0; padding-left: 0; padding-right: 0; }
.tab i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c); }
.page {
  height: 84px; display: grid; place-items: center; font-weight: 600; font-size: 19px;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface));
  transition: background 0.2s, color 0.2s;
}

.trackpad {
  position: relative; aspect-ratio: 1.6; max-width: 400px; margin: 22px auto 0;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
}
.finger {
  position: absolute; width: 13%; aspect-ratio: 1; border-radius: 50%;
  background: var(--finger); box-shadow: 0 0 0 5px color-mix(in srgb, var(--finger) 28%, transparent);
  translate: -50% -50%; opacity: 0; will-change: left, top, opacity, scale;
}

.gestures { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.gestures button {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 14px; padding: 14px 18px;
  transition: background 0.2s, border-color 0.2s;
}
.gestures button:hover { background: var(--sunken); }
.gestures button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.gestures strong { display: block; font-size: 18px; }
.gestures span { color: var(--muted); font-size: 15px; }

/* Sections */
section.block { padding: 56px 0; border-top: 1px solid var(--line); }
section.block h2 { font-size: clamp(26px, 4vw, 34px); margin: 0 0 24px; letter-spacing: -0.01em; }

.apps { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0; list-style: none; }
.apps li { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 15px; }

.price { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
.card .big { font-size: 40px; font-weight: 700; line-height: 1.1; margin-bottom: 6px; }
.card p { margin: 0 0 18px; color: var(--muted); }

details { border-bottom: 1px solid var(--line); padding: 16px 0; }
details summary { cursor: pointer; font-weight: 600; font-size: 18px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details[open] summary::after { content: "−"; }
details p, details ol { color: var(--muted); margin: 10px 0 0; max-width: 46em; }
details ol { padding-left: 1.3em; }
kbd { font: inherit; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; color: var(--text); white-space: nowrap; }

footer { padding: 36px 0 56px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

/* Success page */
.center { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.center h1 { font-size: 32px; margin: 0 0 12px; }
.center p { color: var(--muted); margin: 0 0 22px; max-width: 30em; }
.code {
  font: 600 clamp(22px, 5vw, 32px)/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.06em;
  padding: 18px 26px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  user-select: all; margin-bottom: 16px; display: inline-block;
}
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); margin: 0 auto 20px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .demo { grid-template-columns: 1fr; padding-bottom: 48px; }
  .hero { padding-top: 32px; }
  .wrap { padding: 0 16px; }
  .stage { padding: 14px; }
  .tab { font-size: 13px; padding: 5px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .tab, .page { transition: none; }
  .spinner { animation-duration: 2.5s; }
}
