:root {
  --sky-top: #bbdefb;
  --sky-mid: #e1f5fe;
  --sky-bottom: #c8e6c9;
  --grass-color: #66bb6a;
  --grass-dark: #43a047;
  --stem-color: #558b2f;
  --stem-highlight: #7cb342;
  --seed-glow: rgba(255, 255, 255, 0.85);
}

/* ========================================================
   Main Field & Day/Sunset Themes
   ======================================================== */
.dand-field {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: pointer;
  transition: background 0.8s ease;
}

.dand-field.theme-day {
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-bottom) 85%, var(--grass-color) 100%);
}

.dand-field.theme-sunset {
  background: linear-gradient(180deg, #28144b 0%, #6a1b9a 30%, #ad1457 55%, #f57c00 80%, #33691e 100%);
}

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

/* ========================================================
   Sky & Meadow Backdrop
   ======================================================== */
.sky-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.sky-sun {
  position: absolute;
  top: 7%;
  right: 10%;
  width: 72px;
  height: 72px;
  background: radial-gradient(circle, #fff9c4 0%, #ffee58 60%, rgba(255, 238, 88, 0) 100%);
  border-radius: 50%;
  filter: drop-shadow(0 0 20px #ffee58);
  transition: all 0.8s ease;
}

.theme-sunset .sky-sun {
  top: 14%;
  right: 14%;
  width: 84px;
  height: 84px;
  background: radial-gradient(circle, #fff3e0 0%, #ff9800 50%, #e91e63 80%, transparent 100%);
  filter: drop-shadow(0 0 28px #ff9800);
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50px;
  filter: blur(1px);
  animation: cloud-float linear infinite alternate;
}

.cloud-1 {
  top: 18%;
  left: 6%;
  width: 130px;
  height: 42px;
  animation-duration: 24s;
}

.cloud-2 {
  top: 28%;
  right: 8%;
  width: 170px;
  height: 52px;
  animation-duration: 32s;
}

.theme-sunset .cloud {
  background: rgba(255, 204, 188, 0.45);
}

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

.meadow-grass {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 42px;
  background: linear-gradient(180deg, transparent 0%, var(--grass-dark) 100%);
  z-index: 2;
}

.grass-tuft {
  position: absolute;
  bottom: 0;
  width: 32px;
  height: 24px;
  background: #43a047;
  clip-path: polygon(0% 100%, 25% 15%, 50% 100%, 75% 0%, 100% 100%);
}

.tuft-1 { left: 12%; height: 32px; }
.tuft-2 { left: 45%; height: 26px; }
.tuft-3 { right: 18%; height: 34px; }

/* ========================================================
   Dandelion Plant Structure
   ======================================================== */
.dand-plant {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 22px;
  transform-origin: bottom center;
}

.dand-plant.sway-idle {
  animation: plant-idle-sway 4.5s ease-in-out infinite alternate;
}

.dand-plant.wind-gust {
  animation: plant-wind-bend 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes plant-idle-sway {
  0% { transform: rotate(-1.5deg); }
  100% { transform: rotate(1.5deg); }
}

@keyframes plant-wind-bend {
  0% { transform: rotate(0deg); }
  35% { transform: rotate(14deg) scaleY(0.96); }
  70% { transform: rotate(-5deg); }
  100% { transform: rotate(0deg); }
}

/* Head & Attached Seeds */
.dand-head {
  position: relative;
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attached-seeds-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dand-attached-seed {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 64px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(139, 195, 74, 0.5) 100%);
  transform-origin: bottom center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.attached-tuft {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #ffffff 0%, rgba(255, 255, 255, 0.8) 50%, transparent 80%);
  border-radius: 50%;
  filter: drop-shadow(0 0 4px var(--seed-glow));
}

.attached-kernel {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 6px;
  background: #5d4037;
  border-radius: 2px;
}

.theme-sunset .attached-tuft {
  background: radial-gradient(circle, #fff9c4 0%, rgba(255, 224, 130, 0.85) 60%, transparent 85%);
  filter: drop-shadow(0 0 6px #ffe082);
}

.dand-receptacle {
  position: relative;
  width: 26px;
  height: 26px;
  background: radial-gradient(circle, #8bc34a 0%, #558b2f 70%, #33691e 100%);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 5;
}

/* Sprouting Bud Animation */
.sprouting-bud {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 58px;
  line-height: 1;
  z-index: 12;
  filter: drop-shadow(0 0 16px #ffeb3b);
  animation: bud-grow-bloom 1.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bud-grow-bloom {
  0% { transform: translate(-50%, -50%) scale(0.1) translateY(24px); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.3) translateY(-8px); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) translateY(0); opacity: 1; }
}

/* Stem & Base Leaves */
.dand-stem {
  position: relative;
  width: 10px;
  height: 150px;
  background: linear-gradient(90deg, var(--stem-color) 0%, var(--stem-highlight) 45%, var(--stem-color) 100%);
  border-radius: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  z-index: 3;
}

.dand-leaves {
  position: absolute;
  bottom: -6px;
  display: flex;
  justify-content: center;
  width: 160px;
  pointer-events: none;
  z-index: 4;
}

.leaf {
  width: 58px;
  height: 24px;
  background: linear-gradient(180deg, #689f38 0%, #33691e 100%);
  border-radius: 20px 4px 20px 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.leaf-left {
  transform: rotate(-25deg) translateY(4px);
  margin-right: -10px;
}

.leaf-right {
  transform: rotate(25deg) scaleX(-1) translateY(4px);
  margin-left: -10px;
}

/* ========================================================
   Free-Flying Seeds
   ======================================================== */
.seeds-area {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  z-index: 20;
}

.flying-seed {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: center center;
  will-change: transform;
  pointer-events: auto;
}

.seed-flying-tuft {
  width: 22px;
  height: 22px;
  background: radial-gradient(circle, #ffffff 0%, rgba(255, 255, 255, 0.9) 45%, rgba(255, 255, 255, 0) 80%);
  border-radius: 50%;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.95));
}

.theme-sunset .seed-flying-tuft {
  background: radial-gradient(circle, #fff9c4 0%, rgba(255, 238, 88, 0.9) 50%, rgba(255, 193, 7, 0) 80%);
  filter: drop-shadow(0 0 8px #ffe082);
}

.seed-flying-stalk {
  width: 1.5px;
  height: 20px;
  background: rgba(255, 255, 255, 0.8);
}

.seed-flying-kernel {
  width: 4px;
  height: 6px;
  background: #5d4037;
  border-radius: 2px;
}

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

.sparkle-pop {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  background: radial-gradient(circle, #ffffff 0%, #ffeb3b 60%, transparent 100%);
  border-radius: 50%;
  animation: spark-burst 0.65s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  pointer-events: none;
}

@keyframes spark-burst {
  0% { transform: translate(0, 0) scale(0.2); opacity: 1; }
  100% { transform: translate(var(--sx, 0), var(--sy, 0)) scale(1.3); opacity: 0; }
}

/* ========================================================
   Action Controls Bar
   ======================================================== */
.dand-controls {
  position: relative;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.ctrl-btn {
  background: #ffffff;
  color: #2e7d32;
  border: 3px solid #81c784;
  border-radius: 999px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  padding: 10px 22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ctrl-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.ctrl-btn:active {
  transform: scale(0.96);
}

.ctrl-btn.breeze-btn {
  background: linear-gradient(135deg, #4fc3f7 0%, #0288d1 100%);
  color: #ffffff;
  border-color: #b3e5fc;
  box-shadow: 0 6px 16px rgba(2, 136, 209, 0.35);
  animation: breeze-pulse 2.4s ease-in-out infinite alternate;
}

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

.ctrl-btn.regrow-btn {
  background: linear-gradient(135deg, #ffd54f 0%, #ff8f00 100%);
  color: #4e342e;
  border-color: #ffecb3;
}

.ctrl-btn.theme-btn {
  background: linear-gradient(135deg, #ba68c8 0%, #7b1fa2 100%);
  color: #ffffff;
  border-color: #e1bee7;
}

/* ========================================================
   Responsive Breakpoints
   ======================================================== */
@media (max-height: 600px) {
  .dand-head {
    width: 130px;
    height: 130px;
  }
  .dand-stem {
    height: 80px;
  }
  .dand-plant {
    margin-bottom: 8px;
  }
  .dand-controls {
    margin-bottom: 8px;
    gap: 8px;
  }
  .ctrl-btn {
    font-size: 13px;
    padding: 6px 14px;
  }
}

@media (max-width: 360px) {
  .dand-controls {
    gap: 6px;
  }
  .ctrl-btn {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* ========================================================
   Reduced Motion
   ======================================================== */
@media (prefers-reduced-motion: reduce) {
  .cloud,
  .dand-plant.sway-idle,
  .ctrl-btn.breeze-btn {
    animation: none;
  }
  .dand-field {
    transition: none;
  }
  .sprouting-bud {
    animation: none;
    transform: translate(-50%, -50%);
    opacity: 1;
  }
  .sparkle-pop {
    animation: none;
    opacity: 0.8;
  }
}
