body, html {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

#rainbow-racer-game {
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
  font-family: 'Comic Sans MS', cursive;
  background: linear-gradient(to top, #ffe8f1, #ffffff);
  padding: 20px;
}

.start-screen, .team-input-screen, .car-select-screen, .turn-screen,
.race-track, .end-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 90vh;
}

.mode-btn, #proceed-teams, #start-turn {
  padding: 1em 2em;
  margin: 10px;
  border: none;
  background: linear-gradient(45deg, #ff7edb, #91faff);
  color: white;
  border-radius: 12px;
  font-size: 1.2rem;
  cursor: pointer;
  animation: bounce 1s infinite alternate;
}

input[type="text"] {
  margin: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid #ddd;
  font-size: 1rem;
}

.car-options {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-top: 1em;
  margin-inline: auto;
  width: 100%;
  padding: 0 10px;
  box-sizing: border-box;
}

.car-option {
  width: 30vw;
	max-width: 100px;
  height: auto;
	aspect-ratio: 2.5 / 1;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 10px;
  transition: transform 0.2s;
}
.car-option:hover {
  transform: scale(1.1);
}
.car-option.selected {
  border-color: #ff69b4;
  box-shadow: 0 0 10px #ff69b4;
}
.bounce {
  animation: car-bounce 1s infinite ease-in-out;
}

@keyframes car-bounce {
  0% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

.team-flash {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: #ffffff;
  background-color: #ff69b4;
  padding: 1em 2em;
  border-radius: 20px;
  box-shadow: 0 0 30px #ffb6c1;
  z-index: 999;
  animation: flashScale 3s ease-in-out;
  max-width: 90%;
  text-align: center;
}

.race-track {
  position: relative;
  background: linear-gradient(#7af, #e2f2ff);
  height: 400px;
  width: 100%;
  overflow: hidden;
}

.car-anim {
  width: 60px;
  height: 30px;
  background-repeat: no-repeat;
  background-size: contain;
  position: absolute;
  bottom: 20px;
  left: 0;
  transition: left 0.1s ease;
}

#obstacles-container {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  height: 100px;
  pointer-events: none;
}

.obstacle {
  position: absolute;
  bottom: 0;
  width: 40px;
  height: 40px;
  background-size: contain;
  background-repeat: no-repeat;
}

.obstacle.oil { background-image: url('images/oil-spill.png'); }
.obstacle.cone { background-image: url('images/traffic-cone.png'); }

.start-line-img, .finish-line-img {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 80px;
  width: auto;
  z-index: 15;
  pointer-events: none;
}
.start-line-img { left: 0; }
.finish-line-img { right: 0; }

.car-anim {
  width: 100px; /* Increased from 60px */
  height: 50px;  /* Increased from 30px */
  transition: left 0.1s ease, transform 0.1s ease;
}

.scoreboard {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.7);
  padding: 10px;
  border-radius: 10px;
}

.controls-guide, .mobile-instruction {
  font-size: 0.9rem;
  color: #333;
  margin-top: 5px;
  display: block;
}

.end-screen {
  background-color: #fffafc;
  position: relative;
  padding: 2em;
}

#reveal-text {
  font-size: 2rem;
  font-weight: bold;
  color: #ff69b4;
  margin-bottom: 20px;
}

#team-stats {
  font-size: 1.2rem;
  margin-top: 10px;
}

.share-buttons a, .share-buttons button {
  display: inline-block;
  margin: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #ff90c2;
  color: white;
  text-decoration: none;
  transition: background 0.3s;
}

.share-buttons a:hover, .share-buttons button:hover { background: #ff5ea2; }

#sparkle-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  animation: sparkle-blink 1.2s infinite ease-in-out;
}

@keyframes sparkle-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.end-screen button {
  padding: 12px 20px;
  background-color: #ff69b4;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  margin-top: 15px;
  transition: background 0.3s;
}
.end-screen button:hover {
  background-color: #ff2f92;
}

#rainbow-racer-game {
  display: none;
}

/* Enhanced Host Intro Styling */
.host-intro {
  text-align: center;
  background: linear-gradient(145deg, #fff0f5, #e0ffff);
  padding: 25px;
  margin-bottom: 30px;
  border-radius: 14px;
  box-shadow: 0 0 25px rgba(255, 182, 193, 0.5);
  animation: glowBox 5s ease-in-out infinite alternate;
}
.host-intro h2 {
  font-size: 2rem;
  color: #ff69b4;
  text-shadow: 2px 2px 4px #ffc0cb;
  margin-bottom: 15px;
}
.host-intro p {
  font-size: 1.1rem;
  color: #444;
  margin: 8px 0;
}

/* Gender Selection Box */
.gender-select {
  text-align: center;
  padding: 15px;
  border: 2px dashed #ffb6c1;
  margin-top: 15px;
  border-radius: 12px;
  background: #fffafc;
  animation: pulseBox 3s ease-in-out infinite;
}
.gender-select label {
  display: block;
  font-size: 1.2rem;
  margin: 10px 0;
  color: #333;
}
.gender-select input {
  margin-right: 8px;
}

/* Generate & Copy Buttons */
#generate-link,
#copy-link-btn {
  padding: 10px 18px;
  background: linear-gradient(90deg, #ff69b4, #ffa07a);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s;
  margin-top: 10px;
}
#generate-link:hover,
#copy-link-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(90deg, #ffa07a, #ff69b4);
}

/* Link Copy UI */
.generated-link-container {
  text-align: center;
}
.generated-link-container input {
  width: 90%;
  max-width: 400px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}
.copy-status {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.95rem;
  color: green;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* Glowing + Pulsing Animations */
@keyframes glowBox {
  0% { box-shadow: 0 0 15px rgba(255, 182, 193, 0.2); }
  100% { box-shadow: 0 0 35px rgba(255, 182, 193, 0.8); }
}
@keyframes pulseBox {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}

.hidden { display: none !important; }
@keyframes flashScale {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

@media screen and (max-width: 768px) {
  .car-anim { width: 80px; height: 40px; }
  .mode-btn { font-size: 1rem; }
  .start-line-img, .finish-line-img { height: 60px; }
}
@media screen and (max-width: 1024px){
  .controls-guide { display: none !important; }
  .mobile-instruction { display: block !important; }
  .start-line-img, .finish-line-img { height: 70px; }
}

@media screen and (max-width: 480px) {
  .team-flash { font-size: 1.2rem; padding: 0.8em 1.5em; }
  .mode-btn,
  #proceed-teams,
  #start-turn { font-size: 1rem; padding: 0.8em 1.5em; }
  #car-select-heading { font-size: 1.3rem; }
  .end-screen button { font-size: 1rem; }
  .start-line-img, .finish-line-img { height: 50px; }
}