/* --- DISEÑO DEL SISTEMA E IMPORTACIÓN DE FUENTES --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Paleta de colores quirúrgica */
  --bg-main: #060913;
  --bg-surface: rgba(15, 23, 42, 0.65);
  --bg-card: rgba(22, 30, 54, 0.7);
  --border-glass: rgba(255, 255, 255, 0.07);
  
  --primary: #0ea5e9;       /* Cian esterilizado */
  --primary-hover: #0284c7;
  --primary-glow: rgba(14, 165, 233, 0.3);
  
  --secondary: #6366f1;     /* Azul profundo */
  --accent: #22d3ee;        /* Brillo de cámara */
  
  --success: #10b981;       /* Verde libre de bacterias */
  --success-glow: rgba(16, 185, 129, 0.2);
  
  --warning: #f59e0b;       /* Alerta cremallera abierta / lubricación */
  --danger: #f43f5e;        /* Incorrecto / Biofilm */
  --danger-glow: rgba(244, 63, 94, 0.2);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- ESTILOS GENERALES Y RESET --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Ocultar scrollbars estándar conservando funcionalidad */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
}

/* --- CONTENEDOR PRINCIPAL Y ENRUTADOR --- */
#app-container {
  max-width: 500px; /* Ancho máximo de smartphone ideal */
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 6.5rem 1.25rem; /* Margen inferior para navegación */
  flex-grow: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- HEADER DE LA APP --- */
.app-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0.5rem 0;
}

.app-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 15px var(--primary-glow);
  border: 1.5px solid var(--primary);
  object-fit: cover;
}

.app-title-group h1 {
  font-size: 1.35rem;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-title-group p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* --- BOTÓN FLOTANTE DE INSTALACIÓN PWA --- */
#install-btn {
  background: rgba(14, 165, 233, 0.15);
  border: 1px dashed var(--primary);
  color: var(--primary);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}
#install-btn:hover {
  background: var(--primary);
  color: #000;
}

/* --- NAVEGACIÓN INFERIOR (ESTILO MOBILE PREMIUM) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  padding: 0.8rem 0.5rem;
  z-index: 1000;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  width: 75px;
}

.nav-item i {
  font-size: 1.35rem;
  transition: var(--transition-bounce);
}

.nav-item:hover {
  color: var(--primary);
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-item.active i {
  transform: translateY(-4px) scale(1.1);
  text-shadow: 0 0 10px var(--primary-glow);
}

/* --- VISTA: CATÁLOGO DE INSTRUMENTAL --- */

/* Barra de Búsqueda */
.search-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem 0.9rem 2.8rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
  backdrop-filter: blur(8px);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

/* Categorías tipo chip */
.categories-filter {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.8rem;
  margin-bottom: 1.5rem;
  scrollbar-width: none; /* Firefox */
}
.categories-filter::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.category-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.category-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #060913;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Grid de Instrumental */
.instruments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.instrument-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: var(--transition-bounce);
  backdrop-filter: blur(10px);
}

.instrument-card:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.instrument-card-img {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: #1a2238;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.instrument-card-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
}

.instrument-card-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.instrument-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.instrument-card-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Ficha Detallada (Modal / Vista Completa) */
.details-view {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1rem;
  position: relative;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.back-button {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  transition: var(--transition-smooth);
  width: fit-content;
}
.back-button:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-img {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border-glass);
  background: #1a2238;
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.detail-title {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.btn-speak {
  background: var(--primary-glow);
  border: 1px solid var(--primary);
  color: var(--primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-bounce);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.1);
}

.btn-speak:hover {
  transform: scale(1.1);
  background: var(--primary);
  color: #000;
}

.detail-aliases {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Pestañas de Ficha */
.detail-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 1.25rem;
}

.detail-tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 0.75rem 0.5rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  text-align: center;
}

.detail-tab-btn.active {
  color: var(--primary);
}

.detail-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}

.tab-pane.active {
  display: block;
}

.sterilization-step {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--primary);
}

.sterilization-step.inspection { border-left-color: var(--warning); }
.sterilization-step.packaging { border-left-color: var(--secondary); }
.sterilization-step.method { border-left-color: var(--success); }

.step-icon {
  font-size: 1.15rem;
  margin-top: 0.1rem;
}
.sterilization-step.cleaning .step-icon { color: var(--primary); }
.sterilization-step.inspection .step-icon { color: var(--warning); }
.sterilization-step.packaging .step-icon { color: var(--secondary); }
.sterilization-step.method .step-icon { color: var(--success); }

.step-content h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  letter-spacing: 0.03em;
}

.step-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Micrófono para practicar */
.practice-pronunciation {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  text-align: center;
}

.practice-pronunciation h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.practice-pronunciation p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.mic-btn-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.btn-mic {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.2);
  border: 2px solid var(--secondary);
  color: var(--secondary);
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-bounce);
}

.btn-mic.listening {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: pulseMic 1.2s infinite;
}

@keyframes pulseMic {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.mic-status {
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 20px;
}
.mic-status.listening { color: var(--danger); }
.mic-status.success { color: var(--success); }
.mic-status.error { color: var(--warning); }

.feedback-bubble {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-style: italic;
}

/* --- VISTA: ESCÁNER IA (SIMULACIÓN Y CÁMARA) --- */
.scanner-viewport {
  position: relative;
  width: 100%;
  height: 320px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #090e1a;
  border: 1.5px solid var(--border-glass);
  margin-bottom: 1.5rem;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.scanner-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  z-index: 2;
}

.scanner-placeholder i {
  font-size: 3.5rem;
  color: var(--primary);
  opacity: 0.65;
  margin-bottom: 1rem;
}

.scanner-placeholder p {
  font-size: 0.85rem;
}

/* Carga de fotos / Fallback */
.upload-btn-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.btn-action {
  flex: 1;
  background: var(--primary);
  border: none;
  color: #060913;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-action:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  box-shadow: none;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary);
  border-color: var(--primary);
}

.file-input {
  display: none;
}

/* Consola de análisis de IA */
.analysis-console {
  background: rgba(6, 9, 19, 0.9);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--primary);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.console-text {
  position: relative;
  z-index: 2;
  line-height: 1.5;
}

.console-text::before {
  content: '> ';
  font-weight: bold;
}

.analysis-console::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.15), rgba(0,0,0,0.15) 1px, transparent 1px, transparent 2px);
  pointer-events: none;
  z-index: 1;
}

/* Selector para simulación */
.mock-selector-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.mock-selector-group h4 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.select-instrument {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
}

/* --- VISTA: MODO ESTUDIO (QUIZ Y FLASHCARDS) --- */
.mode-selector {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.mode-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: var(--transition-bounce);
  text-align: center;
}

.mode-btn:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px var(--primary-glow);
}

.mode-btn i {
  font-size: 2.2rem;
  color: var(--primary);
}

.mode-btn h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.mode-btn p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Estructura Flashcards */
.flashcards-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  perspective: 1000px; /* Soporte 3D */
}

.flashcard-wrapper {
  width: 100%;
  height: 360px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard-wrapper.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-front {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(10, 15, 30, 0.9) 100%);
}

.card-back {
  background: linear-gradient(135deg, #0e1e38 0%, #060913 100%);
  transform: rotateY(180deg);
  border-color: rgba(14, 165, 233, 0.25);
  justify-content: space-between;
}

.card-progress {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 0.5rem;
}

.card-img-container {
  position: relative;
  flex-grow: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: #111827;
  margin-bottom: 1rem;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-mystery-tag {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(6, 9, 19, 0.85);
  border: 1px dashed var(--primary);
  color: var(--primary);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  pointer-events: none;
  backdrop-filter: blur(5px);
  letter-spacing: 0.05em;
  animation: pulseScanner 2s infinite;
}

@keyframes pulseScanner {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
  50% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; box-shadow: 0 0 15px var(--primary-glow); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
}

.card-hint-box {
  background: rgba(255, 255, 255, 0.02);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border-left: 2px solid var(--text-muted);
}

.card-hint-box p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.card-info-back {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
  flex-grow: 1;
  justify-content: center;
}

.card-back-title {
  font-size: 1.4rem;
  color: var(--primary);
  font-family: var(--font-title);
}

.card-back-cat {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.card-back-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.flashcard-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.btn-card-action {
  flex: 1;
  padding: 0.8rem;
  border-radius: var(--radius-md);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
}

.btn-card-easy {
  background: var(--success);
  color: #060913;
  box-shadow: 0 4px 10px var(--success-glow);
}

.btn-card-hard {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.btn-reveal-card {
  width: 100%;
  background: var(--primary-glow);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.8rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
}

/* Estructura Cuestionario (Quiz) */
.quiz-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  width: 0%;
  transition: width 0.4s ease-out;
}

.quiz-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.quiz-question-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.quiz-question-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

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

.quiz-option-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  padding: 1rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.03);
}

.quiz-option-btn.correct {
  background: var(--success-glow);
  border-color: var(--success);
  color: #a7f3d0;
  font-weight: 600;
}

.quiz-option-btn.incorrect {
  background: var(--danger-glow);
  border-color: var(--danger);
  color: #fecdd3;
}

.quiz-explanation-box {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid var(--success-glow);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  animation: slideUp 0.3s ease-out;
}

.quiz-explanation-box h5 {
  color: var(--success);
  margin-bottom: 0.25rem;
}

.quiz-explanation-box p {
  color: var(--text-secondary);
}

/* Resultados Finales */
.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.results-score-circle {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  background: var(--primary-glow);
  border: 3px solid var(--primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0 auto 1.5rem auto;
  box-shadow: 0 0 20px var(--primary-glow);
}

.results-score-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.results-score-total {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.results-title {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.results-msg {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* --- ANATOMÍA INTERACTIVA (BONUS) --- */
.anatomy-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.anatomy-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.anatomy-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.anatomy-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.01);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.anatomy-item-num {
  background: var(--primary-glow);
  color: var(--primary);
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

/* --- RESPONSIVIDAD PARA TABLET / DESKTOP --- */
@media (min-width: 501px) {
  body {
    background-image: 
      radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.06) 0%, transparent 40%),
      radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 45%);
  }

  #app-container {
    max-width: 600px; /* Algo más ancho en PC */
    padding-bottom: 7rem;
  }

  .bottom-nav {
    max-width: 600px;
    border-radius: var(--radius-lg);
    bottom: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  }
}

/* --- AJUSTES Y AJUSTES DE API KEY --- */
.settings-icon-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.settings-icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 12, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: modalFadeIn 0.3s ease-out forwards;
}

/* Modal Content */
.modal-content {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(14, 165, 233, 0.1);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  animation: modalSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

.modal-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-header h3 i {
  color: var(--primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: var(--danger);
}

.modal-body label {
  font-family: var(--font-title);
}

.modal-body input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  background: rgba(255,255,255,0.06);
}

/* Modos de escáner */
.btn-mode-tab.active {
  background: var(--primary) !important;
  color: #060913 !important;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-mode-tab:hover:not(.active) {
  color: var(--text-primary) !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

/* Etiquetas e indicadores de origen */
.badge-custom-db {
  font-size: 0.6rem;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  padding: 0.05rem 0.3rem;
  border-radius: var(--radius-sm);
  margin-left: 0.4rem;
  text-transform: uppercase;
  font-weight: 700;
  vertical-align: middle;
}
