/* Duditopia · Zona Niños · Puzles — estilos del centro de puzles, niveles, pantalla de juego y celebración.
   Se apoya en /ninos/ui.css (variables --ink, --pink, --mint…, .k-card, .k-btn, .k-bar). Cada tipo pinta su tablero
   dentro de .pz-board con el tamaño --pz-size (lo calcula motor.js). */
.c-coral { --c: #ff8a6b; --c-l: #ffe7df; --c-d: #b83d22; }
.c-blue { --c: #2f6bf2; --c-l: #e4ecff; --c-d: #1c45b5; }
.c-mint { --c: #2fae82; --c-l: #dcf6ea; --c-d: #17694b; }
.c-yellow { --c: #ffcf4a; --c-l: #fff3cf; --c-d: #7a5200; }
.c-lila { --c: #8b5cf6; --c-l: #f1e8ff; --c-d: #5b34c2; }
.c-sky { --c: #7ad7f0; --c-l: #e3f6fc; --c-d: #1d6f8a; }
.c-green { --c: #62b04a; --c-l: #e4f5dc; --c-d: #2f6e23; }

body.k { background: transparent; }
.pz-wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 48px; padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right)); }
.pz-wrap svg { shape-rendering: crispEdges; display: block; }
.pz-h2 { font: 800 28px/1.1 var(--pixel); margin: 30px 4px 14px; letter-spacing: -.5px; }
.pz-foot { text-align: center; color: var(--soft); font-size: 15px; font-weight: 600; margin: 28px auto 0; max-width: 560px; }

/* ---------- portada (hub) ---------- */
.pz-hero { display: grid; grid-template-columns: 300px 1fr; gap: 10px 28px; align-items: center; padding: 22px 28px;
  background: #fff linear-gradient(135deg, #fff 55%, #fff6dd); position: relative; overflow: hidden; }
.pz-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(#f0e6d6 2px, transparent 2px), linear-gradient(90deg, #f0e6d6 2px, transparent 2px);
  background-size: 28px 28px; -webkit-mask: linear-gradient(90deg, #000, transparent 45%); mask: linear-gradient(90deg, #000, transparent 45%); }
.pz-hero-art { position: relative; height: 190px; }
.pz-hero-dudi { position: absolute; left: 0; bottom: 0; width: 150px; animation: pz-bob 2.6s ease-in-out infinite; }
.pz-hero-dudi svg { width: 100%; height: auto; }
.pz-hero-pz { position: absolute; right: 14px; top: 2px; width: 132px; transform: rotate(8deg); }
.pz-hero-pz svg { width: 100%; height: auto; }
.pz-hero-txt { position: relative; }
.pz-hero h2 { font: 800 44px/1.02 var(--pixel); margin: 0 0 8px; letter-spacing: -1px; }
.pz-hero h2 span { color: var(--blue); }
.pz-hero p { margin: 0 0 16px; color: var(--soft); font-size: 18px; max-width: 560px; }

.pz-bands { display: flex; gap: 10px; flex-wrap: wrap; }
.pz-band { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 7px 16px 8px; border-radius: 14px;
  border: 3px solid var(--ink); background: #fff; box-shadow: 3px 3px 0 var(--ink); text-align: left; min-height: 54px;
  transition: transform .1s, box-shadow .1s, background .15s; }
.pz-band b { font: 800 19px/1.1 var(--pixel); }
.pz-band span { font: 700 14px/1.2 var(--round); color: var(--soft); }
.pz-band:hover { background: var(--yellow-l); }
.pz-band[aria-checked="true"].b0 { background: var(--yellow); }
.pz-band[aria-checked="true"].b1 { background: #9fe3c4; }
.pz-band[aria-checked="true"].b2 { background: #c9b6ff; }
.pz-band[aria-checked="true"] span { color: var(--ink); }
.pz-band:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.pz-bands.big .pz-band { flex: 1 1 140px; padding: 10px 18px 11px; }
.pz-bands.big .pz-band b { font-size: 23px; }
.pz-bands.pick .pz-band { animation: pz-wiggle 2.4s ease-in-out infinite; }
.pz-bands.pick .pz-band.b1 { animation-delay: .15s; } .pz-bands.pick .pz-band.b2 { animation-delay: .3s; }

.pz-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.pz-type { display: flex; flex-direction: column; background: #fff; border: 3px solid var(--ink); border-radius: 20px; overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink); color: var(--ink); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.pz-type:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); color: var(--ink); }
.pz-type:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.pz-type-art { display: grid; place-items: center; height: 150px; border-bottom: 3px solid var(--ink); position: relative;
  background: var(--c-l) radial-gradient(circle at 50% 120%, var(--c) 0 34%, transparent 35%); }
.pz-type-art::before { content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: radial-gradient(var(--c) 1.6px, transparent 1.8px); background-size: 16px 16px; }
.pz-type-art svg { width: 128px; height: 128px; position: relative; }
.pz-type:hover .pz-type-art svg { animation: pz-bob .8s ease-in-out infinite; }
.pz-type-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px 14px; flex: 1; }
.pz-type-body > b { font: 800 22px/1.15 var(--pixel); letter-spacing: -.3px; }
.pz-type-body > span { color: var(--soft); font-size: 16px; font-weight: 600; line-height: 1.35; flex: 1; }
.pz-prog { display: flex; align-items: center; gap: 8px; margin-top: 8px; font: 800 15px/1 var(--round); }
.pz-bar { flex: 1; height: 14px; border: 2px solid var(--ink); border-radius: 99px; background: #f3eee4; overflow: hidden; }
.pz-bar i { display: block; height: 100%; background: var(--c); border-right: 2px solid var(--ink); }
.pz-bar i[style="width:0%"] { border: 0; }
.pz-prog-s { display: inline-flex; align-items: center; gap: 3px; }
.pz-prog-s svg { width: 18px; height: 18px; }

/* ---------- niveles ---------- */
.pz-lhead { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 24px; align-items: center; padding: 18px 24px;
  background: #fff linear-gradient(120deg, var(--c-l), #fff 60%); }
.pz-lhead-art { width: 128px; height: 128px; border-radius: 20px; background: #fff; border: 3px solid var(--ink); display: grid; place-items: center; }
.pz-lhead-art svg { width: 96px; height: 96px; }
.pz-lhead h2 { font: 800 34px/1.05 var(--pixel); margin: 0 0 4px; letter-spacing: -.6px; }
.pz-lhead p { margin: 0 0 12px; color: var(--soft); font-size: 17px; }
.pz-lhead-sum { text-align: center; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 16px; box-shadow: 3px 3px 0 var(--ink); }
.pz-lhead-sum b { display: flex; align-items: center; justify-content: center; gap: 6px; font: 800 34px/1 var(--pixel); }
.pz-lhead-sum b small { font-size: 18px; color: var(--soft); }
.pz-lhead-sum svg { width: 30px; height: 30px; }
.pz-lhead-sum span { font-size: 14px; color: var(--soft); font-weight: 700; }
.pz-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 16px; margin-top: 22px; }
.pz-lv { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  aspect-ratio: 1 / 1; border: 3px solid var(--ink); border-radius: 20px; background: #fff; box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink); text-decoration: none; transition: transform .1s, box-shadow .1s, background .15s; }
.pz-lv b { font: 800 40px/1 var(--pixel); }
.pz-lv-st { display: flex; gap: 2px; }
.pz-lv-st svg { width: 26px; height: 26px; }
.pz-lv.done { background: var(--c-l); }
.pz-lv.next { background: var(--yellow); animation: pz-pulse 1.6s ease-in-out infinite; }
.pz-lv:not(.lock):hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); color: var(--ink); }
.pz-lv:not(.lock):active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.pz-lv.lock { background: #efe9dd; color: #a49d8f; border-color: #b9b2a4; box-shadow: 4px 4px 0 #b9b2a4; }
.pz-lv.lock b { opacity: .55; }
.pz-lv-lock svg { width: 34px; height: 34px; opacity: .9; }

/* ---------- pantalla de juego ---------- */
body[data-view="play"] .pz-wrap { max-width: 1320px; padding-top: 14px; padding-bottom: 20px; }
.pz-play { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; }
.pz-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 92px; }
.pz-info { padding: 14px 16px; }
.pz-info-h { display: flex; align-items: center; gap: 12px; }
.pz-info-art { width: 60px; height: 60px; flex: none; border-radius: 14px; background: var(--c-l); border: 3px solid var(--ink); display: grid; place-items: center; }
.pz-info-art svg { width: 48px; height: 48px; }
.pz-info-h b { display: block; font: 800 20px/1.15 var(--pixel); }
.pz-info-h span { font-size: 15px; color: var(--soft); font-weight: 700; }
.pz-help { margin: 12px 0 0; font-size: 17px; line-height: 1.4; }
.pz-say { margin: 8px 0 0; min-height: 1.4em; font-weight: 800; color: var(--c-d); font-size: 17px; }
.pz-say:empty::before { content: "\a0"; }
.pz-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pz-tool { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; border: 3px solid var(--ink);
  border-radius: 16px; background: #fff; box-shadow: 3px 3px 0 var(--ink); font: 800 16px/1.1 var(--round); transition: transform .1s, box-shadow .1s, background .15s; }
.pz-tool svg { width: 34px; height: 34px; }
.pz-tool.t-hint { background: var(--lilac-l); }
.pz-tool:hover:not([disabled]) { background: var(--yellow-l); }
.pz-tool:active:not([disabled]) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.pz-tool[disabled] { opacity: .45; cursor: default; }
.pz-meta { display: flex; justify-content: space-between; gap: 8px; font: 700 15px/1.2 var(--round); color: var(--soft); padding: 0 4px; }
.pz-play > *, .pz-side > * { min-width: 0; }
.pz-stage { display: flex; justify-content: center; align-items: flex-start; min-width: 0; }
.pz-board { position: relative; width: var(--pz-size, 480px); max-width: 100%; }

@media (max-width: 899px) {
  .pz-play { grid-template-columns: 1fr; gap: 12px; }
  .pz-side { position: static; display: contents; }
  .pz-info { order: 1; padding: 10px 14px; }
  .pz-info-h { display: none; }
  .pz-help { margin: 0; font-size: 16px; }
  .pz-stage { order: 2; }
  .pz-tools { order: 3; position: sticky; bottom: 0; z-index: 4; padding: 10px 0 max(10px, env(safe-area-inset-bottom));
    background: linear-gradient(transparent, #fbf8f2 28%); }
  .pz-meta { order: 4; }
  .pz-tool { flex-direction: row; justify-content: center; gap: 6px; padding: 8px 4px; min-height: 54px; }
  .pz-tool svg { width: 28px; height: 28px; }
}

/* ---------- celebración ---------- */
.pz-ov { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(31, 34, 64, .45); overflow-y: auto; animation: pz-fade .25s ease-out; }
.pz-cel { width: 100%; max-width: 520px; margin: auto; text-align: center; padding: 18px 22px 22px; position: relative;
  animation: pz-pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.pz-cel-pic { display: flex; justify-content: center; margin: -2px auto 6px; }
.pz-cel-pic > * { max-width: 220px; max-height: 220px; width: auto; height: auto; border: 3px solid var(--ink); border-radius: 12px; background: #fff;
  box-shadow: 4px 4px 0 var(--ink); }
.pz-cel-chars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; height: 118px; }
.pz-cel-chars svg { height: 100%; width: auto; }
.pz-cel-dudi { height: 112px; animation: pz-jump .9s ease-in-out infinite; }
.pz-cel-ava { height: 118px; }
.pz-cel-pal { height: 66px; animation: pz-jump .9s ease-in-out .2s infinite; }
.pz-cel h2 { font: 800 38px/1.05 var(--pixel); margin: 8px 0 2px; letter-spacing: -.8px; }
.pz-cel-sub { margin: 0; color: var(--soft); font-weight: 700; }
.pz-cel-stars { display: flex; justify-content: center; gap: 8px; margin: 10px 0 4px; }
.pz-cel-stars .st { width: 64px; height: 64px; animation: pz-star .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.pz-cel-stars .st:nth-child(2) { transform: translateY(-10px); width: 76px; height: 76px; }
.pz-cel-stars svg { width: 100%; height: 100%; }
.pz-cel-why { margin: 2px 0 6px; color: var(--soft); font-size: 16px; font-weight: 600; }
.pz-cel-prize { display: flex; justify-content: center; gap: 12px; margin: 8px 0; }
.pz-cel-prize span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border: 3px solid var(--ink); border-radius: 99px;
  background: var(--yellow-l); font: 800 22px/1.2 var(--pixel); }
.pz-cel-prize svg { width: 26px; height: 26px; }
.pz-cel-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.pz-cel-btns .k-btn { flex: 1 1 140px; }
.pz-cel-btns .k-btn.ghost { background: #fff; }
.pz-cont { display: inline-flex; align-items: center; gap: 10px; margin: 14px 0 0; padding: 6px 16px 6px 8px; border: 3px solid var(--ink);
  border-radius: 99px; background: #fff; box-shadow: 3px 3px 0 var(--ink); color: var(--ink); text-decoration: none; font: 800 17px/1.2 var(--round); }
.pz-cont svg { width: 34px; height: 34px; }
.pz-cont:hover { background: var(--yellow-l); color: var(--ink); }
.pz-cont:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.pz-confeti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.pz-confeti i { position: absolute; top: -20px; width: 10px; height: 14px; border: 2px solid #1f2240; animation: pz-fall 2.6s linear forwards; }
.pz-confeti i:nth-child(3n) { width: 14px; height: 10px; animation-duration: 3.1s; }
.pz-confeti i:nth-child(4n) { animation-duration: 2.2s; }

@keyframes pz-bob { 50% { transform: translateY(-6px); } }
@keyframes pz-jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16px); } 60% { transform: translateY(-14px); } }
@keyframes pz-pulse { 50% { box-shadow: 4px 4px 0 var(--ink), 0 0 0 6px rgba(255, 207, 74, .45); } }
@keyframes pz-wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-2deg); } 90% { transform: rotate(2deg); } 95% { transform: rotate(-1deg); } }
@keyframes pz-fade { from { opacity: 0; } }
@keyframes pz-pop { from { transform: scale(.7); opacity: 0; } }
@keyframes pz-star { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
@keyframes pz-fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes pz-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@keyframes pz-glow { 50% { box-shadow: 0 0 0 5px rgba(139, 92, 246, .55); } }
.pz-shake { animation: pz-shake .35s; }
.pz-hint { animation: pz-glow .7s ease-in-out 3; }

@media (max-width: 760px) {
  .pz-hero { grid-template-columns: 1fr; padding: 16px 16px 18px; text-align: center; }
  .pz-hero-art { height: 132px; width: 270px; margin: 0 auto; }
  .pz-hero-dudi { width: 110px; left: 20px; }
  .pz-hero-pz { width: 100px; right: 20px; }
  .pz-hero h2 { font-size: 34px; }
  .pz-hero p { font-size: 16px; margin: 0 auto 14px; }
  .pz-bands { justify-content: center; }
  .pz-bands.big .pz-band { flex: 1 1 90px; padding: 8px 10px; align-items: center; text-align: center; }
  .pz-bands.big .pz-band b { font-size: 19px; }
  .pz-h2 { font-size: 24px; margin-top: 24px; }
  .pz-types { grid-template-columns: 1fr 1fr; gap: 12px; }
  .pz-type-art { height: 112px; }
  .pz-type-art svg { width: 88px; height: 88px; }
  .pz-type-body { padding: 10px 12px 12px; }
  .pz-type-body > b { font-size: 18px; }
  .pz-type-body > span { font-size: 14px; }
  .pz-lhead { grid-template-columns: 84px 1fr; padding: 14px; gap: 6px 14px; }
  .pz-lhead-txt { display: contents; }
  .pz-lhead-art { grid-row: span 2; align-self: start; }
  .pz-lhead h2, .pz-lhead p { grid-column: 2; }
  .pz-lhead p { margin-bottom: 4px; }
  .pz-bands, .pz-bands.big { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pz-bands .pz-band { align-items: center; text-align: center; padding: 6px 4px 7px; }
  .pz-lhead-art { width: 84px; height: 84px; } .pz-lhead-art svg { width: 64px; height: 64px; }
  .pz-lhead h2 { font-size: 25px; }
  .pz-lhead p { font-size: 15px; margin-bottom: 10px; }
  .pz-lhead .pz-bands { grid-column: 1 / -1; margin-top: 4px; }
  .pz-lhead-sum { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px 12px; }
  .pz-lhead-sum b { font-size: 26px; }
  .pz-band { padding: 5px 10px 6px; min-height: 48px; }
  .pz-band b { font-size: 17px; } .pz-band span { font-size: 12px; }
  .pz-levels { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .pz-lv b { font-size: 32px; } .pz-lv-st svg { width: 22px; height: 22px; }
  .pz-cel h2 { font-size: 30px; }
  .pz-cel-chars { height: 92px; } .pz-cel-dudi { height: 88px; } .pz-cel-ava { height: 92px; } .pz-cel-pal { height: 52px; }
  .pz-cel-stars .st { width: 52px; height: 52px; } .pz-cel-stars .st:nth-child(2) { width: 62px; height: 62px; }
}
@media (max-width: 400px) { .pz-types { grid-template-columns: 1fr; } .pz-type { flex-direction: row; } .pz-type-art { width: 110px; height: auto; border-bottom: 0; border-right: 3px solid var(--ink); flex: none; } }
@media (prefers-reduced-motion: reduce) {
  .pz-hero-dudi, .pz-type:hover .pz-type-art svg, .pz-lv.next, .pz-bands.pick .pz-band, .pz-cel-dudi, .pz-cel-pal, .pz-cel, .pz-ov,
  .pz-cel-stars .st, .pz-shake, .pz-hint { animation: none !important; }
  .pz-hint { box-shadow: 0 0 0 5px rgba(139, 92, 246, .55); }
}
@media (max-width: 420px) { .pz-tools { gap: 8px; } .pz-tool { font-size: 15px; gap: 4px; padding: 6px 2px; } .pz-tool svg { width: 24px; height: 24px; } }
