:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --ink: #1c1a17;
  --muted: #6b655c;
  --line: #e7e2d9;
  --accent: #d9601a;
  --accent-ink: #ffffff;
  --accent-soft: #fbeadd;
  --good: #1f7a4d;
  --bad: #b3261e;
  --warn-bg: #fff6e0;
  --warn-line: #f0d48a;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(28 26 23 / 0.05), 0 4px 16px rgb(28 26 23 / 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311;
    --surface: #1d1b18;
    --ink: #f1ede6;
    --muted: #a39c90;
    --line: #2f2c27;
    --accent: #f07a35;
    --accent-ink: #1a0f08;
    --accent-soft: #3a2416;
    --good: #5cc28d;
    --bad: #f2867e;
    --warn-bg: #2e2614;
    --warn-line: #5a4a1f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "Instrument Sans", system-ui, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, td.n, .tile .v { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
nav { display: flex; gap: 20px; }
nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
nav a:hover { color: var(--ink); }

.hero { padding: 56px 0 24px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 12px; }
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 16px; max-width: 18ch; }
.lede { font-size: 18px; color: var(--muted); max-width: 62ch; margin: 0 0 28px; }
h2 { font-size: 26px; letter-spacing: -0.01em; margin: 0 0 4px; }
h3 { font-size: 18px; margin: 0 0 4px; }
h4 { margin: 0 0 6px; font-size: 15px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-head { margin-bottom: 16px; }
.card-head p { margin: 0; font-size: 14px; }
.card-head.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }

.form { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.field.grow { flex: 1 1 340px; }
.field.inline { min-width: 0; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }
input, select {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#address, #rpc { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: progress; }
.advanced { flex-basis: 100%; border-top: 1px dashed var(--line); padding-top: 12px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.advanced[open] { display: grid; gap: 12px; }
.hint { font-size: 14px; color: var(--muted); margin: 8px 0 0; }

.progress { margin-top: 16px; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.progress p { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.error { color: var(--bad); font-weight: 500; }

#results { padding-top: 16px; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.results-head p { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 24px; font-weight: 500; margin-top: 4px; letter-spacing: -0.01em; }
.tile .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tile.hero-tile { background: var(--accent-soft); border-color: transparent; }

.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; font-size: 14px; }
.warn ul { margin: 6px 0 0; padding-left: 18px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -20px; padding: 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.n, th.n { text-align: right; }
td.pos { color: var(--good); }
td.neg { color: var(--bad); }
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: var(--warn-bg); border: 1px solid var(--warn-line); margin-left: 4px; }
.tx { color: var(--muted); font-size: 12px; }

.review-item { display: grid; grid-template-columns: 110px 1fr minmax(260px, 380px); gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.review-item:last-child { border-bottom: 0; }
.dir { font-weight: 600; }
.dir.in { color: var(--good); }
.dir.out { color: var(--bad); }
.review-item select { min-height: 38px; padding: 6px 10px; font-size: 14px; }
.review-more { margin-top: 12px; }
.review-more summary { cursor: pointer; color: var(--muted); font-size: 14px; }

.how { padding: 40px 0 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 16px; }
.grid p { color: var(--muted); font-size: 15px; margin: 0; }
.disclaimer { font-size: 14px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 12px; margin-top: 28px; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 24px; padding-bottom: 40px; font-size: 13px; border-top: 1px solid var(--line); margin-top: 32px; }

@media (max-width: 640px) {
  .hero { padding-top: 32px; }
  .review-item { grid-template-columns: 1fr; gap: 4px; }
  nav a:first-child { display: none; }
}

@media print {
  .top, .hero, .how, .foot, .results-head .actions, #review-card select, .advanced { display: none !important; }
  #results { display: block !important; padding: 0; }
  body { background: #fff; color: #000; }
  .card, .tile { box-shadow: none; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  th, td { white-space: normal; }
}
