:root {
  --bb-primary: #7b1f2a;
  --bb-secondary: #1e2a44;
  --bb-accent: #f5ead4;
  --bb-bg: #e3d6bd;
  --bb-text: #2e2a26;
  --bb-green: #2f9e44;
  --bb-red: #d64545;
  --bb-yellow: #e9b949;
  --bb-status-win: var(--bb-green);
  --bb-status-loss: var(--bb-red);
  --bb-status-draw: #8c6c1d;
  --bb-status-upcoming: var(--bb-yellow);
  --bb-status-win-bg: rgba(47, 158, 68, 0.15);
  --bb-status-loss-bg: rgba(214, 69, 69, 0.15);
  --bb-status-draw-bg: rgba(233, 185, 73, 0.2);
  --bb-status-upcoming-bg: rgba(233, 185, 73, 0.2);
  --bb-card: rgba(245, 234, 212, 0.8);
  --bb-surface: #faf7f0;
  --bb-border-color: rgba(46, 42, 38, 0.15);
  --bb-border: 1px solid var(--bb-border-color);
  --bb-shadow: 0 6px 18px rgba(30, 42, 68, 0.12);
  --bb-text-muted: rgba(46, 42, 38, 0.7);
  --bb-text-subtle: rgba(46, 42, 38, 0.55);
  --bb-texture-1: rgba(245, 234, 212, 0.5);
  --bb-texture-2: rgba(46, 42, 38, 0.06);
  --bb-table-odd: rgba(250, 247, 240, 0.9);
  --bb-table-even: rgba(250, 247, 240, 0.7);
  --bb-row-empty: rgba(250, 247, 240, 0.6);

  --bb-card-radius: 8px;
  --bb-heading: var(--bb-secondary);
  --bb-link: var(--bb-primary);
  --bb-link-hover: var(--bb-secondary);
  --bb-cta: var(--bb-primary);
  --bb-cta-hover: var(--bb-secondary);
  --bb-icon: var(--bb-secondary);
  --bb-group: var(--bb-secondary);
}

body[data-theme="retro"] {
  --bb-primary: #7b1f2a;
  --bb-secondary: #1e2a44;
  --bb-accent: #f5ead4;
  --bb-bg: #e3d6bd;
  --bb-text: #2e2a26;
  --bb-green: #2f9e44;
  --bb-red: #d64545;
  --bb-yellow: #e9b949;
  --bb-status-win: var(--bb-green);
  --bb-status-loss: var(--bb-red);
  --bb-status-draw: #8c6c1d;
  --bb-status-upcoming: var(--bb-yellow);
  --bb-status-win-bg: rgba(47, 158, 68, 0.15);
  --bb-status-loss-bg: rgba(214, 69, 69, 0.15);
  --bb-status-draw-bg: rgba(233, 185, 73, 0.2);
  --bb-status-upcoming-bg: rgba(233, 185, 73, 0.2);
  --bb-card: rgba(245, 234, 212, 0.8);
  --bb-surface: #faf7f0;
  --bb-border-color: rgba(46, 42, 38, 0.15);
  --bb-shadow: 0 6px 18px rgba(30, 42, 68, 0.12);
  --bb-text-muted: rgba(46, 42, 38, 0.7);
  --bb-text-subtle: rgba(46, 42, 38, 0.55);
  --bb-texture-1: rgba(245, 234, 212, 0.5);
  --bb-texture-2: rgba(46, 42, 38, 0.06);
  --bb-table-odd: rgba(250, 247, 240, 0.9);
  --bb-table-even: rgba(250, 247, 240, 0.7);
  --bb-row-empty: rgba(250, 247, 240, 0.6);
  --bb-heading: var(--bb-secondary);
  --bb-link: var(--bb-primary);
  --bb-link-hover: var(--bb-secondary);
  --bb-cta: var(--bb-primary);
  --bb-cta-hover: var(--bb-secondary);
  --bb-icon: var(--bb-secondary);
  --bb-group: var(--bb-secondary);
}

body[data-theme="dark-fantasy"] {
  --bb-primary: #8a2626;
  --bb-secondary: #0e131a;
  --bb-accent: #f6e7cc;
  --bb-bg: #0a0d12;
  --bb-text: #f2e6cf;
  --bb-green: #57c46b;
  --bb-red: #ff6b6b;
  --bb-yellow: #d2a84a;
  --bb-status-win: #79d98b;
  --bb-status-loss: #ff7a7a;
  --bb-status-draw: #f0c770;
  --bb-status-upcoming: #f0c770;
  --bb-status-win-bg: rgba(121, 217, 139, 0.18);
  --bb-status-loss-bg: rgba(255, 122, 122, 0.18);
  --bb-status-draw-bg: rgba(240, 199, 112, 0.22);
  --bb-status-upcoming-bg: rgba(240, 199, 112, 0.22);
  --bb-card: rgba(22, 27, 35, 0.96);
  --bb-surface: #161b23;
  --bb-border-color: rgba(255, 255, 255, 0.14);
  --bb-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
  --bb-text-muted: rgba(242, 230, 207, 0.82);
  --bb-text-subtle: rgba(242, 230, 207, 0.6);
  --bb-texture-1: rgba(12, 16, 22, 0.7);
  --bb-texture-2: rgba(255, 255, 255, 0.05);
  --bb-table-odd: rgba(22, 27, 35, 0.98);
  --bb-table-even: rgba(22, 27, 35, 0.88);
  --bb-row-empty: rgba(22, 27, 35, 0.7);
  --bb-heading: var(--bb-accent);
  --bb-link: #d88a5c;
  --bb-link-hover: #f0b07a;
  --bb-cta: #e2b36b;
  --bb-cta-hover: #f5d08a;
  --bb-icon: #b7a88f;
  --bb-group: #cdbb9a;
}

body[data-theme="modern"] {
  --bb-primary: #1f3a5f;
  --bb-secondary: #0f172a;
  --bb-accent: #e2e8f0;
  --bb-bg: #f1f5f9;
  --bb-text: #0f172a;
  --bb-green: #16a34a;
  --bb-red: #ef4444;
  --bb-yellow: #f59e0b;
  --bb-status-win: #22c55e;
  --bb-status-loss: #ef4444;
  --bb-status-draw: #f59e0b;
  --bb-status-upcoming: #f59e0b;
  --bb-status-win-bg: rgba(34, 197, 94, 0.16);
  --bb-status-loss-bg: rgba(239, 68, 68, 0.16);
  --bb-status-draw-bg: rgba(245, 158, 11, 0.2);
  --bb-status-upcoming-bg: rgba(245, 158, 11, 0.2);
  --bb-card: #ffffff;
  --bb-surface: #ffffff;
  --bb-border-color: rgba(15, 23, 42, 0.1);
  --bb-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --bb-text-muted: rgba(15, 23, 42, 0.65);
  --bb-text-subtle: rgba(15, 23, 42, 0.5);
  --bb-texture-1: rgba(241, 245, 249, 0.7);
  --bb-texture-2: rgba(15, 23, 42, 0.04);
  --bb-table-odd: rgba(241, 245, 249, 0.9);
  --bb-table-even: rgba(241, 245, 249, 0.7);
  --bb-row-empty: rgba(241, 245, 249, 0.6);
  --bb-heading: var(--bb-secondary);
  --bb-link: #2563eb;
  --bb-link-hover: #1d4ed8;
  --bb-cta: #1f3a5f;
  --bb-cta-hover: #0f172a;
  --bb-icon: var(--bb-secondary);
  --bb-group: var(--bb-secondary);
}

html, body {
  height: 100%;
}

body {
  font-family: "Libre Franklin", "Segoe UI", sans-serif;
  background: var(--bb-bg);
  color: var(--bb-text);
  letter-spacing: 0.1px;
}

/* Stronger custom look (reduces Bootstrap feel) */
.form-control,
.form-select,
.form-control-sm {
  border-radius: 10px;
  border: 1px solid var(--bb-border-color);
  background: var(--bb-surface);
  color: var(--bb-text);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--bb-yellow);
  box-shadow: 0 0 0 3px rgba(233, 185, 73, 0.25);
}

@keyframes bb-fade-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bb-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 1400px) {
  .container {
    max-width: 1800px;
  }
}

*:focus-visible {
  outline: 2px solid var(--bb-yellow);
  box-shadow: 0 0 0 3px rgba(233, 185, 73, 0.35);
  outline-offset: 2px;
}

.bb-bg-texture {
  background-image:
    linear-gradient(0deg, var(--bb-texture-1), var(--bb-texture-1)),
    repeating-linear-gradient(
      135deg,
      var(--bb-texture-2) 0,
      var(--bb-texture-2) 2px,
      transparent 2px,
      transparent 10px
    );
  min-height: 100vh;
}

.bb-brand {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.bb-header {
  background: var(--bb-secondary);
  color: var(--bb-accent);
  border-bottom: 3px solid var(--bb-primary);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.bb-nav-link {
  color: var(--bb-accent);
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.8px;
  transition: color 0.15s ease, transform 0.15s ease;
  position: relative;
  text-decoration: none;
  padding: 4px 6px;
}

.bb-nav-link:hover,
.bb-nav-link.active {
  color: var(--bb-yellow);
  transform: translateY(-1px);
}

.bb-nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--bb-yellow);
  border-radius: 999px;
}

.bb-badge {
  background: var(--bb-primary);
  color: var(--bb-accent);
  border: 1px solid rgba(245, 234, 212, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 0.75rem;
}

.bb-card {
  background: var(--bb-card);
  border-radius: var(--bb-card-radius);
  border: var(--bb-border);
  box-shadow: var(--bb-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: bb-fade-up 0.22s ease both;
  position: relative;
}

.bb-card:not(.bb-card-paper)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--bb-primary);
  border-top-left-radius: var(--bb-card-radius);
  border-top-right-radius: var(--bb-card-radius);
}

.bb-card-paper {
  background: var(--bb-surface);
  border-color: var(--bb-border-color);
  position: relative;
}

.bb-card-paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--bb-primary);
  border-top-left-radius: var(--bb-card-radius);
  border-top-right-radius: var(--bb-card-radius);
}

.bb-card.hoverable:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(30, 42, 68, 0.18);
}

.bb-card.hoverable:hover::before {
  background: var(--bb-yellow);
}

.bb-card-header {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--bb-heading);
  font-weight: 600;
}

.bb-table thead th {
  background: var(--bb-primary);
  color: var(--bb-accent);
  border-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.bb-table {
  background: var(--bb-surface);
  --bs-table-bg: var(--bb-surface);
  --bs-table-accent-bg: transparent;
  --bs-table-color: var(--bb-text);
  animation: bb-fade-up 0.22s ease both;
}

.bb-table tbody tr:nth-child(odd) {
  background: var(--bb-table-odd);
}

.bb-table tbody tr:nth-child(even) {
  background: var(--bb-table-even);
}

.bb-table tbody tr:hover {
  background: rgba(233, 185, 73, 0.1);
}

.bb-clickable {
  cursor: pointer;
}

.bb-sortable {
  cursor: pointer;
  user-select: none;
}

.bb-sortable::after {
  content: " ⇅";
  font-size: 0.8em;
  opacity: 0.5;
}

.bb-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--bb-border-color);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bb-surface);
}

.bb-lang-select {
  background: transparent;
  color: var(--bb-text);
  border: 0;
  padding: 4px 10px;
  font-size: 0.75rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  outline: none;
  cursor: pointer;
}

.bb-lang-select:focus-visible {
  outline: 2px solid var(--bb-yellow);
  outline-offset: 2px;
}

.bb-lang-select option {
  color: var(--bb-text);
  background: var(--bb-surface);
}

.bb-theme-toggle {
  display: inline-flex;
  border: 1px solid var(--bb-border-color);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bb-surface);
}

.bb-theme-select {
  background: transparent;
  color: var(--bb-text);
  border: 0;
  padding: 4px 10px;
  font-size: 0.75rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  outline: none;
  cursor: pointer;
}

.bb-theme-select:focus-visible {
  outline: 2px solid var(--bb-yellow);
  outline-offset: 2px;
}

.bb-theme-select option {
  color: var(--bb-text);
  background: var(--bb-surface);
}

.bb-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bb-badge-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border: 1px solid var(--bb-border-color);
}

.bb-badge-gold {
  background: rgba(233, 185, 73, 0.25);
  color: #6b4f10;
  border-color: rgba(140, 108, 29, 0.6);
}

.bb-badge-blue {
  background: rgba(52, 152, 219, 0.18);
  color: #1e5b86;
  border-color: rgba(52, 152, 219, 0.45);
}

.bb-game-details {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--bb-border-color);
  font-size: 0.85rem;
  color: var(--bb-text-muted);
}

.bb-toggle {
  cursor: pointer;
}

.bb-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--bb-group);
}

.bb-group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--bb-border-color);
}

.bb-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.bb-overlay.active {
  display: flex;
  animation: bb-fade-in 0.2s ease both;
}

.bb-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.bb-overlay-panel {
  position: relative;
  background: var(--bb-surface);
  border: var(--bb-border);
  box-shadow: var(--bb-shadow);
  border-radius: var(--bb-card-radius);
  width: min(900px, 92vw);
  max-height: 80vh;
  overflow: auto;
  padding: 16px;
  z-index: 1;
  animation: bb-fade-up 0.2s ease both;
}

.bb-overlay-panel-wide {
  width: min(1100px, 94vw);
}

.bb-table-card .bb-table {
  border-radius: var(--bb-card-radius);
  overflow: hidden;
}

.bb-table-card {
  position: relative;
}

.bb-table-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--bb-primary);
  border-top-left-radius: var(--bb-card-radius);
  border-top-right-radius: var(--bb-card-radius);
}
.bb-table tbody tr.bb-row-empty td {
  color: var(--bb-text-subtle);
  background: var(--bb-row-empty);
  font-style: italic;
}

.bb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid var(--bb-border-color);
}

.bb-pill.win { background: rgba(47, 158, 68, 0.15); color: var(--bb-green); }
.bb-pill.loss { background: rgba(214, 69, 69, 0.15); color: var(--bb-red); }
.bb-pill.draw { background: rgba(233, 185, 73, 0.2); color: #8c6c1d; }

.bb-pill.win { background: var(--bb-status-win-bg); color: var(--bb-status-win); }
.bb-pill.loss { background: var(--bb-status-loss-bg); color: var(--bb-status-loss); }
.bb-pill.draw { background: var(--bb-status-draw-bg); color: var(--bb-status-draw); }
.bb-pill.upcoming { background: var(--bb-status-upcoming-bg); color: var(--bb-status-upcoming); }

.bb-cta-link {
  color: var(--bb-cta);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.15s ease, letter-spacing 0.15s ease;
}

/* Buttons & badges beyond Bootstrap defaults */
.btn,
.btn-sm,
.btn-primary,
.btn-outline-primary,
.btn-outline-secondary {
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  border: 1px solid var(--bb-border-color);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--bb-primary);
  color: var(--bb-accent);
  border-color: var(--bb-primary);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.15);
  background: var(--bb-secondary);
  border-color: var(--bb-secondary);
}

.btn-outline-primary {
  background: transparent;
  color: var(--bb-primary);
  border-color: var(--bb-primary);
}

.btn-outline-primary:hover {
  background: var(--bb-primary);
  color: var(--bb-accent);
}

.btn-outline-secondary {
  background: transparent;
  color: var(--bb-secondary);
  border-color: var(--bb-secondary);
}

.btn-outline-secondary:hover {
  background: var(--bb-secondary);
  color: var(--bb-accent);
}

.badge,
.badge-pill {
  border-radius: 999px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Stronger header identity */
.bb-header .bb-brand {
  letter-spacing: 1.6px;
  font-size: 1.05rem;
}

.bb-header nav {
  gap: 16px;
}

.bb-header .bb-lang-toggle,
.bb-header .bb-theme-toggle {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.bb-cta-link:hover {
  color: var(--bb-cta-hover);
  letter-spacing: 0.9px;
}

a.text-decoration-none {
  color: var(--bb-link);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a.text-decoration-none:hover,
a.text-decoration-none:focus {
  color: var(--bb-link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bb-icon {
  color: var(--bb-icon);
  font-size: 1.2rem;
}

.bb-section-subtitle {
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 0.8rem;
  color: var(--bb-text-muted);
}

.bb-section-title {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--bb-heading);
  font-weight: 600;
}

.bb-page-section {
  margin-bottom: 24px;
}

.bb-page-section:last-child {
  margin-bottom: 0;
}

.bb-section-stack > .bb-card + .bb-card {
  margin-top: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .bb-card,
  .bb-table,
  .bb-overlay.active,
  .bb-overlay-panel {
    animation: none;
  }
  .bb-card,
  .bb-nav-link,
  .bb-cta-link,
  a.text-decoration-none {
    transition: none;
  }
}

.bb-top-team {
  border: 2px solid var(--bb-yellow);
  position: relative;
}


.bb-footer {
  color: var(--bb-text-muted);
  font-size: 0.85rem;
}

@media (max-width: 991.98px) {
  .bb-header {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

@media (max-width: 767.98px) {
  .bb-table thead {
    display: none;
  }
  .bb-table tbody tr {
    display: block;
    margin-bottom: 12px;
    border: var(--bb-border);
    border-radius: var(--bb-card-radius);
    padding: 10px;
  }
  .bb-table tbody td {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
  }
}
.bb-table tbody td,
.bb-table tbody th {
  color: var(--bb-text);
}

.bb-card .text-muted {
  color: var(--bb-text-muted) !important;
}
