:root {
  --game-bg: linear-gradient(180deg, #42a5f5 0%, #90caf9 50%, #e3f2fd 82%, #c8e6c9 100%);
}

.top-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 16px;
  box-sizing: border-box;
  gap: 12px;
  z-index: 30;
}

.top-controls .instruction-banner {
  flex: 1;
  margin: 0;
}

.release-all-btn {
  background: linear-gradient(135deg, #ff4081 0%, #f50057 100%);
  color: #ffffff;
  border: 2px solid #ff80ab;
  font-size: 15px;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(245, 0, 87, 0.4);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, opacity 0.2s;
  outline: none;
}

.release-all-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 18px rgba(245, 0, 87, 0.5);
}

.release-all-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.release-all-btn:focus-visible {
  outline: 3px solid #ffb300;
  outline-offset: 2px;
}

.release-all-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: grayscale(0.4);
}

.balloon-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.balloon-field:focus-visible {
  outline: 4px solid #ffb300;
  outline-offset: -4px;
}

/* Sky Scenery: Clouds & Smiling Sun */
.sky-scenery {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.smiling-sun {
  position: absolute;
  top: 14px;
  right: 20px;
  font-size: 56px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 6px 16px rgba(255, 215, 64, 0.6));
  animation: sun-pulse 4s infinite ease-in-out alternate;
  outline: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 4px;
}

.smiling-sun:hover {
  transform: scale(1.15) rotate(15deg);
}

.smiling-sun:active {
  transform: scale(0.95);
}

.smiling-sun:focus-visible {
  outline: 3px solid #ffb300;
  outline-offset: 4px;
  border-radius: 50%;
}

.smiling-sun.sun-spin {
  animation: sun-spin-burst 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes sun-spin-burst {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.3) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

@keyframes sun-pulse {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.1) rotate(15deg); }
}

.cloud {
  position: absolute;
  font-size: 48px;
  line-height: 1;
  opacity: 0.85;
  filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.6));
  pointer-events: none;
}

.c1 { top: 40px; left: 8%; animation: cloud-float 22s linear infinite; }
.c2 { top: 90px; right: 15%; animation: cloud-float 28s linear infinite reverse; font-size: 56px; }
.c3 { top: 160px; left: 25%; animation: cloud-float 25s linear infinite; font-size: 42px; }

@keyframes cloud-float {
  0% { transform: translateX(-40px); }
  50% { transform: translateX(50px); }
  100% { transform: translateX(-40px); }
}

/* Sky Area for Released Balloons */
.sky-area {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

.flying-balloon {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  pointer-events: auto;
  animation: balloon-ascend-sway 3.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  outline: none;
}

@keyframes balloon-ascend-sway {
  0% { transform: translateY(0) translateX(0) scale(1); opacity: 1; }
  30% { transform: translateY(-30vh) translateX(var(--drift, 30px)) scale(0.95); }
  60% { transform: translateY(-65vh) translateX(calc(var(--drift, 30px) * -0.6)) scale(0.85); }
  100% { transform: translateY(-120vh) translateX(var(--drift, 30px)) scale(0.65); opacity: 0; }
}

.flying-balloon .flying-string {
  width: 2px;
  height: 60px;
  background: rgba(255, 255, 255, 0.85);
  margin-top: -6px;
  animation: string-flutter 0.6s ease-in-out infinite alternate;
}

@keyframes string-flutter {
  0% { transform: rotate(-8deg); }
  100% { transform: rotate(8deg); }
}

/* Sparkles Container */
.sparkles-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}

.balloon-spark {
  position: absolute;
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  animation: spark-drift 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes spark-drift {
  0% { transform: translate(0, 0) scale(0.4); opacity: 1; }
  100% { transform: translate(var(--tx, 0), var(--ty, -50px)) scale(1.3) rotate(var(--rot, 30deg)); opacity: 0; }
}

/* Teddy Stage & Meadow Hill */
.teddy-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  z-index: 10;
}

.meadow-grass {
  width: 100%;
  height: 60px;
  background: linear-gradient(180deg, #81c784 0%, #4caf50 50%, #388e3c 100%);
  border-radius: 50% 50% 0 0 / 25px 25px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 20px;
  box-shadow: 0 -4px 14px rgba(56, 142, 60, 0.3);
  z-index: 6;
}

.flower {
  font-size: 26px;
  line-height: 1;
  pointer-events: none;
  animation: flower-sway 3s ease-in-out infinite alternate;
}

.f1 { animation-duration: 2.5s; }
.f2 { animation-duration: 3.2s; font-size: 30px; }
.f3 { animation-duration: 2.8s; }

@keyframes flower-sway {
  0% { transform: rotate(-6deg); }
  100% { transform: rotate(6deg); }
}

/* Teddy Bear Button */
.teddy-bear-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: -15px;
  outline: none;
  z-index: 8;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.teddy-bear-btn:hover {
  transform: scale(1.1);
}

.teddy-bear-btn:active {
  transform: scale(0.95);
}

.teddy-bear-btn:focus-visible {
  outline: 3px solid #ffb300;
  border-radius: 50%;
}

.teddy-icon {
  font-size: min(34vw, 145px);
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
  transition: transform 0.2s ease;
}

.teddy-paw {
  position: absolute;
  top: 10px;
  right: -8px;
  font-size: 40px;
  line-height: 1;
  transform-origin: bottom center;
  display: inline-block;
}

.teddy-waving .teddy-paw {
  animation: paw-wave 0.5s ease-in-out 4;
}

.teddy-celebrating .teddy-paw {
  animation: paw-wave 0.35s ease-in-out infinite alternate;
}

.teddy-celebrating .teddy-icon {
  animation: teddy-bounce 0.6s ease-in-out infinite alternate;
}

@keyframes paw-wave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(25deg) scale(1.15); }
}

@keyframes teddy-bounce {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(1.16) translateY(-14px) rotate(3deg); }
}

/* Balloons Bouquet */
.balloons-bunch {
  position: absolute;
  top: -140px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  z-index: 12;
  pointer-events: auto;
}

.balloons-bunch.bunch-entering {
  animation: bouquet-arrive 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bouquet-arrive {
  0% {
    transform: translateY(-70px) scale(0.65);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.balloon-item {
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  user-select: none;
}

.balloon-item:hover:not(:disabled) {
  transform: scale(1.15) translateY(-6px);
}

.balloon-item:disabled {
  pointer-events: none;
  cursor: default;
}

.balloon-item:focus-visible .balloon-body {
  box-shadow: 0 0 0 4px #ffee58, inset -6px -8px 12px rgba(0, 0, 0, 0.25), inset 6px 8px 10px rgba(255, 255, 255, 0.6);
  transform: scale(1.12);
}

.balloon-body {
  width: 58px;
  height: 72px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset -6px -8px 12px rgba(0, 0, 0, 0.25), inset 6px 8px 10px rgba(255, 255, 255, 0.6), 0 8px 18px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s ease;
  animation: balloon-bob 2.8s ease-in-out infinite alternate;
}

.balloon-body::after {
  content: '';
  position: absolute;
  bottom: -5px;
  width: 8px;
  height: 6px;
  background: inherit;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.balloon-body.b-red { background: linear-gradient(135deg, #ff5252 0%, #e53935 60%, #b71c1c 100%); animation-duration: 2.6s; }
.balloon-body.b-blue { background: linear-gradient(135deg, #40c4ff 0%, #0091ea 60%, #01579b 100%); animation-duration: 3.1s; }
.balloon-body.b-yellow { background: linear-gradient(135deg, #ffee58 0%, #fbc02d 60%, #f57f17 100%); animation-duration: 2.4s; }
.balloon-body.b-green { background: linear-gradient(135deg, #69f0ae 0%, #00c853 60%, #1b5e20 100%); animation-duration: 3.3s; }
.balloon-body.b-star {
  background: linear-gradient(135deg, #ffd54f 0%, #ffb300 60%, #ff8f00 100%);
  animation-duration: 2.9s;
  font-size: 32px;
  color: #ffffff;
}

@keyframes balloon-bob {
  0% { transform: translateY(0) rotate(-3deg); }
  100% { transform: translateY(-12px) rotate(4deg); }
}

.balloon-string {
  width: 2px;
  height: 70px;
  background: rgba(255, 255, 255, 0.9);
  margin-top: 1px;
  transform-origin: top center;
  animation: string-sway 2.8s ease-in-out infinite alternate;
}

@keyframes string-sway {
  0% { transform: rotate(-5deg); }
  100% { transform: rotate(5deg); }
}

@media (max-width: 420px) {
  .balloon-body { width: 48px; height: 62px; }
  .balloon-string { height: 55px; }
  .balloons-bunch { top: -115px; gap: 6px; }
  .balloon-body.b-star { font-size: 26px; }
  .top-controls { padding: 4px 8px; gap: 6px; }
  .release-all-btn { font-size: 13px; padding: 4px 10px; }
}

@media (max-height: 600px) {
  .teddy-icon { font-size: min(28vw, 110px); }
  .balloon-body { width: 48px; height: 60px; }
  .balloons-bunch { top: -110px; gap: 8px; }
  .release-all-btn { font-size: 13px; padding: 4px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .smiling-sun,
  .cloud,
  .flower,
  .balloon-body,
  .balloon-string,
  .teddy-paw,
  .teddy-waving .teddy-paw,
  .teddy-celebrating .teddy-paw,
  .teddy-celebrating .teddy-icon,
  .balloons-bunch.bunch-entering {
    animation: none !important;
    transition: none !important;
  }

  .flying-balloon {
    animation: balloon-fade-reduced 1.8s ease-out forwards !important;
  }
}

@keyframes balloon-fade-reduced {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-45vh); opacity: 0; }
}
