@font-face { font-family: "Plex Mono"; src: url("/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/fonts/plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/fonts/plex-mono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* black, white dots, nothing else */
:root {
  --bg: #000;
  --panel: rgba(6, 6, 6, 0.94);
  --line: rgba(255, 255, 255, 0.14);
  --line-2: rgba(255, 255, 255, 0.34);
  --ink: #f3f3f3;
  --ink-2: #a9a9a9;
  --ink-3: #6a6a6a;
  /* names used by the page script (hearts, brain graph) */
  --paper: #000;
  --paper-2: #0d0d0d;
  --paper-3: #1a1a1a;
  --rule: rgba(255, 255, 255, 0.12);
  --rim: #f3f3f3;
  --rim-2: #d9d9d9;
  --rim-dim: #4d4d4d;
  --heart: #ffffff;
  --heart-dim: #141414;
  --mono: "Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --dots: radial-gradient(circle, #fff 1.15px, transparent 1.5px);
  --dots-dim: radial-gradient(circle, #343434 1.15px, transparent 1.5px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 12px/1.5 var(--mono);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1.3px);
  background-size: 18px 18px;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
b { font-weight: 600; color: #fff; }
button { font: inherit; color: inherit; }
::selection { background: #fff; color: #000; }

/* ───────── chips & bars ───────── */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 8px;
}
.nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: #000;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 7px 12px 6px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { border-color: #fff; text-decoration: none; }
.chip.brand { background: #fff; color: #000; border-color: #fff; font-weight: 600; font-size: 12px; letter-spacing: 0.04em; text-transform: none; display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px 5px 9px; }
.chip.brand img { width: 18px; height: 18px; display: block; }
.chip.ca { letter-spacing: 0.04em; text-transform: none; }
.chip.ca .lbl { text-transform: uppercase; color: var(--ink-3); letter-spacing: 0.16em; }
.chip.ca #ca-text { font: 500 11px/1 var(--mono); letter-spacing: 0; text-transform: none; }
.chip.buy { background: #fff; color: #000; border-color: #fff; }
.chip.buy:hover { background: #000; color: #fff; }

.bar {
  display: flex;
  background: #000;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  overflow: hidden;
}
.bar > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 16px 6px;
  border-left: 1px solid var(--line);
  min-width: 96px;
}
.bar > div:first-child { border-left: 0; }
.bar span { font: 500 8.5px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); }
.bar b { font: 500 12.5px/1.1 var(--mono); color: #fff; white-space: nowrap; }

.live { justify-self: end; display: flex; align-items: center; gap: 8px; font: 500 9.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.live.on i { background: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.7); animation: pulse 2s infinite; }
.live.sim i { background: #fff; animation: pulse 0.6s infinite; }
.live.dead i { background: transparent; border: 1px solid var(--ink-3); }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ───────── layout ───────── */
.tank {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr) 338px;
  gap: 14px;
  padding: 6px 16px 14px;
}
.col { overflow-y: auto; min-height: 0; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.col::-webkit-scrollbar { width: 5px; }
.col::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ───────── panels ───────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 0 0 10px;
  overflow: hidden;
}
.panel > h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font: 500 9.5px/1 var(--mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 9px 11px 8px;
  border-bottom: 1px dashed var(--line);
}
.panel > h2::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px rgba(255, 255, 255, 0.6); }
.bd { padding: 9px 11px 10px; }
.bd.tight { padding: 4px 6px 6px; }
.prose p { margin: 0 0 8px; color: var(--ink-2); }
.prose p:last-child { margin: 0; }
.code pre { margin: 0; font: 400 10px/1.6 var(--mono); color: var(--ink-2); white-space: pre-wrap; }
.small { font-size: 10.5px; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.note { margin: 0 0 9px; color: var(--ink-2); font-size: 11px; }

.kvs { display: flex; flex-direction: column; gap: 1px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; border-bottom: 1px dotted var(--rule); }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { color: var(--ink-2); }
.kv > :last-child { text-align: right; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv .good { color: #fff; }
.kv .warn { color: var(--ink-2); }
.kv .bad { color: #fff; text-decoration: underline dashed var(--ink-2); text-underline-offset: 3px; }

table { width: 100%; border-collapse: collapse; }
th { font: 500 8px/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
td { padding: 3px 4px; border-bottom: 1px dotted var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.rules td:last-child, .rules th:last-child { text-align: right; color: #fff; }
.rules td:first-child { color: var(--ink-2); }
.txns { font-size: 10.5px; }
.txns td:nth-child(2), .txns td:nth-child(3) { text-align: right; white-space: nowrap; }
.txns th:nth-child(2), .txns th:nth-child(3) { text-align: right; }
.txns td:nth-child(4) a { text-decoration: none; color: var(--ink-2); }
.txns td:nth-child(4) a:hover { color: #fff; }
.txns td:nth-child(5) { color: var(--ink-3); font-size: 9.5px; max-width: 82px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txns tr.new td { animation: rowin 1.6s ease-out; }
@keyframes rowin { from { background: rgba(255, 255, 255, 0.14); } to { background: transparent; } }
.side { font: 500 8px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 5px 2px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); display: inline-block; }
.side.buy { background: #fff; border-color: #fff; color: #000; }
.side.sell { border-color: #fff; color: #fff; }
.side.burn { border: 1px dashed #fff; color: #fff; }
.side.birth { background: #fff; color: #000; border-color: #fff; }

/* organs: dot meters */
.organ { margin: 0 0 9px; }
.organ:last-child { margin: 0; }
.organ .row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.organ .name { font-weight: 500; }
.organ .val { color: var(--ink-2); font-size: 10.5px; }
.organ.hot .name::after { content: " · hostile"; color: var(--ink-2); font-weight: 400; }
.organ.dead .name { text-decoration: line-through; color: var(--ink-3); }
.meter { height: 10px; margin: 4px 0 3px; background-image: var(--dots-dim); background-size: 5px 5px; position: relative; overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; background-image: var(--dots); background-size: 5px 5px; transition: width 0.6s; }
.organ.hot .meter > i { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.sense { height: 5px; position: relative; border-top: 1px solid var(--line); margin-top: 3px; }
.sense .band { position: absolute; top: -1px; bottom: 0; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.45) 0 1px, transparent 1px 3px); }
.sense .dot { position: absolute; top: -4px; width: 7px; height: 7px; margin-left: -3px; background: #fff; border-radius: 50%; transition: left 0.6s; }

/* immune */
.path { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; font-size: 10.5px; padding: 2px 0; border-bottom: 1px dotted var(--rule); }
.path .pbar { grid-column: 1 / -1; height: 5px; background-image: var(--dots-dim); background-size: 5px 5px; overflow: hidden; }
.path .pbar i { display: block; height: 100%; background-image: var(--dots); background-size: 5px 5px; }

/* brain */
.states { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 0 0 6px; }
.states span { font: 500 8.5px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 7px 3px; color: var(--ink-3); }
.states span.on { background: #fff; color: #000; border-color: #fff; }
.graph { width: 100%; height: auto; display: block; margin: 0 0 4px; }

/* genome: a dot matrix */
.genome .grid { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; margin: 2px 0 9px; }
.genome .grid i { display: block; aspect-ratio: 1; border-radius: 50%; }
.genome .grid i.mut { outline: 1px solid #fff; outline-offset: 1px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 10px; color: var(--ink-2); margin: 6px 0 3px; }
.legend i { width: 7px; height: 7px; display: inline-block; margin-right: -5px; border-radius: 50%; }
.g-band { background: #fff; } .g-coef { background: #bdbdbd; } .g-thr { background: #7c7c7c; } .g-res { background: #3d3d3d; }

/* memory */
.mem { display: grid; grid-template-columns: 1fr 58px 26px 26px 38px; gap: 4px; align-items: center; font-size: 10px; padding: 2px 0; border-bottom: 1px dotted var(--rule); }
.mem.head { font: 500 8px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.mem .trust { height: 6px; position: relative; background: linear-gradient(90deg, transparent calc(50% - 0.5px), var(--line-2) calc(50% - 0.5px), var(--line-2) calc(50% + 0.5px), transparent calc(50% + 0.5px)); }
.mem .trust i { position: absolute; top: 0; bottom: 0; }
.mem .trust i.p { left: 50%; background: #fff; }
.mem .trust i.n { right: 50%; background: repeating-linear-gradient(90deg, #fff 0 1px, transparent 1px 3px); }
.mem span:nth-child(n+3) { text-align: right; }

.laws { margin: 0 0 7px; padding: 0; list-style: none; color: var(--ink-2); }
.laws li { margin: 0 0 3px; padding-left: 13px; position: relative; }
.laws li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: #fff; }

/* heal */
.burnbox { display: flex; flex-direction: column; gap: 7px; margin: 0 0 7px; }
.burnrow { display: flex; gap: 5px; }
.burnrow input { flex: 1; min-width: 0; font: 500 12px var(--mono); padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 4px; background: #000; color: #fff; outline: none; }
.burnrow input:focus { border-color: #fff; }
.btn { font: 500 9.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; padding: 8px 12px 7px; border: 1px solid var(--line-2); border-radius: 999px; background: #000; color: #fff; cursor: pointer; }
.btn:hover { border-color: #fff; }
.btn.hot { background: #fff; border-color: #fff; color: #000; }
.btn.hot:hover { background: #000; color: #fff; }
.btn:disabled { opacity: 0.4; cursor: default; }
.copy { font: 500 10.5px var(--mono); background: none; border: 0; color: #fff; cursor: pointer; padding: 0; text-decoration: underline dotted var(--line-2); text-underline-offset: 3px; }

/* ───────── stage ───────── */
.stage { position: relative; min-height: 0; display: flex; flex-direction: column; align-items: center; background: radial-gradient(ellipse 60% 55% at 50% 50%, #000 55%, rgba(0, 0, 0, 0) 100%); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage #shark-still { position: absolute; top: 50%; left: 50%; width: min(80%, 620px); transform: translate(-50%, -50%); }
.hearts { position: relative; z-index: 2; display: flex; gap: 5px; margin: 6px 0 3px; }
.hearts svg { width: 20px; height: 18px; display: block; }
.hearts.beat { animation: thump 0.35s ease-out; }
@keyframes thump { 30% { transform: scale(1.08); } }
.hp { position: relative; z-index: 2; font: 500 9.5px/1 var(--mono); letter-spacing: 0.2em; color: var(--ink-2); text-transform: uppercase; }
.caption { position: absolute; z-index: 2; bottom: 66px; font: 500 9.5px/1 var(--mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-2); background: rgba(0, 0, 0, 0.75); padding: 6px 11px 5px; border-radius: 999px; border: 1px solid var(--line); }
.stage .bar.state { position: absolute; z-index: 2; bottom: 8px; }
.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.7s; }
.flash.sell { background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.07), transparent 60%); opacity: 1; transition: none; }
.flash.burn { background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.16), transparent 60%); opacity: 1; transition: none; }
.flash.buy { background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05), transparent 60%); opacity: 1; transition: none; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; background: #fff; color: #000; font: 500 10px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; padding: 10px 16px 9px; border-radius: 999px; }

/* docs */
.page { overflow: auto; display: block; }
.docs { max-width: 760px; margin: 0 auto; padding: 8px 16px 48px; }
.docs .panel .bd { font-size: 12.5px; line-height: 1.7; }
.docs p { margin: 0 0 10px; color: var(--ink-2); }
.docs code { background: #111; border: 1px solid var(--line); padding: 0 4px; border-radius: 3px; font-size: 11.5px; color: #fff; }
.docs table td, .docs table th { font-size: 11.5px; }
.docs .verify-out { white-space: pre-wrap; font-size: 11px; color: #fff; }

/* ───────── small screens ───────── */
@media (max-width: 1180px) {
  .tank { grid-template-columns: 290px minmax(0, 1fr) 300px; }
  .bar > div { min-width: 80px; padding: 6px 10px; }
}
@media (max-width: 960px) {
  body { overflow: auto; height: auto; }
  .top { grid-template-columns: 1fr; justify-items: center; gap: 9px; }
  .nav { justify-content: center; }
  .live { justify-self: center; }
  .tank { display: flex; flex-direction: column; padding: 4px 10px 16px; }
  .stage { order: 0; height: 56vh; min-height: 340px; margin-bottom: 8px; }
  .col { display: contents; }
  .panel { margin: 0 0 10px; }
  .o-beats { order: 1; } .o-organs { order: 2; } .o-immune { order: 3; } .o-heal { order: 4; }
  .o-vitals { order: 5; } .o-market { order: 6; } .o-flow { order: 7; } .o-brain { order: 8; }
  .o-about { order: 9; } .o-math { order: 10; } .o-rules { order: 11; } .o-genome { order: 12; }
  .o-memory { order: 13; } .o-addr { order: 14; } .o-keeper { order: 15; }
  .caption { bottom: 62px; }
}
@media (max-width: 520px) {
  .bar > div { min-width: 0; padding: 6px 8px; }
  .bar b { font-size: 11px; }
  .chip { font-size: 9px; padding: 6px 9px 5px; }
  .hearts svg { width: 17px; height: 15px; }
  .hearts { gap: 3px; }
}
