/* ─────────────────────────────────────────
   TD PLAYGROUND · main.css
   Design system · tokens · shared styles
───────────────────────────────────────── */


/* ─── TOKENS ─── */
:root {
  /* Fondos — oscuros fríos como TD */
  --bg:          #0f0f0f;
  --panel:       #1a1a1a;
  --panel2:      #222222;
  --border:      #2e2e2e;
  --text:        #e8e8f0;
  --muted:       #666666;

  /* Nexa · acento principal (del gradiente del botón) */
  --nexa-blue:     #3366ee;
  --nexa-blue-lt:  #7799ff;
  --nexa-grad:     #3366ee;
  --nexa-color:    #5248d5;

  /* Acentos UI */
  --accent:      #5248d5;
  --accent2:     #7799ff;
  --accent3:     #b3adfd;
  --accent4:     #ff6b6b;
  --accent5:     #4857ac;

  --success:     #00ff88;
  --warn:        #ffaa00;

  /* Familias — colores originales de TD */
  --top-color:   #E24B4A;
  --chop-color:  #7ab84e;
  --sop-color:   #639922;
  --dat-color:   #BA7517;
  --comp-color:  #7F77DD;
  --mat-color:   #1D9E75;
  --pop-color:   #D4537E;

  --font-display: 'roboto', sans-serif;
  --font-mono:    "roboto-mono", monospace;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;

  /* ─── TOPs · fondos op-cards ─── */
  --top-generador-bg:   #1f1c28;
  --top-modificador-bg: #1b162a;
  --top-salida-bg:      #161026;
  
}

/* ─── FAMILY CLASSES ─────────────────────────────────────────
   Clases semánticas por familia de operadores TD.
   Uso: agregar .family-top, .family-chop, etc. al elemento.
   Disponibles como variables CSS: var(--family-color) y var(--family-bg)
─────────────────────────────────────────────────────────────── */

.family-top  { --family-color: #9b7fd4; --family-bg: #342958; --family-hover: #b49de6b7; --family-desc: #cfaaff; }
.family-chop { --family-color: #7ab84e; --family-bg: #315419; --family-hover: #b7e695b7; --family-desc: #9ec97f; }
.family-sop  { --family-color: #5aaae8; --family-bg: #13406b; --family-hover: #8fc5f0b7; --family-desc: #8dc8f5; }
.family-pop  { --family-color: #6b6be8; --family-bg: #151373; --family-hover: #9a9af0b7; --family-desc: #9999f0; }
.family-mat  { --family-color: #c4c44a; --family-bg: #5f5515; --family-hover: #d8d87ab7; --family-desc: #d9d97a; }
.family-dat  { --family-color: #e85aaa; --family-bg: #582948; --family-hover: #f08ac8b7; --family-desc: #f09fd4; }
.family-comp { --family-color: #aaaaaa; --family-bg: #1d1d1d; --family-hover: #ccccccb7; --family-desc: #cccccc; }

/* Helpers reutilizables — funcionan dentro de cualquier .family-* */
.family-badge {
  background: var(--family-bg);
  color: var(--family-color);
  border-left: 2px solid var(--family-color);
}
.family-pill {
  background: var(--family-bg);
  color: var(--family-color);
}
.family-accent {
  color: var(--family-color);
}
.family-border {
  border-color: var(--family-color);
}

/* ─── TOPs · colores de texto en op-cards ─── */
.family-top .op-card p { 
  color: #a395bf;
}



/* ─── SKELETON LOADER ─── */
@keyframes skel-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skel {
  background: linear-gradient(
    90deg,
    var(--panel2) 25%,
    rgba(255,255,255,0.045) 50%,
    var(--panel2) 75%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.6s ease-in-out infinite;
  border-radius: 4px;
}

/* Variantes de tamaño */
.skel-badge      { width: 44px;  height: 20px; border-radius: 3px; margin-bottom: 0.8rem; }
.skel-title      { width: 260px; max-width: 100%; height: 32px; margin-bottom: 0.8rem; }
.skel-title-sm   { width: 160px; max-width: 100%; height: 18px; }
.skel-text       { width: 88%;   max-width: 480px; height: 11px; margin-bottom: 0.45rem; }
.skel-text-short { width: 55%;   max-width: 300px; }
.skel-cat-label  { width: 110px; height: 10px; margin-bottom: 0.9rem; }
.skel-op-card    { height: 86px; border-radius: 8px; }
.skel-card       { height: 110px; border-radius: 8px; }
.skel-block      { width: 100%;  border-radius: 8px; }

/* Stagger sutil entre cards */
.skel-op-card:nth-child(2), .skel-card:nth-child(2) { animation-delay: 0.12s; }
.skel-op-card:nth-child(3), .skel-card:nth-child(3) { animation-delay: 0.24s; }

/* ─── TRANSICIÓN DE PÁGINA ─── */
.page {
  opacity: 0;
  transition: opacity 0.18s ease;
}
.page.page-visible {
  opacity: 1;
}
.page.page-leaving {
  opacity: 0;
  transition: opacity 0.13s ease;
}

/* ─── RESET ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ─── BG GLOW ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(51,102,238,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 90%, rgba(119,153,255,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.canvas-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.canvas-grid-major {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 200px 200px;
    pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;          /* sticky-footer: ocupa el alto restante del body */
}

/* ─── NAV ─── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid #2e2e2e;
  background: rgba(15,15,15,0.96);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--muted);
}
.nav-logo span { 
  color: var(--nexa-color); 
  font-weight: 700; }

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: block;
}
.nav-links a:hover  { border-color: var(--accent); color: var(--text); }
.nav-links a.active { color: #3366ee; color: #fff; border-color: transparent; }

.nav-badge {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--accent3);
  letter-spacing: 0.1em;
}

/* ─── NAV DROPDOWN ─── */

.nav-dropdown {
  position: relative;
}


.nav-dropdown-btn {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* Cuando el button está solo (sin link) */
.nav-dropdown:not(.has-link) .nav-dropdown-btn {
  width: 100%;
}

.nav-dropdown-btn:hover,
.nav-dropdown.open .nav-dropdown-btn,
.nav-dropdown-group:hover .nav-dropdown-btn {
  border-color: var(--accent);
  color: var(--text);
}

.nav-dropdown-btn.active,
.nav-dropdown-group:hover .nav-dropdown-btn.active {
  color: #fff;
  border-color: var(--accent);
}

.nav-dropdown:not(.has-link) .nav-dropdown-btn.active {
  border-color: transparent;
}

.nav-arrow {
  font-size: 0.5rem;
  transition: transform 0.2s;
  display: inline-block;
}
.nav-dropdown.open .nav-arrow {
  transform: rotate(180deg);
}

/* Menú desplegable */
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: rgba(15, 15, 15, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  list-style: none;
  min-width: 120px;
  backdrop-filter: blur(12px);
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  margin-top: -1px;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu li a {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  padding: 0.45rem 0.8rem;
  display: block;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  border: 1px solid transparent;
}
.nav-dropdown-menu li a:hover {
  color: var(--text);
  background: var(--panel2);
  border-color: var(--border);
}
.nav-dropdown-menu li a.active {
  color: var(--accent3);
  background: rgba(0, 229, 255, 0.06);
}


/* ─── PAGE WRAPPER ─── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* ─── SECTION HEADER ─── */
.section-header {
  margin-bottom: 2rem;
}
.section-header h1 {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.6rem;
}

.section-header h1 em {
  font-family: hegante, sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-style: normal;
  font-weight: 900;
  color: var(--nexa-color);
}

.section-header .title-family-top em {
  color: var(--top-color);
}

.section-header .title-family-chop em {
  color: var(--chop-color);
}


.section-header p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 650px;
}

.header-desc{
  color: #a3a3a3 !important;
  font-size: 0.9rem !important;
  line-height: 1.3 !important;
}

.section-header .titleMain {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4vw, 2rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 0.6rem;
}

.section-header .titleMain em{
  font-family: hegante, sans-serif;
  font-size: clamp(1.8rem, 4vw, 4rem);
  font-style: normal;
  font-weight: 900;
  /*color: var(--nexa-color);*/
}

.section-header .titleMain em {
  background: linear-gradient(90deg, #9067e2, #7ab84e, #5aaae8, #6b6be8, #d1d14c, #e85aaa, #9067e2);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: slideGradient 4s linear infinite;
}

@keyframes slideGradient {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* ─── HOME PAGE — centrado vertical ─── */
.page-home {
  min-height: calc(100svh - 60px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  margin-top: -50px; /* ajustar para subir (+neg) o bajar (+pos) el contenido */
}

/* ─── HOME CARDS — 2x2, igual altura por fila ─── */
#index-modulos {
  grid-template-columns: repeat(2, 1fr);
  align-items: stretch;
}
#index-modulos a {
  display: block;
  height: 100%;
}
#index-modulos .card {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
}
#index-modulos .card p {
  flex: 1;
}

@media (max-width: 600px) {
  #index-modulos {
    grid-template-columns: 1fr;
  }
}

/* ─── HOME HERO — título más grande ─── */
#index-hero .titleMain {
  font-size: clamp(3rem, 7vw, 3rem);
  line-height: 1.05;
  margin-bottom: 1rem;
  padding-bottom: 0.12em;
  overflow: visible;
}

#index-hero .titleMain em {
  font-size: clamp(3rem, 7vw, 6rem);
  /* JS maneja el color letra a letra — cancelar gradiente genérico */
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: inherit !important;
  animation: none !important;
}

/* ─── Wave: letras del hero ─── */
.hero-letter {
  display: inline-block;
  animation: heroWave 2.4s ease-in-out infinite;
  will-change: transform;
}

@keyframes heroWave {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-9px); }
}

/* ─── Canvas de nodos — fijo, detrás de todo ─── */
#hero-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ─── CARDS GRID ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.cards-grid .title{
  color: #c3c3c3;
  font-size:0.9rem; 
  font-weight:700; 
  margin-bottom:0.4rem;
}

/* ─── GENERIC CARD ─── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.card:hover { 
  border-color: var(--accent); 
  transform: translateY(-2px); 
}


.card:has(.detail-box.open) {
  border-color: var(--accent); 
}

.card p{
  font-family:var(--font-mono); 
  font-size:0.7rem; 
  color:var(--muted); 
  line-height:1.6;
  margin-bottom: 0.5rem; 
}

.card h3{
  font-weight: 300;
  font-style: normal;
}



/* ─── BADGE / PILL ─── */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
}

.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

/* ─── DIVIDER ─── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* ─── TOGGLE HINT ─── */
.toggle-hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 0.5rem;
  transition: color 0.2s;
}
.card:hover .toggle-hint { color: var(--accent3); }

/* ─── DETAIL BOX ─── */
.detail-box { display: none; padding-top: 1rem; }
.detail-box.open { display: block; }

.detail-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: #a5a5a5;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  margin-top: 0.9rem;
}

.detail-label:first-child { margin-top: 0; }

.detail-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text);
  line-height: 1.7;
}

.nodes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

/* ─── TÉCNICA CARD LINK ─── */
.tecnica-card-link { text-decoration: none; display: block; }
.tecnica-card-link .card { transition: border-color 0.2s, transform 0.2s; }
.tecnica-card-link:hover .card {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ─── ENTORNO ─── */
.entorno-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 3rem;
  align-items: start;
}

.entorno-sidebar {
  position: sticky;
  top: 5rem;
}

.entorno-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.entorno-nav-item {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.15s;
}
.entorno-nav-item:hover {
  color: var(--text);
  border-color: var(--border);
}
.entorno-nav-item.active {
  color: var(--accent);
  border-color: rgba(82,72,213,0.3);
  background: rgba(82,72,213,0.07);
}

.entorno-items {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.entorno-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.entorno-item-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.entorno-icono {
  font-size: 1.1rem;
}

.entorno-item-titulo {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.entorno-item-desc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #a3a3a3;
  line-height: 1.8;
}

.entorno-tip {
  background: var(--panel2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text);
  line-height: 1.7;
}
.entorno-tip-label {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent3);
  margin-bottom: 0.3rem;
}

.entorno-shortcut {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.2rem;
}
.entorno-shortcut-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.entorno-shortcut code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: rgba(82,72,213,0.12);
  color: var(--accent3);
  padding: 0.15em 0.5em;
  border-radius: 3px;
}

@media (max-width: 768px) {
  .entorno-layout {
    grid-template-columns: 1fr;
  }
  .entorno-sidebar {
    position: static;
  }
  .entorno-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
}

/* ─── ENTORNO INTERACTIVO ─── */
.entorno-interactivo {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Fila superior: imagen (izq) + botones (der) */
.entorno-top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.2rem;
}

.entorno-img-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel2);
  flex: 1 1 0;
  min-width: 0;
  max-width: 800px;
  aspect-ratio: 16 / 9;
}

.entorno-img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.entorno-img-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.2s;
}

.entorno-panel-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Botones en fila (default) */
.entorno-btns {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-start;
}

/* Botones apilados verticalmente (columna derecha) */
.entorno-btns--col {
  flex-direction: column;
  flex-wrap: nowrap;
  flex-shrink: 0;
  width: 250px;
}

.entorno-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  white-space: nowrap;
}
.entorno-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.3);
}
.entorno-btn.active {
  color: var(--accent);
  border-color: rgba(82,72,213,0.35);
  background: rgba(82,72,213,0.08);
}

.entorno-btn-icono {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.entorno-panels {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.4rem;
}

.entorno-placeholder {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.entorno-panel {
  display: none;
}
.entorno-panel.active {
  display: block;
}

/* Dropdown mobile */
.entorno-select-wrap {
  display: none;
}

.entorno-select {
  width: 100%;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2rem;
}

.entorno-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Responsivo ─── */
@media (max-width: 640px) {

  .entorno-select-wrap {
    display: block;
  }

  .entorno-btns--col {
    display: none;
  }

  .entorno-top {
    flex-direction: column;
  }

  .entorno-img-wrap {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  .entorno-img-overlay {
    font-size: 0.65rem;
  }

}

/* ─── Mouse & Teclado ─────────────────────────────── */
.mt-wrap {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.mt-block-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.mt-mouse-container {
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.mt-mouse-svg {
  width: 100%;
  max-width: 680px;
  min-width: 520px;
  height: auto;
  overflow: visible;
}

@media (max-width: 600px) {
  .mt-mouse-svg {
    min-width: 560px;
  }
}

.mt-keys-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.mt-key-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
}

.mt-key-cap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 0.5rem 0.6rem;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-bottom: 3px solid #3a3a3a;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1.35;
  text-align: center;
}

.mt-key-cap--sm {
  font-size: 0.62rem;
  letter-spacing: 0;
}

.mt-key-desc {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.mt-sub-label {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.mt-sub-label--gap {
  margin-top: 2rem;
}

.mt-keys-general {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

.mt-key-cap--hl {
  background: rgba(82, 72, 213, 0.1);
  border-color: var(--accent5);
  border-bottom-color: var(--accent);
  color: var(--accent3);
}

@media (max-width: 768px) {
  .mt-keys-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .mt-keys-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .mt-keys-general {
    grid-template-columns: repeat(2, 1fr);
  }
  .mt-key-cap {
    font-size: 0.9rem;
    min-height: 58px;
  }
  .mt-key-cap--sm {
    font-size: 0.72rem;
  }
  .mt-key-desc {
    font-size: 0.75rem;
  }
  .mt-block-label {
    font-size: 0.72rem;
  }
}

/* ─── NAV HAMBURGER ─── */

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.nav-hamburger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--muted);
  border-radius: 2px;
  transition: all 0.22s ease;
  transform-origin: center;
}

.nav-hamburger:hover { border-color: var(--accent); }
.nav-hamburger:hover span { background: var(--text); }

/* X cuando está abierto */
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Panel mobile */
.nav-mobile-menu {
  display: none;
  position: sticky;
  top: 57px; /* altura del nav */
  z-index: 99;
  background: rgba(15,15,15,0.98);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding: 1rem;
  flex-direction: column;
  gap: 0.25rem;
  animation: mobileMenuIn 0.18s ease;
}

.nav-mobile-menu.open { display: flex; }

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

.nav-mobile-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* Links directos (sin hijos) */
.nav-mobile-links > li > a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.85rem 1rem;
  display: block;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.15s;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-mobile-links > li > a:hover,
.nav-mobile-links > li > a.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--panel2);
}

.nav-mobile-links > li > a.active { color: var(--accent2); }

/* Grupos colapsables */
.nav-mobile-group-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.85rem 1rem;
  min-height: 44px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.nav-mobile-group-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--panel2);
}

.nav-mobile-group-btn.active { color: var(--accent3); }

.nav-mobile-group-btn .mob-arrow {
  font-size: 0.5rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.nav-mobile-group.open .mob-arrow { transform: rotate(180deg); }

.nav-mobile-sub {
  list-style: none;
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.15rem 0 0.25rem 0.5rem;
  border-left: 1px solid var(--border);
  margin: 0 0 0.2rem 1rem;
}

.nav-mobile-group.open .nav-mobile-sub { display: flex; }

.nav-mobile-sub li a {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.75rem 0.85rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.nav-mobile-sub li a:hover { color: var(--text); background: var(--panel2); }
.nav-mobile-sub li a.active { color: var(--accent2); }

.nav-mobile-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.75rem 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .nav-links  { display: none; }
  .nav-right  { display: none !important; }
  .nav-hamburger { display: flex; }
}

@media (max-width: 600px) {
  nav { padding: 1rem; }
  .page { padding: 1.5rem 1rem; }
  .nav-badge { display: none; }

  /* Home — sin centrado vertical en móvil */
  .page-home {
    min-height: unset;
    justify-content: flex-start;
    margin-top: 0;
    gap: 2rem;
  }

  /* Home — textos más chicos */
  #index-hero .titleMain {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
    margin-bottom: 0.6rem;
  }

  #index-hero .titleMain em {
    font-size: clamp(2.2rem, 10vw, 3rem);
  }

  #index-hero .header-desc {
    font-size: 0.8rem !important;
  }
}

/* ─── QUIZ ──────────────────────────────────────────────────────── */

.quiz-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

/* Header: progreso + contador */
.quiz-header {
  margin-bottom: 2rem;
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.quiz-tipo-badge {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
}

.quiz-counter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.quiz-progress-bar-wrap {
  height: 3px;
  background: var(--panel2);
  border-radius: 2px;
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.35s ease;
}

/* Body: pregunta + opciones */
.quiz-body {
  margin-bottom: 1.5rem;
}

.quiz-question {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

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

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(82, 72, 213, 0.06);
}

.quiz-option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.quiz-option:hover:not(:disabled) .quiz-option-letter {
  border-color: var(--accent);
  color: var(--accent);
}

.quiz-option-text {
  flex: 1;
}

/* True/False: más compactas y centradas */
.quiz-option--tf {
  justify-content: center;
  text-align: center;
  font-weight: 700;
  font-size: 0.82rem;
}

/* Estados post-respuesta */
.quiz-option--correct {
  border-color: var(--success) !important;
  background: rgba(0, 255, 136, 0.07) !important;
  color: var(--success) !important;
}
.quiz-option--correct .quiz-option-letter {
  border-color: var(--success);
  background: rgba(0, 255, 136, 0.12);
  color: var(--success);
}

.quiz-option--wrong {
  border-color: var(--accent4) !important;
  background: rgba(255, 107, 107, 0.07) !important;
  color: var(--accent4) !important;
}
.quiz-option--wrong .quiz-option-letter {
  border-color: var(--accent4);
  background: rgba(255, 107, 107, 0.12);
  color: var(--accent4);
}

.quiz-option--dim {
  opacity: 0.35;
}

/* Footer: botón siguiente */
.quiz-footer {
  display: flex;
  justify-content: flex-end;
}

.quiz-next-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.7rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.quiz-next-btn:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}

/* ── PANTALLA DE RESULTADOS ── */
.quiz-result-screen {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.quiz-score-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}

.quiz-score-num {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.quiz-score-num span {
  font-size: 2rem;
  color: var(--muted);
}

.quiz-score-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

.quiz-score-msg {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--accent3);
}

/* Sección de repaso */
.quiz-result-repaso-title {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.quiz-result-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent4);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-result-q {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.6;
}

.quiz-result-answers {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quiz-result-ans {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
}

.quiz-result-ans-label {
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-width: 110px;
  flex-shrink: 0;
}

.quiz-result-ans--wrong {
  color: var(--accent4);
}
.quiz-result-ans--wrong .quiz-result-ans-label {
  color: rgba(255,107,107,0.6);
}

.quiz-result-ans--correct {
  color: var(--success);
}
.quiz-result-ans--correct .quiz-result-ans-label {
  color: rgba(0,255,136,0.6);
}

.quiz-result-exp {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}

/* Acciones finales */
.quiz-result-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.quiz-retry-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.04em;
}
.quiz-retry-btn:hover {
  background: rgba(82,72,213,0.12);
}

.quiz-back-btn {
  display: inline-flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-decoration: none;
  transition: all 0.15s;
  letter-spacing: 0.04em;
}
.quiz-back-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

@media (max-width: 600px) {
  .quiz-question { font-size: 0.88rem; }
  .quiz-option   { font-size: 0.72rem; }
  .quiz-result-ans-label { min-width: 80px; }
}

/* ─── PATH CARDS (elección de camino) ─── */
.path-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.4rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

.path-card:hover { 
  border-color: var(--accent); 
  transform: translateY(-2px); 
}

.path-card:hover .path-cta { 
  color: var(--accent3) !important; 
}

.path-card:hover .toggle-hint { 
  color: var(--accent5); 
}

.path-icon { 
  font-size: 1.4rem; 
  margin-bottom: 0.7rem; 
  color: var(--accent3); 
}

.path-title { 
  font-size: 1rem; 
  font-weight: 800; 
  margin-bottom: 0.4rem; 
}

.path-sub { 
  font-family:var(--font-mono); 
  font-size:0.7rem; 
  color:var(--muted); 
  line-height:1.6;
  margin-bottom: 0.8rem; 
}

.path-cta { 
  font-family: var(--font-mono); 
  font-size: 0.6rem; 
  color: var(--muted);
}

/* ─── BACK BUTTON ─── */
.back-btn {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.back-btn:hover { 
  border-color: var(--accent); 
  color: var(--text); 
}

/* ─── OPERATORS GRID ─── */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.op-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

/*---------- CARD OVER / ACTIVE — driven by --family-hover / --family-color / --family-desc */
.op-card:hover {
  border-color: var(--family-hover, rgba(150, 111, 233, 0.719));
  transform: translateY(-2px);
}

.op-card.active {
  border-color: var(--family-color, var(--accent));
}

.op-card:hover .op-desc {
  color: #aaaaaa !important;
}

.op-card.active .op-desc {
  color: var(--family-desc, var(--muted)) !important;
}




.op-card p{
  font-family:var(--font-mono); 
  font-size:0.7rem; 
  color:var(--muted); 
  line-height:1.6;
  margin-top: 0.5rem; 
  margin-bottom: 0.5rem; 
}

.op-desc-small { 
  font-size: 0.7rem;
}

/*.family-top .toggle-hint     { color: #666666; }*/


.card:hover .op-desc { 
  color: #aaaaaa !important; 
}


.title-family-top em  { color: #966bec !important; }
.title-family-chop em { color: #7ab84e !important; }
.title-family-sop em  { color: #5aaae8 !important; }
.title-family-pop em  { color: #6b6be8 !important; }
.title-family-mat em  { color: #c4c44a !important; }
.title-family-dat em  { color: #e85aaa !important; }
.title-family-comp em { color: #aaaaaa !important; }

.op-card:hover .toggle-hint { color: var(--family-color, var(--accent3)); }

.op-detail {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-top: 0;
  transition: max-height 0.38s ease, opacity 0.28s ease, padding-top 0.28s ease;
}

.op-detail.open {
  max-height: 900px;
  opacity: 1;
  padding-top: 0.8rem;
}

/* ─── OP IMAGE ─── */
.op-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  background: #000;
}
.op-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 1.2rem;
}

/* ─── OP I/O BADGES ─── */
.op-io {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.op-io-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  background: var(--panel2);
  flex: 1;
  white-space: nowrap;
  font-size: 0.65rem;
}

.op-io-sep {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.op-io-arrow {
  color: var(--muted);
  font-size: 0.7rem;
}

.op-io-count {
  font-weight: 700;
  color: var(--text);
  font-size: 0.72rem;
}

.op-io-label {
  color: var(--muted);
  letter-spacing: 0.03em;
}

.op-io-none .op-io-arrow,
.op-io-none .op-io-count,
.op-io-none .op-io-label {
  opacity: 0.35;
}

.op-io-multi .op-io-count {
  color: var(--accent3);
}

/* ─── OP DEMO BUTTON ─── */
.op-demo-btn {
  display: inline-block;
  margin-top: 0.65rem;
  padding: 0.45rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent3);
  background: transparent;
  border: 1px solid var(--accent5);
  border-radius: var(--radius-sm);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.op-demo-btn:hover {
  background: rgba(82, 72, 213, 0.12);
  border-color: var(--accent3);
  color: var(--text);
}
.op-demo-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ─── OP DEMO BADGE ─── */
.op-demo-badge {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent3);
  background: rgba(179, 173, 253, 0.1);
  border: 1px solid var(--accent5);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
}

/* ─── NETWORK ─── */
.network-container {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  overflow-x: auto;
}
.network-node:hover { opacity: 0.85; }

.node-info-box {
  margin-top: 0.75rem;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent3);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
}

/* ─── PASOS ─── */
.pasos-list { display: flex; flex-direction: column; gap: 0.6rem; }
.paso-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
}
.paso-num {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent);
  font-weight: 700;
  min-width: 24px;
  padding-top: 0.15rem;
}
.tecnica-card { cursor: pointer; }


/* ─── SELECTOR DE IDIOMA ─── */
.lang-selector {
  display: flex;
  gap: 0.2rem;
}

.lang-btn {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--text); }
.lang-btn.active { border-color: var(--accent); color: var(--accent); }

/* ─── NETWORK CONTAINER ────────────────────────────────────────── */
.network-container {
  position: relative;
  overflow: visible;
}

#network-nodes {
  position: absolute;
  inset: 0;
  margin-left: -15px;
  margin-top: -25px;
}

/* ─── NETWORK NODES (HTML+CSS) ────────────────────────────────── */
.td-node {
  position: absolute;
  width: 150px;
  border: 1px solid #444;
  border-radius: 2px;
  font-family: 'Space Mono', monospace;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: default;
}
.td-node:hover {
  border-color: #666;
  box-shadow: 0 0 0 1px #555;
}
.td-node.selected {
  border-color: #9b7fd4;
  box-shadow: 0 0 0 1px #9b7fd4, 0 0 10px rgba(155,127,212,0.2);
}

/* Header */
.node-header {
  height: 20px;
  display: flex;
  align-items: center;
  padding: 0 7px;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(0,0,0,0.75);
  border-radius: 2px 2px 0 0;
}
.node-header.generador   { background: #b3a3e8; }
.node-header.modificador { background: #9b7fd4; }
.node-header.salida      { background: #7a6bad; }

.node-type-label {
  margin-left: auto;
  font-size: 8px;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Preview — vacío */
.node-preview {
  height: 45px;
  background: #1a1a1a;
}

/* Footer */
.node-footer {
  height: 18px;
  display: flex;
  align-items: center;
  padding: 0 7px;
  gap: 4px;
  border-top: 1px solid #333;
  background: #242424;
  border-radius: 0 0 2px 2px;
}
.node-name {
  font-size: 9px;
  color: #aaa;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node-viewer-icon {
  width: 9px;
  height: 9px;
  border-radius: 1px;
  background: #444;
  flex-shrink: 0;
  transition: background 0.1s;
}
.node-viewer-icon:hover { background: #9b7fd4; }

/* Connectors */
.node-connector {
  width: 8px;
  height: 8px;
  background: #555;
  border-radius: 50%;
  position: absolute;
  border: 1px solid #2a2a2a;
  transform: translateY(-50%);
  transition: background 0.1s;
  cursor: pointer;
}
.node-connector:hover { background: #9b7fd4; }
.node-connector.in  { left:  -5px; }
.node-connector.out { right: -5px; top: 50%; }

/* ─── DEMO PAGE ─────────────────────────────────────────────────── */
.demo-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

/* Canvas — cuadrado sticky */
.demo-canvas-wrap {
  position: sticky;
  top: 5rem;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.demo-canvas-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  padding: 1rem;
  text-align: center;
}

/* Panel de parámetros */
.demo-params {
  display: flex;
  flex-direction: column;
}

.param-section-title {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.3rem;
}

/* Fila de parámetro */
.param-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  min-height: 34px;
  transition: opacity 0.2s;
}

.param-row.param-disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Etiqueta izquierda — alineada a la derecha como en TD */
.param-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  min-width: 118px;
  text-align: right;
  flex-shrink: 0;
}

/* Slider */
.param-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.param-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
  transition: background 0.15s;
}

.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 4px rgba(82,72,213,0.5);
}

.param-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.param-slider:disabled {
  cursor: not-allowed;
}

.param-value {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text);
  min-width: 30px;
  text-align: right;
}

/* Botones de tipo (Perlin / Simplex / Sparse) */
.param-type-btns {
  display: flex;
  gap: 0.3rem;
  flex: 1;
}

.type-btn {
  flex: 1;
  padding: 0.28rem 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}

.type-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.type-btn.active {
  background: rgba(82,72,213,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Toggle On/Off */
.toggle-btn {
  padding: 0.25rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.06em;
  min-width: 42px;
  text-align: center;
}

.toggle-btn.on {
  background: rgba(122,184,78,0.1);
  border-color: #7ab84e;
  color: #7ab84e;
}

.toggle-btn:hover:not(.on) {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Botón reset */
.demo-reset-btn {
  margin-top: 1.2rem;
  width: 100%;
  padding: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.06em;
}

.demo-reset-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

/* Responsive demo */
@media (max-width: 820px) {
  .demo-layout {
    grid-template-columns: 1fr;
  }
  .demo-canvas-wrap {
    position: static;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
  }
  .param-label {
    min-width: 100px;
  }
}

/* ─── ESTRUCTURA NODOS ──────────────────────────────────────────── */
.en-diagram-wrap {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 2.5rem;
}

.en-tab-panel {
  display: none;
}
.en-tab-panel.active {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.en-node-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.en-node-lbl {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  letter-spacing: 0.04em;
  width: 100%;
}
.en-node-lbl strong {
  display: block;
  color: #a3a3a3;
  margin-bottom: 2px;
}
.en-node-lbl--lg {
  font-size: 0.72rem;
}
.en-node-lbl--lg strong {
  font-size: 0.8rem;
  color: var(--text);
}

.en-legend {
  min-width: 200px;
  max-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.en-leg-title {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
.en-leg-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #a3a3a3;
  line-height: 1.5;
}
.en-leg-row strong { color: var(--text); }
.en-leg-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.6rem 0 0.8rem;
}

/* anatomy wrap + svg */
.en-anatomy-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.2rem;
  width: 100%;
}
.en-anatomy-svg {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

/* interactive zones */
.en-az { cursor: pointer; }
.en-hz { cursor: pointer; }
.en-hl { transition: opacity 0.15s; }

/* info panel content */
.en-info-hint {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.en-info-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}
.en-info-desc {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text);
  line-height: 1.6;
}
.en-info-code {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent3);
  background: var(--panel);
  padding: 2px 8px;
  border-radius: 3px;
  margin-top: 2px;
  display: inline-block;
}

/* tooltip */
#en-tt {
  position: fixed;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 9999;
  max-width: 248px;
  line-height: 1.6;
}
#en-tt-t {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
}
#en-tt-b {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}
#en-tt-s {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent3);
  display: block;
  margin-top: 4px;
}

/* anatomy panel */
#en-panel-anatomy {
  flex-direction: column;
  align-items: flex-start;
}

/* tab buttons spacing */
.en-diagram-wrap .entorno-btns {
  margin-bottom: 1.2rem;
}

.en-callout {
  background: var(--panel2);
  border: 1px solid rgba(82,72,213,0.2);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  flex-basis: 100%;
  max-width: 765px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.7;
}
.en-callout strong { color: var(--text); }
.en-callout em     { color: #00c8e0; font-style: normal; }
.en-callout-sub    { font-size: 0.6rem; color: var(--muted); }
.en-callout-note   { font-size: 0.6rem; color: var(--muted); opacity: 0.6; }
.en-callout-title {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent3);
  margin-bottom: 0.6rem;
  display: block;
}

#en-info-panel {
  width: 100%;
  max-width: 600px;
  min-height: 72px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.en-family-note {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.7;
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 640px;
  flex-basis: 100%;
}
.en-family-note strong,
.en-family-note em { color: var(--text); font-style: normal; }

/* family node label color via CSS custom property */
.en-node-lbl--fam         { color: var(--fam-color); }
.en-node-lbl--fam strong  { color: var(--fam-color); }

/* ─── TD OPERATOR NODE SYSTEM ────────────────────────────────────── */
:root {
  --td-shell:              #555555;
  --td-viewport-bg:        #0d0d0d;
  --td-footer-bg:          #111111;
  --td-button-bg:          #1a1a1a;
  --td-card-rail-width:    10px;
  --td-card-toolbar-size:  22px;
  --td-card-footer-height: 22px;
  --td-card-footer-fs:     10px;
}

.td-operator-node {
  display: flex;
  flex-direction: column;
  background: transparent;
  width: 100%;
  aspect-ratio: 1.6 / 1;
  font-family: var(--font-mono);
  overflow: hidden;
  box-sizing: border-box;
  cursor: pointer;
  position: relative;
  transition: outline 0.05s ease;
}

.td-operator-node:hover {
  outline: 1px solid #44ff44;
  outline-offset: 3px;
  overflow: visible;
  z-index: 200;
}

.td-node-top-row {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.td-node-side {
  display: flex;
  height: 100%;
  flex-shrink: 0;
  background: transparent;
  z-index: 5;
}

.td-node-side.td-side-left {
  position: relative;
  z-index: 12;
}

.td-track-in,
.td-track-out-inner {
  width: var(--td-card-rail-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.td-track-rail,
.td-rail-container {
  flex: 1;
  width: 100%;
  border: 1px solid var(--td-shell);
  box-sizing: border-box;
  min-height: 2px;
  background: #111;
}

.td-gap-in,
.td-gap-out {
  width: 100%;
  height: 4px;
  flex-shrink: 0;
  background: transparent;
}

.td-rail-tab {
  width: 100%;
  height: 30%;
  background: inherit;
}

.td-toolbar {
  width: var(--td-card-toolbar-size);
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--td-shell);
  border-right: none;
  box-sizing: border-box;
}

.td-ico-stack {
  height: auto;
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: #111;
}

.td-ico {
  flex: 0 0 var(--td-card-toolbar-size);
  width: var(--td-card-toolbar-size);
  height: var(--td-card-toolbar-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--td-shell);
}

.td-ico svg {
  width: 60%;
  height: 60%;
  display: block;
  overflow: visible;
}

.td-toolbar-empty { flex: 1; background: #111; }

.td-node-center {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--td-viewport-bg);
  border-top: 1px solid var(--td-shell);
  border-bottom: 1px solid var(--td-shell);
}

.td-node-center::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 3px var(--td-shell);
  pointer-events: none;
  z-index: 2;
}

.td-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 3px;
  margin-top: 0;
  background: #000;
  overflow: hidden;
}

.td-footer-group {
  height: var(--td-card-footer-height);
  width: 100%;
  display: flex;
  margin-top: 2px;
  flex-shrink: 0;
}

.td-footer-label {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 13px;
  font-size: var(--td-card-footer-fs);
  color: #ccc;
  background: var(--td-footer-bg);
  display: flex;
  align-items: center;
  border: 1px solid var(--td-shell);
  overflow: hidden;
  white-space: nowrap;
  margin-right: 2px;
}

.td-marquee-text {
  display: inline-block;
  width: max-content;
}

.td-footer-status,
.td-footer-plus {
  width: var(--td-card-toolbar-size);
  height: 100%;
  background: var(--td-button-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--td-shell);
  border-left: none;
  color: #9aa4b2;
  font-size: var(--td-card-footer-fs);
  flex-shrink: 0;
}

.td-footer-status {
  width: var(--td-card-footer-height);
  border-left: 1px solid var(--td-shell);
  flex-shrink: 0;
}

.td-footer-status svg {
  width: 100%;
  height: 100%;
}

/* Dominant rail colors */
.td-operator-node .td-side-left .td-track-rail,
.td-operator-node .td-side-left .td-toolbar-empty {
  background: var(--td-dominant-rail-color-left, #111) !important;
}

.td-operator-node .td-side-right .td-rail-container,
.td-operator-node .td-side-right .td-rail-tab {
  background: var(--td-dominant-rail-color-right, #111) !important;
}

/* Preview thumbnails */
.td-preview-default {
  width: 100%;
  height: 100%;
  background: #0a0a0a;
}

.td-preview-circle {
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.td-preview-circle::after {
  content: '';
  width: 55%;
  aspect-ratio: 1;
  border: 1px solid #1e1e3a;
  border-radius: 50%;
}

.td-preview-icon {
  width: 100%;
  height: 100%;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 3rem;
  color: #444;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ─── ESTRUCTURA NODOS · layout helpers ──────────────────────────── */
.en-node-outer {
  width: 480px;
  flex-shrink: 0;
}

.en-states-outer {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.en-states-row {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* Zone hover highlighting */
.en-zone-active {
  outline: 1.5px solid var(--zone-color, #00c8e0);
  outline-offset: 1px;
  border-radius: 1px;
  z-index: 10;
  position: relative;
}

/* ─── DEMO DRAWER — overlay global ──────────────────────────────── */

/* Backdrop */
#demo-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.32s ease;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

#demo-drawer-overlay.open {
  pointer-events: all;
  opacity: 1;
}

/* El drawer en sí — panel desde la derecha */
#demo-drawer {
  width: min(560px, 92vw);
  height: 100%;
  background: var(--bg, #0e0e10);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.36s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}

#demo-drawer-overlay.open #demo-drawer {
  transform: translateX(0);
}

#demo-drawer-overlay.closing #demo-drawer {
  transform: translateX(100%);
}

#demo-drawer-overlay.closing {
  opacity: 0;
}

/* Header del drawer */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 1rem;
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  flex-wrap: wrap;
}

.drawer-title em { color: var(--accent2); font-style: normal; }

.drawer-subtitle {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--muted);
  font-family: var(--font-mono);
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* Botón cerrar */
.drawer-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.drawer-close:hover {
  border-color: var(--text);
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

/* Cuerpo scrollable */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Layout demo dentro del drawer: canvas sticky a la izquierda, params a la derecha
   En desktop aprovecha el ancho del panel, en mobile se apila */
.drawer-demo-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

/* Canvas 16:9 */
.drawer-canvas-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

/* Select y textarea dentro de params */
.param-select {
  flex: 1;
  max-width: 180px;
  background: var(--bg2, #1a1a1e);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  cursor: pointer;
}
.param-select:focus { outline: none; border-color: var(--accent); }

.drawer-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Params dentro del drawer — label un poco más ancho que el sm */
.drawer-param-label {
  min-width: 100px !important;
}

/* Ramp color stops editor */
.ramp-gradient-bar {
  width: 100%;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  background: linear-gradient(to right, #000, #fff);
}
.ramp-stops-list { margin-bottom: 0.5rem; }
.ramp-stop-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}
.ramp-stop-num {
  font-size: 0.68rem;
  color: var(--muted);
  min-width: 1rem;
  text-align: center;
  flex-shrink: 0;
}
.ramp-sl { flex: 1; min-width: 0; }
.ramp-alpha-sl { max-width: 60px; }
.ramp-col {
  width: 28px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.stop-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.15rem;
  font-size: 0.7rem;
  flex-shrink: 0;
  line-height: 1;
}
.stop-del:hover { color: var(--text); }
.stop-del-ph { width: 1.1rem; flex-shrink: 0; }
.ramp-add-stop {
  width: 100%;
  padding: 0.3rem;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font-mono);
}
.ramp-add-stop:hover { color: var(--text); border-color: var(--accent); }

/* Movie File In demo */
.movie-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  gap: 0.3rem;
}
.movie-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font-mono);
}
.movie-file-btn:hover { background: rgba(82,72,213,0.12); }

/* Tabs del drawer demo */
.demo-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.8rem;
  gap: 0;
}
.demo-tab {
  padding: 0.38rem 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.demo-tab:hover { color: var(--fg); }
.demo-tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.demo-tab-panel { display: none; }
.demo-tab-panel.active { display: block; }

/* Dual slider en una misma fila (ej. Radius X/Y, Center X/Y, Arc Angles) */
.param-dual-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.param-dual-wrap .param-slider { flex: 1; min-width: 0; }
.param-dual-wrap .param-value  { min-width: 28px; text-align: right; }

/* Color picker + alpha slider en una misma fila */
.param-color-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
}

/* Swatch nativo */
.param-color {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.param-color::-webkit-color-swatch-wrapper { padding: 2px; }
.param-color::-webkit-color-swatch         { border: none; border-radius: 2px; }
.param-color::-moz-color-swatch            { border: none; border-radius: 2px; }

/* Link pantalla completa en el header */
.op-demo-full-link {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.op-demo-full-link:hover {
  color: var(--accent);
}

/* Bloquear scroll del body mientras el drawer está abierto */
body.drawer-open {
  overflow: hidden;
}

/* Mobile: drawer desde abajo, full width */
@media (max-width: 640px) {
  #demo-drawer-overlay {
    align-items: flex-end;
    justify-content: stretch;
  }
  #demo-drawer {
    width: 100%;
    height: 92vh;
    height: 92dvh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
  }
  #demo-drawer-overlay.open #demo-drawer {
    transform: translateY(0);
  }
  #demo-drawer-overlay.closing #demo-drawer {
    transform: translateY(100%);
  }
}

/* ─── DEMO BUTTON (en op-card) ──────────────────────────────────── */
/* ── op-card header with demo badge ── */
.op-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.op-demo-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(82,72,213,0.15);
  color: var(--accent);
  border: 1px solid rgba(82,72,213,0.35);
  pointer-events: none;
}

.op-demo-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.7rem;
  padding: 0.3rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(82,72,213,0.08);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}

.op-demo-btn:hover {
  background: rgba(82,72,213,0.2);
  color: #fff;
}

.op-demo-disabled {
  border-color: var(--border);
  color: var(--muted);
  background: transparent;
  cursor: not-allowed;
  opacity: 0.45;
}
.op-demo-disabled:hover {
  background: transparent;
  color: var(--muted);
}

/* ─── OP 
/* ─── SITE FOOTER ─────────────────────────────────────────── */
.site-footer {
  flex-shrink: 0;              /* el footer no se comprime; .app crece */
  margin-top: 4rem;
  padding: 2rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(0,0,0,0.2);
}

.site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer-brand {
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.site-footer-brand span:first-child {
  color: var(--nexa-blue-lt);
}

.site-footer-version {
  margin-left: 0.5rem;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.site-footer-links a {
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 700;
  transition: color 0.2s ease;
}

.site-footer-links a:hover {
  color: var(--nexa-blue-lt);
}

.site-footer-credit a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(102,102,102,0.3);
  transition: color 0.2s ease;
}

.site-footer-credit a:hover {
  color: var(--nexa-blue-lt);
}

@media (max-width: 640px) {
  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
}

/* ─── PAGINAS LEGALES ─────────────────────────────────────── */
.page-legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.7;
}

.page-legal h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-legal .legal-updated {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2.5rem;
}

.page-legal h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
  color: var(--nexa-blue-lt);
  letter-spacing: -0.01em;
}

.page-legal p,
.page-legal li {
  font-size: 0.9rem;
  color: rgba(232,232,240,0.85);
}

.page-legal ul {
  margin: 0.5rem 0 1rem 1.25rem;
}

.page-legal li { margin-bottom: 0.4rem; }

.page-legal a {
  color: var(--nexa-blue-lt);
  text-decoration: none;
  border-bottom: 1px solid rgba(119,153,255,0.3);
}

.page-legal a:hover {
  color: #fff;
  border-bottom-color: var(--nexa-blue-lt);
}

.page-legal strong { color: var(--text); }

.page-legal .legal-note {
  margin-top: 2.5rem;
  padding: 1rem 1.25rem;
  background: rgba(82,72,213,0.08);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
