:root {
  --bg-color: #090d16;
  --bg-gradient: radial-gradient(circle at 50% 30%, #151f32 0%, #080c14 100%);
  --surface-glass: rgba(16, 24, 40, 0.75);
  --surface-glass-border: rgba(255, 255, 255, 0.12);
  --surface-glass-hover: rgba(26, 38, 64, 0.85);
  
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --primary-glow: rgba(6, 182, 212, 0.35);
  
  --accent-bone: #f1ebd9;
  --accent-marrow: #c98a72;
  --accent-red: #ef4444;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-panel: 0 12px 36px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--surface-glass-border);
  --shadow-glow: 0 0 20px var(--primary-glow);
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  background: var(--bg-color);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* Layout Principal de la Aplicación */
.app-layout {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Contenedor Dividido: Sidebar Izquierda + Canvas 3D Derecha */
.app-main-content {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Columna Derecha: Contenedor del Espacio 3D + Barra Inferior Fija */
.viewport-wrapper {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Espacio 3D Exclusivo (Canvas WebGL) */
#viewport-container {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-gradient);
}

#webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Glassmorphism Panel Base */
.glass-panel {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-glass-border);
  box-shadow: var(--shadow-panel);
}

/* Barra Superior Fija */
.app-header {
  height: 66px;
  min-height: 66px;
  border-radius: 0;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: 1px solid var(--surface-glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 20;
  pointer-events: auto;
  position: relative;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.logo-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(6, 182, 212, 0.18);
  color: var(--primary);
  border: 1px solid rgba(6, 182, 212, 0.35);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.logo-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Espacio Central en Barra Superior: Logo Ambystoma Technologies */
.header-center-branding {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0 14px;
  min-width: 0;
}

.header-brand-logo {
  height: 52px;
  max-height: 54px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.header-brand-logo:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 0 14px rgba(6, 182, 212, 0.6));
}

/* Botones y Elementos Interactivos */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
  background: linear-gradient(135deg, #0369a1, #0891b2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--surface-glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Barra Lateral Fija Izquierda: Herramienta de Corte Didáctico */
.slicer-panel {
  width: 360px;
  min-width: 360px;
  max-width: 380px;
  height: 100%;
  max-height: 100%;
  background: rgba(13, 19, 33, 0.96);
  border-right: 1px solid var(--surface-glass-border);
  border-left: none;
  border-top: none;
  border-bottom: none;
  border-radius: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--surface-glass-border);
  background: rgba(16, 24, 40, 0.6);
  min-height: 60px;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-mobile-close {
  display: none;
}

.btn-floating-mobile {
  display: none;
}

.mobile-panel-backdrop {
  display: none;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.1); }
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-body {
  padding: 12px 10px 80px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0; /* CRÍTICO: Permite que flexbox encoja el contenedor y active el scroll vertical */
  overflow-y: auto; /* Barra de desplazamiento vertical cuando se desborda */
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(6, 182, 212, 0.6) rgba(16, 24, 40, 0.85);
}

/* Scrollbar estilizada y altamente visible para navegación táctil/ratón */
.panel-body::-webkit-scrollbar {
  width: 8px;
}
.panel-body::-webkit-scrollbar-track {
  background: rgba(16, 24, 40, 0.85);
  border-radius: 8px;
}
.panel-body::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.5);
  border-radius: 8px;
  border: 1px solid rgba(6, 182, 212, 0.7);
}
.panel-body::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.85);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Selector de Planos Anatómicos */
.plane-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.btn-plane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  gap: 2px;
}

.btn-plane:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-plane.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.plane-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.75;
}

/* Sliders */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mono-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

input[type="range"]:hover {
  background: rgba(255, 255, 255, 0.18);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
  cursor: grab;
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.25);
  cursor: grabbing;
}

.range-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* Navegación Rápida de Corte */
.slice-quick-nav {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.btn-micro {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.btn-micro:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-micro.primary {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.35);
  color: var(--primary);
}

.btn-micro.primary:hover {
  background: rgba(6, 182, 212, 0.22);
}

/* Rotación de la Muestra / Modelo 3D */
.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.section-sublabel {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.axis-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.axis-tag.axis-y {
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.axis-tag.axis-x {
  background: rgba(236, 72, 153, 0.18);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.axis-tag.axis-z {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

/* Acordeones Desplegables de Herramientas */
.accordion-group {
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-md);
  background: rgba(16, 24, 40, 0.5);
  flex-shrink: 0; /* Impide que flexbox aplaste o recorte la tarjeta */
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.accordion-group.expanded {
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #22d3ee;
}

.accordion-group.expanded .accordion-header {
  border-bottom-color: var(--surface-glass-border);
  background: rgba(6, 182, 212, 0.08);
}

.accordion-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.accordion-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.accordion-chevron {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-dim);
}

.accordion-group.expanded .accordion-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.accordion-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 10px 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 200px);
  scrollbar-width: thin;
  scrollbar-color: rgba(6, 182, 212, 0.6) rgba(16, 24, 40, 0.85);
  animation: fadeInAccordion 0.2s ease-out;
}

.accordion-content::-webkit-scrollbar {
  width: 6px;
}
.accordion-content::-webkit-scrollbar-track {
  background: rgba(16, 24, 40, 0.7);
  border-radius: 6px;
}
.accordion-content::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.5);
  border-radius: 6px;
}
.accordion-content::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.85);
}

.accordion-group.collapsed .accordion-content {
  display: none;
}

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

.rot-quick-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 3px;
}

.btn-rot-step {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 4px 2px;
  text-align: center;
}

.btn-rot-step:hover {
  border-color: rgba(6, 182, 212, 0.45);
  color: #22d3ee;
  background: rgba(6, 182, 212, 0.1);
  transform: translateY(-1px);
}

.btn-rot-step:active {
  transform: translateY(1px);
}

/* Checkbox Custom */
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.checkbox-option input {
  display: none;
}

.custom-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--surface-glass-border);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-option input:checked + .custom-check {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-option input:checked + .custom-check::after {
  content: "✓";
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.12);
  transition: var(--transition-fast);
  border-radius: 34px;
  border: 1px solid var(--surface-glass-border);
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-fast);
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* Selector de Color de Tapa Sólida */
.color-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.color-presets {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

#cap-custom-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

/* Barra Inferior FIJA (debajo del espacio 3D, no sobre él) */
.app-footer {
  height: 54px;
  min-height: 54px;
  background: rgba(13, 19, 33, 0.96);
  border-top: 1px solid var(--surface-glass-border);
  border-bottom: none;
  border-left: none;
  border-right: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 10;
  position: relative;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.footer-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-group-pill {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-glass-border);
  padding: 3px;
  border-radius: var(--radius-full);
  gap: 2px;
}

.btn-pill {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-pill:hover {
  color: var(--text-main);
}

.btn-pill.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.footer-divider {
  width: 1px;
  height: 24px;
  background: var(--surface-glass-border);
}

.model-info-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-glass-border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.info-tag.fps {
  font-family: var(--font-mono);
  color: #10b981;
  font-weight: 600;
}

/* Modal de Ayuda */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 13, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: modal-enter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card-large {
  max-width: 920px;
  width: 94%;
}

.modal-header-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.modal-footer-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-right: auto;
}

/* Filtro de Categorías en el Modal */
.sample-categories-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.btn-filter {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-filter:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-filter.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

/* Grilla de Modelos de Muestra */
.sample-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  padding: 4px 0;
}

.sample-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.sample-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 12px 32px rgba(6, 182, 212, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

.sample-card.active-model {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.sample-card-preview {
  height: 170px;
  width: 100%;
  position: relative;
  background: radial-gradient(circle at 50% 50%, #152033 0%, #090d16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--surface-glass-border);
}

.sample-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.sample-card:hover .sample-card-preview img {
  transform: scale(1.08);
}

.preview-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sample-card-info {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

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

.sample-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.15);
  color: var(--primary);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.sample-size {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.sample-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.sample-category {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}

.sample-desc {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
  flex: 1;
}

.sample-card-footer {
  margin-top: 10px;
  display: flex;
}

.sample-card-footer .btn {
  width: 100%;
  justify-content: center;
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--surface-glass-border);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: 20px 24px;
  max-height: 70vh;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Tarjeta de Desarrollador y Contacto en Modal de Info */
.company-author-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(16, 24, 40, 0.9) 100%);
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 22px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.company-author-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.company-author-logo {
  height: 48px;
  max-width: 180px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.company-author-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.company-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(6, 182, 212, 0.18);
  border: 1px solid rgba(6, 182, 212, 0.35);
  padding: 1px 7px;
  border-radius: 4px;
  align-self: flex-start;
}

.company-author-text .company-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
}

.company-author-text .company-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.company-contact-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13, 19, 33, 0.85);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.contact-box-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}

.contact-text-wrap {
  display: flex;
  flex-direction: column;
}

.contact-box-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 600;
}

.contact-email-link {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: #22d3ee;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.contact-email-link:hover {
  color: #67e8f9;
  text-decoration: underline;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.modal-body h4 {
  color: var(--text-main);
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.help-list {
  padding-left: 18px;
  margin-bottom: 10px;
}

.help-list li {
  margin-bottom: 6px;
}

kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--surface-glass-border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-main);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--surface-glass-border);
  display: flex;
  justify-content: flex-end;
}

/* Drag & Drop Zona */
.drop-zone-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 182, 212, 0.15);
  backdrop-filter: blur(10px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drop-zone-box {
  padding: 40px 60px;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--primary);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: rgba(16, 24, 40, 0.9);
  box-shadow: 0 0 40px rgba(6, 182, 212, 0.3);
  animation: bounce-slow 2s infinite ease-in-out;
}

@keyframes bounce-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.drop-icon {
  color: var(--primary);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 150;
  pointer-events: none;
}

.toast {
  background: rgba(16, 24, 40, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.info {
  border-left: 4px solid var(--primary);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Helpers */
.hidden {
  display: none !important;
}

.full-width {
  width: 100%;
}

#btn-turntable.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.35);
}

/* Responsive */
@media (max-width: 1350px) {
  .header-brand-logo {
    height: 44px;
  }
}

@media (max-width: 1150px) {
  .header-brand-logo {
    height: 34px;
  }
}

@media (max-width: 980px) {
  .header-center-branding {
    display: flex;
    height: 40px;
    padding: 0 6px;
    cursor: pointer !important;
  }
  .header-brand-logo {
    height: 34px;
    max-height: 34px;
    cursor: pointer !important;
    pointer-events: auto !important;
  }
}

@media (max-width: 768px) {
  /* Layout móvil: El espacio 3D toma toda la pantalla */
  .app-layout {
    height: 100vh;
    height: 100dvh; /* Soporte para viewports dinámicos en teléfonos */
    overflow: hidden;
  }

  .app-header {
    height: 52px;
    min-height: 52px;
    padding: 0 12px;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
  }

  .logo-group {
    gap: 8px;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
  }

  .logo-title {
    font-size: 0.92rem;
  }

  .logo-subtitle {
    display: none;
  }

  .badge {
    display: none;
  }

  .header-actions {
    gap: 6px;
    overflow-x: auto;
    max-width: 68%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .btn-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
  }

  /* Contenedor principal en teléfono */
  .app-main-content {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
  }

  /* El visor 3D es el protagonista a pantalla completa */
  .viewport-wrapper {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
  }

  /* Panel de herramientas como Drawer deslizable lateral */
  .slicer-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 86vw;
    max-width: 330px;
    min-width: 0;
    height: 100%;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 8px 0 35px rgba(0, 0, 0, 0.7);
    border-right: 1px solid rgba(6, 182, 212, 0.4);
    background: rgba(13, 19, 33, 0.98);
  }

  .slicer-panel.mobile-open {
    transform: translateX(0);
  }

  .panel-header {
    padding: 12px 14px;
    min-height: 50px;
  }

  .panel-title {
    font-size: 0.86rem;
  }

  .btn-mobile-close {
    display: flex !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
  }

  /* Botón Flotante para abrir herramientas */
  .btn-floating-mobile {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: absolute;
    bottom: 60px;
    left: 14px;
    z-index: 25;
    background: linear-gradient(135deg, #0284c7, #06b6d4);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 30px;
    padding: 10px 18px;
    font-weight: 700;
    font-size: 0.82rem;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.5);
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  }

  .btn-floating-mobile:active {
    transform: scale(0.96);
  }

  /* Fondo oscurecido con desenfoque */
  .mobile-panel-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .mobile-panel-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Footer en teléfono */
  .app-footer {
    height: auto;
    min-height: 44px;
    padding: 6px 10px;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .app-footer::-webkit-scrollbar {
    display: none;
  }

  .footer-label {
    display: none;
  }

  .btn-pill {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .info-tag {
    font-size: 0.68rem;
    padding: 2px 6px;
  }

  /* Transparencia dinámica EXCLUSIVA para celulares al manipular sliders */
  .slicer-panel.slider-active-mode {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: none;
  }

  .slicer-panel.slider-active-mode #slicer-controls {
    pointer-events: auto;
  }

  .slicer-panel.slider-active-mode .panel-header {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .slicer-panel.slider-active-mode .accordion-header,
  .slicer-panel.slider-active-mode .accordion-group:not(.has-active-slider),
  .slicer-panel.slider-active-mode .control-section:not(.slider-dragging-active),
  .slicer-panel.slider-active-mode .section-title-row,
  .slicer-panel.slider-active-mode .rot-quick-buttons,
  .slicer-panel.slider-active-mode .slice-quick-nav,
  .slicer-panel.slider-active-mode #btn-play-scan,
  .slicer-panel.slider-active-mode .plane-buttons,
  .slicer-panel.slider-active-mode .checkbox-option {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .slicer-panel.slider-active-mode .accordion-group.has-active-slider {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }

  .slicer-panel.slider-active-mode .control-section.slider-dragging-active {
    opacity: 1 !important;
    pointer-events: auto !important;
    background: rgba(13, 19, 33, 0.75) !important;
    border-radius: var(--radius-md);
    padding: 8px 12px !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(6, 182, 212, 0.5) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
    transition: opacity 0.2s ease, background 0.2s ease;
  }

  .slicer-panel.slider-active-mode .control-section.slider-dragging-active * {
    opacity: 1 !important;
  }

  .mobile-panel-backdrop.slider-active-mode {
    opacity: 0 !important;
    pointer-events: none !important;
  }
}
