/* Tokens follow design 6.2 (borrowed from Lody): a paper light theme and a
   deep-sea dark theme; depth from surface brightness and shadow, few lines. */
:root {
  --page: #f9f9f9;
  --region: #f0f0f0;
  --card: #ffffff;
  --well: hsl(0 0% 11% / .05);
  --hover: hsl(0 0% 94.9%);
  --sep: hsl(0 0% 91.6%);
  --fg: #1c1c1c;
  --fg2: hsl(0 0% 46%);
  --fg3: hsl(0 0% 62%);
  --accent: #5b8def;
  --accent-fg: #ffffff;
  --link: #4a7dd9;
  --danger: hsl(356 72% 47%);
  --success: hsl(151 55% 36%);
  --shadow-card: 0 0 0 .5px hsl(0 0% 11% / .1), 0 1px 1.5px hsl(0 0% 11% / .04), 0 2px 6px -2px hsl(0 0% 11% / .04);
  --shadow-pop: 0 0 0 .5px hsl(0 0% 11% / .11), 0 2px 4px -1px hsl(0 0% 11% / .06), 0 12px 32px -6px hsl(0 0% 11% / .16);
  --r-mini: 5px; --r-small: 8px; --r-medium: 10px; --r-large: 14px;
  --h-sm: 28px; --h-md: 32px; --h-lg: 36px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --sans: "Inter Variable", Inter, "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #131416;
    --region: #191a1d;
    --card: #1e2023;
    --well: hsl(0 0% 0% / .28);
    --hover: #25272b;
    --sep: #2b2d31;
    --fg: #ecedee;
    --fg2: hsl(0 0% 62.7%);
    --fg3: hsl(0 0% 45%);
    --accent: #7cc4e8;
    --accent-fg: #0d1a22;
    --link: hsl(200 69% 70%);
    --danger: hsl(0 100% 75%);
    --success: hsl(151 60% 52%);
    --shadow-card: 0 0 0 .5px hsl(0 0% 100% / .06), 0 1px 2px hsl(0 0% 0% / .3);
    --shadow-pop: 0 0 0 .5px hsl(0 0% 100% / .08), 0 12px 32px -6px hsl(0 0% 0% / .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 14px; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--page); color: var(--fg); font: 400 14px/20px var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 18px; line-height: 24px; font-weight: 600; margin: 0 0 8px; }
h2 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--fg2); }
.small { font-size: 12px; line-height: 16px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wordmark { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 18px; font-weight: 600; color: var(--fg); letter-spacing: .01em; }
.wordmark:hover { text-decoration: none; }
.wordmark.big { font-size: 26px; margin-bottom: 24px; }

.topbar { display: flex; align-items: center; gap: 24px; height: 52px; padding: 0 24px; background: var(--region); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: var(--fg2); padding: 4px 10px; border-radius: var(--r-small); }
.topbar nav a:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.topbar nav a[aria-current="page"] { color: var(--fg); background: var(--well); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who form { margin: 0; }

.page { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }

.card { background: var(--card); border-radius: var(--r-large); box-shadow: var(--shadow-card); padding: 24px; }
.narrow { width: 100%; max-width: 400px; }
.section { margin-bottom: 16px; }
.narrow-page { max-width: 560px; margin: 32px auto 0; }
.foot { margin: 16px 0 0; font-size: 13px; }
.alert { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-radius: var(--r-small); padding: 8px 12px; }

.stack { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.stack label { font-size: 13px; color: var(--fg2); }
.row { display: flex; gap: 8px; align-items: center; margin: 0; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; margin-top: 12px; }

input { height: var(--h-lg); padding: 0 12px; border: 0; border-radius: var(--r-small); background: var(--well); color: var(--fg); font: inherit; min-width: 0; }
input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
input::placeholder { color: var(--fg3); }
.code-input { text-align: center; font-size: 18px; letter-spacing: .2em; text-transform: uppercase; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h-lg); padding: 0 14px; border: 0; border-radius: var(--r-small); font: 500 14px/1 var(--sans); cursor: pointer; color: var(--fg); background: var(--well); transition: background 120ms var(--ease), opacity 120ms var(--ease); text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.danger.solid { background: var(--danger); color: var(--accent-fg); }
.btn.danger.solid:hover { background: var(--danger); opacity: .9; }
.btn.small { height: var(--h-sm); padding: 0 10px; font-size: 13px; border-radius: var(--r-mini); }
.btn.block { width: 100%; }
.btn.provider { background: var(--well); margin-bottom: 8px; }
.btn.provider:hover { background: var(--hover); }
img[src$="github.svg"], img[src$="email.svg"] { filter: var(--icon-filter, none); }
@media (prefers-color-scheme: dark) { :root { --icon-filter: invert(1); } }

.or { display: flex; align-items: center; gap: 12px; color: var(--fg3); font-size: 12px; margin: 12px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--sep); }

.cmd { display: flex; align-items: center; gap: 8px; background: var(--well); border-radius: var(--r-small); padding: 6px 6px 6px 12px; margin: 8px 0; }
.cmd code { flex: 1; font-family: var(--mono); font-size: 13px; overflow-x: auto; white-space: nowrap; }
.cmd.multi { align-items: flex-start; }
.cmd.multi code { white-space: pre; line-height: 20px; padding: 2px 0; }
.plain { padding-left: 20px; margin: 0; }
.plain li { margin-bottom: 4px; }

.empty { text-align: left; }
.steps { padding-left: 20px; margin: 16px 0; }
.steps li { margin-bottom: 12px; }

.machines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.machine { display: flex; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.machine-main { display: flex; gap: 12px; min-width: 0; }
.machine-text { min-width: 0; }
.machine-name { font-size: 16px; line-height: 24px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.machine-name a { color: var(--fg); }
.machine-actions { display: flex; align-items: flex-start; gap: 4px; }
.machine-actions form { margin: 0; }
.rename summary { list-style: none; }
.rename summary::-webkit-details-marker { display: none; }
.rename[open] summary { display: none; }
.rename input { height: var(--h-sm); width: 180px; }
.addrs { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; color: var(--fg2); }
.addrs dd { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--fg2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Online dot: a halo breathing every 2.8 s; offline is a still grey dot. */
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--fg3); }
.dot.online { background: var(--success); animation: halo 2.8s var(--ease) infinite; }
@keyframes halo { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 45%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .dot.online { animation: none; } }

.identities { list-style: none; padding: 0; margin: 0; }
.identities li { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.identities form { margin: 0; }
.link-email { margin-top: 12px; }
.link-email input { flex: 1; height: var(--h-sm); }

.usercode { font-size: 28px; letter-spacing: .15em; text-align: center; padding: 16px; margin: 16px 0; background: var(--well); border-radius: var(--r-medium); }
.done-mark { width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--success) 15%, transparent); margin-bottom: 12px; position: relative; }
.done-mark::after { content: ""; position: absolute; left: 14px; top: 9px; width: 9px; height: 17px; border: solid var(--success); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

.dialog { border: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); color: var(--fg); }
.dialog::backdrop { background: hsl(0 0% 0% / .35); }

@media (max-width: 600px) {
  .topbar { gap: 12px; padding: 0 16px; }
  .who span { display: none; }
  .page { padding: 24px 16px 48px; }
  .machine { flex-direction: column; }
  .kv, .kv.wide { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}

.totp-setup .qr { display: block; width: 200px; height: 200px; margin: 8px 0 16px; border-radius: var(--r-small); background: #fff; padding: 8px; image-rendering: pixelated; }
.recovery { columns: 2; list-style: none; padding: 16px; margin: 0 0 16px; background: var(--well); border-radius: var(--r-medium); font-size: 15px; line-height: 28px; }

.notice { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: var(--r-small); padding: 10px 14px; margin: 0 0 16px; }
.tag { display: inline-block; margin-left: 8px; padding: 0 6px; border-radius: var(--r-mini); background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); font-size: 12px; line-height: 20px; font-weight: 500; vertical-align: 2px; }

/* Connecting a machine: the three stages the pairing goes through. */
.progress { list-style: none; display: flex; gap: 8px; padding: 0; margin: 12px 0; }
.progress li { flex: 1; font-size: 12px; line-height: 16px; color: var(--fg3); border-top: 2px solid var(--sep); padding-top: 6px; }
.progress li.now { color: var(--fg); border-top-color: var(--accent); }
.progress li.done { color: var(--fg2); border-top-color: var(--success); }
.installed { margin-top: 8px; color: var(--fg2); }
.installed summary { cursor: pointer; }
.card > summary { cursor: pointer; font-weight: 600; }

/* The public pages: home, privacy, and the footer every page ends with. */
.sitefoot { padding: 24px 16px 32px; text-align: center; font-size: 13px; }
.sitefoot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.sitefoot a { color: var(--fg2); }

.page.home { max-width: 960px; }
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: 34px; line-height: 44px; letter-spacing: -.01em; margin: 0 0 12px; max-width: 720px; }
.lead { font-size: 16px; line-height: 26px; color: var(--fg2); max-width: 640px; margin: 0 0 24px; }
.lead-in { color: var(--fg2); max-width: 640px; margin: 0 0 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 12px; }
.btn.big { height: 42px; padding: 0 22px; font-size: 15px; border-radius: var(--r-medium); }
.band { font-size: 18px; line-height: 26px; margin: 48px 0 16px; }

.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.feature { padding: 20px 22px; }
.feature h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 0 0 6px; }
.feature p { margin: 0; color: var(--fg2); }

.path { display: flex; align-items: stretch; gap: 0; margin: 0 0 20px; }
.stop { flex: 1 1 0; min-width: 0; padding: 12px 14px; background: var(--well); border-radius: var(--r-medium); text-align: center; }
.stop b { display: block; font-weight: 600; }
.stop span { display: block; font-size: 12px; line-height: 16px; color: var(--fg2); }
.stop.mine { box-shadow: inset 0 0 0 1.5px var(--accent); }
.hop { flex: none; width: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; line-height: 16px; color: var(--fg2); }
.hop::after { content: "→"; font-size: 18px; line-height: 20px; color: var(--fg3); }
.trust li { margin-bottom: 8px; }
.more { margin: 12px 0 0; }
.home .section h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 20px 0 6px; }
.closing { margin: 48px 0 0; }
.closing .actions { justify-content: center; }

.kv.wide { grid-template-columns: 150px 1fr; gap: 12px 20px; }
.kv.wide dt { color: var(--fg); font-weight: 600; }

@media (max-width: 700px) {
  .hero { padding-top: 24px; }
  .hero h1 { font-size: 28px; line-height: 36px; }
  .features { grid-template-columns: 1fr; }
  .path { flex-direction: column; }
  .hop { width: auto; height: 52px; }
  .hop::after { content: "↓"; }
  .actions .btn.big { flex: 1 1 100%; }
  .kv.wide { grid-template-columns: 1fr; gap: 2px; }
  .kv.wide dd { margin-bottom: 10px; }
}
.narrow-page .plain { margin-bottom: 12px; }
