/* Recomp Board: one stylesheet, no build step. */

:root {
  color-scheme: light;

  --ground: #eef1ef;
  --surface: #fbfcfb;
  --surface-sunk: #e6eae7;
  --surface-alt: #f3f6f4;
  --ink: #15201e;
  --ink-soft: #3c4b48;
  --muted: #64736f;
  --line: #d5dcd8;
  --line-strong: #bcc6c1;

  --accent: #0f5f59;
  --accent-ink: #0b4a45;
  --accent-wash: #dcebe8;
  --accent-contrast: #f7fbfa;
  --signal: #9c6210;
  --signal-wash: #f6e9d4;
  --warn: #a33a2a;
  --warn-wash: #f7e2de;

  --recomp: #0f5f59;
  --recomp-wash: #dcebe8;
  --decomp: #6a4fbf;
  --decomp-wash: #e6e0f7;

  --st-exploring: #6a4fbf;
  --st-in-progress: #0f5f59;
  --st-playable: #2c7a34;
  --st-released: #1f5f9e;
  --st-paused: #7d6c4c;

  --act-active: #2c7a34;
  --act-quiet: #9c6210;
  --act-dormant: #7a8481;

  --radius: 7px;

  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --measure: 62ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0e1413;
    --surface: #151d1b;
    --surface-sunk: #101817;
    --surface-alt: #18211f;
    --ink: #e7ece9;
    --ink-soft: #c2cdc9;
    --muted: #8d9c98;
    --line: #253030;
    --line-strong: #35433f;

    --accent: #56c3b5;
    --accent-ink: #7fd6ca;
    --accent-wash: #16302e;
    --accent-contrast: #06100f;
    --signal: #e0a44a;
    --signal-wash: #2e2517;
    --warn: #f08a72;
    --warn-wash: #351d19;

    --recomp: #56c3b5;
    --recomp-wash: #16302e;
    --decomp: #a78bfa;
    --decomp-wash: #241d3a;

    --st-exploring: #a78bfa;
    --st-in-progress: #56c3b5;
    --st-playable: #6fbd72;
    --st-released: #7db1e8;
    --st-paused: #bda87e;

    --act-active: #6fbd72;
    --act-quiet: #e0a44a;
    --act-dormant: #7d8a86;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0e1413;
  --surface: #151d1b;
  --surface-sunk: #101817;
  --surface-alt: #18211f;
  --ink: #e7ece9;
  --ink-soft: #c2cdc9;
  --muted: #8d9c98;
  --line: #253030;
  --line-strong: #35433f;

  --accent: #56c3b5;
  --accent-ink: #7fd6ca;
  --accent-wash: #16302e;
  --accent-contrast: #06100f;
  --signal: #e0a44a;
  --signal-wash: #2e2517;
  --warn: #f08a72;
  --warn-wash: #351d19;

  --recomp: #56c3b5;
  --recomp-wash: #16302e;
  --decomp: #a78bfa;
  --decomp-wash: #241d3a;

  --st-exploring: #a78bfa;
  --st-in-progress: #56c3b5;
  --st-playable: #6fbd72;
  --st-released: #7db1e8;
  --st-paused: #bda87e;

  --act-active: #6fbd72;
  --act-quiet: #e0a44a;
  --act-dormant: #7d8a86;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.55 var(--font-sans);
  font-synthesis-weight: none;
}

h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

a { color: var(--accent-ink); }
a:hover { color: var(--ink); }

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

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

.skip { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 10px 14px; z-index: 20; }
.skip:focus { left: 8px; top: 8px; }

.shell { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- header ---------- */

.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }

.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--ink);
  font: 600 16px/1 var(--font-mono); letter-spacing: -.01em;
}
.wordmark-mark { width: 14px; height: 14px; border-radius: 3px; background: var(--accent); box-shadow: inset 0 0 0 3px var(--ground); }
.wordmark-dim { color: var(--muted); }

.top-nav { display: flex; flex-wrap: wrap; gap: clamp(10px, 2.4vw, 22px); font-size: 14px; }
.top-nav a { color: var(--ink-soft); text-decoration: none; }
.top-nav a:hover { color: var(--accent-ink); text-decoration: underline; }

/* ---------- hero ---------- */

.hero { padding-block: clamp(40px, 7vw, 76px) 26px; }

.hero h1 {
  font-size: clamp(34px, 6.2vw, 58px);
  font-weight: 700; letter-spacing: -.028em; line-height: 1.04; max-width: 14ch;
}

.lead { margin-top: 18px; max-width: var(--measure); font-size: clamp(16px, 2.2vw, 19px); color: var(--ink-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent;
  font: 600 15px/1 var(--font-sans); text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-small { padding: 7px 13px; font-size: 13.5px; border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-small:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- counts ---------- */

.counts { padding-block: 6px 28px; }

.counts-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 1px; margin: 0;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.count { background: var(--surface); padding: 13px 15px; }
.count dt { font: 500 11px/1 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.count dd { margin: 8px 0 0; font: 600 24px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- toolbar ---------- */

.board { padding-block: 16px 52px; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-grow { flex: 1 1 220px; }
.field label { font: 500 11px/1 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.field input, .field select {
  font: 400 15px/1.2 var(--font-sans); color: var(--ink);
  background: var(--ground); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 9px 11px; min-width: 0; max-width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); padding-bottom: 9px; cursor: pointer; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }

.result-line { margin-top: 16px; font: 500 12.5px/1 var(--font-mono); letter-spacing: .04em; color: var(--muted); }

/* ---------- the table ---------- */

.table-wrap {
  margin-top: 10px;
  max-height: min(72vh, 820px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

/* The table gets more room than the text around it, so every column fits on a laptop. */
.board.shell { max-width: 1480px; }

.grid {
  width: 100%;
  min-width: 940px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--line-strong);
  border-right: 1px solid var(--line);
  padding: 0;
  text-align: left;
  font: 600 11px/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.grid thead th:last-child { border-right: 0; }

.grid thead th button {
  all: unset;
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.grid thead th button:hover { color: var(--accent-ink); }
.grid thead th button::after { content: ""; }
.grid thead th[aria-sort="ascending"] button::after { content: " ↑"; color: var(--accent); }
.grid thead th[aria-sort="descending"] button::after { content: " ↓"; color: var(--accent); }
.grid thead th:not(:has(button)) { padding: 11px 8px; }

.grid tbody td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
}
.grid tbody td:last-child { border-right: 0; }
.grid tbody tr:nth-child(4n+3) td { background: var(--surface-alt); }
.grid tbody tr.data-row:hover td { background: var(--accent-wash); }
.grid tbody tr.is-open td { background: var(--accent-wash); }

.col-expand { width: 30px; }
.col-notes { min-width: 120px; }
.cell-targets { font: 500 12.5px/1.5 var(--font-mono); color: var(--ink-soft); min-width: 86px; }

.cell-expand { text-align: center; padding-inline: 4px !important; }
.expand-btn {
  all: unset;
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px;
  color: var(--muted); cursor: pointer;
  font: 600 10px/1 var(--font-mono);
}
.expand-btn:hover { background: var(--surface-sunk); color: var(--accent-ink); }
.expand-btn::before { content: "▸"; font-size: 12px; }
tr.is-open .expand-btn::before { content: "▾"; }

.cell-game { font-weight: 600; letter-spacing: -.008em; min-width: 130px; }
.cell-project { color: var(--ink-soft); min-width: 150px; overflow-wrap: anywhere; }
.project-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.project-link:hover { color: var(--accent-ink); border-color: var(--accent); }
.project-by { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.cell-clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.is-open td { white-space: normal; }
tr.is-open .cell-clip { max-width: none; overflow: visible; text-overflow: clip; }
tr.is-open td { vertical-align: top; }
.cell-mono { font: 400 12.5px/1.5 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; }
.cell-version { font: 500 12.5px/1.5 var(--font-mono); color: var(--ink); max-width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tr.is-open .cell-version { white-space: normal; overflow-wrap: anywhere; }
.cell-empty { color: var(--muted); }

.type-tag {
  display: inline-block;
  font: 600 10.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 6px; border-radius: 4px; white-space: nowrap;
}
.type-tag[data-type="recomp"] { color: var(--recomp); background: var(--recomp-wash); }
.type-tag[data-type="decomp"] { color: var(--decomp); background: var(--decomp-wash); }

.system-tag { font: 500 12px/1.5 var(--font-mono); color: var(--ink-soft); }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px/1.3 var(--font-mono); color: var(--st); white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st); flex: none; }
.status[data-status="exploring"] { --st: var(--st-exploring); }
.status[data-status="in-progress"] { --st: var(--st-in-progress); }
.status[data-status="playable"] { --st: var(--st-playable); }
.status[data-status="released"] { --st: var(--st-released); }
.status[data-status="paused"] { --st: var(--st-paused); }

.commit { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.commit::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--act); flex: none; }
.commit[data-activity="active"] { --act: var(--act-active); }
.commit[data-activity="quiet"] { --act: var(--act-quiet); }
.commit[data-activity="dormant"] { --act: var(--act-dormant); }
tr[data-activity="dormant"] .cell-game,
tr[data-activity="dormant"] .cell-project { opacity: .62; }

.help-flag { display: inline-block; margin-left: 7px; font: 600 10.5px/1 var(--font-mono); color: var(--signal); background: var(--signal-wash); border-radius: 4px; padding: 3px 5px; vertical-align: 1px; }

.detail-links { display: flex; flex-wrap: wrap; gap: 5px; }
.detail-links a {
  font: 500 11.5px/1 var(--font-mono); text-decoration: none; color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 4px 6px; white-space: nowrap;
}
.detail-links a:hover { border-color: var(--accent); color: var(--accent-ink); }

/* notes stay inside their own column; expanding just lets them breathe */

.cell-notes-body { min-width: 120px; max-width: 320px; }
.cell-id { font: 400 11.5px/1.45 var(--font-mono); color: var(--muted); min-width: 130px; max-width: 170px; overflow-wrap: anywhere; user-select: all; }
.cell-notes-body .note-text {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink-soft);
}
tr.is-open .cell-notes-body .note-text { display: block; overflow: visible; }

.note-detail { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.note-field h4 { margin: 0 0 3px; font: 600 10px/1 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.note-field p { font-size: 13.5px; color: var(--ink-soft); }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.help-chip { font: 500 12px/1 var(--font-mono); color: var(--signal); background: var(--signal-wash); border-radius: 4px; padding: 5px 8px; }

.chip {
  display: inline-block; margin-left: 7px; vertical-align: 1px;
  font: 600 10.5px/1 var(--font-mono); border-radius: 4px; padding: 3px 5px; white-space: nowrap;
}
.chip-help { color: var(--signal); background: var(--signal-wash); }
.chip-unclaimed { color: var(--muted); background: var(--surface-sunk); border: 1px dashed var(--line-strong); }
.chip-warn { color: var(--warn); background: var(--warn-wash); }


.table-legend { margin-top: 12px; font-size: 13px; color: var(--muted); max-width: 80ch; }
.table-legend b { font-weight: 600; color: var(--ink-soft); }

.empty { margin-top: 20px; font-size: 15px; color: var(--muted); max-width: var(--measure); }

/* ---------- rules ---------- */

.rules, .submit, .about { padding-block: 44px; border-top: 1px solid var(--line); }

.rules h2, .submit h2, .about h2 { font-size: clamp(24px, 3.6vw, 32px); letter-spacing: -.02em; font-weight: 700; }

.rule-list {
  list-style: none; margin: 24px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px 32px;
}
.rule-kicker { font: 600 11px/1 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--accent-ink); padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.rule-list li p + p { margin-top: 11px; font-size: 14.5px; color: var(--ink-soft); }

/* ---------- submit ---------- */

.section-lead { margin-top: 10px; max-width: var(--measure); color: var(--ink-soft); }

.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin-top: 26px; }
.way {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.way-kicker { font: 600 11px/1 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--accent-ink); }
.way h3 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.way p { font-size: 14.5px; color: var(--ink-soft); }
.way .btn-small { margin-top: auto; }

.prompt {
  font: 400 12.5px/1.6 var(--font-mono) !important;
  color: var(--ink) !important;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  width: 100%;
}

.schema { margin-top: 26px; }
.schema summary { cursor: pointer; font: 500 14px/1 var(--font-mono); color: var(--ink-soft); padding: 10px 0; }
.schema-note { margin: 4px 0 12px; font-size: 14px; color: var(--muted); max-width: var(--measure); }

pre { margin: 0; overflow-x: auto; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
code { font: 400 13px/1.6 var(--font-mono); }
p code, li code, .schema-note code, .table-legend code { background: var(--surface-sunk); padding: 1px 5px; border-radius: 4px; }

.nogithub { margin-top: 30px; padding: 18px 20px; border-left: 2px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.nogithub h3 { font-size: 17px; font-weight: 600; }
.nogithub p { margin-top: 10px; font-size: 14.5px; color: var(--ink-soft); max-width: var(--measure); }

/* ---------- about ---------- */

.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 26px; margin-top: 24px; }
.about-col h3 { font: 600 12px/1 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.about-col p { margin-top: 12px; font-size: 15px; color: var(--ink-soft); }

/* ---------- footer ---------- */

.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-block: 22px; font-size: 13.5px; color: var(--muted); }

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

@media (max-width: 720px) {
  .table-wrap { max-height: 70vh; }
  .detail { padding-left: 16px; }
  .top-nav { font-size: 13px; }
}

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