    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      min-height: 100vh;
      background: #2a2218;
      color: #3e2e1e;
      font-family: 'Crimson Text', Georgia, serif;
      line-height: 1.6;
      transition: background 0.4s ease;
    }

    /* ── Parchment texture via CSS ────────────────────────── */
    .parchment-bg {
      background:
        repeating-linear-gradient(
          0deg,
          transparent,
          transparent 28px,
          rgba(139,115,75,0.03) 28px,
          rgba(139,115,75,0.03) 29px
        ),
        radial-gradient(ellipse at 15% 10%, rgba(180,140,80,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 90%, rgba(160,120,60,0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(200,170,110,0.06) 0%, transparent 70%),
        linear-gradient(180deg, #f5ecd4 0%, #efe2c4 30%, #e8d8b4 70%, #e0d0a8 100%);
      transition: background 0.4s ease, color 0.4s ease;
    }

    ::-webkit-scrollbar { width: 10px; }
    ::-webkit-scrollbar-track { background: rgba(60,45,25,0.15); }
    ::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, #b89860, #8a6e3e);
      border-radius: 5px;
      border: 2px solid rgba(245,236,212,0.5);
    }

    /* ── Leather Spine / Binding Edge ────────────────────── */
    .book-wrapper { display: flex; min-height: 100vh; }
    .book-spine {
      width: 36px;
      min-width: 36px;
      background: linear-gradient(90deg, #1e160e 0%, #3a2a18 30%, #4a3820 60%, #3a2a18 85%, #2a1e12 100%);
      box-shadow: inset -4px 0 12px rgba(0,0,0,0.4), 2px 0 8px rgba(0,0,0,0.3);
      position: relative;
    }
    .book-spine::after {
      content: '';
      position: absolute;
      top: 0; bottom: 0; right: 0;
      width: 3px;
      background: linear-gradient(180deg, rgba(180,140,80,0.4), rgba(180,140,80,0.15) 20%, rgba(180,140,80,0.15) 80%, rgba(180,140,80,0.4));
    }
    .book-body { flex: 1; display: flex; flex-direction: column; }

    /* ── Header ─────────────────────────────────────────────── */
    .header {
      padding: 32px 36px 0;
      border-bottom: 2px solid #c4a46a;
      position: relative;
    }
    .header::after {
      content: '';
      position: absolute;
      bottom: -5px; left: 36px; right: 36px;
      height: 1px;
      background: rgba(160,120,60,0.3);
    }
    .header h1 {
      font-family: 'Cinzel Decorative', 'Cinzel', serif;
      font-size: 32px;
      font-weight: 700;
      color: #4a3420;
      letter-spacing: 3px;
      margin-bottom: 4px;
    }
    .header .subtitle {
      font-size: 14px;
      color: #8a7050;
      font-style: italic;
      margin-bottom: 22px;
    }

    /* ── Category Tabs ──────────────────────────────────────── */
    .cat-tabs { display: flex; gap: 1px; flex-wrap: wrap; }
    .cat-tab {
      padding: 10px 16px;
      border: 1px solid rgba(160,120,60,0.25);
      border-bottom: none;
      border-radius: 5px 5px 0 0;
      background: rgba(220,200,160,0.3);
      color: #7a6040;
      cursor: pointer;
      font-size: 13px;
      font-family: 'Cinzel', serif;
      font-weight: 400;
      letter-spacing: 0.5px;
      transition: all 0.2s ease;
      white-space: nowrap;
      display: flex;
      align-items: center;
      gap: 7px;
    }
    .cat-tab:hover { background: rgba(220,200,160,0.6); color: #4a3420; }
    .cat-tab.active {
      background: linear-gradient(180deg, rgba(245,236,212,0.95), rgba(239,226,196,0.95));
      border-color: #c4a46a;
      color: #4a3420;
      font-weight: 600;
      position: relative;
      z-index: 1;
    }
    .cat-tab .cat-dot {
      width: 10px; height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
      box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
      opacity: 0.8;
    }
    .cat-tab.active .cat-dot { opacity: 1; }
    .cat-tab .tab-count {
      display: inline-block;
      margin-left: 2px;
      padding: 1px 7px;
      font-size: 10px;
      border-radius: 8px;
      background: rgba(160,120,60,0.12);
      color: #8a7050;
      font-family: 'Crimson Text', serif;
    }
    .cat-tab.active .tab-count { background: rgba(160,120,60,0.2); color: #6a5030; }

    /* ── Search Bar ──────────────────────────────────────────── */
    .search-bar {
      padding: 14px 36px;
      border-bottom: 1px solid rgba(160,120,60,0.2);
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }
    .search-bar input {
      flex: 1;
      min-width: 180px;
      max-width: 360px;
      padding: 9px 14px;
      background: rgba(255,250,235,0.6);
      border: 1px solid rgba(160,120,60,0.3);
      border-radius: 4px;
      color: #3e2e1e;
      font-family: 'Crimson Text', serif;
      font-size: 15px;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .search-bar input::placeholder { color: #a09070; }
    .search-bar input:focus {
      border-color: #b89860;
      box-shadow: 0 0 0 2px rgba(184,152,96,0.15);
    }
    .search-count { font-size: 13px; color: #8a7050; font-style: italic; }
    .filter-controls {
      display: flex; gap: 8px; margin-left: auto; align-items: center; flex-wrap: wrap;
    }
    .filter-select {
      padding: 7px 28px 7px 12px;
      border: 1px solid rgba(160,120,60,0.3);
      border-radius: 4px;
      background-color: #f5ecd4;
      color: #5a4a30;
      font-family: 'Crimson Text', serif;
      font-size: 13px;
      outline: none;
      cursor: pointer;
      transition: border-color 0.2s, background-color 0.4s, color 0.4s;
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a7050'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
      background-size: 10px 6px;
    }
    .filter-select:focus { border-color: #b89860; }
    .filter-select option { background: #f5ecd4; color: #3e2e1e; }
    .filter-select.has-value {
      border-color: #b89860;
      background-color: #efe2c4;
      color: #4a3420;
      font-weight: 600;
    }
    .filter-toggle {
      padding: 7px 14px;
      border: 1px solid rgba(160,120,60,0.3);
      border-radius: 4px;
      background: rgba(255,250,235,0.6);
      color: #7a6040;
      cursor: pointer;
      font-family: 'Crimson Text', serif;
      font-size: 13px;
      transition: all 0.2s;
    }
    .filter-toggle:hover { background: rgba(220,200,160,0.5); }
    .filter-toggle.active {
      background: rgba(60,100,50,0.1);
      border-color: rgba(60,100,50,0.4);
      color: #3a6a30;
      font-weight: 600;
    }

    /* ── Active Filter Pills ─────────────────────────────────── */
    .active-filters {
      display: flex; gap: 6px; flex-wrap: wrap;
      padding: 0 36px 10px;
      border-bottom: 1px solid rgba(160,120,60,0.12);
    }
    .active-filters:empty { display: none; padding: 0; border: none; }
    .filter-pill {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 3px 10px; border-radius: 12px; font-size: 12px;
      font-family: 'Crimson Text', serif;
      background: rgba(184,152,96,0.15);
      border: 1px solid rgba(184,152,96,0.3);
      color: #6a5030;
    }
    .filter-pill-close { cursor: pointer; opacity: 0.5; transition: opacity 0.2s; font-size: 14px; line-height: 1; }
    .filter-pill-close:hover { opacity: 1; }
    .filter-pill.craft-pill {
      background: rgba(60,90,120,0.08); border-color: rgba(60,90,120,0.25); color: #3a6070;
    }
    .filter-pill.free-pill {
      background: rgba(60,100,50,0.08); border-color: rgba(60,100,50,0.25); color: #3a6a30;
    }

    /* ── Ship-class disclaimer ───────────────────────────────── */
    .class-disclaimer {
      display: flex;
      align-items: flex-start;
      gap: 9px;
      margin: 12px 36px;
      padding: 10px 14px;
      font-size: 13px;
      line-height: 1.5;
      color: #6a5a3a;
      background: rgba(200,170,110,0.12);
      border: 1px solid rgba(160,120,60,0.25);
      border-left: 3px solid rgba(160,120,60,0.5);
      border-radius: 4px;
    }
    .class-disclaimer strong { color: #4a3a20; font-weight: 700; }
    .class-disclaimer-icon {
      flex-shrink: 0;
      color: #a07a30;
      font-size: 14px;
      line-height: 1.4;
    }
    body.dark-mode .class-disclaimer {
      color: #a0906a;
      background: rgba(60,48,28,0.22);
      border-color: rgba(100,80,40,0.3);
      border-left-color: rgba(120,95,45,0.55);
    }
    body.dark-mode .class-disclaimer strong { color: #d0c090; }
    body.dark-mode .class-disclaimer-icon { color: #c0a860; }

    /* ── Main Layout ─────────────────────────────────────────── */
    .main { display: flex; flex: 1; }

    /* ── Background List ─────────────────────────────────────── */
    .bg-list {
      width: 360px;
      min-width: 360px;
      border-right: 1px solid rgba(160,120,60,0.2);
      overflow-y: auto;
      max-height: calc(100vh - 170px);
    }
    .bg-cat-group { border-bottom: 1px solid rgba(160,120,60,0.1); }
    .bg-cat-header {
      padding: 10px 20px;
      font-family: 'Cinzel', serif;
      font-size: 11px;
      font-weight: 600;
      color: #8a7050;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      background: rgba(200,170,110,0.12);
      border-bottom: 1px solid rgba(160,120,60,0.1);
      position: sticky;
      top: 0;
      z-index: 2;
    }
    .bg-item {
      padding: 10px 20px;
      cursor: pointer;
      border-bottom: 1px solid rgba(160,120,60,0.06);
      transition: background 0.15s;
      display: flex;
      align-items: center;
      gap: 11px;
    }
    .bg-item:hover { background: rgba(200,170,110,0.12); }
    .bg-item.active {
      background: rgba(200,170,110,0.22);
      border-left: 3px solid #b89860;
    }
    .bg-item-name { font-size: 15px; color: #4a3a28; flex: 1; }
    .bg-item.active .bg-item-name { color: #3a2a18; font-weight: 600; }

    /* ── Monogram badge (stands in for the unavailable icons) ── */
    .bg-monogram {
      width: 30px; height: 30px;
      min-width: 30px;
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-family: 'Cinzel', serif;
      font-weight: 700;
      font-size: 15px;
      color: #fff8ec;
      text-shadow: 0 1px 2px rgba(0,0,0,0.35);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 3px rgba(40,28,14,0.3);
      flex-shrink: 0;
    }
    .bg-monogram.lg {
      width: 56px; height: 56px;
      min-width: 56px;
      border-radius: 10px;
      font-size: 28px;
    }

    /* ── EP badges ───────────────────────────────────────────── */
    .ep-badge {
      display: inline-block;
      padding: 2px 9px;
      font-size: 11px;
      font-family: 'Cinzel', serif;
      letter-spacing: 0.5px;
      border-radius: 10px;
      white-space: nowrap;
      font-variant-numeric: tabular-nums;
      /* Eminence Points use the site's magenta (#ff09fb) — match it here so the
         cost reads as EP everywhere. */
      background: linear-gradient(90deg, #7a2bd6 0%, #ff09fb 100%);
      border: 1px solid rgba(255,9,251,0.5);
      color: #fff;
      box-shadow: 0 0 6px rgba(255,9,251,0.4);
      flex-shrink: 0;
    }
    .ep-badge.ep-recm {
      background: rgba(160,120,40,0.16);
      border-color: rgba(180,140,50,0.5);
      color: #9a7a20;
      box-shadow: none;
    }
    .ep-badge.ep-free {
      background: rgba(60,100,50,0.1);
      border-color: rgba(60,100,50,0.3);
      color: #4a7a3a;
      box-shadow: none;
    }

    /* ── Detail (Right Page) ─────────────────────────────────── */
    .bg-detail {
      flex: 1;
      padding: 32px 40px;
      overflow-y: auto;
      max-height: calc(100vh - 170px);
      position: relative;
    }
    .bg-detail-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100%;
      color: #a09070;
      font-style: italic;
      font-size: 16px;
      gap: 12px;
    }
    .bg-detail-empty .empty-icon { font-size: 48px; opacity: 0.3; }

    .bg-header {
      display: flex;
      align-items: flex-start;
      gap: 18px;
      margin-bottom: 18px;
      padding-bottom: 18px;
      border-bottom: 2px solid rgba(160,120,60,0.2);
    }
    .bg-header-text { flex: 1; min-width: 0; }
    .bg-title-row {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 8px;
    }
    .bg-detail-title {
      font-family: 'Cinzel Decorative', 'Cinzel', serif;
      font-size: 24px;
      font-weight: 700;
      color: #3a2a18;
      margin-bottom: 4px;
      letter-spacing: 1px;
      line-height: 1.3;
    }
    .bg-action-row { display: flex; gap: 6px; flex-shrink: 0; }
    .bg-share {
      background: rgba(80,55,15,0.15);
      border: 1px solid rgba(160,120,60,0.4);
      color: #6a4a20;
      cursor: pointer;
      padding: 5px 7px;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      transition: background 0.15s, color 0.15s, border-color 0.15s;
      flex-shrink: 0;
    }
    .bg-share svg { width: 12px; height: 12px; display: block; }
    .bg-share:hover { color: #3a2a18; border-color: rgba(160,120,60,0.7); background: rgba(160,120,60,0.18); }
    .bg-share.copied { color: #4a6a2a; border-color: rgba(74,106,42,0.6); background: rgba(74,106,42,0.12); }

    .share-toast {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(40,28,14,0.95);
      color: #f0d688;
      padding: 10px 18px;
      border-radius: 4px;
      border: 1px solid rgba(160,120,60,0.5);
      font-family: 'Cinzel', serif;
      font-size: 12px;
      letter-spacing: 0.5px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s;
      z-index: 9999;
      box-shadow: 0 4px 18px rgba(0,0,0,0.4);
    }
    .share-toast.visible { opacity: 1; }

    /* Meta tags */
    .bg-meta { display: flex; gap: 10px; flex-wrap: wrap; }
    .bg-meta-tag {
      padding: 3px 11px;
      border-radius: 3px;
      font-size: 12px;
      font-family: 'Cinzel', serif;
      letter-spacing: 0.5px;
    }
    .tag-category { background: rgba(160,120,60,0.12); border: 1px solid rgba(160,120,60,0.3); color: #6a5030; }
    .tag-ep { background: linear-gradient(90deg, #7a2bd6 0%, #ff09fb 100%); border: 1px solid rgba(255,9,251,0.5); color: #fff; box-shadow: 0 0 6px rgba(255,9,251,0.4); font-variant-numeric: tabular-nums; }
    .tag-recm { background: rgba(180,140,50,0.14); border: 1px solid rgba(180,140,50,0.4); color: #9a7a20; font-weight: 600; }
    .tag-free { background: rgba(60,100,50,0.1); border: 1px solid rgba(60,100,50,0.25); color: #4a7a3a; }
    .tag-craft { background: rgba(60,90,120,0.1); border: 1px solid rgba(60,90,120,0.28); color: #3a6080; }
    .tag-xp { background: rgba(120,70,130,0.1); border: 1px solid rgba(120,70,130,0.28); color: #7a4a8a; }

    /* Description */
    .bg-description {
      margin: 22px 0 28px;
      padding: 18px 22px;
      background: rgba(255,250,235,0.5);
      border: 1px solid rgba(160,120,60,0.15);
      border-left: 3px solid rgba(160,120,60,0.3);
      border-radius: 2px;
      font-size: 15px;
      line-height: 1.75;
      color: #4a3a28;
      white-space: pre-wrap;
    }
    .bg-description:empty { display: none; }

    /* Sections (items / recipes) */
    .bg-section { margin-bottom: 28px; }
    .bg-section h3 {
      font-family: 'Cinzel', serif;
      font-size: 14px;
      font-weight: 600;
      color: #6a5030;
      letter-spacing: 1px;
      text-transform: uppercase;
      margin-bottom: 12px;
      padding-bottom: 8px;
      border-bottom: 1px solid rgba(160,120,60,0.2);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .section-count {
      display: inline-block;
      padding: 1px 8px;
      font-size: 11px;
      border-radius: 8px;
      background: rgba(160,120,60,0.14);
      color: #8a7050;
      font-family: 'Crimson Text', serif;
      letter-spacing: 0;
    }
    .handout-note {
      font-size: 13px;
      color: #6a5a3a;
      font-style: italic;
      margin-bottom: 12px;
      padding: 8px 12px;
      background: rgba(200,170,110,0.1);
      border-radius: 4px;
      border: 1px dashed rgba(160,120,60,0.25);
    }
    .handout-note strong { font-style: normal; color: #4a3a20; }
    .bg-empty-line { color: #a09070; font-style: italic; padding: 8px 0; }

    /* Items table */
    .bg-table { width: 100%; border-collapse: collapse; }
    .bg-table thead th {
      text-align: left;
      padding: 8px 12px;
      font-family: 'Cinzel', serif;
      font-size: 11px;
      font-weight: 600;
      color: #8a7050;
      letter-spacing: 1px;
      text-transform: uppercase;
      border-bottom: 2px solid rgba(160,120,60,0.2);
    }
    .bg-table tbody td {
      padding: 10px 12px;
      font-size: 14px;
      border-bottom: 1px solid rgba(160,120,60,0.08);
      color: #4a3a28;
    }
    .bg-table tbody tr:hover { background: rgba(200,170,110,0.08); }
    .it-name { color: #3e2e1e; }
    .it-qty { color: #4a6a80; text-align: center; }

    /* Recipe chips */
    .recipe-chips { display: flex; flex-wrap: wrap; gap: 8px; }
    .recipe-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 6px 13px;
      font-size: 13px;
      border-radius: 14px;
      background: rgba(60,90,120,0.08);
      border: 1px solid rgba(60,90,120,0.25);
      color: #3a6070;
    }
    a.recipe-chip-link {
      text-decoration: none;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    }
    a.recipe-chip-link:hover {
      background: rgba(60,90,120,0.16);
      border-color: rgba(60,90,120,0.5);
      color: #275068;
      box-shadow: 0 1px 4px rgba(60,90,120,0.18);
    }
    .recipe-chip-go { font-size: 11px; opacity: 0.55; }
    a.recipe-chip-link:hover .recipe-chip-go { opacity: 0.9; }

    /* ── Loading / Error ─────────────────────────────────────── */
    .loading {
      display: flex; align-items: center; justify-content: center;
      height: 300px; color: #a09070; font-style: italic; font-size: 16px;
    }
    .loading-spinner {
      display: inline-block;
      width: 20px; height: 20px;
      border: 2px solid rgba(160,120,60,0.2);
      border-top-color: rgba(160,120,60,0.6);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      margin-right: 10px;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    .error-msg { text-align: center; padding: 40px; color: #8b3030; }

    /* ── Dark Mode Toggle ────────────────────────────────────── */
    .dark-mode-toggle {
      padding: 8px 14px;
      border: 1px solid rgba(160,120,60,0.3);
      border-radius: 6px;
      background: rgba(255,250,235,0.5);
      color: #6a5030;
      cursor: pointer;
      font-size: 18px;
      line-height: 1;
      transition: all 0.3s;
      flex-shrink: 0;
      margin-top: 4px;
    }
    .dark-mode-toggle:hover { background: rgba(220,200,160,0.6); }

    /* ── Breadcrumb + corner nav ─────────────────────────────── */
    .breadcrumb {
      font-family: 'Cinzel', serif; font-size: 11px; letter-spacing: 1.5px;
      text-transform: uppercase; color: #8a7050; margin-bottom: 10px;
    }
    .breadcrumb a { color: #6a5030; text-decoration: none; transition: color 0.15s; }
    .breadcrumb a:hover { color: #3e2e1e; }
    .breadcrumb .sep { color: #b89860; margin: 0 8px; }
    .breadcrumb .current { color: #3e2e1e; font-weight: 600; }

    .header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .corner-nav { display: flex; gap: 4px; margin-top: 4px; }
    .corner-nav a {
      padding: 8px 14px;
      border: 1px solid rgba(160,120,60,0.3);
      border-radius: 6px;
      background: rgba(255,250,235,0.5);
      color: #6a5030;
      text-decoration: none;
      font-family: 'Cinzel', serif;
      font-size: 12px;
      letter-spacing: 0.5px;
      transition: all 0.2s;
    }
    .corner-nav a:hover { background: rgba(220,200,160,0.6); color: #3e2e1e; }

    body.dark-mode .breadcrumb { color: #7a6a4a; }
    body.dark-mode .breadcrumb a { color: #a08858; }
    body.dark-mode .breadcrumb a:hover { color: #e0c888; }
    body.dark-mode .breadcrumb .sep { color: #5a4a30; }
    body.dark-mode .breadcrumb .current { color: #e0c888; }
    body.dark-mode .corner-nav a {
      background: rgba(40,30,20,0.5);
      border-color: rgba(120,90,50,0.35);
      color: #b09868;
    }
    body.dark-mode .corner-nav a:hover { background: rgba(60,45,25,0.7); color: #e0c888; }

    @media (max-width: 600px) { .corner-nav { display: none; } }

    /* ═══════════════════════════════════════════════════════════
       DARK MODE
       ═══════════════════════════════════════════════════════════ */
    body.dark-mode { background: #151015; }
    body.dark-mode .parchment-bg {
      background:
        repeating-linear-gradient(
          0deg,
          transparent,
          transparent 28px,
          rgba(80,60,40,0.04) 28px,
          rgba(80,60,40,0.04) 29px
        ),
        radial-gradient(ellipse at 15% 10%, rgba(60,40,20,0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 90%, rgba(50,30,15,0.12) 0%, transparent 50%),
        linear-gradient(180deg, #1e1a14 0%, #1a1610 30%, #181410 70%, #16120e 100%);
      color: #c8b898;
    }

    body.dark-mode .book-spine {
      background: linear-gradient(90deg, #0a0806 0%, #1a1410 30%, #201a12 60%, #1a1410 85%, #0e0a06 100%);
    }

    body.dark-mode .header { border-bottom-color: #5a4a2a; }
    body.dark-mode .header::after { background: rgba(80,60,30,0.3); }
    body.dark-mode .header h1 { color: #e0c888; }
    body.dark-mode .header .subtitle { color: #8a7858; }

    body.dark-mode .cat-tab {
      background: rgba(60,48,28,0.3);
      border-color: rgba(80,60,30,0.3);
      color: #9a8868;
    }
    body.dark-mode .cat-tab:hover { background: rgba(80,60,30,0.5); color: #c8b888; }
    body.dark-mode .cat-tab.active {
      background: linear-gradient(180deg, rgba(30,26,20,0.95), rgba(26,22,16,0.95));
      border-color: #5a4a2a;
      color: #e0c888;
    }
    body.dark-mode .cat-tab .tab-count { background: rgba(80,60,30,0.2); color: #8a7858; }
    body.dark-mode .cat-tab.active .tab-count { background: rgba(80,60,30,0.3); color: #c8b888; }

    body.dark-mode .search-bar { border-bottom-color: rgba(80,60,30,0.2); }
    body.dark-mode .search-bar input {
      background: rgba(40,32,20,0.5);
      border-color: rgba(80,60,30,0.3);
      color: #c8b898;
    }
    body.dark-mode .search-bar input::placeholder { color: #6a5a40; }
    body.dark-mode .search-bar input:focus {
      border-color: #8a7040;
      box-shadow: 0 0 0 2px rgba(138,112,64,0.15);
    }
    body.dark-mode .search-count { color: #7a6a4a; }

    body.dark-mode .filter-select {
      background-color: #2a2418;
      border-color: rgba(100,80,40,0.5);
      color: #c8b898;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c8b898'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
      background-size: 10px 6px;
    }
    body.dark-mode .filter-select:focus { border-color: #a08850; }
    body.dark-mode .filter-select option { background: #252018; color: #c8b898; padding: 6px; }
    body.dark-mode .filter-select.has-value {
      border-color: #a08850;
      background-color: #332a1c;
      color: #e0c888;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23e0c888'/%3E%3C/svg%3E");
    }
    body.dark-mode .filter-toggle {
      background: rgba(40,32,20,0.5);
      border-color: rgba(80,60,30,0.3);
      color: #9a8868;
    }
    body.dark-mode .filter-toggle:hover { background: rgba(60,48,28,0.5); }
    body.dark-mode .filter-toggle.active {
      background: rgba(50,90,40,0.18);
      border-color: rgba(70,120,55,0.45);
      color: #88c070;
    }

    body.dark-mode .active-filters { border-bottom-color: rgba(80,60,30,0.12); }
    body.dark-mode .filter-pill {
      background: rgba(100,80,40,0.15);
      border-color: rgba(100,80,40,0.3);
      color: #b0a070;
    }
    body.dark-mode .filter-pill.craft-pill {
      background: rgba(50,80,100,0.1); border-color: rgba(50,80,100,0.25); color: #80a8c0;
    }
    body.dark-mode .filter-pill.free-pill {
      background: rgba(50,90,40,0.12); border-color: rgba(50,90,40,0.28); color: #88c070;
    }

    body.dark-mode .bg-list { border-right-color: rgba(80,60,30,0.2); }
    body.dark-mode .bg-cat-group { border-bottom-color: rgba(80,60,30,0.1); }
    body.dark-mode .bg-cat-header {
      color: #8a7858;
      background: rgba(60,48,28,0.15);
      border-bottom-color: rgba(80,60,30,0.1);
    }
    body.dark-mode .bg-item { border-bottom-color: rgba(80,60,30,0.06); }
    body.dark-mode .bg-item:hover { background: rgba(80,60,30,0.12); }
    body.dark-mode .bg-item.active {
      background: rgba(80,60,30,0.22);
      border-left-color: #8a7040;
    }
    body.dark-mode .bg-item-name { color: #c0b088; }
    body.dark-mode .bg-item.active .bg-item-name { color: #e0c888; }
    body.dark-mode .bg-monogram { filter: brightness(1.08); text-shadow: 0 1px 2px rgba(0,0,0,0.55); }

    body.dark-mode .ep-badge { background: linear-gradient(90deg, #7a2bd6 0%, #ff09fb 100%); border-color: rgba(255,9,251,0.55); color: #fff; box-shadow: 0 0 7px rgba(255,9,251,0.5); }
    body.dark-mode .ep-badge.ep-recm { background: rgba(170,130,50,0.2); border-color: rgba(190,150,60,0.5); color: #e0c060; box-shadow: none; }
    body.dark-mode .ep-badge.ep-free { background: rgba(60,100,50,0.16); border-color: rgba(80,130,65,0.4); color: #88c070; box-shadow: none; }

    body.dark-mode .bg-detail-empty { color: #6a5a40; }
    body.dark-mode .bg-header { border-bottom-color: rgba(80,60,30,0.2); }
    body.dark-mode .bg-detail-title { color: #e0c888; }
    body.dark-mode .bg-share {
      background: rgba(80,60,30,0.25);
      border-color: rgba(160,130,80,0.35);
      color: #c0a868;
    }
    body.dark-mode .bg-share:hover { background: rgba(100,75,35,0.35); color: #e8c878; border-color: rgba(180,150,90,0.6); }
    body.dark-mode .bg-share.copied { color: #88c060; border-color: rgba(120,180,80,0.5); background: rgba(70,110,40,0.2); }

    body.dark-mode .tag-category { background: rgba(80,60,30,0.15); border-color: rgba(80,60,30,0.3); color: #b0a070; }
    body.dark-mode .tag-ep { background: linear-gradient(90deg, #7a2bd6 0%, #ff09fb 100%); border-color: rgba(255,9,251,0.55); color: #fff; box-shadow: 0 0 7px rgba(255,9,251,0.5); }
    body.dark-mode .tag-recm { background: rgba(170,130,50,0.18); border-color: rgba(190,150,60,0.45); color: #e0c060; }
    body.dark-mode .tag-free { background: rgba(50,90,40,0.14); border-color: rgba(70,120,55,0.3); color: #88c070; }
    body.dark-mode .tag-craft { background: rgba(50,80,100,0.14); border-color: rgba(60,100,130,0.32); color: #80a8c0; }
    body.dark-mode .tag-xp { background: rgba(110,70,120,0.16); border-color: rgba(140,90,150,0.35); color: #c090d0; }

    body.dark-mode .bg-description {
      background: rgba(30,26,18,0.5);
      border-color: rgba(80,60,30,0.15);
      border-left-color: rgba(80,60,30,0.3);
      color: #b0a080;
    }

    body.dark-mode .bg-section h3 { color: #a09060; border-bottom-color: rgba(80,60,30,0.2); }
    body.dark-mode .section-count { background: rgba(80,60,30,0.2); color: #a09060; }
    body.dark-mode .handout-note {
      background: rgba(60,48,28,0.2);
      border-color: rgba(100,80,40,0.3);
      color: #a0906a;
    }
    body.dark-mode .handout-note strong { color: #d0c090; }
    body.dark-mode .bg-empty-line { color: #6a5a40; }

    body.dark-mode .bg-table thead th { color: #8a7858; border-bottom-color: rgba(80,60,30,0.25); }
    body.dark-mode .bg-table tbody td { border-bottom-color: rgba(80,60,30,0.08); color: #b0a080; }
    body.dark-mode .bg-table tbody tr:hover { background: rgba(80,60,30,0.08); }
    body.dark-mode .it-name { color: #c0b088; }
    body.dark-mode .it-qty { color: #80a0b8; }

    body.dark-mode .recipe-chip {
      background: rgba(50,80,100,0.12);
      border-color: rgba(60,100,130,0.3);
      color: #80a8c0;
    }
    body.dark-mode a.recipe-chip-link:hover {
      background: rgba(60,100,130,0.22);
      border-color: rgba(80,130,160,0.55);
      color: #a8d0e4;
      box-shadow: 0 1px 5px rgba(40,80,110,0.4);
    }

    body.dark-mode .loading { color: #6a5a40; }
    body.dark-mode .loading-spinner { border-color: rgba(80,60,30,0.2); border-top-color: rgba(80,60,30,0.6); }
    body.dark-mode .error-msg { color: #d08080; }

    body.dark-mode .dark-mode-toggle {
      background: rgba(40,32,20,0.5);
      border-color: rgba(80,60,30,0.3);
      color: #c8a860;
    }
    body.dark-mode .dark-mode-toggle:hover { background: rgba(60,48,28,0.5); }

    body.dark-mode ::-webkit-scrollbar-track { background: rgba(20,16,10,0.3); }
    body.dark-mode ::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, #6a5430, #4a3a20);
      border-color: rgba(30,26,20,0.5);
    }

    /* ── Fade-in animation ───────────────────────────────────── */
    .fade-in { animation: fadeIn 0.25s ease; }
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* ── Responsive ──────────────────────────────────────────── */
    @media (max-width: 860px) {
      .book-spine { display: none; }
      .main { flex-direction: column; }
      .bg-list {
        width: 100%;
        min-width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid rgba(160,120,60,0.2);
      }
      .bg-detail { max-height: none; padding: 24px 20px; }
      .filter-controls { margin-left: 0; }
      .search-bar { flex-wrap: wrap; padding: 14px 20px; }
      .header { padding: 20px 20px 0; }
      .active-filters { padding: 0 20px 10px; }
      .class-disclaimer { margin: 12px 20px; }
    }
