:root {
  --bg: #070707;
  --panel: #0e0e0e;
  --line: #1f1f1f;
  --fg: #c9c9c9;
  --dim: #6b6b6b;
  --faint: #3a3a3a;
  --red: #d13c2f;
  --buy: #6fbf73;
  --sell: #d1552f;
  --amber: #d6a33a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font: 13px/1.55 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  padding: 0 16px 48px;
  max-width: 1120px;
  margin: 0 auto;
}
a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--faint); }
a:hover { text-decoration-color: var(--fg); }
h2 { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 28px 0 10px; }
h2 .sub { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--faint); margin-left: 8px; }
p { max-width: 72ch; margin: 8px 0; }
table { border-collapse: collapse; width: 100%; }
td, th { padding: 3px 8px 3px 0; vertical-align: top; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 400; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
ul { list-style: none; margin: 0; padding: 0; }
code { color: var(--fg); background: var(--panel); padding: 0 4px; }

header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; padding: 22px 0 14px; border-bottom: 1px solid var(--line); }
.brand { font-size: 22px; font-weight: 700; letter-spacing: .2em; color: var(--red); }
.tag { color: var(--dim); }
.statusline { flex-basis: 100%; color: var(--dim); font-variant-numeric: tabular-nums; }
.statusline b { color: var(--fg); font-weight: 500; }
.links { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--dim); }
.links a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--faint); }
.links a:hover { border-bottom-color: var(--red); }
.links a.x::before { content: '𝕏 '; color: var(--dim); }
.demo-banner { margin: 12px 0 0; padding: 8px 10px; border: 1px dashed var(--amber); color: var(--amber); }
.hidden { display: none !important; }

main.stage { display: block; margin-top: 18px; }

.screen { position: relative; background: #000; border: 1px solid var(--line); aspect-ratio: 8 / 5; max-width: 100%; }
.screen canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .55s ease-out; }
.screen.flash-sell::after { box-shadow: inset 0 0 70px 22px rgba(224, 48, 32, .9); opacity: 1; transition: none; }
.screen.flash-buy::after { box-shadow: inset 0 0 70px 22px rgba(94, 227, 107, .75); opacity: 1; transition: none; }

/* call to action: the order book is the controller */
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.btn { font-family: 'Press Start 2P', ui-monospace, monospace; font-size: 12px; line-height: 1; padding: 14px 18px; text-decoration: none; border: 2px solid var(--red); color: var(--red); background: transparent; letter-spacing: .02em; box-shadow: 4px 4px 0 #000; }
.btn.buy { background: var(--red); color: #fff; }
.btn.buy:hover, .btn.buy:focus-visible { background: #e8483a; outline: none; }
.btn.sell:hover, .btn.sell:focus-visible { background: #1a0d0c; outline: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000; }
.cta .ca { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono, ui-monospace, monospace); font-size: 12px; color: var(--dim); min-width: 0; }
.cta .ca .k { letter-spacing: .12em; }
.cta .ca code { background: var(--panel); border: 1px solid var(--line); padding: 4px 8px; color: var(--fg); overflow-wrap: anywhere; min-width: 0; }
.cta .ca button { font: inherit; color: var(--fg); background: transparent; border: 1px solid var(--faint); padding: 4px 8px; cursor: pointer; }
.cta .ca button:hover { border-color: var(--fg); }
@media (max-width: 640px) { .btn { flex: 1 1 auto; text-align: center; padding: 14px 10px; font-size: 11px; } .cta .ca { display: flex; flex-basis: 100%; min-width: 0; } .cta .ca code { flex: 1 1 0; } }

/* hit feed: trades as damage numbers under the screen */
.hits { height: 60px; margin-top: 12px; display: flex; gap: 18px; align-items: center; overflow: hidden; white-space: nowrap; font-family: 'Press Start 2P', ui-monospace, Menlo, monospace; }
.hits:empty::before { content: 'no hits yet'; font: 12px/1 var(--mono, ui-monospace, monospace); color: var(--faint); letter-spacing: .1em; }
.hit { display: inline-block; line-height: 1; text-shadow: 2px 2px 0 #000; animation: hitpop .3s cubic-bezier(.2, 1.7, .4, 1) both, hitfade 14s linear .3s forwards; will-change: transform, opacity; }
.hit.buy { color: #5ee36b; }
.hit.sell { color: #ff3b2f; }
.hit.whale, .hit.leviathan { text-shadow: 2px 2px 0 #000, 0 0 14px currentColor; }
.hit .tier { display: block; font-size: 8px; color: var(--amber); margin-top: 7px; letter-spacing: .12em; text-shadow: 1px 1px 0 #000; }
@keyframes hitpop { from { transform: scale(2.4) translateY(12px); opacity: 0; } 60% { transform: scale(.9) translateY(-3px); opacity: 1; } to { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes hitfade { 0%, 65% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .hit { animation: none; } .screen::after { transition: none; } }

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--red); background: rgba(0,0,0,.72); letter-spacing: .2em; }
.plan { margin-top: 10px; color: var(--dim); }
.plan #plan-label { color: var(--fg); }
.bar { height: 3px; background: var(--line); margin-top: 6px; }
.bar > div { height: 100%; width: 0; background: var(--red); transition: width .2s linear; }
.held { margin-top: 8px; color: var(--dim); }
.held span { color: var(--fg); }
.key { display: inline-block; border: 1px solid var(--faint); padding: 0 5px; margin-right: 4px; color: var(--fg); }
.key.down { border-color: var(--fg); background: #161616; }

.planrow { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: end; }
.planrow .plan { flex: 1 1 360px; margin-top: 8px; }
.planrow .held { flex: 0 1 auto; margin-top: 8px; }

/* vitals: compact tiles that light up when a value changes */
.vitals h2 { margin-top: 26px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tile { background: var(--bg); padding: 8px 10px 9px; min-width: 0; }
.tile .k { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.tile b { display: block; font-weight: 500; font-size: 15px; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile b.alert { color: var(--red); }
.tile b.ok { color: var(--buy); }
.tick { animation: tick .7s ease-out; }
@keyframes tick { from { color: #fff; text-shadow: 0 0 10px rgba(255, 255, 255, .55); } }
@media (prefers-reduced-motion: reduce) { .tick { animation: none; } }

.feeds { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 4px; }
.feeds h2 { margin-top: 22px; }
@media (max-width: 760px) { .feeds { grid-template-columns: 1fr; } .feed li .tier { display: none; } .feed li .ts { flex-basis: 56px; } }
.feed { min-width: 0; }
.feed ul { border-top: 1px solid var(--line); max-height: 260px; overflow-y: auto; overflow-x: hidden; }
.feed li { padding: 3px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed li .ts { color: var(--faint); flex: 0 0 62px; }
.feed li .side { flex: 0 0 44px; font-weight: 600; }
.feed li .buy { color: var(--buy); }
.feed li .sell { color: var(--sell); }
.feed li .tier { color: var(--dim); flex: 0 0 82px; }
.feed li .usd { flex: 0 0 76px; text-align: right; font-variant-numeric: tabular-nums; }
.feed li .hash a { color: var(--dim); }
.feed li .down { color: var(--fg); }
.feed li .up { color: var(--faint); }
.feed li .cheat { color: var(--amber); }
.feed li .death { color: var(--red); }
.feed li .level { color: var(--buy); }
.feed li .note { color: var(--dim); }

.journal ul { border-top: 1px solid var(--line); }
.journal li { padding: 4px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.journal li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.journal li .ts { color: var(--faint); flex: 0 0 120px; }
.journal li .kind { color: var(--dim); flex: 0 0 64px; }
.journal li.death .kind { color: var(--red); }
.journal li.level .kind { color: var(--buy); }
.journal li.reflex .kind { color: var(--amber); }

.doc { border-top: 1px solid var(--line); margin-top: 28px; }
.doc table { max-width: 760px; }
.doc .scroll { overflow-x: auto; }
.doc td:first-child { white-space: nowrap; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; max-width: 760px; }
dt { color: var(--dim); }
dd { margin: 0; word-break: break-all; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } .doc td:first-child { white-space: normal; } }
footer { border-top: 1px solid var(--line); margin-top: 36px; padding-top: 14px; color: var(--dim); font-size: 12px; }
footer p { max-width: none; }
