/* Home-page play layer: globe pins, spin-to-pick, parallax, wish hearts.
   Everything decorative is scoped to html[data-fx=on], which world-fx.js only
   sets when motion is allowed. The picker itself works without motion. */

/* ---- Globe pins ---- */
.fx-pins{position:absolute;inset:0;pointer-events:none;opacity:0;transition:opacity .3s}
.world-chooser[data-state=choice] .fx-pins{opacity:1}
.world-chooser[data-state=choice] .earth-ball.fx-spinning .fx-pins{opacity:0;transition-duration:.1s}
.fx-pin{position:absolute;left:var(--x);top:var(--y);width:0;height:0}
.fx-pin::before,.fx-pin::after{content:'';position:absolute;box-sizing:border-box;width:11px;height:11px;margin:-5.5px;border-radius:50%}
.fx-pin::before{background:#e8604c;border:2px solid #fffdf5;box-shadow:0 1px 0 #173e3555;transition:transform .2s;z-index:1}
.fx-pin::after{border:2px solid #e8604c;opacity:0}
.fx-pin b{position:absolute;left:0;bottom:11px;transform:translateX(-50%) scale(.5);transform-origin:50% 100%;opacity:0;white-space:nowrap;background:#173e35;color:#fffdf5;font:600 12px/1 'Noto Sans TC',sans-serif;letter-spacing:.04em;padding:6px 10px;border-radius:14px;transition:transform .22s cubic-bezier(.3,1.6,.5,1),opacity .15s;z-index:2}
.fx-pin b::after{content:'';position:absolute;left:50%;top:100%;margin-left:-4px;border:4px solid transparent;border-top-color:#173e35;border-bottom:0}
.fx-pin.is-on::before{transform:scale(1.45)}
.fx-pin.is-on b{opacity:1;transform:translateX(-50%) scale(1)}
html[data-fx=on] .fx-pin::after{animation:fx-ripple 2.6s ease-out infinite;animation-delay:var(--d)}
html[data-fx=on] .fx-pin.is-on::after{animation-duration:1s;animation-delay:0s}
@keyframes fx-ripple{0%{transform:scale(1);opacity:.75}60%,100%{transform:scale(3.4);opacity:0}}

/* ---- Spin-to-pick: its own row under the scene, so it never covers the map ---- */
.fx-spin-row{display:flex;justify-content:center;margin:-2px auto 20px;visibility:hidden;opacity:0;transition:opacity .35s}
.world-chooser[data-state=choice] .fx-spin-row{visibility:visible;opacity:1}
.fx-spin{display:inline-flex;align-items:center;gap:9px;min-height:48px;padding:10px 24px 10px 20px;border:0;border-radius:28px;background:#173e35;color:#fffdf5;font:600 15px/1.3 'Noto Sans TC',sans-serif;letter-spacing:.05em;white-space:nowrap;cursor:pointer;box-shadow:0 6px 16px #173e352e;transition:transform .15s,box-shadow .15s,background-color .15s}
.fx-spin svg{width:19px;height:19px;flex:none}
.fx-spin:hover{background:#215446;transform:translateY(-2px);box-shadow:0 9px 20px #173e3538}
.fx-spin:active{transform:translateY(1px);box-shadow:0 3px 8px #173e3530}
.fx-spin:focus-visible{outline:3px solid #537e5c;outline-offset:3px}
.fx-spin[disabled]{cursor:progress}
html[data-fx=on] .fx-spin svg{animation:fx-nudge 6s ease-in-out infinite}
html[data-fx=on] .fx-spin:hover svg{animation:fx-turn .7s ease}
html[data-fx=on] .fx-spin.is-spinning svg{animation:fx-turn .6s linear infinite}
.world-chooser[data-state=choice] .earth-ball>img{cursor:pointer}
@keyframes fx-turn{to{transform:rotate(360deg)}}
@keyframes fx-nudge{0%,82%,100%{transform:rotate(0)}88%{transform:rotate(-28deg)}95%{transform:rotate(360deg)}}

/* ---- Cat speech bubble: sits on the cat's head (JS sets left/bottom).
   The pick result is a real link with a "go" chip. ---- */
/* Reserve a dialogue lane between the introduction and the cat. Without it,
   the absolute bubble can rise into the introduction on short viewports. */
.world-chooser[data-state=choice] .world-scene{margin-top:72px}
.fx-bubble{position:absolute;left:4%;bottom:70%;z-index:5;display:inline-flex;align-items:center;gap:10px;width:max-content;padding:10px 16px;border:2px solid #173e35;border-radius:22px;background:#fffdf5;color:#173e35;font:700 15px/1.4 'Noto Sans TC',sans-serif;letter-spacing:.03em;text-decoration:none;box-shadow:0 5px 0 #173e351f;opacity:0;visibility:hidden;transform:translateY(10px) scale(.7);transform-origin:30px 100%;transition:opacity .16s,transform .28s cubic-bezier(.3,1.7,.5,1),visibility 0s .28s}
.fx-bubble::after{content:'';position:absolute;left:24px;bottom:-8px;width:12px;height:12px;background:#fffdf5;border:solid #173e35;border-width:0 2px 2px 0;border-radius:0 0 3px 0;transform:rotate(45deg)}
.fx-bubble.is-on{opacity:1;visibility:visible;transform:none;transition-delay:0s}
.world-chooser:not([data-state=choice]) .fx-bubble{display:none}
.fx-bubble-text{display:block;min-width:0;overflow-wrap:anywhere;line-height:1.5}
.fx-bubble-go{flex:none;padding:5px 12px;border-radius:16px;background:#e8604c;color:#fff;font-size:13px;letter-spacing:.06em;transition:transform .15s,background-color .15s}
.fx-bubble[href]{padding-right:10px;cursor:pointer}
.fx-bubble[href]:hover .fx-bubble-go{background:#d24c39;transform:translateX(3px)}
.fx-bubble:focus-visible{outline:3px solid #537e5c;outline-offset:3px}

/* ---- Picked ticket ---- */
.country-ticket.fx-picked{box-shadow:0 0 0 3px #173e35,0 8px 0 #173e3514}
html[data-fx=on] .country-ticket.fx-picked{animation:fx-picked .9s ease 2}
@keyframes fx-picked{0%,100%{transform:none}30%{transform:translateY(-7px) rotate(-1deg)}60%{transform:translateY(-3px) rotate(1deg)}}

/* ---- Idle life: hop, twinkle, bob, parallax ---- */
html[data-fx=on] .country-ticket:is(:hover,:focus-visible,.fx-picked)>:is(.world-cat,.world-country-cat){animation:fx-hop .55s ease}
html[data-fx=on] .future-country.fx-yay .future-country-cat{animation:fx-hop .55s ease}
@keyframes fx-hop{0%,100%{transform:none}35%{transform:translateY(-9px) rotate(-3deg)}65%{transform:translateY(0) rotate(2deg)}80%{transform:translateY(-3px)}}
html[data-fx=on] .play-cat.fx-boop{animation:fx-boop .5s ease}
@keyframes fx-boop{0%,100%{scale:1}30%{scale:1.06 .93}60%{scale:.97 1.05}}
html[data-fx=on] .world-chooser[data-state=choice] .play-cat{cursor:pointer}
html[data-fx=on] .world-chooser[data-state=choice] .world-spark{animation:fx-twinkle 3.2s ease-in-out infinite}
html[data-fx=on] .world-chooser[data-state=choice] .spark-b{animation-delay:-1.4s}
@keyframes fx-twinkle{0%,100%{scale:1;opacity:1}50%{scale:.6;opacity:.45}}
html[data-fx=on] .world-chooser[data-state=choice] .world-plane{animation:fx-bob 3.6s ease-in-out infinite}
@keyframes fx-bob{0%,100%{translate:0 0}50%{translate:4px -8px}}
@media(hover:hover) and (pointer:fine){
  html[data-fx=on] .world-chooser[data-state=choice] :is(.earth-ball,.play-cat,.world-spark,.world-orbit){transition:translate .3s ease-out}
  html[data-fx=on] .world-chooser[data-state=choice] .earth-ball{translate:calc(var(--fx-px,0)*-9px) calc(var(--fx-py,0)*-6px)}
  html[data-fx=on] .world-chooser[data-state=choice] .play-cat{translate:calc(var(--fx-px,0)*7px) calc(var(--fx-py,0)*3px)}
  html[data-fx=on] .world-chooser[data-state=choice] .world-spark{translate:calc(var(--fx-px,0)*-20px) calc(var(--fx-py,0)*-14px)}
  html[data-fx=on] .world-chooser[data-state=choice] .world-orbit{translate:calc(var(--fx-px,0)*-14px) calc(var(--fx-py,0)*-9px)}
}

/* ---- Future list: staggered reveal + wish hearts ---- */
html[data-fx=on] .fx-reveal>li{opacity:0;translate:0 22px}
html[data-fx=on] .fx-reveal.is-in>li{opacity:1;translate:0 0;transition:opacity .5s ease,translate .5s cubic-bezier(.2,.9,.3,1.2);transition-delay:calc(var(--i,0)*80ms)}
.fx-heart{position:fixed;left:0;top:0;z-index:50;pointer-events:none;color:#e8604c;font-size:18px;line-height:1;will-change:transform,opacity}

@media(max-width:560px){
  .fx-spin-row{margin:4px auto 16px}
  .fx-spin{font-size:14px;min-height:46px;padding:9px 20px 9px 16px}
  .fx-bubble{font-size:13px;padding:8px 12px;gap:8px;border-radius:18px}
  .fx-bubble[href]{padding-right:8px}
  .fx-bubble-go{font-size:12px;padding:4px 10px}
  .fx-pin b{font-size:11px;padding:5px 8px}
}
