:root {
  --game-bg: radial-gradient(circle at 50% 20%, #e0f7fa 0%, #b2ebf2 40%, #80deea 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 14px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 700;
  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;
}

.soap-tool-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-tool-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.active-tool {
  box-shadow: 0 0 0 3px #ffffff, 0 6px 16px rgba(0, 0, 0, 0.3);
  transform: scale(1.06);
}

.tool-btn.tool-hint-pulse {
  animation: tool-pulse 0.9s cubic-bezier(0.4, 0, 0.6, 1) infinite alternate;
}

@keyframes tool-pulse {
  0% {
    transform: scale(1.06);
    box-shadow: 0 0 0 3px #ffffff, 0 0 16px rgba(33, 150, 243, 0.6);
  }
  100% {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px #ffffff, 0 0 24px rgba(33, 150, 243, 0.95);
  }
}

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

.wash-field {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

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

/* Water Shimmer Background */
.water-shimmer-layer {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 10%, rgba(255, 255, 255, 0.35) 0%, transparent 65%);
  pointer-events: none;
  animation: water-pulse 5s ease-in-out infinite alternate;
  z-index: 1;
}

@keyframes water-pulse {
  0% { opacity: 0.5; transform: scaleY(0.96); }
  100% { opacity: 0.9; transform: scaleY(1.04); }
}

/* Wash Stage and Bathtub */
.wash-stage {
  position: relative;
  width: min(85vw, 65vh, 360px);
  height: min(85vw, 65vh, 360px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.bathtub-rim {
  position: absolute;
  inset: -16px;
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, #e0f2f1 75%, #b2dfdb 100%);
  border-radius: 46%;
  box-shadow: inset 0 -10px 24px rgba(0, 77, 64, 0.15), 0 16px 36px rgba(0, 77, 64, 0.2);
  border: 6px solid #ffffff;
  pointer-events: none;
  z-index: 2;
}

.target-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: none;
}

.clean-target {
  font-size: min(44vw, 34vh, 175px);
  line-height: 1;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.16));
  user-select: none;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
  z-index: 7;
}

.target-celebrate {
  animation: clean-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) infinite alternate;
}

@keyframes clean-bounce {
  0% { transform: scale(1) translateY(0); filter: drop-shadow(0 0 16px #ffeb3b); }
  100% { transform: scale(1.12) translateY(-12px); filter: drop-shadow(0 0 32px #ffffff); }
}

/* Dirt / Mud / Jam Spots */
.mud-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.mud-spot {
  position: absolute;
  border-radius: 45% 55% 65% 35% / 40% 45% 55% 60%;
  opacity: 0.92;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
  will-change: transform, opacity;
}

.mud-spot.mud-dirt {
  background: radial-gradient(circle at 35% 35%, #795548 0%, #4e342e 70%, #3e2723 100%);
}

.mud-spot.mud-jam {
  background: radial-gradient(circle at 35% 35%, #e91e63 0%, #c2185b 70%, #880e4f 100%);
}

.mud-spot.mud-paint {
  background: radial-gradient(circle at 35% 35%, #00bcd4 0%, #0097a7 70%, #006064 100%);
}

/* Foam Suds Layer */
.foam-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

.soap-suds {
  position: absolute;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f3e5f5 60%, #e1bee7 100%);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(186, 104, 200, 0.25), inset 0 2px 4px #ffffff;
  pointer-events: none;
  animation: suds-emerge 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  will-change: transform, opacity;
}

@keyframes suds-emerge {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.88; }
}

.suds-rinsing {
  animation: suds-wash-away 0.6s ease-in forwards !important;
}

@keyframes suds-wash-away {
  0% { transform: translate(-50%, -50%) translateY(0) scale(1); opacity: 0.88; }
  100% { transform: translate(-50%, -50%) translateY(120px) scale(0.3); opacity: 0; }
}

/* Shower Water Cascades */
.shower-stream-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 14;
}

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

@keyframes drop-fall {
  0% { transform: translateY(-40px); opacity: 0; }
  30% { opacity: 0.9; }
  100% { transform: translateY(380px); opacity: 0; }
}

/* Shine Sparkles Layer */
.shine-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 18;
}

.clean-sparkle {
  position: absolute;
  font-size: 32px;
  line-height: 1;
  pointer-events: none;
  animation: sparkle-burst 1.1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes sparkle-burst {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  40% { transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(1.3); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) rotate(45deg) scale(0.8); opacity: 0; }
}

/* Floating Rubber Duck */
.duck-toy {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 25;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  animation: duck-bob 3s ease-in-out infinite alternate;
}

.duck-icon {
  font-size: 50px;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.2));
}

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

.duck-toy:hover,
.duck-toy:active {
  transform: scale(1.25) rotate(-10deg);
}

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

/* Ambient 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;
  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;
}

@keyframes bath-bubble-rise {
  0% { transform: translateY(0) scale(0.5); opacity: 0.9; }
  100% { transform: translateY(-420px) translateX(var(--drift, 12px)) scale(1.25); opacity: 0; }
}

/* Sponge Cursor */
.sponge-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 40;
  transform: translate(-50%, -50%);
  transition: transform 0.08s ease-out;
}

.sponge-icon {
  font-size: 44px;
  line-height: 1;
  display: inline-block;
  animation: sponge-wiggle 0.3s ease-in-out infinite alternate;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

@keyframes sponge-wiggle {
  0% { transform: rotate(-8deg) scale(0.95); }
  100% { transform: rotate(8deg) scale(1.05); }
}

@media (max-width: 600px) {
  .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.9rem;
    padding: 3px 8px;
    text-align: center;
  }

  .action-buttons {
    justify-content: center;
  }
}

@media (max-height: 600px) {
  .wash-stage {
    width: min(72vw, 55vh, 280px);
    height: min(72vw, 55vh, 280px);
  }
  .clean-target { font-size: min(36vw, 35vh, 130px); }
  .duck-icon { font-size: 38px; }
  .duck-toy { bottom: 10px; right: 10px; }
  .tool-btn { font-size: 13px; padding: 4px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .water-shimmer-layer,
  .duck-toy,
  .target-celebrate,
  .soap-suds,
  .suds-rinsing,
  .water-stream-drop,
  .clean-sparkle,
  .bath-bubble,
  .sponge-icon,
  .tool-btn.tool-hint-pulse {
    animation: none !important;
    transition: none !important;
  }
}
