/* El mapa es el escenario; la interfaz conserva espacio para explorar. */
:root {
  --tinta: #253e33;
  --tinta-suave: #687565;
  --bosque: #244b3b;
  --hoja: #6c9670;
  --menta: #d9e7cb;
  --papel: #fcf9ed;
  --borde: #d6dac4;
  --sombra: 0 4px 0 rgba(40, 65, 39, .1), 0 10px 32px rgba(40, 65, 39, .12);
  --fuente-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { color: var(--tinta); background: #bdcda6; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, a, input { touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid #33856d; outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .45; }
button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.solo-lectores { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#mundo, #map { width: 100%; height: 100%; height: 100dvh; }
#map { position: absolute; inset: 0; background: #bdcda6; }
.marco-mundo { position: fixed; inset: 0; border: 8px solid rgba(252, 249, 237, .64); pointer-events: none; z-index: 2; }
.cabecera-mundo { position: fixed; z-index: 10; top: max(22px, env(safe-area-inset-top)); left: 26px; right: 26px; display: flex; align-items: center; justify-content: flex-end; pointer-events: none; }
.cabecera-mundo > * { pointer-events: auto; }
.cabecera-acciones { display: flex; align-items: center; gap: 10px; }
.estado-conexion { display: flex; align-items: center; gap: 7px; padding: 11px 13px; background: var(--papel); border: 1px solid var(--borde); border-radius: 6px; box-shadow: var(--sombra); font-size: 11px; }
.estado-conexion i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #729c6a; box-shadow: 0 0 0 3px rgba(114, 156, 106, .12); flex: none; }
.estado-conexion:has([data-estado="offline"]) i { background: #b38c4e; box-shadow: 0 0 0 3px rgba(179, 140, 78, .12); }
.boton-icono { display: grid; place-items: center; width: 40px; height: 40px; background: var(--papel); border: 1px solid var(--borde); border-radius: 6px; box-shadow: var(--sombra); font: 700 18px var(--fuente-mono); }
.boton-icono:hover { background: #e9eedb; }
.jugadores-toggle { display: none; }
.panel { background: var(--papel); border: 1px solid var(--borde); border-radius: 8px; box-shadow: var(--sombra); }
.etiqueta { display: block; color: var(--tinta-suave); font: 700 9px/1.5 var(--fuente-mono); letter-spacing: 1.15px; }
.ficha-explorador { position: fixed; z-index: 6; top: max(22px, env(safe-area-inset-top)); left: 26px; width: max-content; min-width: 0; padding: 6px 10px; border-radius: 6px; text-align: center; }
.ficha-explorador strong { display: block; font: 700 16px/1 var(--fuente-mono); font-variant-numeric: tabular-nums; }
.panel-jugadores { position: fixed; z-index: 7; top: 110px; right: 26px; width: 254px; overflow: hidden; }
.panel-encabezado { padding: 17px 17px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e0e3d0; }
.panel-encabezado h2 { margin-top: 5px; font-size: 16px; }
.contador { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; margin-left: 5px; padding: 0 5px; background: #e7ecd9; border-radius: 4px; color: #537151; font: 700 10px var(--fuente-mono); vertical-align: 2px; }
.boton-cerrar { display: grid; place-items: center; height: 32px; width: 32px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #78836d; font-size: 23px; flex: none; }
.boton-cerrar:hover { background: #e9eddb; color: var(--tinta); }
#cerrarJugadoresBtn { display: none; }
#jugadores-lista { max-height: min(38vh, 320px); overflow-y: auto; padding: 4px 10px; scrollbar-width: thin; scrollbar-color: #bdc9aa transparent; }
.lista-vacia, .jugadores-vacio { text-align: center; font-size: 12px; line-height: 1.8; padding: 24px 3px; color: #5d6d57; }
.lista-vacia span, .jugadores-vacio span { color: #8b927f; font-size: 11px; }
.jugador-fila, .jugador-item { display: flex; align-items: center; gap: 10px; padding: 11px 7px; width: 100%; border: 0; border-bottom: 1px solid #e6e7d9; text-align: left; background: transparent; border-radius: 5px; }
.jugador-fila:last-child, .jugador-item:last-child { border-bottom: 0; }
.jugador-fila:hover, .jugador-item:hover { background: #eaf0de; }
.jugador-fila svg, .jugador-item svg { width: 29px; height: 36px; flex: none; image-rendering: pixelated; stroke: none; }
.jugador-avatar { width: 31px; height: 37px; display: grid; place-items: center; flex: none; background: #e7edd9; border-radius: 4px; }
.jugador-info { flex: 1; min-width: 0; }
.jugador-info strong { display: block; font-size: 12px; }
.jugador-info small { display: block; color: var(--tinta-suave); font-size: 10px; margin-top: 4px; }
.jugador-chat { color: #64825d; font-size: 12px; }
.jugador-no-leidos { background: #315b43; color: #fffdf1; border-radius: 4px; padding: 2px 5px; font: 10px var(--fuente-mono); }
.panel-conversaciones { position: fixed; z-index: 26; top: max(16px, env(safe-area-inset-top)); right: 16px; width: 270px; max-width: calc(100vw - 32px); max-height: min(360px, calc(100dvh - 110px)); display: flex; flex-direction: column; overflow: hidden; }
.conversaciones-cabecera { display: flex; align-items: center; justify-content: space-between; padding: 8px 9px 8px 14px; border-bottom: 1px solid #dce2cc; }
.conversaciones-cabecera h2 { font-size: 13px; }
#conversaciones-lista { overflow-y: auto; padding: 4px 8px; min-height: 0; scrollbar-width: thin; }
.conversacion-fila { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 54px; padding: 8px 6px; border: 0; border-radius: 4px; background: transparent; text-align: left; }
.conversacion-fila:hover, .conversacion-fila:focus-visible { background: #e9efdc; }
.conversacion-fila strong { font: 700 12px var(--fuente-mono); }
.conversacion-avatar { flex: none; width: 27px; height: 35px; }
.conversacion-avatar svg { width: 27px; height: 35px; stroke: none; }
.conversacion-info { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 5px; }
.conversacion-nueva { font-size: 10px; color: #446b40; white-space: nowrap; }
.conversacion-distancia { flex: none; margin-left: auto; color: var(--tinta-suave); font: 700 11px/1.4 var(--fuente-mono); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.conversacion-nueva::before { content: '●'; font-size: 8px; margin-right: 5px; }
.chat-visible .panel-conversaciones { max-height: 25dvh; }
.panel-pie { padding: 11px 9px; border-top: 1px solid #e0e3d0; text-align: center; font-size: 10px; color: var(--tinta-suave); background: #f3f3e5; }
.panel-pie > span { color: #709168; margin-right: 3px; }
.panel-ayuda { position: fixed; z-index: 35; top: 83px; right: 26px; padding: 24px; width: 335px; }
.panel-ayuda h2 { font-size: 21px; margin: 8px 0 9px; letter-spacing: -.5px; }
.panel-ayuda > p { font-size: 12px; line-height: 1.7; color: var(--tinta-suave); }
.panel-ayuda ul { list-style: none; margin: 20px 0; padding: 0; }
.panel-ayuda li { display: flex; gap: 12px; margin: 15px 0; color: var(--tinta-suave); font-size: 11px; line-height: 1.6; }
.panel-ayuda li strong { display: block; margin-bottom: 3px; font-size: 12px; color: var(--tinta); }
.ayuda-simbolo { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #d7dfc4; background: #edf1df; font-size: 20px; flex: none; color: #5d7a57; }
.panel-ayuda .ayuda-nota { font-size: 10px; border-top: 1px solid #dee2ce; padding-top: 13px; }
.inicio-aventura { position: fixed; z-index: 15; width: min(390px, calc(100vw - 36px)); left: 50%; top: 49%; transform: translate(-50%, -50%); padding: 23px 31px 26px; text-align: center; box-shadow: 0 7px 0 rgba(40, 65, 39, .13), 0 20px 100px rgba(40, 65, 39, .23); }
.inicio-emblema { width: 72px; height: 72px; margin: 0 auto 6px; }
.inicio-emblema svg { width: 100%; height: 100%; }
.inicio-aventura > .etiqueta { font-size: 8px; letter-spacing: 1.5px; }
.inicio-aventura h2 { font-size: 29px; letter-spacing: -1px; line-height: 1.2; margin: 10px -8px 12px; }
.inicio-aventura > p:not(.gps-detalle) { font-size: 12px; line-height: 1.7; color: var(--tinta-suave); }
.inicio-gps { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 24px; font-size: 12px; }
.pulso-gps { width: 7px; height: 7px; background: #7e9d6b; border-radius: 50%; box-shadow: 0 0 0 4px #e5ecd6; }
.gps-detalle { margin: 10px 0 16px; font-size: 11px; line-height: 1.6; color: #7b826f; }
#geoRetryBtn { width: 100%; justify-content: space-between; }
.inicio-nota { display: block; margin-top: 14px; font: 8px var(--fuente-mono); color: #8a927d; }
.error-mapa { position: fixed; left: 50%; top: 88px; transform: translateX(-50%); z-index: 40; max-width: 440px; width: calc(100vw - 32px); padding: 16px 18px; line-height: 1.6; border-color: #d4b487; color: #775529; }
.aviso { position: fixed; z-index: 50; left: 50%; bottom: 143px; transform: translateX(-50%); max-width: min(520px, calc(100vw - 32px)); width: max-content; padding: 13px 20px; border: 1px solid #466c4b; border-radius: 6px; color: #f3f5df; background: #2d4c38; box-shadow: var(--sombra); font-size: 12px; text-align: center; line-height: 1.5; }
.aviso:empty { display: none; }
.herramientas-mapa { position: fixed; right: 27px; bottom: 49px; z-index: 5; display: flex; flex-direction: column; gap: 15px; align-items: center; }
.brujula { width: 40px; text-align: center; opacity: .9; }
.brujula > span { font: 700 10px var(--fuente-mono); display: block; margin-bottom: 3px; }
.brujula svg { display: block; margin: auto; width: 23px; height: 29px; }
.zoom-mapa { display: flex; flex-direction: column; border: 1px solid var(--borde); border-radius: 5px; background: var(--papel); box-shadow: var(--sombra); }
.zoom-mapa button { width: 38px; height: 38px; font: 23px var(--fuente-mono); border: 0; background: transparent; }
.zoom-mapa button + button { border-top: 1px solid var(--borde); }
.zoom-mapa button:hover { background: #eaf0de; }
.controles-movimiento { position: fixed; bottom: 48px; left: 29px; z-index: 8; }
.control-etiqueta { text-align: center; margin-bottom: 10px; color: #4f684c; font-size: 8px; letter-spacing: 2px; }
.cruceta { width: 122px; height: 122px; display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); gap: 1px; filter: drop-shadow(0 3px 0 rgba(40, 65, 39, .17)); }
.direccion { display: grid; place-items: center; padding: 0; border: 1px solid #bcc9ab; background: #f7f7e7; font-size: 12px; color: #6b825e; touch-action: none; user-select: none; -webkit-user-select: none; }
.direccion:hover, .direccion:active, .direccion.activa { background: #dce9c9; color: var(--bosque); }
.norte { grid-column: 2; grid-row: 1; border-radius: 5px 5px 0 0; }
.oeste { grid-column: 1; grid-row: 2; border-radius: 5px 0 0 5px; }
.este { grid-column: 3; grid-row: 2; border-radius: 0 5px 5px 0; }
.sur { grid-column: 2; grid-row: 3; border-radius: 0 0 5px 5px; }
.cruceta-centro { grid-column: 2; grid-row: 2; background: #e8edda; border: 1px solid #d5dfc4; display: grid; place-items: center; color: #b4c5a2; font-size: 13px; }
.barra-aventura { position: fixed; z-index: 9; bottom: 43px; left: 50%; transform: translateX(-50%); }
.pista-movimiento { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 10px; color: #456440; margin-bottom: 13px; white-space: nowrap; text-shadow: 0 1px #e4ebd6; }
.pista-movimiento kbd { font: 9px var(--fuente-mono); border: 1px solid #91ac7b; background: rgba(242, 246, 228, .6); border-radius: 2px; min-width: 16px; padding: 2px 3px; text-align: center; }
.pista-movimiento span { margin-left: 4px; }
.pista-movimiento i { margin: 0 3px 0 9px; }
.acciones-aventura { display: flex; align-items: center; gap: 7px; background: var(--papel); border: 1px solid var(--borde); border-radius: 9px; padding: 8px; box-shadow: var(--sombra); }
.boton { border: 1px solid #d5ddc4; border-radius: 5px; padding: 11px 14px; background: #f4f5e7; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-size: 11px; font-weight: 600; white-space: nowrap; min-height: 42px; }
.boton:hover { background: #e7eed8; border-color: #b9cba8; }
.boton:active { transform: translateY(1px); }
.boton-primario { border-color: var(--bosque); background: var(--bosque); color: #f5f7e8; }
.boton-primario:hover { border-color: #366049; background: #366049; }
#chatBtn { min-width: 82px; }
#chatBtn::before { content: ""; display: inline-block; width: 14px; height: 12px; border: 1.4px solid currentColor; clip-path: polygon(0 0, 100% 0, 100% 80%, 35% 80%, 0 100%); background: linear-gradient(currentColor, currentColor) 3px 3px / 6px 1px no-repeat, linear-gradient(currentColor, currentColor) 3px 6px / 4px 1px no-repeat; }
.separador-barra { width: 1px; height: 23px; background: #dce1cb; margin: 0 1px; }
#consola { display: none; position: fixed; z-index: 25; right: 26px; bottom: 116px; width: 365px; max-width: calc(100vw - 32px); height: min(440px, calc(100dvh - 225px)); }
#consola-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; border-color: #b2c09f; }
.consola-cabecera { display: flex; align-items: center; gap: 10px; padding: 15px 12px 15px 16px; border-bottom: 1px solid #dce2cc; background: #f2f4e5; }
.chat-emblema { width: 32px; height: 34px; background: #e2eace; display: grid; place-items: center; border: 1px solid #c9d8b6; flex: none; }
.chat-emblema svg { width: 19px; height: 19px; stroke: #5d7b51; fill: none; stroke-width: 1.5; stroke-linejoin: round; }
.consola-identidad { flex: 1; min-width: 0; }
.consola-identidad .etiqueta { font-size: 8px; }
#consola-titulo { margin-top: 5px; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#consola-mensajes { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px 8px; scrollbar-width: thin; scrollbar-color: #bdc9aa transparent; }
.msg { font-size: 12px; line-height: 1.6; margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; padding: 9px 11px; border: 1px solid #e0e4cf; border-radius: 5px; }
.msg .hora { display: block; font: 8px var(--fuente-mono); color: #839173; margin-bottom: 5px; }
.msg-yo { background: #e9efdc; margin-left: 22px; border-color: #d9e2c8; }
.msg-otro { background: #f6f1e2; margin-right: 22px; }
.msg-sistema { text-align: center; font-size: 10px; color: #8a907c; border: 0; padding: 5px 0; }
.msg-sistema .hora { display: inline; margin-right: 5px; color: #9b9f8e; }
.msg-pendiente { opacity: .55; }
.msg-fallido { color: #a24e35; background: #f8eade; cursor: pointer; border-color: #e6c6b4; }
#consola-form { display: flex; align-items: stretch; gap: 7px; padding: 12px 12px 0; border-top: 1px solid #e1e5d3; }
#consola-input { min-width: 0; width: 100%; border: 1px solid #d4ddc3; border-radius: 5px; padding: 11px 12px; background: #fffef8; color: var(--tinta); font-size: 12px; }
#consola-input::placeholder { color: #939b86; }
#consola-form button { width: 42px; padding: 10px; flex: none; }
.consola-nota { font-size: 8px; color: #939b86; display: flex; gap: 5px; padding: 8px 13px 12px; }
.consola-nota > span:last-child { margin-left: auto; }
/* Cada OverlayView coloca este origen en las coordenadas geográficas del personaje. */
.personaje-rpg { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 1; }
.personaje-boton { position: absolute; bottom: 0; left: -26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 52px; height: 61px; padding: 0; background: transparent; border: 0; pointer-events: auto; overflow: visible; }
.personaje-boton::before { content: ""; position: absolute; bottom: 0; width: 33px; height: 10px; background: rgba(37, 62, 51, .22); border-radius: 50%; z-index: -1; }
.personaje-sprite { width: 40px; height: 52px; image-rendering: pixelated; filter: drop-shadow(1px 2px 0 rgba(35, 55, 35, .2)); transform-origin: center bottom; }
.personaje-boton svg { width: 40px; height: 52px; stroke: none; }
.personaje-nombre { position: absolute; left: 50%; top: 7px; transform: translateX(-50%); padding: 4px 7px; border: 1px solid rgba(83, 102, 67, .5); border-radius: 3px; background: #fcf9ed; color: #3b5438; font: 700 9px/1.2 var(--fuente-mono); white-space: nowrap; box-shadow: 0 2px 0 rgba(40, 65, 39, .12); pointer-events: none; }
.es-propio .personaje-nombre { background: #2a523e; border-color: #163d2b; color: #f5f8e9; }
.es-propio .personaje-boton::after { content: ""; position: absolute; top: -10px; left: 22px; width: 8px; height: 6px; background: #f7f7e3; border-top: 1px solid #2b553b; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.personaje-boton:hover .personaje-sprite { filter: drop-shadow(0 0 3px #fff9c6) drop-shadow(1px 2px 0 rgba(35, 55, 35, .2)); }
.personaje-burbuja { opacity: .9; position: absolute; bottom: 77px; left: 50%; transform: translateX(-50%); max-width: 210px; width: max-content; padding: 8px 11px; border: 1px solid #91a67b; border-radius: 6px; background: #fffef5; color: #304b34; box-shadow: 0 3px 0 rgba(40, 65, 39, .13); font: 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; }
.personaje-burbuja::after { content: ""; position: absolute; bottom: -5px; left: calc(50% - 4px); width: 8px; height: 8px; border-bottom: 1px solid #91a67b; border-right: 1px solid #91a67b; transform: rotate(45deg); background: #fffef5; }
.personaje-rpg:not(.en-moto):is(.mirando-oeste, .mirando-noroeste, .mirando-suroeste) .personaje-sprite { transform: scaleX(-1); }
.personaje-rpg.caminando .personaje-sprite { animation: caminar .28s steps(2, end) infinite; }
.personaje-rpg:not(.en-moto).caminando:is(.mirando-oeste, .mirando-noroeste, .mirando-suroeste) .personaje-sprite { animation-name: caminar-oeste; }
.personaje-rpg.tiene-mensajes .personaje-nombre { border-color: #be9342; background: #fff1bd; color: #775620; }
.personaje-rpg.tiene-mensajes .personaje-nombre::before { content: "● "; color: #bd8741; }
/* Contadores fijos sobre el mapa, por encima de la atribución y del área segura del móvil. */
.coleccion-caramelos { position: fixed; z-index: 10; left: 50%; bottom: max(34px, calc(env(safe-area-inset-bottom) + 24px)); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; align-items: center; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; color: #20392e; font: 700 16px/1 var(--fuente-mono); text-shadow: 0 1px 2px #fff, 0 -1px 2px #fff, 1px 0 2px #fff, -1px 0 2px #fff; }
.coleccion-color { display: inline-flex; gap: 4px; align-items: center; min-width: 0; }
.coleccion-color svg { flex: none; width: 26px; height: 21px; filter: drop-shadow(0 1px 1px #fff); }
.recompensa-mapa { position: absolute; width: 0; height: 0; z-index: 19000; }
.caramelo-boton { position: absolute; left: -24px; top: -24px; display: grid; place-items: center; width: 48px; height: 48px; padding: 3px; border: 0; background: transparent; }
.caramelo-boton::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: rgba(255, 249, 200, .55); box-shadow: 0 0 15px 4px rgba(255, 246, 174, .7); }
.caramelo-boton svg { position: relative; width: 40px; height: 30px; stroke: none; filter: drop-shadow(0 3px 1px rgba(40, 60, 35, .25)); animation: flotar-caramelo 1.5s ease-in-out infinite; }
.caramelo-tiempo { position: absolute; bottom: 28px; left: 0; transform: translateX(-50%); font: 700 12px/1 var(--fuente-mono); color: #294734; text-shadow: 0 1px 2px #fff, 0 -1px 2px #fff, 1px 0 2px #fff, -1px 0 2px #fff; pointer-events: none; }
.por-vencer .caramelo-tiempo { color: #a33242; }
@keyframes flotar-caramelo { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-4px) rotate(8deg); } }
@keyframes caminar { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-3px) rotate(3deg); } }
@keyframes caminar-oeste { 0%, 100% { transform: scaleX(-1) translateY(0) rotate(-3deg); } 50% { transform: scaleX(-1) translateY(-3px) rotate(3deg); } }
.sin-javascript { position: fixed; z-index: 100; left: 16px; right: 16px; top: 30%; background: var(--papel); padding: 30px; border: 1px solid var(--borde); text-align: center; }
@media (min-width: 1350px) { .cabecera-mundo { left: 32px; right: 32px; top: 28px; } .ficha-explorador { left: 32px; top: 28px; } .panel-jugadores { right: 32px; top: 120px; } }
@media (max-width: 1000px) {
  .panel-jugadores { width: 230px; }
  .barra-aventura { left: 54%; }
  .boton { padding: 11px 10px; gap: 7px; }
  .pista-movimiento { font-size: 9px; gap: 2px; }
  .cruceta { width: 107px; height: 107px; grid-template-columns: repeat(3, 35px); grid-template-rows: repeat(3, 35px); }
  .direccion { font-size: 10px; }
}
@media (max-width: 700px) {
  .marco-mundo { border-width: 5px; }
  .cabecera-mundo { top: max(13px, env(safe-area-inset-top)); left: 14px; right: 14px; }
  .cabecera-acciones { gap: 6px; }
  .estado-conexion { display: none; }
  .boton-icono { width: 36px; height: 36px; }
  .jugadores-toggle { display: grid; }
  .ficha-explorador { top: max(13px, env(safe-area-inset-top)); left: 14px; }
  .panel-jugadores { display: none; right: 14px; top: 82px; z-index: 30; width: min(300px, calc(100vw - 28px)); }
  .panel-jugadores.abierto { display: block; }
  #cerrarJugadoresBtn { display: grid; }
  #jugadores-lista { max-height: 42vh; }
  .panel-ayuda { top: 77px; right: 14px; width: min(335px, calc(100vw - 28px)); max-height: calc(100dvh - 100px); overflow-y: auto; padding: 20px; }
  .inicio-aventura { top: 48%; padding: 20px 25px; }
  .inicio-aventura h2 { font-size: 27px; }
  .inicio-emblema { width: 58px; height: 58px; }
  .inicio-gps { margin-top: 17px; }
  .controles-movimiento { bottom: max(114px, calc(env(safe-area-inset-bottom) + 100px)); left: 18px; }
  .control-etiqueta { display: none; }
  .cruceta { width: 122px; height: 122px; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); }
  .direccion { background: rgba(252, 249, 237, .95); }
  .herramientas-mapa { right: 18px; bottom: max(116px, calc(env(safe-area-inset-bottom) + 102px)); gap: 12px; }
  .brujula { width: 34px; }
  .brujula svg { width: 18px; height: 24px; }
  .zoom-mapa button { width: 34px; height: 34px; }
  .barra-aventura { bottom: max(34px, calc(env(safe-area-inset-bottom) + 21px)); left: 50%; width: max-content; max-width: calc(100vw - 26px); }
  .pista-movimiento { display: none; }
  .acciones-aventura { gap: 5px; padding: 6px; border-radius: 7px; }
  .boton { font-size: 10px; padding: 10px; gap: 6px; }
  .boton svg { width: 17px; height: 17px; }
  #chatBtn { min-width: 62px; }
  .separador-barra { margin: 0; }
  .aviso { bottom: 103px; padding: 10px 15px; font-size: 11px; }
  #consola { right: 13px; bottom: max(100px, calc(env(safe-area-inset-bottom) + 87px)); width: calc(100vw - 26px); max-width: none; height: min(405px, calc(100dvh - 185px)); }
  #consola-input { font-size: 16px; }
  .consola-cabecera { padding: 12px; }
  .error-mapa { top: 78px; font-size: 12px; }
}
@media (max-width: 360px) {
  .boton { padding: 10px 7px; gap: 4px; font-size: 9px; }
  #chatBtn { min-width: 54px; }
  .inicio-aventura { padding: 18px 23px; }
}
@media (max-height: 650px) and (min-width: 701px) {
  .panel-jugadores { top: 100px; }
  .inicio-aventura { padding: 16px 26px; }
  .inicio-emblema { width: 45px; height: 45px; }
  .inicio-gps { margin-top: 14px; }
  #consola { bottom: 108px; height: calc(100dvh - 205px); }
}
@media (max-height: 600px) and (max-width: 700px) {
  .inicio-aventura { top: 47%; padding: 14px 23px; }
  .inicio-emblema { display: none; }
  .inicio-aventura h2 { margin: 7px 0; font-size: 23px; }
  .inicio-aventura > p:not(.gps-detalle) { font-size: 11px; }
  .inicio-gps { margin-top: 13px; }
  .gps-detalle { margin: 7px 0 10px; font-size: 10px; }
  .inicio-nota { margin-top: 10px; }
  .brujula { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* Mantener la lista de mensajes nuevos y el chat abiertos sin superponerlos, también en móvil. */
body.conversaciones-visibles.chat-visible #consola { height: min(440px, calc(70dvh - 130px)); }

/* Publicar un sobre sin ocupar el mapa con una tarjeta permanente. */
.acciones-coleccion { position: fixed; z-index: 12; left: 50%; bottom: max(34px, calc(env(safe-area-inset-bottom) + 24px)); transform: translateX(-50%); display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 24px); width: max-content; pointer-events: none; }
.acciones-coleccion .coleccion-caramelos { position: static; transform: none; max-width: none; min-width: 0; flex-wrap: nowrap; gap: 6px; font-size: 15px; flex-shrink: 1; }
.coleccion-color span, #diamantes-cantidad { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boton-sobre { width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 8px; border: 1px solid #aab99a; border-radius: 7px; background: #fff8df; box-shadow: var(--sombra); pointer-events: auto; }
.boton-sobre svg { width: 26px; height: 24px; fill: none; stroke: #50684b; stroke-width: 1.6; }
#coleccion-diamantes { min-width: 0; display: flex; align-items: center; gap: 6px; color: #243b64; font: 700 15px/1 var(--fuente-mono); text-shadow: 0 1px 2px white, 0 -1px 2px white; }
#coleccion-diamantes svg { flex: none; width: 27px; height: 24px; fill: #91d7ff; stroke: #3665ab; stroke-width: 1.3; }
#teletransporte-activar { background: #eef1ff; border-color: #a2b3df; }
#teletransporte-activar svg { fill: #7183ef; stroke: #435ab0; }
#velocidad-activar { position: relative; background: #fff0c5; border-color: #d4b76d; }
#velocidad-activar svg { stroke: #895d18; }
#velocidad-tiempo { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); padding: 2px 4px; border-radius: 4px; background: #fff6da; color: #72531d; white-space: nowrap; font: 700 10px/1.2 var(--fuente-mono); }
body.velocidad-activa #velocidad-activar { opacity: 1; background: #f7d66b; }
.personaje-rpg.en-moto .personaje-boton { width: 80px; height: 64px; left: -40px; }
.personaje-rpg.en-moto .personaje-boton svg { width: 80px; height: 64px; }
.personaje-rpg.en-moto .personaje-boton::before { width: 60px; }
.personaje-rpg.en-moto.es-propio .personaje-boton::after { left: 36px; top: -7px; }
.personaje-rpg.en-moto.caminando .personaje-sprite { animation: moto-marcha .16s steps(2, end) infinite; filter: drop-shadow(0 0 4px #ffe69a); }
.personaje-rpg.en-moto.caminando .moto-rueda { transform-box: fill-box; transform-origin: center; animation: moto-rueda .32s steps(4, end) infinite; }
.personaje-rpg.en-moto.caminando .moto-banda { animation: moto-rodadura .16s steps(2, end) infinite; }
@keyframes moto-marcha { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1px); } }
@keyframes moto-rueda { to { transform: rotate(360deg); } }
@keyframes moto-rodadura { to { transform: translateY(2px); } }
.personaje-rpg.en-moto.caminando::before { --angulo-estela: 0deg; content: ''; position: absolute; left: -22px; top: -44px; width: 44px; height: 32px; pointer-events: none; background: linear-gradient(90deg, transparent, #fff4b2) 0 3px/34px 3px, linear-gradient(90deg, transparent, #fffdf1) 0 14px/44px 3px, linear-gradient(90deg, transparent, #ffe08a) 0 25px/28px 3px; background-repeat: no-repeat; animation: estela-velocidad .28s linear infinite; }
.personaje-rpg.en-moto.mirando-norte::before { --angulo-estela: -90deg; }
.personaje-rpg.en-moto.mirando-sur::before { --angulo-estela: 90deg; }
.personaje-rpg.en-moto.mirando-oeste::before { --angulo-estela: 180deg; }
.personaje-rpg.en-moto.mirando-noreste::before { --angulo-estela: -45deg; }
.personaje-rpg.en-moto.mirando-sureste::before { --angulo-estela: 45deg; }
.personaje-rpg.en-moto.mirando-suroeste::before { --angulo-estela: 135deg; }
.personaje-rpg.en-moto.mirando-noroeste::before { --angulo-estela: -135deg; }
@keyframes estela-velocidad { from { opacity: .9; transform: rotate(var(--angulo-estela)) translateX(-26px); } to { opacity: 0; transform: rotate(var(--angulo-estela)) translateX(-48px); } }
#teletransporte-panel { position: fixed; z-index: 35; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(340px, calc(100vw - 24px)); padding-bottom: 14px; }
#teletransporte-panel p { margin: 12px 16px; font-size: 13px; line-height: 1.5; }
#teletransporte-confirmar { margin: 0 16px; width: calc(100% - 32px); }
body.teletransporte-activo .acciones-coleccion { pointer-events: none; opacity: .4; }
body.teletransporte-activo .acciones-coleccion button, body.teletransporte-activo .sobre-mapa, body.teletransporte-activo .personaje-boton { pointer-events: none; }
body.teletransporte-activo .sobre-burbuja, body.teletransporte-activo .personaje-burbuja { visibility: hidden; }
body.teletransporte-salida .es-propio .personaje-sprite { animation: portal-salida .42s ease-in both; }
body.teletransporte-llegada .es-propio .personaje-sprite { animation: portal-llegada .55s ease-out both; }
body.teletransporte-salida .es-propio::after, body.teletransporte-llegada .es-propio::after { content: ''; position: absolute; width: 82px; height: 82px; left: -41px; top: -66px; border: 3px solid #c9eaff; border-radius: 50%; box-shadow: 0 0 18px #7e8dff, inset 0 0 18px #7e8dff; animation: portal-onda .55s ease-out both; }
@keyframes portal-salida { to { opacity: 0; transform: scale(.1, 1.8); filter: brightness(4) drop-shadow(0 0 12px #8ce6ff); } }
@keyframes portal-llegada { from { opacity: 0; transform: scale(.1, 1.8); filter: brightness(4) drop-shadow(0 0 12px #8ce6ff); } to { opacity: 1; transform: scale(1); } }
@keyframes portal-onda { from { opacity: 1; transform: scale(.2); } to { opacity: 0; transform: scale(1.7); } }
#sobre-editor { position: fixed; z-index: 32; bottom: max(96px, calc(env(safe-area-inset-bottom) + 86px)); left: 50%; transform: translateX(-50%); width: min(350px, calc(100vw - 26px)); max-height: calc(100dvh - 130px); overflow-y: auto; }
#sobre-form { padding: 14px; font-size: 12px; }
#sobre-form label { display: block; margin-bottom: 7px; }
#sobre-texto { display: block; width: 100%; resize: vertical; min-height: 80px; max-height: 30dvh; padding: 10px; border: 1px solid #d4ddc3; border-radius: 5px; background: #fffef8; color: var(--tinta); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#sobre-form p { margin: 10px 0; line-height: 1.5; color: var(--tinta-suave); }
#sobre-form #sobre-precio { color: var(--tinta); font-weight: 700; }
#sobre-form .sobre-tarifa { font-size: 10px; }
#sobre-form #sobre-error { color: #9a4438; }
#sobre-error:empty { display: none; }
#sobre-publicar { width: 100%; }
#sobres-aviso, #velocidad-aviso { bottom: max(96px, calc(env(safe-area-inset-bottom) + 86px)); }
.sobre-mapa { position: absolute; width: 0; height: 0; z-index: 19001; }
.sobre-boton { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; padding: 4px; }
.sobre-boton svg { width: 34px; height: 26px; filter: drop-shadow(0 2px 1px #53664c55); }
.sobre-cercano .sobre-boton svg { filter: drop-shadow(0 0 4px #fff4ad) drop-shadow(0 2px 1px #53664c55); }
.sobre-abierto { z-index: 100100; }
.sobre-burbuja { bottom: 28px; max-width: min(300px, calc(100vw - 44px)); padding: 12px 16px; border-color: #000; border-radius: 8px; background: #000; color: #fff; font-size: 14px; line-height: 1.55; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); pointer-events: auto; }
.sobre-burbuja::after { left: var(--punta-sobre, calc(50% - 4px)); border-color: #000; background: #000; }
.sobre-contenido { max-height: min(220px, 40dvh); overflow-y: auto; }
.sobre-selector-precio { margin: 14px 0; padding: 11px; background: #eee9cf; border-radius: 6px; }
.sobre-selector-precio label { display: flex !important; justify-content: space-between; gap: 8px; align-items: center; }
#sobre-lectura-valor { font-weight: 700; white-space: nowrap; }
#sobre-precio-lectura { width: 100%; min-height: 32px; margin: 0; accent-color: #a57918; cursor: pointer; }
#sobre-form #sobre-ganancia { font-size: 11px; margin-bottom: 0; }
.sobre-dorado .sobre-boton svg { filter: drop-shadow(0 0 5px #e5b44cbb) drop-shadow(0 2px 1px #6d4f24); }
.sobre-compra-titulo { display: block; color: #f5d77e; margin-bottom: 6px; }
.sobre-compra-nota { display: block; margin: 8px 0; color: #ddd; font-size: 12px; }
.sobre-pagar { width: 100%; margin-top: 8px; border: 1px solid #f2d379; border-radius: 5px; background: #f2d379; color: #241a04; min-height: 44px; padding: 8px 12px; font-weight: 700; }
.sobre-compra-error { display: block; color: #ffb8a5; font-size: 12px; margin-top: 8px; }
#lecturas-toggle { display: flex; align-items: center; gap: 8px; width: calc(100% - 28px); min-height: 44px; margin: 14px 14px 0; padding: 8px 10px; border: 1px solid #dbc68d; border-radius: 6px; background: #f7e2a6; font-size: 12px; text-align: left; }
#lecturas-contador { margin-left: auto; min-width: 17px; padding: 2px 4px; border-radius: 9px; background: #382e18; color: #fff; font: 10px/1.3 var(--fuente-mono); }
#lecturas-panel { position: fixed; z-index: 31; top: max(16px, env(safe-area-inset-top)); right: 16px; width: min(340px, calc(100vw - 32px)); max-height: calc(100dvh - 116px); overflow-y: auto; }
.lecturas-nota { padding: 12px 14px; font-size: 12px; line-height: 1.5; color: var(--tinta-suave); }
#lecturas-lista { max-height: 28dvh; overflow-y: auto; padding: 0 10px 10px; }
.lectura-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px 8px; border: 0; border-bottom: 1px solid #dddcc7; background: transparent; text-align: left; }
.lectura-fila:hover, .lectura-fila:focus-visible { background: #eee8cd; }
.lectura-fila small { font-size: 11px; color: var(--tinta-suave); }
#lecturas-detalle { margin: 0 12px 12px; padding: 14px; background: #000; color: #fff; border-radius: 8px; }
#lectura-titulo { font-size: 12px; color: #f5d77e; margin: 0 0 10px; }
#lectura-texto { font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
