/* ==========================================================================
   The Sentinel 3D • Estilos Canónicos e Integración en /tools/
   ========================================================================== */

:root {
  --bg-space: #050811;
  --color-primary: #06b6d4;
  --color-primary-glow: rgba(6, 182, 212, 0.45);
  --color-accent: #8b5cf6;
  --color-accent-glow: rgba(139, 92, 246, 0.45);
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #f43f5e;
  --color-danger-glow: rgba(244, 63, 94, 0.6);
  --glass-bg: rgba(15, 23, 42, 0.8);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-hover: rgba(255, 255, 255, 0.25);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores de sección web */
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-page: #f8fafc;
}

[data-theme="dark"] {
  --card-bg: #0f172a;
  --card-border: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --bg-page: #0b0f17;
}

/* ==========================================================================
   Contención canónica del layout
   ========================================================================== */

body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-main);
  margin: 0;
  padding: 0;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.text-mono {
  font-family: var(--font-mono);
}

.text-cyan {
  color: var(--color-primary);
}

/* ==========================================================================
   Tarjeta del Escenario 3D del Juego
   ========================================================================== */

.sentinel-stage-card {
  position: relative;
  width: 100%;
  height: 640px;
  min-height: 500px;
  max-height: 85vh;
  background-color: var(--bg-space);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.65), 0 0 35px rgba(6, 182, 212, 0.1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Modo Pantalla Completa nativa */
.sentinel-stage-card:fullscreen,
.sentinel-stage-card:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
}

/* Lienzo WebGL */
.canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  outline: none;
  cursor: crosshair;
}

/* Viñeteado de Peligro / Detección */
.danger-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  box-shadow: inset 0 0 100px rgba(244, 63, 94, 0);
  transition: box-shadow 0.3s ease;
}

.danger-vignette.alert-locked {
  box-shadow: inset 0 0 120px rgba(245, 158, 11, 0.6);
  animation: pulseAmber 1.2s infinite ease-in-out;
}

.danger-vignette.alert-draining {
  box-shadow: inset 0 0 160px rgba(244, 63, 94, 0.85);
  animation: pulseRed 0.6s infinite ease-in-out;
}

@keyframes pulseAmber {

  0%,
  100% {
    box-shadow: inset 0 0 100px rgba(245, 158, 11, 0.4);
  }

  50% {
    box-shadow: inset 0 0 140px rgba(245, 158, 11, 0.7);
  }
}

@keyframes pulseRed {

  0%,
  100% {
    box-shadow: inset 0 0 120px rgba(244, 63, 94, 0.6);
  }

  50% {
    box-shadow: inset 0 0 180px rgba(244, 63, 94, 0.95);
  }
}

/* Efecto de Hipersalto */
.hyperspace-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, #fff 0%, #22d3ee 40%, #050811 90%);
  transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.hyperspace-overlay.active {
  opacity: 1;
}

/* ==========================================================================
   HUD Superior Integrado
   ========================================================================== */

.hud-top {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.hud-top-left,
.hud-top-right,
.hud-top-center {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-hud-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.btn-hud-icon:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--color-primary);
  color: #38bdf8;
  transform: translateY(-1px);
}

.hud-world-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  backdrop-filter: blur(10px);
}

.hud-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  font-weight: 600;
}

.hud-world-code {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.hud-world-code:hover {
  color: #7dd3fc;
}

/* =========================================================================
   MÓDULO DE RADAR TÁCTICO 360 DEL CENTINELA (HUD SUPERIOR)
   ========================================================================= */

.hud-radar-card {
  background: rgba(11, 15, 23, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 9999px;
  padding: 0.25rem 0.85rem 0.25rem 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(56, 189, 248, 0.08);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
}

.hud-radar-card.warning {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.22), inset 0 0 12px rgba(245, 158, 11, 0.12);
}

.hud-radar-card.danger {
  border-color: rgba(244, 63, 94, 0.75);
  box-shadow: 0 4px 24px rgba(244, 63, 94, 0.35), inset 0 0 14px rgba(244, 63, 94, 0.2);
  animation: radar-danger-pulse 1s ease-in-out infinite alternate;
}

@keyframes radar-danger-pulse {
  from {
    box-shadow: 0 4px 18px rgba(244, 63, 94, 0.25);
  }

  to {
    box-shadow: 0 4px 28px rgba(244, 63, 94, 0.55);
  }
}

/* Pantalla circular del radar */
.radar-scope-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.radar-scope {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.92) 0%, rgba(3, 7, 18, 0.98) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8), 0 0 8px rgba(56, 189, 248, 0.25);
  transition: border-color 0.3s ease;
}

.hud-radar-card.warning .radar-scope {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8), 0 0 10px rgba(245, 158, 11, 0.35);
}

.hud-radar-card.danger .radar-scope {
  border-color: rgba(244, 63, 94, 0.85);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8), 0 0 14px rgba(244, 63, 94, 0.5);
}

/* Anillos concéntricos y retícula militar */
.radar-grid-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.radar-grid-ring.ring-outer {
  inset: 2px;
  border: 1px solid rgba(56, 189, 248, 0.18);
}

.radar-grid-ring.ring-mid {
  inset: 9px;
  border: 1px dashed rgba(56, 189, 248, 0.2);
}

.radar-grid-ring.ring-inner {
  inset: 15px;
  border: 1px dotted rgba(56, 189, 248, 0.22);
}

.radar-axis-h {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(56, 189, 248, 0.18);
  pointer-events: none;
}

.radar-axis-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(56, 189, 248, 0.18);
  pointer-events: none;
}

/* Barrido continuo 360° */
.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(56, 189, 248, 0) 0deg, rgba(56, 189, 248, 0) 280deg, rgba(56, 189, 248, 0.35) 360deg);
  animation: radar-sweep-spin 2.8s linear infinite;
  pointer-events: none;
}

.hud-radar-card.danger .radar-sweep {
  background: conic-gradient(from 0deg, rgba(244, 63, 94, 0) 0deg, rgba(244, 63, 94, 0) 280deg, rgba(244, 63, 94, 0.45) 360deg);
  animation-duration: 1.4s;
}

@keyframes radar-sweep-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Marcador del jugador en el centro */
.radar-player-blip {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #38bdf8;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px #38bdf8;
  z-index: 2;
}

/* Ancla orbital del Centinela (rota alrededor del centro) */
.radar-sentinel-anchor {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  z-index: 3;
  transition: transform 0.08s linear;
}

.radar-sentinel-blip {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  transform: translate(-50%, -15px);
  box-shadow: 0 0 8px #38bdf8;
  transition: background-color 0.25s, box-shadow 0.25s;
}

.hud-radar-card.warning .radar-sentinel-blip {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
}

.hud-radar-card.danger .radar-sentinel-blip {
  background: #f43f5e;
  box-shadow: 0 0 12px #f43f5e;
  animation: blip-flash 0.5s ease infinite alternate;
}

@keyframes blip-flash {
  from {
    transform: translate(-50%, -15px) scale(0.9);
  }

  to {
    transform: translate(-50%, -15px) scale(1.3);
  }
}

/* Cono de visión / haz del Centinela en el mini-radar */
.radar-sentinel-gaze {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 11px solid rgba(56, 189, 248, 0.45);
  transform-origin: center bottom;
  transform: translate(-50%, -24px);
  transition: border-color 0.25s ease;
  pointer-events: none;
}

.hud-radar-card.warning .radar-sentinel-gaze {
  border-bottom-color: rgba(245, 158, 11, 0.7);
}

.hud-radar-card.danger .radar-sentinel-gaze {
  border-bottom-color: rgba(244, 63, 94, 0.85);
}

/* Metadatos y cuadrante numérico */
.radar-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.radar-bearing-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.radar-label {
  font-size: 0.65rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.radar-bearing {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
}

.radar-status-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  transition: background-color 0.25s, color 0.25s;
}

.radar-status-badge.warning {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.radar-status-badge.danger {
  background: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

/* Pastilla de Puntos */
.hud-stat-pill {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  backdrop-filter: blur(10px);
}

.hud-stat-label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
}

.hud-stat-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
}

/* ==========================================================================
   Retícula central y tooltip
   ========================================================================== */

.hud-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.crosshair-ring {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  position: absolute;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.crosshair-dot {
  width: 4px;
  height: 4px;
  background: #f8fafc;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  transition: all 0.15s ease;
}

.hud-center.valid-target .crosshair-ring {
  border-color: var(--color-primary);
  width: 42px;
  height: 42px;
  box-shadow: 0 0 12px var(--color-primary-glow);
}

.hud-center.valid-target .crosshair-dot {
  background: var(--color-primary);
}

.hud-center.transfer-target .crosshair-ring {
  border-color: var(--color-accent);
  width: 46px;
  height: 46px;
  box-shadow: 0 0 14px var(--color-accent-glow);
}

.hud-center.transfer-target .crosshair-dot {
  background: var(--color-accent);
}

.hud-center.sentinel-target .crosshair-ring {
  border-color: #38bdf8;
  border-style: dashed;
  width: 50px;
  height: 50px;
  animation: rotateRing 8s linear infinite;
}

@keyframes rotateRing {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.crosshair-info {
  margin-top: 2.2rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--glass-border);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #e2e8f0;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.15s ease;
  pointer-events: none;
}

.crosshair-info.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Banner de Alerta / Detección
   ========================================================================== */

.hud-alert-banner {
  position: absolute;
  top: 4.8rem;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.4);
  padding: 0.5rem 1.15rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  backdrop-filter: blur(12px);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-alert-banner.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hud-alert-banner.warning {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fef3c7;
}

.hud-alert-banner.danger {
  background: rgba(244, 63, 94, 0.25);
  border-color: rgba(244, 63, 94, 0.6);
  color: #ffe4e6;
}

.hud-alert-banner.victory {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(16, 185, 129, 0.7);
  color: #ecfdf5;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.35);
}

.alert-pulse-icon {
  display: flex;
  align-items: center;
  animation: pulseSvg 0.8s infinite alternate ease-in-out;
}

@keyframes pulseSvg {
  0% {
    transform: scale(0.9);
  }

  100% {
    transform: scale(1.15);
  }
}

.alert-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
}

.alert-subtitle {
  font-size: 0.7rem;
  opacity: 0.85;
}

/* ==========================================================================
   HUD Inferior: Energía y Botonera
   ========================================================================== */

.hud-bottom {
  position: absolute;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  z-index: 10;
  pointer-events: none;
}

.hud-energy-container {
  pointer-events: auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.65rem 0.95rem;
  border-radius: 14px;
  backdrop-filter: blur(12px);
  width: 210px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.hud-energy-container.energy-critical {
  border-color: var(--color-danger);
  animation: pulseBorderRed 0.8s infinite alternate ease-in-out;
}

@keyframes pulseBorderRed {
  from {
    border-color: rgba(244, 63, 94, 0.4);
  }

  to {
    border-color: rgba(244, 63, 94, 0.9);
  }
}

.energy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.energy-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  font-weight: 600;
}

.energy-numeric {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.energy-unit {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.energy-meter-track {
  display: flex;
  gap: 2px;
  height: 10px;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px;
  border-radius: 4px;
}

.energy-seg {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.energy-seg.active {
  background: var(--color-primary);
  box-shadow: 0 0 5px var(--color-primary-glow);
}

.energy-seg.warning {
  background: var(--color-warning);
  box-shadow: 0 0 5px rgba(245, 158, 11, 0.5);
}

.energy-seg.danger {
  background: var(--color-danger);
  box-shadow: 0 0 5px var(--color-danger-glow);
}

/* Barra de acciones Dock */
.hud-actions-dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.45rem 0.55rem;
  border-radius: 16px;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.btn-action {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
  color: #e2e8f0;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
  min-width: 60px;
  position: relative;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
}

.btn-action:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.85);
  border-color: var(--color-primary);
  color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px -3px var(--color-primary-glow);
}

.btn-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.action-label {
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-heading);
}

.action-badge {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: #94a3b8;
}

.action-key {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #0f172a;
  border: 1px solid var(--glass-border);
  font-size: 0.55rem;
  font-family: var(--font-mono);
  padding: 0.08rem 0.3rem;
  border-radius: 3px;
  color: #cbd5e1;
}

.btn-action.btn-transfer:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: #c084fc;
  box-shadow: 0 6px 15px -3px var(--color-accent-glow);
}

.btn-action.btn-hyperspace.ready {
  animation: pulseActionGlow 1.2s infinite alternate ease-in-out;
  border-color: var(--color-primary);
}

@keyframes pulseActionGlow {
  from {
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
    transform: scale(1);
  }

  to {
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.9);
    transform: scale(1.03);
  }
}

/* ==========================================================================
   Modales encapsulados en el juego
   ========================================================================== */

.game-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1.25rem;
}

.game-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.game-modal-dialog {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 92%;
  overflow-y: auto;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 35px rgba(6, 182, 212, 0.15);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: #f8fafc;
  animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-modal-dialog.modal-small {
  max-width: 420px;
}

@keyframes modalScaleIn {
  from {
    transform: scale(0.93) translateY(10px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-badge-row {
  display: flex;
  gap: 0.5rem;
}

.modal-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.modal-tag.tag-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.15;
}

.modal-subtitle {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
}

.modal-lead {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.modal-guide-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.guide-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
}

.guide-num {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  background: rgba(6, 182, 212, 0.1);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.8rem;
}

.guide-info strong {
  color: #f8fafc;
  font-family: var(--font-heading);
}

.guide-info span {
  color: #94a3b8;
  line-height: 1.35;
}

.modal-actions-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.modal-actions-row .btn-primary-start {
  flex: 1 1 180px;
}

.btn-primary-start {
  flex: 0 0 auto;
  width: 100%;
  max-width: 320px;
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  color: #fff;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(6, 182, 212, 0.5);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary-start:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-secondary-guide {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--glass-border);
  color: #cbd5e1;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary-guide:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #fff;
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}

.modal-header-simple {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-desc-simple {
  font-size: 0.82rem;
  color: #94a3b8;
}

.world-input-row {
  display: flex;
  gap: 0.5rem;
}

.input-world {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--glass-border);
  color: #38bdf8;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  outline: none;
  text-align: center;
}

.btn-confirm-world {
  background: var(--color-primary);
  border: none;
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  padding: 0 1.15rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-worlds-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.chip-world {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.chip-world:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: var(--color-primary);
  color: #38bdf8;
}

/* Tabla de controles */
.instructions-content {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.controls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.controls-table th,
.controls-table td {
  padding: 0.5rem 0.4rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.controls-table th {
  color: #94a3b8;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.controls-table td code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.12rem 0.3rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  color: #38bdf8;
  font-size: 0.75rem;
}

.strategy-tip-box {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  font-size: 0.8rem;
  color: #ddd6fe;
  line-height: 1.45;
}

.strategy-tip-box strong {
  color: #f3e8ff;
  font-family: var(--font-heading);
}

/* Victoria y derrota */
.modal-victory-dialog {
  max-width: 440px;
  overflow: visible;
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 50px rgba(6, 182, 212, 0.25);
  text-align: center;
  align-items: center;
  gap: 0.85rem;
  padding: 1.4rem 1.6rem;
}

.modal-victory-dialog .modal-title {
  font-size: 1.45rem;
  margin: 0;
}

.modal-victory-dialog .modal-lead {
  font-size: 0.82rem;
  margin: 0;
}

.modal-victory-dialog .score-summary-box {
  margin: 0.2rem 0;
}

.victory-icon-glow {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px var(--color-primary-glow);
}

.score-summary-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #94a3b8;
}

.score-row.total-row {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.4rem;
  color: #f8fafc;
  font-weight: 700;
}

.score-huge {
  font-size: 1.15rem;
  color: #38bdf8;
}

.modal-defeat-dialog {
  border-color: rgba(244, 63, 94, 0.4);
  text-align: center;
  align-items: center;
}

.defeat-icon-glow {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px var(--color-danger-glow);
}

.defeat-title {
  color: #fb7185;
}

.btn-retry {
  background: linear-gradient(135deg, #f43f5e, #be123c);
}

/* ==========================================================================
   Sección didáctica, características y FAQ (Contenido SEO)
   ========================================================================== */

.sentinel-guide-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1rem;
}

.section-heading {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(6, 182, 212, 0.12);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.feature-desc {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* Acordeón FAQ */
.faq-accordion-section {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.faq-main-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  transition: background-color 0.2s;
}

.faq-question {
  padding: 1rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
  color: var(--text-muted);
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 1.2rem 1.2rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px solid var(--card-border);
  padding-top: 0.85rem;
}

/* ==========================================================================
   Adaptación Móvil y Responsividad
   ========================================================================== */

@media (max-width: 768px) {
  .sentinel-stage-card {
    height: 480px;
    border-radius: 14px;
  }

  .hud-top {
    top: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
  }

  .hud-radar-card {
    padding: 0.2rem 0.5rem 0.2rem 0.25rem;
    gap: 0.45rem;
  }

  .radar-scope-wrapper {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .radar-sentinel-blip {
    transform: translate(-50%, -12px);
  }

  .radar-sentinel-gaze {
    transform: translate(-50%, -20px);
  }

  .hud-bottom {
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .hud-energy-container {
    width: 100%;
    padding: 0.5rem 0.75rem;
  }

  .hud-actions-dock {
    width: 100%;
    justify-content: space-around;
    padding: 0.35rem;
  }

  .btn-action {
    min-width: 48px;
    padding: 0.45rem 0.3rem;
  }

  .action-key {
    display: none;
  }

  .game-modal-dialog {
    padding: 1.25rem;
    border-radius: 16px;
  }

  .modal-title {
    font-size: 1.4rem;
  }

  .quick-worlds-list {
    grid-template-columns: 1fr;
  }
}