/* TerraTD — shared styling for the wiki and every proposal page.
 *
 * Standalone: these pages do NOT load styles/main.css, so the palette is
 * repeated here. It is the same palette main.css uses — keep the two in step
 * if you retint the game, or the wiki starts looking like a different product.
 *
 * There is no theme system on this branch (terra-v1 had one), so these are
 * plain values rather than a theme hookup. The extra names below exist because
 * the doc styling uses more roles than the game HUD does.
 */
:root {
  --bg: #0b0d14;
  --panel: #141826;
  --panel-solid: #141826;
  --surface: #1d2235;
  --surface-hi: #252b42;
  --surface-lo: #171b2b;
  --line: #2a3050;
  --text: #e6e8f2;
  --dim: #8a91ad;
  --gold: #ffd166;
  --life: #ff5d6c;
  --wave: #56e0ff;
  --ok: #66e08c;
  --bad: #ff5d6c;
  --accent: #56e0ff;
  --accent-2: #ff6ad5;
  --accent-bg: #16283a;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  /* Matches the game menu's backdrop so the wiki reads as part of TerraTD
     rather than as a document that happens to be next to it. */
  background: radial-gradient(ellipse at top, #1a2040 0%, #060810 70%) fixed, var(--bg);
  min-height: 100vh;
  line-height: 1.62;
  font-size: 15px;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 26px 20px 90px; }

header.top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 6px;
}
header.top h1 {
  margin: 0; font-size: 30px; font-weight: 900; letter-spacing: -0.5px;
}
header.top h1 span { color: var(--accent); }
.back {
  font-size: 13px; color: var(--accent); text-decoration: none;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px;
  white-space: nowrap;
}
.back:hover { border-color: var(--accent); background: var(--accent-bg); }
.sub { color: var(--dim); font-size: 13.5px; margin: 0 0 20px; }

nav.toc {
  display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 22px; padding: 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
nav.toc a {
  font-size: 12px; color: var(--dim); text-decoration: none;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px;
}
nav.toc a:hover { color: var(--accent); border-color: var(--accent); }

section.card {
  background: var(--panel-solid); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px;
  scroll-margin-top: 14px;
}
section.card > h2 {
  margin: 0 0 12px; font-size: 12.5px; font-weight: 800;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
}
h3 { font-size: 15.5px; margin: 20px 0 6px; }
h3:first-of-type { margin-top: 4px; }
p { margin: 0 0 10px; }
ul, ol { margin: 0 0 10px; padding-left: 20px; }
li { margin: 4px 0; }
a { color: var(--accent); }
b, strong { color: var(--text); }
em { color: var(--accent); font-style: normal; font-weight: 600; }
.muted { color: var(--dim); font-size: 13px; }

code, .kbd {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px; font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.kbd { font-family: inherit; font-weight: 700; }

/* ---------- Tables (rendered from the live game config) ---------- */
.tableWrap { overflow-x: auto; margin: 10px 0 4px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  color: var(--dim); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
}
tbody tr:hover { background: var(--surface-lo); }
td.name { font-weight: 700; }
td .desc { display: block; color: var(--dim); font-weight: 400; font-size: 12px; white-space: normal; max-width: 380px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.gold { color: var(--gold); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Tags / status pills ---------- */
.tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--dim); margin-right: 8px;
  white-space: nowrap; vertical-align: 2px;
}
.tag.done { color: var(--ok); border-color: var(--ok); }
.tag.live { color: var(--accent); border-color: var(--accent); }
.tag.plan { color: var(--gold); border-color: var(--gold); }
.tag.idea { color: var(--wave); border-color: var(--wave); }
.tag.open { color: var(--bad); border-color: var(--bad); }

ul.todo { list-style: none; padding: 0; margin: 0; }
ul.todo > li {
  display: flex; gap: 4px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
ul.todo > li:last-child { border-bottom: 0; }
ul.todo > li > div { flex: 1; }
ul.todo .muted { display: block; margin-top: 2px; }

/* ---------- Callout ---------- */
.note {
  border-left: 3px solid var(--accent); background: var(--surface-lo);
  padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 12px 0;
}
.note.warn { border-left-color: var(--gold); }

/* ---------- Cards grid (proposal index, feature blurbs) ---------- */
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tile {
  background: var(--surface-lo); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
}
.tile h4 { margin: 0 0 4px; font-size: 14px; }

footer.foot {
  color: var(--dim); font-size: 11.5px; margin-top: 26px;
  padding-top: 14px; border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 70px; }
  header.top h1 { font-size: 23px; }
  td .desc { max-width: 200px; }
}
