/* Adapt the new edition controls to the established Companion layout. */
:root{--bg:#f3f6fb;--surface:#fff;--soft:#e7eef8;--text:#20334c;--muted:#667a92;--link:#1c4e8c;--line:#d7e0ec;--active:#1c4987;--header:#162d4a}
html[data-theme=dark]{--bg:#101822;--surface:#1a2635;--soft:#233347;--text:#dce5f0;--muted:#a6b6cb;--link:#91c1ff;--line:#37485f;--active:#305d92;--header:#111f30}
#main{min-height:0}
#mode-message{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
#search{min-height:0;padding:7px 10px;border-radius:4px}
.search-wrap{width:auto;min-width:0}
#site-header .logo{flex:none}
.rules-choice{margin-left:auto;flex:none}
#ruleset{display:inline-flex;align-items:stretch;gap:2px;height:36px;min-height:36px;padding:2px;border-radius:7px;box-shadow:inset 0 0 0 1px #637994;background:transparent;color:#eff6ff;font:14px/1.4 system-ui,sans-serif}
#ruleset label{position:relative;display:flex;cursor:pointer}
#ruleset input{position:absolute;width:1px;height:1px;opacity:0;clip-path:inset(50%)}
#ruleset span{display:flex;align-items:center;justify-content:center;min-width:42px;padding:0 9px;border-radius:5px;transition:background-color 140ms ease-out,color 140ms ease-out;white-space:nowrap}
#ruleset label:hover span{background:#293e57}
#ruleset input:checked+span{background:#305d92;color:#fff;box-shadow:inset 0 0 0 1px #6797d2}
#ruleset input:focus-visible+span{outline:2px solid #a9cfff;outline-offset:2px}
#site-header #theme{margin-left:0;min-width:36px}
#navigation a{min-height:0}
.directory-head h1{margin:0}
.category-card{text-decoration:none}
.filters{gap:6px;margin:0 0 16px;padding-bottom:10px;border-bottom:1px solid #cbd8e8}
.filters button,.levels button,.edition-bar button{padding:7px 12px;border:1px solid #cbd8e8;border-radius:6px;font:14px/1.35 system-ui,sans-serif;color:#315374;background:#fff}
.filters button[aria-pressed=true],.levels button[aria-pressed=true],.edition-bar button[aria-pressed=true]{background:#1c4987;border-color:#1c4987;color:#fff}
.filters button:disabled,.levels button:disabled{opacity:1;background:#edf0f4;border-color:#dce2ea;color:#8a95a5;cursor:not-allowed}
.class-filters{border:0;padding:0;margin:0 0 16px}
.class-filters .class-icon{width:1.15em;height:1.15em}
.toolbar{margin-bottom:6px;font:13px/1.5 system-ui,sans-serif}
.spell-list-label{font-weight:600;color:#52647d}
.schools summary{display:flex;align-items:center;gap:8px;padding:0;list-style:none;font:13px/1.5 system-ui,sans-serif;color:#315374;border-radius:3px}
.schools summary::-webkit-details-marker{display:none}
.schools summary::after{content:'▾';margin-left:auto}
.schools[open] summary::after{transform:rotate(180deg)}
.school-options{width:340px;max-width:calc(100vw - 32px);display:grid;grid-template-columns:1fr 1fr;gap:6px}
.school-options label{min-height:40px;padding:7px;border:1px solid var(--line);border-radius:6px;font-size:13px;gap:7px}
.school-options label:has(input:checked){background:var(--soft)}
.school-options input{width:auto;height:auto;margin:0;accent-color:#1c4987}
#school-clear{grid-column:1/-1;justify-self:start;padding:6px 0;border:0;background:transparent;color:var(--link);font-size:13px;text-decoration:underline}
#mobile-class-toggle,.level-more{display:none}
.mobile-class-select{display:none!important}
.levels{display:flex;gap:6px;margin:0 0 16px;padding-bottom:10px;border-bottom:1px solid #cbd8e8}
.levels button{flex:1 0 auto;padding:9px 12px;white-space:nowrap}
.grid.entry-grid{margin:0}
.item-table-scroll{max-width:100%;overflow-x:auto;border:1px solid var(--line);border-radius:7px;background:var(--surface);overscroll-behavior-x:contain}
.item-table{width:100%;min-width:660px;border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:14px;line-height:1.45}
.item-table .item-name-column{width:36%}
.item-table th,.item-table td{padding:10px 12px;text-align:left;vertical-align:middle;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.item-table thead th{background:var(--soft);font-weight:650}
.item-table tbody th{font-weight:400}
.item-table tbody tr:nth-child(even){background:var(--bg)}
.item-table tbody tr:last-child>*{border-bottom:0}
.item-table tbody tr:hover,.item-table tbody tr:has([aria-current=true]){background:var(--soft)}
.item-table .item-link{display:flex;align-items:center;gap:8px;min-height:24px;color:var(--link);text-decoration:none}
.item-table .item-link:hover{text-decoration:underline}
.item-table .badge{flex:none}
.item-references{position:relative;font-size:14px;margin-left:auto;align-self:center}
.item-references summary{cursor:pointer;color:var(--link);padding:8px}
.item-references nav{position:absolute;right:0;top:100%;z-index:5;min-width:180px;padding:6px;background:var(--surface);border:1px solid var(--line);border-radius:7px;box-shadow:0 8px 24px #0003}
.item-references a{display:block;padding:9px;color:var(--link);text-decoration:none;border-radius:4px}
.item-references a:hover,.item-references a:focus-visible{background:var(--soft)}
html[data-theme=dark] .item-table tbody tr>*{background:var(--surface)!important;color:var(--text)!important}
html[data-theme=dark] .item-table tbody tr:nth-child(even)>*{background:#202e3f!important}
html[data-theme=dark] .item-table tbody tr:hover>*,html[data-theme=dark] .item-table tbody tr:has([aria-current=true])>*{background:var(--soft)!important}
@media(max-width:600px){.item-table{min-width:620px;font-size:14px}.item-table .item-name-column{width:190px}.item-table th,.item-table td{padding:8px 10px}.item-table .item-link{min-height:28px}.item-table tr>:first-child{position:sticky;left:0;background:var(--surface);z-index:1;box-shadow:1px 0 var(--line)}.item-table thead tr>:first-child{background:var(--soft)}.item-table tbody tr:nth-child(even)>:first-child{background:var(--bg)}.item-table tbody tr:hover>:first-child,.item-table tbody tr:has([aria-current=true])>:first-child{background:var(--soft)}}
#main{position:relative}
.directory-progress{position:absolute;left:24px;right:24px;height:3px;border-radius:3px;overflow:hidden;background:var(--line);pointer-events:none;z-index:5}
.directory-progress-track{display:block;width:35%;height:100%;border-radius:inherit;background:var(--link);animation:directory-progress-slide 1s ease-in-out infinite}
@keyframes directory-progress-slide{from{transform:translateX(-105%)}to{transform:translateX(390%)}}
@media(max-width:600px){.directory-progress{left:16px;right:16px}}
@media(prefers-reduced-motion:reduce){.directory-progress-track{animation:none;width:100%;opacity:.65}}
.entry-grid .card{height:100%;min-height:44px;padding:8px 11px;border-radius:6px;gap:12px}
.entry-grid .card>.label{font-size:inherit;color:inherit;min-width:0}
.entry-grid .card>.chevron{color:#8ba1bc;font-size:20px;opacity:1}
.entry-grid .card>.badge{font-size:11px;color:var(--text)}
.entry-grid .card>.class-icon{width:36px;height:36px;color:inherit;margin:0;flex:0 0 36px}
.entry-grid .card:has(>.class-icon){gap:9px}
.count{font-size:13px;margin-left:7px}
.category-group h2{line-height:1.5}
.directory-head h1{flex:none}
html[data-theme=dark] .directory-title h1 .fa{color:#dce5f0}
.reader{margin-top:24px;padding:24px}
.reader-head{gap:8px;margin-bottom:16px}
.reader-head h1{font-size:23px;line-height:1.3;margin:0}
.reader[data-kind=spell] .reader-head h1{font-size:23px;line-height:1.25;flex:none}
.reader[data-inline=true][data-kind=spell]{margin-top:16px}
.reader[data-inline=false]{font:14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif}
.reader[data-inline=false] .reader-head h1{font:600 24px/1.3 system-ui,sans-serif}
.reader[data-inline=false] .article{font:15px/1.65 "Helvetica Neue",Helvetica,Arial,sans-serif}
.reader[data-inline=false] .article p{margin:0 0 10px}
.reader[data-inline=false] .article h1,.reader[data-inline=false] .article h2{font-size:21px;line-height:1.3;font-weight:500;margin:20px 0 10px}
.reader[data-inline=false] .article h3,.reader[data-inline=false] .article h4{font-size:17px;line-height:1.4;font-weight:500;margin:18px 0 8px}
.reader[data-inline=false] .reader-head{margin-bottom:12px}
.reader[data-inline=false] .article table{display:table;width:100%;margin:0;font-size:15px;line-height:1.42857143}
.reader[data-inline=false] .article :is(th,td){padding:8px;border:0;border-top:1px solid #ddd}
.reader[data-inline=false] .article .table-scroll{margin:12px 0}
.reader[data-inline=false] .subclass-buttons{font:14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif}
.reader[data-inline=false] .subclass-buttons button{font:inherit}
.reader[data-inline=false] .subclass-buttons{margin-bottom:0}
.reader[data-inline=false] #subclass-description{line-height:18.5714px}
html[data-theme=dark] #navigation a[aria-current=page]{color:#91c1ff!important}
.reader-head>.class-icon{width:28px;height:28px}
.reader-head .back{width:32px;min-height:32px;height:32px;font:24px/1 system-ui,sans-serif;border-radius:5px}
#main:has(>.reader-slot) .reader{margin-top:0}
#main>#reader-slot:only-child>.reader{margin-top:0;border-radius:8px;padding:20px 24px}
.edition-bar{margin:0 0 16px;gap:6px}
.article{color:#303e50;font-size:15px;line-height:1.65}
.article p{margin:0 0 16px}
.article .feature-disclosure{margin:8px 0}
.article .feature-disclosure>summary{font-weight:400;padding:10px 12px}
.article .feature-disclosure>summary :is(h1,h2,h3,h4){font-size:16px;font-weight:400;line-height:1.4;margin:0}
.article .feature-disclosure>.feature-body{padding:2px 12px 12px}
.article .feature-body>:last-child{margin-bottom:0}
.subclasses{border:0;padding:0;margin-bottom:20px}
.subclasses .filters{border:0;padding:0}
.subclass-reader{padding:0;margin:12px 0 0;border:0;background:transparent}
.subclass-reader:empty{display:none}
.article .subclass-badge{display:block;font-size:11px;font-weight:400}
.subclass-buttons{font:14px/1.65 Arial,sans-serif}
.filters.nested-tabs{border:0;padding:0;margin-bottom:20px}
.filters.feat-type-tabs{gap:8px;margin-bottom:16px;padding-bottom:16px;border-bottom:2px solid #cbd8e8}
.filters.feat-type-tabs button{font-weight:600}
.article table{font:14px/1.5 inherit}
@media(max-width:650px){.article .table-scroll[data-imported-many-columns]>table{min-width:960px}}
.source-link{font-size:12px;margin-bottom:0}
.directory-footer{line-height:1.5}
#preview{display:flex;flex-direction:column;max-height:min(430px,calc(100vh - 24px));border:1px solid #afc3de;border-radius:9px;box-shadow:0 10px 35px #162d4a33;font:14px/1.55 system-ui,sans-serif}
.preview-heading{gap:12px;padding:10px 14px;border-bottom:1px solid #d7e0ec;background:#f3f6fb;flex:none}
#preview-title{font-size:16px;font-weight:600;color:#1c4e8c}
#preview-title{text-decoration:none}
.school-mobile{display:none}
#preview-close{padding:0;min-width:30px;min-height:30px;border:0;background:transparent;color:#315374;font-size:24px}
#preview-body{padding:12px 14px;min-height:0;max-height:none;font:14px/1.55 system-ui,sans-serif;overscroll-behavior:contain;scrollbar-color:#90a8c5 transparent}
#preview-body p{margin:0 0 10px}
#preview-body :is(h1,h2,h3,h4,h5,h6){font-size:15px;margin:12px 0 8px}
#preview-body table{display:block;max-width:100%;overflow:auto;font-size:13px}
#preview-body :is(th,td){padding:5px;border:1px solid #d7e0ec}
#preview-body :is(ul,ol){padding-left:20px}
#preview-body::-webkit-scrollbar{width:7px;height:7px}
#preview-body::-webkit-scrollbar-thumb{background:#90a8c5;border:1px solid #fff;border-radius:12px}
#preview-body::-webkit-scrollbar-button{display:none;width:0;height:0}
html[data-theme=dark] #preview{border-color:#37485f;color:#dce5f0}
html[data-theme=dark] .preview-heading{background:#233347;border-color:#37485f}
html[data-theme=dark] :is(#preview-title,#preview-close){color:#91c1ff}
html[data-theme=dark] #preview-body{scrollbar-color:#617e9f transparent}
html[data-theme=dark] #preview-body::-webkit-scrollbar-thumb{background:#617e9f;border-color:#1a2635}
.companion-site :is(.filters button,.levels button,.edition-bar button,.schools summary,.school-options label){transition:background-color 140ms ease-out,border-color 140ms ease-out,color 140ms ease-out}
.companion-site #main[data-filter-commit] :is(.filters button,.class-filters button,.levels button){transition:none}
.filters button:not(:disabled):hover,.levels button:not(:disabled):hover,.edition-bar button:hover,.schools summary:hover{background:#e7eef8;border-color:#83a6d3}
html[data-theme=dark] :is(.article,.spell-list-label,.schools summary){color:#dce5f0}
html[data-theme=dark] :is(.filters button,.levels button,.edition-bar button){background:#1a2635;border-color:#37485f;color:#dce5f0}
html[data-theme=dark] :is(.filters,.levels){border-color:#37485f}
html[data-theme=dark] :is(.filters button:not(:disabled):hover,.levels button:not(:disabled):hover,.edition-bar button:hover,.schools summary:hover){background:#293e57;border-color:#6e95c4}
html[data-theme=dark] :is(.filters button[aria-pressed=true],.levels button[aria-pressed=true],.edition-bar button[aria-pressed=true]){background:#305d92;border-color:#6797d2;color:#fff}
html[data-theme=dark] :is(.filters button:disabled,.levels button:disabled){background:#161f2a;color:#7d8a9c;border-color:#29374a}
@media(min-width:601px){.grid.entry-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:601px){.reader[data-inline=true]:is([data-kind=feat],[data-kind=background]) .reader-head .back{display:none}}
@media(min-width:850px){.grid.entry-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:650px){#site-header{gap:10px;padding:12px}.search-wrap{order:4;width:100%;flex-basis:100%;max-width:none}}
@media(max-width:600px){
 #site-header{gap:7px}#site-header .logo{font-size:16px;gap:6px;letter-spacing:-.4px}
 #site-header .logo img{width:36px;height:36px}.rules-choice{margin-left:auto}
 #site-header{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"logo theme" "search rules"}
 #site-header .logo{grid-area:logo}#site-header #theme{grid-area:theme;justify-self:end}
 #site-header .search-wrap{grid-area:search;width:100%;min-width:0}
 #ruleset{grid-area:rules;justify-self:end;width:auto;max-width:none;margin:0;padding:0;gap:0;font-size:13px;min-height:44px;height:44px}
 #ruleset span{min-width:44px;min-height:44px;padding:0 6px}
 #suggestions{width:calc(100vw - 24px);max-width:calc(100vw - 24px)}
 #site-header #theme{width:44px;min-width:44px;height:44px}
 #site-header .search-wrap #search{font-size:16px;min-height:44px}
 .reader{padding:18px}.reader-head h1{font-size:22px}.reader-head .back{width:44px;min-height:44px;height:44px}
 #main>#reader-slot:only-child>.reader{padding:18px 14px}
 .entry-grid .card{min-height:44px;font-size:16px;padding:8px 11px}
 .entry-grid .card>.class-icon{width:30px;height:30px;flex-basis:30px}
 .filters button{min-height:44px}.levels{overflow-x:auto;padding-bottom:8px}.levels button{min-height:44px;flex:1 0 auto}
 .toolbar{margin-bottom:10px;align-items:stretch}.mobile-class-select{flex:1 1 48%;width:0;min-width:0;min-height:44px;border-radius:6px;font:14px/1.35 system-ui,sans-serif;padding:7px 10px}
 .schools{flex:1 1 52%;min-width:0;margin:0}.schools summary{height:100%;min-height:44px;padding:7px 10px;border:1px solid var(--line);background:var(--surface);border-radius:6px;font:14px/1.35 system-ui,sans-serif}
 .school-options label{min-height:44px}
 .school-desktop{display:none}.school-mobile{display:inline}
 .grid.entry-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 #mobile-class-toggle{display:flex;align-items:center;justify-content:space-between;gap:6px;flex:1 1 48%;min-width:0;min-height:44px;padding:7px 10px;border:1px solid var(--line);background:var(--surface);color:var(--link);border-radius:6px;font:14px/1.35 system-ui,sans-serif;text-align:left}
 #mobile-class-toggle::after{content:'▾'}#mobile-class-toggle[aria-expanded=true]::after{transform:rotate(180deg)}
 .class-filters[data-open]{display:flex}.class-filters button{min-height:44px}
 .level-strip{display:flex;align-items:flex-start;gap:5px;border-bottom:1px solid var(--line);margin-bottom:16px}
 .level-strip .levels{flex:1;min-width:0;margin:0;border:0;padding-top:0}
 .level-more{display:flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;padding:0;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--link);font:26px/1 system-ui,sans-serif}
 .level-more:disabled{visibility:hidden}
}
@media(max-width:350px){.grid.entry-grid{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){.companion-site :is(.filters button,.levels button,.edition-bar button,.schools summary,.school-options label){transition:none}}

@media(prefers-reduced-motion:reduce){#ruleset span{transition:none}}
