/* Fruit Garden: Harvest Fun — Styles */

:root {
  --orchard-sky: #e0f2fe;
  --orchard-sky-deep: #bae6fd;
  --tree-green: #22c55e;
  --tree-green-light: #4ade80;
  --tree-trunk: #78350f;
  --lawn-color: #15803d;
  --accent-gold: #f59e0b;
}

body {
  background: radial-gradient(circle at 50% 20%, #fef9c3 0%, #f0fdf4 50%, #dcfce7 100%);
  margin: 0;
  padding: 0;
  color: #14532d;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 16px 16px;
  box-sizing: border-box;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 4px;
}

.score-badge {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #15803d;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.instruction-banner {
  margin: 4px 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  color: #166534;
  cursor: pointer;
  user-select: none;
}

.instruction-banner:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 3px;
  border-radius: 8px;
}

/* Orchard Stage */
.orchard-stage {
  position: relative;
  width: 100%;
  height: 320px;
  max-width: 640px;
  background: linear-gradient(180deg, var(--orchard-sky) 0%, var(--orchard-sky-deep) 45%, #bbf7d0 75%, var(--lawn-color) 100%);
  border: 6px solid #16a34a;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(22, 163, 74, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stage-sky {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  height: 50px;
  pointer-events: none;
}

.sky-sun {
  position: absolute;
  top: 10px;
  right: 18px;
  font-size: 2.2rem;
  filter: drop-shadow(0 0 10px #fde047);
}

.sky-cloud {
  position: absolute;
  font-size: 1.6rem;
  opacity: 0.85;
}

.c1 { left: 15%; top: 12px; animation: floatCloud 24s infinite linear; }
.c2 { left: 55%; top: 6px; animation: floatCloud 32s infinite linear reverse; }

/* Tree Canopy */
.tree-container {
  position: relative;
  width: 100%;
  height: 190px;
  display: flex;
  justify-content: center;
  z-index: 2;
}

.tree-foliage {
  position: relative;
  width: 85%;
  height: 165px;
  background: radial-gradient(circle at 50% 40%, var(--tree-green-light) 0%, var(--tree-green) 85%);
  border-radius: 120px 120px 80px 80px;
  box-shadow: 0 10px 20px rgba(21, 128, 61, 0.3), inset 0 0 30px rgba(255, 255, 255, 0.2);
  margin-top: 10px;
}

.tree-trunk {
  position: absolute;
  bottom: 0;
  width: 44px;
  height: 45px;
  background: linear-gradient(90deg, #92400e 0%, var(--tree-trunk) 100%);
  border-radius: 6px 6px 0 0;
  z-index: -1;
}

/* Hanging Fruit */
.hanging-fruit {
  position: absolute;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
  transform-origin: top center;
  animation: swayFruit 3s infinite ease-in-out;
  transition: transform 0.2s, opacity 0.2s;
  outline: none;
  background: none;
  border: none;
  padding: 0;
}

.hanging-fruit:hover {
  transform: scale(1.18);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}

.hanging-fruit:active {
  transform: scale(0.92);
}

.hanging-fruit:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 4px;
  border-radius: 50%;
}

.hanging-fruit:disabled {
  pointer-events: none;
  opacity: 0.85;
}

.hanging-fruit.is-falling {
  pointer-events: none;
  animation: dropIntoBasket 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Ground Lawn & Characters */
.ground-lawn {
  position: relative;
  height: 110px;
  background: var(--lawn-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  z-index: 3;
}

/* Friend Zone */
.friend-zone {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-ticket {
  background: #ffffff;
  border: 3px solid var(--accent-gold);
  border-radius: 20px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}

.order-ticket.is-popping {
  animation: ticketPop 0.4s ease-out;
}

.order-ticket:hover {
  transform: scale(1.05);
}

.order-ticket:active {
  transform: scale(0.96);
}

.order-ticket:focus-visible {
  outline: 3px solid #16a34a;
  outline-offset: 3px;
}

.ticket-fruit {
  font-size: 1.8rem;
  line-height: 1;
}

.ticket-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: #b45309;
}

.animal-avatar {
  font-size: 3.8rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  transition: transform 0.2s;
  cursor: pointer;
  user-select: none;
  outline: none;
}

.animal-avatar:hover {
  transform: scale(1.08);
}

.animal-avatar:active {
  transform: scale(0.92);
}

.animal-avatar:focus-visible {
  outline: 3px solid #16a34a;
  outline-offset: 4px;
  border-radius: 50%;
}

.orchard-stage.is-celebrating .animal-avatar {
  animation: happyJump 0.8s infinite alternate ease-in-out;
}

/* Basket Zone */
.basket-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.basket-counter-badge {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #16a34a;
  border-radius: 14px;
  padding: 2px 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #15803d;
  margin-bottom: 2px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.basket-body {
  position: relative;
  width: 90px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.basket-weave {
  font-size: 4rem;
  line-height: 1;
  z-index: 2;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.basket-interior {
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px;
  z-index: 3;
  pointer-events: none;
  max-width: 90px;
  margin: 0 auto;
}

.collected-fruit {
  display: inline-block;
  font-size: 1.35rem;
  line-height: 1;
  animation: popBounce 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.orchard-stage.is-celebrating .basket-body {
  animation: basketGleam 1s infinite alternate ease-in-out;
}

/* Action Controls */
.action-bar {
  display: flex;
  justify-content: center;
  min-height: 54px;
  width: 100%;
}

.action-btn {
  border: 3px solid #fff;
  border-radius: 40px;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.25rem;
  padding: 12px 36px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.next-btn {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.4), 0 3px 0 #14532d;
}

.again-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4), 0 3px 0 #b45309;
}

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

.action-btn:active {
  transform: translateY(2px) scale(0.97);
}

.action-btn:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 4px;
}

/* Sparkles FX Overlay */
.fx-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.sparkle-particle {
  position: absolute;
  font-size: 1.8rem;
  animation: sparkleRise 1.2s forwards ease-out;
}

/* Keyframes */
@keyframes swayFruit {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(3deg); }
  75% { transform: rotate(-3deg); }
}

@keyframes dropIntoBasket {
  0% { transform: scale(1); opacity: 1; }
  60% { transform: translateY(120px) scale(0.9); opacity: 0.9; }
  100% { transform: translateY(160px) scale(0.6); opacity: 0; }
}

@keyframes happyJump {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-16px) scale(1.08); }
}

@keyframes basketGleam {
  0% { filter: drop-shadow(0 0 4px #facc15); }
  100% { filter: drop-shadow(0 0 16px #facc15); }
}

@keyframes popBounce {
  0% { transform: scale(0.3) translateY(10px); opacity: 0; }
  70% { transform: scale(1.2) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}

@keyframes ticketPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes sparkleRise {
  0% { transform: translateY(0) scale(0.5); opacity: 1; }
  100% { transform: translateY(-70px) scale(1.2); opacity: 0; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .hanging-fruit, .collected-fruit, .sky-cloud, .animal-avatar, .action-btn, .sparkle-particle, .basket-body, .order-ticket {
    animation: none !important;
    transition: none !important;
  }
}

/* Mobile responsive */
@media (max-width: 540px) {
  .orchard-stage {
    height: 290px;
  }
  .tree-container {
    height: 165px;
  }
  .tree-foliage {
    height: 145px;
  }
  .hanging-fruit {
    width: 36px;
    height: 36px;
    margin-left: -18px;
    margin-top: -18px;
    font-size: 1.8rem;
  }
  .ground-lawn {
    padding: 0 14px;
  }
  .friend-zone {
    gap: 8px;
  }
  .order-ticket {
    padding: 4px 10px;
  }
  .animal-avatar {
    font-size: 3rem;
  }
  .basket-weave {
    font-size: 3.2rem;
  }
}

/* Compact height / Landscape screen */
@media (max-height: 600px) {
  .game-container {
    padding: 4px 12px 8px;
    justify-content: flex-start;
  }
  .status-bar {
    margin-bottom: 2px;
  }
  .score-badge {
    padding: 3px 10px;
    font-size: 0.95rem;
  }
  .instruction-banner {
    margin: 2px 0 4px;
    font-size: 1rem;
  }
  .orchard-stage {
    height: 220px;
    margin-bottom: 6px;
    border-radius: 20px;
    border-width: 4px;
  }
  .tree-container {
    height: 125px;
  }
  .tree-foliage {
    height: 115px;
  }
  .hanging-fruit {
    width: 32px;
    height: 32px;
    margin-left: -16px;
    margin-top: -16px;
    font-size: 1.6rem;
  }
  .hanging-fruit.is-falling {
    animation-name: dropIntoBasketCompact;
  }
  @keyframes dropIntoBasketCompact {
    0% { transform: scale(1); opacity: 1; }
    60% { transform: translateY(70px) scale(0.9); opacity: 0.9; }
    100% { transform: translateY(95px) scale(0.6); opacity: 0; }
  }
  .ground-lawn {
    height: 80px;
    padding: 0 16px;
  }
  .animal-avatar {
    font-size: 2.5rem;
  }
  .basket-weave {
    font-size: 2.8rem;
  }
  .basket-interior {
    top: -6px;
  }
  .collected-fruit {
    font-size: 1.15rem;
  }
  .action-bar {
    min-height: 42px;
  }
  .action-btn {
    padding: 8px 26px;
    font-size: 1.05rem;
  }
}
