/* Search pages: dark by default, with native controls and system fonts. */
*{box-sizing:border-box}
html{scroll-padding-top:24px}
body{margin:0;min-height:100vh;min-height:100svh;display:flex;flex-direction:column;background:var(--paper);color:var(--ink);font:16px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;-webkit-text-size-adjust:100%}
button,input,select{font:inherit}
button,a,input,select,summary{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button,summary,select{cursor:pointer}
button{color:inherit}
a{color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid var(--teal);outline-offset:4px}
[hidden]{display:none!important}
h1,h2,h3,p{margin:0}
h1,h2,h3{line-height:1.3}
.icon{display:inline-block;vertical-align:middle;flex-shrink:0}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.skip-link{position:fixed;left:16px;top:-80px;background:var(--teal);color:#102b25;padding:12px 20px;z-index:100;border-radius:4px}
.skip-link:focus{top:10px}
.page-shell,.header-inner{width:min(1040px,calc(100% - 64px));margin-inline:auto}
main.page-shell{flex:1}
summary{list-style:none}
summary::-webkit-details-marker{display:none}
.site-header{border-bottom:1px solid var(--border);position:relative;z-index:20}
.header-inner{display:flex;align-items:center;gap:28px;min-height:72px}
.brand{display:flex;align-items:center;margin-right:auto;font-size:16px;font-weight:600;line-height:1.4;min-height:48px}
.desktop-nav{display:flex;gap:24px;font-size:13px}
.desktop-nav a{padding:14px 0;color:var(--muted)}
.desktop-nav a[aria-current]{color:var(--teal)}
.desktop-nav a:hover{color:var(--ink)}
.tools-menu{position:relative}
.tools-menu>summary{min-height:44px;display:flex;gap:10px;align-items:center;border:1px solid var(--border);padding:8px 12px;border-radius:5px;font-size:13px}
.tools-menu>summary .icon{width:14px;height:14px}
.tools-menu nav{position:absolute;top:calc(100% + 8px);right:0;background:var(--surface-raised);border:1px solid var(--border);border-radius:6px;width:225px;padding:6px;z-index:50}
.tools-menu nav a{display:block;padding:11px 12px;border-radius:4px;font-size:13px;min-height:44px}
.tools-menu nav a:hover{background:#2b3b4b}
.home-page main{max-width:880px}
.home-heading{padding:40px 0 18px}
.home-heading h1{font-size:28px;font-weight:600;letter-spacing:-.4px;text-align:center}
.hero{min-width:0}
.brand-icon{display:none}
.search-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:24px}
.search-label{display:block;font-size:13px;font-weight:500;margin-bottom:10px}
.search-row{display:flex;gap:10px}
.search-input-wrap{flex:1;min-width:0;position:relative}
.search-input-wrap input{width:100%;height:54px;padding:0 48px;background:var(--paper);border:1px solid #5a6c7e;border-radius:5px;font-size:17px;color:var(--ink)}
.search-input-wrap input::placeholder{color:var(--muted)}
.search-input-wrap input:focus{outline:2px solid var(--teal);outline-offset:1px}
.input-icon{position:absolute;top:17px;left:16px;color:var(--muted);pointer-events:none}
.icon-button{border:0;background:none;display:grid;place-items:center;width:44px;height:44px;border-radius:4px}
.clear-search{position:absolute;top:5px;right:3px;color:var(--muted)}
.clear-search .icon{width:17px;height:17px}
.search-submit{display:flex;align-items:center;justify-content:center;gap:16px;background:var(--teal);color:#102b25;border:0;border-radius:5px;min-height:54px;padding:0 22px;font-size:14px;font-weight:650;white-space:nowrap}
.search-submit:hover{background:#a0eddf}
.search-submit:disabled{opacity:.7;cursor:wait}
.search-options{border-top:1px solid var(--border);margin-top:20px}
.search-options>summary{min-height:48px;display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--muted);font-size:12px}
.search-options>summary>span{display:flex;align-items:center;gap:9px}
.search-options>summary .icon{width:16px;height:16px}
.search-options>summary>.icon{width:14px;height:14px}
details[open]>summary>.icon{transform:rotate(180deg)}
.active-options{display:inline-grid;place-items:center;border-radius:4px;background:var(--mint);color:var(--teal);min-width:20px;height:20px;padding:0 4px}
.option-grid{display:grid;grid-template-columns:1fr 1fr;gap:2px 20px}
.option{display:flex;align-items:center;gap:10px;padding:8px 0;min-height:44px;cursor:pointer;font-size:13px}
.option:has(input:disabled){opacity:.6;cursor:default}
.option input{width:18px;height:18px;accent-color:var(--teal);margin:0;flex-shrink:0}
.phrase-hint{font-size:12px;color:var(--muted);margin-top:8px}
.autocomplete-dropdown{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:30;background:var(--surface-raised);border:1px solid #5a6c7e;border-radius:5px;max-height:285px;overflow-y:auto;overscroll-behavior:contain;padding:4px}
.autocomplete-item{padding:11px 12px;border-radius:3px;cursor:pointer;font-size:15px;min-height:44px;overflow-wrap:anywhere}
.autocomplete-item:hover,.autocomplete-item[aria-selected="true"]{background:var(--mint);color:var(--teal)}
.autocomplete-item strong{font-weight:700}
.toolkit{padding:30px 0 40px}
.section-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}
.section-heading h2{font-size:19px;font-weight:600;display:flex;align-items:center;gap:9px}
.toolkit .section-heading h2{font-size:16px;color:var(--muted);font-weight:500}
.tool-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.tool-card{display:flex;align-items:center;gap:10px;min-width:0;min-height:62px;padding:14px;background:var(--surface);border:1px solid var(--border);border-radius:5px}
.tool-card:hover{background:var(--surface-raised);border-color:#5a6c7e}
.tool-card>.icon{width:18px;height:18px;color:var(--muted)}
.tool-card h3{font-size:13px;font-weight:500}
.site-footer{border-top:1px solid var(--border);padding-top:18px;padding-bottom:max(20px,env(safe-area-inset-bottom));display:flex;align-items:center;justify-content:space-between;gap:20px;font-size:12px;color:var(--muted)}
.site-footer nav{display:flex;gap:24px;flex-wrap:wrap}
.site-footer nav a{display:flex;align-items:center;min-height:44px}
.site-footer a:hover,.text-link:hover{color:var(--teal);text-decoration:underline;text-underline-offset:4px}
.results-page .page-shell{max-width:980px}
.results-search{padding-top:28px;padding-bottom:16px;border-bottom:1px solid var(--border)}
.search-form-compact .search-row{width:100%}
.results-heading{padding:24px 0 20px}
.results-heading h1{font-size:27px;font-weight:600;letter-spacing:-.3px;overflow-wrap:anywhere;margin-bottom:10px}
.results-heading h1 span{color:var(--teal)}
.result-totals{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.result-section{scroll-margin-top:24px}
.count-badge{display:inline-grid;place-items:center;min-width:23px;height:23px;padding:0 5px;border-radius:4px;background:var(--surface-raised);color:var(--muted);font-size:11px;font-weight:500}
.edition-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;min-height:24px;border-radius:3px;font-size:10px;font-weight:500;white-space:nowrap;flex-shrink:0}
.edition-badge.new{background:#203c35;color:#b6e8d2}
.edition-badge.old{background:#3b3327;color:#efd1a3}
.page-links{display:flex;gap:5px;flex-wrap:wrap}
.page-links a{display:flex;align-items:center;justify-content:center;gap:6px;padding:6px 9px;min-width:40px;min-height:44px;border:1px solid #516675;border-radius:4px;color:var(--teal);background:var(--paper);font-size:12px;font-weight:500}
.page-links a .icon{width:11px;height:11px;color:var(--muted)}
.page-links a:hover{background:var(--mint);border-color:var(--teal)}
.no-pages{color:var(--muted);font-size:11px}
.results-note{font-size:11px;color:var(--muted);margin-top:14px;line-height:1.7}
.glossary-results{margin-top:36px}
.results-bottom{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:30px 0}
.text-link{display:inline-flex;gap:8px;align-items:center;min-height:44px;color:var(--teal);font-size:13px;font-weight:500}
.text-link .icon{width:16px;height:16px}
.section-empty{padding:22px;background:var(--surface);border:1px solid var(--border);border-radius:6px;color:var(--muted);font-size:13px}
.empty-state{border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);padding:28px;margin-bottom:32px}
.empty-state h2{font-size:20px;font-weight:600}
.empty-state>p{margin:10px 0;font-size:14px;color:var(--muted)}
.suggestions{margin:20px 0}
.suggestions h3{font-size:13px;font-weight:500;margin-bottom:10px}
.suggestions>div{display:flex;flex-wrap:wrap;gap:8px}
.suggestions button{display:flex;align-items:center;gap:10px;padding:10px 14px;min-height:44px;border:1px solid #516675;border-radius:4px;background:var(--paper);color:var(--teal);font-size:13px}
.suggestions .icon{width:14px;height:14px}
@media(max-width:1000px){.page-shell,.header-inner{width:calc(100% - 48px)}.header-inner{gap:20px}.desktop-nav{gap:18px}.tool-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){
    .page-shell,.header-inner{width:calc(100% - 36px)}
    .header-inner{min-height:66px;gap:12px}.brand{font-size:14px}.desktop-nav{display:none}.tools-menu>summary{font-size:12px;gap:8px;padding-inline:10px}
    .home-heading{padding:24px 0 16px}.home-heading h1{font-size:24px}
    .search-card{padding:16px}.search-label{font-size:12px}.search-row{gap:8px}.search-input-wrap input{font-size:16px;padding-left:36px;padding-right:44px}
    .input-icon{left:11px;width:17px;height:17px;top:18px}.clear-search{right:0}.search-submit{padding-inline:15px;gap:8px;font-size:13px}.search-submit .icon{width:16px;height:16px}
    .search-options{margin-top:16px}.option-grid{gap:2px 10px}.option{font-size:12px;gap:8px}.option input{width:17px;height:17px}
    .toolkit{padding:24px 0 30px}.tool-card{padding:12px;gap:9px;min-height:60px}.tool-card h3{font-size:12px}.tool-card>.icon{width:17px;height:17px}
    .site-footer{flex-direction:column;align-items:center;gap:2px;padding-top:10px;padding-bottom:max(8px,env(safe-area-inset-bottom));font-size:12px;text-align:center}
    .site-footer nav{display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:4px;width:min(340px,100%)}
    .site-footer nav a{justify-content:center;min-height:44px;min-width:44px;padding:8px 4px;border-radius:5px;color:var(--teal);font-size:13px}
    .site-footer nav a:hover{background:var(--surface)}
    .results-search{padding-top:20px;padding-bottom:10px}.results-heading{padding:20px 0}.results-heading h1{font-size:23px}.result-totals{font-size:11px;gap:7px}
    .section-heading h2{font-size:18px}.results-note{font-size:10px}.empty-state{padding:22px 18px}
}
@media(max-width:380px){
    .page-shell,.header-inner{width:calc(100% - 28px)}.brand{font-size:13px}.search-card{padding:14px 12px}.search-submit{padding-inline:13px}.search-submit .icon{display:none}
    .option{font-size:11px}.tool-card{padding:10px;gap:8px}.tool-card h3{font-size:11px}.result-totals{gap:5px;font-size:10px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;scroll-behavior:auto!important}}
/* Preserve the original table-first results workflow at every screen size. */
.edition-section{margin-top:24px;min-width:0}
.edition-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.edition-heading h3{font-size:17px;font-weight:600;letter-spacing:-.2px}
.table-scroll{width:100%;max-width:100%;border:1px solid var(--border);border-radius:8px;background:var(--surface)}
.table-scroll:focus-visible{outline:3px solid var(--teal);outline-offset:4px}
.results-table{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0;font-size:13px;line-height:1.6}
.results-table th,.results-table td{min-width:0;padding:13px 12px;text-align:left;vertical-align:middle;border-bottom:1px solid var(--border);white-space:normal;overflow-wrap:anywhere}
.results-table thead th{background:var(--surface-raised);color:var(--ink);font-size:11px;font-weight:650;white-space:normal;padding-top:14px;padding-bottom:14px}
.results-table tbody th{font-size:12px;font-weight:600;white-space:normal}
.results-table tbody tr:last-child>th,.results-table tbody tr:last-child>td{border-bottom:0}
.results-table tbody tr:nth-child(even)>*{background:#1b2530}
.results-table tbody tr:hover>*{background:#243242}
.results-table tr>*:not(:last-child){border-right:1px solid var(--border)}
.results-table thead th{border-bottom:2px solid #526577}
.results-table tbody th{background:inherit}
.results-table thead th:first-child{background:var(--surface-raised);border-top-left-radius:7px}
.results-table thead th:last-child{border-top-right-radius:7px}
.results-table tbody tr:last-child>th:first-child{border-bottom-left-radius:7px}
.results-table tbody tr:last-child>td:last-child{border-bottom-right-radius:7px}
.results-table .number-cell{text-align:center;font-variant-numeric:tabular-nums}
.summary-table .col-grade{width:10%}.summary-table .col-book{width:25%}.summary-table .col-edition{width:17%}.summary-table .col-count{width:14%}.summary-table .col-pages{width:34%}
.compact-column-label{display:none}
.book-type-cell a{display:inline-flex;max-width:100%;align-items:center;min-height:44px;color:var(--teal);font-weight:550;text-decoration:underline;text-decoration-color:#516f73;text-underline-offset:4px}
.book-type-cell a:hover{text-decoration-color:var(--teal)}
.results-table .page-links{gap:5px}
.results-table .page-links a{min-width:40px;min-height:44px;padding:6px 9px}
.results-table .edition-badge{display:inline-block;max-width:100%;white-space:normal;overflow-wrap:anywhere;font-size:10px}
.glossary-table .col-word{width:17%}.glossary-table .col-type{width:13%}.glossary-table .col-book{width:27%}.glossary-table .col-unit{width:11%}.glossary-table .col-page{width:10%}.glossary-table .col-edition{width:22%}
.glossary-table[data-edition="old"] .col-word{width:16%}.glossary-table[data-edition="old"] .col-type{width:12%}.glossary-table[data-edition="old"] .col-book{width:23%}.glossary-table[data-edition="old"] .col-unit{width:10%}.glossary-table[data-edition="old"] .col-page{width:9%}.glossary-table .col-period{width:14%}.glossary-table[data-edition="old"] .col-edition{width:16%}
.book-code{display:block;font-size:10px;color:var(--muted);margin-top:3px}
.detailed-results{margin-top:42px}
.detailed-book{margin-top:18px;scroll-margin-top:24px}
.detailed-book h4{margin:0;padding:14px 18px;background:var(--mint);color:var(--teal);border:1px solid var(--border);border-radius:6px 6px 0 0;font-size:14px;font-weight:600;line-height:1.6}
.detailed-book h4 span{font-size:12px;font-weight:400}
.detailed-book .context{background:var(--surface);border:1px solid var(--border);border-top:0;border-radius:0 0 6px 6px;padding:0 20px;overflow-wrap:anywhere}
.detailed-book .context p{padding:17px 0;font-size:14px;line-height:1.9;color:var(--ink)}
.detailed-book .context p+p{border-top:1px solid var(--border)}
.detailed-book .context strong{color:#c3f2c7;font-weight:650;background:#234331;border-radius:3px;padding:1px 3px;box-decoration-break:clone;-webkit-box-decoration-break:clone}
@media(max-width:1000px){
    .results-table th,.results-table td{padding:10px 7px}
    .results-table .page-links{display:grid;grid-template-columns:repeat(auto-fit,minmax(30px,1fr));gap:4px;max-width:100%}
    .results-table .page-links a{min-width:0;max-width:100%;min-height:40px;padding:4px 2px;font-size:12px}
    .results-table .page-links .icon{display:none}
}
@media(max-width:700px){
    .edition-heading{align-items:flex-start;gap:8px}.edition-heading h3{font-size:15px;line-height:1.5}.edition-heading>.edition-badge{font-size:9px}
    .results-table{font-size:12px;line-height:1.5}
    .results-table th,.results-table td{padding:10px 5px}
    .results-table thead th{font-size:11px;padding:12px 5px}.results-table tbody th{font-size:12px}
    .results-table .edition-badge{padding:3px 2px;font-size:11px;line-height:1.5;border-radius:3px}
    .summary-table .col-grade{width:14%}.summary-table .col-book{width:24%}.summary-table .col-edition{width:17%}.summary-table .col-count{width:14%}.summary-table .col-pages{width:31%}
    .full-column-label,.grade-prefix{display:none}.compact-column-label{display:inline;white-space:nowrap}
    .summary-table .grade-cell{text-align:center}
    .summary-table thead th:first-child{white-space:nowrap}
    .book-type-cell a{display:block;min-height:44px}
    .glossary-table .col-word{width:18%}.glossary-table .col-type{width:15%}.glossary-table .col-book{width:24%}.glossary-table .col-unit{width:12%}.glossary-table .col-page{width:11%}.glossary-table .col-edition{width:20%}
    .glossary-table[data-edition="old"] .col-word{width:16%}.glossary-table[data-edition="old"] .col-type{width:13%}.glossary-table[data-edition="old"] .col-book{width:18%}.glossary-table[data-edition="old"] .col-unit{width:10%}.glossary-table[data-edition="old"] .col-page{width:11%}.glossary-table .col-period{width:15%}.glossary-table[data-edition="old"] .col-edition{width:17%}
    .glossary-table th,.glossary-table td{padding:10px 4px;font-size:11px;hyphens:auto}
    .glossary-table .edition-badge{font-size:10px;padding:2px 1px}
    .results-table .no-pages{font-size:10px;line-height:1.5}
    .book-code{font-size:10px}
    .detailed-book h4{padding:13px 15px;font-size:13px}.detailed-book .context{padding:0 16px}.detailed-book .context p{font-size:14px;padding:15px 0}
}
@media(max-width:380px){
    .results-table th,.results-table td{padding-inline:3px}
    .results-table thead th{font-size:10px;padding-inline:3px}.summary-table{font-size:11px}.results-table .edition-badge{font-size:10px}
    .glossary-table th,.glossary-table td{font-size:10.5px}
    .glossary-table thead th{font-size:10px}.glossary-table .edition-badge{font-size:10px}
}
/* Desktop search workspace; the stacked phone layout stays unchanged. */
@media screen and (min-width:1001px){
    .home-page .header-inner,.home-page main.page-shell,.home-page .site-footer{width:min(1180px,calc(100% - 96px));max-width:1180px}
    .home-page .site-header{background:var(--surface)}
    .home-page .header-inner{min-height:84px}
    .home-page .brand{font-size:18px;gap:12px}
    .home-page .brand-icon{display:block;width:38px;height:38px;padding:9px;border:1px solid #416a5b;border-radius:6px;background:var(--mint);color:var(--teal)}
    .home-page .desktop-nav{gap:28px;font-size:14px}
    .home-page .desktop-nav a[aria-current]{box-shadow:inset 0 -2px var(--teal)}
    .home-page .tools-menu>summary{background:var(--paper);font-size:14px;padding-inline:16px}
    .home-page main.page-shell{display:flex;flex-direction:column;justify-content:center;padding-block:48px 56px}
    .home-heading{padding:0 0 28px}
    .home-heading h1{font-size:34px;letter-spacing:-.6px}
    .home-workspace{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:24px;align-items:stretch}
    .hero{display:flex}
    .home-page .search-card{width:100%;padding:32px;border-color:#415467;border-top:3px solid var(--teal);box-shadow:0 12px 32px #00000020}
    .home-page .search-label{font-size:15px;margin-bottom:14px}
    .home-page .search-row{gap:12px}
    .home-page .search-input-wrap input{height:64px;font-size:20px;padding-left:52px}
    .home-page .input-icon{top:22px;left:18px}
    .home-page .clear-search{top:10px}
    .home-page .search-submit{min-height:64px;padding-inline:26px;font-size:16px;gap:20px}
    .home-page .search-options{margin-top:28px}
    .home-page .search-options>summary{min-height:56px;font-size:14px}
    .home-page .option-grid{gap:12px}
    .home-page .option{padding:15px 16px;min-height:58px;font-size:14px;gap:12px;background:var(--paper);border:1px solid var(--border);border-radius:6px}
    .home-page .option:hover{border-color:var(--control-border)}
    .home-page .option:has(input:checked){border-color:#5a9b8e;background:var(--mint)}
    .home-page .option input{width:20px;height:20px}
    .home-page .phrase-hint{font-size:13px}
    .home-page .toolkit{padding:26px 22px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);display:flex;flex-direction:column}
    .home-page .toolkit .section-heading{margin-bottom:20px}
    .home-page .toolkit .section-heading h2{font-size:18px;font-weight:600;color:var(--ink)}
    .home-page .tool-grid{grid-template-columns:1fr;gap:10px;flex:1}
    .home-page .tool-card{gap:12px;padding:12px;min-height:66px;background:var(--paper);border-color:var(--border)}
    .home-page .tool-card>.icon{width:38px;height:38px;padding:9px;border-radius:5px;background:var(--surface-raised);color:var(--teal)}
    .home-page .tool-card h3{font-size:14px;font-weight:500}
    .home-page .tool-card::after{content:'→';margin-left:auto;color:var(--muted);font-size:18px}
    .home-page .tool-card:hover{background:var(--surface-raised);border-color:#5a9b8e}
    .home-page .site-footer{padding-top:12px;font-size:13px}
    .results-page .page-shell{width:min(1180px,calc(100% - 96px));max-width:1180px}
    .results-page .results-table{font-size:14px}
    .results-page .results-table thead th,.results-page .results-table tbody th{font-size:13px}
}

@media print{.table-scroll{overflow:visible;border-radius:0}.results-table{min-width:0;font-size:10px}.results-table th,.results-table td{padding:6px}.results-table th:first-child{position:static}.table-scroll-hint{display:none}.detailed-book{break-inside:avoid}}
@media print{
    :root{color-scheme:light;--paper:#fff;--surface:#fff;--surface-raised:#eee;--ink:#111;--muted:#444;--teal:#164c40;--mint:#eee;--border:#ccc}
    body{display:block;min-height:0}.site-header,.site-footer,.results-search,.results-bottom,.skip-link{display:none!important}.page-shell{width:100%;max-width:none}
    .results-table tbody tr:nth-child(even)>*{background:#f5f5f5}.detailed-book .context strong{background:#e6efc6;color:#111}.edition-badge{background:#eee!important;color:#222!important}
}
