:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.88);
  --blue-team: #2563eb;
  --blue-light: #60a5fa;
  --red-team: #e11d48;
  --red-light: #fb7185;
  --accent-gold: #f59e0b;
  --court-wood: #d97706;
  --text-white: #ffffff;
  --text-dim: #94a3b8;
  --radius-lg: 16px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-white);
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Header HUD */
#hud {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  pointer-events: none;
  z-index: 10;
}

.team-score {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.team-p1 {
  border-color: var(--blue-team);
}

.team-p2 {
  border-color: var(--red-team);
}

.team-label {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
}

.team-p1 .team-label {
  color: var(--blue-light);
}

.team-p2 .team-label {
  color: var(--red-light);
}

.score-num {
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

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

#round-indicator {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 20px;
}

#modifier-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent-gold);
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 15, 30, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 20;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 16px;
}

.overlay.hidden {
  display: none !important;
}

.menu-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  animation: cardEntrance 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.menu-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.2);
  color: var(--blue-light);
  border: 1px solid var(--blue-team);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.menu-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.menu-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
  margin-bottom: 20px;
}

/* Mode Buttons */
.mode-select {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
  outline: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mode-select .btn {
  text-align: left;
  justify-content: flex-start;
  padding: 12px 16px;
}

.mode-select .btn.selected {
  outline: 2px solid var(--accent-gold);
  border-color: var(--accent-gold);
}

.btn-icon {
  font-size: 22px;
}

.btn-text {
  display: flex;
  flex-direction: column;
}

.btn-text strong {
  font-size: 13px;
  letter-spacing: 0.5px;
}

.btn-text small {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: normal;
  margin-top: 2px;
}

/* Controls Guide */
.controls-guide {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.key-pill {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.start-cta {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

/* Winner Card */
.winner-trophy {
  font-size: 48px;
  margin-bottom: 8px;
  animation: bounce 0.6s infinite alternate cubic-bezier(0.16, 1, 0.3, 1);
}

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

.winner-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 4px;
}

.final-score {
  font-size: 36px;
  font-weight: 900;
  color: var(--accent-gold);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.winner-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 4px;
}

.stat-label {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.stat-val {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.gameover-actions {
  display: flex;
  gap: 10px;
}

.gameover-actions .btn {
  flex: 1;
}

/* Pause Card */
.pause-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.pause-card p {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 20px;
}

/* Touch Split Zones for Mobile */
.touch-zones {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 5;
  pointer-events: none;
}

.touch-zone {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 20px;
  pointer-events: auto;
  opacity: 0.25;
  transition: opacity 0.15s ease;
}

.touch-zone:active {
  opacity: 0.6;
}

.touch-zone span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.4);
}

.touch-p1 span {
  color: var(--blue-light);
  border: 1px solid var(--blue-team);
}

.touch-p2 span {
  color: var(--red-light);
  border: 1px solid var(--red-team);
}

@media (max-width: 600px) {
  .menu-card {
    padding: 20px 16px;
  }
  .menu-title {
    font-size: 26px;
  }
  .score-num {
    font-size: 22px;
  }
  .team-label {
    font-size: 12px;
  }
}

