/* chainrom — a phosphor terminal, because the subject is a 1990s program
   living inside a machine that was not built to hold it.

   Everything here is drawn from primitives: the logo is three rectangles, the
   scanlines are a repeating gradient. No borrowed artwork. */

:root {
  --bg: #080b09;
  --panel: #0d120f;
  --panel-2: #111815;
  --line: #1c2a22;
  --line-hot: #2b4a38;

  --ink: #d6f0e0;
  --ink-dim: #8fae9c;
  --ink-mute: #5c7668;

  --green: #43d675;
  --green-dim: #227a43;
  --amber: #f0b23c;
  --red: #ff5f56;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", Menlo,
    Consolas, monospace;

  --radius: 4px;
  --max: 1000px;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* Scanlines and a soft bloom. Kept faint — a CRT that fights the text is a
   costume, not a design. */
.scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
      0deg,
      #00000038 0 1px,
      transparent 1px 3px
    ),
    radial-gradient(ellipse 80% 55% at 50% 0%, #43d6751f, transparent 70%);
  mix-blend-mode: normal;
}
@media (prefers-reduced-motion: no-preference) {
  .scan::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent, #43d6750f 45%, transparent);
    animation: sweep 7s linear infinite;
  }
}
@keyframes sweep {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(100%);
  }
}

a {
  color: inherit;
}

/* ── logo: three bars, drawn not borrowed ─────────────────────────────── */

.logo {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  width: 18px;
}
.logo i {
  height: 3px;
  background: var(--green);
  display: block;
}
.logo i:nth-child(2) {
  width: 100%;
}
.logo i:nth-child(1) {
  width: 80%;
}
.logo i:nth-child(3) {
  width: 55%;
  background: var(--green-dim);
}
.logo.small {
  width: 14px;
}

/* ── header ───────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px 20px;
  background: #080b09e6;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-right: auto;
  text-transform: lowercase;
}
.top nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.top nav a {
  color: var(--ink-mute);
  text-decoration: none;
  font-size: 13px;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.top nav a:hover {
  color: var(--green);
}

/* ── X / social ───────────────────────────────────────────────────────── */
.x {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  text-transform: none;
}
.x svg {
  width: 11px;
  height: 11px;
  flex: none;
  opacity: 0.85;
}
.top nav a.x {
  margin-left: 2px;
  text-transform: none;
}
footer .x {
  color: var(--ink-mute);
  margin-left: auto;
}
footer .x:hover {
  color: var(--green);
}

/* ── hero ─────────────────────────────────────────────────────────────── */

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 72px 20px 44px;
}
.kicker {
  margin: 0 0 20px;
  color: var(--green);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 22px;
  font-size: clamp(32px, 5.6vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 700;
}
h1 em {
  font-style: normal;
  color: var(--green);
}
.lede {
  margin: 0;
  max-width: 64ch;
  color: var(--ink-dim);
  font-size: clamp(14px, 1.7vw, 16px);
}
.cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-hot);
  background: var(--panel-2);
  color: var(--ink);
  font: 700 13px var(--mono);
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn:hover {
  border-color: var(--green);
  color: var(--green);
}
.btn.go {
  background: var(--green);
  color: #06120b;
  border-color: var(--green);
}
.btn.go:hover {
  background: #5ae88a;
  color: #06120b;
}
.btn.small {
  padding: 7px 13px;
  font-size: 12px;
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn[disabled]:hover {
  border-color: var(--line-hot);
  color: var(--ink);
}

/* ── contract address ─────────────────────────────────────────────────── */

.ca-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4px 20px 0;
}
.ca {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--line-hot);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 11px 14px;
}
.ca-tag {
  flex: none;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
}
.ca-addr {
  flex: 1 1 240px;
  min-width: 0;
  word-break: break-all;
  font-size: 13px;
  color: var(--ink);
}
.ca-copy {
  flex: none;
  padding: 6px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line-hot);
  background: var(--panel-2);
  color: var(--ink);
  font: 700 12px var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ca-copy:hover {
  border-color: var(--green);
  color: var(--green);
}
.ca-copy.ok {
  background: var(--green);
  color: #06120b;
  border-color: var(--green);
}
.ca-link {
  flex: none;
  font-size: 12px;
  color: var(--ink-mute);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.ca-link:hover {
  color: var(--green);
}

.foot-ca {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink-mute);
  font: 12.5px var(--mono);
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.foot-ca:hover {
  color: var(--green);
}
.foot-ca.ok {
  color: var(--green);
}

/* ── sections ─────────────────────────────────────────────────────────── */

.band {
  max-width: var(--max);
  margin: 0 auto;
  padding-block: 48px;
  padding-inline: 20px;
  border-top: 1px solid var(--line);
}
h2 {
  margin: 0 0 14px;
  font-size: clamp(20px, 2.8vw, 28px);
  letter-spacing: -0.01em;
  font-weight: 700;
}
h3 {
  margin: 34px 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
}
.band p {
  max-width: 74ch;
  color: var(--ink-dim);
}
.band p strong,
.band p b {
  color: var(--ink);
}
.sub {
  margin-top: -6px;
  font-size: 14px;
}
code {
  color: var(--green);
  font-size: 0.93em;
}

/* ── game picker ──────────────────────────────────────────────────────── */

.picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0 2px;
}
.pick {
  flex: 1 1 200px;
  text-align: left;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-hot);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.pick:hover {
  border-color: var(--green);
}
.pick[aria-selected="true"] {
  border-color: var(--green);
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--green);
}
.pick b {
  font-size: 15px;
  letter-spacing: 0.02em;
}
.pick span {
  font-size: 12px;
  color: var(--ink-mute);
}
.pick.soon {
  opacity: 0.82;
}
.pick .badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid #f0b23c55;
  border-radius: 3px;
  padding: 1px 6px;
}

/* ── console ──────────────────────────────────────────────────────────── */

.console {
  margin: 26px 0 16px;
  border: 1px solid var(--line-hot);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.console-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.console-head .spacer {
  margin-left: auto;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-mute);
  flex: none;
}
.dot.busy {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  animation: pulse 1s infinite;
}
.dot.ok {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.dot.bad {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.bar {
  height: 2px;
  background: var(--line);
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  transition: width 0.2s linear;
}

.log {
  margin: 0;
  padding: 14px;
  max-height: 260px;
  overflow: auto;
  font: 12.5px/1.75 var(--mono);
  color: var(--ink-dim);
  background: #060907;
  white-space: pre-wrap;
  word-break: break-word;
}
.log b {
  color: var(--ink);
  font-weight: 400;
}
.log .g {
  color: var(--green);
}
.log .a {
  color: var(--amber);
}
.log .r {
  color: var(--red);
}
.log .d {
  color: var(--ink-mute);
}

.stage {
  border-top: 1px solid var(--line);
  background: #000;
  position: relative;
  text-align: center;
}
/* Scale to fit within BOTH limits with width/height auto, so the whole frame is
   always visible — never cropped, never stretched. Capping only max-height while
   forcing width:100% (the old rule) squashed the picture. */
.stage canvas {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  image-rendering: pixelated;
  background: #000;
}
.stage:fullscreen {
  display: grid;
  place-items: center;
  text-align: center;
  border: 0;
}
.stage:fullscreen canvas {
  max-width: 100vw;
  max-height: 100vh;
}
.stage-note:fullscreen {
  display: none;
}
#btnFull:disabled {
  display: none;
}
.stage-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
}
.stage-note[hidden] {
  display: none;
}

/* ── metric cells ─────────────────────────────────────────────────────── */

.grid4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.cell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 16px;
}
.cell span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 7px;
}
.cell b {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.cell b.mono-sm {
  font-size: 12px;
  font-weight: 400;
  color: var(--green);
  word-break: break-all;
}

/* ── notes, lists ─────────────────────────────────────────────────────── */

.note {
  margin-top: 26px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--panel);
}
.note h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--green);
}
.checks {
  margin: 0;
  padding: 0;
  list-style: none;
}
.checks li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  font-size: 13.5px;
  color: var(--ink-dim);
}
.checks li:last-child {
  margin-bottom: 0;
}
.checks li::before {
  content: "×";
  position: absolute;
  left: 4px;
  color: var(--red);
  font-weight: 700;
}
.checks b {
  color: var(--ink);
  font-weight: 700;
}

.steps {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: s;
}
.steps li {
  position: relative;
  padding-left: 44px;
  margin-bottom: 18px;
  counter-increment: s;
}
.steps li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  color: var(--green-dim);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line-hot);
  border-radius: var(--radius);
  width: 30px;
  height: 26px;
  display: grid;
  place-items: center;
}
.steps b {
  display: block;
  margin-bottom: 3px;
  color: var(--green);
  font-size: 14px;
}
.steps p {
  margin: 0;
  font-size: 13.5px;
}

/* ── table ────────────────────────────────────────────────────────────── */

.tablewrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: 11px 14px;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody td:first-child {
  color: var(--ink);
  white-space: normal;
}
tbody td.num {
  color: var(--green);
}

.fineprint {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink-mute);
  line-height: 1.7;
}

/* ── status ───────────────────────────────────────────────────────────── */

.status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin: 24px 0 0;
}
.status > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px 20px;
}
.status h3 {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.status ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.status li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  font-size: 13.5px;
  color: var(--ink-dim);
}
.status .done li::before {
  content: "+";
  position: absolute;
  left: 3px;
  color: var(--green);
}
.status .todo li::before {
  content: "·";
  position: absolute;
  left: 5px;
  color: var(--ink-mute);
}

/* ── footer ───────────────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--line);
  max-width: var(--max);
  margin: 34px auto 0;
  padding: 26px 20px 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--ink-mute);
  font-size: 12.5px;
}
.sep {
  color: var(--line-hot);
}

@media (max-width: 680px) {
  .top {
    padding: 12px 16px;
    gap: 12px;
  }
  .top nav {
    gap: 14px;
    width: 100%;
  }
  .hero {
    padding-top: 48px;
  }
  .band {
    padding-block: 36px;
  }
}
