/* Iliac Codex: dark slate and brass, after the in-game class screen. */

:root {
  --bg: #101215;
  --panel: #171a1f;
  --panel-2: #1d2127;
  --line: #2a2f37;
  --fg: #e6dcc6;
  --muted: #9a937f;
  --brass: #d0a54a;
  --brass-ink: #14110a;
  --blood: #c0432f;
  --blood-ink: #e2705c;
  --moss: #7fa05a;
  --note: #6c9ccd;
  --warn: #e0903f;
  --link: #e3bd6a;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --f-display: "Jacquard 12", "Pixelify Sans", Georgia, "Times New Roman", serif;
  --f-body: "Alegreya Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --f-pixel: "Pixelify Sans", "Lucida Console", "Courier New", ui-monospace, monospace;
  --topbar-h: 56px;
  color-scheme: dark;
}

/* Light theme: "vellum" */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e8e9e4;
    --panel: #f3f3ef;
    --panel-2: #ecece6;
    --line: #c6c8c0;
    --fg: #1d1f22;
    --muted: #565a5e;
    --brass: #7f5a12;
    --brass-ink: #fff8e6;
    --blood: #a8321f;
    --blood-ink: #a8321f;
    --moss: #3f6b22;
    --note: #2f5f8f;
    --warn: #8f4d0c;
    --link: #7a540c;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 18px rgba(40, 40, 30, 0.12);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #e8e9e4;
  --panel: #f3f3ef;
  --panel-2: #ecece6;
  --line: #c6c8c0;
  --fg: #1d1f22;
  --muted: #565a5e;
  --brass: #7f5a12;
  --brass-ink: #fff8e6;
  --blood: #a8321f;
  --blood-ink: #a8321f;
  --moss: #3f6b22;
  --note: #2f5f8f;
  --warn: #8f4d0c;
  --link: #7a540c;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 18px rgba(40, 40, 30, 0.12);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 18px;
  line-height: 1.55;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--brass); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.display { font-family: var(--f-display); font-weight: 400; letter-spacing: 0.02em; }
.eyebrow, .nav-cat, .kind, .pill, .chip { font-family: var(--f-pixel); }
.eyebrow { margin: 0 0 0.25rem; color: var(--brass); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-cat { margin: 1rem 0 0.35rem; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 0.75rem;
  min-height: var(--topbar-h);
  padding: 0.4rem max(16px, env(safe-area-inset-right)) 0.4rem max(16px, env(safe-area-inset-left));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.wordmark { color: var(--brass); text-decoration: none; font-size: 1.9rem; line-height: 1; white-space: nowrap; }
.wordmark:hover { color: var(--fg); }
.top-search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 28rem; margin-left: auto; }
.top-search input {
  width: 100%; padding: 0.4rem 0.7rem; font: inherit; font-size: 1rem;
  color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.top-search input::placeholder, .hero-search input::placeholder { color: var(--muted); }
.top-tools { display: flex; align-items: center; gap: 0.5rem; flex: 0 0 auto; }
select, .theme-toggle, button, .button {
  font: inherit; font-size: 0.95rem; color: var(--fg);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.35rem 0.6rem; cursor: pointer;
}
select { max-width: 11rem; }
button:hover, .button:hover, .theme-toggle:hover { border-color: var(--brass); }
.theme-toggle { width: 2.4rem; padding-inline: 0; font-size: 1.1rem; line-height: 1.2; }
.button {
  display: inline-block; text-decoration: none; margin: 0.5rem 0;
  background: var(--brass); color: var(--brass-ink); border-color: var(--brass); font-weight: 700; padding: 0.55rem 1rem;
}
.button:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 60;
}
.dropdown[hidden] { display: none; }
.dropdown a { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.4rem 0.6rem; border-radius: 5px; color: var(--fg); text-decoration: none; }
.dropdown li.on a, .dropdown a:hover { background: var(--panel-2); outline: 1px solid var(--brass); }
.dropdown .kind, .results .kind {
  flex: 0 0 auto; min-width: 4.2em; font-size: 0.7rem; color: var(--brass); text-transform: uppercase; letter-spacing: 0.06em;
}
.dropdown .ctx, .results .ctx { color: var(--muted); font-size: 0.85rem; margin-left: auto; text-align: right; }
.dropdown .none { padding: 0.5rem 0.7rem; color: var(--muted); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 90rem; margin: 0 auto; }
main { min-width: 0; padding: 1.25rem 16px 3rem; }
.sidebar { padding: 0.5rem 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sidebar summary { cursor: pointer; font-family: var(--f-pixel); color: var(--brass); padding: 0.4rem 0; }
.sidebar ul, .toc ol, .cat ul, .quick-list { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block; padding: 0.2rem 0.6rem; color: var(--fg); text-decoration: none; border-left: 2px solid transparent; font-size: 0.98rem;
}
.sidebar li a:hover { color: var(--brass); border-left-color: var(--line); }
.sidebar li a[aria-current="page"] { color: var(--brass); border-left-color: var(--brass); background: var(--panel-2); }
.page, main > section, main > .view > section, .home-hero { max-width: 70ch; margin-left: auto; margin-right: auto; }
.page.journey, .page.tool { max-width: 62rem; }
.view[hidden] { display: none; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 15.5rem minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: var(--topbar-h); align-self: start;
    height: calc(100vh - var(--topbar-h)); overflow-y: auto;
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  .sidebar summary { pointer-events: none; list-style: none; }
  .sidebar summary::-webkit-details-marker { display: none; }
  main { padding: 1.75rem 2rem 4rem; }
}
.toc { margin: 1rem 0; padding: 0.5rem 0.9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.toc ol { counter-reset: t; }
.toc li { counter-increment: t; padding: 0.1rem 0; }
.toc li a { color: var(--fg); text-decoration: none; }
.toc li a::before { content: counter(t) ". "; color: var(--muted); font-family: var(--f-pixel); }
.toc li a:hover { color: var(--brass); }
@media (min-width: 1360px) {
  .page:not(.journey):not(.tool) .toc {
    position: fixed; top: calc(var(--topbar-h) + 2rem); left: calc(50% + 28rem); width: 13rem;
    max-height: calc(100vh - var(--topbar-h) - 4rem); overflow-y: auto; font-size: 0.9rem;
    border: 0; border-left: 1px solid var(--line); border-radius: 0; background: none; padding: 0 0 0 1rem; margin: 0;
  }
}

/* ---------- prose ---------- */
.page-head { margin-bottom: 0.75rem; }
h1.display { margin: 0; font-size: clamp(2.3rem, 7vw, 3.6rem); line-height: 1.05; color: var(--fg); overflow-wrap: anywhere; }
.lede { margin: 0.5rem 0 0; font-size: 1.15rem; color: var(--muted); }
.prose h2, .page h2 { margin: 2rem 0 0.5rem; font-size: 1.55rem; line-height: 1.2; color: var(--brass); }
.prose h3 { margin: 1.5rem 0 0.4rem; font-size: 1.2rem; }
.prose h2 .anchor, .prose h3 .anchor { margin-left: -1.1em; padding-right: 0.3em; opacity: 0; text-decoration: none; color: var(--muted); font-size: 0.8em; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0.7rem 0; }
.prose li { margin: 0.25rem 0; }
.prose code, .step code, .build-notes code { font-family: var(--f-pixel); font-size: 0.85em; padding: 0.05em 0.35em; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; overflow-wrap: anywhere; }
.prose pre { overflow-x: auto; padding: 0.8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0.05em 0.45em 0.12em; margin: 0 0.05em;
  font-family: var(--f-pixel); font-size: 0.82em; line-height: 1.35; text-align: center; white-space: nowrap;
  color: var(--fg); background: var(--panel-2);
  border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 5px;
}

/* tables scroll inside .table-wrap */
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); -webkit-overflow-scrolling: touch; }
.table-wrap table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 0.45rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { font-family: var(--f-pixel); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td .tip, th .tip { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.88rem; font-weight: 400; }
.cost { color: var(--moss); }
.refund { color: var(--blood-ink); }
.table-note { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0; }
.missing { color: var(--blood-ink); }
.layout-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0 0.5rem; }
.layout-picker label { color: var(--muted); }
.layout-hint { margin: 0; padding: 0.5rem 16px; background: var(--panel-2); border-bottom: 1px solid var(--brass); text-align: center; font-size: 0.95rem; }
.layout-hint button { margin-left: 0.5rem; }

/* ---------- callouts ---------- */
.callout {
  margin: 1rem 0; padding: 0.6rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; background: var(--panel);
}
.callout > :last-child { margin-bottom: 0; }
.callout p { margin: 0.4rem 0; }
.callout-label { margin: 0 0 0.2rem !important; font-family: var(--f-pixel); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.callout.tip { border-left-color: var(--moss); }
.callout.tip .callout-label { color: var(--moss); }
.callout.note { border-left-color: var(--note); }
.callout.note .callout-label { color: var(--note); }
.callout.important { border-left-color: var(--brass); }
.callout.important .callout-label { color: var(--brass); }
.callout.warning { border-left-color: var(--warn); }
.callout.warning .callout-label { color: var(--warn); }
.callout.caution { border-left-color: var(--blood); }
.callout.caution .callout-label { color: var(--blood-ink); }
blockquote { margin: 1rem 0; padding: 0.2rem 1rem; border-left: 3px solid var(--line); color: var(--muted); }

/* sources + footer */
.sources { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.sources ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sources a { text-decoration: none; }
.site-foot { max-width: 70ch; margin: 0 auto; padding: 1.5rem 16px 3rem; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }

/* ---------- home ---------- */
.home-hero { margin-bottom: 1.5rem; padding: 1rem 0; }
.home-hero h1 { font-size: clamp(3rem, 12vw, 5.5rem); color: var(--brass); }
.hero-search { display: flex; gap: 0.5rem; margin: 1.25rem 0 0; }
.hero-search input { flex: 1 1 auto; min-width: 0; padding: 0.6rem 0.8rem; font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.hero-search button { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); font-weight: 700; }
.section-lede { color: var(--muted); margin-top: 0; }
main section > h2 { color: var(--brass); font-size: 1.6rem; margin: 2rem 0 0.6rem; }
.quick-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.6rem; }
.quick-list a {
  display: block; height: 100%; padding: 0.7rem 0.9rem; color: var(--fg); text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; border-left: 3px solid var(--brass);
}
.quick-list a:hover { border-color: var(--brass); background: var(--panel-2); }
.journey-cards { display: grid; gap: 0.75rem; }
.journey-card {
  display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem 1.1rem; text-decoration: none; color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.journey-card:hover { border-color: var(--brass); color: var(--fg); }
.journey-card strong { font-family: var(--f-display); font-size: 1.8rem; font-weight: 400; color: var(--brass); line-height: 1.1; }
.progress-line { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.4rem; color: var(--muted); font-size: 0.9rem; }
.bar { flex: 1 1 auto; height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.bar .fill { display: block; height: 100%; width: 0; background: var(--moss); transition: width 0.25s ease; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.cat { padding: 0.8rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.cat h3 { margin: 0 0 0.4rem; font-family: var(--f-pixel); font-size: 0.85rem; color: var(--brass); letter-spacing: 0.08em; text-transform: uppercase; }
.cat li { padding: 0.25rem 0; }
.cat li a { display: block; font-weight: 700; text-decoration: none; }
.cat li span { display: block; color: var(--muted); font-size: 0.88rem; line-height: 1.3; }

/* ---------- search results ---------- */
.results { list-style: none; margin: 1rem 0; padding: 0; }
.results li a { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; padding: 0.6rem 0.8rem; margin-bottom: 0.4rem; color: var(--fg); text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.results li a:hover { border-color: var(--brass); }
.results .empty { color: var(--muted); padding: 1rem 0; }

/* ---------- journey ---------- */
.progress { display: flex; align-items: center; gap: 0.7rem; margin-top: 1rem; flex-wrap: wrap; }
.progress .bar { min-width: 8rem; }
.ghost { background: none; }
.ghost.confirm { border-color: var(--blood-ink); color: var(--blood-ink); }
.build-notes { margin: 1rem 0; padding-left: 1.2rem; }
.stages { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.stage { margin: 0 0 1.75rem; }
.stage h2 { display: flex; align-items: center; gap: 0.7rem; margin: 0 0 0.2rem; font-size: 1.5rem; color: var(--brass); }
.stage-n { flex: 0 0 auto; display: inline-grid; place-items: center; width: 2rem; height: 2rem; font-family: var(--f-pixel); font-size: 1rem; color: var(--brass-ink); background: var(--brass); border-radius: 4px; }
.goal { margin: 0 0 0.6rem 2.7rem; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 0.7rem; padding: 0.6rem 0.8rem; margin-bottom: 0.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.step input[type="checkbox"] { flex: 0 0 auto; width: 1.3rem; height: 1.3rem; margin-top: 0.2rem; accent-color: var(--moss); cursor: pointer; }
.step-body { min-width: 0; flex: 1 1 auto; }
.step-body label { cursor: pointer; overflow-wrap: anywhere; }
.step.done { border-color: var(--moss); }
.step.done .step-body > label { color: var(--muted); }
.step-tip { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.92rem; }
.step-tip::before { content: "Tip: "; font-family: var(--f-pixel); color: var(--moss); }
.see { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.4rem 0 0; }
.chip { display: inline-block; padding: 0.1rem 0.55rem; font-size: 0.78rem; color: var(--fg); text-decoration: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; }
a.chip:hover, button.chip:hover { border-color: var(--brass); color: var(--brass); }
button.chip { cursor: pointer; padding: 0.15rem 0.7rem; }
button.chip.on { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); }

/* ---------- class sheet (creation-screen style) ---------- */
.class-sheet { margin: 1.25rem 0; padding: 1rem 1.1rem; background: var(--panel); border: 1px solid var(--brass); border-radius: 10px; box-shadow: var(--shadow); }
.sheet-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; align-items: flex-end; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 2.2rem; color: var(--brass); line-height: 1; }
.sheet-head .eyebrow { margin-bottom: 0.2rem; }
.sheet-difficulty { display: flex; align-items: baseline; gap: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.sheet-difficulty .pts { font-family: var(--f-pixel); font-size: 3rem; line-height: 1; color: var(--brass); }
.sheet-grid { display: grid; gap: 0.5rem 1.5rem; margin-top: 0.2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .sheet-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.class-sheet ul { list-style: none; margin: 0; padding: 0; }
.sheet-skills li { padding: 0.12rem 0; }
.sheet-attrs dl { margin: 0; }
.attr { display: grid; grid-template-columns: 6.2rem 1fr; align-items: center; gap: 0.4rem; padding: 0.1rem 0; font-size: 0.95rem; }
.attr dt { color: var(--muted); }
.attr dd { margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.attr-bar { flex: 1 1 auto; height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 2px; }
.attr-bar span { display: block; height: 100%; background: var(--brass); }
.attr-val { font-family: var(--f-pixel); min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
.hp { margin: 0; font-family: var(--f-pixel); font-size: 1.6rem; color: var(--brass); }
.hp .muted { font-size: 0.9rem; }
.sheet-specials li { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.12rem 0; font-size: 0.95rem; }
.sheet-specials .num { font-family: var(--f-pixel); font-variant-numeric: tabular-nums; }

/* ---------- calculator ---------- */
.calc-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 1rem 0; }
.calc-presets .nav-cat { margin: 0 0.4rem 0 0; }
.calc { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .calc { grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; } .calc-result { position: sticky; top: calc(var(--topbar-h) + 1rem); } }
.calc-block { margin-bottom: 1rem; padding: 0.8rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.calc-block h2 { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.6rem; font-size: 1.2rem; }
.pill { font-size: 0.75rem; padding: 0.05rem 0.5rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; font-variant-numeric: tabular-nums; }
.pill.bad { color: var(--blood-ink); border-color: var(--blood); }
.pill.ok { color: var(--moss); border-color: var(--moss); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 0; }
.stepper { display: inline-flex; align-items: center; gap: 0.5rem; }
.stepper button { width: 2.2rem; height: 2.2rem; padding: 0; font-size: 1.2rem; line-height: 1; }
.stepper output { min-width: 2.5ch; text-align: center; font-family: var(--f-pixel); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.calc-attrs { display: grid; gap: 0.4rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.calc-attr { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.picks { list-style: none; margin: 0 0 0.6rem; padding: 0; }
.picks li { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
.picks li:last-child { border-bottom: 0; }
.picks .what { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.picks .num { font-family: var(--f-pixel); font-variant-numeric: tabular-nums; }
.picks .none { color: var(--muted); }
.adder { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.adder select { flex: 1 1 10rem; max-width: none; min-width: 0; }
.calc-result { padding: 1rem; background: var(--panel); border: 1px solid var(--brass); border-radius: 10px; box-shadow: var(--shadow); }
.calc-result .nav-cat { margin-top: 0; }
.calc-points { margin: 0; font-family: var(--f-pixel); font-size: 4rem; line-height: 1; color: var(--brass); font-variant-numeric: tabular-nums; }
.calc-points.neg { color: var(--blood-ink); }
.calc-mult { margin: 0.5rem 0; }
.gauge { position: relative; height: 34px; margin: 0.8rem 0 0.2rem; }
.gauge-band { position: absolute; left: 0; right: 0; top: 14px; height: 6px; background: linear-gradient(90deg, var(--blood), var(--line) 30%, var(--line) 50%, var(--moss)); border-radius: 3px; }
.gauge-zero { position: absolute; top: 8px; width: 2px; height: 18px; background: var(--muted); }
.gauge-dagger { position: absolute; top: 0; width: 0; height: 0; left: 0; transition: left 0.25s ease; }
.gauge-dagger::before { content: ""; position: absolute; left: -6px; top: 0; width: 12px; height: 34px; background: var(--brass); clip-path: polygon(50% 100%, 100% 55%, 62% 55%, 62% 0, 38% 0, 38% 55%, 0 55%); }
.gauge-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; font-family: var(--f-pixel); }
.calc-breakdown { margin: 0.8rem 0 0; }
.calc-breakdown div { display: flex; justify-content: space-between; padding: 0.2rem 0; border-top: 1px solid var(--line); }
.calc-breakdown dt { color: var(--muted); }
.calc-breakdown dd { margin: 0; font-family: var(--f-pixel); font-variant-numeric: tabular-nums; }
.calc-problems ul { margin: 0.8rem 0 0; padding-left: 1.1rem; color: var(--blood-ink); font-size: 0.95rem; }
.calc-problems .legal { margin: 0.8rem 0 0; color: var(--moss); font-size: 0.95rem; }

/* ---------- databases ---------- */
.page.db { max-width: 78rem; }
.db-cards { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.db-card { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.8rem 1rem; text-decoration: none; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; border-left: 3px solid var(--brass); }
.db-card:hover { border-color: var(--brass); color: var(--fg); }
.db-card strong { font-family: var(--f-display); font-size: 1.6rem; font-weight: 400; color: var(--brass); line-height: 1.1; }
.db-card .count { font-family: var(--f-pixel); font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.db-card span:last-child { color: var(--muted); font-size: 0.9rem; line-height: 1.3; }
.db-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.db-controls input { flex: 1 1 14rem; min-width: 0; padding: 0.45rem 0.7rem; font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.db-count { margin-left: auto; color: var(--muted); font-family: var(--f-pixel); font-size: 0.8rem; }
.db-table { font-size: 0.95rem; }
.db-table tbody tr[hidden] { display: none; }
.db-table tbody tr:hover { background: var(--panel-2); }
.db-table th[scope="row"] { font-weight: 700; white-space: normal; min-width: 9rem; }
.db-table th[scope="row"] a { text-decoration: none; }
.db-table thead th[aria-sort="ascending"]::after { content: " B2"; font-family: sans-serif; color: var(--brass); }
.db-table thead th[aria-sort="descending"]::after { content: " BC"; font-family: sans-serif; color: var(--brass); }
.db-table thead th:hover { color: var(--brass); }
.crumbs { margin-bottom: 0.5rem; font-family: var(--f-pixel); font-size: 0.85rem; }
.facts { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); margin: 1.25rem 0; }
.facts > div { padding: 0.55rem 0.8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.facts dt { font-family: var(--f-pixel); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0.1rem 0 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.facts .vals { margin: 0.2rem 0 0; padding-left: 1.1rem; font-size: 1rem; }
.facts > div:has(.msg) { grid-column: 1 / -1; }
.facts .msg h3 { margin: 0.6rem 0 0.2rem; font-size: 0.95rem; font-family: var(--f-pixel); color: var(--brass); letter-spacing: 0.06em; text-transform: uppercase; }
.facts .msg p { margin: 0.25rem 0; font-size: 1rem; max-width: 70ch; }
.backrefs h2 { font-size: 1.25rem; }
.backrefs ul { margin: 0.4rem 0; padding-left: 1.2rem; }

@media (max-width: 520px) {
  body { font-size: 17px; }
  .topbar { flex-wrap: wrap; row-gap: 0.3rem; }
  .top-search { order: 3; flex: 1 1 100%; max-width: none; margin-left: 0; }
  .top-tools { margin-left: auto; }
  .wordmark { font-size: 1.6rem; }
  .attr { grid-template-columns: 5.6rem 1fr; }
  .calc-points { font-size: 3.2rem; }
  .goal { margin-left: 0; }
  select { max-width: 8.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .sidebar, .site-foot { display: none; }
  body { background: #fff; color: #000; }
}

/* ================================================================ wiki frame, in the game's own look ================================================================ */
:root {
  --brass-dim: #7a6230;
  --frame: #3a3220;
  --panel-hi: #1c2026;
}
:root[data-theme="light"] { --brass-dim: #a98a3e; --frame: #cdbf98; --panel-hi: #f7f6f0; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --brass-dim: #a98a3e; --frame: #cdbf98; --panel-hi: #f7f6f0; } }

/* top bar: section links, like a wiki's tab row */
.topbar { border-bottom: 2px solid var(--brass-dim); }
.topnav { display: none; gap: 0.2rem; align-items: center; }
@media (min-width: 760px) { .topnav { display: flex; } }
.topnav a { padding: 0.25rem 0.7rem; font-family: var(--f-pixel); font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); text-decoration: none; border: 1px solid transparent; border-radius: 4px; }
.topnav a:hover { color: var(--brass); border-color: var(--line); background: var(--panel-2); }

/* the left rail */
.sidebar { background: linear-gradient(180deg, var(--panel) 0%, var(--bg) 100%); }
@media (min-width: 900px) {
  .sidebar summary { pointer-events: auto; }
  .nav-details > summary { pointer-events: none; list-style: none; }
  .nav-details > summary::-webkit-details-marker { display: none; }
}
.nav-main { margin-bottom: 0.6rem !important; padding-bottom: 0.6rem !important; border-bottom: 1px solid var(--line); }
.nav-main li a { font-weight: 700; }
.nav-group { margin: 0.1rem 0; border-top: 1px solid var(--line); }
.nav-group > summary { cursor: pointer; padding: 0.4rem 0.3rem; font-family: var(--f-pixel); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brass); list-style: none; display: flex; align-items: center; gap: 0.4rem; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::before { content: "\25B8"; font-size: 0.75rem; color: var(--brass-dim); font-family: sans-serif; transition: transform 0.12s ease; }
.nav-group[open] > summary::before { transform: rotate(90deg); }
.nav-group > ul { margin-bottom: 0.4rem !important; }
.nav-group .nav-sub { margin: 0.5rem 0 0.15rem 0.6rem; font-family: var(--f-pixel); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.nav-group .more a { color: var(--muted); font-size: 0.85rem; font-style: italic; }

/* breadcrumbs and page tabs */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0 0 0.6rem; font-family: var(--f-pixel); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brass); text-decoration: underline; }
.crumbs .sep { color: var(--muted); }
.crumbs [aria-current] { color: var(--fg); }

/* the article as a framed window */
main > .page, main > .view > .page {
  position: relative; max-width: 66rem; margin: 0 auto 1.5rem; padding: 1.1rem 1.5rem 1.4rem;
  background: var(--panel); border: 1px solid var(--brass-dim);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--frame), 0 10px 30px rgba(0, 0, 0, 0.25);
}
main > .page::before, main > .page::after, main > .view > .page::before, main > .view > .page::after {
  content: ""; position: absolute; width: 10px; height: 10px; background: var(--brass); top: -5px; border-radius: 1px; box-shadow: 0 0 0 2px var(--bg);
}
main > .page::before, main > .view > .page::before { left: -5px; }
main > .page::after, main > .view > .page::after { right: -5px; }
main > .page.journey, main > .page.tool, main > .view > .page.journey, main > .view > .page.tool { max-width: 66rem; }
@media (max-width: 520px) { main > .page, main > .view > .page { padding: 0.9rem 0.9rem 1.2rem; box-shadow: 0 0 0 2px var(--frame); } main > .page::before, main > .page::after, main > .view > .page::before, main > .view > .page::after { display: none; } }
.page-head { padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.page-head h1.display { font-size: clamp(2rem, 6vw, 3rem); }
.prose h2, .page .prose h2 { padding-bottom: 0.2rem; border-bottom: 1px solid var(--brass-dim); }
.prose h3 { color: var(--fg); }
.catlinks { margin: 1.5rem 0 0; padding: 0.5rem 0.8rem; font-size: 0.95rem; background: var(--panel-hi); border: 1px solid var(--line); }
.catlinks span { color: var(--muted); font-family: var(--f-pixel); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.page-list { list-style: none; margin: 1rem 0; padding: 0; }
.page-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.page-list li a { font-weight: 700; }
.page-list li span { display: block; color: var(--muted); font-size: 0.95rem; }

/* the infobox on a database entry */
.entry-layout { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
@media (min-width: 760px) { .entry-layout { flex-direction: row-reverse; align-items: flex-start; } }
.entry-body { flex: 1 1 auto; min-width: 0; }
.infobox { flex: 0 0 auto; width: 100%; background: var(--panel-hi); border: 1px solid var(--brass-dim); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--frame); }
@media (min-width: 760px) { .infobox { width: 21rem; } }
.infobox-title { margin: 0; padding: 0.4rem 0.7rem; font-family: var(--f-display); font-size: 1.5rem; line-height: 1.1; color: var(--brass-ink); background: var(--brass); }
.infobox-sub { margin: 0; padding: 0.25rem 0.7rem; font-family: var(--f-pixel); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--line); }
.infobox table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.infobox th, .infobox td { padding: 0.3rem 0.7rem; vertical-align: top; border-bottom: 1px solid var(--line); }
.infobox th { width: 40%; text-align: left; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.infobox td { overflow-wrap: anywhere; }
.infobox tr:last-child > * { border-bottom: 0; }
.infobox .vals { margin: 0; padding-left: 1rem; }
.entry-prose h2 { margin-top: 1.4rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--brass-dim); }
.entry-prose .msg h3 { margin: 0.8rem 0 0.2rem; font-family: var(--f-pixel); font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brass); }
.entry-prose .msg p { margin: 0.25rem 0; max-width: 70ch; }

/* portal cards with a brass tile */
.db-card { position: relative; padding-left: 3.6rem; min-height: 4rem; }
.db-card::before { content: attr(data-initial); position: absolute; left: 0.7rem; top: 0.75rem; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; font-family: var(--f-pixel); font-size: 1.1rem; color: var(--brass-ink); background: var(--brass); border: 1px solid var(--brass-dim); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18); }
.portal-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0; }
.portal-links a { padding: 0.35rem 0.9rem; font-family: var(--f-pixel); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brass-ink); background: var(--brass); text-decoration: none; border: 1px solid var(--brass-dim); }
.portal-links a:hover { background: var(--fg); color: var(--bg); }
.more-link { margin: 0.6rem 0 0; }
.home-hero { padding: 1.4rem 1.5rem !important; background: radial-gradient(120% 140% at 0% 0%, rgba(208, 165, 74, 0.12), transparent 60%), var(--panel); border: 1px solid var(--brass-dim); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--frame); }
main > .view > section, main > section { max-width: 66rem; }

/* calculators */
.gadget { display: grid; gap: 1.2rem; margin: 1rem 0; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .gadget { grid-template-columns: minmax(0, 1fr) 21rem; align-items: start; } .gadget-result { position: sticky; top: calc(var(--topbar-h) + 1rem); } }
.gadget-form { display: grid; gap: 0.7rem 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.field { display: flex; flex-direction: column; gap: 0.2rem; }
.field label { font-size: 0.9rem; color: var(--muted); }
.field input, .field select { width: 100%; max-width: none; padding: 0.4rem 0.6rem; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.field input:focus-visible, .field select:focus-visible { border-color: var(--brass); }
.field .hint { font-size: 0.8rem; color: var(--muted); }
.gadget-result { padding: 1rem; background: var(--panel-hi); border: 1px solid var(--brass-dim); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--frame); }
.gadget-result .nav-cat { margin-top: 0; }
.gadget-big { margin: 0; font-family: var(--f-pixel); font-size: 2.4rem; line-height: 1.1; color: var(--brass); overflow-wrap: anywhere; }
.gadget-rows { margin: 0.7rem 0 0; }
.gadget-rows div { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.25rem 0; border-top: 1px solid var(--line); font-size: 0.95rem; }
.gadget-rows dt { color: var(--muted); }
.gadget-rows dd { margin: 0; font-family: var(--f-pixel); text-align: right; font-variant-numeric: tabular-nums; }
.gadget-text { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.92rem; }

/* ================================================================ round 10: top bar menus, pictures ================================================================ */
.wordmark { display: inline-flex; align-items: center; gap: 0.45rem; }
.emblem { width: 1.5rem; height: 1.5rem; flex: none; }
.topnav { gap: 0.1rem; }
.menu { position: relative; }
.menu > summary, .menu-link { list-style: none; cursor: pointer; padding: 0.3rem 0.7rem; font-family: var(--f-pixel); font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); border: 1px solid transparent; border-radius: 4px; text-decoration: none; display: block; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "\25BE"; margin-left: 0.35rem; font-family: sans-serif; font-size: 0.7rem; }
.menu > summary:hover, .menu[open] > summary, .menu-link:hover { color: var(--brass); border-color: var(--line); background: var(--panel-2); }
.menu-pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 70; min-width: 14rem; padding: 0.5rem; background: var(--panel); border: 1px solid var(--brass-dim); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--frame), 0 12px 28px rgba(0, 0, 0, 0.35); }
.menu-pop ul { list-style: none; margin: 0; padding: 0; }
.menu-pop a { display: block; padding: 0.3rem 0.6rem; color: var(--fg); text-decoration: none; border-radius: 4px; font-size: 0.98rem; }
.menu-pop a:hover { background: var(--panel-2); color: var(--brass); }
.menu-pop .menu-all { font-weight: 700; color: var(--brass); }
.menu-pop.wide { display: grid; grid-template-columns: repeat(4, minmax(10rem, 1fr)); gap: 0.2rem 1rem; width: min(52rem, 92vw); }
.menu-pop.wide .menu-all { grid-column: 1 / -1; border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 0.3rem; }
.menu-col p { margin: 0.2rem 0.6rem; font-family: var(--f-pixel); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 1100px) { .menu-pop.wide { grid-template-columns: repeat(2, minmax(10rem, 1fr)); left: -8rem; } }
.top-search { margin-left: auto; }

/* pictures cut from the game's own files */
.ico { image-rendering: pixelated; object-fit: contain; vertical-align: middle; }
.ico-xs { width: 1.3rem; height: 1.3rem; margin-right: 0.3rem; }
.ico-s { width: 2rem; height: 2rem; margin-right: 0.55rem; padding: 1px; background: var(--bg); border: 1px solid var(--line); }
.ico-l { max-width: 100%; max-height: 11rem; }
.infobox-pic { display: grid; place-items: center; padding: 0.8rem; background: radial-gradient(70% 70% at 50% 45%, rgba(208, 165, 74, 0.16), transparent 75%), var(--bg); border-bottom: 1px solid var(--line); }
.db-table th[scope="row"] { white-space: nowrap; }
a.auto { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; text-decoration-color: var(--brass-dim); }
a.auto:hover { text-decoration-style: solid; }
.menu-pop a { font-family: var(--f-body, inherit); text-transform: none; letter-spacing: normal; }
.menu:has(.menu-pop.wide) { position: static; }
.menu-pop.wide { left: 1rem; right: 1rem; width: auto; top: calc(100% - 6px); max-width: 64rem; margin-inline: auto; }
@media (max-width: 959px) { .topnav { display: none; } }
@media (min-width: 960px) { .topnav { display: flex; } .top-search { min-width: 11rem; } }
@media (min-width: 960px) and (max-width: 1199px) { .menu > summary, .menu-link { padding-inline: 0.45rem; font-size: 0.78rem; } .wordmark .display { font-size: 1.6rem; } }
.ico-l { width: 8rem; height: 8rem; max-height: none; }
.menu-pop { max-height: calc(100vh - var(--topbar-h) - 1.5rem); overflow-y: auto; }

/* ================================================================ round 11: motion and a more modern finish ================================================================ */
html { scroll-behavior: smooth; }
html.no-motion { scroll-behavior: auto; }
::selection { background: rgba(208, 165, 74, 0.35); }
* { scrollbar-width: thin; scrollbar-color: var(--brass-dim) transparent; }

/* top bar: a quiet glass strip */
.topbar { background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(10px) saturate(1.3); -webkit-backdrop-filter: blur(10px) saturate(1.3); }
.topbar .wordmark { transition: transform 0.2s ease, color 0.2s ease; }
.topbar .wordmark:hover { transform: translateY(-1px); }
.topbar .emblem { transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1); }
.topbar .wordmark:hover .emblem { transform: rotate(90deg) scale(1.1); }
.top-search { margin-left: auto; max-width: 30rem; }
.top-search input { transition: border-color 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease; }
.top-search input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(208, 165, 74, 0.22); }
.top-search::before { content: ""; }
.theme-toggle { transition: transform 0.35s ease, border-color 0.15s ease; }
.theme-toggle:hover { transform: rotate(180deg); }

/* reading progress and back to top */
.read-progress { position: fixed; z-index: 80; left: 0; top: 0; width: 100%; height: 3px; transform: scaleX(0); transform-origin: 0 50%; background: linear-gradient(90deg, var(--brass-dim), var(--brass)); pointer-events: none; transition: transform 0.08s linear; }
.to-top { position: fixed; z-index: 60; right: 1.1rem; bottom: 1.1rem; width: 2.6rem; height: 2.6rem; padding: 0; display: grid; place-items: center; font-size: 1.2rem; color: var(--brass-ink); background: var(--brass); border: 1px solid var(--brass-dim); border-radius: 50%; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); opacity: 0; transform: translateY(12px) scale(0.9); pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.15s ease; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--fg); color: var(--bg); }

/* pages ease in; the single file's views too when they are shown */
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
main > .page, main > section, main > .view:not([hidden]) > .page, main > .view:not([hidden]) > section, main > .view:not([hidden]) > header { animation: pageIn 0.38s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.home-hero { animation: pageIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.home-hero { background: radial-gradient(120% 140% at 0% 0%, rgba(208, 165, 74, 0.16), transparent 60%), radial-gradient(90% 120% at 100% 100%, rgba(120, 150, 200, 0.10), transparent 60%), var(--panel); background-size: 140% 140%, 140% 140%, auto; animation: pageIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both, glow 14s ease-in-out 0.5s infinite alternate; }
@keyframes glow { from { background-position: 0% 0%, 100% 100%, 0 0; } to { background-position: 30% 20%, 70% 80%, 0 0; } }

/* cards scroll into view and lift on hover */
.fx-in { opacity: 0; transform: translateY(14px); transition: opacity 0.45s ease var(--fx-delay, 0ms), transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) var(--fx-delay, 0ms), border-color 0.15s ease, box-shadow 0.2s ease, background-color 0.15s ease; }
.fx-in.is-in { opacity: 1; transform: none; }
.db-card, .journey-card, .cat { transition: opacity 0.45s ease var(--fx-delay, 0ms), transform 0.2s ease, border-color 0.15s ease, box-shadow 0.2s ease, background-color 0.15s ease; }
.db-card:hover, .journey-card:hover { transform: translateY(-3px); border-color: var(--brass); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--brass-dim); }
.fx-in.is-in:hover { transform: translateY(-3px); }
.db-card::before { transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1); }
.db-card:hover::before { transform: rotate(-6deg) scale(1.1); }
.portal-links a { transition: opacity 0.45s ease var(--fx-delay, 0ms), transform 0.15s ease, background-color 0.15s ease, color 0.15s ease; }
.portal-links a:hover { transform: translateY(-2px); }
.portal-links a:active, .button:active, button:active { transform: translateY(1px) scale(0.98); }

/* links, rail and tables */
.prose a, .page a { transition: color 0.15s ease, text-decoration-color 0.15s ease; }
.sidebar li a { transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, padding-left 0.15s ease; }
.sidebar li a:hover { padding-left: 0.85rem; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.nav-group[open] > ul, .nav-group[open] > .nav-sub { animation: drop 0.22s ease both; }
.dropdown:not([hidden]) { animation: drop 0.15s ease both; }
.db-table tbody tr { transition: background-color 0.12s ease; }
.db-table tbody tr:hover { background: color-mix(in srgb, var(--brass) 9%, transparent); }
.ico-s { transition: transform 0.2s ease; }
.db-table tr:hover .ico-s { transform: scale(1.12); }
.infobox { transition: box-shadow 0.25s ease; }
.infobox:hover { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--brass-dim), 0 12px 28px rgba(0, 0, 0, 0.3); }
.infobox-pic .ico-l { transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.infobox:hover .infobox-pic .ico-l { transform: scale(1.08); }

/* calculators and progress */
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.07); color: var(--fg); } 100% { transform: scale(1); } }
.gadget-big { transform-origin: 0 60%; }
.gadget-big.bump { animation: bump 0.32s ease; }
.bar .fill { transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.field input, .field select { transition: border-color 0.15s ease, box-shadow 0.2s ease; }
.field input:focus, .field select:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(208, 165, 74, 0.18); }

/* theme switch */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .fx-in { opacity: 1; transform: none; }
}
@media print { .read-progress, .to-top { display: none; } }

/* the right-hand floating contents list is gone: the contents sit at the top of the page */
@media (min-width: 1360px) {
  .page:not(.journey):not(.tool) .toc { position: static; width: auto; max-height: none; overflow: visible; font-size: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-hi); padding: 0.5rem 0.9rem; margin: 1rem 0; }
}

/* the bar's menus are back */
.menu-col p a { color: inherit; text-decoration: none; }
.menu-col p a:hover { color: var(--brass); }
.menu-pop.wide { grid-template-columns: repeat(5, minmax(9rem, 1fr)); }
@media (max-width: 1299px) { .menu-pop.wide { grid-template-columns: repeat(3, minmax(9rem, 1fr)); } }
@media (max-width: 1099px) { .menu-pop.wide { grid-template-columns: repeat(2, minmax(9rem, 1fr)); } }

/* ================================================================ round 12: symbols, quieter rail, background motion ================================================================ */
.g { display: inline-block; min-width: 1.1em; margin-right: 0.4em; color: var(--brass); font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", sans-serif; font-size: 0.95em; line-height: 1; text-align: center; transition: transform 0.25s ease; }
.menu > summary:hover .g, .nav-group > summary:hover .g, .cat h3:hover .g, .menu-link:hover .g { transform: scale(1.25) rotate(-8deg); }
.nav-group > summary { gap: 0; }
.nav-group > summary .g { margin-left: 0.1rem; }
.cat h3 .g { font-size: 1.1em; }
.rail-context { margin: 0 0 0.6rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.rail-context .nav-sub { margin: 0 0 0.25rem; font-family: var(--f-pixel); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brass); }
@media (min-width: 960px) { .rail-full { display: none; } }

/* inline links: a picture for items and creatures, a symbol for everything else */
a[data-ds]::before { display: inline-block; margin-right: 0.25em; color: var(--brass-dim); font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif; font-size: 0.85em; text-decoration: none; }
a[data-ds]:has(> .ico)::before { content: none; }
a[data-ds="skills"]::before { content: "\2726"; }
a[data-ds="races"]::before { content: "\263a"; }
a[data-ds="guilds"]::before, a[data-ds="factions"]::before { content: "\2691"; }
a[data-ds="spells"]::before, a[data-ds="effects"]::before, a[data-ds="starting-spells"]::before { content: "\2727"; }
a[data-ds="potions"]::before { content: "\2697"; }
a[data-ds="professions"]::before, a[data-ds="specialisations"]::before, a[data-ds="recipes"]::before, a[data-ds="resources"]::before { content: "\2692"; }
a[data-ds="books"]::before { content: "\2761"; }
a[data-ds="regions"]::before, a[data-ds="towns"]::before { content: "\25ce"; }
a[data-ds="classes"]::before { content: "\263a"; }
a[data-ds="quests"]::before { content: "\270e"; }
a[data-ds="items"]::before, a[data-ds="magic-items"]::before, a[data-ds="materials"]::before { content: "\25c6"; }
a[data-ds="enemies"]::before { content: "\2620"; }
a[data-ds="mods"]::before { content: "\2699"; }
a[data-ds]:not([data-ds="items"]):not([data-ds="enemies"])::before { opacity: 0.9; }
.ico-t { width: 1.25em; height: 1.25em; margin: 0 0.25em 0.15em 0; vertical-align: middle; object-fit: contain; }
a[data-ds]:hover::before { color: var(--brass); }
a.tool-link::before { content: "\2699"; margin-right: 0.25em; color: var(--brass-dim); }

/* a quiet themed backdrop: embers in the dark, dust motes in the light */
.bg-fx { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-fx span { position: absolute; bottom: -24px; left: var(--x); width: var(--s); height: var(--s); background: var(--ember); opacity: 0; transform: rotate(45deg); border-radius: 1px; animation: rise var(--d) linear var(--delay) infinite; }
:root { --ember: rgba(208, 165, 74, 0.55); }
:root[data-theme="light"] { --ember: rgba(140, 100, 30, 0.35); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --ember: rgba(140, 100, 30, 0.35); } }
@keyframes rise {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(45deg); }
  10% { opacity: 0.8; }
  60% { opacity: 0.35; }
  100% { opacity: 0; transform: translate3d(var(--sway), -108vh, 0) rotate(225deg); }
}
.bg-fx::before { content: ""; position: absolute; inset: -20%; background: radial-gradient(40% 35% at 15% 85%, rgba(208, 165, 74, 0.07), transparent 70%), radial-gradient(35% 30% at 85% 15%, rgba(110, 140, 200, 0.06), transparent 70%); animation: drift 30s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate3d(-2%, 1%, 0) scale(1); } to { transform: translate3d(3%, -2%, 0) scale(1.08); } }
.sidebar, main, .site-foot { position: relative; z-index: 1; }
@media (min-width: 900px) { .sidebar { position: sticky; } }
.topbar { z-index: 50; }
@media (prefers-reduced-motion: reduce) { .bg-fx span, .bg-fx::before { animation: none; opacity: 0; } }
@media print { .bg-fx { display: none; } }

/* ================================================================ the world map ================================================================ */
.worldmap { margin: 1rem 0; }
.map-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.map-search { position: relative; flex: 1 1 14rem; max-width: 22rem; }
.map-search input { width: 100%; padding: 0.4rem 0.7rem; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.map-search input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(208, 165, 74, 0.2); }
.map-results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--panel); border: 1px solid var(--brass-dim); box-shadow: var(--shadow); }
.map-results[hidden] { display: none; }
.map-results li { display: flex; flex-direction: column; }
.map-results button { text-align: left; width: 100%; padding: 0.25rem 0.5rem; background: none; border: 0; border-radius: 4px; color: var(--fg); font: inherit; cursor: pointer; }
.map-results button:hover, .map-results button:focus-visible { background: var(--panel-2); color: var(--brass); }
.map-results li span { padding: 0 0.5rem 0.25rem; color: var(--muted); font-size: 0.8rem; }
.map-bar select { max-width: 14rem; }
.map-zoom { display: flex; gap: 0.25rem; margin-left: auto; }
.map-zoom button { min-width: 2.3rem; }
.map-chips { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; margin: 0.6rem 0; font-size: 0.92rem; }
.map-chip { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.map-chip .sw { width: 0.8rem; height: 0.8rem; border-radius: 2px; border: 1px solid rgba(0, 0, 0, 0.5); }
.map-stage { position: relative; height: clamp(300px, 64vh, 720px); overflow: hidden; background: #2a44a6; border: 1px solid var(--brass-dim); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--frame); cursor: grab; }
.map-stage:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.map-stage canvas { display: block; }
.map-tip { position: absolute; z-index: 3; display: flex; flex-direction: column; max-width: 16rem; padding: 0.3rem 0.55rem; font-size: 0.85rem; color: #fff; background: rgba(10, 12, 16, 0.92); border: 1px solid var(--brass-dim); pointer-events: none; }
.map-tip[hidden] { display: none; }
.map-tip span { color: #cfd3da; font-size: 0.78rem; }
.map-info { margin-top: 0.6rem; padding: 0.5rem 0.8rem; min-height: 2.6rem; background: var(--panel-hi); border: 1px solid var(--line); color: var(--muted); }
.map-info strong { color: var(--fg); }

.maplink { text-decoration: none; }
.maplink.in-table { margin-left: 0.45rem; color: var(--brass-dim); font-size: 0.95rem; }
.maplink.in-table:hover { color: var(--brass); }
.infobox .maplink { font-weight: 700; }

.map-styles { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.6rem 0 0; }
.map-styles button { padding: 0.3rem 0.8rem; font-size: 0.9rem; }
.map-styles button[aria-pressed="true"] { color: var(--brass-ink); background: var(--brass); border-color: var(--brass); font-weight: 700; }
.map-opts { margin-top: 0.1rem; }
.map-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0.6rem 0 0; font-size: 0.88rem; color: var(--muted); }
.map-legend:empty { display: none; }
.map-legend .lg { display: inline-flex; align-items: center; gap: 0.35rem; }
.map-legend .lg i { width: 0.9rem; height: 0.9rem; border-radius: 2px; border: 1px solid rgba(0, 0, 0, 0.45); }
.map-note { margin: 0.3rem 0 0; font-size: 0.88rem; color: var(--muted); }

.entry-body .lede { max-width: 62ch; color: var(--fg); font-size: 1.08rem; }
.entry-body .where { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.9rem; }

/* ================================================================ round 13: builds ================================================================ */
.build-block { margin: 1.8rem 0; }
.build-block h2, .build-analysis h2 { margin: 0 0 0.5rem; }
.build-list { list-style: none; margin: 0.6rem 0; padding: 0; display: grid; gap: 0.5rem; }
.build-list li { padding: 0.55rem 0.8rem; background: var(--panel-hi); border: 1px solid var(--line); border-left: 3px solid var(--brass-dim); }
.guide-list { list-style: none; margin: 0.6rem 0; padding: 0; display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.guide-list a { display: block; height: 100%; padding: 0.6rem 0.8rem; background: var(--panel-hi); border: 1px solid var(--line); text-decoration: none; color: var(--fg); }
.guide-list a:hover { border-color: var(--brass); }
.guide-list strong { display: block; color: var(--brass); }
.guide-list span { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.92rem; }
.stat-cards { display: grid; gap: 0.7rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); margin: 0.6rem 0 1rem; }
.stat-card { padding: 0.7rem 0.9rem; background: var(--panel-hi); border: 1px solid var(--line); border-top: 3px solid var(--brass); }
.stat-card strong { display: block; font-family: var(--f-pixel); font-size: 1.5rem; color: var(--brass); }
.stat-card span { display: block; font-weight: 700; }
.stat-card small { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.85rem; line-height: 1.35; }
.bonus-table .is-forbidden th, .bonus-table .is-forbidden td { color: var(--muted); text-decoration: line-through; }
.bonus-table .is-strong th { color: var(--brass); }
.skills-line { margin-top: 0.4rem; color: var(--brass); font-family: var(--f-pixel); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }

/* ================================================================ round 14: readability and finish ================================================================ */
:root {
  --fg: #f1e9d6;
  --muted: #b6ae9a;
  --line: #343b46;
  --panel: #191d23;
  --panel-2: #20252d;
  --panel-hi: #1e232b;
  --link: #efc975;
}
:root[data-theme="light"] { --fg: #181a1d; --muted: #4c5156; --line: #bfc2ba; --panel: #f5f5f1; --panel-2: #ecece6; --panel-hi: #f9f9f6; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --fg: #181a1d; --muted: #4c5156; --line: #bfc2ba; --panel: #f5f5f1; --panel-2: #ecece6; --panel-hi: #f9f9f6; } }

body { font-size: 19px; line-height: 1.64; letter-spacing: 0.003em; font-feature-settings: "kern", "liga"; }
.bg-fx { display: none; }
.bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* type */
.eyebrow { font-size: 0.86rem; letter-spacing: 0.1em; }
.page-head h1.display { font-size: clamp(2.5rem, 6vw, 3.8rem); }
.page-head { padding-bottom: 0.9rem; margin-bottom: 1rem; position: relative; }
.page-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 6rem; height: 3px; background: var(--brass); }
.lede { font-size: 1.22rem; line-height: 1.55; color: color-mix(in srgb, var(--fg) 82%, var(--muted)); max-width: 62ch; }
.prose p, .prose li, .page p, .page li { max-width: 74ch; }
.prose h2, .page .prose h2 { margin-top: 2.4rem; font-size: 1.75rem; border-bottom: 1px solid var(--line); padding-bottom: 0.35rem; }
.prose h3 { margin-top: 1.7rem; font-size: 1.3rem; color: var(--fg); }
.prose p, .prose ul, .prose ol { margin: 0.85rem 0; }
.prose li { margin: 0.35rem 0; }
.prose a, .page a:not(.chip):not(.button):not(.db-card):not(.journey-card):not(.maplink) { text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, var(--link) 55%, transparent); }
.prose a:hover { text-decoration-color: currentColor; }
.table-note, .section-lede { font-size: 0.98rem; color: var(--muted); }

/* the article panel: roomier and calmer */
main > .page, main > .view > .page { padding: 1.6rem 2.1rem 2rem; max-width: 68rem; background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, #fff 4%) 0, var(--panel) 12rem); }
@media (max-width: 700px) { main > .page, main > .view > .page { padding: 1.1rem 1.1rem 1.5rem; } }
main { padding-top: 1.5rem; }

/* the rail and the bar */
.sidebar { font-size: 1.02rem; }
@media (min-width: 900px) { .shell { grid-template-columns: 17rem minmax(0, 1fr); } }
.sidebar li a { padding: 0.32rem 0.7rem; font-size: 1.02rem; }
.sidebar li a[aria-current="page"] { font-weight: 700; background: color-mix(in srgb, var(--brass) 14%, var(--panel-2)); }
.nav-group > summary { font-size: 0.9rem; padding: 0.55rem 0.35rem; }
.rail-context .nav-sub { font-size: 0.86rem; }
.menu > summary, .menu-link { font-size: 0.92rem; padding: 0.4rem 0.75rem; }
.menu-pop a { font-size: 1.02rem; padding: 0.38rem 0.7rem; }
.top-search input { font-size: 1.02rem; padding: 0.5rem 0.8rem; }
.crumbs { font-size: 0.84rem; }

/* tables you read for a living */
.table-wrap { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.db-table, .prose table { font-size: 1rem; }
.db-table th, .db-table td, .prose th, .prose td { padding: 0.6rem 0.85rem; }
.db-table thead th, .prose thead th { position: sticky; top: var(--topbar-h); z-index: 2; background: var(--panel-2); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--brass-dim); }
.db-table tbody tr:nth-child(even), .prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.db-table tbody tr:hover { background: color-mix(in srgb, var(--brass) 11%, transparent); }
.db-table th[scope="row"] { font-weight: 600; }
.db-table td.num, .prose td.num { font-variant-numeric: tabular-nums; }
.table-wrap { max-height: none; }

/* entries */
.infobox th { font-size: 0.9rem; }
.infobox td { font-size: 1rem; }
.infobox-title { font-size: 1.7rem; }
.entry-prose .msg p { max-width: 74ch; }
.entry-body .lede { font-size: 1.12rem; }

/* cards */
.db-card, .journey-card, .cat { border-radius: 6px; border: 1px solid var(--line); background: var(--panel-hi); }
.db-card strong, .journey-card strong { font-size: 1.18rem; line-height: 1.25; }
.db-card span:not(.count), .journey-card span { color: color-mix(in srgb, var(--fg) 78%, var(--muted)); font-size: 1rem; line-height: 1.5; }
.db-card .count { font-size: 0.82rem; }
.cat h3 { font-size: 1.15rem; }
.cat li a { font-size: 1.02rem; }
.cat li span { font-size: 0.95rem; color: var(--muted); }
.quick-list a { font-size: 1.04rem; }

/* callouts, code, buttons, chips */
.callout { font-size: 1rem; }
.button { font-size: 1rem; padding: 0.65rem 1.2rem; }
.chip { font-size: 0.86rem; padding: 0.28rem 0.7rem; }
button, select { font-size: 1rem; }
.field label { font-size: 0.98rem; }
.field input, .field select { font-size: 1.02rem; padding: 0.5rem 0.7rem; }
.gadget-rows div { font-size: 1.02rem; }
.gadget-big { font-size: 2.6rem; }

/* the home page banner with the box art */
.home-hero { position: relative; overflow: hidden; }
.hero-art { display: none; }
@media (min-width: 860px) {
  .home-hero:has(.hero-art) { padding-right: 17rem !important; min-height: 20rem; }
  .hero-art { display: block; position: absolute; right: 1.6rem; top: 50%; transform: translateY(-50%) rotate(2deg); width: 13rem; box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--brass-dim), 0 18px 40px rgba(0, 0, 0, 0.55); transition: transform 0.4s ease; }
  .home-hero:hover .hero-art { transform: translateY(-50%) rotate(0deg) scale(1.03); }
  .hero-art img { display: block; width: 100%; height: auto; }
}
.tamriel { margin: 1.5rem 0 0; }
.tamriel img { width: 100%; height: auto; image-rendering: auto; border: 1px solid var(--brass-dim); }
.tamriel figcaption { margin-top: 0.4rem; color: var(--muted); font-size: 0.92rem; }
.ico-t { width: 1.4em; height: 1.4em; }
.bg-canvas { opacity: 0.72; }
