/* Oddball juice — Sparky. Additive overlay; does not restyle the base game. */

/* ---- Combo heat + pop ---- */
#combo-chip.fun-heat-1 {
  background: linear-gradient(90deg, #2dff6a, #c8ff3a);
  color: #10200a;
  box-shadow: 0 0 14px rgba(124, 255, 80, 0.65);
}
#combo-chip.fun-heat-2 {
  background: linear-gradient(90deg, #ffe14a, #ffb200);
  color: #2a1a00;
  box-shadow: 0 0 14px rgba(255, 210, 40, 0.7);
}
#combo-chip.fun-heat-3 {
  background: linear-gradient(90deg, #ff8a1a, #ff4d00);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 100, 20, 0.75);
}
#combo-chip.fun-heat-4 {
  background: linear-gradient(90deg, #ff2d8a, #ff4df0);
  color: #fff;
  box-shadow: 0 0 18px rgba(255, 60, 160, 0.85);
}
#combo-gauge.fun-heat-1 #combo-readout { color: #7CFF9E; }
#combo-gauge.fun-heat-2 #combo-readout { color: #ffe14a; }
#combo-gauge.fun-heat-3 #combo-readout { color: #ff8a1a; }
#combo-gauge.fun-heat-4 #combo-readout {
  color: #ff4db8;
  text-shadow: 0 0 12px rgba(255, 77, 184, 0.8);
}
#combo-chip.fun-pop,
#combo-gauge.fun-pop {
  animation: fun-combo-pop 0.5s cubic-bezier(.2, 1.6, .3, 1);
}
@keyframes fun-combo-pop {
  0% { transform: scale(0.72) rotate(-8deg); }
  38% { transform: scale(1.16) rotate(5deg); }
  62% { transform: scale(0.94) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---- Exploding score ---- */
#result-points { position: relative; font-variant-numeric: tabular-nums; }
#result-points.fun-pop { animation: fun-score-pop 0.42s cubic-bezier(.2, 1.6, .3, 1); }
@keyframes fun-score-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.28); }
  100% { transform: scale(1); }
}
.fun-sparks {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 2;
}
.fun-sparks i {
  position: absolute;
  left: 0;
  top: 0;
  width: 7px;
  height: 7px;
  margin: -3px;
  border-radius: 1px;
  background: var(--fun-c, #ffb24a);
  pointer-events: none;
  animation: fun-spark 0.58s ease-out forwards;
}
@keyframes fun-spark {
  0% { transform: rotate(var(--fun-r)) translateY(0) scale(1); opacity: 1; }
  100% { transform: rotate(var(--fun-r)) translateY(var(--fun-d, -36px)) scale(0.15); opacity: 0; }
}

/* ---- Mission Control face ---- */
.fun-mc-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fun-mc {
  flex: 0 0 auto;
  display: block;
  overflow: visible;
  pointer-events: none;
}
.fun-mc .bg { fill: #1a1540; stroke: #7CFF9E; stroke-width: 1.5; }
.fun-mc .pupil, .fun-mc .wide { fill: #7ee0d0; }
.fun-mc .xeyes, .fun-mc .sleepy, .fun-mc .lids {
  fill: none; stroke: #7ee0d0; stroke-width: 1.7; stroke-linecap: round;
}
.fun-mc .m-sad, .fun-mc .m-smile, .fun-mc .m-grin {
  fill: none; stroke: #7ee0d0; stroke-width: 1.7; stroke-linecap: round;
}
.fun-mc .m-yawn, .fun-mc .m-oh, .fun-mc .m-wow {
  fill: #0b0720; stroke: #7ee0d0; stroke-width: 1.4;
}
.fun-mc .stars { fill: #ffb24a; }
.fun-mc .xeyes, .fun-mc .wide, .fun-mc .sleepy, .fun-mc .lids,
.fun-mc .m-sad, .fun-mc .m-yawn, .fun-mc .m-smile, .fun-mc .m-grin,
.fun-mc .m-oh, .fun-mc .m-wow, .fun-mc .stars { visibility: hidden; }
.fun-mc[data-mood="miss"] .xeyes,
.fun-mc[data-mood="miss"] .m-sad,
.fun-mc[data-mood="obvious"] .sleepy,
.fun-mc[data-mood="obvious"] .m-yawn,
.fun-mc[data-mood="solid"] .m-smile,
.fun-mc[data-mood="sharp"] .m-grin,
.fun-mc[data-mood="oddball"] .wide,
.fun-mc[data-mood="oddball"] .m-oh,
.fun-mc[data-mood="unheard"] .wide,
.fun-mc[data-mood="unheard"] .m-wow,
.fun-mc[data-mood="unheard"] .stars { visibility: visible; }
.fun-mc[data-mood="miss"] .pupil,
.fun-mc[data-mood="obvious"] .pupil,
.fun-mc[data-mood="oddball"] .pupil,
.fun-mc[data-mood="unheard"] .pupil { visibility: hidden; }
.fun-mc.fun-blink .pupil,
.fun-mc.fun-blink .wide,
.fun-mc.fun-blink .xeyes,
.fun-mc.fun-blink .sleepy { visibility: hidden; }
.fun-mc.fun-blink .lids { visibility: visible; }
.fun-mc[data-mood="unheard"] {
  transform-origin: 50% 50%;
  animation: fun-mc-shake 0.45s ease-in-out infinite;
}
@keyframes fun-mc-shake {
  0%, 100% { transform: rotate(-8deg) scale(1.05); }
  50% { transform: rotate(8deg) scale(1.12); }
}

/* ---- Low-fuel panic (gentle, never covers the answer form) ---- */
#timer-wrap.fun-panic,
#timer-wrap.fun-panic .fuel-bar,
#timer-wrap.fun-panic #timer-num,
#rocket.fun-panic,
#rocket.fun-panic svg {
  pointer-events: none;
}
#timer-wrap.fun-panic .fuel-bar {
  background: linear-gradient(90deg, #ff1133, #ff6a00) !important;
  box-shadow: 0 0 10px rgba(255, 30, 40, 0.45);
  animation: fun-fuel-flash 1.6s ease-in-out infinite;
}
#timer-wrap.fun-panic #timer-num { color: #ff3355; }
@keyframes fun-fuel-flash {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.28) saturate(1.12); }
}
#rocket.fun-panic svg { animation: fun-jitter 0.07s linear infinite; }
@keyframes fun-jitter {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-1.6px, 1px) rotate(-1.4deg); }
  75% { transform: translate(1.6px, -1px) rotate(1.4deg); }
}

/* ---- Final grid flip (do not touch #lb) ---- */
#final-grid { perspective: 640px; }
#final-grid > .fun-flip {
  display: inline-block;
  backface-visibility: hidden;
  transform-origin: 50% 50%;
  pointer-events: none;
  animation: fun-flip-in 0.5s cubic-bezier(.15, 1.2, .3, 1) both;
  animation-delay: var(--fun-delay, 0s);
}
@keyframes fun-flip-in {
  0% { transform: rotateY(90deg) scale(0.7); opacity: 0; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #combo-chip.fun-pop,
  #combo-gauge.fun-pop,
  #result-points.fun-pop,
  #timer-wrap.fun-panic .fuel-bar,
  #rocket.fun-panic svg,
  #final-grid > .fun-flip,
  .fun-sparks i,
  .fun-mc[data-mood="unheard"] {
    animation: none !important;
  }
}

/* ==== Launch-and-fly between rounds — Sparky (v2) ====
   Uses the individual `translate`/`scale` properties so it composes with
   Bloop's `transform`-based layout instead of overriding it. */
.fly-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
/* #ruler stays readable: streaks skip its column (fun.js) and the ruler is never animated here. */
body.fly-on .rocket-stage { animation: fly-rocket var(--fly-dur, 1400ms) cubic-bezier(.3,.1,.25,1) both; }
body.fly-on #rocket svg { animation: fly-wobble .09s linear infinite alternate; }
body.fly-on #rocket .flame-outer, body.fly-on #rocket .flame-inner, body.fly-on #rocket .flame-glow {
  transform-box: fill-box; transform-origin: 50% 0; animation: fly-flame var(--fly-dur, 1400ms) ease-out both;
}
body.fly-on .ground, body.fly-on .earth, body.fly-on .moon { animation: fly-drop var(--fly-dur, 1400ms) cubic-bezier(.45,0,.25,1) both; }
body.fly-on .clouds {
  animation: fly-fall var(--fly-dur, 1400ms) cubic-bezier(.45,0,.25,1) both;
}
body.fly-on .stars-a, body.fly-on .stars-b { animation: fly-stars var(--fly-dur, 1400ms) cubic-bezier(.45,0,.25,1) both; }
body.fly-on .sky-grad { animation: fly-sky var(--fly-dur, 1400ms) ease-in-out both; }
body.fly-on #screen-play .console { animation: fly-card var(--fly-dur, 1400ms) cubic-bezier(.2,.9,.3,1.25) both; }
body.fly-big .sky { animation: fly-shake .12s linear 4 calc(var(--fly-dur, 1400ms) * .2); }
body.fly-miss .rocket-stage { animation-timing-function: ease-out; }
body.fly-fade #screen-play .console { animation: fly-fade .28s ease both; }

@keyframes fly-rocket {
  0% { translate: 0 0; } 12% { translate: 0 6px; }
  45% { translate: 0 calc(var(--fly-rise, 10vh) * -1); }
  100% { translate: 0 0; }
}
@keyframes fly-wobble { from { rotate: -1.2deg; } to { rotate: 1.2deg; } }
@keyframes fly-flame { 0% { scale: 1 1; } 20%, 60% { scale: 1.25 2.1; } 100% { scale: 1 1; } }
@keyframes fly-fall {
  0% { translate: 0 0; opacity: 1; }
  55% { translate: 0 calc(var(--fly-rise, 10vh) * 3); opacity: .35; }
  56% { translate: 0 calc(var(--fly-rise, 10vh) * -1.2); opacity: 0; }
  100% { translate: 0 0; opacity: 1; }
}
@keyframes fly-drop { 0%, 100% { translate: 0 0; } 50% { translate: 0 calc(var(--fly-rise, 10vh) * 2); } }
@keyframes fly-stars { 0% { translate: 0 0; } 50% { translate: 0 calc(var(--fly-rise, 10vh) * 1.6); } 100% { translate: 0 0; } }
@keyframes fly-sky { 0%, 100% { filter: none; } 45% { filter: brightness(.7) saturate(1.3); } }
@keyframes fly-card {
  0%, 55% { translate: 0 -40px; opacity: .55; scale: .96; }
  78% { translate: 0 8px; opacity: 1; scale: 1.01; }
  90% { translate: 0 -3px; }
  100% { translate: 0 0; opacity: 1; scale: 1; }
}
@keyframes fly-shake { 0%, 100% { translate: 0 0; } 25% { translate: 2px -1px; } 75% { translate: -2px 1px; } }
@keyframes fly-fade { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  body.fly-on .rocket-stage, body.fly-on #rocket svg, body.fly-on .clouds, body.fly-on .ground, body.fly-on .earth,
  body.fly-on .moon, body.fly-on .stars-a, body.fly-on .stars-b, body.fly-on .sky-grad, body.fly-big .sky,
  body.fly-on #screen-play .console, body.fly-on #rocket .flame-outer { animation: none !important; }
  .fly-fx { display: none; }
}

/* ==== v3: zone cast, UFO beam-up — Sparky ==== */
.fun-cast { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.fun-top { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.fc { position: absolute; left: 0; top: 20%; pointer-events: none; opacity: .92; will-change: transform;
  animation: fc-cross var(--d, 20s) linear forwards; transition: opacity .6s ease; }
.fc.fc-rev { animation-name: fc-cross-rev; }
.fc.fc-rev > svg { transform: scaleX(-1); }
.fc.fc-bye { opacity: 0 !important; }
@keyframes fc-cross { from { translate: -200px 0; } to { translate: calc(100vw + 40px) -4vh; } }
@keyframes fc-cross-rev { from { translate: calc(100vw + 40px) 0; } to { translate: -200px -4vh; } }
.fc-bob > svg { animation: fc-bob 3.2s ease-in-out infinite; }
@keyframes fc-bob { 50% { translate: 0 -8px; } }
.fc-flap { animation: fc-flap .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes fc-flap { to { scale: 1 .45; } }
.fc-d1 { animation-delay: .17s !important; } .fc-d2 { animation-delay: .33s !important; }
.fc-waggle > svg { animation: fc-waggle 1.6s ease-in-out infinite; }
@keyframes fc-waggle { 25% { rotate: -6deg; } 75% { rotate: 6deg; } }
.fc-wave { animation: fc-wave .45s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 0% 100%; }
@keyframes fc-wave { from { rotate: -14deg; } to { rotate: 22deg; } }
.fc-blink { animation: fc-blink 1.1s steps(1) infinite; }
@keyframes fc-blink { 50% { opacity: .15; } }
.fc-tumble > svg { animation: fc-tumble 7s linear infinite; }
@keyframes fc-tumble { to { rotate: 360deg; } }
/* asteroid zips: fast diagonal whoosh */
.fc-zip { animation-name: fc-zip !important; animation-timing-function: cubic-bezier(.4,.1,.6,.9) !important; rotate: var(--tilt, 0deg); }
.fc-zip.fc-rev { animation-name: fc-zip-rev !important; }
@keyframes fc-zip { from { translate: -120px -6vh; } to { translate: calc(100vw + 40px) 10vh; } }
@keyframes fc-zip-rev { from { translate: calc(100vw + 40px) -6vh; } to { translate: -120px 10vh; } }
.fc-spin { animation: fc-tumble 1.2s linear infinite; transform-box: fill-box; transform-origin: center; }
/* astronaut on a tether by the Moon */
.fc-astro { left: auto; right: calc(6% + 150px); top: 16%; animation: fc-fade var(--d, 15s) ease forwards; }
.fc-astro > svg { animation: fc-bob 3.6s ease-in-out infinite; }
@keyframes fc-fade { 0% { opacity: 0; } 8%, 88% { opacity: .95; } 100% { opacity: 0; } }
/* whale */
.fc-whale > svg { width: 150px; height: auto; }
.fc-tail { animation: fc-tail 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 0% 50%; }
@keyframes fc-tail { 50% { rotate: 12deg; } }
.fc-spout { animation: fc-spout 6s ease-out infinite; }
@keyframes fc-spout { 0%, 70% { opacity: 0; translate: 0 6px; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 -6px; } }
/* UFO: zips in, wobbles, beams once, zips off */
.fc-ufo { left: auto; right: 10%; top: 13%; animation: fc-ufo var(--d, 9s) ease-in-out forwards; }
.fc-ufo > svg { animation: fc-waggle 1.2s ease-in-out infinite; }
@keyframes fc-ufo {
  0% { translate: 70vw -12vh; opacity: 0; } 12% { translate: 0 0; opacity: 1; }
  30% { translate: -14px 6px; } 50% { translate: 8px -4px; } 75% { translate: -6px 2px; opacity: 1; }
  100% { translate: -90vw -18vh; opacity: 0; }
}
.fc-beam { opacity: 0; animation: fc-beam var(--d, 9s) linear forwards; }
@keyframes fc-beam { 0%, 38% { opacity: 0; } 42%, 54% { opacity: .45; } 46% { opacity: .2; } 58%, 100% { opacity: 0; } }
.fc-ufo.fc-tap { pointer-events: auto; cursor: pointer; }
.fc-spark { position: fixed; z-index: 10; width: 0; height: 0; pointer-events: none; }
.fc-spark i { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; animation: fc-spark .7s ease-out forwards; }
@keyframes fc-spark { to { translate: var(--dx) var(--dy); opacity: 0; scale: .3; } }

/* paused while the tab is hidden */
body.fun-hidden .fun-cast *, body.fun-hidden .fun-cast, body.fun-hidden .fun-top * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .fun-cast, .fun-top { display: none; }
}
