/* Rungs: dark first, dense, numbers in monospace. Light theme through prefers-color-scheme. */
:root {
  --bg: #0b0e13; --surface: #141a23; --raise: #1a222d; --line: #252e3b; --fg: #eef2f7; --muted: #8b97a8; --dim: #4d5868;
  --link: #8fb8ff; --btn: #eef2f7; --btn-fg: #0b0e13; --warn: #ffb020;
  --t0: #a07cff; --t1: #4f9dff; --t2: #25c6c6; --t3: #5fd36a; --t4: #ffb020; --t5: #ff6b7d;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9; --surface: #ffffff; --raise: #eef1f5; --line: #dde3ea; --fg: #0c1118; --muted: #5b6878; --dim: #b7c0cc;
    --link: #1f5fd0; --btn: #0c1118; --btn-fg: #ffffff; --warn: #a66300;
    --t0: #6a4ce0; --t1: #1f6fe0; --t2: #0b8f8f; --t3: #2b8f3a; --t4: #b26b00; --t5: #d1344c;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--sans); overflow-x: hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.top { max-width: 760px; margin: 0 auto; padding: 14px 16px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); font: 700 15px/1 var(--mono); letter-spacing: .08em; }
.brand:hover { text-decoration: none; }
.mark { width: 26px; height: 26px; color: var(--fg); }
.top nav a { font-size: 14px; color: var(--muted); margin-left: 14px; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
h1 { font: 700 19px/1.25 var(--sans); margin: 14px 0 10px; letter-spacing: -.01em; }
h2 { font: 700 15px/1.2 var(--mono); margin: 0; letter-spacing: .02em; }
h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 18px 0 6px; }

/* the wallet box */
form#wform { display: flex; gap: 8px; }
#w { flex: 1; min-width: 0; font: 15px/1.2 var(--mono); padding: 12px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
#w:focus { outline: 2px solid var(--t1); outline-offset: 1px; border-color: transparent; }
button, .btn { font: 600 14px/1 var(--sans); padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--raise); color: var(--fg); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
button[disabled] { opacity: .55; cursor: default; }
#wgo, .btn.primary { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.msg { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.msg.warn { border-color: var(--warn); }
.msg button { margin-top: 8px; }

/* lists */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); min-height: 48px; }
.row:last-child { border-bottom: 0; }
a.row, button.row { color: var(--fg); width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font: inherit; padding: 10px 2px; }
a.row:hover, button.row:hover { background: var(--surface); text-decoration: none; }
.ico { width: 28px; height: 28px; border-radius: 50%; background: var(--raise); flex: none; object-fit: cover; }
.who { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.who b { font: 700 14px/1.2 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { text-align: right; flex: none; font: 12px/1.3 var(--mono); color: var(--muted); }
.right b { color: var(--fg); font-size: 14px; }
.chip { display: inline-block; font: 600 11px/1 var(--mono); padding: 4px 6px; border-radius: 6px; background: var(--raise); color: var(--muted); }
.chip.go { color: var(--fg); }
.fold { font-size: 13px; color: var(--muted); padding: 10px 2px 0; }
#tokens { margin-top: 10px; }
#tokens .rows { border-top: 1px solid var(--line); }

/* boards */
.board { margin-top: 30px; }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.board-head .sub { font-size: 12px; color: var(--muted); }
.shape { display: flex; width: 96px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); flex: none; }
.shape i { display: block; height: 100%; }

/* the result card */
.card { margin-top: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.card .tok { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.card .tok b { color: var(--fg); font: 700 14px/1.2 var(--mono); }
.card .tok a { margin-left: auto; font-size: 13px; white-space: nowrap; }
.big { font: 800 clamp(40px, 13vw, 76px)/1 var(--mono); letter-spacing: -.03em; margin: 14px 0 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big .of { color: var(--muted); font-weight: 700; font-size: .5em; letter-spacing: 0; }
.line { font: 700 18px/1.3 var(--mono); margin: 6px 0 12px; }
.line .sep { color: var(--dim); }
.tier-0 { color: var(--t0); } .tier-1 { color: var(--t1); } .tier-2 { color: var(--t2); } .tier-3 { color: var(--t3); } .tier-4 { color: var(--t4); } .tier-5 { color: var(--t5); }
.ladder { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.rung { display: grid; grid-template-columns: 76px 1fr 64px 52px; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font: 13px/1.2 var(--mono); }
.rung .tn { font-weight: 700; color: var(--tc); }
.rung .rg { color: var(--muted); font-size: 11px; display: block; font-weight: 400; }
.rung .bar { position: relative; height: 8px; border-radius: 4px; background: var(--line); }
.rung .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--tc); }
.rung .bar .dot { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--fg); border: 3px solid var(--surface); }
.rung .ct { text-align: right; font-weight: 700; }
.rung .sh { text-align: right; color: var(--muted); }
.rung.you { background: var(--raise); box-shadow: inset 3px 0 0 var(--tc); padding-left: 8px; }
.rung.you .tn::after { content: " you"; color: var(--fg); font-size: 11px; }
.facts { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.facts b { color: var(--fg); font-family: var(--mono); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.preview { margin-top: 12px; }
.preview summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.preview img { display: block; margin-top: 8px; border-radius: 10px; border: 1px solid var(--line); width: 100%; height: auto; aspect-ratio: 1200 / 630; }
.top20 { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 12px 0 4px; }
.top20 span { font: 700 12px/30px var(--mono); text-align: center; border-radius: 6px; background: var(--raise); color: var(--muted); }
.top20 span.me { background: var(--t1); color: var(--btn-fg); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--dim); border-top-color: var(--fg); border-radius: 50%; animation: s 0.8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes s { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* the token section */
.token { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; }
.token h2 { font-size: 14px; }
.addr { display: flex; gap: 8px; align-items: flex-start; }
.addr code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 13px/1.4 var(--mono); padding-top: 6px; }
.addr button { padding: 6px 10px; font-size: 13px; }
.links a { margin-right: 16px; }

.foot { max-width: 760px; margin: 0 auto; padding: 18px 16px 40px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* how */
.prose { font-size: 15px; }
.prose h2 { font: 700 16px/1.3 var(--sans); margin: 28px 0 8px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose td, .prose th { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
.prose th { color: var(--muted); font-weight: 600; }
.prose li { margin: 4px 0; }

@media (min-width: 700px) {
  h1 { font-size: 22px; }
  .card { padding: 22px 24px; }
  .line { font-size: 22px; }
  .rung { grid-template-columns: 110px 1fr 80px 64px; font-size: 14px; }
  .top20 { grid-template-columns: repeat(20, 1fr); }
}
