/* Base styles */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Main render container */
#renderDiv {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #111;
  margin: 0;
}

/* Red overlay flash for out of bounds - no layout shift */
#renderDiv::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  background: linear-gradient(
    to center,
    rgba(255, 0, 0, 0.8) 0%,
    rgba(255, 0, 0, 0.5) 20%,
    rgba(255, 0, 0, 0.3) 40%,
    rgba(255, 0, 0, 0.3) 60%,
    rgba(255, 0, 0, 0.5) 80%,
    rgba(255, 0, 0, 0.8) 100%
  );
  border: 15px solid rgba(255, 0, 0, 0.9);
  box-sizing: border-box;
  transition: opacity 0.05s ease;
}

#renderDiv.red-border-pulse::before {
  animation: redOverlayPulse 1s ease-in-out infinite;
}

@keyframes redOverlayPulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.1;
  }
  100% {
    opacity: 0.6;
  }
}

/* Out of bounds warning */
.out-of-bounds-warning {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  color: red;
  font-family: "Arial Black", Gadget, sans-serif;
  font-size: clamp(32px, 8vw, 64px);
  font-weight: bold;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
  text-align: center;
  animation: pulse 1s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0% {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
  100% {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Start overlay */
.start-overlay {
  position: absolute;
  inset: 0;
  background: url('assets/start.png') no-repeat center / cover;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  text-align: center;
  font-family: "Arial Black", Gadget, sans-serif;
}

.start-overlay .start-text-box {
  background-color: rgba(0, 0, 0, 0.4);
  padding: 10px 25px;
  border-radius: 15px;
  max-width: 90%;
}

.start-overlay h1 {
  font-size: clamp(40px, 10vw, 80px);
  margin: 0 0 20px;
  text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.9);
}

.start-overlay p {
  font-size: clamp(16px, 4.5vw, 28px);
  line-height: 1.5;
  margin: 0 0 30px;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
}

#loading-text {
  font-size: clamp(16px, 3vw, 24px) !important;
  font-style: italic;
  margin: 10px 0 0 !important;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.7);
}

/* Video element */
.game-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 0;
}

/* Three.js canvas */
.three-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Status wrapper */
.status-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: none;
  pointer-events: none;
  text-align: center;
  color: white;
  text-shadow: 2px 2px 4px black;
  font-family: "Arial Black", Gadget, sans-serif;
  padding: 20px;
  background-color:rgba(255, 255, 255, 0.3);
}

.status-text {
  font-size: clamp(36px, 12vw, 72px);
  font-weight: bold;
  /* margin-bottom: 10px; */
}

.restart-hint {
  font-size: clamp(20px, 5.5vw, 32px);
  opacity: 0.9;
}

/* Score display */
#score-display {
  position: absolute;
  top: 15px;
  left: 15px;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.6);
  color: #FFD700;
  font-family: "Arial Black", Gadget, sans-serif;
  font-size: clamp(20px, 4vw, 32px);
  font-weight: bold;
  border: 3px solid #FFD700;
  /* border-radius: 10px; */
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
  z-index: 15;
  display: none;
  transition: all 0.1s ease;
}

/* Score flash animations */
#score-display.score-flash-green {
  color: #00FF00;
  border-color: #00FF00;
  box-shadow: 0 0 25px rgba(0, 255, 0, 0.8);
  transform: scale(1.1);
}

#score-display.score-flash-red {
  color: #FF0000;
  border-color: #FF0000;
  box-shadow: 0 0 25px rgba(255, 0, 0, 0.8);
  transform: scale(1.1);
}

/* Start button */
.start-button {
  margin-top: 20px;
  padding: clamp(12px, 2.5vh, 18px) clamp(25px, 5vw, 35px);
  font-size: clamp(18px, 4.5vw, 36px);
  font-family: "Arial Black", Gadget, sans-serif;
  font-weight: bold;
  color: #fff;
  background-color: #4CAF50;
  border: 5px solid #FF476F;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s, transform 0.1s;
  display: none;
}

.start-button:hover {
  background-color: #45a049;
  transform: scale(1.05);
}

/* Countdown display */
#countdown-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(100px, 25vw, 200px);
  font-family: "Arial Black", Gadget, sans-serif;
  font-weight: bold;
  color: #00FFFF;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.7), 0 0 15px rgba(0, 200, 255, 0.5);
  z-index: 20;
  display: none;
}

/* Status text color helpers */
.status-white { color: #fff; }
.status-red { color: red; }
.status-orange { color: orange; }

/* Optional: style the player controls */
.control-bar {
  display: flex; gap: 12px; align-items: center;
  margin-top: 16px; background: rgba(0,0,0,0.5);
  padding: 8px 12px; border-radius: 10px;
}
.control-label { font-size: clamp(16px,4vw,22px); }
.player-select {
  font-size: clamp(16px,4vw,22px);
  padding: 6px 10px; border-radius: 8px;
  border: 2px solid #FF476F; background: #222; color: #fff; cursor: pointer;
}

.text-box {
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.7);
    color: black;
    font-family: "Arial", "Helvetica Neue", Helvetica, sans-serif;
    border: 2px solid black;
    box-shadow: 3px 3px 0px black;
    font-size: clamp(13px, 2vw, 15px);
    text-align: center;
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    max-width: 90%;
    box-sizing: border-box;
}

#logo-container {
    position: absolute;
    top: 10px;
    right: 10px;
}

a {
    color: #0000ff !important;
}

a:hover {
    text-decoration: underline;
}