/* Juegos sensoriales de Spectra: escenario a pantalla, botonera de cristal, tarjetas de inicio y cierre. */
body.sj-body { overflow: hidden; overscroll-behavior: none; background: #030712; }
body.sj-body .spectra-main { padding: 0 !important; min-height: 0; }

.sj-stage {
  position: fixed; left: 0; right: 0; bottom: 0;
  top: var(--spectra-header-height, 0px);
  z-index: 10; overflow: hidden; background: #030712;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif; color: #eef6ff;
}
.sj-stage:fullscreen { top: 0; width: 100vw; height: 100vh; }
.sj-stage:-webkit-full-screen { top: 0; width: 100vw; height: 100vh; }
.sj-canvas { position: absolute; inset: 0; display: block; cursor: pointer; touch-action: none; }

/* Botonera */
.sj-hud {
  position: absolute; z-index: 5; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none;
}
body.spectra-program-resource .sj-hud { top: 72px; }
.sj-hud__left, .sj-hud__right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; pointer-events: auto; }
.sj-hud__right { justify-content: flex-end; }
.sj-iconbtn {
  width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .16); background: rgba(8, 14, 32, .45); color: #eef6ff;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); cursor: pointer; padding: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transition: transform .18s ease, background .2s ease, border-color .2s ease;
  text-decoration: none;
}
.sj-iconbtn svg { width: 20px; height: 20px; fill: currentColor; }
.sj-iconbtn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); }
.sj-iconbtn:active { transform: scale(.92); }
.sj-iconbtn:focus-visible, .sj-btn:focus-visible { outline: 2px solid var(--sj-accent, #5fd4ff); outline-offset: 3px; }
.sj-pill {
  padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: .92rem; letter-spacing: .01em;
  background: rgba(8, 14, 32, .45); border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  font-variant-numeric: tabular-nums;
}
.sj-pill--bump { animation: sjBump .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes sjBump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }

/* Frases suaves */
.sj-toast {
  position: absolute; z-index: 4; left: 50%; top: 22%; transform: translate(-50%, 8px);
  max-width: min(520px, 86vw); text-align: center; pointer-events: none;
  font-size: clamp(1.05rem, 2.6vw, 1.45rem); font-weight: 500; letter-spacing: .01em; line-height: 1.45;
  color: rgba(240, 248, 255, .94); text-shadow: 0 2px 22px rgba(0, 0, 0, .65), 0 0 30px rgba(120, 200, 255, .25);
  opacity: 0; transition: opacity 1.1s ease, transform 1.1s ease;
}
.sj-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Tarjetas de inicio y cierre */
.sj-overlay {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 90% at 50% 40%, rgba(3, 7, 18, .35), rgba(3, 7, 18, .78));
  opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s linear .6s;
  overflow-y: auto; touch-action: pan-y;
}
.sj-overlay.is-on { opacity: 1; visibility: visible; transition: opacity .6s ease; }
.sj-card {
  width: min(460px, 100%); text-align: center; padding: 30px 26px 24px; border-radius: 26px;
  background: linear-gradient(160deg, rgba(20, 32, 64, .72), rgba(8, 14, 32, .78));
  border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 30px 80px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  transform: translateY(14px) scale(.98); transition: transform .7s cubic-bezier(.2, .9, .3, 1);
}
.sj-overlay.is-on .sj-card { transform: none; }
.sj-card__icon {
  font-size: 2.6rem; line-height: 1; width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .22), rgba(255, 255, 255, .04));
  box-shadow: 0 0 40px color-mix(in srgb, var(--sj-accent, #5fd4ff) 45%, transparent);
  animation: sjFloat 5s ease-in-out infinite;
}
@keyframes sjFloat { 50% { transform: translateY(-5px); } }
.sj-card__title { margin: 0 0 8px; font-size: clamp(1.5rem, 4.6vw, 2rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.sj-card__text { margin: 0 auto 14px; color: rgba(214, 232, 255, .82); line-height: 1.6; font-size: .98rem; max-width: 38ch; }
.sj-steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; text-align: left; counter-reset: sj; }
.sj-steps li {
  counter-increment: sj; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); color: rgba(232, 242, 255, .9); font-size: .92rem; line-height: 1.45;
}
.sj-steps li::before {
  content: counter(sj); flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; color: #04101f; background: var(--sj-accent, #5fd4ff);
}
.sj-card__hint { margin: 14px 0 0; font-size: .8rem; color: rgba(200, 222, 255, .55); }
.sj-card__breath { margin: 4px auto 18px; font-size: .86rem; color: rgba(200, 222, 255, .66); line-height: 1.5; max-width: 34ch; }
.sj-card__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sj-btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 28px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 1rem;
  transition: transform .18s ease, box-shadow .25s ease, background .2s ease;
}
.sj-btn--primary {
  color: #04101f; background: linear-gradient(135deg, #ffffff, var(--sj-accent, #5fd4ff));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--sj-accent, #5fd4ff) 40%, transparent);
}
.sj-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 14px 36px color-mix(in srgb, var(--sj-accent, #5fd4ff) 55%, transparent); }
.sj-btn--ghost { color: #eef6ff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); }
.sj-btn--ghost:hover { background: rgba(255, 255, 255, .14); }
.sj-btn:active { transform: scale(.96); }
.sj-stats { display: flex; gap: 10px; justify-content: center; margin: 4px 0 14px; flex-wrap: wrap; }
.sj-stat { min-width: 96px; padding: 10px 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); display: grid; gap: 2px; }
.sj-stat strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.sj-stat span { font-size: .76rem; color: rgba(200, 222, 255, .7); }

/* Botones de juego dentro del escenario (ej. añadir pelotas) */
.sj-dock {
  position: absolute; z-index: 5; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100% - 24px);
}
.sj-chip {
  appearance: none; cursor: pointer; font: inherit; font-size: .88rem; font-weight: 600; color: #eef6ff;
  padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(8, 14, 32, .5);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: inline-flex; gap: 6px; align-items: center;
  transition: transform .15s ease, background .2s ease;
}
.sj-chip:hover { background: rgba(255, 255, 255, .14); }
.sj-chip:active { transform: scale(.95); }
.sj-chip[aria-pressed="true"] { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .34); }

@media (max-width: 560px) {
  .sj-iconbtn { width: 38px; height: 38px; }
  .sj-iconbtn svg { width: 18px; height: 18px; }
  .sj-card { padding: 24px 18px 20px; border-radius: 22px; }
  .sj-steps li { font-size: .88rem; }
  .sj-chip { font-size: .76rem; padding: 8px 9px; }
  .sj-dock { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .sj-card__icon { animation: none; }
  .sj-toast, .sj-overlay, .sj-card { transition-duration: .01s; }
}
