/* Cerquita — estilos */
:root {
  --bg: #fff7f3;
  --surface: rgba(255, 252, 250, .88);
  --card: #ffffff;
  --ink: #241a26;
  --muted: #86788a;
  --line: rgba(36, 26, 38, .09);
  --chip: rgba(255, 255, 255, .9);
  --accent: #ff4d6d;
  --accent-2: #ff8e53;
  --accent-soft: rgba(255, 77, 109, .12);
  --grad: linear-gradient(135deg, #ff4d6d 0%, #ff8e53 100%);
  --shadow: 0 12px 32px rgba(70, 20, 45, .16);
  --ok: #1fa971;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #15131a;
  --surface: rgba(28, 25, 34, .86);
  --card: #201d27;
  --ink: #f7eff4;
  --muted: #a89cae;
  --line: rgba(255, 255, 255, .09);
  --chip: rgba(44, 40, 52, .9);
  --accent-soft: rgba(255, 77, 109, .2);
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic { width: 22px; height: 22px; flex: none; }
.glass { background: var(--surface); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--line); box-shadow: var(--shadow); }

/* ── Carga ── */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: var(--bg); z-index: 50; }
.boot-logo { width: 84px; animation: bob 1.6s ease-in-out infinite; }
.boot p { margin: 0; font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* ── Bienvenida ── */
.welcome { position: fixed; inset: 0; overflow-y: auto; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(60% 45% at 85% 8%, rgba(255, 142, 83, .35), transparent 70%),
    radial-gradient(55% 40% at 8% 92%, rgba(255, 77, 109, .3), transparent 70%),
    var(--bg); }
.w-card { width: min(420px, 100%); display: grid; gap: 14px; text-align: center; animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.w-card.left { text-align: left; }
.w-logo { width: 96px; margin: 0 auto 4px; filter: drop-shadow(0 14px 22px rgba(255, 77, 109, .35)); }
.w-card h1 { margin: 0; font-size: 40px; letter-spacing: -.03em; }
.w-card h2 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.lead { margin: 0 0 6px; color: var(--muted); font-size: 17px; line-height: 1.45; }
.fine { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.note { margin: 0; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); font-size: 14px; line-height: 1.4; text-align: left; }
.note b { display: block; margin-bottom: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 18px; border: 0; font-weight: 700; font-size: 16px; text-decoration: none; transition: transform .12s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 10px 22px rgba(255, 77, 109, .32); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: transparent; color: #d92d4b; border: 1px solid rgba(217, 45, 75, .35); }
.btn.small { min-height: 40px; padding: 0 14px; border-radius: 14px; font-size: 14px; }
.btn.block { width: 100%; }
.back { justify-self: start; background: none; border: 0; padding: 6px 0; color: var(--muted); font-weight: 700; }

.field { display: grid; gap: 6px; text-align: left; font-size: 13px; font-weight: 700; color: var(--muted); }
.input { width: 100%; min-height: 52px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); font-size: 17px; font-weight: 600; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.code { text-align: center; letter-spacing: .28em; font-size: 24px; font-weight: 800; text-transform: uppercase; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border-radius: 14px; border: 2px solid transparent; background: var(--card); font-size: 22px; padding: 0; }
.emoji-grid button.on { border-color: var(--accent); background: var(--accent-soft); }
.swatches { display: grid; grid-template-columns: repeat(8, 32px); justify-content: space-between; padding: 3px; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--bg); background: var(--c); box-shadow: 0 0 0 2px transparent; padding: 0; }
.swatches button.on { box-shadow: 0 0 0 3px var(--c); }

/* ── Avatar ── */
.av { --c: var(--accent); width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 23px; background: color-mix(in srgb, var(--c) 16%, var(--card)); border: 3px solid var(--c); overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.big { width: 76px; height: 76px; font-size: 40px; border-width: 4px; }
.av.sm { width: 34px; height: 34px; font-size: 17px; border-width: 2px; }

/* ── Pantalla principal ── */
.main { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }
#bursts { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.top { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; z-index: 6; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px 0 10px; border-radius: 999px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand-logo { width: 26px; display: grid; }
.top-actions { display: flex; gap: 8px; }
.round { position: relative; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; padding: 0; transition: transform .12s; }
.round:active { transform: scale(.92); }
.round .dot { position: absolute; top: 9px; right: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.fabs { position: absolute; right: 12px; bottom: calc(196px + env(safe-area-inset-bottom)); display: grid; gap: 8px; z-index: 6; }

.dock { position: absolute; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 28px; padding: 10px 12px 12px; z-index: 6; }
.people { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px; align-items: center; }
.person { display: flex; gap: 10px; align-items: center; min-width: 0; padding: 6px; border-radius: 18px; background: none; border: 0; text-align: left; }
.person:active { background: var(--accent-soft); }
.person.right { flex-direction: row-reverse; text-align: right; }
.person .meta { min-width: 0; display: grid; gap: 2px; }
.person b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { font-size: 12px; line-height: 1.25; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.person small.live { color: var(--ok); font-weight: 700; }
.between { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: #fff; background: var(--grad); padding: 7px 12px; border-radius: 999px; white-space: nowrap; box-shadow: 0 6px 14px rgba(255, 77, 109, .35); }
.quick { display: flex; gap: 8px; overflow-x: auto; margin: 8px -12px 0; padding: 2px 12px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip); font-weight: 700; font-size: 14px; transition: transform .12s; }
.chip:active { transform: scale(.93); }
.chip span { font-size: 18px; }
.chip.more { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ── Marcadores ── */
.pin { --c: var(--accent); position: relative; display: grid; justify-items: center; cursor: pointer; filter: drop-shadow(0 6px 10px rgba(40, 10, 30, .3)); z-index: 2; }
.pin.me { z-index: 1; }
.pin-body { position: relative; z-index: 1; width: 54px; height: 54px; border-radius: 50%; background: #fff; border: 4px solid var(--c); display: grid; place-items: center; font-size: 28px; overflow: hidden; }
.pin-body img { width: 100%; height: 100%; object-fit: cover; }
.pin::after { content: ""; width: 14px; height: 14px; margin-top: -9px; background: var(--c); transform: rotate(45deg); border-radius: 3px; }
.pin-halo { position: absolute; top: 0; left: 50%; width: 54px; height: 54px; margin-left: -27px; border-radius: 50%; background: var(--c); opacity: .4; animation: halo 2.2s ease-out infinite; }
.pin.stale .pin-halo { display: none; }
.pin.stale .pin-body { filter: grayscale(.75); }
.pin-name { position: absolute; top: 100%; margin-top: 5px; padding: 4px 9px; border-radius: 999px; background: var(--card); color: var(--ink); font: 800 12px/1 var(--font); white-space: nowrap; }
@keyframes halo { from { transform: scale(1); opacity: .45; } to { transform: scale(2.1); opacity: 0; } }

.place-pin { display: grid; justify-items: center; gap: 3px; cursor: pointer; }
.place-pin span { width: 34px; height: 34px; border-radius: 12px; background: var(--card); border: 2px solid var(--accent); display: grid; place-items: center; font-size: 18px; box-shadow: 0 4px 10px rgba(40, 10, 30, .2); }
.place-pin em { font: 700 11px/1 var(--font); font-style: normal; color: var(--ink); background: var(--card); padding: 3px 7px; border-radius: 999px; opacity: .92; }

.burst { position: absolute; width: 0; height: 0; }
.burst-main { position: absolute; left: 0; bottom: 0; transform-origin: center bottom; font-size: 68px; line-height: 1; margin-left: -34px; animation: burst-main 2.8s cubic-bezier(.2, .9, .3, 1.1) forwards; }
.burst-text { position: absolute; left: 0; bottom: 78px; transform: translateX(-50%); padding: 7px 12px; border-radius: 999px; background: var(--card); color: var(--ink); font: 800 14px/1 var(--font); white-space: nowrap; box-shadow: var(--shadow); animation: burst-main 2.8s cubic-bezier(.2, .9, .3, 1.1) forwards; }
.burst i { position: absolute; left: -11px; bottom: 30px; font-style: normal; font-size: 22px; animation: burst-p 1.5s ease-out forwards; }
@keyframes burst-main { 0% { opacity: 0; translate: 0 20px; scale: .2; } 14% { opacity: 1; translate: 0 -8px; scale: 1.25; } 28% { translate: 0 -12px; scale: 1; } 78% { opacity: 1; translate: 0 -46px; } 100% { opacity: 0; translate: 0 -96px; scale: .9; } }
@keyframes burst-p { from { opacity: 1; translate: 0 0; scale: .4; } to { opacity: 0; translate: var(--dx) var(--dy); scale: 1; rotate: 50deg; } }

/* ── Elegir lugar en el mapa ── */
.crosshair { display: none; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; z-index: 5; pointer-events: none; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: var(--accent); border-radius: 2px; }
.crosshair::before { left: 14px; top: 0; width: 3px; height: 30px; }
.crosshair::after { top: 14px; left: 0; height: 3px; width: 30px; }
.main.picking .crosshair { display: block; }
.main.picking .dock, .main.picking .fabs, .main.picking .top-actions { display: none; }
.picker { position: absolute; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 28px; padding: 16px; z-index: 7; display: grid; gap: 10px; }
.picker h3 { margin: 0; font-size: 18px; }
.picker .hint { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.row-emojis { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.row-emojis button { flex: none; width: 42px; height: 42px; border-radius: 14px; border: 2px solid transparent; background: var(--card); font-size: 20px; padding: 0; }
.row-emojis button.on { border-color: var(--accent); background: var(--accent-soft); }
.range { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.range input { width: 100%; accent-color: var(--accent); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── Hojas ── */
.backdrop { position: fixed; inset: 0; background: rgba(24, 10, 22, .4); opacity: 0; transition: opacity .25s; z-index: 20; }
.backdrop.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 90dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: 28px 28px 0 0; box-shadow: 0 -10px 40px rgba(30, 10, 25, .25); transform: translateY(102%); transition: transform .34s cubic-bezier(.2, .8, .2, 1); z-index: 21; padding-bottom: env(safe-area-inset-bottom); }
.sheet.open { transform: none; }
.sheet::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 6px 20px; flex: none; }
.sheet-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.sheet-close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; color: var(--muted); }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; padding: 4px 18px 24px; display: grid; gap: 14px; align-content: start; grid-auto-rows: max-content; }
.sheet-body > p { margin: 0; color: var(--muted); line-height: 1.45; font-size: 15px; }

.group { background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.group-title { margin: 6px 4px -6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row b { font-size: 15px; }
.row small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.row .emo { width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 19px; color: var(--accent); }
.row .ic.end { color: var(--muted); width: 18px; height: 18px; }
button.row:active { background: var(--accent-soft); }
.switch { position: relative; width: 50px; height: 30px; flex: none; border-radius: 999px; border: 0; background: var(--line); transition: background .2s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 14px; background: var(--line); }
.seg button { height: 36px; border: 0; border-radius: 11px; background: none; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .1); }

.profile-top { display: flex; gap: 14px; align-items: center; }
.profile-top .grow { flex: 1; display: grid; gap: 8px; }
.code-box { display: grid; gap: 10px; justify-items: center; padding: 20px; border-radius: 22px; background: var(--card); border: 1px dashed var(--accent); }
.code-box strong { font-size: 34px; letter-spacing: .14em; font-weight: 800; }
.steps { display: grid; gap: 10px; counter-reset: s; }
.step { position: relative; padding: 14px 14px 14px 52px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; display: grid; gap: 8px; }
.step::before { counter-increment: s; content: counter(s); position: absolute; left: 14px; top: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 800; font-size: 14px; display: grid; place-items: center; }
.step b { font-size: 15px; }
.step small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.step .btns { display: flex; flex-wrap: wrap; gap: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; background: var(--bg); padding: 8px 10px; border-radius: 10px; user-select: all; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty span { font-size: 40px; }
.day { margin: 4px 4px -6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ── Avisos ── */
#toasts { position: fixed; top: calc(66px + env(safe-area-inset-top)); left: 0; right: 0; display: grid; justify-items: center; gap: 8px; z-index: 40; pointer-events: none; padding: 0 14px; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 12px 16px; border-radius: 18px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 14px; box-shadow: var(--shadow); animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2) both; }
.toast b { font-size: 20px; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: all .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(.94); } }

.maplibregl-ctrl-bottom-left { bottom: calc(176px + env(safe-area-inset-bottom)); }
.maplibregl-ctrl-attrib { font-size: 10px; opacity: .8; }

@media (min-width: 720px) {
  .dock, .picker { left: 50%; right: auto; width: 460px; margin-left: -230px; }
  .sheet { left: 50%; right: auto; width: 460px; margin-left: -230px; border-radius: 28px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
