/* =========================================================
   Más juegos para aprender en casa (js/aprender-casa-2.js)
   El xilófono de Nina y el laberinto de Nina.
   El resto (barra, estrellas) está en css/juegos.css.
   ========================================================= */

/* ---------- El xilófono ---------- */
.xilo {
  position: relative; display: flex; align-items: center; justify-content: center; gap: clamp(6px, 1.4vw, 14px);
  width: min(100%, 720px); height: clamp(200px, 36vw, 300px); padding: 0 clamp(10px, 2vw, 22px);
}
.xilo__soporte {
  position: absolute; left: 2%; right: 2%; top: 26%; bottom: 26%; z-index: 0; pointer-events: none;
  background: linear-gradient(#9B6A43, #9B6A43) top / 100% 14px no-repeat, linear-gradient(#9B6A43, #9B6A43) bottom / 100% 14px no-repeat;
  transform: perspective(600px) rotateY(0) skewY(-6deg); border-radius: 8px;
}
.xilo__barra {
  position: relative; z-index: 1; flex: 1; max-width: 76px; height: var(--alto); border: 0; border-radius: 14px; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 12px 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, .35), transparent 40%, rgba(0, 0, 0, .08)), var(--color);
  box-shadow: inset 0 0 0 3px rgba(29, 42, 77, .5), 0 6px 0 rgba(29, 42, 77, .28); touch-action: none; user-select: none; -webkit-user-select: none;
}
.xilo__clavo { width: 12px; height: 12px; border-radius: 50%; background: #D9DEE7; box-shadow: inset 0 0 0 2px rgba(29, 42, 77, .5); }
.xilo__nombre { font-weight: 800; font-size: clamp(.85rem, 1.8vw, 1.15rem); color: #38251F; background: rgba(255, 255, 255, .6); border-radius: 10px; padding: 0 6px; }
.xilo__barra:focus-visible { outline: 4px solid var(--foco); outline-offset: 3px; }
.xilo__barra--suena { filter: brightness(1.15); box-shadow: inset 0 0 0 3px rgba(29, 42, 77, .5), 0 0 0 6px #FFF4CF, 0 2px 0 rgba(29, 42, 77, .28); transform: translateY(4px); }
@media (prefers-reduced-motion: no-preference) {
  .xilo__barra { transition: transform .12s ease, filter .3s ease; }
  .xilo__barra--suena { animation: xilo-vibra .45s ease-out; }
}
@keyframes xilo-vibra { 0% { transform: translateY(5px) rotate(-1.5deg); } 30% { transform: translateY(3px) rotate(1.5deg); } 60% { transform: translateY(4px) rotate(-.8deg); } 100% { transform: translateY(4px); } }

/* Modo «Tocar libre»: sin estrellas ni «Escuchar otra vez» */
.juego--libre .juego-estrellas, .juego--libre .juego-repetir { display: none; }
.xilo-inicio-libre { min-width: 12em; }

/* ---------- El laberinto ---------- */
.lab { position: relative; width: min(100%, 760px, calc(52vh * var(--prop))); aspect-ratio: var(--prop); touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 22px; }
.lab:focus-visible { outline: 4px solid var(--foco); outline-offset: 4px; }
.lab__plano { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lab__hierba { fill: #CFEFC0; }
.lab__salida { fill: #FFF4CF; }
.lab__seto { fill: none; stroke: #4FA36B; stroke-width: 10; stroke-linecap: round; }
.lab__seto-sombra { fill: none; stroke: #2F7A4A; stroke-width: 10; stroke-linecap: round; transform: translateY(3px); }
.lab__rastro { fill: none; stroke: #FFB079; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 14; opacity: .9; }
.lab__nina { position: absolute; transform: translate(-50%, -58%); pointer-events: none; z-index: 2; transition: left .14s ease, top .14s ease; }
.lab__nina img { width: 100%; height: auto; display: block; }
.lab--choca .lab__nina { animation: juego-no .2s ease-in-out; }
@media (prefers-reduced-motion: no-preference) {
  .lab__nina--llega { animation: lab-salta .5s ease-in-out 2; }
}
@keyframes lab-salta { 50% { transform: translate(-50%, -85%); } }
:root[data-theme="dark"] .lab__hierba { fill: #BFE3B2; }

@media (max-width: 560px) {
  .xilo { height: 200px; gap: 5px; padding: 0 4px; }
  .xilo__barra { border-radius: 10px; padding: 8px 0; }
  .xilo__clavo { width: 9px; height: 9px; }
  .xilo__nombre { font-size: .8rem; padding: 0 3px; }
  .lab { width: min(100%, calc(54vh * var(--prop))); }
}
