/* Feesweeper — styles. No external fonts, no frameworks. */
:root {
  --bg: #0b0d0c;
  --bg-raised: #101312;
  --bg-panel: #121615;
  --line: #222927;
  --line-soft: #1a201e;
  --ink: #e8ece9;
  --ink-dim: #9aa5a0;
  --ink-faint: #7e8984;   /* AA on every surface in this palette (≥4.9:1) */
  --accent: #4ee39b;
  --accent-ink: #07120d;
  --warn: #e3b34e;
  --danger: #e3685e;
  --radius: 12px;
  --radius-sm: 8px;
  --max: 1080px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
/* Author display rules (e.g. .btn) must never override an element's hidden state. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
/* keep anchored headings clear of the sticky masthead */
[id] { scroll-margin-top: 84px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(900px 420px at 50% -160px, rgba(78, 227, 155, 0.09), transparent 70%);
  background-repeat: no-repeat;
}

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -48px; background: var(--accent); color: var(--accent-ink);
  padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600; z-index: 50;
  transition: top 0.15s ease;
}
.skip:focus { top: 12px; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 30;
  background: rgba(11, 13, 12, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.masthead-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.wallet-controls { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.wallet-address { color: var(--ink-dim); font: 12px var(--mono); white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; }
.brand-word {
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.18em; font-weight: 600;
}
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { color: var(--ink-dim); text-decoration: none; font-size: 14px; transition: color 0.15s ease; }
.nav a:hover, .nav a:focus-visible { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 12px 18px; font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; transition: background 0.15s ease, border-color 0.15s ease,
  color 0.15s ease, transform 0.08s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #63eeaa; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: #36423e; background: #151a18; }
.btn-sm { padding: 9px 14px; font-size: 13px; }
.btn-icon { padding: 12px 14px; font-size: 13px; }
.btn[disabled] { opacity: 0.42; cursor: not-allowed; }
.btn[disabled]:hover { background: transparent; border-color: var(--line); }
.btn-primary[disabled]:hover { background: var(--accent); }

/* ---------- hero ---------- */
.hero { padding: 84px 24px 56px; }
.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 20px;
}
h1 {
  font-size: clamp(34px, 5.4vw, 58px); line-height: 1.05; letter-spacing: -0.025em;
  margin: 0 0 22px; font-weight: 650;
}
.lede { font-size: clamp(16px, 2vw, 18px); color: var(--ink-dim); max-width: 62ch; margin: 0 0 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 48px; }
.facts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0;
  background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden;
}
.facts > div { background: var(--bg-raised); padding: 20px; }
.facts dt { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.facts dd { margin: 0; color: var(--ink-faint); font-size: 13.5px; line-height: 1.5; }

/* ---------- panel / scanner ---------- */
.panel {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; margin-bottom: 40px;
}
.panel-head { margin-bottom: 22px; }
.panel-head h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.01em; }
.muted { color: var(--ink-faint); }
.small { font-size: 13px; }

.scan-form { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field.grow { flex: 1 1 340px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-dim); letter-spacing: 0.01em; }
.input-row { display: flex; gap: 8px; }
input[type="text"], select {
  width: 100%; background: #0d100f; border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px;
  font-family: var(--mono); transition: border-color 0.15s ease;
}
select { font-family: var(--sans); cursor: pointer; }
input[type="text"]:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="text"].invalid { border-color: var(--danger); }
.hint { font-size: 12.5px; color: var(--ink-faint); margin: 0; }
.field-submit { padding-bottom: 1px; }

.status { margin: 18px 0 0; font-size: 14px; color: var(--ink-dim); min-height: 21px; }
.status.error { color: var(--danger); }
.status.ok { color: var(--accent); }
.progress { margin-top: 12px; height: 4px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.25s ease; }

/* ---------- results ---------- */
#results { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--line-soft); animation: fade 0.28s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.stat { background: var(--bg-raised); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); font-family: var(--mono); }
.stat-value { font-family: var(--mono); font-size: clamp(22px, 3.4vw, 30px); font-weight: 600; letter-spacing: -0.02em; }
.stat-value.accent { color: var(--accent); }
.stat-sub { font-size: 12.5px; color: var(--ink-faint); }

.escrow-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  margin: 20px 0; padding: 22px; border: 1px solid #2c4a3c; border-radius: var(--radius);
  background: linear-gradient(125deg, rgba(78, 227, 155, .07), transparent 60%), var(--bg-raised);
}
.escrow-copy { min-width: 0; }
.escrow-panel .flow-tag { margin: 0 0 7px; }
.escrow-panel h3 { margin: 0; font-size: 17px; }
.escrow-balance { margin: 5px 0 7px; color: var(--accent); font: 600 clamp(22px, 3vw, 30px) var(--mono); }
.escrow-panel .hint { max-width: 70ch; }
.escrow-panel > .btn { flex: 0 0 auto; }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }

.table-wrap { margin-top: 20px; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint); font-weight: 600; padding: 12px 14px; background: #0e1211;
  border-bottom: 1px solid var(--line-soft); font-family: var(--mono); white-space: nowrap;
}
.grid tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: #141917; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tok { display: flex; flex-direction: column; gap: 2px; }
.tok-sym { font-weight: 600; }
.tok-addr { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.zero { color: var(--ink-faint); }
.cell-sub { display: block; font-size: 11px; color: var(--ink-faint); font-weight: 400; letter-spacing: 0.01em; }
.claim { color: var(--accent); font-weight: 600; }
.link {
  color: var(--ink-dim); text-decoration: none; border-bottom: 1px dotted #36423e;
  font-family: var(--mono); font-size: 12.5px;
}
.link:hover { color: var(--accent); border-color: var(--accent); }
.row-btn { padding: 9px 13px; font-size: 12.5px; }
.footnote { font-size: 12.5px; color: var(--ink-faint); margin: 14px 0 0; max-width: 78ch; }
.empty { margin-top: 22px; padding: 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin: 0 0 6px; }

/* ---------- sections ---------- */
.section { padding: 56px 24px; }
.section h2 { font-size: clamp(24px, 3vw, 30px); letter-spacing: -0.02em; margin: 0 0 28px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.steps li { counter-increment: step; background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 22px; position: relative; }
.steps li::before {
  content: counter(step, decimal-leading-zero); font-family: var(--mono); font-size: 12px;
  color: var(--accent); letter-spacing: 0.08em; display: block; margin-bottom: 10px;
}
.steps h3 { margin: 0 0 8px; font-size: 16px; }
.steps p { margin: 0; color: var(--ink-dim); font-size: 14px; }
code { font-family: var(--mono); font-size: 0.92em; background: #0d100f; border: 1px solid var(--line-soft);
  padding: 1px 5px; border-radius: 5px; color: #cfe8dd; }

.faq { display: grid; gap: 10px; }
details { background: var(--bg-raised); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
summary { cursor: pointer; padding: 16px 18px; font-weight: 600; font-size: 15px; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; float: right; color: var(--ink-faint); font-family: var(--mono); }
details[open] summary::after { content: "−"; }
details p { margin: 0; padding: 0 18px 18px; color: var(--ink-dim); font-size: 14.5px; max-width: 76ch; }

/* ---------- where the money goes ---------- */
.small-lede { max-width: 70ch; margin: 0 0 26px; font-size: 15px; color: var(--ink-dim); }
.flow { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.flow-card { background: var(--bg-raised); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 22px; }
.flow-tag {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 12px;
}
.flow-card h3 { margin: 0 0 10px; font-size: 17px; letter-spacing: -0.01em; }
.flow-card p { margin: 0; color: var(--ink-dim); font-size: 14px; }
.flow-note {
  margin: 20px 0 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #0e1211; color: var(--ink-dim); font-size: 14px; max-width: 80ch;
}
.flow-note strong { color: var(--ink); }
.flow-note.subtle { margin-top: 10px; font-size: 13px; color: var(--ink-faint); background: transparent; }
.flow-note + .flow-note { margin-top: 10px; }

/* ---------- post-claim choice dialog ---------- */
.claim-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: min(90vh, 760px); overflow: auto;
  margin: auto; padding: 0; border: 1px solid #2c4a3c; border-radius: var(--radius);
  background: var(--bg-raised); color: var(--ink); box-shadow: 0 24px 90px rgba(0,0,0,.72);
}
.claim-dialog::backdrop { background: rgba(3, 6, 4, .76); backdrop-filter: blur(4px); }
.claim-dialog-inner {
  padding: 26px; background: linear-gradient(160deg, rgba(78,227,155,.07), transparent 48%), var(--bg-raised);
}
.claim-dialog .flow-tag { margin: 0 0 8px; color: var(--accent); font: 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.claim-dialog h2 { margin: 0 0 10px; font-size: clamp(22px, 4vw, 28px); line-height: 1.2; }
.claim-dialog p { color: var(--ink-dim); font-size: 14px; overflow-wrap: anywhere; }
.claim-dialog-body { margin: 0 0 18px; }
.claim-receipt { margin: 18px 0; border-top: 1px solid var(--line); }
.claim-receipt > div { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(0, 1.2fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.claim-receipt dt { color: var(--ink-faint); font-size: 12px; }
.claim-receipt dd { margin: 0; text-align: right; font: 13px var(--mono); overflow-wrap: anywhere; }
.claim-receipt code, .claim-address code { font-size: 11px; overflow-wrap: anywhere; word-break: break-all; }
.claim-price-note { margin: -6px 0 14px; font-size: 11px !important; color: var(--ink-faint) !important; }
.claim-address { margin: 0 0 18px; font-size: 12px !important; }
.claim-address .link { overflow-wrap: anywhere; }
.claim-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 12px; }
.claim-actions .btn { min-height: 48px; white-space: normal; }
.claim-fineprint { margin: 0; font-size: 12px !important; color: var(--ink-faint) !important; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line-soft); margin-top: 40px; padding: 32px 24px 48px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: baseline; }
.footer-brand { margin: 0; font-size: 14px; }
.footer p { margin: 0; max-width: 62ch; }
.footer-inner .muted.small { max-width: 52ch; text-align: right; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #18211d; border: 1px solid #2c3a34; color: var(--ink);
  padding: 12px 18px; border-radius: 99px; font-size: 14px; z-index: 60;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5); animation: toast-in 0.18s ease both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .facts { grid-template-columns: 1fr; }
  .summary { grid-template-columns: 1fr; }
  .nav { display: none; }
  .wallet-controls { margin-left: auto; }
  .hero { padding: 56px 24px 40px; }
  .panel { padding: 20px; }
  .escrow-panel { align-items: stretch; flex-direction: column; }
  .escrow-panel > .btn { width: 100%; }
  .hide-sm { display: none; }
  .footer-inner .muted.small { text-align: left; }
}
/* comfortable touch targets on touch devices */
@media (pointer: coarse) {
  .btn, .btn-sm, .row-btn, select { min-height: 44px; }
  .input-row .btn { min-height: 44px; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .claim-dialog-inner { padding: 20px; }
  .claim-actions { grid-template-columns: 1fr; }
  .claim-actions .btn { width: 100%; }
  .hero { padding: 44px 16px 32px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .field.grow { flex-basis: 100%; }
  .field, .field-submit { flex: 1 1 100%; }
  .field-submit .btn { width: 100%; }
  .actions-row .btn { flex: 1 1 calc(50% - 5px); }
  .grid { font-size: 13px; }
  .grid thead th, .grid tbody td { padding: 11px 10px; }
}
