@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;600&display=swap');

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --border: #1e1e2e;
  --red: #ff3b5c;
  --blue: #3b8eff;
  --gold: #ffd166;
  --text: #f0f0f8;
  --muted: #5a5a7a;
  --radius: 44px;
  --watch-size: 390px;
}

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

body {
  background: #050508;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}

/* Watch shell */
.watch-shell {
  width: var(--watch-size);
  background: #1a1a1a;
  border-radius: 88px;
  padding: 28px 22px;
  box-shadow:
    0 0 0 2px #333,
    0 0 0 6px #111,
    0 40px 80px rgba(0,0,0,0.8),
    inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
}

/* Crown */
.watch-shell::before {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 60px;
  background: linear-gradient(to right, #2a2a2a, #1a1a1a);
  border-radius: 0 6px 6px 0;
  box-shadow: 2px 0 4px rgba(0,0,0,0.5);
}

.watch-screen {
  background: var(--bg);
  border-radius: 64px;
  overflow: hidden;
  aspect-ratio: 1 / 1.1;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ── SCREENS ── */
.screen { display: none; width: 100%; height: 100%; }
.screen.active { display: flex; flex-direction: column; }

/* HOME */
#home {
  background: radial-gradient(ellipse at 30% 20%, #1a1a2e 0%, var(--bg) 70%);
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 32px 24px;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 52px;
  letter-spacing: 6px;
  color: var(--text);
  line-height: 1;
}

.logo span { color: var(--gold); }

.tagline {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.mode-btns { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.mode-btn {
  padding: 14px 20px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  transition: transform 0.1s, opacity 0.2s;
}

.mode-btn:active { transform: scale(0.96); opacity: 0.85; }

.mode-btn.singles {
  background: linear-gradient(135deg, var(--red), #c0002a);
  color: white;
}

.mode-btn.doubles {
  background: linear-gradient(135deg, var(--blue), #1a4fa0);
  color: white;
}

/* GAME SCREEN */
#game {
  background: var(--bg);
  flex-direction: column;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 8px;
}

.set-dots {
  display: flex;
  gap: 5px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.dot.filled { background: var(--gold); }

.match-info {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Sets scoreboard */
.sets-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 4px 16px;
}

.set-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 10px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--muted);
}

.set-badge.current { border-color: var(--gold); color: var(--gold); }

/* Main score */
.score-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 12px;
}

.player-score {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 12px 8px;
  border-radius: 20px;
  transition: background 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.player-score:active {
  background: rgba(255,255,255,0.05);
}

.player-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
}

.p1 .player-label { color: var(--red); }
.p2 .player-label { color: var(--blue); }

.score-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 86px;
  line-height: 1;
  transition: transform 0.1s;
}

.p1 .score-num { color: var(--red); }
.p2 .score-num { color: var(--blue); }

.score-num.bump {
  animation: bump 0.25s ease;
}

@keyframes bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.score-tap-hint {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
}

.divider {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 48px;
  color: var(--border);
  padding: 0 4px;
  margin-bottom: 18px;
}

/* Footer controls */
.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 20px;
  gap: 8px;
}

.ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:active { transform: scale(0.94); background: #1e1e2e; }

.ctrl-btn.undo { color: var(--gold); border-color: rgba(255,209,102,0.3); }
.ctrl-btn.next-set { color: #7fffae; border-color: rgba(127,255,174,0.3); }
.ctrl-btn.end-game { color: var(--red); border-color: rgba(255,59,92,0.3); }

/* WINNER */
#winner {
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 32px 24px;
  background: radial-gradient(ellipse at center, #1a0010 0%, var(--bg) 70%);
}

.trophy {
  font-size: 52px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.winner-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 5px;
  color: var(--gold);
  text-align: center;
}

.winner-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 46px;
  color: var(--text);
  text-align: center;
  letter-spacing: 3px;
}

.final-score {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 2px;
  text-align: center;
}

.play-again-btn {
  background: linear-gradient(135deg, var(--gold), #c89a00);
  color: #0a0a0f;
  border: none;
  border-radius: 16px;
  padding: 14px 28px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform 0.1s;
}

.play-again-btn:active { transform: scale(0.96); }

/* Serving indicator */
.serve-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  transition: opacity 0.3s;
}

.serving .serve-dot { opacity: 1; }

/* Modal overlay */
.modal-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10,10,15,0.92);
  border-radius: 64px;
  z-index: 10;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  backdrop-filter: blur(6px);
}

.modal-overlay.show { display: flex; }

.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  color: var(--gold);
  letter-spacing: 3px;
  text-align: center;
}

.modal-text {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 1px;
  line-height: 1.6;
}

.modal-btns { display: flex; flex-direction: column; gap: 8px; width: 100%; }

.modal-btn {
  border: none;
  border-radius: 14px;
  padding: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.1s;
}

.modal-btn:active { transform: scale(0.96); }
.modal-btn.confirm { background: var(--red); color: white; }
.modal-btn.cancel  { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* responsive: small phones */
@media (max-width: 420px) {
  :root { --watch-size: 100vw; }
  .watch-shell { border-radius: 0; padding: 0; box-shadow: none; }
  .watch-shell::before { display: none; }
  .watch-screen { border-radius: 0; min-height: 100svh; aspect-ratio: unset; }
  #winner .modal-overlay { border-radius: 0; }
  .modal-overlay { border-radius: 0; }
}
