/* Encargo 6: «más premium, que atrape». Tres cosas, cada una con su interruptor en js/config.js:
   cerca (html.cerca): en celular el barrio se ve de cerca y a pantalla completa, con la cámara siguiendo al personaje.
   arte 'premium' (html.premium): luz, sombras y detalle en el mapa.
   juegos: los minijuegos. */

/* ---------- El mundo que mueve la cámara (sirve también con cerca apagado) ---------- */
.mapa { overflow: hidden; }
.mapa .mundo { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; will-change: transform; }
.mapa .mundo svg { overflow: visible; }
.b-hud, .k-vermapa { display: none; }
button.b-pista.objetivo { width: 100%; text-align: left; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.b-pista.objetivo .k-ir { flex: none; margin-left: auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #1B2559; box-shadow: 0 3px 0 rgba(27, 37, 89, .35); }
button.b-pista.objetivo .k-ir .icono { width: 20px; height: 20px; --a: #FFE066; animation: none; filter: none; transform: rotate(-90deg); }
button.b-pista.objetivo:active { transform: translateY(3px); }

/* ---------- De cerca: el mapa llena la pantalla; la cabecera flota arriba y el panel sube desde abajo ---------- */
@media (max-width: 899px) {
  html.cerca body:has(#app[data-pantalla=barrio]) { overflow: hidden; overscroll-behavior: none; }
  html.cerca #app[data-pantalla=barrio] { position: relative; height: 100svh; min-height: 0; overflow: hidden; }
  html.cerca #app[data-pantalla=barrio] .escenario { position: absolute; inset: 0; height: auto; min-height: 0; }
  html.cerca #app[data-pantalla=barrio] .mapa { inset: 0; }

  /* la barra de arriba, más chica */
  html.cerca #app[data-pantalla=barrio] .barra { padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); pointer-events: none; }
  html.cerca #app[data-pantalla=barrio] .barra > * { pointer-events: auto; }
  html.cerca #app[data-pantalla=barrio] .barra .pildora { padding: 4px 10px; font-size: 12px; min-height: 0; }
  html.cerca #app[data-pantalla=barrio] .barra .marca { transform: scale(.8); transform-origin: 0 50%; }
  html.cerca #app[data-pantalla=barrio] #marca-texto { display: none; }

  /* cabecera flotante */
  html.cerca #app[data-pantalla=barrio] .b-hud { display: block; position: absolute; z-index: 5; left: 8px; right: 8px; top: calc(40px + env(safe-area-inset-top)); pointer-events: none; }
  .b-hud .b-cabeza { margin: 0; gap: 5px; }
  .b-hud .b-cabeza > * { pointer-events: auto; }
  .b-hud .v-nivel { gap: 8px; padding: 5px 12px 6px 6px; border-radius: 18px; box-shadow: 0 4px 0 #392EB5, 0 10px 18px rgba(20, 30, 100, .28); }
  .b-hud .v-nivel-num { width: 36px; height: 36px; font-size: 22px; }
  .b-hud .v-nivel-num .icono { width: 22px; height: 22px; }
  .b-hud .v-nivel-txt { gap: 2px; }
  .b-hud .v-nivel-txt b { font-size: 15px; }
  .b-hud .v-nivel-txt small { font-size: 12.5px; }
  .b-hud .v-puntos i { height: 6px; }
  .b-hud .b-fila { flex-wrap: nowrap; gap: 5px; }
  html.casual .b-hud .b-chip { padding: 4px 9px; font-size: 12.5px; }
  html.casual .b-hud .b-chip:not(.reloj):not(.g-puntos):not(.g-racha):not(.libreta) { background: rgba(20, 28, 80, .74); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 3px 0 rgba(20, 28, 80, .3); }
  html.casual .b-hud .b-chip .calc { font-size: 14px; }
  html.casual .b-hud .b-chip.reloj { font-size: 14.5px; }
  html.casual .b-hud .b-chip.reloj .icono, .b-hud .g-racha .icono, .b-hud .g-puntos .icono { width: 16px; height: 16px; }
  html.casual .b-hud .b-chip.g-puntos .calc, html.casual .b-hud .b-chip.g-racha { font-size: 15px; }
  html.casual .b-hud .b-chip.libreta { padding: 4px 9px; }
  html.casual .b-hud .b-barras { grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 6px 9px; border-radius: 14px; background: rgba(255, 255, 255, .93); box-shadow: 0 3px 0 rgba(27, 37, 89, .2), 0 8px 14px rgba(20, 30, 100, .18); }
  .b-hud .b-barra { display: flex; align-items: center; gap: 5px; }
  html.casual .b-hud .b-barra-nombre { font-size: 0; gap: 0; }
  html.casual .b-hud .b-barra-nombre .icono { display: block; width: 16px; height: 16px; }
  html.casual .b-hud .b-riel { flex: 1; margin-top: 0; height: 9px; }

  /* botones sobre el mapa, a la derecha, bajo la cabecera */
  html.cerca #app[data-pantalla=barrio] .g-sonido, html.cerca #app[data-pantalla=barrio] .k-vermapa { left: auto; right: 10px; top: calc(var(--hud-b, 190px) + 8px); width: 40px; height: 40px; background: rgba(20, 28, 80, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 3px 0 rgba(20, 28, 80, .35); }
  html.cerca #app[data-pantalla=barrio] .k-vermapa { display: grid; place-items: center; position: absolute; z-index: 3; top: calc(var(--hud-b, 190px) + 56px); border: 0; border-radius: 50%; cursor: pointer; }
  .k-vermapa .icono { position: static; width: 22px; height: 22px; --a: #fff; }
  .k-vermapa[aria-pressed=true] { background: linear-gradient(180deg, #FFE680, #FFC21A) !important; }
  .k-vermapa[aria-pressed=true] .icono { --a: #1B2559; }

  /* el panel: hoja que sube desde abajo */
  html.cerca #app[data-pantalla=barrio] .panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; flex: none; margin: 0; max-height: 62svh; overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; box-shadow: 0 -12px 30px rgba(10, 20, 80, .35); }
  /* en la calle no hay hoja: solo tarjetas que flotan sobre el mapa */
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] { background: none; box-shadow: none; pointer-events: none; padding: 0 10px calc(12px + env(safe-area-inset-bottom)); max-height: none; overflow: visible; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] > div > * { pointer-events: auto; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] > div > .aviso { margin-top: 8px; padding: 0 4px; font-size: 13px; text-align: center; color: #fff; text-shadow: 0 1px 0 rgba(20, 28, 80, .9), 0 0 8px rgba(20, 28, 80, .8); pointer-events: none; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .b-pista, html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .g-retos, html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .boton { box-shadow: 0 5px 0 rgba(27, 37, 89, .28), 0 12px 22px rgba(10, 20, 80, .32); }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .b-pista.objetivo { box-shadow: 0 6px 0 var(--amarillo-o), 0 12px 22px rgba(10, 20, 80, .32); padding: 9px 9px 9px 13px; font-size: 18px; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .b-pista.objetivo.noche { box-shadow: 0 6px 0 #121A45, 0 12px 22px rgba(10, 20, 80, .32); }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .g-retos { margin-top: 8px; padding: 8px 11px 9px; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .g-retos > b { font-size: 15px; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .g-listo { grid-column: 1 / -1; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .g-reto { padding: 3px 9px 3px 4px; font-size: 13px; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .b-pista.aviso-b { font-size: 14px; padding: 9px 12px; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .boton { margin-top: 8px; }
}

/* ---------- Arte premium ---------- */
/* Los banderines quedan quietos: con el mapa de cerca, moverlos todos hacía repintar media pantalla en cada cuadro. */
html.premium .c-bandera { animation: none; }
/* Un borde oscuro muy suave alrededor de la pantalla, para que el centro resalte. */
html.premium .mapa::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; box-shadow: inset 0 0 70px rgba(10, 18, 80, .28); }
/* En pantallas táctiles el «pasar el ratón» se queda pegado después de tocar: ahí el lugar no se resalta. */
@media (hover: none) { html.casual .mapa .lugar:hover:not(.aqui) .toca { fill: transparent; stroke: transparent; } }

/* ============ Minijuegos (js/config.js → juegos) ============ */
/* El vecino curioso en el mapa */
.k-vecino-cuerpo { animation: k-saluda 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes k-saluda { 50% { transform: rotate(-4deg) translateY(-2px); } }
.k-globo { animation: botar .9s ease-in-out infinite; }
.k-vecino-chip { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 7px 12px 7px 7px; border: 0; border-radius: 18px; background: linear-gradient(180deg, #8274FF, #5647E8); color: #fff; font: inherit; font-weight: 600; font-size: 15px; line-height: 1.2; text-align: left; box-shadow: 0 5px 0 #392EB5, 0 12px 22px rgba(10, 20, 80, .3); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.k-vecino-chip i { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #5647E8; font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif; font-style: normal; font-size: 22px; box-shadow: 0 3px 0 rgba(27, 37, 89, .25); }
.k-vecino-chip.aqui { background: linear-gradient(180deg, #FFE680, #FFC21A); color: #1B2559; box-shadow: 0 5px 0 #E59B00, 0 12px 22px rgba(10, 20, 80, .3); font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif; font-weight: 400; font-size: 19px; }
.k-vecino-chip:active { transform: translateY(3px); }
.k-vecino-chip:focus-visible { outline: 4px solid #FFE066; outline-offset: 3px; }

/* «¿Verdad o cuento?» */
.k-quiz { overflow: hidden; border-radius: 28px; background: #fff; color: #22315A; box-shadow: 0 8px 0 rgba(27, 37, 89, .22), 0 16px 22px rgba(20, 40, 120, .22); }
.k-quiz-cabeza { padding: 12px 16px 13px; background: linear-gradient(180deg, #8274FF, #5647E8); color: #fff; }
html.casual .k-quiz-cabeza .sobre, .k-quiz-cabeza .sobre { margin: 0; color: #FFE680; }
.k-quiz-cabeza h2 { font-size: clamp(25px, 6.6vw, 32px); text-shadow: 0 3px 0 rgba(27, 37, 89, .35); }
.k-quiz-cuerpo { display: grid; gap: 10px; padding: 13px 15px 17px; }
html.casual .k-quiz-cuerpo > .sobre, .k-quiz-cuerpo > .sobre { margin: 0; color: #5647E8; }
.k-dicho { font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif; font-size: 22px; line-height: 1.18; color: #1B2559; }
.k-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.k-botones .boton { margin: 0; font-size: 24px; padding: 13px 10px 15px; }
html.casual .boton.k-cuento { background: linear-gradient(180deg, #FF8FB0, #FF4F86); box-shadow: 0 6px 0 #C92A63, 0 12px 18px rgba(201, 42, 99, .25); }
.k-resultado { display: grid; gap: 8px; padding: 12px 13px 13px; border-radius: 18px; background: #E2FBE8; font-size: 15.5px; animation: brotar .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.k-quiz.mal .k-resultado { background: #FFF1DA; }
.k-veredicto { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; }
.k-veredicto b { font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif; font-weight: 400; font-size: 21px; color: #0F7D35; }
.k-quiz.mal .k-veredicto b { color: #B25B00; }
.k-pts { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 3px 8px; border-radius: 999px; background: linear-gradient(180deg, #FFE680, #FFC21A); color: #1B2559; box-shadow: 0 3px 0 #E59B00; }
.k-pts .icono { width: 15px; height: 15px; --a: #fff; }
.k-pts .calc { font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif; font-size: 17px; color: #1B2559; }
html.casual .k-quiz .fuente-b, .k-quiz .fuente-b { justify-self: start; padding: 3px 10px; border: 0; border-radius: 999px; background: #1B2559; color: #fff; font-family: inherit; font-size: 12.5px; font-weight: 600; white-space: normal; text-align: left; }
html.casual .k-quiz .fuente-b i { background: #FFE066; color: #1B2559; opacity: 1; }
.k-quiz .boton { margin-top: 2px; }

/* El juego del turno */
.mj { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); background: rgba(14, 21, 80, .58); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: mj-entra .22s ease both; }
@keyframes mj-entra { from { opacity: 0; } }
@media (min-width: 900px) { .mj { place-items: center; } }
.mj-caja { width: min(100%, 440px); display: grid; gap: 9px; padding: 16px 16px 13px; border-radius: 28px; background: linear-gradient(180deg, #FFFFFF, #EEF4FF); color: #1B2559; box-shadow: 0 8px 0 rgba(27, 37, 89, .3), 0 22px 40px rgba(10, 20, 80, .45); text-align: center; animation: brotar .4s cubic-bezier(.2, 1.4, .4, 1) both; }
html.casual .mj-caja .sobre, .mj-caja .sobre { margin: 0; color: #5647E8; }
.mj-caja h2 { font-size: clamp(26px, 7vw, 34px); color: #1B2559; }
.mj-pista { position: relative; height: 48px; margin: 8px 8px 4px; border-radius: 24px; background: #DCE6F7; box-shadow: inset 0 3px 0 rgba(27, 37, 89, .12); }
.mj-zona { position: absolute; left: 50%; top: 0; bottom: 0; transform: translateX(-50%); border-radius: 8px; background: linear-gradient(180deg, #7BEA8F, #2FC25B); box-shadow: 0 0 0 3px #fff; transition: width .25s ease; }
.mj-zona::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 35%; transform: translateX(-50%); background: rgba(255, 255, 255, .42); }
.mj-marca { position: absolute; top: -6px; bottom: -6px; left: 0; width: 12px; margin-left: -6px; border-radius: 6px; background: #1B2559; box-shadow: 0 0 0 3px #fff, 0 4px 8px rgba(10, 20, 80, .35); will-change: left; }
.mj-msg { min-height: 1.3em; font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif; font-size: 21px; line-height: 1.2; color: #53608A; }
.mj-msg.ok { color: #0F9D45; }
.mj-msg.no { color: #E0304F; }
.mj-msg .calc { font-family: inherit; color: inherit; }
.mj-luces { display: flex; justify-content: center; gap: 9px; }
.mj-luces i { width: 17px; height: 17px; border-radius: 50%; background: #DCE6F7; box-shadow: inset 0 2px 0 rgba(27, 37, 89, .12); }
.mj-luces i.ok { background: #2FC25B; box-shadow: 0 0 0 3px rgba(47, 194, 91, .25); }
.mj-luces i.no { background: #FF6B85; }
.mj .boton.mj-ya { margin: 2px 0 0; font-size: 30px; padding: 14px 18px 16px; }
html.casual .mj .b-enlace, .mj .b-enlace { margin: 0 auto; padding: 4px 10px; color: #5647E8; }
html.casual .mj .aviso, .mj .aviso { margin: 0; color: #5B6890; font-size: 12.5px; font-weight: 500; }
.mj.golpe .mj-pista { animation: mj-golpe .3s ease; }
@keyframes mj-golpe { 30% { transform: scale(1.05); } }

/* Gente que pasa por la calle: va hasta el otro lado, se da vuelta y regresa. */
.k-pasea { animation: k-pasea 60s linear infinite; }
@keyframes k-pasea { 0% { transform: translateX(24px) scaleX(1); } 49.9% { transform: translateX(592px) scaleX(1); } 50% { transform: translateX(592px) scaleX(-1); } 99.9% { transform: translateX(24px) scaleX(-1); } 100% { transform: translateX(24px) scaleX(1); } }
.k-paso { animation: brincar .42s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }

/* El aviso del vecino: en computadora, la frase completa; de cerca (celular), una pastilla corta que flota sobre las tarjetas. */
.k-vecino-chip > b { display: none; font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif; font-weight: 400; font-size: 17px; white-space: nowrap; }
@media (max-width: 899px) {
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] > div { position: relative; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .k-vecino-chip:not(.aqui) { position: absolute; right: 0; bottom: 100%; width: auto; margin: 0 0 9px; padding: 5px 14px 5px 5px; border-radius: 999px; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .k-vecino-chip:not(.aqui) > span { display: none; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .k-vecino-chip:not(.aqui) > b { display: block; }
  html.cerca #app[data-pantalla=barrio] .panel[data-vista=calle] .k-vecino-chip:not(.aqui) i { width: 30px; height: 30px; font-size: 20px; animation: botar .9s ease-in-out infinite; }
}
