:root {
  --ink: #172628;
  --ink-soft: #536264;
  --page: #f2e6c8;
  --page-deep: #e8d7ad;
  --frame: #10282a;
  --frame-soft: #19383a;
  --gold: #c79a43;
  --gold-soft: #d4b66d;
  --line: rgba(91, 70, 32, .28);
  --shadow: 0 18px 48px rgba(4, 17, 18, .22);
  --radius: 18px;
  --core: #2c7378;
  --fl: #85803f;
  --mom: #58788e;
  --sr: #755f88;
  --utp: #a87534;
  --soc: #984e5b;
  --dl: #4d7897;
  --cir: #875b49;
  --mon: #4f4f5e;
}

@font-face {
  font-family: 'EldritchHorrorIcons';
  src: url('./assets/fonts/eldritch-horror-icons.woff2?v=18') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'TypicalWriter';
  src: url('./assets/fonts/TypicalWriter-G3LO.ttf?v=1') format('truetype');
  font-display: swap;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 118px; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--frame);
  font-family: 'TypicalWriter', Georgia, 'Times New Roman', serif;
  line-height: 1.58;
  text-rendering: optimizeLegibility;
}
body.dark-reading {
  --page: #162d2f;
  --page-deep: #1b3536;
  --ink: #efe6cf;
  --ink-soft: #b8c0bb;
  --line: rgba(220, 197, 145, .18);
  --shadow: 0 18px 48px rgba(0,0,0,.35);
}
a { color: #2b6f73; text-decoration-thickness: 1px; text-underline-offset: 3px; }
body.dark-reading a { color: #9cc7c8; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 1000;
  background: white; color: #111; padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  padding: 12px max(18px, calc((100vw - 1640px) / 2));
  background: color-mix(in srgb, var(--frame) 94%, transparent);
  border-bottom: 1px solid rgba(226, 202, 147, .14);
  backdrop-filter: blur(12px);
}
.masthead { display: grid; grid-template-columns: 238px minmax(280px, 1fr) 330px; align-items: start; gap: 18px; }
.brand { display: inline-flex; align-items: center; min-width: 0; color: #f4ead3; text-decoration: none; }
.brand-lockup { display: grid; gap: 3px; min-width: 0; }
.brand-wordmark { display: block; width: auto; height: 46px; mix-blend-mode: screen; filter: brightness(1.24) contrast(1.08); }
.brand small { display: block; color: #b9b29e; font-family: system-ui, sans-serif; font-size: 11px; letter-spacing: .11em; text-transform: uppercase; }
.header-center { display: grid; gap: 7px; width: min(760px, 100%); min-width: 0; justify-self: center; }
.header-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
.quiet-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid rgba(235, 218, 174, .22); background: rgba(255,255,255,.03); color: #dfd5bc;
  border-radius: 9px; padding: 7px 11px; text-decoration: none; font-family: system-ui, sans-serif; font-size: 12px; cursor: pointer;
}
.quiet-button.icon-button { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.quiet-button:hover, .quiet-button:focus-visible { border-color: var(--gold); color: white; outline: none; }
.button-icon, .mobile-toggle svg, .mobile-search-button svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.search-shell {
  position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; align-items: center;
  width: 100%; margin: 0; border: 1px solid rgba(231, 213, 168, .28); border-radius: 12px;
  background: #f7eed9; box-shadow: 0 7px 22px rgba(0,0,0,.18); overflow: hidden;
}
.search-icon { width: 18px; height: 18px; margin-left: 15px; fill: none; stroke: #5d6a67; stroke-width: 1.8; }
.search-shell input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 12px 14px; background: transparent; color: #18282a; font-family: system-ui, sans-serif; font-size: 15px; }
.search-shell kbd { color: #6b756f; border: 1px solid #cfc2a6; border-bottom-width: 2px; border-radius: 5px; font: 11px/1 system-ui, sans-serif; padding: 4px 7px; margin-right: 7px; }
.clear-search { border: 0; border-left: 1px solid #ded2b8; background: transparent; color: #6a6f67; font: 12px system-ui, sans-serif; height: 100%; padding: 0 13px; cursor: pointer; opacity: 0; pointer-events: none; }
.search-shell.has-query .clear-search { opacity: 1; pointer-events: auto; }
.mobile-search-shell.has-query .clear-search { opacity: 1; pointer-events: auto; }

.filter-bar { display: flex; align-items: center; justify-content: flex-start; gap: 7px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 0 2px 2px; }
.filter-bar::-webkit-scrollbar { display: none; }
.expansion-filter { display: flex; flex: 0 0 auto; justify-content: flex-start; gap: 5px; padding: 0; }
.expansion-filter::-webkit-scrollbar { display: none; }
.filter-chip, .badge {
  border: 0; color: white; border-radius: 999px; font: 700 10px/1 system-ui, sans-serif; letter-spacing: .03em;
  padding: 6px 10px; white-space: nowrap;
}
.filter-chip { cursor: pointer; opacity: .38; filter: grayscale(.45); outline: 1px solid transparent; outline-offset: 2px; }
.filter-chip:hover { opacity: 1; }
.filter-chip.active { opacity: 1; filter: none; outline-color: #f5e7c4; }
.filter-chip.all { background: #efe2c4; color: #243638; }
.filter-chip.locked { cursor: default; opacity: 1; filter: none; }
.filter-chip.not-owned { color: rgba(255,255,255,.68); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.exp-core { background: var(--core); }.exp-fl { background: var(--fl); }.exp-mom { background: var(--mom); }.exp-sr { background: var(--sr); }
.exp-utp { background: var(--utp); }.exp-soc { background: var(--soc); }.exp-dl { background: var(--dl); }.exp-cir { background: var(--cir); }.exp-mon { background: var(--mon); }
.collection-toggle {
  border: 1px solid rgba(235, 218, 174, .2); border-radius: 999px; color: white;
  font: 800 10px/1 system-ui, sans-serif; letter-spacing: .03em; padding: 6px 9px;
  cursor: pointer; white-space: nowrap;
}
.collection-toggle:hover,
.collection-toggle:focus-visible { opacity: 1; border-color: rgba(245, 231, 196, .75); outline: none; }
.collection-toggle { background: rgba(255,255,255,.035); color: #f3e8cf; }
.collection-toggle[aria-pressed="false"] { color: #d4d0c2; border-style: dashed; }

.app-shell {
  width: min(1640px, 100%); margin: 0 auto;
  display: grid; grid-template-columns: 238px minmax(0, 1fr) 330px; gap: 18px;
  padding: 18px;
  align-items: start;
}
.toc-panel, .results-panel { color: #d7d4c8; font-family: system-ui, sans-serif; font-size: 13px; }
.toc-panel { position: sticky; top: 116px; max-height: calc(100vh - 134px); overflow: auto; padding: 9px 0 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; text-transform: uppercase; letter-spacing: .11em; font-weight: 750; font-size: 11px; color: #a8afaa; margin: 0 10px 8px; }
.toc-nav { display: grid; gap: 2px; }
.toc-group { display: grid; gap: 1px; min-width: 0; }
.toc-link { color: #bfc3ba; text-decoration: none; padding: 7px 10px; border-radius: 8px; line-height: 1.25; border-left: 2px solid transparent; }
.toc-sublink { color: #9fb2ad; text-decoration: none; margin-left: 9px; padding: 5px 9px; border-radius: 7px; border-left: 2px solid rgba(199,154,67,.22); font-size: 11.5px; line-height: 1.25; }
.toc-link:hover, .toc-sublink:hover { background: rgba(255,255,255,.05); color: white; }
.toc-link.active, .toc-sublink.active { background: rgba(199,154,67,.09); border-left-color: var(--gold); color: #f2e7cc; }
.toc-footer { margin: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; color: #aab0aa; line-height: 1.45; font-size: 11px; }
.toc-footer p { margin: 0 0 10px; }
.muted { opacity: .72; }
kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mobile-toggle { display: none; }

.reference {
  min-width: 0; background: var(--page); border-radius: 22px; box-shadow: var(--shadow); overflow: clip;
  border: 1px solid rgba(228, 208, 155, .45);
}
.intro-note { margin: 0; padding: 18px clamp(22px, 5vw, 64px); border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 15px; }
.intro-note strong { color: var(--ink); }

.reference-section { padding: 54px clamp(22px, 5vw, 64px); border-bottom: 1px solid var(--line); scroll-margin-top: 118px; }
.reference-section[hidden],
.entry[hidden] { display: none; }
.reference-section:last-child { border-bottom: 0; }
.section-heading { border: 1.5px solid currentColor; border-radius: 14px; padding: 13px 16px; margin-bottom: 28px; display: flex; gap: 14px; align-items: center; color: var(--ink); box-shadow: inset 0 -1px 0 rgba(199,154,67,.7); }
.section-icon { width: 40px; height: 40px; border: 1.5px solid #2c7378; color: #2c7378; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; font-family: 'EldritchHorrorIcons', system-ui, sans-serif; font-size: 24px; line-height: 1; }
.section-heading h2 { margin: 0; font-size: clamp(27px, 3vw, 40px); line-height: 1.08; }
.section-kicker { margin-left: auto; font: 700 10px/1.2 system-ui, sans-serif; color: var(--ink-soft); letter-spacing: .12em; text-transform: uppercase; text-align: right; }

.entry { position: relative; padding: 4px 0 26px; scroll-margin-top: 122px; }
.entry + .entry { padding-top: 4px; }
.entry h3 { margin: 0 0 8px; color: #286d71; font: 750 clamp(20px, 2.2vw, 25px)/1.2 system-ui, sans-serif; letter-spacing: -.01em; }
body.dark-reading .entry h3 { color: #8cc2c3; }
.entry p { margin: 0 0 12px; }
.entry ul { padding-left: 22px; margin: 8px 0 12px; }
.entry li { margin: 4px 0; }
.entry-anchor { opacity: 0; margin-left: 7px; color: var(--ink-soft); text-decoration: none; font-size: 13px; vertical-align: middle; }
.entry h3:hover .entry-anchor, .entry-anchor:focus { opacity: .8; }
.entry-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 9px; }
.badge { display: inline-flex; align-items: center; }
.entry.flash { animation: targetFlash 1.3s ease-out; }
@keyframes targetFlash { 0%{ background: rgba(199,154,67,.22); box-shadow: 0 0 0 12px rgba(199,154,67,.08);} 100%{ background: transparent; box-shadow: none;} }
:target { scroll-margin-top: 122px; }
mark.search-mark { background: #e3bd66; color: #18282a; padding: 0 .08em; border-radius: 2px; }

.callout { margin: 16px 0 4px; border-left: 4px solid var(--gold); background: color-mix(in srgb, var(--page-deep) 66%, transparent); padding: 13px 15px; border-radius: 0 10px 10px 0; }
.callout strong { display: block; color: var(--ink); font: 800 11px/1.2 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 5px; }
.callout p { margin: 0; }.callout.danger { border-left-color: #9c544d; }.callout.soc-accent { border-left-color: var(--soc); }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-family: system-ui, sans-serif; font-size: 12px; }
.component-icon-grid { display: grid; gap: 22px; margin-top: 14px; }
.component-group { display: grid; gap: 10px; }
.component-group h4 { margin: 0; color: var(--ink); font: 850 12px/1.2 system-ui, sans-serif; letter-spacing: .11em; text-transform: uppercase; }
.component-group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.component-icon-card { position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 78px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--page-deep) 30%, transparent); }
.component-icon-card.component-card-wide { grid-template-columns: 84px minmax(0, 1fr); }
.component-icon-card.component-card-card { grid-template-columns: 70px minmax(0, 1fr); }
.component-icon-card:hover,
.component-icon-card:focus-within { z-index: 6; }
.component-icon-card strong { display: block; color: var(--ink); font: 800 12px/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.component-icon-card span { display: block; margin-top: 3px; color: var(--ink-soft); font: 700 10px/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.component-icon-card p { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.35; }
.component-art { position: relative; width: 48px; height: 48px; display: inline-grid; place-items: center; border: 0; padding: 0; border-radius: 50%; color: #f9efd5; background: #2c7378; box-shadow: inset 0 0 0 1px rgba(255,255,255,.26), 0 3px 12px rgba(20,33,34,.14); overflow: hidden; vertical-align: middle; cursor: default; }
.component-art.has-image { cursor: zoom-in; }
.component-shape-wide { width: 78px; border-radius: 6px; }
.component-shape-card { width: 58px; height: 72px; border-radius: 6px; }
.component-art:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.component-art svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.component-art img { grid-area: 1 / 1; display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; border-radius: 4px; transition: transform .18s ease, filter .18s ease, box-shadow .18s ease; }
.component-art svg { grid-area: 1 / 1; }
.component-art.has-image { background: transparent; box-shadow: none; border-radius: 4px; overflow: visible; }
.component-art.has-image img { opacity: 1; }
.component-icon-card:hover .component-art.has-image img,
.component-icon-card:focus-within .component-art.has-image img { transform: scale(2.55); filter: saturate(1.08) contrast(1.04); box-shadow: 0 18px 42px rgba(24, 31, 28, .38); }
.component-art.has-image svg { display: none; }
.component-gate { background: #342f71; }.component-doom { background: #8b3f43; }.component-omen { background: #486b39; }
.component-monster { background: #552b30; }.component-focus { background: #58788e; }.component-resource { background: #9a6a2d; }
.component-eldritch { background: #6a4f86; }.component-mystery { background: #355f62; }.component-expedition { background: #927534; }
.component-dream-portal { background: #4d7897; }.component-devastation { background: #875b49; }.component-improvement { background: #367653; }
.component-impairment { background: #984e5b; }
.component-preview[hidden] { display: none; }
.component-preview { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 22px; }
.component-preview-backdrop { position: absolute; inset: 0; border: 0; background: rgba(9, 20, 21, .76); backdrop-filter: blur(3px); cursor: zoom-out; }
.component-preview-panel { position: relative; display: grid; justify-items: center; gap: 12px; width: min(680px, calc(100vw - 32px)); padding: 18px; border: 1px solid rgba(239, 226, 196, .26); border-radius: 8px; background: var(--page); color: var(--ink); box-shadow: 0 26px 70px rgba(0,0,0,.44); transform: scale(.97); opacity: 0; transition: transform .14s ease, opacity .14s ease; }
.component-preview.open .component-preview-panel { transform: scale(1); opacity: 1; }
.component-preview-panel img { display: block; width: min(520px, 82vw); max-height: 72vh; object-fit: contain; image-rendering: auto; }
.component-preview-panel strong { font: 800 13px/1.2 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.component-preview-close { justify-self: end; border: 1px solid var(--line); border-radius: 7px; background: color-mix(in srgb, var(--page-deep) 54%, transparent); color: var(--ink); padding: 6px 9px; font: 700 11px/1 system-ui, sans-serif; cursor: pointer; }
.component-preview-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.component-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--page-deep) 24%, transparent); }
.component-strip .component-art { flex: 0 0 auto; }
.component-strip .component-art.has-image { overflow: hidden; }
.component-strip .component-shape-wide { width: 88px; }
.component-strip .component-shape-card { height: 78px; }
.phase-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.phase-list li { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 12px; align-items: start; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--page-deep) 28%, transparent); }
.phase-list li > span { width: 32px; height: 32px; border: 1px solid var(--gold); color: #8f6725; border-radius: 50%; display: grid; place-items: center; font: 800 12px system-ui, sans-serif; }
.phase-list p { margin: 2px 0 0; color: var(--ink-soft); }
.step-list { display: grid; gap: 9px; margin: 12px 0; }
.step-list > div { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 12px; align-items: start; }
.step-list > div > span { color: #8e6729; font: 800 12px system-ui, sans-serif; border: 1px solid var(--gold); border-radius: 7px; text-align: center; padding: 5px 4px; }
.step-list p { margin: 0; }.step-list.compact { gap: 7px; }
.priority-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 15px 0; }
.priority-grid > div { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.priority-grid strong { font-family: system-ui, sans-serif; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.priority-grid p { color: var(--ink-soft); margin: 5px 0 0; font-size: 14px; }
.key-additions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin: 13px 0; }
.key-additions strong { font: 800 10px system-ui, sans-serif; letter-spacing: .09em; text-transform: uppercase; margin-right: 3px; }
.key-additions span { font: 650 11px system-ui, sans-serif; border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; background: color-mix(in srgb, var(--page-deep) 38%, transparent); }
.related-links { font-family: system-ui, sans-serif; font-size: 13px; }
.faq-list { display: grid; gap: 7px; margin: 14px 0; padding-left: 19px; }
.faq-list li { padding-left: 2px; color: var(--ink-soft); line-height: 1.45; }
.faq-list strong { color: var(--ink); font: 780 12px/1.25 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.cheat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.cheat-grid > div { border: 1px solid var(--line); border-radius: 10px; padding: 13px; }
.cheat-grid strong { font: 800 12px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.cheat-grid p { margin: 6px 0; }.cheat-grid small { color: var(--ink-soft); font-family: system-ui, sans-serif; }
.limits-table { display: grid; gap: 5px; }
.limits-table > div { display: grid; grid-template-columns: 160px 100px 1fr; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding: 8px 0; }
.limits-table strong, .limits-table span { font-family: system-ui, sans-serif; }.limits-table p { margin: 0; color: var(--ink-soft); }
.mechanic-map { display: grid; gap: 6px; }.mechanic-map > div { display: grid; grid-template-columns: 58px 1fr; gap: 12px; align-items: center; }.mechanic-map p { margin: 0; }
.setup-matrix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.setup-matrix > div { border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: color-mix(in srgb, var(--page-deep) 24%, transparent); }
.setup-matrix strong { display: inline-block; margin: 0 7px 6px 0; color: var(--ink); font: 800 12px/1.25 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.setup-matrix p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.45; }
.setup-matrix .component-strip { max-width: 100%; margin-top: 10px; padding: 8px; gap: 8px; overflow: hidden; }
.setup-matrix .component-art { width: 40px; height: 40px; }
.setup-matrix .component-shape-wide { width: 68px; height: 40px; }
.setup-matrix .component-shape-card { width: 42px; height: 54px; }
.trigger-table { display: grid; gap: 0; margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.trigger-table > div { display: grid; grid-template-columns: minmax(150px, .85fr) minmax(170px, 1fr) minmax(220px, 1.45fr); gap: 12px; align-items: start; padding: 10px 12px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--page-deep) 16%, transparent); }
.trigger-table > div:first-child { border-top: 0; background: color-mix(in srgb, var(--page-deep) 40%, transparent); }
.trigger-table strong { color: var(--ink); font: 850 11px/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.trigger-table span { color: var(--ink); font: 780 12px/1.3 system-ui, sans-serif; }
.trigger-table p { margin: 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.35; }
.investigator-table > div { grid-template-columns: minmax(130px, .8fr) minmax(130px, .8fr) minmax(170px, 1fr) minmax(260px, 1.55fr); }
.investigator-table .stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; margin: 3px 0 6px; color: var(--ink-soft); font: inherit; }
.investigator-table .stat-grid span { color: var(--ink-soft); font: inherit; letter-spacing: 0; text-transform: none; }
.player-aid { margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: color-mix(in srgb, var(--page-deep) 20%, transparent); }
.aid-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 11px; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.aid-title strong { font: 850 14px/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.aid-title span { color: var(--ink-soft); font: 700 11px/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.aid-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.aid-grid section { border: 1px solid var(--line); border-radius: 7px; padding: 10px; background: color-mix(in srgb, var(--page-deep) 18%, transparent); }
.aid-grid h4 { margin: 0 0 6px; font: 850 11px/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.aid-grid p { margin: 5px 0; font-size: 12.5px; line-height: 1.35; color: var(--ink-soft); }
.external-aids { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.external-aids section { border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: color-mix(in srgb, var(--page-deep) 18%, transparent); }
.external-aids .external-aid-feature { grid-column: 1 / -1; }
.external-aids strong { color: var(--ink); font: 850 12px/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.external-aids p { margin: 8px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.external-aids a { font-family: system-ui, sans-serif; }
.mythos-vendor-frame { margin: 14px 0 2px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #0b1d1e; }
.mythos-vendor-frame iframe { display: block; width: 100%; min-height: 260px; height: 300px; border: 0; overflow: hidden; background: #152b2d; transition: height .18s ease; }

.reference-footer { padding: 34px clamp(22px, 5vw, 64px) 48px; color: var(--ink-soft); font-size: 12px; border-top: 1px solid var(--line); }
.reference-footer p { max-width: 850px; }.reference-footer a { font-family: system-ui, sans-serif; }

.results-panel { position: sticky; top: 116px; min-width: 0; max-height: calc(100vh - 134px); }
.results-sticky { max-height: inherit; display: flex; flex-direction: column; }
.results-heading { margin: 9px 4px 9px 8px; }
.result-count { color: #d8c08b; letter-spacing: .03em; }
.search-hint { border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 18px; color: #aeb5af; background: rgba(255,255,255,.025); }
.search-hint .orb { width: 42px; height: 42px; border: 1px solid var(--gold); border-radius: 50%; margin-bottom: 13px; position: relative; }
.search-hint .orb::before { content:''; position:absolute; inset: 13px; border-radius:50%; background: var(--gold); opacity:.65; }
.search-hint p { margin: 0 0 13px; line-height: 1.5; }
.popular-searches { display: flex; flex-wrap: wrap; gap: 6px; }
.popular-searches button { border: 1px solid rgba(255,255,255,.13); border-radius: 999px; background: transparent; color: #d6d8d1; padding: 5px 8px; font: 11px system-ui, sans-serif; cursor: pointer; }
.popular-searches button:hover { border-color: var(--gold); color: white; }
.search-results { overflow: auto; padding: 0 3px 20px 0; display: grid; gap: 7px; scrollbar-color: rgba(220,199,145,.25) transparent; }
.result-card { width: 100%; text-align: left; border: 1px solid rgba(255,255,255,.095); border-radius: 11px; padding: 11px 12px; background: rgba(255,255,255,.028); color: #d8ddd6; cursor: pointer; }
.result-card:hover, .result-card:focus-visible { border-color: rgba(199,154,67,.8); background: rgba(199,154,67,.07); outline: none; }
.result-card .result-section { display: block; color: #8fa09d; font: 700 9px/1.25 system-ui, sans-serif; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 4px; }
.result-card strong { display: block; color: #f0e8d3; font: 720 13px/1.25 system-ui, sans-serif; }
.result-card p { margin: 5px 0 8px; color: #aeb5ae; font: 11.5px/1.42 system-ui, sans-serif; }
.result-card mark { background: rgba(199,154,67,.35); color: #fff3d3; }
.result-badges { display: flex; gap: 4px; flex-wrap: wrap; }.result-badges .badge { font-size: 8px; padding: 4px 6px; }
.no-results { border: 1px dashed rgba(255,255,255,.15); border-radius: 12px; padding: 18px; color: #abb2ac; line-height: 1.5; }

.mobile-search-button { display: none; }
.mobile-search-dialog[hidden] { display: none; }
.mobile-search-dialog { position: fixed; inset: 0; z-index: 180; display: grid; align-items: end; padding: 14px; }
.mobile-search-backdrop { position: absolute; inset: 0; border: 0; background: rgba(9, 20, 21, .62); backdrop-filter: blur(3px); }
.mobile-search-panel { position: relative; width: min(620px, 100%); max-height: min(72vh, 640px); margin: 0 auto; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); gap: 10px; padding: 14px; border: 1px solid rgba(239, 226, 196, .24); border-radius: 14px; background: var(--frame); color: #f4e9d0; box-shadow: 0 24px 70px rgba(0,0,0,.45); transform: translateY(12px); opacity: 0; transition: transform .14s ease, opacity .14s ease; }
.mobile-search-dialog.open .mobile-search-panel { transform: translateY(0); opacity: 1; }
.mobile-search-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mobile-search-title strong { font: 850 12px/1.2 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.mobile-search-shell { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; border: 1px solid rgba(231, 213, 168, .28); border-radius: 12px; background: #f7eed9; overflow: hidden; }
.mobile-search-shell input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 12px 14px; background: transparent; color: #18282a; font-family: system-ui, sans-serif; font-size: 16px; }
.mobile-search-heading { margin: 0 2px; }
.mobile-search-results { max-height: none; padding-bottom: 2px; }
body.dialog-open { overflow: hidden; }

@media (max-width: 1200px) {
  .masthead { grid-template-columns: minmax(150px, 205px) minmax(260px, 1fr) auto; gap: 14px; }
  .header-center { width: min(680px, 100%); }
  .app-shell { grid-template-columns: minmax(0,1fr) 300px; }
  .toc-panel {
    display: block;
    position: fixed;
    left: 14px;
    bottom: 14px;
    top: auto;
    z-index: 65;
    width: min(360px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    overflow: auto;
    padding: 10px;
    border: 1px solid rgba(235, 218, 174, .22);
    border-radius: 14px;
    background: color-mix(in srgb, var(--frame) 96%, transparent);
    box-shadow: 0 12px 34px rgba(0,0,0,.32);
  }
  .toc-panel:not(.open) { width: auto; max-height: none; overflow: visible; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .toc-panel:not(.open) .panel-heading { margin: 0; }
  .toc-panel:not(.open) .panel-heading > span,
  .toc-panel:not(.open) .toc-nav,
  .toc-panel:not(.open) .toc-footer { display: none; }
  .toc-panel.open .toc-nav { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 3px; max-height: min(62vh, 560px); overflow: auto; margin-top: 8px; padding-right: 2px; }
  .toc-panel.open .toc-footer { display: none; }
  .mobile-toggle { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #d2ad62; background: #153536; color: #f4e9d0; border-radius: 999px; padding: 10px 14px; font: 700 12px system-ui, sans-serif; box-shadow: 0 8px 26px rgba(0,0,0,.25); cursor: pointer; }
  .results-panel { grid-column: auto; }
  .results-sticky { padding: 0; }
  .search-results { grid-template-columns: 1fr; max-height: none; }
}

@media (max-width: 860px) {
  html { scroll-padding-top: 145px; }
  .site-header { padding: 10px 12px; }
  .masthead { grid-template-columns: minmax(0, 1fr) auto; gap: 9px 12px; }
  .header-center { grid-column: 1 / -1; grid-row: 2; gap: 6px; width: 100%; }
  .header-actions { grid-column: 2; grid-row: 1; padding-top: 0; }
  .brand small { display: none; }.brand-wordmark { height: 38px; max-width: 46vw; object-fit: contain; object-position: left center; }
  .search-shell kbd { display: none; }
  .expansion-filter { justify-content: flex-start; }
  .app-shell { display: block; padding: 0; }
  .panel-heading { margin: 4px 0; }
  .toc-nav { display: none; grid-template-columns: repeat(2, minmax(0,1fr)); margin: 8px 0 4px; }
  .toc-nav.open { display: grid; }.toc-footer { display: none; }
  .reference { border-radius: 0; border-left: 0; border-right: 0; }
  .reference-section { padding: 42px 22px; }.section-heading { align-items: flex-start; }.section-kicker { display: none; }
  .component-group-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .component-icon-card { grid-template-columns: 62px minmax(0, 1fr); min-height: 88px; }
  .component-icon-card.component-card-wide { grid-template-columns: 96px minmax(0, 1fr); }
  .component-icon-card.component-card-card { grid-template-columns: 78px minmax(0, 1fr); }
  .component-art { width: 56px; height: 56px; }
  .component-shape-wide { width: 88px; }
  .component-shape-card { width: 66px; height: 82px; }
  .component-art svg { width: 40px; height: 40px; }
  .priority-grid, .cheat-grid, .setup-matrix { grid-template-columns: 1fr; }
  .trigger-table > div { grid-template-columns: 1fr; gap: 5px; }
  .aid-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .external-aids { grid-template-columns: 1fr; }
  .mythos-vendor-frame iframe { min-height: 300px; }
  .limits-table > div { grid-template-columns: 1fr 90px; }.limits-table p { grid-column: 1 / -1; }
  .results-panel { position: static; max-height: none; padding: 0; background: var(--frame); }
  .results-sticky { max-height: none; padding: 20px 14px 28px; }
  .search-results { grid-template-columns: 1fr; max-height: none; }
  .mobile-search-button { display: flex; position: fixed; right: 14px; bottom: 14px; z-index: 60; align-items: center; gap: 7px; border: 1px solid #d2ad62; border-radius: 999px; background: #153536; color: #f4e9d0; box-shadow: 0 8px 26px rgba(0,0,0,.25); padding: 10px 14px; font: 700 12px system-ui, sans-serif; }
  #themeButton, .mobile-toggle, .mobile-search-button { display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; gap: 0; border-radius: 50%; line-height: 0; }
  .mobile-search-button { display: grid; }
  #themeButton .button-label, .mobile-toggle .button-label, .mobile-search-button .button-label { display: none; }
  #themeButton .button-icon, .mobile-toggle svg, .mobile-search-button svg { display: block; width: 18px; height: 18px; margin: 0; }
}

@media (max-width: 520px) {
  .header-actions .quiet-button:first-child { display: none; }
  .search-shell { grid-template-columns: 24px minmax(0,1fr) auto; }.clear-search { grid-column: 3; }
  .section-heading { padding: 11px 12px; }.section-icon { width: 34px; height: 34px; }.section-heading h2 { font-size: 26px; }
  .component-group-grid { grid-template-columns: 1fr; }
  .component-icon-card { grid-template-columns: 58px minmax(0, 1fr); padding: 11px; }
  .component-icon-card.component-card-wide { grid-template-columns: 86px minmax(0, 1fr); }
  .component-icon-card.component-card-card { grid-template-columns: 70px minmax(0, 1fr); }
  .component-art { width: 52px; height: 52px; }
  .component-shape-wide { width: 78px; height: 52px; }
  .component-shape-card { width: 60px; height: 76px; }
  .step-list > div { grid-template-columns: 36px 1fr; }
  .phase-list li { grid-template-columns: 34px 1fr; }
  .badge-grid { grid-template-columns: 1fr; }
  .aid-title { align-items: flex-start; flex-direction: column; gap: 4px; }
  .aid-grid { grid-template-columns: 1fr; }
  .toc-panel.open .toc-nav, .toc-nav { grid-template-columns: 1fr; }
}

@media (hover: none), (pointer: coarse) {
  .component-icon-card:hover .component-art.has-image img,
  .component-icon-card:focus-within .component-art.has-image img { transform: none; filter: none; box-shadow: none; }
}

@media print {
  @page { size: A4; margin: 6mm; }
  .site-header, .toc-panel, .results-panel, .mobile-search-button, .mobile-search-dialog { display: none !important; }
  html, body { background: white; color: #111; font-size: 7.8pt; line-height: 1.18; }
  .app-shell { display: block; width: 100%; padding: 0; margin: 0; }
  .reference { box-shadow: none; border: 0; border-radius: 0; background: white; overflow: visible; }
  .intro-note { padding: 0 0 3mm; margin: 0 0 3mm; border-bottom: 1px solid #999; font-size: 7.8pt; }
  .reference-section { padding: 0 0 3.8mm; margin: 0 0 3.8mm; border-bottom: 1px solid #bbb; scroll-margin-top: 0; break-inside: auto; }
  .section-heading { margin: 0 0 2.4mm; padding: 0 0 1.2mm; border: 0; border-bottom: 1px solid #777; border-radius: 0; box-shadow: none; color: #111; gap: 6px; }
  .section-icon { display: none; }
  .section-heading h2 { font: 800 12.5pt/1.05 Georgia, 'Times New Roman', serif; color: #111; }
  .section-kicker { font-size: 6.4pt; color: #555; }
  .entry { padding: 0 0 2mm; scroll-margin-top: 0; break-inside: auto; }
  .entry h3 { margin: 0 0 .8mm; color: #111; font: 800 8.8pt/1.12 system-ui, sans-serif; break-after: avoid; }
  .entry-anchor { display: none; }
  .entry p, .entry ul, .entry ol, .callout, .phase-list, .step-list, .priority-grid, .cheat-grid, .setup-matrix, .trigger-table, .player-aid, .external-aids { margin-top: .9mm; margin-bottom: 1.2mm; }
  .entry ul, .entry ol { padding-left: 3.5mm; }
  .entry li { margin: .35mm 0; }
  .entry-tags { gap: 2px; margin-bottom: .8mm; }
  .badge, .filter-chip { padding: 1.6px 4px; font-size: 5.9pt; color: white !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .callout, .player-aid, .setup-matrix > div, .trigger-table > div, .aid-grid section, .cheat-grid > div, .limits-table > div, .component-strip { border-color: #aaa; border-radius: 0; background: white; padding: 1.2mm; }
  .callout { border-left: 2px solid #777; }
  .callout strong, .component-group h4, .priority-grid strong, .cheat-grid strong, .setup-matrix strong, .trigger-table strong, .aid-title strong, .aid-grid h4 { color: #111; font-size: 6.8pt; }
  .callout p, .priority-grid p, .cheat-grid p, .setup-matrix p, .trigger-table p, .aid-grid p, .component-icon-card p, .faq-list li { color: #222; font-size: 7.2pt; line-height: 1.18; }
  .faq-list { break-inside: auto; }
  .faq-list li { break-inside: avoid; }
  #official-faq-errata .faq-list, #glossary .section-entries, #common-gotchas .section-entries { columns: 2 86mm; column-gap: 6mm; }
  #glossary .entry, #common-gotchas .entry { break-inside: avoid; }
  .phase-list { gap: 1mm; }
  .phase-list li { grid-template-columns: 5mm 1fr; gap: 1.4mm; padding: 1.2mm; border-radius: 0; background: white; }
  .phase-list li > span, .step-list > div > span { border-color: #777; color: #111; padding: .6mm; }
  .step-list { gap: 1mm; }
  .step-list > div { grid-template-columns: 6.5mm 1fr; gap: 1.4mm; }
  .priority-grid, .cheat-grid { grid-template-columns: repeat(3, 1fr); gap: 1.2mm; }
  .setup-matrix, .aid-grid { grid-template-columns: repeat(2, 1fr); gap: 1.2mm; }
  .external-aids { grid-template-columns: 1fr; }
  .component-icon-grid { gap: 2mm; }
  .component-group { gap: 1.2mm; }
  .component-group-grid { grid-template-columns: repeat(4, 1fr); gap: 1mm; }
  .component-icon-card, .component-icon-card.component-card-wide, .component-icon-card.component-card-card { grid-template-columns: 7.5mm 1fr; min-height: 0; padding: 1mm; gap: 1.2mm; break-inside: avoid; }
  .component-icon-card span { margin-top: .3mm; font-size: 5.8pt; }
  .component-art, .component-shape-wide, .component-shape-card { width: 6.5mm; height: 6.5mm; }
  .component-art img, .component-art.has-image img { opacity: 1; transform: none !important; box-shadow: none !important; filter: none !important; }
  .component-art svg { width: 6mm; height: 6mm; }
  .component-strip { gap: 1mm; padding: 1mm; }
  .component-strip .component-art { width: 5.8mm; height: 5.8mm; }
  .mythos-vendor-frame { display: none; }
  .trigger-table { gap: 0; }
  .trigger-table > div { grid-template-columns: .75fr .95fr 1.3fr; gap: 1.5mm; padding: 1mm 0; border-left: 0; border-right: 0; border-bottom: 0; }
  .investigator-table > div { grid-template-columns: .7fr .7fr .85fr 1.65fr; }
  .investigator-table .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 0 1.2mm; }
  .limits-table > div { grid-template-columns: 24mm 15mm 1fr; gap: 1.4mm; padding: 1mm 0; }
  .player-aid, .setup-matrix > div, .aid-grid section, .cheat-grid > div, .limits-table > div { break-inside: avoid; }
  .player-aid { background: white; }
  .player-aid .component-strip { display: none; }
  .reference-footer { padding: 4mm 0 0; border-top: 1px solid #999; font-size: 7.5pt; }
}
