/* Terhia: Heroes — Player's Guide
   Same design language as the character creator: ink-and-gilt UI, Cinzel display, Cormorant lore, Inter UI.
   Two reading themes on one set of tokens: Ink (dark) and Parchment (light). */

:root, :root[data-theme="ink"] {
  --bg: #0d0e12;
  --ink-1: #14161c;
  --ink-2: #1b1e26;
  --ink-3: #242833;
  --ink-4: #2f3441;
  --line: #343a48;
  --line-soft: #262b36;
  --text: #ece6d9;
  --text-dim: #b3ab9b;
  --text-faint: #7b7466;
  --gilt: #d4a94f;
  --gilt-hi: #f0cf82;
  --gilt-lo: #8a6a2c;
  --link: #f0cf82;
  --accord: #9bc0f5;
  --crown: #f0cf82;
  --chimera: #93d69f;
  --bad: #e06a5a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --glow-a: rgba(212, 169, 79, .08);
  --glow-b: rgba(92, 143, 214, .06);
  --pre-bg: #efe4cc;
  --pre-ink: #2c2418;
  color-scheme: dark;
}
:root[data-theme="parchment"] {
  --bg: #f1e7d0;
  --ink-1: #ece0c4;
  --ink-2: #e6d8b8;
  --ink-3: #ddcca6;
  --ink-4: #d2bf95;
  --line: #c4ae84;
  --line-soft: #d6c49c;
  --text: #2a2117;
  --text-dim: #4f4231;
  --text-faint: #806f52;
  --gilt: #9a6b1c;
  --gilt-hi: #7a520f;
  --gilt-lo: #b8955a;
  --link: #8a4f0c;
  --accord: #2f5f9e;
  --crown: #8a6210;
  --chimera: #2f7a3e;
  --bad: #a83a2c;
  --shadow: 0 10px 30px rgba(90, 60, 20, .18);
  --glow-a: rgba(255, 255, 255, .35);
  --glow-b: rgba(150, 110, 40, .10);
  --pre-bg: #f8f1e0;
  --pre-ink: #2c2418;
  color-scheme: light;
}
:root {
  --radius: 14px;
  --font-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-lore: "Cormorant Garamond", Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --topbar: 60px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar) + 20px); }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; min-height: 100vh; transition: background .25s, color .25s;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(1200px 600px at 85% -10%, var(--glow-a), transparent 60%), radial-gradient(900px 500px at -10% 110%, var(--glow-b), transparent 60%);
}
a { color: var(--link); }
button { font: inherit; color: inherit; }
::selection { background: rgba(212, 169, 79, .35); }
.hidden { display: none !important; }

/* ——— Top bar ——— */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid var(--line-soft); }
.topbar-inner { max-width: 1480px; margin: 0 auto; height: 100%; padding: 0 20px; display: flex; align-items: center; gap: 14px; }
.brand { font-family: var(--font-display); font-weight: 700; letter-spacing: .08em; font-size: 17px; white-space: nowrap; text-decoration: none; color: var(--text); }
.brand-text > span { color: var(--gilt); }
.brand small { display: block; font-family: var(--font-ui); font-weight: 500; font-size: 10.5px; letter-spacing: .25em; color: var(--text-faint); text-transform: uppercase; }
.search-btn {
  margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--ink-1); color: var(--text-faint); cursor: pointer; font-size: 13.5px;
}
.search-btn:hover { border-color: var(--gilt-lo); color: var(--text-dim); }
.search-btn kbd, .kbd { margin-left: auto; font-family: var(--font-ui); font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--text-faint); background: var(--ink-2); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink-2); cursor: pointer; color: var(--text-dim); }
.icon-btn:hover { color: var(--text); border-color: var(--gilt-lo); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--ink-3); cursor: pointer; font-weight: 600; font-size: 13.5px; text-decoration: none; color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--ink-4); }
.btn.primary { background: linear-gradient(180deg, #f0cf82, #d4a94f); color: #20180a; border-color: #d4a94f; box-shadow: 0 6px 20px rgba(212, 169, 79, .25); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.menu-btn { display: none; }
.progress { position: fixed; top: var(--topbar); left: 0; height: 2px; width: 0; z-index: 31; background: linear-gradient(90deg, var(--gilt-lo), var(--gilt-hi)); transition: width .1s linear; }

/* ——— Shell ——— */
.shell { max-width: 1480px; margin: 0 auto; display: grid; grid-template-columns: 280px minmax(0, 1fr) 230px; gap: 36px; padding: 0 20px; }
.shell.wide { grid-template-columns: 280px minmax(0, 1fr); }

.sidebar { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; padding: 22px 4px 40px 0; scrollbar-width: thin; }
.nav-group { margin-bottom: 18px; }
.nav-group > button {
  display: flex; align-items: center; width: 100%; gap: 8px; border: 0; background: none; cursor: pointer; padding: 4px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--gilt);
}
.nav-group > button .chev { margin-left: auto; transition: transform .2s; font-size: 10px; color: var(--text-faint); }
.nav-group.closed > button .chev { transform: rotate(-90deg); }
.nav-group.closed ul { display: none; }
.nav-group ul { list-style: none; margin: 4px 0 0; padding: 0; }
.nav-group a {
  display: flex; align-items: baseline; gap: 8px; padding: 5px 10px; border-radius: 8px; text-decoration: none; color: var(--text-dim);
  font-size: 13.5px; line-height: 1.35; border-left: 2px solid transparent;
}
.nav-group a:hover { background: var(--ink-2); color: var(--text); }
.nav-group a.on { background: var(--ink-2); color: var(--text); border-left-color: var(--gilt); }
.nav-group a .n { font-size: 11px; color: var(--text-faint); min-width: 28px; font-variant-numeric: tabular-nums; }
.nav-group a .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center; }
.nav-home { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin-bottom: 14px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; }
.nav-home:hover, .nav-home.on { background: var(--ink-2); }
.nav-foot { margin-top: 18px; padding: 12px 10px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--text-faint); }

/* ——— Article ——— */
main { min-width: 0; padding: 30px 0 120px; }
.article { max-width: 820px; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.kicker { font-size: 11.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--gilt); font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { text-decoration: underline; }
.article h1 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 44px); line-height: 1.08; margin: 8px 0 6px; letter-spacing: .03em; font-weight: 600; }
.article .subtitle { font-family: var(--font-lore); font-style: italic; font-size: 21px; color: var(--text-dim); margin: 0 0 18px; }
.rule { display: flex; align-items: center; gap: 12px; color: var(--gilt); font-family: var(--font-display); font-size: 12px; letter-spacing: .25em; text-transform: uppercase; margin: 22px 0; }
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gilt-lo), transparent); }

.prose { font-size: 16px; line-height: 1.72; color: var(--text); }
.prose p { margin: 0 0 1em; }
.prose strong { color: var(--text); font-weight: 650; }
:root[data-theme="ink"] .prose strong, :root:not([data-theme]) .prose strong { color: #f6efe0; }
.prose em { font-style: italic; }
.prose h3 {
  font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: .03em; margin: 2em 0 .6em;
  padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: baseline; gap: 12px; position: relative;
}
.sec-num { font-family: var(--font-ui); font-size: 13px; font-weight: 700; color: var(--gilt); letter-spacing: .04em; }
.hlink { margin-left: 6px; opacity: 0; text-decoration: none; color: var(--text-faint); font-family: var(--font-ui); font-size: 15px; transition: opacity .15s; }
.prose h3:hover .hlink { opacity: 1; }
.prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--gilt); }
.prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose ol li { margin: .45em 0; padding-left: .2em; }
.prose ol li::marker { color: var(--gilt); font-weight: 700; }
.prose code { font-size: .88em; background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: 5px; padding: 1px 5px; }
a.xref { text-decoration: none; border-bottom: 1px dotted currentColor; font-weight: 600; white-space: nowrap; }
a.xref:hover { border-bottom-style: solid; }
a.xref.ext::after { content: "↗"; font-size: .75em; margin-left: 2px; opacity: .7; }
.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 30% { background: rgba(212, 169, 79, .22); } 100% { background: transparent; } }

/* Tables */
.tbl { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--ink-1); }
.tbl table { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.5; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); background: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--gilt) 5%, transparent); }
.tbl td:first-child { font-weight: 500; }
.tbl .c { text-align: center; }

/* The character sheet block */
.doc-pre {
  background: var(--pre-bg); color: var(--pre-ink); border-radius: 6px; padding: 22px; overflow-x: auto; font-size: 12.5px; line-height: 1.55;
  box-shadow: inset 0 0 60px rgba(110, 80, 30, .2), var(--shadow); border: 1px solid rgba(90, 65, 25, .3); margin: 0 0 1.4em;
}

/* Ability cards on class pages */
.ab-list { display: grid; gap: 10px; margin: 0 0 1.4em; }
.ab { border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; background: var(--ink-1); border-left: 3px solid var(--accent, var(--gilt-lo)); }
.ab.core { background: linear-gradient(90deg, color-mix(in srgb, var(--accent, var(--gilt)) 10%, var(--ink-1)), var(--ink-1)); }
.ab-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ab-n { font-family: var(--font-display); font-size: 16.5px; font-weight: 600; letter-spacing: .02em; }
.ab-rank { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent, var(--gilt)); min-width: 58px; }
.ab-m { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 6px 0 4px; }
.chip-s { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--ink-3); color: var(--text-dim); border: 1px solid var(--line-soft); }
.chip-s.strain { color: var(--gilt-hi); border-color: color-mix(in srgb, var(--gilt) 45%, transparent); }
.ab-range { font-size: 12.5px; color: var(--text-faint); }
.ab-fx { font-size: 14.5px; line-height: 1.6; color: var(--text-dim); }
.ab.core .ab-fx { margin-top: 4px; }
.rank-h { display: flex; align-items: baseline; gap: 12px; margin: 1.6em 0 .7em; font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: .08em; color: var(--accent, var(--gilt)); text-transform: uppercase; }
.rank-h::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); align-self: center; }
.rank-h em { font-family: var(--font-ui); text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text-faint); font-weight: 400; order: 2; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--ink-3); color: var(--text-dim); border: 1px solid var(--line-soft); font-family: var(--font-ui); letter-spacing: .02em; }
.tag.req { color: var(--accord); border-color: color-mix(in srgb, var(--accord) 45%, transparent); }
.tag.elem-fire { color: #e8826c; border-color: rgba(208, 80, 58, .5); background: rgba(208, 80, 58, .12); }
.tag.elem-frost { color: #6fb3d8; border-color: rgba(120, 190, 230, .5); background: rgba(120, 190, 230, .12); }
.tag.elem-storm { color: #a88be8; border-color: rgba(160, 130, 230, .5); background: rgba(160, 130, 230, .12); }
.tag.elem-stone { color: #b99a64; border-color: rgba(170, 140, 90, .55); background: rgba(170, 140, 90, .14); }
.tag.accord { color: var(--accord); border-color: color-mix(in srgb, var(--accord) 45%, transparent); }
.tag.crown { color: var(--crown); border-color: color-mix(in srgb, var(--crown) 45%, transparent); }
.tag.chimera { color: var(--chimera); border-color: color-mix(in srgb, var(--chimera) 45%, transparent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }

/* Class hero */
.class-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 18px; }
.class-hero figure { margin: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 2 / 3; border: 1px solid var(--line-soft); background: var(--ink-2); }
.class-hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; display: block; transition: transform .5s; }
.class-hero figure:hover img { transform: scale(1.04); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0 0 20px; }
.fact { border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 12px; background: var(--ink-1); }
.fact span { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); }
.fact b { font-weight: 600; font-size: 14px; }

/* Culture hero */
.banners { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 18px; }
@media (max-width: 640px) { .banners { grid-template-columns: 1fr; } }
.banner { position: relative; border-radius: 12px; overflow: hidden; min-height: 170px; display: flex; align-items: flex-end; border: 1px solid var(--line-soft); background: var(--ink-2) center/cover no-repeat; text-decoration: none; color: #fff; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(8, 8, 12, .85)); }
.banner .inner { position: relative; z-index: 1; padding: 12px 14px; display: flex; justify-content: space-between; align-items: flex-end; width: 100%; gap: 8px; }
.banner h4 { margin: 0; font-family: var(--font-display); font-size: 21px; letter-spacing: .04em; }
.banner .tag { background: rgba(10, 10, 14, .6); }

/* Map */
.map-wrap { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); margin: 6px 0 22px; background: #0a1a26; }
.map-wrap img { display: block; width: 100%; height: auto; }
.map-pin { position: absolute; transform: translate(-50%, -50%); padding: 4px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: rgba(13, 14, 18, .78); color: #fff; text-decoration: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); backdrop-filter: blur(4px); white-space: nowrap; transition: transform .15s, background .15s; }
.map-pin:hover { transform: translate(-50%, -50%) scale(1.08); background: #d4a94f; color: #1b1407; }
@media (max-width: 640px) { .map-pin { font-size: 9px; padding: 2px 6px; } }

/* Prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.pager a { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--ink-1); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.pager a:hover { border-color: var(--gilt); transform: translateY(-2px); }
.pager a span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }
.pager a b { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.pager a.next { text-align: right; grid-column: 2; }
.page-meta { margin-top: 18px; font-size: 12px; color: var(--text-faint); }

/* On this page */
.toc { position: sticky; top: var(--topbar); align-self: start; max-height: calc(100vh - var(--topbar)); overflow-y: auto; padding: 32px 0 40px; font-size: 13px; }
.toc h5 { margin: 0 0 10px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.toc a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--line-soft); color: var(--text-faint); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--gilt-hi); border-left-color: var(--gilt); }
.toc .toc-actions { margin-top: 18px; display: grid; gap: 8px; }

/* ——— Home ——— */
.home-hero { position: relative; border-radius: 18px; overflow: hidden; min-height: 380px; display: flex; align-items: flex-end; margin-bottom: 26px; border: 1px solid var(--line-soft); background: linear-gradient(180deg, rgba(13, 14, 18, .15) 0%, rgba(13, 14, 18, .88) 78%), url("../assets/hero.jpg") center 35%/cover no-repeat; color: #f3ecdd; }
.home-hero .inner { padding: 32px; max-width: 720px; }
.home-hero .eyebrow { letter-spacing: .4em; text-transform: uppercase; font-size: 12px; color: #f0cf82; }
.home-hero h1 { font-family: var(--font-display); font-size: clamp(38px, 6vw, 64px); margin: 8px 0; line-height: 1; letter-spacing: .04em; }
.home-hero h1 span { color: #d4a94f; }
.home-hero p { font-family: var(--font-lore); font-style: italic; font-size: 21px; margin: 0 0 20px; color: #e6dcc6; }
.home-hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.home-hero .btn:not(.primary) { background: rgba(20, 22, 28, .7); color: #f3ecdd; border-color: rgba(255, 255, 255, .2); }
.section-title { font-family: var(--font-display); font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--gilt-hi); margin: 30px 0 12px; font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
.section-title small { font-family: var(--font-ui); text-transform: none; letter-spacing: 0; color: var(--text-faint); font-weight: 400; font-size: 12.5px; margin-left: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px; border: 1px solid var(--line-soft); background: linear-gradient(180deg, var(--ink-2), var(--ink-1)); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--gilt-lo); transform: translateY(-2px); }
.card .n { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--gilt); text-transform: uppercase; }
.card b { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.card p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.class-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .class-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .class-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.class-tile { position: relative; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-soft); text-decoration: none; color: #fff; }
.class-tile img { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; transition: transform .5s; }
.class-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(8, 8, 12, .9)); }
.class-tile:hover img { transform: scale(1.05); }
.class-tile span { position: absolute; left: 10px; right: 10px; bottom: 9px; z-index: 1; font-family: var(--font-display); font-size: 15px; letter-spacing: .04em; }
.class-tile small { display: block; font-family: var(--font-ui); font-size: 10.5px; color: #d6cebe; letter-spacing: .04em; }
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.glance .tile { border: 1px solid var(--line-soft); border-radius: 14px; padding: 16px; background: var(--ink-1); }
.glance .tile.span2 { grid-column: span 2; }
@media (max-width: 640px) { .glance .tile.span2 { grid-column: auto; } }
.glance .tile h4 { margin: 0 0 8px; font-family: var(--font-display); font-size: 15px; letter-spacing: .06em; color: var(--gilt-hi); font-weight: 600; }
.glance .tile p { margin: 0 0 8px; font-size: 13.5px; color: var(--text-dim); line-height: 1.55; }
.loot-panel { margin: 0 0 26px; padding: 0 0 22px; border-bottom: 1px solid var(--line-soft); }
.loot-panel .section-title { margin-top: 0; }
.loot-lede { margin: 0 0 12px; color: var(--text-dim); font-size: 14px; }
.loot-lede a { color: var(--link); }
.glance .tile .steps { margin: 0 0 10px; padding-left: 1.3em; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.glance .tile .steps li { margin: .3em 0; }
.glance .tile .steps li::marker { color: var(--gilt); font-weight: 700; }
.glance .tile .steps b { color: var(--text); font-weight: 600; }
.formula { font-family: var(--font-display); font-size: 19px; letter-spacing: .02em; margin: 2px 0 8px; color: var(--text); }
.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini td, .mini th { padding: 4px 6px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.mini th { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.moons { display: flex; flex-wrap: wrap; gap: 6px; }
.moon { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-soft); background: var(--ink-2); }

/* ——— Search palette ——— */
.palette-bg { position: fixed; inset: 0; z-index: 60; background: rgba(5, 5, 8, .55); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.palette { width: min(680px, 100%); max-height: 72vh; display: flex; flex-direction: column; border-radius: 16px; background: var(--ink-1); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.palette-input svg { width: 18px; height: 18px; stroke: var(--text-faint); fill: none; stroke-width: 1.8; flex: none; }
.palette-input input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--text); }
.palette-results { overflow-y: auto; padding: 8px; }
.result { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); cursor: pointer; }
.result.on, .result:hover { background: var(--ink-3); }
.result .r-top { display: flex; gap: 8px; align-items: baseline; }
.result .r-sec { font-size: 11px; font-weight: 700; color: var(--gilt); min-width: 34px; }
.result .r-title { font-weight: 600; }
.result .r-page { margin-left: auto; font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.result .r-snip { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result mark { background: rgba(212, 169, 79, .3); color: inherit; border-radius: 3px; padding: 0 1px; }
.palette-empty { padding: 26px; text-align: center; color: var(--text-faint); font-size: 14px; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--text-faint); }

/* ——— Unified header: brand · site switcher · search · theme (identical in players/ and gms/) ——— */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 14px; height: 14px; flex: none; background: var(--gilt); transform: rotate(45deg); border-radius: 2px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gilt) 22%, transparent); }
.brand-text { display: block; }
.sites { margin-left: auto; display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; border: 1px solid var(--line); background: var(--ink-1); }
.sites a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--text-dim); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .15s, color .15s; }
.sites a svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; flex: none; }
.sites a:hover { color: var(--text); background: var(--ink-3); }
.sites a[aria-current="page"] { background: linear-gradient(180deg, #f0cf82, #d4a94f); color: #20180a; }
.sites .short { display: none; }
.search-btn { margin-left: 0; }
@media (max-width: 1200px) { .search-btn { min-width: 200px; } }
@media (max-width: 1080px) { .sites .full { display: none; } .sites .short { display: inline; } }
@media (max-width: 900px) { .search-btn { min-width: 0; flex: 0 0 auto; width: 36px; height: 36px; padding: 0; justify-content: center; } .search-btn .label, .search-btn kbd { display: none; } }
@media (max-width: 640px) {
  .brand-text { display: none; }
  .sites a { padding: 6px 9px; font-size: 12px; gap: 5px; }
}
@media (max-width: 400px) { .sites a svg { display: none; } }

/* ——— Responsive ——— */
@media (max-width: 1200px) { .shell { grid-template-columns: 260px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 900px) {
  .shell, .shell.wide { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .sidebar { position: fixed; top: var(--topbar); left: 0; bottom: 0; width: 300px; max-width: 86vw; z-index: 40; background: var(--bg); border-right: 1px solid var(--line); padding: 18px 12px 40px; transform: translateX(-102%); transition: transform .25s ease; height: auto; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: var(--topbar) 0 0 0; background: rgba(0, 0, 0, .4); z-index: 35; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .brand small { display: none; }
  .shell { padding: 0 16px; }
  .class-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .prose { font-size: 15.5px; }
  .home-hero .inner { padding: 20px; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: auto; }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .progress, .palette-bg { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
}

/* ——— Lightbox: any element with data-lb opens its image full-size ——— */
[data-lb] { cursor: zoom-in; }
.lb { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 4vh 4vw; background: rgba(6, 7, 10, .9); backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s; }
.lb.open { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.lb figure { position: relative; margin: 0; max-width: min(1400px, 92vw); display: flex; flex-direction: column; align-items: center; transform: scale(.97); transition: transform .25s ease; }
.lb.open figure { transform: scale(1); }
.lb img { max-width: 100%; max-height: 84vh; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-2); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.lb figcaption { margin-top: 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--text-dim); text-align: center; }
.lb-close { position: absolute; top: -44px; right: -4px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--ink-2); color: var(--text); font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: border-color .2s, color .2s; }
.lb-close:hover { border-color: var(--gilt); color: var(--gilt); }
@media (max-width: 640px) { .lb-close { top: -40px; right: 0; } }
