@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,700;1,400&display=swap');

:root {
  /* Paleta cálida — Deep Navy + acentos vivos */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.75);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-purple: #a78bfa;
  --accent-indigo: #818cf8;
  --accent-gold: #fbbf24;
  --accent-rose: #fb7185;
  --accent-teal: #34d399;
  --accent-orange: #fb923c;
  --accent-coral: #ff6b6b;
  --gradient-main: linear-gradient(135deg, #a78bfa, #818cf8);
  --gradient-gold: linear-gradient(135deg, #fbbf24, #fb923c);
  --gradient-warm: linear-gradient(135deg, #ff6b6b, #a78bfa);
  --gradient-dark: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  --shadow-glow: 0 0 40px rgba(167, 139, 250, 0.12);
  --shadow-warm: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Textura de ruido sutil sobre toda la app */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-purple);
  border-radius: 3px;
}

/* ===== LAYOUT ===== */
/* El sidebar es position:fixed, por lo tanto sale del flujo del grid.
   Usamos un layout simple: body→sidebar(fixed) + main(margin-left). */
.app-layout {
  min-height: 100vh;
}

/* ===== SIDEBAR NEXUS (V1.2.9) ===== */
.sidebar {
  background: rgba(15, 23, 42, 0.85);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 72px;
  height: 100vh;
  z-index: 1000;
  backdrop-filter: blur(25px);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
}

.sidebar-logo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--gradient-warm);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 25px;
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.4);
  cursor: pointer;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  font-size: 22px;
}

.nav-btn:hover {
  background: rgba(167, 139, 250, 0.1);
  color: #fff;
  transform: translateY(-2px) scale(1.1);
  border-color: rgba(167, 139, 250, 0.3);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(167, 139, 250, 0.2);
}

.nav-btn.active {
  background: var(--gradient-main);
  color: #fff;
  border: none;
  box-shadow: 0 0 25px rgba(167, 139, 250, 0.5);
  animation: active-pulse 2s infinite ease-in-out;
}

@keyframes active-pulse {

  0%,
  100% {
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.4);
  }

  50% {
    box-shadow: 0 0 30px rgba(167, 139, 250, 0.7);
  }
}

.sidebar-bottom {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.5);
}

/* ===== NEXUS GLOBAL INTERFACE ===== */
.main-content {
  margin-left: 72px;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);
  padding: 30px;
}

.panel {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: var(--transition);
}

.panel-header {
  padding: 24px 30px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-header h3 .material-symbols-outlined {
  color: var(--accent-purple);
  font-size: 24px;
}

.panel-body {
  padding: 30px;
}

/* Form Elements Nexus */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 12px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: all 0.3s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.15);
}

/* ===== NEXUS UI COMPONENTS ===== */
.project-avatar-nexus {
  width: 50px;
  height: 50px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid var(--accent-purple);
  border-radius: 12px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.2);
}

.tooltip {
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-purple);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 2000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.nav-btn:hover .tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(5px);
}

.status-dot {
  width: 10px;
  height: 10px;
  background: #64748b;
  border-radius: 50%;
  border: 2px solid #0f172a;
}

.status-dot.active {
  background: var(--accent-teal);
  box-shadow: 0 0 10px var(--accent-teal);
}

/* ===== UTILERÍAS NEXUS GLOW ===== */
.glow-purple {
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.2);
}

.glow-teal {
  box-shadow: 0 0 20px rgba(91, 245, 200, 0.2);
}

.glow-coral {
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.2);
}

.glass-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.3s ease;
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-5px);
}

.text-gradient {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
}

@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.spin-nexus {
  animation: spin-slow 10s linear infinite;
}

/* ===== HEADER ===== */
.app-header {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 10, 18, 0.9);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title h1 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ===== FORMAT & GENRE SELECTORS (dentro del header) ===== */
.selector-bar {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 8px;
}

.selector-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selector-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}

.pill {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.pill:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.pill.active {
  background: var(--gradient-main);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 12px rgba(124, 91, 245, 0.3);
}

.pill-genre.active.terror {
  background: linear-gradient(135deg, #8b0000, #4a0000);
}

.pill-genre.active.drama {
  background: linear-gradient(135deg, #5b6ef5, #3a4ec5);
}

.pill-genre.active.comedia {
  background: linear-gradient(135deg, #f5c85b, #e5a830);
  color: #1a1a2e;
}

.pill-genre.active.animado {
  background: linear-gradient(135deg, #5bf5c8, #30c5a0);
  color: #1a1a2e;
}

.pill-genre.active.suspenso {
  background: linear-gradient(135deg, #f55b8b, #c53a6a);
}

.pill-genre.active.accion {
  background: linear-gradient(135deg, #ff4500, #b33000);
}

/* ===== WORKSPACE ===== */
/* Cada sección .workspace es un contenedor independiente.
   NO usar flex:1 aquí porque causa conflictos cuando
   las secciones hidden acumulan espacio. */
.workspace {
  padding: 24px 32px;
  gap: 24px;
}

/* ===== PANELS / SECTIONS ===== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  overflow: hidden;
  transition: all 0.4s ease;
}

.panel:hover {
  border-color: rgba(167, 139, 250, 0.25);
  box-shadow: 0 8px 40px rgba(167, 139, 250, 0.08), var(--shadow-glow);
  transform: translateY(-1px);
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header h3 .icon {
  color: var(--accent-purple);
}

.panel-body {
  padding: 20px;
}

/* ===== ACTANTIAL MODEL ===== */
.actantial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
}

.actant-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: var(--transition);
  cursor: pointer;
}

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

.actant-card.filled {
  border-color: var(--accent-gold);
}

.actant-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-gold);
  font-weight: 700;
  margin-bottom: 8px;
}

.actant-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.actant-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.actant-card textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
  outline: none;
}

.actant-card textarea::placeholder {
  color: var(--text-muted);
}

/* ===== CHARACTER BUILDER ===== */
.character-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.char-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.char-card:hover {
  border-color: var(--accent-purple);
  transform: translateX(4px);
}

.char-card.active {
  border-color: var(--accent-purple);
  background: rgba(124, 91, 245, 0.08);
}

.char-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.char-info {
  flex: 1;
  min-width: 0;
}

.char-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.char-info p {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.char-detail-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-purple);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(124, 91, 245, 0.15);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-group select {
  cursor: pointer;
}

.form-group select option {
  background: var(--bg-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ===== BEAT SHEET ===== */
.beat-sheet {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.beat-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.beat-item:hover {
  border-color: var(--accent-purple);
}

.beat-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.beat-content {
  flex: 1;
}

.beat-content h5 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.beat-content textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  resize: vertical;
  min-height: 40px;
  outline: none;
  line-height: 1.5;
}

/* ===== SCRIPT EDITOR ===== */
.script-editor {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  min-height: 400px;
  position: relative;
}

.script-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-glass);
  flex-wrap: wrap;
}

.script-toolbar button {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition);
}

.script-toolbar button:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.script-toolbar button.active {
  background: var(--accent-purple);
  color: white;
  border-color: transparent;
}

.script-textarea {
  width: 100%;
  min-height: 380px;
  padding: 20px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.8;
  resize: vertical;
  outline: none;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--gradient-main);
  color: white;
  box-shadow: 0 2px 12px rgba(124, 91, 245, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124, 91, 245, 0.4);
}

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.btn-gold {
  background: var(--gradient-gold);
  color: #1a1a2e;
  box-shadow: 0 2px 12px rgba(245, 200, 91, 0.3);
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(245, 200, 91, 0.4);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

/* ===== GENERATION MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  place-items: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: grid;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ===== LOADING ANIMATION ===== */
.generating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
}

.generating .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.generating p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== SECTION VIEWS ===== */
/* La visibilidad se controla via JS (inline style.display).
   Estas reglas son solo fallback para el render inicial. */
.section-view {
  display: none;
}

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

/* ===== THREE-ACT STRUCTURE VISUAL ===== */
.three-act-visual {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.act-block {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}

.act-block:hover {
  border-color: var(--accent-purple);
}

.act-block.active {
  border-color: var(--accent-gold);
  background: rgba(245, 200, 91, 0.05);
}

.act-block h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.act-block .act-pct {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.act-block p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== PROJECT OVERVIEW ===== */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}



/* ===== EXPORT PANEL ===== */
.export-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.export-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.export-option:hover {
  border-color: var(--accent-purple);
}

.export-option .exp-icon {
  font-size: 24px;
}

.export-option h5 {
  font-size: 13px;
  font-weight: 600;
}

.export-option p {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ===== CONFLICT MATRIX ===== */
.conflict-matrix {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.conflict-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
}

.conflict-vs {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-rose);
  text-transform: uppercase;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-purple);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  animation: toastIn 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== ANIMACIONES ===== */
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .main-content {
    margin-left: 0;
  }

  .selector-bar {
    flex-direction: column;
  }

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

  .three-act-visual {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .rayuela-path {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   🎮 GAMIFICATION LAYER
   Alegorías: Tetris (bloques), Rubik (ejes de color), Rayuela (camino)
   ============================================================ */

/* --- XP PROGRESS BAR (header & dashboard) --- */
.xp-bar-container {
  width: 100%;
  padding: 10px 0;
}

.xp-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.xp-level {
  color: var(--accent-purple);
  text-shadow: 0 0 10px rgba(167, 139, 250, 0.4);
}

.xp-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-coral), var(--accent-gold), var(--accent-teal));
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.xp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 100%;
  background: rgba(255, 255, 255, 0.4);
  filter: blur(4px);
  animation: xpShimmer 2s ease-in-out infinite;
}

@keyframes xpShimmer {

  0%,
  100% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }
}

/* --- TETRIS: Card drop animation (Dashboard) --- */
@keyframes tetrisDrop {
  0% {
    opacity: 0;
    transform: translateY(-40px) scale(0.95);
  }

  60% {
    opacity: 1;
    transform: translateY(4px) scale(1.02);
  }

  80% {
    transform: translateY(-2px) scale(1);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.overview-card {
  animation: tetrisDrop 0.5s ease-out both;
}

.overview-card:nth-child(1) {
  animation-delay: 0.05s;
}

.overview-card:nth-child(2) {
  animation-delay: 0.12s;
}

.overview-card:nth-child(3) {
  animation-delay: 0.19s;
}

.overview-card:nth-child(4) {
  animation-delay: 0.26s;
}

.overview-card:nth-child(5) {
  animation-delay: 0.33s;
}

.overview-card:nth-child(6) {
  animation-delay: 0.40s;
}

/* Tetris completion "row clear" glow */
.overview-card.complete {
  border-color: var(--accent-teal) !important;
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.15);
}

.overview-card.complete::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 12px;
  color: var(--accent-teal);
  font-size: 14px;
  font-weight: 800;
}

.overview-card {
  position: relative;
}

/* --- RUBIK: Actantial model with colored axes --- */
.actant-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.actant-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 4px 0 0 4px;
  transition: var(--transition);
}

/* Eje de Comunicación: coral */
.actant-card[data-axis="communication"]::before {
  background: var(--accent-coral);
}

/* Eje de Deseo: gold */
.actant-card[data-axis="desire"]::before {
  background: var(--accent-gold);
}

/* Eje de Poder: teal */
.actant-card[data-axis="power"]::before {
  background: var(--accent-teal);
}

.actant-card:hover {
  transform: translateY(-3px) rotateX(2deg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.actant-card.filled {
  border-color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.04);
}

.rubik-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 11px;
  color: var(--text-muted);
}

.rubik-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rubik-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.rubik-legend .dot-comm {
  background: var(--accent-coral);
}

.rubik-legend .dot-desire {
  background: var(--accent-gold);
}

.rubik-legend .dot-power {
  background: var(--accent-teal);
}

/* ============================================================
   RAYUELA BEAT SHEET (Tetris & Hopscotch)
   ============================================================ */

/* --- Achievement badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-bronze {
  background: rgba(205, 127, 50, 0.15);
  color: #cd7f32;
  border: 1px solid rgba(205, 127, 50, 0.3);
}

.badge-silver {
  background: rgba(192, 192, 192, 0.12);
  color: #c0c0c0;
  border: 1px solid rgba(192, 192, 192, 0.3);
}

.badge-gold {
  background: rgba(251, 191, 36, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-diamond {
  background: rgba(167, 139, 250, 0.12);
  color: var(--accent-purple);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

/* --- Section fade-in transition --- */
.section-view.active {
  animation: sectionFadeIn 0.35s ease-out;
}

@keyframes sectionFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ──────────────────────────────────────────
   PANEL ADAPTATIVO POR GÉNERO
   Estilos para el panel de género que aparece
   en la sección de Conflictos.
   ────────────────────────────────────────── */

/* Contenedor del panel */
.genre-panel {
  margin-bottom: 20px;
}

/* Collapsible sections con animación */
.genre-details {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.genre-details[open] {
  border-color: rgba(255, 255, 255, 0.12);
}

.genre-details summary {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.genre-details summary::before {
  content: '▸';
  transition: transform 0.2s;
}

.genre-details[open] summary::before {
  transform: rotate(90deg);
}

.genre-details summary::-webkit-details-marker {
  display: none;
}

/* Grid de chips de información */
.genre-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 0 14px 14px;
}

.genre-chip {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border-left: 3px solid rgba(255, 255, 255, 0.1);
}

.genre-chip strong {
  color: var(--text-primary);
}

/* Tag cloud — tropos, subtramas, gags */
.genre-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 14px;
}

.genre-tag {
  font-size: 11px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: var(--text-secondary);
  transition: all 0.2s;
  cursor: default;
}

.genre-tag:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Badges de logro (dashboard Tetris) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-bronze {
  background: rgba(205, 127, 50, 0.15);
  color: #cd7f32;
  border: 1px solid rgba(205, 127, 50, 0.3);
}

.badge-silver {
  background: rgba(192, 192, 192, 0.15);
  color: #c0c0c0;
  border: 1px solid rgba(192, 192, 192, 0.3);
}

.badge-gold {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.3);
}


/* ESTILOS PARA LA LÍNEA DE TIEMPO DE METZ (Añadir a styles.css) */
.metz-timeline {
  display: flex;
  height: 14px;
  width: 100%;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  margin-top: 15px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
  gap: 2px;
  padding: 2px;
}

.timeline-segment {
  height: 100%;
  flex-grow: 1;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: help;
  position: relative;
  border-radius: 2px;
}

.timeline-segment:hover {
  filter: brightness(1.3);
  transform: scaleY(1.4);
  z-index: 10;
}

/* Animación de entrada para nuevos segmentos */
@keyframes segment-pop {
  0% {
    transform: scaleX(0);
    opacity: 0;
  }

  100% {
    transform: scaleX(1);
    opacity: 1;
  }
}

.timeline-segment-new {
  animation: segment-pop 0.6s ease-out forwards;
}

/* Toolbar de Metz */
.metz-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(30, 41, 59, 0.4);
  border-radius: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--border-glass);
}

.toolbar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-indigo);
  font-weight: 800;
  margin-right: 10px;
}

.metz-toolbar button {
  font-size: 11px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.metz-toolbar button:hover {
  background: var(--accent-indigo);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(129, 140, 248, 0.3);
}

/* ===== DASHBOARD NEXUS GRID (V1.2) ===== */
.dashboard-nexus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 30px;
  perspective: 1000px;
}

.overview-card {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px;
  border-radius: var(--radius-xl);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 280px;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.overview-card:hover {
  border-color: var(--accent-purple);
  background: rgba(167, 139, 250, 0.08);
  transform: translateY(-8px) rotateX(2deg);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(167, 139, 250, 0.15);
}

.card-bg-texture {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
  transition: var(--transition);
}

.overview-card:hover .card-bg-texture {
  opacity: 0.3;
  transform: scale(1.1);
}

.card-icon {
  position: relative;
  z-index: 2;
  margin-bottom: 20px;
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  animation: float3D 4s ease-in-out infinite;
}

.overview-card h4 {
  position: relative;
  z-index: 2;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #fff;
}

.overview-card p {
  position: relative;
  z-index: 2;
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 220px;
}

@keyframes float3D {

  0%,
  100% {
    transform: translateY(0) rotateY(0);
  }

  50% {
    transform: translateY(-10px) rotateY(10deg);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spin 1.5s linear infinite;
}


/* RAYUELA & GAMIFIED UI */
.rayuela-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
  padding: 20px;
}

.rayuela-step {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 24px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: grab;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.rayuela-step:hover {
  transform: translateY(-5px);
  border-color: rgba(167, 139, 250, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(167, 139, 250, 0.1);
}

.rayuela-step:active {
  cursor: grabbing;
  transform: scale(1.05) rotate(2deg);
  z-index: 50;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.rayuela-step[data-act="1"] {
  border-top: 4px solid var(--accent-purple);
  border-left: 1px solid rgba(167, 139, 250, 0.2);
}

.rayuela-step[data-act="2"] {
  border-top: 4px solid var(--accent-gold);
  border-left: 1px solid rgba(251, 191, 36, 0.2);
}

.rayuela-step[data-act="3"] {
  border-top: 4px solid var(--accent-teal);
  border-left: 1px solid rgba(45, 212, 191, 0.2);
}

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

.step-number {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
}

.step-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex: 1;
  margin-left: 12px;
}

.rayuela-step textarea {
  width: 100%;
  min-height: 120px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}

/* LEGO CONFLICT STACK */
.lego-tower-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lego-block-3d {
  background: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-top: 6px solid var(--block-color);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.lego-block-3d:hover {
  transform: translateX(12px) scale(1.02);
  box-shadow: -15px 0 30px var(--block-color), 0 10px 25px rgba(0, 0, 0, 0.4);
  border-color: var(--block-color);
}

.lego-header {
  background: rgba(0, 0, 0, 0.2);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lego-type-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.lego-icon {
  font-size: 24px;
}

.lego-title {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
}

.lego-subtitle {
  font-size: 10px;
  color: var(--text-muted);
}

.lego-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.intensity-meter {
  display: flex;
  gap: 4px;
}

.intensity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.intensity-dot:hover {
  transform: scale(1.5);
}

.lego-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.lego-close-btn {
  width: 36px;
  height: 36px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lego-close-btn:hover {
  background: rgba(251, 113, 133, 0.2);
  border-color: var(--accent-coral);
  box-shadow: 0 0 15px rgba(251, 113, 133, 0.4);
  transform: scale(1.05);
}

.lego-close-btn .material-symbols-outlined {
  font-size: 18px;
  font-weight: 700;
}


.escalation-lego {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.esc-step {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 8px;
}

.esc-label {
  display: block;
  font-size: 8px;
  font-weight: 800;
  margin-bottom: 5px;
  color: var(--text-muted);
}

.esc-step input {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 11px;
}

.input-nexus {
  width: 100%;
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid var(--border-glass) !important;
  border-radius: 10px !important;
  padding: 10px !important;
  color: #fff !important;
}

#beat-sheet-graph {
  margin-bottom: 40px;
}

/* ============================================================
   🧬 CHARACTER LAB NEXUS (V1.3)
   ============================================================ */

.character-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.char-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}

.char-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-color, var(--accent-purple));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.char-card:hover {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.3);
  transform: translateX(8px);
}

.char-card.active {
  background: rgba(167, 139, 250, 0.12);
  border-color: var(--accent-color, var(--accent-purple));
  box-shadow: 0 0 25px rgba(167, 139, 250, 0.2);
}

.char-card.active::before {
  opacity: 1;
}

.char-avatar-nexus {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--gradient-dark);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  font-size: 24px;
  position: relative;
  z-index: 2;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.char-info-nexus h4 {
  font-size: 14px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.5px;
  color: #fff;
}

.char-info-nexus p {
  font-size: 10px;
  color: var(--text-secondary);
  margin: 2px 0 0;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1.5px;
}

/* --- INFOGRAPHIC TRAITS --- */
.char-infographic {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 20px 0;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.trait-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trait-label {
  font-size: 9px;
  font-weight: 900;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  justify-content: space-between;
}

.trait-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.trait-bar-fill {
  height: 100%;
  background: var(--gradient-main);
  border-radius: 10px;
  box-shadow: 0 0 10px var(--accent-purple);
  transition: width 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.trait-bar-fill.teal {
  background: var(--accent-teal);
  box-shadow: 0 0 10px var(--accent-teal);
}

.trait-bar-fill.gold {
  background: var(--accent-gold);
  box-shadow: 0 0 10px var(--accent-gold);
}

.trait-bar-fill.rose {
  background: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
}

/* --- CHARACTER EDITOR NEXUS --- */
.char-editor-header {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.02);
  padding: 25px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.char-editor-3d {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.1), transparent);
  border-radius: 50%;
  border: 1px solid rgba(167, 139, 250, 0.2);
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 0 30px rgba(167, 139, 250, 0.1);
}

.char-editor-3d::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed rgba(167, 139, 250, 0.2);
  animation: spin-nexus 15s linear infinite;
}

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

/* ============================================================
   NEXUS ACTANTIAL MODEL — Diagrammatic HUD
   ============================================================ */
.actantial-card-nexus {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.actantial-card-nexus:hover {
  transform: translateY(-5px) scale(1.02);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--node-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px var(--node-color);
}

.actantial-card-nexus.has-data {
  border-color: rgba(255, 255, 255, 0.15);
}

.act-node-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--node-color) 0%, transparent 70%);
  opacity: 0.03;
  pointer-events: none;
  transition: opacity 0.3s;
}

.actantial-card-nexus:hover .act-node-glow {
  opacity: 0.1;
}

.act-card-header-nexus {
  display: flex;
  align-items: center;
  gap: 15px;
}

.act-icon-hex {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 20px;
}

.act-label-nexus {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.act-axis-label {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
  opacity: 0.5;
  color: var(--node-color);
}

.act-card-body-nexus {
  flex: 1;
}

.act-select-nexus {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  outline: none;
  transition: border-color 0.3s;
}

.act-select-nexus:focus {
  border-color: var(--node-color);
}

.act-textarea-nexus {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px;
  color: var(--text-primary);
  font-size: 12px;
  min-height: 80px;
}

/* Fila principal del header con capacidad elástica */

.header-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 20px;
  flex-wrap: wrap; /* CRÍTICO: Permite que el título y los controles se apilen en pantallas angostas */
  gap: 15px;
}

/* ============================================================
   NEXUS ELASTIC LAYOUT — Estructuras Flexibles para Adaptabilidad
   ============================================================ */

/* Contenedor del Laboratorio de Personajes (Desktop Default) */
.character-lab-container {
  display: grid;
  grid-template-columns: 320px 1fr; /* Panel fijo para lista, el resto para el editor */
  gap: 25px;
  height: calc(100vh - 160px);
  min-height: 600px;
}

/* Scroll personalizado para la lista de sujetos */
.character-list-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 5px;
}

/* Rejilla Actancial Nexus (Desktop Default: 3 Columnas) */
.nexus-actantial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

/* Fila principal del header con capacidad elástica */
.header-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 20px;
  flex-wrap: wrap; /* CRÍTICO: Permite que el título y los controles se apilen en pantallas angostas */
  gap: 15px;
}

/* ============================================================
   NEXUS ELASTIC LAYOUT — Estructuras Flexibles para Adaptabilidad
   ============================================================ */

/* Contenedor del Laboratorio de Personajes (Desktop Default) */
.character-lab-container {
  display: grid;
  grid-template-columns: 320px 1fr; /* Panel fijo para lista, el resto para el editor */
  gap: 25px;
  height: calc(100vh - 160px);
  min-height: 600px;
}

/* Scroll personalizado para la lista de sujetos */
.character-list-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 5px;
}

/* Rejilla Actancial Nexus (Desktop Default: 3 Columnas) */
.nexus-actantial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}


/* ============================================================
   RESPONSIVE DESIGN — Adaptación Multi-Plataforma (NEXUS V5.3 - FINAL)
   ============================================================ */

/* 1. INTERFAZ WEB (DESKTOP): Sidebar tipo Dock Persistente */
@media (min-width: 769px) {
  .sidebar {
    width: 58px !important;
    position: fixed !important;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 1000 !important;
    border-right: 1px solid rgba(255,255,255,0.05) !important;
  }
  
  .mobile-menu-toggle {
    display: none !important; /* Oculto en web desktop */
  }

  .nav-label {
    display: none !important; /* En dock web solo iconos */
  }

  .main-content {
    margin-left: 58px !important;
    width: calc(100% - 58px) !important;
  }
}

/* 2. DISEÑO RESPONSIVO (MOBILE): Menú Hamburguesa Activo */
@media (max-width: 768px) {
  .sidebar {
    position: fixed !important;
    left: -100% !important; /* Oculto por defecto */
    width: 260px !important;
    height: 100vh !important;
    z-index: 15000 !important;
    background: var(--bg-deep) !important;
    transition: left 0.4s cubic-bezier(0.19, 1, 0.22, 1) !important;
  }


  .sidebar.expanded {
    display: flex !important; /* Asegura visibilidad tras el toggle */
    left: 0 !important; /* Activación por botón */
    box-shadow: 20px 0 60px rgba(0,0,0,0.8);
  }

  .mobile-menu-toggle {
    display: grid !important; /* Solo en mobile */
    position: fixed !important;
    top: 15px !important;
    right: 15px !important;
    z-index: 16000 !important;
  }

  .nav-label {
    display: block !important;
    font-size: 11px !important;
    opacity: 1 !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 10px !important;
  }
}

/* DASHBOARD: Restauración de Layout Original */
.dashboard-stats-body {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
  gap: 25px !important;
}

.stress-graph {
  height: 70px !important;
}

/* REUBICACIÓN DE BARRA XP Y SELECTORES */
.app-header {
  padding: 10px 20px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 15px !important;
  background: rgba(15, 23, 42, 0.4) !important;
  border-bottom: 1px solid rgba(255,255,255,0.05) !important;
}

.selector-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 20px !important;
  padding: 5px 0 !important;
}

.selector-group {
  display: flex !important;
  gap: 8px !important;
  background: rgba(0,0,0,0.2) !important;
  padding: 4px 8px !important;
  border-radius: 30px !important;
  border: 1px solid rgba(255,255,255,0.03) !important;
}

.selector-label {
  display: none !important; /* Limpieza visual máxima */
}

/* BRAIN PILLS: Rounded horizontal badges for genre constraints */
.brain-pill {
  padding: 6px 14px !important;
  border-radius: 20px !important;
  border: 1px solid rgba(245, 200, 91, 0.3) !important;
  background: rgba(245, 200, 91, 0.08) !important;
  color: var(--accent-gold) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: default !important;
  transition: all 0.3s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
}

.brain-pill.active {
  background: rgba(245, 200, 91, 0.15) !important;
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 10px rgba(245, 200, 91, 0.2) !important;
}

/* PILLS: Icon-only con Hover Label */
.pill {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  font-size: 16px !important;
  position: relative !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  transition: all 0.3s ease !important;
}

.pill.active {
  background: rgba(167, 139, 250, 0.15) !important;
  border-color: var(--accent-purple) !important;
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.2) !important;
}

/* Hover Label Minimalista */
.pill::after {
  content: attr(data-format) attr(data-genre);
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  font-size: 8px;
  color: var(--accent-purple);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 1px;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
  pointer-events: none;
}

.pill:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* BARRA DE XP (Debajo de los selectores) */
.xp-bar-container {
  width: 100% !important;
  max-width: 600px !important;
  margin: 5px 0 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

.xp-bar-label {
  display: flex !important;
  justify-content: space-between !important;
  font-size: 8px !important;
  font-weight: 900 !important;
  letter-spacing: 2px !important;
  margin-bottom: 5px !important;
  color: var(--text-muted) !important;
}

.xp-bar-track {
  height: 2px !important;
  background: rgba(255,255,255,0.05) !important;
  border-radius: 1px !important;
}

.xp-bar-fill {
  box-shadow: 0 0 10px var(--accent-purple) !important;
}

/* Optimización para Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 64px !important; }
}

/* ============================================================
   NEXUS CORE COMPONENT LAYOUTS (DESKTOP)
   ============================================================ */

.subjects-panel {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

.subjects-panel .character-list-scroll {
  overflow-y: auto !important;
  flex: 1 !important;
  height: 0 !important; /* CRÍTICO: Fuerza a flexbox a limitar su altura activando el scroll interno */
  padding-right: 10px;
}

.character-editor-panel {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

.character-editor-panel #character-editor {
  overflow-y: auto !important;
  flex: 1 !important;
  height: 0 !important; /* CRÍTICO: Fuerza a flexbox a limitar su altura activando el scroll interno */
  padding-right: 10px;
}

.conflict-matrix-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
}

.escalation-lego {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.brain-grid-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 25px;
  margin-bottom: 25px;
}

.brain-diagnostic-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 25px;
}

/* ============================================================
   NEXUS CEREBRO (RADAR ANIMATIONS)
   ============================================================ */

@keyframes spin-radar {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 0.4; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

@keyframes pulse-brain {
  0% { transform: scale(0.95); filter: drop-shadow(0 0 10px var(--accent-coral)); }
  100% { transform: scale(1.05); filter: drop-shadow(0 0 25px var(--accent-coral)); }
}

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

.brain-card-item {
  animation: fadeIn 0.4s ease forwards;
}

/* ============================================================
   NEXUS MOBILE RESPONSIVE ADAPTATIONS (max-width: 768px)
   ============================================================ */

@media (max-width: 768px) {
  /* Identidades */
  .character-lab-container {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
  
  .subjects-panel {
    height: auto !important;
  }
  
  .subjects-panel .character-list-scroll {
    overflow-y: visible !important;
    height: auto !important;
  }
  
  .character-editor-panel {
    height: auto !important;
  }
  
  .character-editor-panel #character-editor {
    overflow-y: visible !important;
    height: auto !important;
  }
  
  /* Modelo Actancial */
  .nexus-actantial-grid {
    grid-template-columns: 1fr !important;
  }
  
  .actantial-infographic {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }
  
  /* Conflictos (Lego) */
  .conflict-matrix-layout {
    grid-template-columns: 1fr !important;
  }
  
  .escalation-lego {
    grid-template-columns: 1fr !important;
  }
  
  .lego-block-wrapper:hover {
    transform: none !important;
  }
  
  /* Beat Sheet (Rayuela) */
  .rayuela-board {
    grid-template-columns: 1fr !important;
  }
  
  .rayuela-step {
    padding: 10px !important;
  }
  
  .rayuela-step textarea {
    min-height: 80px !important;
    font-size: 12px !important;
  }
  
  /* Cerebro */
  .brain-grid-layout {
    grid-template-columns: 1fr !important;
  }
  
  .brain-diagnostic-columns {
    grid-template-columns: 1fr !important;
  }
  
  .journey-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

.journey-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 15px;
}

/* SUB-CONFLICTOS LEGO STACK */
.sub-conflicts-section {
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.sub-conflicts-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-conflict-lego-card {
  position: relative;
  background: rgba(30, 41, 59, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--block-color);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-left: 20px; /* Sangría de apilamiento */
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.sub-conflict-lego-card:hover {
  transform: translateX(6px) scale(1.01);
  background: rgba(30, 41, 59, 0.45) !important;
  box-shadow: -8px 0 20px var(--block-color), 0 6px 15px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Intensidad en sub-conflictos */
.sub-conflict-lego-card .intensity-dot {
  opacity: 0.6;
}

.sub-conflict-lego-card .intensity-dot.active {
  opacity: 1;
  box-shadow: 0 0 8px var(--block-color);
}

/* Responsive para celulares en sub-conflictos */
@media (max-width: 768px) {
  .sub-conflict-lego-card {
    margin-left: 10px !important;
    padding: 10px !important;
  }
}

/* ============================================================
   NEXUS BILLING & CREDIT CARD STYLES (V1.0)
   ============================================================ */

.credit-card-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.glass-credit-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 180px;
  border-radius: 16px;
  padding: 20px;
  color: #ffffff;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.6s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform-style: preserve-3d;
}

.glass-credit-card:hover {
  transform: translateY(-8px) rotateY(10deg);
  box-shadow: 0 25px 45px rgba(0,0,0,0.6), 0 0 25px rgba(255, 255, 255, 0.1);
}

.card-glass-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
  z-index: 1;
}

.glass-credit-card.generic {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.8));
  box-shadow: 0 15px 35px rgba(0,0,0,0.4), inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.glass-credit-card.visa {
  background: linear-gradient(135deg, rgba(10, 37, 64, 0.85), rgba(0, 114, 206, 0.5));
  border-color: rgba(0, 114, 206, 0.4);
  box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 20px rgba(0, 114, 206, 0.2);
}

.glass-credit-card.mastercard {
  background: linear-gradient(135deg, rgba(235, 94, 85, 0.65), rgba(245, 158, 11, 0.45));
  border-color: rgba(235, 94, 85, 0.3);
  box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 20px rgba(235, 94, 85, 0.2);
}

.glass-credit-card.amex {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.65), rgba(45, 212, 191, 0.45));
  border-color: rgba(13, 148, 136, 0.3);
  box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 20px rgba(45, 212, 191, 0.2);
}

.pricing-card {
  position: relative;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s, box-shadow 0.3s !important;
}

.pricing-card:hover {
  transform: translateY(-8px) scale(1.02);
}

.pricing-card.active {
  box-shadow: 0 15px 40px rgba(167, 139, 250, 0.15) !important;
}

.pricing-card.creator:hover {
  border-color: var(--accent-purple) !important;
  box-shadow: 0 15px 45px rgba(167, 139, 250, 0.15), 0 0 25px rgba(167, 139, 250, 0.1) !important;
}

.pricing-card.enterprise:hover {
  border-color: var(--accent-coral) !important;
  box-shadow: 0 15px 45px rgba(235, 94, 85, 0.15), 0 0 25px rgba(235, 94, 85, 0.1) !important;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 0.3; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

@media (max-width: 768px) {
  .pricing-plans-grid {
    grid-template-columns: 1fr !important;
  }
}