:root {
  --green: #1f9d55;
  --amber: #d98c00;
  --orange: #e8590c;
  --red: #d92d20;
  --ink: #1a2430;
  --muted: #5b6b7b;
  --line: #e2e8f0;
  --card: #ffffff;
  --shadow: 0 8px 30px rgba(20, 40, 70, 0.16);
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  color: var(--ink); background: #eef1f5;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
#map { position: fixed; inset: 0; z-index: 1; }

button { font-family: inherit; }
.hidden { display: none !important; }

/* ---------------- Controls (top card) ---------------- */
.controls {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 10px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.row { display: flex; gap: 8px; align-items: center; }

.search { position: relative; flex: 1; min-width: 0; }
.search input {
  width: 100%;
  padding: 11px 12px;
  font-size: 16px; /* evita zoom en iOS */
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #fff;
}
.search input:focus { border-color: #9db6d6; box-shadow: 0 0 0 3px rgba(90, 140, 220, 0.15); }
.results {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow);
  overflow: hidden; max-height: 46vh; overflow-y: auto;
  z-index: 20;
}
.results button {
  display: block; width: 100%; text-align: left;
  padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; font-size: 14px; cursor: pointer; color: var(--ink);
}
.results button:last-child { border-bottom: 0; }
.results button:active { background: #eef4fb; }

.iconbtn {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border: 1px solid var(--line); border-radius: 11px;
  background: #fff; font-size: 20px; cursor: pointer;
  display: grid; place-items: center;
}
.iconbtn:active { transform: scale(0.94); }
.iconbtn svg { display: block; }
.iconbtn.locate { color: var(--orange); }

/* categoría + altura */
.settings { gap: 10px; }
.cats { display: flex; background: #eef1f5; border-radius: 11px; padding: 3px; flex-shrink: 0; }
.cats button {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--muted);
}
.cats button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

.alt { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.alt input[type="range"] {
  flex: 1; min-width: 0; accent-color: var(--orange); height: 26px;
}
.altval {
  flex-shrink: 0; font-weight: 700; font-size: 14px;
  min-width: 52px; text-align: right; font-variant-numeric: tabular-nums;
}
.catdesc { font-size: 12px; color: var(--muted); line-height: 1.35; padding: 0 2px; }

/* ---------------- Zoom hint chip ---------------- */
.zoomhint {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 700;
  background: var(--ink); color: #fff;
  padding: 9px 16px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px); text-align: center;
}

/* ---------------- Verdict card ---------------- */
.verdict {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 110%);
  width: 100%;
  max-width: 480px;
  z-index: 1100;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
}
.verdict.open { transform: translate(-50%, 0); }
@media (min-width: 520px) {
  .verdict { bottom: 16px; border-radius: 20px; width: calc(100% - 24px); }
  .verdict.open { transform: translate(-50%, 0); }
}
.v-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,0.28); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer; z-index: 2;
}
.v-head {
  padding: 22px 20px 18px; color: #fff;
}
.v-head .grab {
  width: 40px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.6); margin: -10px auto 12px;
}
.v-emoji { font-size: 30px; line-height: 1; }
.v-title { font-size: 23px; font-weight: 800; letter-spacing: -0.4px; margin: 8px 0 0; }
.v-reason { font-size: 15px; line-height: 1.45; margin-top: 6px; opacity: 0.97; }

.sev-free   { background: var(--green); }
.sev-cond   { background: var(--amber); }
.sev-auth   { background: var(--orange); }
.sev-prohib { background: var(--red); }

.v-extra { padding: 12px 20px 18px; }
.v-links { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; }
.v-links a { color: #1a56b0; text-decoration: none; font-weight: 600; }
.v-links a:active { opacity: 0.7; }

.v-more { margin-top: 10px; }
.v-more summary {
  cursor: pointer; font-size: 13px; color: var(--muted); list-style: none;
}
.v-more summary::-webkit-details-marker { display: none; }
.v-more summary::before { content: "▸ "; }
.v-more[open] summary::before { content: "▾ "; }
.v-more ul { margin: 8px 0 0; padding-left: 0; list-style: none; }
.v-more li {
  font-size: 13.5px; line-height: 1.4; padding: 7px 0; border-top: 1px solid var(--line);
  display: flex; gap: 8px;
}
.v-more li .dot { flex-shrink: 0; }
.cat-note {
  margin-top: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.4;
  padding-top: 10px; border-top: 1px solid var(--line);
}

.v-loading { padding: 26px 20px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 15px; }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line);
  border-top-color: var(--orange); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Info modal ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 25, 40, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 520px) { .modal { align-items: center; padding: 20px; } }
.modal-card {
  position: relative;
  background: #fff; width: 100%; max-width: 460px;
  border-radius: 20px 20px 0 0;
  padding: 24px 22px calc(env(safe-area-inset-bottom, 0px) + 24px);
  max-height: 86vh; overflow-y: auto;
}
@media (min-width: 520px) { .modal-card { border-radius: 18px; padding-bottom: 24px; } }
.modal-card h2 { margin: 0 0 14px; font-size: 20px; }
.modal-card p { font-size: 14px; line-height: 1.55; color: var(--ink); margin: 0 0 14px; }
.modal-card p.muted { color: var(--muted); font-size: 13px; }
.modal-card a { color: #1a56b0; }
.modal-card p.credits { font-size: 11.5px; }
.callout {
  background: #f3f7ff; border: 1px solid #dbe6fb; border-radius: 12px;
  padding: 12px 14px; font-size: 14px; line-height: 1.5; margin-bottom: 14px;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: #eef1f5; color: var(--ink);
  font-size: 19px; line-height: 1; cursor: pointer;
}

.leaflet-container { font: inherit; }
.leaflet-control-zoom { margin-bottom: 84px !important; } /* deja hueco al chip */
