:root {
  --bb-primary: #3B82F6;
  --bb-primary-dark: #2563EB;
  --bb-accent: #8B5CF6;
  --bb-accent-light: #A78BFA;
  --bb-bg: #0F172A;
  --bb-surface: #1E293B;
  --bb-surface-light: #334155;
  --bb-text: #E2E8F0;
  --bb-text-dim: #94A3B8;
  --bb-text-muted: #64748B;
  --bb-border: rgba(148, 163, 184, 0.15);
  --bb-radius: 0.75rem;
  --bb-radius-lg: 1rem;
}

html { scroll-behavior: smooth; }
body { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background-color: var(--bb-bg); color: var(--bb-text); line-height: 1.6; margin: 0; }

*:focus-visible { outline: 2px solid var(--bb-accent); outline-offset: 2px; }
*:focus:not(:focus-visible) { outline: none; }

a { color: var(--bb-accent-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--bb-accent); }

.hamburger-menu {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  min-height: 44px;
  justify-content: center !important;
  gap: 5px;
  padding: 0 10px;
  border-radius: 0.5rem;
}
.hamburger-line { width: 100%; height: 2px; background: currentColor; transition: transform 0.3s ease, opacity 0.3s ease; }
.hamburger-menu.active .hamburger-line:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.hamburger-menu.active .hamburger-line:nth-child(2) { opacity: 0; }
.hamburger-menu.active .hamburger-line:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

.bb-lang-switch { display: flex; gap: 0.25rem; padding: 0.25rem; background: rgba(255,255,255,0.05); border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.1); }
.bb-lang-switch button { min-width: 44px; min-height: 44px; padding: 0.5rem 0.75rem; font-size: 0.75rem; font-weight: 600; color: #94a3b8; background: transparent; border: none; border-radius: 0.25rem; cursor: pointer; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.05em; }
.bb-lang-switch button:hover { color: var(--bb-accent-light); background: rgba(255,255,255,0.05); }
.bb-lang-switch button.active { color: white; background: var(--bb-accent); }

.bb-lang-switch-mobile { display: flex; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 1rem; }
.bb-lang-switch-mobile button { flex: 1; min-height: 44px; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 500; color: #94a3b8; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 0.5rem; cursor: pointer; transition: all 0.2s; }
.bb-lang-switch-mobile button:hover { color: var(--bb-accent-light); border-color: var(--bb-accent); }
.bb-lang-switch-mobile button.active { color: white; background: var(--bb-accent); border-color: var(--bb-accent); }

.filter-section { background: var(--bb-surface); border-radius: var(--bb-radius); padding: 1rem; margin-bottom: 1rem; }
.filter-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0.5rem 0.875rem; border-radius: 9999px; font-size: 0.8125rem; cursor: pointer; transition: all 0.15s ease; border: 1px solid rgba(255,255,255,0.1); background: transparent; color: #94a3b8; }
.filter-chip:hover { border-color: var(--bb-accent); color: var(--bb-accent-light); }
.filter-chip.active { background: var(--bb-accent); border-color: var(--bb-accent); color: white; font-weight: 500; }

.cr-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 2.5rem; height: 1.5rem; padding: 0 0.5rem; border-radius: 0.375rem; font-weight: 600; font-size: 0.75rem; }
.cr-low { background: #22c55e; color: white; }
.cr-medium { background: #eab308; color: black; }
.cr-high { background: #f97316; color: white; }
.cr-deadly { background: #ef4444; color: white; }
.cr-legendary { background: #8b5cf6; color: white; }

.bb-badge { display: inline-flex; align-items: center; justify-content: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.6875rem; font-weight: 600; line-height: 1.4; }
.bb-badge-cr-low { background: rgba(34,197,94,0.12); color: #4ade80; }
.bb-badge-cr-med { background: rgba(234,179,8,0.12); color: #facc15; }
.bb-badge-cr-high { background: rgba(249,115,22,0.12); color: #fb923c; }
.bb-badge-cr-deadly { background: rgba(239,68,68,0.12); color: #f87171; }
.bb-badge-cr-legend { background: rgba(139,92,246,0.12); color: #a78bfa; }
.bb-badge-level { background: var(--bb-surface-light); color: var(--bb-text); }

.level-badge { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.6875rem; font-weight: 600; line-height: 1.5; color: white; }
.school-badge { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.6875rem; font-weight: 500; line-height: 1.5; background: rgba(139,92,246,0.15); color: var(--bb-accent-light); }
.ritual-badge { display: inline-flex; align-items: center; padding: 0.125rem 0.375rem; border-radius: 9999px; font-size: 0.625rem; font-weight: 600; line-height: 1.5; background: rgba(234,179,8,0.15); color: #facc15; margin-left: 0.25rem; }

.component-tag { padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-size: 0.75rem; font-weight: 600; }
.component-v { background: rgba(59,130,246,0.15); color: #60a5fa; }
.component-s { background: rgba(16,185,129,0.15); color: #34d399; }
.component-m { background: rgba(245,158,11,0.15); color: #fbbf24; }
.component-a { background: rgba(139,92,246,0.15); color: #a78bfa; }

.modal-section { border-top: 1px solid var(--bb-border); padding-top: 0.75rem; margin-top: 0.75rem; }
.modal-section-title { font-size: 0.75rem; font-weight: 600; color: var(--bb-accent-light); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }

.bb-modal { display: none; position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.85); backdrop-filter: blur(4px); padding: 1rem; overflow-y: auto; }
.bb-modal.active { display: flex; align-items: flex-start; justify-content: center; }
.bb-modal-content { background: var(--bb-bg); border: 1px solid var(--bb-border); border-radius: var(--bb-radius-lg); max-width: 48rem; width: 100%; margin-top: 2rem; max-height: calc(100vh - 4rem); overflow-y: auto; }
.bb-modal-close { background: none; border: none; color: #94a3b8; cursor: pointer; padding: 0.5rem; transition: color 0.2s; }
.bb-modal-close:hover { color: white; }

.stat-block-header { border-bottom: 2px solid var(--bb-primary); padding-bottom: 0.75rem; margin-bottom: 0.75rem; }
.stat-block-section { border-top: 1px solid var(--bb-border); padding-top: 0.75rem; margin-top: 0.75rem; }
.ability-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; text-align: center; }
.ability-score { background: rgba(255,255,255,0.05); padding: 0.5rem; border-radius: 0.5rem; }
.ability-label { font-size: 0.625rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.ability-value { font-size: 0.875rem; font-weight: 600; color: white; }
.trait-name { color: var(--bb-accent-light); font-weight: 600; }
.bb-trait-name { color: var(--bb-accent-light); font-weight: 600; }

.view-toggle { display: flex; gap: 0.25rem; background: var(--bb-surface); padding: 0.25rem; border-radius: 0.5rem; }
.view-toggle button { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem; border: none; background: transparent; color: #94a3b8; cursor: pointer; border-radius: 0.375rem; transition: all 0.15s; }
.view-toggle button:hover { color: white; }
.view-toggle button.active { background: var(--bb-accent); color: white; }

.bb-tab {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.spell-fav-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
}

.token-gallery { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; max-height: 200px; overflow-y: auto; padding: 0.25rem; }
.token-thumb { width: 56px !important; height: 56px !important; max-width: 56px !important; max-height: 56px !important; border-radius: 0.5rem; object-fit: cover; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; }
.token-thumb:hover { border-color: var(--bb-accent-light); transform: scale(1.05); }
.token-thumb.active { border-color: var(--bb-accent); box-shadow: 0 0 10px rgba(139,92,246,0.5); }

.token-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; padding: 0.5rem; background: rgba(255,255,255,0.03); border-radius: 0.5rem; }
.token-filter-select { padding: 0.25rem 0.5rem; font-size: 0.75rem; background: var(--bb-surface); border: 1px solid rgba(255,255,255,0.15); border-radius: 0.375rem; color: white; cursor: pointer; }
.token-filter-select:focus { outline: none; border-color: var(--bb-accent); }
.token-filter-label { font-size: 0.625rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 0.125rem; }
.token-stats { font-size: 0.6875rem; color: #64748b; margin-top: 0.25rem; }

.bb-rarity-common { background: rgba(148,163,184,0.15); color: #94a3b8; }
.bb-rarity-uncommon { background: rgba(34,197,94,0.15); color: #4ade80; }
.bb-rarity-rare { background: rgba(59,130,246,0.15); color: #60a5fa; }
.bb-rarity-very-rare { background: rgba(168,85,247,0.15); color: #c084fc; }
.bb-rarity-legendary { background: rgba(245,158,11,0.15); color: #fbbf24; }
.bb-prop-tag { padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.6875rem; background: rgba(139,92,246,0.15); color: var(--bb-accent-light); font-weight: 500; }

.license-badge { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.75rem; background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.3); border-radius: 0.5rem; color: var(--bb-accent-light); font-size: 0.8125rem; font-weight: 600; margin: 0.5rem 0; }
.quote-block { background: rgba(255,255,255,0.03); border-left: 3px solid var(--bb-accent); padding: 1rem 1.25rem; border-radius: 0 0.5rem 0.5rem 0; margin: 0.75rem 0; font-style: italic; color: var(--bb-text-dim); }

.sort-select { padding: 0.375rem 0.75rem; background: var(--bb-surface); border: 1px solid var(--bb-border); border-radius: 0.5rem; color: var(--bb-text); font-size: 0.8125rem; outline: none; cursor: pointer; }
.sort-select:focus { border-color: var(--bb-accent); }

.filter-sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 100%; max-width: 20rem; background: var(--bb-bg); z-index: 60; transform: translateX(-100%); transition: transform 0.3s ease; overflow-y: auto; padding: 5rem 1rem 2rem; border-right: 1px solid var(--bb-border); }
.filter-sidebar.open { transform: translateX(0); }
@media (min-width: 1024px) {
  .filter-sidebar { position: sticky; top: 5rem; transform: none; padding: 0; border-right: none; max-height: calc(100vh - 6rem); width: 16rem; flex-shrink: 0; }
}
.filter-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 55; }
.filter-overlay.open { display: block; }
@media (min-width: 1024px) { .filter-overlay { display: none !important; } }
