    :root {
      --ink: #173044;
      --ink-2: #4d6170;
      --navy: #19364f;
      --navy-2: #244d68;
      --teal: #177f7a;
      --teal-dark: #0e6966;
      --teal-soft: #e7f5f2;
      --coral: #b84432;
      --coral-dark: #963426;
      --cream: #f6f3ed;
      --paper: #fffefa;
      --line: #dce4e7;
      --line-dark: #bdcbd0;
      --muted: #eef2f3;
      --white: #ffffff;
      --success: #246d53;
      --warning: #9a5c12;
      --danger: #9b3d35;
      --accent-text: #0e6966;
      --panel-surface: #fffefa;
      --control-surface: #ffffff;
      --card-surface: rgba(255, 254, 250, .96);
      --translucent-surface: rgba(255, 255, 255, .7);
      --meta-group-surface: #f3f8f8;
      --meta-item-surface: #ffffff;
      --tag-surface: #edf3f4;
      --tag-border: #d6e0e2;
      --shadow-sm: 0 7px 24px rgba(21, 48, 68, .08);
      --shadow-md: 0 20px 55px rgba(21, 48, 68, .14);
      --radius-sm: 12px;
      --radius: 18px;
      --radius-lg: 28px;
      --content: 1240px;
      --focus: 0 0 0 4px rgba(23, 127, 122, .2);
      --user-background: #f6f3ed;
    }

    html[data-theme="light"] { color-scheme: light; }

    html[data-theme="dark"] {
      color-scheme: dark;
      --ink: #edf4f7;
      --ink-2: #b9c8d2;
      --cream: #0c151d;
      --paper: #14222e;
      --line: #344958;
      --line-dark: #587080;
      --muted: #233744;
      --teal-soft: #173b3d;
      --success: #75d3a7;
      --warning: #f0c46d;
      --danger: #ff9b92;
      --coral: #f08a75;
      --coral-dark: #c95743;
      --accent-text: #7bd9d2;
      --panel-surface: #14222e;
      --control-surface: #1b2c39;
      --card-surface: rgba(20, 34, 46, .97);
      --translucent-surface: rgba(27, 44, 57, .82);
      --meta-group-surface: #192b37;
      --meta-item-surface: #203440;
      --tag-surface: #1d303d;
      --tag-border: #3c5362;
      --shadow-sm: 0 9px 26px rgba(0, 0, 0, .24);
      --shadow-md: 0 24px 65px rgba(0, 0, 0, .38);
      --focus: 0 0 0 4px rgba(123, 217, 210, .3);
    }

    html[data-theme="sepia"] {
      color-scheme: light;
      --ink: #43361f;
      --ink-2: #695a3d;
      --cream: #f3e7cf;
      --paper: #fff8e9;
      --line: #d8c7a8;
      --line-dark: #b7a17c;
      --muted: #eee0c5;
      --teal-soft: #e4eddf;
      --accent-text: #3d6861;
      --panel-surface: #fff8e9;
      --control-surface: #fffdf6;
      --card-surface: rgba(255, 248, 233, .97);
      --translucent-surface: rgba(255, 248, 233, .78);
      --meta-group-surface: #f5ead7;
      --meta-item-surface: #fffaf0;
      --tag-surface: #efe3ce;
      --tag-border: #d6c3a3;
    }

    html[data-theme="contrast"] {
      color-scheme: light;
      --ink: #000000;
      --ink-2: #202020;
      --cream: #ffffff;
      --paper: #ffffff;
      --line: #000000;
      --line-dark: #000000;
      --muted: #eeeeee;
      --teal-soft: #e8ffff;
      --accent-text: #005f5b;
      --panel-surface: #ffffff;
      --control-surface: #ffffff;
      --card-surface: #ffffff;
      --translucent-surface: #ffffff;
      --meta-group-surface: #f4f4f4;
      --meta-item-surface: #ffffff;
      --tag-surface: #f4f4f4;
      --tag-border: #000000;
      --coral: #000000;
      --coral-dark: #000000;
      --shadow-sm: none;
      --shadow-md: 0 0 0 2px #000000;
      --focus: 0 0 0 4px #ffbf00;
    }

    * { box-sizing: border-box; }

    html { scroll-behavior: smooth; }

    body {
      margin: 0;
      min-width: 320px;
      color: var(--ink);
      background:
        radial-gradient(circle at 10% 5%, rgba(231, 104, 81, .09), transparent 30rem),
        radial-gradient(circle at 96% 22%, rgba(23, 127, 122, .10), transparent 32rem),
        var(--cream);
      font-family: var(--user-font-family, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
      line-height: var(--user-line-height, 1.5);
      -webkit-font-smoothing: antialiased;
    }

    body.custom-appearance {
      background:
        radial-gradient(circle at 10% 5%, rgba(231, 104, 81, .07), transparent 30rem),
        radial-gradient(circle at 96% 22%, rgba(23, 127, 122, .08), transparent 32rem),
        var(--user-background);
    }

    html[data-theme="dark"] body:not(.custom-appearance) {
      background:
        radial-gradient(circle at 8% 4%, rgba(231, 104, 81, .08), transparent 30rem),
        radial-gradient(circle at 96% 22%, rgba(66, 181, 174, .11), transparent 34rem),
        var(--cream);
    }

    body.strong-borders {
      --line: #8396a1;
      --line-dark: #536a78;
    }

    html[data-theme="dark"] body.strong-borders {
      --line: #718999;
      --line-dark: #9ab0bd;
    }

    html[data-theme="contrast"] body.strong-borders {
      --line: #000000;
      --line-dark: #000000;
    }

    body.large-controls .search-button,
    body.large-controls .book-action,
    body.large-controls .apply-filters,
    body.large-controls .filter-select,
    body.large-controls .year-input,
    body.large-controls .sort-select,
    body.large-controls .field-wrap input,
    body.large-controls .field-wrap select,
    body.large-controls .basket-small-button,
    body.large-controls .basket-input,
    body.large-controls .basket-select,
    body.large-controls .appearance-settings > summary,
    body.large-controls .appearance-control select { min-height: 46px; }

    body.reduce-motion *,
    body.reduce-motion *::before,
    body.reduce-motion *::after {
      scroll-behavior: auto !important;
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
    }

    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
      }
    }

    /* Gdy użytkownik ustawi własny kolor tekstu, stosujemy go do CAŁEJ treści do
       czytania (tytuły, autorzy, wartości metryk, etykiety tematów, teksty
       okładek zastępczych), a nie tylko do tekstu dziedziczącego --ink. Przyciski
       i plakietki zachowują kolory marki dla czytelności. */
    body.custom-text h1 em,
    body.custom-text .book-authors,
    body.custom-text .dialog-authors,
    body.custom-text .meta-value,
    body.custom-text .meta-item.series-fact,
    body.custom-text .meta-item.series-fact .meta-label,
    body.custom-text .meta-item.series-fact .meta-value,
    body.custom-text .subject-tag,
    body.custom-text .basket-item-author,
    body.custom-text .basket-item-meta { color: var(--ink); }

    button, input, select { font: inherit; }
    button, a { -webkit-tap-highlight-color: transparent; }
    button { color: inherit; }
    a { color: inherit; }
    img { max-width: 100%; }

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    .skip-link {
      position: fixed;
      top: 10px;
      left: 10px;
      z-index: 1000;
      padding: 10px 14px;
      color: var(--white);
      background: var(--navy);
      border-radius: 10px;
      box-shadow: var(--shadow-sm);
      font-weight: 800;
      transform: translateY(-180%);
      transition: transform .15s ease;
    }

    .skip-link:focus { transform: translateY(0); }

    .noscript-message {
      margin: 12px auto;
      width: min(var(--content), calc(100% - 36px));
      padding: 13px 16px;
      color: #632e17;
      background: #fff1e7;
      border: 1px solid #d99b77;
      border-radius: 12px;
      font-weight: 700;
    }

    .shell {
      width: min(var(--content), calc(100% - 36px));
      margin-inline: auto;
    }

    .site-header {
      position: relative;
      z-index: 10;
      padding: 18px 0 10px;
    }

    .nav {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
    }

    .brand {
      display: inline-flex;
      min-width: 0;
      align-items: center;
      gap: 12px;
      text-decoration: none;
      font-weight: 800;
      letter-spacing: -.025em;
    }

    .brand-mark {
      display: grid;
      place-items: center;
      width: 44px;
      height: 44px;
      color: var(--white);
      border-radius: 14px;
      background: linear-gradient(145deg, var(--teal), var(--navy));
      box-shadow: 0 10px 24px rgba(23, 127, 122, .22);
    }

    .brand-mark svg { width: 25px; height: 25px; }
    .brand-name { font-size: 1.02rem; }
    .brand > span:last-child { min-width: 0; }
    .brand-name { overflow-wrap: anywhere; }
    .brand-sub { display: block; margin-top: -2px; color: var(--ink-2); font-size: .72rem; font-weight: 650; letter-spacing: .02em; }

    .nav-links {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .nav-link {
      padding: 9px 13px;
      border-radius: 999px;
      color: var(--ink-2);
      text-decoration: none;
      font-size: .88rem;
      font-weight: 700;
    }

    .nav-link:hover { color: var(--ink); background: var(--translucent-surface); }

    .test-badge {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 8px 12px;
      color: var(--accent-text);
      background: var(--teal-soft);
      border: 1px solid rgba(23, 127, 122, .16);
      border-radius: 999px;
      font-size: .76rem;
      font-weight: 800;
      white-space: nowrap;
    }

    .test-badge::before {
      width: 7px;
      height: 7px;
      content: "";
      background: var(--teal);
      border-radius: 50%;
      box-shadow: 0 0 0 4px rgba(23, 127, 122, .12);
    }

    .header-tools { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }

    .appearance-settings { position: relative; }
    .appearance-settings:not([open]) > .appearance-panel { display: none; }

    .appearance-settings > summary {
      display: inline-flex;
      min-height: 40px;
      align-items: center;
      justify-content: center;
      gap: 7px;
      padding: 8px 11px;
      color: var(--ink);
      background: var(--panel-surface);
      border: 1px solid var(--line);
      border-radius: 12px;
      cursor: pointer;
      font-size: .78rem;
      font-weight: 820;
      list-style: none;
    }

    .appearance-settings > summary::-webkit-details-marker { display: none; }
    .settings-icon { width: 17px; height: 17px; }
    .appearance-settings > summary:hover { border-color: var(--teal); }
    .appearance-settings > summary:focus-visible { outline: none; box-shadow: var(--focus); }

    .appearance-panel {
      position: absolute;
      top: calc(100% + 9px);
      right: 0;
      z-index: 80;
      width: min(390px, calc(100vw - 24px));
      max-height: min(760px, calc(100vh - 90px));
      padding: 18px;
      overflow: auto;
      color: var(--ink);
      background: var(--panel-surface);
      border: 1px solid var(--line);
      border-radius: 16px;
      box-shadow: var(--shadow-md);
      scrollbar-gutter: stable;
    }

    .appearance-panel h2 { margin: 0 0 8px; font-size: 1.05rem; }
    .appearance-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 11px; font-size: .78rem; font-weight: 760; }
    .appearance-control input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--teal); }
    .appearance-control input[type="color"] { width: 54px; height: 36px; padding: 2px; background: var(--control-surface); border: 1px solid var(--line-dark); border-radius: 8px; cursor: pointer; }
    .appearance-control select { min-width: 190px; padding: 8px 30px 8px 10px; color: var(--ink); background: var(--control-surface); border: 1px solid var(--line-dark); border-radius: 8px; }
    .appearance-control input:focus-visible,
    .appearance-control select:focus-visible { outline: none; box-shadow: var(--focus); }
    .appearance-value { color: var(--ink-2); font-variant-numeric: tabular-nums; }
    .appearance-message { min-height: 2.4em; margin: 13px 0 0; color: var(--ink-2); font-size: .71rem; line-height: 1.35; }
    .appearance-message.error { color: var(--danger); font-weight: 760; }
    .appearance-reset { width: 100%; min-height: 36px; margin-top: 9px; color: var(--accent-text); background: var(--teal-soft); border: 1px solid rgba(23, 127, 122, .3); border-radius: 9px; cursor: pointer; font-size: .75rem; font-weight: 800; }
    .appearance-clear-data { color: var(--danger); background: var(--control-surface); border-color: currentColor; }
    .appearance-clear-data:hover { background: var(--muted); }
    .appearance-intro { margin: 0 0 6px; color: var(--ink-2); font-size: .72rem; line-height: 1.35; }
    .appearance-help { margin: 6px 0 0; color: var(--ink-2); font-size: .66rem; line-height: 1.35; }
    .appearance-subtitle { display: block; margin: 12px 0 6px; font-size: .72rem; font-weight: 820; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); }
    .appearance-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .appearance-preset { display: flex; min-height: 38px; align-items: center; gap: 7px; padding: 7px 9px; color: var(--ink); background: var(--control-surface); border: 1px solid var(--line-dark); border-radius: 9px; cursor: pointer; font-size: .72rem; font-weight: 780; }
    .appearance-preset:hover { border-color: var(--teal); color: var(--accent-text); }
    .appearance-preset.active { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
    .appearance-preset:focus-visible { outline: none; box-shadow: var(--focus); }
    .theme-swatch { flex: 0 0 auto; width: 16px; height: 16px; border: 1px solid rgba(0, 0, 0, .28); border-radius: 50%; }
    .theme-light .theme-swatch { background: #fffefa; }
    .theme-dark .theme-swatch { background: #14222e; border-color: #718999; }
    .theme-sepia .theme-swatch { background: #f3e7cf; }
    .theme-contrast .theme-swatch { background: linear-gradient(90deg, #000 50%, #fff 50%); }
    .appearance-check { display: flex; align-items: flex-start; gap: 9px; margin: 9px 0; color: var(--ink); cursor: pointer; font-size: .74rem; font-weight: 690; line-height: 1.35; }
    .appearance-check input { flex: 0 0 auto; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--teal); }

    .basket-header-button {
      display: inline-flex;
      min-height: 40px;
      align-items: center;
      gap: 8px;
      padding: 8px 11px;
      color: var(--white);
      background: var(--navy);
      border: 1px solid var(--navy);
      border-radius: 12px;
      cursor: pointer;
      font-size: .78rem;
      font-weight: 820;
      box-shadow: 0 8px 20px rgba(25, 54, 79, .14);
    }

    .basket-header-button:hover { background: var(--navy-2); }

    .basket-count {
      display: grid;
      min-width: 22px;
      height: 22px;
      place-items: center;
      padding-inline: 5px;
      color: var(--navy);
      background: #f4ce47;
      border-radius: 999px;
      font-size: .68rem;
      font-weight: 900;
    }

    .hero {
      position: relative;
      padding: 48px 0 22px;
    }

    .hero::before {
      position: absolute;
      top: 18px;
      right: max(18px, calc((100vw - var(--content)) / 2));
      width: 150px;
      height: 150px;
      content: "";
      border: 1px solid rgba(23, 127, 122, .16);
      border-radius: 44px;
      transform: rotate(12deg);
      pointer-events: none;
    }

    .hero-copy { position: relative; max-width: 820px; }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 9px;
      margin: 0 0 14px;
      color: var(--accent-text);
      font-size: .78rem;
      font-weight: 850;
      letter-spacing: .11em;
      text-transform: uppercase;
    }

    .eyebrow::before { width: 28px; height: 2px; content: ""; background: var(--coral); }

    h1 {
      max-width: 760px;
      margin: 0;
      font-family: var(--user-heading-font, Georgia, "Times New Roman", serif);
      font-size: clamp(2.55rem, 6vw, 5.25rem);
      font-weight: 700;
      line-height: .98;
      letter-spacing: -.055em;
    }

    h1 em { color: var(--coral); font-style: normal; }

    .hero-lead {
      max-width: 690px;
      margin: 22px 0 0;
      color: var(--ink-2);
      font-size: clamp(1rem, 2vw, 1.18rem);
    }

    .search-card {
      position: relative;
      z-index: 2;
      margin-top: 30px;
      padding: 16px;
      background: var(--card-surface);
      border: 1px solid rgba(189, 203, 208, .7);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-md);
      backdrop-filter: blur(12px);
    }

    .search-row {
      display: grid;
      grid-template-columns: 182px minmax(0, 1fr) auto;
      gap: 10px;
      align-items: stretch;
    }

    .field-wrap { position: relative; }

    .field-wrap label {
      position: absolute;
      top: 8px;
      left: 15px;
      z-index: 1;
      color: var(--ink-2);
      font-size: .66rem;
      font-weight: 800;
      letter-spacing: .05em;
      text-transform: uppercase;
      pointer-events: none;
    }

    .field-wrap select,
    .field-wrap input {
      width: 100%;
      min-height: 62px;
      padding: 24px 15px 8px;
      color: var(--ink);
      background: var(--control-surface);
      border: 1px solid var(--line);
      border-radius: 16px;
      outline: none;
      font-weight: 690;
    }

    .field-wrap input { padding-right: 46px; font-size: 1.03rem; }

    .field-wrap select:focus,
    .field-wrap input:focus { border-color: var(--teal); box-shadow: var(--focus); }

    .clear-query {
      position: absolute;
      top: 50%;
      right: 10px;
      display: none;
      width: 34px;
      height: 34px;
      padding: 0;
      border: 0;
      border-radius: 50%;
      background: transparent;
      cursor: pointer;
      transform: translateY(-50%);
    }

    .clear-query:hover { background: var(--muted); }
    .clear-query.visible { display: grid; place-items: center; }

    .search-button {
      display: inline-flex;
      min-width: 146px;
      align-items: center;
      justify-content: center;
      gap: 9px;
      padding: 0 22px;
      color: var(--white);
      background: linear-gradient(145deg, var(--teal), var(--teal-dark));
      border: 0;
      border-radius: 16px;
      box-shadow: 0 10px 22px rgba(23, 127, 122, .2);
      cursor: pointer;
      font-weight: 830;
    }

    .search-button:hover { background: linear-gradient(145deg, #1a8c86, #0d625f); transform: translateY(-1px); }
    .search-button:active { transform: translateY(0); }
    .search-button:focus-visible, button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--focus); }
    .search-button:disabled { cursor: wait; opacity: .75; transform: none; }
    .search-button svg { width: 19px; height: 19px; }

    .search-foot {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      padding: 12px 5px 1px;
      color: var(--ink-2);
      font-size: .78rem;
    }

    .api-note { flex: 0 0 auto; }

    .sections {
      padding: 26px 0 18px;
    }

    .section-head {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 24px;
      margin-bottom: 16px;
    }

    .section-head h2 {
      margin: 0;
      font-family: var(--user-heading-font, Georgia, "Times New Roman", serif);
      font-size: clamp(1.6rem, 3vw, 2.25rem);
      letter-spacing: -.03em;
    }

    .section-head p { max-width: 610px; margin: 0; color: var(--ink-2); font-size: .9rem; }

    .departments {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
    }

    .department {
      position: relative;
      min-height: 184px;
      padding: 19px;
      overflow: hidden;
      background: var(--translucent-surface);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow-sm);
    }

    .department::after {
      position: absolute;
      right: -32px;
      bottom: -40px;
      width: 100px;
      height: 100px;
      content: "";
      background: var(--teal-soft);
      border-radius: 50%;
      opacity: .75;
    }

    .department:nth-child(2)::after { background: #fce9e3; }
    .department:nth-child(3)::after { background: #eaf0f8; }
    .department:nth-child(4)::after { background: #f5edda; }

    .department-title {
      display: flex;
      align-items: center;
      gap: 9px;
      margin: 0 0 13px;
      font-size: .94rem;
      font-weight: 850;
    }

    .department-icon {
      display: grid;
      width: 32px;
      height: 32px;
      place-items: center;
      color: var(--accent-text);
      background: var(--teal-soft);
      border-radius: 10px;
      font-size: 1rem;
    }

    .category-list { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 7px; }

    .category-chip {
      padding: 7px 10px;
      color: var(--ink-2);
      background: var(--control-surface);
      border: 1px solid var(--line);
      border-radius: 999px;
      cursor: pointer;
      font-size: .76rem;
      font-weight: 730;
    }

    .category-chip:hover { color: var(--accent-text); border-color: rgba(23, 127, 122, .5); }
    .category-chip.active { color: var(--white); background: var(--teal); border-color: var(--teal); }

    .source-strip {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 12px;
      padding: 18px 0 30px;
    }

    .source-card {
      display: flex;
      min-width: 0;
      flex-wrap: wrap;
      align-items: center;
      gap: 13px;
      min-height: 82px;
      padding: 14px 16px;
      background: var(--translucent-surface);
      border: 1px solid var(--line);
      border-radius: var(--radius);
    }

    .source-logo {
      display: grid;
      flex: 0 0 auto;
      width: 43px;
      height: 43px;
      place-items: center;
      color: var(--white);
      background: var(--navy);
      border-radius: 13px;
      font-weight: 900;
      letter-spacing: -.04em;
    }

    .source-logo.bn { background: #9d2730; }
    .source-logo.google { background: #4285f4; }
    .source-logo.lc { background: #a83d30; }
    .source-logo.platon { color: var(--navy); background: #f4ce47; }
    .source-card > div { min-width: 0; flex: 1 1 100px; }
    .source-card h3 { margin: 0; overflow-wrap: anywhere; font-size: .9rem; }
    .source-card p { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--ink-2); font-size: .75rem; }
    .source-state { min-width: 0; margin-left: auto; overflow-wrap: anywhere; color: var(--success); font-size: .69rem; font-weight: 820; text-transform: uppercase; }
    .source-state.external { color: var(--warning); }

    .results-area {
      min-height: 580px;
      padding: 28px 0 70px;
      border-top: 1px solid rgba(189, 203, 208, .72);
    }

    .results-layout {
      display: grid;
      grid-template-columns: 254px minmax(0, 1fr);
      gap: 24px;
      align-items: start;
    }

    .filters {
      position: sticky;
      top: 18px;
      padding: 18px;
      background: var(--card-surface);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow-sm);
      backdrop-filter: blur(12px);
    }

    .filters-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 13px;
    }

    .filters h2 { margin: 0; font-size: 1rem; }

    .reset-filters {
      padding: 3px 0;
      color: var(--accent-text);
      background: none;
      border: 0;
      cursor: pointer;
      font-size: .73rem;
      font-weight: 780;
    }

    .apply-filters {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      min-height: 44px;
      margin-bottom: 6px;
      padding: 10px 14px;
      color: var(--white);
      background: linear-gradient(145deg, var(--teal), var(--teal-dark));
      border: 1px solid var(--teal-dark);
      border-radius: 12px;
      cursor: pointer;
      font-size: .9rem;
      font-weight: 820;
    }

    .apply-filters svg { width: 17px; height: 17px; }
    .apply-filters:hover { background: linear-gradient(145deg, #1a8c86, #0d625f); }
    .apply-filters.dirty { box-shadow: 0 0 0 3px rgba(23, 127, 122, .22); }

    .apply-hint {
      display: none;
      margin: 0 0 12px;
      color: var(--accent-text);
      font-size: .72rem;
      font-weight: 700;
    }

    .apply-hint.visible { display: block; }

    .filter-group { padding: 15px 0; border-top: 1px solid var(--line); }
    .filter-group:first-of-type { border-top: 0; }
    .filter-title { display: block; margin-bottom: 9px; font-size: .78rem; font-weight: 820; }
    .no-category-text { display: none; color: var(--ink-2); font-size: .75rem; }
    .stage-note { margin: 0; color: var(--ink-2); font-size: .72rem; }

    .filter-select,
    .year-input {
      width: 100%;
      min-height: 40px;
      padding: 8px 10px;
      color: var(--ink);
      background: var(--control-surface);
      border: 1px solid var(--line);
      border-radius: 10px;
      outline: none;
      font-size: .79rem;
      font-weight: 650;
    }

    .filter-select:focus, .year-input:focus { border-color: var(--teal); box-shadow: var(--focus); }
    .year-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

    .check-row {
      display: flex;
      align-items: flex-start;
      gap: 9px;
      margin: 9px 0;
      color: var(--ink-2);
      cursor: pointer;
      font-size: .78rem;
      font-weight: 650;
    }

    .check-row input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--teal); }

    .active-category-box {
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-top: 8px;
      padding: 9px 10px;
      color: var(--accent-text);
      background: var(--teal-soft);
      border-radius: 10px;
      font-size: .75rem;
      font-weight: 780;
    }

    .active-category-box.visible { display: flex; }
    .active-category-box button { padding: 2px; background: none; border: 0; cursor: pointer; font-weight: 900; }

    .mobile-filter-button { display: none; }

    .results-panel { min-width: 0; }

    .results-toolbar {
      display: flex;
      min-height: 48px;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 14px;
      padding: 12px 14px;
      background: var(--translucent-surface);
      border: 1px solid var(--line);
      border-radius: 14px;
    }

    .results-summary h2 { margin: 0; font-family: var(--user-heading-font, Georgia, "Times New Roman", serif); font-size: 1.55rem; letter-spacing: -.025em; }
    .results-summary p { max-width: 720px; margin: 4px 0 0; color: var(--ink-2); font-size: .78rem; line-height: 1.45; }

    .toolbar-controls { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px; }

    .sort-select {
      min-height: 40px;
      padding: 7px 31px 7px 10px;
      color: var(--ink);
      background: var(--panel-surface);
      border: 1px solid var(--line);
      border-radius: 10px;
      outline: none;
      font-size: .76rem;
      font-weight: 700;
    }

    .view-buttons { display: flex; padding: 3px; background: var(--translucent-surface); border: 1px solid var(--line); border-radius: 11px; }

    .view-button {
      display: grid;
      width: 34px;
      height: 32px;
      padding: 0;
      place-items: center;
      color: var(--ink-2);
      background: transparent;
      border: 0;
      border-radius: 8px;
      cursor: pointer;
    }

    .view-button.active { color: var(--accent-text); background: var(--control-surface); box-shadow: 0 2px 8px rgba(21, 48, 68, .1); }
    .view-button svg { width: 17px; height: 17px; }

    .status-box {
      display: grid;
      min-height: 360px;
      padding: 42px 22px;
      place-items: center;
      text-align: center;
      background: var(--translucent-surface);
      border: 1px dashed var(--line-dark);
      border-radius: var(--radius-lg);
    }

    .status-content { max-width: 470px; }

    .status-icon {
      display: grid;
      width: 72px;
      height: 72px;
      margin: 0 auto 18px;
      place-items: center;
      color: var(--accent-text);
      background: var(--teal-soft);
      border-radius: 24px;
    }

    .status-icon svg { width: 34px; height: 34px; }
    .status-box h3 { margin: 0 0 7px; font-size: 1.18rem; }
    .status-box p { margin: 0; color: var(--ink-2); font-size: .88rem; }

    .status-box.error { border-color: rgba(155, 61, 53, .35); background: #fff8f6; }
    .status-box.error .status-icon { color: var(--danger); background: #fbe8e4; }

    .source-notice {
      margin-bottom: 12px;
      padding: 11px 13px;
      color: #634d12;
      background: #fff7dc;
      border: 1px solid #e4ca6e;
      border-radius: 11px;
      font-size: .78rem;
      line-height: 1.45;
    }

    .source-notice strong { color: #3d310e; }

    .retry-button {
      margin-top: 16px;
      padding: 9px 14px;
      color: var(--white);
      background: var(--teal);
      border: 0;
      border-radius: 10px;
      cursor: pointer;
      font-size: .8rem;
      font-weight: 800;
    }

    .loader {
      width: 34px;
      height: 34px;
      border: 3px solid rgba(23, 127, 122, .18);
      border-top-color: var(--teal);
      border-radius: 50%;
      animation: spin .8s linear infinite;
    }

    @keyframes spin { to { transform: rotate(360deg); } }

    .result-list { display: grid; gap: 12px; }

    .book-card {
      position: relative;
      display: grid;
      grid-template-columns: 112px minmax(0, 1fr);
      gap: 18px;
      min-width: 0;
      padding: 18px;
      background: var(--card-surface);
      border: 1px solid var(--line-dark);
      border-radius: var(--radius);
      box-shadow: var(--shadow-sm);
      transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    }

    .book-card:hover { border-color: var(--teal); box-shadow: var(--shadow-md); transform: translateY(-2px); }

    .cover-frame {
      position: relative;
      width: 112px;
      aspect-ratio: 2 / 3;
      overflow: hidden;
      background: linear-gradient(145deg, #dfe9e8, #c6d7d6);
      border-radius: 9px 13px 13px 9px;
      box-shadow: 0 10px 20px rgba(21, 48, 68, .18);
    }

    .cover-frame::before { position: absolute; top: 0; bottom: 0; left: 7px; z-index: 2; width: 1px; content: ""; background: rgba(23, 48, 68, .14); }

    .cover-frame img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; }

    .cover-source-badge {
      position: absolute;
      right: 5px;
      bottom: 5px;
      z-index: 3;
      display: inline-flex;
      align-items: center;
      padding: 3px 5px;
      color: var(--white);
      background: rgba(25, 54, 79, .9);
      border: 1px solid rgba(255, 255, 255, .44);
      border-radius: 6px;
      font-size: .55rem;
      font-weight: 850;
      letter-spacing: .02em;
      line-height: 1;
      box-shadow: 0 2px 8px rgba(21, 48, 68, .2);
    }

    .cover-placeholder {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 7px;
      padding: 12px;
      color: var(--navy);
      text-align: center;
      font-family: var(--user-heading-font, Georgia, "Times New Roman", serif);
      font-size: .78rem;
      font-weight: 700;
      line-height: 1.22;
    }

    .cover-placeholder::before { width: 26px; height: 3px; content: ""; background: var(--coral); border-radius: 99px; }

    .book-main { display: flex; min-width: 0; flex-direction: column; }
    .book-topline { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 7px; }

    .edition-badge,
    .ebook-badge,
    .large-print-badge,
    .material-badge,
    .primary-genre-badge,
    .series-volume-badge {
      display: inline-flex;
      padding: 4px 7px;
      border-radius: 7px;
      font-size: .65rem;
      font-weight: 810;
    }

    .edition-badge { color: var(--navy-2); background: #eaf0f6; }
    .ebook-badge { color: #246d53; background: #e7f3ed; }
    .large-print-badge { color: #4d3a74; background: #eee8fb; }
    .material-badge { color: #604314; background: #f8edcf; }
    .primary-genre-badge { color: #713044; background: #f9e7ed; }
    .series-volume-badge { color: var(--white); background: var(--teal-dark); }
    .primary-genre-badge.domain { color: #5a4310; background: #f8edc9; }

    .book-title {
      margin: 0;
      overflow-wrap: anywhere;
      font-family: var(--user-heading-font, Georgia, "Times New Roman", serif);
      font-size: 1.3rem;
      line-height: 1.2;
      letter-spacing: -.018em;
    }

    .book-authors,
    .dialog-authors { margin: 6px 0 0; color: var(--accent-text); font-size: .9rem; font-weight: 800; }

    .author-search-button {
      appearance: none;
      padding: 0;
      color: inherit;
      background: transparent;
      border: 0;
      cursor: pointer;
      font: inherit;
      font-weight: inherit;
      text-align: left;
      text-decoration: underline;
      text-decoration-color: transparent;
      text-underline-offset: .16em;
    }

    .author-search-button:hover { text-decoration-color: currentColor; }
    .author-search-button:focus-visible { outline: none; border-radius: 4px; box-shadow: var(--focus); }
    .author-unknown { color: var(--ink-2); }

    .book-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 14px 0 0;
      padding: 9px 10px;
      color: var(--ink);
      background: var(--meta-group-surface);
      border-left: 3px solid var(--teal);
      border-radius: 10px;
      font-size: .75rem;
    }

    .meta-item {
      display: inline-flex;
      min-width: 0;
      max-width: 100%;
      min-height: 30px;
      align-items: center;
      align-content: center;
      flex-wrap: wrap;
      gap: 5px 6px;
      padding: 6px 9px;
      background: var(--meta-item-surface);
      border: 1px solid var(--line);
      border-radius: 8px;
      line-height: 1;
    }

    .meta-label,
    .meta-value { display: inline-flex; min-width: 0; align-items: center; line-height: 1.15; }
    .meta-label { color: var(--ink-2); font-size: .63rem; font-weight: 800; text-transform: uppercase; letter-spacing: .045em; }
    .meta-value { color: var(--ink); font-size: .77rem; font-weight: 850; overflow-wrap: anywhere; }
    .meta-item.series-fact { color: var(--accent-text); background: var(--teal-soft); border-color: rgba(23, 127, 122, .35); }
    .meta-item.series-fact .meta-label, .meta-item.series-fact .meta-value { color: var(--accent-text); }
    .meta-item.series-fact .meta-value { font-size: .79rem; }
    .meta-item.language-inferred { border-style: dashed; }

    .edition-versions-toggle {
      appearance: none;
      align-items: center;
      gap: 5px;
      border: 0;
      cursor: pointer;
      font: inherit;
    }

    .edition-versions-toggle:hover { box-shadow: inset 0 0 0 1px var(--teal); }
    .edition-versions-toggle:focus-visible { outline: none; box-shadow: var(--focus); }
    .edition-toggle-arrow { font-size: .75em; line-height: 1; }

    .edition-versions-panel {
      margin-top: 10px;
      padding: 10px;
      background: var(--panel-surface);
      border: 1px solid var(--line);
      border-radius: 11px;
    }

    .edition-versions-panel[hidden] { display: none; }
    .edition-versions-title { margin: 0 0 8px; font-size: .75rem; }
    .edition-versions-list { display: grid; gap: 7px; }
    .edition-version-row {
      display: grid;
      grid-template-columns: 24px minmax(0, 1fr) auto;
      gap: 8px;
      align-items: center;
      padding: 8px;
      background: var(--meta-group-surface);
      border-radius: 8px;
    }
    .edition-version-number { display: grid; width: 24px; height: 24px; place-items: center; color: var(--white); background: var(--teal-dark); border-radius: 50%; font-size: .66rem; font-weight: 850; }
    .edition-version-content { display: grid; min-width: 0; gap: 2px; }
    .edition-version-heading { font-size: .72rem; }
    .edition-version-description { color: var(--ink-2); font-size: .67rem; overflow-wrap: anywhere; }
    .edition-version-link { padding: 5px 7px; color: var(--accent-text); background: var(--control-surface); border: 1px solid var(--line); border-radius: 7px; font-size: .65rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
    .edition-version-link:hover { border-color: var(--teal); }
    .detail-edition-versions { margin-top: 18px; }

    .subject-section {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      gap: 8px 10px;
      align-items: start;
      margin-top: 11px;
      padding-top: 10px;
      border-top: 1px solid var(--line);
    }

    .subject-heading {
      padding-top: 4px;
      color: var(--ink-2);
      font-size: .61rem;
      font-weight: 820;
      letter-spacing: .055em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .subject-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

    .subject-tag {
      appearance: none;
      max-width: 240px;
      padding: 4px 7px;
      overflow: hidden;
      color: var(--ink-2);
      background: var(--tag-surface);
      border: 1px solid var(--tag-border);
      border-radius: 7px;
      font-size: .71rem;
      font-weight: 700;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .subject-search-button {
      font: inherit;
      cursor: pointer;
    }

    .subject-search-button:hover {
      color: var(--accent-text);
      background: var(--teal-soft);
      border-color: var(--teal);
    }

    .subject-search-button:focus-visible {
      outline: none;
      box-shadow: var(--focus);
    }

    .book-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      margin-top: 13px;
      padding-top: 12px;
      border-top: 1px solid var(--line);
    }

    .book-action {
      display: inline-flex;
      min-height: 35px;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 7px 10px;
      color: var(--ink);
      background: var(--control-surface);
      border: 1px solid var(--line);
      border-radius: 9px;
      cursor: pointer;
      text-decoration: none;
      font-size: .72rem;
      font-weight: 760;
    }

    .book-action:hover { border-color: var(--teal); background: var(--teal-soft); }
    .book-action.primary { color: var(--white); background: var(--navy); border-color: var(--navy); }
    .book-action.primary:hover { background: var(--navy-2); }
    .book-action.source-bn { color: var(--white); background: #9d2730; border-color: #9d2730; }
    .book-action.source-bn:hover { color: var(--white); background: #7f1e27; border-color: #7f1e27; }
    .book-action.source-google { color: var(--white); background: #3578e5; border-color: #3578e5; }
    .book-action.source-google:hover { color: var(--white); background: #2864c4; border-color: #2864c4; }
    .book-action.source-lc { color: var(--white); background: #b94836; border-color: #b94836; }
    .book-action.source-lc:hover { color: var(--white); background: #973827; border-color: #973827; }
    .book-action.source-platon { color: var(--navy); background: #f4ce47; border-color: #d6ac1d; }
    .book-action.source-platon:hover { color: var(--navy); background: #e6bb26; border-color: #c79b0b; }
    .book-action.basket-add { color: var(--white); background: var(--teal); border-color: var(--teal); }
    .book-action.basket-add:hover { color: var(--white); background: var(--teal-dark); border-color: var(--accent-text); }
    .book-action.basket-add.added { color: var(--accent-text); background: var(--teal-soft); border-color: rgba(23, 127, 122, .45); }

    .result-list.covers-small-view { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    .covers-small-view .book-card,
    .covers-large-view .book-card { grid-template-columns: 1fr; height: 100%; }
    .covers-small-view .book-card { gap: 10px; padding: 12px; }
    .covers-small-view .cover-frame { width: min(105px, 58%); margin-inline: auto; }
    .covers-small-view .book-title { font-size: .94rem; }
    .covers-small-view .book-authors { font-size: .73rem; }
    .covers-small-view .book-meta { gap: 5px; }
    .covers-small-view .meta-item { min-height: 25px; padding: 4px 6px; }
    .covers-small-view .subject-section { display: none; }
    .covers-small-view .book-actions { margin-top: 6px; }
    .covers-small-view .book-action { flex: 1 1 auto; }
    .covers-small-view .book-action:not(.primary):not(.basket-add) { display: none; }

    .result-list.covers-large-view { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
    .covers-large-view .book-card { gap: 13px; padding: 15px; }
    .covers-large-view .cover-frame { width: min(180px, 72%); margin-inline: auto; }
    .covers-large-view .book-title { font-size: 1.05rem; }
    .covers-large-view .book-meta { gap: 5px 8px; }
    .covers-large-view .subject-section { display: none; }
    .covers-large-view .book-actions { margin-top: 8px; }
    .covers-large-view .book-action { flex: 1 1 auto; }

    .pagination {
      display: none;
      align-items: center;
      justify-content: center;
      gap: 10px;
      margin-top: 22px;
    }

    .pagination.visible { display: flex; }

    .page-button {
      min-width: 42px;
      min-height: 40px;
      padding: 7px 12px;
      color: var(--ink);
      background: var(--panel-surface);
      border: 1px solid var(--line);
      border-radius: 10px;
      cursor: pointer;
      font-size: .76rem;
      font-weight: 780;
    }

    .page-button:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-soft); }
    .page-button:disabled { cursor: not-allowed; opacity: .45; }
    .page-label { color: var(--ink-2); font-size: .76rem; font-weight: 700; }

    .dialog-backdrop {
      position: fixed;
      inset: 0;
      z-index: 50;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(16, 35, 49, .62);
      backdrop-filter: blur(5px);
    }

    .dialog-backdrop.open { display: flex; }

    .dialog {
      position: relative;
      width: min(720px, 100%);
      max-height: min(820px, calc(100vh - 40px));
      padding: 25px;
      overflow: auto;
      background: var(--panel-surface);
      border: 1px solid var(--line);
      border-radius: 24px;
      box-shadow: 0 34px 90px rgba(0, 0, 0, .25);
    }

    .dialog-close {
      position: absolute;
      top: 14px;
      right: 14px;
      display: grid;
      width: 38px;
      height: 38px;
      padding: 0;
      place-items: center;
      background: var(--muted);
      border: 0;
      border-radius: 50%;
      cursor: pointer;
      font-size: 1.25rem;
    }

    .dialog-kicker { margin: 0 44px 6px 0; color: var(--accent-text); font-size: .71rem; font-weight: 830; letter-spacing: .08em; text-transform: uppercase; }
    .dialog h2 { margin: 0 44px 4px 0; font-family: var(--user-heading-font, Georgia, "Times New Roman", serif); font-size: 1.75rem; line-height: 1.1; }
    .dialog-author { margin: 0; color: var(--ink-2); font-size: .9rem; font-weight: 700; }

    .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
    .detail-cell { padding: 11px 12px; background: var(--control-surface); border: 1px solid var(--line); border-radius: 11px; }
    .detail-label { display: block; margin-bottom: 3px; color: var(--ink-2); font-size: .65rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
    .detail-value { overflow-wrap: anywhere; font-size: .8rem; font-weight: 690; }
    .detail-section { margin-top: 19px; }
    .detail-section h3 { margin: 0 0 8px; font-size: .84rem; }
    .detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
    .detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 21px; }

    .basket-backdrop {
      position: fixed;
      inset: 0;
      z-index: 120;
      display: none;
      justify-content: flex-end;
      background: rgba(15, 33, 47, .48);
      backdrop-filter: blur(4px);
    }

    .basket-backdrop.open { display: flex; }

    .basket-drawer {
      width: min(620px, 100%);
      height: 100%;
      overflow: auto;
      padding: 22px;
      background: var(--panel-surface);
      box-shadow: -22px 0 60px rgba(21, 48, 68, .24);
    }

    .basket-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
    .basket-head h2 { margin: 0; font-family: var(--user-heading-font, Georgia, "Times New Roman", serif); font-size: 1.65rem; letter-spacing: -.03em; }
    .basket-head p { margin: 4px 0 0; color: var(--ink-2); font-size: .78rem; }

    .basket-close {
      display: grid;
      flex: 0 0 auto;
      width: 39px;
      height: 39px;
      place-items: center;
      padding: 0;
      color: var(--ink);
      background: var(--control-surface);
      border: 1px solid var(--line);
      border-radius: 50%;
      cursor: pointer;
      font-size: 1.25rem;
    }

    .basket-panel {
      margin-top: 17px;
      padding: 14px;
      background: var(--control-surface);
      border: 1px solid var(--line);
      border-radius: 15px;
    }

    .basket-control-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .basket-control-grid + .basket-control-grid { margin-top: 8px; }

    .basket-input,
    .basket-select {
      width: 100%;
      min-height: 42px;
      padding: 8px 10px;
      color: var(--ink);
      background: var(--panel-surface);
      border: 1px solid var(--line);
      border-radius: 10px;
      outline: none;
      font-size: .8rem;
      font-weight: 700;
    }

    .basket-input:focus,
    .basket-select:focus { border-color: var(--teal); box-shadow: var(--focus); }

    .basket-small-button {
      min-height: 42px;
      padding: 8px 12px;
      color: var(--ink);
      background: var(--panel-surface);
      border: 1px solid var(--line);
      border-radius: 10px;
      cursor: pointer;
      font-size: .75rem;
      font-weight: 800;
    }

    .basket-small-button:hover { border-color: var(--teal); background: var(--teal-soft); }
    .basket-small-button.danger { color: var(--danger); }
    .basket-small-button.primary { color: var(--white); background: var(--teal); border-color: var(--teal); }

    .basket-view-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
    .basket-view-controls label { display: grid; gap: 4px; color: var(--ink-2); font-size: .66rem; font-weight: 800; text-transform: uppercase; }

    .basket-list { display: grid; gap: 10px; margin-top: 15px; }
    .basket-group-title { margin: 10px 0 0; color: var(--accent-text); font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }

    .basket-item {
      display: grid;
      grid-template-columns: 58px minmax(0, 1fr) auto;
      gap: 11px;
      align-items: start;
      padding: 11px;
      background: var(--control-surface);
      border: 1px solid var(--line);
      border-radius: 13px;
    }

    .basket-item-cover {
      width: 58px;
      aspect-ratio: 2 / 3;
      overflow: hidden;
      color: var(--navy);
      background: var(--teal-soft);
      border-radius: 6px 9px 9px 6px;
      font-size: .55rem;
      font-weight: 800;
      text-align: center;
    }

    .basket-item-cover img { width: 100%; height: 100%; object-fit: cover; }
    .basket-item-cover span { display: grid; height: 100%; place-items: center; padding: 5px; }
    .basket-item h3 { margin: 0; font-size: .88rem; line-height: 1.25; }
    .basket-item-author { margin: 3px 0 0; color: var(--ink-2); font-size: .73rem; }
    .basket-item-meta { margin: 6px 0 0; color: var(--ink-2); font-size: .65rem; line-height: 1.45; }
    .basket-item-tools { display: grid; justify-items: end; gap: 7px; }
    .basket-quantity { display: flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: .66rem; font-weight: 800; }
    .basket-quantity input { width: 50px; min-height: 32px; padding: 4px; text-align: center; border: 1px solid var(--line); border-radius: 8px; }
    .basket-remove { padding: 5px 7px; color: var(--danger); background: transparent; border: 0; cursor: pointer; font-size: .68rem; font-weight: 850; }

    .basket-empty {
      margin-top: 15px;
      padding: 30px 18px;
      color: var(--ink-2);
      background: var(--translucent-surface);
      border: 1px dashed var(--line-dark);
      border-radius: 15px;
      text-align: center;
      font-size: .82rem;
    }

    .basket-footer { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
    .basket-summary { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; color: var(--ink-2); font-size: .76rem; }
    .basket-export-actions { display: flex; flex-wrap: wrap; gap: 7px; }
    .basket-export-actions .basket-small-button { flex: 1 1 125px; }

    .toast {
      position: fixed;
      right: 20px;
      bottom: 20px;
      z-index: 180;
      max-width: min(380px, calc(100% - 40px));
      padding: 11px 14px;
      color: var(--white);
      background: var(--navy);
      border-radius: 11px;
      box-shadow: var(--shadow-md);
      font-size: .78rem;
      font-weight: 750;
      opacity: 0;
      pointer-events: none;
      transform: translateY(8px);
      transition: opacity .18s ease, transform .18s ease;
    }

    .toast.visible { opacity: 1; transform: translateY(0); }

    .print-sheet { display: none; }

    .footer { padding: 25px 0 38px; color: var(--ink-2); border-top: 1px solid var(--line); font-size: .75rem; }
    .footer-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
    .footer strong { color: var(--ink); }

    html[data-theme="dark"] .department::after { opacity: .12; }
    html[data-theme="dark"] .status-box.error {
      color: #ffd9d5;
      background: #321d22;
      border-color: #8d5258;
    }
    html[data-theme="dark"] .status-box.error .status-icon {
      color: #ffb1aa;
      background: #48262c;
    }
    html[data-theme="dark"] .source-notice {
      color: #f5dfa3;
      background: #382f18;
      border-color: #776434;
    }
    html[data-theme="dark"] .source-notice strong { color: #fff1be; }
    html[data-theme="dark"] .edition-badge { color: #d8e9f7; background: #263d50; }
    html[data-theme="dark"] .large-print-badge { color: #ded2ff; background: #3b3159; }
    html[data-theme="dark"] .material-badge { color: #ffe4aa; background: #4b3a1f; }
    html[data-theme="dark"] .primary-genre-badge { color: #ffd3df; background: #522b39; }
    html[data-theme="dark"] .primary-genre-badge.domain { color: #ffe6a6; background: #493b1f; }
    html[data-theme="dark"] .ebook-badge { color: #bdebd4; background: #204738; }
    html[data-theme="dark"] .source-logo.lc { background: #9f382d; }
    html[data-theme="dark"] .book-action.source-platon,
    html[data-theme="dark"] .source-logo.platon { color: #19364f; }

    body.large-text .nav-links,
    body.large-text .test-badge,
    body.large-text .appearance-settings > summary .appearance-label,
    body.large-text .basket-header-button > span:not(.basket-count) { display: none; }
    body.large-text .header-tools { width: 100%; }
    body.large-text .source-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .book-card,
    .book-main,
    .book-meta,
    .subject-section,
    .subject-tags,
    .edition-versions-panel,
    .edition-version-content { min-width: 0; max-width: 100%; }

    @media (max-width: 1040px) {
      .departments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .source-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .results-layout { grid-template-columns: 225px minmax(0, 1fr); gap: 17px; }
      .result-list.covers-small-view { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .result-list.covers-large-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }

    @media (max-width: 820px) {
      .shell { width: min(100% - 24px, var(--content)); }
      .site-header { padding-top: 12px; }
      .nav-links { display: none; }
      .hero { padding-top: 32px; }
      .hero::before { display: none; }
      .search-row { grid-template-columns: 148px minmax(0, 1fr); }
      .search-button { grid-column: 1 / -1; min-height: 54px; }
      .search-foot { align-items: flex-start; flex-direction: column; }
      .source-strip { grid-template-columns: 1fr; }
      body.large-text .source-strip { grid-template-columns: 1fr; }
      .results-layout { display: block; }
      .filters { position: static; display: none; margin-bottom: 15px; }
      .filters.mobile-open { display: block; }
      .mobile-filter-button {
        display: inline-flex;
        min-height: 40px;
        align-items: center;
        gap: 7px;
        padding: 7px 11px;
        background: var(--panel-surface);
        border: 1px solid var(--line);
        border-radius: 10px;
        cursor: pointer;
        font-size: .76rem;
        font-weight: 760;
      }
    }

    @media (max-width: 600px) {
      .brand-sub, .test-badge { display: none; }
      .basket-header-button > span:not(.basket-count) { display: none; }
      .appearance-settings > summary .appearance-label { display: none; }
      .appearance-panel {
        position: fixed;
        top: 68px;
        right: auto;
        left: 12px;
        width: calc(100vw - 24px);
        max-height: calc(100vh - 80px);
      }
      body.large-text .appearance-presets { grid-template-columns: minmax(0, 1fr); }
      .appearance-control { grid-template-columns: minmax(0, 1fr); }
      .appearance-control select { width: 100%; min-width: 0; }
      .appearance-control input[type="color"] { justify-self: start; }
      .hero { padding-top: 26px; }
      h1 { font-size: clamp(2rem, 14vw, 3.7rem); }
      .hero-lead { margin-top: 16px; }
      .search-card { margin-top: 22px; padding: 11px; border-radius: 20px; }
      .search-row { grid-template-columns: 1fr; }
      .search-button { grid-column: auto; }
      .field-wrap select, .field-wrap input { min-height: 58px; }
      .api-note { display: none; }
      .departments { grid-template-columns: 1fr; }
      .department { min-height: auto; }
      .section-head { align-items: flex-start; flex-direction: column; gap: 7px; }
      .source-state { display: none; }
      .results-area { padding-top: 20px; }
      .results-toolbar { align-items: flex-start; flex-direction: column; }
      .toolbar-controls { width: 100%; }
      .sort-select { flex: 1; min-width: 0; }
      .book-card { grid-template-columns: 88px minmax(0, 1fr); gap: 13px; padding: 12px; }
      body.large-text .book-card { grid-template-columns: 1fr; }
      body.large-text .cover-frame { width: 96px; margin-inline: auto; }
      body.large-text .book-actions { margin-left: 0; }
      .cover-frame { width: 88px; }
      .book-title { font-size: 1.03rem; }
      .book-meta { margin-top: 9px; }
      .subject-section { display: none; }
      .book-actions { margin-left: -101px; padding-top: 13px; }
      .result-list.covers-small-view,
      .result-list.covers-large-view { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
      .covers-small-view .book-card,
      .covers-large-view .book-card { padding: 10px; }
      .covers-small-view .cover-frame { width: min(96px, 70%); }
      .covers-large-view .cover-frame { width: min(145px, 82%); }
      .covers-small-view .book-authors,
      .covers-large-view .book-authors { font-size: .75rem; }
      .covers-small-view .book-meta,
      .covers-large-view .book-meta { display: flex; }
      .covers-small-view .book-topline,
      .covers-large-view .book-topline { flex-wrap: wrap; }
      .covers-small-view .book-actions,
      .covers-large-view .book-actions { margin-left: 0; }
      .covers-small-view .book-action:not(.primary):not(.basket-add),
      .covers-large-view .book-action:not(.primary):not(.basket-add) { display: none; }
      .detail-grid { grid-template-columns: 1fr; }
      .dialog { padding: 22px 17px; }
      .basket-drawer { padding: 16px 12px; }
      .basket-view-controls { grid-template-columns: 1fr; }
      .basket-item { grid-template-columns: 48px minmax(0, 1fr); }
      .basket-item-cover { width: 48px; }
      .basket-item-tools { grid-column: 1 / -1; grid-template-columns: 1fr auto; align-items: center; justify-items: start; }
      .footer-row { align-items: flex-start; flex-direction: column; gap: 8px; }
    }

    @media print {
      body > *:not(.print-sheet) { display: none !important; }
      .print-sheet { display: block !important; padding: 20mm 14mm; color: #111; background: #fff; font-family: Arial, sans-serif; }
      .print-sheet h1 { max-width: none; margin: 0 0 5mm; font-family: Georgia, serif; font-size: 22pt; letter-spacing: 0; }
      .print-sheet p { margin: 0 0 5mm; font-size: 9pt; }
      .print-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
      .print-table th, .print-table td { padding: 2.4mm; border: 1px solid #bbb; text-align: left; vertical-align: top; }
      .print-table th { background: #eee; }
    }

    @media (max-width: 390px) {
      .book-card { grid-template-columns: 1fr; }
      .book-card .cover-frame { width: 92px; margin-inline: auto; }
      .book-actions { margin-left: 0; }
      .edition-version-row { grid-template-columns: 24px minmax(0, 1fr); }
      .edition-version-link { grid-column: 2; justify-self: start; }
      .result-list.covers-small-view,
      .result-list.covers-large-view { grid-template-columns: 1fr; }
      .covers-small-view .cover-frame { width: 105px; }
      .covers-large-view .cover-frame { width: 145px; }
    }
