html, body { background: #c8ecb0; }
#game { background: linear-gradient(#bfe6ff 0%, #e3f5ff 45%, #c8ecb0 45%, #a5d98a 100%); }

/* progress row: one fruit per basket in the round */
#slots { position: absolute; z-index: 10; top: 1.5vh; left: 3vw; right: 12vh; display: flex; gap: 1.2vh; justify-content: center;
  align-items: center; height: 8vh; pointer-events: none; }
.slot { width: 6vh; height: 6vh; }
.slot svg { width: 100%; height: 100%; overflow: visible; }
.slot.on { animation: pop .5s; }
@keyframes pop { 40% { transform: scale(1.6) rotate(-10deg); } }

/* layout: fruit on the left, basket on the right (landscape) */
#stage { position: absolute; left: 3vw; right: 3vw; top: 11vh; bottom: 10vh; display: flex; gap: 2vw; align-items: stretch; }
#field { position: relative; flex: 1; }
#basketArea { position: relative; flex: 0 0 38%; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* fruit waiting to be picked (the element is larger than its drawing: a generous tap area) */
.fruit { position: absolute; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fruit svg { width: 86%; height: 86%; overflow: visible; filter: drop-shadow(0 .8vh .5vh #0003);
  animation: sway 2.4s ease-in-out infinite alternate; }
.fruit:nth-child(3n+1) svg { animation-delay: -.8s; } .fruit:nth-child(3n+2) svg { animation-delay: -1.6s; }
@keyframes sway { from { transform: rotate(-5deg) translateY(0); } to { transform: rotate(5deg) translateY(-1vh); } }
.fruit.picked { pointer-events: none; z-index: 8; }
.fruit.jiggle svg { animation: jiggle .7s; }
@keyframes jiggle { 20% { transform: rotate(-16deg) scale(1.08); } 45% { transform: rotate(14deg) scale(1.08); } 70% { transform: rotate(-8deg); } }
.fruit.hint svg { animation: glow .8s ease-in-out infinite alternate; }
@keyframes glow { from { transform: scale(1); filter: drop-shadow(0 0 1vh #fff) drop-shadow(0 0 2vh #ffeb3b); }
                  to   { transform: scale(1.12); filter: drop-shadow(0 0 2vh #fff) drop-shadow(0 0 4vh #ffeb3b); } }

/* the basket: back (handle + inside), the fruit in it, then the front (the fruit's lower part sits behind the front) */
#basket { position: relative; flex: none; cursor: pointer; }
#basket svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#basket svg.front { pointer-events: none; filter: drop-shadow(0 1vh .8vh #0003); }
#inBasket { position: absolute; inset: 0; pointer-events: none; }
.inb { position: absolute; width: 19%; aspect-ratio: 1; transform: translate(-50%, -50%); }
.inb svg { width: 100%; height: 100%; overflow: visible; display: block; }
#basket.bounce { animation: bounce .6s; }
@keyframes bounce { 30% { transform: scale(1.08, .92); } 60% { transform: scale(.96, 1.06) translateY(-2%); } }
#basket.wiggle { animation: wiggle .5s; }
@keyframes wiggle { 25% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } 75% { transform: rotate(-2deg); } }

/* the number of fruit in the basket */
#count { height: 22vh; min-width: 1ch; margin-bottom: 5.5vh; text-align: center; font-size: 20vh; line-height: 22vh; font-weight: 900; color: #fff;
  text-shadow: 0 .8vh 0 #ef6c00, 0 1.4vh 1.4vh #0003; -webkit-text-stroke: .5vh #ef6c00; pointer-events: none; }
#count.pop { animation: numpop .45s; }
@keyframes numpop { 40% { transform: scale(1.35); } }
#count.total { animation: numtotal .9s; }
@keyframes numtotal { 30% { transform: scale(1.6) rotate(-6deg); } 60% { transform: scale(1.4) rotate(5deg); } }

.spark { position: absolute; z-index: 6; width: 2vh; height: 2vh; border-radius: 50%; pointer-events: none; }
.ripple { position: absolute; z-index: 4; width: 6vh; height: 6vh; margin: -3vh 0 0 -3vh; border-radius: 50%; border: .5vh solid #fff;
  pointer-events: none; animation: ripple .5s ease-out forwards; }
@keyframes ripple { from { transform: scale(.3); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }

#doneFruit { display: flex; flex-wrap: wrap; gap: 1.5vh; justify-content: center; max-width: 80vw; }
#doneFruit svg { width: 10vh; height: 10vh; overflow: visible; animation: hop 1s ease-in-out infinite alternate; }
#doneFruit svg:nth-child(odd) { animation-delay: .25s; }
@keyframes hop { to { transform: translateY(-1.5vh) rotate(6deg); } }

/* portrait phones: fruit on top, basket beneath */
@media (max-aspect-ratio: 1/1) {
  #game { background: linear-gradient(#bfe6ff 0%, #e3f5ff 30%, #c8ecb0 30%, #a5d98a 100%); }
  #slots { top: 2vw; right: 18vw; height: 13vw; gap: 1.2vw; }
  .slot { width: 9vw; height: 9vw; }
  #stage { flex-direction: column; top: 17vw; bottom: 16vw; gap: 2vw; }
  #basketArea { flex: 0 0 38%; flex-direction: row; gap: 3vw; }   /* the number beside the basket, so the basket can be wide */
  #count { height: 13vh; min-width: 2ch; margin: 0; font-size: 12vh; line-height: 13vh; }
  #doneFruit svg { width: 15vw; height: 15vw; }
}
