/* ==========================================================================
   Mapwright - D&D 2024 Reference Compendium Styles
   Aesthetic: Obsidian, Dark Slate, Eldritch Gold & Brass
   Fonts: Cormorant Garamond (Headers), Figtree (UI), JetBrains Mono (Math/Stats)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Modal Card & Body Layout
   -------------------------------------------------------------------------- */
#compendium-modal .sheet-modal-card.compendium-card {
  width: min(1240px, 96vw);
  height: min(860px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: var(--sheet-bg, #0a0e17);
  border: 1px solid var(--sheet-glass-border, rgba(200, 166, 104, 0.25));
  box-shadow: 
    0 24px 64px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(200, 166, 104, 0.2),
    0 0 32px rgba(200, 166, 104, 0.1);
}

.compendium-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   2. Left Navigation Bar (Obsidian Dock ~240px)
   -------------------------------------------------------------------------- */
.compendium-nav {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  background: rgba(8, 12, 20, 0.95);
  border-right: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 8px;
  user-select: none;
  z-index: 5;
}

.compendium-nav-head {
  padding: 0 4px 12px 4px;
  border-bottom: 1px solid var(--sheet-border-subtle, rgba(255, 255, 255, 0.06));
}

.compendium-nav-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--brass-bright, #d4af37);
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.compendium-nav-sub {
  font-size: 10.5px;
  color: var(--muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.compendium-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}

.compendium-nav-list::-webkit-scrollbar {
  width: 4px;
}
.compendium-nav-list::-webkit-scrollbar-thumb {
  background: rgba(200, 166, 104, 0.2);
  border-radius: 4px;
}

.compendium-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fg, #f8fafc);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
  position: relative;
}

.compendium-nav-btn:hover {
  background: rgba(200, 166, 104, 0.08);
  border-color: rgba(200, 166, 104, 0.2);
  color: var(--brass-bright, #d4af37);
}

.compendium-nav-btn.active {
  background: linear-gradient(135deg, rgba(200, 166, 104, 0.2), rgba(200, 166, 104, 0.06));
  border-color: var(--brass, #c8a668);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 14px rgba(200, 166, 104, 0.18);
}

.compendium-nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--brass-bright, #d4af37);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--brass-bright, #d4af37);
}

.compendium-nav-icon {
  font-size: 15px;
  line-height: 1;
}

.compendium-nav-lbl {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compendium-nav-badge {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted, #94a3b8);
  transition: all 0.16s ease;
}

.compendium-nav-btn.active .compendium-nav-badge {
  background: rgba(200, 166, 104, 0.3);
  color: #fff;
}

.compendium-nav-foot {
  padding-top: 10px;
  border-top: 1px solid var(--sheet-border-subtle, rgba(255, 255, 255, 0.06));
}

.compendium-foot-note {
  font-size: 10.5px;
  color: rgba(148, 163, 184, 0.6);
  text-align: center;
}

/* --------------------------------------------------------------------------
   3. Main Content Container
   -------------------------------------------------------------------------- */
.compendium-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: 
    radial-gradient(circle at top right, rgba(200, 166, 104, 0.04) 0%, transparent 60%),
    radial-gradient(circle at bottom left, rgba(45, 212, 191, 0.03) 0%, transparent 50%),
    var(--sheet-bg, #0a0e17);
}

/* Header & Search Bar */
.compendium-header {
  background: rgba(13, 18, 30, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.08));
  padding: 14px 20px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3;
}

.compendium-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compendium-title-area {
  display: flex;
  flex-direction: column;
}

.compendium-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--brass-bright, #d4af37);
  margin: 0;
  line-height: 1.2;
}

.compendium-counter {
  font-size: 11.5px;
  color: var(--muted, #94a3b8);
  margin-top: 2px;
}

.compendium-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 440px;
}

.compendium-search-icon {
  position: absolute;
  left: 12px;
  font-size: 13px;
  opacity: 0.6;
  pointer-events: none;
}

.compendium-search-inp {
  width: 100%;
  padding-left: 34px !important;
  padding-right: 32px !important;
  height: 36px;
  border-radius: 8px;
  background: rgba(6, 10, 18, 0.85);
  border: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.1));
  font-size: 13px;
  color: var(--fg, #f8fafc);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.compendium-search-inp:focus {
  border-color: var(--brass, #c8a668);
  box-shadow: 0 0 12px rgba(200, 166, 104, 0.25);
  outline: none;
}

.compendium-search-clear {
  position: absolute;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease;
}

.compendium-search-clear:hover {
  background: rgba(239, 68, 68, 0.4);
}

.compendium-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.08));
  color: var(--muted, #94a3b8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.15s ease;
}

.compendium-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Subfilters Bar */
.compendium-subfilters-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.compendium-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.compendium-chip {
  padding: 4px 11px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sheet-border-subtle, rgba(255, 255, 255, 0.08));
  color: var(--muted, #94a3b8);
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.compendium-chip:hover {
  background: rgba(200, 166, 104, 0.1);
  border-color: rgba(200, 166, 104, 0.3);
  color: var(--fg, #f8fafc);
}

.compendium-chip.active {
  background: rgba(200, 166, 104, 0.22);
  border-color: var(--brass, #c8a668);
  color: var(--brass-bright, #d4af37);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(200, 166, 104, 0.15);
}

.compendium-chip-cr.active {
  background: rgba(168, 85, 247, 0.25);
  border-color: #a855f7;
  color: #e9d5ff;
}

.compendium-filter-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.compendium-filter-select-lbl {
  font-size: 12px;
  color: var(--muted, #94a3b8);
}

.compendium-select {
  padding: 3px 8px;
  height: 28px;
  font-size: 12px;
  border-radius: 6px;
  background: rgba(6, 10, 18, 0.9);
  border: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.1));
  color: var(--fg, #f8fafc);
}

/* --------------------------------------------------------------------------
   4. Cards Grid & Scrollable View
   -------------------------------------------------------------------------- */
.compendium-cards-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compendium-cards-wrap::-webkit-scrollbar {
  width: 6px;
}
.compendium-cards-wrap::-webkit-scrollbar-thumb {
  background: rgba(200, 166, 104, 0.25);
  border-radius: 4px;
}

.compendium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  align-items: start;
}

.compendium-card-item {
  background: rgba(13, 19, 33, 0.75);
  border: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  backdrop-filter: blur(6px);
  position: relative;
}

.compendium-card-item:hover {
  transform: translateY(-2px);
  border-color: rgba(200, 166, 104, 0.45);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 0 14px rgba(200, 166, 104, 0.1);
}

.compendium-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.compendium-card-title-col {
  flex: 1;
  min-width: 0;
}

.compendium-card-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--fg, #f8fafc);
  margin: 0;
  line-height: 1.25;
}

.compendium-card-name-en {
  font-size: 11.5px;
  color: var(--muted, #94a3b8);
  font-style: italic;
  margin-top: 1px;
}

.compendium-card-type-sub {
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.compendium-card-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: #cbd5e1;
  white-space: pre-line;
  word-break: break-word;
}

.compendium-card-desc.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compendium-card-desc.clamp-4 {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compendium-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

/* Badges System */
.compendium-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.compendium-badge-gold {
  background: rgba(200, 166, 104, 0.15);
  border: 1px solid rgba(200, 166, 104, 0.35);
  color: var(--brass-bright, #d4af37);
}

.compendium-badge-hd {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.compendium-badge-spd {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.compendium-badge-magic {
  background: rgba(129, 140, 248, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: #a5b4fc;
}

.compendium-badge-warn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.compendium-badge-dmg {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

.compendium-badge-cr {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #d8b4fe;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.compendium-badge-req {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  color: #fcd34d;
}

/* Magic Item Rarity Badges */
.rarity-common {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
}
.rarity-uncommon {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.14);
  border: 1px solid rgba(74, 222, 128, 0.35);
}
.rarity-rare {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.35);
}
.rarity-very-rare {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.16);
  border: 1px solid rgba(192, 132, 252, 0.4);
}
.rarity-legendary {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.18);
  border: 1px solid rgba(251, 146, 60, 0.45);
  font-weight: 700;
}
.rarity-artifact {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.5);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.25);
}
.rarity-varies {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* --------------------------------------------------------------------------
   5. Bestiary Specific Cards
   -------------------------------------------------------------------------- */
.compendium-monster-avatar-col {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
}

.compendium-monster-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.1));
}

.compendium-monster-avatar-fallback {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.1));
}

.compendium-monster-stats-hub {
  display: flex;
  gap: 8px;
}

.compendium-stat-pill {
  flex: 1;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--sheet-border-subtle, rgba(255, 255, 255, 0.06));
}

.compendium-stat-pill.hp {
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.compendium-stat-pill.ac {
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}

.compendium-stat-pill.spd {
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.compendium-monster-abilities-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 6px 4px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  border: 1px solid var(--sheet-border-subtle, rgba(255, 255, 255, 0.06));
  text-align: center;
}

.compendium-ab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  color: var(--muted, #94a3b8);
}

.compendium-ab-item b {
  font-size: 13px;
  color: var(--fg, #f8fafc);
  font-family: 'JetBrains Mono', monospace;
}

.compendium-ab-item small {
  font-size: 10px;
  color: var(--brass, #c8a668);
}

.compendium-subheading {
  font-size: 12px;
  font-weight: 600;
  color: var(--brass-bright, #d4af37);
  margin-bottom: 4px;
}

.compendium-atk-row, .compendium-feat-mini-row {
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
  padding: 3px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.compendium-atk-row:first-of-type, .compendium-feat-mini-row:first-of-type {
  border-top: none;
}

.compendium-spawn-btn {
  width: 100%;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   6. Weapon & Mastery Specific Cards
   -------------------------------------------------------------------------- */
.compendium-mastery-badge-box {
  background: linear-gradient(135deg, rgba(200, 166, 104, 0.18), rgba(200, 166, 104, 0.05));
  border: 1px solid var(--brass, #c8a668);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--brass-bright, #d4af37);
  display: flex;
  align-items: center;
  gap: 6px;
}

.compendium-mastery-star {
  font-size: 14px;
}

.compendium-mastery-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: #f1f5f9;
}

/* --------------------------------------------------------------------------
   7. Class Dossier Full View
   -------------------------------------------------------------------------- */
.compendium-detail-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 24px;
  overflow-y: auto;
  height: 100%;
}

.compendium-detail-view::-webkit-scrollbar {
  width: 6px;
}
.compendium-detail-view::-webkit-scrollbar-thumb {
  background: rgba(200, 166, 104, 0.25);
  border-radius: 4px;
}

.compendium-detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.compendium-back-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.1));
}

.compendium-dossier-header {
  background: linear-gradient(135deg, rgba(200, 166, 104, 0.1), rgba(15, 23, 42, 0.85));
  border: 1px solid var(--brass, #c8a668);
  border-radius: 12px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.compendium-dossier-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--brass-bright, #d4af37);
  margin: 0;
  line-height: 1.15;
}

.compendium-dossier-sub {
  font-size: 13px;
  color: var(--muted, #94a3b8);
  margin-top: 3px;
}

.compendium-dossier-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.compendium-dossier-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: #cbd5e1;
  white-space: pre-line;
}

.compendium-dossier-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compendium-section-heading {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--brass-bright, #d4af37);
  border-bottom: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.08));
  padding-bottom: 6px;
  margin: 0;
}

.compendium-levels-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compendium-level-card {
  display: flex;
  gap: 14px;
  background: rgba(13, 19, 33, 0.65);
  border: 1px solid var(--sheet-border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  padding: 10px 14px;
  transition: border-color 0.15s ease;
}

.compendium-level-card:hover {
  border-color: rgba(200, 166, 104, 0.3);
}

.compendium-level-badge-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  border-right: 1px solid var(--sheet-border-subtle, rgba(255, 255, 255, 0.06));
  padding-right: 12px;
}

.compendium-level-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--brass-bright, #d4af37);
}

.compendium-level-prof {
  font-size: 10.5px;
  color: var(--muted, #94a3b8);
}

.compendium-level-content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compendium-feature-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compendium-feature-name {
  font-weight: 600;
  color: var(--brass-bright, #d4af37);
  font-size: 13.5px;
}

.compendium-feature-desc {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.45;
  white-space: pre-line;
}

.compendium-subclasses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.compendium-subclass-card {
  background: rgba(13, 19, 33, 0.7);
  border: 1px solid var(--sheet-border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compendium-subclass-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--brass-bright, #d4af37);
  margin: 0;
}

.compendium-subclass-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: #cbd5e1;
  white-space: pre-line;
}

.compendium-sublevel-block {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 6px;
  border: 1px solid var(--sheet-border-subtle, rgba(255, 255, 255, 0.05));
}

.compendium-sublevel-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--brass, #c8a668);
  display: block;
  margin-bottom: 4px;
}

.compendium-cat-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--brass-bright, #d4af37);
  margin: 10px 0 6px 0;
}

/* --------------------------------------------------------------------------
   8. Loading & Empty States
   -------------------------------------------------------------------------- */
.compendium-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
}

.compendium-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(200, 166, 104, 0.15);
  border-top-color: var(--brass-bright, #d4af37);
  border-radius: 50%;
  animation: compendiumSpin 0.9s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

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

.compendium-loading-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--brass-bright, #d4af37);
}

.compendium-loading-sub {
  font-size: 13px;
  color: var(--muted, #94a3b8);
}

.compendium-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  font-size: 14px;
  color: var(--muted, #94a3b8);
  background: rgba(13, 19, 33, 0.4);
  border: 1px dashed var(--sheet-border, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
}

.compendium-more-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 0 20px 0;
}

.compendium-load-more-btn {
  background: rgba(200, 166, 104, 0.12);
  border: 1px solid var(--brass, #c8a668);
  color: var(--brass-bright, #d4af37);
  padding: 8px 24px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.compendium-load-more-btn:hover {
  background: rgba(200, 166, 104, 0.25);
  box-shadow: 0 0 14px rgba(200, 166, 104, 0.2);
}

/* --------------------------------------------------------------------------
   9. Backgrounds & Feats Boxes
   -------------------------------------------------------------------------- */
.compendium-feat-box {
  background: rgba(200, 166, 104, 0.06);
  border: 1px solid rgba(200, 166, 104, 0.25);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 4px 0;
}

.compendium-feat-box-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--brass-bright, #d4af37);
  margin-bottom: 3px;
}

.compendium-feat-box-desc {
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.45;
  white-space: pre-line;
}

.compendium-subraces-box {
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 6px;
}

.compendium-subraces-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--brass, #c8a668);
  margin-bottom: 4px;
}

.compendium-subraces-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.compendium-subrace-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.compendium-higher-levels {
  background: rgba(129, 140, 248, 0.08);
  border-left: 3px solid #818cf8;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  color: #c7d2fe;
  line-height: 1.45;
  margin-top: 4px;
}

.compendium-params-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  font-size: 11.5px;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 6px 8px;
}

.compendium-param-line {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.4;
}

.compendium-classes-line {
  color: #94a3b8;
  font-size: 11.5px;
}
