/* «Abre la sorpresa»: un mundo de juguetería para niños muy pequeños. Un solo aspecto (claro y de colores), a propósito.
   Disposición: horizontal → Kimberly a la izquierda y la escena a la derecha; vertical → escena arriba, Kimberly abajo. */
@font-face { font-family: 'Fredoka'; src: url('fuentes/Fredoka.ttf') format('truetype'); font-weight: 300 700; font-display: swap; }
:root {
  --cielo: #7ecbff; --rosa: #ff5fa2; --amarillo: #ffd23f; --morado: #8b5cf6; --menta: #2ed3b7; --naranja: #ff8a3d;
  --tinta: #3b2a5c; --papel: #fffdf6; --blanco: #ffffff;
  --letra: 'Fredoka', 'Baloo 2', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --kim: clamp(120px, 30vmin, 260px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--cielo); color: var(--tinta); font-family: var(--letra); touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 4px solid var(--morado); outline-offset: 3px; }
img { -webkit-user-drag: none; user-select: none; }

#fondo { position: fixed; inset: 0; background: var(--cielo) center / cover no-repeat; transition: filter .6s, transform .8s; }
#fondo.oscuro { filter: saturate(.8) brightness(.75) blur(3px); transform: scale(1.06); }

/* ---------- barra */
#barra { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; gap: 10px; align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); pointer-events: none; }
#barra > * { pointer-events: auto; }
.espacio { flex: 1; }
.redondo, .pildora { height: 48px; min-width: 48px; border-radius: 999px; background: var(--blanco); color: var(--tinta);
  font-size: 24px; font-weight: 700; box-shadow: 0 4px 0 rgba(59, 42, 92, .25); }
.pildora { padding: 0 16px; font-size: 18px; }
.redondo.apagado { opacity: .5; text-decoration: line-through; }
.salir-sitio { display: inline-flex; align-items: center; height: 48px; padding: 0 18px; border-radius: 999px; background: var(--blanco);
  color: var(--tinta); font-weight: 700; font-size: 18px; text-decoration: none; white-space: nowrap; box-shadow: 0 4px 0 rgba(59, 42, 92, .25); }
.salir-sitio:hover { color: var(--rosa); }
.salir-sitio:focus-visible { outline: 4px solid var(--morado); outline-offset: 3px; }
/* Entorno común de Verbo (/juegos/comun/modo-juego.js): su «✕» va arriba a la derecha, junto a la música; se le deja
   lugar. En el teléfono reemplaza a «← More games» (no caben los dos y es la misma salida). */
body:has(> .mj-salir) #barra { padding-right: 156px; }
.mj-movil body:has(> .mj-salir) #barra { padding-right: max(54px, calc(env(safe-area-inset-right, 0px) + 48px)); }
.mj-movil body:has(> .mj-salir) .salir-sitio { display: none; }

/* ---------- escena */
#escena { position: fixed; inset: 0; z-index: 1; display: grid; place-items: center;
  padding: calc(64px + env(safe-area-inset-top, 0px)) 16px calc(var(--kim) + 24px) 16px; }
.pantalla { width: 100%; height: 100%; display: grid; place-items: center; position: relative; }
@media (orientation: landscape) {
  #escena { padding: calc(60px + env(safe-area-inset-top, 0px)) calc(clamp(72px, 15vmin, 110px) + 30px + env(safe-area-inset-right, 0px)) 16px calc(var(--kim) + 36px); }
}

#titulo, #arranque h1 { margin: 0; font-size: clamp(34px, 8vmin, 72px); font-weight: 700; color: var(--blanco); text-align: center;
  text-wrap: balance; letter-spacing: .01em;
  text-shadow: 0 4px 0 var(--rosa), 0 8px 0 var(--morado), 0 12px 18px rgba(59, 42, 92, .35); }
#menu { grid-template-rows: auto 1fr; gap: 2vmin; }
#envases { display: flex; gap: clamp(10px, 4vmin, 48px); align-items: center; justify-content: center; flex-wrap: wrap; width: 100%; }
.envase { width: clamp(110px, 28vmin, 260px); aspect-ratio: 1; border-radius: 28px; position: relative;
  animation: flotar 2.6s ease-in-out infinite; }
.envase:nth-child(2) { animation-delay: -.9s; } .envase:nth-child(3) { animation-delay: -1.7s; }
.envase img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 12px 10px rgba(59, 42, 92, .3)); transition: transform .2s; }
.envase:hover img, .envase:focus-visible img { transform: scale(1.08) rotate(-3deg); }
.envase::after { content: ''; position: absolute; left: 18%; right: 18%; bottom: -6%; height: 10%; border-radius: 50%;
  background: rgba(59, 42, 92, .18); filter: blur(4px); z-index: -1; animation: sombra 2.6s ease-in-out infinite; animation-delay: inherit; }
@keyframes flotar { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-14px) rotate(2deg); } }
@keyframes sombra { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.8); opacity: .6; } }

/* ---------- abrir */
#cerrado { width: min(78vmin, 520px); aspect-ratio: 1; display: grid; place-items: center; position: relative; }
#cerrado img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 16px rgba(59, 42, 92, .35)); }
#cerrado::before { content: ''; position: absolute; inset: 10%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0)); opacity: var(--brillo, 0); transition: opacity .3s; }
/* La vista desde arriba llena todo el espacio entre Kimberly y «Mis tesoros» (hasta 1,65 veces más ancha que alta;
   la imagen cuadrada se recorta arriba y abajo, como si la cámara estuviera más cerca). */
#abrir { container-type: size; }
#cenital { width: min(100cqw, 165cqh); height: min(100cqh, 100cqw); position: relative; border-radius: 26px; overflow: visible; }
#cenital-fondo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 26px;
  box-shadow: 0 20px 40px rgba(59, 42, 92, .35), 0 0 0 6px rgba(255, 255, 255, .7); }
#sorpresas { position: absolute; inset: 0; container-type: size; }
.sorpresa { position: absolute; transform-origin: 50% 50%; translate: -50% -50%; aspect-ratio: 1; padding: 0; filter: drop-shadow(0 8px 6px rgba(59, 42, 92, .35)); }
.sorpresa img, .sorpresa svg { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.sorpresa:active { filter: drop-shadow(0 4px 4px rgba(59, 42, 92, .35)) brightness(1.1); }
.sorpresa.pista { animation: pista 1.2s ease-in-out infinite; }
@keyframes pista { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }

.boton-grande { position: relative; padding: 18px 34px; border-radius: 999px; background: var(--rosa); color: var(--blanco);
  font-size: clamp(22px, 4.6vmin, 34px); font-weight: 700; box-shadow: 0 7px 0 #c93a7c, 0 14px 22px rgba(59, 42, 92, .3);
  animation: latido 1.4s ease-in-out infinite; }
.boton-grande:active { transform: translateY(5px); box-shadow: 0 2px 0 #c93a7c; }
@keyframes latido { 0%, 100% { scale: 1; } 50% { scale: 1.06; } }
#b-otra { position: absolute; bottom: 2%; left: 50%; translate: -50% 0; z-index: 5; }

/* ---------- Kimberly */
#kim { position: fixed; z-index: 28; left: max(12px, env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: flex-end; gap: 8px; pointer-events: none; max-width: calc(100vw - 24px); }
.kim-marco { width: var(--kim); aspect-ratio: 1; flex: none; border-radius: 28px; overflow: hidden; position: relative;
  background: radial-gradient(circle at 50% 35%, #fff6c9, var(--amarillo)); border: 6px solid var(--blanco);
  box-shadow: 0 6px 0 rgba(59, 42, 92, .2), 0 12px 24px rgba(59, 42, 92, .25); }
.kim-marco img { position: absolute; left: 0; bottom: -4%; width: 100%; height: 108%; object-fit: cover; object-position: 50% 10%;
  transition: opacity .15s; }
.kim-nombre { position: absolute; left: 50%; bottom: 6px; translate: -50% 0; padding: 2px 12px; border-radius: 999px;
  background: var(--rosa); color: var(--blanco); font-weight: 700; font-size: clamp(13px, 2.4vmin, 18px); letter-spacing: .02em;
  box-shadow: 0 3px 0 #c93a7c; white-space: nowrap; }
.kim-marco.hablando { animation: hablar .5s ease-in-out infinite; }
@keyframes hablar { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1.5deg) scale(1.02); } 75% { transform: rotate(1.5deg) scale(1.02); } }
.kim-globo { position: relative; background: var(--blanco); border-radius: 22px; padding: 10px 16px; margin-bottom: calc(var(--kim) * .45);
  max-width: min(46vw, 340px); min-width: 0; box-shadow: 0 6px 0 rgba(59, 42, 92, .15); transform-origin: 0 100%;
  transition: opacity .25s, transform .25s; }
.kim-globo::before { content: ''; position: absolute; left: -12px; bottom: 16px; border: 10px solid transparent; border-right: 14px solid var(--blanco); border-left: 0; }
.kim-globo.vacio { opacity: 0; transform: scale(.6); }
.kim-globo p { margin: 0; overflow-wrap: anywhere; }
#kim-en { font-size: clamp(17px, 3.4vmin, 26px); font-weight: 700; color: var(--morado); line-height: 1.15; }
#kim-es { font-size: clamp(13px, 2.4vmin, 18px); color: var(--tinta); opacity: .75; margin-top: 2px; }
#kim-es:empty { display: none; }
@media (orientation: landscape) {
  #kim { flex-direction: column; align-items: flex-start; }
  .kim-globo { margin: 0 0 0 4px; order: -1; max-width: calc(var(--kim) + 40px); }
  .kim-globo::before { left: 30px; bottom: -14px; border: 10px solid transparent; border-top: 14px solid var(--blanco); border-bottom: 0; }
}

/* ---------- repisa */
#b-repisa { position: fixed; z-index: 16; right: max(14px, env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: clamp(72px, 15vmin, 110px); aspect-ratio: 1; border-radius: 26px; background: var(--amarillo); border: 5px solid var(--blanco);
  box-shadow: 0 6px 0 rgba(59, 42, 92, .25); display: grid; place-items: center; }
#b-repisa .cofre { width: 82%; height: 82%; object-fit: contain; }
#b-repisa b { position: absolute; top: -10px; right: -10px; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 999px; background: var(--rosa);
  color: var(--blanco); font-size: 18px; display: grid; place-items: center; border: 3px solid var(--blanco); font-variant-numeric: tabular-nums; }
#b-repisa.salto { animation: salto .5s; }
@keyframes salto { 30% { transform: scale(1.25) rotate(-6deg); } 60% { transform: scale(.95); } }
#repisa { position: fixed; inset: 0; z-index: 30; overflow: hidden; grid-template-rows: minmax(0, 1fr); background: rgba(59, 42, 92, .45); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.repisa-caja { width: min(100%, 860px); max-height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 14px; align-items: center;
  background: var(--papel); border-radius: 30px; padding: 20px; border: 6px solid var(--amarillo); }
.repisa-caja h2 { margin: 0; font-size: clamp(28px, 6vmin, 44px); color: var(--rosa); }
#repisa-lista { width: 100%; flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; touch-action: pan-y; }
.tesoro { aspect-ratio: 1; border-radius: 20px; background: var(--blanco); border: 3px dashed #e8dcff; display: grid; place-items: center; position: relative; padding: 8px; }
.tesoro img, .tesoro svg { width: 100%; height: 100%; object-fit: contain; }
.tesoro.tiene { border-style: solid; border-color: #c9b5ff; }
.tesoro:not(.tiene) img { filter: brightness(0) opacity(.12); }
.tesoro b { position: absolute; right: 6px; bottom: 4px; font-size: 15px; color: var(--morado); }

/* ---------- la sorpresa en grande */
#zoom { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; }
#zoom-luz { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(255, 246, 201, .95), rgba(126, 203, 255, .75) 45%, rgba(59, 42, 92, .55));
  animation: aparecer .3s ease-out; }
#zoom-luz::before { content: ''; position: absolute; left: 50%; top: 45%; width: 160vmax; height: 160vmax; translate: -50% -50%;
  background: repeating-conic-gradient(rgba(255, 255, 255, .35) 0 10deg, rgba(255, 255, 255, 0) 10deg 20deg);
  animation: girar 18s linear infinite; mask: radial-gradient(closest-side, #000 20%, transparent 70%); -webkit-mask: radial-gradient(closest-side, #000 20%, transparent 70%); }
@keyframes girar { to { rotate: 360deg; } }
@keyframes aparecer { from { opacity: 0; } }
#zoom-cosa { position: fixed; z-index: 2; filter: drop-shadow(0 20px 20px rgba(59, 42, 92, .4)); }
#zoom-cosa img, #zoom-cosa svg { width: 100%; height: 100%; object-fit: contain; display: block; }
#zoom-texto { position: fixed; z-index: 3; left: 50%; bottom: calc(var(--kim) + 34px); translate: -50% 0; text-align: center;
  display: flex; flex-direction: column; gap: 4px; align-items: center; max-width: calc(100vw - 32px); animation: aparecer .4s .25s both; }
@media (orientation: landscape) { #zoom-texto { bottom: 18px; left: calc(50% + var(--kim) / 2); max-width: calc(100vw - var(--kim) - 80px); } }
#zoom-nombre { font-size: clamp(28px, 6.5vmin, 52px); color: var(--blanco); text-shadow: 0 3px 0 var(--rosa), 0 6px 12px rgba(59, 42, 92, .4); }
#zoom-nota { font-size: clamp(15px, 2.8vmin, 20px); background: var(--blanco); color: var(--tinta); padding: 6px 14px; border-radius: 999px; }
#zoom-nota:empty { display: none; }

/* papelito abierto */
.papel-grande { width: 100%; height: 100%; background: var(--papel); border-radius: 18px; padding: 9% 8% 7%; display: flex; flex-direction: column;
  justify-content: center; gap: 4%; text-align: center; position: relative; color: var(--tinta);
  background-image: repeating-linear-gradient(transparent 0 calc(12% - 2px), #cfe8ff calc(12% - 2px) 12%);
  box-shadow: inset 0 0 0 6px #fff, inset 0 0 0 9px var(--c, var(--rosa)); }
.papel-grande::before { content: ''; position: absolute; top: -4%; left: 50%; width: 34%; height: 9%; translate: -50% 0; rotate: -3deg;
  background: color-mix(in srgb, var(--c, var(--rosa)) 70%, white); opacity: .85; border-radius: 3px; }
.papel-grande q { quotes: none; font-size: var(--tam, 30px); font-weight: 600; line-height: 1.2; text-wrap: balance; }
.papel-grande cite { font-style: normal; font-weight: 700; color: var(--c, var(--rosa)); font-size: calc(var(--tam, 30px) * .62); }

/* ---------- efectos */
#destello { position: fixed; inset: 0; z-index: 24; background: #fff; opacity: 0; pointer-events: none; }
#confeti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 26; pointer-events: none; }
.chispa { position: fixed; z-index: 27; width: 14px; height: 14px; pointer-events: none; border-radius: 3px; }

/* ---------- arranque */
#arranque { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vmin;
  background: radial-gradient(circle at 50% 40%, #fff6c9, var(--cielo) 60%); padding: 16px; }
#arranque-kim { width: clamp(150px, 34vmin, 300px); aspect-ratio: 1; object-fit: cover; object-position: 50% 15%; border-radius: 50%;
  border: 8px solid var(--blanco); background: var(--amarillo); box-shadow: 0 10px 0 rgba(59, 42, 92, .2); }
#arranque.fuera { opacity: 0; transition: opacity .4s; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .envase, .envase::after, .boton-grande, .sorpresa.pista, #zoom-luz::before, .kim-nombre { position: absolute; left: 50%; bottom: 6px; translate: -50% 0; padding: 2px 12px; border-radius: 999px;
  background: var(--rosa); color: var(--blanco); font-weight: 700; font-size: clamp(13px, 2.4vmin, 18px); letter-spacing: .02em;
  box-shadow: 0 3px 0 #c93a7c; white-space: nowrap; }
.kim-marco.hablando { animation: none; }
}
