.play {
  height: 100%;
  display: grid;
  grid-template-columns: clamp(200px, 24vw, 300px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: "side basket" "controls controls" "dots dots";
  justify-items: center;
  align-items: center;
  padding: 92px 20px 16px;
  gap: 12px 16px;
}

.mascot-box.top {
  grid-area: side;
  flex-direction: column-reverse;
  align-items: center;
  gap: 18px;
}

.mascot-box.top .bubble {
  margin-bottom: 0;
  text-align: center;
}

.mascot-box.top .bubble::after {
  left: calc(50% - 12px);
  bottom: -12px;
  border: 12px solid transparent;
  border-top-color: var(--card);
  border-bottom: 0;
}

.basket {
  grid-area: basket;
  width: 100%;
  height: 100%;
  max-width: 980px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 24px);
  padding: 20px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 44px;
  box-shadow: var(--shadow);
}

.fruit {
  position: relative;
  width: clamp(90px, min(15vh, 20vw), 170px);
  aspect-ratio: 1;
  background: none;
  padding: 0;
  touch-action: manipulation;
  animation: pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  transition: transform 0.2s ease;
}

.fruit img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(61, 58, 92, 0.18));
}

@media (hover: hover) {
  .fruit:hover {
    transform: scale(1.06);
  }
}

.fruit b {
  position: absolute;
  right: -4px;
  top: -4px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--sky-deep);
  color: #fff;
  font-size: 28px;
  display: none;
  place-items: center;
  box-shadow: 0 4px 0 #4a8fcc;
}

.fruit.counted b {
  display: grid;
  animation: pop-in 0.3s ease;
}

.fruit.counted {
  transform: scale(1.08) rotate(-4deg);
}

.controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.answer {
  flex: none;
  width: clamp(88px, 13vh, 110px);
  height: clamp(88px, 13vh, 110px);
  border-radius: 30px;
  background: #fff;
  border: 6px dashed var(--lav-deep);
  display: grid;
  place-items: center;
  font-size: clamp(52px, 8.4vh, 72px);
  font-weight: 800;
  line-height: 1;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}

.answer.filled {
  border-style: solid;
  color: var(--lav-deep);
  animation: pop-in 0.3s ease;
}

.answer.right {
  border: 6px solid var(--mint-deep);
  color: var(--mint-deep);
  transform: scale(1.1);
}

.answer.wrong {
  border: 6px solid var(--peach-deep);
  color: var(--peach-deep);
  animation: shake 0.45s ease;
}

.numpad {
  --n: min(80px, calc((100vw - 250px - 64px) / 9));
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.num {
  width: var(--n);
  height: clamp(60px, 9vh, 76px);
  border-radius: 18px;
  background: #fff;
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 800;
  box-shadow: 0 5px 0 #d4d2e6;
  touch-action: manipulation;
}

.num:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #d4d2e6;
}

.round-dots {
  grid-area: dots;
  display: flex;
  gap: 10px;
}

.round-dots i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

.round-dots i.now {
  box-shadow: 0 0 0 4px var(--butter-deep);
}

.round-dots i.ok {
  background: var(--butter-deep);
}

@media (orientation: portrait), (max-width: 860px) {
  .play {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "side" "basket" "controls" "dots";
  }
  .mascot-box.top {
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
  }
  .mascot-box.top img {
    width: clamp(90px, 14vw, 130px);
  }
  .mascot-box.top .bubble {
    margin-bottom: 30px;
    text-align: left;
    max-width: 420px;
  }
  .mascot-box.top .bubble::after {
    left: -12px;
    bottom: 18px;
    border: 12px solid transparent;
    border-right-color: var(--card);
    border-left: 0;
  }
  .fruit {
    width: clamp(90px, min(13vh, 22vw), 180px);
  }
  .controls {
    flex-direction: column;
    gap: 12px;
  }
  .numpad {
    --n: min(84px, calc((100vw - 64px - 64px) / 9));
  }
  .num {
    height: clamp(64px, 7vh, 88px);
  }
}
