:root {
  --fondo: #0f2b1d;
  --papel: #f5efe3;
  --tinta: #1d3b2c;
  --tinta-suave: #5c7165;
  --apagado: #a9b8ab;
  --linea: rgba(245, 239, 227, 0.25);
  --rojo: #c8343a;
  --rojo-vivo: #e0464b;
  --rojo-claro: #ff9c8f;
  --oro: #f0c060;
  --abeto: #2f6b45;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --suave: cubic-bezier(0.2, 0.8, 0.3, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--fondo); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fondo);
  color: var(--papel);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

body > main { position: relative; z-index: 1; }

h1, h2 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
}

button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--oro); outline-offset: 3px; }

@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fundir { from { opacity: 0; } to { opacity: 1; } }
@keyframes sacudir {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes pop { from { transform: scale(0.6); } to { transform: scale(1); } }

.nieve { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ---------- Luces ---------- */
.luces { height: 66px; }
.luces svg { display: block; overflow: visible; }
.luces-fijas {
  position: fixed; top: 0; left: 0; width: 100%;
  z-index: 1; pointer-events: none;
  transition: opacity 0.45s ease;
}
.hilo { fill: none; stroke: rgba(245, 239, 227, 0.4); stroke-width: 1.2; }

.bombilla { animation: titila 2.4s ease-in-out var(--d, 0s) infinite alternate; }
.bombilla .halo { fill: var(--c); opacity: 0.28; }
.bombilla .nucleo { fill: var(--c); }
.bombilla.apagada { animation: none; }
.bombilla.apagada .halo { display: none; }
.bombilla.apagada .nucleo { fill: rgba(245, 239, 227, 0.2); }
@keyframes titila { from { opacity: 0.5; } to { opacity: 1; } }

/* ---------- Entrada ---------- */
.entrada {
  max-width: 360px;
  margin: 0 auto;
  padding: 96px 24px 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.entrada > * { animation: subir 0.7s var(--suave) backwards; }
.entrada > :nth-child(2) { animation-delay: 0.12s; }
.entrada > :nth-child(3) { animation-delay: 0.2s; }
.entrada > :nth-child(4) { animation-delay: 0.28s; }
.entrada.saliendo, .luces-fijas.saliendo, .bosque-fijo.saliendo { opacity: 0; }
.entrada.saliendo { transform: translateY(-14px); }
.entrada h1 { font-size: 1.7rem; }

.cal { width: 100%; }
.cal.sacudir { animation: sacudir 0.45s ease; }
.cal-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-mes { font-family: var(--serif); font-size: 1.2rem; color: var(--oro); }
.cal-nav {
  width: 40px; height: 40px;
  border: 0; background: none; cursor: pointer;
  font-size: 1.6rem; line-height: 1;
  border-radius: 50%;
  transition: background 0.2s;
}
.cal-nav:active { background: rgba(245, 239, 227, 0.12); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid.cambia { animation: fundir 0.3s ease; }
.cal-sem { font-size: 0.8rem; color: var(--apagado); padding: 4px 0; }
.cal-dia {
  aspect-ratio: 1;
  border: 0; background: none; cursor: pointer;
  border-radius: 50%;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
@media (hover: hover) { .cal-dia:hover { background: rgba(245, 239, 227, 0.12); } }
.cal-dia[aria-pressed="true"] { background: var(--rojo); color: var(--papel); animation: pop 0.25s var(--suave); }

.aviso { min-height: 1.5em; margin: -12px 0 -12px; color: var(--rojo-claro); }
.aviso.nuevo { animation: subir 0.35s var(--suave); }

.boton {
  min-width: 140px;
  padding: 12px 28px;
  border: 1px solid var(--rojo-vivo);
  border-radius: 999px;
  background: var(--rojo);
  color: var(--papel);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s;
}
.boton:active { transform: scale(0.96); }
.boton-suave { background: none; }

.bosque-fijo {
  position: fixed; left: 0; bottom: 0; width: 100%; height: 100px;
  z-index: 0; pointer-events: none;
  transition: opacity 0.45s ease;
}
.bosque-fijo svg { display: block; }

/* ---------- Principal ---------- */
.principal {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 16px 40px;
  animation: fundir 0.7s ease backwards;
}
.principal .luces { margin: 0 -16px; }

.principal h1 {
  text-align: center;
  font-size: 2.2rem;
  margin-top: 8px;
  text-shadow: 0 0 22px rgba(240, 192, 96, 0.35);
}
.letra { display: inline-block; animation: letra 0.8s var(--suave) backwards; }
@keyframes letra { from { opacity: 0; transform: translateY(0.6em); } to { opacity: 1; transform: none; } }

.cuenta {
  text-align: center;
  color: var(--oro);
  margin: 6px 0 0;
  min-height: 1.5em;
  animation: fundir 0.9s ease 0.7s backwards;
}

.proximo {
  margin: 2px 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--papel);
  opacity: 0.65;
  animation: fundir 0.9s ease 0.9s backwards;
}
.vista-previa {
  position: fixed; top: 8px; left: 8px; z-index: 7;
  margin: 0; padding: 3px 10px;
  border-radius: 999px;
  background: var(--oro); color: var(--tinta);
  font-size: 0.72rem; font-weight: 600;
  pointer-events: none;
}

.camino { position: relative; margin-top: 8px; }
.camino > svg.fondo { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* Camino de nieve */
.tramo path { fill: none; stroke-linecap: round; transition-delay: inherit; }
.nieve-sombra { stroke: #7f9fb1; stroke-width: 25px; transform: translateY(3px); }
.nieve { stroke: #f6fafc; stroke-width: 21px; filter: drop-shadow(0 0 6px rgba(220, 238, 248, 0.35)); }
.tramo.abierto path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1s ease; transition-delay: inherit; }
.tramo.abierto.dibujado path { stroke-dashoffset: 0; }
.tramo.cerrado { opacity: 0; transition: opacity 0.9s ease; }
.tramo.cerrado.dibujado { opacity: 0.1; }
.grupo-huellas { opacity: 0; transition: opacity 1.2s ease 0.5s; }
.grupo-huellas.dibujado { opacity: 1; }
.grupo-huellas ellipse { fill: #8fb0c2; opacity: 0.75; }

.nodo {
  position: absolute;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(245, 239, 227, 0.3);
  background: var(--fondo);
  color: var(--apagado);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.4s ease;
}
.nodo:not(.visible) { opacity: 0; }
.nodo.visible { animation: aparecer 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) var(--retraso, 0s) backwards; }
@keyframes aparecer { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@media (hover: hover) { .nodo:hover { transform: scale(1.1); } }
.nodo:active { transform: scale(0.93); }

.nodo.abierto { background: var(--rojo); border-color: var(--rojo-vivo); color: var(--papel); box-shadow: 0 0 12px rgba(224, 70, 75, 0.35); }
.nodo.hoy { background: var(--oro); border-color: var(--oro); color: var(--tinta); box-shadow: 0 0 18px rgba(240, 192, 96, 0.6); }
.nodo.abierto.nuevo { box-shadow: 0 0 0 4px rgba(240, 192, 96, 0.4), 0 0 12px rgba(224, 70, 75, 0.35); }
.nodo.hoy.nuevo::after {
  content: "";
  position: absolute; inset: -2px;
  border-radius: 50%;
  border: 1.5px solid var(--oro);
  animation: pulso 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes pulso { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.7); opacity: 0; } }
.nodo svg { width: 20px; height: 20px; fill: currentColor; }
.nodo.final svg { animation: titilar 2.6s ease-in-out infinite; }
@keyframes titilar { 50% { transform: scale(1.2) rotate(10deg); opacity: 0.75; } }
.nodo.final.cerrado svg { fill: var(--oro); opacity: 0.8; }
.nodo.hecho::before {
  content: "";
  position: absolute; top: -4px; right: -4px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--oro) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d3b2c' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 10px no-repeat;
  box-shadow: 0 0 0 2px var(--fondo);
  animation: pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) 0.2s backwards;
}
.recuerdo {
  position: absolute;
  width: 62px;
  padding: 5px 5px 8px;
  border: 0;
  border-radius: 3px;
  background: #fffdf8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 18px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transform-origin: 50% 0;
  rotate: -5deg;
  animation: colgar 4.6s ease-in-out infinite alternate;
  transition: transform 0.2s ease;
}
.recuerdo.oculto { display: none; }
.recuerdo.nuevo { animation: caer 1s cubic-bezier(0.2, 1.3, 0.4, 1) backwards, colgar 4.6s ease-in-out 1s infinite alternate; }
.recuerdo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 35%; border-radius: 2px; pointer-events: none; }
.recuerdo::before {
  content: "";
  position: absolute; top: -7px; left: 50%;
  width: 28px; height: 12px; margin-left: -14px;
  background: repeating-linear-gradient(-45deg, var(--rojo) 0 4px, var(--papel) 4px 8px);
  opacity: 0.92;
  transform: rotate(3deg);
}
@media (hover: hover) { .recuerdo:hover { transform: scale(1.08); } }
.recuerdo:active { transform: scale(0.95); }
.figura { position: absolute; width: 90px; height: 110px; pointer-events: none; z-index: 2; }
.figura.oculto { display: none; }
.figura.nuevo { animation: caer 1s cubic-bezier(0.2, 1.3, 0.4, 1) backwards; }
.noel { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25)); }
.noel-pierna { transform-origin: 48px 66px; animation: noel-pierna 1.3s ease-in-out infinite; }
.noel-balon { animation: noel-balon 1.3s infinite; }
.noel-giro { transform-origin: 65px 81px; animation: noel-giro 2.6s linear infinite; }
.noel-brazo.i { transform-origin: 30px 40px; animation: noel-brazo-i 1.3s ease-in-out infinite; }
.noel-brazo.d { transform-origin: 54px 40px; animation: noel-brazo-d 1.3s ease-in-out infinite; }
@keyframes noel-balon {
  0%, 100% { transform: translateY(0); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  50% { transform: translateY(-27px); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
}
@keyframes noel-pierna { 0%, 100% { transform: rotate(-38deg); } 22%, 78% { transform: rotate(-4deg); } }
@keyframes noel-giro { to { transform: rotate(360deg); } }
@keyframes noel-brazo-i { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes noel-brazo-d { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(9deg); } }
@keyframes colgar { from { rotate: -6deg; } to { rotate: 2deg; } }
@keyframes caer { from { opacity: 0; transform: translateY(-34px) scale(0.5); } }
.nodo.sacudir { animation: sacudir 0.4s ease; }

.arbol, .adorno {
  position: absolute;
  opacity: 0;
  transform: scaleY(0.4);
  transform-origin: 50% 100%;
  animation: balanceo 5s ease-in-out infinite alternate;
}
.arbol.visible, .adorno.visible { opacity: 1; transform: none; transition: opacity 1s ease, transform 1s cubic-bezier(0.2, 1.3, 0.4, 1); transition-delay: var(--retraso, 0s); }
@keyframes balanceo { from { rotate: -1.4deg; } to { rotate: 1.4deg; } }
.adorno { animation-duration: 6s; }
.columpio { transform-box: fill-box; transform-origin: 50% 0; animation: columpio 2.4s ease-in-out infinite alternate; }
.estrella-g { transform-box: fill-box; transform-origin: 50% 50%; animation: titilar 2.6s ease-in-out infinite; }
.llama { transform-box: fill-box; transform-origin: 50% 100%; animation: parpadeo 0.9s ease-in-out infinite alternate; }
@keyframes columpio { from { transform: rotate(-13deg); } to { transform: rotate(13deg); } }
@keyframes parpadeo { from { transform: scale(1, 1); opacity: 0.9; } to { transform: scale(0.9, 1.1); opacity: 1; } }
.bola { animation: titila 2.2s ease-in-out infinite alternate; }

.bosque { position: absolute; left: -16px; bottom: 0; width: calc(100% + 32px); opacity: 0; transform: translateY(24px); }
.bosque.visible { opacity: 1; transform: none; transition: opacity 1s ease, transform 1s var(--suave); }

.hoy-btn {
  position: fixed;
  right: 16px; bottom: 24px;
  z-index: 3;
  padding: 10px 18px;
  border: 1px solid var(--oro);
  border-radius: 999px;
  background: var(--oro);
  color: var(--tinta);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.hoy-btn.visible { opacity: 1; transform: none; pointer-events: auto; }

.chispa { position: fixed; width: 6px; height: 6px; border-radius: 50%; pointer-events: none; z-index: 6; }

/* ---------- Tarjeta ---------- */
.tarjeta {
  width: min(92vw, 440px);
  max-height: 88vh;
  padding: 32px 24px 24px;
  border: 0;
  border-radius: 16px;
  background:
    repeating-linear-gradient(-45deg, var(--rojo) 0 10px, var(--papel) 10px 20px, var(--abeto) 20px 30px, var(--papel) 30px 40px) top / 100% 8px no-repeat,
    var(--papel);
  color: var(--tinta);
  overflow: auto;
}
.tarjeta[open] { animation: entrar 0.4s var(--suave); }
.tarjeta[open]::backdrop { animation: fundir 0.4s ease; }
.tarjeta.cerrando { animation: salir 0.22s ease-in forwards; }
.tarjeta.cerrando::backdrop { animation: fundir 0.22s ease reverse forwards; }
.tarjeta::backdrop { background: rgba(6, 22, 14, 0.72); }
@keyframes entrar { from { opacity: 0; transform: translateY(28px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes salir { to { opacity: 0; transform: translateY(18px) scale(0.97); } }

.tarjeta h2 { font-size: 1.5rem; margin-bottom: 16px; }
.tarjeta .boton { display: block; margin: 24px auto 0; }
.tarjeta .boton-suave { border-color: var(--tinta); color: var(--tinta); }
.cuerpo > * { animation: subir 0.55s var(--suave) 0.1s backwards; }
.cuerpo > :nth-child(2) { animation-delay: 0.2s; }
.cuerpo > :nth-child(3) { animation-delay: 0.3s; }
.cuerpo p { margin: 0 0 12px; }

.polaroid {
  background: #fffdf8;
  padding: 12px 12px 16px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(29, 59, 44, 0.2), 0 10px 24px rgba(29, 59, 44, 0.12);
  transform: rotate(-1.2deg);
  animation: revelar 0.8s var(--suave) 0.1s backwards;
}
@keyframes revelar { from { opacity: 0; transform: rotate(-6deg) scale(0.9); } }
.polaroid img { display: block; width: 100%; height: auto; border-radius: 2px; }
.polaroid .pie { margin: 12px 0 0; text-align: center; font-family: var(--serif); font-size: 1rem; }

.vale {
  position: relative;
  border: 1.5px solid var(--rojo);
  border-radius: 8px;
  padding: 24px 22px;
  font-family: var(--serif);
  font-size: 1.15rem;
  animation: sello 0.6s var(--suave) 0.1s backwards;
}
.vale::after {
  content: "";
  position: absolute; inset: 5px;
  border: 1px dashed var(--abeto);
  border-radius: 5px;
  pointer-events: none;
}
.vale p:last-child { margin-bottom: 0; }
@keyframes sello { from { opacity: 0; transform: scale(1.08) rotate(-2deg); } }

/* ---------- Puzzle ---------- */
.puzzle-tablero {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.pieza {
  position: absolute;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background-color: #c9cdbf;
  background-clip: padding-box;
  background-origin: border-box;
  cursor: pointer;
  transition: left 0.4s cubic-bezier(0.3, 0.9, 0.3, 1), top 0.4s cubic-bezier(0.3, 0.9, 0.3, 1),
    transform 0.2s ease, box-shadow 0.3s ease, border-width 0.7s ease, border-radius 0.7s ease;
}
.pieza.elegida { transform: scale(0.93); box-shadow: inset 0 0 0 3px var(--rojo); z-index: 2; }
.pieza.bien { box-shadow: inset 0 0 0 2px rgba(47, 107, 69, 0.7); }
.puzzle.resuelto .pieza { border-width: 0; border-radius: 0; box-shadow: none; cursor: default; }
.puzzle-vista {
  position: absolute; inset: 0;
  background-size: 100% 100%;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 3;
}
.puzzle-vista.activa { opacity: 1; }
.puzzle-pie { margin-top: 14px; text-align: center; }
.puzzle-pie .boton { margin: 0; min-width: 0; padding: 8px 20px; font-size: 0.95rem; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.puzzle-final { margin: 14px 0 0; text-align: center; font-family: var(--serif); font-size: 1.1rem; animation: subir 0.8s var(--suave) 0.5s backwards; }
.puzzle.resuelto .puzzle-tablero { animation: latido 0.9s var(--suave); }
@keyframes latido { 40% { transform: scale(1.03); } }

/* Celebración al completar */
.puzzle.celebra .puzzle-tablero { animation: halo-oro 2.4s ease-out; }
@keyframes halo-oro {
  0% { box-shadow: 0 0 0 0 rgba(240, 192, 96, 0.9); }
  30% { box-shadow: 0 0 26px 8px rgba(240, 192, 96, 0.85); }
  100% { box-shadow: 0 0 0 0 rgba(240, 192, 96, 0); }
}
.puzzle.celebra .puzzle-tablero::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.7) 50%, transparent 62%);
  transform: translateX(-120%);
  animation: barrido 1.1s ease-in-out 0.2s forwards;
}
@keyframes barrido { to { transform: translateX(120%); } }
.puzzle.celebra .pieza { animation: ola 0.7s ease-in-out backwards; }
@keyframes ola { 40% { transform: scale(1.07); filter: brightness(1.12); z-index: 2; } }

.puzzle-sello {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 18px 7px 14px;
  border: 1.5px solid var(--rojo);
  border-radius: 999px;
  color: var(--rojo);
  font-family: var(--serif);
  font-size: 1.05rem;
}
.puzzle-sello svg { width: 18px; height: 18px; fill: currentColor; }
.puzzle-sello.nuevo { animation: sello-pop 0.8s cubic-bezier(0.2, 1.5, 0.4, 1) 0.5s backwards; }
.puzzle-sello.nuevo svg { animation: latir 1.2s ease-in-out 1.3s 3; }
@keyframes sello-pop { from { opacity: 0; transform: scale(0.4) rotate(-8deg); } }
@keyframes latir { 40% { transform: scale(1.35); } }

.confeti-capa {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}
.confeti-capa canvas { display: block; width: 100%; height: 100%; }

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  z-index: 5;
  transform: translate(-50%, 12px);
  max-width: 88vw;
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--papel);
  color: var(--tinta);
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Música y monigotes ---------- */
.mini-musica {
  position: fixed;
  left: 16px; bottom: 24px;
  z-index: 3;
  display: flex; flex-direction: column; align-items: flex-start;
  pointer-events: none;
}
.mini-musica.oculto { display: none; }
.mini-musica.nuevo { animation: subir 0.8s var(--suave) backwards; }
.mini-boton {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 5px 16px 5px 5px;
  border: 1px solid rgba(240, 192, 96, 0.55);
  border-radius: 999px;
  background: rgba(15, 43, 29, 0.94);
  color: var(--papel);
  font: inherit; font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.mini-boton:active { transform: scale(0.96); }
.mini-disco { position: relative; display: block; width: 38px; height: 38px; flex: none; }
.mini-disco .disco { display: block; width: 100%; height: 100%; }
.mini-icono { position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; fill: var(--papel); }
.mini-icono .ic-pausa, body.suena .mini-icono .ic-play { display: none; }
body.suena .mini-icono .ic-pausa { display: inline; }
.mini-texto { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 359px) { .mini-texto { max-width: 96px; } }

body.suena .disco { animation: girar 3.2s linear infinite; }
@keyframes girar { to { rotate: 360deg; } }

/* Los monigotes asoman cuando suena la música */
.escenario { display: flex; align-items: flex-end; gap: 2px; height: 64px; margin: 0 0 6px 8px; }
.mono { display: block; width: 38px; height: 61px; overflow: visible; }
.mono path { fill: none; stroke: var(--c); stroke-width: 3.6; stroke-linecap: round; }
.mono .cabeza { fill: var(--c); }
.mono .gorro { fill: var(--rojo-vivo); stroke: none; }
.mono .borde { fill: var(--papel); stroke: none; }
.escenario .mono { opacity: 0; transform: translateY(26px) scale(0.4); transform-origin: 50% 100%; transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
body.suena .escenario .mono { opacity: 1; transform: none; transition-delay: calc(var(--d) * 1.5); }
.mono .cuerpo-mono, .mono .brazo, .mono .pierna { transform-box: fill-box; }
.mono .cuerpo-mono { transform-origin: 50% 100%; }
.mono .b1, .mono .p1 { transform-origin: 100% 0; }
.mono .b2, .mono .p2 { transform-origin: 0 0; }
body.suena .mono .cuerpo-mono { animation: bailar 0.56s ease-in-out var(--d) infinite alternate; }
body.suena .mono .b1 { animation: brazo-i 0.56s ease-in-out var(--d) infinite alternate; }
body.suena .mono .b2 { animation: brazo-d 0.56s ease-in-out var(--d) infinite alternate; }
body.suena .mono .p1 { animation: pierna-i 0.56s ease-in-out var(--d) infinite alternate; }
body.suena .mono .p2 { animation: pierna-d 0.56s ease-in-out var(--d) infinite alternate; }
@keyframes bailar { from { transform: translateY(0) rotate(-7deg); } to { transform: translateY(-5px) rotate(7deg); } }
@keyframes brazo-i { from { transform: rotate(-75deg); } to { transform: rotate(20deg); } }
@keyframes brazo-d { from { transform: rotate(75deg); } to { transform: rotate(-20deg); } }
@keyframes pierna-i { from { transform: rotate(14deg); } to { transform: rotate(-12deg); } }
@keyframes pierna-d { from { transform: rotate(-14deg); } to { transform: rotate(12deg); } }

/* El camino también baila: luces más rápidas y arbolitos con más swing */
body.suena .bombilla:not(.apagada) { animation-duration: 0.56s; }
body.suena .arbol, body.suena .adorno { animation-duration: 1.12s; }
body.suena .columpio { animation-duration: 0.56s; }

/* Tarjeta de la canción */
.cancion { text-align: center; }
.cancion .escenario.en-tarjeta { position: absolute; inset: 0; height: auto; margin: 0; pointer-events: none; }
.cancion .escenario.en-tarjeta .mono { position: absolute; bottom: 0; width: 36px; height: 57px; }
.cancion .escenario.en-tarjeta .mono:nth-child(1) { left: -50px; --c: #c8343a !important; }
.cancion .escenario.en-tarjeta .mono:nth-child(2) { right: -50px; --c: #2f6b45 !important; }
.cancion-disco { position: relative; width: 128px; height: 128px; margin: 4px auto 14px; filter: drop-shadow(0 6px 10px rgba(29, 59, 44, 0.3)); }
.cancion-disco .disco { display: block; width: 100%; height: 100%; }
.cancion-titulo { margin: 0; font-family: var(--serif); font-size: 1.3rem; }
.cancion-artista { margin: 2px 0 0; opacity: 0.7; font-size: 0.95rem; }
.cancion .boton { margin-top: 18px; min-width: 150px; }
.cancion-barra { display: block; width: 100%; margin: 18px 0 4px; accent-color: var(--rojo); }
.cancion-nota {
  max-width: 62%;
  margin: 14px 0 0 auto !important;
  padding: 7px 10px;
  border: 1px dashed var(--abeto);
  border-radius: 6px;
  background: rgba(47, 107, 69, 0.07);
  color: var(--abeto);
  font-family: var(--serif);
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.3;
  text-align: right;
  rotate: -2deg;
  transform-origin: 100% 50%;
}
.cancion-reloj { margin: 0; font-size: 0.85rem; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ---------- Test de preguntas ---------- */
.test-contador { margin: 0 0 6px; font-size: 0.85rem; opacity: 0.7; }
.test-barra { height: 5px; margin-bottom: 18px; border-radius: 99px; background: rgba(29, 59, 44, 0.12); overflow: hidden; }
.test-barra span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rojo), var(--abeto)); transition: width 0.5s var(--suave); }
.test-pregunta { margin: 0 0 16px; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; line-height: 1.3; animation: subir 0.45s var(--suave) backwards; }
.test-opciones { display: grid; gap: 10px; }
.test-opcion {
  padding: 12px 16px;
  border: 1.5px solid rgba(29, 59, 44, 0.45);
  border-radius: 12px;
  background: transparent;
  color: var(--tinta);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  animation: subir 0.45s var(--suave) backwards;
}
.test-opcion:nth-child(2) { animation-delay: 0.06s; }
.test-opcion:nth-child(3) { animation-delay: 0.12s; }
.test-opcion:nth-child(4) { animation-delay: 0.18s; }
@media (hover: hover) { .test-opcion:not(:disabled):hover { background: rgba(47, 107, 69, 0.1); } }
.test-opcion:not(:disabled):active { transform: scale(0.98); }
.test-opcion:disabled { cursor: default; }
.test-opciones { grid-auto-flow: row; }
.test-opcion.bien { border-color: var(--abeto); background: rgba(47, 107, 69, 0.16); animation: pop 0.35s cubic-bezier(0.2, 1.5, 0.4, 1); }
.test-opcion.mal { border-color: var(--rojo); background: rgba(200, 52, 58, 0.12); animation: sacudir 0.4s ease; }
.test-opcion.correcta { border-color: var(--abeto); border-style: dashed; }
.test-feedback { min-height: 1.4em; margin: 14px 0 0; font-family: var(--serif); font-size: 1.05rem; color: var(--abeto); animation: subir 0.4s var(--suave) backwards; }
.test-feedback.es-mal { color: var(--rojo); }
.test-feedback.test-decepcion { margin-top: 18px; font-size: 1.35rem; text-align: center; line-height: 1.3; }
.test-aviso { display: inline-block; margin: 0 0 10px; padding: 3px 12px; border-radius: 99px; background: var(--oro); color: var(--tinta); font-size: 0.8rem; font-weight: 600; }
.test-texto {
  display: block; width: 100%;
  padding: 12px 14px;
  border: 1.5px solid rgba(29, 59, 44, 0.45);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--tinta);
  font: inherit;
  resize: vertical;
}
.test-texto:focus { outline: 2px solid var(--abeto); outline-offset: 1px; }
.tarjeta .test-enviar, .tarjeta .test-sig { margin-top: 14px; }
.tarjeta .test-enviar:disabled { opacity: 0.45; cursor: default; }
.test-final { text-align: center; animation: subir 0.6s var(--suave) backwards; }
.test-nota { margin: 4px 0 8px; font-family: var(--serif); font-size: 3rem; line-height: 1; color: var(--rojo); }
.test-veredicto { margin: 0 0 10px; font-family: var(--serif); font-size: 1.2rem; }
.test-cierre { margin: 0; opacity: 0.75; font-size: 0.95rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .nodo:not(.visible) { opacity: 1; }
  .tramo.abierto path { stroke-dashoffset: 0; }
  .tramo.cerrado { opacity: 0.1; }
  .grupo-huellas, .arbol, .adorno, .bosque { opacity: 1; transform: none; }
  body.suena .escenario .mono { opacity: 1; transform: none; }
}
