/* Option 4: 3D Cinematic WebGL Scene Styling */
.solar-scene {
  position: -webkit-sticky;
  position: sticky;
  top: calc(var(--header-height) + 1.25rem);
  align-self: start;
  display: flex;
  flex-direction: column;
  height: min(80svh, 780px);
  min-height: 560px;
  margin: 0;
  padding: 1.25rem 1.4rem;
  overflow: hidden;
  border: 1px solid rgb(212 233 226 / 20%);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 25%, #153c32 0%, #0a2118 60%, #05120c 100%);
  box-shadow: 0 32px 100px rgb(0 0 0 / 50%), inset 0 0 0 1px rgb(212 233 226 / 8%);
  font-family: var(--font);
}

/* Subtle cinematic vignette */
.solar-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 55%, rgb(3 10 7 / 65%) 100%);
  pointer-events: none;
  z-index: 3;
}

/* WebGL 3D Canvas */
#solar-3d-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  display: block;
}

.scene__topline {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgb(212 233 226 / 12%);
  pointer-events: none;
}

.scene__telemetry-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgb(241 216 145 / 12%);
  border: 1px solid rgb(241 216 145 / 35%);
  color: #f1d891;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scene__telemetry-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f1d891;
  box-shadow: 0 0 8px #f1d891;
  animation: pulse-dot-3d 1.8s infinite ease-in-out;
}

@keyframes pulse-dot-3d {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.scene__gis-coords {
  color: rgb(212 233 226 / 75%);
  font-family: ui-monospace, monospace;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

/* WebGL Floating HUD Overlays */
.webgl-center-callout {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 350ms ease, transform 350ms ease;
}

.webgl-callout-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgb(8 26 20 / 88%);
  backdrop-filter: blur(10px);
  border: 1px solid rgb(56 189 248 / 40%);
  box-shadow: 0 8px 30px rgb(0 0 0 / 40%);
  color: #e0f2fe;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.webgl-callout-pill--heat {
  border-color: rgb(245 158 11 / 50%);
  color: #fef08a;
}

.webgl-callout-pill--tilt {
  border-color: rgb(34 197 94 / 50%);
  color: #86efac;
}

.webgl-callout-pill--grid {
  border-color: rgb(56 189 248 / 50%);
  color: #7dd3fc;
}

/* 3D Telemetry HUD Ribbon at bottom */
.webgl-hud-panel {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-top: auto;
  background: rgb(6 19 14 / 78%);
  backdrop-filter: blur(8px);
  border: 1px solid rgb(212 233 226 / 15%);
  border-radius: 6px;
  pointer-events: none;
  transition: all 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

.webgl-hud-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.25rem 0.4rem;
  border-left: 2px solid rgb(212 233 226 / 15%);
  transition: border-color 300ms ease, background-color 300ms ease;
}

.webgl-hud-item.is-active {
  border-left-color: #f1d891;
  background: rgb(241 216 145 / 8%);
}

.webgl-hud-label {
  color: rgb(212 233 226 / 60%);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.webgl-hud-val {
  color: #fff;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.webgl-hud-item.is-active .webgl-hud-val {
  color: #f1d891;
  text-shadow: 0 0 10px rgb(241 216 145 / 40%);
}

.scene__caption {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgb(212 233 226 / 10%);
  pointer-events: none;
}

/* Touch support on canvas */
#solar-3d-canvas {
  touch-action: pan-y;
}

.webgl-mobile-pill {
  display: none;
}

/* Mobile adjustments (<= 780px) */
@media (max-width: 780px) {
  .solar-scene {
    position: sticky;
    top: calc(var(--header-height) + 0.35rem);
    height: clamp(210px, 29svh, 250px);
    min-height: 0;
    padding: 0.55rem 0.75rem;
    gap: 0.35rem;
    border-radius: 10px;
    touch-action: pan-y;
  }

  #solar-3d-canvas {
    pointer-events: none;
    touch-action: pan-y;
  }

  .scene__topline {
    padding-bottom: 0.4rem;
  }

  .scene__telemetry-badge {
    font-size: 0.58rem;
    padding: 0.18rem 0.48rem;
    letter-spacing: 0.05em;
  }

  .scene__gis-coords {
    font-size: 0.58rem;
    letter-spacing: 0.02em;
    max-width: 52%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .webgl-callout-pill {
    max-width: min(92vw, 310px);
    white-space: normal;
    text-align: center;
    font-size: 0.67rem;
    padding: 0.28rem 0.65rem;
    line-height: 1.3;
  }

  /* Reemplazar HUD panel 2x2 por píldora dinámica de etapa activa */
  .webgl-hud-panel {
    display: none;
  }

  .webgl-mobile-pill {
    position: relative;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: auto;
    align-self: center;
    max-width: calc(100% - 1rem);
    padding: 0.38rem 0.8rem;
    background: rgb(6 19 14 / 88%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgb(241 216 145 / 45%);
    border-radius: 999px;
    box-shadow: 0 4px 16px rgb(0 0 0 / 45%);
    pointer-events: none;
    animation: fadeInPill 300ms ease;
  }

  .webgl-mobile-pill__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f1d891;
    box-shadow: 0 0 6px #f1d891;
    flex-shrink: 0;
  }

  .webgl-mobile-pill__text {
    color: #f1d891;
    font-family: ui-monospace, monospace;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .scene__caption {
    display: none; /* Integrado en la píldora y topline para dejar limpio el render 3D */
  }
}

@keyframes fadeInPill {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
