:root {
  --ink: #0a0908;
  --panel: #12100f;
  --line: #2a2623;
  --bone: #c9c3b3;
  --dim: #7a766b;
  --blood: #9a1b1b;
  --blood-hi: #c42a2a;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Courier Prime", "Courier New", Courier, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--bone);
  font: 15px/1.55 var(--font); overscroll-behavior: none; }
button, input, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* Mapa apagado: sin color, con un tinte sucio */
#map { position: fixed; inset: 0; background: var(--ink); animation: surface 1.8s ease-out both; }
.leaflet-tile-pane { filter: grayscale(1) sepia(.35) brightness(.78) contrast(1.25); }
.leaflet-shadow-pane { opacity: .55; filter: sepia(.4); }
@keyframes surface { from { opacity: 0; filter: brightness(.2); } to { opacity: 1; filter: none; } }
@media (prefers-reduced-motion: reduce) { #map { animation: none; } .sheet { transition: none !important; } }

/* Grano y viñeta */
.grain, .vignette { position: fixed; inset: 0; pointer-events: none; }
.grain { z-index: 450; opacity: .16; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.vignette { z-index: 460; background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.78) 100%); }

.brand { position: fixed; z-index: 500; top: calc(14px + var(--safe-t)); left: 16px; pointer-events: none; text-shadow: 0 1px 8px #000; }
.brand-title { display: block; font-size: 17px; font-weight: 700; letter-spacing: .04em; color: var(--bone); }
.brand-sub { display: block; font-size: 12px; color: var(--dim); }

.fabs { position: fixed; z-index: 500; right: 14px; bottom: calc(16px + var(--safe-b));
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.fab { border: 1px solid var(--line); background: rgba(10,9,8,.88); color: var(--bone); cursor: pointer; border-radius: 2px; }
.fab.small { width: 44px; height: 44px; display: grid; place-items: center; }
.fab.small svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.fab.add { height: 48px; padding: 0 20px; font-size: 15px; font-weight: 700; border-color: var(--blood); color: var(--bone); background: rgba(40,8,8,.9); }
.fab:active, .btn:active { filter: brightness(1.4); }
:focus-visible { outline: 1px solid var(--bone); outline-offset: 2px; }

.toast { position: fixed; z-index: 900; left: 50%; top: calc(64px + var(--safe-t)); transform: translate(-50%, -8px);
  background: var(--panel); border: 1px solid var(--line); padding: 8px 14px; font-size: 13px;
  opacity: 0; transition: .25s; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.pick-banner { position: fixed; z-index: 800; left: 14px; right: 14px; top: calc(14px + var(--safe-t));
  background: var(--panel); border: 1px solid var(--blood); padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pick-banner button { border: 1px solid var(--line); background: none; color: var(--bone); font: inherit; padding: 6px 12px; border-radius: 2px; }
.picking #map { cursor: crosshair; }
.picking .fabs, .picking .brand { display: none; }

/* Paneles inferiores */
.sheet { position: fixed; z-index: 700; left: 0; right: 0; bottom: 0; max-height: 82dvh; overflow-y: auto;
  background: var(--panel); border-top: 1px solid var(--blood);
  padding: 18px 18px calc(22px + var(--safe-b)); transform: translateY(105%); transition: transform .28s ease;
  box-shadow: 0 -16px 50px rgba(0,0,0,.8); }
.sheet.open { transform: none; }
.sheet-handle { display: none; }
.sheet-close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; background: none;
  color: var(--dim); font-size: 24px; line-height: 1; cursor: pointer; }
.sheet h2 { margin: 0 40px 6px 0; font-size: 19px; font-weight: 700; }
.muted { color: var(--dim); margin: 0 0 16px; font-size: 13px; }
@media (min-width: 700px) { .sheet { left: 50%; right: auto; width: 440px; transform: translate(-50%, 105%); }
  .sheet.open { transform: translate(-50%, 0); } }

/* Ficha de un punto */
.tags { list-style: none; margin: 0 36px 16px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { border: 1px solid var(--line); padding: 3px 9px; font-size: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0 0 16px; }
.facts dt { color: var(--dim); font-size: 12px; }
.facts dd { margin: 0; font-size: 16px; font-weight: 700; }
.level { display: flex; gap: 3px; margin-top: 6px; }
.level i { width: 12px; height: 6px; background: var(--line); }
.level i.on { background: var(--blood-hi); }
.coords { color: var(--dim); font-size: 13px; margin-bottom: 14px; }
.link { display: block; text-align: center; padding: 12px; border: 1px solid var(--line); color: var(--bone); text-decoration: none; font-weight: 700; }

/* Formulario */
label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 14px; flex: 1; }
input, textarea { width: 100%; margin-top: 4px; background: #0a0908; color: var(--bone); border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 10px 2px; font-size: 16px; /* 16px evita el zoom de iOS */ }
textarea { border: 1px solid var(--line); padding: 10px; resize: vertical; }
input:focus, textarea:focus { outline: 0; border-color: var(--bone); }
::placeholder { color: #4b4842; }
.row { display: flex; gap: 14px; }
.row.buttons { margin-bottom: 16px; gap: 8px; }
.btn { border-radius: 2px; padding: 12px 12px; font-weight: 700; cursor: pointer; flex: 1; font-size: 14px; }
.btn.primary { background: var(--blood); color: #f1ebe0; border: 1px solid var(--blood-hi); width: 100%; font-size: 15px; }
.btn.ghost { background: none; color: var(--bone); border: 1px solid var(--line); font-weight: 400; }
.error { color: var(--blood-hi); font-size: 13px; min-height: 18px; margin: 0 0 8px; }
.done { padding: 4px 0; }
.done p { color: var(--dim); margin: 0 0 18px; }

/* Marcadores */
.leaflet-container { font: inherit; background: var(--ink); }
.leaflet-control-attribution { background: rgba(10,9,8,.7) !important; color: #4b4842 !important; font-size: 9px; }
.leaflet-control-attribution a { color: #4b4842 !important; }
.leaflet-control-zoom { display: none; }
.cl { background: rgba(10,9,8,.72); border: 1px solid var(--dim); color: var(--bone); border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.me { width: 14px; height: 14px; border-radius: 50%; background: var(--bone); border: 2px solid var(--ink); box-shadow: 0 0 0 5px rgba(201,195,179,.2); }
.picked { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--blood-hi); background: rgba(154,27,27,.4); }
