/* Shard Superintelligence Lab, Peer-to-Peer AI: the whole design system in
   one file. Self-hosted Geist (font-src 'self'), no frameworks, no inline
   styles (style-src 'self').

   Principles: the live network is the one bold, moving thing; everything
   else is still. Structure carries meaning: only the surface you act in
   (chat, signup) is elevated, readouts are ruled strips, numbers mark the
   one real sequence. Colour carries role: iris = compute being given
   (donors, primary actions), quartz = tokens in flight, green = live only.
   Mono is for identifiers (device, ticket), never for labels. */

@font-face {
  font-family: "Geist";
  src: url("../fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* palette: paper, ink, iris, quartz, signal */
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --surface-3: #e3e7f0;
  --line: #dde1eb;
  --line-strong: #c9cfdc;
  --ink: #0e1226;
  --ink-2: #333a52;
  --muted: #565e75;
  --faint: #767e94;
  --accent: #5541db;
  --accent-ink: #ffffff;
  --accent-soft: rgba(85, 65, 219, 0.09);
  --accent-line: rgba(85, 65, 219, 0.35);
  --quartz: #2e5bda;
  --good: #12804a;
  --good-soft: rgba(18, 128, 74, 0.10);
  --warn: #935700;
  --warn-soft: #fff1d6;
  --bad: #c0233a;
  --bad-soft: #ffe9ec;
  --glow: rgba(85, 65, 219, 0.10);
  --grid-dot: rgba(30, 40, 80, 0.11);
  --shadow: 0 1px 2px rgba(14, 18, 38, .05), 0 24px 48px -28px rgba(14, 18, 38, .22);
  --nav-bg: rgba(244, 245, 249, .8);
  --mesh-bg: #f4f5f9;
  --mesh-donor: #5541db;
  --mesh-peer: #8d95aa;
  --mesh-hub: #333a52;
  --mesh-link: rgba(51, 58, 82, .2);
  --mesh-packet: #2e5bda;
  --mesh-label: #565e75;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 76rem;
  --gutter: clamp(1rem, 3.5vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0a0d16;
    --surface: #111523;
    --surface-2: #171c2c;
    --surface-3: #1e2537;
    --line: #1f2638;
    --line-strong: #2d364b;
    --ink: #eceff7;
    --ink-2: #c5ccdc;
    --muted: #8f98ae;
    --faint: #6c768d;
    --accent: #a797ff;
    --accent-ink: #120d33;
    --accent-soft: rgba(167, 151, 255, .11);
    --accent-line: rgba(167, 151, 255, .4);
    --quartz: #d6e4ff;
    --good: #57d68f;
    --good-soft: rgba(87, 214, 143, .12);
    --warn: #f0bc5e;
    --warn-soft: rgba(240, 188, 94, .12);
    --bad: #ff7e88;
    --bad-soft: rgba(255, 126, 136, .12);
    --glow: rgba(140, 120, 255, .16);
    --grid-dot: rgba(170, 185, 225, .085);
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 30px 60px -30px rgba(0, 0, 0, .8);
    --nav-bg: rgba(10, 13, 22, .74);
    --mesh-bg: #0a0d16;
    --mesh-donor: #a797ff;
    --mesh-peer: #6a7590;
    --mesh-hub: #c5ccdc;
    --mesh-link: rgba(150, 165, 210, .14);
    --mesh-packet: #d6e4ff;
    --mesh-label: #8f98ae;
  }
}

/* --- base --- */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
code { font-family: var(--mono); font-size: .9em; }
.nowrap { white-space: nowrap; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 50;
  background: var(--accent); color: var(--accent-ink);
  padding: .55rem .9rem; border-radius: 10px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: .75rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hint { color: var(--muted); font-size: .84rem; line-height: 1.5; }
.hint:empty, .status:empty { display: none; }

/* --- controls --- */

button, input, select, textarea { font: inherit; color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 2.75rem; padding: 0 1.2rem;
  border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; letter-spacing: -0.005em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn-sm { min-height: 2.35rem; padding: 0 1rem; font-size: .9rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px -14px var(--accent); }
.btn-primary:hover { box-shadow: 0 12px 34px -12px var(--accent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn:disabled, .btn[disabled] { opacity: .4; cursor: default; box-shadow: none; }

input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: .55rem .75rem;
  min-height: 2.6rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover { border-color: var(--faint); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 2.2rem; cursor: pointer; max-width: 100%; text-overflow: ellipsis;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 52%, calc(100% - .75rem) 52%;
  background-size: .3rem .3rem, .3rem .3rem;
  background-repeat: no-repeat;
}
select option:disabled { color: var(--faint); }

.ctl { display: grid; gap: .3rem; min-width: 0; }
.ctl-label, .field-label { font-size: .84rem; font-weight: 500; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .8rem; font-weight: 500; line-height: 1;
  padding: .4rem .7rem; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.pill::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; flex: none; }
.pill[data-tone="good"] { color: var(--good); background: var(--good-soft); border-color: transparent; }
.pill[data-tone="warn"] { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill[data-tone="active"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

/* --- nav --- */

.nav {
  position: sticky; top: 0; z-index: 20;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--measure); margin: 0 auto; padding: .65rem var(--gutter);
  display: flex; align-items: center; gap: 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-logo { height: 2rem; width: auto; flex: none; display: block; }
.beta {
  font-size: .72rem; font-weight: 600; color: var(--accent);
  padding: .15rem .45rem; border-radius: 6px; border: 1px solid var(--accent-line);
}
.nav-links { display: flex; gap: 1.4rem; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 500; }
.nav-links a:hover { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: .5rem; min-width: 0; margin-left: 1rem; }
.live-chip, .busy-chip, .bal-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .82rem; font-weight: 500; white-space: nowrap;
  padding: .4rem .75rem; border-radius: 999px; border: 1px solid var(--line-strong);
}
.live-chip { color: var(--ink-2); }
.live-dot { position: relative; width: .5rem; height: .5rem; border-radius: 50%; background: var(--faint); flex: none; }
.live-chip[data-state="live"] .live-dot { background: var(--good); }
.live-chip[data-state="live"] .live-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--good); opacity: 0; animation: ping 2.6s cubic-bezier(0, 0, .2, 1) infinite;
}
.live-chip[data-state="empty"] .live-dot { background: var(--warn); }
.live-chip[data-state="down"] .live-dot { background: var(--bad); }
.busy-chip { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.bal-chip { color: var(--ink-2); font-variant-numeric: tabular-nums; }

@keyframes ping {
  0% { transform: scale(.6); opacity: .7; }
  80%, 100% { transform: scale(1.9); opacity: 0; }
}

/* --- hero: the live network field --- */

.hero {
  position: relative; overflow: hidden;
  display: grid;
  min-height: clamp(36rem, 82vh, 47rem);
  background-color: var(--bg);
  background-image:
    radial-gradient(34rem 28rem at 71% 50%, var(--glow), transparent 70%),
    radial-gradient(circle at 1px 1px, var(--grid-dot) 1px, transparent 0);
  background-size: auto, 24px 24px;
  border-bottom: 1px solid var(--line);
}
.field {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0;
  /* read by js/mesh.js: network centre and radii as fractions of the canvas */
  --mesh-cx: .71;
  --mesh-rx: .28;
  --mesh-ry: .42;
}
.hero::before {
  /* keeps the copy legible where the field runs under it */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 18%, rgba(0, 0, 0, 0) 60%);
  opacity: .92;
}
.hero-inner {
  position: relative; z-index: 2;
  width: 100%; max-width: var(--measure); margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 6.5rem) var(--gutter) clamp(5rem, 9vw, 6.5rem);
  display: grid; align-content: center;
}
.hero-copy { max-width: 37rem; }
.hero h1 {
  font-size: clamp(3.4rem, 8.4vw, 6.75rem);
  font-weight: 640; line-height: .94; letter-spacing: -0.055em;
}
.kicker {
  margin-top: 1.4rem;
  font-size: clamp(1.35rem, 2.3vw, 1.75rem); font-weight: 500; line-height: 1.25;
  letter-spacing: -0.025em; color: var(--ink-2);
}
.lead {
  margin-top: 1.1rem; max-width: 33rem;
  font-size: 1.06rem; line-height: 1.65; color: var(--muted);
  text-wrap: pretty;
}
.cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }
.cta .btn { min-height: 3rem; padding: 0 1.45rem; font-size: 1rem; }
.serving {
  display: flex; align-items: center; gap: .55rem; margin-top: 1.6rem;
  font-size: .9rem; color: var(--muted);
}
.serving:empty { display: none; }
.serving::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--good); flex: none; }
.serving[data-state="none"]::before { background: var(--warn); }
.serving strong { color: var(--ink-2); font-weight: 600; }

.field-key {
  position: absolute; z-index: 2; bottom: 1.4rem;
  right: max(var(--gutter), calc((100% - var(--measure)) / 2 + var(--gutter)));
  display: grid; justify-items: end; gap: .45rem;
  font-size: .8rem; color: var(--muted);
}
.field-status { color: var(--faint); }
.field-status[data-live="true"] { color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; justify-content: flex-end; }
.legend li { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.lg { display: inline-block; flex: none; }
.lg-donor { width: .6rem; height: .6rem; border-radius: 50%; background: var(--mesh-donor); box-shadow: 0 0 0 3px var(--accent-soft); }
.lg-peer { width: .45rem; height: .45rem; border-radius: 50%; background: var(--mesh-peer); }
.lg-token { width: 1.1rem; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--mesh-donor), var(--mesh-packet)); }
.lg-hub { width: .5rem; height: .5rem; border: 1.5px solid var(--mesh-hub); transform: rotate(45deg); }

/* --- the pool right now: a ruled readout strip --- */

.pulse { border-bottom: 1px solid var(--line); }
.tiles {
  list-style: none; margin: 0 auto; padding: 0 var(--gutter);
  max-width: var(--measure);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
}
.tile { display: flex; flex-direction: column; padding: 1.5rem 1.5rem 1.6rem; min-width: 0; }
.tile:first-child { padding-left: 0; }
.tile + .tile { border-left: 1px solid var(--line); }
.tile-value {
  order: -1;
  font-size: clamp(1.9rem, 3vw, 2.5rem); font-weight: 600; letter-spacing: -0.045em; line-height: 1;
}
.tile[data-tone="warn"] .tile-value { color: var(--warn); }
.tile-label {
  display: inline-flex; align-items: center; gap: .45rem; margin-top: .65rem;
  font-size: .9rem; font-weight: 500; color: var(--ink-2);
}
.tile[data-tone="good"] .tile-label::before,
.tile[data-tone="warn"] .tile-label::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; flex: none; }
.tile[data-tone="good"] .tile-label::before { background: var(--good); }
.tile[data-tone="warn"] .tile-label::before { background: var(--warn); }
.tile-note { margin-top: .15rem; font-size: .8rem; color: var(--faint); overflow-wrap: anywhere; }

/* --- big models: one row per split model, its layers as a bar --- */

.bigmodels { max-width: var(--measure); margin: 0 auto; padding: clamp(3rem, 7vw, 5rem) var(--gutter) 0; min-width: 0; }
.bigmodels h2 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); font-weight: 620; letter-spacing: -0.035em; }
.big-list { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.big-row { display: grid; gap: .55rem; padding: 1.4rem 0 1.5rem; border-bottom: 1px solid var(--line); min-width: 0; }
.big-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.big-name { font-size: 1.15rem; font-weight: 620; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.big-meta { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.big-meta:empty { display: none; }
.big-note { margin-top: 1rem; max-width: 44rem; }
/* The bar: one block per run of layers, as wide as its share of the model.
   Served blocks are iris (compute being given), solid once a donor has
   measured its speed; a gap is a hatched warning rule, never empty space. */
.big-bar { display: flex; gap: 2px; height: 1.6rem; margin-top: .35rem; min-width: 0; }
.big-seg {
  flex: var(--n, 1) 1 0; min-width: 4px; display: grid; align-items: center; justify-items: center;
  overflow: hidden; white-space: nowrap; border-radius: 4px;
  font-size: .72rem; font-weight: 500; font-variant-numeric: tabular-nums;
}
.big-seg[data-kind="span"] { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); }
.big-seg[data-kind="span"][data-perf="measured"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.big-seg[data-kind="gap"] {
  border: 1px dashed var(--warn); color: var(--warn);
  background: repeating-linear-gradient(135deg, transparent 0 5px, var(--warn-soft) 5px 10px);
}
.big-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.big-help { display: grid; gap: .5rem; margin-top: .6rem; padding: .85rem 1rem; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); min-width: 0; }
.big-help-title { font-weight: 600; font-size: .95rem; color: var(--ink); }
.big-row[data-status="live"] .big-help { border-color: var(--line-strong); background: transparent; }
@media (forced-colors: active) {
  .big-seg { border: 1px solid CanvasText; }
  .big-seg[data-kind="gap"] { border-style: dashed; }
}

/* --- banner --- */

.banner {
  max-width: calc(var(--measure) - 2 * var(--gutter)); margin: 1.25rem auto 0;
  padding: .85rem 1.1rem; border-radius: 10px; font-weight: 500;
}
.banner.error { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); }
@media (max-width: 80rem) { .banner { margin-left: var(--gutter); margin-right: var(--gutter); } }

/* --- workspace: chat elevated, side panels flat --- */

.workspace {
  max-width: var(--measure); margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) var(--gutter);
  display: grid; gap: 1.5rem; align-items: start;
  grid-template-columns: minmax(0, 1.7fr) minmax(19rem, 1fr);
}
.workspace:focus { outline: none; }
.side { display: grid; gap: 1.5rem; min-width: 0; }

.chat, .signup {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); min-width: 0;
  display: grid; gap: 1rem; align-content: start; padding: 1.5rem;
}
.panel {
  border: 1px solid var(--line); border-radius: 14px; min-width: 0;
  display: grid; gap: 1rem; align-content: start; padding: 1.25rem 1.3rem;
}
.chat h2, .panel h2 { font-size: 1.3125rem; font-weight: 620; letter-spacing: -0.025em; }
.sub { color: var(--muted); font-size: .875rem; margin-top: .2rem; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }

/* signup */

.signup { grid-column: 1 / -1; justify-self: center; width: min(100%, 38rem); padding: 2.25rem 2rem; text-align: center; justify-items: center; }
.signup .muted { max-width: 30rem; }
.key-glyph {
  display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 14px 36px -14px var(--accent);
}
.key-glyph svg { width: 1.6rem; height: 1.6rem; }
.signup h2 { font-size: 1.75rem; font-weight: 620; letter-spacing: -0.03em; }
.signup-form { width: 100%; display: grid; gap: .45rem; text-align: left; margin-top: .4rem; }
.input-row {
  display: flex; align-items: center; gap: .4rem;
  padding: .3rem .3rem .3rem .9rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-row .at { color: var(--faint); }
.input-row input { flex: 1; min-width: 0; border: 0; background: transparent; padding: .4rem 0; }
.input-row input:focus-visible { box-shadow: none; }

/* chat */

.chat-head { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: flex-end; justify-content: space-between; }
.chat-controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; flex: 1 1 22rem; justify-content: flex-end; min-width: 0; }
.ctl-model { flex: 1 1 14rem; max-width: 26rem; }
.ctl-model select { width: 100%; font-size: .9rem; }
.ctl-narrow input { width: 7rem; font-variant-numeric: tabular-nums; }

.privacy {
  display: flex; gap: .65rem; align-items: flex-start;
  background: var(--warn-soft); color: var(--ink-2);
  border-radius: 10px; padding: .7rem .85rem; font-size: .875rem; line-height: 1.5;
}
.privacy svg { width: 1.15rem; height: 1.15rem; flex: none; color: var(--warn); margin-top: .1rem; }
.privacy strong { font-weight: 600; color: var(--ink); }

.thread {
  min-height: 20rem; max-height: min(36rem, 62vh); overflow-y: auto;
  border-radius: 14px; background: var(--surface-2);
  padding: 1.1rem; overscroll-behavior: contain;
}
.chat-empty { display: grid; align-content: center; justify-items: start; gap: .5rem; min-height: 17.8rem; padding: .5rem .75rem; }
.chat-empty-title { font-size: 1.75rem; font-weight: 620; letter-spacing: -0.035em; line-height: 1.2; }
.chat-empty .muted { max-width: 32rem; font-size: .94rem; }
.starters { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.starter {
  font-size: .875rem; padding: .5rem .85rem; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-2);
  transition: border-color .15s ease, color .15s ease;
}
.starter:hover { border-color: var(--accent); color: var(--ink); }

.messages { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.messages li { display: grid; gap: .35rem; min-width: 0; }
.messages li[data-role="user"] { justify-items: end; }
.messages .role {
  display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; min-width: 0;
  font-size: .8rem; color: var(--muted);
}
.messages li[data-role="user"] .role { justify-content: flex-end; }
.messages .role .via { overflow-wrap: anywhere; }
.messages .role .who { color: var(--ink-2); font-weight: 600; }
.messages .role .via { color: var(--faint); }
.messages .role .via:not(:empty) { font-family: var(--mono); font-size: .74rem; }
.messages li[data-role="assistant"] .role::before {
  content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); flex: none;
}
.messages .text {
  display: block; white-space: pre-wrap; overflow-wrap: anywhere;
  padding: .75rem 1rem; border-radius: 16px; line-height: 1.6; font-size: .97rem; max-width: 100%;
}
.messages li[data-role="user"] .text {
  background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; max-width: min(85%, 36rem);
}
.messages li[data-role="assistant"] .text { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 5px; }
.messages li[data-role="assistant"] .text:empty::after {
  content: "● ● ●"; letter-spacing: .1em; font-size: .6rem; color: var(--accent);
  animation: dots 1.2s ease-in-out infinite;
}
.receipt { display: flex; flex-wrap: wrap; gap: .35rem; }
.receipt .chip {
  font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums;
  padding: .18rem .55rem; border-radius: 6px; background: var(--surface); border: 1px solid var(--line);
}
.receipt .chip-id { font-family: var(--mono); font-size: .72rem; }
.receipt a.chip-link { color: var(--muted); text-decoration: none; }
.receipt a.chip-link:hover { color: var(--accent); border-color: var(--accent-line); text-decoration: underline; }
.receipt .chip-money { color: var(--good); border-color: transparent; background: var(--good-soft); font-weight: 500; }
.receipt .chip-pending { color: var(--warn); border-color: transparent; background: var(--warn-soft); }

@keyframes dots { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.composer {
  border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea {
  display: block; width: 100%; border: 0; background: transparent; resize: none;
  padding: .9rem 1rem .35rem; min-height: 3.4rem; max-height: 14rem; line-height: 1.5;
}
.composer textarea:focus-visible { box-shadow: none; }
.composer-bar { display: flex; align-items: center; gap: .75rem; padding: .35rem .5rem .5rem 1rem; }
.keys { font-size: .78rem; color: var(--faint); }
.composer-buttons { display: flex; gap: .45rem; margin-left: auto; }

.chat-foot { display: grid; gap: .35rem; margin-top: -.3rem; }
.cost { font-size: .8rem; color: var(--faint); line-height: 1.5; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cost:empty { display: none; }
.status { font-size: .875rem; color: var(--muted); display: flex; align-items: center; gap: .55rem; }
.chat[data-busy="true"] .status::before {
  content: ""; width: .85rem; height: .85rem; border-radius: 50%; flex: none;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* share */

.power {
  display: flex; align-items: center; gap: .85rem; width: 100%;
  padding: .8rem 1rem; border-radius: 12px; cursor: pointer; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink);
  font-weight: 600; font-size: .98rem;
  transition: border-color .2s ease, background-color .2s ease;
}
.power:hover { border-color: var(--faint); }
.power-knob {
  position: relative; flex: none; width: 2.75rem; height: 1.55rem; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line-strong); transition: background-color .2s ease;
}
.power-knob::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 1.2rem; height: 1.2rem; border-radius: 50%;
  background: var(--faint); transition: transform .22s cubic-bezier(.3, .7, .4, 1.2), background-color .2s ease;
}
.power[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.power[aria-pressed="true"] .power-knob { background: var(--accent); border-color: transparent; }
.power[aria-pressed="true"] .power-knob::after { transform: translateX(1.2rem); background: var(--accent-ink); }

.engine progress {
  display: block; width: 100%; height: .4rem; border: 0; border-radius: 999px; overflow: hidden;
  appearance: none; -webkit-appearance: none; background: var(--accent-soft);
}
.engine progress::-webkit-progress-bar { background: var(--accent-soft); border-radius: 999px; }
.engine progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.engine progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.mini-stats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.mini-stats div { padding: .8rem .8rem 0; min-width: 0; }
.mini-stats div:first-child { padding-left: 0; }
.mini-stats div + div { border-left: 1px solid var(--line); }
.mini-stats dt { font-size: .78rem; color: var(--muted); }
.mini-stats dd {
  margin: .15rem 0 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#share-status { overflow-wrap: anywhere; }

/* account */

.device {
  font-family: var(--mono); font-size: .74rem; color: var(--muted);
  padding: .3rem .55rem; border-radius: 8px; border: 1px solid var(--line);
}
.balance-block { display: grid; gap: .15rem; }
.balance-label { font-size: .84rem; color: var(--muted); }
.balance { font-size: 2.25rem; font-weight: 620; letter-spacing: -0.045em; line-height: 1.1; overflow-wrap: anywhere; }
.balance .unit { font-size: 1rem; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: .35rem; }
.balance-held { font-size: .84rem; color: var(--warn); }
.balance-held:empty { display: none; }

.fair { display: grid; gap: .45rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.fair-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.fair-label { font-size: .84rem; color: var(--muted); }
.fair-x { font-size: 1.3rem; font-weight: 620; letter-spacing: -0.02em; }
.meter { position: relative; height: .5rem; border-radius: 999px; background: var(--accent-soft); margin: .25rem 0; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--pos, 40%); border-radius: 999px; background: var(--accent); }
.meter-neutral { position: absolute; left: 40%; top: -.3rem; bottom: -.3rem; width: 2px; margin-left: -1px; background: var(--line-strong); border-radius: 1px; }
.meter-mark {
  position: absolute; top: 50%; left: var(--pos, 40%); width: 1rem; height: 1rem; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--surface); border: 3px solid var(--accent);
}
.meter-scale { position: relative; height: 1rem; font-size: .72rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.meter-scale span { position: absolute; top: 0; }
.meter-scale span:nth-child(1) { left: 0; }
.meter-scale span:nth-child(2) { left: 40%; transform: translateX(-50%); }
.meter-scale span:nth-child(3) { right: 0; }
.fairshare { font-size: .875rem; color: var(--muted); line-height: 1.5; }

.jobs { display: grid; gap: .5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.jobs h3 { font-size: .9rem; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.jobs-list { list-style: none; margin: 0; padding: 0; display: grid; max-height: 17rem; overflow-y: auto; }
.job {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: center;
  padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.job:last-child { border-bottom: 0; }
.job-icon {
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 8px;
  font-size: .85rem; font-weight: 700; background: var(--accent-soft); color: var(--accent);
}
.job[data-role="provider"] .job-icon { background: var(--good-soft); color: var(--good); }
.job-main { display: grid; min-width: 0; }
.job-model { font-size: .86rem; font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-sub { font-size: .78rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.job-money { display: grid; justify-items: end; gap: .1rem; font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-state { font-size: .76rem; color: var(--faint); }
.job[data-state="holding"] .job-state { color: var(--warn); }

/* --- how a reply moves: one connected sequence --- */

.how, .honesty { max-width: var(--measure); margin: 0 auto; padding: clamp(3rem, 7vw, 5.5rem) var(--gutter) 0; }
.how h2, .honesty h2 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); font-weight: 620; letter-spacing: -0.035em; }
.section-sub { color: var(--muted); margin-top: .55rem; max-width: 40rem; }
.steps {
  list-style: none; margin: 2.5rem 0 0; padding: 0; position: relative;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
}
.steps::before {
  /* the path a reply takes, from the first stop to the last */
  content: ""; position: absolute; top: 1.15rem; left: 1.15rem; width: 75%; height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--mesh-packet));
  opacity: .55;
}
.step { position: relative; padding-right: 2rem; }
.step-n {
  position: relative; z-index: 1;
  display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--accent-line); color: var(--accent);
  font-weight: 600; font-size: .95rem; font-variant-numeric: tabular-nums;
}
.step h3 { margin-top: 1.2rem; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.015em; }
.step p { margin-top: .5rem; font-size: .94rem; color: var(--muted); line-height: 1.6; max-width: 32ch; }

.how-split {
  display: flex; gap: .9rem; align-items: flex-start; margin-top: 2.5rem; max-width: 52rem;
  padding: 1rem 1.15rem; border-radius: 14px; border: 1px solid var(--accent-line);
  background: var(--accent-soft); color: var(--ink-2); font-size: .95rem; line-height: 1.6;
}
.how-split svg { width: 1.5rem; height: 1.5rem; flex: none; color: var(--accent); margin-top: .1rem; }

/* --- what the hub promises: a ruled list --- */

.honesty-list {
  margin: 2rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 3rem;
  border-top: 1px solid var(--line);
}
.honesty-list div { padding: 1.05rem 0 1.1rem; border-bottom: 1px solid var(--line); min-width: 0; }
.honesty-list dt { font-size: .95rem; font-weight: 600; color: var(--ink); }
.honesty-list dd { margin: .25rem 0 0; font-size: .94rem; color: var(--muted); line-height: 1.55; }

/* --- language picker --- */

.lang {
  position: relative; display: inline-flex; align-items: center;
  color: var(--muted);
}
.lang svg { position: absolute; left: .6rem; width: 1rem; height: 1rem; pointer-events: none; }
.lang select {
  min-height: 2.15rem; padding: 0 2rem 0 2rem; border-radius: 999px;
  font-size: .84rem; font-weight: 500; color: var(--ink-2);
  background-color: transparent; border-color: var(--line-strong);
}

/* --- why P2P AI: the mission, said plainly --- */

.why {
  max-width: var(--measure); margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) var(--gutter) 0;
}
.why-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem 4rem; align-items: start; }
.why h2 { grid-column: 1 / -1; font-size: 1rem; font-weight: 600; color: var(--accent); letter-spacing: 0; }
.why-lead {
  font-size: clamp(1.9rem, 3.6vw, 2.9rem); font-weight: 600; line-height: 1.08; letter-spacing: -0.04em;
  text-wrap: balance;
}
.why-body { display: grid; gap: 1rem; color: var(--ink-2); font-size: 1.06rem; line-height: 1.65; padding-top: .35rem; }
.why-points {
  list-style: none; margin: 3rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0;
  border-top: 1px solid var(--line);
}
.why-points li { padding: 1.5rem 2rem 0 0; }
.why-points li + li { padding-left: 2rem; border-left: 1px solid var(--line); }
.why-points svg { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.why-points h3 { margin-top: .9rem; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.015em; }
.why-points p { margin-top: .45rem; color: var(--muted); font-size: .95rem; line-height: 1.6; max-width: 34ch; }
.why-note {
  margin-top: 2rem; font-size: .875rem; color: var(--faint);
  padding-left: .9rem; border-left: 2px solid var(--warn);
}

/* --- who we are --- */

.team { max-width: var(--measure); margin: 0 auto; padding: clamp(3rem, 7vw, 5.5rem) var(--gutter) 0; }
.team h2 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); font-weight: 620; letter-spacing: -0.035em; }
.person {
  margin-top: 2rem; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2.25rem; align-items: start;
  max-width: 56rem;
}
.portrait { margin: 0; }
.portrait img, .monogram {
  display: grid; place-items: center; width: 11rem; aspect-ratio: 1; border-radius: 24px; object-fit: cover;
  border: 1px solid var(--line);
}
.monogram {
  font-size: 3.4rem; font-weight: 600; letter-spacing: -0.04em; color: var(--accent-ink);
  background: linear-gradient(140deg, var(--mesh-donor), #7c6cf0 55%, #5b8cff);
}
.person-body { display: grid; gap: .75rem; max-width: 40rem; }
.person-body h3 { font-size: 1.5rem; font-weight: 620; letter-spacing: -0.03em; }
.person-role { color: var(--accent); font-weight: 500; margin-top: -.45rem; }
.person-body p:not(.person-role) { color: var(--ink-2); line-height: 1.65; }
.person-link {
  display: inline-flex; align-items: center; gap: .5rem; justify-self: start; margin-top: .25rem;
  font-weight: 600; font-size: .95rem; text-decoration: none;
  padding: .55rem .95rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink);
}
.person-link:hover { border-color: var(--accent); }
.person-link svg { width: 1.1rem; height: 1.1rem; color: var(--accent); }

/* --- Chinese, Japanese, Korean: system faces, no negative tracking --- */

:root:lang(zh) { --font: "Geist", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif; }
:root:lang(ja) { --font: "Geist", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", sans-serif; }
:root:lang(ko) { --font: "Geist", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif; }
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3, :lang(zh) .kicker, :lang(zh) .why-lead, :lang(zh) .tile-value,
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) .kicker, :lang(ja) .why-lead, :lang(ja) .tile-value,
:lang(ko) h1, :lang(ko) h2, :lang(ko) h3, :lang(ko) .kicker, :lang(ko) .why-lead, :lang(ko) .tile-value {
  letter-spacing: 0;
}
:lang(zh) .hero h1, :lang(ja) .hero h1, :lang(ko) .hero h1 { line-height: 1.08; font-weight: 700; }
:lang(zh) body, :lang(ja) body { line-break: strict; }
:lang(ko) body { word-break: keep-all; }

/* --- footer --- */

.foot { margin-top: clamp(3.5rem, 8vw, 6rem); border-top: 1px solid var(--line); }
.foot-inner {
  max-width: var(--measure); margin: 0 auto; padding: 1.75rem var(--gutter) 2.75rem;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem 2.5rem; align-items: baseline;
  color: var(--muted); font-size: .875rem;
}
.foot-brand { font-weight: 650; color: var(--ink); letter-spacing: -0.015em; white-space: nowrap; }
.foot-text { max-width: 44rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; white-space: nowrap; max-width: 26rem; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--ink); }

/* --- responsive --- */

@media (max-width: 68rem) {
  .nav-links { display: none; }
  .nav-right { margin-left: auto; }
  .hero { min-height: 0; background-image: radial-gradient(circle at 1px 1px, var(--grid-dot) 1px, transparent 0); background-size: 24px 24px; }
  .hero::before { display: none; }
  .hero-inner { padding-bottom: 1rem; }
  .field {
    position: relative; inset: auto; order: 2; height: clamp(18rem, 55vw, 26rem);
    --mesh-cx: .5; --mesh-rx: .44; --mesh-ry: .44;
  }
  .hero-inner { order: 1; }
  .field-key { position: static; order: 3; justify-items: start; padding: 0 var(--gutter) 1.5rem; }
  .legend { justify-content: flex-start; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile, .tile + .tile { border-left: 0; padding-left: 0; }
  .tile { border-bottom: 1px solid var(--line); }
  .tile:not(:nth-child(3n + 1)) { border-left: 1px solid var(--line); padding-left: 1.25rem; }
  .tile:nth-child(n + 4) { border-bottom: 0; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2.5rem; }
  .steps::before { display: none; }
  .foot-inner { grid-template-columns: minmax(0, 1fr); }
  .why-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 46rem) {
  .nav .bal-chip { display: none; }
  .brand-logo { height: 1.75rem; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile, .tile + .tile, .tile:not(:nth-child(3n + 1)) { border-left: 0; padding-left: 0; border-bottom: 1px solid var(--line); }
  .tile:nth-child(even) { border-left: 1px solid var(--line); padding-left: 1.25rem; }
  .tile:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .steps { grid-template-columns: minmax(0, 1fr); row-gap: 1.75rem; }
  .steps::before { display: block; top: 1.15rem; bottom: 1.15rem; left: 1.15rem; width: 1px; height: auto; background: linear-gradient(180deg, var(--accent), var(--mesh-packet)); }
  .step { padding: 0 0 0 3.4rem; }
  .step-n { position: absolute; left: 0; top: 0; }
  .step h3 { margin-top: .35rem; }
  .honesty-list { grid-template-columns: minmax(0, 1fr); }
  .chat, .signup { padding: 1.1rem 1rem; border-radius: 16px; }
  .panel { padding: 1.1rem 1rem; }
  .input-row { flex-wrap: wrap; border-radius: 14px; padding: .3rem; }
  .input-row .at { padding-left: .6rem; }
  .input-row .btn { width: 100%; }
  .keys { display: none; }
  .chat-controls { justify-content: stretch; }
  .ctl-model { max-width: none; }
  .thread { min-height: 15rem; padding: .8rem; }
  .chat-empty { min-height: 13rem; padding: .25rem; }
  .chat-empty-title { font-size: 1.45rem; }
  .nav-inner { gap: .6rem; }
  .nav-right { gap: .35rem; }
  .beta { display: none; }
  .lang select { width: 2.15rem; padding: 0; color: transparent; }
  .lang select option { color: var(--ink); }
  .lang svg { left: .55rem; color: var(--ink-2); }
  .why-points { grid-template-columns: minmax(0, 1fr); border-top: 0; margin-top: 2rem; }
  .why-points li, .why-points li + li { padding: 1.25rem 0; border-left: 0; border-top: 1px solid var(--line); }
  .person { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .portrait img, .monogram { width: 7.5rem; border-radius: 18px; }
  .monogram { font-size: 2.4rem; }
}
@media (max-width: 24rem) {
  #live-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  .power[aria-pressed="true"] { outline: 2px solid Highlight; }
  .hero::before { display: none; }
}

/* donate */
.donate { max-width: var(--measure); margin: 0 auto; padding: clamp(3rem, 7vw, 5.5rem) var(--gutter) 0; min-width: 0; }
.donate h2 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); font-weight: 620; letter-spacing: -0.035em; }
.donate h3 { font-size: 1.05rem; font-weight: 620; letter-spacing: -0.015em; }
.donate-pitch { max-width: 44rem; }
.donate-gift { margin-top: 1rem; max-width: 44rem; font-size: .94rem; color: var(--ink-2); line-height: 1.6; padding-left: .9rem; border-left: 2px solid var(--accent-line); }
.donate-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin-top: 2rem; align-items: start; }
.donate-card { min-width: 0; }
.donate-network { color: var(--muted); font-size: .875rem; margin-top: .2rem; }
.donate-qr { margin-top: 1rem; background: #ffffff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem; display: grid; place-items: center; max-width: 16rem; }
.donate-qr img { display: block; width: min(220px, 100%); height: auto; }
.donate-address-label { margin-top: 1.1rem; font-size: .84rem; font-weight: 500; color: var(--muted); }
.donate-address { margin-top: .3rem; font-family: var(--mono); font-size: .84rem; line-height: 1.6; overflow-wrap: anywhere; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; }
.donate-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.donate-copy-status { margin-top: .5rem; font-size: .875rem; color: var(--good); min-height: 1.2em; }
.donate-copy-status:empty { display: none; }
.donate-thanks { margin-top: .5rem; font-size: .9rem; color: var(--ink-2); line-height: 1.55; }
.donate-amounts { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: 1rem; }
.donate-amounts-label { font-size: .84rem; color: var(--muted); margin-right: .2rem; }
.donate-amount { font-size: .85rem; font-variant-numeric: tabular-nums; padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); text-decoration: none; }
.donate-amount:hover { border-color: var(--accent); color: var(--ink); }
.donate-raised-box { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); display: grid; gap: .15rem; }
.donate-raised-label { font-size: .84rem; color: var(--muted); }
.donate-raised { font-size: 1.6rem; font-weight: 620; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.donate-raised-usd, .donate-count { font-size: .9rem; color: var(--muted); }
.donate-side { display: grid; gap: 1.75rem; min-width: 0; }
.donate-block { min-width: 0; }
.donate-block > h3 { padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.donate-goals { display: grid; }
.donate-goal { padding: .95rem 0 1rem; border-bottom: 1px solid var(--line); min-width: 0; }
.donate-goal-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; }
.donate-goal-label { font-size: .95rem; font-weight: 600; color: var(--ink); }
.donate-goal-of { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.donate-goal-desc { margin-top: .25rem; font-size: .94rem; color: var(--muted); line-height: 1.55; }
.donate-bar { display: block; width: 100%; height: .45rem; margin-top: .6rem; border: 0; border-radius: 999px; overflow: hidden; appearance: none; -webkit-appearance: none; background: var(--accent-soft); }
.donate-bar::-webkit-progress-bar { background: var(--accent-soft); border-radius: 999px; }
.donate-bar::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.donate-bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.donate-recent { list-style: none; margin: 0; padding: 0; display: grid; }
.donate-recent-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.donate-recent-amount { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.donate-recent-time { font-size: .85rem; color: var(--faint); }
.donate-recent-link { font-size: .85rem; margin-left: auto; }
.donate-wall-count { margin-top: .7rem; font-size: .9rem; color: var(--muted); }
.donate-wall { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.donate-wall-handle { font-size: .85rem; padding: .3rem .65rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); overflow-wrap: anywhere; max-width: 100%; }
.donate-recognised-body { margin-top: .7rem; font-size: .94rem; color: var(--muted); line-height: 1.55; }
.donate-recognised .btn { margin-top: .8rem; }
.donate-tag-instructions { margin-top: .9rem; font-size: .95rem; color: var(--ink-2); line-height: 1.55; }
.donate-wall-opt { display: flex; align-items: flex-start; gap: .55rem; margin-top: .9rem; font-size: .92rem; color: var(--ink-2); cursor: pointer; }
.donate-wall-opt input { min-height: 0; width: 1.05rem; height: 1.05rem; margin-top: .2rem; flex: none; accent-color: var(--accent); }
.donate-badge { font-size: .72rem; padding: .25rem .55rem; vertical-align: middle; }
.donate-nudge { margin-top: .6rem; font-size: .875rem; color: var(--muted); line-height: 1.55; }
.donate-nudge-link { font-weight: 600; }
.donate-nudge-dismiss { background: none; border: 0; padding: .1rem .3rem; color: var(--faint); font-size: .85rem; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.donate-nudge-dismiss:hover { color: var(--ink); }
@media (min-width: 56rem) {
  .donate-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 2rem; }
}
@media (forced-colors: active) {
  .donate-qr { background: #ffffff; }
  .donate-bar { border: 1px solid CanvasText; }
}

/* --- money: account card, out of credits, buy dialog, prices, donor install, keys --- */

.account-tags { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; justify-content: flex-end; }
.frozen-note {
  font-size: .875rem; line-height: 1.5; color: var(--bad); background: var(--bad-soft);
  border: 1px solid var(--bad); border-radius: 10px; padding: .65rem .8rem;
}
.balance-sub { font-size: .84rem; color: var(--muted); }
.balance-sub:empty { display: none; }
.balance-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.balance-block .hint { margin-top: .2rem; }

.earnings { display: grid; gap: .3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.earnings h3, .api-keys summary { font-size: .9rem; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.earnings-total { font-size: 1.3rem; font-weight: 620; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* the out-of-credits call to action sits in the chat footer */
.funds {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  padding: .7rem .9rem; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft);
}
.funds[data-kind="refused"] { border-color: var(--warn); background: var(--warn-soft); }
.funds-text { flex: 1 1 16rem; font-size: .875rem; color: var(--ink-2); line-height: 1.5; font-variant-numeric: tabular-nums; }

/* buy dialog (showModal: no inline script, the CSP stays as it is) */
.buy-dialog {
  width: min(44rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow);
}
.buy-dialog::backdrop { background: rgba(10, 13, 22, .55); }
.buy-inner { display: grid; gap: 1rem; padding: 1.5rem; }
.buy-inner h2 { font-size: 1.3125rem; font-weight: 620; letter-spacing: -0.025em; }
.buy-options { display: grid; gap: 1.25rem; min-width: 0; }
.buy-group { display: grid; gap: .6rem; min-width: 0; }
.buy-group-title { font-size: .95rem; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.buy-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .6rem; }
.buy-card {
  display: grid; gap: .3rem; align-content: start; justify-items: start; min-width: 0;
  padding: .9rem 1rem; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface-2);
}
.buy-card .btn { margin-top: .4rem; }
.buy-card-title { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.buy-card-price { font-size: 1.3rem; font-weight: 620; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.buy-perks { margin: 0; padding-left: 1.1rem; display: grid; gap: .2rem; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.prices-soon {
  font-size: .9rem; color: var(--warn); background: var(--warn-soft); border-radius: 10px;
  padding: .6rem .8rem; line-height: 1.5;
}

/* public prices, visible before signup */
.prices, .pc { max-width: var(--measure); margin: 0 auto; padding: clamp(3rem, 7vw, 5.5rem) var(--gutter) 0; min-width: 0; }
.prices h2, .pc h2 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); font-weight: 620; letter-spacing: -0.035em; }
.prices h3, .pc h3 { font-size: 1.05rem; font-weight: 620; letter-spacing: -0.015em; }
.prices-head .prices-soon { margin-top: 1rem; max-width: 44rem; }
.prices-grid, .prices-lower { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem; margin-top: 2rem; align-items: start; }
.prices-models, .prices-buy-wrap, .prices-priority, .money { display: grid; gap: .75rem; min-width: 0; }
.table-wrap { overflow-x: auto; min-width: 0; }
.price-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.price-table th, .price-table td { text-align: left; padding: .6rem .75rem .6rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.price-table thead th { font-size: .78rem; font-weight: 500; color: var(--muted); }
.price-table tbody th { font-weight: 500; color: var(--ink-2); }
.price-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-table tr[data-live="false"] td:last-child { color: var(--faint); }
.price-model { overflow-wrap: anywhere; }
.price-split { display: block; font-size: .78rem; font-weight: 400; color: var(--faint); }
.money-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .45rem; color: var(--ink-2); font-size: .94rem; line-height: 1.6; }
@media (min-width: 56rem) {
  .prices-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2.5rem; }
  .prices-lower { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; }
}

/* donate from your computer */
.pc-steps { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1.25rem; counter-reset: pc; }
.pc-step { display: grid; gap: .45rem; padding-left: 3.1rem; position: relative; min-width: 0; counter-increment: pc; }
.pc-step::before {
  content: counter(pc); position: absolute; left: 0; top: -.15rem;
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  border: 1px solid var(--accent-line); color: var(--accent); font-weight: 600; font-size: .9rem;
}
.pc-cmd-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; }
.pc-cmd, .key-secret, .key-cmd {
  display: block; flex: 1 1 18rem; min-width: 0; font-family: var(--mono); font-size: .82rem; line-height: 1.55;
  overflow-wrap: anywhere; word-break: break-all; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .75rem;
  /* commands are copied by eye too: no '--' ligature */
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}
.pc-or { flex-basis: 100%; }
.pc-file { overflow-wrap: anywhere; }
.pc-ip {
  margin-top: 1.5rem; max-width: 44rem; font-size: .94rem; color: var(--ink-2); line-height: 1.6;
  padding-left: .9rem; border-left: 2px solid var(--warn);
}

/* developer API keys */
.api-keys { padding-top: 1rem; border-top: 1px solid var(--line); }
.api-keys summary { cursor: pointer; display: flex; align-items: baseline; gap: .5rem; }
.keys-count { font-size: .8rem; font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }
.keys-body { display: grid; gap: .75rem; margin-top: .75rem; }
.key-form { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; }
.key-form .ctl:first-child { flex: 1 1 10rem; }
.key-form input { width: 100%; }
.key-once { display: grid; gap: .5rem; padding: .85rem; border-radius: 12px; border: 1px solid var(--warn); background: var(--warn-soft); }
.key-once-title { font-weight: 600; font-size: .9rem; color: var(--ink); }
.key-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.key-list { list-style: none; margin: 0; padding: 0; display: grid; }
.key-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.key-row:last-child { border-bottom: 0; }
.key-main { display: grid; flex: 1; min-width: 0; }
.key-name { font-size: .88rem; font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-sub { font-size: .76rem; color: var(--faint); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.key-state { font-size: .78rem; color: var(--faint); }
.key-row[data-state="revoked"] .key-name { color: var(--faint); text-decoration: line-through; }

/* link a device: the account card's one-time code, and "use a link code" at signup */
.link-device { display: grid; gap: .5rem; padding-top: 1rem; border-top: 1px solid var(--line); min-width: 0; }
.link-device h3 { font-size: .9rem; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.link-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.link-once { display: grid; gap: .5rem; padding: .85rem; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); min-width: 0; }
.link-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.link-code {
  font-family: var(--mono); font-size: 1.4rem; font-weight: 600; letter-spacing: .12em; color: var(--ink);
  font-variant-numeric: tabular-nums; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}
.link-use { width: 100%; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); text-align: left; }
.link-use summary { cursor: pointer; text-align: center; font-size: .92rem; color: var(--ink-2); }
.link-use .signup-form { margin-top: .6rem; }
.link-use input { font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.link-use-status:empty { display: none; }

/* download: the Windows app and the Python donor */
.dl-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; margin-top: 2rem; align-items: start; }
.dl-card { display: grid; gap: .6rem; align-content: start; min-width: 0; }
.dl-meta { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dl-meta:empty { display: none; }
.dl-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.dl-sha { font-family: var(--mono); font-size: .78rem; overflow-wrap: anywhere; word-break: break-all; }
.dl-warn { font-size: .88rem; color: var(--ink-2); line-height: 1.55; padding-left: .8rem; border-left: 2px solid var(--warn); }
@media (min-width: 56rem) {
  .dl-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
}
@media (forced-colors: active) {
  .link-once { border: 1px solid CanvasText; }
}

/* terms.html and paid.html */
.doc-main { max-width: 46rem; margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) var(--gutter) 0; display: grid; gap: 1.1rem; }
.doc-main:focus { outline: none; }
.doc-main h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 650; letter-spacing: -0.035em; }
.doc-lead { color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.doc-section { display: grid; gap: .6rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.doc-section h2 { font-size: 1.2rem; font-weight: 620; letter-spacing: -0.02em; }
.doc-section p { color: var(--ink-2); line-height: 1.65; }
.draft-note {
  font-size: .92rem; line-height: 1.55; color: var(--warn); background: var(--warn-soft);
  border: 1px solid var(--warn); border-radius: 10px; padding: .75rem .9rem; font-weight: 500;
}
.doc-back { margin-top: .5rem; }
.paid { justify-items: start; padding-top: clamp(3rem, 10vw, 6rem); }
.paid-card { display: grid; gap: .6rem; }
.paid-card p { color: var(--ink-2); font-size: 1.05rem; line-height: 1.6; }
@media (forced-colors: active) {
  .funds, .key-once, .draft-note, .prices-soon, .frozen-note { border: 1px solid CanvasText; }
}
