/* ═══════════════════════════════════════════════════════════════════════════
   contests.html — capa competitiva (catálogo + detalle + retos)
   ═══════════════════════════════════════════════════════════════════════════ */

/*
 * Nav a ancho viewport: el shell no hereda el ancho capado de reboot (1400px) → desaparece la “franja” a los lados.
 * El catálogo debajo sigue en .contests-wrap (max 1320).
 */
body.contest-hub-page .main-container.top-container.bxf-shell {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

body.contest-hub-page .main-container.top-container.bxf-shell .bxf-header {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  border-radius: 0 !important;
  box-sizing: border-box;
}

.contests-wrap {
  --cx-line: rgba(160, 150, 190, 0.14);
  --cx-line-strong: rgba(188, 168, 228, 0.28);
  --cx-panel: linear-gradient(
    168deg,
    rgba(16, 12, 26, 0.96) 0%,
    rgba(8, 6, 14, 0.94) 48%,
    rgba(10, 8, 18, 0.98) 100%
  );
  --cx-panel-border: rgba(188, 160, 230, 0.26);
  --contest-page-pad: clamp(16px, 2.5vw, 24px);
  max-width: 1320px;
  width: min(100%, 96vw);
  margin: 0 auto;
  padding: 28px var(--contest-page-pad) 120px;
  position: relative;
  z-index: 1;
}

/* —— Hero: misma caja que .contests-wrap; sin “contenedor” visible (fondo = página) —— */
.contests-hero--contained {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 0 36px;
  padding: 0;
  overflow: visible;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/*
 * reboot-ui fuerza .contests-hero { padding: 24px clamp(18px,3.2vw,34px) !important }
 * → el split queda más estrecho que .contests-grid. Solo en hub de concursos lo quitamos
 * para que el hero use el mismo ancho útil que el catálogo (padding solo en .contests-wrap).
 */
body.contest-hub-page .contests-hero.contests-hero--contained {
  padding: 0 !important;
}

/* ~60 % arte / ~40 % copy (referencia). Móvil: una columna, arte arriba. */
.contests-hero__split {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  min-width: 0;
  column-gap: 0;
  row-gap: 0;
  min-height: clamp(300px, 40vw, 460px);
  align-items: stretch;
}

/* Ilustración: columna izquierda en escritorio */
.contests-hero--contained .contests-hero__art {
  position: relative;
  min-width: 0;
  min-height: 260px;
  background: transparent;
  border-radius: 2.5rem 1.85rem 2.1rem 2.85rem;
  overflow: hidden;
  isolation: isolate;
}


.contests-hero--contained .contests-hero__art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 6;
  /* Viñeta interior: bordes de la ilustración hacia el fondo de la página, sin corte duro */
  background: radial-gradient(ellipse 92% 88% at 50% 50%, transparent 35%, rgba(2, 1, 8, 0.2) 100%);
  mix-blend-mode: multiply;
  opacity: 0.48;
}

.contests-hero--contained .contests-hero__layers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

.contests-hero__layer {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.contests-hero__layer--image {
  background-color: #06040c;
  background-image: url("/images/contests-hero.png");
  background-size: cover;
  background-position: 28% 48%;
  background-repeat: no-repeat;
  filter: saturate(1.12) contrast(1.1) brightness(0.96);
  transform: scale(1.04);
  transform-origin: 40% 50%;
}

.contests-hero__layer--purple-glow {
  background:
    radial-gradient(ellipse 90% 75% at 12% 8%, rgba(138, 43, 226, 0.42), transparent 48%),
    radial-gradient(ellipse 55% 45% at 25% 35%, rgba(99, 102, 241, 0.16), transparent 55%),
    radial-gradient(ellipse 50% 40% at 70% 60%, rgba(168, 85, 247, 0.08), transparent 50%);
  mix-blend-mode: screen;
  opacity: 0.92;
}

/* Viñeta: sin franjas verticales (gradientes con pasos suaves) */
.contests-hero--contained .contests-hero__layer--vignette {
  background: linear-gradient(
    100deg,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0) 28%,
    rgba(0, 0, 0, 0) 48%,
    rgba(0, 0, 0, 0.05) 68%,
    rgba(0, 0, 0, 0) 100%
  );
}

/* Funde hacia el panel sin oscurecimiento brusco (era lo que leía como “corte”) */
.contests-hero--contained .contests-hero__layer--art-fade {
  background: linear-gradient(
    100deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 52%,
    rgba(0, 0, 0, 0.06) 78%,
    rgba(0, 0, 0, 0) 100%
  );
  mix-blend-mode: normal;
  pointer-events: none;
}

.contests-hero__layer--scan {
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.13) 2px,
    rgba(0, 0, 0, 0.13) 3px
  );
  opacity: 0.35;
  mix-blend-mode: multiply;
  animation: contestsHeroScan 7s linear infinite;
}

.contests-hero__layer--noise {
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23a)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: contestsHeroNoise 0.2s steps(2) infinite;
}

.contests-hero__layer--grime {
  background: linear-gradient(125deg, transparent 40%, rgba(0, 255, 255, 0.03) 50%, transparent 60%);
  background-size: 200% 200%;
  animation: contestsHeroShimmer 8s ease-in-out infinite;
  mix-blend-mode: soft-light;
  opacity: 0.5;
}

@keyframes contestsHeroScan {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(3px);
  }
}

@keyframes contestsHeroNoise {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-1px, 1px);
  }
}

@keyframes contestsHeroShimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Panel derecho: fondo propio + línea divisoria (no overlay full-bleed) */
.contests-hero--contained .contests-hero__panel {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
}

@media (min-width: 901px) {
  .contests-hero__split {
    border-radius: 1.25rem;
    overflow: hidden;
    border: 1px solid rgba(188, 178, 220, 0.18);
    box-shadow: 0 20px 56px rgba(0, 4, 16, 0.42);
  }

  .contests-hero--contained .contests-hero__art {
    border-radius: 0;
    min-height: 100%;
    align-self: stretch;
  }

  .contests-hero--contained .contests-hero__panel {
    border-left: 1px solid rgba(188, 178, 220, 0.32);
    padding-left: clamp(20px, 3vw, 36px);
    background: linear-gradient(105deg, rgba(6, 10, 22, 0.72) 0%, rgba(4, 8, 18, 0.55) 100%);
    border-radius: 0;
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.05);
  }

  .contests-hero--contained .contests-hero__inner {
    padding-left: 0;
    padding-right: clamp(22px, 3.6vw, 44px);
  }

  .contests-hero--contained .contests-hero__layer--image {
    background-position: 28% 48%;
  }
}

/* Mismos márgenes horizontales que .contests-wrap (catálogo y detalle alineados) */
.contests-hero--contained .contests-hero__inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: clamp(28px, 4vw, 48px) 0 clamp(28px, 3.5vw, 44px) 0;
}

.contests-hero__copy {
  width: 100%;
  min-width: 0;
  max-width: none;
  text-align: left;
  box-sizing: border-box;
}

.contests-hero__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px 14px;
  margin: 0 0 1.1rem;
  width: 100%;
}

.contests-hero__trophy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  color: #c4b5fd;
  background: rgba(8, 6, 20, 0.35);
  border: 1.5px solid rgba(167, 139, 250, 0.65);
  box-shadow:
    0 0 0 1px rgba(0, 255, 255, 0.08),
    0 0 36px rgba(138, 43, 226, 0.55),
    0 0 60px rgba(99, 102, 241, 0.2);
}

.contests-hero__trophy-svg {
  width: 22px;
  height: 22px;
  display: block;
  opacity: 0.95;
  filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.35));
}

.contests-hero__eyebrow {
  display: inline-flex;
  margin: 0;
  padding: 10px clamp(22px, 3.2vw, 36px);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #f8fafc;
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: var(--bxf-radius-full, 9999px);
  background: rgba(6, 8, 22, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 20px rgba(88, 28, 135, 0.25);
}

.contests-hero__title {
  margin: 0 0 1rem;
  width: 100%;
  font-family: var(--font-heading, "Segoe UI", system-ui, sans-serif);
  font-size: clamp(2.5rem, 4.2vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.04;
  /* Cian → púrpura (tokens --bxf-mega-title-*) */
  background: var(--bxf-mega-title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: var(--bxf-mega-title-filter);
}

.contests-hero__lead {
  margin: 0;
  max-width: none;
  width: 100%;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: clamp(0.86rem, 1.1vw, 0.98rem);
  line-height: 1.75;
  font-weight: 450;
  color: rgba(241, 245, 249, 0.94);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  text-align: left;
  text-wrap: balance;
  hyphens: none;
  -webkit-hyphens: none;
  overflow-wrap: break-word;
}

/* Palabra resaltada: sin guiones automáticos (evita "lea-derboard") */
.contests-hero__hl {
  color: #5ee9f5;
  font-weight: 700;
  text-shadow: 0 0 16px rgba(0, 255, 255, 0.5);
  hyphens: none;
  -webkit-hyphens: none;
}

@media (max-width: 900px) {
  .contests-hero__split {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height: 0;
    column-gap: 0;
    row-gap: 0;
  }

  .contests-hero--contained .contests-hero__art {
    grid-row: 1;
    min-height: min(48vw, 280px);
    border-radius: 1.75rem;
  }

  .contests-hero--contained .contests-hero__layer--image {
    background-position: 50% 42%;
  }

  .contests-hero--contained .contests-hero__panel {
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    border: none;
    padding-left: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .contests-hero__lead {
    text-align: left;
    text-align-last: auto;
    hyphens: none;
    -webkit-hyphens: none;
  }

  .contests-hero--contained .contests-hero__inner {
    padding: 28px var(--contest-page-pad, 22px) 32px;
  }

  .contests-hero__copy {
    max-width: none;
    width: 100%;
    margin: 0;
    text-align: left;
  }

  .contests-hero__kicker {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .contests-hero--contained .contests-hero__art {
    min-height: 200px;
    border-radius: 1.35rem 1.15rem 1.25rem 1.2rem;
  }

  .contests-hero--contained .contests-hero__inner {
    padding: 22px var(--contest-page-pad, 18px) 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contests-hero__layer--scan,
  .contests-hero__layer--noise,
  .contests-hero__layer--grime {
    animation: none;
  }
}

/* —— Grid principal —— */
.contests-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.contests-list-pane,
.contest-detail-pane {
  position: relative;
  border-radius: var(--bxf-radius-lg, 18px);
  padding: 24px 24px 26px;
  background: var(--cx-panel);
  border: 1px solid var(--cx-panel-border);
  border-left: 3px solid rgba(198, 157, 255, 0.48);
  box-shadow:
    var(--bxf-shadow-inset, inset 0 1px 0 rgba(255, 255, 255, 0.05)),
    0 0 0 1px rgba(203, 166, 247, 0.08),
    var(--bxf-panel-depth, 0 28px 100px rgba(0, 4, 18, 0.55)),
    0 0 40px rgba(198, 157, 255, 0.08);
  overflow: hidden;
}

.contests-list-pane::after,
.contest-detail-pane::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
  z-index: 2;
}

.contest-detail-pane {
  min-height: min(420px, 62vh);
}

/* Panel derecho: estado en reposo (catálogo / sync) */
.contest-detail-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  min-height: min(380px, 58vh);
  padding: 28px 20px 36px;
  position: relative;
  z-index: 1;
}

.contest-detail-idle__chrome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.contest-detail-idle__glyph {
  font-size: 1.65rem;
  line-height: 1;
  color: rgba(203, 166, 247, 0.82);
  text-shadow: 0 0 28px rgba(198, 157, 255, 0.45);
  animation: contestIdleGlyph 2.8s ease-in-out infinite;
}

@keyframes contestIdleGlyph {
  0%,
  100% {
    opacity: 0.55;
    text-shadow: 0 0 18px rgba(198, 157, 255, 0.35);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 36px rgba(198, 157, 255, 0.55);
  }
}

.contest-detail-idle__bars {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 22px;
}

.contest-detail-idle__bars span {
  width: 5px;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(188, 178, 220, 0.85), rgba(203, 166, 247, 0.35));
  animation: contestIdleBars 1.1s ease-in-out infinite alternate;
}

.contest-detail-idle__bars span:nth-child(1) {
  height: 10px;
  animation-delay: 0ms;
}

.contest-detail-idle__bars span:nth-child(2) {
  height: 18px;
  animation-delay: 120ms;
}

.contest-detail-idle__bars span:nth-child(3) {
  height: 14px;
  animation-delay: 240ms;
}

@keyframes contestIdleBars {
  from {
    transform: scaleY(0.55);
    opacity: 0.55;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.contest-detail-idle__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--bxf-mega-title-gradient, linear-gradient(95deg, #9ae6d4 0%, #c4b5fd 100%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: var(--bxf-section-title-filter, var(--bxf-mega-title-filter));
}

.contest-detail-idle__text {
  margin: 0;
  max-width: 36ch;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted, #7188a5);
  font-family: var(--font-mono);
}

.contest-detail-idle[hidden] {
  display: none !important;
}

.contests-list-pane {
  position: sticky;
  top: 88px;
}

.contests-list-pane__head {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--cx-line);
  position: relative;
  z-index: 1;
}

.contests-list-pane__title {
  margin: 0 0 6px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b8ecff;
}

.contests-list-pane__sub {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted, #7188a5);
}

.contests-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  max-height: min(72vh, 720px);
  overflow-y: auto;
  padding-right: 4px;
  position: relative;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(137, 180, 250, 0.35) transparent;
}

/* Aviso bajo el catálogo (errores / sin concursos); nunca ocupa el panel derecho */
.contests-catalog-hint {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(137, 180, 250, 0.22);
  position: relative;
  z-index: 1;
}

.contests-catalog-hint__text {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--text-muted, #7188a5);
  font-family: var(--font-mono);
}

#contest-detail-empty[hidden] {
  display: none !important;
}

.contests-list::-webkit-scrollbar {
  width: 6px;
}
.contests-list::-webkit-scrollbar-thumb {
  background: rgba(137, 180, 250, 0.28);
  border-radius: 99px;
}

.contest-list-item {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-radius: var(--bxf-radius-md, 12px);
  border: 1px solid rgba(188, 178, 220, 0.14);
  background: rgba(4, 10, 24, 0.55);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}

.contest-list-item:hover {
  border-color: rgba(196, 175, 232, 0.32);
  box-shadow: 0 8px 28px rgba(2, 8, 22, 0.35);
  transform: translateY(-1px);
}

/*
 * Fila activa: mismo tono base que el resto; solo anillo, sin gradiente “nuevo” que dispare
 * la sensación de que todo el bloque (o la página) cambia de color al elegir concurso.
 */
.contest-list-item.is-active {
  border-color: rgba(198, 157, 255, 0.4);
  box-shadow:
    0 0 0 1px rgba(198, 157, 255, 0.12),
    0 8px 22px rgba(0, 4, 14, 0.38);
  background: rgba(4, 10, 24, 0.6);
}

.contest-list-item__rail {
  width: 4px;
  flex-shrink: 0;
  border-radius: var(--bxf-radius-md, 12px) 0 0 var(--bxf-radius-md, 12px);
  /* Un único acento: el estado (activo/programado/cerrado) ya va en el texto; antes cada uno teñía la fila. */
  background: linear-gradient(180deg, rgba(188, 178, 220, 0.5), rgba(198, 157, 255, 0.32));
  opacity: 0.38;
  transition: opacity 0.2s ease;
}

.contest-list-item.is-active .contest-list-item__rail {
  opacity: 0.95;
}

/*
 * Sobreescribe reboot-ui (gradiente fijo con !important en .contest-list-item.is-active)
 * para que al cambiar de concurso el catálogo no “encienda” otra tira de color distinta
 * a la de las filas normales: solo borde y sombra, mismo fondo base.
 */
body.contest-hub-page .contest-list-item.is-active {
  background: rgba(4, 10, 24, 0.6) !important;
  color: inherit !important;
  border-color: rgba(198, 157, 255, 0.4) !important;
  box-shadow:
    0 0 0 1px rgba(198, 157, 255, 0.12),
    0 8px 22px rgba(0, 4, 14, 0.38) !important;
}

.contest-list-item__inner {
  flex: 1;
  padding: 14px 16px 14px 12px;
  min-width: 0;
}

.contest-list-item__title {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 6px;
}

.contest-list-item__meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.contest-list-item__meta--date {
  margin-top: 4px;
  opacity: 0.88;
  font-size: 0.68rem;
}

/* —— Detalle concurso —— */
.contest-detail {
  animation: contestDetailIn 0.35s ease both;
}

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

.contest-detail__header {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--cx-line);
}

.contest-detail__title {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  background: var(--bxf-mega-title-gradient, linear-gradient(95deg, #9ae6d4 0%, #c4b5fd 100%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: var(--bxf-section-title-filter, var(--bxf-mega-title-filter));
}

.contest-detail__meta {
  margin-bottom: 0;
}

.contest-meta {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.contest-detail__prose {
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: var(--bxf-radius-md, 12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.88rem;
  line-height: 1.6;
  color: #c8d6e8;
  white-space: pre-wrap;
  word-break: break-word;
}

.contest-ranking-link-wrap {
  margin: 0 0 18px;
}

.contest-ranking-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e8d4ff;
  text-decoration: none;
  padding: 11px 18px;
  border-radius: var(--bxf-radius-full, 9999px);
  border: 1px solid rgba(203, 166, 247, 0.45);
  background: linear-gradient(135deg, rgba(203, 166, 247, 0.14), rgba(196, 175, 232, 0.08));
  box-shadow: 0 4px 20px rgba(12, 6, 28, 0.35);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.contest-ranking-link:hover {
  border-color: rgba(203, 166, 247, 0.65);
  box-shadow: 0 6px 28px rgba(198, 157, 255, 0.2);
  transform: translateY(-1px);
}

.contest-detail-lead {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-left: 3px solid rgba(188, 178, 220, 0.45);
  border-radius: 0 var(--bxf-radius-sm, 8px) var(--bxf-radius-sm, 8px) 0;
  background: rgba(196, 175, 232, 0.08);
  font-size: 0.84rem;
  color: #b4c9e0;
  line-height: 1.5;
}

.contest-progress {
  margin: 0 0 18px;
  padding: 10px 14px;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ec8e8;
  border-radius: var(--bxf-radius-sm, 8px);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(137, 180, 250, 0.15);
}

/* —— Panel enunciado fijado —— */
.contest-challenge-focus {
  margin: 0 0 24px;
  padding: 0;
  border-radius: var(--bxf-radius-lg, 18px);
  border: 1px solid rgba(203, 166, 247, 0.35);
  background:
    linear-gradient(145deg, rgba(22, 12, 40, 0.55) 0%, transparent 45%),
    linear-gradient(165deg, rgba(8, 14, 32, 0.98), rgba(4, 8, 18, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 16px 48px rgba(2, 4, 16, 0.5);
  overflow: hidden;
}

.contest-challenge-focus__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--cx-line);
}

.contest-challenge-focus__kicker {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #cba6f7;
}

.contest-challenge-focus__deco {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, #c69dff, #d4c4f5, #8ef7be);
  opacity: 0.85;
}

.contest-challenge-focus__title {
  margin: 0;
  padding: 4px 18px 12px;
  font-size: 1.12rem;
  font-weight: 800;
  color: #f2f6ff;
  line-height: 1.35;
}

.contest-challenge-focus__body {
  margin: 0;
  padding: 0 18px 16px;
  font-size: 0.93rem;
  line-height: 1.62;
  color: #dce6f2;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(46vh, 400px);
  overflow: auto;
  scrollbar-width: thin;
}

.contest-challenge-focus__hint {
  margin: 0;
  padding: 12px 18px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-dim);
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.contest-ch-focus-open-btn {
  display: flex;
  width: calc(100% - 36px);
  margin: 0 18px 18px;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 12px 16px;
  border-radius: var(--bxf-radius-md, 12px);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, rgba(203, 166, 247, 0.22), rgba(188, 178, 220, 0.12)) !important;
  border-color: rgba(203, 166, 247, 0.5) !important;
}

.contest-ch-focus-open-btn:disabled {
  filter: grayscale(0.3);
}

/* —— Sección retos —— */
.contest-challenges-section {
  margin-top: 8px;
  padding-top: 22px;
  border-top: 1px solid var(--cx-line);
}

.contest-challenges-section__title {
  margin: 0 0 6px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #c8b8e8;
}

.contest-challenges-section__sub {
  margin: 0 0 18px;
  font-size: 0.76rem;
  color: var(--text-muted, #7188a5);
  line-height: 1.45;
}

.contest-challenges-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* —— Tarjetas reto —— */
.contest-ch {
  position: relative;
  padding: 0;
  margin: 0;
  border-radius: var(--bxf-radius-lg, 16px);
  border: 1px solid rgba(188, 178, 220, 0.16);
  background: transparent;
  transition: border-color 0.2s ease, box-shadow 0.22s ease, transform 0.18s ease;
}

.contest-ch--selectable {
  cursor: pointer;
}

.contest-ch:hover {
  border-color: rgba(196, 175, 232, 0.28);
  box-shadow: 0 12px 36px rgba(2, 8, 20, 0.38);
  transform: translateY(-2px);
}

.contest-ch.is-selected {
  border-color: rgba(196, 175, 232, 0.55);
  box-shadow:
    0 0 0 1px rgba(196, 175, 232, 0.15),
    0 16px 40px rgba(4, 16, 32, 0.45);
}

.contest-ch.is-solved {
  border-color: rgba(166, 227, 161, 0.38);
}

.contest-ch.is-solved:hover {
  box-shadow: 0 12px 36px rgba(8, 32, 16, 0.28);
}

.contest-ch.is-unlocked:not(.is-solved) {
  border-color: rgba(203, 166, 247, 0.22);
}

.contest-ch.is-locked {
  opacity: 0.55;
  border-style: dashed;
  transform: none;
}

.contest-ch__surface {
  border-radius: inherit;
  padding: 18px 20px 16px;
  background: linear-gradient(160deg, rgba(16, 12, 26, 0.8) 0%, rgba(8, 6, 16, 0.9) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.contest-ch__head {
  margin-bottom: 12px;
}

.contest-ch__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.contest-ch__chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--bxf-radius-full, 9999px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.contest-ch__chip--bash {
  color: #ffd4b8;
  border-color: rgba(250, 179, 135, 0.35);
  background: rgba(250, 179, 135, 0.1);
}

.contest-ch__chip--pts {
  color: #b8ecff;
  border-color: rgba(196, 175, 232, 0.35);
  background: rgba(196, 175, 232, 0.1);
}

.contest-ch__chip--open {
  color: #e8d4ff;
  border-color: rgba(203, 166, 247, 0.4);
  background: rgba(203, 166, 247, 0.1);
}

.contest-ch__chip--solved {
  color: #b8f5c8;
  border-color: rgba(166, 227, 161, 0.45);
  background: rgba(166, 227, 161, 0.12);
}

.contest-ch__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #f4f7ff;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.contest-ch__body {
  font-size: 0.9rem;
  line-height: 1.58;
  color: #c5d4e8;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--bxf-radius-md, 12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  max-height: min(36vh, 280px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.contest-ch__actions {
  margin: 0;
  padding-top: 4px;
}

.contest-ch-enter-btn {
  width: 100%;
  border: 1px solid rgba(196, 175, 232, 0.42);
  background: linear-gradient(135deg, rgba(196, 175, 232, 0.16), rgba(196, 175, 232, 0.08));
  color: #dff6ff;
  border-radius: var(--bxf-radius-md, 12px);
  padding: 11px 16px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: filter 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.contest-ch-enter-btn:hover {
  border-color: rgba(196, 175, 232, 0.65);
  box-shadow: 0 0 24px rgba(188, 178, 220, 0.15);
  filter: brightness(1.06);
}

.contest-ch-enter-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  filter: none;
  box-shadow: none;
}

.contest-ch__submit {
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.contest-ch-flag-form {
  margin: 0;
}

.contest-ch-flag-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9ec8e8;
  margin-bottom: 8px;
  font-family: var(--font-mono);
}

.contest-ch-flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.contest-ch-flag-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(196, 175, 232, 0.35);
  background: rgba(0, 0, 0, 0.45);
  color: #e8e8ef;
  border-radius: var(--bxf-radius-md, 12px);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.contest-ch-flag-input--script {
  min-height: 130px;
  resize: vertical;
  line-height: 1.5;
}

.contest-ch-flag-input:focus {
  outline: none;
  border-color: rgba(196, 175, 232, 0.65);
  box-shadow: 0 0 0 2px rgba(196, 175, 232, 0.15);
}

.contest-ch-flag-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(166, 227, 161, 0.5);
  background: rgba(166, 227, 161, 0.14);
  color: #a6e3a1;
  border-radius: var(--bxf-radius-md, 12px);
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.contest-ch-open-terminal-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(196, 175, 232, 0.5);
  background: rgba(196, 175, 232, 0.12);
  color: #c8f3ff;
  border-radius: var(--bxf-radius-md, 12px);
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.contest-ch-open-terminal-btn:hover,
.contest-ch-flag-btn:hover {
  filter: brightness(1.08);
}

.contest-ch-flash-msg {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.contest-ch-offline {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
}

.contest-ch--empty {
  border-style: dashed;
  opacity: 0.85;
  padding: 20px;
  text-align: center;
}

.contest-gate {
  border: 1px solid rgba(188, 178, 220, 0.32);
  border-left: 3px solid rgba(250, 179, 135, 0.55);
  border-radius: var(--bxf-radius-lg, 16px);
  padding: 22px 24px;
  margin-bottom: 16px;
  background: linear-gradient(160deg, rgba(10, 18, 38, 0.94) 0%, rgba(4, 10, 22, 0.98) 100%);
  box-shadow: 0 14px 36px rgba(0, 4, 18, 0.45);
}

.contest-gate__label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c8b8e8;
}

.contest-gate__countdown {
  margin: 0 0 10px;
  font-size: clamp(1.05rem, 1.4vw, 1.35rem);
  font-family: var(--font-mono);
  font-weight: 800;
  color: #f9e2af;
  letter-spacing: 0.06em;
}

.contest-gate__note {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #b4c4dc;
}

.contest-ch__meta {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.contest-ch__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.contest-badge {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  letter-spacing: 0.04em;
}

.contest-badge--ctf {
  background: rgba(196, 175, 232, 0.12);
  border-color: rgba(196, 175, 232, 0.35);
  color: #b8ecff;
}

.contest-badge--linux {
  background: rgba(166, 227, 161, 0.1);
  border-color: rgba(166, 227, 161, 0.35);
  color: #c8f0c4;
}

.contest-badge--bash {
  background: rgba(250, 179, 135, 0.12);
  border-color: rgba(250, 179, 135, 0.35);
  color: #ffd4b8;
}

.contest-badge--flag {
  background: rgba(203, 166, 247, 0.12);
  border-color: rgba(203, 166, 247, 0.35);
  color: #e8d4ff;
}

.contest-badge--term {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

.contest-badge--bashc {
  background: rgba(249, 226, 175, 0.1);
  border-color: rgba(249, 226, 175, 0.35);
  color: #fde9a8;
}

/* —— Tutorial modal (contests) —— */
.contests-tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 21000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 8, 18, 0.84);
}

.contests-tutorial-overlay.is-open {
  display: flex;
}

.contests-tutorial-modal {
  width: min(640px, 95vw);
  border-radius: 14px;
  border: 1px solid rgba(196, 175, 232, 0.42);
  background: linear-gradient(160deg, rgba(12, 20, 44, 0.98), rgba(4, 10, 22, 0.98));
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.52);
  padding: 18px 18px 14px;
}

.contests-tutorial-modal__kicker {
  margin: 0 0 5px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #cba6f7;
}

.contests-tutorial-modal__title {
  margin: 0 0 10px;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: #edf4ff;
  line-height: 1.25;
}

.contests-tutorial-modal__desc {
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #c6d8eb;
}

.contests-tutorial-modal__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.contests-tutorial-btn {
  border: 1px solid rgba(137, 180, 250, 0.42);
  background: rgba(137, 180, 250, 0.12);
  color: #d9e9ff;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.contests-tutorial-btn--primary {
  border-color: rgba(166, 227, 161, 0.52);
  background: rgba(166, 227, 161, 0.16);
  color: #c9f7c8;
}

.contests-tutorial-btn:hover {
  filter: brightness(1.08);
}

.contests-tutorial-modal__step {
  margin: 10px 0 0;
  font-size: 0.72rem;
  color: #b8b0cf;
  font-family: var(--font-mono);
}

/* Guided spotlight tutorial (contests page) */
.contests-guided-overlay {
  position: fixed;
  inset: 0;
  z-index: 22000;
  pointer-events: auto;
}

.contests-guided-overlay-pane {
  position: absolute;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.contests-guided-highlight {
  position: fixed;
  z-index: 22001;
  border: 2px solid #c8b8e8;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(196, 175, 232, 0.42);
  pointer-events: none;
  transition: all 0.28s ease;
}

.contests-guided-card {
  position: fixed;
  z-index: 22002;
  display: block;
  border-radius: 12px;
  border: 1px solid rgba(196, 175, 232, 0.48);
  background: linear-gradient(160deg, rgba(12, 20, 44, 0.98), rgba(4, 10, 22, 0.98));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.52);
  padding: 14px;
  color: #e5eef9;
}

.contests-guided-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #cba6f7;
}

.contests-guided-card p {
  margin: 0 0 10px;
  font-size: 0.88rem;
  line-height: 1.52;
  color: #c6d8eb;
}

.contests-guided-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.contests-guided-btn {
  border: 1px solid rgba(137, 180, 250, 0.42);
  background: rgba(137, 180, 250, 0.12);
  color: #d9e9ff;
  border-radius: 9px;
  padding: 8px 11px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  cursor: pointer;
}

.contests-guided-btn--primary {
  border-color: rgba(166, 227, 161, 0.52);
  background: rgba(166, 227, 161, 0.16);
  color: #c9f7c8;
}

.contests-guided-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.contests-guided-step {
  margin-top: 8px;
  font-size: 0.72rem;
  color: #b8b0cf;
  font-family: var(--font-mono);
}

/* contest-leaderboard.html — tabla alineada con leaderboard global v2 */
.contest-lb-standalone .lb-table-wrapper {
  background: rgba(3, 6, 14, 0.92) !important;
  border: 1px solid rgba(130, 118, 168, 0.28) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 26px 80px rgba(0, 0, 0, 0.48) !important;
}

.contest-lb-standalone .lb-page .lb-table thead tr {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: linear-gradient(90deg, rgba(18, 14, 28, 0.98), rgba(12, 10, 20, 0.96)) !important;
}

.contest-lb-standalone .lb-page .lb-table tbody tr {
  background: rgba(10, 8, 18, 0.48) !important;
  box-shadow: none !important;
}

.contest-lb-standalone .lb-page .lb-table tbody tr:hover {
  background: rgba(18, 28, 48, 0.62) !important;
  box-shadow: inset 3px 0 0 rgba(137, 180, 250, 0.45) !important;
}

/* Panel de navegación inferior: mismo radio en todas las esquinas (evita lectura “corte” asimétrico) */
.contest-lb-standalone .contest-lb-nav-panel.lb-hero {
  border-radius: var(--rx-radius-lg, 20px) !important;
}

/* contest-leaderboard.html — podio + tabla como leaderboard global */
.contest-lb-back {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.contest-lb-back__sep {
  margin: 0 10px;
  color: rgba(166, 173, 200, 0.55);
}

.contest-lb-back__link {
  color: #d4b8ff;
  text-decoration: none;
}

.contest-lb-back__link:hover {
  text-decoration: underline;
}

.contest-lb-nav-panel .contest-lb-back {
  margin-bottom: 0;
  text-align: center;
}

.contest-lb-standalone .lb-table {
  min-width: min(100%, 720px);
}

.contest-lb-standalone .podium {
  margin-bottom: 24px;
}

.contest-lb-standalone .podium-card[data-user-id],
.contest-lb-standalone #contest-lb-body tr[data-user-id] {
  cursor: pointer;
}

.contest-lb-initial {
  font-family: var(--font-mono);
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  user-select: none;
}

.lb-avatar-sm .contest-lb-initial {
  font-size: 0.82rem;
}

.podium-avatar .contest-lb-initial {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.contest-lb-banner.contest-lb-banner--err {
  border-color: rgba(243, 139, 168, 0.45);
  color: #f38ba8;
  background: rgba(243, 139, 168, 0.08);
}

.contest-lb-empty {
  text-align: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 16px 10px;
}

@media (max-width: 980px) {
  .contests-list-pane {
    position: static;
    max-height: none;
  }

  .contests-list {
    max-height: none;
  }

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

  .contest-ch-flag-row {
    flex-direction: column;
  }

  .contest-ch-flag-btn {
    width: 100%;
  }

  .contest-ch-open-terminal-btn {
    width: 100%;
  }

  .contest-ch-focus-open-btn {
    width: calc(100% - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .contests-hero__scan,
  .contest-detail-idle__glyph,
  .contest-detail-idle__bars span {
    animation: none !important;
    opacity: 0.85;
  }

  .contest-detail,
  .contest-list-item,
  .contest-ch {
    animation: none !important;
    transition: none !important;
  }

  .contest-list-item:hover,
  .contest-ch:hover,
  .contest-ranking-link:hover {
    transform: none !important;
  }
}
