/* 🌱 Sprout & Blossom: Nature & Plant Magic Lab Styling */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1e3a1e;
  color: #1c1917;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.garden-app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #87ceeb;
}

/* --- Top Bar --- */
.top-bar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 2px solid #5b8e38;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  z-index: 20;
}

.back-btn {
  text-decoration: none;
  color: #1e3a1e;
  font-weight: 800;
  font-size: 0.9rem;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 999px;
  padding: 6px 14px;
  transition: all 0.15s ease;
}
.back-btn:hover {
  background: #dcfce7;
  transform: translateY(-1px);
}

.title {
  font-size: 1.15rem;
  font-weight: 900;
  color: #166534;
  white-space: nowrap;
}

.guide-pill {
  flex: 1;
  text-align: center;
  background: #fefce8;
  border: 1.5px solid #eab308;
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 0.96rem;
  color: #854d0e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.15);
}

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

.stage-pill {
  background: #dcfce7;
  border: 1.5px solid #22c55e;
  color: #14532d;
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: 800;
  font-size: 0.88rem;
  white-space: nowrap;
}

.ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.ctrl-btn.active {
  opacity: 1;
  background: #ecfdf5;
  border-color: #16a34a;
}
.ctrl-btn:hover {
  transform: scale(1.06);
}

/* --- Main Living Stage (Split Sky / Soil) --- */
.stage {
  flex: 1;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Sky Zone (Above Ground) --- */
.sky-zone {
  flex: 1.15;
  position: relative;
  background: linear-gradient(180deg, #60a5fa 0%, #93c5fd 55%, #bae6fd 85%, #d9f99d 100%);
  overflow: hidden;
}

/* Sun Actor */
.sun-actor {
  position: absolute;
  top: 18px;
  right: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
  outline: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sun-actor:hover {
  transform: scale(1.12);
}
.sun-body {
  font-size: 4.8rem;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 18px #fde047);
  animation: sunBob 4s ease-in-out infinite alternate;
}
.sun-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(253, 224, 71, 0.65) 0%, rgba(250, 204, 21, 0.2) 55%, transparent 75%);
  border-radius: 50%;
  animation: sunGlowPulse 2.5s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes sunBob {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(-8px) rotate(8deg); }
}
@keyframes sunGlowPulse {
  from { transform: scale(0.9); opacity: 0.6; }
  to { transform: scale(1.25); opacity: 0.95; }
}

/* Sun Rays Effect */
.sun-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(254, 240, 138, 0.35) 0%, transparent 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.sun-rays.shining {
  opacity: 1;
  animation: raySpin 8s linear infinite;
}
@keyframes raySpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Cloud Actor */
.cloud-actor {
  position: absolute;
  top: 24px;
  left: 50px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
  outline: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cloud-actor:hover {
  transform: scale(1.1);
}
.cloud-body {
  font-size: 4.5rem;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.15));
  animation: cloudDrift 6s ease-in-out infinite alternate;
}
@keyframes cloudDrift {
  from { transform: translateX(0); }
  to { transform: translateX(35px); }
}

/* Raindrops Curtain */
.rain-curtain {
  position: absolute;
  top: 75px;
  left: -20px;
  width: 140px;
  height: 220px;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.rain-curtain.raining {
  opacity: 1;
}
.raindrop {
  position: absolute;
  width: 3.5px;
  height: 18px;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  border-radius: 999px;
  animation: fallRain 0.55s linear infinite;
}
@keyframes fallRain {
  0% { transform: translateY(-30px); opacity: 0; }
  25% { opacity: 0.9; }
  100% { transform: translateY(220px); opacity: 0.2; }
}

/* Pollinators (Bee, Butterfly, Bird) */
.pollinator {
  position: absolute;
  z-index: 9;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.3s ease;
}
.pollinator:hover {
  transform: scale(1.3);
}
.pollinator.bee {
  font-size: 2.2rem;
  top: 90px;
  left: 35%;
  animation: beeFly 5s ease-in-out infinite;
}
@keyframes beeFly {
  0% { transform: translate(0, 0) scaleX(1); }
  25% { transform: translate(60px, -25px) scaleX(1); }
  50% { transform: translate(120px, 15px) scaleX(-1); }
  75% { transform: translate(40px, -35px) scaleX(-1); }
  100% { transform: translate(0, 0) scaleX(1); }
}
.pollinator.butterfly {
  font-size: 2.4rem;
  top: 60px;
  right: 28%;
  animation: butterFly 7s ease-in-out infinite;
}
@keyframes butterFly {
  0% { transform: translate(0, 0) rotate(0deg); }
  30% { transform: translate(-80px, 40px) rotate(-10deg); }
  60% { transform: translate(-140px, -20px) rotate(12deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
.pollinator.bird {
  font-size: 2.2rem;
  top: 30px;
  left: 20%;
  animation: birdFly 9s ease-in-out infinite;
}
@keyframes birdFly {
  0% { transform: translate(0, 0); }
  50% { transform: translate(250px, 20px) scaleX(-1); }
  100% { transform: translate(0, 0) scaleX(1); }
}

/* Plant Above Ground */
.plant-above {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 5;
}

/* Stem / Trunk */
.stem-trunk {
  width: 14px;
  height: 0px;
  background: linear-gradient(90deg, #4ade80, #16a34a, #15803d);
  border-radius: 8px 8px 0 0;
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.4s ease, background 0.4s ease;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.12);
  transform-origin: bottom center;
}
.stem-trunk.tree {
  background: linear-gradient(90deg, #a16207, #78350f, #451a03);
  border-radius: 14px 14px 0 0;
}

/* Leaves */
.leaf {
  position: absolute;
  font-size: 2.2rem;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center bottom;
}
.leaf-left {
  bottom: 60px;
  left: 75px;
  transform: scale(0) rotate(-40deg);
}
.leaf-right {
  bottom: 100px;
  right: 75px;
  transform: scale(0) rotate(40deg);
}
.leaf.visible {
  opacity: 1;
  animation: leafSway 3s ease-in-out infinite alternate;
}
.leaf-left.visible {
  transform: scale(1) rotate(-35deg);
}
.leaf-right.visible {
  transform: scale(1) rotate(35deg);
}
@keyframes leafSway {
  from { transform: rotate(-30deg) scale(1); }
  to { transform: rotate(-40deg) scale(1.05); }
}

/* Bloom Head */
.bloom-head {
  position: absolute;
  top: calc(100% - 10px);
  left: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bloom-emoji {
  font-size: 5rem;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.18));
  display: block;
  animation: bloomPulse 3.5s ease-in-out infinite alternate;
}
@keyframes bloomPulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}
.bloom-head.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Fruit Container (Strawberries, Apples) */
.fruit-container {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}
.fruit-item {
  position: absolute;
  font-size: 2.8rem;
  cursor: pointer;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: fruitBob 2.5s ease-in-out infinite alternate;
}
.fruit-item:hover {
  transform: scale(1.25);
}
@keyframes fruitBob {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

/* Sparkles Container (Photosynthesis Sparkles) */
.sparkles-container {
  position: absolute;
  inset: -50px;
  pointer-events: none;
}
.sparkle-dot {
  position: absolute;
  font-size: 1.5rem;
  animation: floatSparkle 1.4s ease-out forwards;
}
@keyframes floatSparkle {
  0% { transform: translateY(0) scale(0.5); opacity: 1; }
  100% { transform: translateY(-80px) scale(1.4); opacity: 0; }
}

/* Ground Surface Border */
.ground-surface {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: #65a30d;
  border-top: 3px solid #84cc16;
  border-bottom: 2px solid #3f6212;
  z-index: 6;
}
.grass-tufts {
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
  background-image: radial-gradient(circle at 10px 8px, #84cc16 8px, transparent 9px);
  background-size: 20px 8px;
}
.ladybug {
  position: absolute;
  top: -16px;
  left: 22%;
  font-size: 1.4rem;
  animation: bugWalk 12s linear infinite;
  cursor: pointer;
}
@keyframes bugWalk {
  0% { left: 15%; transform: scaleX(1); }
  50% { left: 80%; transform: scaleX(1); }
  51% { transform: scaleX(-1); }
  100% { left: 15%; transform: scaleX(-1); }
}

/* --- Underground Soil Zone (Cutaway View) --- */
.soil-zone {
  flex: 0.85;
  position: relative;
  background: linear-gradient(180deg, #451a03 0%, #3a1602 45%, #270e01 100%);
  overflow: hidden;
  box-shadow: inset 0 8px 24px rgba(0, 0, 0, 0.4);
}
.soil-layers {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 30% 20%, rgba(217, 119, 6, 0.15) 3px, transparent 4px),
    radial-gradient(circle at 70% 60%, rgba(217, 119, 6, 0.12) 4px, transparent 5px),
    radial-gradient(circle at 85% 25%, rgba(245, 158, 11, 0.1) 3px, transparent 4px),
    radial-gradient(circle at 15% 75%, rgba(245, 158, 11, 0.1) 5px, transparent 6px);
  background-size: 120px 120px;
  pointer-events: none;
}
.soil-label {
  position: absolute;
  top: 10px;
  right: 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(254, 240, 138, 0.2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fde68a;
  z-index: 4;
}

/* The Seed in Soil */
.seed-actor {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  z-index: 3;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}
.seed-actor.sprouting {
  transform: translateX(-50%) scale(1.15);
}

/* SVG Roots Canvas */
.roots-canvas {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Soil Critter (Worm) */
.soil-critter.worm {
  position: absolute;
  bottom: 25px;
  left: 20%;
  font-size: 2.2rem;
  cursor: pointer;
  animation: wormWiggle 4s ease-in-out infinite alternate;
}
@keyframes wormWiggle {
  from { transform: translateX(0) scaleX(1); }
  to { transform: translateX(35px) scaleX(1.1); }
}

/* Moisture particles in soil */
.soil-water-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.moisture-drop {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, #67e8f9 0%, #0284c7 100%);
  border-radius: 50%;
  box-shadow: 0 0 8px #38bdf8;
  animation: sinkMoisture 1.8s ease-out forwards;
}
@keyframes sinkMoisture {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(120px); opacity: 0; }
}

/* --- Photosynthesis Science Banner --- */
.science-pill {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(254, 252, 232, 0.96);
  border: 2px solid #ca8a04;
  border-radius: 999px;
  padding: 8px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 800;
  color: #854d0e;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 25;
}
.science-pill.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.sci-icon {
  font-size: 1.4rem;
}

/* --- Start Welcome Screen Modal --- */
.start-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.start-overlay.hidden {
  display: none;
}
.start-card {
  background: #faf7f0;
  border: 3.5px solid #65a30d;
  border-radius: 28px;
  padding: 32px 36px;
  text-align: center;
  max-width: 540px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}
.start-emoji {
  font-size: 2.8rem;
  letter-spacing: 6px;
  margin-bottom: 10px;
}
.start-card h2 {
  font-size: 1.9rem;
  font-weight: 900;
  color: #166534;
  margin-bottom: 12px;
}
.start-card p {
  font-size: 1.05rem;
  color: #44403c;
  line-height: 1.5;
  margin-bottom: 18px;
}
.start-keys {
  font-weight: 700;
  color: #57534e;
  margin-bottom: 22px;
  line-height: 1.5;
}
.kbd {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1.5px solid #a8a29e;
  box-shadow: 0 2px 0 #a8a29e;
  font-weight: 800;
}
.kbd.wide {
  padding: 3px 12px;
}
.start-btn {
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  cursor: pointer;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border: none;
  border-radius: 18px;
  padding: 14px 34px;
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.4);
  transition: transform 0.15s ease;
}
.start-btn:hover {
  transform: translateY(-2px);
}

/* --- Bottom Garden Control Bar --- */
.garden-bar {
  height: 98px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 2px solid #5b8e38;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
  z-index: 20;
}

/* Plant Selector Tabs */
.plant-tabs {
  display: flex;
  gap: 8px;
}
.plant-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}
.plant-tab .tab-emoji {
  font-size: 1.8rem;
}
.plant-tab .tab-info {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}
.plant-tab .tab-info strong {
  font-size: 0.92rem;
  font-weight: 800;
  color: #1e293b;
}
.plant-tab .tab-info small {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
}
.plant-tab:hover {
  border-color: #22c55e;
  transform: translateY(-2px);
}
.plant-tab.active {
  border-color: #16a34a;
  background: #f0fdf4;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.22);
}
.plant-tab.active .tab-info strong {
  color: #15803d;
}

/* Big Action Buttons (Toddler-Friendly) */
.action-buttons {
  display: flex;
  gap: 12px;
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 20px;
  border: 2.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}
.action-btn:hover {
  transform: translateY(-3px) scale(1.02);
}
.action-btn:active {
  transform: translateY(1px) scale(0.97);
}

.action-btn .act-emoji {
  font-size: 2.2rem;
}
.action-btn .act-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}
.action-btn .act-text strong {
  font-size: 1.05rem;
  font-weight: 900;
}
.action-btn .act-text small {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.85;
}

.water-btn {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border-color: #0369a1;
  color: #ffffff;
}
.sun-btn {
  background: linear-gradient(135deg, #facc15, #eab308);
  border-color: #ca8a04;
  color: #713f12;
}
.care-btn {
  background: linear-gradient(135deg, #f472b6, #db2777);
  border-color: #be185d;
  color: #ffffff;
}
.harvest-btn {
  background: linear-gradient(135deg, #4ade80, #16a34a);
  border-color: #15803d;
  color: #ffffff;
  animation: harvestPulse 1s ease-in-out infinite alternate;
}
@keyframes harvestPulse {
  from { transform: scale(1); box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
  to { transform: scale(1.06); box-shadow: 0 0 20px rgba(34, 197, 94, 0.7); }
}
.action-btn.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 1050px) {
  .title { display: none; }
  .plant-tab .tab-info small { display: none; }
  .action-btn .act-text small { display: none; }
}

@media (max-width: 820px) {
  .plant-tabs { overflow-x: auto; max-width: 260px; }
  .action-btn { padding: 8px 14px; }
  .action-btn .act-emoji { font-size: 1.8rem; }
  .action-btn .act-text strong { font-size: 0.9rem; }
}
