/* DARWIN: a naturalist's field journal crossed with a trading terminal. */

:root {
  --bg: #0d1210;
  --bg-2: #111915;
  --panel: #151e19;
  --panel-2: #1b2620;
  --panel-3: #22302a;
  --line: #26352d;
  --line-2: #34493d;
  --text: #eee7d5;
  --dim: #a4ad9f;
  --mute: #6f7a71;
  --tag: #f2c14e;
  --tag-2: #ffd977;
  --tag-ink: #2a2110;
  --up: #5fd38d;
  --up-soft: rgba(95, 211, 141, 0.12);
  --down: #ff6b6b;
  --down-soft: rgba(255, 107, 107, 0.12);
  --warn: #f0a63c;
  --warn-soft: rgba(240, 166, 60, 0.12);
  --info: #7cc4ff;
  --info-soft: rgba(124, 196, 255, 0.1);
  --scout: #6dbb57;
  --follower: #5c9be0;
  --scavenger: #b8946b;
  --sniper: #e5524f;
  --display: "Silkscreen", "Courier New", monospace;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --shadow: 4px 4px 0 #000;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(238, 231, 213, 0.035) 1px, transparent 1px);
  background-size: 16px 16px;
  color: var(--text);
  font: 15px/1.6 var(--mono);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; padding-top: var(--s5); padding-bottom: var(--s8); outline: none; }
a { color: inherit; }
img, svg { display: block; }
/* Finch idle: two frames swapped with step timing (see art/traits.json "bob"). --bob and --ph are set per finch. */
.finch .fa { animation: fa var(--bob, 1.6s) step-end var(--ph, 0s) infinite; }
.finch .fb { visibility: hidden; animation: fb var(--bob, 1.6s) step-end var(--ph, 0s) infinite; }
@keyframes fa { 0% { visibility: visible; } 50% { visibility: hidden; } }
@keyframes fb { 0% { visibility: hidden; } 50% { visibility: visible; } }
@media (prefers-reduced-motion: reduce) { .finch .fa, .finch .fb { animation: none; } }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--tag); color: var(--tag-ink); }
:focus-visible { outline: 2px solid var(--tag); outline-offset: 2px; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: var(--s4); padding-right: var(--s4); }
.skip { position: absolute; left: -999px; top: 0; background: var(--tag); color: var(--tag-ink); padding: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ── Type ── */
h1, h2, h3, .display { font-family: var(--display); font-weight: 400; letter-spacing: 0.02em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(28px, 5vw, 48px); }
h2 { font-size: clamp(20px, 3vw, 26px); }
h3 { font-size: 16px; }
p { margin: 0 0 var(--s3); }
.dim { color: var(--dim); }
.mute { color: var(--mute); }
.up { color: var(--up); }
.down { color: var(--down); }
.warn { color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }
.big { font-size: clamp(28px, 4vw, 40px); font-weight: 600; line-height: 1.1; }
.label { font-family: var(--display); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); }
.fine { font-size: 12px; color: var(--mute); line-height: 1.5; }
.nowrap { white-space: nowrap; }
.mono-addr { font-size: 13px; color: var(--dim); }

/* ── Header ── */
.top { position: sticky; top: 0; z-index: 20; background: rgba(13, 18, 16, 0.94); backdrop-filter: blur(6px); border-bottom: 2px solid var(--line); }
.top-row { display: flex; align-items: center; gap: var(--s5); height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand-mark svg { width: 40px; height: 40px; }
.brand-word { font-family: var(--display); font-size: 22px; letter-spacing: 0.12em; }
.brand-word.sm { font-size: 18px; margin-bottom: var(--s2); }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { text-decoration: none; padding: 8px 12px; color: var(--dim); font-family: var(--display); font-size: 13px; letter-spacing: 0.04em; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-bottom-color: var(--tag); }
.top-actions { display: flex; gap: var(--s2); align-items: center; margin-left: auto; }
.menu-btn { display: none; background: none; border: 2px solid var(--line-2); width: 40px; height: 40px; cursor: pointer; font-size: 18px; }

.ticker { border-top: 1px solid var(--line); height: 34px; overflow: hidden; font-size: 13px; color: var(--dim); }
.ticker-inner { display: flex; gap: var(--s5); align-items: center; height: 34px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.ticker-inner::-webkit-scrollbar { display: none; }
.ticker b { color: var(--text); font-weight: 500; }
.live-dot { display: inline-block; width: 8px; height: 8px; background: var(--up); margin-right: 6px; animation: blink 1.6s steps(2) infinite; }
.live-dot.off { background: var(--warn); animation: none; }
@keyframes blink { 50% { opacity: 0.25; } }

@media (max-width: 960px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg-2); border-bottom: 2px solid var(--line); padding: var(--s2) var(--s4) var(--s4); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 4px; font-size: 15px; border-bottom: 1px solid var(--line); }
  .nav a.active { border-bottom-color: var(--line); color: var(--tag); }
}

/* ── Banner ── */
.banner { border-bottom: 2px solid var(--line); font-size: 13px; }
.banner .wrap { padding-top: 10px; padding-bottom: 10px; }
.banner.preview { background: var(--info-soft); color: var(--info); }
.banner.alert { background: var(--warn-soft); color: var(--warn); }
.banner.error { background: var(--down-soft); color: var(--down); }
.banner b { color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border: 2px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-family: var(--display); font-size: 13px; letter-spacing: 0.04em; text-decoration: none; cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, border-color 0.1s; white-space: nowrap; min-height: 40px;
}
.btn:hover { border-color: var(--dim); }
.btn:active { transform: translate(2px, 2px); }
.btn-tag { background: var(--tag); color: var(--tag-ink); border-color: var(--tag); box-shadow: var(--shadow); }
.btn-tag:hover { background: var(--tag-2); border-color: var(--tag-2); }
.btn-tag:active { box-shadow: 2px 2px 0 #000; }
.btn-up { background: var(--up); color: #0b2416; border-color: var(--up); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 11px; min-height: 32px; }
.btn[disabled], .btn.disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* ── Panels & layout ── */
.panel { background: var(--panel); border: 2px solid var(--line); padding: var(--s5); }
.panel.tight { padding: var(--s4); }
.panel + .panel { margin-top: var(--s4); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.section { margin-top: var(--s7); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
.section-head p { margin: 6px 0 0; color: var(--dim); max-width: 640px; }
.grid { display: grid; gap: var(--s4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.cards.five { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.split.rev { grid-template-columns: minmax(0, 1fr) minmax(0, 360px); }
@media (max-width: 960px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.rev { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: var(--s4); }
}

.page-head { margin-bottom: var(--s5); }
.page-head p { color: var(--dim); max-width: 720px; margin-top: var(--s3); }
.crumbs { font-size: 13px; color: var(--mute); margin-bottom: var(--s3); }
.crumbs a { color: var(--dim); text-decoration: none; }
.crumbs a:hover { color: var(--text); }

/* ── Stats ── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 2px; background: var(--line); border: 2px solid var(--line); }
.stat { background: var(--panel); padding: var(--s3) var(--s4); }
.stat .v { font-size: 22px; font-weight: 600; margin-top: 2px; }
.stat .s { font-size: 12px; color: var(--mute); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s4); font-size: 14px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; text-align: right; }

/* ── Specimen tag (the signature element) ── */
.tag {
  display: inline-flex; align-items: center; gap: 6px; background: var(--tag); color: var(--tag-ink);
  font-family: var(--display); font-size: 11px; padding: 3px 8px; letter-spacing: 0.05em; white-space: nowrap;
}
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line-2); font-size: 12px; color: var(--dim); white-space: nowrap; }
.pill.up { color: var(--up); border-color: rgba(95, 211, 141, 0.4); background: var(--up-soft); }
.pill.down { color: var(--down); border-color: rgba(255, 107, 107, 0.4); background: var(--down-soft); }
.pill.warn { color: var(--warn); border-color: rgba(240, 166, 60, 0.4); background: var(--warn-soft); }
.pill.info { color: var(--info); border-color: rgba(124, 196, 255, 0.35); background: var(--info-soft); }
.diet { font-family: var(--display); font-size: 11px; letter-spacing: 0.04em; }
.diet-Scout { color: var(--scout); }
.diet-Follower { color: var(--follower); }
.diet-Scavenger { color: var(--scavenger); }
.diet-Sniper { color: var(--sniper); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Darwin card ── */
.dcard { position: relative; display: block; background: var(--panel); border: 2px solid var(--line); text-decoration: none; transition: border-color 0.1s, transform 0.1s; }
.dcard:hover { border-color: var(--line-2); transform: translateY(-2px); }
.dcard .art { background: var(--panel-2); display: flex; justify-content: center; padding: var(--s2) 0 0; border-bottom: 2px solid var(--line); }
.dcard .art svg { width: 100%; height: auto; max-width: 160px; image-rendering: pixelated; }
.dcard .art.bg-Scout { background: linear-gradient(#1f2d22, #18231b); }
.dcard .art.bg-Follower { background: linear-gradient(#1c2836, #172029); }
.dcard .art.bg-Scavenger { background: linear-gradient(#2b251e, #211c17); }
.dcard .art.bg-Sniper { background: linear-gradient(#301c1e, #241618); }
.dcard .meta { padding: var(--s2) var(--s3) var(--s3); }
.dcard .row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.dcard .id { font-family: var(--display); font-size: 14px; }
.dcard .bal { font-size: 13px; }
.dcard .sub { font-size: 12px; color: var(--mute); margin-top: 2px; display: flex; justify-content: space-between; gap: 6px; }
.dcard .corner { position: absolute; top: 6px; left: 6px; }
.dcard.dead { opacity: 0.85; }

/* ── Coin ── */
.coin-logo { width: 36px; height: 36px; flex-shrink: 0; border: 2px solid var(--line-2); background: var(--panel-3); display: grid; place-items: center; font-family: var(--display); font-size: 12px; overflow: hidden; }
.coin-logo img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.coin-logo.lg { width: 64px; height: 64px; font-size: 18px; }
.coin-logo.sm { width: 24px; height: 24px; font-size: 9px; border-width: 1px; }
.coin-chip { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.coin-chip .sym { font-family: var(--display); font-size: 13px; }
.ccard { background: var(--panel); border: 2px solid var(--line); padding: var(--s4); text-decoration: none; display: block; transition: border-color 0.1s; }
.ccard:hover { border-color: var(--line-2); }
.ccard-head { display: flex; gap: var(--s3); align-items: center; margin-bottom: var(--s3); }
.ccard-head .name { font-size: 12px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard-head .rank { margin-left: auto; font-family: var(--display); font-size: 12px; color: var(--mute); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s3); }
.check { font-size: 11px; padding: 2px 6px; border: 1px solid rgba(95, 211, 141, 0.35); color: var(--up); background: var(--up-soft); white-space: nowrap; }
.check.na { border-color: var(--line-2); color: var(--mute); background: none; white-space: normal; }
.check.bad { border-color: rgba(255, 107, 107, 0.4); color: var(--down); background: var(--down-soft); }
.strip { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.strip .chipcard { flex: 0 0 auto; min-width: 150px; background: var(--panel); border: 2px solid var(--line); padding: var(--s3); text-decoration: none; }
.strip .chipcard:hover { border-color: var(--line-2); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border: 2px solid var(--line); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--display); font-weight: 400; font-size: 11px; letter-spacing: 0.06em; color: var(--mute); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; background: var(--bg-2); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
td.r, th.r { text-align: right; }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; }
.thumb { width: 40px; height: 40px; background: var(--panel-2); border: 1px solid var(--line); }
.thumb svg { width: 100%; height: 100%; }
.who { display: flex; align-items: center; gap: 10px; }

/* ── Tabs & filters ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; }
.tabs button, .tabs a { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; padding: 10px 16px; cursor: pointer; font-family: var(--display); font-size: 13px; color: var(--dim); text-decoration: none; white-space: nowrap; }
.tabs .on { color: var(--text); border-bottom-color: var(--tag); }
.filters { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s4); }
.filters label { font-size: 12px; color: var(--mute); display: flex; gap: 6px; align-items: center; }
select, input[type="text"], input[type="number"], input[type="search"] {
  background: var(--panel-2); border: 2px solid var(--line-2); padding: 8px 10px; min-height: 40px; font-size: 14px; border-radius: 0;
}
select:focus, input:focus { border-color: var(--tag); outline: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button, .chips a { background: var(--panel); border: 1px solid var(--line-2); padding: 6px 10px; cursor: pointer; font-size: 12px; color: var(--dim); text-decoration: none; }
.chips button.on, .chips a.on { border-color: var(--tag); color: var(--tag); }
.pager { display: flex; gap: var(--s2); justify-content: center; align-items: center; margin-top: var(--s5); font-size: 13px; color: var(--dim); }

/* ── Hero ── */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: var(--s6); align-items: center; padding: var(--s5) 0 var(--s4); }
.hero h1 span { color: var(--tag); }
.hero .lede { font-size: 17px; color: var(--dim); margin: var(--s4) 0 var(--s5); max-width: 560px; }
.hero .lede b { color: var(--text); font-weight: 500; }
.specimen { position: relative; background: var(--panel); border: 2px solid var(--line); padding: var(--s4); box-shadow: 8px 8px 0 #000; }
.specimen .art svg { width: 100%; height: auto; image-rendering: pixelated; }
.specimen .pin { position: absolute; top: -10px; right: 18px; transform: rotate(3deg); }
.specimen .label-row { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px dashed var(--line-2); padding-top: var(--s3); margin-top: var(--s3); gap: var(--s3); }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } .specimen { max-width: 420px; } }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); counter-reset: step; }
.step { background: var(--panel); border: 2px solid var(--line); padding: var(--s4); }
.step .n { font-family: var(--display); color: var(--tag); font-size: 12px; margin-bottom: var(--s2); }
.step h3 { margin-bottom: var(--s2); }
.step p { color: var(--dim); font-size: 14px; margin: 0; }
@media (max-width: 860px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

/* ── Feed ── */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: flex-start; }
.feed li:last-child { border-bottom: none; }
.feed .ico { width: 22px; flex-shrink: 0; text-align: center; }
.feed .when { margin-left: auto; color: var(--mute); font-size: 12px; white-space: nowrap; padding-left: var(--s2); }
.feed a { color: var(--text); }

/* ── Broke meter ── */
.meter { height: 14px; border: 2px solid var(--line-2); background: var(--bg-2); position: relative; }
.meter > i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, var(--up) 0 6px, transparent 6px 8px); }
.meter.low > i { background: repeating-linear-gradient(90deg, var(--warn) 0 6px, transparent 6px 8px); }

/* ── Chart ── */
.chart { position: relative; width: 100%; user-select: none; touch-action: pan-y; }
.chart svg { width: 100%; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--bg); border: 2px solid var(--line-2); padding: 6px 8px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -100%); top: 0; display: none; z-index: 2; }
.chart .tip b { display: block; font-weight: 600; }
.chart-empty { height: 200px; display: grid; place-items: center; color: var(--mute); border: 2px dashed var(--line); font-size: 13px; text-align: center; padding: var(--s4); }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: 12px; color: var(--dim); margin-top: var(--s2); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }

/* ── Darwin page ── */
.portrait { background: var(--panel); border: 2px solid var(--line); }
.portrait .art { display: flex; justify-content: center; padding: var(--s4) var(--s4) 0; }
.portrait .art svg { width: 100%; height: auto; max-width: 340px; image-rendering: pixelated; }
.portrait .art.bg-Scout { background: radial-gradient(circle at 50% 40%, #243a29, #18231b 70%); }
.portrait .art.bg-Follower { background: radial-gradient(circle at 50% 40%, #213448, #172029 70%); }
.portrait .art.bg-Scavenger { background: radial-gradient(circle at 50% 40%, #362e24, #211c17 70%); }
.portrait .art.bg-Sniper { background: radial-gradient(circle at 50% 40%, #3d2224, #241618 70%); }
.portrait .body { padding: var(--s4); border-top: 2px solid var(--line); }
.genes td:first-child { color: var(--mute); }
.carried { color: var(--mute); font-size: 12px; }
.epitaph { font-family: var(--display); font-size: 14px; line-height: 1.6; color: var(--dim); border-left: 4px solid var(--line-2); padding-left: var(--s3); }
.eating { display: grid; grid-template-columns: auto 1fr; gap: var(--s4); align-items: center; }

/* ── Graveyard ── */
.tab-note { margin: calc(-1 * var(--s2)) 0 var(--s4); font-size: 13px; max-width: 80ch; }
.stones { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stone { background: var(--panel); border: 2px solid var(--line); text-decoration: none; display: flex; flex-direction: column; color: var(--dim); transition: border-color 0.15s, transform 0.15s; }
.stone:hover { border-color: var(--line-2); transform: translateY(-2px); }
.stone .art { background: radial-gradient(ellipse at 50% 30%, #222838, #12151c 75%); display: flex; justify-content: center; padding: var(--s3) var(--s3) 0; }
.stone .art svg { width: 82%; height: auto; image-rendering: pixelated; }
.stone .txt { padding: var(--s3) var(--s4) var(--s4); font-size: 13px; display: flex; flex-direction: column; gap: var(--s2); flex: 1; }
.stone .name { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.stone .name .display { color: var(--text); font-size: 16px; }
.stone .cause { margin: 0; color: var(--text); font-style: italic; line-height: 1.4; }
.stone .when { margin: auto 0 0; color: var(--mute); font-size: 12px; }
.mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 0; background: var(--line); border: 1px solid var(--line); }
.mini div { background: var(--bg-2); padding: 6px 8px; min-width: 0; }
.mini dt { font-family: var(--display); font-size: 10px; letter-spacing: 0.06em; color: var(--mute); }
.mini dd { margin: 2px 0 0; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini dd.up { color: var(--up); }
@media (max-width: 600px) { .stones { grid-template-columns: minmax(0, 1fr); } }

/* ── States ── */
.loading { padding: var(--s7) 0; text-align: center; color: var(--mute); font-family: var(--display); font-size: 13px; }
.loading::after { content: ""; display: inline-block; width: 1ch; animation: dots 1.2s steps(4) infinite; text-align: left; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--mute); border: 2px dashed var(--line); font-size: 14px; }
.error-box { padding: var(--s5); border: 2px solid rgba(255, 107, 107, 0.4); background: var(--down-soft); }
.error-box h2 { color: var(--down); margin-bottom: var(--s3); }
.skeleton { background: linear-gradient(90deg, var(--panel) 0, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; min-height: 120px; border: 2px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Modal & toast ── */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 50; display: grid; place-items: center; padding: var(--s4); }
.modal { background: var(--panel); border: 2px solid var(--line-2); box-shadow: 8px 8px 0 #000; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s4); border-bottom: 2px solid var(--line); }
.modal-head button { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--dim); }
.modal-body { padding: var(--s4); }
.modal-body .opt { display: flex; gap: var(--s2); flex-wrap: wrap; margin: var(--s3) 0; }
.modal-body .opt button { flex: 1; min-width: 72px; }
.modal-body .opt button.on { border-color: var(--tag); color: var(--tag); }
.toasts { position: fixed; bottom: var(--s4); right: var(--s4); z-index: 60; display: flex; flex-direction: column; gap: var(--s2); max-width: calc(100vw - 32px); }
.toast { background: var(--panel-2); border: 2px solid var(--line-2); padding: 10px 14px; font-size: 14px; box-shadow: var(--shadow); animation: pop 0.15s ease-out; }
.toast.ok { border-color: var(--up); }
.toast.err { border-color: var(--down); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.hatch svg { animation: hatch 0.6s steps(6) both; }
@keyframes hatch { from { transform: scale(0.2) rotate(-12deg); opacity: 0; } }

/* ── Footer ── */
.foot { border-top: 2px solid var(--line); background: var(--bg-2); padding: var(--s6) 0; margin-top: auto; }
.foot-grid { display: grid; grid-template-columns: 1.2fr 0.8fr 2fr; gap: var(--s5); }
.foot-grid p { font-size: 13px; }
.foot-links { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.foot-links a { color: var(--dim); text-decoration: none; }
.foot-links a:hover { color: var(--text); }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; } }

/* ── Lab / prose ── */
.prose p, .prose li, .prose .page-head p { max-width: 80ch; }
.prose h2 { margin: var(--s6) 0 var(--s3); }
.prose h3 { margin: var(--s5) 0 var(--s2); }
.prose p, .prose li { color: var(--dim); }
.prose b { color: var(--text); font-weight: 500; }
.prose ul { padding-left: 20px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s4) 0; }
.toc a { font-size: 12px; padding: 4px 8px; border: 1px solid var(--line-2); text-decoration: none; color: var(--dim); }
.toc a:hover { color: var(--text); border-color: var(--dim); }
.bar { height: 8px; background: var(--bg-2); border: 1px solid var(--line); min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--tag); }
details.faq { border-bottom: 1px solid var(--line); padding: var(--s3) 0; }
details.faq summary { cursor: pointer; font-weight: 500; }
details.faq p { margin-top: var(--s2); }
code, .hash { font-family: var(--mono); font-size: 12px; color: var(--dim); word-break: break-all; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Mint ── */
.mint-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s6); align-items: start; margin-top: var(--s4); }
.mint-preview .art svg { width: 100%; height: auto; image-rendering: pixelated; }
.mint-panel { margin: 0; display: flex; flex-direction: column; gap: var(--s4); }
.mint-panel h1 { font-size: 34px; }
.mint-panel > p { margin: 0; }
.mint-progress .bar { height: 12px; }
.mint-progress .row { display: flex; justify-content: space-between; font-size: 13px; margin-top: 6px; gap: var(--s3); }
.price-list { margin: 0; display: grid; gap: 2px; background: var(--line); border: 2px solid var(--line); }
.price-list div { display: flex; justify-content: space-between; gap: var(--s3); background: var(--bg-2); padding: 10px 14px; }
.price-list dt { color: var(--dim); }
.price-list dd { margin: 0; text-align: right; color: var(--text); font-weight: 500; }
.price-list dd.up { color: var(--up); }
.mint-form { display: flex; flex-direction: column; gap: var(--s3); }
.stepper { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.stepper .btn { width: 44px; justify-content: center; font-size: 18px; padding: 8px 0; }
.stepper input { width: 72px; text-align: center; font: inherit; font-size: 20px; padding: 8px; background: var(--bg-2); color: var(--text); border: 2px solid var(--line-2); }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.mint-form .total { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px dashed var(--line-2); padding-top: var(--s3); }
.mint-form .total b { font-size: 22px; }
.ack { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--dim); cursor: pointer; line-height: 1.5; }
.ack input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--tag, #f2c14e); }
.soldout { border: 2px solid var(--line-2); padding: var(--s4); background: var(--bg-2); }
.soldout h3 { margin-bottom: var(--s2); }
.odds { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 2px; background: var(--line); border: 2px solid var(--line); }
.odd { display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 12px 14px; }
.odd .num { margin-left: auto; color: var(--dim); }
.sw { width: 14px; height: 14px; border: 2px solid #000; flex-shrink: 0; }
.sw-Scout { background: #5aa84a; } .sw-Follower { background: #4a8bd8; } .sw-Scavenger { background: #9b7b5b; } .sw-Sniper { background: #cf3b3e; }
@media (max-width: 860px) { .mint-grid { grid-template-columns: minmax(0, 1fr); } .mint-preview { order: 2; max-width: 360px; width: 100%; justify-self: center; } .mint-panel h1 { font-size: 26px; } }

/* ── Wallet picker ── */
.wallet-list { display: flex; flex-direction: column; gap: var(--s2); }
.wallet-opt { justify-content: flex-start; gap: 12px; width: 100%; padding: 12px 14px; }
.wallet-opt img { width: 24px; height: 24px; image-rendering: auto; }

/* ── My Nest dashboard ── */
.nest-head { display: flex; justify-content: space-between; align-items: end; gap: var(--s4); flex-wrap: wrap; }
.alerts { border: 2px solid var(--line-2); background: var(--bg-2); padding: var(--s3) var(--s4); margin-bottom: var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.alert-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; background: var(--panel); border-left: 4px solid var(--line-2); font-size: 14px; }
.alert-item.urgent { border-left-color: var(--down); background: var(--down-soft, rgba(240, 90, 90, 0.08)); }
.alert-item.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.alert-item.good { border-left-color: var(--up); }
.alert-item .ico { font-size: 16px; }
.all-good { border: 2px dashed var(--line-2); padding: 10px 14px; margin-bottom: var(--s4); color: var(--dim); font-size: 14px; }
.flock-stats { margin-bottom: var(--s5); }
.flock-stats .stat .v a { text-decoration: none; }
.nest-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: var(--s5); align-items: start; }
.nest-side { display: flex; flex-direction: column; gap: var(--s4); position: sticky; top: 80px; }
.lcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--s3); }
.lcard { display: grid; grid-template-columns: 104px minmax(0, 1fr); background: var(--panel); border: 2px solid var(--line); }
.lcard.warn { border-color: rgba(240, 166, 60, 0.55); }
.lcard.urgent { border-color: var(--down); box-shadow: 0 0 0 1px var(--down) inset; }
.lcard .art { display: flex; align-items: end; justify-content: center; border-right: 2px solid var(--line); }
.lcard .art { position: relative; overflow: hidden; }
.lcard .art svg { width: 100%; height: auto; image-rendering: pixelated; position: relative; }
.lcard .art svg.spark { position: absolute; inset: 0; height: 100%; }
.spark.up { color: var(--up); }
.spark.down { color: var(--down); }
.spark .base { fill: var(--mute); opacity: 0.35; }
.spark .tip { animation: spark-tip 1.6s steps(2, jump-none) infinite; }
@keyframes spark-tip { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .spark .tip { animation: none; } }
.lcard .art.bg-Scout { background: radial-gradient(circle at 50% 40%, #243a29, #18231b 70%); }
.lcard .art.bg-Follower { background: radial-gradient(circle at 50% 40%, #213448, #172029 70%); }
.lcard .art.bg-Scavenger { background: radial-gradient(circle at 50% 40%, #362e24, #211c17 70%); }
.lcard .art.bg-Sniper { background: radial-gradient(circle at 50% 40%, #3d2224, #241618 70%); }
.lbody { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ltop { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ltop .display { font-size: 16px; color: var(--text); }
.ltop a { text-decoration: none; }
.lpill { margin-left: auto; }
.lnums { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px 12px; margin: 0; }
.lnums dt { font-family: var(--display); font-size: 10px; letter-spacing: 0.06em; color: var(--mute); }
.lnums dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.doing { margin: 0; font-size: 13px; color: var(--dim); }
.lactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.gone { margin-top: var(--s4); }
.gone summary { cursor: pointer; color: var(--dim); font-size: 14px; }
.gone-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--s3); }
.gone-item { display: flex; gap: 8px; align-items: center; background: var(--panel); border: 2px solid var(--line); padding: 4px 10px 4px 4px; text-decoration: none; font-size: 12px; }
.gone-item svg { width: 48px; height: 48px; }
.feed.activity li.new { background: rgba(95, 211, 141, 0.07); box-shadow: inset 3px 0 0 var(--up); }
.guide ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.guide li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: 13px; }
.guide .tick { width: 20px; height: 20px; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: 12px; color: var(--tag-ink); }
.guide li.done .tick { background: var(--up); border-color: var(--up); }
.guide li.done b { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--line-2); }
.nest-empty { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.nest-empty .specimen svg { width: 100%; height: auto; image-rendering: pixelated; }
@media (max-width: 1060px) { .nest-grid { grid-template-columns: minmax(0, 1fr); } .nest-side { position: static; } }
@media (max-width: 640px) {
  .lcard { grid-template-columns: 88px minmax(0, 1fr); }
  .nest-empty { grid-template-columns: minmax(0, 1fr); }
  .nest-empty .specimen { max-width: 220px; }
}
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 6px; background: var(--down); color: #fff; font-size: 11px; font-family: var(--mono, inherit); border-radius: 10px; }

/* Leaderboard: today's top 10 so far, the player's own wallet row */
tr.prize td { background: var(--up-soft); }
tr.prize td:first-child { box-shadow: inset 3px 0 0 var(--up); }
.reward { color: var(--up); font-weight: 600; font-size: 13px; }
tr.you td { background: rgba(242, 193, 78, 0.08); }
.badge-you { display: inline-block; padding: 1px 6px; border: 1px solid var(--tag); color: var(--tag); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; vertical-align: 1px; }
tr.gap td { text-align: center; color: var(--mute); padding: 4px; }

/* Time machine (local test chain only) */
.banner.tm { background: var(--panel-2); border-bottom: 2px dashed var(--tag); }
.banner.tm .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tm-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-busy { opacity: .8; }

/* Family: who bred whom, at a glance */
.family { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 13px; color: var(--dim); margin: 0; }
.family a { color: var(--text); }
.family-row { display: flex; gap: 12px 18px; flex-wrap: wrap; margin: 8px 0 16px; }
.lcard .art-tag { position: absolute; top: 6px; left: 6px; z-index: 1; padding: 1px 6px; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; background: var(--panel); border: 1px solid var(--tag); color: var(--tag); white-space: nowrap; }
.lcard.new-chick { border-color: var(--tag); }
.nest-filter { margin: 0 0 var(--s3); }
