* {
  box-sizing: border-box;
  font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
}
.font-mono { font-family: 'JetBrains Mono', monospace; }
html, body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  width: 100vw;
  background-color: #f0f6fb;
  color: #0f172a;
  margin: 0;
  padding: 0;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
.minimal-dot-grid {
  background-image: radial-gradient(rgba(2, 132, 199, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
}
.glass-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.glass-card:hover {
  box-shadow: 0 14px 28px -5px rgba(2, 132, 199, 0.14), 0 10px 12px -6px rgba(0, 0, 0, 0.06);
}
.glass-card-red {
  background: rgba(254, 242, 242, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.18);
}
.glass-card-amber {
  background: rgba(255, 251, 235, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.22);
}
.point-name-input {
  width: 2.2rem; height: 1.5rem; text-align: center; font-weight: 700; font-size: 0.8rem;
  border-radius: 0.375rem; border: 1px solid rgba(2, 132, 199, 0.35);
  background: rgba(240, 249, 255, 0.9); color: #0284c7; outline: none; text-transform: uppercase;
  transition: all 0.15s ease;
}
.point-name-input:focus {
  border-color: #0284c7; background: #ffffff; box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}
input[type=range] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px;
  background: #bae6fd; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #0284c7; cursor: pointer; box-shadow: 0 0 4px rgba(2, 132, 199, 0.5);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.35); box-shadow: 0 0 8px rgba(2, 132, 199, 0.7); }
input[type=range]::-webkit-slider-thumb:active { transform: scale(1.15); box-shadow: 0 0 12px rgba(2, 132, 199, 0.9); }

@keyframes error-pulse {
  0%, 100% { transform: translate(-50%, 0) scale(1); }
  50% { transform: translate(-50%, 0) scale(1.02); }
}
.animate-error-pulse { animation: error-pulse 2s infinite ease-in-out; }

@keyframes notice-in {
  0% { opacity: 0; transform: translate(-50%, -6px) scale(0.96); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.animate-notice-in { animation: notice-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.93) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.animate-pop-in { animation: popIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-slide { animation: fadeSlideUp 0.25s ease-out forwards; }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(2, 132, 199, 0); }
}
.animate-pulse-glow { animation: pulseGlow 2.5s infinite; }

.btn-interactive {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-interactive:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.18);
}
.btn-interactive:active {
  transform: translateY(0) scale(0.96);
}

.mode-btn {
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mode-btn:hover {
  transform: translateY(-1px);
}
.mode-btn:active {
  transform: scale(0.96);
}

.view-btn {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.view-btn:hover {
  transform: translateY(-1px);
}
.view-btn:active {
  transform: scale(0.96);
}

.custom-scroll::-webkit-scrollbar { width: 4px; }
.custom-scroll::-webkit-scrollbar-thumb { background: rgba(2, 132, 199, 0.25); border-radius: 4px; }

/* Epura 2D Pantalla Casi Completa y Controles de Verdadera Magnitud */
.epura-fullscreen {
  position: fixed !important;
  top: 1rem !important;
  left: 1rem !important;
  right: 1rem !important;
  bottom: 1rem !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  transform: none !important;
  z-index: 50 !important;
  margin: 0 !important;
  /* Sin declarar 'display' aquí: el modal ya es 'flex' por sus clases base y así
     la utilidad 'hidden' (display:none) puede ocultarlo con el botón Cerrar. */
  flex-direction: column !important;
  box-shadow: 0 25px 50px -12px rgba(0, 56, 168, 0.25), 0 0 0 1px rgba(2, 132, 199, 0.2) !important;
}

/* Ocultar la barra de controles complejos (2da imagen) y el banner de información en la vista compacta pequeña;
   sólo se muestra dentro de la interfaz grande (ventana casi completa / fullscreen o ampliada). */
#epuraModal:not(.epura-fullscreen):not(.epura-expanded) #epuraVMControls,
#epuraModal:not(.epura-fullscreen):not(.epura-expanded) #epuraVMInfoBanner {
  display: none !important;
}

/* Ventana ampliada (mediana) del épura. Se gobierna por clase propia para que
   las utilidades responsive de Tailwind (sm:w-80, sm:top-3, sm:right-3...) no
   sobrescriban la posición y el tamaño al cambiar de modo. */
.epura-expanded {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  width: min(94vw, 42rem) !important;
  height: auto !important;
  max-width: none !important;
  margin: 0 !important;
  z-index: 40 !important;
  flex-direction: column !important;
}

@media (min-width: 768px) {
  .epura-fullscreen {
    top: 1.5rem !important;
    left: 1.5rem !important;
    right: 1.5rem !important;
    bottom: 1.5rem !important;
    transform: none !important;
  }
}

.canvas-interactive {
  cursor: grab;
  touch-action: none;
}
.canvas-interactive:active {
  cursor: grabbing;
}

.pill-btn {
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pill-btn:hover {
  transform: translateY(-1px);
}
.pill-btn:active {
  transform: scale(0.96);
}

/* 3D Viewport Canvases Touch Control (evita scroll o gestos no deseados del navegador en móviles) */
#canvas3dContainer canvas,
#figPreviewContainer canvas {
  touch-action: none !important;
  display: block;
}

/* Ocultar barra de scroll horizontal en contenedores de pestañas */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Ergonomía táctil para móviles y pantallas táctiles */
@media (pointer: coarse) {
  input[type=range] {
    height: 6px;
    margin-top: 4px;
    margin-bottom: 4px;
  }
  input[type=range]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    box-shadow: 0 1px 5px rgba(0, 56, 168, 0.4);
  }
  .btn-interactive, .mode-btn, .view-btn, .pill-btn {
    min-height: 28px;
    touch-action: manipulation;
  }
}

/* Ajustes de ventana y modales en pantallas móviles */
@media (max-width: 639px) {
  .epura-fullscreen {
    top: 0.5rem !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    bottom: 0.5rem !important;
    border-radius: 1rem !important;
    padding: 0.6rem !important;
  }
}

/* Soporte para áreas seguras de notch y barra inferior en iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #coordsPanel {
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
}

/* =============================================================================
   MÉTODO "TestGeo" — Especificación Técnica de Visibilidad Diédrica (RESOL.md)
   ============================================================================= */
:root {
  --color-solido-a: #dc2626;
  --color-solido-b: #0284c7;
  --color-auxiliar: #9333ea;
  --color-corte-visto: #16a34a;
  --color-corte-oculto: #64748b;
  --color-referencia: rgba(100, 116, 139, 0.45);
  
  --grosor-visto: 2.6px;
  --grosor-oculto: 1.6px;
  --grosor-ref: 1.2px;
}

/* Representación DIN de Aristas Vistas y Ocultas */
.arista-vista {
  stroke: var(--color-solido-a);
  stroke-width: var(--grosor-visto);
  stroke-linecap: round;
  fill: none;
}

.arista-oculta {
  stroke: var(--color-solido-a);
  stroke-width: var(--grosor-oculto);
  stroke-dasharray: 6, 4;
  fill: none;
}

/* Polígono de Intersección */
.corte-tramo-visible {
  stroke: var(--color-corte-visto);
  stroke-width: 3px;
  stroke-linecap: round;
  fill: none;
  filter: drop-shadow(0 0 2px rgba(22, 163, 74, 0.45));
}

.corte-tramo-oculto {
  stroke: var(--color-corte-oculto);
  stroke-width: 2px;
  stroke-dasharray: 5, 4;
  fill: none;
}

/* Líneas de Referencia y Correspondencia Ortogonal π1 ↔ π2 */
.linea-referencia {
  stroke: var(--color-referencia);
  stroke-width: var(--grosor-ref);
  stroke-dasharray: 2, 2;
}

@keyframes pulseIntersectionRef {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.95; }
}

.anim-referencia-activa {
  animation: pulseIntersectionRef 1.6s ease-in-out infinite;
}


