/* ZecPy Live, data-terminal style (seed 617959318), face: the accent line in Zcash gold.

   Grid at 1440: canvas padding 32 + 32, content 1376 = 448 (scenes) + 24 + 904 (server view).
   At 1920: 1856 = 448 + 24 + 1384. The left column is fixed; the server view takes the rest.
   Right column: KPI strip of 4 equal cells split by 1px rules, then the memo batch, then
   the ledger, all on the column's edges. One gap (24) everywhere. */

:root {
  --ground: #171719;
  --surface: #131217;
  --raised: #212023;
  --border: #222224;
  --rule: #1b1a1f;
  --control: #3a3a3e;
  --text: #ffffff;
  --muted: #8a8c92;
  --accent: #f4b728;           /* Zcash gold: the only selection mark */
  --positive: #44a282;
  --negative: #e5566f;
  --warning: #d9a441;
  --pill-positive-bg: #1b2828; --pill-positive-ink: #5fc39c;
  --pill-negative-bg: #2c1a20; --pill-negative-ink: #e5566f;
  --pill-warning-bg: #2a2416;  --pill-warning-ink: #d9a441;
  --pill-neutral-bg: #212023;  --pill-neutral-ink: #bdbdc0;
  --shadow: 0 12px 28px rgba(0, 0, 0, .2);
  --radius-card: 6px;
  --radius-control: 999px;
  --gap: 24px;
  --pad: 32px;
  --control-height: 34px;
  --fs-title: 26px;
  --fs-section: 16px;
  --fs-kpi: 20px;
  --fs-lead: 32px;
  --fs-body: 13px;
  --fs-small: 12px;
  --font: "Public Sans", Inter, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--text);
  font: 400 var(--fs-body)/20px var(--font);
  -webkit-font-smoothing: antialiased;
}
.num { font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.bar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.mark { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: square; }
.brand-name { font-weight: 600; font-size: 15px; }
.scope { color: var(--muted); }
.conn { margin-left: auto; color: var(--muted); font-size: var(--fs-small); }
.conn.live::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--positive); margin-right: 8px; vertical-align: 1px;
}

.ghost {
  height: var(--control-height);
  padding: 0 14px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.ghost:hover:not(:disabled) { border-color: #5a5a60; }
.ghost:active:not(:disabled) { transform: translateY(1px); }
.ghost:disabled { color: var(--muted); cursor: default; }
.primary {
  height: var(--control-height);
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: #141416;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.primary:hover { background: transparent; color: var(--accent); }
.primary:active { transform: translateY(1px); }
.primary[hidden], .notice[hidden] { display: none; }

/* Canvas */
.canvas { padding: 28px var(--pad) var(--pad); }
.title-row { margin-bottom: var(--gap); }
h1 { font-size: var(--fs-title); line-height: 32px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.finding { margin: 6px 0 0; font-size: 15px; color: var(--text); max-width: 1100px; }
.finding .bad { color: var(--negative); }
.notice { margin: 6px 0 0; font-size: var(--fs-small); color: var(--muted); max-width: 1100px; }
.notice a { color: var(--text); text-underline-offset: 3px; }
.notice a:hover { color: var(--accent); }

.grid { display: grid; grid-template-columns: 448px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.col-left, .col-right { display: grid; gap: var(--gap); min-width: 0; }

.panel {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
h2 { font-size: var(--fs-section); font-weight: 600; margin: 0; line-height: 24px; }
.meta { color: var(--muted); font-size: var(--fs-small); }

/* Scenes */
.scenes { list-style: none; margin: 0; padding: 0; }
.scene {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
.scene:first-child { border-top: 0; padding-top: 4px; }
.scene-name { font-size: 15px; font-weight: 600; justify-self: start; position: relative; }
.scene.current .scene-name::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: var(--accent);
}
.scene-desc { grid-column: 1; color: var(--muted); }
.scene-state { grid-column: 1; color: var(--muted); font-size: var(--fs-small); }
.scene-state .bad { color: var(--negative); }
.scene .ghost { grid-column: 2; grid-row: 1 / span 3; }

/* Narration */
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
.step:first-child { border-top: 0; }
.step .state { font-size: var(--fs-small); color: var(--muted); padding-top: 1px; }
.step.ok .state { color: var(--pill-positive-ink); }
.step.refused .state { color: var(--warning); }
.step.failed .state { color: var(--negative); }
.step .text { overflow-wrap: anywhere; }
.step .extra { grid-column: 2; font: 400 var(--fs-small)/18px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.step pre.extra { margin: 6px 0 0; white-space: pre-wrap; color: #d6d6d9; background: var(--raised); padding: 10px 12px; border-radius: 4px; }
.empty { color: var(--muted); padding: 8px 0; }

/* KPI strip: one container split by 1px rules */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; }
.kpi { display: grid; align-content: start; gap: 2px; padding: 18px 24px; border-left: 1px solid var(--rule); }
.kpi:first-child { border-left: 0; }
.kpi .label { color: var(--muted); font-size: var(--fs-small); }
.kpi .value { font-size: var(--fs-kpi); line-height: 28px; font-weight: 500; }
.kpi.lead .value { font-size: var(--fs-lead); line-height: 40px; }
.kpi .value.bad { color: var(--negative); }
.kpi .sub { color: var(--muted); font-size: var(--fs-small); }

/* Memo batch */
.memo-note { margin: 0 0 8px; color: var(--muted); }
.batch { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.batch li {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  height: 32px; border-top: 1px solid var(--rule); position: relative;
}
.batch .tx { flex: 1; min-width: 0; font: 400 var(--fs-body)/18px var(--mono); color: #d6d6d9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch .who { color: var(--muted); font-size: var(--fs-small); flex: none; }
.batch li.ours .who { color: var(--accent); }
.batch li.ours::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--accent); }

/* Tabs: the selection is a 1px accent line as wide as the label */
.tabs { display: flex; gap: 20px; }
.tabs button { background: none; border: 0; padding: 4px 0; color: var(--muted); cursor: pointer; position: relative; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--accent); }
.tabs button:hover { color: var(--text); }

/* Ledger */
.feed { padding-bottom: 8px; }
.ledger { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ledger th { font-weight: 400; color: var(--muted); font-size: var(--fs-small); text-align: left; padding: 0 12px 8px 0; }
.ledger th:nth-child(1) { width: 72px; }
.ledger th:nth-child(2) { width: 116px; }
.ledger th:nth-child(3) { width: 196px; }
.ledger th:nth-child(5) { width: 160px; }
.ledger td { height: 30px; padding: 0 12px 0 0; border-top: 1px solid var(--rule); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger td.num, .ledger th.num { text-align: right; padding-right: 20px; }
.ledger td.num { color: var(--muted); }
.ledger .method, .ledger .detail { font-family: var(--mono); font-size: var(--fs-body); }
.ledger .detail { color: var(--muted); }
.ledger tr.identifying .method { color: var(--negative); }
.ledger tr.arrive { animation: arrive .4s ease-out; }
@keyframes arrive { from { opacity: 0; transform: translateY(-4px); } }
.ledger .empty-row td { color: var(--muted); }
.feed-scroll { overflow-y: auto; }

/* Wide screens fill the viewport exactly: both columns end on one bottom edge and a
   1080p take never scrolls the page; narration and the ledger scroll inside their panels. */
@media (min-width: 1101px) {
  .canvas { display: flex; flex-direction: column; height: calc(100vh - 48px); min-height: 760px; }
  .grid { flex: 1; min-height: 0; align-items: stretch; }
  .col-left, .col-right { display: flex; flex-direction: column; min-height: 0; }
  .narration, .feed { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
  .steps, .feed-scroll { flex: 1; min-height: 0; overflow-y: auto; }
}

.pill { display: inline-block; flex: none; height: 20px; line-height: 20px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; white-space: nowrap; }
.pill.public, .pill.broadcast { background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.coarse, .pill.decoyed { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pill.identifying { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.who-chip { color: var(--text); }
.who-chip.devtool { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .ledger tr.arrive { animation: none; }
  .ghost:active:not(:disabled) { transform: none; }
}

/* Tablet and phone: one column; the ledger becomes two-line rows */
@media (max-width: 1100px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .col-right { order: -1; }
}
@media (max-width: 640px) {
  :root { --pad: 16px; }
  .bar { gap: 12px; }
  .scope { display: none; }
  .canvas { padding-top: 20px; }
  h1 { font-size: 22px; line-height: 28px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .kpi { padding: 14px 16px; }
  .panel { padding: 16px; }
  .batch { grid-template-columns: minmax(0, 1fr); }
  .panel-head { flex-wrap: wrap; }
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
  .ledger td { border: 0; height: auto; padding: 0; }
  .ledger td.num { display: none; }
  .ledger td.who-cell { grid-column: 1; grid-row: 2; color: var(--muted); font-size: var(--fs-small); }
  .ledger td.method { grid-column: 1; grid-row: 1; }
  .ledger td.detail { grid-column: 1 / -1; grid-row: 3; }
  .ledger td.label-cell { grid-column: 2; grid-row: 1; text-align: right; }
  .ghost { min-height: 44px; }
}

/* The hosted replay adds a button to the bar; on a phone the bar wraps instead of clipping. */
@media (max-width: 600px) {
  .bar { height: auto; min-height: 48px; padding-block: 8px; flex-wrap: wrap; row-gap: 8px; }
  .conn { display: none; }
  #run-all { margin-left: auto; }
}
