/* ============================================================
   TABLE TENNIS UMPIRE APP v1.1 — MAIN STYLESHEET
   Kentavros A.S.E.A. Volou — Uncle Paul 1st Tournament
   Designed for 1920×1080 minimum, 4K optimised
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;600;700&family=Inter:wght@300;400;600&display=swap');

:root {
  --primary:       #1a1a2e;
  --secondary:     #16213e;
  --accent:        #0f3460;
  --gold:          #f5c518;
  --gold-dark:     #c9a000;
  --white:         #ffffff;
  --light-gray:    #e0e0e0;
  --green:         #00c853;
  --red:           #d32f2f;
  --orange:        #ff6f00;
  --sidebar-width: 240px;
  --border-radius: 14px;
  --shadow:        0 8px 32px rgba(0,0,0,0.4);
  --transition:    all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--primary);
  color: var(--white);
  font-family: 'Rajdhani', 'Inter', sans-serif;
  overflow: hidden;
  user-select: none;
}

/* ── SCREENS ── */
.screen {
  display: none;
  width: 100vw; height: 100vh;
  position: absolute; top: 0; left: 0;
  animation: screenFadeIn 0.4s ease;
}
.screen.active { display: flex; }

@keyframes screenFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: linear-gradient(180deg, #0d0d1a 0%, #1a1a2e 40%, #0d1b2a 100%);
  border-right: 2px solid rgba(245,197,24,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px;
  gap: 16px;
  z-index: 10;
  justify-content: flex-start;
}

.sidebar .org-logo {
  width: 200px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(245,197,24,0.3));
  mix-blend-mode: screen;
}

.sidebar .tournament-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.5;
  padding: 10px 8px;
  border-top: 1px solid rgba(245,197,24,0.2);
  border-bottom: 1px solid rgba(245,197,24,0.2);
  width: 100%;
}

.sidebar .sponsors-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(245,197,24,0.15);
  width: 100%;
}

.sidebar .sponsors-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.sidebar .sponsor-link {
  display: block;
  text-decoration: none;
}

.sidebar .sponsor-logo {
  width: 190px;
  height: auto;
  max-height: 70px;
  object-fit: contain;
  filter: brightness(0.9);
  transition: var(--transition);
  display: block;
}
.sidebar .sponsor-logo:hover { filter: brightness(1.15); }

/* ── MAIN CONTENT AREA ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================
   SETUP SCREEN
   ============================================================ */
#screen-setup { flex-direction: row; }

.setup-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 30px;
  overflow-y: auto;
}

.setup-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(245,197,24,0.5);
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  width: 100%;
  max-width: 800px;
}

.player-setup-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(245,197,24,0.2);
  border-radius: var(--border-radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.player-setup-card:hover { border-color: rgba(245,197,24,0.5); }

.player-setup-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.photo-upload-area {
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 3px dashed rgba(245,197,24,0.4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
  background: rgba(255,255,255,0.03);
  position: relative;
}
.photo-upload-area:hover { border-color: var(--gold); background: rgba(245,197,24,0.05); }
.photo-upload-area img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
}
.photo-upload-area .upload-icon {
  font-size: 32px;
  color: rgba(245,197,24,0.5);
  pointer-events: none;
  z-index: 2;
  position: relative;
}
.photo-upload-area input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
  z-index: 3;
}

.setup-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: var(--white);
  font-family: 'Rajdhani', sans-serif;
  font-size: 18px;
  font-weight: 600;
  padding: 12px 16px;
  text-align: center;
  outline: none;
  transition: var(--transition);
}
.setup-input:focus { border-color: var(--gold); background: rgba(245,197,24,0.08); }
.setup-input::placeholder { color: rgba(255,255,255,0.3); }

.format-selector {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.format-selector label {
  font-size: 15px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 1px;
}
.format-btn {
  padding: 10px 24px;
  border-radius: 10px;
  border: 2px solid rgba(245,197,24,0.3);
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.format-btn.active, .format-btn:hover {
  border-color: var(--gold);
  background: rgba(245,197,24,0.15);
  color: var(--gold);
}

.btn-primary {
  padding: 16px 56px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none;
  border-radius: 12px;
  color: #1a1a2e;
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(245,197,24,0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(245,197,24,0.6);
}

.btn-secondary {
  padding: 12px 32px;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: rgba(255,255,255,0.6);
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.5); color: var(--white); }

/* ============================================================
   COIN TOSS SCREEN
   ============================================================ */
#screen-cointoss { flex-direction: row; }

.cointoss-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 30px;
}

.cointoss-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(245,197,24,0.5);
}

.toss-players-row {
  display: flex;
  gap: 50px;
  align-items: center;
}

.toss-player-label { text-align: center; }

.toss-player-role {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.toss-player-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
}

.toss-vs {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  color: rgba(255,255,255,0.2);
}

/* Coin */
.coin-container {
  perspective: 600px;
  width: 140px; height: 140px;
  display: flex; align-items: center; justify-content: center;
}

.coin {
  width: 120px; height: 120px;
  position: relative;
  transform-style: preserve-3d;
  border-radius: 50%;
}

.coin-face {
  position: absolute; inset: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  backface-visibility: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.coin-heads {
  background: radial-gradient(circle at 35% 35%, #ffe066, #f5c518, #c9a000, #7a5c00);
}

.coin-tails {
  background: radial-gradient(circle at 35% 35%, #e0e0e0, #aaa, #666);
  transform: rotateY(180deg);
}

@keyframes flipHeads {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(1800deg); }
}
@keyframes flipTails {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(1980deg); }
}
.coin.flipping-heads { animation: flipHeads 2s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.coin.flipping-tails { animation: flipTails 2s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

.toss-result {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  min-height: 32px;
  opacity: 0;
  transition: opacity 0.5s;
}
.toss-result.visible { opacity: 1; }

/* Choice panels */
.choice-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(245,197,24,0.2);
  border-radius: 14px;
  padding: 20px 30px;
  min-width: 400px;
}

.choice-panel-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 1px;
  text-align: center;
}

.choice-buttons {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.choice-btn {
  padding: 13px 26px;
  border-radius: 10px;
  border: 2px solid rgba(245,197,24,0.4);
  background: rgba(245,197,24,0.08);
  color: var(--gold);
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
}
.choice-btn:hover {
  background: rgba(245,197,24,0.25);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(245,197,24,0.3);
}

/* ============================================================
   PRACTICE COUNTDOWN SCREEN
   ============================================================ */
#screen-practice { flex-direction: row; }

.practice-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.practice-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 4px;
  text-transform: uppercase;
}

.practice-vs {
  display: flex;
  align-items: center;
  gap: 40px;
}

.practice-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.practice-player-photo {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(245,197,24,0.4);
}
.practice-player-photo.no-photo { display: none; }

.practice-player-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
}

.practice-vs-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: rgba(255,255,255,0.3);
}

.countdown-ring {
  position: relative;
  width: 220px; height: 220px;
}

.countdown-ring svg { transform: rotate(-90deg); }

.countdown-ring circle.bg {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 10;
}

.countdown-ring circle.progress {
  fill: none;
  stroke: var(--gold);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 628;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 8px rgba(245,197,24,0.6));
}

.countdown-number {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.countdown-number span {
  font-family: 'Orbitron', sans-serif;
  font-size: 64px;
  font-weight: 900;
  color: var(--white);
  line-height: 1;
}

.countdown-number small {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.practice-info {
  font-size: 16px;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

/* ============================================================
   MAIN SCOREBOARD SCREEN
   ============================================================ */
#screen-match { flex-direction: row; }

.match-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Top bar ── */
.match-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(0,0,0,0.35);
  border-bottom: 2px solid rgba(245,197,24,0.2);
  gap: 10px;
  flex-shrink: 0;
}

.timer-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}

.timer-label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 2px;
}

.timer-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
}

.match-info-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.match-format-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 3px;
}

.game-indicator {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
}

/* ── Deuce / Advantage ── */
.deuce-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #ff6b6b;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 0;
  animation: deuceFlash 1s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes deuceFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Side swap notice ── */
.side-swap-notice {
  text-align: center;
  padding: 8px;
  background: rgba(245,197,24,0.15);
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 2px;
  flex-shrink: 0;
}

/* ── Score area ── */
.score-area {
  flex: 1;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  min-height: 0;
}

.player-score-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  gap: 10px;
  padding: 16px 20px;
  overflow: hidden;
}

.player-score-panel.left {
  background: linear-gradient(160deg, rgba(10,40,80,0.85) 0%, rgba(20,20,50,0.9) 100%);
  border-right: 1px solid rgba(245,197,24,0.1);
}

.player-score-panel.right {
  background: linear-gradient(200deg, rgba(80,10,10,0.85) 0%, rgba(50,20,20,0.9) 100%);
}

.player-score-panel:hover { filter: brightness(1.1); }

/* Click ripple */
.player-score-panel::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(245,197,24,0.35);
  width: 0; height: 0;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: none;
}
.player-score-panel.ripple::after {
  animation: rippleEffect 0.5s ease-out forwards;
}
@keyframes rippleEffect {
  0%   { width: 0; height: 0; opacity: 1; }
  100% { width: 700px; height: 700px; opacity: 0; }
}

/* ── Player photo wrap ── */
.player-photo-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.player-photo-score {
  width: 140px; height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(245,197,24,0.4);
  transition: var(--transition);
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}
.player-photo-score.no-photo { display: none; }
.player-score-panel:hover .player-photo-score { border-color: var(--gold); }

/* ── First server badge ── */
.first-server-badge {
  background: rgba(245,197,24,0.18);
  border: 1px solid rgba(245,197,24,0.5);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
  white-space: nowrap;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 6px rgba(245,197,24,0.3); }
  50%       { box-shadow: 0 0 14px rgba(245,197,24,0.7); }
}

/* ── Player name ── */
.player-name-score {
  font-family: 'Rajdhani', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  letter-spacing: 1px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Serve indicator ── */
.serve-indicator {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8c0, #f5c518, #c9a000);
  border: 2px solid #fff;
  box-shadow: 0 0 12px var(--gold), 0 0 24px rgba(245,197,24,0.5);
  opacity: 0;
  transition: opacity 0.3s;
  flex-shrink: 0;
}
.serve-indicator.active {
  opacity: 1;
  animation: servePulse 1.2s ease-in-out infinite;
}
@keyframes servePulse {
  0%, 100% { box-shadow: 0 0 12px var(--gold), 0 0 24px rgba(245,197,24,0.5); }
  50%       { box-shadow: 0 0 22px var(--gold), 0 0 44px rgba(245,197,24,0.8); }
}

/* ── Side label ── */
.side-label {
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

/* ── Sets display ── */
.sets-display {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.set-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.set-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  background: transparent;
  transition: var(--transition);
}
.set-dot.won {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(245,197,24,0.7);
}

.set-dot-score {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  min-height: 18px;
  text-align: center;
}

/* ── Score number ── */
.score-number {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(120px, 18vw, 240px);
  font-weight: 900;
  line-height: 1;
  color: var(--white);
  text-shadow: 0 0 60px rgba(255,255,255,0.15);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.score-number.bump {
  animation: scoreBump 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scoreBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.22); color: var(--gold); text-shadow: 0 0 60px rgba(245,197,24,0.9); }
  100% { transform: scale(1); }
}

/* ── Centre divider ── */
.score-divider {
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.score-divider-colon {
  font-family: 'Orbitron', sans-serif;
  font-size: 56px;
  font-weight: 900;
  color: rgba(255,255,255,0.25);
}

.game-scores-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.game-score-item {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
}

/* ── Umpire controls bar ── */
.umpire-controls {
  background: rgba(0,0,0,0.45);
  border-top: 2px solid rgba(245,197,24,0.15);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.umpire-hint {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 2px;
}

.umpire-btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.umpire-btn {
  padding: 9px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.75);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.5px;
}
.umpire-btn:hover { background: rgba(255,255,255,0.14); color: var(--white); border-color: rgba(255,255,255,0.35); }

.umpire-btn.warning {
  border-color: rgba(255,111,0,0.4);
  color: #ffab40;
}
.umpire-btn.warning:hover { background: rgba(255,111,0,0.15); border-color: var(--orange); }

/* ============================================================
   EDIT MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid rgba(245,197,24,0.3);
  border-radius: 18px;
  padding: 36px;
  min-width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.modal-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.modal-label {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  min-width: 90px;
}

.modal-input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: var(--white);
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
}
.modal-input:focus { border-color: var(--gold); }

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ============================================================
   WINNER SCREEN
   ============================================================ */
#screen-winner { flex-direction: row; }

.winner-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

#confetti-canvas {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
}

.winner-content > * { position: relative; z-index: 1; }

.winner-trophy {
  font-size: 100px;
  animation: trophyBounce 1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes trophyBounce {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.winner-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  letter-spacing: 6px;
  text-transform: uppercase;
  animation: fadeInUp 0.6s 0.3s both;
}

.winner-photo {
  width: 180px; height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 6px solid var(--gold);
  box-shadow: 0 0 50px rgba(245,197,24,0.7), 0 0 100px rgba(245,197,24,0.3);
  animation: fadeInUp 0.6s 0.5s both, winnerGlow 2s 1.2s ease-in-out infinite;
}
.winner-photo.no-photo { display: none; }

@keyframes winnerGlow {
  0%, 100% { box-shadow: 0 0 50px rgba(245,197,24,0.7), 0 0 100px rgba(245,197,24,0.3); }
  50%       { box-shadow: 0 0 80px rgba(245,197,24,1.0), 0 0 160px rgba(245,197,24,0.5); }
}

.winner-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 52px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(245,197,24,0.9);
  text-align: center;
  animation: fadeInUp 0.6s 0.7s both;
}

.winner-score-summary {
  font-family: 'Rajdhani', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  animation: fadeInUp 0.6s 0.9s both;
}

.winner-actions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  animation: fadeInUp 0.6s 1.1s both;
}

@keyframes fadeInUp {
  0%   { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }
.text-gold { color: var(--gold); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb { background: rgba(245,197,24,0.3); border-radius: 3px; }

/* ============================================================
   4K SCALING (3840px+)
   ============================================================ */
@media (min-width: 3000px) {
  :root { --sidebar-width: 380px; }
  .sidebar .org-logo { width: 320px; }
  .sidebar .tournament-name { font-size: 18px; }
  .sidebar .sponsor-logo { width: 300px; max-height: 110px; }
  .match-topbar { padding: 22px 60px; }
  .timer-value { font-size: 52px; }
  .timer-label { font-size: 16px; }
  .game-indicator { font-size: 36px; }
  .match-format-label { font-size: 20px; }
  .score-number { font-size: 400px; }
  .player-name-score { font-size: 48px; }
  .player-photo-score { width: 240px; height: 240px; border-width: 6px; }
  .serve-indicator { width: 32px; height: 32px; }
  .set-dot { width: 48px; height: 48px; }
  .set-dot-score { font-size: 22px; }
  .score-divider { width: 130px; }
  .score-divider-colon { font-size: 90px; }
  .game-score-item { font-size: 22px; }
  .umpire-controls { padding: 20px 60px; }
  .umpire-btn { font-size: 22px; padding: 14px 32px; }
  .umpire-hint { font-size: 18px; }
  .first-server-badge { font-size: 16px; padding: 6px 18px; }
  .deuce-label { font-size: 32px; }
  .side-label { font-size: 18px; letter-spacing: 4px; }
}
