/*
 * =============================================================================
 * BASKETBALL TOURNAMENT MANAGER — styles.css
 * Version : 3.0.1
 *
 * TABLE OF CONTENTS
 * -----------------
 * 1.  CSS Custom Properties (Design Tokens)
 * 2.  Reset & Base
 * 3.  Layout
 * 4.  App Header
 * 5.  Screen Visibility
 * 6.  Section Labels
 * 7.  Cards
 * 8.  Buttons
 * 9.  Format Picker
 * 10. Team Count Input
 * 11. Team Name Inputs
 * 12. Banners (Error / Success)
 * 13. Home Screen — Tournament List
 * 14. Fixtures Screen — Stats, Tabs, Rounds
 * 15. Match Cards
 * 16. Score Entry Modal
 * 17. Bracket Page  (bracket.html)
 * 18. Debug Log Panel
 * 19. Utilities
 * 20. Animations
 * =============================================================================
 */

/* =============================================================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   Light mode defaults. Dark mode overrides via prefers-color-scheme.
   ============================================================================= */
:root {
  /* Backgrounds — warm cream base, JB254 "Warm Community" theme */
  --bg-primary    : #fffdf9;
  --bg-secondary  : #faf6ec;
  --bg-tertiary   : #f2ead5;
  --bg-info       : #e6f1fb;
  --bg-success    : #e7f2ec;
  --bg-error      : #fdf0ea;
  --bg-warning    : #fbf1de;

  /* Text */
  --text-primary  : #232019;
  --text-secondary: #6b6255;
  --text-tertiary : #a39a89;
  --text-info     : #185fa5;
  --text-success  : #0b6e4f;
  --text-error    : #a3401d;
  --text-warning  : #8a5a06;

  /* Borders */
  --border-light  : rgba(35,32,25,0.10);
  --border-mid    : rgba(35,32,25,0.18);

  /* Brand — forest green primary, terracotta secondary (JB254, Kenyan-flag inspired) */
  --accent        : #0b6e4f;
  --accent-dark   : #084f39;
  /* Fixed brightness, does NOT flip with dark mode — for surfaces that are
     always dark regardless of system theme (e.g. the bracket page's night
     background). Using --accent-dark there would go near-black in light mode. */
  --accent-bright : #1d9e75;
  --secondary     : #c1440e;
  --secondary-dark: #973207;
  --danger        : #c1440e;
  --warning       : #b8790f;

  /* Border radii — a little rounder throughout for a friendlier feel */
  --radius-sm     : 7px;
  --radius-md     : 10px;
  --radius-lg     : 14px;
  --radius-xl     : 20px;

  /* Typography */
  --font          : 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono     : 'Cascadia Code', 'Consolas', 'Courier New', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary    : #1c1a15;
    --bg-secondary  : #26231b;
    --bg-tertiary   : #302c21;
    --bg-info       : #0c2540;
    --bg-success    : #0e2a1f;
    --bg-error      : #331d10;
    --bg-warning    : #2e2408;
    --text-primary  : #f5f0e4;
    --text-secondary: #b9ae99;
    --text-tertiary : #7d7563;
    --text-info     : #85b7eb;
    --text-success  : #4fc78e;
    --text-error    : #ec8f5e;
    --text-warning  : #e0ac4a;
    --border-light  : rgba(245,240,228,0.08);
    --border-mid    : rgba(245,240,228,0.15);
    --accent        : #1d9e75;
    --accent-dark   : #4fc78e;
    --secondary     : #e0713e;
    --secondary-dark: #f0997b;
  }
}

/* =============================================================================
   2. RESET & BASE
   ============================================================================= */
*, *::before, *::after {
  box-sizing : border-box;
  margin     : 0;
  padding    : 0;
}

html { scroll-behavior: smooth; }

body {
  font-family : var(--font);
  background  : var(--bg-tertiary);
  color       : var(--text-primary);
  min-height  : 100vh;
  line-height : 1.5;
  -webkit-font-smoothing: antialiased;
}

input, button, select, textarea {
  font-family : inherit;
  font-size   : inherit;
}

/* =============================================================================
   3. LAYOUT
   ============================================================================= */
.page-wrapper {
  display         : flex;
  justify-content : center;
  padding         : 2rem 1rem 4rem;
}

.app {
  width     : 100%;
  max-width : 720px;
}

/* Bracket page gets a wider canvas */
.app.wide {
  max-width : 1100px;
}

/* =============================================================================
   4. APP HEADER
   ============================================================================= */
.app-header {
  display         : flex;
  align-items     : center;
  justify-content : space-between;
  margin-bottom   : 2rem;
  padding-bottom  : 1rem;
  border-bottom   : 0.5px solid var(--border-light);
}

.app-header h1 {
  font-size   : 18px;
  font-weight : 500;
}

.app-header p {
  font-size  : 12px;
  color      : var(--text-tertiary);
  margin-top : 2px;
}

.app-header-right {
  display     : flex;
  align-items : center;
  gap         : 8px;
}

/* Connection indicator dot */
.conn-dot {
  width         : 8px;
  height        : 8px;
  border-radius : 50%;
  background    : #ccc;
  display       : inline-block;
}
.conn-dot.online  { background: var(--accent); }
.conn-dot.offline { background: var(--danger); }

.conn-label {
  font-size : 11px;
  color     : var(--text-tertiary);
}

/* =============================================================================
   4b. BOTTOM NAV BAR (mobile) + TOP NAV BAR (desktop)
   ============================================================================= */

/* Top nav — visible on desktop, hidden on mobile */
.app-nav {
  display         : flex;
  align-items     : center;
  justify-content : space-between;
  padding         : 6px 1rem;
  background      : var(--bg-secondary);
  border-bottom   : 0.5px solid var(--border-light);
}

.nav-brand {
  display         : inline-flex;
  align-items     : center;
  gap             : 6px;
  font-size       : 14px;
  font-weight     : 700;
  color           : var(--accent);
  text-decoration : none;
  white-space     : nowrap;
}

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

#auth-controls {
  display     : flex;
  align-items : center;
  gap         : 8px;
}
.app-nav .nav-link {
  display         : inline-flex;
  align-items     : center;
  gap             : 5px;
  padding         : 5px 10px;
  border-radius   : var(--radius-md);
  font-size       : 12px;
  font-weight     : 500;
  color           : var(--text-secondary);
  text-decoration : none;
  border          : none;
  background      : transparent;
  cursor          : pointer;
  transition      : background 0.12s, color 0.12s;
  white-space     : nowrap;
}
.app-nav .nav-link:hover  { background: var(--bg-tertiary); color: var(--text-primary); }
.app-nav .nav-link.active { background: var(--bg-primary); color: var(--accent);
                             border: 0.5px solid var(--border-light); }

/* Bottom nav bar — mobile only */
.bottom-nav {
  display  : none;
  position : fixed;
  bottom   : 0; left : 0; right : 0;
  height   : 58px;
  background    : var(--bg-primary);
  border-top    : 0.5px solid var(--border-light);
  z-index       : 90;
  align-items   : stretch;
  box-shadow    : 0 -2px 12px rgba(0,0,0,0.06);
}

.bottom-nav-item {
  flex            : 1;
  display         : flex;
  flex-direction  : column;
  align-items     : center;
  justify-content : center;
  gap             : 3px;
  font-size       : 10px;
  font-weight     : 500;
  color           : var(--text-tertiary);
  text-decoration : none;
  border          : none;
  background      : transparent;
  cursor          : pointer;
  padding         : 8px 4px 10px;
  transition      : color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item .nav-icon { font-size: 20px; line-height: 1; }
.bottom-nav-item:hover,
.bottom-nav-item.active  { color: var(--accent); }

/* =============================================================================
   RESPONSIVE — mobile breakpoints
   ============================================================================= */

/* ≤ 600px: switch to bottom nav, tighten layout */
@media (max-width: 600px) {
  .page-wrapper {
    padding : 1rem 0.75rem 80px; /* bottom padding clears the bottom nav */
  }

  /* Hide top nav on mobile — bottom nav takes over */
  .app-nav          { display: none; }
  .bottom-nav       { display: flex; }

  /* App header: stack vertically */
  .app-header {
    flex-direction : column;
    align-items    : flex-start;
    gap            : 8px;
    margin-bottom  : 1rem;
  }
  .app-header-right {
    width     : 100%;
    flex-wrap : wrap;
    gap       : 6px;
  }

  /* Auth bar: stack left nav links and auth controls */
  #auth-bar {
    flex-direction : column !important;
    align-items    : flex-start !important;
    gap            : 8px !important;
  }
  #auth-controls { flex-wrap: wrap; }

  /* Schedule header: stack */
  .schedule-header {
    flex-direction : column;
    gap            : 0.75rem;
  }
  .schedule-header .btn-row { flex-wrap: wrap; }

  /* Stats row: 2 cols instead of 3 */
  .stats-row { grid-template-columns: repeat(2, 1fr); }

  /* Format grid: 1 column */
  .format-grid { grid-template-columns: 1fr 1fr; }

  /* Team inputs: single column */
  .team-inputs-grid { grid-template-columns: 1fr; }

  /* Tournament item: wrap actions below name */
  .tournament-item {
    flex-direction : column;
    align-items    : flex-start;
    gap            : 8px;
  }
  .tournament-item-actions { width: 100%; justify-content: flex-end; }

  /* Match cards: tighten padding */
  .match-card { padding: 0.55rem 0.65rem; gap: 6px; }
  .team-a, .team-b { font-size: 12px; }

  /* Modal: full-width on small screens */
  .modal { max-width: 100%; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

/* 601–768px: tablet — keep top nav, tighten a bit */
@media (min-width: 601px) and (max-width: 768px) {
  .page-wrapper { padding: 1.25rem 1rem 3rem; }

  .schedule-header { flex-wrap: wrap; }
  .schedule-header .btn-row { flex-wrap: wrap; }

  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .team-inputs-grid { grid-template-columns: 1fr 1fr; }

  .tournament-item-actions { flex-wrap: wrap; }
}

/* =============================================================================
   5. SCREEN VISIBILITY
   Only .screen.active is shown. All others are hidden.
   ============================================================================= */
.screen         { display: none; }
.screen.active  { display: block; }

/* =============================================================================
   6. SECTION LABELS
   Small uppercase labels used above cards and sections.
   ============================================================================= */
.section-label {
  font-size      : 11px;
  font-weight    : 500;
  letter-spacing : 0.08em;
  text-transform : uppercase;
  color          : var(--text-tertiary);
  margin-bottom  : 0.75rem;
}

/* =============================================================================
   7. CARDS
   ============================================================================= */
.card {
  background    : var(--bg-primary);
  border        : 0.5px solid var(--border-light);
  border-radius : var(--radius-lg);
  padding       : 1.25rem;
  margin-bottom : 1rem;
}

/* =============================================================================
   8. BUTTONS
   ============================================================================= */
.btn {
  display         : inline-flex;
  align-items     : center;
  gap             : 6px;
  padding         : 0 18px;
  height          : 38px;
  border-radius   : var(--radius-md);
  font-size       : 13px;
  font-weight     : 500;
  cursor          : pointer;
  border          : 0.5px solid var(--border-mid);
  background      : transparent;
  color           : var(--text-primary);
  transition      : background 0.12s, opacity 0.12s, transform 0.08s;
  white-space     : nowrap;
  text-decoration : none;
}
.btn:hover    { background: var(--bg-secondary); }
.btn:active   { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn.primary { background: var(--accent);  border-color: var(--accent);  color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }

.btn.danger  { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.btn.danger:hover { background: #b83d3d; }

.btn.ghost   { border-color: var(--border-light); color: var(--text-secondary); }

/* Small variant */
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; }

.btn-row {
  display   : flex;
  gap       : 8px;
  flex-wrap : wrap;
  align-items: center;
}

/* =============================================================================
   9. FORMAT PICKER
   ============================================================================= */
.format-grid {
  display               : grid;
  grid-template-columns : repeat(3, 1fr);
  gap                   : 10px;
  margin-bottom         : 1.25rem;
}

.format-card {
  background    : var(--bg-primary);
  border        : 0.5px solid var(--border-light);
  border-radius : var(--radius-md);
  padding       : 0.85rem 0.75rem;
  cursor        : pointer;
  transition    : border-color 0.15s;
  text-align    : center;
}
.format-card:hover    { border-color: var(--border-mid); }
.format-card.selected { border: 1.5px solid var(--accent); }
.format-card .fmt-icon { font-size: 20px; margin-bottom: 6px; }
.format-card .fmt-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.format-card .fmt-desc { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; line-height: 1.4; }

.format-suggestion {
  font-size     : 12px;
  color         : var(--text-info);
  background    : var(--bg-info);
  border-radius : var(--radius-md);
  padding       : 6px 10px;
  margin-bottom : 1.25rem;
  display       : inline-block;
}

.format-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* =============================================================================
   10. TEAM COUNT INPUT
   ============================================================================= */
.team-count-row {
  display       : flex;
  align-items   : center;
  gap           : 12px;
  margin-bottom : 0.6rem;
}

.team-count-row label {
  font-size   : 13px;
  color       : var(--text-secondary);
  white-space : nowrap;
}

.team-count-row input[type="number"] {
  width         : 80px;
  height        : 38px;
  border        : 0.5px solid var(--border-mid);
  border-radius : var(--radius-md);
  background    : var(--bg-secondary);
  color         : var(--text-primary);
  font-size     : 18px;
  font-weight   : 500;
  text-align    : center;
  outline       : none;
  transition    : border-color 0.15s;
}
.team-count-row input[type="number"]:focus { border-color: var(--accent); }
.team-count-row input[type="number"].input-error { border-color: var(--danger); }

.team-count-hint {
  font-size     : 11px;
  color         : var(--text-tertiary);
  margin-bottom : 1.25rem;
}

/* =============================================================================
   11. TEAM NAME INPUTS
   ============================================================================= */
.team-inputs-grid {
  display               : grid;
  grid-template-columns : 1fr 1fr;
  gap                   : 8px;
  margin-bottom         : 1.25rem;
}

.team-input-wrap {
  display       : flex;
  align-items   : center;
  gap           : 8px;
  background    : var(--bg-secondary);
  border        : 0.5px solid var(--border-light);
  border-radius : var(--radius-md);
  padding       : 0 10px;
  height        : 38px;
}

.team-num {
  font-size   : 11px;
  font-weight : 500;
  color       : var(--text-tertiary);
  min-width   : 20px;
}

.team-input-wrap input {
  border     : none;
  background : transparent;
  font-size  : 13px;
  color      : var(--text-primary);
  outline    : none;
  flex       : 1;
  height     : 100%;
}

/* Tournament name input (full width) */
.tournament-name-input {
  width         : 100%;
  height        : 38px;
  border        : 0.5px solid var(--border-mid);
  border-radius : var(--radius-md);
  background    : var(--bg-secondary);
  color         : var(--text-primary);
  font-size     : 13px;
  padding       : 0 12px;
  outline       : none;
  transition    : border-color 0.15s;
  margin-bottom : 1rem;
}
.tournament-name-input:focus { border-color: var(--accent); }

select.tournament-name-input {
  appearance         : none;
  -webkit-appearance : none;
  background-image   : url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a9993' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat  : no-repeat;
  background-position: right 12px center;
  padding-right      : 32px;
}

/* =============================================================================
   12. BANNERS (ERROR / SUCCESS)
   ============================================================================= */
.error-banner,
.success-banner,
.warning-banner {
  display       : none;
  align-items   : center;
  gap           : 8px;
  border-radius : var(--radius-md);
  padding       : 8px 12px;
  margin-bottom : 1rem;
  font-size     : 12px;
}
.error-banner.visible,
.success-banner.visible,
.warning-banner.visible { display: flex; }

.error-banner {
  background : var(--bg-error);
  border     : 0.5px solid #e8b79a;
  color      : var(--text-error);
}
.success-banner {
  background : var(--bg-success);
  border     : 0.5px solid #a3d3bb;
  color      : var(--text-success);
}
.warning-banner {
  background : var(--bg-warning);
  border     : 0.5px solid #f0d080;
  color      : var(--text-warning);
}

.banner-icon { font-size: 14px; flex-shrink: 0; }

/* =============================================================================
   13. HOME SCREEN — TOURNAMENT LIST
   ============================================================================= */
.tournament-list { margin-bottom: 1rem; }

.tournament-item {
  background      : var(--bg-primary);
  border          : 0.5px solid var(--border-light);
  border-radius   : var(--radius-md);
  padding         : 0.85rem 1rem;
  display         : flex;
  align-items     : center;
  justify-content : space-between;
  margin-bottom   : 6px;
  transition      : border-color 0.15s;
}
.tournament-item:hover { border-color: var(--border-mid); }

.tournament-item-info h3 {
  font-size   : 14px;
  font-weight : 500;
}
.tournament-item-info p {
  font-size  : 11px;
  color      : var(--text-tertiary);
  margin-top : 2px;
}

.tournament-item-actions {
  display     : flex;
  gap         : 6px;
  align-items : center;
  flex-wrap   : wrap;
}

.empty-state {
  text-align  : center;
  padding     : 3rem 1rem;
  color       : var(--text-tertiary);
  font-size   : 13px;
  line-height : 1.8;
}
.empty-state .empty-icon {
  font-size     : 32px;
  margin-bottom : 0.75rem;
  display       : block;
}

/* =============================================================================
   14. FIXTURES SCREEN — STATS, TABS, ROUNDS
   ============================================================================= */
.schedule-header {
  display         : flex;
  align-items     : flex-start;
  justify-content : space-between;
  margin-bottom   : 1.25rem;
  gap             : 1rem;
}
.schedule-title { font-size: 18px; font-weight: 500; }
.schedule-meta  { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.stats-row {
  display               : grid;
  grid-template-columns : repeat(3, 1fr);
  gap                   : 8px;
  margin-bottom         : 1.25rem;
}
.stat-box {
  background    : var(--bg-secondary);
  border-radius : var(--radius-md);
  padding       : 0.75rem;
  text-align    : center;
}
.stat-val { font-size: 22px; font-weight: 500; }
.stat-lbl { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* Tabs */
.tab-row {
  display       : flex;
  gap           : 4px;
  margin-bottom : 1.25rem;
  background    : var(--bg-secondary);
  border-radius : var(--radius-md);
  padding       : 3px;
}
.tab {
  flex          : 1;
  padding       : 6px 0;
  text-align    : center;
  font-size     : 12px;
  font-weight   : 500;
  color         : var(--text-secondary);
  cursor        : pointer;
  border-radius : calc(var(--radius-md) - 2px);
  border        : none;
  background    : transparent;
  transition    : background 0.12s, color 0.12s;
}
.tab.active {
  background : var(--bg-primary);
  color      : var(--text-primary);
  border     : 0.5px solid var(--border-light);
}
.tab-panel        { display: none; }
.tab-panel.active { display: block; }

/* Round sections */
.round-section { margin-bottom: 1.5rem; }

.round-label {
  font-size      : 11px;
  font-weight    : 500;
  letter-spacing : 0.06em;
  text-transform : uppercase;
  color          : var(--text-tertiary);
  margin-bottom  : 8px;
  display        : flex;
  align-items    : center;
  gap            : 8px;
}
.round-label::after {
  content    : '';
  flex       : 1;
  height     : 0.5px;
  background : var(--border-light);
}

/* =============================================================================
   15. MATCH CARDS
   ============================================================================= */
.match-card {
  background    : var(--bg-primary);
  border        : 0.5px solid var(--border-light);
  border-radius : var(--radius-md);
  padding       : 0.65rem 1rem;
  display       : flex;
  align-items   : center;
  gap           : 10px;
  margin-bottom : 6px;
  transition    : border-color 0.15s, background 0.12s;
}
.match-card.clickable { cursor: pointer; }
.match-card.clickable:hover { border-color: var(--accent); }
.match-card.completed { background: var(--bg-secondary); }

.match-num {
  font-size   : 11px;
  color       : var(--text-tertiary);
  min-width   : 22px;
  font-weight : 500;
}

.team-a {
  flex        : 1;
  font-size   : 13px;
  font-weight : 500;
  text-align  : right;
}

.team-b {
  flex        : 1;
  font-size   : 13px;
  font-weight : 500;
}

.vs {
  font-size   : 11px;
  color       : var(--text-tertiary);
  font-weight : 500;
  padding     : 0 6px;
}

.match-score {
  font-size   : 12px;
  font-weight : 500;
  color       : var(--accent);
  white-space : nowrap;
  min-width   : 50px;
  text-align  : center;
}

.match-action {
  font-size : 11px;
  color     : var(--text-tertiary);
  min-width : 70px;
  text-align: right;
}

.tbd         { color: var(--text-tertiary) !important; font-style: italic; }
.winner-bold { font-weight: 700; color: var(--accent) !important; }

/* Status badges */
.status-badge {
  font-size     : 10px;
  font-weight   : 500;
  padding       : 2px 7px;
  border-radius : 99px;
  white-space   : nowrap;
}
.badge-pending   { background: var(--bg-secondary); color: var(--text-tertiary); }
.badge-active    { background: var(--bg-warning); color: var(--text-warning); }
.badge-completed { background: var(--bg-success); color: var(--text-success); }
.badge-teal      { background: var(--bg-success); color: var(--text-success); }

/* =============================================================================
   16. SCORE ENTRY MODAL
   ============================================================================= */
.modal-overlay {
  display         : none;
  position        : fixed;
  inset           : 0;
  background      : rgba(0,0,0,0.45);
  z-index         : 100;
  justify-content : center;
  align-items     : center;
  padding         : 1rem;
  backdrop-filter : blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background    : var(--bg-primary);
  border        : 0.5px solid var(--border-light);
  border-radius : var(--radius-xl);
  padding       : 1.5rem;
  width         : 100%;
  max-width     : 380px;
  box-shadow    : 0 8px 40px rgba(0,0,0,0.2);
  animation     : modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
  font-size     : 15px;
  font-weight   : 500;
  margin-bottom : 1.25rem;
}

.modal-teams {
  display               : grid;
  grid-template-columns : 1fr auto 1fr;
  align-items           : center;
  gap                   : 10px;
  margin-bottom         : 1.25rem;
}

.modal-team-name {
  font-size   : 13px;
  font-weight : 500;
  text-align  : center;
}

.modal-vs { font-size: 11px; color: var(--text-tertiary); }

.score-inputs {
  display               : grid;
  grid-template-columns : 1fr auto 1fr;
  align-items           : center;
  gap                   : 10px;
  margin-bottom         : 1.25rem;
}

.score-input {
  width         : 100%;
  height        : 56px;
  border        : 0.5px solid var(--border-mid);
  border-radius : var(--radius-md);
  background    : var(--bg-secondary);
  color         : var(--text-primary);
  font-size     : 26px;
  font-weight   : 500;
  text-align    : center;
  outline       : none;
  transition    : border-color 0.15s;
}
.score-input:focus { border-color: var(--accent); }

.score-sep {
  font-size  : 20px;
  color      : var(--text-tertiary);
  text-align : center;
}

.modal-error {
  font-size     : 12px;
  color         : var(--text-error);
  margin-bottom : 0.75rem;
  display       : none;
}
.modal-error.visible { display: block; }

/* Edit result note */
.modal-edit-note {
  font-size     : 11px;
  color         : var(--text-warning);
  background    : var(--bg-warning);
  border-radius : var(--radius-sm);
  padding       : 4px 8px;
  margin-bottom : 0.75rem;
  display       : none;
}
.modal-edit-note.visible { display: block; }

/* =============================================================================
   17. BRACKET PAGE (bracket.html)
   ============================================================================= */

/* Bracket canvas — horizontally scrollable */
.bracket-page-header {
  display         : flex;
  align-items     : center;
  justify-content : space-between;
  margin-bottom   : 1.5rem;
  flex-wrap       : wrap;
  gap             : 0.75rem;
}

.bracket-page-title { font-size: 20px; font-weight: 500; }
.bracket-page-meta  { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; }

.bracket-canvas-wrap {
  overflow-x    : auto;
  overflow-y    : visible;
  padding-bottom: 1.5rem;
}

.bracket-canvas {
  display     : flex;
  align-items : flex-start;
  gap         : 0;
  min-width   : max-content;
  padding     : 1rem 0.5rem;
}

/* Each round column */
.bc-round {
  display        : flex;
  flex-direction : column;
  min-width      : 180px;
  padding        : 0 16px;
  position       : relative;
}

/* Vertical connector line between rounds */
.bc-round::after {
  content    : '';
  position   : absolute;
  right      : 0;
  top        : 10%;
  height     : 80%;
  width      : 1px;
  background : var(--border-light);
}
.bc-round:last-child::after { display: none; }

.bc-round-label {
  font-size      : 10px;
  text-transform : uppercase;
  letter-spacing : 0.08em;
  color          : var(--text-tertiary);
  font-weight    : 600;
  text-align     : center;
  margin-bottom  : 16px;
  padding-bottom : 8px;
  border-bottom  : 0.5px solid var(--border-light);
}

.bc-matches {
  display        : flex;
  flex-direction : column;
  gap            : 12px;
  flex           : 1;
  justify-content: space-around;
}

/* Individual bracket match card */
.bc-match {
  background    : var(--bg-primary);
  border        : 1px solid var(--border-light);
  border-radius : var(--radius-md);
  overflow      : hidden;
  transition    : border-color 0.15s, box-shadow 0.15s;
  cursor        : default;
}
.bc-match.clickable { cursor: pointer; }
.bc-match.clickable:hover {
  border-color : var(--accent);
  box-shadow   : 0 2px 12px rgba(29,158,117,0.15);
}
.bc-match.done { border-color: var(--accent); }
.bc-match.tbd-match { opacity: 0.5; }

/* Each team row within a bracket match */
.bc-team {
  display         : flex;
  align-items     : center;
  justify-content : space-between;
  padding         : 7px 10px;
  font-size       : 12px;
  border-bottom   : 0.5px solid var(--border-light);
  min-height      : 34px;
}
.bc-team:last-child { border-bottom: none; }

.bc-team-name {
  white-space   : nowrap;
  overflow      : hidden;
  text-overflow : ellipsis;
  max-width     : 120px;
}

.bc-team.tbd .bc-team-name  { color: var(--text-tertiary); font-style: italic; }
.bc-team.bye .bc-team-name  { color: var(--text-tertiary); font-style: italic; }
.bc-team.winner { background: var(--bg-success); }
.bc-team.winner .bc-team-name { font-weight: 600; color: var(--accent); }

.bc-score {
  font-size   : 12px;
  font-weight : 600;
  color       : var(--text-tertiary);
  margin-left : 8px;
  flex-shrink : 0;
}
.bc-team.winner .bc-score { color: var(--accent); }

/* Champion display */
.champion-box {
  border-radius : var(--radius-lg);
  padding       : 1.5rem;
  text-align    : center;
  color         : #fff;
  margin-top    : 1.5rem;
}
.champion-box .trophy { font-size: 36px; margin-bottom: 0.5rem; }
.champion-box h2 { font-size: 13px; font-weight: 400; opacity: 0.8; margin-bottom: 4px; }
.champion-box .champion-name { font-size: 22px; font-weight: 600; }
.champion-box.is-visible {animation: champion-shimmer 3s ease-in-out infinite,
                     champion-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;}

/* Group stage bracket labels */
.group-bracket-label {
  font-size      : 12px;
  font-weight    : 500;
  color          : var(--text-secondary);
  margin-bottom  : 8px;
  padding-bottom : 6px;
  border-bottom  : 0.5px solid var(--border-light);
}

/* No bracket state */
.no-bracket {
  text-align  : center;
  padding     : 3rem 1rem;
  color       : var(--text-tertiary);
  font-size   : 13px;
  line-height : 1.8;
}

/* =============================================================================
   18. DEBUG LOG PANEL
   ============================================================================= */
.log-toggle {
  font-size   : 11px;
  color       : var(--text-tertiary);
  cursor      : pointer;
  user-select : none;
  display     : inline-flex;
  align-items : center;
  gap         : 4px;
  margin-top  : 1.5rem;
  padding     : 4px 0;
}
.log-toggle:hover { color: var(--text-secondary); }

.log-panel {
  display       : none;
  background    : var(--bg-secondary);
  border        : 0.5px solid var(--border-light);
  border-radius : var(--radius-md);
  padding       : 10px 12px;
  margin-top    : 6px;
  max-height    : 220px;
  overflow-y    : auto;
  font-family   : var(--font-mono);
  font-size     : 11px;
  line-height   : 1.6;
}
.log-panel.open { display: block; }

.log-entry         { display: flex; gap: 10px; }
.log-time          { color: var(--text-tertiary); flex-shrink: 0; }
.log-level-INFO    { color: var(--accent-dark); flex-shrink: 0; min-width: 40px; }
.log-level-WARN    { color: #d4860a; flex-shrink: 0; min-width: 40px; }
.log-level-ERROR   { color: var(--danger); flex-shrink: 0; min-width: 40px; }
.log-level-DEBUG   { color: #7a9ec2; flex-shrink: 0; min-width: 40px; }
.log-msg           { color: var(--text-secondary); word-break: break-all; }

.log-actions       { display: flex; gap: 8px; margin-bottom: 6px; }
.log-btn {
  font-size     : 11px;
  color         : var(--text-tertiary);
  cursor        : pointer;
  background    : none;
  border        : 0.5px solid var(--border-light);
  border-radius : 4px;
  padding       : 2px 8px;
}
.log-btn:hover { color: var(--text-primary); border-color: var(--border-mid); }

/* =============================================================================
   19. UTILITIES
   ============================================================================= */

/* Loading spinner */
.spinner {
  display       : inline-block;
  width         : 14px;
  height        : 14px;
  border        : 2px solid rgba(255,255,255,0.35);
  border-top    : 2px solid #fff;
  border-radius : 50%;
  flex-shrink   : 0;
}

/* Dark spinner variant (for non-primary buttons) */
.spinner.dark {
  border-color     : rgba(0,0,0,0.15);
  border-top-color : var(--text-primary);
}

/* Divider */
.divider {
  height     : 0.5px;
  background : var(--border-light);
  margin     : 1rem 0;
}

/* Muted text */
.text-muted { color: var(--text-tertiary); font-size: 12px; }

/* =============================================================================
   20. ANIMATIONS
   ============================================================================= */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner { animation: spin 0.7s linear infinite; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen.active { animation: fade-in 0.18s ease; }
/***LOGIN PAGE***/
.login-wrap {
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem;
      background: var(--bg-secondary);
    }
    .login-card {
      background: var(--bg-primary);
      border: 0.5px solid var(--border-light);
      border-radius: var(--radius-lg);
      padding: 2rem;
      width: 100%;
      max-width: 400px;
    }
    .login-logo  { text-align:center;font-size:32px;margin-bottom:0.5rem; }
    .login-title { text-align:center;font-size:18px;font-weight:600;color:var(--text-primary);margin-bottom:0.25rem; }
    .login-sub   { text-align:center;font-size:12px;color:var(--text-tertiary);margin-bottom:1.5rem; }

    .auth-tabs {
      display: flex;
      border-bottom: 1px solid var(--border-light);
      margin-bottom: 1.5rem;
    }
    .auth-tab {
      flex: 1;
      padding: 8px;
      font-size: 13px;
      font-weight: 500;
      text-align: center;
      cursor: pointer;
      color: var(--text-tertiary);
      border-bottom: 2px solid transparent;
      margin-bottom: -1px;
      transition: color 0.15s, border-color 0.15s;
    }
    .auth-tab.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
    }
    .auth-panel { display: none; }
    .auth-panel.active { display: block; }

    .login-field { margin-bottom: 1rem; }
    .login-field label {
      display: block;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-secondary);
      margin-bottom: 5px;
    }
    .login-field input {
      width: 100%;
      padding: 10px 12px;
      font-size: 14px;
      border: 1px solid var(--border-light);
      border-radius: var(--radius-md);
      background: var(--bg-secondary);
      color: var(--text-primary);
      box-sizing: border-box;
      transition: border-color 0.15s;
    }
    .login-field input:focus { outline:none;border-color:var(--accent); }

    .login-btn {
      width: 100%;
      font-size: 14px;
      font-weight: 600;
      color: var(--accent);
      border: none;
      border-radius: var(--radius-md);
      cursor: pointer;
      margin-top: 0.5rem;
      transition: opacity 0.15s;
      display:flex;
      align-items:center;
      gap:10px; 
      padding:8px 1rem; 
      background:var(--bg-secondary); 
      border-bottom:0.5px solid var(--border-light); 
      justify-content:center;
    }
    .login-btn:hover    { opacity: 0.88; }
    .login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

    .auth-msg {
      display: none;
      font-size: 12px;
      padding: 8px 12px;
      border-radius: var(--radius-md);
      margin-top: 0.75rem;
    }
    .auth-msg.error {
      display: block;
      background: var(--bg-danger, #fef2f2);
      border: 0.5px solid var(--danger);
      color: var(--danger);
    }
    .auth-msg.success {
      display: block;
      background: var(--bg-success);
      border: 0.5px solid var(--accent);
      color: var(--accent);
    }
    .login-guest {
      text-align: center;
      margin-top: 1.25rem;
      font-size: 12px;
      color: var(--text-tertiary);
    }
    .login-guest a { color:var(--accent);text-decoration:none;font-weight:500; }

    .password-wrap { position: relative; }
    .password-toggle {
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 14px;
      cursor: pointer;
      color: var(--text-tertiary);
      background: none;
      border: none;
      padding: 2px;
    }
    
     /* =========================================================================
     STATS PAGE — additional styles layered on top of styles.css
     ========================================================================= */

  .stats-page { max-width: 700px; margin: 0 auto; padding: 0 1rem 3rem; }

  /* Page header */
  .stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0 0.75rem;
    flex-wrap: wrap;
    gap: 8px;
  }
  .stats-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
  }
  .stats-header p {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 2px 0 0;
  }

  /* Search / filter bar */
  .search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }
  
  .search-bar input,
  .search-bar select {
    flex: 1;
    min-width: 140px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
  }
  .search-bar input:focus,
  .search-bar select:focus {
    outline: none;
    border-color: var(--accent);
  }

  /* Tab nav — reuse .tab / .tab-panel from styles.css */

  /* Team card — used in Teams tab */
  .team-card {
    background: var(--bg-primary);
    border: 0.5px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .team-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(29,158,117,0.12);
  }
  .team-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
  }
  .team-card-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
  }
  .team-card-stats {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
  }
  .team-card-stat {
    text-align: center;
  }
  .team-card-stat-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
  }
  .team-card-stat-lbl {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* Team detail panel */
  .team-detail {
    background: var(--bg-primary);
    border: 0.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
  }
  .team-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 8px;
  }
  .team-detail-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
  }
  .team-detail-category {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 3px;
  }
  .team-detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 1rem;
  }
  .detail-stat-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 10px 8px;
    text-align: center;
  }
  .detail-stat-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
  }
  .detail-stat-lbl {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
  }

  /* Tournament history table */
  .history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }
  .history-table th {
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    background: var(--bg-secondary);
  }
  .history-table td {
    padding: 8px;
    border-top: 0.5px solid var(--border-light);
    color: var(--text-primary);
  }
  .history-table tr:hover td { background: var(--bg-secondary); }

  /* Head-to-head */
  .h2h-selector {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
    margin-bottom: 1rem;
  }
  .h2h-vs {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-align: center;
  }
  .h2h-summary {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
  }
  .h2h-wins {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent);
  }
  .h2h-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
  }
  .h2h-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-tertiary);
    font-weight: 300;
  }

  /* Rankings table */
  .rankings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 0.5px solid var(--border-light);
  }
  .rankings-table th {
    padding: 8px 10px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
  }
  .rankings-table th:hover { color: var(--accent); }
  .rankings-table th.sorted { color: var(--accent); }
  .rankings-table td {
    padding: 8px 10px;
    border-top: 0.5px solid var(--border-light);
    color: var(--text-primary);
  }
  .rankings-table tr:hover td { background: var(--bg-secondary); }
  .rank-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    width: 28px;
  }
  .rank-1 { color: #f59e0b; }
  .rank-2 { color: #94a3b8; }
  .rank-3 { color: #b45309; }

  /* Empty / loading states */
  .stats-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
    font-size: 13px;
  }
  .stats-empty-icon { font-size: 32px; display: block; margin-bottom: 0.5rem; }

  .spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* Win rate bar */
  .win-bar-wrap {
    background: var(--bg-secondary);
    border-radius: 99px;
    height: 4px;
    width: 60px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
  }
  .win-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
  }

  /* Placement badge */
  .placement-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
  }
  .placement-1 { background: #fef3c7; color: #f59e0b; }
  .placement-2 { background: #f1f5f9; color: #94a3b8; }
  .placement-3 { background: #fef3c7; color: #b45309; }
  .placement-other { background: var(--bg-secondary); color: var(--text-tertiary); }
  
  /* =============================================================================
   BRACKET PREMIUM STYLES — append to end of styles.css
   Covers: glassmorphism cards, bezier connectors (via bracket.js update),
   champion overlay, badge toggle, tab bar, hover path glow, confetti glow,
   match status pills, mobile polish.
   ============================================================================= */

/* ── Bracket page background ─────────────────────────────────────────────── */
.bracket-page-bg {
  background    : radial-gradient(ellipse at top, #0f2027 0%, #1a1a2e 50%, #16213e 100%);
  min-height    : 100vh;
}

/* ── Glassmorphism card override (SVG cards use fill=, but HTML fallback uses this) ── */
.bc-match {
  background    : rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border        : 0.5px solid rgba(255, 255, 255, 0.10);
  box-shadow    : 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.06);
  transition    : border-color 0.2s, box-shadow 0.2s;
}
.bc-match:hover {
  border-color  : rgba(29, 158, 117, 0.55);
  box-shadow    : 0 4px 20px rgba(29, 158, 117, 0.18), inset 0 1px 0 rgba(255,255,255,0.08);
}
.bc-match.done {
  border-color  : rgba(29, 158, 117, 0.6);
  box-shadow    : 0 0 12px rgba(29, 158, 117, 0.15);
}

/* ── Connector glow on SVG path hover ────────────────────────────────────── */
/* bracket.js adds data-team-id to each <path>. JS applies .path-glow via hover. */
.bc-path-glow {
  stroke        : var(--accent-bright) !important;
  stroke-width  : 2px !important;
  opacity       : 0.9 !important;
  filter        : drop-shadow(0 0 4px rgba(29,158,117,0.7));
  transition    : stroke 0.2s, opacity 0.2s;
}

/* ── Badge / seed toggle ─────────────────────────────────────────────────── */
/* These work with SVG class="bc-badge" / class="bc-seed-num" inside #bc-wrap */
#bc-wrap .bc-badge    { opacity: 0; transition: opacity 0.2s; }
#bc-wrap .bc-seed-num { opacity: 1; transition: opacity 0.2s; }
#bc-wrap.show-badges .bc-badge    { opacity: 1; }
#bc-wrap.show-badges .bc-seed-num { opacity: 0; }

/* ── Tab bar — sliding underline indicator ───────────────────────────────── */
.bc-tab-bar {
  display          : none;
  position         : relative;
  background       : var(--bg-secondary, #1a1a2e);
  border-bottom    : 0.5px solid var(--border-light, #2a2a4a);
}
.bc-tab-btn {
  position         : relative;
  flex             : 1;
  padding          : 10px 0;
  font-size        : 11px;
  font-weight      : 700;
  text-transform   : uppercase;
  letter-spacing   : 0.08em;
  color            : var(--text-tertiary, #666);
  background       : transparent;
  border           : none;
  cursor           : pointer;
  font-family      : inherit;
  transition       : color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.bc-tab-btn::after {
  content          : '';
  position         : absolute;
  bottom           : 0;
  left             : 20%;
  width            : 60%;
  height           : 2px;
  border-radius    : 2px 2px 0 0;
  background       : var(--accent-bright);
  transform        : scaleX(0);
  transform-origin : center;
  transition       : transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.bc-tab-btn.active        { color: var(--accent-bright); }
.bc-tab-btn.active::after { transform: scaleX(1); }

/* Tab panels */
.bc-tab-panel             { display: none; overflow-x: auto; }
.bc-tab-panel.active      { display: block; }

/* ── Mobile tab auto-activate ────────────────────────────────────────────── */
@media (max-width: 768px) {
  #bc-wrap .bc-zoom-controls { display: none !important; }
  #bc-wrap .bc-zoom-hint     { display: none !important; }
  #bc-wrap .bc-tab-bar       { display: flex !important; }
  #bc-wrap .bc-inner         { display: none !important; }
  #bc-wrap .bc-tab-panel     { display: none; }
  #bc-wrap .bc-tab-panel.active { display: block; }
  #bc-wrap { cursor: default !important; touch-action: pan-x pan-y; }
}
@media (min-width: 769px) {
  #bc-wrap .bc-tab-bar   { display: none !important; }
  #bc-wrap .bc-tab-panel { display: none !important; }
  #bc-wrap .bc-inner     { display: inline-block !important; }
  #bc-wrap .bc-zoom-controls { display: flex !important; }
}

/* ── Match status pills ──────────────────────────────────────────────────── */
.match-pill {
  display          : inline-flex;
  align-items      : center;
  gap              : 4px;
  padding          : 2px 6px;
  border-radius    : 99px;
  font-size        : 9px;
  font-weight      : 700;
  letter-spacing   : 0.06em;
  text-transform   : uppercase;
  line-height      : 1;
}
.match-pill-live {
  background       : rgba(232, 64, 64, 0.15);
  color            : #E84040;
  border           : 0.5px solid rgba(232, 64, 64, 0.4);
}
.match-pill-live::before {
  content          : '';
  display          : inline-block;
  width            : 5px;
  height           : 5px;
  border-radius    : 50%;
  background       : #E84040;
  animation        : pill-pulse 1.2s ease-in-out infinite;
}
.match-pill-final {
  background       : rgba(29, 158, 117, 0.15);
  color            : var(--accent-bright);
  border           : 0.5px solid rgba(29, 158, 117, 0.4);
}
@keyframes pill-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ── Champion box — gold hero card with glow animation ───────────────────── */
.champion-box {
  position         : relative;
  overflow         : hidden;
  background       : linear-gradient(135deg,
                       #7c5c00 0%, #b8860b 25%, #ffd700 50%,
                       #b8860b 75%, #7c5c00 100%);
  background-size  : 200% 200%;
  border-radius    : var(--radius-lg);
  padding          : 2rem 1.5rem;
  text-align       : center;
  color            : #1a1200;
  margin-top       : 1.5rem;
  margin-bottom    : 1.5rem;
  animation        : none;
  box-shadow       : 0 0 40px rgba(255, 215, 0, 0.35),
                     0 0 80px rgba(255, 215, 0, 0.12),
                     0 8px 32px rgba(0, 0, 0, 0.4);
}
.champion-box::before {
  content          : '';
  position         : absolute;
  inset            : 0;
  background       : radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.25) 0%, transparent 70%);
  pointer-events   : none;
}
.champion-box .trophy {
  font-size        : 48px;
  display          : block;
  margin-bottom    : 0.5rem;
  filter           : drop-shadow(0 0 12px rgba(255,215,0,0.6));
  animation        : trophy-float 2.5s ease-in-out infinite;
}
.champion-box h2 {
  font-size        : 11px;
  font-weight      : 600;
  letter-spacing   : 0.12em;
  text-transform   : uppercase;
  opacity          : 0.7;
  margin-bottom    : 6px;
}
.champion-box .champion-name {
  font-size        : 26px;
  font-weight      : 800;
  letter-spacing   : -0.01em;
  text-shadow      : 0 2px 8px rgba(0,0,0,0.2);
}

@keyframes champion-shimmer {
  0%   { background-position: 0% 50%;   }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%;   }
}
@keyframes champion-appear {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1);    }
}
@keyframes trophy-float {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-6px); }
}

/* ── Confetti particles (injected by bracket.js when champion is set) ─────── */
.champion-confetti {
  position         : absolute;
  top              : 0;
  left             : 0;
  width            : 100%;
  height           : 100%;
  pointer-events   : none;
  overflow         : hidden;
}
.confetti-dot {
  position         : absolute;
  width            : 6px;
  height            : 6px;
  border-radius    : 50%;
  animation        : confetti-fall linear infinite;
  opacity          : 0.8;
}
@keyframes confetti-fall {
  0%   { transform: translateY(-10px) rotate(0deg);   opacity: 0.9; }
  100% { transform: translateY(120px) rotate(360deg); opacity: 0; }
}

/* ── Zoom controls ───────────────────────────────────────────────────────── */
.bc-zoom-controls {
  position         : absolute;
  top              : 8px;
  right            : 10px;
  display          : flex;
  gap              : 4px;
  z-index          : 10;
}
.bc-zoom-btn {
  width            : 30px;
  height           : 30px;
  border           : 0.5px solid rgba(255,255,255,0.12);
  border-radius    : 8px;
  background       : rgba(255, 255, 255, 0.07);
  backdrop-filter  : blur(6px);
  color            : var(--text-secondary, #ccc);
  font-size        : 16px;
  cursor           : pointer;
  display          : flex;
  align-items      : center;
  justify-content  : center;
  transition       : background 0.15s, border-color 0.15s;
}
.bc-zoom-btn:hover {
  background       : rgba(29, 158, 117, 0.2);
  border-color     : rgba(29, 158, 117, 0.5);
  color            : var(--accent-bright);
}

/* ── Zoom hint ───────────────────────────────────────────────────────────── */
.bc-zoom-hint {
  position         : absolute;
  bottom           : 8px;
  right            : 10px;
  font-size        : 10px;
  color            : var(--text-tertiary, #555);
  pointer-events   : none;
  letter-spacing   : 0.02em;
}

/* ── Header toggle buttons ───────────────────────────────────────────────── */
.btn-toggle {
  display          : inline-flex;
  align-items      : center;
  gap              : 5px;
  padding          : 5px 10px;
  font-size        : 12px;
  font-weight      : 500;
  border-radius    : var(--radius-md, 6px);
  border           : 0.5px solid var(--border-light, #444);
  background       : var(--bg-secondary, #1e1e1e);
  color            : var(--text-secondary, #bbb);
  cursor           : pointer;
  font-family      : inherit;
  transition       : background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-toggle:hover  { background: var(--bg-tertiary, #2a2a2a); color: var(--text-primary, #eee); }
.btn-toggle.active { background: var(--accent-bright); color: #fff; border-color: var(--accent-bright); }
.btn-toggle svg    { width: 14px; height: 14px; flex-shrink: 0; }

/* Hide Tabs button on desktop — not needed when full bracket is always shown */
@media (min-width: 769px) {
  #btn-tabs { display: none; }
}

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
  .app-nav, .bottom-nav, .bracket-page-actions,
  .bc-zoom-controls, .bc-zoom-hint, .bc-tab-bar { display: none !important; }
  body          { background: #fff !important; }
  .bc-match     { break-inside: avoid; }
  .bc-zoom-wrap { overflow: visible !important; height: auto !important; }
  .bc-inner     { transform: none !important; }
}
