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

:root {
  --primary-color: #3498db;
  --secondary-color: #2ecc71;
  --background-color: #f0f4f8;
  --text-color: #2c3e50;
  --card-background: #ffffff;
  --button-color: #e74c3c;
  --scoreboard-color: #34495e;
}

body, html {
  font-family: 'Merriweather', serif;
  font-weight: 300;
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.4;
  height: 100%;
  overflow: hidden;
}

#mainContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  padding: 10px;
  box-sizing: border-box;
}

h1 {
  font-size: 3rem;
  font-weight: 900;
  color: white;
  text-align: center;
  margin: 5px 0; /* Reduced the margin */
  text-shadow: 
      2px 2px 0 #000,
      -1px -1px 0 #000,  
      1px -1px 0 #000,
      -1px 1px 0 #000,
      1px 1px 0 #000,
      3px 3px 0 #444,
      4px 4px 0 #666,
      5px 5px 0 #888,
      6px 6px 8px rgba(0,0,0,0.6);
  letter-spacing: 2px;
  line-height: 1;
}

#setupArea {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
  margin-top: 5px; /* Reduced the margin */
}

#newGameBtn, #startGameBtn, #copyGameUrl {
  width: 100%;
  padding: 8px;
  margin: 2px 0; /* Reduced the margin */
  font-size: 0.9rem;
  color: #fff;
  background-color: var(--button-color);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#newGameBtn:hover, #startGameBtn:hover {
  background-color: #c0392b;
}

.green-button {
  background-color: var(--secondary-color) !important;
}

.green-button:hover {
  background-color: #27ae60 !important;
}

#gameUrlInput {
  width: 100%;
  padding: 8px;
  margin: 2px 0; /* Reduced the margin */
  font-size: 0.9rem;
  border: 1px solid var(--primary-color);
  border-radius: 5px;
}

#currentQuestion {
  font-size: 1.5rem;
  margin: 5px 0; /* Reduced the margin */
  text-align: center;
  font-weight: 700;
}

.image-frame {
  width: 180px;
  height: 180px;
  margin: 5px auto; /* Reduced the margin */
  background-image: url('circularframeformookie.png');
  background-size: cover;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-image {
  width: 59%;
  height: 59%;
  object-fit: cover;
  border-radius: 50%;
}

.traffic-light {
  width: 60px;
  height: 20px;
  background-color: #333;
  border-radius: 10px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 5px;
  margin: 3px auto; /* Reduced the margin */
}

.light {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  opacity: 0.3;
}

.red { background-color: #ff0000; }
.yellow { background-color: #ffff00; }
.green { background-color: #00ff00; }

.active { opacity: 1; }

.scoreboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 5px 0; /* Reduced the margin */
  width: 100%;
}

.player-score {
  text-align: center;
  margin-bottom: 5px; /* Reduced the margin */
}

.player-label {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 5px;
}

.horse-wheel {
  display: flex;
  justify-content: center;
}

.letter-tile {
  width: 30px;
  height: 30px;
  background-color: #3498db;
  color: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  font-weight: bold;
  margin: 0 3px;
  border-radius: 3px;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.letter-tile.earned {
  transform: rotateY(180deg);
}

.letter-tile::after {
  content: attr(data-letter);
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: white;
  color: black;
  display: flex;
  justify-content: center;
  align-items: center;
  backface-visibility: hidden;
  transform: rotateY(180deg);
  border-radius: 3px;
}

.input-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 5px; /* Reduced the margin */
  width: 100%;
}

.input-area input {
  width: 100%;
  max-width: 300px;
  padding: 8px;
  margin-bottom: 3px; /* Reduced the margin */
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: 'Merriweather', serif;
  font-weight: 300;
}

.input-area button {
  width: 100%;
  max-width: 300px;
  padding: 8px;
  font-size: 14px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Merriweather', serif;
  font-weight: 700;
}

.suggestions {
  width: 100%;
  max-width: 300px;
  max-height: 100px;
  overflow-y: auto;
  background-color: var(--card-background);
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  display: none;
}

.suggestion-item {
  padding: 5px;
  cursor: pointer;
  font-size: 12px;
}

#result {
  text-align: center;
  font-size: 1rem;
  margin-top: 5px;
  font-weight: 700;
}

#gameArea {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 5px; /* Reduced the margin */
}

@keyframes popInAndRotate {
  0% { transform: scale(0) rotate(0deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(10deg); opacity: 1; }
  80% { transform: scale(0.9) rotate(-5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.pow-animation {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #ffff00;
  color: #ff0000;
  font-size: 48px;
  font-weight: bold;
  padding: 20px 40px;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  animation: popInAndRotate 0.6s ease-out;
  z-index: 1000;
  text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
}

.pow-animation::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 3px solid #ff0000;
  border-radius: 25px;
  animation: pulse 0.6s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.1); opacity: 0.7; }
}

@media (min-width: 768px) {
  #mainContainer {
    max-width: 768px;
    margin: 0 auto;
  }
  
  h1 {
    font-size: 4rem;
  }
  
  #currentQuestion {
    font-size: 1.8rem;
  }
  
  .image-frame {
    width: 220px;
    height: 220px;
  }
  
  .letter-tile {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
}
