/* Ajustes específicos de la misión Viking. Se carga al final para no alterar otras misiones. */
.vf-launch-scene {
  background-color: #0d2556;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.vf-launch-stars {
  opacity: .18;
  mix-blend-mode: screen;
}

.vf-launch-rocket {
  filter: drop-shadow(0 5px 8px #061020a8);
}

/* El paracaídas es muy pequeño: su zona de encaje es mayor, pero la pieza sigue instalada en su punto exacto. */
.vf-slot-parachute {
  width: 56px;
  height: 48px;
  transform: translate(-34%, -20%);
  border-width: 2px;
  border-color: #8beeff;
  background: #123c5b88;
  box-shadow: 0 0 14px #46dbf055;
}

.vf-slot-parachute span {
  box-shadow: 0 0 8px #55e9ff;
}

@media (max-width: 520px) {
  .vf-slot-parachute { width: 48px; height: 42px; }
}

/* Secuencia de lanzamiento: vibración durante la cuenta atrás, motor encendido y ascenso completo. */
.vf-launch-scene::after {
  content: '';
  position: absolute;
  z-index: 0;
  bottom: -28px;
  left: 50%;
  width: 220px;
  height: 96px;
  transform: translateX(-50%) scale(.45);
  border-radius: 50%;
  background: radial-gradient(ellipse, #fff7d6 0 10%, #ffbf5a 22%, #ff653b77 48%, transparent 72%);
  filter: blur(9px);
  opacity: 0;
  transition: opacity .25s ease;
}

.vf-flame {
  z-index: 1;
  bottom: 0;
  width: 70px;
  height: 142px;
  opacity: 0;
  clip-path: polygon(50% 100%, 14% 44%, 33% 8%, 50% 0, 67% 8%, 86% 44%);
  background: linear-gradient(180deg, #fffde5 0 12%, #ffe27b 30%, #ff9f35 58%, #ec4d32 100%);
  filter: drop-shadow(0 0 8px #fff5a1) drop-shadow(0 0 23px #ff6b39);
  transform-origin: top center;
}

.vf-launch-scene.is-counting .vf-launch-rocket {
  animation: vf-rocket-vibration .12s steps(2, end) infinite;
}

.vf-launch-scene.is-counting .vf-flame {
  opacity: .72;
  height: 80px;
  animation: vf-engine-idle .16s ease-in-out infinite alternate;
}

.vf-launch-scene.is-counting::after {
  opacity: .55;
  transform: translateX(-50%) scale(.7);
}

.vf-launch-scene.is-launching .vf-launch-rocket,
.vf-launch-rocket.takeoff {
  animation: vf-rocket-ascent 2.85s cubic-bezier(.24, .55, .45, 1) forwards;
  opacity: 1;
}

.vf-launch-scene.is-launching .vf-flame {
  opacity: 1;
  animation: vf-engine-fire .12s ease-in-out infinite alternate;
}

.vf-launch-scene.is-launching::after {
  opacity: .9;
  animation: vf-launch-smoke 2.7s ease-out forwards;
}

@keyframes vf-rocket-vibration {
  from { transform: translate(-1px, 0); }
  to { transform: translate(1px, -1px); }
}

@keyframes vf-engine-idle {
  from { transform: scaleY(.8) scaleX(.86); }
  to { transform: scaleY(1) scaleX(1); }
}

@keyframes vf-engine-fire {
  from { transform: scaleY(.9) scaleX(.88); }
  to { transform: scaleY(1.18) scaleX(1.08); }
}

@keyframes vf-rocket-ascent {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  22% { transform: translateY(-45px) scale(1.01); opacity: 1; }
  100% { transform: translateY(-620px) scale(.74); opacity: 0; }
}

@keyframes vf-launch-smoke {
  0% { transform: translateX(-50%) scale(.55); opacity: .55; }
  100% { transform: translateX(-50%) scale(2.2); opacity: 0; }
}

/* El vehiculo contiene cohete, llama y estela: los tres ascienden como una sola unidad. */
.vf-launch-vehicle {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  align-self: end;
  width: 220px;
  height: 330px;
  transform-origin: 50% 100%;
}

.vf-launch-vehicle .vf-launch-rocket {
  position: relative;
  z-index: 3;
  align-self: end;
  width: 122px;
  max-height: 330px;
  transition: none;
}

.vf-launch-vehicle .vf-flame {
  position: absolute;
  z-index: 2;
  bottom: -96px;
  left: calc(50% - 35px);
  width: 70px;
  height: 142px;
  opacity: 0;
}

.vf-smoke-trail {
  position: absolute;
  z-index: 1;
  bottom: -178px;
  left: 50%;
  width: 168px;
  height: 180px;
  transform: translateX(-50%) scale(.45);
  transform-origin: 50% 0;
  border-radius: 48% 48% 62% 62%;
  background: radial-gradient(ellipse at 50% 8%, #fff7d9e8 0 11%, #f3d6b1a8 30%, #a4a1b5a0 54%, transparent 74%);
  filter: blur(9px);
  opacity: 0;
}

.vf-launch-scene.is-counting .vf-launch-vehicle {
  animation: vf-vehicle-vibration .12s steps(2, end) infinite;
}

.vf-launch-scene.is-counting .vf-launch-vehicle .vf-launch-rocket,
.vf-launch-scene.is-launching .vf-launch-vehicle .vf-launch-rocket {
  animation: none;
  transform: none;
  opacity: 1;
}

.vf-launch-scene.is-counting .vf-launch-vehicle .vf-flame {
  opacity: .72;
  height: 80px;
  animation: vf-engine-idle .16s ease-in-out infinite alternate;
}

.vf-launch-scene.is-counting .vf-launch-vehicle .vf-smoke-trail {
  opacity: .32;
  animation: vf-smoke-idle .55s ease-in-out infinite alternate;
}

.vf-launch-vehicle.takeoff {
  animation: vf-vehicle-ascent 2.95s cubic-bezier(.24, .55, .45, 1) forwards;
}

.vf-launch-vehicle.takeoff .vf-flame {
  opacity: 1;
  height: 154px;
  animation: vf-engine-fire .11s ease-in-out infinite alternate;
}

.vf-launch-vehicle.takeoff .vf-smoke-trail {
  opacity: .8;
  animation: vf-smoke-ascent 2.95s ease-out forwards;
}

@keyframes vf-vehicle-vibration {
  from { transform: translate(-1px, 0); }
  to { transform: translate(1px, -1px); }
}

@keyframes vf-vehicle-ascent {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  17% { transform: translateY(-28px) scale(1.01); opacity: 1; }
  100% { transform: translateY(-650px) scale(.74); opacity: 0; }
}

@keyframes vf-smoke-idle {
  from { transform: translateX(-50%) scale(.38); }
  to { transform: translateX(-50%) scale(.58); }
}

@keyframes vf-smoke-ascent {
  0% { transform: translateX(-50%) scale(.55); opacity: .8; }
  100% { transform: translateX(-50%) scale(1.45); opacity: 0; }
}

/* Ruta a Marte: cohete horizontal, corredor, asteroides e indicadores de daño. */
.vf-flight-asteroid .vf-hud,
.vf-flight-asteroid .vf-route,
.vf-flight-asteroid .vf-corridor,
.vf-flight-asteroid .vf-flight-message,
.vf-flight-asteroid .vf-controls,
.vf-flight-asteroid .vf-flight-start {
  z-index: 6;
}

.vf-flight-asteroid .vf-corridor {
  z-index: 4;
  top: 43%;
  right: 4%;
  left: 4%;
  height: 96px;
}

.vf-flight-asteroid .vf-corridor #rocket {
  z-index: 5;
  top: calc(50% - 130px);
  left: calc(20% - 56px);
  width: 112px;
  height: 260px;
  filter: drop-shadow(0 0 9px #62e7ff88);
}

.vf-mars-route {
  position: absolute;
  z-index: 2;
  top: calc(50% - 42px);
  right: 16px;
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px #ff873f99);
}

.vf-flight-asteroid .vf-corridor > b {
  right: 22px;
  top: calc(50% + 56px);
  z-index: 3;
}

.vf-flight-asteroid .vf-flight-message {
  bottom: 110px;
}

.vf-asteroid-layer {
  position: absolute;
  z-index: 5;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.vf-asteroid {
  position: absolute;
  left: var(--asteroid-x);
  top: var(--asteroid-y);
  width: var(--asteroid-size);
  height: var(--asteroid-size);
  object-fit: contain;
  transform: translate(-50%, -50%) rotate(var(--asteroid-rotation));
  filter: drop-shadow(0 5px 5px #03030bbb);
}

.vf-impact-flash {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 48%, #ff3e3e15 0 22%, #ef1d2c75 100%);
}

.vf-flight-asteroid.impact { animation: vf-impact-shake .34s linear; }
.vf-flight-asteroid.impact .vf-impact-flash { animation: vf-impact-red .42s ease-out; }
.vf-flight-asteroid.impact #rocket { filter: drop-shadow(0 0 10px #ff3131) sepia(1) saturate(5) hue-rotate(320deg); }

.vf-direction-controls {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-areas: '. up .' 'left down right';
  width: max-content;
  margin: 0 auto;
}

.vf-direction-controls [data-flight-y="-1"] { grid-area: up; }
.vf-direction-controls [data-flight-x="-1"] { grid-area: left; }
.vf-direction-controls [data-flight-y="1"] { grid-area: down; }
.vf-direction-controls [data-flight-x="1"] { grid-area: right; }

.vf-arrival-mars {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 6px;
  object-fit: contain;
  filter: drop-shadow(0 0 14px #ff8547bb);
}

@keyframes vf-impact-shake {
  0%, 100% { transform: translate(0); }
  25% { transform: translate(-7px, 3px); }
  50% { transform: translate(7px, -3px); }
  75% { transform: translate(-4px, 2px); }
}

@keyframes vf-impact-red {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 620px) {
  .vf-launch-vehicle { transform: scale(.82); transform-origin: 50% 100%; }
  .vf-flight-asteroid .vf-corridor #rocket { top: calc(50% - 90px); left: calc(20% - 42px); width: 84px; height: 180px; }
  .vf-flight-asteroid .vf-corridor > b { right: 4px; }
}
