/* Estilos base */
:root {
  --glass: rgba(22,24,28,.7);
  --stroke: #586071;
  --fg: #e9ecf1;
  --muted: #a6adbb;
}

html, body {
  height: 100%;
  margin: 0;
  background: #000;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
  overflow: hidden;
}

#scene-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#map2d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  background: radial-gradient(1200px 800px at 48% 40%, #0b0d12 0%, #07080c 60%, #03040a 100%);
}

/* Botones y toolbars */
#top-left {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#top-right {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1000;
  display: flex;
  gap: 10px;
}

.btn-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: #17181d;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}

.btn-icon img {
  width: 22px;
  height: 22px;
}

.btn-icon:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn-icon.active {
  outline: 2px solid #88aaff;
}

.btn-icon[disabled] {
  filter: grayscale(.7) opacity(.7);
  cursor: not-allowed;
}

/* Botón quad para grupos */
.btn-icon.quad {
  position: relative;
}

.btn-icon.quad .dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(210,225,255,0.35);
  cursor: pointer;
}

.btn-icon.quad .dot.tl { top: 6px; left: 6px; background: #fa1328; }
.btn-icon.quad .dot.tr { top: 6px; right: 6px; background: #fe4e01; }
.btn-icon.quad .dot.bl { bottom: 6px; left: 6px; background: #648606; }
.btn-icon.quad .dot.br { bottom: 6px; right: 6px; background: #133afa; }

.btn-icon.quad .dot.off { opacity: 0.45; }

/* Etiquetas y labels */
.reference-label, .star-label, .equatorial-label {
  color: #fff;
  text-shadow: 1px 1px 2px #000;
  pointer-events: none;
  white-space: nowrap;
  font-size: 13px;
  transform: translate(-50%, -120%);
}

.distance-label {
  color: #f0f3f8;
  font-weight: 600;
  background: rgba(0,0,0,.55);
  padding: 3px 6px;
  border-radius: 6px;
}

.star-label {
  font-size: 9px;
  opacity: 0.9;
  transition: opacity 0.2s;
  transform: translate(-50%, -150%);
}

.main-star-label {
  color: #a0d8ff;
  font-size: 10px;
  opacity: 0.9;
}

.hover-label {
  background: rgba(0,0,0,0.65);
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 11px;
  text-shadow: 1px 1px 2px black;
}

.hover-label-name { font-weight: 600; }
.hover-label-coord { font-size: 9px; color: #aaaaff; }
.hover-label-altitude { font-size: 11px; color: #E0B0FF; }

/* Info cards y tooltips */
.info-card {
  position: fixed;
  max-width: 420px;
  color: #eaf0ff;
  background: rgba(12,16,28,.92);
  border: 1px solid rgba(180,200,255,.18);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 12px 24px rgba(0,0,0,.35);
  z-index: 1000;
}

.info-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.info-card a {
  color: #8fb8ff;
  text-decoration: none;
}

.info-card a:hover { text-decoration: underline; }

/* Paneles de ayuda */
#help-box {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 900;
  max-width: 360px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  color: var(--fg);
  font-size: 11px;
  line-height: 1.3;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#help-box h4 {
  margin: 0 0 4px;                  /* menos margen inferior */
  font-size: 11px;                  /* más pequeño que 15px */
  color: #fff;
}

.panel-divider {
  margin: 6px 0;
  height: 0;
  border-top: 1px solid rgba(255,255,255,0.28);
}

.ack-section {
  color: #e8ecf4;
  font: 11px/1.3 system-ui, sans-serif;
}

.ack-name {
  font-weight: 700;
  background: #fff;
  color: #000;
  border-radius: 4px;
  margin: 0 4px;
  padding: 0 4px;
}

.ack-handle { color: #9ec9ff; text-decoration: none; }

#help-panel {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 520px;
  background: rgba(8,10,18,.92);
  border: 1px solid rgba(210,225,255,.35);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  padding: 14px;
  z-index: 20;
}

#help-panel img {
  display: block;
  width: 103%;
  height: auto;
}

@media (max-width: 1200px) { #help-panel { width: 440px; } }
@media (max-width: 900px) { #help-panel { width: 360px; } }
@media (max-width: 700px) { #help-panel { width: 300px; } }
@media (max-width: 600px) { #help-panel { display: none; } }

/* Doc bar */
#doc-bar {
  position: fixed;
  top: 14px;
  left: 40%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  z-index: 1002;
  backdrop-filter: blur(2px);
}

/* En móvil/tablet: mover a la izquierda, cerca de top-left */
@media (max-width: 768px) {
  #doc-bar {
    left: 70px;                  /* A la derecha de los botones top-left (ajusta si necesitas más/menos) */
    top: 14px;
    transform: none;             /* Quitar centrado */
    flex-direction: row;         /* Mantener horizontal */
    gap: 8px;                    /* Espacio más pequeño */
  }

  /* Reducir tamaño de banderas y PDF en móvil */
  #doc-bar .lang-btn img,
  #doc-bar .doc-link {
    width: 24px;                 /* Bandera más pequeña */
    height: 24px;
    font-size: 12px;             /* Texto PDF más pequeño */
  }
}

.doc-lang {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-btn {
  padding: 2px;
  border-radius: 6px;
  border: 1px solid rgba(210,220,255,0.35);
  background: #000;
  cursor: pointer;
}

.lang-btn.active {
  box-shadow: 0 0 0 2px rgba(180,215,255,0.88), 0 0 14px rgba(170,210,255,0.55);
}

.lang-btn img {
  width: 22px;
  height: 22px;
}

.doc-link {
  color: #eaf2ff;
  text-decoration: none;
  font: 600 14px/1.2 system-ui, sans-serif;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  background: #0b0b0c;
}

.doc-link:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .doc-bar { top: 8px; gap: 8px; padding: 5px 8px; }
  .lang-btn img { width: 20px; height: 20px; }
  .doc-link { font-size: 13px; padding: 5px 8px; }
}

/* Modo 2D específico */
.disabled-when-2d [data-3d-only="true"] {
  filter: grayscale(.7) opacity(.7);
  pointer-events: none;
}

#toggleArcs.mode-2d img { width: 30px; height: 30px; transform: translate(2px, 3px); }
#toggleArcs:not(.mode-2d) img { width: 22px; height: 22px; transform: none; }

#toggleHeight.btn-icon.mode-2d {
  background-color: #000 !important;
  border: 1px solid rgba(210,225,255,0.55) !important; /* Reborde visible en 2D */
  opacity: 1 !important;
  filter: none !important;
}


#toggleHeight.btn-icon.mode-2d img#iconHeight { filter: invert(1) !important; }