/* Sight Words One — balloon game */

.sw1-page {
  width: 100%;
  max-width: 100%;
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.sw1-page .back-link {
  align-self: flex-start;
  margin-bottom: 1rem;
}

.sw1-header {
  text-align: center;
  margin-bottom: 1rem;
}

.sw1-header h2 {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 0 var(--jungle-dark), 0 3px 10px rgba(0, 0, 0, 0.3);
}

.sw1-header p {
  margin-top: 0.35rem;
  font-size: 1rem;
  font-weight: 500;
  color: #d8f3dc;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.sw1-game {
  position: relative;
  flex: 1;
  min-height: 65vh;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(135, 206, 235, 0.45) 0%, rgba(82, 183, 136, 0.35) 100%);
  border: 4px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.15), 0 8px 24px var(--box-shadow);
}

/* Start screen */
.sw1-start {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  z-index: 10;
  background: rgba(26, 77, 46, 0.35);
  backdrop-filter: blur(2px);
}

.sw1-start.hidden {
  display: none;
}

.sw1-start-icon {
  font-size: 4rem;
  animation: sw1-bounce 1.5s ease-in-out infinite;
}

@keyframes sw1-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.sw1-start-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.35);
  max-width: 280px;
  line-height: 1.5;
}

.sw1-btn {
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--jungle-dark);
  background: linear-gradient(145deg, #fff 0%, #ffe8a3 100%);
  border: 4px solid var(--sun-yellow);
  border-radius: 16px;
  padding: 0.85rem 2rem;
  cursor: pointer;
  box-shadow: 0 5px 0 #e6a800, 0 8px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.sw1-btn:hover {
  transform: translateY(-3px);
}

.sw1-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #e6a800, 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Play area */
.sw1-play-area {
  position: absolute;
  inset: 0;
}

.sw1-play-area.hidden {
  display: none;
}

.balloon-field {
  position: absolute;
  inset: 0;
}

/* Balloons */
.balloon {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transform-origin: center bottom;
  animation: balloon-float var(--float-duration, 4s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  z-index: 2;
  touch-action: manipulation;
}

.balloon:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
  border-radius: 50%;
}

.balloon-body {
  position: relative;
  width: var(--balloon-size, 90px);
  height: calc(var(--balloon-size, 90px) * 1.2);
  border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7) 0%, transparent 45%),
    var(--balloon-color, #ff6b6b);
  box-shadow:
    inset -6px -10px 16px rgba(0, 0, 0, 0.12),
    3px 8px 16px rgba(0, 0, 0, 0.2);
}

.balloon-word {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  white-space: nowrap;
}

.balloon-knot {
  width: 10px;
  height: 8px;
  background: var(--balloon-color, #ff6b6b);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  margin-top: -2px;
}

.balloon-string {
  width: 2px;
  height: 45px;
  background: linear-gradient(180deg, rgba(80, 80, 80, 0.6), rgba(80, 80, 80, 0.2));
  border-radius: 1px;
}

@keyframes balloon-float {
  0%, 100% {
    transform: translate(0, 0) rotate(-2deg);
  }
  25% {
    transform: translate(8px, -18px) rotate(2deg);
  }
  50% {
    transform: translate(-5px, -28px) rotate(-1deg);
  }
  75% {
    transform: translate(-10px, -12px) rotate(3deg);
  }
}

.balloon.shake .balloon-body {
  animation: balloon-shake 0.5s ease-in-out;
}

@keyframes balloon-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  15% { transform: translateX(-10px) rotate(-6deg); }
  30% { transform: translateX(10px) rotate(6deg); }
  45% { transform: translateX(-8px) rotate(-5deg); }
  60% { transform: translateX(8px) rotate(5deg); }
  75% { transform: translateX(-4px) rotate(-2deg); }
}

.balloon.popping {
  animation: balloon-pop 0.45s ease-out forwards;
  pointer-events: none;
}

@keyframes balloon-pop {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  40% {
    transform: scale(1.25);
    opacity: 0.9;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* Confetti canvas */
.confetti-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

/* Win screen */
.sw1-win {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  background: rgba(26, 77, 46, 0.25);
}

.sw1-win.hidden {
  display: none;
}

.great-job {
  position: relative;
  z-index: 2;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  color: #fff;
  text-shadow:
    3px 3px 0 var(--jungle-dark),
    0 0 20px rgba(255, 209, 102, 0.8),
    0 4px 16px rgba(0, 0, 0, 0.35);
  animation: great-job-bounce 0.8s ease-in-out infinite alternate;
}

@keyframes great-job-bounce {
  0% {
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(-18px) scale(1.05);
  }
}

.fireworks-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.sw1-play-again {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

@media (max-width: 600px) {
  .sw1-game {
    min-height: 70vh;
  }

  .balloon {
    --balloon-size: 72px;
  }

  .balloon-string {
    height: 30px;
  }
}
