/* ---------- Tokens (claro / oscuro) ---------- */
:root {
  --red: #D6202C;
  --red-a: 214,32,44;
  --gold: #C9A227;
  --ink: #111114;
  --muted: #8A8A93;
  --line: #EDEDF0;
  --bg: #FFFFFF;
  --bg-a: 255,255,255;
  --bg-2: #F6F6F8;
  --chev: #C5C5CC;
  --handle: #DADADF;
  --map-bg: #F3F2EF;
  --map-line: #B8B8C0;
  --shadow: rgba(0,0,0,.1);
  --toast: #111114;
  --toast-ink: #FFFFFF;
  --top: max(env(safe-area-inset-top, 0px), 10px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --sheet-vis: 150px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --elev-1: 0 1px 2px rgba(17,17,20,.06), 0 2px 8px rgba(17,17,20,.06);
  --elev-2: 0 1px 2px rgba(17,17,20,.06), 0 6px 16px rgba(17,17,20,.08), 0 16px 32px rgba(17,17,20,.06);
  --elev-sheet: 0 -1px 0 rgba(17,17,20,.04), 0 -8px 24px rgba(17,17,20,.07);
  --focus: 0 0 0 3px rgba(var(--red-a),.45);
  --tabbar: calc(58px + var(--safe-bot));
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --red: #E8323E; --red-a: 232,50,62; --gold: #D9B23A;
    --ink: #F2F2F5; --muted: #8E8E98; --line: #26262D;
    --bg: #0F0F12; --bg-a: 15,15,18; --bg-2: #1B1B21;
    --chev: #4A4A55; --handle: #3A3A44;
    --map-bg: #17171C; --map-line: #4A4A55; --shadow: rgba(0,0,0,.5);
    --toast: #F2F2F5; --toast-ink: #111114;
    --elev-1: 0 0 0 1px rgba(255,255,255,.06), 0 2px 8px rgba(0,0,0,.4);
    --elev-2: 0 0 0 1px rgba(255,255,255,.07), 0 8px 24px rgba(0,0,0,.55);
    --elev-sheet: 0 -1px 0 rgba(255,255,255,.06), 0 -8px 24px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body { position: fixed; inset: 0; }
button, input { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* En escritorio: marco iPhone 14 (390×844) escalado para caber en la ventana */
#app { position: relative; width: 100%; height: 100%; overflow: clip; background: var(--bg); }
@media (min-width: 520px) {
  body { display: grid; place-items: center; background: #E9E9EC; }
  #app {
    height: min(844px, calc(100dvh - 48px)); width: auto; aspect-ratio: 390 / 844; --top: 22px;
    border-radius: 44px; box-shadow: 0 0 0 9px #111, 0 30px 80px rgba(0,0,0,.25);
  }
}
@media (min-width: 520px) and (prefers-color-scheme: dark) { body { background: #050507; } #app { box-shadow: 0 0 0 9px #2A2A30, 0 30px 80px rgba(0,0,0,.6); } }

/* ---------- Top bar ---------- */
.topbar {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  padding: calc(var(--top) + 6px) 20px 26px;
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(var(--bg) 78%, rgba(var(--bg-a),0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.brand-mark { width: 18px; height: 18px; flex: none; }
h1 { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -.02em; max-width: 270px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ring { position: relative; width: 34px; height: 34px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.4; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--red); stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; transition: stroke-dashoffset .6s ease; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; letter-spacing: -.02em; }

/* ---------- Mapa ---------- */
#map { position: absolute; inset: 0; background: var(--map-bg); }
/* Créditos del mapa (ⓘ): pequeños, debajo de la leyenda del mapa de calor; sin leyenda (distrito abierto) ocupan su sitio */
.maplibregl-ctrl-top-left { top: calc(var(--top) + 146px); left: 15px; transition: top .25s var(--ease-out); }
#app.no-legend .maplibregl-ctrl-top-left { top: calc(var(--top) + 82px); }
#app.on-page .maplibregl-ctrl-top-left { display: none; }
.maplibregl-ctrl-attrib.maplibregl-compact { margin: 0 !important; opacity: .55; transform: scale(.85); transform-origin: left top; background: rgba(var(--bg-a),.85); color: var(--ink); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--ink); }
.d-label { pointer-events: auto; }
.d-label span {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; color: var(--ink);
  text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 3px var(--bg);
}
/* Pines: el wrapper (marker) no se anima; todo va en .pin */
.pin { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: rgba(var(--bg-a),.8); border: 1.5px dashed var(--red); transition: transform .2s; }
.pin svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pin.v1, .pin.v2 { width: 24px; height: 24px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pin.v1 { background: var(--red); }
.pin.v2 { background: var(--gold); }
.pin.v2 svg { stroke-width: 2.4; }
.pin.sel { transform: scale(1.35); box-shadow: 0 0 0 4px rgba(var(--red-a),.25), 0 2px 6px rgba(0,0,0,.25); }
.pin.enter { animation: pin-in .18s ease-out; }
.pin.sel.enter { animation: none; }
.pin.flash { animation: pin-flash .9s ease-out; }
@keyframes pin-in { from { opacity: 0; transform: scale(.6); } }
@keyframes pin-flash { 0% { box-shadow: 0 0 0 0 rgba(var(--red-a),.5); } 100% { box-shadow: 0 0 0 14px rgba(var(--red-a),0); } }
.me { width: 16px; height: 16px; border-radius: 50%; background: #2F7BF6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,123,246,.2); }

/* Botones flotantes */
.locate {
  position: absolute; z-index: 5; right: 15px; top: calc(var(--top) + 82px);
  width: 44px; height: 44px; border-radius: 14px; background: var(--bg);
  box-shadow: var(--elev-2); display: grid; place-items: center;
}
.locate svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.locate.active { background: #2F7BF6; }
.locate.active svg { stroke: #fff; }
.locate.share { top: calc(var(--top) + 134px); }
.locate.loading svg { animation: pulse 1s infinite; }
.share-menu {
  position: absolute; z-index: 9; right: 15px; top: calc(var(--top) + 186px); width: 230px;
  background: var(--bg); border-radius: 18px; box-shadow: var(--elev-2); padding: 6px; animation: pop .18s var(--ease-out); transform-origin: top right;
}
.share-menu p { font-size: 12px; color: var(--muted); padding: 8px 10px 4px; }
.share-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.share-menu button em { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 4px; }
.share-menu .fmt { width: 20px; height: 20px; fill: none; stroke: var(--red); stroke-width: 1.6; flex: none; }
.share-menu p:not(:first-child) { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.share-menu button:active { background: var(--bg-2); }
@keyframes pop { from { opacity: 0; transform: scale(.95) translateY(-4px); } }

/* ---------- Bottom sheet: min / peek / half / full ---------- */
.sheet {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: var(--tabbar);
  height: calc(100% - var(--top) - 44px - var(--tabbar)); background: var(--bg); border-radius: 28px 28px 0 0;
  box-shadow: var(--elev-sheet);
  transition: transform .42s var(--ease-drawer);
  display: flex; flex-direction: column; will-change: transform; contain: layout paint;
}
.sheet[data-state="min"] { transform: translateY(calc(100% - 28px)); }
.sheet[data-state="peek"] { transform: translateY(calc(100% - 150px)); }
.sheet[data-state="half"] { transform: translateY(42%); }
.sheet[data-state="full"] { transform: translateY(0); }
.handle { width: 100%; height: 28px; flex: none; position: relative; cursor: grab; touch-action: none; }
.sheet.dragging { transition: none; }
.sheet.dragging #sheet-body { overflow: hidden; }
.handle::after { content: ''; position: absolute; left: 50%; top: 10px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--handle); }
#sheet-body { overflow-y: auto; overflow-x: clip; padding: 0 20px 28px; flex: 1; overscroll-behavior: contain; }
.sheet[data-state="half"] #sheet-body { padding-bottom: calc(42vh + 28px); }

/* ---------- Home: buscador, chips, pestañas ---------- */
.search { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border-radius: 12px; padding: 0 12px; height: 40px; margin: 2px 0 10px; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; outline: none; font-size: 16px; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search button { color: var(--muted); font-size: 14px; padding: 4px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px 10px; padding: 0 20px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 36px), transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--bg-2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip b { font-weight: 600; color: var(--muted); margin-left: 2px; }
.chip.on { background: var(--red); color: #fff; }
.chip.on b { color: rgba(255,255,255,.8); }
.chips.seg { margin-top: 12px; }
.tabs { display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tab { padding: 8px 0 10px; font-size: 15px; font-weight: 600; color: var(--muted); position: relative; }
.tab.on { color: var(--ink); }
.tab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--red); }
.tabs-meta { margin-left: auto; font-size: 13px; color: var(--muted); }
.sec-sub { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }

/* Filas de distrito */
.row { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.badge { width: 44px; height: 44px; border-radius: 14px; background: var(--bg-2); display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.row.done .badge { background: var(--red); color: #fff; }
.r-info { flex: 1; min-width: 0; }
.r-info strong { display: block; font-size: 16px; font-weight: 600; }
.r-info small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--red); border-radius: 2px; transition: width .4s; }
.r-count { font-size: 13px; font-weight: 600; color: var(--muted); }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--chev); border-top: 2px solid var(--chev); transform: rotate(45deg); margin-left: 4px; flex: none; }

/* Ítem de lugar (búsqueda, diario) */
.pitem { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pthumb { width: 36px; height: 36px; border-radius: 11px; background: var(--bg-2); display: grid; place-items: center; flex: none; color: var(--ink); }
.pthumb svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pthumb.t-1 svg, .pthumb.t-2 svg { stroke: #fff; stroke-width: 2.6; }
.pthumb.t-1 { background: var(--red); }
.pthumb.t-2 { background: var(--gold); }

/* Logros */
.badges { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.bdg { background: var(--bg-2); border-radius: 16px; padding: 12px; opacity: .75; }
.bdg.on { opacity: 1; background: rgba(var(--red-a),.08); box-shadow: inset 0 0 0 1.5px rgba(var(--red-a),.25); }
.bdg .bi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; background: var(--bg); color: var(--muted); }
.bdg.on .bi { background: var(--red); color: #fff; }
.bdg .bi svg { width: 22px; height: 22px; }
.bdg strong { display: block; font-size: 14px; }
.bdg small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.bdg .bar { margin-top: 8px; }
.bdg .bn { margin-top: 4px; font-weight: 600; }

/* ---------- Detalle distrito ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--red); font-weight: 600; margin: 2px 0 10px; }
.back::before { content: ''; width: 8px; height: 8px; border-left: 2px solid var(--red); border-bottom: 2px solid var(--red); transform: rotate(45deg); }
.d-head h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.d-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.zone { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--red); margin: 18px 0 2px; }
.empty-state { margin-top: 28px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }

.place { display: flex; align-items: center; gap: 12px; position: relative; cursor: pointer;
  transition: background .3s; border-radius: 12px; margin: 0 -10px; padding: 13px 10px; }
.place::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 1px; background: var(--line); }
.place:last-child::after, .place.sel::after { display: none; }
.place.sel { background: rgba(var(--red-a),.06); }
.place.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 25% { background: rgba(var(--red-a),.18); } 100% { background: rgba(var(--red-a),.06); } }
.p-info { flex: 1; min-width: 0; }
.p-info strong { display: block; font-size: 15px; font-weight: 600; }
.p-info small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.p-info small.gps-ok { color: var(--gold); font-weight: 600; }

/* Doble check */
.checks { display: flex; gap: 6px; flex: none; }
.chk { width: 38px; height: 38px; border-radius: 12px; border: 1.5px solid var(--line); display: grid; place-items: center; transition: background-color .2s, border-color .2s; }
.chk svg { width: 18px; height: 18px; fill: none; stroke: var(--chev); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chk.on { background: var(--red); border-color: var(--red); }
.chk.on svg { stroke: #fff; }
.chk.gps.on { background: var(--gold); border-color: var(--gold); }
.chk:disabled { opacity: .35; }
.chk.loading svg { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }

/* ---------- Ficha de lugar ---------- */
.hero { position: relative; height: 170px; border-radius: 18px; overflow: hidden; background: var(--bg-2); margin-bottom: 14px; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-ico { display: none; }
.hero.noimg { display: grid; place-items: center; background: linear-gradient(135deg, rgba(var(--red-a),.14), rgba(var(--red-a),.04)); height: 110px; }
.hero.noimg .hero-ico { display: block; color: var(--red); }
.hero-ico svg { width: 44px; height: 44px; stroke-width: 1.4; }
.pd-head { display: flex; align-items: flex-start; gap: 12px; }
.pd-head > div:first-child { flex: 1; min-width: 0; }
.pd-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.pd-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.stamps { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.stamp { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.stamp svg { width: 22px; height: 22px; padding: 4px; border-radius: 7px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.stamp.s1 svg { background: var(--red); }
.stamp.s2 svg { background: var(--gold); }
.stamp b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.cta { display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border-radius: 14px;
  background: var(--red); color: #fff; font-weight: 600; font-size: 15px; margin: 16px 0 12px; }
.cta svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; }
.info-row { display: flex; gap: 10px; align-items: center; color: var(--ink); background: var(--bg-2); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.desc { font-size: 15px; line-height: 1.5; margin-top: 14px; }
.src { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Sugerencia "estás cerca" ---------- */
.suggest {
  /* Sigue al panel con transform (en la GPU) en vez de animar «bottom», que recalcula el diseño en cada fotograma */
  position: absolute; z-index: 7; left: 12px; right: 12px; bottom: calc(var(--tabbar) + 10px);
  display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 10px; border-radius: 18px;
  background: var(--bg); box-shadow: var(--elev-2), inset 0 0 0 1.5px rgba(var(--red-a),.25);
  transform: translateY(calc(16px - var(--sheet-vis))); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .35s cubic-bezier(.2,.8,.2,1);
}
.suggest.show { transform: translateY(calc(0px - var(--sheet-vis))); opacity: 1; pointer-events: auto; }
.sg-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; }
.sg-ico { width: 34px; height: 34px; border-radius: 11px; background: rgba(var(--red-a),.1); color: var(--red); display: grid; place-items: center; flex: none; }
.sg-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sg-main b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-main small { display: block; font-size: 12px; color: var(--muted); }
.sg-main > span:last-child { min-width: 0; }
.sg-ok { background: var(--gold); color: #fff; font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: 12px; flex: none; }
.sg-no { color: var(--muted); padding: 8px; font-size: 13px; flex: none; }

/* ---------- Toast ---------- */
.toast {
  position: absolute; z-index: 9; left: 50%; top: calc(var(--top) + 84px);
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  background: var(--toast); color: var(--toast-ink); padding: 10px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 500; white-space: nowrap; transition: opacity .2s var(--ease-out), transform .25s var(--ease-out); box-shadow: var(--elev-2); max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }

/* ---------- Debug GPS falso ---------- */
.debug {
  position: absolute; z-index: 5; left: 50px; right: 74px; top: calc(var(--top) + 84px);
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 12px;
  background: rgba(17,17,20,.9); color: #fff;
}
.debug[hidden] { display: none; }
.debug .dot { width: 8px; height: 8px; border-radius: 50%; background: #2F7BF6; box-shadow: 0 0 0 3px rgba(47,123,246,.35); flex: none; }
.debug div { flex: 1; min-width: 0; line-height: 1.15; }
.debug b { display: block; font-size: 12px; }
.debug small { display: block; color: #B5B5BD; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debug button { font-size: 11px; font-weight: 600; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.14); color: #fff; }
.debug.placing { background: rgba(47,123,246,.95); }
.debug.placing #debug-move { background: #fff; color: #2F7BF6; }
.debug.placing small { color: #DCE8FF; }
#app.placing .d-label, #app.placing .maplibregl-marker { pointer-events: none; }
#app.placing #map { cursor: crosshair; }

/* ---------- Menú inferior ---------- */
.tabbar {
  position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; height: var(--tabbar);
  padding-bottom: var(--safe-bot); display: flex; background: var(--bg); border-top: 1px solid var(--line);
}
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--red); }
.tabbar button.on svg { stroke-width: 2.1; }

/* ---------- Páginas Diario / Logros ---------- */
.page { position: absolute; z-index: 7; inset: 0 0 var(--tabbar) 0; background: var(--bg); display: flex; flex-direction: column; animation: page-in .18s ease-out; contain: strict; }
.page[hidden] { display: none; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
.page-head { padding: calc(var(--top) + 8px) 20px 10px; flex: none; }
.page-head h1 { font-size: 32px; }
#page-body { flex: 1; overflow-y: auto; overflow-x: clip; padding: 4px 20px 28px; overscroll-behavior: contain; }
.kpis { display: flex; gap: 10px; margin: 4px 0 6px; }
.kpis .stat { flex: 1; background: var(--bg-2); border-radius: 14px; padding: 12px; }
.kpis .stat b { display: block; font-size: 22px; }
.kpis .stat b span { font-size: 14px; color: var(--muted); font-weight: 600; }
.kpis .stat small { font-size: 12px; color: var(--muted); }
.kpis .stat.gold b { color: var(--gold); }

/* Iconos vectoriales */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-s { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; }
.chip.on .ico { stroke: #fff; }
.info-row .ico { color: var(--muted); width: 18px; height: 18px; }

/* Scrollbar integrada: fina, redondeada, sin carril; más visible al pasar el ratón */
#sheet-body, #page-body { scrollbar-width: thin; scrollbar-color: var(--handle) transparent; }
#sheet-body::-webkit-scrollbar, #page-body::-webkit-scrollbar { width: 10px; }
#sheet-body::-webkit-scrollbar-track, #page-body::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
#sheet-body::-webkit-scrollbar-thumb, #page-body::-webkit-scrollbar-thumb {
  background: var(--handle); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box;
}
#sheet-body::-webkit-scrollbar-thumb:hover, #page-body::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }

/* ---------- Logros: sellos de pasaporte ---------- */
.pp-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px dashed var(--line); padding-bottom: 8px; margin: 2px 0 8px; }
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; }
.pp { text-align: center; padding-bottom: 8px; }
.pp-svg { width: 132px; height: 132px; display: block; margin: 0 auto; }
.pp strong { display: block; font-size: 13px; font-weight: 600; margin-top: -2px; }
.pp small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; line-height: 1.3; padding: 0 6px; }
.pp:not(.on) strong { color: var(--muted); }
.pp.on .pp-svg { animation: stamp-in .35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes stamp-in { from { transform: scale(1.25); opacity: 0; } }

/* ---------- Cuenta ---------- */
.acct { display: flex; align-items: center; gap: 12px; background: var(--bg-2); border-radius: 22px; padding: 12px; margin: 2px 0 14px; flex-wrap: wrap; }
.acct.off { font-size: 12px; color: var(--muted); }
.acct-txt { flex: 1; min-width: 160px; }
.acct-txt b { display: block; font-size: 15px; }
.acct-txt small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.acct:not(.in) .gbtn { width: 100%; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; padding: 0 16px; border-radius: 10px;
  background: #fff; color: #1F1F1F; font-weight: 600; font-size: 15px; border: 1px solid #DADCE0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; }
.sync.ok::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #1BA35B; margin-right: 6px; vertical-align: 1px; }
.sync.syncing { color: var(--muted); }
.sync.error { color: var(--red); cursor: pointer; text-decoration: underline; }
.link { color: var(--red); font-weight: 600; font-size: 14px; padding: 6px; }

/* Rendimiento: no pintar filas/sellos fuera de pantalla */
.row, .pitem, .place { content-visibility: auto; contain-intrinsic-height: auto 64px; }
.pp { content-visibility: auto; contain-intrinsic-height: auto 190px; min-width: 0; }
.pp-svg { width: 132px; height: 132px; }

/* ================= Pulido visual ================= */
/* Tipografía */
h1, h2, .pd-head h2, .d-head h2 { text-wrap: balance; }
.desc, .p-info small, .acct-txt small, .pp small, .sg-main small { text-wrap: pretty; }
.ring span, .r-count, .chip b, .kpis b, .pp-head, .tabs-meta, .sec-title span, .stat b, .bn, #debug-pos { font-variant-numeric: tabular-nums; }

/* Imágenes: contorno sutil para que no se fundan con el fondo */
.hero img { outline: 1px solid rgba(0,0,0,.1); outline-offset: -1px; border-radius: inherit; }
@media (prefers-color-scheme: dark) { .hero img { outline-color: rgba(255,255,255,.1); } }

/* Toque: sin zoom por doble toque y respuesta inmediata */
button, a, input, .place, .row, .pitem { touch-action: manipulation; }

/* Feedback al pulsar (escala sutil, transición interrumpible) */
.chk, .row, .pitem, .chip, .tab, .cta, .gbtn, .locate, .tabbar button, .back, .sg-ok, .share-menu button, .link, .search button {
  transition-property: transform, background-color, border-color, color, opacity; transition-duration: .14s; transition-timing-function: var(--ease-out);
}
.chk:active:not(:disabled), .chip:active, .cta:active, .gbtn:active, .locate:active, .sg-ok:active, .tabbar button:active { transform: scale(.96); }
.row:active, .pitem:active, .place:active { background: var(--bg-2); }
.back:active, .link:active { opacity: .6; }

/* Foco visible para teclado / switch control */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.search input:focus-visible { box-shadow: none; }
.search:focus-within { box-shadow: var(--focus); }

/* Áreas táctiles ≥ 44 px sin cambiar el diseño */
.chk { width: 40px; height: 40px; position: relative; }
.back::after, .link::after, .sg-no::after, .search button::after, .debug button::after { content: ''; position: absolute; inset: -6px; }
.chk::before { content: ''; position: absolute; inset: -6px -2px; }   /* 44×52 sin solaparse con el check vecino (gap 6 px) */
.back, .link, .sg-no, .search button { position: relative; }
.back { min-height: 32px; }
.search button, .sg-no { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; }
.icon-x { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.debug button { position: relative; }

/* Movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Sello de confirmación GPS ---------- */
.gps-stamp { position: absolute; z-index: 20; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; pointer-events: none;
  animation: stamp-out .4s var(--ease-out) 1.7s forwards; }
.gps-stamp::before { content: ''; position: absolute; inset: 0; background: rgba(var(--bg-a),.55); animation: veil-in .2s var(--ease-out) both; }
.gps-stamp img { position: relative; width: 220px; height: 220px; transform: rotate(var(--rot)); animation: stamp-hit .42s cubic-bezier(.2, 1.4, .4, 1) both; }
.gps-stamp p { position: relative; font-size: 15px; font-weight: 700; color: var(--ink); max-width: 260px; text-align: center; text-wrap: balance;
  animation: veil-in .3s var(--ease-out) .25s both; }
@keyframes stamp-hit { 0% { opacity: 0; transform: rotate(var(--rot)) scale(1.6); } 55% { opacity: 1; transform: rotate(var(--rot)) scale(.94); } 100% { opacity: 1; transform: rotate(var(--rot)) scale(1); } }
@keyframes veil-in { from { opacity: 0; } }
@keyframes stamp-out { to { opacity: 0; transform: translateY(-8px); } }
#app.on-page .suggest { opacity: 0; pointer-events: none; }

/* Diario plegable por días */
.day { border-bottom: 1px solid var(--line); }
.day-h { width: 100%; display: flex; align-items: center; gap: 8px; padding: 14px 0 10px; text-align: left; }
.day-h span:first-child { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
.day-h small { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Desplegable: cerrado › (a la derecha), abierto ⌄ (hacia abajo) */
.day-h .chev { transform: rotate(45deg); transition: transform .2s var(--ease-out); margin: 0 6px 0 6px; }
.day.open .day-h .chev { transform: rotate(135deg); margin-bottom: 3px; }
.day-b .pitem:last-child { border-bottom: 0; }
.src { text-decoration: none; }

/* ---------- Mapa de calor: % en las etiquetas y leyenda ---------- */
.d-label em { display: block; font-style: normal; font-size: 10px; font-weight: 800; color: var(--red); text-align: center; margin-top: -1px;
  text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 3px var(--bg); font-variant-numeric: tabular-nums; }
.heat-legend { position: absolute; z-index: 4; left: 15px; top: calc(var(--top) + 82px); display: grid; grid-template-columns: auto auto; gap: 2px 0;
  padding: 7px 10px 6px; border-radius: 12px; background: rgba(var(--bg-a),.9); box-shadow: var(--elev-1); font-size: 10px; color: var(--muted); pointer-events: none; }
.heat-legend[hidden], #app.on-page .heat-legend { display: none; }
.heat-legend span { grid-column: 1 / -1; font-weight: 700; color: var(--ink); }
.heat-legend i { grid-column: 1 / -1; width: 96px; height: 6px; border-radius: 3px; margin: 3px 0 1px;
  background: linear-gradient(90deg, rgba(var(--red-a),.1), rgba(var(--red-a),.65)); }
.heat-legend small:last-child { text-align: right; }

/* ---------- Barrios en el distrito ---------- */
.barrios { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 4px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.4; margin: 0 0 4px; }
.b-head { display: flex; align-items: baseline; justify-content: space-between; }
.b-head span { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.b-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.bchip { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1.5px dashed rgba(var(--red-a),.45); font-size: 13px; font-weight: 500; color: var(--ink); background: var(--bg); }
.bchip svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.bchip.l1 { background: var(--red); border: 1.5px solid var(--red); color: #fff; }
.bchip.l2 { background: var(--gold); border: 1.5px solid var(--gold); color: #fff; }
.bchip:active { transform: scale(.96); }
.pitem.static { cursor: default; }

/* ---------- Logros: nivel ---------- */
.lvl-card { background: var(--bg-2); border-radius: 22px; padding: 16px; margin: 2px 0 18px; }
.lvl-top { display: flex; align-items: center; gap: 12px; }
.lvl-n { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--red); color: #fff; font-size: 20px; font-weight: 800; }
.lvl-top small { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lvl-top h2 { font-size: 24px; line-height: 1.1; }
.lvl-pts { margin-left: auto; font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lvl-pts span { font-size: 13px; color: var(--muted); font-weight: 600; }
.lvl-card .bar { height: 8px; border-radius: 4px; margin-top: 14px; background: var(--line); }
.lvl-card .bar i { border-radius: 4px; }
.lvl-next { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ---------- Logros: progreso por tipo ---------- */
.tp-list { margin: 0 0 18px; }
.tp-row { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr) 72px 48px; align-items: center; gap: 10px; padding: 9px 0; text-align: left; border-bottom: 1px solid var(--line); min-height: 44px; }
.tp-row .ico { color: var(--muted); }
.tp-row.done .ico { color: var(--red); }
.tp-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-row .bar { margin: 0; }
.tp-n { font-size: 13px; font-weight: 600; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tp-row.done .tp-n { color: var(--red); }
.tp-row:active { background: var(--bg-2); }

/* ---------- Diario: idioma y 4 KPIs ---------- */
.kpis .stat { min-width: 0; padding: 10px; }
.kpis .stat b { font-size: 20px; }
.kpis .stat small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-row { display: flex; align-items: center; gap: 8px; margin-top: 22px; font-size: 14px; color: var(--muted); }
.lang-row .ico { width: 18px; height: 18px; }
.lang-seg { margin-left: auto; display: flex; gap: 6px; }
.lang-seg .chip { min-height: 36px; }

/* ---------- Avisos desde arriba (logros, nivel) ---------- */
.notif { position: absolute; z-index: 30; left: 10px; right: 10px; top: calc(var(--top) + 4px); display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 20px; background: rgba(var(--bg-a),.94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--elev-2), 0 0 0 1px var(--line); cursor: pointer;
  transform: translateY(calc(-100% - var(--top) - 12px)); transition: transform .42s var(--ease-drawer); }
.notif.in { transform: translateY(0); }
.nt-ico { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--red); color: #fff; }
.notif.gold .nt-ico { background: var(--gold); }
.nt-ico .ico { width: 22px; height: 22px; stroke-width: 2; }
.nt-txt { min-width: 0; display: flex; flex-direction: column; }
.nt-txt small { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.notif.gold .nt-txt small { color: var(--gold); }
.nt-txt b { font-size: 15px; line-height: 1.25; }
.nt-txt span { font-size: 13px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .notif { transition: opacity .2s; transform: none; opacity: 0; } .notif.in { opacity: 1; } }

/* ---------- Aviso con acción (Deshacer) ---------- */
.toast.act { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 6px 6px 6px 16px; }
.toast button { color: #FF8A92; font-weight: 700; font-size: 14px; padding: 8px 10px; min-height: 36px; border-radius: 10px; }
.toast button:active { background: rgba(255,255,255,.12); }
@media (prefers-color-scheme: dark) { .toast button { color: var(--red); } }

/* ---------- Listas: favoritos / quiero ir ---------- */
.lists { display: flex; gap: 8px; margin: 14px 0 4px; }
.lst { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 12px;
  background: var(--bg-2); font-size: 14px; font-weight: 600; color: var(--ink); }
.lst .ico { width: 18px; height: 18px; color: var(--muted); }
.lst.f.on { background: rgba(var(--red-a),.1); color: var(--red); }
.lst.f.on .ico { color: var(--red); fill: var(--red); }
.lst.w.on { background: rgba(47,123,246,.12); color: #2F7BF6; }
.lst.w.on .ico { color: #2F7BF6; fill: #2F7BF6; }
.lst:active { transform: scale(.97); }
.chip.list .ico { color: var(--red); }
.chip.list[data-t="__want"] .ico { color: #2F7BF6; }
.chip.list.on .ico { color: #fff; }
.ico.mk { width: 13px; height: 13px; margin-left: 5px; vertical-align: -1px; stroke-width: 2.2; }
.ico.mk.fav { color: var(--red); fill: var(--red); }
.ico.mk.want { color: #2F7BF6; fill: #2F7BF6; }

/* ---------- Pines agrupados ---------- */
.cluster { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: conic-gradient(var(--red) var(--p), rgba(var(--red-a),.18) 0); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.cluster span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg);
  font-size: 12px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.cluster.all span { background: var(--red); color: #fff; }
.cluster.all-gps { background: var(--gold); }
.cluster.all-gps span { background: var(--gold); color: #fff; }
.cluster:active { transform: scale(.94); }

/* ---------- Cómo llegar (a pie / transporte) y metro más cercano ---------- */
.ctas { display: flex; gap: 8px; }
.ctas .cta { flex: 1.4; }
.ctas .cta.alt { flex: 1; background: var(--bg-2); color: var(--ink); }
.ctas .cta.alt svg { stroke: var(--ink); fill: none; }
.info-row.metro { align-items: center; }
.info-row.metro p { line-height: 1.5; }
.info-row.metro small { color: var(--muted); font-size: 12px; }
.m-logo { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #E0292F; color: #fff;
  font-size: 12px; font-weight: 800; box-shadow: 0 0 0 2px #fff inset; border: 1.5px solid #E0292F; }
.mline { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 3px; border-radius: 10px;
  font-style: normal; font-size: 11px; font-weight: 800; vertical-align: 1px; }
.mline.r { box-shadow: inset 0 0 0 1.5px #005AA9; color: #005AA9 !important; }
.info-row + .info-row { margin-top: 8px; }

/* ---------- Cerca de ti / orden del distrito / siguiente pendiente ---------- */
/* Tarjeta aparte: fondo suave, borde y esquinas, para que no se confunda con la lista de distritos */
.near { margin: 2px 0 18px; padding: 10px 14px 4px; border-radius: 18px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.near .b-head .zone { margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.near .pitem { border-bottom-color: var(--line); }
.near .pitem:last-child { border-bottom: 0; }
.near .pthumb.t-0 { background: var(--bg); }
.near-cta { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; margin: 2px 0 12px; border-radius: 14px;
  background: rgba(var(--red-a),.07); color: var(--red); font-size: 14px; font-weight: 600; text-align: left; }
.near-cta .ico { width: 20px; height: 20px; }
.near-cta.loading .ico { animation: pulse 1s infinite; }
.opt-row { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; font-size: 13px; }
.opt-row::-webkit-scrollbar { display: none; }
.opt-row + .opt-row { margin-top: 2px; }
.chips.seg + .opt-row, .d-head + .opt-row { margin-top: 10px; }
.opt-ico { width: 26px; flex: none; color: var(--muted); display: grid; place-items: center; }
.opt-ico .ico { width: 16px; height: 16px; }
.opt-row button { flex: none; padding: 6px 9px; min-height: 34px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.opt-row button b { font-weight: 600; opacity: .7; margin-left: 2px; }
.opt-row button.on { color: var(--red); background: rgba(var(--red-a),.09); }
.opt-row button:active { transform: scale(.96); }
.next { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.next-h { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; }
.next-h .ico { color: var(--muted); }
.next-row { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px; border-radius: 16px;
  background: var(--bg); border: 1.5px dashed rgba(var(--red-a),.45); }
.next-ico { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: rgba(var(--red-a),.08); color: var(--red); }
.next-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.next-txt b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-txt small { font-size: 12px; color: var(--muted); }
.next-go { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--red); }
.next-go svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.next-row:active { transform: scale(.98); }
.share-menu .ico { color: var(--red); }
.lvl-rank { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; font-weight: 600; }
.lvl-rank .ico { width: 18px; height: 18px; color: var(--red); }

/* ---------- Onboarding (propuesta A · minimal) ---------- */
#onboard { position: absolute; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; animation: ob-in .3s var(--ease-out); }
#onboard.out { opacity: 0; transition: opacity .3s; pointer-events: none; }
@keyframes ob-in { from { opacity: 0; } }
.ob-skip { position: absolute; z-index: 2; right: 14px; top: calc(var(--top) + 8px); padding: 10px 12px; min-height: 44px; color: var(--muted); font-size: 15px; font-weight: 600; }
.ob-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.ob-track::-webkit-scrollbar { display: none; }
.ob-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(var(--top) + 70px) 28px 0; }
.ob-ill { flex: 1; width: 100%; display: grid; place-items: center; min-height: 0; position: relative; }
.ob-ill > * { grid-area: 1 / 1; }
/* Mancha de color suave detrás de cada ilustración */
.ob-blob { width: 270px; height: 270px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--red-a),.10), rgba(var(--red-a),0) 68%); }
.ob-slide:nth-child(3) .ob-blob { background: radial-gradient(circle, rgba(201,162,39,.16), rgba(201,162,39,0) 68%); }
.ob-map { width: min(280px, 72vw); height: auto; max-height: 100%; position: relative; }
.ob-pinwrap, .ob-stampwrap { position: relative; display: grid; place-items: center; }
.ob-pin { width: 150px; overflow: visible; }
.ob-gps { width: min(300px, 78vw); overflow: visible; }
.ob-stamp { width: 210px; }
/* Paso 2: chip «+10» */
.ob-chip { position: absolute; right: -34px; top: 18px; display: flex; align-items: center; gap: 5px; padding: 7px 11px; border-radius: 999px;
  background: var(--bg); box-shadow: var(--elev-2); color: var(--red); font-size: 14px; }
.ob-chip .ico { width: 16px; height: 16px; }
/* Paso 4: tarjeta de nivel */
.ob-level { position: absolute; bottom: -38px; display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 9px; border-radius: 16px;
  background: var(--bg); box-shadow: var(--elev-2); text-align: left; min-width: 190px; }
.ob-level > span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font-weight: 800; }
.ob-level small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ob-level b { font-size: 15px; }
.ob-level i { position: absolute; left: 53px; right: 14px; bottom: 7px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.ob-level em { display: block; height: 100%; width: 70%; background: var(--red); border-radius: 2px; }
.ob-me { transform: translate(176px, 168px); }

/* ---- Animaciones (se relanzan al llegar a cada paso: .ob-slide.on) ---- */
.ob-slide h1, .ob-slide p { opacity: 0; transform: translateY(10px); }
.ob-slide.on h1 { animation: ob-up .5s var(--ease-out) .15s both; }
.ob-slide.on p { animation: ob-up .5s var(--ease-out) .25s both; }
@keyframes ob-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ob-slide.on .ob-blob { animation: ob-blob 4s ease-in-out infinite alternate; }
@keyframes ob-blob { from { transform: scale(.92); } to { transform: scale(1.08); } }
/* 1: distritos aparecen del centro hacia fuera */
.ob-map path { opacity: 0; transform-box: fill-box; transform-origin: center; }
.ob-slide.on .ob-map path { animation: ob-dist .45s var(--ease-out) calc(var(--n) * 45ms + .1s) both; }
@keyframes ob-dist { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
/* 2: el pin cae con rebote, se dibuja el check y salta el +10 */
.ob-drop { transform-box: fill-box; transform-origin: 50% 100%; }
.ob-slide.on .ob-drop { animation: ob-drop .7s cubic-bezier(.3,1.5,.5,1) .1s both; }
@keyframes ob-drop { from { transform: translateY(-70px) scale(.9); opacity: 0; } 60% { opacity: 1; } to { transform: none; } }
.ob-shadow { transform-box: fill-box; transform-origin: center; }
.ob-slide.on .ob-shadow { animation: ob-shadow .7s ease-out .1s both; }
@keyframes ob-shadow { from { transform: scale(.3); opacity: 0; } }
.ob-draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.ob-slide.on .ob-pin .ob-draw { animation: ob-draw .35s ease-out .7s forwards; }
@keyframes ob-draw { to { stroke-dashoffset: 0; } }
.ob-chip { opacity: 0; }
.ob-slide.on .ob-chip { animation: ob-pop .45s cubic-bezier(.3,1.6,.5,1) 1s both; }
@keyframes ob-pop { from { opacity: 0; transform: scale(.4) translateY(10px); } to { opacity: 1; transform: none; } }
/* 3: el punto azul entra en el área, pulso dorado, el pin salta y se dibuja el doble check */
.ob-ring { transform-box: fill-box; transform-origin: center; }
.ob-slide.on .ob-ring { animation: ob-spin 24s linear infinite; }
@keyframes ob-spin { to { transform: rotate(360deg); } }
.ob-slide.on .ob-me { animation: ob-me 1s var(--ease-out) .1s both; }
@keyframes ob-me { from { transform: translate(250px, 220px); opacity: 0; } 30% { opacity: 1; } to { transform: translate(176px, 168px); } }
.ob-pulse { opacity: 0; transform-box: fill-box; transform-origin: center; }
.ob-slide.on .ob-pulse { animation: ob-pulse 1.6s ease-out 1.1s 2; }
@keyframes ob-pulse { from { opacity: .7; transform: scale(.85); } to { opacity: 0; transform: scale(1.15); } }
.ob-gold { transform-box: fill-box; transform-origin: 50% 100%; opacity: 0; }
.ob-slide.on .ob-gold { animation: ob-gold .55s cubic-bezier(.3,1.6,.5,1) 1s both; }
@keyframes ob-gold { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
.ob-slide.on .ob-gold .d1 { animation: ob-draw .25s ease-out 1.45s forwards; }
.ob-slide.on .ob-gold .d2 { animation: ob-draw .3s ease-out 1.65s forwards; }
/* 4: golpe de sello y la barra de nivel sube */
.ob-stamp { opacity: 0; }
.ob-slide.on .ob-stamp { animation: ob-stamp .5s cubic-bezier(.2,1.4,.4,1) .15s both; }
@keyframes ob-stamp { from { opacity: 0; transform: scale(1.7) rotate(14deg); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }
.ob-level { opacity: 0; }
.ob-slide.on .ob-level { animation: ob-up .45s var(--ease-out) .65s both; }
.ob-slide.on .ob-level em { animation: ob-bar 1s var(--ease-out) .9s both; }
@keyframes ob-bar { from { width: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ob-slide *, .ob-slide h1, .ob-slide p { animation: none !important; opacity: 1 !important; transform: none; stroke-dashoffset: 0 !important; }
  .ob-me { transform: translate(176px, 168px) !important; }
}
.ob-slide h1 { font-size: 27px; white-space: nowrap; letter-spacing: -.02em; line-height: 1.1; margin-top: 18px; }
.ob-slide p { font-size: 16px; line-height: 1.45; color: var(--muted); margin-top: 10px; max-width: 320px; min-height: 46px; }
.ob-slide:nth-child(4) h1 { margin-top: 56px; }
.ob-foot { flex: none; padding: 26px 28px calc(var(--safe-bot) + 18px); }
.ob-dots { display: flex; gap: 7px; justify-content: center; margin-bottom: 24px; }
.ob-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--line); transition: width .25s var(--ease-out), background-color .25s; }
.ob-dots i.on { width: 22px; background: var(--red); }
.ob-btn { width: 100%; height: 54px; border-radius: 16px; background: var(--red); color: #fff; font-size: 17px; font-weight: 600; }
.ob-btn:active { transform: scale(.98); }
.ob-later { display: block; width: 100%; min-height: 44px; margin-top: 6px; color: var(--muted); font-size: 15px; font-weight: 600; }
.ob-again { width: 100%; display: flex; align-items: center; gap: 8px; margin-top: 22px; min-height: 44px; font-size: 14px; color: var(--muted); }
.ob-again .ico { width: 18px; height: 18px; }
@media (prefers-reduced-motion: reduce) { #onboard { animation: none; } }
.gbtn-gis { width: 100%; min-height: 44px; display: flex; justify-content: center; }
.ob-privacy { display: block; text-align: center; font-size: 12px; color: var(--muted); margin-top: 2px; }
