/* ========================================================================== */
/* VISION ENGLISH · THE GAMES                                                 */
/* Visual layer for the markup generated by juegos.js. Do not rename hooks.  */
/* ========================================================================== */

#lessons {
  --jx-ink: #4c1d95;
  --jx-muted: #725c91;
  --jx-glass: rgba(255, 255, 255, .65);
  --jx-glass-strong: rgba(255, 255, 255, .82);
  --jx-line: rgba(255, 255, 255, .92);
  --jx-shadow: 0 22px 52px rgba(76, 29, 149, .12);
  position: relative;
  isolation: isolate;
  min-height: 100%;
  padding-bottom: 110px;
  color: var(--jx-ink);
  background:
    radial-gradient(circle at 9% 23%, rgba(250, 204, 21, .16), transparent 26%),
    radial-gradient(circle at 88% 17%, rgba(192, 132, 252, .24), transparent 30%),
    linear-gradient(145deg, #f3e8ff 0%, #fbf8ff 44%, #fff 100%);
}

#lessons::before,
#lessons::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 11px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, .5);
  pointer-events: none;
}

#lessons::before { top: 170px; right: 7%; }
#lessons::after { top: 420px; left: 5%; transform: scale(.62); }

#lessons #dailyLibraryGrid[hidden] { display: none !important; }

.games-page-title {
  position: relative;
  align-items: center;
  min-height: 138px;
  margin-bottom: 18px;
  padding: 24px 28px;
  overflow: hidden;
  border: 1px solid var(--jx-line);
  border-radius: 8px;
  background: linear-gradient(118deg, rgba(255,255,255,.82), rgba(255,255,255,.48));
  box-shadow: var(--jx-shadow), inset 0 1px 0 #fff;
  backdrop-filter: blur(12px) saturate(145%);
  -webkit-backdrop-filter: blur(12px) saturate(145%);
}

.games-page-title::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -74px;
  width: 250px;
  height: 190px;
  border: 34px solid rgba(168, 85, 247, .11);
  border-radius: 50%;
  transform: rotate(-12deg);
}

.games-page-kicker {
  display: block;
  margin-bottom: 5px;
  color: #8b5cf6;
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: 0;
}

.games-page-title h1 {
  margin: 0;
  color: var(--jx-ink);
  font-family: "Outfit", sans-serif;
  font-size: clamp(2.15rem, 4vw, 3.35rem);
  line-height: .98;
  letter-spacing: 0;
}

.games-page-title p {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--jx-muted);
  font-size: 1rem;
}

.games-title-medal {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: #713f12;
  border: 7px solid rgba(255,255,255,.74);
  border-radius: 50%;
  background: linear-gradient(145deg, #fff7a8, #facc15 55%, #e69b00);
  box-shadow: 0 12px 24px rgba(234, 179, 8, .3), inset 6px 6px 10px rgba(255,255,255,.7), inset -7px -8px 12px rgba(161,98,7,.22);
  transform: rotate(8deg);
}

.games-title-medal span { font-size: .8rem; font-weight: 900; }
.games-title-medal strong { position: absolute; right: -4px; bottom: -6px; font-size: 1.45rem; }

.games-daily-strip {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: stretch;
  min-height: 112px;
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .94);
  border-radius: 8px;
  background: var(--jx-glass);
  box-shadow: 0 15px 38px rgba(76,29,149,.1), inset 0 1px 0 #fff;
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
}

.games-daily-symbol {
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, #fde68a, #facc15 60%, #f59e0b);
  box-shadow: inset -10px -8px 18px rgba(180,83,9,.2), inset 8px 7px 15px rgba(255,255,255,.7);
}

.games-daily-symbol span {
  width: 37px;
  height: 37px;
  background: #fff8cf;
  clip-path: polygon(50% 0,61% 34%,98% 35%,68% 56%,79% 92%,50% 71%,21% 92%,32% 56%,2% 35%,39% 34%);
  filter: drop-shadow(0 6px 5px rgba(113,63,18,.28));
  transform: rotate(-8deg);
}

#lessons .games-daily-card.daily-card {
  display: grid;
  grid-template-columns: minmax(250px, .9fr) minmax(280px, 1.1fr);
  gap: 28px;
  align-items: center;
  min-height: 0;
  padding: 18px 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.games-daily-copy h2 { margin: 2px 0 3px; color: var(--jx-ink); font-size: 1.25rem; }
.games-daily-copy p { margin: 0; color: var(--jx-muted); font-size: .87rem; }
.games-daily-copy strong { color: #a16207; }
.games-daily-progress small { display: block; margin-top: 7px; color: var(--jx-muted); font-weight: 700; text-align: right; }
.games-daily-progress .progress-track { height: 11px; background: rgba(76,29,149,.1); }
.games-daily-progress .progress-track span { background: linear-gradient(90deg, #facc15, #f59e0b, #c084fc); box-shadow: 0 0 15px rgba(250,204,21,.45); }

/* Hub --------------------------------------------------------------------- */

.jx-hub {
  --jx-accent: #8b5cf6;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border: 1px solid var(--jx-line);
  border-radius: 8px;
  background: rgba(255,255,255,.46);
  box-shadow: var(--jx-shadow), inset 0 1px 0 #fff;
  backdrop-filter: blur(12px) saturate(145%);
  -webkit-backdrop-filter: blur(12px) saturate(145%);
}

.jx-hub[data-modo="examen"] { --jx-accent: #f43f5e; }

.jx-niveles {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 14px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  gap: 6px;
  width: min(100%, 520px);
  padding: 6px;
  border: 1px solid rgba(255,255,255,.94);
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 12px 25px rgba(76,29,149,.12), inset 0 1px 0 #fff;
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
}

.jx-nivel {
  position: relative;
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  color: #725c91;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: 900 .85rem/1 "Outfit", sans-serif;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.jx-nivel:hover { color: var(--jx-ink); background: rgba(139,92,246,.1); }
.jx-nivel:focus-visible { outline: 3px solid rgba(139,92,246,.35); outline-offset: 2px; }
.jx-nivel.activo {
  color: #fff;
  background: linear-gradient(145deg, #a78bfa, #7c3aed);
  box-shadow: 0 7px 14px rgba(124,58,237,.3), inset 0 1px 1px rgba(255,255,255,.45), inset 0 -3px 5px rgba(76,29,149,.24);
  transform: translateY(-1px);
}

.jx-nivel:disabled,
.jx-nivel[aria-disabled="true"],
.jx-nivel[data-estado="bloqueado"],
.jx-nivel[data-locked="true"],
.jx-nivel.bloqueado,
.jx-nivel.is-locked {
  padding-right: 25px;
  color: #aaa3b7;
  background: rgba(100, 88, 118, .07);
  box-shadow: inset 0 0 0 1px rgba(100, 88, 118, .08);
  cursor: not-allowed;
  opacity: .7;
  filter: grayscale(.7) saturate(.2);
  transform: none;
}

.jx-nivel:disabled::before,
.jx-nivel[aria-disabled="true"]::before,
.jx-nivel[data-estado="bloqueado"]::before,
.jx-nivel[data-locked="true"]::before,
.jx-nivel.bloqueado::before,
.jx-nivel.is-locked::before {
  content: "";
  position: absolute;
  top: 18px;
  right: 8px;
  width: 8px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.jx-nivel:disabled::after,
.jx-nivel[aria-disabled="true"]::after,
.jx-nivel[data-estado="bloqueado"]::after,
.jx-nivel[data-locked="true"]::after,
.jx-nivel.bloqueado::after,
.jx-nivel.is-locked::after {
  content: "";
  position: absolute;
  top: 13px;
  right: 10px;
  width: 4px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.jx-roll {
  grid-column: 2;
  grid-row: 1;
  min-height: 50px;
  padding: 0 20px;
  color: #35115f;
  border: 1px solid #fef3c7;
  border-bottom: 6px solid #d97706;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff7a8, #facc15 64%, #f59e0b);
  box-shadow: 0 10px 22px rgba(217,119,6,.25), inset 4px 4px 8px rgba(255,255,255,.65), inset -5px -6px 10px rgba(180,83,9,.18);
  font: 900 .88rem/1 "Outfit", sans-serif;
  cursor: pointer;
  transform: translateY(0);
  transition: transform .13s ease, border-bottom-width .13s ease, box-shadow .2s ease;
}

.jx-roll:hover { box-shadow: 0 13px 28px rgba(217,119,6,.32), 0 0 20px rgba(250,204,21,.28), inset 4px 4px 8px rgba(255,255,255,.65); }
.jx-roll:focus-visible { outline: 3px solid rgba(245,158,11,.35); outline-offset: 3px; }
.jx-roll:active { border-bottom-width: 2px; transform: translateY(5px) scale(.97, .94); box-shadow: 0 4px 9px rgba(217,119,6,.22), inset 2px 4px 8px rgba(180,83,9,.2); }

.jx-marcador {
  grid-column: 3;
  grid-row: 1;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  min-width: 92px;
  min-height: 50px;
  padding: 8px 14px;
  color: var(--jx-ink);
  border: 1px solid rgba(255,255,255,.94);
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 9px 20px rgba(76,29,149,.1), inset 0 1px 0 #fff;
  font-size: .72rem;
  font-weight: 900;
}

.jx-xp { color: #8b5cf6; font: 900 1.45rem/1 "Outfit", sans-serif; }

/* Cards ------------------------------------------------------------------- */

.jx-grid {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 14% 8%, rgba(192, 132, 252, .05), transparent 43%),
    radial-gradient(ellipse at 86% 92%, rgba(6, 182, 212, .035), transparent 45%),
    rgba(243, 232, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .035);
}

.jx-card {
  --card-accent: #06b6d4;
  --card-accent-2: #2563eb;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  min-height: 258px;
  padding: 24px 22px 23px;
  overflow: hidden;
  color: #fff;
  border: 2px solid rgba(255,255,255,.82);
  border-radius: 8px;
  background: #22153d;
  box-shadow: 0 16px 34px color-mix(in srgb, var(--card-accent) 19%, rgba(76,29,149,.14)), inset 0 1px 0 rgba(255,255,255,.55);
  cursor: pointer;
  transform: translateY(0) rotate(0);
  transform-origin: 50% 86%;
  transition: transform .24s cubic-bezier(.2,.8,.2,1), box-shadow .24s ease, border-color .24s ease;
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
}

.jx-card[data-juego="pronuncia"] { --card-accent: #ec4899; --card-accent-2: #f43f5e; }
.jx-card[data-juego="dictado"] { --card-accent: #f59e0b; --card-accent-2: #f97316; }
.jx-card[data-juego="memoria"] { --card-accent: #10b981; --card-accent-2: #22c55e; }
.jx-card[data-juego="cadena"] { --card-accent: #8b5cf6; --card-accent-2: #6366f1; }
.jx-card[data-juego="duelo"] { --card-accent: #ef4444; --card-accent-2: #111827; }

.jx-card::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image: url("assets/game-contrarreloj.png?v=1");
  background-position: center;
  background-size: cover;
  transform: scale(1.01);
  transition: transform .5s cubic-bezier(.2,.8,.2,1), filter .28s ease;
}

.jx-card[data-juego="pronuncia"]::before { background-image: url("assets/game-pronuncia.png?v=1"); }
.jx-card[data-juego="dictado"]::before { background-image: url("assets/game-dictado.png?v=1"); }
.jx-card[data-juego="memoria"]::before { background-image: url("assets/game-memoria.png?v=1"); }
.jx-card[data-juego="cadena"]::before { background-image: url("assets/game-cadena.png?v=1"); }
.jx-card[data-juego="duelo"]::before { background-image: url("assets/game-duelo.png?v=1"); }

.jx-card::after {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  opacity: 1;
  background:
    linear-gradient(180deg, rgba(7,10,28,.03) 20%, rgba(12,9,34,.18) 46%, rgba(12,8,32,.93) 100%),
    linear-gradient(105deg, color-mix(in srgb, var(--card-accent-2) 19%, transparent), transparent 58%);
  pointer-events: none;
}

.jx-card:hover,
.jx-card:focus-visible {
  border-color: color-mix(in srgb, var(--card-accent) 55%, #fff);
  box-shadow: 0 23px 42px color-mix(in srgb, var(--card-accent) 24%, rgba(76,29,149,.1)), 0 0 0 4px color-mix(in srgb, var(--card-accent) 12%, transparent), inset 0 1px 0 #fff;
  outline: 0;
  transform: translateY(-7px);
}

.jx-card:hover::before,
.jx-card:focus-visible::before { transform: scale(1.09); filter: saturate(1.12) contrast(1.03); }

.jx-card-kicker {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  padding: 6px 9px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 999px;
  background: rgba(15,23,42,.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: 0;
}

.jx-card-titulo {
  margin: 0 0 6px;
  color: #fff;
  font: 900 clamp(1.65rem, 2.6vw, 2.25rem)/1 "Outfit", sans-serif;
  letter-spacing: 0;
  text-shadow: 0 3px 14px rgba(0,0,0,.68);
}

.jx-card-desc {
  max-width: 92%;
  min-height: 39px;
  margin: 0 0 12px;
  color: rgba(255,255,255,.9);
  font-size: .88rem;
  line-height: 1.35;
  text-shadow: 0 2px 9px rgba(0,0,0,.72);
}

.jx-card-meta {
  align-self: flex-start;
  padding: 6px 10px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 999px;
  background: rgba(15,23,42,.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: .72rem;
  font-weight: 900;
}

.jx-timer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 8px;
  overflow: visible;
  background: rgba(76,29,149,.09);
}

.jx-timer-fill {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, var(--card-accent-2), var(--card-accent), #fff);
  box-shadow: 0 0 14px var(--card-accent), 0 -2px 10px color-mix(in srgb, var(--card-accent) 50%, transparent);
}

.jx-timer-fill::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -5px;
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 58% 42%;
  background: #fff;
  box-shadow: 0 0 13px 4px var(--card-accent);
  transform: translateY(-50%) rotate(20deg);
}

/* State painting ---------------------------------------------------------- */

.jx-card[data-estado="idle"] { animation: jxCardArrive .46s cubic-bezier(.2,.8,.2,1) both; }
.jx-card[data-estado="idle"]:nth-child(2) { animation-delay: .05s; }
.jx-card[data-estado="idle"]:nth-child(3) { animation-delay: .1s; }
.jx-card[data-estado="idle"]:nth-child(4) { animation-delay: .15s; }
.jx-card[data-estado="idle"]:nth-child(5) { animation-delay: .2s; }
.jx-card[data-estado="idle"]:nth-child(6) { animation-delay: .25s; }

.jx-card[data-estado="activa"] {
  border-color: var(--card-accent);
  box-shadow: 0 21px 44px color-mix(in srgb, var(--card-accent) 35%, transparent), 0 0 24px color-mix(in srgb, var(--card-accent) 46%, transparent), inset 0 0 0 2px rgba(255,255,255,.6);
  animation: jxActivePulse 1.35s ease-in-out infinite;
}

.jx-card[data-estado="activa"]::before { animation: jxClayFloat 1.6s ease-in-out infinite; }

.jx-card[data-estado="acierto"] {
  --card-accent: #22c55e;
  --card-accent-2: #059669;
  border-color: #4ade80;
  box-shadow: 0 20px 45px rgba(34,197,94,.3), 0 0 30px rgba(74,222,128,.42), inset 0 0 0 2px rgba(255,255,255,.7);
  animation: jxCorrectPop .56s cubic-bezier(.2,.9,.2,1);
}

.jx-card[data-estado="acierto"]::after {
  opacity: 1;
  background:
    radial-gradient(circle, #fff 0 3px, transparent 4px) 10% 25% / 54px 54px,
    radial-gradient(circle, #facc15 0 4px, transparent 5px) 80% 15% / 76px 76px,
    radial-gradient(circle, #4ade80 0 3px, transparent 4px) 54% 62% / 64px 64px,
    linear-gradient(180deg, rgba(5,150,105,.02) 18%, rgba(3,78,55,.9) 100%);
  animation: jxParticles .72s ease-out both;
}

.jx-card[data-estado="fallo"] {
  --card-accent: #fb7185;
  --card-accent-2: #dc2626;
  border-color: #fb7185;
  background: linear-gradient(145deg, rgba(255,255,255,.88), rgba(255,228,230,.68));
  box-shadow: 0 18px 38px rgba(220,38,38,.23), 0 0 20px rgba(251,113,133,.25);
  animation: jxWrongTilt .58s cubic-bezier(.3,.8,.2,1) both;
}

.jx-card[data-estado="fallo"]::before { filter: grayscale(.2); }
.jx-card[data-estado="fallo"]::after { background: linear-gradient(180deg, rgba(127,29,29,.05) 20%, rgba(69,10,10,.94) 100%); }

.jx-hub[data-modo="examen"] .jx-card {
  background:
    linear-gradient(155deg, rgba(255,255,255,.88), rgba(255,255,255,.55)),
    linear-gradient(135deg, color-mix(in srgb, var(--card-accent) 12%, #fff), rgba(254,226,226,.7));
}

.jx-hub[data-modo="examen"] .jx-card-meta::before { content: "FINAL · "; }

@keyframes jxCardArrive {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes jxActivePulse {
  0%, 100% { transform: translateY(-3px) scale(1); }
  50% { transform: translateY(-6px) scale(1.015); }
}

@keyframes jxClayFloat {
  0%, 100% { transform: scale(1.03); filter: saturate(1.08); }
  50% { transform: scale(1.1); filter: saturate(1.22) brightness(1.06); }
}

@keyframes jxCorrectPop {
  0% { transform: scale(.96); }
  48% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

@keyframes jxParticles {
  from { opacity: 0; transform: scale(.72) rotate(-8deg); }
  45% { opacity: 1; }
  to { opacity: .32; transform: scale(1.12) rotate(4deg); }
}

@keyframes jxWrongTilt {
  0% { transform: rotate(0) translateX(0); }
  24% { transform: rotate(-3deg) translateX(-5px); }
  47% { transform: rotate(2.5deg) translateX(4px); }
  70% { transform: rotate(-1.5deg) translateX(-2px); }
  100% { transform: rotate(-1deg) translateX(0); }
}

/* Dark mode --------------------------------------------------------------- */

body.dark #lessons {
  --jx-ink: #fff;
  --jx-muted: #d5c4ee;
  --jx-glass: rgba(30,17,69,.5);
  --jx-glass-strong: rgba(30,17,69,.72);
  --jx-line: rgba(192,132,252,.26);
  --jx-shadow: 0 24px 58px rgba(0,0,0,.35);
  background:
    radial-gradient(circle at 12% 20%, rgba(6,182,212,.13), transparent 28%),
    radial-gradient(circle at 90% 15%, rgba(236,72,153,.14), transparent 27%),
    linear-gradient(145deg, #0f0726, #160b34 48%, #1e1145);
}

body.dark .games-page-title,
body.dark .games-daily-strip,
body.dark .jx-hub {
  border-color: rgba(192,132,252,.24);
  background: rgba(30,17,69,.5);
  box-shadow: 0 22px 52px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.1);
}

body.dark .games-page-title h1,
body.dark .games-daily-copy h2 { color: #c084fc; }
body.dark .games-page-kicker { color: #22d3ee; }
body.dark .games-page-title p,
body.dark .games-daily-copy p,
body.dark .games-daily-progress small { color: #d5c4ee; }
body.dark .games-daily-copy strong { color: #fde047; }
body.dark .games-daily-progress .progress-track { background: rgba(255,255,255,.1); }

body.dark .jx-niveles,
body.dark .jx-marcador {
  color: #fff;
  border-color: rgba(192,132,252,.28);
  background: rgba(15,7,38,.76);
  box-shadow: 0 12px 30px rgba(0,0,0,.34), 0 0 20px rgba(139,92,246,.1), inset 0 1px 0 rgba(255,255,255,.1);
}

body.dark .jx-nivel { color: #c4b5d8; }
body.dark .jx-nivel:hover { color: #fff; background: rgba(6,182,212,.13); }
body.dark .jx-nivel.activo { color: #fff; background: linear-gradient(145deg, #c084fc, #7c3aed); box-shadow: 0 0 19px rgba(192,132,252,.48), inset 0 1px 1px rgba(255,255,255,.34); }
body.dark .jx-nivel:disabled,
body.dark .jx-nivel[aria-disabled="true"],
body.dark .jx-nivel[data-estado="bloqueado"],
body.dark .jx-nivel[data-locked="true"],
body.dark .jx-nivel.bloqueado,
body.dark .jx-nivel.is-locked {
  color: #766b89;
  background: rgba(255, 255, 255, .035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
body.dark .jx-xp { color: #22d3ee; text-shadow: 0 0 15px rgba(6,182,212,.7); }

body.dark .jx-grid {
  background:
    radial-gradient(ellipse at 14% 8%, rgba(192, 132, 252, .045), transparent 43%),
    radial-gradient(ellipse at 86% 92%, rgba(6, 182, 212, .035), transparent 45%),
    rgba(255, 255, 255, .012);
  box-shadow: inset 0 0 0 1px rgba(192, 132, 252, .035);
}

body.dark .jx-card,
body.dark .jx-hub[data-modo="examen"] .jx-card {
  color: #fff;
  border-color: color-mix(in srgb, var(--card-accent) 34%, rgba(255,255,255,.08));
  background:
    linear-gradient(155deg, rgba(30,17,69,.72), rgba(15,7,38,.58)),
    linear-gradient(135deg, color-mix(in srgb, var(--card-accent) 16%, transparent), transparent);
  box-shadow: 0 18px 38px rgba(0,0,0,.32), 0 0 18px color-mix(in srgb, var(--card-accent) 16%, transparent), inset 0 1px 0 rgba(255,255,255,.1);
}

body.dark .jx-card-titulo { color: #fff; }
body.dark .jx-card-desc { color: #d5c4ee; }
body.dark .jx-card-meta { color: #fff; background: color-mix(in srgb, var(--card-accent) 18%, rgba(15,7,38,.72)); border-color: color-mix(in srgb, var(--card-accent) 48%, transparent); }
body.dark .jx-card:hover,
body.dark .jx-card:focus-visible,
body.dark .jx-card[data-estado="activa"] { border-color: var(--card-accent); box-shadow: 0 22px 44px rgba(0,0,0,.35), 0 0 26px color-mix(in srgb, var(--card-accent) 52%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--card-accent) 55%, transparent); }
body.dark .jx-card[data-estado="acierto"] { border-color: #4ade80; box-shadow: 0 0 34px rgba(74,222,128,.52), inset 0 0 0 1px rgba(74,222,128,.5); }
body.dark .jx-card[data-estado="fallo"] { border-color: #fb7185; box-shadow: 0 0 30px rgba(244,63,94,.42), inset 0 0 0 1px rgba(251,113,133,.44); }

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1120px) {
  .jx-hub { grid-template-columns: minmax(0, 1fr) auto; }
  .jx-niveles { width: 100%; }
  .jx-marcador { grid-column: 1 / -1; grid-row: 3; justify-self: end; }
  .jx-roll { grid-column: 2; grid-row: 1; }
  .jx-grid { grid-row: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  #lessons { padding-bottom: 140px; }
  .games-page-title { min-height: 122px; padding: 22px; }
  .games-page-title p { max-width: calc(100% - 58px); font-size: .9rem; }
  .games-title-medal { width: 58px; height: 58px; border-width: 5px; }
  .games-daily-strip { grid-template-columns: 58px minmax(0, 1fr); }
  .games-daily-symbol span { width: 30px; height: 30px; }
  #lessons .games-daily-card.daily-card { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .games-daily-progress small { text-align: left; }

  .jx-hub { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 14px; }
  .jx-niveles { top: 8px; order: 0; overflow-x: auto; }
  .jx-roll { order: 1; width: 100%; }
  .jx-grid { order: 2; grid-template-columns: 1fr; gap: 14px; padding: 8px; }
  .jx-marcador { order: 3; align-self: center; }
  .jx-card { min-height: 264px; padding: 22px 20px; }

  body:has(#lessons.active) .ollie-floating-btn,
  body:has(#lessons.active) .theme-toggle {
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 50%;
  }

  body:has(#lessons.active) .ollie-floating-btn { bottom: 74px; }
  body:has(#lessons.active) .theme-toggle { bottom: 16px; }
  body:has(#lessons.active) .ollie-floating-text,
  body:has(#lessons.active) .ollie-pulse-badge,
  body:has(#lessons.active) .theme-toggle strong { display: none; }
}

@media (max-width: 430px) {
  .games-page-title h1 { font-size: 2.15rem; }
  .games-page-title p { max-width: 100%; padding-right: 42px; }
  .games-title-medal { position: absolute; right: 16px; bottom: 18px; width: 48px; height: 48px; }
  .games-daily-strip { grid-template-columns: 1fr; }
  .games-daily-symbol { min-height: 42px; }
  .games-daily-symbol span { width: 24px; height: 24px; }
  .jx-niveles { grid-template-columns: repeat(6, 48px); }
}

@media (prefers-reduced-motion: reduce) {
  .jx-card,
  .jx-card::before,
  .jx-card::after,
  .jx-nivel,
  .jx-roll { animation: none !important; transition: none !important; }
  .jx-card:hover,
  .jx-card:focus-visible,
  .jx-card:hover::before,
  .jx-card:focus-visible::before,
  .jx-card[data-estado="fallo"],
  .jx-card[data-estado="acierto"],
  .jx-card[data-estado="activa"] { transform: none !important; }
  .jx-card[data-estado="acierto"]::after { opacity: .35; }
}

/* ========================================================================== */
/* PANTALLA COMPLETA DE JUEGO                                                  */
/* Estos estilos visten los ganchos .jxp-* publicados por juegos.js.          */
/* ========================================================================== */

.jxp-capa {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: block;
  padding: 0;
  overflow: hidden;
  background: #f7f4ff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: jxpStageEnter .32s ease both;
}

.jxp-capa[hidden] { display: none; }

.jxp-escenario {
  --jx-acento: #7c3aed;
  --jx-acento-2: #c084fc;
  --jx-fondo: #f6f1ff;
  --jx-brillo: rgba(124, 58, 237, .2);
  --jx-imagen: url("assets/game-cadena.png?v=1");
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 8px minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  color: #21163f;
  background: var(--jx-fondo);
}

.jxp-escenario[data-juego="contrarreloj"] {
  --jx-acento: #0284c7;
  --jx-acento-2: #2563eb;
  --jx-fondo: linear-gradient(145deg, #eefaff 0%, #f7fbff 48%, #e7f1ff 100%);
  --jx-brillo: rgba(14, 165, 233, .24);
  --jx-imagen: url("assets/game-contrarreloj.png?v=1");
}

.jxp-escenario[data-juego="pronuncia"] {
  --jx-acento: #db2777;
  --jx-acento-2: #ef4444;
  --jx-fondo: linear-gradient(145deg, #fff1f7 0%, #fff8fb 48%, #ffecef 100%);
  --jx-brillo: rgba(236, 72, 153, .23);
  --jx-imagen: url("assets/game-pronuncia.png?v=1");
}

.jxp-escenario[data-juego="dictado"] {
  --jx-acento: #d97706;
  --jx-acento-2: #f59e0b;
  --jx-fondo: linear-gradient(145deg, #fff8e7 0%, #fffdf7 52%, #fff0d5 100%);
  --jx-brillo: rgba(245, 158, 11, .22);
  --jx-imagen: url("assets/game-dictado.png?v=1");
}

.jxp-escenario[data-juego="memoria"] {
  --jx-acento: #059669;
  --jx-acento-2: #22c55e;
  --jx-fondo: linear-gradient(145deg, #ebfff5 0%, #fbfffd 50%, #e8f7ff 100%);
  --jx-brillo: rgba(16, 185, 129, .22);
  --jx-imagen: url("assets/game-memoria.png?v=1");
}

.jxp-escenario[data-juego="cadena"] {
  --jx-acento: #7c3aed;
  --jx-acento-2: #a855f7;
  --jx-fondo: linear-gradient(145deg, #f5efff 0%, #fcfaff 50%, #eee9ff 100%);
  --jx-brillo: rgba(139, 92, 246, .23);
  --jx-imagen: url("assets/game-cadena.png?v=1");
}

.jxp-escenario[data-juego="duelo"] {
  --jx-acento: #dc2626;
  --jx-acento-2: #2563eb;
  --jx-fondo: linear-gradient(115deg, #fff0f1 0%, #fbf8ff 49%, #edf5ff 100%);
  --jx-brillo: rgba(239, 68, 68, .2);
  --jx-imagen: url("assets/game-duelo.png?v=1");
}

.jxp-escenario::before {
  content: "";
  position: absolute;
  z-index: -3;
  inset: 0;
  background-image: var(--jx-imagen);
  background-position: right 5% center;
  background-repeat: no-repeat;
  background-size: min(46vw, 680px);
  opacity: .075;
  filter: saturate(.72);
  mask-image: linear-gradient(90deg, transparent 18%, #000 70%);
  -webkit-mask-image: linear-gradient(90deg, transparent 18%, #000 70%);
  transform: scale(1.05);
}

.jxp-atmosfera,
.jxp-halo,
.jxp-rejilla {
  position: absolute;
  pointer-events: none;
}

.jxp-atmosfera { z-index: -2; inset: 0; overflow: hidden; }

.jxp-halo {
  width: min(48vw, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--jx-brillo), transparent 67%);
  filter: blur(12px);
  animation: jxpHaloDrift 12s ease-in-out infinite alternate;
}

.jxp-halo-1 { top: -24%; right: -8%; }
.jxp-halo-2 { bottom: -38%; left: -12%; opacity: .58; animation-delay: -6s; }

.jxp-rejilla {
  inset: 0;
  opacity: .18;
  background-image:
    linear-gradient(rgba(92, 72, 135, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 72, 135, .08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, #000 42%, transparent 95%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 42%, transparent 95%);
}

.jxp-escenario[data-juego="dictado"] .jxp-rejilla {
  opacity: .22;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(217, 119, 6, .12) 32px 33px);
  background-size: auto;
}

.jxp-hud {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  margin: 18px 22px 0;
  padding: 14px 16px 14px 22px;
  border: 1px solid rgba(255, 255, 255, .84);
  border-radius: 20px;
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 15px 40px rgba(55, 34, 100, .1), inset 0 1px 0 #fff;
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.jxp-hud-ident { min-width: 0; }

.jxp-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--jx-acento);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.jxp-titulo {
  margin: 0;
  color: #21163f;
  font: 900 clamp(1.35rem, 2.2vw, 2rem)/1 "Outfit", sans-serif;
  letter-spacing: 0;
}

.jxp-hud-derecha {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jxp-hud-marca {
  min-width: 84px;
  padding: 10px 14px;
  color: var(--jx-acento);
  border: 1px solid color-mix(in srgb, var(--jx-acento) 19%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--jx-acento) 8%, rgba(255,255,255,.76));
  font-size: .86rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.jxp-hud-salir {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  padding: 0;
  color: #4d4166;
  border: 1px solid rgba(82, 62, 123, .12);
  border-radius: 50%;
  background: rgba(255, 255, 255, .74);
  box-shadow: 0 7px 18px rgba(52, 35, 92, .1), inset 0 1px 0 #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, transform .12s ease;
}

.jxp-hud-salir:hover { color: #fff; background: var(--jx-acento); }
.jxp-hud-salir:active { transform: scale(.9); }
.jxp-hud-salir:focus-visible { outline: 3px solid var(--jx-brillo); outline-offset: 3px; }

.jxp-hud-reloj {
  position: relative;
  z-index: 3;
  height: 8px;
  margin: 10px 26px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(80, 61, 121, .09);
  box-shadow: inset 0 1px 2px rgba(39, 25, 71, .08);
}

.jxp-hud-reloj-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jx-acento), var(--jx-acento-2));
  box-shadow: 0 0 14px var(--jx-brillo);
  transition: width .28s linear;
}

.jxp-escenario[data-juego="contrarreloj"] .jxp-hud-reloj-fill {
  box-shadow: 0 0 16px rgba(14, 165, 233, .42);
}

.jxp-arena {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: clamp(24px, 4vw, 52px);
  overflow: auto;
  overscroll-behavior: contain;
}

.jxp-arena > .jxp-escena,
.jxp-arena > .jxp-final,
.jxp-arena > .jxp-cargando {
  width: 100%;
  max-width: 940px;
}

.jxp-escena,
.jxp-final {
  position: relative;
  min-height: min(560px, calc(100dvh - 190px));
  padding: clamp(28px, 5vw, 64px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .84);
  border-radius: 28px;
  background: rgba(255, 255, 255, .62);
  box-shadow: 0 28px 70px rgba(54, 33, 99, .12), inset 0 1px 0 #fff;
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  animation: jxpSceneIn .35s cubic-bezier(.16, 1, .3, 1) both;
}

.jxp-escena {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.jxp-suelo {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px clamp(20px, 4vw, 52px);
  border-top: 1px solid rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .58);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.jxp-instruccion {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: 18px;
  padding: 8px 12px;
  color: var(--jx-acento);
  border: 1px solid color-mix(in srgb, var(--jx-acento) 18%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--jx-acento) 7%, rgba(255,255,255,.7));
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.jxp-pregunta {
  max-width: 800px;
  margin: 0 0 28px;
  color: #20153c;
  font: 800 clamp(1.35rem, 3vw, 2.35rem)/1.25 "Outfit", sans-serif;
  letter-spacing: 0;
}

.jxp-opciones {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.jxp-opcion {
  min-height: 58px;
  padding: 15px 18px;
  color: #30234d;
  border: 2px solid color-mix(in srgb, var(--jx-acento) 16%, rgba(255,255,255,.84));
  border-bottom-width: 5px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 10px 24px rgba(55, 34, 100, .07), inset 0 1px 0 #fff;
  font-weight: 800;
  text-align: left;
  transition: transform .13s ease, border-color .16s ease, background .16s ease;
}

.jxp-opcion:hover:not(:disabled) {
  border-color: var(--jx-acento);
  background: color-mix(in srgb, var(--jx-acento) 7%, #fff);
  transform: translateY(-2px);
}

.jxp-opcion:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.jxp-opcion:focus-visible { outline: 3px solid var(--jx-brillo); outline-offset: 2px; }
.jxp-opcion.bien { color: #087443; border-color: #22c55e; background: #eafbf1; }
.jxp-opcion.mal { color: #b4233a; border-color: #fb7185; background: #fff0f2; }

.jxp-escenario[data-juego="contrarreloj"] .jxp-opcion {
  transition-duration: .07s;
}

.jxp-eco {
  min-height: 28px;
  margin: 20px 0 0;
  font-size: 1rem;
  font-weight: 800;
}

.jxp-frase-en {
  margin: 0 0 8px;
  color: #20153c;
  font: 900 clamp(2rem, 5vw, 4.2rem)/1.08 "Outfit", sans-serif;
  letter-spacing: 0;
}

.jxp-frase-es {
  margin: 0 0 26px;
  color: #716385;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  font-weight: 650;
}

.jxp-voz { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }

.jxp-btn-audio,
.jxp-mic,
.jxp-enviar,
.jxp-secundario {
  min-height: 52px;
  padding: 13px 22px;
  border-radius: 16px;
  font-weight: 900;
}

.jxp-btn-audio,
.jxp-mic {
  color: var(--jx-acento);
  border: 2px solid color-mix(in srgb, var(--jx-acento) 24%, transparent);
  background: rgba(255, 255, 255, .76);
}

.jxp-btn-audio:hover,
.jxp-mic:hover { color: #fff; border-color: var(--jx-acento); background: var(--jx-acento); }

.jxp-mic.escuchando {
  color: #fff;
  border-color: var(--jx-acento);
  background: var(--jx-acento);
  animation: jxpListening 1.1s ease-in-out infinite;
}

.jxp-input {
  width: 100%;
  min-height: 58px;
  padding: 15px 18px;
  color: #20153c;
  border: 2px solid color-mix(in srgb, var(--jx-acento) 18%, transparent);
  border-radius: 16px;
  background: rgba(255, 255, 255, .82);
  box-shadow: inset 0 2px 5px rgba(48, 35, 77, .06);
  font-size: 1.05rem;
}

.jxp-input:focus { outline: none; border-color: var(--jx-acento); box-shadow: 0 0 0 4px var(--jx-brillo); }

.jxp-enviar {
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, var(--jx-acento), var(--jx-acento-2));
  box-shadow: 0 10px 24px var(--jx-brillo), inset 0 1px 0 rgba(255,255,255,.3);
}

.jxp-enviar:hover { box-shadow: 0 14px 30px var(--jx-brillo); transform: translateY(-2px); }
.jxp-enviar:active { transform: translateY(1px) scale(.98); }

.jxp-secundario {
  color: var(--jx-acento);
  border: 2px solid color-mix(in srgb, var(--jx-acento) 25%, transparent);
  background: rgba(255,255,255,.54);
}

/* Memoria: giro 3D real, no solo cambio de color. */
.jxp-escenario[data-juego="memoria"] .jxp-escena { perspective: 1000px; }

.jxp-memoria {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  perspective: 1100px;
}

.jxp-ficha {
  min-height: 104px;
  padding: 10px;
  overflow: hidden;
  color: transparent;
  border: 2px solid rgba(255,255,255,.66);
  border-bottom: 6px solid color-mix(in srgb, var(--jx-acento) 70%, #064e3b);
  border-radius: 18px;
  background: linear-gradient(145deg, #34d399, #059669);
  box-shadow: 0 13px 22px rgba(5,150,105,.2), inset 5px 5px 11px rgba(255,255,255,.28), inset -6px -7px 12px rgba(4,120,87,.22);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: transform .48s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease, opacity .25s ease;
}

.jxp-ficha:nth-child(4n + 2) { background: linear-gradient(145deg, #60a5fa, #2563eb); border-bottom-color: #1d4ed8; }
.jxp-ficha:nth-child(4n + 3) { background: linear-gradient(145deg, #fbbf24, #f97316); border-bottom-color: #c2410c; }
.jxp-ficha:nth-child(4n + 4) { background: linear-gradient(145deg, #c084fc, #7c3aed); border-bottom-color: #5b21b6; }
.jxp-ficha span { display: block; opacity: 0; transform: rotateY(180deg); backface-visibility: hidden; }
.jxp-ficha::after { color: rgba(255,255,255,.9); font-size: 1.8rem; text-shadow: 0 2px 7px rgba(0,0,0,.18); }
.jxp-ficha:hover:not(.abierta):not(.hecha) { transform: translateY(-5px) rotateX(5deg); }
.jxp-ficha.abierta,
.jxp-ficha.hecha { color: #253247; background: rgba(255,255,255,.9); border-color: var(--jx-acento); transform: rotateY(180deg); }
.jxp-ficha.abierta span,
.jxp-ficha.hecha span { opacity: 1; }
.jxp-ficha.abierta::after,
.jxp-ficha.hecha::after { opacity: 0; }
.jxp-ficha.hecha { color: #087443; border-color: #22c55e; opacity: .75; }

/* Cadena y duelo reciben una composición propia sin añadir contenido. */
.jxp-escenario[data-juego="cadena"] .jxp-opcion {
  position: relative;
  border-radius: 24px 10px 24px 10px;
}

.jxp-duelo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(239,68,68,.11), rgba(255,255,255,.62) 48% 52%, rgba(37,99,235,.11));
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 900;
}

.jxp-vs-yo { color: #dc2626; text-align: right; }
.jxp-vs-ollie { color: #2563eb; }
.jxp-vs-sep { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; border-radius: 50%; background: #23173f; font-size: .72rem; }

.jxp-final {
  display: grid;
  place-content: center;
  text-align: center;
}

.jxp-final-icono { font-size: clamp(4rem, 9vw, 7rem); filter: drop-shadow(0 14px 18px var(--jx-brillo)); }
.jxp-final-titulo { margin: 18px 0 7px; color: #21163f; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: 0; }
.jxp-final-detalle { margin: 0 0 20px; color: #716385; font-size: 1.05rem; }
.jxp-final-xp { justify-self: center; padding: 12px 25px; border-radius: 999px; }
.jxp-final-botones { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }

/* Modo oscuro: materiales y contraste propios, no una simple opacidad. */
body.dark .jxp-capa { background: #0f0824; }

body.dark .jxp-escenario {
  color: #fff;
  --jx-fondo: linear-gradient(145deg, #100824, #1d103c 58%, #100a27);
}

body.dark .jxp-escenario[data-juego="contrarreloj"] { --jx-fondo: linear-gradient(145deg, #06182a, #0a2140 55%, #10122f); }
body.dark .jxp-escenario[data-juego="pronuncia"] { --jx-fondo: linear-gradient(145deg, #230b24, #35102d 55%, #190d2b); }
body.dark .jxp-escenario[data-juego="dictado"] { --jx-fondo: linear-gradient(145deg, #241606, #35200b 55%, #191127); }
body.dark .jxp-escenario[data-juego="memoria"] { --jx-fondo: linear-gradient(145deg, #071f20, #0c2c2b 55%, #10142c); }
body.dark .jxp-escenario[data-juego="cadena"] { --jx-fondo: linear-gradient(145deg, #130824, #241044 55%, #11102f); }
body.dark .jxp-escenario[data-juego="duelo"] { --jx-fondo: linear-gradient(110deg, #290c16, #171027 49%, #081a33); }

body.dark .jxp-escenario::before { opacity: .12; filter: saturate(1.1) brightness(.8); }
body.dark .jxp-rejilla { opacity: .28; }

body.dark .jxp-hud,
body.dark .jxp-suelo {
  border-color: rgba(255,255,255,.1);
  background: rgba(15, 10, 35, .62);
  box-shadow: 0 18px 45px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.08);
}

body.dark .jxp-titulo,
body.dark .jxp-pregunta,
body.dark .jxp-frase-en,
body.dark .jxp-final-titulo { color: #fff; }

body.dark .jxp-hud-marca,
body.dark .jxp-instruccion { background: color-mix(in srgb, var(--jx-acento) 14%, rgba(11,7,28,.72)); border-color: color-mix(in srgb, var(--jx-acento) 34%, transparent); }
body.dark .jxp-hud-salir { color: #fff; border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.07); box-shadow: none; }
body.dark .jxp-hud-reloj { background: rgba(255,255,255,.08); }

body.dark .jxp-escena,
body.dark .jxp-final {
  border-color: rgba(255,255,255,.1);
  background: rgba(14, 9, 34, .64);
  box-shadow: 0 30px 80px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.07);
}

body.dark .jxp-frase-es,
body.dark .jxp-final-detalle,
body.dark .jxp-nota { color: #c7bada; }

body.dark .jxp-opcion,
body.dark .jxp-btn-audio,
body.dark .jxp-mic,
body.dark .jxp-secundario,
body.dark .jxp-input {
  color: #f8f5ff;
  border-color: color-mix(in srgb, var(--jx-acento) 31%, rgba(255,255,255,.08));
  background: rgba(255,255,255,.065);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

body.dark .jxp-opcion:hover:not(:disabled) { background: color-mix(in srgb, var(--jx-acento) 16%, rgba(255,255,255,.05)); }
body.dark .jxp-opcion.bien { color: #9af0bc; border-color: #22c55e; background: rgba(34,197,94,.13); }
body.dark .jxp-opcion.mal { color: #fecdd3; border-color: #fb7185; background: rgba(244,63,94,.13); }
body.dark .jxp-ficha.abierta,
body.dark .jxp-ficha.hecha { color: #f8f5ff; background: #201a39; }

@keyframes jxpStageEnter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes jxpSceneIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: none; }
}

@keyframes jxpHaloDrift {
  from { transform: translate3d(-2%, -2%, 0) scale(.96); }
  to { transform: translate3d(5%, 4%, 0) scale(1.06); }
}

@keyframes jxpListening {
  0%, 100% { box-shadow: 0 0 0 0 var(--jx-brillo); }
  50% { box-shadow: 0 0 0 14px transparent; }
}

@media (max-width: 720px) {
  .jxp-escenario { grid-template-rows: auto 6px minmax(0, 1fr); }
  .jxp-escenario::before { background-position: center 78%; background-size: 115vw; opacity: .055; }
  .jxp-hud { min-height: 72px; margin: 8px 8px 0; padding: 11px 10px 11px 15px; border-radius: 16px; }
  .jxp-kicker { font-size: .62rem; }
  .jxp-titulo { font-size: 1.25rem; }
  .jxp-hud-marca { min-width: 0; padding: 8px 10px; font-size: .74rem; }
  .jxp-hud-salir { width: 44px; height: 44px; flex-basis: 44px; }
  .jxp-hud-reloj { margin: 7px 12px 0; }
  .jxp-arena { align-items: flex-start; padding: 14px 10px 22px; }
  .jxp-escena,
  .jxp-final { min-height: calc(100dvh - 125px); padding: 24px 18px; border-radius: 20px; }
  .jxp-opciones { grid-template-columns: 1fr; gap: 10px; }
  .jxp-opcion,
  .jxp-btn-audio,
  .jxp-mic,
  .jxp-enviar,
  .jxp-secundario { min-height: 48px; }
  .jxp-pregunta { margin-bottom: 20px; font-size: 1.38rem; }
  .jxp-frase-en { font-size: 2rem; }
  .jxp-memoria { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .jxp-ficha { min-height: 68px; padding: 5px; border-radius: 12px; border-bottom-width: 4px; font-size: .68rem; }
  .jxp-final-botones { flex-direction: column; }
  .jxp-final-botones button { width: 100%; }
}

@media (max-width: 390px) {
  .jxp-hud-marca { display: none; }
  .jxp-memoria { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .jxp-capa,
  .jxp-escena,
  .jxp-final,
  .jxp-halo,
  .jxp-mic.escuchando,
  .jxp-final-icono { animation: none !important; }

  .jxp-opcion,
  .jxp-ficha,
  .jxp-hud-salir,
  .jxp-enviar { transition: none !important; }
}
