:root {
  --game-bg: linear-gradient(180deg, #a5d6a7 0%, #81c784 45%, #66bb6a 100%);
}

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

.top-bar .instruction-banner {
  flex: 1;
  min-width: 0;
  margin: 0;
  border-radius: 16px;
}

.water-btn {
  background: linear-gradient(135deg, #0288d1 0%, #01579b 100%);
  color: #ffffff;
  border: 2px solid #81d4fa;
  font-size: 16px;
  font-weight: 800;
  padding: 8px 18px;
  min-height: 44px;
  border-radius: 24px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(2, 136, 209, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, opacity 0.2s;
  outline: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.water-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 16px rgba(2, 136, 209, 0.5);
}

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

.water-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
  transform: none !important;
}

.water-btn:focus-visible {
  outline: 3px solid #ffeb3b;
  outline-offset: 3px;
}

.garden-field {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

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

/* Ensure emoji glyphs render consistently via colour emoji font across platforms */
.rainbow-arc,
.sun-corner,
.tuft,
.garden-flower,
.garden-creature,
.water-drop-shower,
.garden-spark {
  font-family: var(--font-emoji);
}

/* Rainbow Milestone */
.rainbow-arc {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: min(22vw, 120px);
  line-height: 1;
  filter: drop-shadow(0 6px 24px rgba(255, 215, 0, 0.5));
  animation: rainbow-pop 2.5s infinite ease-in-out;
  pointer-events: none;
  z-index: 25;
}

@keyframes rainbow-pop {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.95; }
  50% { transform: translateX(-50%) scale(1.12); opacity: 1; }
}

/* Sun in corner */
.sun-corner {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: min(12vw, 55px);
  line-height: 1;
  animation: sun-rotate 14s linear infinite;
  filter: drop-shadow(0 4px 12px rgba(255, 179, 0, 0.4));
  pointer-events: none;
  z-index: 2;
}

@keyframes sun-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Grass Tuft Decoration */
.grass-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  font-size: 24px;
}

.tuft { position: absolute; }
.t1 { top: 20%; left: 12%; }
.t2 { top: 40%; right: 14%; }
.t3 { bottom: 25%; left: 22%; }
.t4 { bottom: 35%; right: 28%; }

/* Garden Container */
.garden-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* Garden Flower Elements */
.garden-flower {
  position: absolute;
  font-size: clamp(44px, 14vw, 64px);
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  animation: flower-spring 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.16));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.garden-flower:hover {
  transform: translate(-50%, -50%) scale(1.2) rotate(6deg);
}

.garden-flower.dancing {
  animation: flower-dance 0.5s ease-in-out;
}

.garden-flower.fading {
  transform: translate(-50%, -50%) scale(0) !important;
  opacity: 0 !important;
  transition: transform 0.35s ease-in, opacity 0.35s ease-in !important;
  pointer-events: none !important;
}

@keyframes flower-spring {
  0% { transform: translate(-50%, -50%) scale(0.1) translateY(30px); }
  70% { transform: translate(-50%, -50%) scale(1.18); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes flower-dance {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  25% { transform: translate(-50%, -50%) scale(1.25) rotate(-12deg); }
  75% { transform: translate(-50%, -50%) scale(1.25) rotate(12deg); }
}

/* Garden Creature (Butterflies, Bees, Ladybugs) */
.garden-creature {
  position: absolute;
  font-size: clamp(38px, 11vw, 50px);
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  z-index: 20;
  transform: translate(-50%, -50%);
  animation: creature-flutter 2.2s ease-in-out forwards;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

.garden-creature.tickled {
  animation: creature-spin-exit 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes creature-flutter {
  0% { transform: translate(calc(-50% + var(--startX)), calc(-50% + var(--startY))) scale(0.5); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  60% { transform: translate(calc(-50% + 10px), calc(-50% - 15px)) scale(1.05); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--endX)), calc(-50% + var(--endY))) scale(0.5); opacity: 0; }
}

@keyframes creature-spin-exit {
  0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  35% { transform: translate(-50%, -50%) scale(1.35) rotate(180deg); opacity: 1; }
  65% { transform: translate(-50%, -50%) scale(1.2) rotate(360deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--endX)), calc(-50% + var(--endY))) scale(0.4) rotate(420deg); opacity: 0; }
}

/* Watering Rain Shower */
.water-drop-shower {
  position: absolute;
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  animation: drop-fall 0.8s linear forwards;
}

@keyframes drop-fall {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(220px); opacity: 0; }
}

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

.garden-spark {
  position: absolute;
  font-size: 24px;
  pointer-events: none;
  animation: spark-drift 0.9s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

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

@media (max-width: 480px) {
  .top-bar {
    padding: 3px 8px;
    gap: 8px;
  }
  .water-btn {
    padding: 6px 14px;
    font-size: 14px;
    min-height: 40px;
  }
  .top-bar .instruction-banner {
    font-size: 0.92rem;
    padding: 4px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rainbow-arc,
  .sun-corner,
  .garden-flower,
  .garden-creature,
  .water-drop-shower,
  .garden-spark {
    animation: none !important;
    transition: none !important;
  }
}
