/* STNH Quest Book. Design system "Industrial dark", shared with the launcher. */

@font-face { font-family: "Inter"; font-weight: 400 700; font-display: swap; src: url(fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 400 700; font-display: swap; src: url(fonts/inter-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 500; font-display: swap; src: url(fonts/mono-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 500; font-display: swap; src: url(fonts/mono-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Space Grotesk"; font-weight: 500 700; font-display: swap; src: url(fonts/grotesk-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg-deep: #0d0f12;
  --bg: #111317;
  --side: #14161b;
  --surface: #181b21;
  --raised: #20242c;
  --track: #262a33;
  --line: #23272f;
  --border: #2f3540;
  --slot: #0b0d10;
  --grid: #1b1f26;
  --map: #15181e;

  --text: #e8eaed;
  --text-2: #b7bdc7;
  --muted: #9aa1ad;
  --dim: #858c98;

  --energy: #f5a524;
  --energy-hover: #ffc163;
  --energy-ink: #1a1206;
  --energy-soft: #1e1a12;
  --energy-line: #3a2c0e;
  --info: #6cb4ee;
  --info-text: #8cc6f2;
  --info-soft: #14202c;
  --danger: #f06a5a;
  --danger-soft: #2a1715;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --r-badge: 4px;
  --r-field: 8px;
  --r-card: 10px;
  --r-sheet: 14px;

  --top: 56px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 400 14px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--energy); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--energy); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); }
svg { flex-shrink: 0; }

/* ---------------------------------------------------------------- shell */

.app { min-height: 100dvh; }
.sidebar { display: none; }
.aside { display: none; }
#main { min-width: 0; padding-bottom: calc(var(--tabbar) + var(--safe-b) + 24px); }

.topbar {
  /* In the installed app on iPhone the status bar is see-through: keep the bar below it. */
  position: sticky; top: 0; z-index: 20; height: calc(var(--top) + var(--safe-t)); padding-top: var(--safe-t);
  padding-left: max(4px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 4px;
  background: var(--side); border-bottom: 1px solid var(--line);
}
.topbar .title { flex: 1; min-width: 0; font: 700 17px var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb { flex: 1; min-width: 0; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand { flex: 1; display: flex; align-items: center; gap: 10px; padding-left: 10px; font: 700 18px var(--font-display); color: var(--text); text-decoration: none; }

.mark { width: 30px; height: 30px; border-radius: 8px; background: var(--energy); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

.iconbtn {
  width: 44px; height: 44px; flex-shrink: 0; border: none; border-radius: var(--r-field); background: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none;
}
.iconbtn:hover { background: var(--raised); }
.iconbtn.on { color: var(--energy-hover); }
.langbtn { min-width: 44px; height: 44px; border: none; background: none; color: var(--muted); font-weight: 600; font-size: 13px; border-radius: var(--r-field); }
.langbtn:hover { color: var(--text); background: var(--raised); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--side); border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; }
.tabbar a[aria-current="page"] { color: var(--energy-hover); font-weight: 600; }

.page { padding: 16px; display: flex; flex-direction: column; gap: 22px; max-width: 760px; margin: 0 auto; }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
  .app.with-aside { grid-template-columns: 264px minmax(0, 1fr) 480px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; overflow-y: auto;
    background: var(--side); border-right: 1px solid var(--line);
  }
  #main { overflow-y: auto; padding-bottom: 32px; position: relative; }
  #main.fill { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
  .aside { display: block; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); }
  .tabbar { display: none; }
  .topbar.phone { display: none; }
  .page { padding: 28px 32px; }
}

/* ---------------------------------------------------------------- sidebar */

.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; color: var(--text); }
.side-brand .home { flex: 1; display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 700 18px var(--font-display); white-space: nowrap; }
.side-brand .langbtn { min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--border); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.navitem {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--r-field);
  color: var(--muted); text-decoration: none; font-weight: 500; border: 1px solid transparent;
}
.navitem:hover { color: var(--text); background: #1a1d23; }
.navitem[aria-current="page"] { background: var(--raised); color: var(--text); }
.navitem[aria-current="page"] svg { color: var(--energy); }
.navitem .count { margin-left: auto; font: 400 11px var(--font-mono); color: var(--dim); }
.lineitem { height: 38px; padding: 0 10px; gap: 10px; color: var(--text); }
.lineitem.active { border-color: var(--energy); background: var(--energy-soft); }
.lineitem .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.label { margin: 0; font: 600 11px/1.2 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.sidebar .label { padding: 0 12px 4px; }

/* ---------------------------------------------------------------- controls */

.field {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px;
  border-radius: var(--r-field); border: 1px solid var(--border); background: var(--bg); color: var(--dim);
}
.field:focus-within { border-color: var(--energy); }
.field input { flex: 1; min-width: 0; height: 100%; background: none; border: none; outline: none; color: var(--text); font-size: 16px; }
.field input::-webkit-search-cancel-button { display: none; }
.field kbd { font: 500 11px var(--font-mono); padding: 1px 6px; border: 1px solid var(--border); border-radius: var(--r-badge); }
.sidebar .field { height: 40px; }
.sidebar .field input { font-size: 14px; }
.clear { width: 28px; height: 28px; border: none; border-radius: 999px; background: var(--track); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }

.btn {
  height: 44px; padding: 0 18px; border-radius: var(--r-field); border: 1px solid var(--border); background: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--text); font-weight: 500; text-decoration: none;
}
.btn:hover { background: var(--raised); }
.btn-primary { border: none; background: var(--energy); color: var(--energy-ink); font-weight: 600; }
.btn-primary:hover { background: var(--energy-hover); }
.btn-quiet { border-color: transparent; color: var(--energy); padding: 0; height: 40px; font-weight: 600; }
.btn-quiet:hover { background: none; color: var(--energy-hover); }

.seg { display: inline-flex; padding: 3px; border-radius: var(--r-field); background: var(--bg-deep); border: 1px solid var(--line); }
.seg button, .seg a { text-decoration: none; height: 34px; padding: 0 12px; border: none; border-radius: 6px; background: none; color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; }
.seg [aria-pressed="true"] { background: var(--raised); color: var(--text); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  text-decoration: none;
  height: 32px; padding: 0 12px; flex-shrink: 0; border-radius: 999px; border: 1px solid var(--border); background: none;
  color: var(--text-2); font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--energy-soft); border-color: var(--energy); color: var(--energy-hover); }

.tag { display: inline-block; height: 20px; padding: 0 6px; border-radius: var(--r-badge); font: 600 11px/20px var(--font-ui); letter-spacing: .04em; white-space: nowrap; }
.tag-main { background: var(--energy-soft); color: var(--energy-hover); }
.tag-soft { background: var(--raised); color: var(--text-2); }
.tag-wiki { background: #14243a; color: var(--info-text); }
.tier { width: 40px; height: 24px; flex-shrink: 0; border-radius: var(--r-badge); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font: 600 10px var(--font-ui); }
.tag-tier { border: 1px solid var(--border); line-height: 18px; }

/* ---------------------------------------------------------------- cards and rows */

.card { border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); }
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.row:hover .row-title { text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font: 600 15px/1.25 var(--font-ui); color: var(--text); }
.row-title.main { font-weight: 700; }
.row-meta { font-size: 12px; color: var(--muted); }
.card .row { padding: 0 14px; border-bottom: none; border-top: 1px solid var(--line); min-height: 56px; }
.card .row:first-child { border-top: none; }
.count { font: 400 12px var(--font-mono); color: var(--dim); }

.continue { display: flex; align-items: center; gap: 12px; padding: 14px; text-decoration: none; color: inherit; }
.topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.topic { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; min-height: 64px; text-decoration: none; color: inherit; }
.topic .t { font-weight: 600; line-height: 1.3; }
@media (min-width: 700px) { .topics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- item slot */

.slot {
  position: relative; width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--r-badge);
  background: var(--slot); border: 1px solid var(--border); box-shadow: inset 0 2px 0 rgba(0, 0, 0, .45);
  display: inline-flex; align-items: center; justify-content: center;
  font: 500 10px var(--font-mono); color: var(--muted); padding: 0;
}
.slot.main { border-color: var(--energy); color: var(--energy-hover); }
.slot.big { width: 56px; height: 56px; border-width: 2px; border-radius: 6px; font-size: 12px; }
.slot.opt { border-style: dashed; border-color: #5b6372; }
.ic { display: block; width: 32px; height: 32px; flex-shrink: 0; background-size: 512px 512px; background-repeat: no-repeat; image-rendering: pixelated; }
.slot .cnt { z-index: 1; position: absolute; right: 2px; bottom: 0; font: 500 11px/1 var(--font-mono); color: var(--text); text-shadow: 1px 1px 0 #000; }
.slot.grid48 { width: 48px; height: 48px; }

/* ---------------------------------------------------------------- quest */

.quest { display: flex; flex-direction: column; gap: 24px; }
.quest-head { display: flex; gap: 14px; align-items: center; }
.quest-head h1 { margin: 0; font: 700 26px/1.15 var(--font-display); }
.quest-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.qchip {
  min-height: 36px; padding: 6px 12px; border-radius: var(--r-field); background: var(--surface); border: 1px solid var(--line);
  display: inline-flex; align-items: center; text-decoration: none; font-weight: 600; font-size: 13px; color: var(--text);
}
.qchip:hover { border-color: var(--border); }
.h2 { margin: 0; font: 700 20px var(--font-display); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.desc { font-size: 16px; line-height: 1.62; color: var(--text-2); overflow-wrap: anywhere; }
.desc p { margin: 0 0 14px; }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.desc.clamp p { display: inline; }
.desc p:last-child { margin-bottom: 0; }
.desc a { color: var(--info-text); }
.desc a.qlink { color: var(--energy); }
.callout { display: flex; gap: 12px; padding: 14px 16px; margin: 0 0 14px; border-radius: var(--r-field); font-size: 14px; line-height: 1.55; }
.callout::before { content: ""; width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.callout p { margin: 0; }
.callout.note { background: var(--info-soft); color: #cfe6f8; }
.callout.note::before { color: var(--info); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E"); }
.callout.warn { background: var(--danger-soft); color: #f6c9c2; }
.callout.warn::before { color: var(--danger); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 20h20z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E"); }

.linkcard { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: inherit; }
.linkcard .ic { width: 36px; height: 36px; border-radius: 8px; background: #14243a; display: inline-flex; align-items: center; justify-content: center; color: var(--info-text); }

.task { padding: 6px 14px 4px; }
.task-head { display: flex; align-items: center; gap: 8px; min-height: 30px; flex-wrap: wrap; }
.task-head .hint { font-size: 12px; color: var(--dim); }
.irow { display: flex; align-items: center; gap: 12px; min-height: 56px; border-top: 1px solid var(--line); }
.irow .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.irow .nm b { font: 600 15px/1.3 var(--font-ui); color: var(--text); overflow-wrap: anywhere; }
.irow .nm b.raw { font: 500 13px var(--font-mono); color: var(--text-2); }
.irow .nm small { font: 400 11px var(--font-mono); color: var(--dim); overflow-wrap: anywhere; }
.irow .n { font: 500 14px var(--font-mono); color: var(--text-2); white-space: nowrap; }
.or { font-size: 12px; color: var(--dim); padding: 2px 0 2px 52px; border-top: 1px solid var(--line); }

.v-obtain { color: var(--text); } .v-optional { color: var(--muted); } .v-craft { color: #f5b041; }
.v-read { color: var(--info-text); } .v-kill { color: #f28b7d; } .v-visit { color: #7ee08a; } .v-fluid { color: #6fe3e3; }

.idline { margin: 0; font: 400 11px var(--font-mono); color: var(--dim); overflow-wrap: anywhere; }

/* Minecraft formatting codes, tuned for the dark surface. */
.mc0 { color: #8b929e; } .mc1 { color: #8c9bff; } .mc2 { color: #4fc26a; } .mc3 { color: #3fc1c1; }
.mc4 { color: #ef7676; } .mc5 { color: #c58af0; } .mc6 { color: #f5b041; } .mc7 { color: #b7bdc7; }
.mc8 { color: #8b929e; } .mc9 { color: #7aa2ff; } .mca { color: #7ee08a; } .mcb { color: #6fe3e3; }
.mcc { color: #f28b7d; } .mcd { color: #f39be0; } .mce { color: #f2df6b; } .mcf { color: #e8eaed; }
.b { font-weight: 700; } .i { font-style: italic; } .u { text-decoration: underline; } .s { text-decoration: line-through; }

/* ---------------------------------------------------------------- quest line */

.line-head { display: flex; flex-direction: column; gap: 14px; }
.line-tools { display: flex; align-items: center; gap: 8px; }
.line-tools .spacer { flex: 1; }
.desk-head { display: none; }
@media (min-width: 1024px) {
  .desk-head { display: flex; align-items: center; gap: 14px; height: 64px; flex-shrink: 0; padding: 0 20px; border-bottom: 1px solid var(--line); }
  .desk-head h1 { margin: 0; font: 700 20px var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .desk-head .count { white-space: nowrap; }
  .desk-head .spacer { flex: 1; }
}

.map-box { position: relative; height: calc(100dvh - var(--top) - var(--tabbar) - var(--safe-b) - 150px); min-height: 360px; border-top: 1px solid var(--line); }
@media (min-width: 1024px) { .map-box { flex: 1; height: auto; min-height: 0; border-top: none; } }
.map-wrap {
  position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  background-color: var(--map);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
.map-wrap.dragging { cursor: grabbing; }
.map { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.map svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.node {
  position: absolute; padding: 0; border-radius: var(--r-badge); background: var(--slot); border: 1px solid #3a404c;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center;
  font: 500 9px var(--font-mono); color: var(--dim); text-decoration: none; -webkit-user-drag: none;
}
.node.main { border: 2px solid #a8761e; }
.node.sel { border: 2px solid var(--energy); box-shadow: 0 0 0 4px var(--energy-line), inset 0 2px 0 rgba(0, 0, 0, .45); z-index: 2; }
.node:hover { border-color: var(--energy-hover); z-index: 3; }
.node.dim { opacity: .35; }
/* Labels keep their size whatever the zoom (--inv = 1 / zoom). */
.node .tip {
  display: none; position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%) scale(var(--inv, 1)); transform-origin: 50% 100%;
  padding: 4px 8px; border-radius: 6px; background: var(--raised); border: 1px solid var(--border);
  font: 700 12px var(--font-ui); color: var(--text); white-space: nowrap; pointer-events: none;
}
.map-wrap:not(.dragging) .node:hover .tip, .node.sel .tip { display: block; }
.map-ctl { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; border-radius: var(--r-field); border: 1px solid var(--border); background: var(--surface); overflow: hidden; z-index: 5; }
.map-ctl button { width: 40px; height: 40px; border: none; background: none; color: var(--text); font-size: 18px; display: flex; align-items: center; justify-content: center; }
.map-ctl button + button { border-top: 1px solid var(--line); }
.map-hint { position: absolute; left: 16px; bottom: 12px; margin: 0; font-size: 12px; color: var(--dim); pointer-events: none; }
@media (max-width: 1023px) { .map-hint { display: none; } }

/* Desktop list view: the list and a wide reading column side by side. */
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
.split-list { overflow-y: auto; border-right: 1px solid var(--line); padding-bottom: 24px; }
.split-read { overflow-y: auto; }
.split-read .page.read { max-width: 820px; padding: 28px 40px 48px; margin: 0; }
.row[aria-current="true"] { background: var(--raised); margin: 0 -16px; padding: 0 16px; border-radius: 0; }

/* ---------------------------------------------------------------- aside */

.aside .quest { padding: 24px; }
.aside .quest-head h1 { font-size: 24px; }
.aside-empty { padding: 32px 24px; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ---------------------------------------------------------------- search */

.searchbar { flex: 1; height: 44px; border-width: 2px; border-color: var(--energy); }
mark { background: var(--energy-line); color: var(--energy-hover); border-radius: 2px; padding: 0 1px; }
.result { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.result .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.result .x { font-size: 13px; line-height: 1.5; color: var(--muted); }
.empty { padding: 24px 0; color: var(--muted); line-height: 1.6; }

/* ---------------------------------------------------------------- wiki */

.wiki-layout { display: flex; gap: 40px; align-items: flex-start; }
.wiki-layout article { flex: 1; min-width: 0; max-width: 780px; }
.wiki-rail { display: none; }
@media (min-width: 1280px) {
  .wiki-rail { display: flex; flex-direction: column; gap: 22px; width: 240px; flex-shrink: 0; position: sticky; top: 28px; }
}
.wiki-title { margin: 0 0 16px; font: 700 28px/1.15 var(--font-display); }
@media (min-width: 1024px) { .wiki-title { font-size: 34px; } }
.crumbs { font-size: 13px; color: var(--dim); margin-bottom: 8px; }
.toc a { display: block; padding: 6px 0 6px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; font-size: 14px; }
.toc a.l2 { padding-left: 24px; font-size: 13px; }
.toc a:hover { color: var(--text); border-left-color: var(--energy); }
.toc-inline { margin: 0 0 18px; }
.toc-inline summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; padding: 0 14px; font-weight: 600; list-style: none; }
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline .toc { padding: 0 14px 12px; }
@media (min-width: 1280px) { .toc-inline { display: none; } }

.wiki { font-size: 16px; line-height: 1.65; color: var(--text-2); overflow-wrap: anywhere; }
.wiki::after { content: ""; display: block; clear: both; }
.wiki p { margin: 0 0 14px; }
.wiki h2, .wiki h3, .wiki h4 { color: var(--text); font-family: var(--font-display); margin: 26px 0 10px; line-height: 1.25; scroll-margin-top: calc(72px + var(--safe-t)); }
.wiki h2 { font-size: 22px; } .wiki h3 { font-size: 18px; } .wiki h4 { font-size: 16px; }
.wiki a { color: var(--info-text); }
.wiki a.ext::after { content: " ↗"; font-size: .8em; color: var(--dim); }
.wiki b, .wiki strong { color: var(--text); }
.wiki ul, .wiki ol { padding-left: 22px; margin: 0 0 14px; }
.wiki li { margin: 4px 0; }
.wiki img { max-width: 100%; height: auto; vertical-align: middle; }
.wiki code, .wiki pre { font-family: var(--font-mono); font-size: 13px; background: var(--bg-deep); border-radius: 6px; }
.wiki code { padding: 1px 5px; }
.wiki pre { padding: 12px; overflow-x: auto; }
.wiki blockquote { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r-field); background: var(--surface); }
.wiki hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.wiki .table-wrap { overflow-x: auto; margin: 0 0 16px; border-radius: var(--r-card); border: 1px solid var(--line); }
.wiki table { border-collapse: collapse; font-size: 14px; line-height: 1.4; min-width: 100%; }
.wiki th, .wiki td { padding: 8px 12px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.wiki th { background: var(--surface); color: var(--muted); font-weight: 600; }
.wiki tr:first-child > * { border-top: none; }
.wiki caption { padding: 8px 12px; color: var(--muted); text-align: left; }
.wiki .thumb, .wiki figure:not(.pi-item) { margin: 0 0 14px; padding: 8px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); display: table; }
.wiki .thumbcaption, .wiki figcaption { font-size: 13px; color: var(--muted); padding-top: 6px; }
.wiki .gallery { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.wiki sup.reference { font-size: 11px; }

.portable-infobox {
  margin: 0 0 18px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); overflow: hidden; font-size: 14px; line-height: 1.4;
}
@media (min-width: 700px) { .portable-infobox { float: right; width: 280px; margin: 0 0 18px 24px; } }
.portable-infobox .pi-title { margin: 0; padding: 12px 14px; font: 700 16px var(--font-display); color: var(--text); }
.portable-infobox .pi-image { margin: 0; padding: 12px; display: flex; justify-content: center; background-color: var(--map);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 16px 16px; }
.portable-infobox .pi-header { margin: 0; padding: 8px 14px; font: 600 11px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); border-top: 1px solid var(--line); }
.portable-infobox .pi-data { display: grid; grid-template-columns: 112px 1fr; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); }
.portable-infobox .pi-data-label { margin: 0; font: 400 14px var(--font-ui); color: var(--dim); }
.portable-infobox .pi-data-value { color: var(--text); font-weight: 500; }
.portable-infobox .pi-data-value p { margin: 0; }
.portable-infobox .pi-caption { padding: 0 14px 10px; font-size: 12px; color: var(--muted); }

.attrib { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--dim); }
.attrib a { color: var(--info-text); }
.questcard { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 18px; border-radius: var(--r-card); background: var(--energy-soft); border: 1px solid var(--energy-line); text-decoration: none; color: inherit; }
.wq { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-field); background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.wq .slot { width: 32px; height: 32px; font-size: 9px; }
.cats { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- misc */

.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.notice { padding: 14px 16px; border-radius: var(--r-field); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; line-height: 1.55; }
.footer-note { font: 400 11px var(--font-mono); color: var(--dim); text-align: center; padding: 8px 0 0; }
.az { display: flex; flex-wrap: wrap; gap: 4px; }
.az a { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 13px; }
.az a:hover { background: var(--raised); }
