body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(to bottom, #ffffff 0%, #154872 100%);
  font-family: 'Fredoka One', cursive;
  color: white;
}

/* Header Styles */
.game-header {
  width: 100%;
  background-color: #FF5722;
  padding: 10px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: relative;
}

.back-button {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  color: #FF5722;
  font-size: 18px;
}

.header-content {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5px 50px;
}

.header-image {
  max-height: 60px;
  max-width: 80%;
}

/* Main Content Styles */
.game-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
}

.wheel-container {
  position: relative;
  width: 80vmin;
  height: 80vmin;
}

.wheel-frame {
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  background: #fff;
  width: 100%;
  height: 100%;
  position: relative;
  padding: 5%;
  box-sizing: border-box;
}

.game-title {
  text-align: center;
  font-size: 2.5rem;
  margin: 20px 0;
  color: #FF5722;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  font-family: 'Bangers', cursive;
  letter-spacing: 2px;
  transform: rotate(-2deg);
}

@media (max-width: 600px) {
  .game-title {
    font-size: 1.5rem;
    margin: 10px 0;
  }
}

canvas#wheel {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  background: #222;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
  border: 4px solid #333;
}

#spinButton {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  font-size: 1.2rem;
  font-weight: bold;
  font-family: 'Fredoka One', cursive;
  background: #f04000;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 0 10px #000;
  color: white;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  transition: all 0.2s ease;
}

@media (max-width: 600px) {
  #spinButton {
    width: 48px;
    height: 48px;
    font-size: 0.9rem;
  }
}

#spinButton:hover {
  background: #ff5722;
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 0 15px #000;
}

.pointer.top {
  position: absolute;
  top: 5%; /* slightly above the top edge of wheel */
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 3vmin solid transparent;
  border-right: 3vmin solid transparent;
  border-top: 4vmin solid #FF5722; /* downward arrow with game theme color */
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
  z-index: 4;
  animation: pulse 1.5s infinite ease-in-out;
}

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

/* Footer Styles */
.game-footer {
  width: 100%;
  background-color: #333;
  padding: 15px 0;
  text-align: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.footer-image {
  max-height: 50px;
  max-width: 80%;
  margin-bottom: 10px;
}

.footer-content {
  color: white;
  font-size: 0.8rem;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .game-header {
    padding: 8px 0;
  }
  
  .back-button {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .header-image {
    max-height: 50px;
  }
  
  .footer-image {
    max-height: 40px;
  }
}

.popup {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

.popup-content {
  background: linear-gradient(135deg, #fff 0%, #f5f5f5 100%);
  color: #fff;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  font-family: 'Fredoka One', cursive;
  max-width: 80%;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  border: 3px solid #FF5722;
}

.popup-content p {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #FF5722;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
}

.popup-content button {
  background: #2196F3;
  color: white;
  border: none;
  padding: 10px 20px;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 5px rgba(0,0,0,0.2);
}

.popup-content button:hover {
  background: #1976D2;
  transform: scale(1.05);
}

.popup.hidden {
  display: none !important;
  visibility: hidden;
  opacity: 0;
}

.player-name {
  font-size: 1.3rem;
  color: #2196F3;
  /* margin adjustments not needed since flex handles spacing */
  margin-top: 5px;
  margin-bottom: 15px;
  text-align: left;
  min-width: 100px; /* optional, so text box doesn't shrink too much */
  font-family: 'Fredoka One', cursive;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #111; /* fully opaque dark background */
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.loading-spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #FF5722;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
}

.loading-text {
  color: #fff;
  font-size: 1.5rem;
  font-family: 'Fredoka One', cursive;
  letter-spacing: 2px;
}
