:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --panel: #12121e;
  --text: #e4e4eb;
  --muted: #9a9ab0;
  --border: rgba(255, 255, 255, 0.08);
  --link: #7db4f5;
  --codebg: rgba(255, 255, 255, 0.06);
  --ok: #8ce99a;
  --warn: #ffc078;
  --architecture: #3bc9db;
  --identity: #4dabf7;
  --sync: #ffa94d;
  --streams: #51cf66;
  --auth: #f783ac;
  --app: #9775fa;
  --news: #ffd43b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f8f8fa;
    --panel: #ffffff;
    --text: #1a1a2e;
    --muted: #5c5c80;
    --border: rgba(0, 0, 0, 0.1);
    --link: #1c64d6;
    --codebg: rgba(0, 0, 0, 0.05);
    --ok: #2b8a3e;
    --warn: #a14a08;
    --architecture: #0c8599;
    --identity: #1c7ed6;
    --sync: #e8590c;
    --streams: #2f9e44;
    --auth: #d6336c;
    --app: #7048e8;
    --news: #e8a400;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--sans); }
main { max-width: 820px; margin: 0 auto; padding: 36px 16px 72px; }
a { color: var(--link); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 8px; font-weight: 650; }
.lede { color: var(--muted); margin: 0 0 16px; max-width: 60ch; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--codebg); padding: 2px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.endpoint { display: flex; gap: 8px; align-items: stretch; }
.endpoint code { flex: 1; min-width: 0; white-space: nowrap; overflow-x: auto; padding: 0 12px; display: flex; align-items: center; border-radius: 8px; }
button {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; min-height: 44px; padding: 0 14px; cursor: pointer;
}
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.clients { margin: 10px 0 0; color: var(--muted); font-size: 0.92rem; }
.status { margin: 14px 0 0; }
.status summary { color: var(--muted); font-size: 0.92rem; min-height: 44px; align-items: baseline; padding-top: 10px; }
.status summary > span { flex: 1; }
.status .ok { color: var(--ok); font-weight: 600; }
.status .behind { color: var(--warn); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.find { margin: 18px 0 4px; }
.find input {
  width: 100%; min-height: 44px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
#matches { color: var(--muted); font-size: 0.92rem; min-height: 1.5em; margin: 6px 0 0; }

section.domain {
  margin: 14px 0 0; border-radius: 14px; scroll-margin-top: 16px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
}
section.domain > details { padding: 0 18px; }
section.domain > details[open] { padding-bottom: 14px; }
.domain-head { display: flex; gap: 16px; align-items: center; padding: 14px 0; }
.domain-head::before { display: none; }
.domain-head::after { content: "▸"; margin-left: auto; color: var(--accent); font-size: 1.7rem; line-height: 1; }
details[open] > .domain-head::after { content: "▾"; }
.domain-head img { width: 64px; height: 64px; flex: none; }
.domain-head h2 { margin: 0; font-size: 1.2rem; color: color-mix(in srgb, var(--accent) 65%, var(--text)); }
.domain-head .blurb { display: block; color: var(--muted); font-size: 0.95rem; }
.domain-head .count { white-space: nowrap; }
section.domain a { color: color-mix(in srgb, var(--accent) 55%, var(--text)); }

ul.sources { margin: 0; padding-left: 22px; font-size: 0.92rem; }
ul.sources li { margin: 3px 0; }
ul.sources .mono { color: var(--muted); }
.fresh { font-size: 0.85rem; color: var(--ok); font-weight: 600; }
.fresh.behind { color: var(--warn); }

section.domain [data-group] { border-top: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border)); margin-top: 12px; padding-top: 6px; }
.group-head { margin: 6px 0 0; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.count { color: var(--muted); font-size: 0.85rem; }

details { margin-top: 8px; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; color: var(--text); }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "▸"; color: var(--accent, var(--muted)); width: 1em; }
details[open] > summary::before { content: "▾"; }
.kind { font-size: 0.85rem; letter-spacing: 0.04em; color: var(--accent); font-weight: 600; }
ul.pages { margin: 2px 0 6px; padding-left: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 32px; }
ul.pages li { margin: 3px 0; overflow-wrap: anywhere; }
ul.pages li::marker { color: var(--accent); }
ul.pages.nsids a { font-family: var(--mono); font-size: 0.86em; }
ol.proposals { margin: 8px 0 4px; padding-left: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); column-gap: 28px; }
ol.proposals li { margin: 6px 0; display: flex; gap: 10px; align-items: baseline; }
ol.proposals .num {
  font-family: var(--mono); font-size: 0.8rem; color: var(--bg); background: var(--accent);
  border-radius: 6px; padding: 1px 6px; flex: none;
}
mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; }
[hidden] { display: none !important; }

footer { margin-top: 44px; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 520px) {
  .scheme { display: none; }
  .endpoint code { font-size: 0.8rem; padding: 0 10px; }
  h1 { font-size: 1.35rem; }
  .domain-head img { width: 48px; height: 48px; }
  section.domain > details { padding: 0 14px; }
}
