/* ===========================================================================
   THE ARCADE — signal yellow on slate.
   ---------------------------------------------------------------------------
   Yellow-on-dark is the language of instruments: hazard marks, cabinet
   marquees, switchgear labels. This is an archive of machines that were taken
   apart and rebuilt, so the chrome borrows that language — hairline rules,
   index numbers, tabular metadata — without dressing up as a machine.

   Two rules hold the whole thing together:
     1. YELLOW IS A SIGNAL. It marks the live thing and nothing else: the
        current page, the play affordance, a set favourite, focus. Used four
        times a page it reads as deliberate; used forty it reads as decoration.
     2. STRUCTURE, NOT WHITESPACE. Character comes from visible hairlines and
        a strict grid rather than from generous padding, because there is no
        typeface here doing that work (§15 — nothing is fetched from anyone).
   =========================================================================== */

:root {
  /* Dark is the primary design; light is derived from it, not the reverse.
     A neutral grey ramp, deliberately: a blue-tinted "slate" is the tell of
     every default dark theme, and yellow sits better on a colourless ground
     anyway — nothing competes with it for temperature. */
  --bg: #131313;
  --bg-deep: #0b0b0b;
  --surface: #1a1a1a;
  --surface-2: #212121;
  --edge: #2f2f2f;
  --edge-soft: #232323;
  --ink: #ededed;
  --ink-mid: #b5b5b5;
  --muted: #8a8a8a;
  --accent: #facc15;
  --accent-ink: #131313;
  --accent-dim: #6f5a0c;
  --warn: #d29922;
  --bad: #f85149;

  --rule: 1px solid var(--edge);
  --shell: 1240px;
  --gutter: clamp(16px, 4vw, 40px);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #fcfcfc;
    --bg-deep: #eeeeee;
    --surface: #ffffff;
    --surface-2: #f5f5f5;
    --edge: #e0e0e0;
    --edge-soft: #ebebeb;
    --ink: #131313;
    --ink-mid: #454545;
    --muted: #626262;
    /* Bright yellow is illegible as text on white; this is the same signal
       at a weight that actually reads. Filled elements keep the bright one. */
    --accent: #8a6a06;
    --accent-ink: #ffffff;
    --accent-dim: #e3c65a;
    --warn: #8a6a06;
    --bad: #c0362c;
  }
}

:root[data-theme='light'] {
  --bg: #fcfcfc;
  --bg-deep: #eeeeee;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --edge: #e0e0e0;
  --edge-soft: #ebebeb;
  --ink: #131313;
  --ink-mid: #454545;
  --muted: #626262;
  --accent: #8a6a06;
  --accent-ink: #ffffff;
  --accent-dim: #e3c65a;
  --warn: #8a6a06;
  --bad: #c0362c;
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The content column is bounded by real hairlines running the full height, so
   the page reads as a drawing sheet rather than as text floating in space. */
.wrap {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--gutter);
  border-left: var(--rule);
  border-right: var(--rule);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Small caps mono, used for every piece of metadata on the site. */
.meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- header ------------------------------------------------------ */
.site-head {
  border-bottom: var(--rule);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 56px;
  border-bottom: 0;
}

/* The wordmark carries the only permanent piece of yellow on the page. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 640;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand::before {
  content: '';
  width: 9px;
  height: 9px;
  background: var(--accent);
  /* A cut corner: a marker, not a logo. */
  clip-path: polygon(0 0, 100% 0, 100% 62%, 62% 100%, 0 100%);
}

.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a {
  position: relative;
  padding: 6px 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.site-nav a[aria-current='page'] { color: var(--ink); }
/* The current page is marked, not merely coloured. */
.site-nav a[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
}

.theme-toggle,
.ax-chip {
  border: var(--rule);
  background: transparent;
  color: var(--muted);
  border-radius: 3px;
  height: 28px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.theme-toggle:hover,
.ax-chip:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- title card -------------------------------------------------- */
/* padding-top ONLY. A `padding: X 0 0` shorthand here silently reset the
   horizontal gutter that .wrap sets, so the hero sat flush against the frame
   rule while everything else was inset — the whole page looked subtly
   misaligned and the cause was one shorthand. */
.hero { padding-top: clamp(40px, 6vw, 68px); }
.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(27px, 3.9vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 660;
  max-width: 24ch;
}
/* Yellow marks ONE phrase, not half the sentence. A whole heading in the
   signal colour is decoration; three words in it is emphasis. */
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero p {
  margin: 0;
  max-width: 54ch;
  color: var(--ink-mid);
  font-size: 16px;
}

/* A spec strip, the way equipment is labelled. */
.spec {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 40px 0 0;
  border-top: var(--rule);
  border-bottom: var(--rule);
}
.spec div {
  flex: 1 1 150px;
  padding: 14px 18px;
  border-right: var(--rule);
}
/* The first cell has no left padding so its label lines up with the page
   content; every other cell needs it, or the text sits on the divider. */
.spec div:first-child { padding-left: 0; }
.spec div:last-child { border-right: 0; }
.spec dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}
.spec dd {
  margin: 0;
  font-size: 15px;
  font-weight: 560;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- section headings -------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 56px 0 14px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 600;
}
.section-head .count { margin-left: auto; }
.section-head::after { content: none; }

/* ---------- the shelf --------------------------------------------------- */
/* Hairline cell dividers rather than gaps: the grid itself is the graphic. */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  border-top: var(--rule);
  border-left: var(--rule);
  margin-bottom: 96px;
}
.card {
  display: flex;
  flex-direction: column;
  border-right: var(--rule);
  border-bottom: var(--rule);
  background: var(--bg);
  position: relative;
  transition: background 0.15s;
}
.card:hover { background: var(--surface); text-decoration: none; }

.card-tile {
  aspect-ratio: 2 / 1;
  position: relative;
  border-bottom: var(--rule);
  background-color: var(--bg-deep);
  overflow: hidden;
}
/* A vignette, so a tile has depth without the motif having to shout. The
   crosshatch that used to live here was fighting the motifs underneath it —
   two competing grids at the same weight read as noise, not as texture. */
.card-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(140% 110% at 50% -10%, transparent 46%, var(--bg-deep) 108%);
  opacity: 0.5;
}

.card-index {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.card-body { padding: 14px 16px 18px; display: flex; flex-direction: column; flex: 1; }
.card-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -0.015em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body p {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-mid);
}
.card-after {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--edge-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.pill {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--edge);
  border-radius: 2px;
  color: var(--muted);
}
.pill.wip { color: var(--accent); border-color: var(--accent-dim); }
.pill.planned { color: var(--muted); }

/* ---------- footer ------------------------------------------------------ */
.site-foot {
  border-top: var(--rule);
  padding: 28px 0 56px;
}
.site-foot .wrap { display: block; }
.site-foot p {
  margin: 0;
  max-width: 62ch;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}
.site-foot a { color: var(--ink-mid); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===========================================================================
   The game page: a player in a bezel, and a datasheet underneath.
   The research is not an appendix here — it is half of what the page is for,
   so it gets the same care as the frame.
   =========================================================================== */

.game-head {
  /* padding-top/bottom only — see the note in site.css on .hero. */
  padding-top: 44px;
  padding-bottom: 26px;
  border-bottom: var(--rule);
}
.game-head .index {
  display: block;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.game-head h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 660;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.game-head .tagline {
  margin: 0;
  max-width: 58ch;
  color: var(--ink-mid);
  font-size: 16px;
}

/* ---------- the player -------------------------------------------------- */
.frame-shell {
  position: relative;
  margin: 28px 0 0;
  background: var(--bg-deep);
  border: var(--rule);
}
/* Corner marks, as on a registration target. Purely a signal that this is the
   instrument and everything else on the page is documentation. */
.frame-shell::before,
.frame-shell::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--accent);
  border-style: solid;
  pointer-events: none;
  z-index: 2;
}
.frame-shell::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.frame-shell::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.frame-shell iframe {
  display: block;
  width: 100%;
  /* Sized to the tallest whole-number scale the width can support, and no
     taller. With the controls beside the field rather than under it, the width
     caps Grainfall at 2x anyway, so a taller frame bought nothing but a slab of
     empty dark below the game (§11 — integer scaling only). */
  height: min(74vh, 690px);
  border: 0;
  background: var(--bg-deep);
}

.frame-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: var(--rule);
  background: var(--surface);
}
.frame-bar .spacer { margin-left: auto; }
.frame-bar button,
.frame-bar a.btn {
  border: var(--rule);
  background: transparent;
  color: var(--muted);
  border-radius: 3px;
  padding: 5px 11px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.frame-bar button:hover,
.frame-bar a.btn:hover { color: var(--ink); border-color: var(--muted); text-decoration: none; }
/* The live mode is the one thing on this bar worth marking. */
.frame-bar button[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* A planned game: the research is done, the player is not. */
.not-yet {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 260px;
  padding: 40px 24px;
  color: var(--muted);
  font-size: 13.5px;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 14px,
    color-mix(in srgb, var(--edge) 40%, transparent) 14px 15px
  );
}
.not-yet strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.not-yet span { max-width: 44ch; }

/* ---------- documentation ----------------------------------------------- */
.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 0;
  padding-bottom: 88px;
  border-top: var(--rule);
  margin-top: 44px;
}
.cols > div { padding: 28px 36px 0 0; border-right: var(--rule); }
.cols > aside { padding: 28px 0 0 36px; }
@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; }
  .cols > div { border-right: 0; padding-right: 0; }
  .cols > aside { padding-left: 0; border-top: var(--rule); margin-top: 28px; }
}

h2.section {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 600;
}
h2.section + h2.section { margin-top: 32px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th,
table.data td {
  text-align: left;
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--edge-soft);
  vertical-align: top;
  color: var(--ink-mid);
}
table.data thead th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: var(--rule);
  padding-bottom: 7px;
}
table.data tbody th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
  width: 1%;
  padding-right: 24px;
}
table.data code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--edge);
  border-radius: 2px;
  padding: 1px 6px;
}

/* The original, given the weight it deserves. */
.origin {
  border: var(--rule);
  border-left: 2px solid var(--accent);
  background: var(--surface);
  padding: 16px 18px;
  font-size: 13.5px;
  color: var(--ink-mid);
  line-height: 1.65;
}
.origin strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}

ul.plain { margin: 0; padding-left: 16px; font-size: 13.5px; color: var(--ink-mid); }
ul.plain li { margin-bottom: 7px; padding-left: 2px; }
ul.plain li::marker { color: var(--accent-dim); }

/* ---------- prose (about, 404) ------------------------------------------ */
.prose { max-width: 66ch; padding-top: 44px; padding-bottom: 96px; }
.prose h1 {
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.03em;
  font-weight: 660;
  margin: 0 0 24px;
}
.prose h2 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 40px 0 12px;
  padding-top: 20px;
  border-top: var(--rule);
}
.prose p { color: var(--ink-mid); font-size: 15px; line-height: 1.72; margin: 0 0 16px; }
.prose strong { color: var(--ink); font-weight: 600; }

/* ---------- 404 --------------------------------------------------------- */
.lost { padding-top: 96px; padding-bottom: 120px; }
.lost .code {
  font-family: var(--mono);
  font-size: clamp(56px, 14vw, 132px);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  margin: 0 0 20px;
}
.lost h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 12px; font-weight: 620; }
.lost p { color: var(--ink-mid); max-width: 46ch; margin: 0 0 28px; }

/* ===========================================================================
   Accounts: the sign-in dialog, favourite marks, and transient notices.
   Same discipline as the rest — yellow marks the live thing and nothing else.
   =========================================================================== */

/* ---------- favourite mark ---------------------------------------------- */
.ax-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border: var(--rule);
  border-radius: 3px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.ax-fav:hover { color: var(--ink); border-color: var(--muted); }
.ax-fav[aria-pressed='true'] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.card { position: relative; }

.ax-fav-inline {
  position: static;
  vertical-align: middle;
  backdrop-filter: none;
  flex: none;
}

/* ---------- dialog ------------------------------------------------------ */
.ax-dialog {
  border: var(--rule);
  border-top: 2px solid var(--accent);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 26px 26px 24px;
  width: min(440px, calc(100vw - 32px));
  font-family: var(--font);
  position: relative;
}
.ax-dialog::backdrop { background: rgba(3, 5, 8, 0.62); }
.ax-dialog-title {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.ax-dialog-body p { margin: 0 0 15px; font-size: 14px; line-height: 1.62; color: var(--ink-mid); }
.ax-dialog-close { position: absolute; top: 12px; right: 12px; margin: 0; }
.ax-dialog-close button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.ax-dialog-close button:hover { color: var(--ink); }

.ax-dialog button,
.ax-dialog .ax-btn {
  display: inline-block;
  border: var(--rule);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
}
.ax-dialog button:hover,
.ax-dialog .ax-btn:hover { border-color: var(--muted); }
.ax-dialog .ax-primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 640;
}
.ax-dialog .ax-primary:hover { filter: brightness(1.06); }

.ax-or {
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 14px !important;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ax-or::before,
.ax-or::after { content: ''; flex: 1; height: 1px; background: var(--edge); }

.ax-form { display: flex; gap: 8px; flex-wrap: wrap; }
.ax-form input {
  flex: 1 1 220px;
  min-width: 0;
  border: var(--rule);
  border-radius: 3px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 9px 11px;
}
.ax-form input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.ax-error { color: var(--bad); font-size: 13px; flex-basis: 100%; margin: 6px 0 0 !important; }

/* The account key, shown exactly once. It should look like the serial number
   it is, and be trivially selectable. */
.ax-key {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--bg);
  border: var(--rule);
  border-left: 2px solid var(--accent);
  padding: 14px;
  margin-bottom: 14px;
  user-select: all;
  overflow-wrap: anywhere;
}
.ax-row { display: flex; gap: 8px; margin-bottom: 16px; }
.ax-muted { color: var(--muted); font-size: 12.5px !important; }

/* ---------- notices ----------------------------------------------------- */
.ax-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}
.ax-toast {
  border: var(--rule);
  border-left: 2px solid var(--accent);
  background: var(--surface);
  color: var(--ink-mid);
  font-size: 13px;
  line-height: 1.55;
  padding: 12px 15px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
