:root {
  --bg: #f5efe3;
  --card: #fffdf8;
  --line: #e4dac6;
  --line2: #efe7d8;
  --ink: #1c2541;
  --mute: #6b6f80;
  --orange: #ff5b14;
  --orange-soft: #ffe4d5;
  --teal: #0f9e8a;
  --teal-soft: #d6f1ec;
  --butter: #ffd34d;
  --up: #12915a;
  --down: #d63b2f;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 6px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 Figtree, system-ui, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
/* geometric tile wall + grain */
body::before, body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
body::before { background: url(/brand/geo.svg) 0 0 / 480px 480px; opacity: .5; }
body::after {
  opacity: .45; mix-blend-mode: multiply;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .5 0 0 0 0 .4 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
.tape, main, .foot { position: relative; z-index: 1; }
@media (max-width: 700px) { body::before { background-size: 360px 360px; opacity: .4; } }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
.num { font-family: var(--mono); font-weight: 500; letter-spacing: -.02em; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--mute); }
.mute { color: var(--mute); }

/* top */
.top { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: none; }
.logo img { border-radius: 9px; }
.logo span { font: 800 25px/1 'Bricolage Grotesque', Figtree, sans-serif; letter-spacing: -.04em; }
.search { position: relative; flex: 1; max-width: 480px; }
.search input {
  width: 100%; height: 38px; border-radius: 19px; border: 1px solid #3a4466; background: #26304f;
  color: #fff; padding: 0 16px; font: inherit; outline: none;
}
.search input::placeholder { color: #9aa2bd; }
.search input:focus { border-color: var(--butter); }
.qres {
  position: absolute; top: 44px; left: 0; right: 0; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 30px rgba(28,37,65,.18);
  max-height: 420px; overflow: auto; padding: 4px;
}
.qres a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; text-decoration: none; }
.qres a:hover, .qres a.on { background: var(--orange-soft); }
.qres .k { margin-left: auto; font-size: 12px; color: var(--mute); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 17px; color: #c9cee0; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: #fff; }
.nav a.on { background: var(--butter); color: var(--ink); }
.nav b { font-family: var(--mono); font-size: 12px; }
.tide { height: 12px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12'%3E%3Cpath d='M0 9 L8 3 L16 9' fill='none' stroke='%23ffd34d' stroke-width='2'/%3E%3C/svg%3E") 0 0 / 16px 12px repeat-x, var(--ink); }

/* tape */
.tape { background: var(--card); border-bottom: 1px solid var(--line); overflow: hidden; white-space: nowrap; }
.tape-in { display: inline-flex; gap: 26px; padding: 8px 0; animation: roll 90s linear infinite; }
.tape:hover .tape-in { animation-play-state: paused; }
.tape a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.tape a b { font-weight: 800; }
.tape a i { font-style: normal; color: var(--mute); }
.tape img { width: 18px; height: 18px; border-radius: 50%; }
@keyframes roll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tape-in { animation: none; } }

main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; }
.loading, .empty { padding: 60px 0; text-align: center; color: var(--mute); }

/* heads */
.lede { margin: 2px 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.lede h1 { font-size: 20px; line-height: 1.25; letter-spacing: -.01em; margin: 0 0 3px; }
.lede .hc { color: var(--orange); } .lede .hs { color: var(--teal); }
.lede p { margin: 0; color: var(--mute); max-width: 640px; }
.lede p b { color: var(--ink); }
h2 { font-size: 15px; margin: 0; letter-spacing: -.01em; }
.sec-h { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 6px 5px 12px; }
.sec-h .mute { font-size: 13px; }

/* wild rides strip */
.rides { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.ride {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px;
  text-decoration: none; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  transition: border-color .15s;
}
.ride:hover { border-color: var(--orange); }
.ride .who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ride .who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.ride .who b { font-weight: 800; }
.ride .x { font: 700 26px/1 var(--mono); letter-spacing: -.04em; }
.ride .x small { font: 600 12px Figtree, sans-serif; margin-left: 4px; letter-spacing: 0; }
.ride.with .x { color: var(--orange); } .ride.against .x { color: var(--ink); }
.ride .vs { font-size: 12px; color: var(--mute); display: flex; justify-content: space-between; gap: 6px; }

/* bars: stock vs coin */
.bars { display: grid; gap: 3px; }
.bar { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 6px; font-size: 11px; }
.bar .tr { height: 7px; background: var(--line2); border-radius: 4px; position: relative; overflow: hidden; }
.bar .tr i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.bar .tr::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line); }
.bar.s i { background: var(--teal); } .bar.c i { background: var(--orange); }

/* board split */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.panel-h { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 14px; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--mute);
}
.chip:hover { color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel-h .chips { margin-left: auto; }
.stocks { max-height: 760px; overflow: auto; }
.srow {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 64px; gap: 10px; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--line2); text-decoration: none; cursor: pointer; background: none; border-left: 3px solid transparent;
  width: 100%; text-align: left; border-top: 0; border-right: 0;
}
.srow:hover { background: #fbf6ec; }
.srow.on { background: var(--teal-soft); border-left-color: var(--teal); }
.srow .nm b { display: block; font-weight: 800; }
.srow .nm span { display: block; font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .px { text-align: right; font-size: 13px; }
.srow .px .num { display: block; }
.srow .rid { text-align: right; font-size: 12px; color: var(--mute); }
.srow .rid b { display: block; font: 700 14px var(--mono); color: var(--ink); }
.slogo { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 1px solid var(--line2); object-fit: cover; }

.shead { padding: 14px; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.shead .slogo { width: 44px; height: 44px; }
.shead h2 { font-size: 19px; }
.shead .sub { font-size: 13px; color: var(--mute); }
.shead .moves { margin-left: auto; display: flex; gap: 14px; font-size: 12px; color: var(--mute); text-align: right; }
.shead .moves b { display: block; font: 700 15px var(--mono); }

.clist { }
.crow {
  display: grid; grid-template-columns: 22px 34px minmax(0, 1.4fr) repeat(3, minmax(0, .8fr)) 96px; gap: 10px; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--line2); text-decoration: none;
}
.crow:hover { background: #fbf6ec; }
.crow.head { font-size: 11px; color: var(--mute); text-transform: lowercase; padding-top: 7px; padding-bottom: 7px; background: #fbf8f1; }
.crow.head:hover { background: #fbf8f1; }
.crow .nm { min-width: 0; }
.crow .nm b { font-weight: 800; }
.crow .nm span { display: block; font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .r { text-align: right; font-size: 13px; }
.clogo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--line2); flex: none; }
.star { border: 0; background: none; padding: 0; font-size: 16px; color: #cbbfa8; line-height: 1; }
.star.on { color: var(--orange); }
.pill {
  display: inline-block; font: 700 12px var(--mono); padding: 3px 8px; border-radius: 12px; white-space: nowrap; text-align: center;
}
.pill.with { background: var(--orange-soft); color: #b83d06; }
.pill.against { background: #e2e5f0; color: var(--ink); }
.pill.none { background: transparent; color: var(--mute); font-weight: 500; }
.dust { padding: 10px 14px; font-size: 13px; color: var(--mute); display: flex; justify-content: space-between; align-items: center; }
.dust button { border: 0; background: none; text-decoration: underline; color: var(--ink); padding: 0; }
.capnote { padding: 8px 14px; font-size: 12px; color: var(--mute); background: #fbf8f1; border-bottom: 1px solid var(--line2); }

/* coin page */
.back { display: inline-block; margin-bottom: 12px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 3px 12px; }
.back:hover { background: var(--butter); }
.chead { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.chead .clogo { width: 64px; height: 64px; }
.chead h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.chead h1 .star { font-size: 24px; }
.chead .sub { color: var(--mute); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.ca {
  border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 3px 10px; font: 500 12px var(--mono);
}
.ca:hover { border-color: var(--ink); }
.links { display: flex; gap: 6px; flex-wrap: wrap; }
.links a { font-size: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 3px 9px; text-decoration: none; background: var(--card); }
.links a:hover { border-color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-bottom: 16px; }
.stats > div { padding: 12px 14px; border-right: 1px solid var(--line2); }
.stats > div:last-child { border-right: 0; }
.stats > div > span { display: block; font-size: 12px; color: var(--mute); }
.stats b { font: 700 17px var(--mono); letter-spacing: -.02em; }
.cgrid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; }
.chart { width: 100%; height: 470px; border: 0; display: block; background: #fff; }
.side { display: grid; gap: 16px; }
.rcard { padding: 14px; border-bottom: 1px solid var(--line2); display: grid; gap: 10px; }
.rcard:last-child { border-bottom: 0; }
.rcard .top-l { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.rcard .top-l .pill { margin-left: auto; }
.rcard .bars .bar { grid-template-columns: 54px 1fr 64px; }
.rcard .bars .bar .num { text-align: right; }
.tf { display: flex; gap: 4px; }
.pools { width: 100%; border-collapse: collapse; font-size: 13px; }
.pools th { text-align: left; font-weight: 500; color: var(--mute); font-size: 11px; padding: 7px 14px; background: #fbf8f1; }
.pools td { padding: 8px 14px; border-top: 1px solid var(--line2); }
.pools td.r, .pools th.r { text-align: right; }
.pools a { text-decoration: none; border-bottom: 1px solid var(--line); }

/* ride card */
.card-out { padding: 14px; display: grid; gap: 10px; }
.card-out canvas { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 18px; padding: 7px 14px; font-weight: 700; font-size: 13px; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--ink); }
.btn:hover { background: var(--orange); border-color: var(--orange); color: #fff; }

/* about */
.prose { max-width: 760px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 20px 16px; }
.prose h1 { font-size: 23px; letter-spacing: -.02em; }
.prose h3 { margin: 22px 0 4px; font-size: 16px; }
.prose p { margin: 0 0 8px; }
.prose code { font: 500 13px var(--mono); background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }

/* foot */
.foot { background: var(--ink); color: #b9bed2; font-size: 13px; }
.foot-in { max-width: 1240px; margin: 0 auto; padding: 16px; display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.foot-in span:nth-child(2) { flex: 1; min-width: 240px; max-width: 640px; }
.foot a { color: #fff; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 16px;
  border-radius: 18px; font-size: 13px; z-index: 50; pointer-events: none;
}

@media (max-width: 1100px) {
  .rides { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats > div:nth-child(3) { border-right: 0; }
  .stats > div:nth-child(-n+3) { border-bottom: 1px solid var(--line2); }
}
@media (max-width: 860px) {
  .split, .cgrid { grid-template-columns: 1fr; }
  .stocks { max-height: none; }
  .split .detail { display: none; }
  .chart { height: 380px; }
  .nav a { padding: 6px 8px; }
}
@media (max-width: 640px) {
  .top-in { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .rides { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crow { grid-template-columns: 22px 34px minmax(0, 1fr) 78px 80px; }
  .crow .hide-s { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div { border-right: 0; border-bottom: 1px solid var(--line2); }
  .shead .moves { margin-left: 0; width: 100%; justify-content: space-between; text-align: left; }
}
[hidden] { display: none !important; }
@media (max-width: 860px) {
  .split.has-sel .list { display: none; }
  .split.has-sel .detail { display: block; }
}
.plate {
  display: inline-grid; place-items: center; width: 52px; height: 26px; flex: none;
  background: #fffdf8; border: 2px solid var(--ink); border-radius: 5px;
  font: 700 12px/1 var(--mono); letter-spacing: .02em; color: var(--ink);
  box-shadow: inset 0 0 0 2px #fffdf8, inset 0 0 0 3px var(--line);
}
.plate.long { font-size: 10px; }
.shead .plate { width: 64px; height: 32px; font-size: 14px; }
.shead .plate.long { font-size: 12px; }
.srow { grid-template-columns: 52px minmax(0, 1fr) auto 64px; }
.qres .plate { width: 46px; height: 22px; font-size: 11px; }
.stats b .num, .shead .moves b .num { font: inherit; }
@media (max-width: 860px) { .hide-m { display: none !important; } }
@media (max-width: 640px) {
  .crow { grid-template-columns: 22px 34px minmax(0, 1fr) 66px 104px; gap: 8px; }
  .crow .hide-s, .sec-h .hide-s { display: none; }
}

/* live */
.vs.mv { color: var(--ink); }
.vs.mv span { white-space: nowrap; }
.crow, .ride { position: relative; }
.tick-buy { animation: tickb 1s ease-out; }
.tick-sell { animation: ticks 1s ease-out; }
@keyframes tickb { 0% { background-color: #c9f0dc; } 100% { background-color: var(--card); } }
@keyframes ticks { 0% { background-color: #fbd5d0; } 100% { background-color: var(--card); } }
.ride.tick-buy, .ride.tick-sell { animation-duration: 1.2s; }
.pop {
  position: absolute; right: 0; top: -6px; font: 700 11px var(--mono); padding: 1px 6px; border-radius: 9px; white-space: nowrap;
  animation: popup 1.6s ease-out forwards; pointer-events: none; z-index: 2;
}
.pop.buy { background: var(--up); color: #fff; } .pop.sell { background: var(--down); color: #fff; }
.ride .pop { right: 10px; top: 8px; }
@keyframes popup { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: translateY(0); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; margin-right: 6px; vertical-align: 1px; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.trades { max-height: 420px; overflow: auto; }
.trow { display: grid; grid-template-columns: 52px 1fr 1fr 1.1fr 44px; gap: 8px; padding: 7px 14px; border-top: 1px solid var(--line2); font-size: 13px; text-decoration: none; align-items: center; }
.trow.head { font-size: 11px; color: var(--mute); background: #fbf8f1; border-top: 0; position: sticky; top: 0; }
.trow .side { font-weight: 800; }
.trow.buy .side { color: var(--up); } .trow.sell .side { color: var(--down); } .trow.swap .side { color: var(--mute); }
.trow .ago { text-align: right; }
.trow.fresh.buy { animation: tickb 1.4s ease-out; } .trow.fresh.sell { animation: ticks 1.4s ease-out; }
.trow:hover { background: #fbf6ec; }
@media (prefers-reduced-motion: reduce) { .tick-buy, .tick-sell, .pop, .dot, .trow.fresh { animation: none !important; } }
