/* Ahorcado educativo (/dos/ahorcado/): escena de invierno con el muñeco de nieve, panel de juego, huecos y teclado.
   Va después de /cq.css y /dos/dos.css. */
.ah { display: grid; grid-template-columns: minmax(300px, 440px) minmax(0, 1fr); gap: 22px; width: 100%; max-width: 1100px; align-items: start; }
.ah-izq { position: sticky; top: 12px; display: grid; gap: 12px; }

/* ---------- escena ---------- */
.ah-escena { position: relative; container-type: inline-size; aspect-ratio: 120 / 84; border: 3px solid var(--cq-ink); border-radius: 18px;
             overflow: hidden; box-shadow: 6px 6px 0 var(--cq-ink); background: #a6daf6; line-height: 0; user-select: none; }
.ah-escena svg { display: block; }
.ah-fondo { position: absolute; inset: 0; }
.ah-fondo svg { width: 100%; height: 100%; }
.ah-calor { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 78% 6%, rgba(255, 196, 92, .75), rgba(255, 150, 70, .25) 45%, rgba(255, 140, 60, 0) 75%);
            opacity: calc(var(--f, 0) / 7 * .85); transition: opacity .6s; }
.ah-sol { position: absolute; width: calc(15cqw + var(--f, 0) * 1.4cqw); left: calc(80% - var(--f, 0) * 3.6%); top: calc(2% + var(--f, 0) * .6%);
          transition: left .8s cubic-bezier(.3, 1.4, .5, 1), width .8s, top .8s; filter: drop-shadow(0 0 calc(var(--f, 0) * 1.2px) rgba(255, 190, 80, .9)); }
.ah-sol svg { width: 100%; height: auto; animation: ah-gira 6s steps(4) infinite; }
.ah-muneco { position: absolute; left: 50%; bottom: 2.5cqw; width: 40cqw; transform: translateX(-50%); transform-origin: 50% 100%; }
.ah-muneco svg { width: 100%; height: auto; }
.ah-muneco.ay { animation: ah-ay .55s ease-out; }
.ah-escena.feliz .ah-muneco { animation: ah-salta .6s steps(2) 4; }
.ah-copos { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ah-copo { position: absolute; top: -8%; width: 4.5cqw; animation: ah-cae 2.6s linear forwards; }
.ah-copo svg, .ah-gota svg { width: 100%; height: auto; }
.ah-gota { position: absolute; top: 46%; width: 3.2cqw; animation: ah-gotea 1.1s ease-in forwards; }
.ah-vidas { display: flex; justify-content: center; gap: 6px; padding: 8px 10px; background: #fff; border: 3px solid var(--cq-ink); border-radius: 14px;
            box-shadow: 3px 3px 0 var(--cq-ink); }
.ah-vida { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: #e7f3fd; border: 2px solid #b9d6ee; line-height: 0; transition: background .3s; }
.ah-vida svg { width: 20px; height: 20px; }
.ah-vida.gastada { background: #f1ece3; border-color: #ddd4c4; }
.ah-vida.gastada svg { width: 13px; height: auto; opacity: .75; }

/* ---------- panel ---------- */
.ah-panel { background: #fff; border: 3px solid var(--cq-ink); border-radius: 20px; box-shadow: var(--cq-sh-lg, 6px 6px 0 var(--cq-ink)); padding: 18px 22px 22px; min-width: 0; }
.ah-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ah-ronda { font: 700 15px/1 var(--cq-body); color: var(--cq-ink2); background: var(--cq-bg); border: 2px solid var(--cq-ink); border-radius: 999px; padding: 7px 12px; }
.ah-ronda b { font: 800 17px/1 var(--cq-head); color: var(--cq-ink); }
.ah-marcador { display: flex; gap: 8px; }
.ah-pts { display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 12px; border: 2px solid var(--cq-ink); background: var(--j-l); max-width: 170px; }
.ah-pts b { font: 700 14.5px/1.1 var(--cq-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-pts i { font: 800 18px/1 var(--cq-head); font-style: normal; min-width: 30px; height: 28px; display: grid; place-items: center; background: #fff; border: 2px solid var(--cq-ink); border-radius: 8px; color: var(--j-d); }
.ah-pts.activo { box-shadow: 3px 3px 0 var(--j-d); }
.ah-h { font: 800 clamp(22px, 2.3vw, 28px)/1.15 var(--cq-head) !important; letter-spacing: -.4px; margin: 4px 0 6px; }
.ah-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--cq-ink2); font-size: 16px; margin: 0 0 12px; }
.ah-nota { color: var(--cq-ink2); font-size: 14px; margin: 12px 0 0; text-align: center; }

.ah-pista { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; padding: 8px 12px; background: var(--cq-yellow-l); border: 2px solid var(--cq-ink);
            border-radius: 14px; line-height: 1.1; }
.ah-pista svg { flex: none; }
.ah-pista span { display: flex; flex-direction: column; }
.ah-pista small { font-weight: 700; font-size: 12.5px; color: #6b5a1d; text-transform: uppercase; letter-spacing: .6px; }
.ah-pista b { font: 800 20px/1.1 var(--cq-head); }
.ah-pista .ah-pista-n { flex-direction: row; align-items: baseline; gap: 5px; margin-left: auto; font-weight: 700; color: var(--cq-ink2); }
.ah-pista .ah-pista-n b { font-size: 24px; color: var(--cq-ink); }
.ah-pista .ah-pista-c { font-weight: 700; font-size: 13.5px; color: var(--cq-ink2); background: #fff; border: 2px solid var(--cq-ink); border-radius: 999px; padding: 4px 9px; }

/* huecos de la palabra */
.ah-huecos { --t: clamp(30px, 4.2vw, 52px); display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; margin: 6px 0 12px; }
.ah-huecos.largo { --t: clamp(24px, 3.3vw, 42px); gap: 5px; }
.ah-hueco { width: var(--t); height: calc(var(--t) * 1.22); display: grid; place-items: center; font: 800 calc(var(--t) * .62)/1 var(--cq-head); color: var(--cq-ink);
            background: #f3f7fc; border: 3px solid #c7d3e6; border-bottom: 5px solid var(--cq-ink); border-radius: 10px 10px 6px 6px; }
.ah-hueco.ok { background: #fff; border-color: var(--cq-ink); box-shadow: 0 3px 0 var(--cq-ink); }
.ah-hueco.nueva { background: var(--cq-yellow); animation: ah-pop .45s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i) * 40ms); }
.ah-hueco.falta { color: #a32a12; background: var(--cq-coral-l); border-color: var(--cq-ink); }
.ah-huecos.mia .ah-hueco.falta { color: #8a8fa8; background: #f3f1ec; border-color: #c9c3b6; border-bottom-color: #a59f92; }
.ah-huecos.fin .ah-hueco.ok { background: var(--cq-mint-l); }
.ah-res.bien .ah-huecos.fin .ah-hueco { animation: ah-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i) * 60ms); }

.ah-msg { min-height: 30px; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; font-weight: 800; font-size: 17px; margin: 0 0 12px; color: var(--cq-ink2); }
.ah-msg.si { color: #136b4d; }
.ah-msg.no { color: #a32a12; }
.ah-msg .dos-espera { margin: 0; }

/* teclado A–Z + Ñ */
.ah-teclado { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 7px; max-width: 620px; margin: 0 auto; }
.ah-tecla { min-height: 50px; font: 800 22px/1 var(--cq-head); color: var(--cq-ink); background: #fff; border: 3px solid var(--cq-ink); border-radius: 12px;
            box-shadow: 0 4px 0 var(--cq-ink); cursor: pointer; padding: 0; transition: transform .08s, box-shadow .08s, background .15s; touch-action: manipulation; }
.ah-tecla:hover { background: var(--cq-yellow-l); }
.ah-tecla:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--cq-ink); }
.ah-tecla:focus-visible { outline: 3px solid var(--cq-blue); outline-offset: 2px; }
.ah-tecla.si { background: var(--cq-mint-l); color: #0f5a40; box-shadow: 0 2px 0 var(--cq-mint-d); border-color: var(--cq-mint-d); cursor: default; }
.ah-tecla.no { background: #ece7de; color: #6f6a62; border-color: #b9b2a5; box-shadow: none; text-decoration: line-through 3px #c4553b; cursor: default; transform: translateY(2px); }
.ah-tecla.pend { background: var(--cq-yellow); animation: ah-late .8s ease-in-out infinite; }
.ah-teclado.quieto .ah-tecla { cursor: default; }
.ah-teclado.quieto .ah-tecla:not(.si):not(.no):not(.pend) { opacity: .7; }
.ah-teclado.quieto .ah-tecla:hover:not(.pend) { background: #fff; }
.ah-teclado.quieto .ah-tecla.si:hover { background: var(--cq-mint-l); }
.ah-teclado.quieto .ah-tecla.no:hover { background: #ece7de; }

/* elegir palabra */
.ah-fila { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.ah-et { flex: none; width: 50px; font-weight: 800; font-size: 14px; color: var(--cq-ink2); text-transform: uppercase; letter-spacing: .5px; }
.ah-chips { gap: 6px; }
.ah-chips .cq-chip { min-height: 40px; padding: 7px 12px; font-size: 14.5px; }
.ah-chips .cq-chip[aria-pressed="true"] { background: var(--cq-ink); color: #fff; }
.ah-chip-ic { display: inline-flex; align-items: center; gap: 6px; }
.ah-palabras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 4px; }
.ah-palabra { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 12px; font: inherit; color: var(--cq-ink); background: var(--cq-bg);
              border: 3px solid var(--cq-ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--cq-ink); cursor: pointer; text-align: left; transition: transform .1s, box-shadow .1s, background .1s; }
.ah-palabra:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--cq-ink); background: var(--cq-yellow-l); }
.ah-palabra b { font: 800 18px/1.1 var(--cq-head); letter-spacing: .5px; overflow-wrap: anywhere; }
.ah-palabra small { margin-left: auto; flex: none; font-weight: 800; font-size: 13px; color: var(--cq-ink2); background: #fff; border: 2px solid var(--cq-line, #ddd); border-radius: 8px; padding: 2px 6px; }
.ah-palabra[aria-pressed="true"] { background: var(--cq-yellow); box-shadow: 4px 4px 0 var(--cq-yellow-d); transform: translate(-1px, -1px); }
.ah-palabra svg { flex: none; }
.ah-botones { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0 0; }
.ah-botones .cq-btn { display: inline-flex; align-items: center; gap: 6px; }
.ah-esconder { margin-left: auto; }
.ah-res .ah-botones { justify-content: center; }
.ah-res .ah-botones .cq-btn { margin: 0; }

/* esperar */
.ah-espera { text-align: center; padding: 26px 8px 18px; }
.ah-espera svg { animation: ah-flota 1.6s steps(2) infinite; }
.ah-espera .ah-sub { justify-content: center; margin-top: 8px; }
.ah-res { text-align: center; }
.ah-res .ah-sub { justify-content: center; font-weight: 700; }
.ah-res.bien .ah-h { color: #136b4d; }
.ah-res.mal .ah-h { color: #a32a12; }

/* reglas (las pinta sala.js en su diálogo) */
.ah-reglas-arte { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.ah-reglas-arte figure { margin: 0; display: grid; justify-items: center; gap: 4px; padding: 8px 8px 6px; background: #e8f4fd; border: 2px solid var(--cq-ink); border-radius: 12px; }
.ah-reglas-arte figcaption { font-weight: 800; font-size: 13px; color: var(--cq-ink); }

@keyframes ah-gira { 50% { transform: rotate(8deg); } }
@keyframes ah-ay { 0% { transform: translateX(-50%); } 25% { transform: translateX(-53%) scaleY(.94); } 55% { transform: translateX(-47%) scaleY(.97); } 100% { transform: translateX(-50%); } }
@keyframes ah-salta { 50% { transform: translateX(-50%) translateY(-6%); } }
@keyframes ah-cae { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(var(--d, 0), 125cqw); opacity: .8; } }
@keyframes ah-gotea { from { transform: translateY(0); opacity: 1; } to { transform: translateY(16cqw); opacity: 0; } }
@keyframes ah-pop { 0% { transform: scale(.4) translateY(10px); } 100% { transform: none; } }
@keyframes ah-late { 50% { transform: scale(1.08); } }
@keyframes ah-flota { 50% { transform: translateY(-4px); } }

@media (max-width: 900px) {
  .ah { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .ah-izq { position: static; grid-template-columns: minmax(0, 1fr); max-width: 560px; width: 100%; margin: 0 auto; }
  .ah-v-elegir .ah-izq { display: none; }
}
@media (max-width: 760px) {
  .ah-izq { position: relative; }
  .ah-escena { aspect-ratio: 120 / 54; border-radius: 14px; box-shadow: 4px 4px 0 var(--cq-ink); }
  .ah-fondo svg { position: absolute; bottom: 0; height: auto; }
  .ah-fondo { top: auto; }
  .ah-muneco { width: 27cqw; bottom: 1.5cqw; }
  .ah-vidas { position: absolute; top: 9px; left: 9px; padding: 4px 6px; gap: 3px; border-radius: 10px; border-width: 2px; box-shadow: 2px 2px 0 var(--cq-ink);
              background: rgba(255, 255, 255, .92); }
  .ah-vida { width: 21px; height: 21px; border-radius: 6px; border-width: 1px; }
  .ah-vida svg { width: 14px; height: 14px; }
  .ah-vida.gastada svg { width: 9px; }
  .ah-panel { padding: 12px 12px 16px; border-radius: 16px; }
  .ah-cab { margin-bottom: 8px; }
  .ah-cab { flex-wrap: nowrap; }
  .ah-ronda { padding: 6px 10px; font-size: 14px; white-space: nowrap; }
  .ah-pts { padding: 3px 3px 3px 3px; gap: 0; }
  .ah-pts b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ah-pista { gap: 8px; padding: 6px 10px; margin-bottom: 10px; }
  .ah-pista svg { width: 26px; height: 26px; }
  .ah-pista b { font-size: 17px; }
  .ah-pista .ah-pista-c { display: none; }
  .ah-huecos { --t: min(38px, calc((100vw - 70px) / var(--n, 8))); gap: 4px; }
  .ah-huecos.largo { --t: min(30px, calc((100vw - 64px) / 11)); gap: 3px; }
  .ah-hueco { border-width: 2px; border-bottom-width: 4px; border-radius: 7px 7px 4px 4px; }
  .ah-teclado { gap: 5px; }
  .ah-tecla { min-height: 46px; font-size: 19px; border-radius: 9px; border-width: 2px; box-shadow: 0 3px 0 var(--cq-ink); }
  .ah-msg { font-size: 15.5px; margin-bottom: 8px; }
  .ah-nota { display: none; }
  .ah-palabras { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ah-palabra { min-height: 48px; padding: 6px 9px; }
  .ah-palabra b { font-size: 15.5px; letter-spacing: 0; overflow-wrap: normal; }
  .ah-palabra svg { display: none; }
  .ah-fila { flex-direction: column; align-items: stretch; gap: 4px; }
  .ah-et { width: auto; }
  .ah-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .ah-chips .cq-chip { flex: none; }
  .ah-esconder { margin-left: 0; width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ah-sol, .ah-calor { transition: none; }
  .ah-sol svg, .ah-muneco.ay, .ah-escena.feliz .ah-muneco, .ah-hueco.nueva, .ah-res.bien .ah-huecos.fin .ah-hueco, .ah-tecla.pend, .ah-espera svg { animation: none !important; }
}
