/* Design Tokens & Theme Variables */
:root {
  --bg: #000000;
  --bg-gradient: radial-gradient(circle at 10% 20%, rgba(255, 214, 10, 0.08) 0%, transparent 50%),
                 radial-gradient(circle at 90% 80%, rgba(88, 86, 214, 0.1) 0%, transparent 50%);
  --surface: rgba(30, 30, 30, 0.4);
  --surface-high: rgba(45, 45, 45, 0.6);
  --surface-highest: rgba(60, 60, 60, 0.8);
  --input-bg: rgba(255, 255, 255, 0.05);

  --text-primary: #F2F2F7;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-black: #000000;

  --neon: #FFD60A;
  --neon-glow: rgba(255, 214, 10, 0.2);
  --neon-glow-high: rgba(255, 214, 10, 0.4);

  --green: #32D74B;
  --green-bg: rgba(50, 215, 75, 0.12);
  --red: #FF453A;
  --red-bg: rgba(255, 69, 58, 0.12);

  --border-gloss: rgba(255, 255, 255, 0.15);
  --border-gloss-hover: rgba(255, 255, 255, 0.3);
  --shadow-glass: inset 0 1px 1px rgba(255, 255, 255, 0.15), 
                   inset 0 -1px 1px rgba(0, 0, 0, 0.2),
                   0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glass-hover: inset 0 1px 2px rgba(255, 255, 255, 0.25), 
                         0 12px 48px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg: #f2f2f7;
  --bg-gradient: radial-gradient(circle at 10% 20%, rgba(255, 149, 0, 0.15) 0%, transparent 50%),
                 radial-gradient(circle at 90% 80%, rgba(88, 86, 214, 0.1) 0%, transparent 50%);
  --surface: rgba(255, 255, 255, 0.5);
  --surface-high: rgba(255, 255, 255, 0.7);
  --surface-highest: rgba(255, 255, 255, 0.9);
  --input-bg: rgba(255, 255, 255, 0.6);

  --text-primary: #1c1c1e;
  --text-secondary: rgba(60, 60, 67, 0.65);
  --text-black: #000000;

  --neon: #FF9500;
  --neon-glow: rgba(255, 149, 0, 0.2);
  --neon-glow-high: rgba(255, 149, 0, 0.4);

  --green: #34C759;
  --green-bg: rgba(52, 199, 89, 0.15);
  --red: #FF3B30;
  --red-bg: rgba(255, 59, 48, 0.15);

  --border-gloss: rgba(255, 255, 255, 0.6);
  --border-gloss-hover: rgba(255, 255, 255, 0.9);
  --shadow-glass: inset 0 1px 1px rgba(255, 255, 255, 0.8), 
                   inset 0 -1px 1px rgba(0, 0, 0, 0.05),
                   0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-glass-hover: inset 0 1px 2px rgba(255, 255, 255, 1), 
                         0 12px 48px rgba(0, 0, 0, 0.12);
}

/* Global Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding-top: 16px;
  padding-bottom: 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Floating Liquid Glass Background Spheres */
body::before, body::after {
  content: "";
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
  transition: opacity 0.5s ease, filter 0.5s ease;
}

[data-theme="light"] body::before, [data-theme="light"] body::after {
  opacity: 0.15;
  filter: blur(140px);
}

@media (max-width: 768px) {
  [data-theme="light"] body::before, [data-theme="light"] body::after {
    opacity: 0.08;
    filter: blur(120px);
  }
}

body::before {
  background: radial-gradient(circle, var(--neon) 0%, transparent 70%);
  top: -100px;
  left: -100px;
  animation: floatOrbital1 24s infinite ease-in-out;
}

body::after {
  background: radial-gradient(circle, #5856D6 0%, transparent 70%);
  bottom: -150px;
  right: -100px;
  animation: floatOrbital2 30s infinite ease-in-out;
}

@keyframes floatOrbital1 {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(120px, 80px) scale(1.15); }
  66% { transform: translate(-40px, 140px) scale(0.95); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes floatOrbital2 {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-100px, -120px) scale(0.9); }
  66% { transform: translate(60px, -60px) scale(1.1); }
  100% { transform: translate(0, 0) scale(1); }
}

/* Scrollbar behaviors */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

.hide-scrollbar {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

/* Shared Premium Styles */
.neon-glow {
  box-shadow: var(--shadow-glass), 0 8px 32px var(--neon-glow);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.neon-glow:hover {
  box-shadow: var(--shadow-glass-hover), 0 12px 48px var(--neon-glow-high);
}

.neon-glow-active:active {
  transform: scale(0.97);
  opacity: 0.85;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.card {
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid var(--border-gloss);
  padding: 24px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(28px) saturate(210%);
  -webkit-backdrop-filter: blur(28px) saturate(210%);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-gloss-hover);
  box-shadow: var(--shadow-glass-hover);
}

/* Pulsating Animation for Active Indicator */
@keyframes pulse {
  0% {
    opacity: 0.3;
    transform: scale(0.9);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
  }

  100% {
    opacity: 0.3;
    transform: scale(0.9);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--neon);
  border-radius: 50%;
  animation: pulse 1.2s infinite ease-in-out;
}

/* Layout Screens & View Manager */
.screen-view {
  width: 100%;
  max-width: 600px;
  padding: 72px 20px 16px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Top App Bar - hidden per user request */
header.app-bar {
  display: none;
}

header.app-bar h1 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  color: var(--neon);
  font-size: 18px;
  font-weight: 800;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.icon-btn:hover {
  background-color: var(--surface-high);
  color: var(--text-primary);
}

.profile-card {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--surface-high);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-highest);
  color: var(--text-secondary);
}

/* Typography Helpers */
.title-lg {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.subtitle-md {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.label-caps {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Court Setup Screen 1 */
.court-card-wrapper {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.court-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
}

.court-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.court-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.court-title-area .material-symbols-outlined {
  color: var(--text-secondary);
  font-size: 20px;
  transition: color 0.2s ease;
}

.court-title-area span:not(.material-symbols-outlined) {
  font-size: 14px;
  font-weight: 700;
}

.court-card.active {
  border-color: rgba(255, 255, 255, 0.15);
  background-color: rgba(255, 255, 255, 0.04);
  box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.2);
}

.court-card.active .court-title-area .material-symbols-outlined {
  color: var(--neon);
}

/* Compact overrides inside Court Card Grid */
.court-card .switch {
  width: 44px;
  height: 24px;
}

.court-card .slider:before {
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
}

.court-card input:checked+.slider:before {
  transform: translateX(20px);
}

.court-card .add-players-btn {
  height: 38px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-primary);
}

.court-card .add-players-btn .material-symbols-outlined {
  font-size: 16px;
}

/* Custom Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 32px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface-highest);
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 32px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background-color: var(--text-primary);
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--neon);
}

input:checked + .slider:before {
  transform: translateX(24px);
  background-color: #FFFFFF;
}

/* Add players inline button */
.add-players-btn {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: none;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.add-players-btn:hover {
  background-color: rgba(255, 255, 255, 0.12);
  transform: scale(0.98);
}

/* Sticky Bottom Action bar */
.sticky-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--surface-highest);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border-top: 1px solid var(--border-gloss);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  justify-content: center;
}

.sticky-bottom-bar-content {
  width: 100%;
  max-width: 600px;
}

.btn-primary {
  width: 100%;
  height: 60px;
  border-radius: 30px;
  border: none;
  background-color: var(--text-primary);
  color: var(--bg);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 14px var(--neon-glow);
}

.btn-primary:disabled {
  background-color: var(--surface-high);
  color: var(--text-secondary);
  cursor: not-allowed;
  box-shadow: none !important;
  opacity: 0.6;
}

/* Player Entry Screen 2 */
.horizontal-tabs {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 4px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.tab-chip {
  flex-shrink: 0;
  height: 44px;
  padding: 0 24px;
  border-radius: 22px;
  background-color: var(--surface);
  border: 1px solid var(--surface-high);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-chip.active {
  background-color: var(--surface-high);
  border-color: var(--neon);
  color: var(--text-primary);
  box-shadow: 0px 4px 12px var(--neon-glow);
}

.tab-chip.completed:not(.active) {
  border: 1px dashed rgba(74, 222, 128, 0.45);
  background-color: rgba(74, 222, 128, 0.05);
}

.tab-chip.completed.active {
  border: 1px solid var(--neon);
  background-color: rgba(74, 222, 128, 0.08);
}

.tab-progress-badge {
  font-size: 10px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--neon);
  background: rgba(255, 214, 10, 0.12);
  border: 1px solid rgba(255, 214, 10, 0.35);
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(255, 214, 10, 0.1);
  transition: all 0.2s ease;
}

.tab-chip.active .tab-progress-badge {
  color: var(--text-primary);
  background: rgba(255, 214, 10, 0.2);
  border-color: rgba(255, 214, 10, 0.45);
}

.player-input-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-input-row {
  position: relative;
  width: 100%;
}

.player-input-row i {
  position: absolute;
  left: 16px;
  top: 20px;
  color: var(--text-secondary);
  font-size: 22px;
}

.player-input-row input {
  width: 100%;
  height: 64px;
  border-radius: 12px;
  border: none;
  background-color: var(--input-bg);
  padding-left: 52px;
  padding-right: 16px;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  transition: border-bottom 0.2s ease;
}

.player-input-row input::placeholder {
  color: var(--text-secondary);
}

.player-input-row input:focus {
  outline: none;
  border-bottom: 2px solid var(--neon);
}

.extra-players-row {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.extra-players-row button {
  flex: 1;
  height: 52px;
  border-radius: 26px;
  border: 2px solid var(--neon);
  background: transparent;
  color: var(--neon);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.extra-players-row button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Dashboard Screen 3 */
.round-chip-row {
  margin-top: 8px;
  margin-bottom: 20px;
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 4px;
}

.round-chip {
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  border-radius: 19px;
  background-color: var(--surface);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.round-chip.viewing {
  background-color: var(--neon);
  color: var(--text-black);
}

.round-chip.viewing .material-symbols-outlined {
  color: var(--text-black) !important;
}

.round-chip.active-round:not(.viewing) {
  border: 1px solid var(--neon);
  background-color: var(--surface-high);
}

.round-chip.completed:not(.viewing) {
  border: 1px dashed rgba(74, 222, 128, 0.45);
  background-color: rgba(74, 222, 128, 0.05);
}

.round-chip.completed.active-round:not(.viewing) {
  border: 1px solid var(--neon);
  background-color: rgba(74, 222, 128, 0.08);
}

.match-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.match-card-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-chip {
  padding: 6px 12px;
  border-radius: 6px;
  background-color: var(--surface-highest);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.match-card-score {
  color: var(--neon);
  font-size: 18px;
  font-weight: 800;
}

.match-card-score-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.match-card-score-diff {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--surface-highest);
  border: 1px solid var(--border-gloss);
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.match-card-score-diff::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  opacity: 0.6;
}


.match-teams-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.match-team {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.match-team.team-2 {
  align-items: flex-end;
  text-align: right;
}

.match-team h4 {
  color: var(--neon);
  font-size: 16px;
  font-weight: 700;
}

.match-team p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.4;
}

.vs-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--input-bg);
  color: var(--text-secondary);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 12px;
}

.match-action-btn {
  width: 100%;
  height: 52px;
  border-radius: 12px;
  border: none;
  background-color: var(--neon);
  color: var(--text-black);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

/* Next Round Banner */
.next-round-banner {
  background: var(--surface);
  border: 1px solid var(--border-gloss);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(28px) saturate(210%);
  -webkit-backdrop-filter: blur(28px) saturate(210%);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.next-round-banner:hover {
  transform: translateY(-2px);
  border-color: var(--border-gloss-hover);
  box-shadow: var(--shadow-glass-hover);
}

.next-round-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--neon) 0%, rgba(255, 214, 10, 0.2) 100%);
}

.next-round-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.next-round-header .material-symbols-outlined {
  color: var(--neon);
  font-size: 20px;
  animation: pulse 2s infinite ease-in-out;
}

.next-round-label {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--neon);
  text-transform: uppercase;
}

.next-round-matchup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-high);
  border: 1px solid var(--border-gloss);
  border-radius: 16px;
  padding: 16px 20px;
  gap: 12px;
  box-shadow: inset 0px 2px 8px rgba(0, 0, 0, 0.05);
}

.next-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  text-align: center;
  position: relative;
}

.next-team span {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.2px;
  transition: color 0.2s ease;
}

.next-team .next-amp {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  opacity: 0.6;
  text-transform: uppercase;
  margin: 1px 0;
}

.next-vs {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px;
  flex-shrink: 0;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
  position: relative;
}

.next-vs::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid var(--neon);
  opacity: 0.2;
  animation: pulse 2.5s infinite ease-in-out;
}


/* Leaderboard Section */
.leaderboard-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  margin-bottom: 16px;
}

.leaderboard-title-row i {
  color: var(--neon);
  font-size: 20px;
}

.leaderboard-title-row h3 {
  font-size: 20px;
  font-weight: 700;
}

.leaderboard-card {
  padding: 0;
  overflow: hidden;
}

.leaderboard-header {
  padding: 18px 24px;
  background-color: var(--surface-highest);
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-gloss);
}

.leaderboard-header span {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.leaderboard-header-rank {
  width: 48px;
  text-align: center;
}

.leaderboard-header-name {
  flex: 1;
}

.leaderboard-header-tot {
  width: 80px;
  text-align: right;
}

.leaderboard-item {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.leaderboard-item:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.leaderboard-item.first-place {
  background: linear-gradient(90deg, rgba(195, 244, 0, 0.03) 0%, transparent 100%);
  border-left: 3px solid var(--neon);
  padding-left: 21px;
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.leaderboard-rank {
  width: 48px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-secondary);
}

.leaderboard-item.first-place .leaderboard-rank {
  color: var(--neon);
}

.leaderboard-name {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.leaderboard-score-chip {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  min-width: 44px;
  text-align: center;
}

.score-positive {
  background-color: var(--green-bg);
  color: var(--green);
}

.score-negative {
  background-color: var(--red-bg);
  color: var(--red);
}

.score-neutral {
  background-color: var(--surface-highest);
  color: var(--text-primary);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(28px) saturate(210%);
  -webkit-backdrop-filter: blur(28px) saturate(210%);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border-gloss);
  border-radius: 28px;
  padding: 32px 24px;
  box-shadow: var(--shadow-glass-hover);
  transform: scale(0.95) translateY(10px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  backdrop-filter: blur(40px) saturate(220%);
  -webkit-backdrop-filter: blur(40px) saturate(220%);
}

.modal-open .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-drag-bar {
  display: none;
}

.modal-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.modal-title-area h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-match-details-badge {
  background-color: var(--surface);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  display: inline-block;
  margin-bottom: 8px;
}

.modal-steppers-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--surface-high);
  border-radius: 24px;
  padding: 16px;
  background-color: var(--surface);
}

.modal-stepper-team-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-stepper-team-info span {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.modal-stepper-team-info h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.stepper-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stepper-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--input-bg);
  border: 1px solid var(--surface-highest);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stepper-btn:active {
  transform: scale(0.95);
  background-color: var(--surface-highest);
}

.stepper-value {
  width: 60px;
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  text-align-last: center;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: none;
}

.stepper-value::-webkit-outer-spin-button,
.stepper-value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper-value.winning {
  color: var(--neon);
}

.stepper-value option {
  background-color: var(--surface);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
}

.modal-vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -6px 0;
  position: relative;
  z-index: 10;
}

.modal-vs-divider-line {
  flex: 1;
  height: 1px;
  background-color: var(--surface-high);
}

.modal-vs-divider-badge {
  padding: 8px;
  background-color: var(--surface-highest);
  border-radius: 50%;
  border: 4px solid var(--surface);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}

.modal-live-feedback {
  width: 100%;
  border-radius: 16px;
  padding: 12px 16px;
  background-color: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.feedback-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.feedback-value {
  font-size: 16px;
  font-weight: 800;
}

.feedback-positive {
  color: var(--green);
}

.feedback-positive .feedback-value {
  color: var(--green);
}

.feedback-negative {
  color: var(--red);
}

.feedback-negative .feedback-value {
  color: var(--red);
}

/* --- CLOUD SYNC & TOURNAMENT CONTROL STYLES --- */
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--surface);
  border: 1px solid var(--surface-high);
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sync-status span {
  font-size: 14px;
}

.status-syncing {
  color: var(--text-secondary);
}

.status-syncing span {
  animation: pulse 1.2s infinite ease-in-out;
  color: var(--text-secondary);
}

.status-saved {
  color: var(--green);
  border-color: rgba(74, 222, 128, 0.2);
}

.status-saved span {
  color: var(--green);
}

.status-error {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.2);
}

.status-error span {
  color: var(--red);
}

.sync-text {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 10px;
  letter-spacing: 0.5px;
}

@media (max-width: 480px) {
  .sync-text {
    display: none;
  }

  .sync-status {
    padding: 6px 8px;
  }
}

/* --- STAGE 2 FINAL STAGE DESIGN STYLES --- */
:root {
  --gold: #ffd700;
  --gold-glow: rgba(255, 215, 0, 0.15);
  --silver: #e0e0e0;
  --silver-glow: rgba(224, 224, 224, 0.12);
  --bronze: #cd7f32;
  --bronze-glow: rgba(205, 127, 50, 0.12);
}

.tier-card-gold {
  border-color: var(--gold) !important;
  box-shadow: 0px 4px 20px var(--gold-glow);
}

.tier-card-gold .tier-header-title {
  color: var(--gold);
}

.tier-card-silver {
  border-color: var(--silver) !important;
  box-shadow: 0px 4px 16px var(--silver-glow);
}

.tier-card-silver .tier-header-title {
  color: var(--silver);
}

.tier-card-bronze {
  border-color: var(--bronze) !important;
  box-shadow: 0px 4px 16px var(--bronze-glow);
}

.tier-card-bronze .tier-header-title {
  color: var(--bronze);
}

.tier-players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.tier-player-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: var(--input-bg);
  border-radius: 8px;
  font-size: 14px;
}

.tier-player-item .seed-badge {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-secondary);
}

.tier-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
}

/* --- KANBAN PLAYER ENTRY BOARD SYSTEM --- */
#view-player-entry.screen-view {
  max-width: 1100px;
  /* Expands to fit side-by-side columns on tablet/desktop! */
  transition: max-width 0.4s ease;
}

.player-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
  align-items: start;
  width: 100%;
}

.board-column {
  background-color: var(--surface);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.board-column.active-drop-target {
  border-color: var(--neon);
  box-shadow: 0px 0px 16px var(--neon-glow);
}

.board-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--surface-high);
  padding-bottom: 10px;
}

.board-column-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-column-title .material-symbols-outlined {
  font-size: 18px;
  color: var(--neon);
}

.capacity-badge {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.capacity-badge.valid {
  background-color: var(--green-bg);
  color: var(--green);
}

.capacity-badge.invalid {
  background-color: var(--red-bg);
  color: var(--red);
}

.capacity-badge.bench {
  background-color: var(--surface-highest);
  color: var(--text-secondary);
}

.player-drag-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
  /* Allows drag over even if empty */
  position: relative;
}

.player-drag-item {
  display: flex;
  align-items: center;
  background-color: var(--input-bg);
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 6px 12px;
  gap: 10px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, background-color 0.2s ease;
  touch-action: pan-y;
  /* Allows smooth vertical scrolling on mobile touch screens */
}

.player-drag-item:hover {
  border-color: var(--surface-highest);
  background-color: var(--surface-high);
}

.drag-handle {
  cursor: grab;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  user-select: none;
  transition: color 0.2s ease;
  touch-action: none;
  /* Prevents scrolling ONLY when grabbing the handle */
}

.drag-handle:hover {
  color: var(--neon);
}

.player-drag-item.is-dragging .drag-handle {
  cursor: grabbing;
  color: var(--neon);
}

.player-drag-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 0;
  transition: border-color 0.2s ease;
}

.player-drag-input::placeholder {
  color: rgba(196, 201, 172, 0.3);
}

.player-drag-input:focus {
  outline: none;
  border-bottom: 1px solid var(--neon);
}

.delete-player-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.delete-player-btn:hover {
  background-color: var(--red-bg);
  color: var(--red);
}

.board-column.bench-column {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  background-color: rgba(255, 255, 255, 0.02);
}

.board-column.bench-column.active-drop-target {
  border-color: var(--neon);
  box-shadow: 0px 0px 16px var(--neon-glow);
  background-color: rgba(255, 255, 255, 0.05);
}

.inline-add-player-btn {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.inline-add-player-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.player-drag-item.is-dragging {
  opacity: 0.4;
  border: 1px dashed var(--neon);
  background-color: var(--surface);
  transform: scale(0.96);
}

/* Floating Drag Ghost */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  background-color: var(--surface-high);
  border: 2px solid var(--neon) !important;
  box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.4) !important;
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.95;
  transform: rotate(1.5deg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.drag-ghost span:not(.material-symbols-outlined) {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.drag-ghost .drag-handle {
  color: var(--neon);
}

/* Vertical Placement Drop Indicator Line */
.drop-indicator {
  height: 3px;
  background-color: var(--neon);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--neon);
  margin: 4px 0;
  transition: all 0.1s ease;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  min-height: calc(72px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  backdrop-filter: blur(28px) saturate(210%);
  -webkit-backdrop-filter: blur(28px) saturate(210%);
  border-top: 1px solid var(--border-gloss);
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  z-index: 1000;
  box-shadow: 0px -4px 32px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 14px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  flex: 1;
}

.nav-item .material-symbols-outlined {
  font-size: 24px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item.active {
  flex-direction: row !important;
  color: var(--text-black) !important;
  background-color: var(--neon) !important;
  box-shadow: 0px 4px 18px var(--neon-glow);
  font-weight: 800;
  font-size: 12px;
  padding: 10px 18px;
  border-radius: 18px;
  gap: 6px;
  flex: auto;
}

.nav-item.active .material-symbols-outlined {
  transform: scale(1.08);
  font-variation-settings: 'FILL' 1;
}

.nav-item:not(.active):hover {
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* Leaderboard Segmented Control Styles */
.leaderboard-toggle-btn.active {
  background-color: var(--surface-highest) !important;
  color: var(--neon) !important;
  box-shadow: var(--shadow-glass);
}

.leaderboard-toggle-btn:not(.active):hover {
  color: var(--text-primary);
}

/* --- PREMIUM AI SETTINGS CARD STYLING --- */
.provider-select:hover, .text-input:hover {
  border-color: var(--border-gloss-hover) !important;
  background-color: rgba(255, 255, 255, 0.02) !important;
}

.provider-select:focus, .text-input:focus {
  border-color: var(--neon) !important;
  box-shadow: 0 0 12px var(--neon-glow) !important;
  background-color: rgba(0, 0, 0, 0.2) !important;
}

.provider-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%23ffd60a' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
}

.text-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.4;
}

/* Gear Icon Animation */
.gear-spin-active {
  transform: rotate(90deg);
  color: var(--neon) !important;
}

/* --- RESPONSIVE ADMIN TOP HEADER BUTTONS --- */
.admin-top-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--neon);
  color: var(--neon);
  background-color: rgba(255, 214, 10, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
  height: fit-content;
  min-height: 36px;
  box-sizing: border-box;
}

.admin-top-btn:hover {
  background-color: rgba(255, 214, 10, 0.2);
}

@media (max-width: 640px) {
  .admin-top-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50% !important;
  }
  .admin-top-btn .btn-label-text {
    display: none !important;
  }
  .admin-top-btn .material-symbols-outlined {
    font-size: 20px !important;
    margin: 0 !important;
  }
}