:root{--sidebar-width:240px;--ink:#233247;--nav:#182536;--accent:#275ead}
body{background:#f2f5f9;color:var(--ink)}a{color:var(--accent)}.app-topbar{background:#142031;min-height:68px;border-bottom:1px solid #30435d}.brand-subtitle{font-size:.85rem;color:#b6c6da;margin-left:.6rem}.app-shell{display:flex;min-height:calc(100vh - 68px)}.app-sidebar{--bs-offcanvas-width:var(--sidebar-width);background:var(--nav)!important;color:#dce5f0;width:var(--sidebar-width);flex-shrink:0}.app-sidebar .offcanvas-body{background:var(--nav);min-height:calc(100vh - 68px)}.app-sidebar .nav-link{color:#bccce0;border-radius:6px;padding:12px}.app-sidebar .nav-link.active,.app-sidebar .nav-link:hover{background:#2b415f;color:#fff}.nav-caption,.eyebrow{font-size:.72rem;letter-spacing:.13em;font-weight:700}.nav-caption{color:#8fa5bf;margin:16px 12px}.sidebar-note{font-size:.8rem;color:#9bb0ca}.app-main{padding:32px;flex:1;min-width:0}.page-heading{display:flex;justify-content:space-between;align-items:center;gap:1rem;margin-bottom:20px}.page-heading h1{font-size:1.9rem;font-weight:700}.eyebrow{color:#59718c;margin-bottom:8px}.card{border:1px solid #dce3ec;box-shadow:0 2px 5px #18253605;border-radius:8px;overflow:hidden}.card-header{background:#fff;border-bottom:1px solid #e6ebf2;padding:16px 20px}.card-body{padding:20px}.card-footer{background:#fafbfd;padding:12px 20px}.table>thead{color:#667a91;background:#f6f8fb;font-size:.85rem}.table td,.table th{padding:12px 16px;vertical-align:top}.context-bar{display:flex;flex-wrap:wrap;gap:10px 24px;background:#e7eef8;padding:16px 20px;border-radius:8px}.context-bar details{flex-basis:100%}.facts{display:grid;grid-template-columns:1fr 1fr;gap:8px}.facts dd{margin:0}.relationship{padding:16px 0;border-bottom:1px solid #e5ebf3}.relationship:first-child{padding-top:0}.relationship:last-child{border-bottom:0}.status-label{font-size:.75rem;background:#fff4d8;color:#6d4a0c;border-radius:5px;padding:4px 8px;height:fit-content}summary{cursor:pointer;color:var(--accent);font-weight:600;padding:6px 0}details[open]>summary{margin-bottom:8px}.skip-link{position:absolute;background:white;padding:12px;z-index:9999}.table-responsive{max-width:100%}button,a.btn{min-height:36px}
/* Keep desktop navigation reachable while long pages scroll. Short windows scroll the menu separately. */
@media(min-width:992px){
  .sidebar-collapsed .app-sidebar{display:none!important}
  .app-topbar{position:sticky;top:0;z-index:1020}
  .app-sidebar{position:sticky;top:68px;align-self:flex-start;height:calc(100vh - 68px);height:calc(100dvh - 68px);overflow-y:auto}
  .app-sidebar .offcanvas-body{min-height:100%}
}
@media(max-width:991.98px){.app-main{padding:20px}.app-sidebar .offcanvas-body{min-height:0}.app-shell{display:block}.app-sidebar{width:var(--sidebar-width)}}
@media(max-width:575.98px){.app-main{padding:16px}.page-heading{align-items:flex-start;flex-direction:column}.brand-subtitle{display:none}.page-heading h1{font-size:1.5rem}.card-body{padding:16px}.context-bar{gap:8px 16px}.table td,.table th{padding:10px}}

.spell-icon{display:inline-block;width:32px;height:32px;object-fit:contain;vertical-align:middle;margin-right:.5rem;border:1px solid #667a91;border-radius:4px;flex-shrink:0}.page-heading h1 .spell-icon{width:48px;height:48px}.spell-icon-missing{background:#e7eef8;color:#667a91;text-align:center;line-height:30px;font-size:20px}.page-heading h1 .spell-icon-missing{line-height:46px}
.icon-catalogue{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr));gap:1rem}.icon-catalogue .card{min-width:0}.spell-icon.icon-thumbnail{width:64px;height:64px;margin:0}.spell-icon-missing.icon-thumbnail{line-height:62px;font-size:32px}

.settings-card{max-width:640px}.nav-cog{font-size:1.3rem;vertical-align:middle;margin-right:.45rem}.spell-row{cursor:pointer}.spell-link{font-weight:600;text-decoration:none}.spell-link:hover{text-decoration:underline}.spell-link:focus-visible{outline:2px solid var(--accent);outline-offset:4px}.list-pagination{font-size:.9rem}.list-pagination .btn{min-width:42px}
[data-bs-theme=dark]{--ink:#dee6f1;--accent:#8cbaff;--bs-secondary-rgb:170,184,203}
[data-bs-theme=dark] body{background:#101822}
[data-bs-theme=dark] .card{background:#1a2533;border-color:#354457}
[data-bs-theme=dark] .card-header{background:#1d2a3b;border-color:#354457}
[data-bs-theme=dark] .card-footer{background:#162130;border-color:#354457}
[data-bs-theme=dark] .context-bar{background:#233449}
[data-bs-theme=dark] .eyebrow{color:#a7bad2}
[data-bs-theme=dark] .relationship{border-color:#354457}
[data-bs-theme=dark] .table>thead{color:#b1c3d8;background:#233449}
[data-bs-theme=dark] .status-label{background:#4a3a1c;color:#ffe1a0}
[data-bs-theme=dark] .spell-icon-missing{background:#233449;color:#b1c3d8}

[data-bs-theme=dark] .btn-outline-secondary{--bs-btn-color:#b1c3d8;--bs-btn-border-color:#7d94af;--bs-btn-hover-bg:#354b65;--bs-btn-hover-border-color:#b1c3d8;--bs-btn-hover-color:#fff;--bs-btn-disabled-color:#b1c3d8;--bs-btn-disabled-border-color:#7d94af}

.settings-action{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;flex-shrink:0;border:1px solid transparent;border-radius:8px;color:#dce5f0;text-decoration:none}
.settings-action:hover,.settings-action.active{background:#2b415f;color:#fff;border-color:#637e9f}
.settings-action:focus-visible{outline:2px solid #a9ceff;outline-offset:3px}
.topbar-actions{flex-shrink:0}
@media(max-width:575.98px){.dataset-badge{display:none}.app-topbar{flex-wrap:nowrap}}

.catalog-search-card{overflow:visible}
.catalog-search-field{position:relative}
.search-suggestions{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1020;max-height:320px;overflow-y:auto}
.search-suggestions[hidden]{display:none}
.search-suggestions [role=option]{cursor:pointer;overflow-wrap:anywhere;min-height:44px}
.search-suggestions [aria-selected=true]{background:var(--bs-primary);color:#fff}
.game-tooltip{max-width:540px;background:linear-gradient(135deg,#131a28,#090d16);color:#fff;border:2px solid #8b8b98;border-radius:7px;padding:18px;box-shadow:0 4px 16px #0005;font-size:15px;line-height:1.45;overflow-wrap:anywhere}
.game-tooltip-title{font-size:20px;font-weight:600;margin-bottom:5px;display:flex;align-items:center;gap:10px}
.game-tooltip-rank{color:#bbb;margin-bottom:8px}.game-tooltip-field span{color:#cbd0da}.game-tooltip-description{color:#ffd95e;white-space:pre-wrap;margin-top:14px}
.game-tooltip .tooltip-unresolved{color:#ffbe93;background:#462516;border-radius:3px;padding:1px 3px}.tooltip-resolved{text-decoration:underline dotted;text-underline-offset:3px}.tooltip-number{font-weight:800;color:#fff4c2}.tooltip-source{white-space:pre-wrap;overflow-wrap:anywhere}
/* Client-style comparison follows Ian's beta-client reference; source context stays outside. */
.client-tooltip{width:300px;max-width:100%;padding:7px 9px 9px;color:#fff;background:rgba(10,9,19,.94);border:2px solid #84734c;border-radius:4px;box-shadow:inset 0 0 0 1px #292626,0 0 0 1px #24231e,0 2px 5px #0008;font-family:Georgia,'Times New Roman',serif;font-size:14px;line-height:1.15;letter-spacing:.15px;text-shadow:1px 1px 1px #000;overflow-wrap:anywhere}
.client-tooltip-row{display:flex;justify-content:space-between;align-items:baseline;gap:10px}.client-tooltip-heading{font-size:18px;line-height:1.05;margin-bottom:1px}.client-tooltip-rank{color:#999;white-space:nowrap}.client-tooltip-range{white-space:nowrap}.client-tooltip-description{color:#ffdf00;white-space:pre-wrap;margin-top:1px}.client-tooltip-unresolved{color:#ffc093;text-decoration:underline dotted;text-underline-offset:2px}.client-context-marker{color:#d59050}.client-tooltip .client-tooltip-unresolved{white-space:normal}
.catalog-evidence{max-width:540px;white-space:normal;overflow-wrap:anywhere}.catalog-evidence summary{min-height:32px;cursor:pointer}.catalog-evidence li{margin-bottom:4px}
.healing-text{white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal;max-width:100%;font-size:inherit}
.healing-spell-card .tooltip-source{font-family:inherit;font-size:.95rem;margin-bottom:0;white-space:pre-wrap}
.healing-spell-card .badge{white-space:normal;text-align:left;line-height:1.4}
.healing-card-evidence{display:flex;flex-wrap:wrap;align-items:flex-start;gap:4px 24px}
.healing-card-evidence>details{margin-top:0!important;min-width:180px;max-width:100%}
.healing-card-evidence>details[open]{flex-basis:100%}
/* Different text colours distinguish preview wording from original stored tokens. */
.healing-spell-card{--healing-preview:#865b08;--healing-original:#315f8d;--healing-mark-bg:#ffebc2;--healing-mark-text:#784509}
[data-bs-theme=dark] .healing-spell-card{--healing-preview:#ffdc83;--healing-original:#a8cfff;--healing-mark-bg:#4a3418;--healing-mark-text:#ffe0a3}
.healing-spell-card>.card-body>.row>div:first-child .tooltip-source{color:var(--healing-preview)}
.healing-spell-card>.card-body>.row>div:last-child .tooltip-source{color:var(--healing-original)}
.healing-spell-card .tooltip-unresolved{background:var(--healing-mark-bg);color:var(--healing-mark-text);border-radius:3px;padding:0 3px;text-decoration:underline dotted;text-underline-offset:3px}

.healing-pattern-preview{min-width:280px;color:#865b08}
.healing-pattern-preview .tooltip-source{font-family:inherit;font-size:inherit}
[data-bs-theme=dark] .healing-pattern-preview{color:#ffdc83}
.healing-pattern-preview .tooltip-unresolved{background:#ffebc2;color:#784509;border-radius:3px;padding:0 3px}
[data-bs-theme=dark] .healing-pattern-preview .tooltip-unresolved{background:#4a3418;color:#ffe0a3}
.local-update-status, #file-library-status { min-height: 1.5em; }
[data-list-region], #catalog-results, #local-viewport-space { overflow-anchor: none; }
/* Shared deletion confirmations need readable width and theme-aware warning text. */
.file-delete-widget[open] { min-width: min(22rem, calc(100vw - 3rem)); }
.file-delete-widget > summary { color: var(--bs-danger-text-emphasis); }
.set-catalogue{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,330px),1fr));gap:16px}
.set-icon-strip{display:flex;align-items:center;flex-wrap:wrap;gap:4px}.set-icon-strip .spell-icon{margin:0}
.set-piece .set-source{border-top:1px solid var(--bs-border-color);padding-top:12px;margin-top:12px;overflow-wrap:anywhere}
.set-unknown{font-size:.9rem}.set-piece h3{overflow-wrap:anywhere}.set-piece .table{font-size:.8rem}

/* One set of links serves full navigation, the desktop icon rail and the mobile drawer. */
.app-sidebar .nav-link,.sidebar-size-toggle{display:flex;align-items:center;gap:.75rem}
.nav-icon{width:22px;height:22px;flex-shrink:0}
.sidebar-size-toggle{justify-content:center}
@media(min-width:992px){
  .sidebar-thin .app-sidebar{width:76px}
  .sidebar-thin .app-sidebar .offcanvas-body{padding:.5rem!important}
  .sidebar-thin .app-sidebar .nav-link{justify-content:center;padding:12px}
  .sidebar-thin .nav-caption,.sidebar-thin .sidebar-note{display:none}
  .sidebar-thin .sidebar-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
}

.font-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,420px),1fr));gap:1rem}
.font-grid .card{min-width:0}
.font-sample{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;font-synthesis:none;margin:1rem 0;min-height:3rem}
.global-menu { position:relative; }
.global-menu > summary { list-style:none; cursor:pointer; min-width:44px; min-height:44px; }
.global-menu > summary::-webkit-details-marker { display:none; }
.global-menu-panel { position:absolute; right:0; top:100%; z-index:1100; width:min(19rem,calc(100vw - 2rem)); padding:.5rem; border:1px solid var(--line); border-radius:.5rem; background:var(--surface); box-shadow:0 .5rem 1rem #0003; }
.global-menu-panel a { display:block; padding:.75rem; color:var(--ink); border-radius:.25rem; text-decoration:none; }
.global-menu-panel a:hover,.global-menu-panel a:focus-visible { background:var(--accent-soft); }
.documentation-definition { white-space:pre-wrap; overflow-wrap:anywhere; }

.home-intro { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:clamp(1rem,4vw,4rem); margin:0 0 1.5rem; padding:clamp(1.25rem,3vw,2.5rem); border:1px solid var(--line); border-radius:.65rem; background:linear-gradient(110deg,var(--surface) 45%,var(--accent-soft)); }
.home-intro .eyebrow { color:var(--heading-context); letter-spacing:normal; font-size:.875rem; }
.dataset-names { display:inline-flex; flex-wrap:wrap; gap:.25rem 1rem; }
.home-intro h1 { font-size:clamp(1.9rem,4vw,3.25rem); line-height:1.08; font-weight:700; margin:0 0 .75rem; }
.home-intro p:not(.eyebrow) { max-width:58ch; }
.home-lead { font-size:clamp(1.1rem,1.6vw,1.35rem); }
.home-community-caption { border-inline-start:.2rem solid var(--accent); border-radius:.2rem; padding:.6rem .85rem; background:var(--accent-soft); color:var(--ink); }
.home-emblem { display:block; width:clamp(9rem,17vw,14rem); max-width:100%; height:auto; justify-self:end; }
.home-guide { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,25rem),1fr)); gap:1.5rem clamp(1.5rem,3vw,3rem); }
.home-guide h2 { font-size:1.4rem; margin:0 0 .85rem; }
.home-guide p { max-width:65ch; }
.home-counts { display:flex; flex-wrap:wrap; gap:1rem 1.5rem; padding:.4rem 0 .95rem; border-bottom:1px solid var(--line); }
.home-counts dt { font-weight:500; font-size:.9rem; color:var(--muted); }
.home-counts dd { margin:.15rem 0 0; font-size:clamp(1.3rem,2vw,1.65rem); font-weight:650; font-variant-numeric:tabular-nums; }
@media(max-width:575.98px) {
  .home-intro { grid-template-columns:minmax(0,1fr) 5rem; gap:.5rem .75rem; }
  .home-intro > div { display:contents; }
  .home-intro .eyebrow, .home-intro h1 { grid-column:1; margin:0; }
  .home-intro p:not(.eyebrow), .home-intro nav { grid-column:1 / -1; }
  .home-intro .home-emblem { grid-column:2; grid-row:1 / 3; width:5rem; }
}

/* Quest details: objective first, readable text, secondary records disclosed inline. */
.quest-page { max-width: 88rem; margin-inline: auto; }
.quest-heading { margin-bottom: 1.75rem; }
.quest-heading h1 { margin: .65rem 0 .4rem; text-wrap: balance; }
.quest-status { color: var(--bs-secondary-color); font-size: .9rem; }
.quest-facts { display: flex; flex-wrap: wrap; gap: 1rem 3rem; margin: 1.25rem 0 0; }
.quest-facts dt { font-weight: 400; font-size: .8rem; color: var(--bs-secondary-color); }
.quest-facts dd { margin: .15rem 0 0; font-weight: 600; }
.quest-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 24rem); gap: 2rem; align-items: start; }
.quest-main, .quest-sidebar { min-width: 0; }
.quest-page h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.quest-objective { border-inline-start: 4px solid var(--bs-primary); background: var(--bs-tertiary-bg); border-radius: .35rem; padding: 1.4rem 1.5rem; }
.quest-objective h2 { font-size: .85rem; font-weight: 600; color: var(--bs-secondary-color); margin-bottom: .65rem; }
.quest-lead { font-size: 1.25rem; line-height: 1.55; }
.quest-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; max-width: 75ch; }
.quest-section { margin-top: 2rem; }
.quest-map { border: 1px solid var(--bs-border-color); border-radius: .5rem; overflow: hidden; margin: 1rem 0 0; }
.quest-map svg { width: 100%; height: auto; display: block; background: #24201b; }
.quest-map figcaption { padding: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.quest-sidebar .card { box-shadow: none; }
.quest-sidebar .list-group-item { padding: .65rem .25rem; font-size: .92rem; overflow-wrap: anywhere; }
.quest-sidebar .list-group-item::before { color: var(--bs-secondary-color); }
.quest-sidebar nav { font-size: .9rem; }
.quest-sidebar nav > * { flex: 1 1 8rem; }
.quest-source { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--bs-border-color); }
@media (max-width: 1000px) {
    .quest-layout { grid-template-columns: minmax(0, 1fr); }
    .quest-objective { padding: 1.1rem; }
    .quest-facts { gap: 1rem 2rem; }
}

/* Keep selected spellbook options visible when their disclosure is closed. */
#book-more-options .book-option { display: none; }
#book-more-options:has(#book-higher:checked) .book-option-higher,
#book-more-options:has(#book-hidden:checked) .book-option-hidden,
#book-more-options:has(#book-highest:checked) .book-option-highest { display: inline; }
