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

/* Keelevalik */
#language-buttons {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 998; /* Vähendatud veel rohkem */
  display: flex;
  gap: 10px;
  align-items: center;
}

#language-buttons button {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  cursor: pointer;
  padding: 8px;
  transition: all 0.3s ease;
}

#language-buttons button:hover {
  background: rgba(255, 215, 0, 0.2);
  border-color: #FFD700;
  transform: scale(1.1);
}

#language-buttons button.active {
  background: rgba(255, 215, 0, 0.3);
  border-color: #FFD700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#language-buttons img {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  display: block;
}

/* Google Translate peitmine */
.goog-te-banner-frame.skiptranslate,
body > .skiptranslate {
  display: none !important;
  height: 0 !important;
}

body {
  top: 0 !important;
}

/* Moderaatori hoiatus */
.moderator-warning {
  background: linear-gradient(145deg, #cc0000, #ff0000);
  color: white;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 30px;
  text-align: center;
  border: 3px solid #ffaaaa;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
  animation: moderatorPulse 2s infinite;
}

@keyframes moderatorPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.3); }
  50% { box-shadow: 0 0 30px rgba(255, 0, 0, 0.6); }
}

.moderator-warning h3 {
  margin: 0 0 10px 0;
  font-size: 24px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.moderator-warning p {
  margin: 0;
  font-size: 16px;
}

/* Mängureeglite sektsioon */
#rulesSection {
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.8), rgba(0, 31, 63, 0.8));
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  margin: 40px auto;
  max-width: 900px;
  border: 3px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.rules-container h2 {
  color: #FFD700;
  text-align: center;
  font-size: 32px;
  margin-bottom: 30px;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.7);
}

.rules-content {
  color: white;
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 30px;
}

.rules-content h3 {
  color: #FFD700;
  margin-top: 25px;
  margin-bottom: 15px;
  font-size: 22px;
}

.rules-content ul {
  margin-left: 20px;
}

.rules-content li {
  margin-bottom: 8px;
}

.rules-content .highlight {
  background: rgba(255, 215, 0, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  color: #FFD700;
  font-weight: bold;
}

/* Ü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;
}

/* 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);
}

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

/* Kategooria sisendväljad */
.categoryInput {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 15px;
  margin: 15px 0;
  border: 1px solid rgba(255, 215, 0, 0.2);
}

.qaGroup {
  display: flex;
  gap: 10px;
  margin: 5px 0;
  flex-wrap: wrap;
}

/* Kõik sisendväljad, nupud ja rippmenüüd */
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);
}

/* 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: 3px;
  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 {
  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;
}

/* 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; }
}

.hidden {
  display: none !important;
}

.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 {
  position: absolute;
  top: 20px;
  left: 20px; /* Muutsin right-st left-ks */
  font-size: 24px;
  font-weight: bold;
  color: #FFD700;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid #FFD700;
  transition: all 0.3s ease;
  z-index: 1002; /* Veel kõrgem */
}

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

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

/* 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: 400px;
  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);
}

#scoreDisplay p {
  font-size: 18px;
  margin: 10px 0;
  color: white;
}

/* Finaalvooru stiilid */
#finalSection {
  padding: 40px;
  background: linear-gradient(145deg, rgba(0, 38, 77, 0.9), rgba(0, 12, 102, 0.9));
  backdrop-filter: blur(10px);
  border-radius: 20px;
  max-width: 900px;
  margin: 40px auto;
  color: white;
  border: 3px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.final-title {
  color: #FFD700;
  font-size: 32px;
  margin-bottom: 30px;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.final-question-container {
  background: rgba(0, 0, 0, 0.6);
  border: 3px solid #FFD700;
  border-radius: 15px;
  padding: 30px;
  margin: 30px 0;
  text-align: center;
}

.final-question {
  font-size: clamp(24px, 4vw, 36px);
  color: #FFD700;
  font-weight: bold;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
  margin: 0;
}

.final-btn {
  background: linear-gradient(145deg, #FFD700, #FFA500);
  color: #000;
  border: none;
  padding: 15px 30px;
  font-size: 18px;
  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);
  margin: 10px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

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

.timer-btn {
  font-size: 20px;
  padding: 20px 40px;
}

.final-timer {
  font-size: 48px;
  font-weight: bold;
  color: #FFD700;
  text-align: center;
  margin: 30px 0;
  text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.8);
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
  border-radius: 15px;
  border: 2px solid #FFD700;
}

.admin-info {
  background: rgba(139, 0, 0, 0.8);
  border: 2px solid #FF6B6B;
  border-radius: 10px;
  padding: 20px;
  margin: 20px 0;
  color: white;
  text-align: center;
  font-size: 20px;
}

.team-wager {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  padding: 20px;
  margin: 15px 0;
}

.team-wager h3 {
  color: #FFD700;
  margin-bottom: 15px;
}

.team-wager label {
  display: inline-block;
  width: 80px;
  font-weight: bold;
}

.team-result {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #FFD700;
  border-radius: 10px;
  padding: 20px;
  margin: 15px 0;
  transition: border-color 0.3s ease;
}

.result-btn {
  background: linear-gradient(145deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 12px 20px;
  margin: 5px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.result-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.wrong-result {
  background: linear-gradient(145deg, #f44336, #d32f2f) !important;
}

.wrong-result:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4) !important;
}

.modal-content .final-btn {
  background: linear-gradient(145deg, #ff6b35, #f7931e);
  color: white;
  border: none;
  padding: 15px 25px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 10px;
}

.modal-content .final-btn:hover {
  background: linear-gradient(145deg, #ff8559, #ffa500);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(255, 107, 53, 0.4);
}

.team-result-display {
  margin-top: 15px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
}

/* Võitja kuvamine */
#winnerDisplay {
  display: none;
  font-size: clamp(36px, 8vw, 72px);
  font-weight: 900;
  color: #FFD700;
  text-align: center;
  margin: 50px auto;
  padding: 40px;
  animation: winnerAnimation 3s 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); 
  }
}

/* Responsiivsuse parandused */
@media (max-width: 768px) {
  #gameBoard {
    grid-gap: 2px;
    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;
  }

  .qaGroup {
    flex-direction: column;
  }
}

@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;
  }
}