:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --text: #16201d;
  --muted: #5d6b66;
  --border: #dfe4e1;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --danger: #b42318;
  --warn-bg: #fff6e5;
  --warn-text: #8a4b00;
  --code-bg: #f0f3f1;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1412;
    --surface: #161e1b;
    --text: #e6ece9;
    --muted: #93a29c;
    --border: #26322e;
    --accent: #2dd4bf;
    --accent-text: #062b27;
    --danger: #f97066;
    --warn-bg: #2e2412;
    --warn-text: #f5c06b;
    --code-bg: #0f1714;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
a { color: var(--accent); text-decoration: none; word-break: break-all; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; margin: 8px 0; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.5em; margin: 8px 0 0; }
.warn { background: var(--warn-bg); color: var(--warn-text); padding: 8px 12px; border-radius: 8px; font-size: 14px; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; }
.logo::after { content: ""; position: absolute; left: 4px; right: 4px; top: 9px; height: 8px; border: 2.5px solid var(--accent-text); border-bottom: 0; border-radius: 8px 8px 0 0; }

input, select, button { font: inherit; }
input, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; }

button { cursor: pointer; border-radius: 8px; padding: 8px 14px; border: 1px solid transparent; white-space: nowrap; }
button.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
button.ghost { background: transparent; border-color: var(--border); color: var(--text); padding: 6px 10px; font-size: 13px; }
button.ghost:hover { border-color: var(--muted); }
button.danger { color: var(--danger); }

.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { margin-top: 20px; }
.login-card button { width: 100%; margin-top: 12px; padding: 10px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.pill { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 2px 10px; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 1;
}
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { background: transparent; color: var(--muted); padding: 6px 12px; }
.tabs button.active { color: var(--text); background: var(--code-bg); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }

.page { max-width: 880px; margin: 0 auto; padding: 20px 16px 48px; }

.claim { display: flex; align-items: stretch; gap: 0; margin-top: 12px; flex-wrap: wrap; }
.claim input { flex: 1; min-width: 120px; border-radius: 0; }
.affix { display: flex; align-items: center; padding: 0 10px; background: var(--code-bg); border: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.affix:first-child { border-radius: 8px 0 0 8px; border-right: 0; }
#claim-suffix { border-left: 0; border-radius: 0 8px 8px 0; margin-right: 8px; }
@media (max-width: 560px) {
  .claim input { min-width: 70px; }
  .affix { padding: 0 8px; font-size: 13px; }
  #claim-suffix { margin-right: 0; }
  .claim button { width: 100%; margin-top: 8px; }
  .list .actions { margin-left: 0; }
}

.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.list .actions { margin-left: auto; display: flex; gap: 6px; }
.empty { color: var(--muted); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: #22c55e; }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.token-box { margin-top: 16px; padding: 12px; border: 1px dashed var(--accent); border-radius: 8px; }
.token-box p { margin: 0 0 8px; }
.token-box code { display: block; word-break: break-all; margin-bottom: 8px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
th, td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
td.actions { display: flex; gap: 6px; justify-content: flex-end; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px;
  max-width: calc(100vw - 32px);
}
.toast-error { background: var(--danger); color: #fff; }

.code-input { font-size: 24px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.row-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
button.link { background: none; border: 0; padding: 4px 0; color: var(--accent); font-size: 14px; width: auto; margin: 0; }
button.link:disabled { color: var(--muted); cursor: default; }
.login-card form button.link { width: auto; padding: 4px 0; margin: 0; }
.inline-form { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 180px; }
#handle-preview { color: var(--text); word-break: break-all; }
.login-footer { font-size: 13px; color: var(--muted); text-align: center; }
.login-footer a { color: var(--text); font-weight: 600; }

/* landing */
.landing { display: flex; flex-direction: column; min-height: 100vh; }
.landing main { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }
.land-top { display: flex; justify-content: space-between; align-items: center; max-width: 920px; width: 100%; margin: 0 auto; padding: 16px; }
.land-top .brand { color: var(--text); text-decoration: none; }
a.button { display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; padding: 10px 18px; font-weight: 600; text-decoration: none; border: 1px solid transparent; }
a.button.primary { background: var(--accent); color: var(--accent-text); }
a.button.ghost { border-color: var(--border); color: var(--text); font-weight: 500; }
a.button:hover { text-decoration: none; filter: brightness(1.05); }
.hero { padding: 56px 0 40px; max-width: 680px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 12px; }
.hero h1 { font-size: clamp(30px, 6vw, 46px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 16px; }
.lead { font-size: 17px; color: var(--muted); margin: 0 0 24px; max-width: 600px; }
.url-sample { background: var(--code-bg); padding: 2px 6px; border-radius: 6px; color: var(--text); word-break: break-all; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; padding: 8px 0 40px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.step h2 { font-size: 16px; margin: 10px 0 4px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--code-bg); font-weight: 700; font-size: 13px; }
.downloads { padding-bottom: 48px; }
.downloads h2 { font-size: 22px; margin-bottom: 14px; }
.downloads h3 { font-size: 16px; margin: 28px 0 8px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.dl { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.dl:hover { border-color: var(--accent); text-decoration: none; }
.dl span { color: var(--muted); font-size: 13px; }
.dl.recommended { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cli p { margin: 12px 0 4px; }
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row pre { flex: 1; margin: 0; }
.land-foot { text-align: center; padding: 20px 16px 28px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); }
.land-foot a { color: var(--text); font-weight: 600; }
.card .dl-grid { margin: 12px 0; }
.advanced { margin-top: 12px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 14px; }

button.loading { position: relative; color: transparent !important; pointer-events: none; }
button.loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--text); border-right-color: transparent; animation: spin 0.7s linear infinite; }
button.primary.loading::after { border-color: var(--accent-text); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.loading::after { animation-duration: 2s; } }
.version-line { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.guide { padding-bottom: 48px; }
.guide h2 { font-size: 22px; margin-bottom: 6px; }
.guide h3 { font-size: 16px; margin: 28px 0 10px; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.g-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.g-card h3 { margin: 0 0 8px; font-size: 15px; }
.g-card pre { margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; }
.g-card p { margin: 0; color: var(--muted); font-size: 14px; }
.cmds { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmds td { padding: 8px 12px 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
.cmds td:first-child { white-space: nowrap; }
.notes { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.notes li { margin: 4px 0; }
kbd { font: 12px ui-monospace, Menlo, monospace; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
@media (max-width: 560px) { .cmds td:first-child { white-space: normal; } }

/* ---------- motion ---------- */
button, a.button, .dl, .g-card, .step, .card, input, select { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease, filter .18s ease; }
button:not(:disabled):active, a.button:active { transform: scale(0.97); }
a.button.primary:hover, button.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.dl:hover, .g-card:hover, .step:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgb(0 0 0 / 0.08); }

.hero > * { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.hero > *:nth-child(2) { animation-delay: .08s; }
.hero > *:nth-child(3) { animation-delay: .16s; }
.hero > *:nth-child(4) { animation-delay: .24s; }
.hero h1 { background: linear-gradient(100deg, var(--text) 30%, var(--accent) 70%, var(--text)); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: rise .6s cubic-bezier(.2,.7,.2,1) .08s both, sheen 7s ease-in-out 1s infinite; }
body.landing { background-image: radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); background-repeat: no-repeat; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sheen { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1), box-shadow .18s ease, border-color .18s ease; }
.reveal.in { opacity: 1; transform: none; }
.reveal.in:hover { transform: translateY(-3px); }

.demo { padding: 0 0 36px; }
.term { background: #0b1210; border: 1px solid #1f2d29; border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px rgb(0 0 0 / 0.18); max-width: 720px; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: #121c19; }
.term-bar span { width: 10px; height: 10px; border-radius: 50%; background: #2c3b36; }
.term-bar em { margin-left: 8px; font-style: normal; font-size: 12px; color: #7f948d; }
.term-body { margin: 0; padding: 16px; min-height: 128px; background: none; color: #d6e4df; font: 13px/1.7 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-all; border: 0; }
.term-body .prompt { color: #2dd4bf; }
.term-body .ok { color: #4ade80; animation: rise .35s ease both; display: inline-block; }
.term-body .req { color: #a7b8b2; animation: rise .35s ease both; display: inline-block; }
.caret { display: inline-block; width: 8px; height: 1.1em; background: #2dd4bf; vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.card { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
.card:nth-of-type(2) { animation-delay: .05s; } .card:nth-of-type(3) { animation-delay: .1s; } .card:nth-of-type(4) { animation-delay: .15s; } .card:nth-of-type(5) { animation-delay: .2s; }
.dot.on { box-shadow: 0 0 0 0 rgb(34 197 94 / 0.6); animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(34 197 94 / 0.55); } 70%, 100% { box-shadow: 0 0 0 7px rgb(34 197 94 / 0); } }
.toast:not([hidden]) { animation: toast-in .25s cubic-bezier(.2,.7,.2,1) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.list li { animation: rise .3s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
