/* Modal styles */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
  border: 3px solid var(--gold);
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin: 0;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-light);
}

/* Player selection buttons */
.player-select-btn {
  width: 100%;
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(180deg, var(--felt-highlight) 0%, var(--felt-green) 100%);
  border: 3px solid var(--wood-dark);
  border-radius: 12px;
  color: var(--cream);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.player-select-btn:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-select-btn:active {
  transform: translateY(0);
}

/* PIN entry keypad */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.pin-dot {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s ease;
}

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

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  max-width: 280px;
  margin: 0 auto;
}

.keypad-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--wood-light);
  background: linear-gradient(145deg, var(--felt-highlight), var(--felt-green));
  color: var(--cream);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow:
    inset -2px -2px 4px rgba(0, 0, 0, 0.3),
    inset 2px 2px 4px rgba(255, 255, 255, 0.1),
    2px 4px 8px rgba(0, 0, 0, 0.3);
}

.keypad-btn:hover {
  border-color: var(--gold);
  transform: scale(1.05);
}

.keypad-btn:active {
  transform: scale(0.95);
  box-shadow:
    inset 2px 2px 4px rgba(0, 0, 0, 0.3),
    inset -2px -2px 4px rgba(255, 255, 255, 0.1);
}

.keypad-btn.clear {
  font-size: 1rem;
  background: linear-gradient(145deg, var(--wood-light), var(--wood-dark));
}

.keypad-btn.backspace {
  font-size: 1.25rem;
  background: linear-gradient(145deg, var(--wood-light), var(--wood-dark));
}

/* Winner selection */
.winner-select-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.winner-btn {
  padding: 1.25rem;
  background: linear-gradient(180deg, var(--felt-highlight) 0%, var(--felt-green) 100%);
  border: 3px solid var(--wood-dark);
  border-radius: 12px;
  color: var(--cream);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.winner-btn .ball {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.winner-btn:hover {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--wood-dark);
}

.winner-btn.self {
  border-color: var(--neon-blue);
}

.winner-btn.opponent {
  border-color: var(--neon-warm);
}

/* Waiting state */
.waiting-state {
  text-align: center;
  padding: 2rem 0;
}

.waiting-state .spinner-large {
  width: 60px;
  height: 60px;
  border: 4px solid var(--bg-dark);
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

.waiting-state p {
  color: var(--neon-blue);
  font-size: 1.1rem;
}

/* Result confirmation */
.result-confirmed {
  text-align: center;
  padding: 1.5rem 0;
}

.result-confirmed .checkmark {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
}

.result-confirmed h3 {
  color: var(--gold);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

/* Modal actions */
.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.modal-actions button {
  flex: 1;
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--text-muted);
  color: var(--text-muted);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--text-light);
  color: var(--text-light);
}
