/* ---------- Huevo de Pascua: la lunita del hero ---------- */
.egg-moon {
  position: absolute;
  z-index: 2;
  right: clamp(20px, 8vw, 140px);
  bottom: clamp(24px, 9vh, 90px);
  width: clamp(58px, 6.5vw, 92px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 0 18px rgba(167,139,250,0.35));
  animation: eggFloat 7s ease-in-out infinite;
}
.egg-moon svg { width: 100%; height: 100%; overflow: visible; display: block; }
.egg-moon:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 6px; border-radius: 50%; }
.egg-moon:hover { filter: drop-shadow(0 0 22px rgba(167,139,250,0.6)); }

.egg-moon .em-cracks { opacity: 0; transition: opacity .35s ease; }
.egg-moon .em-seep   { opacity: 0; transition: opacity .35s ease; }
.egg-moon[data-stage="2"] .em-cracks { opacity: 1; }
.egg-moon[data-stage="2"] .em-seep { opacity: .5; }
.egg-moon[data-stage="3"] .em-seep { opacity: 1; }
.egg-moon .em-half { transform-origin: 60px 60px; transform-box: view-box; }
.egg-moon[data-stage="3"] .em-half--a { animation: eggSplitA .55s cubic-bezier(.2,.9,.3,1.2) forwards; }
.egg-moon[data-stage="3"] .em-half--b { animation: eggSplitB .55s cubic-bezier(.2,.9,.3,1.2) forwards; }
@keyframes eggSplitA { to { transform: translate(-5px, 1px) rotate(-5deg); } }
@keyframes eggSplitB { to { transform: translate(5px, -1px) rotate(5deg); } }
.egg-moon .em-half { display: none; }
.egg-moon[data-stage="3"] .em-half { display: inline; }
.egg-moon[data-stage="3"] .em-whole { display: none; }
.egg-moon[data-stage="3"] .em-seep { opacity: 0; }
.egg-moon .em-core { opacity: 0; transition: opacity .4s ease; }
.egg-moon[data-stage="3"] .em-core { opacity: 1; }
.egg-moon.is-hit svg { animation: eggHit .38s ease-out; }

@keyframes eggFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes eggHit {
  0%   { transform: scale(1) rotate(0); }
  25%  { transform: scale(.93) rotate(-4deg); }
  55%  { transform: scale(1.04) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .egg-moon { animation: none; }
  .egg-moon.is-hit svg { animation: none; }
  .egg-moon[data-stage="3"] .em-half--a { animation: none; transform: translate(-5px, 1px) rotate(-5deg); }
  .egg-moon[data-stage="3"] .em-half--b { animation: none; transform: translate(5px, -1px) rotate(5deg); }
}
@media (max-width: 600px) {
  .egg-moon { right: 18px; bottom: 20px; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Ventana del juego ---------- */
html.moon-lock { overflow: hidden; padding-right: var(--moon-sbw, 0); }
html.moon-lock .nav { padding-right: var(--moon-sbw, 0); }

.moon-game {
  padding: 0;
  border: 1px solid rgba(167,139,250,0.35);
  border-radius: 20px;
  background: #0a0720;
  color: #fff;
  width: min(96vw, calc(90dvh * 16 / 9), 1240px);
  aspect-ratio: 16 / 9;
  max-width: none;
  max-height: none;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
}
.moon-game[open] { display: block; }
.moon-game::backdrop { background: rgba(6,4,20,0.82); backdrop-filter: blur(6px); }

/* móvil / vertical: pantalla completa, el encuadre se adapta en 3D */
@media (max-aspect-ratio: 4/3), (max-width: 640px) {
  .moon-game {
    width: 100vw; height: 100dvh; aspect-ratio: auto;
    border: 0; border-radius: 0;
  }
}

.moon-game__stage { position: relative; width: 100%; height: 100%; outline: none; overflow: hidden; background: #140f35; }
.moon-game__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* viñeta: bordes más oscuros y centro más claro; no intercepta toques */
.moon-game__stage::after {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 50%, rgba(0,0,0,0) 40%, rgba(5,3,18,0.28) 72%, rgba(5,3,18,0.7) 100%);
}

.moon-game__hud {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 12px;
  pointer-events: none;
}
.moon-game__score {
  position: absolute; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%);
  font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 800; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 14px rgba(0,0,0,0.55), 0 0 22px rgba(139,92,246,0.55);
}
.moon-game__btns { display: flex; gap: 8px; pointer-events: auto; }
.moon-game__btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.35);
  background: rgba(14,10,40,0.55);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .2s ease, transform .15s ease, border-color .2s ease;
}
.moon-game__btn:hover { background: rgba(139,92,246,0.45); border-color: rgba(255,255,255,0.6); }
.moon-game__btn:active { transform: scale(.94); }
.moon-game__btn:disabled { opacity: .35; cursor: default; }
.moon-game__btn:focus-visible, .moon-game__cta:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 3px; }

.moon-game__panel {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center;
  pointer-events: none;
}
.moon-game__panel[hidden] { display: none; }
.moon-game__panel--start { justify-content: flex-start; padding-top: clamp(64px, 14%, 110px); }
.moon-game__panel--over, .moon-game__panel--pause, .moon-game__panel--loading, .moon-game__panel--error {
  background: radial-gradient(ellipse at center, rgba(10,6,34,0.72), rgba(10,6,34,0.35) 70%);
}
.moon-game__panel--start { justify-content: flex-end; padding-bottom: clamp(36px, 9%, 70px); }
.moon-game__panel button { pointer-events: auto; }

.moon-game__title {
  margin: 0;
  font-size: clamp(1.35rem, 3.6vw, 2.2rem);
  font-weight: 750;
  letter-spacing: -.01em;
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
}
.moon-game__panel--start .moon-game__title {
  background: linear-gradient(135deg, #b9ffd0, #5dff8a 55%, #a78bfa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.55));
}
.moon-game__hint {
  margin: 0; font-size: clamp(.95rem, 2.2vw, 1.15rem); color: rgba(255,255,255,0.88);
  text-shadow: 0 1px 10px rgba(0,0,0,0.7);
}
.moon-game__final { margin: 0; display: flex; align-items: baseline; gap: 10px; font-size: clamp(3rem, 10vw, 4.6rem); font-weight: 800; line-height: 1; }
.moon-game__final small { font-size: 1rem; font-weight: 600; color: rgba(255,255,255,0.65); }
.moon-game__best { margin: 0; color: rgba(255,255,255,0.8); }
.moon-game__best strong { color: #7dffa6; }

.moon-game__cta {
  margin-top: 6px;
  padding: 13px 28px; min-height: 48px;
  border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 1.05rem;
  color: #07130c; background: linear-gradient(135deg, #8dffb0, #3be07a);
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(60,224,122,0.35);
  transition: transform .15s ease, opacity .2s ease, box-shadow .2s ease;
}
.moon-game__cta:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 32px rgba(60,224,122,0.5); }
.moon-game__cta:disabled { opacity: .4; cursor: default; }

.moon-game__bar { width: min(260px, 60%); height: 6px; border-radius: 6px; background: rgba(255,255,255,0.15); overflow: hidden; }
.moon-game__bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8b5cf6, #5dff8a); transition: width .25s ease; }

.moon-game__sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .moon-game__bar span, .moon-game__btn, .moon-game__cta { transition: none; }
}
