:root {
  /* el marco de las ventanas: piedra oscura y oro viejo */
  --piedra: #17120d;
  --piedra-2: #2a2119;
  --oro-claro: #f6dc8a;
  --oro: #c99a3b;
  --oro-oscuro: #6e4d17;
  /* el pergamino del interior */
  --pergamino: #e9d8b0;
  --pergamino-2: #d9c08a;
  --tinta-parda: #3a2611;
  --tinta-parda-2: #6b4a22;
  /* botones rojos */
  --rojo: #8e1b12;
  --rojo-claro: #c4382a;
  /* resto */
  --mar: #6d7f73;
  --texto-claro: #f2e8cf;
  --sombra: 0 4px 10px rgb(0 0 0 / .55), 0 14px 40px rgb(0 0 0 / .35);
  --ui: "Bricolage Grotesque", system-ui, sans-serif;
  --titulo: "Cinzel", Georgia, serif;
  --libro: "Crimson Pro", Georgia, serif;
  /* borde dorado en bisel, reutilizado */
  --borde-oro: linear-gradient(160deg, var(--oro-claro), var(--oro) 35%, var(--oro-oscuro) 60%, var(--oro) 80%, var(--oro-claro));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--mar);
  color: var(--tinta-parda);
  font-family: var(--ui);
}

#mapa {
  position: fixed;
  inset: 0;
  background: var(--mar);
}

.oculto {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- cabecera ---------- */
.cabecera {
  position: fixed;
  top: 16px; left: 16px; right: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  pointer-events: none;
  z-index: 1000;
}
.cabecera > * { pointer-events: auto; }

/* La marca: letras de oro labrado */
.marca {
  font: 900 2rem/1 "Cinzel Decorative", var(--titulo);
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 4px 2px;
  background: linear-gradient(180deg, #fff6c4 0%, #f7d35a 38%, #c98a1c 62%, #f3c84a 80%, #8a5410 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.2px #3b2206;
  filter:
    drop-shadow(0 1px 0 #2a1704)
    drop-shadow(0 2px 3px rgb(0 0 0 / .75))
    drop-shadow(0 0 10px rgb(0 0 0 / .45));
}
.marca:focus-visible { outline: 3px solid var(--oro-claro); outline-offset: 3px; border-radius: 4px; }

.buscador { flex: 0 1 320px; min-width: 0; }
.buscador input {
  font: 500 1rem var(--ui);
  width: 100%;
  padding: 9px 14px;
  border: 2px solid transparent;
  border-radius: 4px;
  background:
    linear-gradient(var(--piedra), var(--piedra)) padding-box,
    var(--borde-oro) border-box;
  color: var(--texto-claro);
  box-shadow: var(--sombra);
}
.buscador input::placeholder { color: #b9a988; }
.buscador input:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 2px; }

/* Zona y coordenadas bajo el ratón, como en el mapa del juego */
.posicion {
  position: fixed;
  left: 16px; bottom: 16px;
  margin: 0;
  padding: 5px 10px;
  border-radius: 3px;
  background: rgb(23 18 13 / .85);
  color: var(--oro-claro);
  font: 600 .95rem var(--titulo);
  text-shadow: 0 1px 1px #000;
  z-index: 1000;
}
.posicion:empty { display: none; }

/* ---------- chinchetas: como iconos de objeto, con marco dorado ---------- */
.chincheta {
  width: 32px; height: 22px;
  padding: 2px;
  border-radius: 3px;
  background: var(--borde-oro);
  box-shadow: 0 0 0 1px #000, 0 2px 5px rgb(0 0 0 / .6);
  transition: transform .12s ease, box-shadow .12s ease;
  cursor: pointer;
}
/* (Leaflet pone width: auto y quita max-width a las imágenes de los marcadores: hay que forzarlo) */
.leaflet-marker-pane .chincheta img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 1px;
}
.chincheta:hover, .chincheta:focus-visible {
  transform: scale(2);
  box-shadow: 0 0 0 1px #000, 0 0 8px 2px rgb(255 214 90 / .85);   /* el brillo de resaltar un objeto */
  outline: none;
}
.leaflet-marker-icon.chincheta-caja { background: none; border: 0; }

/* ---------- el marco de ventana ---------- */
.marco {
  border: 3px solid transparent;
  border-radius: 6px;
  background:
    linear-gradient(180deg, var(--piedra-2), var(--piedra)) padding-box,
    var(--borde-oro) border-box;
  box-shadow: 0 0 0 1px #000, var(--sombra), inset 0 0 0 1px rgb(0 0 0 / .8);
  color: var(--texto-claro);
}
/* remaches en las esquinas */
.marco::before, .marco::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  top: -6px;
  transform: rotate(45deg);
  background: var(--borde-oro);
  box-shadow: 0 0 0 1px #000;
}
.marco::before { left: -6px; }
.marco::after { right: -6px; }

.postal {
  position: fixed;
  top: 76px; right: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 92px);
  display: flex;
  flex-direction: column;
  z-index: 1100;
  transform: translateX(calc(100% + 40px));
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.postal.abierta { transform: none; }

.marco-cabecera {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-bottom: 2px solid #000;
  background: linear-gradient(180deg, #3a2d20, #1d160f);
  border-radius: 3px 3px 0 0;
}
.postal-titulo {
  flex: 1;
  margin: 0;
  font: 700 1.15rem/1.25 var(--titulo);
  color: var(--oro-claro);
  text-shadow: 0 1px 0 #000, 0 0 6px rgb(0 0 0 / .8);
}

/* botón de cerrar: redondo, rojo, con aro de oro */
.cerrar {
  flex: none;
  width: 30px; height: 30px;
  border: 2px solid transparent;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, var(--rojo-claro), var(--rojo) 70%) padding-box,
    var(--borde-oro) border-box;
  color: #ffe9b0;
  font: 700 1.1rem/1 var(--ui);
  text-shadow: 0 1px 1px #000;
  box-shadow: 0 0 0 1px #000;
  cursor: pointer;
}
.cerrar:hover { filter: brightness(1.2); }
.cerrar:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 2px; }

.postal-foto {
  margin: 0;
  padding: 10px;
  background: #000;
}
.postal-foto a { display: block; cursor: zoom-in; }
.postal-foto a:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 2px; }
.postal-foto img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--oro-oscuro);
  background: var(--mar);
}

/* el pergamino, como el texto de una misión */
.pergamino {
  overflow-y: auto;
  padding: 16px 20px 18px;
  color: var(--tinta-parda);
  font: 400 1.1rem/1.45 var(--libro);
  background:
    radial-gradient(ellipse at 20% 10%, rgb(255 255 255 / .35), transparent 60%),
    radial-gradient(ellipse at 90% 100%, rgb(120 80 30 / .25), transparent 55%),
    linear-gradient(180deg, var(--pergamino), var(--pergamino-2));
  box-shadow: inset 0 0 18px rgb(90 60 20 / .45);
}
.postal-lugar {
  margin: 0 0 12px;
  font: 700 1.05rem var(--titulo);
  color: #2b1a07;
}
.postal-datos {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 14px;
  margin: 0;
}
.postal-datos dt { color: var(--tinta-parda-2); }
.postal-datos dd { margin: 0; font-weight: 600; }
.postal-aviso {
  margin: 14px 0 0;
  font-style: italic;
  color: var(--tinta-parda-2);
}

/* botones rojos, como los de la interfaz del juego */
.marco-botones {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 2px solid #000;
  background: linear-gradient(180deg, #1d160f, #2a2119);
  border-radius: 0 0 3px 3px;
}
.boton {
  min-width: 110px;
  padding: 6px 14px;
  border: 2px solid transparent;
  border-radius: 3px;
  background:
    linear-gradient(180deg, var(--rojo-claro), var(--rojo) 55%, #5c0f09) padding-box,
    var(--borde-oro) border-box;
  color: #ffd75e;
  font: 700 .95rem var(--titulo);
  text-shadow: 0 1px 1px #000;
  box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgb(255 255 255 / .25);
  cursor: pointer;
}
.boton:hover { filter: brightness(1.15); color: #fff3c4; }
.boton:active { transform: translateY(1px); filter: brightness(.95); }
.boton:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 2px; }

/* ---------- quién hizo la foto: nombre en el color de su clase, como en el juego ---------- */
.postal-datos dd.autor { display: flex; align-items: center; gap: 8px; }
.emblema {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font: 700 .8rem var(--titulo);
  color: #fff;
  text-shadow: 0 1px 1px #000;
  background: #6b4a22;
  box-shadow: 0 0 0 2px var(--oro), 0 0 0 3px #000;
}
.clase-warrior { color: #8a5d32; } .fondo-warrior { background: #c69b6d; }
.clase-paladin { color: #b5487a; } .fondo-paladin { background: #f48cba; }
.clase-hunter { color: #5d7d2c; } .fondo-hunter { background: #aad372; }
.clase-rogue { color: #8f8420; } .fondo-rogue { background: #fff468; color: #3a2611; text-shadow: none; }
.clase-priest { color: #5c5c5c; } .fondo-priest { background: #f0f0f0; color: #3a2611; text-shadow: none; }
.clase-shaman { color: #0058a8; } .fondo-shaman { background: #0070dd; }
.clase-mage { color: #2d7f9e; } .fondo-mage { background: #3fc7eb; }
.clase-warlock { color: #6a5bb0; } .fondo-warlock { background: #8788ee; }
.clase-druid { color: #c25f00; } .fondo-druid { background: #ff7c0a; }

/* ---------- denunciar ---------- */
.boton.boton-discreto {
  margin-right: auto;
  min-width: 0;
  background:
    linear-gradient(180deg, #3a2d20, #1d160f) padding-box,
    var(--borde-oro) border-box;
  color: #d9c08a;
}
.denuncia { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgb(107 74 34 / .35); }
.denuncia label { display: block; margin: 4px 0; cursor: pointer; }
.denuncia-nota { margin: 8px 0 10px; font-style: italic; color: var(--tinta-parda-2); }
.denuncia-resultado { margin: 8px 0 0; font-weight: 600; }

/* ---------- cuenta ---------- */
.enlace-instalar {
  margin-left: auto;
  color: var(--oro-claro);
  font: 700 .95rem var(--titulo);
  text-shadow: 0 1px 2px #000, 0 0 8px #000;
}
.enlace-instalar:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 3px; }
.nota-addon { margin: 0 0 14px; }
.nota-addon a { color: var(--rojo); font-weight: 600; }
@media (max-width: 600px) { .enlace-instalar { display: none; } }
.cuenta { display: flex; align-items: center; gap: 10px; }
.cuenta .boton { min-width: 0; text-decoration: none; display: inline-block; }
.cuenta-nombre {
  font: 700 .95rem var(--titulo);
  color: var(--oro-claro);
  text-shadow: 0 1px 2px #000, 0 0 6px #000;
}
.cuenta-enlace { color: var(--oro-claro); font: 600 .9rem var(--titulo); text-shadow: 0 1px 2px #000; }
.aviso-cuenta { margin: 0 0 14px; font-weight: 600; }
.aviso-cuenta a { color: var(--rojo); }

/* ---------- subir capturas ---------- */
.boton-cabecera { min-width: 0; }

.pergamino h3 { margin: 0 0 8px; font: 700 1rem var(--titulo); color: #2b1a07; }
.sincro { margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid rgb(107 74 34 / .35); }
.sincro-estado { margin: 0 0 10px; }
.pasos { margin: 0 0 14px; padding-left: 1.3em; }
.pasos li { margin-bottom: 6px; }
.pasos b { color: #2b1a07; }
.soltar {
  padding: 26px 16px;
  border: 2px dashed var(--tinta-parda-2);
  border-radius: 4px;
  text-align: center;
  font: 600 1.05rem var(--libro);
  color: var(--tinta-parda);
  background: rgb(255 255 255 / .18);
  cursor: pointer;
}
.soltar:hover, .soltar.encima { background: rgb(255 240 190 / .55); border-color: var(--oro-oscuro); }
.soltar:focus-visible { outline: 2px solid var(--oro-oscuro); outline-offset: 2px; }
.subir-resultado p { margin: 10px 0 0; }
.subir-resultado .bien { font-weight: 700; color: #2f5a1c; }
.subir-resultado .mal { font-weight: 700; color: var(--rojo); }

/* ---------- Leaflet con nuestros colores ---------- */
.leaflet-container { background: var(--mar); font-family: var(--ui); }
/* Leaflet suma las teselas entre sí (plus-lighter) para tapar rayas, pero donde se solapan salen
   líneas claras. Sin suma: si queda una raya, se ve la vista previa del mundo que hay debajo. */
.leaflet-container img.leaflet-tile { mix-blend-mode: normal; }
.leaflet-bar { border: 2px solid var(--oro) !important; box-shadow: 0 0 0 1px #000, var(--sombra) !important; }
.leaflet-bar a, .leaflet-bar a:hover {
  background: var(--piedra);
  color: var(--oro-claro);
  border-bottom-color: var(--oro-oscuro);
}
.leaflet-bar a:hover { background: var(--piedra-2); }
.leaflet-bar a.leaflet-disabled { background: var(--piedra); color: #5a4a35; }
.leaflet-control-attribution {
  background: rgb(23 18 13 / .75) !important;
  color: #c9bba0 !important;
}
.leaflet-control-attribution a { color: var(--oro-claro) !important; }

@media (max-width: 600px) {
  .marca { font-size: 1.5rem; }
  .postal {
    top: auto; bottom: 16px; left: 16px;
    max-height: 78vh;
    transform: translateY(calc(100% + 40px));
  }
  .boton { min-width: 0; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .postal, .chincheta { transition: none; }
}
