/* ============================================================
   ESTILOS GLOBALES Y DEL LANZADOR
   ============================================================ */
:root {
  --noche: #150E2E;
  --noche-2: #221548;
  --magenta: #FF3D8B;
  --cian: #3DE0E5;
  --oro: #FFC53D;
  --papel: #F3ECFF;
  --gris: #7A68A8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--noche);
  color: var(--papel);
  font-family: 'Trebuchet MS', Verdana, sans-serif;
  min-height: 100%;
  overflow-x: hidden;
}
/* Fondo de estrellas */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(2px 2px at 12% 18%, #fff, transparent),
    radial-gradient(2px 2px at 68% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 34% 62%, var(--cian), transparent),
    radial-gradient(2px 2px at 88% 44%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 22% 84%, var(--oro), transparent),
    radial-gradient(2px 2px at 76% 78%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 52% 32%, #fff, transparent),
    radial-gradient(ellipse at 50% 0%, #35205F 0%, var(--noche) 60%);
  opacity: .9;
}
.envoltura {
  position: relative; z-index: 1;
  max-width: 960px; margin: 0 auto; padding: 36px 20px 70px;
}

/* Cabecera */
header { text-align: center; padding: 24px 0 12px; }
header svg { width: min(520px, 90vw); height: auto; display: block; margin: 0 auto; }
.lema {
  margin-top: 16px; color: #B9A8E8; font-size: 15px; line-height: 1.75;
  max-width: 52ch; margin-left: auto; margin-right: auto;
}

/* Rejilla de juegos (cartuchos) */
.rejilla {
  margin-top: 50px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  align-items: stretch;
}
.cartucho {
  background: linear-gradient(180deg, var(--noche-2), #190F38);
  border: 3px solid #3E2A72;
  border-radius: 6px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 6px 0 #0C0720;
  transition: transform .15s, border-color .15s;
}
.cartucho:hover { border-color: var(--cian); transform: translateY(-3px); }
.cartucho .miniatura {
  border-radius: 4px; overflow: hidden; background: #0E0824;
  aspect-ratio: 16/9;
}
.cartucho .miniatura svg { display: block; width: 100%; height: 100%; }
.cartucho .numeroJuego { font-size: 12px; color: #8C79C4; letter-spacing: .18em; }
.cartucho h3 { font-size: 23px; letter-spacing: .02em; }
.cartucho p { font-size: 13.5px; color: #B9A8E8; line-height: 1.7; flex: 1; }
.btn {
  background: var(--magenta); color: #1A0A18; border: none;
  border-bottom: 4px solid #B31D5C; border-radius: 4px;
  padding: 13px 22px; font-size: 16px; font-weight: bold;
  letter-spacing: .06em; cursor: pointer;
  transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(3px); border-bottom-width: 1px; }
.btn.cian { background: var(--cian); border-bottom-color: #1E9BA0; color: #04262A; }
.btn.fantasma {
  background: transparent; color: #B9A8E8; border: 2px solid #4B3585;
  border-bottom-width: 2px; font-size: 14px; padding: 11px 16px; font-weight: normal;
}
.btn.fantasma:hover { border-color: var(--magenta); color: var(--magenta); }
.btn:focus-visible { outline: 3px solid var(--oro); outline-offset: 3px; }

.nota {
  margin-top: 44px; border-top: 1px solid #2E1F55; padding-top: 26px;
  color: #9A88CC; font-size: 13.5px; line-height: 1.85; max-width: 60ch;
}
.nota b { color: #CDBEF0; font-weight: normal; }
footer {
  margin-top: 52px; text-align: center; color: #7A68A8; font-size: 12.5px; line-height: 1.9;
}
footer .sello { color: #B9A8E8; letter-spacing: .22em; font-size: 13px; }

/* ============================================================
   PANTALLA DE JUEGO (capa flotante)
   ============================================================ */
#pantallaJuego {
  position: fixed; inset: 0; z-index: 50;
  background: #0A0518;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
#pantallaJuego.abierta { display: flex; }
.marco {
  width: min(880px, 100%);
  display: flex; flex-direction: column; gap: 10px;
}
.barraSuperior {
  display: flex; justify-content: space-between; gap: 10px;
}
.chip {
  background: transparent; border: 2px solid #4B3585; color: #B9A8E8;
  border-radius: 4px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: var(--magenta); color: var(--magenta); }
.escena {
  position: relative;
  background: #0E0824;
  border: 3px solid #3E2A72;
  border-radius: 4px;
  min-height: 300px;
}
.escena canvas {
  display: block;
  width: 100%; height: auto;
  image-rendering: pixelated;
}
.escena .capa {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(10,5,24,.93);
  text-align: center; padding: 20px;
  overflow-y: auto;
}
.escena .capa.oculta { display: none; }
.escena .capa h2 { font-size: clamp(20px, 3.6vw, 32px); color: var(--oro); letter-spacing: .03em; line-height: 1.2; }
.escena .capa .lugar { color: var(--cian); font-size: 12px; letter-spacing: .16em; }
.escena .capa p { color: #B9A8E8; font-size: 13.5px; max-width: 46ch; line-height: 1.7; }
.escena .capa .diario { border-left: 3px solid #4B3585; padding-left: 14px; text-align: left; font-style: italic; color: #CDBEF0; white-space: pre-line; }
.escena .fila { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.selector { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.selector button {
  background: #2B1B5A; color: var(--papel); border: 2px solid #4B3585;
  border-radius: 4px; padding: 9px 12px; font-size: 12.5px; min-width: 112px;
  display: flex; flex-direction: column; gap: 3px; align-items: center; cursor: pointer;
}
.selector button:hover:not(:disabled) { border-color: var(--cian); }
.selector button:disabled { opacity: .35; cursor: not-allowed; }
.selector .num { font-size: 10.5px; color: #8C79C4; letter-spacing: .12em; }
.selector .medalla { font-size: 13px; letter-spacing: 2px; min-height: 16px; color: var(--oro); }

/* Controles táctiles (se muestran en pantallas táctiles) */
.tactil { display: none; gap: 10px; margin-top: 14px; }
.tactil button {
  width: 74px; height: 56px; font-size: 20px;
  background: #2B1B5A; color: var(--papel);
  border: 2px solid #4B3585; border-radius: 6px; cursor: pointer;
}
@media (hover:none) { .tactil { display: flex; } }
.giro { display: none; color: #7A68A8; font-size: 12px; margin-top: 12px; text-align: center; }
@media (max-width: 860px) and (orientation: portrait) { .giro { display: block; } }

.marcador {
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
  margin-top: 12px; font-size: 13.5px; color: #B9A8E8; letter-spacing: .04em;
}
.marcador b { color: var(--oro); }
.marcador .mundo { color: var(--cian); }
.marcador .jefe { color: var(--magenta); }

@media (max-width: 720px) {
  .rejilla { grid-template-columns: 1fr; }
  .escena .capa {
    position: fixed; inset: 0; z-index: 60;
    background: #0A0518;
    justify-content: flex-start;
    padding: 44px 20px 36px;
  }
  .escena .capa h2 { font-size: 24px; }
  .escena .capa p { font-size: 13.5px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
