/* ==========================================================================
   Modals, Overlays & Settings Dialogs
   Smooth transitions, dark green + gold aesthetic, non-blocking for bidding.
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 14, 9, 0.78);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: linear-gradient(145deg, #0e271a 0%, #081a11 100%);
  border: 1px solid rgba(216, 173, 50, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 35px rgba(0, 0, 0, 0.85);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(6px);
  transition: transform 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
  padding: 4px;
}

.modal-close:hover {
  color: #fff;
  transform: scale(1.15);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   Settings Modal Styling (Music, SFX, Sliders, Animations)
   ========================================================================== */

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.setting-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

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

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

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.18);
  transition: 0.25s;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

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

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #0d281a;
}

/* Volume Slider Row */
.volume-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 8px;
}

.volume-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 90px;
}

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 0 6px var(--gold-glow);
  transition: transform 0.15s;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px var(--gold-glow);
}

.volume-value {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--gold);
  min-width: 38px;
  text-align: right;
  font-family: monospace;
}

/* ==========================================================================
   Scoreboard / Round Results Table
   ========================================================================== */

.scoreboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.scoreboard-table th {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  padding: 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.scoreboard-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.scoreboard-row.exact {
  background: rgba(46, 204, 113, 0.12);
  border-left: 3px solid var(--success);
}

.scoreboard-row.failed {
  background: rgba(231, 76, 60, 0.08);
  border-left: 3px solid var(--danger);
}

.score-tag {
  display: inline-block;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.score-tag.positive {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
}

.score-tag.zero {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

/* ==========================================================================
   Game Over Podium
   ========================================================================== */

.game-over-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.trophy-icon {
  font-size: 3.5rem;
  margin-bottom: 8px;
  animation: trophyFloat 2.5s ease-in-out infinite;
}

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

.winner-names {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.5px;
  text-shadow: 0 0 12px var(--gold-glow);
}

.winner-score {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

/* ==========================================================================
   Rules Dialog Specifics
   ========================================================================== */

.rules-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rule-item {
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.45;
}

.rule-title {
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 4px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-content,
  .trophy-icon,
  .slider,
  .slider:before {
    animation: none !important;
    transition: none !important;
  }
}
