/* Trench Terminal — amber phosphor, 1990s trading-desk terminal.
   One family (VT323, a DEC VT320 revival), one colour of light, inverse
   video for anything selected. Structure is drawn with rules and title
   bars the way a character-cell screen would, not with cards. */

@font-face {
  font-family: "VT323";
  src: url("fonts/vt323.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --bg:     #000000;
  --amb:    #ffb000;   /* primary phosphor */
  --amb-2:  #c48700;   /* secondary text */
  --amb-3:  #6b4a00;   /* rules, empty blocks */
  --amb-4:  #231700;   /* hover wash */
  --hi:     #fff0c2;   /* emphasis */
  --up:     #5cff84;
  --dn:     #ff5241;
  --key:    #ffd21f;   /* function-key caps */
  --go:     #3ecf5c;
  --cy:     #72e4ff;

  --glow: 0 0 1px rgba(255, 176, 0, 0.9), 0 0 6px rgba(255, 150, 0, 0.35);
  --font: "VT323", "Lucida Console", "Courier New", monospace;
  --cell: 0.2rem 0.55rem;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--amb);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.15;
  text-shadow: var(--glow);
  font-variant-numeric: tabular-nums;
}

/* ---------- the tube ---------- */

.crt {
  min-height: 100vh;
  padding: 0.6rem 0.9rem 4.5rem;
  position: relative;
}

/* scanlines and a soft vignette, above everything, never in the way */
.crt::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
 
}

::selection { background: var(--amb); color: var(--bg); text-shadow: none; }

a { color: var(--cy); text-shadow: 0 0 5px rgba(114, 228, 255, 0.35); }
a:hover { color: var(--hi); }

:focus-visible { outline: 2px solid var(--cy); outline-offset: 1px; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-shadow: inherit;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 1.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--amb);
}

.brand {
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--bg);
  background: var(--amb);
  padding: 0.05rem 0.5rem 0;
  text-shadow: none;
  box-shadow: 0 0 14px rgba(255, 160, 0, 0.45);
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.1rem;
  margin: 0;
}
.status div { display: flex; gap: 0.35rem; }
.status dt { color: var(--amb-2); }
.status dd { margin: 0; color: var(--hi); }
.status dd.stale { color: var(--dn); }

/* ---------- command line: the one thing you type into ---------- */

.cmdline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.45rem 0 0.55rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--amb-3);
}
.cmdline label { color: var(--hi); font-size: 1.25rem; }
.cmdline input {
  flex: 1 1 12rem;
  min-width: 6rem;
  background: transparent;
  border: 0;
  color: var(--hi);
  font: inherit;
  font-size: 1.25rem;
  text-transform: uppercase;
  text-shadow: var(--glow);
  caret-color: var(--amb);
  padding: 0.1rem 0;
}
.cmdline input::placeholder { color: var(--amb-3); text-shadow: none; }
.cmdline input:focus { outline: none; }
.cmdline:focus-within { border-color: var(--amb); }

.go {
  background: var(--go);
  color: var(--bg);
  text-shadow: none;
  padding: 0.05rem 0.7rem;
  font-size: 1.1rem;
}
.cmdmsg { color: var(--amb-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.cmdmsg.err { color: var(--dn); }

.notice {
  margin: 0 0 0.55rem;
  padding: 0.2rem 0.5rem;
  color: var(--bg);
  background: var(--dn);
  text-shadow: none;
}

/* ---------- panels: a title bar in inverse video, a single rule ---------- */

.panel {
  border: 1px solid var(--amb-3);
  margin-bottom: 0.7rem;
  min-width: 0;
}

.panel > h2 {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1rem;
  margin: 0;
  padding: 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--bg);
  background: var(--amb);
  text-shadow: none;
}
.h-sub { opacity: 0.8; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 0 0.7rem;
}

.statline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.4rem;
  padding: 0.3rem 0.55rem;
  border-bottom: 1px solid var(--amb-3);
}
.statline span { white-space: nowrap; }
.statline b { font-weight: 400; color: var(--amb-2); margin-right: 0.35rem; }

.scroll { overflow-x: auto; }

.empty {
  margin: 0;
  padding: 1rem 0.6rem;
  color: var(--amb-2);
  max-width: 60ch;
}

/* ---------- tables ---------- */

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 19px;
}

.grid th {
  padding: var(--cell);
  color: var(--amb-2);
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--amb-3);
}
.grid th[title] { text-decoration: underline dotted var(--amb-3); text-underline-offset: 3px; }
.grid th[data-sort] { cursor: pointer; }
.grid th[aria-sort] { color: var(--hi); }
.grid th[aria-sort="descending"]::after { content: " v"; }
.grid th[aria-sort="ascending"]::after { content: " ^"; }

.grid td {
  padding: var(--cell);
  white-space: nowrap;
  vertical-align: middle;
}

.grid .n { text-align: right; }

.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--amb-4); }

/* inverse video for the cursor row: everything inside goes black on amber */
.grid tbody tr.sel td { background: var(--amb); }
.grid tbody tr.sel td,
.grid tbody tr.sel td * { color: var(--bg) !important; text-shadow: none; }
.grid tbody tr.sel .blk { background: var(--bg) !important; opacity: 1; }
.grid tbody tr.sel .blk.exit { opacity: 0.35; }

.grid tr.detail td {
  white-space: normal;
  padding: 0.25rem 0.55rem 0.5rem 2.2rem;
  border-bottom: 1px solid var(--amb-3);
  cursor: default;
}
.grid tr.detail:hover td { background: transparent; }

tr.fresh-row td { animation: flash 1.4s steps(4, end); }
@keyframes flash {
  from { background: var(--amb-3); }
  to   { background: transparent; }
}

.up   { color: var(--up); text-shadow: 0 0 5px rgba(92, 255, 132, 0.35); }
.dn   { color: var(--dn); text-shadow: 0 0 5px rgba(255, 82, 65, 0.35); }
.dim  { color: var(--amb-2); }
.hi   { color: var(--hi); }
.faint { color: var(--amb-3); text-shadow: none; }

.sym { color: var(--hi); }
.tname { color: var(--amb-2); margin-left: 0.4rem; }

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.3rem;
  line-height: 1.05;
  color: var(--bg);
  background: var(--amb-2);
  text-shadow: none;
}
.tag.new  { background: var(--up); }
.tag.warn { background: var(--dn); }
.tag.info { background: var(--cy); }

.flags { letter-spacing: 0.15em; }
.flags .f-C, .flags .f-D { color: var(--dn); }
.flags .f-L { color: var(--key); }
.flags .f-N { color: var(--cy); }

/* one block per wallet in the IN column */
.blocks { display: inline-flex; gap: 2px; vertical-align: middle; }
.blk {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--amb);
}
.blk.fresh { background: var(--up); box-shadow: 0 0 4px rgba(92, 255, 132, 0.6); }
.blk.exit  { background: var(--amb-3); }
.blk.more  { width: auto; height: auto; background: none; color: var(--amb-2); }

canvas.spark { display: block; width: 84px; height: 20px; image-rendering: pixelated; }

/* buyer chips under the cursor row */
.who { display: flex; flex-wrap: wrap; gap: 0.15rem 1.1rem; }
.who span { white-space: nowrap; }

/* ---------- charts ---------- */

.chartbox {
  position: relative;
  border-bottom: 1px solid var(--amb-3);
}
.chartbox canvas {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}
.chart-flow-mini canvas { height: 84px; }
.chart-flow canvas { height: 260px; }
.chart-coin canvas { height: 280px; }

.chart-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 16px;
}
.chart-labels span {
  position: absolute;
  color: var(--amb-2);
  white-space: nowrap;
  background: var(--bg);
  padding: 0 0.2rem;
}
.readout {
  position: absolute;
  top: 0.2rem;
  right: 0.5rem;
  color: var(--hi);
  background: var(--bg);
  padding: 0 0.3rem;
  pointer-events: none;
}

/* ---------- coin screen ---------- */

.coin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 1rem;
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid var(--amb-3);
}
.coin-head .big { font-size: 2rem; line-height: 1; color: var(--hi); }
.coin-head .links { display: flex; gap: 0.8rem; margin-left: auto; }

.warnline {
  margin: 0;
  padding: 0.2rem 0.55rem;
  color: var(--bg);
  background: var(--dn);
  text-shadow: none;
}

.kvgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  border-bottom: 1px solid var(--amb-3);
}
.kvgrid div {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.15rem 0.55rem;
  border-right: 1px dotted var(--amb-3);
  border-bottom: 1px dotted var(--amb-3);
}
.kvgrid dt { color: var(--amb-2); }
.kvgrid dd { margin: 0; color: var(--hi); text-align: right; }

.picker { padding: 0.4rem 0.55rem; }

.subhead {
  margin: 0;
  padding: 0.2rem 0.55rem;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--amb-2);
  border-bottom: 1px solid var(--amb-3);
  border-top: 1px solid var(--amb-3);
}

/* ---------- clusters heatmap ---------- */

.heat {
  display: grid;
  gap: 1px;
  padding: 0.5rem 0.55rem;
  font-size: 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--amb-3);
}
.heat .hl { color: var(--amb-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9rem; padding-right: 0.3rem; }
.heat .hc {
  min-width: 1.5rem;
  height: 1.3rem;
  text-align: center;
  color: var(--bg);
  text-shadow: none;
  background: var(--amb);
}
.heat .hc.self { background: none; color: var(--amb-3); }
.heat .top { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 7rem; padding: 0 0 0.2rem; }

/* ---------- help ---------- */

.help-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 0 2rem;
  padding: 0.2rem 0.6rem 0.8rem;
}
.help h3 { margin: 0.8rem 0 0.3rem; font-size: 1.2rem; font-weight: 400; color: var(--hi); }
.help p { margin: 0 0 0.6rem; max-width: 62ch; }
.kv { border-collapse: collapse; }
.kv th { text-align: left; font-weight: 400; color: var(--hi); padding: 0.05rem 1.2rem 0.05rem 0; white-space: nowrap; vertical-align: top; }
.kv td { padding: 0.05rem 0; }

/* ---------- function-key bar ---------- */

.fkeys {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.4rem 0.9rem;
  background: var(--bg);
  border-top: 2px solid var(--amb);
}
.keys, .windows { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.keys button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.05rem 0.55rem 0.05rem 0;
  color: var(--bg);
  background: var(--key);
  text-shadow: none;
  font-size: 1.1rem;
}
.keys kbd {
  font: inherit;
  padding: 0 0.4rem;
  background: var(--bg);
  color: var(--key);
}
.keys button[aria-current="page"] {
  background: var(--hi);
  box-shadow: 0 0 10px rgba(255, 210, 31, 0.6);
}

.windows button {
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--amb-2);
  font-size: 1.1rem;
}
.windows button[aria-checked="true"] {
  background: var(--amb);
  color: var(--bg);
  border-color: var(--amb);
  text-shadow: none;
}

/* ---------- boot ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 2rem;
  background: var(--bg);
  color: var(--amb);
  font-size: 22px;
  white-space: pre-wrap;
}
.boot.off { opacity: 0; transition: opacity 0.25s steps(3, end); }

.cursor-blink::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.1em;
  vertical-align: -0.12em;
  background: var(--amb);
  animation: blink 1s steps(1, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- narrow screens ---------- */

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 18px; }
  .grid { font-size: 17px; }
  .crt { padding: 0.4rem 0.4rem 6.5rem; }
  .brand { font-size: 1.6rem; }
  .hide-s { display: none; }
  .cmdmsg { display: none; }
  .chart-flow canvas { height: 200px; }
  .chart-coin canvas { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  tr.fresh-row td { animation: none; }
  .cursor-blink::after { animation: none; }
  .boot.off { transition: none; }
}
/* Trench Terminal — amber phosphor, 1990s trading-desk terminal.
   One family (VT323, a DEC VT320 revival), one colour of light, inverse
   video for anything selected. Structure is drawn with rules and title
   bars the way a character-cell screen would, not with cards. */

@font-face {
  font-family: "VT323";
  src: url("fonts/vt323.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --bg:     #000000;
  --amb:    #ffb000;   /* primary phosphor */
  --amb-2:  #c48700;   /* secondary text */
  --amb-3:  #6b4a00;   /* rules, empty blocks */
  --amb-4:  #231700;   /* hover wash */
  --hi:     #fff0c2;   /* emphasis */
  --up:     #5cff84;
  --dn:     #ff5241;
  --key:    #ffd21f;   /* function-key caps */
  --go:     #3ecf5c;
  --cy:     #72e4ff;

  --glow: 0 0 1px rgba(255, 176, 0, 0.9), 0 0 6px rgba(255, 150, 0, 0.35);
  --font: "VT323", "Lucida Console", "Courier New", monospace;
  --cell: 0.2rem 0.55rem;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--amb);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.15;
  text-shadow: var(--glow);
  font-variant-numeric: tabular-nums;
}

/* ---------- the tube ---------- */

.crt {
  min-height: 100vh;
  padding: 0.6rem 0.9rem 4.5rem;
  position: relative;
}

/* scanlines and a soft vignette, above everything, never in the way */
.crt::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
 
}

::selection { background: var(--amb); color: var(--bg); text-shadow: none; }

a { color: var(--cy); text-shadow: 0 0 5px rgba(114, 228, 255, 0.35); }
a:hover { color: var(--hi); }

:focus-visible { outline: 2px solid var(--cy); outline-offset: 1px; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-shadow: inherit;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 1.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--amb);
}

.brand {
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--bg);
  background: var(--amb);
  padding: 0.05rem 0.5rem 0;
  text-shadow: none;
  box-shadow: 0 0 14px rgba(255, 160, 0, 0.45);
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.1rem;
  margin: 0;
}
.status div { display: flex; gap: 0.35rem; }
.status dt { color: var(--amb-2); }
.status dd { margin: 0; color: var(--hi); }
.status dd.stale { color: var(--dn); }

/* ---------- command line: the one thing you type into ---------- */

.cmdline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.45rem 0 0.55rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--amb-3);
}
.cmdline label { color: var(--hi); font-size: 1.25rem; }
.cmdline input {
  flex: 1 1 12rem;
  min-width: 6rem;
  background: transparent;
  border: 0;
  color: var(--hi);
  font: inherit;
  font-size: 1.25rem;
  text-transform: uppercase;
  text-shadow: var(--glow);
  caret-color: var(--amb);
  padding: 0.1rem 0;
}
.cmdline input::placeholder { color: var(--amb-3); text-shadow: none; }
.cmdline input:focus { outline: none; }
.cmdline:focus-within { border-color: var(--amb); }

.go {
  background: var(--go);
  color: var(--bg);
  text-shadow: none;
  padding: 0.05rem 0.7rem;
  font-size: 1.1rem;
}
.cmdmsg { color: var(--amb-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.cmdmsg.err { color: var(--dn); }

.notice {
  margin: 0 0 0.55rem;
  padding: 0.2rem 0.5rem;
  color: var(--bg);
  background: var(--dn);
  text-shadow: none;
}

/* ---------- panels: a title bar in inverse video, a single rule ---------- */

.panel {
  border: 1px solid var(--amb-3);
  margin-bottom: 0.7rem;
  min-width: 0;
}

.panel > h2 {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1rem;
  margin: 0;
  padding: 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--bg);
  background: var(--amb);
  text-shadow: none;
}
.h-sub { opacity: 0.8; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 0 0.7rem;
}

.statline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.4rem;
  padding: 0.3rem 0.55rem;
  border-bottom: 1px solid var(--amb-3);
}
.statline span { white-space: nowrap; }
.statline b { font-weight: 400; color: var(--amb-2); margin-right: 0.35rem; }

.scroll { overflow-x: auto; }

.empty {
  margin: 0;
  padding: 1rem 0.6rem;
  color: var(--amb-2);
  max-width: 60ch;
}

/* ---------- tables ---------- */

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 19px;
}

.grid th {
  padding: var(--cell);
  color: var(--amb-2);
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--amb-3);
}
.grid th[title] { text-decoration: underline dotted var(--amb-3); text-underline-offset: 3px; }
.grid th[data-sort] { cursor: pointer; }
.grid th[aria-sort] { color: var(--hi); }
.grid th[aria-sort="descending"]::after { content: " v"; }
.grid th[aria-sort="ascending"]::after { content: " ^"; }

.grid td {
  padding: var(--cell);
  white-space: nowrap;
  vertical-align: middle;
}

.grid .n { text-align: right; }

.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--amb-4); }

/* inverse video for the cursor row: everything inside goes black on amber */
.grid tbody tr.sel td { background: var(--amb); }
.grid tbody tr.sel td,
.grid tbody tr.sel td * { color: var(--bg) !important; text-shadow: none; }
.grid tbody tr.sel .blk { background: var(--bg) !important; opacity: 1; }
.grid tbody tr.sel .blk.exit { opacity: 0.35; }

.grid tr.detail td {
  white-space: normal;
  padding: 0.25rem 0.55rem 0.5rem 2.2rem;
  border-bottom: 1px solid var(--amb-3);
  cursor: default;
}
.grid tr.detail:hover td { background: transparent; }

tr.fresh-row td { animation: flash 1.4s steps(4, end); }
@keyframes flash {
  from { background: var(--amb-3); }
  to   { background: transparent; }
}

.up   { color: var(--up); text-shadow: 0 0 5px rgba(92, 255, 132, 0.35); }
.dn   { color: var(--dn); text-shadow: 0 0 5px rgba(255, 82, 65, 0.35); }
.dim  { color: var(--amb-2); }
.hi   { color: var(--hi); }
.faint { color: var(--amb-3); text-shadow: none; }

.sym { color: var(--hi); }
.tname { color: var(--amb-2); margin-left: 0.4rem; }

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.3rem;
  line-height: 1.05;
  color: var(--bg);
  background: var(--amb-2);
  text-shadow: none;
}
.tag.new  { background: var(--up); }
.tag.warn { background: var(--dn); }
.tag.info { background: var(--cy); }

.flags { letter-spacing: 0.15em; }
.flags .f-C, .flags .f-D { color: var(--dn); }
.flags .f-L { color: var(--key); }
.flags .f-N { color: var(--cy); }

/* one block per wallet in the IN column */
.blocks { display: inline-flex; gap: 2px; vertical-align: middle; }
.blk {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--amb);
}
.blk.fresh { background: var(--up); box-shadow: 0 0 4px rgba(92, 255, 132, 0.6); }
.blk.exit  { background: var(--amb-3); }
.blk.more  { width: auto; height: auto; background: none; color: var(--amb-2); }

canvas.spark { display: block; width: 84px; height: 20px; image-rendering: pixelated; }

/* buyer chips under the cursor row */
.who { display: flex; flex-wrap: wrap; gap: 0.15rem 1.1rem; }
.who span { white-space: nowrap; }

/* ---------- charts ---------- */

.chartbox {
  position: relative;
  border-bottom: 1px solid var(--amb-3);
}
.chartbox canvas {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}
.chart-flow-mini canvas { height: 84px; }
.chart-flow canvas { height: 260px; }
.chart-coin canvas { height: 280px; }

.chart-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 16px;
}
.chart-labels span {
  position: absolute;
  color: var(--amb-2);
  white-space: nowrap;
  background: var(--bg);
  padding: 0 0.2rem;
}
.readout {
  position: absolute;
  top: 0.2rem;
  right: 0.5rem;
  color: var(--hi);
  background: var(--bg);
  padding: 0 0.3rem;
  pointer-events: none;
}

/* ---------- coin screen ---------- */

.coin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 1rem;
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid var(--amb-3);
}
.coin-head .big { font-size: 2rem; line-height: 1; color: var(--hi); }
.coin-head .links { display: flex; gap: 0.8rem; margin-left: auto; }

.warnline {
  margin: 0;
  padding: 0.2rem 0.55rem;
  color: var(--bg);
  background: var(--dn);
  text-shadow: none;
}

.kvgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  border-bottom: 1px solid var(--amb-3);
}
.kvgrid div {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.15rem 0.55rem;
  border-right: 1px dotted var(--amb-3);
  border-bottom: 1px dotted var(--amb-3);
}
.kvgrid dt { color: var(--amb-2); }
.kvgrid dd { margin: 0; color: var(--hi); text-align: right; }

.picker { padding: 0.4rem 0.55rem; }

.subhead {
  margin: 0;
  padding: 0.2rem 0.55rem;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--amb-2);
  border-bottom: 1px solid var(--amb-3);
  border-top: 1px solid var(--amb-3);
}

/* ---------- clusters heatmap ---------- */

.heat {
  display: grid;
  gap: 1px;
  padding: 0.5rem 0.55rem;
  font-size: 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--amb-3);
}
.heat .hl { color: var(--amb-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9rem; padding-right: 0.3rem; }
.heat .hc {
  min-width: 1.5rem;
  height: 1.3rem;
  text-align: center;
  color: var(--bg);
  text-shadow: none;
  background: var(--amb);
}
.heat .hc.self { background: none; color: var(--amb-3); }
.heat .top { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 7rem; padding: 0 0 0.2rem; }

/* ---------- help ---------- */

.help-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 0 2rem;
  padding: 0.2rem 0.6rem 0.8rem;
}
.help h3 { margin: 0.8rem 0 0.3rem; font-size: 1.2rem; font-weight: 400; color: var(--hi); }
.help p { margin: 0 0 0.6rem; max-width: 62ch; }
.kv { border-collapse: collapse; }
.kv th { text-align: left; font-weight: 400; color: var(--hi); padding: 0.05rem 1.2rem 0.05rem 0; white-space: nowrap; vertical-align: top; }
.kv td { padding: 0.05rem 0; }

/* ---------- function-key bar ---------- */

.fkeys {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.4rem 0.9rem;
  background: var(--bg);
  border-top: 2px solid var(--amb);
}
.keys, .windows { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.keys button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.05rem 0.55rem 0.05rem 0;
  color: var(--bg);
  background: var(--key);
  text-shadow: none;
  font-size: 1.1rem;
}
.keys kbd {
  font: inherit;
  padding: 0 0.4rem;
  background: var(--bg);
  color: var(--key);
}
.keys button[aria-current="page"] {
  background: var(--hi);
  box-shadow: 0 0 10px rgba(255, 210, 31, 0.6);
}

.windows button {
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--amb-2);
  font-size: 1.1rem;
}
.windows button[aria-checked="true"] {
  background: var(--amb);
  color: var(--bg);
  border-color: var(--amb);
  text-shadow: none;
}

/* ---------- boot ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 2rem;
  background: var(--bg);
  color: var(--amb);
  font-size: 22px;
  white-space: pre-wrap;
}
.boot.off { opacity: 0; transition: opacity 0.25s steps(3, end); }

.cursor-blink::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.1em;
  vertical-align: -0.12em;
  background: var(--amb);
  animation: blink 1s steps(1, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- narrow screens ---------- */

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 18px; }
  .grid { font-size: 17px; }
  .crt { padding: 0.4rem 0.4rem 6.5rem; }
  .brand { font-size: 1.6rem; }
  .hide-s { display: none; }
  .cmdmsg { display: none; }
  .chart-flow canvas { height: 200px; }
  .chart-coin canvas { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  tr.fresh-row td { animation: none; }
  .cursor-blink::after { animation: none; }
  .boot.off { transition: none; }
}
