/* ============================================================
   wiki.css — the Field Almanac wears the game's own colors:
   near-black violet ground, ember headings, mint for healing,
   monospace throughout. One deliberate dark theme.
   ============================================================ */
:root {
  --bg: #14101c;
  --panel: #1d1830;
  --panel2: #241d3a;
  --line: #3a3158;
  --text: #cfc8e8;
  --dim: #8d84ad;
  --ember: #e8724c;
  --gold: #ffd75f;
  --mint: #7fe0b0;
  --violet: #b278ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.55;
}

header {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  justify-content: space-between;
  padding: 20px 26px 12px;
  border-bottom: 2px solid var(--line);
}
h1 { margin: 0; color: var(--ember); font-size: 28px; letter-spacing: 3px; text-shadow: 2px 2px 0 #000; }
.brand .sub { color: var(--dim); font-size: 13px; }

#tabs { display: flex; gap: 8px; }
#tabs button {
  font: inherit; letter-spacing: 2px; cursor: pointer;
  background: var(--panel); color: var(--dim);
  border: 1px solid var(--line); border-radius: 4px 4px 0 0;
  padding: 8px 18px 6px;
}
#tabs button.on { color: var(--gold); border-color: var(--gold); background: var(--panel2); }
#tabs button:hover { color: var(--text); }
#tabs .branchname { display: block; font-size: 10px; letter-spacing: 0; color: var(--dim); }

/* ---- the book: shelf + article ---- */
#book { display: flex; min-height: calc(100vh - 160px); max-width: 1280px; margin: 0 auto; }
#shelf {
  flex: 0 0 250px; border-right: 1px solid var(--line);
  padding: 18px 12px 40px 20px;
  position: sticky; top: 0; align-self: flex-start; max-height: 100vh; overflow-y: auto;
}
#shelf .chname {
  display: block; color: var(--dim); text-decoration: none;
  letter-spacing: 1px; padding: 5px 8px; border-radius: 4px;
}
#shelf .chname.on { color: var(--ember); background: var(--panel); }
#shelf .chname:hover { color: var(--text); }
#shelf .pages { margin: 2px 0 8px 10px; border-left: 1px solid var(--line); }
#shelf .pgroup {
  color: var(--gold); font-weight: bold; font-size: 10.5px; letter-spacing: 2px;
  text-transform: uppercase; padding: 7px 10px 3px; cursor: pointer;
  list-style: none; user-select: none;
}
#shelf .pgroup::-webkit-details-marker { display: none; }
#shelf .pgroup::before { content: '\25B8'; display: inline-block; margin-right: 6px; transition: transform .12s; }
#shelf details.grp[open] > .pgroup::before { transform: rotate(90deg); }
#shelf .pgroup:hover { color: var(--text); }
#shelf .pg {
  display: block; color: var(--dim); text-decoration: none;
  font-size: 13px; padding: 3px 10px;
}
#shelf .pg.on { color: var(--mint); }
#shelf .pg:hover { color: var(--text); }
#shelf .pgspr { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; vertical-align: -4px; margin-right: 6px; }

main { flex: 1; min-width: 0; padding: 22px 30px 60px; }
.loading { color: var(--dim); padding: 40px 0; }

article h2 {
  color: var(--ember); letter-spacing: 2px; font-size: 24px;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin: 4px 0 18px;
  display: flex; align-items: center; gap: 16px;
}
.pagesprite {
  width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 4px;
}
.scenehead { color: var(--gold); letter-spacing: 2px; margin: 34px 0 12px; font-size: 17px; }

.prose { max-width: 760px; overflow-x: auto; }
.prose p { margin: 0 0 14px; }
.prose b { color: var(--gold); font-weight: bold; }
.prose i { color: var(--mint); }

details.deep, details.alm-deep {
  max-width: 760px; margin-top: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 16px;
}
details.deep summary, details.alm-deep summary { color: var(--violet); letter-spacing: 2px; font-size: 12px; cursor: pointer; }
details.deep .prose, .alm-deep-body { margin-top: 10px; }

/* ---- pieces of the in-game book that arrive inside extracted bodies ---- */
.alm-state { font-size: 11px; letter-spacing: 2px; margin-bottom: 12px; }
.alm-state.known { color: var(--mint); }
.alm-state.unknown { color: var(--dim); }

.alm-card {
  max-width: 430px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 12px 15px; margin: 0 0 16px;
}
.alm-card .tt-name { color: var(--gold); letter-spacing: 1px; margin-bottom: 6px; }
.alm-card .tt-desc { color: var(--dim); font-size: 13.5px; margin-bottom: 7px; }
.alm-card .tt-line { color: var(--text); }
.alm-card .tt-hps { font-weight: bold; color: #ff7a6a; margin-top: 9px; }
.alm-card .tt-hpm { font-weight: bold; color: #7fb0ff; }
.alm-card .tt-rank { color: var(--mint); margin-bottom: 5px; }
.alm-card .tt-stat { color: var(--text); }
.alm-card .tt-foot, .alm-card .tt-open { font-size: 11px; margin-top: 9px; color: var(--dim); }

.alm-facts { border-collapse: collapse; margin: 6px 0 16px; }
.alm-facts th { text-align: left; color: var(--dim); font-weight: normal; padding: 3px 16px 3px 0; white-space: nowrap; vertical-align: top; }
.alm-facts td { padding: 3px 0; vertical-align: top; }

.alm-see { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; max-width: 760px; }
.alm-see-label { font-size: 10px; color: var(--dim); letter-spacing: 2px; margin-right: 4px; }
.chip {
  display: inline-block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 3px 9px; font-size: 13px;
}
a.chip, .chip.term { border-bottom: 1px solid var(--line); }
.chip:hover { border-color: var(--gold); color: var(--text); }

/* the Ladder page's live lattice */
.alm-lattice { border-collapse: collapse; margin: 12px 0 16px; font-size: 12px; }
.alm-lattice th { color: var(--dim); font-weight: normal; padding: 4px 6px; font-size: 11px; }
.alm-lattice th.rowh { text-align: right; letter-spacing: 1px; white-space: nowrap; }
.alm-lattice td { border: 1px solid var(--bg); padding: 4px 6px; text-align: center; min-width: 62px; }
.alm-lattice td.soon { background: var(--panel); color: var(--dim); }
.alm-lattice .dm { display: block; font-weight: bold; }
.alm-lattice .st { display: block; font-size: 10px; opacity: .85; }

.term { color: var(--mint); border-bottom: 1px dotted var(--mint); cursor: help; }
.xref { color: var(--violet); border-bottom: 1px dotted var(--violet); text-decoration: none; }
.xref:hover { color: var(--text); }

#tip {
  position: fixed; z-index: 50; max-width: 340px;
  background: var(--panel2); border: 1px solid var(--gold); border-radius: 5px;
  padding: 9px 12px; font-size: 12.5px; pointer-events: none;
  box-shadow: 0 4px 18px rgba(0,0,0,.6);
}
#tip .tname { color: var(--gold); letter-spacing: 1px; }
#tip[hidden] { display: none; }

/* ---- The Guide: screenshot walkthrough ---- */
.guidegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; }
.gstep {
  margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px; overflow: hidden;
}
.gstep img { max-width: 100%; border-radius: 4px; display: block; background: #000; }
.gstep figcaption { color: var(--dim); font-size: 12.5px; padding: 8px 4px 2px; }
.gstep figcaption b { color: var(--gold); }

/* ---- glossary ---- */
.glossary { columns: 2; column-gap: 26px; max-width: 900px; }
.glossary .gterm { break-inside: avoid; margin-bottom: 12px; font-size: 13px; }
.glossary .gname { color: var(--gold); }
.glossary .gshort { color: var(--dim); }

footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  color: var(--dim); font-size: 12px;
  border-top: 1px solid var(--line); padding: 14px 26px;
}

@media (max-width: 760px) {
  #book { flex-direction: column; }
  #shelf { position: static; max-height: none; flex: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .glossary { columns: 1; }
  main { padding: 18px 14px 50px; }
  header, footer { padding-left: 14px; padding-right: 14px; }
}
