.app-header {
  background: linear-gradient(180deg, #0b1220 0%, #0e1628 100%);
  border-bottom: 1px solid rgba(148,163,184,.2);
  padding: 1.25rem 1rem;
  color: #e2e8f0;
  /* seguridad: no crear nuevo contexto de apilado ni contención */
  overflow: visible;
  transform: none;
  filter: none;
  contain: none;
}

.app-header .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .35rem;
}

/* NO tocamos color aquí, lo fuerza el tema nocturne con !important */
.brand .app-title { font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 900; }
.brand .app-tagline { font-weight: 800; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
  /* seguridad sticky */
  overflow: visible;
  transform: none;
  filter: none;
  contain: none;
}

.profile-select .section-header {
  margin: 1rem 0 1.25rem;
  color: #e2e8f0;
}

.section-subtitle { color: #94a3b8; }

.controls {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.controls .search { min-width: 240px; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }

.grid.grid-profiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 1024px) {
  .grid.grid-profiles { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .controls { grid-template-columns: 1fr; }
  .grid.grid-profiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid.grid-profiles { grid-template-columns: 1fr; }
}

.footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0 0;
}

.app-footer {
  color: #94a3b8;
  text-align: center;
  padding: 1.25rem 1rem 2rem;
  /* seguridad sticky */
  overflow: visible;
  transform: none;
  filter: none;
  contain: none;
}

/* --- Sticky safety for HUD --- */
html, body {
  height: 100%;
  overflow: visible;   /* evita wrappers con scroll que rompan sticky */
}

/* El scroll principal debe ser el del viewport o de este contenedor,
   y NUNCA tener overflow que no sea visible en ancestros del sticky */
main.container,
.panel,
.game-layout {
  overflow: visible !important;
  contain: none !important;     /* evita contain que rompa sticky */
  transform: none !important;   /* evita stacking context nuevo */
  filter: none !important;      /* por si algún tema aplica filtros */
  will-change: auto !important; /* previene promos a layer raras */
}

/* Si tienes un wrapper con scroll personalizado, desactívalo aquí. */
#main, .app-main {
  overflow: visible !important;
  contain: none !important;
  transform: none !important;
  filter: none !important;
}
