/* Deliberately small and dependency-free: everything here is served from
   the same origin as the PIR transport under a `default-src 'none'` CSP,
   so there are no web fonts, no CDNs, and nothing to fetch. */

:root {
  color-scheme: light dark;
  --bg: #fbfbfd;
  --card: #ffffff;
  --ink: #14161a;
  --muted: #5b6472;
  --line: #e3e6ec;
  --accent: #2f5fd0;
  --ok: #0d7a45;
  --warn: #8a5a00;
  --err: #b3261e;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --card: #16191e;
    --ink: #e8eaee;
    --muted: #9aa3b0;
    --line: #262b33;
    --accent: #7ea2ff;
    --ok: #4ec98a;
    --warn: #e0b155;
    --err: #ff7a70;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 46rem;
  margin: 0 auto;
}

header {
  margin-bottom: 1.75rem;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.lede {
  margin: 0;
  color: var(--muted);
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

.fine {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
}

/* ── boot progress ────────────────────────────────────────────────── */

.progress {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* ── form ─────────────────────────────────────────────────────────── */

form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

input[type="text"] {
  flex: 1 1 22rem;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  padding: 0.7rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.suggestions {
  margin-top: 1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--accent);
}

/* ── result ───────────────────────────────────────────────────────── */

.result {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.balance {
  font-size: 1.9rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.balance-unit {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.35rem;
}

.wei {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin-top: 0.35rem;
}

.asof {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.error {
  color: var(--err);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.error strong {
  display: block;
  margin-bottom: 0.2rem;
}

.warn {
  color: var(--warn);
}

/* ── key/value tables ─────────────────────────────────────────────── */

.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.kv td {
  padding: 0.3rem 0;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.kv tr:last-child td {
  border-bottom: 0;
}

.kv td:first-child {
  color: var(--muted);
  padding-right: 1rem;
  white-space: nowrap;
  width: 1%;
}

.kv td:last-child {
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.tag {
  display: inline-block;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid currentColor;
}

.tag-ok {
  color: var(--ok);
}
.tag-warn {
  color: var(--warn);
}

/* ── limits ───────────────────────────────────────────────────────── */

.limits ul {
  margin: 0;
  padding-left: 1.1rem;
}

.limits li {
  margin-bottom: 0.7rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.limits li strong {
  color: var(--ink);
}

.limits li:last-child {
  margin-bottom: 0;
}

footer {
  margin-top: 2rem;
  text-align: center;
}
