/* =========================================================
   IAG DIANA — INTERFAZ PRINCIPAL
   DISEÑO CENTRAL PROTAGONISTA — v2 (composición compacta)
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
}

body {
  background:
    radial-gradient(
      circle at 50% 38%,
      rgba(16, 73, 125, 0.38),
      transparent 34%
    ),
    linear-gradient(
      180deg,
      #020b17 0%,
      #031326 48%,
      #020b17 100%
    );

  color: #dcecff;

  font-family: Arial, Helvetica, sans-serif;

  overflow-x: hidden;
}

/* =========================================================
   CONTENEDOR
   ========================================================= */

.diana-interface {
  width: 100%;
  min-height: 100vh;
  padding: 8px;
}

/* =========================================================
   CABECERA — el logo es protagonista, nunca un cuadro pequeño
   ========================================================= */

.system-header {
  width: 100%;
  min-height: 88px;

  border: 1px solid #008bd0;
  border-radius: 14px;

  background:
    linear-gradient(
      90deg,
      rgba(5, 25, 48, 0.98),
      rgba(2, 15, 30, 0.94),
      rgba(5, 25, 48, 0.98)
    );

  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;

  padding: 10px 22px;

  box-shadow:
    0 0 18px rgba(0, 170, 255, 0.08),
    inset 0 0 25px rgba(0, 80, 150, 0.08);

  position: relative;
  z-index: 20;
  overflow: hidden;
}

/* Textura tecnológica de fondo en la barra (rejilla fina +
   líneas de circuito), para que el espacio vacío del header
   no se vea plano */
.system-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;

  background-image:
    repeating-linear-gradient(90deg, rgba(0, 190, 255, 0.05) 0 1px, transparent 1px 22px),
    linear-gradient(90deg, transparent 0%, rgba(0, 190, 255, 0.07) 38%, rgba(0, 190, 255, 0.07) 62%, transparent 100%),
    repeating-linear-gradient(0deg, rgba(0, 190, 255, 0.06) 0 1px, transparent 1px 14px);

  mask-image: linear-gradient(90deg, transparent 0%, black 20%, black 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 20%, black 80%, transparent 100%);
}

/* Puntos de "circuito" que parpadean con distinto ritmo,
   distribuidos por la franja central de la cabecera */
.system-header::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  top: 18%;
  left: 40%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #00d7ff;
  box-shadow:
    0 0 6px #00d7ff,
    120px 34px 0 -1px rgba(229, 180, 67, 0.85),
    260px 10px 0 -1.5px rgba(0, 215, 255, 0.8),
    370px 40px 0 -1px rgba(229, 180, 67, 0.7);
  animation: statusPulse 3.4s ease-in-out infinite;
}

.brand,
.header-right {
  position: relative;
  z-index: 1;
}

/* =========================================================
   ESQUINAS HUD — marcadores angulares tipo visor táctico,
   dan la sensación de "panel de sistema" en vez de caja plana
   ========================================================= */

.hud-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 21;
  pointer-events: none;
  opacity: 0.85;
}

.corner-tl {
  top: 6px;
  left: 8px;
  border-top: 2px solid #00d7ff;
  border-left: 2px solid #00d7ff;
  filter: drop-shadow(0 0 4px rgba(0, 215, 255, 0.6));
}

.corner-tr {
  top: 6px;
  right: 8px;
  border-top: 2px solid #00d7ff;
  border-right: 2px solid #00d7ff;
  filter: drop-shadow(0 0 4px rgba(0, 215, 255, 0.6));
}

.corner-bl {
  bottom: 6px;
  left: 8px;
  border-bottom: 2px solid #e5b443;
  border-left: 2px solid #e5b443;
  filter: drop-shadow(0 0 4px rgba(229, 180, 67, 0.5));
}

.corner-br {
  bottom: 6px;
  right: 8px;
  border-bottom: 2px solid #e5b443;
  border-right: 2px solid #e5b443;
  filter: drop-shadow(0 0 4px rgba(229, 180, 67, 0.5));
}

/* Línea de barrido que recorre la cabecera de lado a lado,
   como un escaneo de sistema activo — nada queda estático */
.header-scan {
  position: absolute;
  top: 0;
  left: -20%;
  width: 20%;
  height: 100%;
  z-index: 19;
  pointer-events: none;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 215, 255, 0.16),
    transparent
  );

  animation: headerScan 6s linear infinite;
}

.brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

/* =========================================================
   MARCO TECNOLÓGICO DEL LOGO — esquinas cortadas en ángulo,
   borde luminoso pulsante, estilo visor/HUD
   ========================================================= */

.logo-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  padding: 6px 14px;

  background: linear-gradient(
    145deg,
    rgba(4, 20, 38, 0.55),
    rgba(2, 12, 24, 0.75)
  );

  clip-path: polygon(
    10px 0,
    100% 0,
    100% calc(100% - 10px),
    calc(100% - 10px) 100%,
    0 100%,
    0 10px
  );

  border: 1px solid rgba(0, 215, 255, 0.55);

  animation: logoFramePulse 3.2s ease-in-out infinite;
}

/* LOGO REAL — ahora con transparencia auténtica (procesada a
   partir del archivo original, sin fondo blanco) y la letra "A"
   de IAG separada en una capa propia para poder girarla sola. */
.logo-wrap {
  position: relative;
  height: clamp(52px, 6vw, 76px);
  aspect-ratio: 748 / 487;
  perspective: 600px;
}

.header-logo-base,
.header-logo-a {
  display: block;
  object-fit: contain;

  filter:
    drop-shadow(0 0 6px rgba(0, 160, 255, 0.28))
    drop-shadow(0 0 10px rgba(255, 190, 60, 0.14));
}

.header-logo-base {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Posición/tamaño exactos de la "A" dentro del logo original
   (748x487px), expresados en porcentaje para que escale junto
   con el resto del logo. */
.header-logo-a {
  position: absolute;
  left: 22.46%;
  top: 3.08%;
  width: 29.95%;
  height: 55.44%;

  transform-style: preserve-3d;
  animation: spinLetterA 4.5s linear infinite;
}

.brand-divider {
  width: 1px;
  height: 44px;
  background: linear-gradient(transparent, #008bd0, transparent);
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brand-title {
  color: #eaf6ff;
  font-family: "Orbitron", Arial, sans-serif;
  font-size: clamp(14px, 1.8vw, 20px);
  font-weight: 700;
  letter-spacing: 3px;
  white-space: nowrap;
}

/* La letra "A" real del logo (imagen con transparencia real,
   no texto), insertada en el título cada vez que aparece una A */
.letter-a-img {
  height: 0.82em;
  width: auto;
  vertical-align: -0.06em;
  margin: 0 1px;
  filter: drop-shadow(0 0 5px rgba(0, 160, 255, 0.35));
}

.brand-subtitle {
  color: #6e99bc;
  font-size: 10px;
  letter-spacing: 3px;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.fullscreen-buttons {
  display: flex;
  gap: 8px;
}

.fullscreen-btn {
  height: 34px;
  padding: 0 14px;

  border: 1px solid #007ebd;
  border-radius: 20px;

  background: linear-gradient(145deg, #0c2945, #06182b);
  color: #8ec4e2;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: bold;
  letter-spacing: 1px;
  white-space: nowrap;
  cursor: pointer;

  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.fullscreen-btn:hover {
  border-color: #00cfff;
  color: #cfeaff;
  box-shadow: 0 0 10px rgba(0, 207, 255, 0.25);
}

/* En pantalla completa se resalta el botón de "salir"; fuera de
   ella, el de "entrar" — para que siempre se vea cuál toca. */
#diana-interface:not(:fullscreen) #fullscreen-off,
#diana-interface:fullscreen #fullscreen-on {
  opacity: 0.4;
}

@media (max-width: 900px) {
  .fullscreen-buttons {
    display: none;
  }
}

.system-status {
  height: 34px;
  padding: 0 18px;

  border: 1px solid #00bce8;
  border-radius: 20px;

  display: flex;
  align-items: center;
  gap: 9px;

  color: #9ddcff;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 2px;

  box-shadow: 0 0 12px rgba(0, 220, 255, 0.16);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00f2c6;
  box-shadow: 0 0 8px #00f2c6, 0 0 16px rgba(0, 242, 198, 0.55);
  animation: statusPulse 2.4s infinite ease-in-out;
}

.header-message {
  padding-left: 18px;
  border-left: 1px solid rgba(0, 164, 220, 0.4);
  color: #688da9;
  font-size: 9px;
  line-height: 1.35;
  letter-spacing: 1.7px;
}

/* =========================================================
   ZONA PRINCIPAL
   ========================================================= */

.main-grid {
  width: 100%;
  min-height: 560px;
  margin-top: 8px;

  display: grid;
  grid-template-columns: 175px minmax(0, 1fr) 175px;
  gap: 8px;

  position: relative;
}

/* =========================================================
   PANELES EXTERIORES
   ========================================================= */

.side-panel {
  height: 100%;
  border: 1px solid #0085c8;
  border-radius: 13px;

  background:
    linear-gradient(
      180deg,
      rgba(5, 27, 50, 0.98),
      rgba(2, 14, 28, 0.98)
    );

  box-shadow:
    inset 0 0 22px rgba(0, 110, 190, 0.08),
    0 0 12px rgba(0, 90, 150, 0.05);

  position: relative;
  z-index: 12;
  overflow: hidden;
}

.left-panel {
  padding: 15px 12px;
}

.right-panel {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* PANEL IZQUIERDO */

.panel-title {
  color: #e9bb4c;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 14px;
}

.capability {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  color: #c9e1f2;
  font-size: 13px;
}

.capability span {
  color: #00d7ff;
  font-size: 10px;
  text-shadow: 0 0 7px #00d7ff;
}

.panel-divider {
  width: 100%;
  height: 1px;
  margin: 16px 0;
  background: linear-gradient(90deg, transparent, rgba(0, 156, 220, 0.5), transparent);
}

.system-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: #8fa9c0;
  font-size: 12px;
}

.system-item strong {
  color: #00e8c4;
  font-size: 12px;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0, 255, 215, 0.45);
}

.quote {
  margin-top: 24px;
  padding: 12px;
  border-left: 2px solid #dcae42;
  background: rgba(0, 70, 115, 0.12);
  color: #9cbad0;
  font-size: 11px;
  line-height: 1.55;
}

.panel-signature {
  margin-top: 14px;
  text-align: right;
  color: #6d93ab;
  font-size: 10px;
  letter-spacing: 2px;
}

/* =========================================================
   CENTRO — PROTAGONISTA
   Composición compacta: Diana + anillos + módulos escalan
   juntos como una sola unidad, y los módulos siempre quedan
   pegados al borde de la órbita exterior (nunca al borde del
   panel), sin importar el ancho de la pantalla.
   ========================================================= */

.diana-core {
  height: 100%;
  min-width: 0;
  position: relative;

  border: 1px solid #007dbd;
  border-radius: 13px;
  overflow: hidden;

  background:
    radial-gradient(
      circle at 50% 48%,
      rgba(14, 81, 137, 0.32),
      rgba(2, 16, 31, 0.18) 38%,
      rgba(1, 9, 20, 0.7) 75%
    );

  box-shadow: inset 0 0 70px rgba(0, 100, 180, 0.1);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 5;

  /* --- Unidad de escala fluida: todo el conjunto crece o
     encoge junto, en función del espacio real disponible --- */
  --avatar: clamp(320px, 30vw, 620px);
  --halo: calc(var(--avatar) * 1.18);
  --orbit-outer: calc(var(--avatar) * 1.14);
  --orbit-middle: calc(var(--avatar) * 1.05);
  --orbit-inner: calc(var(--avatar) * 0.95);
  --module-w: clamp(175px, 14.5vw, 240px);
  --module-gap: clamp(8px, 1vw, 18px);
}

/* grid sutil de fondo */
.diana-core::before {
  content: "";
  position: absolute;
  inset: 0;

  background-image:
    linear-gradient(rgba(0, 160, 230, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 160, 230, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;

  pointer-events: none;
}

/* HALO */
.diana-halo {
  position: absolute;
  width: var(--halo);
  height: var(--halo);
  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      rgba(0, 119, 220, 0.22) 0%,
      rgba(0, 91, 175, 0.12) 35%,
      transparent 68%
    );

  filter: blur(5px);
  z-index: 1;
}

/* DIANA — la imagen permanece limpia, sin texto encima */
.diana-avatar {
  position: absolute;
  width: var(--avatar);
  height: var(--avatar);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;

  animation: dianaBreathing 7s ease-in-out infinite;
}

.diana-avatar img,
.diana-avatar video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;

  filter:
    drop-shadow(0 0 16px rgba(0, 132, 255, 0.34))
    drop-shadow(0 0 30px rgba(0, 132, 255, 0.13));
}

/* La imagen fija y el video de "hablando" ocupan el mismo lugar,
   superpuestos, y se cruzan con una transición suave (crossfade). */
.diana-avatar-still,
.diana-avatar-video {
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.4s ease;
}

.diana-avatar-still {
  opacity: 1;
}

.diana-avatar-video {
  opacity: 0;
}

/* Estado "hablando": lo activa app.js mientras DIANA reproduce voz */
.diana-avatar.is-talking .diana-avatar-still {
  opacity: 0;
}

.diana-avatar.is-talking .diana-avatar-video {
  opacity: 1;
}

/* ÓRBITAS */
.orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
}

.orbit-outer {
  width: var(--orbit-outer);
  height: var(--orbit-outer);
  border: 2px solid rgba(0, 178, 255, 0.72);

  box-shadow:
    0 0 12px rgba(0, 168, 255, 0.28),
    inset 0 0 10px rgba(0, 168, 255, 0.08);

  animation: orbitClockwise 18s linear infinite;
}

.orbit-middle {
  width: var(--orbit-middle);
  height: var(--orbit-middle);
  border: 2px dashed rgba(224, 175, 61, 0.65);
  animation: orbitCounter 24s linear infinite;
}

.orbit-inner {
  width: var(--orbit-inner);
  height: var(--orbit-inner);
  border: 2px solid rgba(0, 211, 255, 0.78);
  box-shadow: 0 0 15px rgba(0, 183, 255, 0.18);
  animation: orbitClockwiseSlow 30s linear infinite;
}

/* =========================================================
   MAPA MUNDI DE FONDO — detrás de TODO el panel central
   (Diana, anillos, módulos), abstracto/estilizado, como el
   "network map" típico de los HUD futuristas.
   ========================================================= */

.world-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
overflow: hidden;

  /* MAPA HD REAL */
  background-image: url("world-map-diana.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;

  opacity: 0.72;
  filter: saturate(1.15) contrast(1.05);
}

.wb-land {
  position: absolute;
  background: rgba(0, 160, 230, 0.16);
  filter: blur(0.3px);
  -webkit-mask-image: radial-gradient(
    circle,
    rgba(0,0,0,0.9) 0%,
    rgba(0,0,0,0.9) 55%,
    transparent 100%
  );
}

/* "continentes" estilizados (formas libres, no cartografía
   exacta — es un motivo decorativo, no un mapa informativo) */
.wb-land-1 { width: 20%; height: 26%; left: 6%;  top: 14%; border-radius: 38% 62% 55% 45% / 45% 40% 60% 55%; }
.wb-land-2 { width: 16%; height: 20%; left: 30%; top: 10%; border-radius: 55% 45% 40% 60% / 50% 55% 45% 50%; }
.wb-land-3 { width: 24%; height: 30%; left: 52%; top: 18%; border-radius: 45% 55% 60% 40% / 55% 45% 50% 50%; }
.wb-land-4 { width: 18%; height: 22%; left: 12%; top: 56%; border-radius: 60% 40% 45% 55% / 40% 60% 45% 55%; }
.wb-land-5 { width: 22%; height: 24%; left: 62%; top: 58%; border-radius: 50% 50% 40% 60% / 55% 45% 55% 45%; }

/* rejilla de latitud/longitud, muy tenue, sobre todo el fondo */
.world-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(0,190,255,0.06) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(90deg, rgba(0,190,255,0.06) 0 1px, transparent 1px 48px);
}

.wb-pin {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e5b443;
  box-shadow: 0 0 6px #e5b443, 0 0 14px rgba(229, 180, 67, 0.6);
  animation: statusPulse 2.8s ease-in-out infinite;
}

.wb-pin-1 { left: 14%; top: 24%; }
.wb-pin-2 { left: 40%; top: 16%; animation-delay: 0.5s; }
.wb-pin-3 { left: 68%; top: 30%; animation-delay: 1s; }
.wb-pin-4 { left: 24%; top: 66%; animation-delay: 1.5s; }

/* =========================================================
   CORRIENTES DE DATOS — pulsos que recorren el mapa
   ========================================================= */
.energy-line {
  position: absolute;
  height: 2px;
  width: 34%;
  border-radius: 999px;
  transform-origin: left center;
  pointer-events: none;
  opacity: 0.9;
  background: linear-gradient(
    90deg,
    rgba(0, 215, 255, 0.06) 0%,
    rgba(0, 215, 255, 0.12) 35%,
    rgba(0, 215, 255, 0.95) 47%,
    rgba(255, 205, 80, 0.95) 51%,
    rgba(0, 215, 255, 0.08) 68%,
    transparent 100%
  );
  background-size: 220% 100%;
  box-shadow: 0 0 7px rgba(0, 215, 255, 0.55);
  animation: energyFlow 2.8s linear infinite;
}

.energy-line::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #ffffff;
  box-shadow: 0 0 5px #ffffff, 0 0 12px #00d7ff, 0 0 20px rgba(0, 215, 255, 0.7);
}

.energy-1 { left: 3%; top: 25%; transform: rotate(-17deg); animation-delay: -0.4s; }
.energy-2 { left: 18%; top: 72%; width: 31%; transform: rotate(18deg); animation-delay: -1.3s; }
.energy-3 { left: 40%; top: 15%; width: 29%; transform: rotate(12deg); animation-delay: -2.1s; }
.energy-4 { left: 58%; top: 31%; width: 38%; transform: rotate(-15deg); animation-delay: -0.8s; }
.energy-5 { left: 53%; top: 72%; width: 30%; transform: rotate(13deg); animation-delay: -1.7s; }
.energy-6 { left: 73%; top: 60%; width: 25%; transform: rotate(-28deg); animation-delay: -2.5s; }

@keyframes energyFlow {
  0% { background-position: 120% 0; opacity: 0.38; }
  45% { opacity: 0.95; }
  100% { background-position: -120% 0; opacity: 0.38; }
}

/* =========================================================
   RADAR — anillos de distancia, cruz de referencia y un
   barrido luminoso que gira sin parar, como un radar real.
   ========================================================= */

.hud-radar {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--halo);
  height: var(--halo);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.radar-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  border: 1px solid rgba(0, 223, 255, 0.22);
  transform: translate(-50%, -50%);
}

.radar-ring-1 { width: 34%; height: 34%; }
.radar-ring-2 { width: 62%; height: 62%; }
.radar-ring-3 { width: 90%; height: 90%; }

.radar-cross {
  position: absolute;
  background: rgba(0, 223, 255, 0.14);
}

.radar-cross-h { left: 4%; right: 4%; top: 50%; height: 1px; transform: translateY(-50%); }
.radar-cross-v { top: 4%; bottom: 4%; left: 50%; width: 1px; transform: translateX(-50%); }

.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;

  background: conic-gradient(
    from 0deg,
    rgba(0, 223, 255, 0) 0deg,
    rgba(0, 223, 255, 0.5) 10deg,
    rgba(0, 223, 255, 0.14) 26deg,
    rgba(0, 223, 255, 0) 50deg
  );

  mix-blend-mode: screen;
  animation: orbitClockwise 4s linear infinite;
}

/* =========================================================
   ANILLOS SEGMENTADOS ESTILO HUD (tipo Iron Man) — cada uno
   gira a velocidad y dirección propia, independiente de los
   anillos principales, para que la composición se sienta
   siempre viva, nunca estática.
   ========================================================= */

.hud-rings {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  z-index: 7;
  pointer-events: none;
}

.hud-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.hud-ring-a {
  width: calc(var(--orbit-outer) + 34px);
  height: calc(var(--orbit-outer) + 34px);

  background: repeating-conic-gradient(
    rgba(0, 223, 255, 0.9) 0deg 5deg,
    transparent 5deg 16deg
  );

  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));

  filter: drop-shadow(0 0 5px rgba(0, 223, 255, 0.55));
  opacity: 0.6;

  animation: orbitClockwise 9s linear infinite;
}

.hud-ring-b {
  width: calc(var(--orbit-middle) - 8px);
  height: calc(var(--orbit-middle) - 8px);

  background: repeating-conic-gradient(
    rgba(229, 180, 67, 0.9) 0deg 4deg,
    transparent 4deg 13deg
  );

  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));

  filter: drop-shadow(0 0 5px rgba(229, 180, 67, 0.45));
  opacity: 0.55;

  animation: orbitCounter 13s linear infinite;
}

.hud-ring-c {
  width: calc(var(--orbit-inner) - 22px);
  height: calc(var(--orbit-inner) - 22px);

  background: repeating-conic-gradient(
    rgba(0, 223, 255, 0.85) 0deg 3deg,
    transparent 3deg 9deg
  );

  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));

  opacity: 0.45;

  animation: orbitClockwise 6s linear infinite;
}

/* LUCES QUE VIAJAN POR LOS ANILLOS — vinculadas a su órbita,
   nunca sueltas por la pantalla */
.orbit-light {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #00dfff;

  box-shadow: 0 0 7px #00dfff, 0 0 18px rgba(0, 220, 255, 0.75);

  left: 50%;
  top: -6px;
  transform: translateX(-50%);
}

.light-b {
  top: auto;
  bottom: -6px;
  background: #e5b443;
  box-shadow: 0 0 7px #e5b443, 0 0 18px rgba(229, 180, 67, 0.7);
}

.light-c {
  top: 50%;
  left: -6px;
  transform: translateY(-50%);
  background: #e5b443;
  box-shadow: 0 0 7px #e5b443, 0 0 18px rgba(229, 180, 67, 0.7);
}

.light-d {
  top: auto;
  left: auto;
  right: -6px;
  bottom: 18%;
  background: #00dfff;
}

.light-e {
  top: 50%;
  left: auto;
  right: -6px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
}

/* =========================================================
   MAPA MUNDI HUD — a un lado de Diana, en el espacio libre
   entre los módulos y el borde del panel central
   ========================================================= */

.hud-globe,
.hud-atom {
  position: absolute;
  top: 50%;
  width: clamp(76px, 6.4vw, 106px);
  height: clamp(76px, 6.4vw, 106px);
  transform: translateY(-50%);
  z-index: 9;
  perspective: 400px;
}

.hud-globe { left: 16px; }
.hud-atom { right: 16px; }

.globe-sphere {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 1px solid rgba(0, 215, 255, 0.55);

  background: radial-gradient(
    circle at 35% 30%,
    rgba(0, 180, 255, 0.22),
    rgba(0, 60, 110, 0.06) 60%,
    transparent 75%
  );

  box-shadow:
    0 0 14px rgba(0, 190, 255, 0.2),
    inset 0 0 18px rgba(0, 150, 220, 0.18);
}

.globe-lat {
  position: absolute;
  left: 6%;
  right: 6%;
  border: 1px solid rgba(0, 215, 255, 0.32);
  border-radius: 50%;
}

.globe-lat-1 { top: 30%; height: 40%; }
.globe-lat-2 { top: 12%; height: 76%; }

.globe-spin {
  position: absolute;
  inset: 6%;
  animation: orbitClockwise 14s linear infinite;
}

.globe-merid {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(229, 180, 67, 0.4);
  border-radius: 50%;
}

.globe-merid-1 { transform: scaleX(0.15); }
.globe-merid-2 { transform: scaleX(0.55) rotate(20deg); }
.globe-merid-3 { transform: scaleX(0.85) rotate(-15deg); }

.globe-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #00e8ff;
  box-shadow: 0 0 6px #00e8ff, 0 0 12px rgba(0, 232, 255, 0.7);
  animation: statusPulse 2.6s ease-in-out infinite;
}

.dot-1 { top: 28%; left: 32%; }
.dot-2 { top: 62%; left: 68%; animation-delay: 0.6s; }
.dot-3 { top: 45%; left: 50%; animation-delay: 1.2s; }

/* =========================================================
   ÁTOMO GIRANDO — lado opuesto al mapa
   ========================================================= */

.atom-nucleus {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #e5b443;
  box-shadow: 0 0 8px #e5b443, 0 0 16px rgba(229, 180, 67, 0.65);
  animation: modulePulse 2.4s ease-in-out infinite;
  z-index: 2;
}

.atom-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92%;
  height: 38%;
  border: 1px solid rgba(0, 215, 255, 0.6);
  border-radius: 50%;

  /* translate centra el anillo; rotate fija su inclinación
     (0°, 60°, 120° — el clásico símbolo de átomo) */
  transform: translate(-50%, -50%) rotate(0deg);
}

.atom-ring-2 { transform: translate(-50%, -50%) rotate(60deg); }
.atom-ring-3 { transform: translate(-50%, -50%) rotate(120deg); }

/* El electrón gira DENTRO del sistema de coordenadas ya
   inclinado del anillo (hereda su rotate), así que recorre el
   borde elíptico en vez de solo girar sobre sí mismo. */
.atom-electron {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: atomOrbit 3.4s linear infinite;
}

.atom-electron::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 50%;
  background: #00e8ff;
  box-shadow: 0 0 6px #00e8ff, 0 0 12px rgba(0, 232, 255, 0.75);
}

.atom-ring-2 .atom-electron { animation-duration: 4.3s; animation-direction: reverse; }
.atom-ring-3 .atom-electron { animation-duration: 5.1s; }

.globe-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  color: #6d93ab;
  font-size: 7.5px;
  letter-spacing: 1.6px;
}

/* =========================================================
   RADAR INDEPENDIENTE — disco propio, junto al panel de Diana
   (no mezclado con su foto), estilo disco de radar clásico
   ========================================================= */

.radar-disc {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  z-index: 11;
  width: clamp(64px, 5.4vw, 88px);
  text-align: center;
}

.radar-disc-face {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;

  background: radial-gradient(circle, rgba(0, 40, 60, 0.9), rgba(1, 10, 20, 0.96) 75%);
  border: 1px solid rgba(0, 223, 255, 0.6);
  box-shadow: 0 0 14px rgba(0, 200, 255, 0.25), inset 0 0 12px rgba(0, 150, 200, 0.3);
}

.rd-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  border: 1px solid rgba(0, 223, 255, 0.4);
  transform: translate(-50%, -50%);
}

.rd-ring-1 { width: 34%; height: 34%; }
.rd-ring-2 { width: 64%; height: 64%; }
.rd-ring-3 { width: 92%; height: 92%; }

.rd-cross { position: absolute; background: rgba(0, 223, 255, 0.3); }
.rd-cross-h { left: 3%; right: 3%; top: 50%; height: 1px; transform: translateY(-50%); }
.rd-cross-v { top: 3%; bottom: 3%; left: 50%; width: 1px; transform: translateX(-50%); }

.rd-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;

  background: conic-gradient(
    from 0deg,
    rgba(0, 223, 255, 0) 0deg,
    rgba(0, 223, 255, 0.9) 8deg,
    rgba(0, 223, 255, 0.25) 24deg,
    rgba(0, 223, 255, 0) 46deg
  );

  animation: orbitClockwise 2.6s linear infinite;
}

.rd-blip {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #00e8ff;
  box-shadow: 0 0 5px #00e8ff;
  animation: statusPulse 2.2s ease-in-out infinite;
}

.rd-blip-1 { top: 30%; left: 62%; }
.rd-blip-2 { top: 64%; left: 38%; animation-delay: 0.7s; }

/* =========================================================
   MÓDULOS JUNTO A DIANA
   Pegados siempre al borde de la órbita exterior, no al
   borde del contenedor: la composición queda compacta sin
   importar cuán ancha sea la pantalla.
   ========================================================= */

.core-modules {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--module-w);
  z-index: 10;

  display: flex;
  flex-direction: column;
  gap: 9px;
}

.core-left {
  left: calc(50% - (var(--orbit-outer) / 2) - var(--module-gap) - var(--module-w));
}

.core-right {
  right: calc(50% - (var(--orbit-outer) / 2) - var(--module-gap) - var(--module-w));
}

.core-module {
  min-height: 82px;
  padding: 12px 14px;

  border: 1px solid #008bd0;
  border-radius: 10px;

  background:
    linear-gradient(
      135deg,
      rgba(5, 37, 65, 0.96),
      rgba(2, 19, 36, 0.94)
    );

  display: flex;
  align-items: center;
  gap: 8px;

  box-shadow: 0 0 8px rgba(0, 145, 220, 0.07);
  position: relative;
}

.core-module::after {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  width: 64%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 194, 69, 0.8), transparent);
}

.module-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;

  border: 1px solid #d6a83c;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #e4b544;
  font-size: 17px;
  text-shadow: 0 0 8px rgba(255, 194, 69, 0.5);

  animation: modulePulse 3.6s ease-in-out infinite;
}

.core-left .core-module:nth-child(2) .module-icon,
.core-right .core-module:nth-child(2) .module-icon { animation-delay: 0.4s; }
.core-left .core-module:nth-child(3) .module-icon,
.core-right .core-module:nth-child(3) .module-icon { animation-delay: 0.8s; }
.core-left .core-module:nth-child(4) .module-icon,
.core-right .core-module:nth-child(4) .module-icon { animation-delay: 1.2s; }

.module-text {
  min-width: 0;
}

.module-text strong {
  display: block;
  color: #cfe6f5;
  font-size: 14.5px;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.module-text small {
  display: block;
  margin-top: 4px;
  color: #7fa4bf;
  font-size: 11px;
  letter-spacing: 0.3px;
}

.level-bars {
  display: flex;
  gap: 4px;
  margin-top: 9px;
}

.level-bars i {
  display: block;
  width: 10px;
  height: 7px;
  background: #00cbe9;
  box-shadow: 0 0 4px rgba(0, 204, 235, 0.4);
}

/* =========================================================
   MENÚ DERECHO
   ========================================================= */

.menu-button {
  width: 100%;
  min-height: 64px;

  border: 1px solid #007fc2;
  border-radius: 10px;

  background:
    linear-gradient(
      90deg,
      rgba(5, 34, 60, 0.97),
      rgba(2, 20, 38, 0.97)
    );

  color: #d8e9f6;

  display: grid;
  grid-template-columns: 30px 1fr 12px;
  align-items: center;
  gap: 7px;

  padding: 6px 8px;
  text-align: left;
  cursor: pointer;

  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.menu-button:hover {
  transform: translateX(-2px);
  border-color: #00cfff;

  background:
    linear-gradient(
      90deg,
      rgba(7, 50, 82, 0.98),
      rgba(3, 28, 49, 0.98)
    );
}

.menu-icon {
  width: 34px;
  height: 34px;
  border: 1px solid #d8aa3e;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #e4b542;
  font-size: 15px;
}

.menu-text {
  min-width: 0;
}

.menu-text strong {
  display: block;
  color: #d8ecfa;
  font-size: 12.5px;
  letter-spacing: 0.8px;
}

.menu-text small {
  display: block;
  margin-top: 3px;
  color: #7ea0b8;
  font-size: 9.5px;
  line-height: 1.25;
}

.menu-button b {
  color: #00cfff;
  font-size: 20px;
  font-weight: normal;
}

/* =========================================================
   CHAT
   ========================================================= */

.chat-zone {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;

  border: 1px solid #007ebd;
  border-radius: 13px;

  background:
    linear-gradient(
      180deg,
      rgba(3, 25, 44, 0.97),
      rgba(2, 15, 28, 0.98)
    );

  position: relative;
  z-index: 15;
}

.messages {
  width: 100%;
  min-height: 65px;
  max-height: 220px;
  overflow-y: auto;

  padding: 8px 10px;

  border: 1px solid rgba(0, 132, 197, 0.65);
  border-radius: 9px;

  background: rgba(1, 18, 33, 0.85);
}

.message {
  max-width: 90%;
  padding: 10px 13px;
  border-radius: 7px;
  color: #d3e6f4;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.message.diana {
  background: rgba(0, 91, 145, 0.12);
  border-left: 2px solid #00bde8;
}

.message.user {
  background: rgba(0, 40, 70, 0.35);
  margin-left: auto;
  border-right: 2px solid #d4a73d;
}

/* Elementos generados por el renderizado de Markdown dentro de
   los mensajes de DIANA (ver app.js: renderMarkdown/escapeHtml).
   Esto NO se modifica en su lógica, solo se conserva su estilo
   dentro de la nueva paleta visual. */
.message.diana h1,
.message.diana h2,
.message.diana h3,
.message.diana h4,
.message.diana h5,
.message.diana h6 {
  margin: 12px 0 6px;
  line-height: 1.3;
  color: #eaf6ff;
}
.message.diana h1:first-child,
.message.diana h2:first-child,
.message.diana h3:first-child {
  margin-top: 0;
}
.message.diana h1 { font-size: 21px; }
.message.diana h2 { font-size: 19px; }
.message.diana h3 { font-size: 17px; }
.message.diana h4,
.message.diana h5,
.message.diana h6 { font-size: 16px; }
.message.diana p { margin: 0 0 8px; }
.message.diana p:last-child { margin-bottom: 0; }
.message.diana strong { color: #ffd88a; font-weight: bold; }
.message.diana em { font-style: italic; }
.message.diana ul,
.message.diana ol { margin: 0 0 8px; padding-left: 20px; }
.message.diana li { margin-bottom: 3px; }
.message.diana hr {
  border: none;
  border-top: 1px solid rgba(0, 156, 220, 0.4);
  margin: 12px 0;
}
.message.diana code {
  background: rgba(0, 80, 130, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  color: #9ddcff;
}
.message.diana table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 13.5px;
}
.message.diana th,
.message.diana td {
  border: 1px solid rgba(0, 156, 220, 0.4);
  padding: 5px 7px;
  text-align: left;
  vertical-align: top;
}
.message.diana th {
  background: rgba(0, 80, 130, 0.35);
  color: #e9bb4c;
  font-weight: bold;
}

.composer {
  width: 100%;
  display: flex;
  gap: 9px;
  margin-top: 8px;
}

.composer textarea {
  flex: 1;
  min-height: 52px;
  resize: vertical;

  padding: 13px;

  border: 1px solid #007ebd;
  border-radius: 9px;

  background: #021323;
  color: #d9edf9;

  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.composer textarea:focus {
  border-color: #00cfff;
  box-shadow: 0 0 8px rgba(0, 201, 255, 0.13);
}

.composer textarea::placeholder {
  color: #54738b;
}

.voice-toggle {
  width: 55px;
  flex: 0 0 55px;

  border: 1px solid #007ebd;
  border-radius: 9px;

  background: linear-gradient(145deg, #0c2945, #06182b);
  color: #6d93ab;
  font-size: 20px;
  cursor: pointer;

  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.voice-toggle:hover {
  border-color: #00cfff;
  color: #8ec4e2;
}

.voice-toggle.is-active {
  border-color: #00e8c4;
  color: #00e8c4;
  box-shadow: 0 0 10px rgba(0, 232, 196, 0.35);
}

.mic-toggle {
  width: 55px;
  flex: 0 0 55px;

  border: 1px solid #007ebd;
  border-radius: 9px;

  background: linear-gradient(145deg, #0c2945, #06182b);
  color: #6d93ab;
  font-size: 20px;
  cursor: pointer;

  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.mic-toggle:hover {
  border-color: #00cfff;
  color: #8ec4e2;
}

.mic-toggle.is-listening {
  border-color: #ff5470;
  color: #ff5470;
  box-shadow: 0 0 12px rgba(255, 84, 112, 0.45);
  animation: micPulse 1.1s ease-in-out infinite;
}

.mic-toggle:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 84, 112, 0.35); }
  50% { box-shadow: 0 0 18px rgba(255, 84, 112, 0.65); }
}

/* Los controles de voz/micrófono ahora viven en el panel derecho.
   Conservan la apariencia de botón HUD del menú, no la caja pequeña
   que usaban cuando estaban dentro del compositor inferior. */
.right-panel #mic-toggle,
.right-panel #voice-toggle {
  width: 100%;
  flex: 0 0 auto;
  min-height: 64px;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: inherit;
}

.right-panel #mic-toggle .menu-icon,
.right-panel #voice-toggle .menu-icon {
  font-size: 15px;
}

.right-panel #mic-toggle.is-listening {
  border-color: #ff5470;
  color: #d8e9f6;
  box-shadow: 0 0 12px rgba(255, 84, 112, 0.35);
}

.right-panel #voice-toggle.is-active {
  border-color: #00e8c4;
  color: #d8e9f6;
  box-shadow: 0 0 12px rgba(0, 232, 196, 0.28);
}

.voice-select {
  flex: 0 0 168px;
  max-width: 168px;

  border: 1px solid #007ebd;
  border-radius: 9px;

  background: linear-gradient(145deg, #0c2945, #06182b);
  color: #8ec4e2;
  font-size: 13px;
  padding: 0 8px;
  cursor: pointer;

  transition: border-color 0.2s ease, color 0.2s ease;
}

.voice-select:hover,
.voice-select:focus {
  border-color: #00cfff;
  color: #cfeaff;
  outline: none;
}

.voice-select option {
  background: #06182b;
  color: #cfeaff;
}

@media (max-width: 720px) {
  .voice-select {
    flex: 0 0 42%;
    max-width: none;
  }
}

.send-button {
  width: 55px;

  border: 1px solid #d4a73d;
  border-radius: 9px;

  background: linear-gradient(145deg, #0c2945, #06182b);
  color: #e5b43f;
  font-size: 23px;
  cursor: pointer;

  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.send-button:hover {
  transform: scale(1.04);
  box-shadow: 0 0 12px rgba(224, 175, 61, 0.2);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
}

.quick-actions button {
  padding: 7px 14px;

  border: 1px solid #007ebd;
  border-radius: 12px;

  background: rgba(0, 70, 110, 0.16);
  color: #8ec4e2;
  font-size: 12px;
  cursor: pointer;
}

.quick-actions button:hover {
  border-color: #00cfff;
  color: #b7e7fa;
}

/* =========================================================
   PIE
   ========================================================= */

.system-footer {
  height: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  color: #42647c;
  font-size: 7px;
  letter-spacing: 2px;
}

.system-footer span:last-child {
  color: #00cfae;
}

/* =========================================================
   ANIMACIONES — elegantes, vinculadas a sus órbitas
   ========================================================= */

@keyframes orbitClockwise {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes orbitCounter {
  from { transform: translate(-50%, -50%) rotate(360deg); }
  to { transform: translate(-50%, -50%) rotate(0deg); }
}

@keyframes orbitClockwiseSlow {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Respiración + un leve balanceo de cabeza. Es una foto fija,
   no un video, así que el movimiento se mantiene mínimo para
   que se vea natural y no deforme la imagen. */
@keyframes dianaBreathing {
  0%   { transform: translate(-50%, -50%) scale(1)     rotate(0deg); }
  28%  { transform: translate(-50%, -50%) scale(1.008) rotate(0.35deg); }
  52%  { transform: translate(-50%, -50%) scale(1.012) rotate(0deg); }
  76%  { transform: translate(-50%, -50%) scale(1.006) rotate(-0.3deg); }
  100% { transform: translate(-50%, -50%) scale(1)     rotate(0deg); }
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes modulePulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255, 194, 69, 0);
  }
  50% {
    box-shadow: 0 0 9px rgba(255, 194, 69, 0.55);
  }
}

@keyframes atomOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes headerScan {
  0% { left: -20%; }
  100% { left: 100%; }
}

@keyframes spinLetterA {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

@keyframes logoFramePulse {
  0%, 100% {
    border-color: rgba(0, 215, 255, 0.55);
    box-shadow: 0 0 6px rgba(0, 215, 255, 0.18);
  }
  50% {
    border-color: rgba(0, 215, 255, 0.95);
    box-shadow: 0 0 14px rgba(0, 215, 255, 0.45);
  }
}

/* =========================================================
   PANTALLAS GRANDES — Diana aprovecha mucho más el espacio,
   pero sin perder la composición compacta (todo escala junto)
   ========================================================= */

@media (min-width: 1500px) {
  .main-grid {
    min-height: 640px;
    grid-template-columns: 195px minmax(0, 1fr) 195px;
  }
}

/* =========================================================
   PORTÁTILES
   ========================================================= */

@media (max-width: 1100px) {
  .main-grid {
    grid-template-columns: 145px minmax(0, 1fr) 145px;
    min-height: 480px;
  }

  .module-text strong { font-size: 6px; }
  .module-text small { font-size: 5px; }

  .hud-globe,
  .hud-atom,
  .radar-disc {
    display: none;
  }
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
    min-height: auto;
    display: flex;
    flex-direction: column;
  }

  .left-panel,
  .right-panel {
    width: 100%;
    height: auto;
  }

  .right-panel {
    order: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .left-panel {
    order: 2;
  }

  .diana-core {
    order: 1;
    height: 62vw;
    min-height: 380px;
    max-height: 560px;
  }

  .diana-core {
    --avatar: clamp(280px, 46vw, 460px);
  }

  .chat-zone {
    order: 4;
  }
}

/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 750px) {
  .diana-interface {
    padding: 4px;
  }

  .system-header {
    min-height: 74px;
    padding: 8px 10px;
  }

  .header-logo {
    height: clamp(46px, 12vw, 58px);
  }

  .header-message {
    display: none;
  }

  .brand-subtitle {
    display: none;
  }

  .diana-core {
    --avatar: clamp(240px, 58vw, 360px);
    --module-w: 0px;
    height: 78vw;
    min-height: 320px;
    max-height: 440px;
  }

  .core-modules {
    display: none;
  }

  .core-caption {
    bottom: 8px;
  }

  .left-panel {
    display: none;
  }
}

/* =========================================================
   PANTALLA COMPLETA REAL — DIANA ocupa todo el viewport
   ========================================================= */
#diana-interface:fullscreen,
#diana-interface:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

#diana-interface:fullscreen .main-grid,
#diana-interface:-webkit-full-screen .main-grid {
  min-height: 0;
  height: calc(100vh - 88px - 25px - 24px);
}

#diana-interface:fullscreen .diana-core,
#diana-interface:-webkit-full-screen .diana-core {
  min-height: 0;
}

#diana-interface:fullscreen .chat-zone,
#diana-interface:-webkit-full-screen .chat-zone {
  max-height: 260px;
}

@media (min-width: 901px) {
  #diana-interface:fullscreen .diana-core,
  #diana-interface:-webkit-full-screen .diana-core {
    --avatar: clamp(360px, min(38vw, 68vh), 760px);
    --halo: calc(var(--avatar) * 1.18);
    --orbit-outer: calc(var(--avatar) * 1.14);
    --orbit-middle: calc(var(--avatar) * 1.05);
    --orbit-inner: calc(var(--avatar) * 0.95);
    --module-w: clamp(175px, 15vw, 260px);
  }
}

@media (max-width: 900px) {
  #diana-interface:fullscreen,
  #diana-interface:-webkit-full-screen {
    padding: 4px;
    overflow: auto;
  }

  #diana-interface:fullscreen .main-grid,
  #diana-interface:-webkit-full-screen .main-grid {
    height: auto;
    min-height: 0;
  }
}

/* =========================================================
   DIANA v0.2 — memoria, pendientes, ventana emergente
   ========================================================= */

.messages { max-height: 46vh; }
.message.diana { position: relative; }
.message.diana a { color: #6fd8ff; text-decoration: underline; word-break: break-all; }
.message.is-pending { opacity: 0.75; font-style: italic; }

.diana-nota {
  margin-top: 8px;
  font-size: 11.5px;
  color: #7ea0b8;
  font-style: normal;
}

.diana-copiar {
  margin-top: 8px;
  padding: 3px 10px;
  font-size: 11px;
  color: #d8ecfa;
  background: transparent;
  border: 1px solid #007fc2;
  border-radius: 6px;
  cursor: pointer;
}
.diana-copiar:hover { border-color: #00cfff; }

.diana-proyecto {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 127, 194, 0.55);
  border-radius: 8px;
  background: rgba(1, 18, 33, 0.6);
  font-style: normal;
}
.diana-proyecto-titulo { font-weight: bold; color: #ffd88a; flex: 1 1 220px; }
.diana-proyecto-acciones { display: flex; flex-wrap: wrap; gap: 6px; }
.diana-proyecto-acciones button,
.diana-dato button,
.diana-form-linea button {
  padding: 4px 10px;
  font-size: 12px;
  color: #d8ecfa;
  background: rgba(5, 34, 60, 0.97);
  border: 1px solid #007fc2;
  border-radius: 6px;
  cursor: pointer;
}
.diana-proyecto-acciones button:hover,
.diana-dato button:hover,
.diana-form-linea button:hover { border-color: #00cfff; }
.diana-proyecto-detalle { flex-basis: 100%; font-size: 12px; color: #7ea0b8; }

.diana-estado {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid currentColor;
}
.estado-en_curso { color: #00cfff; }
.estado-por_confirmar { color: #e4b542; }
.estado-en_espera { color: #b49cff; }
.estado-presentado, .estado-terminado { color: #5fd38d; }
.estado-archivado { color: #7ea0b8; }

.diana-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 6, 14, 0.78);
}
.diana-modal[hidden] { display: none; }
.diana-modal-caja {
  width: min(760px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border: 1px solid #007ebd;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(3, 25, 44, 0.99), rgba(2, 15, 28, 0.99));
  color: #d3e6f4;
  box-shadow: 0 0 40px rgba(0, 180, 255, 0.18);
}
.diana-modal-cabecera {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(0, 127, 194, 0.5);
}
.diana-modal-cabecera h2 { margin: 0; font-size: 17px; letter-spacing: 1px; color: #e4b542; }
.diana-modal-cerrar {
  background: transparent;
  border: 1px solid #007fc2;
  border-radius: 6px;
  color: #d8ecfa;
  width: 32px;
  height: 32px;
  cursor: pointer;
}
.diana-modal-cuerpo { padding: 6px 18px 18px; overflow-y: auto; font-size: 14px; line-height: 1.5; }
.diana-modal-cuerpo h3 { margin: 18px 0 6px; font-size: 14px; color: #00cfff; letter-spacing: 0.8px; }
.diana-vacio { color: #7ea0b8; font-size: 13px; }

.diana-dato {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 127, 194, 0.25);
}
.diana-dato-cat {
  font-size: 10.5px;
  text-transform: uppercase;
  color: #e4b542;
  min-width: 78px;
}
.diana-dato-texto { flex: 1; }

.diana-form-linea { display: flex; gap: 8px; margin-top: 10px; }
.diana-form-linea input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  color: #d3e6f4;
  background: rgba(1, 18, 33, 0.85);
  border: 1px solid rgba(0, 132, 197, 0.65);
  border-radius: 6px;
  font-size: 13px;
}

.diana-consumo {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 16px;
  max-width: 380px;
}
.diana-consumo strong { color: #ffd88a; text-align: right; }
.diana-resumen { font-size: 13px; color: #b9d2e4; }

/* =========================================================
   PANTALLA COMPLETA v0.3 — todo cabe en la pantalla, sin cortes
   (cabecera arriba, DIANA al centro, chat abajo con su propio scroll)
   ========================================================= */
#diana-interface:fullscreen,
#diana-interface:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #020c18;
}
#diana-interface:fullscreen .system-header,
#diana-interface:-webkit-full-screen .system-header { flex: 0 0 auto; min-height: 70px; }
#diana-interface:fullscreen .main-grid,
#diana-interface:-webkit-full-screen .main-grid {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
}
#diana-interface:fullscreen .side-panel,
#diana-interface:-webkit-full-screen .side-panel { overflow-y: auto; }
#diana-interface:fullscreen .chat-zone,
#diana-interface:-webkit-full-screen .chat-zone {
  flex: 0 0 auto;
  max-height: 34vh;
  margin-top: 0;
  display: flex;
  flex-direction: column;
}
#diana-interface:fullscreen .messages,
#diana-interface:-webkit-full-screen .messages {
  flex: 1 1 auto;
  min-height: 60px;
  max-height: calc(34vh - 110px);
}
#diana-interface:fullscreen .system-footer,
#diana-interface:-webkit-full-screen .system-footer { flex: 0 0 auto; }
@media (min-width: 901px) {
  #diana-interface:fullscreen .diana-core,
  #diana-interface:-webkit-full-screen .diana-core {
    --avatar: clamp(300px, min(32vw, 46vh), 620px);
  }
}
/* Pantallas de portátil (poca altura): todo más compacto para que quepa */
@media (max-height: 900px) {
  #diana-interface:fullscreen .core-modules,
  #diana-interface:-webkit-full-screen .core-modules { gap: 5px; }
  #diana-interface:fullscreen .core-module,
  #diana-interface:-webkit-full-screen .core-module { min-height: 0; padding: 6px 10px; }
  #diana-interface:fullscreen .core-module .level-bars,
  #diana-interface:-webkit-full-screen .core-module .level-bars { display: none; }
  #diana-interface:fullscreen .diana-core,
  #diana-interface:-webkit-full-screen .diana-core { --avatar: clamp(220px, min(30vw, 40vh), 420px); }
  #diana-interface:fullscreen .system-header,
  #diana-interface:-webkit-full-screen .system-header { min-height: 56px; }
  #diana-interface:fullscreen .menu-button,
  #diana-interface:-webkit-full-screen .menu-button { min-height: 46px; padding: 3px 8px; }
  #diana-interface:fullscreen .menu-text small,
  #diana-interface:-webkit-full-screen .menu-text small { display: none; }
  #diana-interface:fullscreen .chat-zone,
  #diana-interface:-webkit-full-screen .chat-zone { max-height: 30vh; padding: 6px 10px; }
  #diana-interface:fullscreen .messages,
  #diana-interface:-webkit-full-screen .messages { max-height: calc(30vh - 100px); }
  #diana-interface:fullscreen .quick-actions,
  #diana-interface:-webkit-full-screen .quick-actions { display: none; }
}
.diana-dicho { text-align: right; margin: 0 4px 8px; font-size: 12.5px; }

/* =========================================================
   DIANA v0.4 — Word, correo, WhatsApp y normas nuevas
   ========================================================= */
.diana-accion {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 216, 138, 0.55);
  border-radius: 8px;
  background: rgba(1, 18, 33, 0.7);
  font-style: normal;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.diana-accion-titulo { font-weight: bold; color: #ffd88a; }
.diana-accion-detalle { font-size: 12px; color: #7ea0b8; word-break: break-all; }
.diana-accion-texto { white-space: pre-wrap; font-size: 13px; color: #d8ecfa; }
.diana-accion-campo { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #7ea0b8; }
.diana-accion-campo input,
.diana-accion-campo textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  color: #eaf6ff;
  background: rgba(5, 34, 60, 0.97);
  border: 1px solid #007fc2;
  border-radius: 6px;
  resize: vertical;
}
.diana-accion > button,
.diana-boton {
  align-self: flex-start;
  padding: 6px 14px;
  font-size: 13px;
  color: #0b1a2a;
  background: #ffd88a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}
.diana-accion > button:disabled,
.diana-boton:disabled { opacity: 0.7; cursor: default; }
.diana-accion-enlace {
  margin-left: 6px;
  padding: 0;
  background: none;
  border: none;
  color: #6fd8ff;
  text-decoration: underline;
  cursor: pointer;
  font-size: 12px;
}
.diana-novedad { margin-top: 10px; font-style: normal; }
.diana-novedad summary { cursor: pointer; color: #ffd88a; font-weight: bold; }
.diana-novedad > div { margin-top: 8px; padding-left: 4px; }
