/* ---------------------------------------------------------------------------
   Fältboken. Same tokens as src/style.css and the game's own HUD; see
   DESIGN.md in the game repository, which is generated from the real files.
   A two-column shell: a sidebar that stays put and marks where you are, and
   one column of reading beside it.
--------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --ink: #171a16;
  --edge: #24231b;
  --wood: #493626;
  --brass: #ad8c50;
  --brass-text: #cbab72;
  --gold: #e9c67a;
  --paper: #d7c59b;
  --cream: #eadcba;
  --panel: #272a21;
  --ground: #39432a;
  --ground-dark: #2a3220;
  --rule: #55603c;
  --bevel: inset 2px 2px #8e7548, inset -2px -2px #2a221b;
  --drop: 3px 3px 0 #11160ec9;
  --warn: #d4794a;
  --live: #b3bd87;
  --sidebar: 260px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--cream);
  background:
    repeating-conic-gradient(#ffffff05 0% 25%, #00000000 0% 50%) 0 0 / 48px 48px,
    var(--ground);
}
h1, h2, h3, h4, .pixel {
  font-family: "VT323", ui-monospace, monospace;
  font-weight: 400;
  letter-spacing: 0.5px;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(44px, 7vw, 72px); line-height: 0.9; text-shadow: 4px 4px 0 #11160e; }
h1 span { color: var(--gold); }
h2 { font-size: clamp(30px, 4vw, 42px); line-height: 1; text-shadow: 3px 3px 0 #11160e66; }
h3 { font-size: 25px; line-height: 1.15; color: var(--paper); }
h4 { font-size: 20px; color: var(--brass-text); }
p { margin: 0; }
a { color: var(--gold); text-underline-offset: 3px; }
a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
strong { color: var(--paper); font-weight: 400; }
em { font-style: normal; color: var(--gold); }
code { color: var(--paper); word-break: break-word; }

.skip {
  position: absolute; top: -60px; left: 12px; z-index: 20;
  background: var(--gold); color: var(--ink); padding: 8px 12px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* --- shell ---------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 40px;
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: 20px;
  padding-block: 0 96px;
  align-items: start;
}

/* --- sidebar -------------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  max-height: 100svh;
  overflow-y: auto;
  padding-block: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wordmark {
  font-family: "VT323", monospace; font-size: 26px; letter-spacing: 1px;
  color: var(--cream); text-decoration: none;
}
.wordmark small { color: var(--brass-text); font-size: 17px; }
.kicker {
  font-family: "VT323", monospace; font-size: 19px; letter-spacing: 1.5px;
  color: var(--brass-text);
}
.search-label {
  font-family: "VT323", monospace; font-size: 17px; letter-spacing: 1px;
  color: var(--brass-text);
}
#nav-search {
  font: inherit; font-size: 14px;
  background: var(--ground-dark); color: var(--cream);
  border: 2px solid var(--edge); box-shadow: var(--bevel);
  padding: 9px 10px; width: 100%; border-radius: 0;
}
.nav { display: flex; flex-direction: column; }
.nav a {
  color: var(--cream); text-decoration: none; font-size: 14px;
  padding: 7px 10px 7px 12px;
  border-left: 3px solid transparent;
}
.nav a:hover { color: var(--gold); background: #ffffff08; }
.nav a.is-active {
  border-left-color: var(--gold);
  color: var(--gold);
  background: #ffffff0d;
}
.nav-empty { font-size: 13px; color: var(--brass-text); padding: 8px 12px; }
.side-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.side-note { font-size: 12px; color: var(--brass-text); }

.btn {
  font-family: "VT323", monospace; font-size: 20px; line-height: 1;
  display: inline-flex; align-items: center; gap: 10px; min-height: 42px;
  padding: 11px 14px; border: 2px solid var(--edge);
  background: linear-gradient(#56442e 0 48%, #453424 48%);
  box-shadow: var(--bevel); color: #f1dfb6; text-shadow: 1px 1px #211c16;
  text-decoration: none;
}
.btn--gold {
  background: linear-gradient(#e2c079 0 48%, #c9a75f 48%);
  color: #2a2214; text-shadow: none;
  box-shadow: inset 2px 2px #f6e3ad, inset -2px -2px #8a6f38;
}
.buttons { display: flex; flex-wrap: wrap; gap: 12px; }

/* --- main ----------------------------------------------------------------- */
main { min-width: 0; }
.top { padding-block: 40px 26px; display: flex; flex-direction: column; gap: 16px; }
.eyebrow {
  font-family: "VT323", monospace; font-size: 19px; letter-spacing: 1.5px;
  color: var(--brass-text); display: flex; align-items: center; gap: 10px;
}
.dot { width: 8px; height: 8px; flex: 0 0 8px; background: var(--live); box-shadow: 0 0 0 3px #b3bd8724; }
.lead { font-size: 17px; color: var(--paper); max-width: 64ch; }
.live-state {
  font-size: 13px; color: var(--brass-text);
  border-left: 3px solid var(--rule); padding-left: 12px;
}
.live-state.is-live { border-left-color: var(--live); }
.live-state.is-stale { border-left-color: var(--warn); }

section { padding-block: 40px 0; border-top: 2px solid var(--rule); margin-top: 28px; }
section > * + * { margin-top: 18px; }
section:first-of-type { border-top: 0; margin-top: 0; }
.section-lead { color: var(--paper); max-width: 66ch; }

.card {
  background: var(--panel); border: 2px solid var(--edge);
  box-shadow: var(--bevel), var(--drop); padding: 20px;
}
.card > * + * { margin-top: 14px; }
.note {
  border-left: 3px solid var(--brass); padding: 4px 0 4px 14px;
  color: var(--paper);
}

.facts { display: grid; gap: 2px; background: var(--edge); border: 2px solid var(--edge); box-shadow: var(--drop); }
.facts div {
  background: var(--panel); padding: 11px 15px;
  display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between;
}
.facts b { font-weight: 400; color: var(--paper); }
.facts span, .facts .v { color: var(--brass-text); font-variant-numeric: tabular-nums; }
.facts.small div { padding: 7px 12px; font-size: 13px; }

.tree { display: grid; gap: 2px; background: var(--edge); border: 2px solid var(--edge); }
.tree div { background: var(--panel); padding: 11px 15px; display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 4px 14px; }
.tree b { font-weight: 400; color: var(--gold); font-family: "VT323", monospace; font-size: 19px; }
.tree span { color: var(--paper); font-size: 14px; }

.where {
  font-family: "VT323", monospace; font-size: 18px; letter-spacing: 1px;
  color: var(--brass-text);
}
figure { margin: 16px 0 0; }
figure img {
  display: block; width: 100%; max-width: 100%; height: auto;
  border: 2px solid var(--edge); box-shadow: var(--drop); background: var(--ground-dark);
}
figcaption { font-size: 13px; color: var(--brass-text); margin-top: 8px; }

ol.route { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 38px; }
ol.route > li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 16px; }
.marker {
  grid-row: 1 / span 9; width: 38px; height: 38px; display: grid; place-items: center;
  font-family: "VT323", monospace; font-size: 23px; color: #2a2214;
  background: linear-gradient(#e2c079 0 48%, #c9a75f 48%);
  border: 2px solid var(--edge); box-shadow: inset 2px 2px #f6e3ad, inset -2px -2px #8a6f38;
}
ol.route h3 { align-self: center; }
ol.route p { margin-top: 11px; }

/* --- log ------------------------------------------------------------------ */
.log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.log-entry {
  background: var(--panel); border: 2px solid var(--edge);
  padding: 16px 18px;
}
.log-entry + .log-entry { border-top-width: 0; }
.log-date {
  font-family: "VT323", monospace; font-size: 17px; letter-spacing: 1px;
  color: var(--brass-text);
}
.log-body { color: var(--paper); font-size: 14px; margin-top: 8px; }

/* --- roadmap -------------------------------------------------------------- */
.roadmap { display: flex; flex-direction: column; gap: 26px; }
.roadmap-group h3 .count {
  font-family: ui-monospace, monospace; font-size: 13px; color: var(--brass-text);
}
.roadmap-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 2px; background: var(--edge); border: 2px solid var(--edge); }
.roadmap-item { background: var(--panel); padding: 13px 16px; }
.roadmap-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; justify-content: space-between; }
.roadmap-summary { color: var(--paper); font-size: 14px; margin-top: 6px; }
.roadmap-asked { color: var(--brass-text); font-size: 13px; margin-top: 6px; }
.tag {
  font-family: "VT323", monospace; font-size: 16px; letter-spacing: 1px;
  border: 2px solid var(--edge); padding: 1px 8px; color: var(--ground-dark);
  background: var(--brass);
}
.tag-core { background: var(--gold); }

/* --- palette -------------------------------------------------------------- */
.palette { display: flex; flex-direction: column; gap: 18px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 2px; background: var(--edge); border: 2px solid var(--edge); margin-top: 8px; }
.swatch { background: var(--panel); padding: 9px 11px; display: flex; align-items: center; gap: 9px; font-size: 12px; }
.chip { width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid var(--edge); }
.swatch-name { color: var(--paper); }
.swatch-hex { color: var(--brass-text); margin-left: auto; font-variant-numeric: tabular-nums; }

ul.plain { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 10px; }
ul.plain li::marker { color: var(--brass); }
.warn { border-left: 3px solid var(--warn); padding: 3px 0 3px 15px; }

kbd {
  font-family: "VT323", monospace; font-size: 18px; padding: 1px 7px;
  border: 2px solid var(--edge); background: var(--ground-dark); color: var(--cream);
}

footer { margin-top: 42px; padding-top: 22px; border-top: 2px solid var(--rule); color: var(--brass-text); font-size: 13px; }
footer > * + * { margin-top: 12px; }

/* --- narrow --------------------------------------------------------------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 0; }
  .sidebar {
    position: static; max-height: none; overflow: visible;
    border-bottom: 2px solid var(--rule); padding-bottom: 18px;
  }
  .nav { flex-flow: row wrap; gap: 2px; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 6px 10px; }
  .nav a.is-active { border-left: 0; border-bottom-color: var(--gold); }
}
@media (max-width: 540px) {
  ol.route > li { grid-template-columns: 1fr; }
  .marker { grid-row: auto; margin-bottom: 10px; }
  .tree div { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* --- code to copy ---------------------------------------------------------- */
.rules {
  background: var(--panel); border: 2px solid var(--edge);
  box-shadow: var(--bevel), var(--drop); padding: 16px 20px;
}
.rules ol { margin: 10px 0 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 8px; }
.rules li::marker { color: var(--gold); font-family: "VT323", monospace; }

.code { position: relative; margin-top: 12px; }
.code pre {
  margin: 0;
  background: var(--ground-dark);
  border: 2px solid var(--edge);
  box-shadow: var(--drop);
  padding: 16px 18px;
  overflow-x: auto;
  max-width: 100%;
}
.code code {
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--cream);
  white-space: pre;
}
.copy {
  position: absolute; top: 8px; right: 8px;
  font-family: "VT323", monospace; font-size: 17px; letter-spacing: 1px;
  border: 2px solid var(--edge);
  background: linear-gradient(#56442e 0 48%, #453424 48%);
  box-shadow: var(--bevel);
  color: #f1dfb6; padding: 4px 10px; cursor: pointer;
}
.copy:hover { color: var(--gold); }
.copy.is-done { background: linear-gradient(#e2c079 0 48%, #c9a75f 48%); color: #2a2214; }
.small { font-size: 13px; color: var(--brass-text); }

/* --- language switch -------------------------------------------------------- */
.lang { display: flex; gap: 2px; border: 2px solid var(--edge); background: var(--edge); }
.lang button {
  flex: 1 1 0; font-family: "VT323", monospace; font-size: 18px; letter-spacing: 1px;
  border: 0; background: var(--panel); color: var(--brass-text);
  padding: 7px 8px; cursor: pointer;
}
.lang button[aria-pressed="true"] {
  background: linear-gradient(#e2c079 0 48%, #c9a75f 48%);
  color: #2a2214;
}
.lang button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.lang-note { font-size: 11px; line-height: 1.5; color: var(--brass-text); }
