@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@500;600;700;800;900&family=Rajdhani:wght@500;600;700&display=swap');

:root,
:root[data-theme="dark"],
:root[data-theme="light"] {
  color-scheme: dark;
  --ground: #0a0608;
  --surface: rgba(22, 12, 16, 0.78);
  --surface-2: rgba(32, 18, 24, 0.88);
  --surface-3: #2c161e;
  --ink: #fff7f9;
  --muted: #bda2aa;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 42, 85, 0.45);
  --blue: #ff2a55;
  --blue-soft: rgba(255, 42, 85, 0.18);
  --red: #ff2a55;
  --red-soft: rgba(255, 42, 85, 0.18);
  --amber: #ffb703;
  --amber-soft: rgba(255, 183, 3, 0.18);
  --gold: #ffd000;
  --green: #05ffa1;
  --green-soft: rgba(5, 255, 161, 0.14);
  --violet: #ff8800;
  --violet-soft: rgba(255, 136, 0, 0.16);
  --shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.75), 0 0 35px rgba(255, 42, 85, 0.15);
  --focus: #ffb703;
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 270px;
  /* Sistema de profundidad e interacción */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --tilt-perspective: 1100px;
  --spot: #ff2a55;
  --spot-soft: rgba(255, 42, 85, 0.16);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 18%, transparent 42%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ground); }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: transparent;
  color: var(--ink);
  font: 400 1rem/1.6 Inter, system-ui, sans-serif;
  letter-spacing: -0.01em;
}
/* Malla Aurora: Rojo y Dorado Fuego */
body::after {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 48% 40% at 82% 8%, rgba(255, 42, 85, 0.38), transparent 68%),
    radial-gradient(ellipse 44% 36% at 12% 84%, rgba(255, 183, 3, 0.32), transparent 68%),
    radial-gradient(ellipse 40% 32% at 50% 50%, rgba(255, 90, 0, 0.20), transparent 70%);
  filter: blur(60px) saturate(1.4);
  will-change: transform;
  animation: aurora-drift 34s var(--ease-out) infinite alternate;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: .20;
  pointer-events: none;
  background-image: 
    linear-gradient(to right, rgba(255, 183, 3, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 42, 85, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 40%, transparent 90%);
}
.cinematic-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  opacity: .52;
  pointer-events: none;
  filter: contrast(1.15) brightness(0.85) saturate(1.2);
  transition: opacity 1s ease;
}
#ambient-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .75; }
.portal-shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
a { color: var(--amber); text-decoration: none; transition: color .2s ease; }
a:hover { color: #fff; }
button, input, textarea, select { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .65rem 1.1rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)), var(--surface-2);
  color: var(--ink);
  font: 600 .88rem Rajdhani, sans-serif;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: all .25s cubic-bezier(.16,1,.3,1);
}
button:hover, .button:hover { 
  transform: translateY(-2px); 
  border-color: var(--amber); 
  background: linear-gradient(180deg, rgba(255,183,3,0.22), rgba(255,42,85,0.1)), var(--surface-2);
  box-shadow: 0 8px 24px rgba(255,183,3,0.3), inset 0 1px 0 rgba(255,255,255,0.25); 
  color: #fff;
}
button.primary, .button.primary { 
  background: linear-gradient(135deg, #ff2a55 0%, #ffb703 100%); 
  border-color: rgba(255,255,255,0.4);
  color: #000;
  font-weight: 800;
  box-shadow: 0 8px 25px rgba(255,42,85,0.4);
}
button.danger { border-color: rgba(255,42,109,0.4); color: #ff91b3; }
button.danger:hover { border-color: var(--red); box-shadow: 0 8px 24px rgba(255,42,109,0.3); }

.portal-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
/* ==========================================================================
   Barra Lateral (Sidebar): Fondo con Color en Movimiento y Navegación Viva
   ========================================================================== */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 20;
  padding: 1.5rem 1.15rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 8, 14, 0.82);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
}

/* Fondo de Color Cósmico en Movimiento Continuo (Aurora Líquida Multicapa) */
.sidebar::before {
  content: "";
  position: absolute;
  inset: -60%;
  z-index: -2;
  pointer-events: none;
  background: 
    radial-gradient(ellipse 55% 45% at 20% 15%, rgba(255, 42, 85, 0.42), transparent 55%),
    radial-gradient(ellipse 50% 50% at 85% 28%, rgba(255, 183, 3, 0.38), transparent 55%),
    radial-gradient(ellipse 60% 50% at 30% 68%, rgba(192, 132, 252, 0.35), transparent 55%),
    radial-gradient(ellipse 50% 45% at 80% 82%, rgba(5, 255, 161, 0.32), transparent 55%),
    radial-gradient(ellipse 45% 45% at 50% 45%, rgba(255, 90, 0, 0.28), transparent 55%);
  filter: blur(42px);
  opacity: 0.95;
  will-change: transform;
  animation: sidebarAuroraMotion 22s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

/* Modo Luis: Colores Celestiales Esmeralda, Cyan y Blanco en Movimiento */
html[data-profile="luis"] .sidebar::before {
  background: 
    radial-gradient(ellipse 55% 45% at 20% 15%, rgba(5, 255, 161, 0.48), transparent 55%),
    radial-gradient(ellipse 50% 50% at 85% 28%, rgba(0, 240, 255, 0.42), transparent 55%),
    radial-gradient(ellipse 60% 50% at 30% 68%, rgba(255, 255, 255, 0.35), transparent 55%),
    radial-gradient(ellipse 50% 45% at 80% 82%, rgba(0, 180, 80, 0.42), transparent 55%),
    radial-gradient(ellipse 45% 45% at 50% 45%, rgba(5, 255, 200, 0.32), transparent 55%);
}

/* Haz de luz neón que recorre el borde derecho */
.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 42, 85, 0.8) 18%,
    rgba(255, 183, 3, 0.9) 42%,
    rgba(192, 132, 252, 0.85) 68%,
    rgba(5, 255, 161, 0.8) 90%,
    transparent 100%
  );
  background-size: 100% 250%;
  animation: sidebarBeamShift 7s linear infinite;
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.5);
}

html[data-profile="luis"] .sidebar::after {
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(5, 255, 161, 0.9) 20%,
    rgba(255, 255, 255, 0.95) 45%,
    rgba(0, 240, 255, 0.85) 70%,
    rgba(5, 255, 161, 0.7) 90%,
    transparent 100%
  );
  background-size: 100% 250%;
  box-shadow: 0 0 10px rgba(5, 255, 161, 0.6);
}

@keyframes sidebarAuroraMotion {
  0% { transform: rotate(0deg) scale(1) translate(0, 0); }
  33% { transform: rotate(4deg) scale(1.1) translate(-25px, 30px); }
  66% { transform: rotate(-5deg) scale(0.96) translate(25px, -20px); }
  100% { transform: rotate(5deg) scale(1.06) translate(-15px, -35px); }
}

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

/* Cabecera / Marca Sentencia */
.brand {
  position: relative;
  z-index: 2;
  display: flex;
  gap: .85rem;
  align-items: center;
  padding: .5rem .5rem 1.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-mark { 
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px; 
  border: 1.5px solid var(--amber);
  border-radius: 12px; 
  background: radial-gradient(circle, rgba(255, 183, 3, 0.32), rgba(255, 42, 85, 0.15) 70%);
  box-shadow: 0 0 25px rgba(255, 42, 85, 0.5), inset 0 0 15px rgba(255, 183, 3, 0.3);
  font-size: 1.3rem; 
  color: var(--amber);
  animation: brandMarkPulse 4s ease-in-out infinite alternate;
}
html[data-profile="luis"] .brand-mark {
  border-color: #05ffa1;
  background: radial-gradient(circle, rgba(5, 255, 161, 0.35), rgba(0, 240, 255, 0.18) 70%);
  box-shadow: 0 0 25px rgba(5, 255, 161, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.3);
  color: #05ffa1;
}
@keyframes brandMarkPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 4px var(--amber)); }
  100% { transform: scale(1.04); filter: drop-shadow(0 0 12px var(--amber)); }
}
.brand strong { 
  display: block;
  font: 800 .92rem Orbitron, sans-serif;
  letter-spacing: .08em;
  background: linear-gradient(135deg, #ffffff 0%, #ffd000 45%, #ff2a55 85%, #ffd000 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: textShine 10s linear infinite;
}
html[data-profile="luis"] .brand strong {
  background: linear-gradient(135deg, #ffffff 0%, #05ffa1 45%, #00f0ff 85%, #ffffff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes textShine {
  to { background-position: 200% center; }
}
.brand small { 
  color: var(--amber);
  font: 700 .72rem Rajdhani, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 183, 3, 0.4);
}
html[data-profile="luis"] .brand small {
  color: #05ffa1;
  text-shadow: 0 0 8px rgba(5, 255, 161, 0.4);
}

.nav-title { 
  margin: 1.4rem .7rem .65rem;
  color: rgba(255, 255, 255, 0.65);
  font: 700 .68rem Orbitron, sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.nav-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), transparent);
}

/* Enlaces y Opciones de Navegación */
.portal-nav {
  position: relative;
  display: grid;
  gap: .42rem;
  z-index: 2;
}
.nav-glider {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  border-radius: 12px;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(90deg, rgba(255, 42, 85, 0.28), rgba(255, 183, 3, 0.18));
  border: 1px solid rgba(255, 183, 3, 0.65);
  box-shadow: 0 0 25px rgba(255, 42, 85, 0.35), inset 0 0 15px rgba(255, 183, 3, 0.2);
  transition: transform 0.32s var(--ease-spring), height 0.28s ease, opacity 0.22s ease;
  opacity: 0;
}
html[data-profile="luis"] .nav-glider {
  background: linear-gradient(90deg, rgba(0, 255, 102, 0.28), rgba(5, 255, 161, 0.18));
  border-color: rgba(5, 255, 161, 0.75);
  box-shadow: 0 0 25px rgba(0, 255, 102, 0.35), inset 0 0 15px rgba(5, 255, 161, 0.2);
}

.portal-nav a { 
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .82rem;
  padding: .72rem .95rem; 
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px; 
  background: rgba(255, 255, 255, 0.025);
  color: rgba(255, 247, 249, 0.88);
  font: 600 .95rem Rajdhani, sans-serif;
  letter-spacing: .04em; 
  transition: all .25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.portal-nav a:hover { 
  color: #ffffff; 
  transform: translateX(5px);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}

/* Iconos de Navegación con Colores Vivos Dedicados */
.portal-nav a .nav-ico {
  display: inline-grid;
  place-items: center;
  font-size: 1.15rem;
  transition: transform 0.25s var(--ease-spring), filter 0.22s ease;
}
.portal-nav a:hover .nav-ico {
  transform: scale(1.25) translateY(-1px);
}

/* 1. Planificación: Oro Solar y Fuego */
.portal-nav a[data-nav-id="planificacion"] .nav-ico {
  color: #ffd000;
  filter: drop-shadow(0 0 8px rgba(255, 208, 0, 0.8));
}
.portal-nav a[data-nav-id="planificacion"]:hover {
  border-color: rgba(255, 208, 0, 0.4);
  background: linear-gradient(90deg, rgba(255, 208, 0, 0.14), rgba(255, 42, 85, 0.08));
}

/* 2. Pokédex: Azul Cyber Neón */
.portal-nav a[data-nav-id="pokedex"] .nav-ico {
  color: #00f0ff;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.8));
}
.portal-nav a[data-nav-id="pokedex"]:hover {
  border-color: rgba(0, 240, 255, 0.4);
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.14), rgba(5, 255, 161, 0.08));
}

/* 3. Personajes: Rosa Rubí Neón */
.portal-nav a[data-nav-id="personajes"] .nav-ico {
  color: #ff477e;
  filter: drop-shadow(0 0 8px rgba(255, 71, 126, 0.8));
}
.portal-nav a[data-nav-id="personajes"]:hover {
  border-color: rgba(255, 71, 126, 0.4);
  background: linear-gradient(90deg, rgba(255, 71, 126, 0.14), rgba(192, 132, 252, 0.08));
}

/* 4. Historia: Ámbar Fuego */
.portal-nav a[data-nav-id="historia"] .nav-ico {
  color: #f59e0b;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8));
}
.portal-nav a[data-nav-id="historia"]:hover {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.14), rgba(255, 42, 85, 0.08));
}

/* 5. Diálogos: Púrpura Eéreo */
.portal-nav a[data-nav-id="dialogos"] .nav-ico {
  color: #c084fc;
  filter: drop-shadow(0 0 8px rgba(192, 132, 252, 0.8));
}
.portal-nav a[data-nav-id="dialogos"]:hover {
  border-color: rgba(192, 132, 252, 0.4);
  background: linear-gradient(90deg, rgba(192, 132, 252, 0.14), rgba(0, 240, 255, 0.08));
}

/* 6. Mapas: Esmeralda Radiante */
.portal-nav a[data-nav-id="mapas"] .nav-ico {
  color: #05ffa1;
  filter: drop-shadow(0 0 8px rgba(5, 255, 161, 0.8));
}
.portal-nav a[data-nav-id="mapas"]:hover {
  border-color: rgba(5, 255, 161, 0.4);
  background: linear-gradient(90deg, rgba(5, 255, 161, 0.14), rgba(0, 200, 100, 0.08));
}

/* 7. Mundo: Azul Celeste Cósmico */
.portal-nav a[data-nav-id="mundo"] .nav-ico {
  color: #38bdf8;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.8));
}
.portal-nav a[data-nav-id="mundo"]:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.14), rgba(0, 240, 255, 0.08));
}

/* 8. Motor: Naranja Plasma */
.portal-nav a[data-nav-id="motor"] .nav-ico {
  color: #fb923c;
  filter: drop-shadow(0 0 8px rgba(251, 146, 60, 0.8));
}
.portal-nav a[data-nav-id="motor"]:hover {
  border-color: rgba(251, 146, 60, 0.4);
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.14), rgba(255, 183, 3, 0.08));
}

/* 9. Música: Fucsia Neón */
.portal-nav a[data-nav-id="musica"] .nav-ico {
  color: #f43f5e;
  filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.8));
}
.portal-nav a[data-nav-id="musica"]:hover {
  border-color: rgba(244, 63, 94, 0.4);
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.14), rgba(255, 42, 85, 0.08));
}

/* 10. Shinies: Destellos Prisma Oro */
.portal-nav a[data-nav-id="shinies"] .nav-ico {
  color: #ffd700;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.95));
  animation: shinyIconPulse 2.4s ease-in-out infinite alternate;
}
.portal-nav a[data-nav-id="shinies"]:hover {
  border-color: rgba(255, 215, 0, 0.5);
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.18), rgba(255, 42, 85, 0.1));
}
@keyframes shinyIconPulse {
  0% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 6px #ffd700); }
  50% { transform: scale(1.22) rotate(12deg); filter: drop-shadow(0 0 14px #ff0077) drop-shadow(0 0 6px #00f0ff); }
  100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 6px #ffd700); }
}

/* Elemento Activo (Página Actual) */
.portal-nav a[aria-current="page"] { 
  color: #ffffff !important;
  font-weight: 700;
  border-color: rgba(255, 183, 3, 0.75) !important;
  background: linear-gradient(90deg, rgba(255, 183, 3, 0.24), rgba(255, 42, 85, 0.14)) !important;
  box-shadow: 
    0 4px 20px rgba(255, 183, 3, 0.25), 
    0 0 14px rgba(255, 42, 85, 0.2), 
    inset 0 0 15px rgba(255, 183, 3, 0.15) !important;
}
html[data-profile="luis"] .portal-nav a[aria-current="page"] {
  border-color: rgba(5, 255, 161, 0.8) !important;
  background: linear-gradient(90deg, rgba(5, 255, 161, 0.25), rgba(0, 240, 255, 0.14)) !important;
  box-shadow: 
    0 4px 20px rgba(5, 255, 161, 0.28), 
    0 0 14px rgba(0, 240, 255, 0.2), 
    inset 0 0 15px rgba(5, 255, 161, 0.15) !important;
}
.portal-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}
html[data-profile="luis"] .portal-nav a[aria-current="page"]::after {
  background: #05ffa1;
  box-shadow: 0 0 10px #05ffa1;
}

.sidebar-footer { 
  position: relative;
  z-index: 2;
  margin-top: 1.5rem; 
  padding: 1rem .65rem; 
  border-top: 1px solid rgba(255, 255, 255, 0.08); 
  color: rgba(255, 255, 255, 0.55); 
  font-size: .78rem; 
  line-height: 1.6; 
}
.search-trigger { 
  position: relative;
  z-index: 2;
  width: 100%; 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  margin-top: .85rem; 
  padding: .65rem .85rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.75);
  font: 600 .85rem Rajdhani, sans-serif;
  cursor: pointer;
  transition: all .25s ease;
}
.search-trigger:hover {
  border-color: var(--amber);
  background: rgba(255, 183, 3, 0.1);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 183, 3, 0.2);
}
.sound-toggle {
  position: relative;
  z-index: 2;
  width: 100%; 
  margin-top: .55rem; 
  justify-content: flex-start;
  padding: .65rem .85rem;
  border-radius: 10px;
  color: var(--ink); 
  background: rgba(255, 255, 255, 0.03); 
  border: 1px solid rgba(255, 255, 255, 0.1);
  font: 600 .85rem Rajdhani, sans-serif;
  cursor: pointer;
  transition: all .25s ease;
}
.sound-toggle:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
}
.sound-toggle[aria-pressed="true"] {
  color: var(--green); 
  border-color: var(--green);
  background: linear-gradient(90deg, rgba(5, 255, 161, 0.16), transparent), rgba(12, 22, 18, 0.7);
  box-shadow: 0 0 16px rgba(5, 255, 161, 0.25), inset 0 1px 0 rgba(255,255,255,.08);
}
.sound-toggle[aria-pressed="false"] { color: var(--muted); box-shadow: none; }
kbd { padding: .15rem .45rem; border: 1px solid rgba(255,183,3,0.35); border-radius: 6px; background: rgba(0,0,0,0.6); color: var(--amber); font: 700 .7rem Rajdhani, sans-serif; }

main { width: 100%; min-width: 0; padding: 2.2rem clamp(1rem, 3.5vw, 4rem) 5rem; }
.masthead { position: relative; display: flex; justify-content: space-between; gap: 2rem; align-items: end; margin: 0 auto 2rem; max-width: 1500px; }
.eyebrow { 
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--amber); font: 700 .74rem Orbitron, sans-serif; letter-spacing: .18em; text-transform: uppercase; 
  margin-bottom: .4rem;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); }
/* Título cromado multicapa: base metálica vertical (luz cenital + línea de
   horizonte) tintada por una pasada neón horizontal que recorre el texto. */
.masthead h1 {
  margin: .3rem 0 .5rem;
  background: linear-gradient(135deg, #ffffff 0%, #ffd000 35%, #ff2a55 75%, #ff8800 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font: 800 clamp(2rem, 4.5vw, 3.8rem)/1.08 Orbitron, sans-serif;
  letter-spacing: .03em;
  filter: drop-shadow(0 4px 20px rgba(255, 42, 85, 0.35));
}
.masthead p { max-width: 820px; margin: 0; color: var(--muted); font-size: 1.05rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .65rem; justify-content: flex-end; }
.content { max-width: 1500px; margin: auto; }

/* Tarjetas Ultra-Glassmorphic: cristal + reflejo superior + borde spotlight.
   La transformación se compone desde variables para que la inclinación 3D
   (JS) y la elevación al hover (CSS) convivan sin pisarse. */
.glass, .card, .panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheen), linear-gradient(145deg, rgba(32, 16, 22, 0.85), rgba(18, 10, 14, 0.78));
  box-shadow: 0 20px 40px -15px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform-style: preserve-3d;
  transform:
    perspective(var(--tilt-perspective))
    rotateX(var(--tilt-x, 0deg))
    rotateY(var(--tilt-y, 0deg))
    translate3d(0, var(--lift, 0px), 0)
    scale(var(--card-scale, 1));
  transition: transform .45s var(--ease-out), border-color .3s ease, box-shadow .3s ease;
  overflow: hidden;
}
/* Mientras el puntero está encima, el JS toma el mando de la inclinación:
   sin transición para que siga al ratón en tiempo real. Al salir vuelve la
   transición larga y la tarjeta se reasienta sola. */
.glass[data-tilting], .card[data-tilting], .panel[data-tilting], .carril-card[data-tilting] {
  transition: border-color .3s ease, box-shadow .3s ease;
}
.card::before, .panel::before, .glass::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(480px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--spot-soft), transparent 42%);
  opacity: 0;
  transition: opacity .4s ease;
}
/* Borde spotlight: anillo de 1px recortado con máscara, iluminado solo en el
   arco más cercano al puntero. */
.card::after, .panel::after, .glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(260px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--spot), transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .35s ease;
}
.card:hover::before, .panel:hover::before, .glass:hover::before,
.card:hover::after, .panel:hover::after, .glass:hover::after { opacity: 1; }
.card:hover, .panel:hover, .glass:hover {
  --lift: -4px;
  border-color: rgba(255, 183, 3, 0.45);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85), 0 0 35px rgba(255, 42, 85, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.card, .panel { padding: 1.35rem; }
.card h2, .card h3, .panel h2, .panel h3 { margin: 0 0 .85rem; font-family: Orbitron, sans-serif; letter-spacing: .05em; }
.card h2, .panel h2 { font-size: 1.12rem; color: #fff; }
.card h3, .panel h3 { font-size: .92rem; color: #e2e8f0; }
.card p:last-child { margin-bottom: 0; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.metric { padding: 1rem; border-left: 3px solid var(--blue); }
.metric strong { display: block; font: 700 1.75rem Orbitron, sans-serif; }
.metric span { color: var(--muted); font-size: .82rem; }
.metric.green { border-color: var(--green); } .metric.amber { border-color: var(--amber); } .metric.red { border-color: var(--red); } .metric.violet { border-color: var(--violet); }
.section { margin-top: 1rem; }
.section-heading,
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; min-width: 0; margin: 2rem 0 .8rem; }
.panel > .section-head:first-child,
.card > .section-head:first-child { margin-top: 0; }
.section-heading h2,
.section-head h2,
.section-head h3 { margin: 0; font-family: Orbitron, sans-serif; letter-spacing: .06em; }
.section-heading h2,
.section-head h2 { font-size: 1.05rem; }
.section-head h3 { font-size: .88rem; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: 1rem; }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.muted { color: var(--muted); }
.mono { font-family: "IBM Plex Mono", Consolas, monospace; overflow-wrap: anywhere; }
.progress {
  display: block;
  position: relative;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: 999px;
  background: linear-gradient(90deg, #00f0ff 0%, #7000ff 50%, #ff007a 100%);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.callout { margin: .85rem 0 0; padding: .8rem .9rem; border: 1px solid var(--amber); border-left-width: 3px; border-radius: var(--radius-sm); background: var(--amber-soft); color: #ffe6a3; }
.callout.ok { border-color: var(--green); background: var(--green-soft); color: #b9ffdf; }
.callout.bad { border-color: var(--red); background: var(--red-soft); color: #ffc0d4; }
.chip-list,
.chip-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; min-width: 0; }
.chip { display: inline-flex; align-items: center; max-width: 100%; padding: .22rem .5rem; border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(6,10,15,.4); color: var(--muted); font: 700 .74rem Rajdhani, sans-serif; overflow-wrap: anywhere; }
.track-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.track-row:last-child { border-bottom: 0; }
.track-row small { display: block; color: var(--muted); }

.badge, .status { display: inline-flex; align-items: center; gap: .38rem; padding: .24rem .6rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font: 700 .74rem Rajdhani, sans-serif; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 2px 10px rgba(0,0,0,.2); max-width: 100%; flex-shrink: 1; overflow-wrap: anywhere; }
/* Punto LED: núcleo sólido + halo que late. El halo es un ::after del propio
   punto, así que hereda el color de estado sin declararlo cuatro veces. */
.badge::before, .status::before {
  content: "";
  position: relative;
  width: 6px; height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor, 0 0 16px currentColor;
  animation: led-blink 2.4s var(--ease-out) infinite;
}
.badge.bad::before, .status.bloqueado::before, .status.pendiente::before { animation-duration: 1.2s; }
.badge.ok::before, .status.hecho::before, .status.activo::before { animation-duration: 3.4s; }
.badge.ok, .status.hecho, .status.activo { color: var(--green); border-color: rgba(5,255,161,.4); background: var(--green-soft); }
.badge.warn, .status.proceso, .status.parcial { color: var(--amber); border-color: rgba(255,183,3,.4); background: var(--amber-soft); }
.badge.bad, .status.bloqueado, .status.pendiente { color: var(--red); border-color: rgba(255,42,109,.4); background: var(--red-soft); }
.badge.info { color: var(--blue); border-color: rgba(0,240,255,.4); background: var(--blue-soft); }
.badge.violet { color: var(--violet); border-color: rgba(217,70,239,.4); background: var(--violet-soft); }

.carril-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheen), linear-gradient(145deg, rgba(16, 24, 38, 0.85), rgba(9, 14, 24, 0.75));
  box-shadow: 0 16px 36px -10px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  --spot: var(--accent, var(--blue));
  transform-style: preserve-3d;
  transform:
    perspective(var(--tilt-perspective))
    rotateX(var(--tilt-x, 0deg))
    rotateY(var(--tilt-y, 0deg))
    translate3d(0, var(--lift, 0px), 0)
    scale(var(--card-scale, 1));
  transition: transform .45s var(--ease-out), border-color .3s ease, box-shadow .3s ease;
}
.carril-card:hover {
  --lift: -5px;
  --card-scale: 1.012;
  border-color: color-mix(in srgb, var(--accent, var(--blue)) 45%, transparent);
  box-shadow: 0 25px 50px -10px rgba(0,0,0,0.8), 0 0 35px var(--accent-soft, var(--blue-soft)), inset 0 1px 0 rgba(255,255,255,0.15);
}
/* Orbe de acento (esquina superior derecha) */
.carril-card::before {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: -50px;
  top: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent, var(--blue)), transparent 70%);
  opacity: .18;
  filter: blur(8px);
  pointer-events: none;
  transition: opacity .4s ease, transform .5s var(--ease-out);
}
.carril-card:hover::before { opacity: .34; transform: scale(1.15); }
/* Borde spotlight teñido con el acento del carril */
.carril-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(260px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--accent, var(--blue)), transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .35s ease;
}
.carril-card:hover::after { opacity: 1; }
.carril-top { display: flex; justify-content: space-between; align-items: start; gap: .6rem; }
.carril-number { font: 800 1.65rem Orbitron, sans-serif; color: var(--accent, var(--blue)); filter: drop-shadow(0 2px 10px var(--accent-soft, var(--blue-soft))); }
.file-list { margin: .75rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .8rem; }
.file-list li { padding: .25rem 0; overflow-wrap: anywhere; }
.file-list li::before { content: "›"; color: var(--accent, var(--blue)); margin-right: .45rem; font-weight: bold; }
.progress { position: relative; height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.08); box-shadow: inset 0 1px 2px rgba(0,0,0,0.5); }
.progress > span {
  position: relative;
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00f0ff 0%, #7c5cff 55%, #d946ef 100%);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.6), 0 0 26px rgba(217, 70, 239, 0.35), inset 0 1px 0 rgba(255,255,255,0.45);
  transition: width .8s var(--ease-out);
  overflow: hidden;
}
/* Destello que recorre la barra llena, más un punto de luz fijo en la cabeza */
.progress > span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.55) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: progress-sweep 2.8s var(--ease-out) infinite;
}

.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: .72rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--blue); font: 700 .72rem Orbitron, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(0,240,255,.035); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.field { display: grid; gap: .3rem; }
.field.full { grid-column: 1 / -1; }
label { color: var(--muted); font: 700 .76rem Rajdhani, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
input, textarea, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: .65rem .75rem; background: rgba(6,10,15,.72); color: var(--ink); }
textarea { min-height: 96px; resize: vertical; }
.toolbar { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 170px; }

/* ==========================================================================
   Sliding Tab Glider (Inspiración: code.xr Navigation Tabs V2)
   ========================================================================== */
.tabs,
.cat-tabs,
.cat-pill-row,
.mobile-view-toggle,
.profile-selector {
  position: relative;
}

.tab-glider {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 42, 85, 0.28), rgba(255, 183, 3, 0.16));
  border: 1px solid rgba(255, 183, 3, 0.5);
  box-shadow: 0 0 18px rgba(255, 42, 85, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.34s var(--ease-spring), width 0.34s var(--ease-spring), height 0.34s var(--ease-spring), opacity 0.2s ease;
  opacity: 0;
  will-change: transform, width, height;
}

.cat-pill-row .tab-glider {
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(255, 42, 85, 0.15));
  border-color: rgba(255, 215, 0, 0.55);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.35);
}

.mobile-view-toggle .tab-glider {
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(112, 0, 255, 0.18));
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.35);
}

.tabs { display: flex; gap: .4rem; max-width: 100%; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.tabs button,
.tabs a,
.cat-pill-row button,
.mobile-view-toggle button { 
  position: relative;
  z-index: 2;
  flex: 0 0 auto; 
  transition: color .2s ease, transform .2s var(--ease-spring);
}
.tabs button:active,
.cat-pill-row button:active,
.mobile-view-toggle button:active {
  transform: scale(0.95);
}
.tabs button[aria-selected="true"],
.tabs button.active { 
  color: #fff; 
  border-color: transparent; 
  background: transparent; 
}
.master-detail { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.6fr); gap: 1rem; }
/* The Pokédex fills these regions after its dataset loads. Reserve a realistic
   first-paint footprint without changing the live region or render flow. */
body[data-page="pokedex"] #metrics:empty { min-height: 7.5rem; }
body[data-page="pokedex"] .master-detail:has(#inventory:empty) { min-height: 38rem; }
body[data-page="pokedex"] #inventory:empty,
body[data-page="pokedex"] #panel:empty { min-height: 27rem; }
.inventory { max-height: 72vh; overflow-y: auto; }
.inventory-item { display: block; width: 100%; margin-bottom: .45rem; text-align: left; }
.inventory-item.active { border-color: var(--blue); background: var(--blue-soft); }
.inventory-item small { display: block; color: var(--muted); }
.stat-bars { display: grid; gap: .45rem; }
.stat-row { display: grid; grid-template-columns: 45px 1fr 42px; gap: .6rem; align-items: center; }
.stat-row .progress { height: 6px; }
pre, code { font-family: "IBM Plex Mono", Consolas, monospace; }
pre { max-width: 100%; overflow-x: auto; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: #04070b; color: #cceff3; }

.dependency-graph { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .7rem; }
.dependency-row { display: grid; grid-template-columns: minmax(120px, .55fr) 40px minmax(0, 1.45fr); align-items: center; gap: .6rem; }
.dependency-node { display: block; min-width: 0; padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(6,10,15,.4); color: var(--ink); }
.dependency-node.active { border-color: var(--blue); background: var(--blue-soft); }
.dependency-node small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.dependency-arrow { color: var(--blue); text-align: center; font-size: 1.4rem; }
.idea-list { display: grid; gap: .7rem; }
.idea { display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: start; padding: .8rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(6,10,15,.35); }

.nav-ico { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: 0 0 18px; }
.nav-ico svg { width: 18px; height: 18px; stroke-width: 1.9; }

.coverage,
.coverage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; }
.coverage-cell { padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(6,10,15,.4); }
.coverage-cell strong { display: block; font: 700 1.45rem Orbitron, sans-serif; color: var(--accent, var(--blue)); }
.coverage-cell small { display: block; margin-bottom: .45rem; color: var(--muted); }

.track { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(6,10,15,.35); }
.track + .track { margin-top: .4rem; }
.track.active { border-color: var(--blue); background: var(--blue-soft); }
.track[aria-disabled="true"] { opacity: .72; }
.track-name { font-weight: 600; overflow-wrap: anywhere; }
.track small { display: block; color: var(--muted); font-size: .78rem; }
.track audio { width: min(320px, 42vw); height: 34px; }
.audio-player,
.player-dock { position: sticky; bottom: 0; z-index: 12; margin-top: 1rem; padding: .8rem 1rem; border: 1px solid var(--blue); border-radius: var(--radius); background: rgba(6,10,15,.96); box-shadow: var(--shadow); }
.audio-player audio,
.player-dock audio { width: 100%; margin-top: .5rem; }
.audio-player .now-playing { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.audio-player .now-playing small { display: block; color: var(--muted); }
.audio-player .audio-error { min-height: 1.4em; margin: .35rem 0 0; color: #ffc0d4; }

.timeline { display: grid; gap: .6rem; padding-left: 1.1rem; border-left: 2px solid var(--line-strong); }
.timeline-item { position: relative; padding: .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(6,10,15,.35); }
.timeline-item::before { content: ""; position: absolute; left: -1.52rem; top: 1.15rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent, var(--blue)); box-shadow: 0 0 10px var(--accent, var(--blue)); }
.timeline-item > span { display: block; margin-bottom: .15rem; color: var(--blue); font: 700 .72rem Orbitron, sans-serif; letter-spacing: .1em; }
.timeline-item strong { display: block; }
.timeline-item p { margin: .2rem 0 0; color: var(--muted); font-size: .82rem; }

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.mode-banner { position: sticky; top: 0; z-index: 15; display: none; margin: -2rem calc(clamp(1rem,3vw,3.5rem) * -1) 1.2rem; padding: .62rem clamp(1rem,3vw,3.5rem); border-bottom: 1px solid var(--amber); background: rgba(45,31,0,.94); color: #ffd86b; }
.mode-banner.visible { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.search-dialog {
  width: min(760px, calc(100vw - 2rem));
  max-width: none;
  max-height: min(720px, calc(100dvh - 2rem));
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--blue) 72%, transparent);
  border-radius: 20px;
  padding: 0;
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(0,0,0,.78), 0 0 0 1px color-mix(in srgb, var(--blue) 18%, transparent), 0 0 38px color-mix(in srgb, var(--blue) 20%, transparent);
  backdrop-filter: blur(12px) saturate(145%);
  -webkit-backdrop-filter: blur(12px) saturate(145%);
}
.search-dialog[open] { animation: palette-in .18s ease-out; }
.search-dialog::backdrop {
  background: rgba(0, 0, 0, .64);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.search-palette { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; max-height: min(720px, calc(100dvh - 2rem)); }
.search-heading {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.1rem .8rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(105deg, color-mix(in srgb, var(--blue) 13%, transparent), transparent 62%);
}
.search-heading-icon {
  display: grid;
  place-items: center;
  flex: 0 0 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid color-mix(in srgb, var(--blue) 60%, transparent);
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 1.45rem;
  box-shadow: 0 0 18px color-mix(in srgb, var(--blue) 20%, transparent);
}
.search-heading > div { min-width: 0; }
.search-heading p { margin: 0 0 .08rem; color: var(--blue); font: 700 .62rem Orbitron, sans-serif; letter-spacing: .14em; text-transform: uppercase; }
.search-heading h2 { margin: 0; font-size: clamp(1rem, 3vw, 1.25rem); }
.search-heading > kbd { margin-left: auto; white-space: nowrap; }
.search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
  margin: .85rem 1rem .55rem;
  padding: .15rem .85rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ground) 52%, transparent);
  box-shadow: inset 0 0 20px rgba(0,0,0,.2), 0 0 0 3px color-mix(in srgb, var(--blue) 7%, transparent);
}
.search-box:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent), 0 0 24px color-mix(in srgb, var(--blue) 15%, transparent); }
.search-box > span { color: var(--blue); font: 800 1.35rem Orbitron, sans-serif; }
.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: .78rem 0;
  background: transparent;
  color: var(--ink);
  font: 600 1rem Inter, sans-serif;
}
.search-box input::placeholder { color: var(--muted); opacity: .78; }
.search-results { min-height: 8rem; max-height: 52vh; overflow: auto; overscroll-behavior: contain; padding: .35rem .65rem .7rem; scrollbar-color: var(--blue) transparent; }
.search-result {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .15rem .8rem;
  margin: .18rem 0;
  padding: .72rem .82rem;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.search-result::before { content: ""; position: absolute; inset: .45rem auto .45rem 0; width: 2px; border-radius: 2px; background: transparent; box-shadow: none; }
.search-result:hover, .search-result.active {
  border-color: color-mix(in srgb, var(--blue) 42%, transparent);
  background: linear-gradient(90deg, var(--blue-soft), color-mix(in srgb, var(--surface) 66%, transparent));
  transform: translateX(2px);
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--blue) 6%, transparent);
}
.search-result.active::before { background: var(--blue); box-shadow: 0 0 11px var(--blue); }
.search-result strong { grid-column: 1; overflow-wrap: anywhere; }
.search-result small { grid-column: 1 / -1; color: var(--muted); overflow-wrap: anywhere; }
.search-category {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  max-width: 15rem;
  overflow: hidden;
  color: var(--blue);
  font: 700 .58rem Orbitron, sans-serif;
  letter-spacing: .07em;
  text-align: right;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.search-result mark {
  border-radius: 3px;
  padding: 0 .08em;
  background: color-mix(in srgb, var(--amber) 32%, transparent);
  color: #fff0a6;
  box-shadow: 0 0 10px color-mix(in srgb, var(--amber) 32%, transparent);
}
.search-help {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  min-height: 2.8rem;
  padding: .55rem 1rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--ground) 44%, transparent);
  color: var(--muted);
  font-size: .7rem;
}
.search-help span { display: inline-flex; align-items: center; gap: .3rem; }
.search-help output { margin-left: auto; color: var(--blue); font-weight: 700; }
.empty { padding: 2.4rem 1rem; text-align: center; color: var(--muted); }
@keyframes palette-in { from { opacity: 0; transform: translateY(-12px) scale(.985); } }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; max-width: min(430px, calc(100vw - 2rem)); padding: .8rem 1rem; border: 1px solid var(--blue); border-radius: 10px; background: var(--surface-2); box-shadow: var(--shadow); animation: toast-in .25s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.mobile-nav { display: none; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: rgba(6,10,15,.94); backdrop-filter: blur(14px); }

/* ---- Motor de animación ---------------------------------------------- */
@keyframes aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  50%  { transform: translate3d(3%, -2.5%, 0) scale(1.12) rotate(4deg); }
  100% { transform: translate3d(-2.5%, 3%, 0) scale(1.05) rotate(-3deg); }
}
@keyframes chrome-sweep {
  from { background-position: 0% 50%, 0 0; }
  to   { background-position: 320% 50%, 0 0; }
}
@keyframes led-blink {
  0%, 62%, 100% { opacity: 1; }
  72%           { opacity: .28; }
  80%           { opacity: 1; }
  88%           { opacity: .45; }
}
@keyframes progress-sweep {
  0%        { transform: translateX(-100%); }
  55%, 100% { transform: translateX(220%); }
}

@media (max-width: 1100px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .master-detail { grid-template-columns: 1fr; }
  body[data-page="pokedex"] #metrics:empty { min-height: 17.5rem; }
  body[data-page="pokedex"] .master-detail:has(#inventory:empty) { min-height: 44rem; }
  body[data-page="pokedex"] #inventory:empty { min-height: 14rem; }
  body[data-page="pokedex"] #panel:empty { min-height: 20rem; }
  .inventory { max-height: 340px; }
}
@media (max-width: 780px) {
  .portal-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-105%); transition: transform .25s ease; }
  body.nav-open .sidebar { transform: translateX(0); }
  .mobile-nav { display: flex; }
  main { padding-top: 1.2rem; }
  .masthead { align-items: start; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .grid.two, .grid.three, .grid.four, .form-grid, .split-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .section-heading, .section-head, .track-row { align-items: flex-start; flex-direction: column; }
  .dependency-graph, .dependency-row { grid-template-columns: 1fr; }
  .dependency-graph > span, .dependency-arrow { transform: rotate(90deg); justify-self: center; }
  .track { grid-template-columns: 1fr; }
  .track audio { width: 100%; }
  .audio-player .now-playing { align-items: flex-start; flex-direction: column; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  body[data-page="pokedex"] #metrics:empty { min-height: 20rem; }
  body[data-page="pokedex"] .master-detail:has(#inventory:empty) { min-height: 34rem; }
  body[data-page="pokedex"] #inventory:empty { min-height: 10rem; }
  body[data-page="pokedex"] #panel:empty { min-height: 14rem; }
  .mode-banner { margin-top: -1.2rem; }
}
@media (max-width: 480px) {
  main { padding-inline: .75rem; }
  .card, .panel { padding: .9rem; }
  .metrics, .metric-grid, .card-grid, .coverage, .coverage-grid { grid-template-columns: 1fr; }
  .page-actions, .page-actions > *, .toolbar > button, .toolbar > .button { width: 100%; }
  body[data-page="pokedex"] #metrics:empty { min-height: 43rem; }
  body[data-page="pokedex"] .master-detail:has(#inventory:empty) { min-height: 25rem; }
  body[data-page="pokedex"] #inventory:empty { min-height: 7rem; }
  body[data-page="pokedex"] #panel:empty { min-height: 9rem; }
  .idea { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  #ambient-canvas { display: none; }
  /* La inclinación 3D es movimiento inducido por el puntero: se anula del
     todo, no solo se acelera. El JS tampoco la aplica en este modo. */
  .glass, .card, .panel, .carril-card {
    --tilt-x: 0deg !important;
    --tilt-y: 0deg !important;
    --lift: 0px !important;
    --card-scale: 1 !important;
  }
  body::after { display: none; }
}
@media print {
  :root { color-scheme: light; --ground: #fff; --surface: #fff; --surface-2: #f4f7fa; --surface-3: #e9eef4; --ink: #111; --muted: #4d5966; --line: #ccd5df; --line-strong: #9dabb9; }
  html, body { width: 100%; max-width: 100%; overflow-x: hidden !important; }
  body { background: #fff; }
  body::before,
  body::after,
  .card::before, .card::after,
  .panel::before, .panel::after,
  .glass::before, .glass::after,
  .carril-card::before, .carril-card::after,
  #ambient-canvas,
  .sidebar,
  .mobile-nav,
  .page-actions,
  .search-trigger,
  [data-open-search],
  .mode-banner,
  .search-dialog,
  .search-dialog[open],
  .no-print { display: none !important; }
  .portal-shell { display: block; width: 100%; min-height: 0; }
  main, .content, .masthead { width: 100%; max-width: none; min-width: 0; }
  main { padding: 0; }
  .masthead h1 { background: none; color: #111; font-size: 26pt; }
  .glass, .card, .panel, .carril-card {
    break-inside: avoid;
    background: #fff;
    color: #111;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: none !important;
  }
  .masthead h1 { animation: none; filter: none; }
  .progress > span { animation: none; box-shadow: none; }
  .table-wrap, .tabs, pre { max-width: 100%; overflow: visible; }
  table { min-width: 0; table-layout: fixed; }
  th, td, pre { overflow-wrap: anywhere; word-break: break-word; }
  pre { white-space: pre-wrap; }
  body[data-page="pokedex"] #metrics:empty,
  body[data-page="pokedex"] .master-detail:has(#inventory:empty),
  body[data-page="pokedex"] #inventory:empty,
  body[data-page="pokedex"] #panel:empty { min-height: 0; }
  body[data-page="pokedex"] .master-detail { display: block; }
  body[data-page="pokedex"] .master-detail > .panel { margin-bottom: 1rem; break-inside: auto; }
  body[data-page="pokedex"] .inventory { max-height: none; overflow: visible; }
  a { color: #111; text-decoration: underline; }
}

/* ==========================================================================
   Temas de Perfil (Alex · Rayquaza / Luis · Dialga)
   ========================================================================== */
html[data-profile="alex"] {
  --ground: #0a0608;
  --surface: rgba(22, 12, 16, 0.78);
  --surface-2: rgba(32, 18, 24, 0.88);
  --surface-3: #2c161e;
  --ink: #fff7f9;
  --muted: #bda2aa;
  --line-strong: rgba(255, 42, 85, 0.45);
  --blue: #ff2a55;
  --blue-soft: rgba(255, 42, 85, 0.18);
  --amber: #ffb703;
  --amber-soft: rgba(255, 183, 3, 0.18);
  --focus: #ffb703;
  --spot: #ff2a55;
  --spot-soft: rgba(255, 42, 85, 0.16);
}
html[data-profile="alex"] body::after {
  background:
    radial-gradient(ellipse 48% 40% at 82% 8%, rgba(255, 42, 85, 0.38), transparent 68%),
    radial-gradient(ellipse 44% 36% at 12% 84%, rgba(255, 183, 3, 0.32), transparent 68%),
    radial-gradient(ellipse 40% 32% at 50% 50%, rgba(255, 90, 0, 0.20), transparent 70%);
}

/* ==========================================================================
   Tema Luis · Ewan (Verde Esmeralda Puro & Negro Obsidiana · Dialga)
   ========================================================================== */
html[data-profile="luis"] {
  --ground: #030604;
  --surface: rgba(4, 14, 8, 0.86);
  --surface-2: rgba(6, 20, 12, 0.92);
  --surface-3: #0a2e1a;
  --ink: #ebfff4;
  --muted: #7ca893;
  --line: rgba(0, 255, 102, 0.14);
  --line-strong: rgba(0, 255, 102, 0.5);
  --blue: #00ff66;
  --blue-soft: rgba(0, 255, 102, 0.18);
  --green: #00ff66;
  --green-soft: rgba(0, 255, 102, 0.18);
  --amber: #00ff66;
  --amber-soft: rgba(0, 255, 102, 0.18);
  --gold: #00ff66;
  --focus: #00ff66;
  --spot: #00ff66;
  --spot-soft: rgba(0, 255, 102, 0.18);
  --shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.92), 0 0 35px rgba(0, 255, 102, 0.22);
}
html[data-profile="luis"] body::after {
  background:
    radial-gradient(ellipse 48% 40% at 82% 8%, rgba(0, 255, 102, 0.32), transparent 68%),
    radial-gradient(ellipse 44% 36% at 12% 84%, rgba(5, 255, 161, 0.28), transparent 68%),
    radial-gradient(ellipse 40% 32% at 50% 50%, rgba(0, 180, 70, 0.16), transparent 70%);
}
html[data-profile="luis"] .sidebar {
  background: rgba(4, 10, 6, 0.94);
  border-right-color: rgba(0, 255, 102, 0.15);
}
html[data-profile="luis"] .eyebrow {
  color: #00ff66;
}
html[data-profile="luis"] .eyebrow::before {
  background: #00ff66;
  box-shadow: 0 0 12px #00ff66;
}
html[data-profile="luis"] .masthead h1 {
  background: linear-gradient(135deg, #ffffff 0%, #00ff66 45%, #00cc55 85%);
  -webkit-background-clip: text;
  filter: drop-shadow(0 4px 20px rgba(0, 255, 102, 0.4));
}
html[data-profile="luis"] .brand-mark {
  border-color: #00ff66;
  background: radial-gradient(circle, rgba(0, 255, 102, 0.28), transparent);
  box-shadow: 0 0 25px rgba(0, 255, 102, 0.45);
  color: #00ff66;
}
html[data-profile="luis"] .brand strong {
  background: linear-gradient(135deg, #ffffff, #00ff66);
  -webkit-background-clip: text;
}
html[data-profile="luis"] .brand small {
  color: #00ff66;
}
html[data-profile="luis"] .portal-nav a {
  color: #7ca893;
}
html[data-profile="luis"] .portal-nav a:hover {
  border-color: rgba(0, 255, 102, 0.2);
  background: rgba(0, 255, 102, 0.06);
  color: #ebfff4;
}
html[data-profile="luis"] .portal-nav a[aria-current="page"] {
  border-color: rgba(0, 255, 102, 0.7);
  background: linear-gradient(90deg, rgba(0, 255, 102, 0.22), rgba(0, 255, 102, 0.05));
  color: #00ff66;
  box-shadow: inset 0 0 15px rgba(0, 255, 102, 0.15), 0 4px 15px rgba(0,0,0,0.5);
}
html[data-profile="luis"] .portal-nav a[aria-current="page"] .nav-ico {
  color: #00ff66;
  filter: drop-shadow(0 0 8px #00ff66);
}
html[data-profile="luis"] kbd {
  border-color: rgba(0, 255, 102, 0.3);
  background: rgba(0, 0, 0, 0.6);
  color: #00ff66;
}
html[data-profile="luis"] button.primary,
html[data-profile="luis"] .button.primary {
  background: linear-gradient(135deg, #00ff66 0%, #00b347 100%);
  color: #000;
  font-weight: 800;
  box-shadow: 0 8px 25px rgba(0, 255, 102, 0.45);
}
html[data-profile="luis"] .glass,
html[data-profile="luis"] .card,
html[data-profile="luis"] .panel {
  background: var(--sheen), linear-gradient(145deg, rgba(6, 18, 11, 0.88), rgba(2, 8, 5, 0.84));
  border-color: rgba(0, 255, 102, 0.14);
}
html[data-profile="luis"] .card:hover,
html[data-profile="luis"] .panel:hover,
html[data-profile="luis"] .glass:hover {
  border-color: rgba(0, 255, 102, 0.55);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 35px rgba(0, 255, 102, 0.3), inset 0 1px 0 rgba(0, 255, 102, 0.2);
}
html[data-profile="luis"] .progress > span {
  background: linear-gradient(90deg, #00ff66 0%, #00cc55 100%);
  box-shadow: 0 0 15px rgba(0, 255, 102, 0.75);
}

/* ==========================================================================
   Widget de Perfil en Sidebar
   ========================================================================== */
.profile-widget {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding: .95rem .85rem;
  margin: 1rem 0 .6rem;
  border: 1px solid rgba(255, 183, 3, 0.35);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 42, 85, 0.14), rgba(255, 183, 3, 0.08) 50%, rgba(20, 10, 15, 0.65));
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 42, 85, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(14px);
  transition: all 0.3s ease;
}
html[data-profile="luis"] .profile-widget {
  border-color: rgba(5, 255, 161, 0.4);
  background: linear-gradient(135deg, rgba(5, 255, 161, 0.14), rgba(0, 240, 255, 0.08) 50%, rgba(10, 20, 15, 0.65));
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(5, 255, 161, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.profile-widget-top {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.profile-widget span.profile-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 1.4rem;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(255, 42, 85, 0.6));
  transition: transform 0.25s ease;
}
.profile-widget:hover span.profile-avatar {
  transform: scale(1.1) rotate(6deg);
}
html[data-profile="luis"] span.profile-avatar {
  filter: drop-shadow(0 0 10px rgba(5, 255, 161, 0.6));
}
.profile-widget .profile-identity {
  flex: 1;
  min-width: 0;
}
.profile-widget .profile-identity strong {
  display: block;
  font: 700 0.95rem Orbitron, sans-serif;
  color: #fff;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}
.profile-widget .profile-identity small {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: rgba(255, 255, 255, 0.75);
  font: 600 .74rem Rajdhani, sans-serif;
  letter-spacing: .03em;
  white-space: nowrap;
}
.profile-widget .profile-identity small i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #05ffa1;
  box-shadow: 0 0 10px #05ffa1;
  animation: statusPulse 2s ease-in-out infinite alternate;
}
@keyframes statusPulse {
  0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 6px #05ffa1; }
  100% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px #05ffa1; }
}
/* Botón interactivo de la Mascota Legendaria en el Header */
.mascot-companion-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(6, 10, 15, 0.6));
  cursor: pointer;
  overflow: visible;
  transition: transform 0.25s var(--ease-spring), border-color 0.25s ease, box-shadow 0.25s ease;
}
.mascot-companion-btn:hover {
  transform: translateY(-2px) scale(1.08);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(255, 208, 0, 0.35);
}
.mascot-companion-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px rgba(5, 255, 161, 0.6));
  animation: companionFloat 2.8s ease-in-out infinite;
  pointer-events: none;
}
.mascot-companion-img.dialga-mascot {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.7));
}
.mascot-companion-btn.roar-jump {
  animation: mascotRoarJump 0.45s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes companionFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.04); }
}
@keyframes mascotRoarJump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) translateY(-8px) rotate(-8deg); }
  70% { transform: scale(1.15) translateY(-3px) rotate(4deg); }
  100% { transform: scale(1); }
}
.mascot-sparkle-fx {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  font-size: 1.1rem;
  animation: sparkleFly 0.75s ease-out forwards;
}
@keyframes sparkleFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.6);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx, 20px), var(--ty, -40px)) scale(1.3);
  }
}
.profile-logout {
  width: 100%;
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 600 .74rem Rajdhani, sans-serif;
  letter-spacing: .04em;
  cursor: pointer;
  transition: all .2s ease;
}
.profile-logout:hover {
  border-color: var(--red);
  background: var(--red-soft);
  color: #ff91b3;
}

/* ==========================================================================
   Pantalla de Login (login.html)
   ========================================================================== */
.login-container {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}
.login-card-wrapper {
  position: relative;
  width: 100%;
  max-width: 486px;
  display: flex;
  justify-content: center;
  align-items: center;
}
/* Lienzo de Fuego Vivo en Tiempo Real (Lenguas de llama orgánicas y ascuas) */
.card-flame-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.4s ease;
  overflow: visible;
}
/* Aura térmica circundante difusa como refuerzo suave del fuego */
.login-flame-aura {
  position: absolute;
  inset: -6px;
  border-radius: 28px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  filter: blur(16px);
  transition: opacity 0.5s ease, filter 0.5s ease;
  will-change: transform, opacity;
}
/* Alex / Draco: Fuego Dorado y Rojo Color Sangre */
body[data-selected="alex"] .login-flame-aura {
  background: conic-gradient(
    from var(--flame-rot, 0deg) at 50% 50%,
    #b3001e 0%,
    #ffd700 24%,
    #800014 44%,
    #ff6600 64%,
    #ff0033 82%,
    #b3001e 100%
  );
  box-shadow: 
    0 0 45px rgba(179, 0, 30, 0.75), 
    0 0 95px rgba(255, 208, 0, 0.45),
    0 0 140px rgba(128, 0, 20, 0.35);
  animation: flameSpin 6s linear infinite, flamePulse 2.4s ease-in-out infinite alternate;
}
body[data-selected="alex"] .login-card {
  border: 1.8px solid rgba(255, 215, 0, 0.6) !important;
  box-shadow: 
    0 25px 65px -15px rgba(0, 0, 0, 0.9), 
    0 0 35px rgba(179, 0, 30, 0.65), 
    0 0 70px rgba(255, 208, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 0 25px rgba(179, 0, 30, 0.28) !important;
}
/* Luis / Ewan: Fuego Celestial Verde y Blanco */
body[data-selected="luis"] .login-flame-aura {
  background: conic-gradient(
    from var(--flame-rot, 0deg) at 50% 50%,
    #05ffa1 0%,
    #ffffff 24%,
    #00994d 44%,
    #d1fae5 64%,
    #00ff88 82%,
    #05ffa1 100%
  );
  box-shadow: 
    0 0 45px rgba(5, 255, 161, 0.75), 
    0 0 95px rgba(255, 255, 255, 0.55),
    0 0 140px rgba(0, 204, 102, 0.35);
  animation: flameSpin 6s linear infinite, flamePulse 2.4s ease-in-out infinite alternate;
}
body[data-selected="luis"] .login-card {
  border: 1.8px solid rgba(255, 255, 255, 0.75) !important;
  box-shadow: 
    0 25px 65px -15px rgba(0, 0, 0, 0.9), 
    0 0 35px rgba(5, 255, 161, 0.65), 
    0 0 70px rgba(255, 255, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 25px rgba(5, 255, 161, 0.25) !important;
}
@keyframes flamePulse {
  0% { transform: scale(0.97); opacity: 0.75; filter: blur(20px); }
  100% { transform: scale(1.03); opacity: 0.95; filter: blur(28px); }
}
@property --flame-rot {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes flameSpin {
  from { --flame-rot: 0deg; }
  to { --flame-rot: 360deg; }
}
/* Ascuas flotantes */
.login-embers-aura {
  position: absolute;
  inset: -25px;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.ember {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: emberRise 3s infinite ease-in-out;
  opacity: 0;
}
body[data-selected="alex"] .ember {
  background: #ffd700;
  box-shadow: 0 0 10px #ff0033, 0 0 18px #ffd700;
}
body[data-selected="luis"] .ember {
  background: #ffffff;
  box-shadow: 0 0 10px #05ffa1, 0 0 18px #ffffff;
}
.e1 { left: 5%; bottom: 10%; width: 5px; height: 5px; animation-duration: 2.8s; animation-delay: 0.1s; }
.e2 { left: 15%; bottom: 5%; width: 6px; height: 6px; animation-duration: 3.4s; animation-delay: 0.6s; }
.e3 { right: 8%; bottom: 12%; width: 5px; height: 5px; animation-duration: 3.1s; animation-delay: 0.3s; }
.e4 { right: 18%; bottom: 4%; width: 7px; height: 7px; animation-duration: 3.7s; animation-delay: 0.9s; }
.e5 { left: -6px; top: 40%; width: 5px; height: 5px; animation-duration: 2.9s; animation-delay: 0.4s; }
.e6 { right: -6px; top: 45%; width: 6px; height: 6px; animation-duration: 3.2s; animation-delay: 0.8s; }
.e7 { left: 28%; bottom: 2%; width: 4px; height: 4px; animation-duration: 2.6s; animation-delay: 1.2s; }
.e8 { right: 30%; bottom: 2%; width: 5px; height: 5px; animation-duration: 3.5s; animation-delay: 1.5s; }
@keyframes emberRise {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  30% { opacity: 0.95; transform: translateY(-40px) scale(1.2); }
  75% { opacity: 0.7; transform: translateY(-95px) scale(0.9); }
  100% { opacity: 0; transform: translateY(-145px) scale(0.3); }
}
.login-card-wrapper:has(.unlock-dissolve) .login-flame-aura,
.login-card-wrapper:has(.unlock-dissolve) .login-embers-aura,
.login-card-wrapper:has(.unlock-dissolve) .card-flame-canvas,
.login-card.unlock-dissolve ~ .login-flame-aura,
.login-card.unlock-dissolve ~ .card-flame-canvas {
  opacity: 0 !important;
  transition: opacity 0.25s ease !important;
}
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  padding: 2.5rem 2rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px var(--blue-soft);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease, filter 0.5s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
.login-card.unlock-dissolve {
  transform: scale(0.65) translateY(-30px) !important;
  opacity: 0 !important;
  filter: blur(25px) !important;
  pointer-events: none !important;
}
.login-header .login-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: .8rem;
  border: 1px solid var(--blue);
  border-radius: 14px;
  background: radial-gradient(circle, var(--blue-soft), transparent);
  box-shadow: 0 0 30px var(--blue-soft);
  font-size: 1.6rem;
  color: var(--blue);
}
.login-header h1 {
  margin: .3rem 0 .5rem;
  font: 800 1.9rem Orbitron, sans-serif;
  letter-spacing: .04em;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  color: transparent;
}
.login-header p {
  color: var(--muted);
  font-size: .92rem;
  margin: 0 0 1.8rem;
}
.profile-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  margin-bottom: 1.8rem;
}
.profile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 1.35rem 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(14, 8, 12, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.profile-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.card-hologram-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    125deg,
    transparent 20%,
    rgba(255, 255, 255, 0.06) 35%,
    rgba(255, 208, 0, 0.12) 48%,
    transparent 65%
  );
  opacity: 0;
  transform: translateX(-100%);
  transition: opacity 0.3s ease, transform 0.65s ease;
}
.profile-card:hover .card-hologram-fx {
  opacity: 1;
  transform: translateX(100%);
}
.profile-crest-box {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.65));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 8px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.alex-crest {
  background: radial-gradient(circle at 50% 40%, rgba(255, 42, 85, 0.22), rgba(12, 6, 8, 0.85));
  border-color: rgba(255, 42, 85, 0.35);
}
.luis-crest {
  background: radial-gradient(circle at 50% 40%, rgba(0, 240, 255, 0.22), rgba(6, 12, 20, 0.85));
  border-color: rgba(0, 240, 255, 0.35);
}
.crest-pedestal {
  position: absolute;
  bottom: 6px;
  width: 52px;
  height: 14px;
  border-radius: 50%;
  filter: blur(4px);
  pointer-events: none;
  opacity: 0.75;
  transition: all 0.3s ease;
}
.alex-crest .crest-pedestal {
  background: radial-gradient(ellipse at center, #ffd000, #ff2a55 60%, transparent);
}
.luis-crest .crest-pedestal {
  background: radial-gradient(ellipse at center, #05ffa1, #00f0ff 60%, transparent);
}
.profile-pokemon-sprite {
  position: relative;
  width: 62px;
  height: 62px;
  object-fit: contain;
  image-rendering: pixelated;
  z-index: 2;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.35s ease;
  pointer-events: none;
}
.rayquaza-crest-sprite {
  filter: drop-shadow(0 0 10px rgba(255, 208, 0, 0.8)) drop-shadow(0 0 20px rgba(255, 42, 85, 0.5));
}
.dialga-crest-sprite {
  filter: drop-shadow(0 0 10px rgba(5, 255, 161, 0.8)) drop-shadow(0 0 20px rgba(0, 240, 255, 0.5));
}
.profile-info {
  text-align: center;
}
.profile-card strong {
  display: block;
  font: 900 1.25rem 'Orbitron', sans-serif;
  letter-spacing: 0.08em;
  color: #ffffff;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}
.profile-card small {
  display: block;
  margin-top: 0.15rem;
  font: 700 0.72rem 'Rajdhani', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s ease;
}
.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.95rem;
  border-radius: 999px;
  font: 800 0.78rem 'Orbitron', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.3s ease;
}
.badge-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.alex-card .profile-badge {
  background: rgba(255, 42, 85, 0.14);
  border: 1px solid rgba(255, 42, 85, 0.4);
  color: #ff6b8b;
}
.alex-card .badge-dot {
  background: #ff2a55;
  box-shadow: 0 0 8px #ff2a55;
}
.luis-card .profile-badge {
  background: rgba(0, 240, 255, 0.14);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #5ce1e6;
}
.luis-card .badge-dot {
  background: #00f0ff;
  box-shadow: 0 0 8px #00f0ff;
}
.profile-card:hover {
  transform: translateY(-4px);
}
.alex-card:hover {
  border-color: rgba(255, 42, 85, 0.6);
  box-shadow: 0 16px 35px -8px rgba(255, 42, 85, 0.35), 0 0 20px rgba(255, 208, 0, 0.2);
}
.luis-card:hover {
  border-color: rgba(0, 240, 255, 0.6);
  box-shadow: 0 16px 35px -8px rgba(0, 240, 255, 0.35), 0 0 20px rgba(5, 255, 161, 0.2);
}
.profile-card:hover .profile-crest-box {
  transform: scale(1.08) translateY(-2px);
}
.profile-card:hover .profile-pokemon-sprite {
  transform: scale(1.1) translateY(-3px);
}
.alex-card.active {
  border-color: #ff2a55 !important;
  background: linear-gradient(170deg, rgba(255, 42, 85, 0.24) 0%, rgba(255, 183, 3, 0.08) 55%, rgba(14, 8, 12, 0.85) 100%) !important;
  box-shadow: 0 0 30px rgba(255, 42, 85, 0.45), 0 16px 35px -8px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
  transform: translateY(-3px);
}
.alex-card.active strong {
  color: #ffffff;
  text-shadow: 0 0 14px rgba(255, 42, 85, 0.75);
}
.alex-card.active .profile-badge {
  background: rgba(255, 42, 85, 0.3);
  border-color: #ff2a55;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 42, 85, 0.5);
}
.alex-card.active .badge-dot {
  animation: dotPulsar 1.4s ease-in-out infinite alternate;
}
.luis-card.active {
  border-color: #00f0ff !important;
  background: linear-gradient(170deg, rgba(0, 240, 255, 0.24) 0%, rgba(5, 255, 161, 0.08) 55%, rgba(6, 12, 20, 0.85) 100%) !important;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.45), 0 16px 35px -8px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
  transform: translateY(-3px);
}
.luis-card.active strong {
  color: #ffffff;
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.75);
}
.luis-card.active .profile-badge {
  background: rgba(0, 240, 255, 0.3);
  border-color: #00f0ff;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.5);
}
.luis-card.active .badge-dot {
  animation: dotPulsar 1.4s ease-in-out infinite alternate;
}
@keyframes dotPulsar {
  0% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 4px currentColor; }
  100% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 12px currentColor; }
}
.login-field {
  text-align: left;
  margin-bottom: 1.5rem;
}
.login-field label {
  display: block;
  margin-bottom: .4rem;
  font: 700 .74rem Rajdhani, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ==========================================================================
   Efecto Borde de Carga Eléctrica (Inspiración Reel 1: _code_and_chill_)
   ========================================================================== */
@property --charge-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes electric-spin {
  from { --charge-angle: 0deg; transform: rotate(0deg); }
  to { --charge-angle: 360deg; transform: rotate(360deg); }
}

.electric-charge-wrap {
  position: relative;
  border-radius: calc(var(--radius-sm) + 2px);
  padding: 2px;
  background: transparent;
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease-out);
  --charge-speed: 2.8s;
  --beam-glow: rgba(255, 42, 85, 0.45);
  --beam-c1: #ff2a55;
  --beam-c2: #ffd000;
  --beam-head: #ffffff;
}

body[data-page="login"][data-selected="luis"] .electric-charge-wrap {
  --beam-glow: rgba(0, 255, 102, 0.45);
  --beam-c1: #00ff66;
  --beam-c2: #05ffa1;
}

.electric-charge-wrap::before {
  content: "";
  position: absolute;
  inset: -100%;
  background: conic-gradient(
    from var(--charge-angle, 0deg),
    transparent 0deg,
    transparent 260deg,
    var(--beam-glow) 305deg,
    var(--beam-c1) 330deg,
    var(--beam-c2) 350deg,
    var(--beam-head) 360deg
  );
  animation: electric-spin var(--charge-speed) linear infinite;
  z-index: 0;
  opacity: 0.75;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.electric-charge-wrap .inner-input-box {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 20, 0.94);
  backdrop-filter: blur(16px);
}

.electric-spark {
  padding-left: .9rem;
  font-size: 1.1rem;
  color: var(--amber);
  filter: drop-shadow(0 0 6px var(--amber));
  animation: spark-pulse 1.8s ease infinite;
  user-select: none;
}
@keyframes spark-pulse {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.15); filter: drop-shadow(0 0 10px var(--gold)); }
}

.electric-charge-wrap:focus-within {
  --charge-speed: 1.1s;
  box-shadow: 0 0 25px var(--beam-glow), inset 0 0 10px var(--beam-glow);
}
.electric-charge-wrap:focus-within::before {
  opacity: 1;
  filter: brightness(1.3) drop-shadow(0 0 6px var(--beam-c1));
}

.electric-charge-wrap.typing {
  --charge-speed: 0.7s;
  box-shadow: 0 0 35px var(--beam-glow), 0 0 15px var(--beam-c2);
}

.login-field input {
  width: 100%;
  padding: .85rem 1rem;
  border: none !important;
  border-radius: var(--radius-sm);
  background: transparent !important;
  color: #fff;
  font-size: 1rem;
  outline: none !important;
  box-shadow: none !important;
}

.pwd-toggle-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  padding: .5rem .8rem;
  cursor: pointer;
  transition: transform .2s ease, color .2s ease;
}
.pwd-toggle-btn:hover {
  transform: scale(1.15);
  color: #fff;
}

.login-error {
  min-height: 1.4rem;
  margin-top: .4rem;
  color: var(--red);
  font: 600 .82rem Rajdhani, sans-serif;
}
.login-submit {
  width: 100%;
  padding: .9rem 1.2rem;
  font-size: 1rem;
  transition: all .25s var(--ease-spring);
}
.login-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 25px var(--blue-soft);
}
.login-submit:active:not(:disabled) {
  transform: scale(0.97);
}
.login-submit.success {
  background: linear-gradient(135deg, var(--green), #00b4d8);
  color: #000;
  box-shadow: 0 0 30px rgba(5, 255, 161, 0.5);
}

/* Sello de Verificación Fusionado (Verified Seal Animation) */
/* ==========================================================================
   Cinematic Unlock Stage: Draco (Rayquaza) vs Ewan (Dialga)
   ========================================================================== */
.cinematic-unlock-stage {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  overflow: hidden;
}

.cinematic-unlock-stage.active {
  opacity: 1;
  pointer-events: auto;
}

.cinematic-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(10, 6, 8, 0.76) 0%, rgba(5, 3, 4, 0.95) 85%);
  backdrop-filter: blur(14px);
}

#unlock-particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.unlock-hero-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 540px;
  width: 90%;
  padding: 2.6rem 2.2rem;
  border-radius: 24px;
  background: rgba(14, 18, 24, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: scale(0.85) translateY(20px);
  animation: hero-card-enter 0.65s var(--ease-spring) forwards;
}

@keyframes hero-card-enter {
  to { transform: scale(1) translateY(0); }
}

.unlock-mandala-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin-bottom: 1.2rem;
  display: grid;
  place-items: center;
}

.lottie-animation-box {
  position: absolute;
  inset: -30px;
  width: calc(100% + 60px);
  height: calc(100% + 60px);
  z-index: 2;
  pointer-events: none;
}

/* Impacto Cinemático con Aberración Cromática y Screen Shake */
@keyframes cinematic-screen-punch {
  0% {
    transform: scale(1);
    filter: none;
  }
  15% {
    transform: scale(1.035) translate(-4px, 2px);
    filter: drop-shadow(6px 0 0 rgba(255, 42, 85, 0.75)) drop-shadow(-6px 0 0 rgba(0, 240, 255, 0.75));
  }
  35% {
    transform: scale(1.02) translate(4px, -3px);
    filter: drop-shadow(-4px 0 0 rgba(255, 42, 85, 0.55)) drop-shadow(4px 0 0 rgba(0, 240, 255, 0.55));
  }
  55% {
    transform: scale(1.008) translate(-2px, 1px);
    filter: drop-shadow(2px 0 0 rgba(255, 42, 85, 0.35)) drop-shadow(-2px 0 0 rgba(0, 240, 255, 0.35));
  }
  100% {
    transform: scale(1) translate(0, 0);
    filter: none;
  }
}

.screen-punch {
  animation: cinematic-screen-punch 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.mandala-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mandala-ring-outer {
  transform-origin: center;
  animation: mandala-spin-cw 14s linear infinite;
}
.mandala-ring-inner {
  transform-origin: center;
  animation: mandala-spin-ccw 9s linear infinite;
}

@keyframes mandala-spin-cw {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes mandala-spin-ccw {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

.unlock-avatar-symbol {
  position: relative;
  z-index: 3;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  box-shadow: 0 0 35px currentColor;
  animation: avatar-pulse 2s ease-in-out infinite;
}

@keyframes avatar-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px currentColor); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 25px currentColor); }
}

.unlock-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .95rem;
  border-radius: 999px;
  font: 800 .72rem Orbitron, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: .7rem;
}

.unlock-main-title {
  margin: 0 0 .35rem;
  font: 900 clamp(1.3rem, 3.2vw, 1.8rem) Orbitron, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.unlock-sub-title {
  margin: 0 0 1.4rem;
  font: 600 .92rem Rajdhani, sans-serif;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}

.unlock-terminal-feed {
  width: 100%;
  padding: .85rem 1.1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font: 500 .8rem "IBM Plex Mono", Consolas, monospace;
  text-align: left;
  line-height: 1.5;
  margin-bottom: 1.2rem;
  min-height: 68px;
}
.unlock-terminal-feed .feed-line {
  display: flex;
  align-items: center;
  gap: .5rem;
  opacity: 0;
  transform: translateX(-6px);
  animation: feed-line-in 0.35s var(--ease-out) forwards;
}
.unlock-terminal-feed .feed-line:nth-child(1) { animation-delay: 0.15s; }
.unlock-terminal-feed .feed-line:nth-child(2) { animation-delay: 0.65s; }
.unlock-terminal-feed .feed-line:nth-child(3) { animation-delay: 1.15s; }

@keyframes feed-line-in {
  to { opacity: 1; transform: translateX(0); }
}

.unlock-meter-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}
.unlock-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 1.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 16px currentColor;
}

/* Tema A: DRACO (Alex / Rayquaza) */
.cinematic-unlock-stage.draco-mode .unlock-hero-card {
  border-color: rgba(255, 42, 85, 0.45);
  box-shadow: 0 25px 80px -10px rgba(0, 0, 0, 0.9), 0 0 60px rgba(255, 42, 85, 0.35);
}
.cinematic-unlock-stage.draco-mode .unlock-badge-pill {
  background: rgba(255, 42, 85, 0.18);
  border: 1px solid var(--red);
  color: #ff91a5;
  box-shadow: 0 0 20px rgba(255, 42, 85, 0.4);
}
.cinematic-unlock-stage.draco-mode .unlock-avatar-symbol {
  background: radial-gradient(circle, rgba(255, 42, 85, 0.35), rgba(255, 183, 3, 0.2) 70%, transparent);
  border: 2px solid var(--amber);
  color: var(--gold);
}
.cinematic-unlock-stage.draco-mode .unlock-main-title {
  background: linear-gradient(135deg, #ffffff 10%, #ffd000 60%, #ff2a55 100%);
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: 0 0 35px rgba(255, 42, 85, 0.6);
}
.cinematic-unlock-stage.draco-mode .unlock-meter-fill {
  background: linear-gradient(90deg, #05ffa1 0%, #ffb703 50%, #ff2a55 100%);
  color: #ff2a55;
}
.cinematic-unlock-stage.draco-mode .unlock-terminal-feed {
  color: #05ffa1;
  border-color: rgba(255, 42, 85, 0.25);
}

/* Tema B: EWAN (Luis / Dialga) */
.cinematic-unlock-stage.ewan-mode .unlock-hero-card {
  border-color: rgba(0, 240, 255, 0.45);
  box-shadow: 0 25px 80px -10px rgba(0, 0, 0, 0.9), 0 0 60px rgba(0, 240, 255, 0.35);
}
.cinematic-unlock-stage.ewan-mode .unlock-badge-pill {
  background: rgba(0, 240, 255, 0.18);
  border: 1px solid #00f0ff;
  color: #a5f3fc;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}
.cinematic-unlock-stage.ewan-mode .unlock-avatar-symbol {
  background: radial-gradient(circle, rgba(0, 240, 255, 0.35), rgba(5, 255, 161, 0.2) 70%, transparent);
  border: 2px solid #00f0ff;
  color: #00f0ff;
}
.cinematic-unlock-stage.ewan-mode .unlock-main-title {
  background: linear-gradient(135deg, #ffffff 10%, #00f0ff 60%, #05ffa1 100%);
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: 0 0 35px rgba(0, 240, 255, 0.6);
}
.cinematic-unlock-stage.ewan-mode .unlock-meter-fill {
  background: linear-gradient(90deg, #7000ff 0%, #00f0ff 50%, #05ffa1 100%);
  color: #00f0ff;
}
.cinematic-unlock-stage.ewan-mode .unlock-terminal-feed {
  color: #00f0ff;
  border-color: rgba(0, 240, 255, 0.25);
}

/* Spotlight Glow Interactivo en Tarjetas y Paneles */
.card, .panel, .login-card, .metric, .carril-card {
  position: relative;
}
.card::after, .panel::after, .login-card::after, .carril-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mouse-x, -999px) var(--mouse-y, -999px), rgba(255, 42, 85, 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}
html[data-profile="luis"] .card::after,
html[data-profile="luis"] .panel::after,
html[data-profile="luis"] .carril-card::after {
  background: radial-gradient(420px circle at var(--mouse-x, -999px) var(--mouse-y, -999px), rgba(0, 255, 102, 0.12), transparent 70%);
}
.card:hover::after, .panel:hover::after, .login-card:hover::after, .carril-card:hover::after {
  opacity: 1;
}

.login-footer {
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: .78rem;
}

/* Animación Shake en error */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake {
  animation: shake .4s cubic-bezier(.36,.07,.19,.97) both;
}

/* ==========================================================================
   Fondo Dual de Pantalla Dividida (Login: Rayquaza vs Dialga)
   ========================================================================== */
.split-bg-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.split-side {
  position: relative;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: width 0.7s cubic-bezier(.16, 1, .3, 1), opacity 0.5s ease, filter 0.5s ease;
}
.split-side.alex-side {
  background: radial-gradient(circle at 30% 50%, rgba(255, 42, 85, 0.25), transparent 70%);
}
.split-side.luis-side {
  background: radial-gradient(circle at 70% 50%, rgba(0, 255, 102, 0.22), transparent 70%);
}
.split-side video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
  opacity: 0.52;
  filter: contrast(1.15) brightness(0.82) saturate(1.2);
}
.split-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: linear-gradient(180deg, transparent 0%, #ffb703 30%, #00ff66 70%, transparent 100%);
  box-shadow: 0 0 15px #ffb703, 0 0 25px #00ff66;
  z-index: 1;
  transform: translateX(-50%);
  transition: left 0.7s cubic-bezier(.16, 1, .3, 1), background 0.5s ease, box-shadow 0.5s ease;
}

body[data-page="login"][data-selected="alex"] .split-side.alex-side {
  width: 65%;
  filter: brightness(1.1);
}
body[data-page="login"][data-selected="alex"] .split-side.luis-side {
  width: 35%;
  opacity: 0.35;
  filter: brightness(0.7);
}
body[data-page="login"][data-selected="alex"] .split-divider {
  left: 65%;
  background: linear-gradient(180deg, transparent 0%, #ff2a55 40%, #ffb703 100%);
  box-shadow: 0 0 25px #ff2a55, 0 0 10px #ffb703;
}

body[data-page="login"][data-selected="luis"] .split-side.alex-side {
  width: 35%;
  opacity: 0.35;
  filter: brightness(0.7);
}
body[data-page="login"][data-selected="luis"] .split-side.luis-side {
  width: 65%;
  filter: brightness(1.1);
}
body[data-page="login"][data-selected="luis"] .split-divider {
  left: 35%;
  background: linear-gradient(180deg, transparent 0%, #00ff66 40%, #05ffa1 100%);
  box-shadow: 0 0 25px #00ff66, 0 0 10px #05ffa1;
}

/* Expansión de pantalla completa cinemática al desbloquear */
body[data-page="login"].unlocking-alex .split-side.alex-side {
  width: 100% !important;
  filter: brightness(1.2) contrast(1.15) !important;
  transition: width 1.2s cubic-bezier(.16, 1, .3, 1), filter 0.6s ease;
  z-index: 5;
}
body[data-page="login"].unlocking-alex .split-side.luis-side {
  width: 0% !important;
  opacity: 0 !important;
  transition: width 1.2s cubic-bezier(.16, 1, .3, 1), opacity 0.5s ease;
}
body[data-page="login"].unlocking-alex .split-divider {
  left: 100% !important;
  box-shadow: 0 0 50px #ff2a55, 0 0 100px #ffd000;
  opacity: 0;
  transition: left 1.2s cubic-bezier(.16, 1, .3, 1), opacity 0.8s ease;
}

body[data-page="login"].unlocking-luis .split-side.luis-side {
  width: 100% !important;
  filter: brightness(1.2) contrast(1.15) !important;
  transition: width 1.2s cubic-bezier(.16, 1, .3, 1), filter 0.6s ease;
  z-index: 5;
}
body[data-page="login"].unlocking-luis .split-side.alex-side {
  width: 0% !important;
  opacity: 0 !important;
  transition: width 1.2s cubic-bezier(.16, 1, .3, 1), opacity 0.5s ease;
}
body[data-page="login"].unlocking-luis .split-divider {
  left: 0% !important;
  box-shadow: 0 0 50px #00f0ff, 0 0 100px #05ffa1;
  opacity: 0;
  transition: left 1.2s cubic-bezier(.16, 1, .3, 1), opacity 0.8s ease;
}

/* ==========================================================================
   Estabilidad (Paneles fijos, Tilt únicamente en tarjetas individuales)
   ========================================================================== */
.panel {
  transform: none !important;
  --tilt-x: 0deg !important;
  --tilt-y: 0deg !important;
  --lift: 0px !important;
  --card-scale: 1 !important;
}

[data-no-tilt],
[data-no-tilt] .card,
[data-no-tilt] .panel,
.master-detail,
.master-detail .panel,
.master-detail .card,
#plugins,
#plugins.panel,
body[data-page="mundo"] .panel,
body[data-page="mundo"] .card,
body[data-page="mundo"] .table-wrap {
  transform: none !important;
  --tilt-x: 0deg !important;
  --tilt-y: 0deg !important;
  --lift: 0px !important;
  --card-scale: 1 !important;
}

/* ==========================================================================
   PALETA DE COMANDOS FLOTANTE (CTRL + K) - GLASSMORPHISM FUTURISTA
   ========================================================================== */
dialog.search-dialog {
  width: min(680px, 94vw);
  max-width: 680px;
  padding: 0;
  border: 1px solid var(--line-strong, rgba(0, 240, 255, 0.25));
  border-radius: var(--radius, 14px);
  background: rgba(10, 16, 23, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text, #e2e8f0);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 35px -5px var(--accent-soft, rgba(0, 240, 255, 0.15)), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin: auto;
}
dialog.search-dialog::backdrop {
  background: rgba(3, 7, 12, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.search-palette {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  max-height: 80vh;
  min-height: 280px;
}
.search-heading {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .85rem 1.2rem;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  background: rgba(255, 255, 255, 0.02);
}
.search-heading-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft, rgba(0, 240, 255, 0.12));
  color: var(--accent, var(--blue));
  font-size: 1.15rem;
  font-weight: bold;
}
.search-heading div { flex: 1; min-width: 0; }
.search-heading p { margin: 0; font: 700 .62rem Orbitron, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.search-heading h2 { margin: 0; font: 700 .98rem Rajdhani, sans-serif; letter-spacing: .03em; color: #fff; }
.search-heading kbd {
  padding: .2rem .5rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(6, 10, 15, 0.6);
  color: var(--muted);
  font: 700 .72rem "IBM Plex Mono", Consolas, monospace;
}
.search-box {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1.2rem;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  background: rgba(6, 10, 15, 0.4);
}
.search-box span { color: var(--accent, var(--blue)); font-size: 1.25rem; font-weight: bold; }
.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  font: 600 1.05rem Rajdhani, sans-serif;
  letter-spacing: .03em;
  padding: 0;
  outline: none;
  box-shadow: none;
}
.search-box input::placeholder { color: var(--muted); font-weight: 500; }
.search-results {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding: .9rem 1.1rem;
  overflow-y: auto;
  max-height: 52vh;
}
.search-result {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .75rem 1rem;
  min-height: 50px;
  box-sizing: border-box;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 8px);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all .15s ease;
}
.search-result:hover,
.search-result.active,
.search-result[aria-selected="true"] {
  border-color: var(--accent, var(--blue));
  background: linear-gradient(90deg, var(--accent-soft, rgba(0, 240, 255, 0.14)), rgba(6, 10, 15, 0.8));
  box-shadow: 0 0 16px -2px var(--accent-soft, rgba(0, 240, 255, 0.3));
  transform: translateX(3px);
}
.search-category {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: .25rem .6rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font: 700 .65rem Orbitron, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent, var(--blue));
  background: rgba(6, 10, 15, 0.65);
  white-space: nowrap;
}
.search-body {
  display: flex;
  flex-direction: column;
  gap: .18rem;
  min-width: 0;
  flex: 1;
}
.search-result strong {
  display: block;
  font: 700 .98rem Rajdhani, sans-serif;
  letter-spacing: .02em;
  color: #fff;
  line-height: 1.2;
}
.search-result small {
  display: block;
  font: .78rem "IBM Plex Mono", Consolas, monospace;
  color: var(--muted);
  line-height: 1.2;
}
.search-result mark {
  background: rgba(255, 183, 3, 0.25);
  color: var(--amber, #ffb703);
  font-weight: bold;
  border-radius: 2px;
  padding: 0 2px;
}
.search-help {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .65rem 1.2rem;
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  background: rgba(6, 10, 15, 0.6);
  font-size: .75rem;
  color: var(--muted);
}
.search-help span { display: inline-flex; align-items: center; gap: .35rem; margin-right: .8rem; }
.search-help kbd {
  display: inline-block;
  padding: .15rem .35rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  font: 700 .65rem "IBM Plex Mono", monospace;
  color: var(--text);
}

/* ==========================================================================
   FASES DIOS, MOVIMIENTOS POR NIVEL Y EXPORTACIÓN A PBS
   ========================================================================== */
.badge.dios,
.cat-tabs button[data-cat="dios"].active {
  border-color: #ffd700 !important;
  color: #ffd700 !important;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 60, 0, 0.15)) !important;
  box-shadow: 0 0 16px -2px rgba(255, 215, 0, 0.45), inset 0 0 8px rgba(255, 215, 0, 0.2);
}

.stage-card.is-god {
  border-color: rgba(255, 215, 0, 0.45);
  box-shadow: 0 0 30px -5px rgba(255, 215, 0, 0.25);
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.03), transparent);
}

.move-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 0;
}

.move-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .65rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(6, 10, 15, 0.55);
  font-size: .8rem;
  color: #fff;
  transition: all .2s ease;
}

.move-chip:hover {
  border-color: var(--accent, var(--blue));
  background: rgba(0, 240, 255, 0.1);
  transform: translateY(-1px);
}

.move-chip-lvl {
  padding: .1rem .4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font: 700 .68rem Orbitron, sans-serif;
  color: var(--accent, var(--blue));
}

.move-chip-name {
  font: 600 .85rem Rajdhani, sans-serif;
  letter-spacing: .02em;
}

.move-chip-del {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 77, 77, 0.2);
  color: var(--red, #ff4d4d);
  font-size: .7rem;
  cursor: pointer;
  padding: 0;
  transition: all .15s ease;
}

.move-chip-del:hover {
  background: var(--red, #ff4d4d);
  color: #fff;
  transform: scale(1.15);
}

.move-add-bar {
  display: grid;
  grid-template-columns: 85px 1fr auto;
  gap: .5rem;
  margin-top: .6rem;
  align-items: center;
}

.btn-export-pbs {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(6, 10, 15, 0.45);
  color: var(--muted);
  font: 700 .82rem Rajdhani, sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: not-allowed;
  transition: all .25s ease;
}

.btn-export-pbs.is-ready {
  border-color: var(--green);
  color: var(--green);
  background: linear-gradient(135deg, rgba(5, 255, 161, 0.2), rgba(6, 18, 14, 0.8));
  box-shadow: 0 0 16px -2px rgba(5, 255, 161, 0.4);
  cursor: pointer;
}

.btn-export-pbs.is-ready:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(5, 255, 161, 0.6);
}

.btn-remove-pbs {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .8rem;
  border: 1px solid rgba(255, 77, 77, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(255, 77, 77, 0.1);
  color: var(--red, #ff4d4d);
  font: 700 .8rem Rajdhani, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .2s ease;
}

.btn-remove-pbs:hover {
  background: rgba(255, 77, 77, 0.25);
  border-color: var(--red, #ff4d4d);
  color: #fff;
}

.btn-add-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  padding: .75rem 1rem;
  margin: 1rem 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font: 700 .9rem Rajdhani, sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .2s ease;
}

.btn-add-stage:hover {
  border-color: var(--accent, var(--blue));
  background: rgba(0, 240, 255, 0.08);
  color: #fff;
}

.btn-del-stage {
  padding: .2rem .55rem;
  border: 1px solid rgba(255, 77, 77, 0.3);
  border-radius: 6px;
  background: rgba(255, 77, 77, 0.08);
  color: var(--red);
  font: 600 .72rem Rajdhani, sans-serif;
  cursor: pointer;
}

.btn-del-stage:hover {
  background: rgba(255, 77, 77, 0.25);
  color: #fff;
}

/* Widget de Sincronización en Equipo (Alex / Luis) */
.team-sync-widget {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  padding: .4rem .85rem;
  background: rgba(22, 12, 16, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  margin-left: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.team-sync-content {
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* Perfil fijo de usuario autenticado */
.team-user-badge-fixed {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .25rem .55rem .25rem .7rem;
  font: 700 .85rem Inter, system-ui, sans-serif;
  color: #fff;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: all .2s ease;
}

.team-user-badge-fixed:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.team-user-badge-fixed .team-avatar {
  font-size: .95rem;
  line-height: 1;
}

.team-user-badge-fixed .team-user-name {
  font-weight: 700;
  letter-spacing: .02em;
}

.team-user-switch-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  color: var(--muted);
  cursor: pointer;
  margin-left: .2rem;
  transition: all .15s ease;
  line-height: 1;
  padding: 0;
}

.team-user-switch-btn:hover {
  background: rgba(255, 42, 85, 0.85);
  border-color: #ff2a55;
  color: #fff;
  transform: scale(1.15);
}

/* Indicadores de presencia en tiempo real (Alex & Luis) */
.team-presence-group {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.presence-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .22rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  font-family: Inter, system-ui, sans-serif;
  letter-spacing: .02em;
  transition: all .25s ease;
  user-select: none;
}

.presence-chip .presence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transition: all .25s ease;
}

.presence-chip.is-offline {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #64748b;
  opacity: 0.65;
}

.presence-chip.is-offline .presence-dot {
  background: #64748b;
}

.presence-chip.is-online {
  opacity: 1;
}

#presence-alex.is-online {
  background: rgba(255, 42, 85, 0.12);
  border: 1px solid rgba(255, 42, 85, 0.45);
  color: #ff5c7c;
  box-shadow: 0 0 10px rgba(255, 42, 85, 0.15);
}

#presence-alex.is-online .presence-dot {
  background: #ff2a55;
  box-shadow: 0 0 8px #ff2a55, 0 0 2px #fff;
  animation: presencePulseRed 1.8s infinite ease-in-out;
}

#presence-luis.is-online {
  background: rgba(5, 255, 161, 0.12);
  border: 1px solid rgba(5, 255, 161, 0.45);
  color: #05ffa1;
  box-shadow: 0 0 10px rgba(5, 255, 161, 0.15);
}

#presence-luis.is-online .presence-dot {
  background: #05ffa1;
  box-shadow: 0 0 8px #05ffa1, 0 0 2px #fff;
  animation: presencePulseGreen 1.8s infinite ease-in-out;
}

@keyframes presencePulseRed {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

@keyframes presencePulseGreen {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* Botón para ver u ocultar contraseña en login */
.pwd-toggle-btn {
  position: absolute;
  right: 0.6rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  font-size: 1.15rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}

.pwd-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.1);
}

.pwd-toggle-btn:active {
  transform: scale(0.95);
}

.team-push-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem 1rem;
  background: linear-gradient(135deg, rgba(255, 42, 85, 0.3), rgba(255, 183, 3, 0.3));
  border: 1px solid var(--amber);
  border-radius: 999px;
  color: #fff;
  font: 700 .85rem Rajdhani, sans-serif;
  letter-spacing: .03em;
  white-space: nowrap;
  cursor: pointer;
  transition: all .2s ease;
}

.team-push-btn span {
  font-size: .95rem;
}

.team-push-btn:hover {
  background: linear-gradient(135deg, rgba(255, 42, 85, 0.5), rgba(255, 183, 3, 0.5));
  box-shadow: 0 0 16px rgba(255, 183, 3, 0.5);
  transform: translateY(-1px);
}

.team-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font: 600 .78rem Inter, sans-serif;
  color: var(--muted);
  white-space: nowrap;
}

.team-status .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.team-status.ok .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.team-status.warn .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }

.team-status.pulse .dot {
  animation: teamPulse 1.2s infinite ease-in-out;
}

@keyframes teamPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

/* Banner Flotante de Pull de Cambios */
.team-pull-banner {
  position: fixed;
  top: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  max-width: 90vw;
  width: 540px;
  animation: slideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from { transform: translate(-50%, -30px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.team-banner-card {
  background: rgba(26, 12, 18, 0.95);
  border: 2px solid var(--amber);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 183, 3, 0.25);
  backdrop-filter: blur(16px);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}

.team-banner-header {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
}

.team-bell {
  font-size: 1.4rem;
  animation: ring 1.5s infinite ease-in-out;
}

@keyframes ring {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(15deg); }
  40%, 80% { transform: rotate(-15deg); }
}

.team-hash {
  background: rgba(255, 255, 255, 0.1);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: .75rem;
  color: var(--amber);
}

.team-banner-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .6rem;
}

.team-pull-btn {
  background: linear-gradient(135deg, #ffb703, #ff2a55);
  border: none;
  color: #000;
  font: 800 .85rem Orbitron, sans-serif;
  letter-spacing: .04em;
  padding: .5rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s ease;
}

.team-pull-btn:hover {
  box-shadow: 0 0 20px rgba(255, 183, 3, 0.6);
  transform: translateY(-1px);
}

.team-dismiss-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 600 .8rem Rajdhani, sans-serif;
  padding: .45rem .8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.team-dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-del-line {
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid rgba(255, 77, 77, 0.5);
  color: #ff7878;
  font: 700 .78rem Rajdhani, sans-serif;
  letter-spacing: .04em;
  padding: .35rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s ease;
}

.btn-del-line:hover {
  background: rgba(255, 77, 77, 0.3);
  border-color: #ff4d4d;
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 77, 77, 0.4);
}

/* ==========================================================================
   ADAPTACIÓN PROFESIONAL PARA ANDROID Y PANTALLAS MÓVILES
   ========================================================================== */

@media (max-width: 780px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .portal-shell {
    display: block !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  main {
    padding: 0.75rem !important;
    padding-bottom: 5.5rem !important; /* Espacio para barra fija inferior */
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  /* 1. Prevención del zoom molesto de Android Chrome (regla 16px) */
  input, select, textarea, button {
    font-size: 16px !important;
    touch-action: manipulation;
  }

  input[type="number"], input[type="text"], input[type="search"], select, textarea {
    min-height: 44px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }

  /* 2. Cabecera y acciones */
  .masthead {
    margin-bottom: 0.85rem !important;
    gap: 0.75rem !important;
  }

  .masthead h1 {
    font-size: 1.55rem !important;
  }

  .masthead p {
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
    opacity: 0.85;
    margin: 0.3rem 0 !important;
  }

  .page-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.45rem !important;
    width: 100% !important;
  }

  .page-actions > * {
    width: auto !important;
    flex: 1 1 calc(50% - 0.45rem) !important;
    min-height: 42px !important;
    font-size: 0.85rem !important;
    justify-content: center !important;
  }

  /* Widget de Sincronización en Equipo en móvil */
  .team-sync-widget {
    width: 100% !important;
    flex: 1 1 100% !important;
    margin: 0.2rem 0 0.5rem !important;
    padding: 0.4rem 0.65rem !important;
    border-radius: var(--radius-sm) !important;
    box-sizing: border-box !important;
    justify-content: space-between !important;
  }

  .team-sync-content {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.4rem !important;
  }

  .team-user-badge-fixed {
    padding: 0.2rem 0.45rem !important;
    font-size: 0.78rem !important;
  }

  .team-presence-group {
    gap: 0.2rem !important;
  }

  .presence-chip {
    padding: 0.15rem 0.4rem !important;
    font-size: 0.68rem !important;
  }

  .team-push-btn {
    padding: 0.35rem 0.7rem !important;
    font-size: 0.8rem !important;
  }

  .team-live-badge {
    padding: 0.15rem 0.45rem !important;
    font-size: 0.68rem !important;
  }

  /* 3. Selector de Vista Móvil (Ficha vs Lista de Pokémon) */
  .mobile-view-toggle {
    display: flex !important;
    width: 100% !important;
    background: rgba(18, 10, 14, 0.95) !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: 999px !important;
    padding: 0.25rem !important;
    margin: 0.4rem 0 1rem !important;
    gap: 0.25rem !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
    box-sizing: border-box !important;
  }

  .mobile-toggle-btn {
    flex: 1 !important;
    border: none !important;
    background: transparent !important;
    color: var(--muted) !important;
    font: 700 0.85rem Rajdhani, sans-serif !important;
    letter-spacing: 0.04em !important;
    padding: 0.5rem 0.8rem !important;
    border-radius: 999px !important;
    min-height: 40px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .mobile-toggle-btn.active {
    background: linear-gradient(135deg, rgba(255, 42, 85, 0.45), rgba(255, 183, 3, 0.4)) !important;
    color: #fff !important;
    border: 1px solid var(--amber) !important;
    box-shadow: 0 0 14px rgba(255, 183, 3, 0.35) !important;
  }

  body.mobile-view-inventory #panel-detail {
    display: none !important;
  }

  body.mobile-view-editor #panel-inventory {
    display: none !important;
  }

  /* 4. Inventario de Pokémon en móvil */
  .inventory {
    max-height: 68vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-right: 0.2rem !important;
  }

  .inventory-item {
    padding: 0.85rem 0.95rem !important;
    min-height: 54px !important;
    margin-bottom: 0.5rem !important;
  }

  .inventory-item .row strong {
    font-size: 0.95rem !important;
  }

  /* 5. Pestañas de categorías y fichas con deslizamiento táctil horizontal */
  .cat-tabs, #tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 0.45rem !important;
    padding: 0.2rem 0 0.6rem !important;
    margin-bottom: 0.8rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .cat-tabs::-webkit-scrollbar, #tabs::-webkit-scrollbar {
    display: none !important;
  }

  .cat-tabs button, #tabs button, .cat-tabs a, #tabs a {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0.45rem 0.85rem !important;
    font-size: 0.82rem !important;
    min-height: 38px !important;
    border-radius: 999px !important;
  }

  /* 6. Métricas del Pulso */
  .metrics {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem !important;
  }

  .metric {
    padding: 0.75rem !important;
  }

  .metric strong {
    font-size: 1.35rem !important;
  }

  .metric span {
    font-size: 0.75rem !important;
  }

  /* 7. Tarjeta de Fase de Especie (Stage Card) */
  .stage-card {
    grid-template-columns: 1fr !important;
    padding: 1rem !important;
    gap: 1.2rem !important;
    border-radius: var(--radius) !important;
  }

  .stage-side {
    min-width: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 0.6rem !important;
  }

  .sprite-viewer {
    max-width: 200px !important;
    width: 100% !important;
    margin: 0 auto !important;
  }

  .sprite-main {
    aspect-ratio: 1 !important;
    max-width: 200px !important;
  }

  .sprite-mini {
    width: 100% !important;
  }

  /* 8. Formularios y campos de edición */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .form-grid .field {
    width: 100% !important;
  }

  .field label {
    font-size: 0.78rem !important;
    margin-bottom: 0.35rem !important;
  }

  .type-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }

  /* 9. Estadísticas Base (Stat Edit) adaptadas a pantalla móvil */
  .stat-edit {
    grid-template-columns: 46px 64px 1fr 44px !important;
    gap: 0.4rem 0.5rem !important;
    align-items: center !important;
  }

  .stat-edit .head {
    font-size: 0.65rem !important;
  }

  .stat-edit input {
    min-height: 40px !important;
    font-size: 16px !important;
    padding: 0.2rem 0.4rem !important;
    text-align: center !important;
  }

  .stat-edit .now {
    font-size: 0.82rem !important;
  }

  /* 10. Checklist en móvil */
  .check-row {
    padding: 0.5rem 0.6rem !important;
    min-height: 42px !important;
  }

  .check-row input[type="checkbox"] {
    width: 22px !important;
    height: 22px !important;
  }

  .check-add {
    grid-template-columns: 1fr auto !important;
    gap: 0.4rem !important;
  }

  .check-add button {
    min-height: 44px !important;
    padding: 0.4rem 0.9rem !important;
  }

  /* 11. Botones de acción entre fases */
  .stage-actions-bar {
    flex-direction: column !important;
    gap: 0.65rem !important;
  }

  .stage-actions-bar button {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 0.88rem !important;
  }

  /* 12. Barra Fija Flotante Inferior en Android */
  .mobile-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
    background: rgba(16, 9, 13, 0.95);
    border-top: 1px solid var(--line-strong);
    backdrop-filter: blur(16px);
    box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.6);
  }

  .mobile-bar-btn {
    flex: 1;
    min-height: 44px;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    font: 700 0.85rem Rajdhani, sans-serif;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mobile-bar-btn.primary {
    flex: 1.4;
    background: linear-gradient(135deg, #ff2a55 0%, #ffb703 100%);
    border-color: rgba(255, 255, 255, 0.3);
    color: #000;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(255, 42, 85, 0.4);
  }

  /* 13. Bloques de código PBS */
  pre, code, [data-pbs] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-width: 100% !important;
  }

  /* 14. Cuadrantes de Estado (Squares) */
  .sq-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem !important;
  }

  .sq {
    padding: 0.5rem 0.6rem !important;
  }
}

@media (min-width: 781px) {
  .mobile-view-toggle,
  .mobile-sticky-bar {
    display: none !important;
  }
}

/* =========================================================
   APARTADO DE CAMBIO DE STATS (POKÉDEX STATS EDITOR)
   ========================================================= */
.stat-editor-card {
  background: rgba(14, 20, 28, 0.75);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.4rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.stat-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: .85rem;
  margin-bottom: 1rem;
}

.stat-editor-header .phase-title {
  font: 700 1.15rem Rajdhani, sans-serif;
  color: #fff;
  letter-spacing: .02em;
  margin: 0;
}

.stat-header-badges {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.stat-bst-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .75rem;
  background: rgba(255, 183, 3, 0.12);
  border: 1px solid var(--amber);
  border-radius: 999px;
  font: 700 .85rem Orbitron, monospace;
  color: var(--amber);
  box-shadow: 0 0 12px rgba(255, 183, 3, 0.25);
}

.stat-bst-badge strong {
  font-size: 1.05rem;
  color: #fff;
}

.stat-archetype-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 999px;
  font: 700 .8rem Rajdhani, sans-serif;
  color: #c084fc;
}

.stat-controls-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-bottom: 1.2rem;
}

.stat-control-row {
  display: grid;
  grid-template-columns: 85px 75px 1fr 110px 55px;
  gap: .75rem;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: .45rem .75rem;
  transition: all .2s ease;
}

.stat-control-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .25rem .5rem;
  border-radius: 6px;
  font: 700 .76rem Orbitron, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.stat-pill-ps  { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.4); }
.stat-pill-atk { background: rgba(249, 115, 22, 0.15); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.4); }
.stat-pill-def { background: rgba(234, 179, 8, 0.15);  color: #eab308; border: 1px solid rgba(234, 179, 8, 0.4); }
.stat-pill-spa { background: rgba(6, 182, 212, 0.15);  color: #06b6d4; border: 1px solid rgba(6, 182, 212, 0.4); }
.stat-pill-spd { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.4); }
.stat-pill-vel { background: rgba(236, 72, 153, 0.15); color: #ec4899; border: 1px solid rgba(236, 72, 153, 0.4); }

.stat-num-input {
  width: 100%;
  padding: .35rem .45rem;
  text-align: right;
  font: 700 .9rem "IBM Plex Mono", Consolas, monospace;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: #fff;
}

.stat-num-input:focus {
  border-color: var(--cyan);
  outline: none;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.35);
}

.stat-slider-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.stat-range-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  transition: opacity .15s;
}

.stat-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8), 0 2px 4px rgba(0,0,0,0.5);
  transition: transform .15s ease;
}

.stat-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.stat-delta-group {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.btn-stat-delta {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  border-radius: 4px;
  padding: .2rem .35rem;
  font: 700 .68rem Orbitron, monospace;
  cursor: pointer;
  line-height: 1;
  transition: all .15s ease;
}

.btn-stat-delta:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--cyan);
  color: #fff;
  transform: translateY(-1px);
}

.btn-stat-delta:active {
  transform: scale(0.95);
}

.stat-diff-tag {
  text-align: right;
  font: 700 .75rem "IBM Plex Mono", Consolas, monospace;
  color: var(--muted);
}

.stat-diff-tag.plus {
  color: var(--green);
}

.stat-diff-tag.minus {
  color: var(--amber);
}

/* Plantillas de Balance Rápido */
.stat-presets-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: .8rem 1rem;
  margin-bottom: 1.2rem;
}

.stat-presets-label {
  display: block;
  font: 700 .75rem Rajdhani, sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .5rem;
}

.stat-presets-row {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
}

.btn-stat-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #e2e8f0;
  padding: .35rem .75rem;
  font: 600 .76rem Rajdhani, sans-serif;
  letter-spacing: .03em;
  cursor: pointer;
  transition: all .2s ease;
}

.btn-stat-preset:hover {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(112, 0, 255, 0.15));
  border-color: var(--cyan);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0, 240, 255, 0.2);
}

/* Vista previa de BaseStats para Essentials */
.stat-pbs-box {
  background: rgba(6, 10, 15, 0.8);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: .8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
}

.stat-pbs-code {
  font: 700 .85rem "IBM Plex Mono", Consolas, monospace;
  color: var(--green);
  margin: 0;
  overflow-wrap: anywhere;
}

.btn-copy-stat-pbs {
  background: rgba(5, 255, 161, 0.12);
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: 6px;
  padding: .4rem .85rem;
  font: 700 .78rem Rajdhani, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s ease;
}

.btn-copy-stat-pbs:hover {
  background: var(--green);
  color: #000;
  box-shadow: 0 0 12px var(--green);
}

@media (max-width: 780px) {
  .stat-control-row {
    grid-template-columns: 75px 60px 1fr 40px;
    gap: .4rem;
    padding: .4rem .5rem;
  }
  .stat-delta-group {
    display: none;
  }
  .stat-editor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
  }
}

/* ==========================================================================
   EFECTOS CINEMÁTICOS DE DESBLOQUEO (GPU CANVAS + ABERRACIÓN CROMÁTICA)
   ========================================================================== */

.screen-punch {
  animation: screenPunchShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  will-change: transform;
}

@keyframes screenPunchShake {
  0% { transform: scale(1) translate(0, 0); }
  20% { transform: scale(1.025) translate(-4px, 2px); }
  40% { transform: scale(1.015) translate(4px, -2px); }
  60% { transform: scale(1.008) translate(-2px, 1px); }
  80% { transform: scale(1.003) translate(1px, -1px); }
  100% { transform: scale(1) translate(0, 0); }
}

/* Desvanecimiento instantáneo y suave de la tarjeta de login al desbloquear */
.login-card.unlock-dissolve {
  pointer-events: none;
  opacity: 0 !important;
  transform: scale(0.94) translateY(14px) !important;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: opacity, transform;
}

/* Expansión del fondo Dual Screen a 100% según el desarrollador autenticado */
body.unlocking-alex .alex-side {
  flex: 1 1 100% !important;
  transition: flex 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
body.unlocking-alex .luis-side {
  flex: 0 0 0% !important;
  opacity: 0;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
body.unlocking-alex .split-divider {
  opacity: 0;
  transition: opacity 0.25s ease;
}

body.unlocking-luis .luis-side {
  flex: 1 1 100% !important;
  transition: flex 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
body.unlocking-luis .alex-side {
  flex: 0 0 0% !important;
  opacity: 0;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
body.unlocking-luis .split-divider {
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Atenuación del fondo durante el desbloqueo para máximo contraste del portal */
body.unlocking-alex .alex-side video,
body.unlocking-luis .luis-side video {
  filter: brightness(0.35) saturate(0.85);
  transition: filter 0.4s ease;
}

/* =========================================================================
   ESCENARIO CINEMÁTICO DE LOS LEGENDARIOS OFICIALES (RAYQUAZA & DIALGA)
   ========================================================================= */
.cinematic-stage {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinematic-stage.active {
  opacity: 1;
}

.cinematic-pokemon-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: legendaryEntrance 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cinematic-summon-pedestal {
  position: absolute;
  bottom: 25px;
  width: 320px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(5, 255, 161, 0.7) 0%, rgba(255, 208, 0, 0.35) 45%, transparent 72%);
  filter: blur(10px);
  z-index: 1;
  animation: pedestalPulse 2s ease-in-out infinite alternate;
}

.cinematic-stage.dialga-mode .cinematic-summon-pedestal {
  background: radial-gradient(ellipse at center, rgba(0, 240, 255, 0.75) 0%, rgba(112, 0, 255, 0.4) 45%, transparent 72%);
}

.cinematic-pokemon-sprite {
  position: relative;
  width: 250px;
  height: 250px;
  object-fit: contain;
  image-rendering: pixelated;
  z-index: 3;
  animation: legendaryFloat 2.6s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(5, 255, 161, 0.8)) drop-shadow(0 0 60px rgba(255, 208, 0, 0.5));
  will-change: transform, filter;
}

.cinematic-stage.dialga-mode .cinematic-pokemon-sprite {
  width: 230px;
  height: 230px;
  filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.85)) drop-shadow(0 0 65px rgba(112, 0, 255, 0.65));
}

@keyframes legendaryEntrance {
  0% {
    opacity: 0;
    transform: scale(0.35) translateY(50px);
    filter: brightness(2.8) blur(12px);
  }
  60% {
    opacity: 1;
    transform: scale(1.08) translateY(-8px);
    filter: brightness(1.3) blur(0px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: brightness(1);
  }
}

@keyframes legendaryFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-16px) rotate(1.2deg);
  }
}

@keyframes pedestalPulse {
  0% {
    transform: scale(0.85);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.18);
    opacity: 0.95;
  }
}

.cinematic-banner {
  margin-top: 1.6rem;
  text-align: center;
  z-index: 3;
  animation: bannerFadeUp 0.5s 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cinematic-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.25rem;
  border-radius: 9999px;
  font: 800 0.82rem 'Orbitron', monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(5, 255, 161, 0.14);
  border: 1px solid rgba(5, 255, 161, 0.5);
  color: #05ffa1;
  box-shadow: 0 0 25px rgba(5, 255, 161, 0.35);
  margin-bottom: 0.65rem;
}

.cinematic-stage.dialga-mode .cinematic-tag {
  background: rgba(0, 240, 255, 0.14);
  border-color: rgba(0, 240, 255, 0.5);
  color: #00f0ff;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.35);
}

.cinematic-title {
  font: 900 2.4rem 'Orbitron', sans-serif;
  letter-spacing: 0.08em;
  color: #ffffff;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.8), 0 0 45px rgba(5, 255, 161, 0.8);
  margin: 0 0 0.45rem;
}

.cinematic-stage.dialga-mode .cinematic-title {
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.8), 0 0 45px rgba(0, 240, 255, 0.85);
}

.cinematic-sub {
  font: 700 1.1rem 'Rajdhani', sans-serif;
  letter-spacing: 0.08em;
  color: #ffd000;
  text-shadow: 0 0 12px rgba(255, 208, 0, 0.55);
}

.cinematic-stage.dialga-mode .cinematic-sub {
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
}

@keyframes bannerFadeUp {
  0% {
    opacity: 0;
    transform: translateY(22px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================================
   EFECTOS HOLOGRÁFICOS 3D PARA CARTAS POKÉDEX, REGIONALES Y SHINIES (OPTIMIZADO)
   ========================================================================= */
.inventory-item {
  content-visibility: auto;
  contain-intrinsic-size: 0 68px;
}

.stage-card {
  content-visibility: auto;
  contain-intrinsic-size: 0 380px;
}

.stage-card, .species-nav-item, .inventory-item {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.2s ease, 
              box-shadow 0.25s ease;
}

.stage-card:hover, .species-nav-item:hover, .inventory-item:hover {
  transform-style: preserve-3d;
}

.stage-card:hover {
  border-color: rgba(255, 208, 0, 0.65) !important;
  box-shadow: 0 20px 42px -10px rgba(0, 0, 0, 0.8), 
              0 0 28px rgba(255, 208, 0, 0.22),
              inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
  transform: translateY(-4px);
}

/* Rayo holográfico iridiscente diagonal (estilo TCG Holográfico) */
.stage-card::before {
  content: "";
  position: absolute;
  top: -120%;
  left: -120%;
  width: 340%;
  height: 340%;
  background: linear-gradient(
    115deg,
    transparent 36%,
    rgba(255, 42, 109, 0.08) 42%,
    rgba(0, 240, 255, 0.15) 48%,
    rgba(5, 255, 161, 0.18) 52%,
    rgba(255, 208, 0, 0.14) 58%,
    transparent 65%
  );
  transform: rotate(-15deg);
  pointer-events: none;
  opacity: 0;
  z-index: 4;
  transition: opacity 0.3s ease;
}

.stage-card:hover::before {
  opacity: 1;
  animation: holoSheen 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes holoSheen {
  0% { transform: translateY(-40%) rotate(-15deg); }
  100% { transform: translateY(40%) rotate(-15deg); }
}

/* Elevación 3D del sprite dentro de la carta al hacer hover */
.stage-card .sprite-main {
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s ease, border-color 0.25s ease;
  transform-style: preserve-3d;
}
.stage-card:hover .sprite-main {
  transform: translateZ(16px) scale(1.04);
  box-shadow: 0 12px 30px -6px rgba(0, 240, 255, 0.32), inset 0 0 20px rgba(0, 240, 255, 0.12);
  border-color: var(--blue);
}
.stage-card .sprite-main img {
  transition: transform 0.35s var(--ease-spring), filter 0.3s ease;
}
.stage-card:hover .sprite-main img {
  transform: scale(1.1) translateY(-5px);
  filter: drop-shadow(0 12px 22px rgba(0, 240, 255, 0.55));
}

/* Chispitas centelleantes para shinies */
@keyframes shinyTwinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.65) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.25) rotate(180deg); filter: drop-shadow(0 0 8px #ffd700); }
}
.sparkle-icon {
  display: inline-block;
  animation: shinyTwinkle 2.2s infinite ease-in-out;
}

/* Barra de progreso de estadísticas de combate RPG con brillo en la punta */
.progress span {
  position: relative;
  transition: width 0.65s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.progress span::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 10px #ffffff, 0 0 18px #00f0ff;
  opacity: 0.85;
}

/* Barra de carga de transición de página (Energy Rift) */
#portal-transit-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #ff2a55 0%, #ffd000 50%, #05ffa1 100%);
  box-shadow: 0 0 14px rgba(5, 255, 161, 0.8), 0 0 8px rgba(255, 208, 0, 0.9);
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
}
#portal-transit-bar.run {
  opacity: 1;
  animation: transitPulse 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes transitPulse {
  0% { width: 0%; opacity: 1; }
  60% { width: 75%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

/* =========================================================================
   ACOMPAÑANTE LEGENDARIO DE CURSOR (RAYQUAZA & DIALGA)
   ========================================================================= */
.cursor-pet {
  position: fixed;
  top: 0;
  left: 0;
  width: 58px;
  height: 58px;
  pointer-events: none;
  z-index: 99998;
  will-change: transform;
  transition: opacity 0.35s ease;
}

.cursor-pet .pet-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.cursor-pet .pet-sprite {
  width: 54px;
  height: 54px;
  object-fit: contain;
  image-rendering: pixelated;
  /* Resplandor dorado/rubí para contrastar con el dragón negro de Rayquaza Shiny */
  filter: drop-shadow(0 0 10px rgba(255, 208, 0, 0.9)) drop-shadow(0 0 22px rgba(255, 42, 85, 0.6));
}

.cursor-pet.pet-dialga .pet-sprite {
  width: 50px;
  height: 50px;
  /* Resplandor esmeralda y cian para Dialga Shiny */
  filter: drop-shadow(0 0 10px rgba(5, 255, 161, 0.9)) drop-shadow(0 0 22px rgba(0, 240, 255, 0.6));
}

.cursor-pet .pet-inner.pet-hop {
  animation: petHopJump 0.42s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes petHopJump {
  0% { transform: scale(1) translateY(0); }
  45% { transform: scale(1.32) translateY(-14px); }
  100% { transform: scale(1) translateY(0); }
}

.pet-trail-spark {
  position: fixed;
  pointer-events: none;
  z-index: 99997;
  font-size: 0.85rem;
  line-height: 1;
  text-shadow: 0 0 8px currentColor;
  animation: trailFade 0.55s ease-out forwards;
}

@keyframes trailFade {
  0% {
    opacity: 0.9;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--drift-x, 0px), var(--drift-y, 15px)) scale(0.3);
  }
}


