/* MageQuest site styles.
   Light theme: warm parchment and cream with ink text.
   Dark theme: deep indigo night sky with parchment cards.
   Colours are tokens on :root; dark mode via prefers-color-scheme or data-theme. */
:root {
  --page: #f5ecd6;
  --page-2: #ebdcb8;
  --ink: #2a2117;
  --ink-soft: #5b4c39;
  --link: #7a2e0e;
  --link-hover: #a33a12;
  --card: #fbf3df;
  --card-2: #f0e2bf;
  --card-ink: #2a2117;
  --card-soft: #5a4a33;
  --card-link: #7a2e0e;
  --gold: #b8892f;
  --gold-soft: #d8b86a;
  --gold-deep: #8a6418;
  --header: #14143a;
  --header-2: #23235e;
  --header-ink: #f3e9cf;
  --focus: #1d6a93;
  --shadow: 0 1px 2px rgba(60, 40, 10, .10), 0 6px 18px rgba(60, 40, 10, .10);
  --shadow-lift: 0 2px 4px rgba(60, 40, 10, .14), 0 12px 28px rgba(60, 40, 10, .16);
  --radius: 14px;
  --spine: #b8892f;
  --stars: .0;
  --font-head: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0f0f29; --page-2: #1c1c48; --ink: #ede5d0; --ink-soft: #c4bbd4;
    --link: #f1c27a; --link-hover: #ffd99a; --card: #f1e3c2; --card-2: #e4d1a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 22px rgba(0, 0, 0, .35);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, .5), 0 14px 32px rgba(0, 0, 0, .45);
    --focus: #8fd0ff; --spine: #d8b86a; --stars: .55; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0f0f29; --page-2: #1c1c48; --ink: #ede5d0; --ink-soft: #c4bbd4;
  --link: #f1c27a; --link-hover: #ffd99a; --card: #f1e3c2; --card-2: #e4d1a5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 22px rgba(0, 0, 0, .35);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .5), 0 14px 32px rgba(0, 0, 0, .45);
  --focus: #8fd0ff; --spine: #d8b86a; --stars: .55; color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background-color: var(--page);
  font: 17px/1.6 var(--font-body); min-height: 100vh; overflow-wrap: anywhere; overflow-x: clip;
  background-image:
    radial-gradient(1px 1px at 30px 40px, rgba(255, 255, 255, var(--stars)), transparent 70%),
    radial-gradient(1px 1px at 140px 120px, rgba(255, 236, 190, var(--stars)), transparent 70%),
    radial-gradient(1.5px 1.5px at 230px 60px, rgba(255, 255, 255, var(--stars)), transparent 70%),
    radial-gradient(1px 1px at 300px 190px, rgba(255, 255, 255, var(--stars)), transparent 70%),
    radial-gradient(ellipse 120% 60% at 50% 0%, var(--page-2), var(--page) 70%);
  background-size: 320px 240px, 320px 240px, 320px 240px, 320px 240px, 100% 100%;
  background-attachment: fixed;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; letter-spacing: .015em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 4.6vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 .85em; }
.small { font-size: .875rem; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 40px; }
main.bare { padding-bottom: 40px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; color: #000; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* parchment surfaces */
.card, .block, .filters, .crumbs ol, .table-wrap, .page-hero, .prose, details.branch {
  --link: var(--card-link); --link-hover: #a33a12; --ink-soft: var(--card-soft);
  color: var(--card-ink);
}
.card, .block, .filters, .page-hero {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--gold); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 4px rgba(255, 250, 232, .5), inset 0 0 0 5px rgba(184, 137, 47, .25);
}
.card, .block { padding: 18px 20px; margin: 0 0 20px; }
.block > h2:first-child { margin-bottom: .7em; }
.block h3 { margin-top: 1.1em; }

/* ornamental gold divider under section headings */
h2.orn::after {
  content: ""; display: block; height: 12px; margin-top: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='12' viewBox='0 0 160 12'%3E%3Cpath d='M0 6h66M94 6h66' stroke='%23b8892f' stroke-width='1.4'/%3E%3Cpath d='M80 1l5 5-5 5-5-5z' fill='%23b8892f'/%3E%3Ccircle cx='70' cy='6' r='1.7' fill='%23b8892f'/%3E%3Ccircle cx='90' cy='6' r='1.7' fill='%23b8892f'/%3E%3C/svg%3E") left center / 160px 12px no-repeat;
}
h2.orn.center::after { background-position: center; }
.home-band h2.orn { color: var(--ink); }

/* ---------------------------------------------------------------- header */
.site-header {
  position: relative; z-index: 50; color: var(--header-ink);
  background:
    radial-gradient(1px 1px at 24px 18px, rgba(255, 255, 255, .8), transparent 70%),
    radial-gradient(1px 1px at 110px 52px, rgba(255, 238, 200, .7), transparent 70%),
    radial-gradient(1.5px 1.5px at 190px 26px, rgba(255, 255, 255, .6), transparent 70%),
    radial-gradient(1px 1px at 262px 70px, rgba(255, 255, 255, .7), transparent 70%),
    radial-gradient(1px 1px at 330px 40px, rgba(255, 230, 180, .6), transparent 70%),
    linear-gradient(180deg, var(--header-2), var(--header));
  background-size: 360px 90px, 360px 90px, 360px 90px, 360px 90px, 360px 90px, auto;
  border-bottom: 1px solid var(--gold); box-shadow: 0 1px 0 rgba(216, 184, 106, .35), 0 4px 14px rgba(0, 0, 0, .3);
}
@media (min-width: 900px) { .site-header { position: sticky; top: 0; } }
.hwrap { max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; min-height: 64px; }
.brand { flex: 0 0 auto; display: block; border-radius: 8px; }
.brand img { height: 52px; width: auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45)); }
.tools {
  display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 4px; border-radius: 14px;
  background: rgba(255, 236, 190, .07); border: 1px solid rgba(216, 184, 106, .35);
}
.menu-btn, .theme-btn {
  background: rgba(255, 236, 190, .08); color: var(--header-ink); border: 1px solid rgba(216, 184, 106, .5);
  border-radius: 10px; padding: 7px 11px; font: 600 .9rem var(--font-body); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
.menu-btn:hover, .theme-btn:hover { background: rgba(255, 236, 190, .18); }
.menu-btn { display: none; }
.theme-text { font-size: .85rem; }
.search { position: relative; }
.search input {
  width: 240px; max-width: 100%; padding: 8px 12px 8px 34px; border-radius: 10px; border: 1px solid var(--gold-soft);
  background: #fcf6e6; color: #2a2117; font: inherit; font-size: .95rem; min-height: 40px;
}
.search input::placeholder { color: #6d5d45; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #5a4a33; pointer-events: none; display: flex; }
.results {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(440px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  list-style: none; margin: 0; padding: 6px; z-index: 60; background: var(--card); color: var(--card-ink);
  border: 1px solid var(--gold); border-radius: 12px; box-shadow: var(--shadow-lift);
}
.results li a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; border-radius: 8px; color: #2a2117; text-decoration: none; }
.results li a:hover, .results li[aria-selected="true"] a { background: #ecd9a8; }
.results .k { font-size: .8rem; color: #5a4a33; white-space: nowrap; }
.results .none { padding: 8px 10px; color: #5a4a33; }
.sw { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: .88rem; user-select: none; padding: 0 6px; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-track { width: 38px; height: 22px; border-radius: 22px; background: #4b4b7e; border: 1px solid var(--gold-soft); position: relative; flex: 0 0 auto; transition: background .15s; }
.sw-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #f3e9cf; transition: transform .15s; }
.sw input:checked + .sw-track { background: #b8892f; }
.sw input:checked + .sw-track::after { transform: translateX(16px); }
.sw input:focus-visible + .sw-track { outline: 3px solid #8fd0ff; outline-offset: 2px; }
.no-js .sw, .no-js .theme-btn { display: none; }

.site-nav { border-top: 1px solid rgba(216, 184, 106, .25); background: rgba(8, 8, 30, .28); }
.nwrap { max-width: 1180px; margin: 0 auto; padding: 0 10px; display: flex; flex-wrap: wrap; gap: 2px; }
.site-nav a {
  color: var(--header-ink); text-decoration: none; padding: 10px 12px 9px; font-weight: 600; font-size: .95rem;
  letter-spacing: .02em; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.site-nav a:hover { color: #fff; border-bottom-color: rgba(216, 184, 106, .6); }
.site-nav a[aria-current="page"] { color: #ffe3a3; border-bottom-color: #e0b85a; }

@media (max-width: 899px) {
  .menu-btn { display: inline-flex; order: 2; margin-left: auto; }
  .brand { order: 1; }
  .tools { order: 3; width: 100%; margin-left: 0; }
  .search { flex: 1 1 auto; }
  .search input { width: 100%; }
  .results { left: 0; right: auto; width: 100%; }
  .js .site-nav { display: none; }
  .js .site-nav.open { display: block; }
  .nwrap { display: grid; grid-template-columns: 1fr 1fr; padding: 6px 12px 12px; gap: 4px; }
  .site-nav a { padding: 11px 12px; border: 1px solid rgba(216, 184, 106, .25); border-radius: 10px; background: rgba(255, 236, 190, .05); }
  .site-nav a[aria-current="page"] { border-color: #e0b85a; background: rgba(224, 184, 90, .14); }
}
@media (max-width: 480px) {
  .sw-text, .theme-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .brand img { height: 44px; }
}

/* ---------------------------------------------------- breadcrumbs, heads */
.crumbs { margin: 16px 0 12px; }
.crumbs ol {
  list-style: none; display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px 14px; margin: 0; font-size: .875rem;
  background: var(--card); border: 1px solid var(--gold-soft); border-radius: 999px;
}
.crumbs li + li::before { content: "\203A"; margin-right: 4px; color: var(--card-soft); }
.page-head { margin: 8px 0 16px; }
.page-head h1 { margin-bottom: .3em; }
.lead { font-size: 1.08rem; max-width: 70ch; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 .6em; }

.page-hero {
  --tint: 216, 172, 80; position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 8px 24px; align-items: center; padding: 22px 24px; margin: 6px 0 20px;
}
.page-hero.has-art { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.page-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 120% at 0% 50%, rgba(var(--tint), .22), rgba(var(--tint), 0) 70%);
}
.page-hero > * { position: relative; }
.page-hero h1 { margin-bottom: .25em; }
.page-hero .lead { margin: .5em 0 0; color: var(--card-ink); }
.eyebrow { font: 700 .78rem var(--font-body); text-transform: uppercase; letter-spacing: .14em; color: var(--card-soft); margin: 0 0 .35em; }
.hero-art { display: flex; justify-content: center; align-items: center; min-height: 170px; padding: 14px; border-radius: 20px; }
.hero-art img { max-height: 320px; width: auto; filter: drop-shadow(0 6px 12px rgba(50, 30, 5, .28)); }
.art-glow { background: radial-gradient(closest-side, rgba(255, 252, 240, .95), rgba(var(--tint), .30) 55%, rgba(var(--tint), 0) 100%); }
.tint-flame { --tint: 235, 111, 58; }
.tint-tide { --tint: 74, 188, 220; }
.tint-arcane { --tint: 160, 146, 229; }
.tint-shadow { --tint: 150, 95, 200; }
.tint-light { --tint: 240, 196, 70; }
.tint-astral { --tint: 60, 170, 180; }
.tint-gold { --tint: 216, 172, 80; }

/* ------------------------------------------------------------------ chips */
.chip {
  display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 999px; font-size: .8rem; font-weight: 650; line-height: 1.65;
  background: #ead7a6; color: #2a2117; border: 1px solid rgba(120, 90, 30, .35); white-space: nowrap; margin-right: 4px;
  text-decoration: none; vertical-align: middle;
}
a.chip:hover { background: #dec48a; color: #2a2117; }
.chip.school, .chip.rarity, .chip.cat, .chip.tier { border-color: rgba(0, 0, 0, .12); }
.s-flame { background: #b83c12 !important; color: #fff !important; }
.s-tide { background: #1d6a93 !important; color: #fff !important; }
.s-arcane { background: #6247b8 !important; color: #fff !important; }
.s-shadow { background: #4a2770 !important; color: #fff !important; }
.s-light { background: #e2b33c !important; color: #2a1a05 !important; }
.s-astral { background: #23707a !important; color: #fff !important; }
.s-any { background: #6b6253 !important; color: #fff !important; }
.r-common { background: #6b655a; color: #fff; }
.r-uncommon { background: #3f7a41; color: #fff; }
.r-rare { background: #3d58a0; color: #fff; }
.r-epic { background: #77479a; color: #fff; }
.r-legendary { background: #e0a83e; color: #2a1a05; }
.t-bronze { background: #e3ad7d; color: #2a1a05; }
.t-silver { background: #cfd8e3; color: #1d2430; }
.t-gold { background: #ecc054; color: #2a1a05; }
.t-mythic { background: #8456c9; color: #fff; }
.cat-main { --cat: #c9962c; }
.cat-side { --cat: #3f7a41; }
.cat-training { --cat: #1d6a93; }
.cat-orientation { --cat: #6b6253; }
.cat-craft { --cat: #8a5a2b; }
.cat-pastime { --cat: #587a26; }
.cat-discipline { --cat: #23707a; }
.chip.cat { background: var(--cat); color: #fff; }
.chip.cat-main { color: #2a1a05; }
.chip .si { display: inline-block; width: 14px; height: auto; margin-right: 4px; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .45)); }
.count-badge { font: 600 .8rem var(--font-body); background: #ead7a6; color: #2a2117; border-radius: 999px; padding: 1px 9px; vertical-align: middle; }

/* ---------------------------------------------------- facts, lists, prose */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 14px; }
.facts div {
  min-width: 0; padding: 9px 13px; border-radius: 12px;
  background: rgba(255, 252, 240, .65); border: 1px solid rgba(184, 137, 47, .35);
}
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--card-soft); font-weight: 700; }
.facts dd { margin: 3px 0 0; font-weight: 600; }
.effect { font-size: 1.06rem; margin: 6px 0; max-width: 72ch; }
.flavour { font-style: italic; color: var(--card-soft); max-width: 72ch; }
.body { margin-bottom: 20px; }
.block p, .card p { max-width: 78ch; }
ul.cols { columns: 2 260px; column-gap: 28px; }
ul.cols li { break-inside: avoid; }
ul.inline-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
ul.stats { list-style: none; padding: 0; margin: 0; }
ul.sources li, ul.rewards li, ul.objectives li { margin: 5px 0; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; }
.prevnext { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
ol.steps li { margin: 7px 0; }
details.more summary, details.schools summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
details.schools { margin-bottom: 14px; }
.school-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 10px; }
.school-grid .card { margin: 0; }

/* ----------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 14px; border-radius: 12px;
  border: 1px solid rgba(160, 120, 45, .55); background: linear-gradient(180deg, var(--card), var(--card-2));
  box-shadow: var(--shadow);
}
.block .table-wrap { box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 9px 11px; vertical-align: top; border-bottom: 1px solid rgba(160, 120, 45, .28); }
th { background: #ead59f; font-weight: 700; white-space: nowrap; font-size: .85rem; letter-spacing: .02em; }
tbody tr:nth-child(even) { background: rgba(225, 205, 155, .22); }
tbody tr:hover { background: rgba(236, 214, 160, .55); }
table.list td:first-child { font-weight: 600; min-width: 9em; }
table.list td { overflow-wrap: normal; word-break: normal; }
.spells-table td:nth-child(7) { min-width: 16em; }
tr[hidden] { display: none !important; }
a.named { display: inline-flex; align-items: center; gap: 10px; }
.tb { flex: 0 0 auto; width: 58px; min-height: 58px; display: flex; align-items: center; justify-content: center; }
.tb img { max-width: 56px; max-height: 70px; width: auto; height: auto; }
@media (max-width: 640px) {
  table.list { min-width: 560px; }
  table.list td:first-child { min-width: 10.5em; }
  .tb { width: 46px; min-height: 46px; }
  .tb img { max-width: 44px; max-height: 60px; }
}

/* grid ("pictures") view of list tables: same rows, laid out as tiles */
table.as-grid, table.as-grid tbody { display: block; min-width: 0 !important; }
table.as-grid thead { display: none; }
table.as-grid tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; padding: 14px; }
table.as-grid tr {
  display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 4px; text-align: center;
  padding: 12px 8px 10px; border-radius: 14px; background: rgba(255, 252, 240, .72) !important;
  border: 1px solid rgba(184, 137, 47, .4); transition: transform .12s, box-shadow .12s;
}
table.as-grid tr:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
table.as-grid td { border: 0; padding: 0; display: block; min-width: 0 !important; }
table.as-grid td:first-child { flex: 1 0 100%; }
table.as-grid td.lo { display: none; }
table.as-grid .chip { margin: 0; font-size: .75rem; }
table.as-grid a.named { flex-direction: column; gap: 6px; text-decoration: none; font-family: var(--font-head); font-size: .98rem; line-height: 1.25; }
table.as-grid a.named span:last-child { text-decoration: underline; text-decoration-color: rgba(122, 46, 14, .35); text-underline-offset: 3px; }
table.as-grid .tb {
  width: 116px; height: 116px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 246, 222, .5) 65%, rgba(255, 246, 222, 0));
}
table.as-grid .tb img { max-width: 108px; max-height: 108px; }
table.spells-table.as-grid .tb { height: 140px; width: 110px; border-radius: 12px; }
table.spells-table.as-grid .tb img { max-width: 96px; max-height: 134px; }
@media (max-width: 480px) {
  table.as-grid tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
  table.as-grid .tb { width: 96px; height: 96px; }
  table.as-grid .tb img { max-width: 90px; max-height: 90px; }
}

/* ---------------------------------------------------------------- filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 14px 16px; margin: 0 0 16px; }
.filters label { display: flex; flex-direction: column; font-size: .8rem; font-weight: 700; gap: 3px; flex: 1 1 130px; min-width: 0; }
.filters input, .filters select {
  font: inherit; font-size: .95rem; font-weight: 400; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--gold);
  background: #fffaf0; color: #2a2117; min-height: 40px; width: 100%;
}
.filters .count { margin: 0; font-size: .875rem; flex: 1 0 auto; color: var(--card-soft); align-self: center; }
.view-toggle { display: inline-flex; border: 1px solid var(--gold); border-radius: 10px; overflow: hidden; flex: 0 0 auto; }
.vbtn { font: 600 .9rem var(--font-body); padding: 8px 14px; background: #fffaf0; color: #2a2117; border: 0; cursor: pointer; min-height: 40px; }
.vbtn + .vbtn { border-left: 1px solid var(--gold); }
.vbtn[aria-pressed="true"] { background: #2a2a66; color: #fff3d6; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-block; text-decoration: none; font-weight: 700; padding: 10px 20px; border-radius: 12px;
  background: linear-gradient(180deg, #f6d27a, #d99d2b); color: #2a1a05 !important; border: 1px solid #8a6418;
  box-shadow: 0 2px 0 #8a6418, var(--shadow); cursor: pointer; font-size: 1rem; font-family: var(--font-body);
  transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); text-decoration: none; }
.btn-ghost { background: #fcf6e6; }
.btn-small { padding: 6px 13px; font-size: .9rem; box-shadow: 0 1px 0 #8a6418; }
.btn-play { font-size: clamp(1.15rem, 3vw, 1.4rem); padding: 15px 36px; font-family: var(--font-head); letter-spacing: .05em; border-radius: 14px; box-shadow: 0 3px 0 #8a6418, 0 0 0 4px rgba(246, 210, 122, .25), 0 10px 30px rgba(0, 0, 0, .35); }

/* ----------------------------------------------------- art on backdrops */
.art-bg { background: radial-gradient(closest-side, rgba(255, 252, 240, .95), rgba(255, 247, 226, .6) 62%, rgba(233, 216, 174, 0) 100%); border-radius: 14px; }
.iconed { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.iconed img { width: auto; max-height: 32px; max-width: 40px; }
.variant-strip { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.variant-strip figure { margin: 0; text-align: center; width: 136px; }
.variant-strip .art-bg { display: flex; height: 150px; align-items: center; justify-content: center; }
.variant-strip img { max-height: 140px; max-width: 130px; width: auto; height: auto; }
.variant-strip figcaption { margin-top: 4px; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }

/* -------------------------------------------------------------------- home */
.home-hero { position: relative; min-height: min(78vh, 680px); display: flex; align-items: center; color: #f8f0dc; border-bottom: 1px solid var(--gold); }
.hero-bg, .hero-bg picture, .hero-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, rgba(10, 10, 36, .35), rgba(10, 10, 36, .78) 75%),
              linear-gradient(180deg, rgba(10, 10, 36, .3), rgba(10, 10, 36, .2) 50%, rgba(10, 10, 36, .85));
}
.hero-inner { position: relative; padding: clamp(32px, 7vw, 72px) 16px; text-align: center; max-width: 780px; margin: 0 auto; }
.logo-h1 { margin: 0 auto 6px; max-width: 600px; }
.logo-h1 img { margin: 0 auto; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .6)); }
.tagline { font-family: var(--font-head); font-size: clamp(1.1rem, 3vw, 1.45rem); color: #ffe3a3; text-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.pitch { font-size: 1.08rem; line-height: 1.65; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); max-width: 64ch; margin-left: auto; margin-right: auto; }
.home-hero .social { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; }
.home-hero .social a { color: #ffe3a3; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.cta { margin: 18px 0; }
.home-band { margin: 44px 0; }
.home-band > h2 { text-align: center; }
.school-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.school-tile {
  --sc: #b8892f; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 10px 14px;
  border-radius: var(--radius); text-decoration: none; color: var(--card-ink) !important;
  background: linear-gradient(180deg, var(--card), var(--card-2)); border: 1px solid var(--gold); border-top: 5px solid var(--sc);
  box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s;
}
.school-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.school-icon { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0)); }
.school-icon img { max-width: 56px; max-height: 60px; width: auto; height: auto; }
.s-tile-flame { --sc: #b83c12; } .s-tile-tide { --sc: #1d6a93; } .s-tile-arcane { --sc: #6247b8; }
.s-tile-shadow { --sc: #4a2770; } .s-tile-light { --sc: #e2b33c; }
.tile-title { display: block; font-family: var(--font-head); font-weight: 700; font-size: 1.08rem; line-height: 1.25; }
.tile-text { display: block; font-size: .92rem; color: var(--card-soft); line-height: 1.45; }
.stat { display: block; font-family: var(--font-head); font-size: 1.2rem; color: var(--gold-deep); margin: 2px 0; }
.more { display: inline-block; margin-top: 8px; font-weight: 700; color: var(--card-link); }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.feature { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--card-ink) !important; margin: 0; transition: transform .12s, box-shadow .12s; }
.feature:hover, .tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.feature-art { display: flex; justify-content: center; align-items: flex-end; gap: 8px; padding: 8px 4px; margin: 0 0 8px; min-height: 92px; }
.feature-art img { max-height: 80px; width: auto; }
.world-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.world-tile {
  position: relative; display: block; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; border: 1px solid var(--gold);
  box-shadow: var(--shadow); text-decoration: none; color: #fff8e6 !important; background: linear-gradient(160deg, #2b4a2e, #14143a);
  transition: transform .12s, box-shadow .12s;
}
.world-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.world-tile picture, .world-tile > picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.world-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-bottom: 40px;
  background: radial-gradient(closest-side, rgba(255, 240, 200, .35), rgba(255, 240, 200, 0)); }
.world-fallback img { max-height: 70%; width: auto; }
.world-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 14px 12px; background: linear-gradient(180deg, rgba(10, 10, 36, 0), rgba(10, 10, 36, .88)); }
.world-label .tile-title { color: #fff3d6; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.world-label .small { color: #f1dfb4; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; }
.gallery img { border-radius: 10px; border: 1px solid var(--gold); aspect-ratio: 16 / 9; object-fit: cover; width: 100%; box-shadow: var(--shadow); }
.gallery figcaption { font-size: .875rem; margin-top: 5px; color: var(--ink-soft); }
.community { text-align: center; padding: 26px 20px; }
.community p { margin-left: auto; margin-right: auto; }
@media (max-width: 900px) { .school-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .school-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-band { margin: 32px 0; } }

/* ------------------------------------------------------- tiles (index) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--card-ink) !important; margin: 0; padding: 14px 16px; transition: transform .12s, box-shadow .12s; }
.tile-art { flex: 0 0 auto; width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; }
.tile-art img { max-width: 80px; max-height: 80px; width: auto; height: auto; }
.tile-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cats .stat { font-size: 1.05rem; }
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.world-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--card-ink) !important; margin: 0; }
.world-card img { border-radius: 10px; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.world-hero img { border-radius: 16px; border: 1px solid var(--gold); margin-bottom: 18px; aspect-ratio: 21 / 9; object-fit: cover; width: 100%; box-shadow: var(--shadow); }

/* ------------------------------------------------------------------ guides */
.guide-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.toc-side { position: sticky; top: 132px; margin: 0; padding: 14px 16px; font-size: .92rem; }
.toc-side ol { margin: 0; padding-left: 18px; }
.toc-side li { margin: 5px 0; }
.toc-title { font: 700 .78rem var(--font-body); text-transform: uppercase; letter-spacing: .12em; color: var(--card-soft); margin-bottom: 6px; }
.prose { padding: 24px clamp(18px, 4vw, 40px); margin: 0 0 20px; font-size: 1.04rem; line-height: 1.7; }
.prose > * { max-width: 70ch; }
.prose h2 { margin-top: 1.4em; }
.prose h2:first-child { margin-top: 0; }
.prose h2::after {
  content: ""; display: block; height: 12px; margin-top: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='12' viewBox='0 0 160 12'%3E%3Cpath d='M0 6h66M94 6h66' stroke='%23b8892f' stroke-width='1.4'/%3E%3Cpath d='M80 1l5 5-5 5-5-5z' fill='%23b8892f'/%3E%3Ccircle cx='70' cy='6' r='1.7' fill='%23b8892f'/%3E%3Ccircle cx='90' cy='6' r='1.7' fill='%23b8892f'/%3E%3C/svg%3E") left center / 160px 12px no-repeat;
}
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.callout { margin: 1.1em 0; padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(184, 137, 47, .5); border-left: 5px solid var(--gold); background: rgba(255, 252, 240, .75); }
.callout p { margin: 0; }
.callout-tip { border-left-color: #3f7a41; }
.callout-note { border-left-color: #1d6a93; }
.callout-warning { border-left-color: #b83c12; }
.callout-label { font-family: var(--font-head); margin-right: 4px; }
.guide-fig { margin: 1.2em auto; text-align: center; max-width: 320px; }
.guide-fig .art-bg { display: flex; justify-content: center; padding: 12px; }
.guide-fig img { max-height: 280px; width: auto; filter: drop-shadow(0 4px 8px rgba(50, 30, 5, .25)); }
.guide-fig figcaption { font-size: .875rem; color: var(--card-soft); margin-top: 4px; }
.guide-nav a { display: flex; flex-direction: column; text-decoration: none; padding: 12px 16px; margin: 0; min-width: 0; flex: 1 1 240px; font-family: var(--font-head); font-weight: 700; }
.guide-nav a.next { text-align: right; }
.guide-nav .small { font-family: var(--font-body); font-weight: 600; color: var(--card-soft); }
.page-hero .hero-art.art-bg { min-height: 0; }
@media (max-width: 900px) {
  .guide-layout { grid-template-columns: minmax(0, 1fr); }
  .toc-side { position: static; }
}
@media (max-width: 640px) {
  .page-hero.has-art { grid-template-columns: minmax(0, 1fr); text-align: center; padding: 16px; }
  .page-hero.has-art .chips { justify-content: center; }
  .hero-art img { max-height: 220px; }
  .card, .block { padding: 14px; }
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  margin-top: 20px; border-top: 1px solid var(--gold); color: var(--header-ink); --link: #ffe3a3; --link-hover: #fff;
  background:
    radial-gradient(1px 1px at 40px 30px, rgba(255, 255, 255, .6), transparent 70%),
    radial-gradient(1px 1px at 200px 80px, rgba(255, 238, 200, .5), transparent 70%),
    linear-gradient(180deg, var(--header-2), var(--header));
  background-size: 300px 120px, 300px 120px, auto;
}
.fgrid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; padding-top: 28px; padding-bottom: 12px; }
.fbrand img { height: 52px; width: auto; margin-bottom: 8px; }
.fhead { font-family: var(--font-head); color: #ffe3a3; margin-bottom: 6px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 5px 0; }
.fbottom { border-top: 1px solid rgba(216, 184, 106, .3); padding-top: 14px; padding-bottom: 26px; }
.site-footer .updated { font-size: .95rem; }
@media (max-width: 640px) { .fgrid { grid-template-columns: 1fr 1fr; } .fbrand { grid-column: 1 / -1; } }

/* ----------------------------------------------------------------- spoilers */
.sp, .spb { display: none; }
.spoilers .sp { display: inline; }
.spoilers .spb { display: block; }
.spoilers .sp-ph, .spoilers .spb-ph, .spoilers .spoiler-note { display: none; }
.sp-ph { font-style: italic; }

/* --------------------------------------------------------------- quest tree */
.tree-controls { position: relative; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tab { font: 600 .95rem var(--font-body); padding: 7px 13px; border-radius: 10px; border: 1px solid var(--gold); background: #fcf6e6; color: #2a2117; cursor: pointer; min-height: 40px; }
.tab[aria-selected="true"] { background: #2a2a66; color: #fff3d6; border-color: #2a2a66; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .875rem; margin-bottom: 8px; }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.lg::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--cat); display: inline-block; }
.lg input { margin: 0; }
.tree-buttons { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.js .tree-world:not(.active) { display: none; }
.tree-world { margin-bottom: 26px; }
.tree-world > h2 a { color: var(--ink); text-decoration: none; }
ol.spine { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; }
ol.spine::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 4px; border-radius: 4px; background: linear-gradient(180deg, var(--spine), rgba(216, 184, 106, .5)); }
.tn { position: relative; margin: 0 0 8px; }
.tn::before { content: ""; position: absolute; left: -23px; top: 12px; width: 14px; height: 14px; border-radius: 50%; background: var(--page); border: 3px solid var(--spine); }
.tn.start::before { background: var(--spine); }
.tn:target > .qn { outline: 3px solid var(--focus); }
.qn {
  display: inline-flex; align-items: baseline; gap: 8px; max-width: 100%; padding: 6px 12px; border-radius: 10px;
  background: var(--card); color: #2a2117 !important; text-decoration: none; border: 1px solid var(--gold);
  border-left: 5px solid var(--cat, var(--gold)); box-shadow: var(--shadow); font-weight: 600;
}
a.qn:hover { background: #fff3d6; }
.qn .n { font: 700 .8rem var(--font-body); color: #6b5323; min-width: 1.6em; }
.start-node { font-style: italic; }
.branches { margin: 6px 0 4px 14px; display: flex; flex-direction: column; gap: 6px; }
details.branch { background: rgba(250, 240, 214, .95); color: #2a2117; border: 1px solid rgba(184, 137, 47, .7); border-left: 4px solid var(--cat); border-radius: 10px; padding: 0 10px; max-width: 760px; }
details.branch > summary { cursor: pointer; padding: 6px 0 6px 22px; list-style: none; position: relative; }
details.branch > summary::-webkit-details-marker { display: none; }
details.branch > summary::before { content: "+"; position: absolute; left: 0; top: 7px; width: 16px; height: 16px; line-height: 14px; text-align: center; font-weight: 700; border: 1px solid #8a6418; border-radius: 4px; background: #fcf6e6; color: #2a2117; font-size: .85rem; }
details.branch[open] > summary::before { content: "\2212"; }
details.branch > summary .bt { font-weight: 700; }
details.branch[open] > summary { border-bottom: 1px dashed rgba(184, 137, 47, .6); }
.branch.leaf { padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: 760px; color: var(--ink); }
.branch.leaf .small { color: var(--ink-soft); }
.branch.leaf .qn { box-shadow: none; padding: 3px 9px; font-size: .93rem; }
.branch.hidden-cat { display: none !important; }
ol.bq { margin: 6px 0 8px; padding-left: 20px; }
ol.bq li { margin: 5px 0; }
ol.bq .qn { box-shadow: none; padding: 3px 9px; font-size: .93rem; }
@media (max-width: 600px) {
  .branches { margin-left: 4px; }
  ol.spine { padding-left: 22px; }
  .tn::before { left: -20px; }
  th, td { padding: 7px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .feature:hover, .tile:hover, .school-tile:hover, .world-tile:hover, table.as-grid tr:hover, .btn:hover { transform: none; }
}
@media print {
  .site-header, .site-footer, .filters, .tree-controls { display: none; }
  body { background: #fff; }
}
