/* HOW TO PLAY — clean white redesign, cqi/cqh-scaled, auto-cycles.
   Layout pins each piece to a fixed % of the screen so the basket lands
   at chest level (≈ 75% from top) on every viewport. */
#screen-howto {
  background: #ffffff;
  position: fixed;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
}

/* ── Header ──
   Kiosk-anchored values (1080×1920):
   • top spacing 305px   (15.89cqh)
   • title 115.2px bold, letter-spacing -6%  (10.667cqw)
   • sub   40.32px semi-bold                 (3.733cqw) */
.howto-header {
  position: absolute;
  top: clamp(24px, 15.89cqh, 305px);
  left: 0; right: 0;
  padding: 0 clamp(20px, 5cqi, 64px);
  text-align: center;
  z-index: 2;
}

.howto-title {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(30px, 10.667cqw, 115.2px);
  line-height: 1.05;
  letter-spacing: -0.06em;
  color: #000;
}

.howto-sub {
  margin: clamp(6px, 1.5cqi, 20px) 0 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(13px, 3.733cqw, 40.32px);
  line-height: 1.3;
  color: #000;
}

/* ── Stage spans from below the header down to the ground line. The
   basket (bottom: 0 of stage) sits exactly on the line. ── */
.howto-stage {
  position: absolute;
  top: clamp(150px, 22cqh, 400px);
  bottom: calc(clamp(160px, 34cqh, 700px) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: min(92%, 760px);
  transition: opacity 0.38s ease;
}

.howto-stage.fading { opacity: 0; }

.howto-fruit,
.howto-bomb,
.howto-explosion,
.howto-basket {
  position: absolute;
  display: block;
  background: center / contain no-repeat;
  opacity: 0;
  pointer-events: none;
}

/* All steps show strawberry + grapes at top */
.howto-strawberry {
  width: clamp(48px, 12cqi, 130px);
  aspect-ratio: 1 / 1;
  top: 14%;
  left: 16%;
  background-image: url("../assets/svgs/strawberry.svg");
}

.howto-grapes {
  width: clamp(54px, 13cqi, 145px);
  aspect-ratio: 1 / 1;
  top: 26%;
  right: 12%;
  background-image: url("../assets/svgs/grapes.svg");
}

.howto-banana {
  width: clamp(54px, 13cqi, 140px);
  aspect-ratio: 1 / 1;
  background-image: url("../assets/svgs/banana.svg");
}

.howto-bomb {
  width: clamp(54px, 12cqi, 140px);
  aspect-ratio: 44 / 56;
  background-image: url("../assets/svgs/howto-bomb.svg");
}

.howto-explosion {
  width: clamp(120px, 30cqi, 320px);
  aspect-ratio: 132 / 84;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  background-image: url("../assets/svgs/fire.svg");
}

.howto-basket {
  width: clamp(160px, 36cqi, 380px);
  aspect-ratio: 106 / 38;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background-image: url("../assets/svgs/howto-basket.svg");
  opacity: 1;
}

/* ── Score pops ── */
.howto-score {
  position: absolute;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(26px, 7cqi, 76px);
  line-height: 1;
  letter-spacing: -0.02em;
  opacity: 0;
  pointer-events: none;
}

.howto-score-good { color: #000; }
.howto-score-bad  { color: #E71C11; }

#howto-score-good { bottom: 38%; left: 60%; }
#howto-score-bad  { bottom: 14%; left: 64%; }

/* ── Ground line — pinned at ~75% from top via bottom anchor ── */
.howto-ground {
  position: absolute;
  bottom: clamp(160px, 34cqh, 700px);
  left: 0; right: 0;
  height: 4px;
  background: #000;
  z-index: 2;
}

/* ── Caption — sits above the logo, below the ground line.
   Same kiosk size as the sub ("Catch them all..."): 40.32px semi-bold. ── */
.howto-caption {
  position: absolute;
  bottom: clamp(120px, 29cqh, 580px);
  left: 0; right: 0;
  padding: 0 clamp(20px, 5cqi, 64px);
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(13px, 3.733cqw, 40.32px);
  color: #878F8E;
  text-align: center;
  z-index: 2;
  transition: opacity 0.38s ease;
}

.howto-caption.fading { opacity: 0; }

/* All steps show top fruits floating */
#screen-howto .howto-strawberry,
#screen-howto .howto-grapes {
  opacity: 1;
  animation: howtoFruitFloat 3.4s ease-in-out infinite;
}
#screen-howto .howto-grapes { animation-delay: 0.6s; }

/* ─────────────────────────────────────────────────────
   STEP 1 — Swipe to move the basket
   ───────────────────────────────────────────────────── */
#screen-howto.howto-step-move .howto-banana {
  opacity: 1;
  top: 46%;
  left: 50%;
  transform: translateX(-50%);
  animation: howtoBananaFall 2.6s ease-in infinite;
}

#screen-howto.howto-step-move .howto-basket {
  animation: howtoBasketSlide 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

/* ─────────────────────────────────────────────────────
   STEP 2 — Catch the fruits
   ───────────────────────────────────────────────────── */
#screen-howto.howto-step-fruit .howto-banana {
  opacity: 1;
  width: clamp(54px, 12cqi, 130px);
  bottom: clamp(40px, 8.5cqi, 100px);
  left: 50%;
  transform: translateX(-50%) rotate(-18deg);
  animation: howtoBananaCaught 2.4s ease-in-out infinite;
}

#screen-howto.howto-step-fruit #howto-score-good {
  animation: howtoScorePopGood 2.4s ease-out infinite;
}

/* ─────────────────────────────────────────────────────
   STEP 3 — Avoid the bombs
   ───────────────────────────────────────────────────── */
#screen-howto.howto-step-bomb .howto-bomb {
  opacity: 1;
  top: 44%;
  left: 50%;
  transform: translateX(-50%);
  animation: howtoBombDrop 2.4s ease-in infinite;
}

#screen-howto.howto-step-bomb .howto-explosion {
  animation: howtoExplode 2.4s ease-out infinite;
}

#screen-howto.howto-step-bomb #howto-score-bad {
  animation: howtoScorePopBad 2.4s ease-out infinite;
}

/* ── Keyframes ── */
@keyframes howtoFruitFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

@keyframes howtoBananaFall {
  0%   { transform: translate(-50%, -120%) rotate(-18deg); opacity: 0; }
  10%  { opacity: 1; }
  78%  { opacity: 1; transform: translate(-50%, 60%) rotate(18deg); }
  88%  { opacity: 0; }
  100% { opacity: 0; transform: translate(-50%, 60%) rotate(18deg); }
}

@keyframes howtoBasketSlide {
  0%   { transform: translateX(-92%); }
  100% { transform: translateX(-8%); }
}

@keyframes howtoBananaCaught {
  0%, 100% { transform: translateX(-50%) rotate(-18deg) translateY(0); }
  50%      { transform: translateX(-50%) rotate(-18deg) translateY(-4px); }
}

@keyframes howtoScorePopGood {
  0%   { opacity: 0; transform: translateY(20px) scale(0.85); }
  18%  { opacity: 1; transform: translateY(0)    scale(1); }
  72%  { opacity: 1; transform: translateY(-8px) scale(1); }
  100% { opacity: 0; transform: translateY(-32px) scale(1); }
}

@keyframes howtoBombDrop {
  0%   { transform: translateX(-50%) translateY(-180%); opacity: 0; }
  10%  { opacity: 1; }
  60%  { transform: translateX(-50%) translateY(20%); opacity: 1; }
  68%  { opacity: 0; }
  100% { opacity: 0; transform: translateX(-50%) translateY(20%); }
}

@keyframes howtoExplode {
  0%, 60%  { opacity: 0; transform: translateX(-50%) scale(0.3); }
  68%      { opacity: 1; transform: translateX(-50%) scale(1.05); }
  82%      { opacity: 1; transform: translateX(-50%) scale(1); }
  100%     { opacity: 0; transform: translateX(-50%) scale(1); }
}

@keyframes howtoScorePopBad {
  0%, 60%  { opacity: 0; transform: translateY(20px) scale(0.85); }
  72%      { opacity: 1; transform: translateY(0)    scale(1); }
  92%      { opacity: 1; transform: translateY(-8px) scale(1); }
  100%     { opacity: 0; transform: translateY(-32px) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #screen-howto * { animation: none !important; }
}

/* ──────────────────────────────────────────────────────
   TRANSITION BURST — fire bursts out of the centre,
   black mask sweeps over everything, then we hand off
   to the game screen (same alignment, kiosk-friendly).
   ────────────────────────────────────────────────────── */
.howto-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
}

.howto-burst-black {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: radial-gradient(circle, #1a0500 0%, #000 80%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.howto-burst-fire {
  display: none;
}

#screen-howto.transitioning {
  cursor: default;
}

#screen-howto.transitioning .howto-burst {
  opacity: 1;
}

#screen-howto.transitioning .howto-burst-black {
  animation: howtoBurstBlack 0.85s cubic-bezier(0.5, 0, 0.6, 1) forwards 0.12s;
}

#screen-howto.transitioning .howto-burst-fire {
  animation: howtoBurstFire 0.85s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}

#screen-howto.transitioning .howto-header,
#screen-howto.transitioning .howto-stage,
#screen-howto.transitioning .howto-ground,
#screen-howto.transitioning .howto-caption,
#screen-howto.transitioning .brand-logo {
  animation: howtoBurstContentDistort 0.55s cubic-bezier(0.4, 0, 0.7, 0.6) forwards;
}

@keyframes howtoBurstBlack {
  0%   { width: 0;        height: 0; }
  100% { width: 300vmax;  height: 300vmax; }
}

@keyframes howtoBurstFire {
  0%   { transform: translate(-50%, -50%) scale(0)   rotate(-30deg); opacity: 0; }
  18%  { transform: translate(-50%, -50%) scale(1.1) rotate(0deg);   opacity: 1; }
  55%  { transform: translate(-50%, -50%) scale(2.4) rotate(40deg);  opacity: 1; }
  85%  { transform: translate(-50%, -50%) scale(3.6) rotate(75deg);  opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(4.4) rotate(90deg);  opacity: 0; }
}

@keyframes howtoBurstContentDistort {
  0%   { filter: blur(0);    opacity: 1; }
  60%  { filter: blur(4px);  opacity: 0.4; }
  100% { filter: blur(10px); opacity: 0; }
}

