:root {
  color-scheme: dark;
  --bg: #212121;
  --side: #171717;
  --panel: #2f2f2f;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #ececec;
  --muted: #b4b4b4;
  --accent: #ececec;
  --on-accent: #0d0d0d;
  --user: #303030;
  --on-user: #ececec;
  --green: #10a37f;
  --red: #ef4444;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --hover: rgba(255, 255, 255, 0.06);
}
:root[data-scheme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --side: #f9f9f9;
  --panel: #ffffff;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.18);
  --text: #0d0d0d;
  --muted: #5d5d5d;
  --accent: #0d0d0d;
  --on-accent: #ffffff;
  --user: #f4f4f4;
  --on-user: #0d0d0d;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  --hover: rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Inter", "Segoe UI", -apple-system, system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  transition: background-color 0.2s ease, color 0.2s ease;
}
a { color: var(--text); }
img { max-width: 100%; }
svg { flex: none; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); text-align: center; font-weight: 600; }
.center { text-align: center; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.9rem; }

/* ----- top bar ----- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px max(20px, env(safe-area-inset-left)) 12px max(20px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; color: var(--text); text-decoration: none; }
.brand .lockup { height: 30px; width: auto; }
.lockup { display: inline-flex; align-items: center; gap: 0.3em; }
.lockup svg { height: 64%; width: auto; }
.lockup-mark { height: 100%; aspect-ratio: 1; background-color: currentColor; -webkit-mask: url("/img/am-mark.png") center / contain no-repeat; mask: url("/img/am-mark.png") center / contain no-repeat; }
.nav nav { display: flex; gap: 6px; margin-left: auto; }
.nav nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.95rem; padding: 6px 12px; border-radius: 999px; }
.nav nav a:hover { color: var(--text); background: var(--hover); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: 0.5; }
.status.on i { background: var(--green); opacity: 1; }
.status.off i { background: var(--red); opacity: 1; }

.scheme-toggle {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer;
}
.scheme-toggle:hover { background: var(--hover); }
.scheme-toggle .sun { display: none; }
:root[data-scheme="light"] .scheme-toggle .sun { display: block; }
:root[data-scheme="light"] .scheme-toggle .moon { display: none; }

/* ----- buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background-color 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { opacity: 0.88; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--hover); }

/* ----- hero ----- */
.hero {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center;
  padding: 72px 24px 56px;
}
.eyebrow { margin: 0 0 10px; color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.hero h1 { font-size: clamp(2.4rem, 6.5vw, 3.8rem); font-weight: 600; }
.lead { font-size: 1.125rem; color: var(--muted); margin: 16px 0 28px; max-width: 32em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.cta + .fine { margin-top: 14px; }

.mock { background: var(--side); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }
.mock-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.mock-bar span { margin-left: 8px; }
.mock-chat { padding: 20px; display: flex; flex-direction: column; gap: 14px; min-height: 330px; background: var(--bg); }
.bub { max-width: 86%; font-size: 0.92rem; line-height: 1.5; }
.bub.ai { align-self: flex-start; display: flex; gap: 10px; align-items: flex-start; }
.bub.ai svg { width: 26px; height: 26px; margin-top: -2px; }
.bub.me { align-self: flex-end; background: var(--user); color: var(--on-user); padding: 9px 16px; border-radius: 20px; }
.mock-input { margin-top: auto; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 26px; padding: 7px 7px 7px 18px; font-size: 0.9rem; color: var(--muted); }
.mock-input b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 0.9rem; }
:root[data-scheme="light"] .mock { background: var(--side); }

/* ----- sections ----- */
.section { max-width: 1100px; margin: 0 auto; padding: 64px 24px; }
.section.alt { max-width: none; background: var(--side); border-block: 1px solid var(--line); }
.section.alt > * { max-width: 1052px; margin-inline: auto; }
.sub { text-align: center; color: var(--muted); max-width: 40em; margin: 12px auto 32px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.card .ico { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); color: var(--text); }
.card .ico svg { width: 20px; height: 20px; }
.card h3 { margin: 14px 0 6px; font-size: 1.05rem; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.step { border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.step span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 0.9rem; }
.step h3 { margin: 12px 0 4px; font-weight: 600; }
.step p { margin: 0; font-size: 0.95rem; color: var(--muted); }
.step b { color: var(--text); }

.foot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 20px calc(36px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--line); }
.foot .lockup { height: 26px; width: auto; color: var(--text); }
.foot p { margin: 0; }
.foot a { color: var(--muted); }

/* ----- phones and small windows ----- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; gap: 32px; }
  .mock { max-width: 520px; width: 100%; margin: 0 auto; }
  .grid, .steps { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav { gap: 8px; padding-inline: 16px; }
  .nav nav { display: none; }
  .status, .nav nav + .scheme-toggle { margin-left: auto; }
  .status span { display: none; }
  .status.on span, .status.off span { display: inline; }
  .section { padding: 48px 16px; }
  .hero { padding-inline: 16px; }
  .cta .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body, .btn { transition: none; }
}

/* terms page */
.doc { max-width: 760px; margin: 0 auto; padding: 40px 20px 20px; }
.doc h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); font-weight: 600; }
.doc h2 { text-align: left; font-size: 1.2rem; margin: 28px 0 8px; }
.doc p, .doc li { line-height: 1.7; }
.doc ul { padding-left: 1.2em; }
.doc .summary { background: var(--side); border: 1px solid var(--line); border-radius: 16px; padding: 6px 22px 14px; margin-top: 20px; }
.doc .summary h2 { margin-top: 14px; }
.nav nav a[aria-current="page"] { color: var(--text); background: var(--hover); }
.dl-hero { grid-template-columns: 1fr minmax(320px, 420px); padding-bottom: 64px; }
.dl-card { background: var(--side); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 24px; }
.dl-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.dl-head .fine { margin: 2px 0 0; }
.dl-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.dl-icon svg { width: 22px; height: 22px; }
.dl-title { font-size: 1.15rem; text-align: left; font-weight: 600; }
.dl-btn { width: 100%; min-height: 52px; font-size: 1.02rem; }
.dl-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 20px 0 0; }
.dl-facts div { min-width: 0; }
.dl-facts dt { color: var(--muted); font-size: 0.8rem; }
.dl-facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.dl-facts code, .dl-sha code { font: 0.85rem ui-monospace, Menlo, Consolas, monospace; }
.dl-sha { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.dl-sha summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.dl-sha summary:hover { color: var(--text); }
.dl-sha-full { display: block; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); overflow-wrap: anywhere; }
.dl-missing { margin: 0 0 6px; font-weight: 600; }
.steps-4 { grid-template-columns: repeat(4, 1fr); }
.dl-note { max-width: 760px; margin: 0 auto; padding: 16px 20px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--side); }
.dl-note p { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.dl-two { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.dl-left { text-align: left; font-size: 1.5rem; }
.dl-list { margin: 16px 0 12px; padding-left: 1.2em; color: var(--muted); }
.dl-list li { margin: 8px 0; }
.dl-list b { color: var(--text); }
@media (max-width: 960px) { .steps-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .dl-hero { grid-template-columns: 1fr; }
  .dl-card { width: 100%; max-width: 520px; margin: 0 auto; }
  .dl-two { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 560px) {
  .steps-4 { grid-template-columns: 1fr; }
  .dl-card { padding: 20px; }
}
.am-mark { display: inline-block; flex: none; background-color: currentColor; -webkit-mask: url("/img/am-mark.png") center / contain no-repeat; mask: url("/img/am-mark.png") center / contain no-repeat; }
.bub.ai .am-mark { width: 26px; height: 26px; margin-top: -2px; }
