/* OddsPad. One terminal: a transcript on the left, framed character-art plates on the right.
   Read off his reference picture: black field, one monospace at one size, two inks, hairline
   dashed frames with solid corner brackets, every picture made of characters. */

@font-face {
  font-family: "Term";
  src: url("/fonts/3270-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* His own palette, measured off the avatar and the header he made: a pixel sunset.
     The structure of this page is the terminal he gave as the design reference; the world it runs
     in is his brand. */
  --ink: #140c2d;           /* the night side of his sky, the page's own field */
  --ink-2: #1b1140;         /* a sunken field: inputs, the inside of a plate */
  --plate: rgba(24, 15, 56, 0.86);
  --blue: #fff2dc;          /* the transcript's ink: the cream his die glows with */
  --blue-bright: #ffc24d;   /* molten gold: typed lines, live numbers, the pips */
  --blue-dim: #b79ae6;      /* the lilac of his upper sky: labels and second rank */
  --violet: #c89bff;        /* the NO side */
  --line: #6a4fb0;          /* the dashed plate rule */
  --line-bright: #ffc24d;   /* the corner brackets, in gold */
  --line-faint: #3a2770;    /* the inner hairline */
  --white: #fff8e8;         /* pictures, display words, the YES side */
  --glow: rgba(255, 190, 90, 0.5);

  --gutter: 40px;
  --rail: 27%;
  --body: 18px;
  --lh: 1.8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--blue);
  font-family: "Term", "Courier New", monospace;
  font-size: var(--body);
  line-height: var(--lh);
  letter-spacing: 0.04em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::after {
  /* The faint scanline his picture has. Static: nothing on this page follows the pointer. */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.13) 0 1px, transparent 1px 3px),
    radial-gradient(130% 90% at 50% 45%, transparent 62%, rgba(0, 0, 0, 0.4) 100%);
  mix-blend-mode: multiply;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

/* ---------------------------------------------------------------- the page */

.screen {
  display: grid;
  grid-template-columns: minmax(300px, var(--rail)) 1fr;
  gap: 34px;
  max-width: 2240px;
  margin: 0 auto;
  padding: 26px var(--gutter) 96px;
  align-items: start;
}

/* ---------------------------------------------------------- the transcript */

.rail { position: sticky; top: 26px; }

.tt { white-space: pre-wrap; word-break: break-word; }
.tt--out { color: var(--blue); }
.tt--sys { color: var(--blue-dim); }
.tt--hi { color: var(--blue-bright); text-shadow: 0 0 12px var(--glow); }
.tt--white { color: var(--white); }

.block { margin: 0 0 calc(var(--lh) * 1em); }
.block:last-child { margin-bottom: 0; }

.label { color: var(--blue-dim); letter-spacing: 0.14em; }

.cmds { list-style: none; margin: 0; padding: 0; }
.cmds li { margin: 0; }

.cmd {
  display: block;
  width: 100%;
  min-height: 1.8em;
  padding: 0;
  background: none;
  border: 0;
  color: var(--blue);
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}
.cmd .w { color: var(--blue-bright); }
.cmd .d { color: var(--blue-dim); }
.cmd:hover .w, .cmd:focus-visible .w { color: var(--white); text-shadow: 0 0 14px var(--glow); }
.cmd[aria-current="true"] .w { color: var(--white); text-shadow: 0 0 14px var(--glow); }

/* The prompt is a real input: every command on this site can be typed. */
.prompt { display: flex; align-items: baseline; gap: 0.6ch; min-height: 48px; }
.prompt .ps1 { color: var(--blue-bright); white-space: pre; }
.prompt input {
  flex: 1 1 auto;
  min-width: 2ch;
  background: none;
  border: 0;
  outline: 0;
  color: var(--white);
  font: inherit;
  letter-spacing: inherit;
  caret-color: var(--blue-bright);
  padding: 0;
}
.caret {
  display: inline-block;
  width: 0.62em;
  height: 1.05em;
  background: var(--white);
  transform: translateY(0.16em);
  box-shadow: 0 0 12px var(--glow);
}
@media (prefers-reduced-motion: no-preference) {
  .caret { animation: blink 1.06s steps(1, end) infinite; }
  @keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
}

/* The contract block: the output of `odds`, where a terminal puts an address. */
.mint {
  display: block;
  width: 100%;
  color: var(--white);
  word-break: break-all;
  text-shadow: 0 0 12px var(--glow);
}
.mint--empty { color: var(--blue-dim); text-shadow: none; }

.keys { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 0.6em; }

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7ch;
  min-height: 48px;
  padding: 0 1.3em;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--blue-bright);
  font: inherit;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-align: center;
}
.key:hover:not(:disabled), .key:focus-visible:not(:disabled) {
  border-color: var(--line-bright);
  color: var(--white);
  text-shadow: 0 0 14px var(--glow);
}
.key:active:not(:disabled) { background: rgba(126, 157, 255, 0.1); }
.key:disabled { color: var(--blue-dim); border-color: var(--line-faint); cursor: not-allowed; }
.key--go { border-color: var(--line-bright); color: var(--white); }
.key--wide { width: 100%; }
.key .mark { height: 1.05em; width: auto; flex: 0 0 auto; }
.key:disabled .mark { opacity: 0.4; }

.feed-line { color: var(--blue); }
.feed-line .y { color: var(--white); }
.feed-line .n { color: var(--blue-bright); }

/* -------------------------------------------------------------- the plates */

.stack { display: grid; gap: 30px; }

.plate {
  position: relative;
  border: 1px dashed var(--line);
  padding: 40px;
  background: var(--ink);
}
.plate::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  --c: var(--line-bright);
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / 18px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 0 / 1px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / 18px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / 1px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / 18px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / 1px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / 18px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / 1px 18px no-repeat;
}
.plate--inner::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid var(--line-faint);
  pointer-events: none;
}

.plate__head {
  margin: 0 0 1.4em;
  color: var(--blue-bright);
  font-size: inherit;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.plate__head .ps1 { color: var(--blue-dim); }

.art { margin: 0 auto; display: block; }
.art--full { width: 100%; }
.art--tall { max-width: 420px; }
.art--wrap { padding: 26px 0; }

.display { display: block; width: 100%; margin: 0 auto; }
.display--mid { max-width: 72%; }

.rule {
  border: 0;
  border-top: 1px dashed var(--line);
  margin: 34px 0;
}

.premise {
  max-width: 46ch;
  margin: 1.2em 0 0;
  color: var(--blue-bright);
}

/* ------------------------------------------------------------- the markets */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1px;
  background: var(--line-faint);
  border: 1px solid var(--line-faint);
}
.cellpad { background: var(--ink); padding: 26px 28px; }

.coin__top { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; }
.coin__tick { color: var(--white); text-shadow: 0 0 12px var(--glow); }
.coin__name { color: var(--blue-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coin__clock { color: var(--blue-bright); white-space: nowrap; }

.bar { white-space: pre; letter-spacing: 0; color: var(--blue-dim); overflow: hidden; display: block; }
.bar .on { color: var(--blue-bright); }
.bar .pct { color: var(--white); letter-spacing: 0.04em; }

.side { display: grid; grid-template-columns: 5.5ch 1fr auto; gap: 0 1ch; align-items: baseline; }
.side__k { color: var(--blue-dim); }
.side--yes .side__k, .side--yes .side__v { color: var(--white); }
.side--no .side__k, .side--no .side__v { color: var(--blue-bright); }
.side__track { white-space: pre; letter-spacing: 0; overflow: hidden; }
.side--yes .side__track { color: var(--white); }
.side--no .side__track { color: var(--blue-bright); }
.side__v { white-space: nowrap; }

.state { color: var(--blue-dim); }
.state--yes { color: var(--white); }
.state--no { color: var(--blue-bright); }

/* --------------------------------------------------------------- the forms */

.form { display: grid; gap: 1.1em; max-width: 56ch; }
.field { display: grid; gap: 0.3em; }
.field > span { color: var(--blue-dim); }
.field input, .field textarea, .field select {
  min-height: 48px;
  padding: 0.5em 1.1em;
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: var(--white);
  font: inherit;
  letter-spacing: inherit;
}
.field textarea { min-height: 5em; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 0;
  border-color: var(--line-bright);
}
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice .key[aria-pressed="true"] { border-color: var(--white); color: var(--white); }

.note { color: var(--blue-dim); max-width: 62ch; }
.warn { color: var(--white); }

.steps { display: grid; gap: 26px; }
.step { display: grid; grid-template-columns: 5ch 1fr; gap: 0 1.5ch; }
.step__n { color: var(--white); }

.rows { display: grid; gap: 1px; background: var(--line-faint); border: 1px solid var(--line-faint); }
.row { background: var(--ink); padding: 20px 28px; display: grid; gap: 0.2em; }

:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------- the sizes */

@media (max-width: 1500px) {
  :root { --rail: 31%; --gutter: 32px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}

@media (max-width: 1080px) {
  :root { --gutter: 26px; --body: 17px; }
  .screen { grid-template-columns: 1fr; gap: 30px; }
  .rail { position: static; }
  .plate { padding: 30px; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --gutter: 18px; --body: 17px; --lh: 1.72; }
  .screen { padding: 20px var(--gutter) 70px; }
  .plate { padding: 22px; }
  .plate--inner::after { inset: 8px; }
  .cellpad { padding: 22px 20px; }
  .display--mid { max-width: 100%; }
  .art--tall { max-width: 100%; }
  .rule { margin: 26px 0; }
  .keys .key { flex: 1 1 calc(50% - 10px); }
}

@media (max-width: 360px) {
  :root { --gutter: 14px; }
  .plate { padding: 18px; }
  .cellpad { padding: 18px 16px; }
}

/* ------------------------------------------------- corrections after looking */

/* A grid item keeps min-width:auto by default, so one wide picture widens the whole track and the
   page lays itself out at the picture's width. Every column here says 0 instead. */
.rail, .stack, .plate, .cellpad, .row, .grid { min-width: 0; }
.rail img, .plate img { max-width: 100%; height: auto; }

/* The wordmark is a banner, not a hero: it sits at the top of the transcript at reading size. */
#wordmark { width: min(100%, 380px); }

/* The first picture is a band across the plate, so the giant word under it is on the first screen
   as it is in his picture, not a screen below. */
.art--full { width: 100%; max-height: 58vh; object-fit: contain; object-position: center; }
.art--tall { max-height: 62vh; width: auto; }

/* Four keys read as one block, never three and a lonely fourth. */
.keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.keys .key { width: 100%; }

@media (max-width: 1080px) {
  .art--full { max-height: none; }
  .art--tall { max-height: none; width: min(100%, 420px); }
}

/* The transcript is three blocks, so a phone can put the pictures between them instead of after
   all of them. On a wide screen they are one column and the last block falls to the foot of the
   page, where his picture puts its progress line. */
.rail { display: flex; flex-direction: column; min-height: 100%; }
.rail__mid { margin-top: calc(var(--lh) * 1em); }
.rail__bottom { margin-top: auto; padding-top: calc(var(--lh) * 2em); }
.screen { align-items: stretch; }

@media (max-width: 1080px) {
  .rail { display: contents; }
  .rail__top { order: 1; }
  .stack { order: 2; }
  .rail__mid { order: 3; margin-top: 0; }
  .rail__bottom { order: 4; margin-top: 0; padding-top: 0; }
}

/* Every column child says min-width:0 too, or one long caps line sets the width of the page. */
.rail__top, .rail__mid, .rail__bottom, .block, .cmds, .cmds li, .cmd, .prompt, .form, .field { min-width: 0; }
.tt, .cmd, .note, .label, .premise, .side__v, .state { overflow-wrap: anywhere; }
.cmd { display: grid; grid-template-columns: 9ch minmax(0, 1fr); gap: 0 1ch; align-items: baseline; }
.cmd .w { white-space: nowrap; }
.cmd .d { min-width: 0; }

/* ---------------------------------------------- his world, under the terminal */

/* The background is more of his world: his sunset sky, blurred, drifting on its own clock, with a
   veil over it so cream text on it is readable. Nothing here follows the pointer. */
body::before {
  content: "";
  position: fixed;
  inset: -6%;
  z-index: -2;
  background: url("/img/sky.webp") center / cover no-repeat;
  filter: blur(9px) saturate(1.05);
  transform: scale(1.04);
}
body {
  background:
    linear-gradient(180deg, rgba(14, 8, 34, 0.86) 0%, rgba(20, 12, 45, 0.74) 46%, rgba(32, 16, 48, 0.8) 100%),
    var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  body::before { animation: drift 90s ease-in-out infinite alternate; }
  @keyframes drift {
    from { transform: scale(1.04) translate3d(-1.2%, 0.6%, 0); }
    to   { transform: scale(1.08) translate3d(1.2%, -0.8%, 0); }
  }
}

/* The scanline stays, far softer: his sky is not a CRT, his die glows. */
body::after {
  background:
    repeating-linear-gradient(to bottom, rgba(10, 5, 28, 0.1) 0 1px, transparent 1px 3px),
    radial-gradient(135% 95% at 50% 40%, transparent 64%, rgba(8, 4, 24, 0.45) 100%);
}

.plate { background: var(--plate); }
.cellpad, .row { background: rgba(21, 13, 50, 0.9); }
.grid, .rows { background: var(--line-faint); }

/* The two sides of a market read as his two inks: cream for yes, lilac for no. */
.side--no .side__k, .side--no .side__v, .side--no .side__track,
.state--no, .feed-line .n { color: var(--violet); }
.coin__clock { color: var(--blue-bright); }

/* Every live number and every typed line carries his glow. */
.tt--hi, .coin__tick, .warn, .step__n { text-shadow: 0 0 14px var(--glow); }
.key--go { box-shadow: 0 0 18px rgba(255, 190, 90, 0.16) inset; }

/* The prompt's own caret is for the closing line, where there is no input to blink in. */
.prompt input + .caret { display: none; }
/* Let a little more of his sky through: it is the world the terminal runs in. */
body {
  background:
    linear-gradient(180deg, rgba(14, 8, 34, 0.8) 0%, rgba(20, 12, 45, 0.66) 46%, rgba(32, 16, 48, 0.74) 100%),
    var(--ink);
}

/* His sky is the point of the background: enough blur that it never competes with the text, not so
   much that it stops being his picture. */
body::before { filter: blur(5px) saturate(1.12) brightness(1.02); }
body {
  background:
    linear-gradient(180deg, rgba(14, 8, 34, 0.74) 0%, rgba(20, 12, 45, 0.58) 44%, rgba(34, 16, 50, 0.7) 100%),
    var(--ink);
}
.display { max-width: 96%; }
#wordmark { filter: drop-shadow(0 0 16px rgba(255, 190, 90, 0.35)); }
.art--full, .art--tall { filter: drop-shadow(0 0 26px rgba(255, 176, 70, 0.22)); }
