/* Estética común de los visores de Mapas Pixel */
@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&family=VT323&display=swap');

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
:root {
  --ink: #2a1c24; --paper: #fbefd2; --paper-hi: #fffaea; --paper-lo: #e3cf9f;
  --accent: #c8452d; --gold: #ffc94a; --gold-hi: #fff0a8; --gold-lo: #d9971c;
  --sky: #8fd0ff; --sky-hi: #dcf2ff; --sky-lo: #4f9fd6;
}
html, body { margin: 0; height: 100%; overflow: hidden; font-family: 'VT323', monospace; -webkit-font-smoothing: none; }
#map { position: absolute; inset: 0; background: linear-gradient(180deg, #2b3a67 0%, #5d7fb8 70%, #9cc0e0 100%); }
.leaflet-container { background: transparent; font-family: 'VT323', monospace; }
.leaflet-tile { image-rendering: pixelated; image-rendering: crisp-edges; }
.leaflet-control-attribution { font-family: 'VT323', monospace; font-size: 15px; background: rgba(251,239,210,.9) !important; color: var(--ink); }

/* paneles con bisel de pixel art */
.px-panel { background: var(--paper); color: var(--ink); border: 4px solid var(--ink);
  box-shadow: inset -4px -4px 0 var(--paper-lo), inset 4px 4px 0 var(--paper-hi), 4px 4px 0 rgba(0,0,0,.45); }
.px-btn { font-family: 'Silkscreen', monospace; font-size: 16px; line-height: 1; padding: 10px 14px; cursor: pointer;
  color: var(--ink); background: var(--gold); border: 4px solid var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  box-shadow: inset -4px -4px 0 var(--gold-lo), inset 4px 4px 0 var(--gold-hi), 4px 4px 0 rgba(0,0,0,.45); }
.px-btn:active { transform: translate(2px, 2px); box-shadow: inset -4px -4px 0 var(--gold-lo), inset 4px 4px 0 var(--gold-hi), 2px 2px 0 rgba(0,0,0,.45); }
.px-btn.sky { background: var(--sky); box-shadow: inset -4px -4px 0 var(--sky-lo), inset 4px 4px 0 var(--sky-hi), 4px 4px 0 rgba(0,0,0,.45); }
.px-btn.off { filter: grayscale(.85) brightness(.92); }

/* barra superior */
.hud { position: absolute; z-index: 1000; left: 0; right: 0; top: 0; display: flex; align-items: stretch; gap: 10px;
  padding: 12px; pointer-events: none; flex-wrap: wrap; }
.hud > * { pointer-events: auto; }
.hud .title { padding: 6px 14px; display: flex; align-items: center; gap: 12px; }
.hud .title h1 { font-family: 'Silkscreen', monospace; font-weight: 700; font-size: 24px; margin: 0; color: var(--accent);
  letter-spacing: 1px; text-shadow: 2px 2px 0 var(--ink); }
.hud .shield { width: 24px; height: 28px; background: var(--accent); border: 3px solid var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); }
.hud .stats { display: flex; }
.hud .stat { padding: 6px 14px; border-right: 3px dashed var(--paper-lo); font-size: 22px; line-height: 1;
  display: flex; flex-direction: column; justify-content: center; }
.hud .stat:last-child { border-right: 0; }
.hud .stat b { font-family: 'Silkscreen', monospace; font-size: 8px; font-weight: 400; color: #8a6a3c; margin-bottom: 5px; text-transform: uppercase; }
.hud .spacer { flex: 1; }

.zoom { position: absolute; z-index: 1000; right: 14px; bottom: 36px; display: flex; flex-direction: column; gap: 10px; }
.zoom .px-btn { width: 48px; height: 48px; justify-content: center; padding: 0; font-size: 24px; }
.compass { position: absolute; z-index: 1000; left: 14px; bottom: 36px; width: 64px; height: 64px; }
.compass svg { position: absolute; inset: 6px; }
.compass span { position: absolute; right: 6px; top: 4px; font-family: 'Silkscreen', monospace; font-size: 16px; color: var(--accent); }

.tip { position: absolute; z-index: 1001; left: 50%; bottom: 36px; transform: translateX(-50%); padding: 10px 16px;
  font-size: 22px; line-height: 1.05; max-width: min(540px, 78vw); text-align: center; display: none; }
.tip b { font-family: 'Silkscreen', monospace; font-size: 16px; color: var(--accent); display: block; margin-bottom: 6px; }

/* carteles: letra estrecha y nítida, sin escalado */
.sign { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; cursor: pointer;
  font-family: 'VT323', monospace; font-size: 20px; line-height: 1; color: var(--ink); background: var(--paper);
  border: 3px solid var(--ink); padding: 3px 7px 2px; box-shadow: 3px 3px 0 rgba(0,0,0,.4); }
.sign::after { content: ''; position: absolute; left: 50%; bottom: calc(-3px - var(--palito, 6px)); width: 4px; height: var(--palito, 6px); background: var(--ink); transform: translateX(-50%); }
.sign.star { background: var(--gold); }
.sign:hover { background: var(--paper-hi); }
.hide-signs .sign { display: none; }
/* de lejos, los carteles se quedan en una marquita (el principal, en pequeño) para no tapar el mapa */
.z-lejos .sign:not(.star) { font-size: 0; padding: 0; width: 9px; height: 9px; border-width: 2px; box-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.z-lejos .sign.star { font-size: 15px; padding: 2px 5px 1px; border-width: 2px; }

/* cielo pixelado detrás del mapa (reloj.js) */
#cielo { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }

/* reloj y calendario (reloj.js) */
.reloj { position: absolute; z-index: 1000; left: 50%; bottom: 30px; transform: translateX(-50%); padding: 8px 12px;
  display: flex; flex-direction: column; gap: 6px; width: min(780px, calc(100vw - 200px)); box-sizing: border-box; }
.reloj-fila { display: flex; align-items: center; gap: 10px; }
.reloj-fila b { font-family: 'Silkscreen', monospace; font-size: 15px; color: var(--accent); white-space: nowrap; }
.reloj-hora { font-size: 30px; line-height: 1; }
.reloj-fiesta { font-size: 20px; color: #8a3b6a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reloj-tiempo { font-size: 20px; color: #3f5f86; white-space: nowrap; }
.reloj-hueco { flex: 1; }
.reloj-fila:first-child { flex-wrap: wrap; row-gap: 6px; }
.reloj-tiempo, .reloj-fiesta { min-width: 0; }
/* los botones van juntos: si no caben, bajan enteros a otra línea, siempre dentro del panel */
.reloj-botones { display: flex; align-items: flex-end; gap: 6px; flex: none; margin-left: auto; }   /* abajo: la barrita del volumen sube sin descolocar el botón «Sonido» */
.reloj .px-btn.reloj-modo { display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1; padding: 3px 8px; min-width: 76px; }
.reloj-modo small { font-size: 8px; opacity: 0.75; letter-spacing: 0.06em; margin-bottom: 2px; }
/* la barrita de volumen, encima del botón «Sonido» y de su mismo ancho (width 0 + min-width 100%: no lo ensancha) */
.son-caja { display: inline-flex; flex-direction: column; align-items: stretch; gap: 3px; flex: none; }
.reloj .son-caja input[type=range] { flex: none; width: 0; min-width: 100%; height: 7px; border-width: 2px; box-sizing: border-box; cursor: pointer; }
.reloj .son-caja input[type=range]::-webkit-slider-thumb { width: 8px; height: 13px; border-width: 2px; }
.reloj .son-caja input[type=range]::-moz-range-thumb { width: 5px; height: 10px; border-width: 2px; }
.son-caja.apagado input[type=range] { opacity: 0.5; }
.reloj .px-btn { font-size: 12px; padding: 6px 9px; }
.reloj label { flex: 1; display: flex; align-items: center; gap: 8px; font-family: 'Silkscreen', monospace; font-size: 10px; color: #8a6a3c; text-transform: uppercase; }
.reloj input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 12px; background: var(--paper-lo);
  border: 3px solid var(--ink); margin: 0; }
.reloj input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 20px; background: var(--gold);
  border: 3px solid var(--ink); cursor: pointer; }
.reloj input[type=range]::-moz-range-thumb { width: 10px; height: 16px; background: var(--gold); border: 3px solid var(--ink); border-radius: 0; cursor: pointer; }
.reloj-sol { width: 18px; height: 18px; flex: none; border: 3px solid var(--ink); }
.reloj-sol.dia { background: var(--gold); }
.reloj-sol.noche { background: #3b4a7a; box-shadow: inset 6px -3px 0 #f4ecce; }
.con-reloj .tip { bottom: 130px; }

#menu { display: none; }
/* móvil y pantallas estrechas: todo cabe sin taparse */
@media (max-width: 760px) {
  .hud { padding: 8px; gap: 6px; align-items: center; }
  .hud .stats { display: none; }
  .hud .title { padding: 4px 10px; }
  .hud .title h1 { font-size: 16px; }
  .hud .shield { width: 18px; height: 22px; }
  .px-btn { font-size: 12px; padding: 7px 9px; }
  #menu { display: inline-flex; }
  .hud > .px-btn:not(#menu), .hud > a.px-btn { display: none; }
  .hud.abierto > .px-btn, .hud.abierto > a.px-btn { display: inline-flex; }
  /* reloj abajo, a todo lo ancho: fecha y tiempo, debajo los botones y luego los deslizadores */
  .reloj { width: calc(100vw - 16px); bottom: max(6px, env(safe-area-inset-bottom, 0px)); padding: 6px 8px; gap: 5px; }
  .reloj-fila:first-child { flex-wrap: wrap; row-gap: 6px; gap: 6px; }
  .reloj-hueco { flex-basis: 100%; height: 0; }
  .reloj-fiesta { display: none; }
  .reloj-hora { font-size: 24px; }
  .reloj-tiempo { font-size: 16px; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
  .reloj .px-btn { font-size: 11px; padding: 6px 7px; }
  /* carteles del móvil: más pequeños; con zoom medio, solo la marquita (salvo el principal) y su nombre al tocarla */
  .sign { font-size: 14px; border-width: 2px; padding: 2px 5px 1px; box-shadow: 2px 2px 0 rgba(0,0,0,.4); }
  .z-medio .sign:not(.star) { font-size: 0; padding: 0; width: 9px; height: 9px; }
  .z-lejos .sign.star, .z-medio .sign.star { font-size: 13px; }
  /* los botones del panel (Ir a…, Ahora, ▶, Velocidad, Tiempo, Sonido): si no caben en una fila, bajan a otra; nunca
     se salen por el borde */
  .reloj-botones { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; gap: 5px; }
  .reloj .px-btn.reloj-modo { min-width: 0; padding: 3px 6px; }
  .reloj label { font-size: 9px; gap: 5px; min-width: 0; }
  .reloj input[type=range] { min-width: 0; width: 100%; }
  /* brújula y zoom arriba, bajo la barra, para que el reloj no los pise */
  .compass { left: 8px; top: 58px; bottom: auto; width: 44px; height: 44px; }
  .compass span { font-size: 12px; }
  .zoom { right: 8px; top: 58px; bottom: auto; gap: 6px; }
  .zoom .px-btn { width: 40px; height: 40px; font-size: 20px; }
  .con-reloj .tip { bottom: 150px; }
  .leaflet-control-attribution { font-size: 10px !important; max-width: 60vw; line-height: 1.1; }
}

/* cajita «Ir a…» (reloj.js): encima del panel del reloj */
.reloj-ir { position: absolute; z-index: 1001; left: 50%; bottom: 132px; transform: translateX(-50%); padding: 10px 12px;
  width: min(640px, calc(100vw - 32px)); box-sizing: border-box; display: flex; flex-direction: column; gap: 8px;
  max-height: calc(100vh - 220px); overflow-y: auto; }
.reloj-ir[hidden] { display: none; }
.reloj-ir b { font-family: 'Silkscreen', monospace; font-size: 10px; font-weight: 400; color: #8a6a3c; text-transform: uppercase; letter-spacing: .5px; }
.reloj-ir-fila { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reloj-ir-fila label { display: flex; align-items: center; gap: 6px; font-family: 'Silkscreen', monospace; font-size: 10px; color: #8a6a3c; text-transform: uppercase; }
.reloj-ir-fila input { font-family: 'VT323', monospace; font-size: 20px; padding: 2px 6px; border: 3px solid var(--ink); background: var(--paper-hi); color: var(--ink); }
.reloj-ir-fila .px-btn { font-size: 12px; padding: 6px 10px; }
.reloj-ir-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.reloj-chip { font-family: 'VT323', monospace; font-size: 19px; line-height: 1; padding: 4px 8px; cursor: pointer; color: var(--ink);
  background: var(--paper-hi); border: 3px solid var(--ink); box-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.reloj-chip:hover, .reloj-chip:focus-visible { background: var(--gold-hi); outline: none; }
.reloj-chip.sitio { background: var(--sky-hi); }
.reloj-ir-momentos { display: flex; flex-direction: column; }
.mom-fila { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 7px 0; border-top: 2px dashed var(--paper-lo); }
.mom-fila:first-child { border-top: 0; }
.mom-fiesta { display: flex; flex-direction: column; gap: 3px; padding-top: 3px; }
.mom-fiesta b { font-family: 'Silkscreen', monospace; font-size: 10px; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
.mom-fiesta span { font-size: 17px; color: #8a6a3c; }
.mom-botones { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
.mom-boton { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 42px; text-align: left; }
.mom-boton .mom-h { font-size: 15px; color: #8a6a3c; }
@media (max-width: 760px) { .mom-fila { grid-template-columns: 1fr; gap: 4px; } .mom-botones { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); } }
@media (max-width: 760px) { .reloj-ir { bottom: 140px; top: 58px; max-height: none; width: calc(100vw - 16px); } }
