/* ═══════════════════════════════════════════════════════════════
   CAMPEONATO DE DOMINÓ — Premium Dark Theme
   jrobotweb.com
═══════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #0a0b14;
  --bg-secondary: #10121f;
  --bg-card: #141728;
  --bg-card-hover: #1a1f35;
  --bg-input: #0d0f1c;

  --accent: #7c3aed;
  --accent-light: #a855f7;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --silver: #94a3b8;
  --bronze: #cd7c54;
  --green: #10b981;
  --green-light: #34d399;
  --red: #ef4444;
  --red-light: #f87171;
  --blue: #3b82f6;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;

  --border: rgba(124, 58, 237, 0.2);
  --border-strong: rgba(124, 58, 237, 0.4);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --font-main: 'Outfit', sans-serif;
  --font-alt: 'Space Grotesk', sans-serif;

  --nav-height: 64px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ════════════════════════════════════
   SCREENS
════════════════════════════════════ */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ════════════════════════════════════
   SPLASH SCREEN
════════════════════════════════════ */
#screen-splash {
  display: none;
  position: relative;
  min-height: 100vh;
  background: radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.2) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(245,158,11,0.15) 0%, transparent 50%),
              var(--bg-primary);
  overflow: hidden;
}
#screen-splash.active { display: flex; align-items: center; justify-content: center; }

.splash-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.domino-float {
  position: absolute;
  font-size: clamp(2rem, 5vw, 4rem);
  opacity: 0.07;
  animation: floatDomino 8s ease-in-out infinite;
  user-select: none;
}
.d1 { top: 10%; left: 5%; animation-delay: 0s; }
.d2 { top: 60%; left: 3%; animation-delay: 1.5s; }
.d3 { top: 20%; right: 8%; animation-delay: 0.8s; }
.d4 { top: 75%; right: 5%; animation-delay: 2s; }
.d5 { top: 45%; left: 50%; animation-delay: 0.5s; }
.d6 { top: 85%; left: 40%; animation-delay: 1.2s; }

@keyframes floatDomino {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.splash-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
}

.logo-badge {
  font-size: 4rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 30px var(--gold));
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 20px var(--gold)); }
  50% { filter: drop-shadow(0 0 40px var(--gold)); }
}

.splash-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.splash-title span {
  display: block;
  background: linear-gradient(135deg, var(--gold) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-sub {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 3rem;
  letter-spacing: 0.5px;
}
.splash-sub strong { color: var(--accent-light); }

.splash-cards {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.card-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 2.5rem;
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  transition: var(--transition);
  min-width: 200px;
  position: relative;
  overflow: hidden;
}

.card-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1.5px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.admin-btn {
  background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(168,85,247,0.1));
}
.player-btn {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(251,191,36,0.1));
}

.card-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.admin-btn:hover { box-shadow: 0 20px 60px var(--accent-glow); }
.player-btn:hover { box-shadow: 0 20px 60px rgba(245,158,11,0.25); }

.card-icon { font-size: 2.5rem; }
.card-label { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.card-desc { font-size: 0.8rem; color: var(--text-secondary); }

/* ════════════════════════════════════
   PAGE HEADER (Login Screens)
════════════════════════════════════ */
.page-header {
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.page-header h2 { font-size: 1.3rem; font-weight: 700; }
.back-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.875rem;
  transition: var(--transition);
}
.back-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ════════════════════════════════════
   CENTER CARD (Login)
════════════════════════════════════ */
.center-card {
  max-width: 460px;
  margin: 4rem auto;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.icon-big { font-size: 3rem; }
.center-card h3 { font-size: 1.6rem; font-weight: 800; }
.hint { color: var(--text-secondary); font-size: 0.9rem; }
.hint-small { color: var(--text-muted); font-size: 0.8rem; }
.hint-small strong { color: var(--accent-light); }

/* ════════════════════════════════════
   TOP NAV
════════════════════════════════════ */
.topnav {
  height: var(--nav-height);
  background: rgba(10, 11, 20, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-brand span {
  background: linear-gradient(135deg, var(--accent-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition);
  position: relative;
}
.nav-tab:hover { background: rgba(124,58,237,0.15); color: var(--text-primary); }
.nav-tab.active {
  background: rgba(124,58,237,0.25);
  color: var(--accent-light);
  font-weight: 700;
}
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 60%; height: 2px;
  background: var(--accent-light);
  border-radius: 2px;
}

.nav-right { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }

.access-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  font-family: var(--font-alt);
}

.viewer-name {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.btn-logout {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red-light);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.8rem;
  transition: var(--transition);
}
.btn-logout:hover { background: var(--red); color: white; }

/* ════════════════════════════════════
   ADMIN / PLAYER TABS
════════════════════════════════════ */
.admin-tab, .player-tab { display: none; }
.admin-tab.active, .player-tab.active { display: block; }

.tab-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.section-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.section-header h2 {
  font-size: 1.7rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.section-header p { color: var(--text-secondary); font-size: 0.9rem; }

.round-badge {
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: white;
  padding: 0.4rem 1.2rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ════════════════════════════════════
   SETUP GRID
════════════════════════════════════ */
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.setup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition);
}
.setup-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-glow); }
.setup-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--accent-light); }

/* ════════════════════════════════════
   INPUTS
════════════════════════════════════ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}
.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.input-group input,
.input-group textarea {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  transition: var(--transition);
  width: 100%;
  outline: none;
}
.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-group input::placeholder,
.input-group textarea::placeholder { color: var(--text-muted); }
.input-group textarea { resize: vertical; min-height: 120px; }

.input-prefix {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
}
.input-prefix:focus-within {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-prefix span {
  padding: 0 0.75rem;
  color: var(--accent-light);
  font-weight: 700;
  font-size: 1.1rem;
}
.input-prefix input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  flex: 1;
}

/* ════════════════════════════════════
   PRIZE CALC
════════════════════════════════════ */
.prize-calc {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.prize-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.prize-row.pot { background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3); }
.prize-row.first { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); }
.prize-row.second { background: rgba(148,163,184,0.1); border: 1px solid rgba(148,163,184,0.25); }
.prize-row.third { background: rgba(205,124,84,0.1); border: 1px solid rgba(205,124,84,0.25); }
.prize-row strong { font-size: 1.1rem; font-weight: 800; }
.prize-row.first strong { color: var(--gold); }
.prize-row.second strong { color: var(--silver); }
.prize-row.third strong { color: var(--bronze); }
.player-count-info { color: var(--text-muted); font-size: 0.85rem; text-align: center; }

/* CODE DISPLAY */
.code-display {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-input);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
}
#access-code-text {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--accent-light);
  font-family: var(--font-alt);
  flex: 1;
  text-align: center;
}
.copy-btn {
  background: var(--accent);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
  white-space: nowrap;
}
.copy-btn:hover { background: var(--accent-light); }

/* VALIDATION */
.validation-info {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
}
.validation-ok { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--green-light); }
.validation-warn { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: var(--gold-light); }
.validation-err { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red-light); }

/* ════════════════════════════════════
   BUTTONS
════════════════════════════════════ */
.btn-primary, .btn-secondary, .btn-success, .btn-danger {
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  transition: var(--transition);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px var(--accent-glow); }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--accent-light); }
.btn-success {
  background: linear-gradient(135deg, #059669, var(--green));
  color: white;
  box-shadow: 0 4px 20px rgba(16,185,129,0.3);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(16,185,129,0.4); }
.btn-danger {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red-light);
}
.btn-danger:hover { background: var(--red); color: white; }
.btn-danger.modal-confirm-inner {
  background: var(--red);
  color: white;
}
.big-btn { padding: 1rem 2rem; font-size: 1.05rem; }
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.btn-icon {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--red-light);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.8rem;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--red); color: white; }

/* ════════════════════════════════════
   PLAYERS
════════════════════════════════════ */
.players-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 860px) { .players-layout { grid-template-columns: 1fr; } }

.add-player-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: calc(var(--nav-height) + 1rem);
}
.add-player-panel h3 { font-size: 1rem; font-weight: 700; color: var(--accent-light); }

.player-count-badge {
  text-align: center;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.count-num {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.count-label { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.25rem; }
.multiple-status { margin-top: 0.5rem; font-size: 0.8rem; font-weight: 600; }
.multiple-ok { color: var(--green-light); }
.multiple-warn { color: var(--gold-light); }

.bulk-add-section { border-top: 1px solid var(--border); padding-top: 1rem; }
.bulk-add-section h4 { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

.players-list-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.panel-header h3 { font-size: 1rem; font-weight: 700; color: var(--accent-light); }

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.player-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: var(--transition);
  animation: fadeSlideIn 0.3s ease;
}
.player-chip:hover { border-color: var(--accent-light); }
.player-chip .player-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; color: white;
  flex-shrink: 0;
}
.player-chip .player-chip-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-chip .remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem;
  transition: var(--transition);
  flex-shrink: 0;
}
.player-chip .remove-btn:hover { color: var(--red-light); }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════
   MATCHES
════════════════════════════════════ */
.matches-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  animation: fadeSlideIn 0.3s ease;
}
.match-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-glow); }

.match-card-header {
  background: linear-gradient(135deg, var(--accent), rgba(124,58,237,0.5));
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.match-table-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.match-status-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
}
.status-pending { background: rgba(245,158,11,0.3); color: var(--gold-light); }
.status-done { background: rgba(16,185,129,0.3); color: var(--green-light); }

.match-teams {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.match-team {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition);
}
.match-team.winner-team {
  border-color: var(--gold);
  background: rgba(245,158,11,0.08);
}

.team-players {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.team-player-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}
.team-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.team-score-display {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-secondary);
  min-width: 48px;
  text-align: right;
  font-family: var(--font-alt);
}
.winner-team .team-score-display { color: var(--gold); }

.vs-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.matches-actions {
  margin-top: 2rem;
  text-align: center;
}

/* ════════════════════════════════════
   SCORE ENTRY
════════════════════════════════════ */
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
}

.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: var(--transition);
}
.score-card:hover { border-color: var(--border-strong); }

.score-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.score-team-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.score-team-block:hover { border-color: var(--accent); }
.score-team-block.selected-winner { border-color: var(--gold); background: rgba(245,158,11,0.1); }

.score-team-names {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.score-team-names .team-sep { color: var(--text-muted); margin: 0 0.4rem; }

.score-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.score-input-row label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.score-input-row input {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-alt);
  font-size: 1.2rem;
  font-weight: 800;
  padding: 0.4rem 0.7rem;
  width: 90px;
  text-align: center;
  outline: none;
  transition: var(--transition);
}
.score-input-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,158,11,0.2); }
.score-winner-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0.25rem;
}
.score-vs { text-align: center; color: var(--text-muted); font-size: 0.8rem; font-weight: 700; letter-spacing: 2px; }
.score-done-badge {
  text-align: center;
  padding: 0.5rem;
  background: rgba(16,185,129,0.15);
  border-radius: var(--radius-sm);
  color: var(--green-light);
  font-size: 0.85rem;
  font-weight: 700;
}

/* ════════════════════════════════════
   LEADERBOARD
════════════════════════════════════ */
.leaderboard-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard-table thead tr {
  background: rgba(124,58,237,0.25);
}
.leaderboard-table th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-light);
  border-bottom: 1px solid var(--border);
}
.leaderboard-table td {
  padding: 0.875rem 1.25rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: var(--transition);
}
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tbody tr:hover td { background: rgba(124,58,237,0.07); }

.lb-rank {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text-muted);
  min-width: 40px;
}
.lb-rank.rank-1 { color: var(--gold); font-size: 1.4rem; }
.lb-rank.rank-2 { color: var(--silver); font-size: 1.2rem; }
.lb-rank.rank-3 { color: var(--bronze); font-size: 1.15rem; }

.lb-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.lb-wins {
  font-weight: 800;
  color: var(--green-light);
  font-family: var(--font-alt);
}
.lb-losses { color: var(--red-light); font-family: var(--font-alt); }
.lb-avg {
  font-weight: 700;
  font-family: var(--font-alt);
}
.lb-avg.positive { color: var(--green-light); }
.lb-avg.negative { color: var(--red-light); }

.top-row-1 { background: rgba(245,158,11,0.06) !important; }
.top-row-2 { background: rgba(148,163,184,0.04) !important; }
.top-row-3 { background: rgba(205,124,84,0.04) !important; }

/* ════════════════════════════════════
   PLAYER INFO
════════════════════════════════════ */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.info-card h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.info-card .info-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-primary);
  font-family: var(--font-alt);
}
.info-card .info-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}
.info-card .info-label-accent {
  font-size: 0.85rem;
  color: var(--accent-light);
  font-weight: 600;
  margin-top: 0.25rem;
}

/* ════════════════════════════════════
   EMPTY STATE
════════════════════════════════════ */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.empty-state span { font-size: 3rem; opacity: 0.5; }
.empty-state p { font-size: 1rem; }

/* ════════════════════════════════════
   ERROR / MESSAGES
════════════════════════════════════ */
.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red-light);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  text-align: center;
}
.hidden { display: none !important; }

/* ════════════════════════════════════
   MODAL
════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-icon { font-size: 2.5rem; }
.modal-box h3 { font-size: 1.3rem; font-weight: 800; }
.modal-box p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.modal-actions .btn-secondary,
.modal-actions .btn-danger {
  flex: 1;
}

/* ════════════════════════════════════
   TOAST
════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.85rem 1.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 2000;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--green); color: var(--green-light); }
.toast.error-toast { border-color: var(--red); color: var(--red-light); }
.toast.info { border-color: var(--accent); color: var(--accent-light); }

/* ════════════════════════════════════
   RESPONSIVE
════════════════════════════════════ */
@media (max-width: 640px) {
  .topnav { padding: 0 0.75rem; gap: 0.75rem; }
  .nav-brand span { display: none; }
  .nav-tab { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
  .tab-content { padding: 1.25rem 0.75rem; }
  .setup-grid { grid-template-columns: 1fr; }
  .score-grid { grid-template-columns: 1fr; }
  .matches-container { grid-template-columns: 1fr; }
  .splash-cards { flex-direction: column; align-items: center; }
  .card-btn { width: 80%; }
  .leaderboard-table th:nth-child(4),
  .leaderboard-table td:nth-child(4) { display: none; }
}

/* Prize preview card special */
.prize-preview-card {
  border-color: rgba(245,158,11,0.3);
}
.prize-preview-card h3 {
  color: var(--gold-light);
}

/* Code card */
.code-card {
  border-color: rgba(124,58,237,0.4);
}

/* Tournament controls card */
#btn-start-tournament { margin-top: 0.5rem; }
#btn-reset-tournament { margin-top: 0.5rem; }

/* Player nav */
.player-nav .nav-tab.active { color: var(--gold-light); }
.player-nav .nav-tab.active::after { background: var(--gold-light); }
