:root {
    color-scheme: light;
    --ink: #213a35;
    --muted: #64746d;
    --accent: #008751;
    --line: #dce4dc;
    --paper: #f5f6ef;
}

body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.4 system-ui, sans-serif; }
.catalogue { max-width: 1280px; margin: auto; padding: 0 clamp(10px, 2.5vw, 28px); }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 0 14px; }
.page-header h1 { margin: 0; font: 700 clamp(1.5rem, 3vw, 2rem)/1.15 Georgia, serif; letter-spacing: -.025em; }
.series-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.book-filter { display: grid; gap: 2px; min-height: 44px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); text-align: left; font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
.book-filter strong { color: var(--accent); font-size: .9rem; }
.series-counts { display: flex; flex-wrap: wrap; gap: 0 10px; color: var(--muted); font-size: .75rem; }
.series-counts > span { white-space: nowrap; }
.book-filter:hover { border-color: var(--accent); background: #edf7f0; }
.book-filter.active { border-color: var(--accent); background: var(--accent); color: white; }
.book-filter.active strong, .book-filter.active .series-counts { color: white; }
.catalogue-panel { padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.filter-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; font-size: .8rem; }
#filter-status { margin: 0; color: var(--muted); }
#reset-filters { min-height: 40px; padding: 4px 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.catalogue-panel div.dt-container > .row { --bs-gutter-y: 0; margin: 0 !important; }
.catalogue-panel div.dt-container > .row > * { padding-left: 0; padding-right: 0; }
.catalogue-panel div.dt-container > .row:first-child { align-items: center; row-gap: 0; padding: 5px 0; margin-top: 0 !important; }
.catalogue-panel div.dt-search { display: flex; align-items: center; gap: 6px; margin: 0; }
.catalogue-panel div.dt-search label { margin: 0; color: var(--muted); }
.catalogue-panel div.dt-search input { width: 230px; min-height: 38px; margin: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; }
.catalogue-panel div.dt-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #00875120; outline: none; }
#polars { table-layout: fixed; width: 100% !important; margin: 0 !important; border-color: var(--line); font-size: .875rem; --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-striped-bg: #f5f8f3; --bs-table-striped-color: var(--ink); }
#polars th:nth-child(1) { width: 50% !important; }
#polars th:nth-child(2) { width: 24% !important; }
#polars th:nth-child(3) { width: 15% !important; }
#polars th:nth-child(4) { width: 11% !important; }
#polars th, #polars td { padding: 7px 10px; vertical-align: middle; overflow-wrap: anywhere; }
#polars thead, #polars tfoot { color: var(--muted); font-size: .75rem; }
#polars thead th { border-top: 1px solid var(--line); }
#polars td:first-child { font-weight: 550; }
#polars .book-link { color: inherit; text-decoration: none; }
#polars .book-link:hover { text-decoration: underline; text-underline-offset: 3px; }
#polars tbody tr[data-wikipedia] { cursor: pointer; }
#polars tbody tr[data-wikipedia]:hover > td { background-color: #edf7f0; }
#polars .publication-year { white-space: nowrap; font-variant-numeric: tabular-nums; }
#polars td:nth-child(3), #polars td:nth-child(4) { font-size: .75rem; }
#polars .text-success { color: var(--accent) !important; }
#polars .text-danger { color: #7b8085 !important; }
.tag-list { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px 5px; vertical-align: middle; }
.tag-symbol { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.tag-symbol svg { width: 24px; height: 24px; }
.tag-emoji { width: auto; min-width: 24px; font-size: 1.15rem; line-height: 1; white-space: nowrap; }
.catalogue-panel div.dt-info { padding: 9px 0; color: var(--muted); font-size: .75rem; }
.page-footer { text-align: center; font-size: .8rem; }
.page-footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--muted); text-decoration: none; }
.page-footer a:hover { color: var(--accent); text-decoration: underline; }
button:focus-visible, a:focus-visible { outline: 3px solid #b36f29; outline-offset: 3px; }

@media (max-width: 767px) {
    .page-header { padding-top: 14px; gap: 10px; }
    .series-filters { width: 100%; flex-wrap: nowrap; }
    .book-filter { flex: 1; min-width: 0; padding: 6px 10px; }
    .catalogue-panel { padding: 0 8px; }
    .catalogue-panel div.dt-container > .row:first-child { padding: 4px 0 8px; }
    .catalogue-panel .dt-layout-start, .catalogue-panel .dt-layout-end { width: 100%; }
    .catalogue-panel div.dt-search { width: 100%; }
    .catalogue-panel div.dt-search input { flex: 1; min-width: 0; width: auto; font-size: 16px; }
    #polars { font-size: .8125rem; }
    #polars th:nth-child(1) { width: 42% !important; }
    #polars th:nth-child(2) { width: 24% !important; }
    #polars th:nth-child(3) { width: 16% !important; }
    #polars th:nth-child(4) { width: 18% !important; }
    #polars th, #polars td { padding: 6px; }
    #polars td:nth-child(2) { font-size: .75rem; }
    #polars td:nth-child(3), #polars td:nth-child(4) { font-size: .7rem; }
    #polars thead th, #polars tfoot th { font-size: .7rem; }
    #polars th.publication-year { padding-left: 3px; padding-right: 3px; font-size: .65rem; }
    .catalogue-panel div.dt-info { text-align: left; }
}
