/* ==========================================================
   RoboSecundaria México - Design System & Modern CSS
   ========================================================== */

:root {
  /* Color Tokens - Dark Modern Theme */
  --bg-primary: #0b1120;
  --bg-secondary: #111b33;
  --bg-tertiary: #192648;
  --bg-card: rgba(22, 33, 62, 0.7);
  --bg-card-hover: rgba(30, 45, 84, 0.85);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border-subtle: rgba(148, 163, 184, 0.15);
  --border-glow: rgba(56, 189, 248, 0.35);
  
  --accent-cyan: #00f3ff;
  --accent-blue: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 25px rgba(0, 243, 255, 0.2);
  --shadow-glow-purple: 0 0 25px rgba(168, 85, 247, 0.25);

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Overrides */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --border-subtle: rgba(100, 116, 139, 0.2);
  --border-glow: rgba(14, 165, 233, 0.4);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.08);
}

/* Base Reset & Core Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 45%),
    linear-gradient(to bottom, transparent, var(--bg-primary));
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Typography Helpers */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Header & Navigation Bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  transition: var(--transition-fast);
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.88);
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-title .highlight {
  color: var(--accent-cyan);
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-secondary);
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-mexico {
  font-size: 0.75rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.btn-theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition-fast);
}

.btn-theme-toggle:hover {
  background: var(--bg-tertiary);
  transform: rotate(15deg);
}

/* Main Container & Tab System */
.main-content {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

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

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

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

/* Hero Section */
.hero-banner {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  align-items: center;
  gap: 2.5rem;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(17, 27, 51, 0.8), rgba(25, 38, 72, 0.6));
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 3.5rem;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(0, 243, 255, 0.15), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.nem-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 1rem;
}

.nem-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1.2rem;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 1.75rem;
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(2, 132, 199, 0.35);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(2, 132, 199, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-glow);
}

/* Robot Avatar Showcase */
.robot-showcase-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.robot-avatar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.robot-antenna {
  width: 4px;
  height: 18px;
  background: #cbd5e1;
  border-radius: 2px;
  position: relative;
}

.robot-antenna::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -4px;
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-cyan);
  animation: pulseLight 1.8s infinite alternate;
}

@keyframes pulseLight {
  from { opacity: 0.6; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.2); }
}

.robot-head {
  width: 110px;
  height: 80px;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 3px solid #38bdf8;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
  margin-top: 2px;
}

.robot-eye {
  width: 18px;
  height: 18px;
  background: #00f3ff;
  border-radius: 50%;
  box-shadow: 0 0 14px #00f3ff;
  animation: eyeBlink 3.5s infinite;
}

@keyframes eyeBlink {
  0%, 96%, 100% { transform: scaleY(1); }
  98% { transform: scaleY(0.1); }
}

.robot-body {
  width: 140px;
  height: 110px;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 3px solid #475569;
  border-radius: 16px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.robot-heart {
  width: 24px;
  height: 24px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 16px #ef4444;
  animation: heartbeat 1.2s infinite;
}

@keyframes heartbeat {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.15); }
  100% { transform: scale(0.9); }
}

.robot-wheels {
  display: flex;
  gap: 80px;
  margin-top: 4px;
}

.wheel {
  width: 32px;
  height: 20px;
  background: #334155;
  border: 3px solid #64748b;
  border-radius: 8px;
}

.robot-bubble {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.88rem;
  text-align: center;
  max-width: 320px;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* 3 Pillars Section */
.section-header-center {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 2.1rem;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.75rem;
  margin-bottom: 3.5rem;
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.pillar-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-5px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.code-card:hover {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: var(--shadow-glow-purple);
}

.pillar-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.electro-card .pillar-icon-box { background: rgba(56, 189, 248, 0.15); border-color: rgba(56, 189, 248, 0.3); }
.code-card .pillar-icon-box { background: rgba(168, 85, 247, 0.15); border-color: rgba(168, 85, 247, 0.3); }
.mech-card .pillar-icon-box { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.3); }

.pillar-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-blue);
  margin-bottom: 0.5rem;
}

.pillar-tag.highlight-tag {
  color: var(--accent-purple);
}

.pillar-heading {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.pillar-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.pillar-features {
  list-style: none;
  font-size: 0.88rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.pillar-features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pillar-cta {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.pillar-card:hover .pillar-cta {
  gap: 0.8rem;
}

/* Pedagogy Card */
.pedagogy-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2rem 2.5rem;
  border-radius: var(--radius-lg);
}

.pedagogy-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-green);
  margin-bottom: 0.5rem;
}

.pedagogy-content h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.pedagogy-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 800px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn-outline:hover {
  background: var(--accent-green);
  color: #0b1120;
}

/* ==========================================================
   PÁGINAS DE CONTENIDO ESPECÍFICO (HEADER & SUBNAVS)
   ========================================================== */
.page-header {
  margin-bottom: 2rem;
}

.header-breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.header-breadcrumbs span:first-child {
  color: var(--accent-cyan);
  cursor: pointer;
}

.page-title {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.page-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 850px;
}

.subnav-tabs {
  display: flex;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
  overflow-x: auto;
}

.subtab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.subtab-btn:hover {
  color: var(--text-main);
  background: var(--bg-tertiary);
}

.subtab-btn.active {
  color: var(--text-main);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.subpane {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.subpane.active {
  display: block;
}

/* ==========================================================
   SECCIÓN 2: SIMULADOR DE ELECTRÓNICA & LEY DE OHM
   ========================================================== */
.lab-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 2rem;
  align-items: start;
}

.lab-controls-card, .lab-visual-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.card-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(0, 243, 255, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}

.control-group {
  margin-bottom: 1.5rem;
}

.label-with-val {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.value-badge {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
}

.value-badge.badge-blue { color: var(--accent-blue); }
.value-badge.badge-purple { color: var(--accent-purple); }
.value-badge.badge-amber { color: var(--accent-amber); }

/* Range Sliders */
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  border: 2px solid #ffffff;
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-marks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.styled-select, .styled-select-sm {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

.styled-select-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.formula-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin-top: 1.5rem;
}

.formula-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.formula-box code {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 0.5rem;
}

.formula-result {
  font-size: 0.9rem;
  color: var(--text-main);
}

/* Circuit Visual Area */
.visual-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.visual-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

.status-safe {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.circuit-canvas-area {
  background: #060913;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.circuit-svg {
  width: 100%;
  max-width: 480px;
  height: auto;
}

/* Animación de corriente fluida */
.flowing-current {
  animation: dashLoop 1.2s linear infinite;
}

@keyframes dashLoop {
  to {
    stroke-dashoffset: -24;
  }
}

.led-glow-anim {
  transition: fill 0.2s ease, r 0.2s ease;
}

.diagnostic-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  text-align: center;
}

.diag-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.diag-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.text-green { color: var(--accent-green) !important; }
.text-red { color: var(--accent-red) !important; }

.tip-banner {
  background: rgba(56, 189, 248, 0.1);
  border-left: 4px solid var(--accent-blue);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Cards Carousel Grid (Componentes & Sensores) */
.cards-carousel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.info-tech-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

.tech-icon {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
}

.info-tech-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
}

.info-tech-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.key-facts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  background: var(--bg-tertiary);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
}

/* Potencia y Puente H */
.driver-explanation-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  align-items: center;
}

.badge-accent {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--accent-red);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 0.8rem;
}

.driver-info h2 {
  font-size: 1.7rem;
  margin-bottom: 1rem;
}

.driver-info p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.driver-solution {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-green);
  padding: 1.2rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.driver-solution h4 {
  color: var(--accent-green);
  margin-bottom: 0.3rem;
}

.h-bridge-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.h-unit {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  width: 100%;
  max-width: 320px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.h-unit strong {
  font-size: 1.05rem;
  margin-top: 0.3rem;
}

.h-unit small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.unit-icon {
  font-size: 1.7rem;
}

.h-arrow {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* ==========================================================
   SECCIÓN 3: PROGRAMACIÓN ESP32 CON JAVASCRIPT
   ========================================================== */
.esp32-workbench-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2rem;
  align-items: start;
}

.code-editor-card {
  background: #0d1322;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.editor-header {
  background: #151d30;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.editor-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-name {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.editor-examples-dropdown {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.editor-textarea-wrapper {
  position: relative;
}

.code-textarea {
  width: 100%;
  height: 310px;
  background: #070b14;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 1.2rem;
  border: none;
  outline: none;
  resize: vertical;
  tab-size: 2;
}

.editor-actions {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: #111828;
  border-top: 1px solid var(--border-subtle);
}

.btn-run {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.btn-run:hover:not(:disabled) {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-stop {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.btn-stop:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-reset {
  background: #1e293b;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: auto;
}

/* Monitor Serial */
.serial-console-card {
  border-top: 1px solid var(--border-subtle);
  background: #050811;
}

.console-header {
  padding: 0.6rem 1.25rem;
  background: #0f172a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.btn-clear-console {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  text-decoration: underline;
}

.console-body {
  height: 140px;
  overflow-y: auto;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.log-line {
  color: #e2e8f0;
}

.log-line.system-msg {
  color: #94a3b8;
  font-style: italic;
}

.log-line.error-msg {
  color: #f87171;
}

.log-line.success-msg {
  color: #34d399;
}

/* Placa ESP32 Visual y Periféricos */
.esp32-visual-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.board-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.board-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.board-status-badge.offline {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.board-status-badge.running {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.esp32-board-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
  background: #050811;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.esp32-board-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
}

.esp-led-off {
  opacity: 0.1;
}

.esp-led-on {
  opacity: 1;
  filter: drop-shadow(0 0 10px #00f3ff);
}

/* Periféricos Conectados */
.peripherals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.peripheral-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.periph-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.periph-pin {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: var(--accent-cyan);
}

.periph-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* LED Externo */
.external-led-display {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #334155;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.external-led-display.on {
  background: #ec4899;
  border-color: #fbcfe8;
  box-shadow: 0 0 20px #ec4899;
}

.led-light-core {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
}

.periph-state-text {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Botón Interactivo */
.interactive-btn-device {
  background: #334155;
  border: 2px solid #64748b;
  color: #f8fafc;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: transform 0.05s ease, background 0.1s ease;
}

.interactive-btn-device:active, .interactive-btn-device.pressed {
  background: #10b981;
  border-color: #34d399;
  transform: translateY(2px);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

/* Servomotor Visual */
.servo-visual-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.servo-arm-pivot {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 0.5rem;
}

.servo-arm {
  width: 60px;
  height: 12px;
  background: #f59e0b;
  border-radius: 6px;
  position: absolute;
  transform-origin: 10px 6px;
  transform: rotate(90deg);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  gap: 4px;
}

.servo-hole {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #1e293b;
}

.servo-angle-indicator {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-amber);
}

/* Sensor Ultrasonido Slider */
.sensor-slider-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sensor-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sensor-slider-label strong {
  color: var(--accent-cyan);
}

.distance-radar-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.2rem;
}

.radar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
  transition: width 0.15s ease;
}

/* Cheatsheet */
.quick-cheatsheet-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.quick-cheatsheet-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.85rem;
  color: var(--text-main);
}

.cheatsheet-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: center;
  font-size: 0.82rem;
}

.cheatsheet-grid code {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  background: var(--bg-tertiary);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.cheatsheet-grid span {
  color: var(--text-muted);
}

/* ==========================================================
   SECCIÓN 4: MECÁNICA BÁSICA & FÍSICA
   ========================================================== */
.mechanics-workbench-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

.mech-controls-card, .mech-canvas-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.physics-metrics-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.metric-row strong {
  font-family: var(--font-mono);
  color: var(--text-main);
  font-size: 0.95rem;
}

.action-buttons-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn-toggle-anim {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-toggle-anim:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-secondary-sm {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary-sm:hover {
  background: rgba(56, 189, 248, 0.2);
}

/* Canvas de Mecánica */
.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.canvas-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.mode-pills {
  display: flex;
  gap: 0.4rem;
  background: var(--bg-secondary);
  padding: 0.25rem;
  border-radius: var(--radius-full);
}

.mode-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.mode-pill.active {
  background: var(--accent-blue);
  color: #0b1120;
}

.canvas-wrapper {
  background: #060913;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#gearsCanvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.physics-explanation-footer {
  margin-top: 1.25rem;
}

.law-card {
  background: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--accent-amber);
  padding: 0.85rem 1.2rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.law-card strong {
  color: var(--accent-amber);
}

.mechanics-concepts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.mech-concept-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}

.concept-icon {
  font-size: 2rem;
  margin-bottom: 0.6rem;
}

.mech-concept-item h4 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.mech-concept-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==========================================================
   SECCIÓN 5: PROYECTOS & QUIZ INTERACTIVO
   ========================================================== */
.projects-master-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
}

.project-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 0.6rem;
}

.project-card h3 {
  font-size: 1.4rem;
  margin-bottom: 0.8rem;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.project-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.75rem;
  flex-grow: 1;
}

.breakdown-col {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.col-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.breakdown-col span:last-child {
  color: var(--text-muted);
}

.btn-project-action {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-project-action:hover {
  filter: brightness(1.15);
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}

/* Quiz Gamificado */
.quiz-section-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.quiz-header {
  text-align: center;
  margin-bottom: 2rem;
}

.quiz-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.quiz-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.progress-indicator {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  transition: width 0.3s ease;
}

.question-number {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.question-text {
  font-size: 1.35rem;
  margin-top: 0.35rem;
  margin-bottom: 1.5rem;
}

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

.quiz-option-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-option-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-glow);
}

.quiz-option-btn.selected-correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-green);
  color: #34d399;
}

.quiz-option-btn.selected-wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
  color: #f87171;
}

.quiz-feedback-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

.feedback-text {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.btn-next-question, .btn-restart-quiz {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.quiz-results-box {
  text-align: center;
  padding: 2rem 1rem;
}

.score-display {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin: 1rem 0;
}

/* Modal Curricular */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-glow);
  animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body ul {
  padding-left: 1.5rem;
  margin-top: 1rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* ==========================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================== */
@media (max-width: 1024px) {
  .hero-banner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-desc {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-stats {
    justify-content: center;
  }

  .lab-grid, .esp32-workbench-grid, .mechanics-workbench-grid, .driver-explanation-card, .projects-master-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 0.75rem 1rem;
  }

  .header-container {
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .hero-title {
    font-size: 2rem;
  }

  .pedagogy-card {
    flex-direction: column;
    text-align: center;
  }

  .peripherals-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   TABLERO DE TRABAJO TIPO PROTOBOARD INTERACTIVO
   ========================================================== */
.breadboard-workbench-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

/* ==========================================================
   BARRA DE HERRAMIENTAS Y DISPOSITIVOS FLOTANTE (DOCK INTERACTIVO)
   ========================================================== */
.wb-floating-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(11, 18, 36, 0.90);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.2);
  border-radius: 9999px;
  padding: 0.4rem 0.65rem;
  user-select: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, width 0.25s ease;
  max-width: 98%;
}

.wb-floating-toolbar:hover {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 12px 35px -5px rgba(0, 0, 0, 0.9), 0 0 25px rgba(56, 189, 248, 0.3);
}

.wb-dock-drag-handle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: grab;
  padding: 0.35rem 0.6rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wb-dock-drag-handle:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
}

.wb-dock-drag-handle:active,
.wb-floating-toolbar.is-dragging .wb-dock-drag-handle {
  cursor: grabbing;
}

.dock-handle-grip {
  font-size: 1rem;
  color: var(--accent-cyan);
  line-height: 1;
  opacity: 0.9;
}

.dock-title-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #7dd3fc;
}

.wb-dock-body {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap;
}

.wb-dock-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.wb-dock-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  margin-right: 0.15rem;
  white-space: nowrap;
}

.wb-dock-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
}

.wb-floating-toolbar .wb-tool-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.38rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.wb-floating-toolbar .wb-tool-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-glow);
}

.wb-floating-toolbar .wb-tool-btn.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.wb-floating-toolbar .wb-tool-btn.danger-hover:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.15);
}

.wb-floating-toolbar .wb-tool-btn.danger-hover.active {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  border-color: #f87171;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.wire-color-picker {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

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

.color-dot.active {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
  transform: scale(1.15);
}

.wb-floating-toolbar .wb-add-btn {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.38rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.wb-floating-toolbar .wb-add-btn:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* Dropdown de Circuitos */
.wb-dropdown-wrapper {
  position: relative;
}

.wb-floating-toolbar .wb-preset-btn {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-blue);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.38rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.wb-floating-toolbar .wb-preset-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-cyan);
  color: #ffffff;
  transform: translateY(-1px);
}

.wb-dropdown-toggle .dropdown-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.wb-dropdown-wrapper.open .dropdown-chevron {
  transform: rotate(180deg);
}

.wb-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 215px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.2);
  padding: 0.45rem;
  z-index: 100;
  flex-direction: column;
  gap: 0.25rem;
}

.wb-dropdown-wrapper.open .wb-dropdown-menu {
  display: flex;
  animation: popoverFadeIn 0.18s ease-out;
}

.wb-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
  width: 100%;
}

.wb-menu-item:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(2px);
}

.wb-menu-item .menu-icon {
  font-size: 1.15rem;
}

.wb-menu-item .menu-desc strong {
  display: block;
  font-size: 0.82rem;
  color: #f8fafc;
}

.wb-menu-item .menu-desc small {
  display: block;
  font-size: 0.7rem;
  color: #94a3b8;
}

.wb-floating-toolbar .btn-danger-soft {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.wb-floating-toolbar .btn-danger-soft:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #f87171;
  color: #ffffff;
}

/* Botón colapsar / expandir dock */
.wb-dock-collapse-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 0;
  flex-shrink: 0;
}

.wb-dock-collapse-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.wb-floating-toolbar.is-collapsed {
  border-radius: 9999px;
  padding: 0.35rem 0.55rem;
}

.wb-floating-toolbar.is-collapsed .wb-dock-body {
  display: none;
}

/* Multímetro Digital / Monitor de Estado */
.multimeter-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  background: #060913;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.4rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.meter-item {
  display: flex;
  flex-direction: column;
}

.meter-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
}

.meter-val {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
}

.meter-val.text-cyan { color: var(--accent-cyan); }
.meter-val.text-amber { color: var(--accent-amber); }
.meter-val.text-green { color: var(--accent-green); }

.meter-status-box {
  grid-column: span 1;
}

.meter-badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-top: 0.2rem;
  text-align: center;
}

.meter-badge.status-open {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text-muted);
}

.meter-badge.status-closed {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.meter-badge.status-danger {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
  animation: dangerPulse 1.2s infinite alternate;
}

@keyframes dangerPulse {
  from { opacity: 0.85; }
  to { opacity: 1; filter: brightness(1.2); }
}

/* Área Visual de la Protoboard */
.workbench-canvas-container {
  position: relative;
  width: 100%;
  background: #080d1a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
}

.breadboard-svg {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
}

/* Nodos terminales y orificios */
.terminal-node {
  cursor: pointer;
}

.node-hit-area, .proto-hit-area {
  cursor: pointer !important;
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.terminal-node:hover .terminal-visible-circle {
  stroke: #00f3ff !important;
  stroke-width: 3.5px !important;
  filter: drop-shadow(0 0 8px rgba(0, 243, 255, 0.8));
}

.terminal-node.node-selected .terminal-visible-circle {
  stroke: #00f3ff !important;
  stroke-width: 4.5px !important;
  filter: drop-shadow(0 0 12px #00f3ff);
}

.proto-hole {
  cursor: pointer;
  transition: fill 0.1s ease;
  pointer-events: none; /* El clic lo maneja .proto-hit-area */
}

.proto-node-wrapper:hover .proto-hole {
  fill: #00f3ff !important;
  filter: drop-shadow(0 0 5px #00f3ff);
}

.proto-node-wrapper.node-selected .proto-hole {
  fill: #10b981 !important;
  stroke: #ffffff !important;
  stroke-width: 2px !important;
  filter: drop-shadow(0 0 8px #10b981);
}

/* Grupos de dispositivos interactivos */
.dev-interactive-group {
  cursor: pointer;
  transition: filter 0.2s ease;
}

.dev-interactive-group:hover rect:first-child {
  stroke-width: 3px;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.4));
}

.dev-interactive-group.is-selected rect:first-child {
  stroke: #00f3ff !important;
  stroke-width: 3px;
  filter: drop-shadow(0 0 16px rgba(0, 243, 255, 0.6));
}

/* Cables SVG */
.wire-group {
  cursor: pointer;
}

.wire-path {
  fill: none;
  stroke-linecap: round;
  transition: stroke-width 0.15s ease;
}

.wire-dash-flowing {
  animation: wireDash 1s linear infinite;
}

@keyframes wireDash {
  to {
    stroke-dashoffset: -20;
  }
}

/* Modo Pinzas: cursor y feedback visual */
.mode-pliers {
  cursor: crosshair !important;
}

.mode-pliers .wire-group:hover .wire-path {
  stroke: #ef4444 !important;
  stroke-width: 7px !important;
  stroke-dasharray: 4 4 !important;
  filter: drop-shadow(0 0 8px #ef4444);
}

/* GLOBO DE DIÁLOGO FLOTANTE (POPOVER) */
.device-popover {
  position: absolute;
  z-index: 100;
  background: #111a30;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  width: 310px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  backdrop-filter: blur(12px);
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #111a30;
  border-left: 1px solid var(--border-glow);
  border-top: 1px solid var(--border-glow);
  transform: rotate(45deg);
  top: -7px;
  left: 30px;
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.popover-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  flex-grow: 1;
  margin-left: 0.4rem;
}

.btn-close-popover {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

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

.popover-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

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

.popover-color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.popover-color-btn {
  height: 34px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.popover-color-btn:hover {
  transform: scale(1.1);
}

.popover-color-btn.selected {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.popover-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.popover-option-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popover-option-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-glow);
}

.popover-option-btn.selected {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

.popover-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.popover-slider-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.popover-slider-row strong {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* Tarjetas de Límites Operacionales en Popover */
.popover-limits-box {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 0.78rem;
}

.limits-box-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
}

.limits-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.6rem;
  margin-bottom: 0.5rem;
}

.limits-data-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.limits-data-item span {
  font-size: 0.72rem;
}

.limits-data-item strong {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.limits-zones-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin: 0.4rem 0 0.25rem 0;
}

.limits-zone-segment {
  height: 100%;
}

.zone-off {
  background: #64748b;
  width: 25%;
}

.zone-safe {
  background: #10b981;
  width: 45%;
}

.zone-warning {
  background: #eab308;
  width: 15%;
}

.zone-danger {
  background: #ef4444;
  width: 15%;
}

.limits-zones-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.limits-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.2);
}

.popover-footer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-popover-delete {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.btn-popover-delete:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}

.btn-popover-save {
  flex-grow: 1;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-popover-save:hover {
  filter: brightness(1.15);
}

/* Botones de Agregar Componentes */
.wb-add-btn {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent-green);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.wb-add-btn:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--accent-green);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Componentes Arrastrables en el SVG */
.workbench-component {
  cursor: grab;
  user-select: none;
  transition: filter 0.15s ease;
}

.workbench-component:hover {
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.4));
}

.workbench-component.is-dragging {
  cursor: grabbing !important;
  filter: drop-shadow(0 8px 20px rgba(0, 243, 255, 0.6)) !important;
}

.comp-header-bar {
  cursor: grab;
}

.comp-btn-action {
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.comp-btn-action circle {
  transition: stroke 0.15s ease, stroke-width 0.15s ease, fill 0.15s ease;
}

.comp-btn-action:hover {
  filter: brightness(1.25) drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

.comp-btn-action[data-action="delete"]:hover circle {
  fill: #dc2626;
  stroke: #ffffff;
  stroke-width: 1.8px;
}

.comp-btn-action[data-action="config"]:hover circle {
  fill: #0284c7;
  stroke: #ffffff;
  stroke-width: 1.8px;
}

.comp-btn-action text,
.comp-btn-repair text {
  pointer-events: none;
  user-select: none;
}

.comp-hud-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: bold;
  pointer-events: none;
}

/* Tabla de Mediciones en Tiempo Real por Dispositivo */
.device-diagnostics-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.diag-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.diag-panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.diag-icon {
  font-size: 1.5rem;
}

.diag-panel-title h4 {
  font-size: 1.05rem;
  margin-bottom: 0.15rem;
}

.diag-panel-title small {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.diag-count-badge {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  background: rgba(0, 243, 255, 0.1);
  border: 1px solid rgba(0, 243, 255, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

.device-measurements-table-wrapper {
  overflow-x: auto;
}

.measurements-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.measurements-table th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.measurements-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: middle;
}

.measurements-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-device-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.table-val-mono {
  font-family: var(--font-mono);
  font-weight: 700;
}

.table-status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  display: inline-block;
}

.table-status-pill.status-safe {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.table-status-pill.status-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.table-status-pill.status-warning {
  background: rgba(234, 179, 8, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.45);
}

.table-status-pill.status-open {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.btn-table-action {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  margin-right: 0.3rem;
  transition: var(--transition-fast);
}

.btn-table-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glow);
}

.btn-table-action.delete-action:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* Guía Didáctica */
.wb-instructions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.wb-instruction-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  font-size: 0.85rem;
}

.wb-instruction-card .inst-icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 0.3rem;
}

.wb-instruction-card strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.wb-instruction-card p {
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================
   ANIMACIONES CARTOON: LEDS, FUEGO, HUMO, CHISPAS Y BRILLO
   ========================================================== */

/* Flash / Explosión inicial del LED quemado */
.cartoon-burst-star {
  transform-origin: center;
  animation: cartoonBurstStar 1.6s ease-in-out infinite alternate;
}

@keyframes cartoonBurstStar {
  0% {
    transform: scale(0.92) rotate(0deg);
    opacity: 0.88;
  }
  50% {
    transform: scale(1.08) rotate(6deg);
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.8));
  }
  100% {
    transform: scale(0.96) rotate(-4deg);
    opacity: 0.92;
  }
}

.cartoon-comic-badge {
  animation: cartoonBadgeBounce 0.85s ease-in-out infinite alternate;
}

@keyframes cartoonBadgeBounce {
  0% {
    transform: translate(32px, -18px) scale(0.95);
  }
  100% {
    transform: translate(32px, -22px) scale(1.06);
    filter: drop-shadow(0 0 6px #ef4444);
  }
}

/* Fuego animado estilo caricatura */
.cartoon-flame-wrapper {
  transform-origin: 0 8px;
  animation: cartoonFlameFlicker 0.4s ease-in-out infinite alternate;
}

@keyframes cartoonFlameFlicker {
  0% {
    transform: translate(0, -10px) scale(0.9, 0.88) rotate(-4deg) skewX(-3deg);
  }
  50% {
    transform: translate(0, -13px) scale(1.15, 1.28) rotate(4deg) skewX(4deg);
  }
  100% {
    transform: translate(0, -11px) scale(1, 1.12) rotate(-2deg) skewX(-1deg);
  }
}

.cartoon-flame-inner {
  transform-origin: 0 8px;
  animation: cartoonFlameInnerFlicker 0.28s ease-in-out infinite alternate;
}

@keyframes cartoonFlameInnerFlicker {
  0% {
    transform: scale(0.85, 0.9) rotate(2deg);
  }
  100% {
    transform: scale(1.15, 1.2) rotate(-3deg);
  }
}

/* Humo saliendo estilo caricatura (Puffs redondeados) */
.cartoon-smoke-circle {
  transform-box: fill-box;
  transform-origin: center;
}

.cartoon-smoke-circle.puff-1 {
  animation: cartoonSmokePuff1 1.4s ease-out infinite;
}

.cartoon-smoke-circle.puff-2 {
  animation: cartoonSmokePuff2 1.6s ease-out infinite 0.45s;
}

.cartoon-smoke-circle.puff-3 {
  animation: cartoonSmokePuff3 1.8s ease-out infinite 0.9s;
}

@keyframes cartoonSmokePuff1 {
  0% {
    transform: translate(0, 0) scale(0.3);
    opacity: 0;
  }
  20% {
    opacity: 0.9;
  }
  75% {
    opacity: 0.55;
  }
  100% {
    transform: translate(-10px, -24px) scale(1.4);
    opacity: 0;
  }
}

@keyframes cartoonSmokePuff2 {
  0% {
    transform: translate(0, 0) scale(0.35);
    opacity: 0;
  }
  25% {
    opacity: 0.92;
  }
  70% {
    opacity: 0.5;
  }
  100% {
    transform: translate(12px, -32px) scale(1.65);
    opacity: 0;
  }
}

@keyframes cartoonSmokePuff3 {
  0% {
    transform: translate(0, 0) scale(0.4);
    opacity: 0;
  }
  20% {
    opacity: 0.9;
  }
  80% {
    opacity: 0.4;
  }
  100% {
    transform: translate(-3px, -42px) scale(1.95);
    opacity: 0;
  }
}

/* Chispas y ascuas volando */
.cartoon-ember {
  transform-box: fill-box;
  transform-origin: center;
}

.cartoon-ember.ember-1 {
  animation: cartoonEmberFly1 1.1s ease-out infinite;
}

.cartoon-ember.ember-2 {
  animation: cartoonEmberFly2 1.3s ease-out infinite 0.35s;
}

.cartoon-ember.ember-3 {
  animation: cartoonEmberFly3 0.95s ease-out infinite 0.7s;
}

@keyframes cartoonEmberFly1 {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-16px, -20px) scale(0.2);
    opacity: 0;
  }
}

@keyframes cartoonEmberFly2 {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(18px, -22px) scale(0.2);
    opacity: 0;
  }
}

@keyframes cartoonEmberFly3 {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(4px, -28px) scale(0.15);
    opacity: 0;
  }
}

/* Destellos / Estrellas cartoon cuando el LED está ENCENDIDO */
.cartoon-sparkle {
  transform-box: fill-box;
  transform-origin: center;
}

.cartoon-sparkle.s1 {
  animation: cartoonSparkleStar1 1.2s ease-in-out infinite alternate;
}

.cartoon-sparkle.s2 {
  animation: cartoonSparkleStar2 1.4s ease-in-out infinite alternate 0.4s;
}

.cartoon-sparkle.s3 {
  animation: cartoonSparkleStar3 1.1s ease-in-out infinite alternate 0.7s;
}

@keyframes cartoonSparkleStar1 {
  0% {
    transform: scale(0.7) rotate(0deg);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.3) rotate(45deg);
    opacity: 1;
  }
}

@keyframes cartoonSparkleStar2 {
  0% {
    transform: scale(0.6) rotate(0deg);
    opacity: 0.4;
  }
  100% {
    transform: scale(1.25) rotate(-30deg);
    opacity: 1;
  }
}

@keyframes cartoonSparkleStar3 {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.4);
    opacity: 1;
  }
}

/* Botón Reparar en componente (fijo, sin saltos de transformación) */
.comp-btn-repair {
  cursor: pointer;
  transition: filter 0.15s ease;
}

.comp-btn-repair rect {
  transition: fill 0.15s ease, stroke-width 0.15s ease, stroke 0.15s ease;
}

.comp-btn-repair:hover {
  filter: drop-shadow(0 0 8px #10b981);
}

.comp-btn-repair:hover rect {
  fill: #059669;
  stroke: #ffffff;
  stroke-width: 2.2px;
}


