:root {
  /* Globe Life Brand Colors */
  --gl-green: #319B42;
  --gl-green-dark: #267a34;
  --gl-green-light: #43A251;
  --gl-blue: #00558C;
  --gl-blue-dark: #003d66;
  --gl-blue-light: #0070b8;

  /* Backgrounds — deep Globe Life navy */
  --bg: #040f1a;
  --bg2: #071828;
  --bg3: #0b2035;
  --border: #0f3352;
  --border-accent: #1a5a3a;

  /* Accent aliases */
  --gold: #319B42;
  --gold2: #267a34;
  --gold3: #43A251;
  --blue: #00558C;
  --blue2: #003d66;
  --blue3: #0070b8;
  --red: #ef4444;
  --red2: #dc2626;
  --purple: #00558C;
  --green: #319B42;

  /* Text */
  --text: #f0f8f2;
  --text2: #7abf8e;
  --text3: #3d7a55;

  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  background-image: 
    radial-gradient(ellipse at top left, rgba(0,85,140,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(49,155,66,0.08) 0%, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: auto;
}

/* Particle canvas */
#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(4,15,26,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--gl-green);
  box-shadow: 0 2px 20px rgba(49,155,66,0.15);
}
.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 12px #319B42);
  animation: pulse-gold 2s ease-in-out infinite;
}
@keyframes pulse-gold {
  0%, 100% { filter: drop-shadow(0 0 8px #319B42); }
  50% { filter: drop-shadow(0 0 22px #319B42) drop-shadow(0 0 40px #00558C); }
}
.logo-title {
  display: block;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #43A251, #ffffff, #43A251);
  background-size: 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 0% }
  100% { background-position: 200% }
}
.logo-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.header-actions { display: flex; align-items: center; gap: 10px; }

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}
.btn-live {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 0 20px rgba(239,68,68,0.3);
}
.btn-live:hover {
  box-shadow: 0 0 30px rgba(239,68,68,0.5);
  transform: translateY(-1px);
}
.btn-live.active {
  background: linear-gradient(135deg, #319B42, #267a34);
  box-shadow: 0 0 20px rgba(49,155,66,0.4);
  animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(49,155,66,0.4); }
  50% { box-shadow: 0 0 40px rgba(49,155,66,0.7); }
}
.btn-icon {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 1rem;
}
.btn-icon:hover { background: var(--bg2); }
.btn-cancel { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-cancel:hover { background: var(--bg2); }
.btn-confirm {
  background: linear-gradient(135deg, var(--gl-green), var(--gl-green-dark));
  color: #fff;
  font-weight: 700;
}
.btn-confirm:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(49,155,66,0.5); }
.btn-dismiss {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 1rem;
  padding: 12px 30px;
  border-radius: 30px;
  margin-top: 20px;
}
.btn-dismiss:hover { background: rgba(255,255,255,0.1); }

/* Tournament Tabs */
.tournament-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 24px 0;
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  color: var(--text2);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); background: var(--bg3); }
.tab-btn.active {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border);
  position: relative;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gl-green), var(--gl-blue), var(--gl-green));
}
.tab-icon { font-size: 1.1rem; }
.tab-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
}
.tab-badge.complete { background: rgba(34,197,94,0.2); color: var(--green); }
.tab-badge.live { background: rgba(239,68,68,0.2); color: var(--red); }

/* Bracket Sub-tabs */
.bracket-tabs {
  display: flex;
  gap: 8px;
  padding: 0 24px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 9;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}
/* Override to make bracket-tabs full width */
.bracket-tabs {
  max-width: 100%;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.bracket-tabs-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 0 24px;
}
.bracket-tab {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text2);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.bracket-tab:hover { color: var(--text); }
.bracket-tab.active { color: var(--green); border-bottom-color: var(--green); }
.bracket-tab[data-bracket="losers"].active { color: var(--blue3); border-bottom-color: var(--blue3); }

/* Main */
.main {
  max-width: none;
  margin: 0 auto;
  padding: 32px 24px;
  position: relative;
  z-index: 1;
}

/* Bracket Container */
.bracket-container {
  overflow-x: auto;
  padding-bottom: 20px;
}

/* Bracket tree round header */
.bracket-round-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 4px 0;
}

/* Bracket Layout */
.bracket-view {
  display: flex;
  gap: 0;
  min-width: max-content;
  align-items: flex-start;
  padding: 16px 0;
}

.round-col {
  display: flex;
  flex-direction: column;
  min-width: 240px;
}

.round-header {
  text-align: center;
  padding: 10px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.matches-col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1;
  gap: 20px;
  padding: 12px 8px;
}

/* Match Card — VS style */
.match-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  transition: all 0.2s;
  position: relative;
  min-width: 240px;
}
.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  height: 0;
  position: relative;
  z-index: 4;
  overflow: visible;
}
.vs-badge {
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 2px 8px;
  border-radius: 20px;
  position: absolute;
  top: 0;
  transform: translateY(-50%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  pointer-events: none;
  white-space: nowrap;
}
.match-card.done .vs-badge { display: none; }
.match-card.pending:hover { border-color: var(--blue3); box-shadow: 0 0 20px rgba(0,85,140,0.3); }
.match-card.live-mode.pending { cursor: pointer; }
.match-card.live-mode.pending:hover { 
  border-color: var(--green); 
  box-shadow: 0 0 20px rgba(49,155,66,0.4);
}
.match-card.live-mode.pending::after {
  content: '✏️ Click to score';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--green);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}
.match-card.live-mode.pending:hover::after { opacity: 1; }

.participant {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  height: 42px;
  transition: background 0.15s;
  position: relative;
  overflow: hidden;
}
.participant:first-child { 
  border-bottom: 2px solid var(--bg);
}
.participant.winner { background: rgba(49,155,66,0.15); }
.participant.winner .p-name { color: var(--gold3); font-weight: 700; }
.participant.loser { opacity: 0.45; background: rgba(0,0,0,0.2); }
.participant.loser .p-name { text-decoration: line-through; color: var(--text3); }
.participant.tbd { opacity: 1; }
.participant.champion { background: rgba(49,155,66,0.25); }
.participant.champion .p-name { color: var(--gold3); font-weight: 800; }

.p-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg3);
  border: 2px solid var(--border);
  flex-shrink: 0;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-weight: 700;
  overflow: hidden;
}
.p-avatar img { width: 100%; height: 100%; object-fit: cover; }
.participant.winner .p-avatar { border-color: var(--green); box-shadow: 0 0 8px rgba(49,155,66,0.5); }
.participant.champion .p-avatar { border-color: var(--gold3); box-shadow: 0 0 12px rgba(75,196,94,0.6); }

.p-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-score {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text2);
  min-width: 50px;
  text-align: right;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
}
.participant.winner .p-score { color: var(--gold3); }

.match-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 12px;
  color: var(--text3);
  background: var(--bg);
  border-top: 1px solid var(--border);
  text-align: center;
}

.winner-crown {
  position: absolute;
  top: 50%;
  right: -18px;
  transform: translateY(-50%);
  font-size: 1rem;
  z-index: 2;
}

/* Connector lines between rounds */
.round-col:not(:last-child) .match-card::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: var(--border);
  pointer-events: none;
}

/* Champion card */
.champion-card {
  background: linear-gradient(135deg, rgba(49,155,66,0.25), rgba(0,85,140,0.2));
  border: 2px solid var(--gl-green);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: 0 0 50px rgba(49,155,66,0.3), 0 0 20px rgba(0,85,140,0.2);
  min-width: 200px;
}
.champion-trophy { font-size: 3rem; display: block; margin-bottom: 8px; }
.champion-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 6px;
}
.champion-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold3);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text3);
}
.empty-state .e-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.2rem; color: var(--text2); margin-bottom: 8px; }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 400px;
  max-width: 95vw;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }
.modal-body { padding: 24px; }
.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.score-player {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.name-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
}
.name-input:focus { outline: none; border-color: var(--gl-blue-light); }
.score-input {
  width: 90px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  font-family: 'Inter', sans-serif;
}
.score-input:focus { outline: none; border-color: var(--green); }
.btn-danger { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.score-vs {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text3);
  margin: 4px 0;
}
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* CELEBRATION */
.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.92);
}
#confettiCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.celebration-content {
  text-align: center;
  z-index: 2001;
  animation: celebration-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes celebration-in {
  from { transform: scale(0.5) translateY(40px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.celebration-icon {
  font-size: 5rem;
  display: block;
  margin-bottom: 16px;
  animation: bounce 0.6s ease-in-out infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-15px); }
}
.celebration-label {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--gl-green-light);
  margin-bottom: 8px;
}
.celebration-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 4rem;
  font-weight: 700;
  color: white;
  line-height: 1;
  text-shadow: 0 0 40px rgba(49,155,66,0.9);
  margin-bottom: 8px;
  animation: name-glow 1.5s ease-in-out infinite;
}
@keyframes name-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(49,155,66,0.6), 0 0 40px rgba(0,85,140,0.4); }
  50% { text-shadow: 0 0 60px rgba(49,155,66,1), 0 0 100px rgba(0,85,140,0.7); }
}
.celebration-sub {
  font-size: 1.1rem;
  color: var(--text2);
  margin-bottom: 8px;
}
.celebration-video {
  margin-top: 20px;
  width: 480px;
  max-width: 90vw;
  border-radius: 12px;
  overflow: hidden;
}
.celebration-video iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
}

/* SETTINGS */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 480px;
  max-width: 95vw;
  box-shadow: var(--shadow);
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.settings-header h2 { font-size: 1.1rem; font-weight: 700; }
.settings-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.setting-group { display: flex; flex-direction: column; gap: 6px; }
.setting-group label { font-size: 0.85rem; font-weight: 600; color: var(--text2); }
.settings-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  width: 100%;
}
.settings-input:focus { outline: none; border-color: var(--gl-green); }
.setting-group small { font-size: 0.75rem; color: var(--text3); }
.setting-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Live mode indicator */
.live-indicator {
  position: fixed;
  top: 80px;
  right: 24px;
  background: rgba(34,197,94,0.15);
  border: 1px solid var(--green);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 1px;
  z-index: 50;
  animation: live-pulse 1.5s ease-in-out infinite;
  display: none;
}
.live-indicator.show { display: block; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* Responsive */
@media (max-width: 768px) {
  .header-inner { padding: 12px 16px; }
  .logo-title { font-size: 1.1rem; }
  .tournament-tabs { padding: 12px 16px 0; gap: 4px; }
  .tab-btn { padding: 10px 14px; font-size: 0.8rem; }
  .tab-badge { display: none; }
  .main { padding: 20px 16px; }
  .celebration-name { font-size: 2.5rem; }
}
