/* Planet 4-5 games (js/games45.js). Everything inside #stage.game45 */
.stage.game45 { display: flex; flex-direction: column; align-items: center; justify-content: space-around; gap: 2vmin; touch-action: none; overflow: hidden; }
.game45 .option { width: clamp(84px, 22vmin, 140px); height: clamp(84px, 22vmin, 140px); }

/* trace */
.tr-row { display: flex; gap: 6vmin; justify-content: center; margin-top: 2vmin; z-index: 1; }
.tr-roads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tr-road { fill: none; stroke: #b9a7ff; stroke-width: 10; stroke-linecap: round; stroke-dasharray: 2 18; opacity: .8; }
.tr-trail { fill: none; stroke: #ffc928; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; }
.tr-star { position: absolute; left: 0; top: 0; width: 64px; height: 64px; display: grid; place-items: center; font-size: 52px; line-height: 1;
  color: #ffc928; text-shadow: 0 3px 0 #e09b00, 0 0 18px #fff6; cursor: grab; touch-action: none; z-index: 2; animation: tr-bob 1.4s ease-in-out infinite; }
.tr-star.is-held { animation: none; scale: 1.2; }
.tr-star.is-hint { animation: tr-pulse .5s 3; }
@keyframes tr-bob { 50% { translate: 0 -6px; } }
@keyframes tr-pulse { 50% { scale: 1.45; } }

/* assemble */
.as-frame { display: flex; direction: ltr; border: 4px dashed #b9a7ff; border-radius: 24px; padding: 6px; background: #fff8; }
.as-frame.is-over, .as-frame.is-whole { border-style: solid; border-color: #ffc928; }
.as-half.option { width: clamp(50px, 13vmin, 80px); height: clamp(100px, 26vmin, 160px); padding: 0; overflow: hidden; border-radius: 18px; }
.as-crop { display: block; width: 200%; height: 100%; }
.as-crop img { width: 100%; height: 100%; object-fit: contain; }
.as-left .as-crop { margin-right: -100%; }
.as-right .as-crop { margin-left: -100%; }
.as-left.option { border-radius: 18px 0 0 18px; opacity: 1; }
.as-slot { width: clamp(50px, 13vmin, 80px); height: clamp(100px, 26vmin, 160px); border-radius: 0 18px 18px 0; background: #ece6ff; }
.as-slot .as-half.option { border-radius: 0 18px 18px 0; }
.as-row { display: flex; gap: 5vmin; direction: ltr; }
.as-ghost { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; }

/* order */
.or-row { display: flex; gap: 4vmin; align-items: flex-end; min-height: clamp(90px, 24vmin, 150px); }
.game45 .or-pic.option { width: calc(clamp(84px, 22vmin, 140px) * var(--s, 1)); height: calc(clamp(84px, 22vmin, 140px) * var(--s, 1)); }
.or-stairs { display: flex; direction: ltr; align-items: flex-end; gap: 1vmin; }
.or-step { width: clamp(90px, 23vmin, 145px); display: flex; align-items: flex-end; justify-content: center; background: linear-gradient(#c9b8ff, #a48df0);
  border-radius: 14px 14px 0 0; box-shadow: inset 0 -6px 0 #0001; }
.or-step0 { height: 6vmin; } .or-step1 { height: 12vmin; } .or-step2 { height: 18vmin; }
.or-step { overflow: visible; margin-top: 24vmin; }

/* timing */
.tm-window { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: clamp(110px, 29vmin, 180px); height: clamp(110px, 29vmin, 180px);
  border: 8px solid #8a6bf0; border-radius: 28px; background: #fff6; box-shadow: 0 0 0 9999px #0000000d; }
.tm-window.is-hint { animation: tm-blink .3s 2; }
.tm-window.is-got { border-color: #4ccf6a; }
@keyframes tm-blink { 50% { border-color: #ffc928; scale: 1.06; } }
.tm-belt { position: absolute; left: 0; right: 0; top: 50%; translate: 0 -50%; height: clamp(84px, 22vmin, 140px); direction: ltr; }
.tm-card.option { position: absolute; left: 0; top: 0; will-change: transform; }

/* blow */
.bw-row { display: flex; gap: 5vmin; }
.bw-card.option { position: relative; overflow: visible; }
.bw-leaves { position: absolute; inset: 0; pointer-events: none; }
.bw-leaf { position: absolute; width: 30%; height: 22%; opacity: .92; border-radius: 0 100% 0 100%; background: #6cbf4a; box-shadow: inset -4px -4px 0 #0002;
  transition: translate .3s, opacity .3s; opacity: calc(1 - var(--blown, 0)); translate: calc(var(--blown, 0) * var(--dx)) calc(var(--blown, 0) * -120%); }
.bw-l0 { left: -6%; top: -4%;  --dx: -140%; rotate: 20deg; }
.bw-l1 { left: 72%; top: -6%;  --dx: 140%;  rotate: -30deg; background: #e7a43a; }
.bw-l2 { left: -10%; top: 40%; --dx: -180%; rotate: 70deg; }
.bw-l3 { left: 80%; top: 42%; --dx: 170%;  rotate: -10deg; background: #d06a3a; }
.bw-l4 { left: 4%; top: 82%; --dx: -120%; rotate: -40deg; background: #e7a43a; }
.bw-l5 { left: 66%; top: 84%; --dx: 150%;  rotate: 40deg; }
.bw-card.is-picked { box-shadow: 0 0 0 6px #ffc928, 0 6px 0 #d8d0f7; }
.bw-wind { width: min(60vw, 320px); height: 14px; border-radius: 9px; background: #ece6ff; opacity: 0; transition: opacity .3s; }
.bw-wind span { display: block; height: 100%; width: 0; border-radius: 9px; background: #7fd0ff; transition: width .15s; }
.game--blow.is-blowing .bw-wind { opacity: 1; }

/* rotate */
.rt-row { display: flex; gap: 5vmin; }
.rt-card.option img { rotate: var(--turn, 0deg); transition: rotate .3s cubic-bezier(.3, 1.4, .5, 1); }
.rt-card.is-up { animation: rt-yay .5s; }
@keyframes rt-yay { 50% { scale: 1.15; } }

@media (orientation: portrait) {
  .tr-row, .bw-row, .rt-row, .as-row { gap: 3vmin; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-star, .rt-card.option img { animation: none !important; transition: none !important; }
}

/* trace and timing use the whole screen (like bubbles); only their own parts take touches */
.stage.game--trace, .stage.game--timing { top: 0; left: 0; right: 0; bottom: 0; transform: none; display: block; pointer-events: none; }
.game--trace .tr-row { position: absolute; top: 16%; left: 0; right: 0; }
.game--trace .tr-row, .game--trace .tr-star, .game--timing .tm-card { pointer-events: auto; }
.game--trace .tr-pic, .game--trace .tr-star { pointer-events: auto; }
.game--trace .tr-row { pointer-events: none; }
