:root {
  --honey: #F2A900;
  --honey-deep: #D99100;
  --ink: #1F160B;
  --muted: #6E6253;
  --line: #E7DFD2;
  --bg: #FFFFFF;
  --surface: #FAF7F1;
  --ok: #2F7D4F;
  --wait: #B5481C;
  --band-ink: #1F160B;
  --display: "Bricolage Grotesque", "Noto Sans SC", system-ui, sans-serif;
  --body: "Noto Sans SC", system-ui, -apple-system, "PingFang SC", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F3EADB;
    --muted: #A99C89;
    --line: #3A2F22;
    --bg: #15100A;
    --surface: #1E170F;
    --ok: #5FBF85;
    --wait: #E27A4E;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--body);
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--honey); }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* The one loud element: a solid honey band holding the question and the input. */
.band { background: var(--honey); color: var(--band-ink); padding: 20px 0 40px; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 48px; }
.brand { font: 800 20px/1 var(--display); letter-spacing: -0.01em; }
.lang {
  font: 500 14px/1 var(--body); color: var(--band-ink); background: transparent;
  border: 1.5px solid var(--band-ink); border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.band h1 {
  font: 800 clamp(34px, 6.4vw, 60px)/1.08 var(--display);
  letter-spacing: -0.025em; margin: 0 0 16px; max-width: 15em;
}
.lede { margin: 0 0 28px; max-width: 38em; font-size: 17px; }
.ask { display: flex; gap: 8px; max-width: 640px; }
.ask { align-items: flex-start; }
.tabs { display: flex; gap: 24px; margin: 0 0 14px; }
.tab {
  font: 700 16px/1 var(--body); color: var(--band-ink); background: none; border: 0;
  padding: 0 0 8px; border-bottom: 3px solid transparent; cursor: pointer; opacity: .62;
}
.tab:hover { opacity: .85; }
.tab[aria-selected="true"] { opacity: 1; border-bottom-color: var(--band-ink); }
.ask input, .ask textarea {
  flex: 1; min-width: 0; font: 500 16px/1.45 var(--body); color: #1F160B;
  background: #FFFDF8; border: 2px solid var(--band-ink); border-radius: 10px; padding: 11px 14px;
  font-variant-numeric: tabular-nums; resize: vertical; overflow-y: auto;
}
.ask button { min-height: 50px; min-width: 128px; }
.ask button {
  font: 700 16px/1 var(--body); color: var(--honey); background: var(--band-ink);
  border: 2px solid var(--band-ink); border-radius: 10px; padding: 0 22px; cursor: pointer;
}
.ask button:disabled { opacity: .6; cursor: progress; }
.promise { margin: 12px 0 0; font-size: 14px; }
.promise + .promise { margin-top: 4px; }
.linkish {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}

.status { margin: 32px 0 0; padding: 14px 16px; border-left: 4px solid var(--honey); background: var(--surface); }
.status.error { border-left-color: var(--wait); }

.total { margin: 40px 0 24px; }
.total-label { margin: 0; color: var(--muted); }
.total-value {
  margin: 0; font: 800 clamp(44px, 9vw, 76px)/1.05 var(--display);
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.total-note { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* One group = one thing to go and do; lines = the tokens it returns. */
.group { border-top: 2px solid var(--ink); padding: 18px 0 20px; }
.group-head { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; flex-wrap: wrap; }
.group-title { margin: 0; font: 700 18px/1.35 var(--body); }
.group-proto { color: var(--muted); font-weight: 500; }
.group-value { font: 800 22px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.group-how { margin: 6px 0 12px; color: var(--muted); font-size: 14px; }
.group-how a { color: var(--ink); }
.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 4px; margin-right: 6px; }
.badge.ok { color: var(--ok); border: 1.5px solid var(--ok); }
.badge.wait { color: var(--wait); border: 1.5px solid var(--wait); }

.lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: fixed; }
.lines th:nth-child(1) { width: 34%; }
.lines th:nth-child(2) { width: 24%; }
.lines th:nth-child(3) { width: 20%; }
.lines td { overflow-wrap: anywhere; }
.lines th { text-align: right; font-weight: 500; color: var(--muted); font-size: 13px; padding: 4px 0 6px 12px; border-bottom: 1px solid var(--line); }
.lines th:first-child, .lines td:first-child { text-align: left; padding-left: 0; }
.lines td { text-align: right; padding: 8px 0 8px 12px; border-bottom: 1px solid var(--line); }
.lines tr:last-child td { border-bottom: 0; }
.sym { font-weight: 700; }
.sym a { text-decoration: none; }
.sym a:hover { text-decoration: underline; }
.dim { color: var(--muted); }
.flag { font-size: 12px; color: var(--wait); display: block; font-weight: 500; }

.small { margin: 8px 0 0; border-top: 2px solid var(--line); padding-top: 14px; }
.small summary { cursor: pointer; color: var(--muted); }
.small .group { border-top-width: 1px; border-top-color: var(--line); }

/* Batch: one summary row per address; opening it shows the same groups as a single lookup. */
.csv {
  font: 700 14px/1 var(--body); color: var(--ink); background: transparent;
  border: 1.5px solid var(--ink); border-radius: 8px; padding: 9px 14px; cursor: pointer; margin: 0 0 20px;
}
.csv:disabled { opacity: .45; cursor: default; }
.addr-head, .addr-row summary {
  display: grid; grid-template-columns: 1fr 72px 140px; gap: 12px; align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.addr-head { color: var(--muted); font-size: 13px; padding: 0 0 6px 22px; border-bottom: 2px solid var(--ink); }
.addr-head span:not(:first-child), .addr-row summary span:not(:first-child) { text-align: right; }
.addr-row { border-bottom: 1px solid var(--line); }
.addr-row summary { padding: 12px 0; cursor: pointer; list-style: none; position: relative; padding-left: 22px; }
.addr-row summary::-webkit-details-marker { display: none; }
.addr-row summary::before { content: "▸"; position: absolute; left: 2px; top: 12px; line-height: 1.65; color: var(--muted); transition: transform .15s; }
.addr-row[open] summary::before { transform: rotate(90deg); }
.addr-row[inert] summary { cursor: default; }
.addr-row[inert] summary::before { opacity: .3; }
.addr-id { font-weight: 700; }
.addr-v { font: 800 18px/1 var(--display); }
.addr-body { padding: 0 0 16px 22px; }
.addr-full { margin: 0 0 8px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.flag-inline { font: 500 14px/1 var(--body); color: var(--wait); }
.retry {
  font: 500 14px/1 var(--body); color: var(--ink); background: transparent;
  border: 1.5px solid var(--ink); border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
@media (prefers-reduced-motion: reduce) { .addr-row summary::before { transition: none; } }

.about { margin: 64px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
.about h2 { font: 800 24px/1.2 var(--display); letter-spacing: -0.01em; margin: 32px 0 12px; }
.about p { max-width: 42em; }
.cover { padding-left: 1.2em; max-width: 46em; }
.cover li { margin: 4px 0; }
.warn { padding: 12px 16px; background: var(--surface); border-left: 4px solid var(--wait); }
.foot { padding-top: 32px; padding-bottom: 40px; color: var(--muted); font-size: 13px; }

@media (max-width: 600px) {
  .top { margin-bottom: 32px; }
  .ask { flex-direction: column; align-items: stretch; }
  .ask button { padding: 14px; }
  .addr-head, .addr-row summary { grid-template-columns: 1fr 40px 96px; gap: 8px; }
  .addr-body { padding-left: 0; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: 1fr auto; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .lines tr:last-child { border-bottom: 0; }
  .lines td { border: 0; padding: 0; }
  .lines td.amt { grid-column: 1; text-align: left; color: var(--muted); font-size: 14px; }
  .lines td.px { grid-column: 2; grid-row: 2; font-size: 14px; color: var(--muted); }
  .lines td.val { grid-column: 2; grid-row: 1; font-weight: 700; }
}
