/* Qwai Explorer. The look comes from the logo: one hot red-pink, white,
   and hard squares. Corners are square on purpose. */
:root {
  --bg: #f5f4f1;
  --panel: #ffffff;
  --ink: #101014;
  --muted: #5b5d66;
  --line: #d9d7d2;
  --grid: #e7e5e0;
  --brand: #ff2d55;
  --brand-ink: #ffffff;
  --brand-soft: #ffe3e9;
  --good: #0f7a43;
  --bad: #b3261e;
  /* Chart series, checked for colour-blind separation on this surface. */
  --s1: #e0234b;
  --s2: #2a78d6;
  --s3: #1baf7a;
  --s4: #eda100;
  --quiet: #b9b7b1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0e;
    --panel: #15151a;
    --ink: #f4f3f1;
    --muted: #a3a5ae;
    --line: #2a2a31;
    --grid: #222228;
    --brand: #ff2d55;
    --brand-ink: #ffffff;
    --brand-soft: #3a1420;
    --good: #58d19a;
    --bad: #ff8a80;
    --s1: #f03a5f;
    --s2: #3987e5;
    --s3: #199e70;
    --s4: #c98500;
    --quiet: #4a4a52;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration-color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand); }
a:focus-visible, button:focus-visible, input:focus-visible, canvas:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.hidden { position: absolute; left: -9999px; }
.mono { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 16px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }

.top { max-width: 1280px; margin: 0 auto; padding: 22px 20px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 30px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; font-size: 26px; font-weight: 500; letter-spacing: -0.02em; }
.brand b { font-weight: 700; }
.brand img { display: block; }
nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
nav a { font-weight: 600; padding: 11px 0; text-decoration: none; border-bottom: 3px solid transparent; }
nav a[aria-current="page"] { border-bottom-color: var(--brand); }
#search { display: flex; flex: 1 1 360px; }
#search input { flex: 1; min-width: 0; border-right: 0; }
button, input { font: inherit; min-height: 50px; border: 2px solid var(--ink); border-radius: 0; padding: 10px 18px; color: var(--ink); background: var(--panel); }
button { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; cursor: pointer; }
button:hover { filter: brightness(1.08); }
button.plain { background: transparent; color: var(--ink); border-color: var(--ink); }
button.copy { min-height: 46px; padding: 6px 14px; margin-left: 10px; vertical-align: middle; }

.pulse { max-width: 1280px; margin: 0 auto; padding: 0 20px; min-height: 30px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 26px; font-variant-numeric: tabular-nums; }
.pulse b { color: var(--ink); font-weight: 600; }

main { max-width: 1280px; margin: 0 auto; padding: 0 20px 80px; }
h1 { font-size: 34px; line-height: 1.15; margin: 30px 0 18px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
h2 { font-size: 22px; margin: 0 0 16px; letter-spacing: -0.01em; }
h3 { font-size: 18px; margin: 0 0 10px; }
section { background: var(--panel); border: 2px solid var(--line); padding: 24px; margin: 20px 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.cols > section { margin: 0; min-width: 0; }
.error { color: var(--bad); font-weight: 600; }

/* Headline figures */
.hero { display: grid; grid-template-columns: minmax(260px, 1.1fr) 2fr; gap: 20px; margin-top: 22px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero-figure { background: var(--brand); color: var(--brand-ink); padding: 26px; display: flex; flex-direction: column; justify-content: space-between; min-height: 210px; }
.hero-figure .label { font-weight: 600; }
.hero-figure .value { font-size: clamp(56px, 9vw, 96px); font-weight: 700; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.hero-figure .value.tick { animation: tick 0.5s ease-out; }
@keyframes tick { from { transform: translateY(14px); opacity: 0.2; } to { transform: none; opacity: 1; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
main > .tiles, main > .cols { margin: 20px 0; }
.tile { background: var(--panel); border: 2px solid var(--line); padding: 16px 18px; display: flex; flex-direction: column; min-width: 0; }
.tile .label { color: var(--muted); }
.tile .value { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* The chain as a row of squares, newest first */
.strip { display: flex; gap: 12px; overflow: hidden; padding: 4px 0; }
.blk { flex: 0 0 132px; height: 132px; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); padding: 12px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; position: relative; text-align: left; }
.blk:hover { border-color: var(--brand); color: var(--ink); }
.blk .h { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.blk .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--brand); opacity: 0.16; }
.blk > span { position: relative; }
.blk.enter { animation: enter 0.7s cubic-bezier(0.2, 0.9, 0.2, 1); }
.blk.enter .h { color: var(--brand); }
@keyframes enter { from { transform: translateX(-150px) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Transaction map */
.map-wrap { position: relative; }
canvas.map { display: block; width: 100%; height: 520px; background: var(--bg); border: 2px solid var(--line); cursor: crosshair; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 9px; }
.legend i { display: inline-block; width: 14px; height: 14px; flex: none; }
.legend i.outline { border: 2px solid var(--ink); }
.legend i.solid { background: var(--ink); }
.legend i.diamond { background: var(--ink); transform: rotate(45deg) scale(0.8); }

/* Tables */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.fresh td { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--brand-soft); } to { background: transparent; } }
.ok { color: var(--good); font-weight: 700; }
.failed { color: var(--bad); font-weight: 700; }
.tag { display: inline-block; border: 2px solid var(--ink); padding: 1px 10px; font-weight: 600; }
.tag.in { border-color: var(--good); }
.tag.out { border-color: var(--brand); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 12px 28px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 640px) { dl.facts { grid-template-columns: 1fr; gap: 2px; } dl.facts dd { margin-bottom: 12px; } }
.pager { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
main > .pager { margin: 0 0 20px; }
pre { background: var(--bg); border: 2px solid var(--line); padding: 14px; overflow-x: auto; font: 16px/1.5 "JetBrains Mono", ui-monospace, monospace; margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Meters, stacked bars, signature squares */
.meter { margin: 0 0 18px; }
.meter .row { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.meter .track { height: 14px; background: var(--grid); }
.meter .bar { height: 100%; background: var(--brand); min-width: 2px; transition: width 0.6s ease; }
.stack { display: flex; gap: 2px; height: 30px; }
.stack div { min-width: 3px; }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; margin: 16px 0 20px; }
.keys span { display: flex; align-items: flex-start; gap: 10px; }
.keys i { width: 14px; height: 14px; flex: none; margin-top: 6px; }
.keys div { color: var(--muted); min-width: 0; }
.keys b { display: block; color: var(--ink); font-variant-numeric: tabular-nums; }
.sigs { display: flex; flex-wrap: wrap; gap: 8px; }
.sig { width: 46px; height: 46px; border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 700; text-decoration: none; }
.sig.signed { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.sig.absent { border-style: dashed; color: var(--muted); }

/* Transaction flow and timeline */
.flow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: stretch; }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr; } }
.party { border: 2px solid var(--ink); padding: 16px; min-width: 0; }
.party .who { color: var(--muted); }
.wire { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 190px; gap: 8px; text-align: center; }
.wire .amount { font-size: 22px; font-weight: 700; }
.wire .track { width: 100%; height: 14px; position: relative; overflow: hidden; background:
  repeating-linear-gradient(90deg, var(--brand) 0 14px, transparent 14px 28px); animation: wire 1.1s linear infinite; }
.wire.failed .track { background: repeating-linear-gradient(90deg, var(--quiet) 0 14px, transparent 14px 28px); animation: none; }
@keyframes wire { from { background-position: 0 0; } to { background-position: 28px 0; } }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.step { border-top: 6px solid var(--brand); padding-top: 12px; }
.step.off { border-top-color: var(--quiet); }
.step b { display: block; font-size: 19px; }

/* Charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font: 18px "Space Grotesk", system-ui, sans-serif; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .col { fill: var(--s1); }
.chart .col.dim { fill: var(--quiet); }
.chart .trend { fill: none; stroke: var(--s2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .wash { fill: var(--s2); opacity: 0.1; }
.chart .dot { fill: var(--s2); stroke: var(--panel); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .hit { fill: transparent; }
#tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 12px; font-size: 16px; max-width: 320px; }
#tip b { display: block; }

.endpoint { border-top: 1px solid var(--line); padding: 18px 0; }
.endpoint:first-of-type { border-top: 0; padding-top: 0; }
.endpoint p { margin: 6px 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
