/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700;900&display=swap');

/* Üldine taust ja tekstistiil */
body {
  font-family: 'Roboto', Arial, sans-serif;
  background: linear-gradient(135deg, #000c66 0%, #001f3f 50%, #000c66 100%);
  background-attachment: fixed;
  color: #fff;
  text-align: center;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Dekoratiivne taustagraafika */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Setup: round selector bar */
.setup-round-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  background: rgba(0, 0, 0, 0.35);
}

.setup-round-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.setup-round-label {
  font-weight: 900;
  color: #FFD700;
  opacity: 0.95;
}

/* Hõbevillak banner (modal) */
.silverBanner {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  letter-spacing: 1px;
  color: #FFD700;
  text-shadow: 3px 3px 10px rgba(0,0,0,0.75);
  margin: 10px 0 10px 0;
}

.silverSub {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 12px;
}

.silverBetRow {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.silverBetRow input {
  width: 180px;
  text-align: center;
  font-weight: 900;
  font-size: 18px;
}

/* Pealkiri Kuldvillak */
h1 {
  font-size: clamp(28px, 6vw, 48px);
  margin: 20px 0;
  color: #FFD700;
  text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.8);
  font-weight: 900;
  letter-spacing: 2px;
  position: relative;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #FFD700, transparent);
}

h2 {
  color: #FFD700;
  margin-bottom: 15px;
}

h3 {
  color: #FFD700;
}

/* Üldine peidetud klass */
.hidden {
  display: none !important;
}

/* Sound control */
.sound-control {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.sound-control button {
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 10px;
  background: linear-gradient(145deg, #4CAF50, #45a049);
}

.sound-control button.disabled {
  background: linear-gradient(145deg, #999, #666);
}

/* Mode selection */
.mode-selection {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mode-card {
  width: min(720px, 95vw);
  background: linear-gradient(145deg, rgba(0,0,0,0.85), rgba(0,31,63,0.85));
  border: 2px solid rgba(255,215,0,0.35);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  text-align: center;
}

.mode-card h2 {
  margin: 0 0 18px 0;
  color: #FFD700;
  font-size: 28px;
  font-weight: 900;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 12px 0 14px 0;
}

.mode-btn {
  border: 0;
  cursor: pointer;
  padding: 16px 14px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 900;
  color: #000;
  background: linear-gradient(145deg, #FFD700, #FFA500);
  box-shadow: 0 10px 25px rgba(255,215,0,0.25);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.mode-btn:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.05);
}

.mode-btn.secondary {
  width: 100%;
  background: linear-gradient(145deg, #6dd5ff, #2193b0);
  color: #001;
  margin-top: 6px;
}

.mode-hint {
  margin: 14px 0 0 0;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  line-height: 1.4;
}

/* Admin badge */
.admin-badge {
  display: inline-block;
  margin: 10px auto 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.5px;
  background: rgba(255,215,0,0.15);
  border: 1px solid rgba(255,215,0,0.35);
  color: #FFD700;
}

/* Setup section */
#setupSection {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  margin: 20px auto;
  border: 2px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Kõik sisendväljad, nupud */
input, button, select {
  padding: 12px 16px;
  margin: 8px;
  border-radius: 8px;
  border: 2px solid rgba(255, 215, 0, 0.3);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

input:focus, select:focus {
  outline: none;
  border-color: #FFD700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
  background: rgba(255, 255, 255, 0.15);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Nuppude stiil */
button {
  background: linear-gradient(145deg, #008CBA, #005f73);
  color: white;
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 140, 186, 0.3);
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover {
  background: linear-gradient(145deg, #00a8d6, #007a8a);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 140, 186, 0.4);
}

button:hover::before {
  left: 100%;
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Start-nupu eriline stiil */
#startGameBtn {
  background: linear-gradient(145deg, #FFD700, #FFA500);
  color: #000;
  border: none;
  padding: 15px 30px;
  font-size: 20px;
  font-weight: 900;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#startGameBtn:hover {
  background: linear-gradient(145deg, #FFED4E, #FF8C00);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
}

/* Mängulaua paigutus */
#gameBoard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-gap: 8px;
  background-color: rgba(0, 0, 0, 0.8);
  padding: 15px;
  border-radius: 12px;
  margin: 20px auto;
  max-width: 1200px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Kategooria- ja küsimuselahtrid */
.category, .cell {
  background: linear-gradient(145deg, #1e1ead, #2a2acd);
  color: #FFD700;
  border: 2px solid rgba(255, 215, 0, 0.2);
  font-weight: bold;
  text-align: center;
  padding: 15px;
  cursor: pointer;
  min-height: 60px;
  transition: all 0.3s ease;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.category::before, .cell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 215, 0, 0.1) 50%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category:hover::before, .cell:hover::before {
  opacity: 1;
}

/* Kategoorianimed */
.category {
  font-size: clamp(16px, 3vw, 22px);
  background: linear-gradient(145deg, #001f3f, #003366);
  color: #FFD700;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 3px solid rgba(255, 215, 0, 0.4);
}

.category:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
}

/* Küsimuste lahtrid */
.cell {
  font-size: clamp(20px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  font-weight: 900;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.cell:hover:not(.answered) {
  background: linear-gradient(145deg, #2a2aff, #3d3dff);
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(42, 42, 255, 0.4);
  border-color: #FFD700;
}

/* Vastatud küsimused */
.cell.answered {
  background: linear-gradient(145deg, #333, #555);
  color: #888;
  cursor: not-allowed;
  opacity: 0.5;
  transform: none !important;
  pointer-events: none;
}

.cell.answered:hover {
  transform: none !important;
  box-shadow: none !important;
  background: linear-gradient(145deg, #333, #555) !important;
}

/* Keegi ei vastanud — eristuv hall-oranž toon */
.cell.noanswer {
  background: linear-gradient(145deg, #3a2800, #5a3e00);
  color: #888;
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
  pointer-events: none;
}

.cell.noanswer:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Küsimuse modaalaken */
#questionModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: rgba(0, 0, 0, 0.8);
  padding: 30px;
  border-radius: 15px;
  border: 2px solid #FFD700;
  max-width: 90%;
  text-align: center;
}

/* Küsimuse tekst modaalis */
#modalQuestion {
  font-size: clamp(24px, 5vw, 42px);
  font-weight: 700;
  color: white;
  margin: 30px;
  text-align: center;
  line-height: 1.4;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
  background: rgba(0, 0, 0, 0.3);
  padding: 30px;
  border-radius: 15px;
  border: 2px solid rgba(255, 215, 0, 0.3);
}

/* Vastuse tekst modaalis */
#modalAnswer {
  font-size: clamp(18px, 3vw, 24px);
  margin: 20px;
  color: #90EE90;
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid #90EE90;
  text-align: center;
}

/* Taimer */
#timerDisplay {
  font-size: 28px;
  font-weight: bold;
  color: #FFD700;
  background: rgba(0, 0, 0, 0.8);
  padding: 12px 24px;
  border-radius: 10px;
  border: 2px solid #FFD700;
  transition: all 0.3s ease;
  display: inline-block;
  margin: 10px;
}

#timerDisplay.warning {
  animation: timerPulse 0.5s infinite;
  border-color: #ff4444;
  color: #ff4444;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Tiimi vastamisnuppude stiil */
#modalTeams button {
  font-size: 18px;
  padding: 15px 25px;
  margin: 10px;
  min-width: 120px;
  border-radius: 10px;
  background: linear-gradient(145deg, #4CAF50, #45a049);
  border: 2px solid rgba(255, 215, 0, 0.3);
}

#modalTeams button:hover {
  background: linear-gradient(145deg, #5CBF60, #4CAF50);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(76, 175, 80, 0.4);
}

#modalTeams button:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
}

/* Õige/Vale nupud */
#correctBtn {
  background: linear-gradient(145deg, #4CAF50, #45a049);
  color: white;
}

#correctBtn:hover {
  background: linear-gradient(145deg, #5CBF60, #4CAF50);
}

#wrongBtn {
  background: linear-gradient(145deg, #f44336, #d32f2f);
  color: white;
}

#wrongBtn:hover {
  background: linear-gradient(145deg, #ff6659, #f44336);
}

/* Keegi ei vastanud nupp */
#noAnswerBtn {
  background: linear-gradient(145deg, #ff9800, #f57c00);
  color: white;
}

#noAnswerBtn:hover {
  background: linear-gradient(145deg, #ffb74d, #ff9800);
}

/* Skooride ala kujundus */
#scoreDisplay {
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.8), rgba(0, 31, 63, 0.8));
  backdrop-filter: blur(10px);
  padding: 25px;
  border-radius: 15px;
  max-width: 600px;
  margin: 30px auto;
  border: 2px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

#scoreDisplay h3 {
  color: #FFD700;
  margin-bottom: 15px;
  font-size: 24px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.score-label {
  font-size: 20px;
  font-weight: 900;
}

.score-controls {
  display: flex;
  gap: 8px;
}

.score-controls button {
  padding: 6px 12px;
  margin: 0;
  font-size: 14px;
}

/* Võitja kuvamine */
#winnerDisplay {
  font-size: clamp(36px, 8vw, 72px);
  font-weight: 900;
  color: #FFD700;
  text-align: center;
  margin: 50px auto;
  padding: 40px;
  animation: winnerAnimation 1.5s ease-out forwards;
  text-shadow: 4px 4px 12px rgba(0, 0, 0, 0.8);
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.8), rgba(0, 31, 63, 0.8));
  backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 4px solid #FFD700;
  box-shadow: 0 15px 40px rgba(255, 215, 0, 0.4);
  max-width: 800px;
  line-height: 1.2;
}

@keyframes winnerAnimation {
  0% { 
    opacity: 0; 
    transform: scale(0.3) rotate(-10deg); 
  }
  50% { 
    opacity: 1; 
    transform: scale(1.2) rotate(5deg); 
  }
  100% { 
    opacity: 1; 
    transform: scale(1) rotate(0deg); 
  }
}

/* Rules section */
#rulesSection {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  margin: 20px auto;
  border: 2px solid rgba(255, 215, 0, 0.3);
}

#rulesSection ul {
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

#rulesSection li {
  margin: 10px 0;
}

/* Responsiivsuse parandused */
@media (max-width: 768px) {
  #gameBoard {
    grid-gap: 4px;
    padding: 10px;
    margin: 10px;
  }
  
  .cell, .category {
    padding: 10px;
    min-height: 50px;
  }
  
  .cell {
    height: 60px;
    font-size: clamp(16px, 5vw, 24px);
  }
  
  #modalQuestion {
    font-size: clamp(20px, 6vw, 32px);
    margin: 15px;
    padding: 20px;
  }
  
  #setupSection {
    margin: 10px;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .category {
    font-size: clamp(12px, 4vw, 16px);
  }
  
  .cell {
    font-size: clamp(14px, 4vw, 20px);
    height: 50px;
  }
  
  #modalTeams button {
    font-size: 14px;
    padding: 10px 15px;
    min-width: 80px;
  }
}

/* Splash screen for display mode */
.splash-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #000c66 0%, #001f3f 50%, #000c66 100%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: splashFadeIn 1s ease-out;
}

@keyframes splashFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.splash-content {
  text-align: center;
  animation: splashBounce 1.5s ease-out;
}

@keyframes splashBounce {
  0% { transform: scale(0.3) translateY(-100px); opacity: 0; }
  50% { transform: scale(1.1) translateY(0); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.splash-title {
  font-size: clamp(48px, 12vw, 120px);
  font-weight: 900;
  color: #FFD700;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.8),
               0 0 60px rgba(255, 215, 0, 0.5),
               4px 4px 20px rgba(0, 0, 0, 0.9);
  margin: 0;
  letter-spacing: 8px;
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8),
                 0 0 60px rgba(255, 215, 0, 0.5),
                 4px 4px 20px rgba(0, 0, 0, 0.9);
  }
  to {
    text-shadow: 0 0 40px rgba(255, 215, 0, 1),
                 0 0 80px rgba(255, 215, 0, 0.7),
                 4px 4px 20px rgba(0, 0, 0, 0.9);
  }
}

.splash-subtitle {
  font-size: clamp(18px, 4vw, 32px);
  color: rgba(255, 255, 255, 0.9);
  margin-top: 30px;
  font-weight: 700;
  letter-spacing: 2px;
  animation: fadeInUp 1s ease-out 0.5s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.splash-loader {
  width: 80px;
  height: 80px;
  margin: 40px auto 0;
  border: 6px solid rgba(255, 215, 0, 0.2);
  border-top-color: #FFD700;
  border-radius: 50%;
  animation: spin 1s linear infinite, fadeInUp 1s ease-out 0.8s both;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Category introduction slides */
.category-intro {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #000c66 0%, #001f3f 50%, #000c66 100%);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: categorySlideIn 0.5s ease-out;
}

@keyframes categorySlideIn {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.category-intro-content {
  text-align: center;
  padding: 40px;
}

.category-intro-title {
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 900;
  color: #FFD700;
  text-transform: uppercase;
  letter-spacing: 6px;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.8),
               0 0 60px rgba(255, 215, 0, 0.5),
               4px 4px 20px rgba(0, 0, 0, 0.9);
  animation: categoryZoom 0.8s ease-out;
  padding: 40px;
  border: 4px solid rgba(255, 215, 0, 0.5);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

@keyframes categoryZoom {
  0% {
    transform: scale(0.3) rotate(-10deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
/* Finaalvooru read */
.final-row{
  display:flex;
  align-items:center;
  gap:10px;
  justify-content:space-between;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,0.15);
  border-radius:10px;
  background: rgba(0,0,0,0.25);
}
.final-row input{
  width:120px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.35);
  color:#fff;
}
.final-row .mini{
  opacity:0.8;
  font-size:12px;
}
.final-row .pill{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  cursor:pointer;
  font-weight:800;
}
.final-row .pill.active{
  background: rgba(80,200,120,0.25);
  border-color: rgba(80,200,120,0.5);
}
.final-row .pill.bad.active{
  background: rgba(255,80,80,0.25);
  border-color: rgba(255,80,80,0.5);
}
.final-modal{
  max-width: 900px;
  margin: 20px auto;
  padding: 22px;
  border: 2px solid rgba(255,215,0,0.7);
  border-radius: 16px;
  background: rgba(0,0,0,0.75);
}

.final-modal-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  margin-bottom: 14px;
}

.final-kicker{ color:#FFD700; font-weight:900; letter-spacing:0.06em; font-size:12px; }
.final-title{ font-size:22px; font-weight:900; color:#FFD700; }

.final-box{
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 14px;
  padding: 14px;
  margin: 14px 0;
}

.final-bigtext{ font-size:22px; font-weight:800; }
.final-sub{ opacity:0.85; margin-top:6px; font-size:12px; }

.final-wagers{ display:flex; flex-direction:column; gap:10px; margin-top: 14px; }

.team-wager{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px;
  border-radius:12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

.team-name{ font-weight:900; font-size:16px; }
.team-score{ opacity:0.85; font-size:12px; margin-top:2px; }

.team-wager-right input{
  width: 160px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,215,0,0.5);
  background: rgba(0,0,0,0.35);
  color: #fff;
}

.final-actions{ margin-top: 16px; display:flex; justify-content:center; }
.final-btn.big{ font-size:18px; font-weight:900; padding: 12px 18px; }
.final-btn.small{ font-size:12px; padding: 8px 10px; }