:root {
  --game-bg: radial-gradient(circle at 50% 25%, #e0f7fa 0%, #80deea 50%, #26c6da 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;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 800;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  user-select: none;
  white-space: nowrap;
}

.foam-btn {
  background: linear-gradient(135deg, #f48fb1 0%, #ec407a 100%);
  color: #ffffff;
  border-color: #f8bbd0;
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.35);
}

.shower-btn {
  background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
  color: #ffffff;
  border-color: #90caf9;
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.35);
}

.tool-btn:hover {
  transform: translateY(-2px) scale(1.05);
}

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

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

.tool-btn.active-tool {
  box-shadow: 0 0 0 3px #ffffff, 0 0 16px rgba(33, 150, 243, 0.8);
  animation: tool-pulse 0.7s ease-in-out infinite alternate;
}

@keyframes tool-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

.shower-btn.pulse-invite {
  animation: shower-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes shower-pulse {
  0% { transform: scale(1); box-shadow: 0 4px 12px rgba(30, 136, 229, 0.35); }
  100% { transform: scale(1.08); box-shadow: 0 0 0 3px #ffffff, 0 0 16px rgba(30, 136, 229, 0.7); }
}

.bath-field {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  position: relative;
  overflow: hidden;
  padding-bottom: 20px;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

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

/* Bathroom Wall Lighting */
.bathroom-wall {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 10%, rgba(255, 255, 255, 0.5) 0%, transparent 65%);
  pointer-events: none;
  z-index: 1;
}

/* Shower Water Streams */
.water-streams {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 90px;
  pointer-events: none;
  overflow: hidden;
  z-index: 25;
}

.water-stream-drop {
  position: absolute;
  width: 6px;
  height: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(66, 165, 245, 0.8) 100%);
  border-radius: 3px;
  filter: drop-shadow(0 2px 6px rgba(33, 150, 243, 0.5));
  animation: drop-fall 0.45s linear infinite;
}

@keyframes drop-fall {
  0% { transform: translateY(-40px); opacity: 0; }
  25% { opacity: 0.95; }
  80% { opacity: 0.9; }
  100% { transform: translateY(min(600px, 75vh)); opacity: 0; }
}

/* Bathtub Basin Stage */
.tub-stage {
  position: relative;
  width: min(88vw, 380px);
  height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  cursor: pointer;
  z-index: 10;
}

/* Water Waves in Tub */
.tub-water-layer {
  position: absolute;
  bottom: 45px;
  left: 12px;
  right: 12px;
  height: 90px;
  background: linear-gradient(180deg, #4dd0e1 0%, #00acc1 60%, #00838f 100%);
  border-radius: 0 0 35px 35px;
  overflow: hidden;
  z-index: 2;
  box-shadow: inset 0 6px 12px rgba(255, 255, 255, 0.4);
}

.water-wave {
  position: absolute;
  top: 0;
  left: -20%;
  right: -20%;
  height: 16px;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  animation: wave-sway 2.8s ease-in-out infinite alternate;
}

.w2 {
  top: 4px;
  animation-duration: 3.5s;
  animation-direction: alternate-reverse;
  opacity: 0.6;
}

@keyframes wave-sway {
  0% { transform: translateX(-15px) scaleY(0.9); }
  100% { transform: translateX(15px) scaleY(1.2); }
}

/* Yellow Rubber Ducky */
.duck-hero {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: max-content;
  bottom: 85px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 8;
  outline: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: duck-swim-bob 2.8s ease-in-out infinite alternate;
}

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

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

.duck-hero:hover {
  transform: scale(1.15) translateY(-6px);
}

.duck-hero:active {
  transform: scale(0.92);
}

.duck-diving {
  animation: duck-dive 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes duck-dive {
  0% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(35px) rotate(35deg) scale(0.85); }
  70% { transform: translateY(-16px) rotate(-15deg) scale(1.1); }
  100% { transform: translateY(0) rotate(0deg); }
}

.duck-foam-hat {
  position: absolute;
  top: -12px;
  left: 20%;
  font-size: 34px;
  animation: hat-wobble 1.5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes hat-wobble {
  0% { transform: rotate(-8deg) scale(0.9); }
  100% { transform: rotate(8deg) scale(1.1); }
}

.duck-hero:focus-visible {
  outline: 3px solid #ffb300;
  border-radius: 50%;
}

/* Floating Bath Toys */
.bath-toy {
  position: absolute;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 7;
  outline: none;
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.15));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: toy-bob 3s ease-in-out infinite alternate;
}

.boat-toy {
  left: 35px;
  bottom: 80px;
  animation-duration: 3.2s;
}

.ball-toy {
  right: 35px;
  bottom: 85px;
  animation-duration: 2.6s;
}

@keyframes toy-bob {
  0% { transform: translateY(0) rotate(-6deg); }
  100% { transform: translateY(-10px) rotate(6deg); }
}

.bath-toy:hover {
  transform: scale(1.2) rotate(15deg);
}

.bath-toy:active {
  transform: scale(0.9);
}

.bath-toy.toy-tapped {
  animation: toy-bounce 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes toy-bounce {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.3) rotate(20deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.bath-toy:focus-visible {
  outline: 3px solid #ffb300;
  border-radius: 50%;
}

/* Soap Foam Suds Layer */
.foam-layer {
  position: absolute;
  bottom: 60px;
  left: 16px;
  right: 16px;
  height: 100px;
  pointer-events: none;
  z-index: 9;
}

.foam-bubble {
  position: absolute;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f3e5f5 65%, #e1bee7 100%);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(186, 104, 200, 0.2), inset 0 2px 4px #ffffff;
  pointer-events: none;
  animation: foam-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes foam-pop {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.15); opacity: 0.95; }
  100% { transform: scale(1); opacity: 0.9; }
}

.foam-washing {
  animation: foam-wash-down 0.6s ease-in forwards !important;
}

@keyframes foam-wash-down {
  0% { transform: translateY(0) scale(1); opacity: 0.9; }
  100% { transform: translateY(80px) scale(0.2); opacity: 0; }
}

/* Ceramic Bathtub Basin */
.tub-basin {
  position: relative;
  width: 100%;
  height: 72px;
  background: linear-gradient(180deg, #ffffff 0%, #eceff1 60%, #cfd8dc 100%);
  border-radius: 0 0 42px 42px;
  box-shadow: 0 14px 28px rgba(0, 77, 64, 0.22);
  z-index: 5;
}

.tub-rim {
  position: absolute;
  top: -12px;
  left: -8px;
  right: -8px;
  height: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #eceff1 100%);
  border-radius: 14px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), inset 0 2px 4px #ffffff;
}

.tub-feet {
  position: absolute;
  bottom: -16px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.claw-foot {
  width: 22px;
  height: 20px;
  background: linear-gradient(180deg, #b0bec5 0%, #78909c 100%);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
}

.foot-left { transform: rotate(12deg); }
.foot-right { transform: rotate(-12deg); }

/* Ambient Popping Bubbles */
.ambient-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.bath-bubble {
  position: absolute;
  font-size: 34px;
  line-height: 1;
  min-width: 52px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.8));
  animation: bath-bubble-rise 4.2s ease-out forwards;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

.bath-bubble:focus-visible {
  outline: 3px solid #ffb300;
  border-radius: 50%;
}

@keyframes bath-bubble-rise {
  0% { transform: translateY(0) scale(0.4); opacity: 0.95; }
  85% { opacity: 0.9; }
  100% { transform: translateY(-420px) translateX(var(--drift, 15px)) scale(1.25); opacity: 0; pointer-events: none; }
}

/* Clean Sparkles */
.sparks-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 30;
}

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

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

@media (max-width: 640px) {
  .top-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px;
  }
  .top-controls .instruction-banner {
    width: 100%;
    flex: 0 0 100%;
    font-size: 0.92rem;
    padding: 3px 8px;
    text-align: center;
  }
  .action-buttons {
    width: 100%;
    justify-content: center;
  }
  .tool-btn {
    padding: 6px 14px;
    font-size: 14px;
  }
}

@media (max-height: 600px) {
  .top-controls {
    padding: 2px 8px;
    gap: 4px;
  }
  .top-controls .instruction-banner {
    font-size: 0.85rem;
    padding: 2px 6px;
  }
  .tub-stage { height: 175px; }
  .duck-icon { font-size: min(20vw, 80px); }
  .duck-hero { bottom: 60px; }
  .bath-toy { font-size: 34px; bottom: 60px; }
  .tool-btn { font-size: 13px; padding: 4px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .bathroom-wall,
  .water-wave,
  .duck-hero,
  .duck-diving,
  .duck-foam-hat,
  .bath-toy,
  .foam-bubble,
  .foam-washing,
  .water-stream-drop,
  .bath-bubble,
  .duck-spark,
  .tool-btn.active-tool,
  .shower-btn.pulse-invite,
  .bath-toy.toy-tapped {
    animation: none !important;
    transition: none !important;
  }
}
