:root {
  /* page */
  --bg: #f4f4f1; --surface: #ffffff; --ink: #1c1d1f; --muted: #5f6368; --line: #dedfd9; --line2: #eceee8;
  --accent: #2d5a88; --accent-bg: #e8eff7;
  /* timeline (unchanged look) */
  --bg2: #ecebe4; --card: #ffffff;
  --brass: #a8780f; --brass-bg: #f1d98f; --teal: #2f6f66; --teal-bg: #cfe3dc;
  --rust: #a2441c; --rust-bg: #f0cdb8; --plum: #5d4a86; --plum-bg: #e3ddef; --bar: #9c947a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --surface: #1d2024; --ink: #e5e5e2; --muted: #9ba0a6; --line: #30343a; --line2: #262a2f;
    --accent: #8db7e6; --accent-bg: #1f2c3b;
    --bg2: #262a2f; --card: #1d2024;
    --brass: #e7b740; --brass-bg: #4b3e17; --teal: #7cc2b5; --teal-bg: #21403b;
    --rust: #e4865c; --rust-bg: #4a2a1b; --plum: #b9a6ea; --plum-bg: #322b45; --bar: #6c6a58;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --surface: #1d2024; --ink: #e5e5e2; --muted: #9ba0a6; --line: #30343a; --line2: #262a2f;
  --accent: #8db7e6; --accent-bg: #1f2c3b;
  --bg2: #262a2f; --card: #1d2024;
  --brass: #e7b740; --brass-bg: #4b3e17; --teal: #7cc2b5; --teal-bg: #21403b;
  --rust: #e4865c; --rust-bg: #4a2a1b; --plum: #b9a6ea; --plum-bg: #322b45; --bar: #6c6a58;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15.5px/1.6 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topin { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 600; font-size: 17px; color: var(--ink); text-decoration: none; }
.build { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px; }
.tabs { margin-left: auto; display: flex; gap: 2px; height: 100%; }
.tabs a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; font-size: 14.5px; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }

/* layout */
.layout { max-width: 1240px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; }
nav.side { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; padding: 22px 0 30px; }
nav.side h2 { font-size: 12px; color: var(--muted); font-weight: 500; margin: 0 10px 8px; display: flex; justify-content: space-between; }
nav.side ol { list-style: none; margin: 0; padding: 0; }
nav.side li a { display: grid; grid-template-columns: 24px 1fr auto; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: 5px; color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.4; }
nav.side li a:hover { background: var(--line2); }
nav.side li a .n { color: var(--muted); font-size: 12.5px; text-align: right; }
nav.side li a .c { color: var(--muted); font-size: 12px; }
nav.side li a.on { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
nav.side li a.on .n, nav.side li a.on .c { color: var(--accent); }
nav.side .jump { display: none; }
main { padding: 24px 0 60px; min-width: 0; }
.loading { color: var(--muted); }

/* split header */
.crumb { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
main h1 { font-size: 30px; margin: 0 0 6px; }
.lead { font-size: 16.5px; color: var(--ink); margin: 0 0 18px; max-width: 70ch; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin-bottom: 14px; }
.facts dl { display: grid; grid-template-columns: 150px 1fr; gap: 5px 14px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.thumbs { display: flex; gap: 8px; align-items: flex-start; }
.thumbs figure { margin: 0; width: 132px; }
.thumbs img { width: 132px; height: 74px; object-fit: cover; border-radius: 4px; display: block; border: 1px solid var(--line); }
.thumbs figcaption { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.3; }

/* legend */
.legend { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 18px; margin: 0 0 22px; font-size: 14px; }
.legend summary { cursor: pointer; font-weight: 500; }
.legend .lg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; margin: 10px 0 4px; color: var(--ink); }
.legend .ic { display: inline-block; width: 22px; }
.lgbar { display: inline-block; width: 26px; height: 12px; border-radius: 3px; background: #6b7556; margin-right: 6px; vertical-align: -1px; }
.lgbar.gold { background: repeating-linear-gradient(135deg, var(--brass) 0 5px, transparent 5px 10px); border: 2px solid var(--brass); }

/* steps */
.chain { counter-reset: step; position: relative; }
.roomhead { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.roomhead:first-child { margin-top: 0; }
.roomhead img { width: 72px; height: 40px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); }
.roomhead h2 { font-size: 18px; margin: 0; }
.roomhead span { color: var(--muted); font-size: 13px; }
.blk { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px 14px 56px; margin: 0 0 10px; }
.blk::before { counter-increment: step; content: counter(step); position: absolute; left: 16px; top: 14px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 13px; display: flex; align-items: center; justify-content: center; }
.blk .t { display: flex; align-items: baseline; gap: 12px; }
.blk h3 { font-size: 16.5px; margin: 0; flex: 1; }
.blk .sec { color: var(--muted); font-size: 14px; white-space: nowrap; }
.blk.door { background: transparent; border-style: dashed; padding-top: 10px; padding-bottom: 10px; }
.blk.door::before { counter-increment: none; content: "\2192"; color: var(--rust); border-color: var(--rust); }
.blk.door h3 { font-size: 15.5px; }
.blk.door.split { border: 1px solid var(--rust); border-left-width: 4px; background: var(--surface); }
.splitflag { font-size: 13px; color: var(--rust); font-weight: 500; white-space: nowrap; }
.wants { margin: 6px 0 2px; font-size: 14.5px; color: var(--muted); }
.chip { display: inline-block; border-radius: 4px; padding: 0 7px; font-weight: 500; }
.chip.w { background: var(--teal-bg); color: var(--teal); }
.chip.g { background: var(--brass-bg); color: var(--ink); }
.reading { margin: 8px 0 0; font-size: 14.5px; max-width: 78ch; }
.reading b { font-weight: 600; }
.muted { color: var(--muted); }
.note { margin-top: 8px; color: var(--muted); font-size: 14px; }
.trick { margin-top: 10px; padding: 8px 12px; font-size: 14px; border-left: 3px solid; background: var(--bg); border-radius: 0 4px 4px 0; }
.trick b { font-weight: 600; margin-right: 2px; }
.trick.guide { border-color: var(--plum); }
.trick.input { border-color: var(--plum); }
.trick.sol { border-color: var(--brass); }
.trick.warn { border-color: var(--rust); background: var(--rust-bg); }
.trick.info { border-color: var(--line); }
.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.nav a { text-decoration: none; display: flex; flex-direction: column; font-size: 15px; font-weight: 500; }
.nav a small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.nav a.next { text-align: right; margin-left: auto; }

/* ---------- timeline (visuals kept) ---------- */
.tl { position: relative; margin: 10px 0 4px; }
.pins { position: relative; }
.pin { position: absolute; top: 0; white-space: nowrap; font-size: 13px; line-height: 20px; padding: 0 7px 0 4px; border-radius: 10px 10px 10px 2px; background: var(--bg2); border: 1px solid var(--line); transform: translateX(-6px); }
.pin.flip { transform: translateX(calc(-100% + 6px)); border-radius: 10px 10px 2px 10px; }
.pin i { font-style: normal; margin-right: 3px; }
.pin em { font-style: normal; color: var(--muted); margin-left: 2px; }
.pin.k-item { background: var(--brass-bg); border-color: var(--brass); }
.pin.k-bit { background: var(--teal-bg); border-color: var(--teal); }
.pin.k-room, .pin.k-door { background: var(--rust-bg); border-color: var(--rust); }
.pin.k-here { background: var(--plum-bg); border-color: var(--plum); }
.lanes { position: relative; padding: 4px 0; border-left: 2px solid var(--line); border-right: 2px dotted var(--line); }
.row { position: relative; height: 26px; margin: 2px 0; }
.row.side { height: 16px; }
.seg { position: absolute; top: 0; bottom: 0; border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; line-height: 26px; padding: 0 6px; color: #fff; }
.seg.c0 { background: #6b7556; } .seg.c1 { background: #85704a; } .seg.c2 { background: #5c6a72; }
.row.side .seg { background: var(--bar); opacity: .7; line-height: 16px; font-size: 11px; color: var(--ink); }
.tick { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); opacity: .55; z-index: 2; }
.tick.k-item { background: var(--brass); opacity: 1; width: 3px; }
.tick.k-bit { background: var(--teal); opacity: 1; width: 3px; }
.tick.k-room, .tick.k-door { background: var(--rust); opacity: 1; width: 3px; }
.goldzone { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(231,183,64,.55) 0 7px, rgba(231,183,64,.2) 7px 14px); border-top: 3px solid var(--brass); border-bottom: 3px solid var(--brass); z-index: 1; pointer-events: none; }
.axis { position: relative; height: 18px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.axis span { position: absolute; transform: translateX(-50%); }
.axis span:first-child { transform: none; }
.axis .unit { right: -14px; transform: none; }

/* text pages */
.doc { max-width: 760px; }
.doc h2 { font-size: 20px; margin: 30px 0 8px; }
.doc p, .doc li { max-width: 72ch; }
.doc .ex { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 18px; margin: 12px 0; }
.cap { font-size: 13.5px; color: var(--muted); margin: 2px 0 0; }
.rooms2 { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; font-size: 14px; }
.rooms2 .r { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 4px 9px; }
.rooms2 .fade { background: #1c1d1f; color: #fff; border-radius: 4px; padding: 4px 9px; }
.rooms2 .ar { color: var(--muted); }
table.conf { border-collapse: collapse; width: 100%; font-size: 14.5px; margin: 10px 0; background: var(--surface); }
table.conf th, table.conf td { text-align: left; vertical-align: top; padding: 8px 10px; border: 1px solid var(--line); }
table.conf th { font-weight: 600; background: var(--bg); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }
  .topin { padding: 0 16px; height: auto; min-height: 52px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 0; }
  .tabs { margin-left: 0; width: 100%; height: 40px; }
  nav.side { position: static; max-height: none; padding: 14px 0 0; }
  nav.side h2, nav.side ol { display: none; }
  nav.side .jump { display: block; width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .facts dl { grid-template-columns: 120px 1fr; }
  .thumbs { overflow-x: auto; }
}
@media (max-width: 600px) {
  main h1 { font-size: 25px; }
  .blk { padding: 12px 14px 12px 46px; }
  .blk::before { left: 10px; width: 24px; height: 24px; }
  .legend .lg { grid-template-columns: 1fr; }
  .build { display: none; }
  .seg { font-size: 11px; }
}

table.conf tr.hl td { background: var(--brass-bg); }
.doc ul li { margin: 4px 0; }

/* ---------- hub additions ---------- */
:root { --ok: #2f6f45; --ok-bg: #dcefe2; --new: #8a5a00; --new-bg: #fbecc8; --neg: #6b6f75; --neg-bg: #ececea; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ok: #7fc79a; --ok-bg: #1f3a29; --new: #f0c062; --new-bg: #3e3115; --neg: #a3a8ae; --neg-bg: #2a2d31; } }
:root[data-theme="dark"] { --ok: #7fc79a; --ok-bg: #1f3a29; --new: #f0c062; --new-bg: #3e3115; --neg: #a3a8ae; --neg-bg: #2a2d31; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; }
.layout.wide { grid-template-columns: minmax(0, 1fr); }
.layout.wide nav.side { display: none; }
.foot { border-top: 1px solid var(--line); background: var(--surface); }
.footin { max-width: 1240px; margin: 0 auto; padding: 16px 24px; font-size: 13px; color: var(--muted); }
nav.side h3 { font-size: 12px; color: var(--muted); font-weight: 500; margin: 16px 10px 6px; text-transform: none; }
nav.side h3:first-child { margin-top: 0; }
nav.side ul { list-style: none; margin: 0; padding: 0; }
nav.side ul a { display: flex; gap: 8px; align-items: baseline; padding: 4px 10px; border-radius: 5px; color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.4; }
nav.side ul a:hover { background: var(--line2); }
nav.side ul a.on { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
nav.side ul a .n { color: var(--muted); font-size: 12.5px; min-width: 34px; }
nav.side ul a .b { margin-left: auto; }

/* badges for how sure a statement is */
.badge { display: inline-block; font-size: 11.5px; font-weight: 500; line-height: 18px; padding: 0 7px; border-radius: 9px; white-space: nowrap; vertical-align: 1px; border: 1px solid transparent; }
.badge.guide { background: var(--plum-bg); color: var(--plum); }
.badge.explained { background: var(--ok-bg); color: var(--ok); }
.badge.new { background: var(--new-bg); color: var(--new); }
.badge.neg { background: var(--neg-bg); color: var(--neg); }
.badge.code { background: var(--accent-bg); color: var(--accent); }

/* home */
.hero { padding: 6px 0 4px; max-width: 760px; }
.hero h1 { font-size: 32px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 26px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 4px; font-size: 16.5px; color: var(--accent); }
.card p { margin: 0; font-size: 14px; color: var(--muted); }
.card .k { display: block; margin-top: 8px; font-size: 13px; color: var(--ink); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin: 12px 0 18px; }
.panel h2 { margin-top: 0 !important; }
.panel > :last-child { margin-bottom: 0; }
.home2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.keylist { margin: 0; padding: 0; list-style: none; }
.keylist li { padding: 7px 0; border-top: 1px solid var(--line2); font-size: 14.5px; }
.keylist li:first-child { border-top: 0; }

/* docs and wiki pages */
.doc { max-width: 820px; }
.doc h3 { font-size: 16.5px; margin: 22px 0 6px; }
.doc table.conf { font-size: 14px; }
.doc pre { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font-size: 13px; line-height: 1.5; }
code { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--line2); padding: 0 4px; border-radius: 3px; }
pre code { background: none; padding: 0; }
.tablewrap { overflow-x: auto; margin: 10px 0; }
.tablewrap table.conf { margin: 0; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 10px 0; }
.steps li { counter-increment: s; position: relative; padding: 2px 0 8px 34px; max-width: 72ch; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12.5px; display: flex; align-items: center; justify-content: center; }
.callout { border-left: 3px solid var(--accent); background: var(--surface); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 12px 0; font-size: 14.5px; }
.callout.warn { border-color: var(--rust); background: var(--rust-bg); }
.callout.new { border-color: var(--new); }
.status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; font-size: 14px; color: var(--muted); }
dl.gloss { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; margin: 10px 0; font-size: 14.5px; }
dl.gloss dt { font-weight: 600; }
dl.gloss dd { margin: 0; }
.trick a.more { margin-left: 4px; font-size: 13px; white-space: nowrap; }
.trick.item, .trick.walk, .trick.tele { border-color: var(--ok); }
.trick.itemnew { border-color: var(--new); background: var(--new-bg); }

/* rooms */
.roomgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 16px 0; }
.roomcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; text-decoration: none; color: var(--ink); }
.roomcard:hover { border-color: var(--accent); }
.roomcard img { width: 100%; height: 96px; object-fit: cover; display: block; background: var(--line2); }
.roomcard .rc { padding: 8px 10px; }
.roomcard b { display: block; font-size: 14.5px; font-weight: 600; }
.roomcard span { font-size: 12.5px; color: var(--muted); }
.act .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.act .meta b { color: var(--ink); font-weight: 500; }
.act h3 .id { color: var(--muted); font-weight: 400; font-size: 14px; margin-right: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; align-items: center; font-size: 14px; }
.filters label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.filters input[type="search"] { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); min-width: 220px; }
.blk.act::before { content: none; }
.blk.act { padding-left: 18px; }
.empty { color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .home2 { grid-template-columns: minmax(0, 1fr); }
  nav.side h3, nav.side ul { display: none; }
  .tabs { width: calc(100% + 16px); margin-right: -16px; }
}
@media (max-width: 600px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 26px; }
  dl.gloss { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.gloss dd { margin-bottom: 8px; }
  .filters input[type="search"] { min-width: 0; width: 100%; }
  .footin { padding: 14px 16px; }
}
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.toc a { font-size: 13.5px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; }
.toc a:hover { border-color: var(--accent); }
.cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.readhint { font-size: 14px; color: var(--muted); margin: -4px 0 18px; }
.legendlist { list-style: none; padding: 0; }
.legendlist li { margin: 6px 0; }
.legendlist .ic { display: inline-block; width: 22px; }
@media (max-width: 1100px) { .cards.four { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 600px) { .cards.four { grid-template-columns: minmax(0, 1fr); } }
nav.side ul a .b { white-space: nowrap; }
main [id] { scroll-margin-top: 72px; }
/* final pass */
.pin.k-wait { background: var(--bg2); border-style: dashed; border-color: var(--muted); }
.tick.k-wait { background: var(--muted); opacity: .9; width: 3px; }
.pin.k-timer { background: var(--accent-bg); border-color: var(--accent); }
.tick.k-timer { background: var(--accent); opacity: 1; width: 3px; }
.trick.itemcode { border-color: var(--accent); }
.lgbar.thin { height: 7px; background: var(--bar); opacity: .7; vertical-align: 1px; }
.lgbar.wait { width: 4px; height: 16px; background: var(--muted); border-radius: 1px; margin: 0 11px 0 9px; vertical-align: -3px; }
.blk .t { flex-wrap: wrap; row-gap: 2px; }
.splitflag { white-space: normal; }
code { overflow-wrap: anywhere; }
pre code { overflow-wrap: normal; }
.reading + .note, .tl + .note { margin-top: 10px; }
.reading,.note,.blk h3,.blk .meta,.trick{overflow-wrap:anywhere}
