/* ¡Bajando! — estilos. Waze, pero verde de montaña + estética topográfica. */

:root {
  /* Marca */
  --green: #2BD46B;
  --green-600: #19B35A;
  --green-neon: #39FF7A;
  --forest: #0E2A1B;
  --forest-2: #143826;
  --forest-3: #1C4A32;
  --cream: #F4EBD0;
  --cream-dim: #CFC7AE;
  --danger: #FF7A1A;
  --danger-deep: #E0520A;
  --ink: #0B1F14;

  /* Contrato con la lógica */
  --trail-color: #39FF7A;
  --trail-glow: #2BD46B;
  --c-caminante: #FFC83D;
  --c-familia: #C084FC;
  --c-deportista: #2EE6D6;
  --c-biker: #FF4D6D;

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-btn: 0 6px 0 rgba(0, 0, 0, .22), 0 10px 22px rgba(0, 0, 0, .25);
  --font-display: "Baloo 2", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
  --sa-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--cream);
  background: #07160E;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Marco de la app (teléfono en desktop) ---------- */
#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--forest);
  isolation: isolate;
}
@media (min-width: 560px) {
  body {
    display: grid;
    place-items: center;
    background:
      radial-gradient(ellipse at 20% 10%, rgba(43, 212, 107, .18), transparent 55%),
      radial-gradient(ellipse at 85% 90%, rgba(255, 122, 26, .12), transparent 50%),
      url("assets/topo.svg") center / 700px,
      #07160E;
  }
  #app {
    width: 430px;
    height: min(900px, calc(100dvh - 40px));
    border-radius: 44px;
    box-shadow: 0 0 0 10px #0A1C12, 0 0 0 12px rgba(43, 212, 107, .35), 0 40px 90px rgba(0, 0, 0, .6);
  }
}

/* ---------- Pantallas ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; animation: screen-in .38s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.screen--topo {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(43, 212, 107, .28), transparent 60%),
    linear-gradient(180deg, var(--forest-2), var(--forest) 60%, #0A2015);
}
.topo {
  position: absolute;
  inset: -20%;
  background: url("assets/topo.svg") 0 0 / 520px;
  opacity: .16;
  pointer-events: none;
  animation: topo-drift 60s linear infinite;
  z-index: 0;
}
@keyframes topo-drift {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(-520px, -260px, 0) rotate(0deg); }
}
.screen__body {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: calc(28px + var(--sa-top)) calc(22px + var(--sa-right)) 16px calc(22px + var(--sa-left));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.screen__body--center { justify-content: center; align-items: center; text-align: center; }
.screen__foot {
  position: relative;
  z-index: 1;
  padding: 12px calc(22px + var(--sa-right)) calc(20px + var(--sa-bottom)) calc(22px + var(--sa-left));
  background: linear-gradient(180deg, transparent, rgba(10, 32, 21, .9) 40%);
}

/* ---------- Tipografía ---------- */
.eyebrow {
  margin: 0;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green);
}
.h-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.05;
  color: #fff;
}
.h-title--sm { font-size: 22px; margin-top: 8px; }
.h-title--center { text-align: center; }
.fineprint { margin: 4px 0 0; font-size: 13px; color: var(--cream-dim); line-height: 1.4; }
.fineprint--center { text-align: center; max-width: 280px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  font-weight: 800;
  transition: transform .12s, box-shadow .12s, background .2s, opacity .2s;
}
.btn--primary {
  width: 100%;
  min-height: 62px;
  padding: 0 24px;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  background: linear-gradient(180deg, #4BEA86, var(--green) 45%, var(--green-600));
  box-shadow: var(--shadow-btn), inset 0 2px 0 rgba(255, 255, 255, .45);
}
.btn--primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, .22), 0 4px 10px rgba(0, 0, 0, .25); }
.btn--primary:disabled {
  background: var(--forest-3);
  color: rgba(244, 235, 208, .45);
  box-shadow: none;
  cursor: not-allowed;
}
.btn--xl { min-height: 64px; }
.btn:focus-visible, .type-option:focus-visible, #btn-bajando:focus-visible, .fab:focus-visible, #alert-ok:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* ---------- Bienvenida ---------- */
.brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin-top: 6px; }
.brand__mark {
  width: 92px; height: 92px;
  display: grid; place-items: center;
  border-radius: 30px;
  background: linear-gradient(160deg, var(--forest-3), var(--forest));
  box-shadow: 0 0 0 3px rgba(43, 212, 107, .5), 0 14px 30px rgba(0, 0, 0, .4), 0 0 40px rgba(43, 212, 107, .3);
  animation: float 5s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-6px) rotate(-2deg); } }
.brand__name {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 56px;
  line-height: .95;
  letter-spacing: -.01em;
  color: #fff;
  text-shadow: 0 4px 0 var(--green-600), 0 10px 26px rgba(0, 0, 0, .45);
}
.brand__tagline { margin: 6px 0 0; font-size: 18px; font-weight: 700; color: var(--cream); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 8px 0 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  background: rgba(43, 212, 107, .14);
  border: 1.5px solid rgba(43, 212, 107, .45);
  color: #DFFBE8;
}
.card {
  position: relative;
  padding: 22px 20px 18px;
  border-radius: var(--radius-xl);
  background: rgba(244, 235, 208, .97);
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
.card--aware { margin-top: 18px; }
.card__emoji {
  position: absolute; top: -26px; left: 20px;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-size: 30px;
  border-radius: 18px;
  background: var(--green);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .3);
}
.card__title { margin: 14px 0 8px; font-family: var(--font-display); font-size: 24px; line-height: 1.1; font-weight: 800; color: var(--forest); }
.card p { margin: 0 0 8px; font-size: 16px; line-height: 1.42; font-weight: 600; color: #22382B; }
.card__strong { font-weight: 900 !important; color: var(--green-600) !important; font-size: 18px !important; }
.type-strip { display: flex; gap: 8px; list-style: none; margin: 10px 0 0; padding: 0; }
.type-strip__i {
  width: 40px; height: 40px; display: grid; place-items: center;
  font-size: 20px; border-radius: 50%;
  background: var(--c); border: 2.5px solid #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .2);
}
.type-strip__i--caminante { --c: var(--c-caminante); }
.type-strip__i--familia { --c: var(--c-familia); border-radius: 12px; }
.type-strip__i--deportista { --c: var(--c-deportista); }
.type-strip__i--biker { --c: var(--c-biker); }

/* ---------- Registro ---------- */
.field {
  display: flex; align-items: center; gap: 10px;
  min-height: 62px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--cream);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .08), 0 6px 16px rgba(0, 0, 0, .25);
  border: 3px solid transparent;
  transition: border-color .2s;
}
.field:focus-within { border-color: var(--green); }
.field__icon { font-size: 22px; }
#input-name {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font: 800 20px var(--font-body);
  color: var(--ink);
}
#input-name::placeholder { color: #8A8672; font-weight: 700; }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-option {
  --c: var(--green);
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 128px;
  padding: 14px 14px 12px;
  text-align: left;
  border-radius: 24px;
  background: rgba(255, 255, 255, .06);
  border: 2.5px solid rgba(255, 255, 255, .12);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
}
.type-option--caminante { --c: var(--c-caminante); }
.type-option--familia { --c: var(--c-familia); }
.type-option--deportista { --c: var(--c-deportista); }
.type-option--biker { --c: var(--c-biker); }
.type-option__icon {
  width: 52px; height: 52px; display: grid; place-items: center;
  margin-bottom: 6px;
  font-size: 28px;
  border-radius: 50%;
  background: var(--c);
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}
.type-option--familia .type-option__icon { border-radius: 16px; }
.type-option--deportista .type-option__icon { border-radius: 50% 50% 50% 14px; }
.type-option--biker .type-option__icon { border-radius: 16px 50% 50% 50%; }
.type-option__name { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: #fff; line-height: 1.1; }
.type-option__desc { font-size: 13px; font-weight: 700; color: var(--cream-dim); line-height: 1.25; }
.type-option:active { transform: scale(.96); }
.type-option.selected {
  background: color-mix(in srgb, var(--c) 22%, transparent);
  border-color: var(--c);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent), 0 4px 0 rgba(0, 0, 0, .25);
  animation: pop .3s cubic-bezier(.3, 1.6, .5, 1);
}
.type-option.selected::after {
  content: "✓";
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%;
  font-weight: 900; font-size: 16px;
  background: var(--c); color: var(--ink);
}
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: none; } }

/* ---------- Consejo ---------- */
.tip-badge {
  position: relative;
  width: 150px; height: 150px;
  display: grid; place-items: center;
  margin: 18px 0 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5BF097, var(--green-600));
  box-shadow: 0 0 0 8px rgba(43, 212, 107, .2), 0 20px 40px rgba(0, 0, 0, .4);
}
#tip-icon { font-size: 76px; line-height: 1; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .25)); }
.tip-badge__ring {
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(43, 212, 107, .6);
  animation: ring 3s ease-out infinite;
}
.tip-badge__ring--2 { animation-delay: 1.5s; }
@keyframes ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
.tip-text { margin: 0; max-width: 330px; font-size: 19px; line-height: 1.45; font-weight: 700; color: var(--cream); }
.install-hint {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .07);
  border: 1.5px dashed rgba(244, 235, 208, .3);
  font-size: 13px; line-height: 1.4; color: var(--cream-dim);
}
.install-hint p { margin: 0; }
.install-hint strong { color: var(--cream); }
.install-hint > span { font-size: 22px; }

/* ---------- Despedida ---------- */
.bye-heart { font-size: 96px; animation: beat 1.4s ease-in-out infinite; filter: drop-shadow(0 10px 20px rgba(43, 212, 107, .5)); }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }

/* ---------- Mapa ---------- */
#screen-map { background: #0b1a12; }
#map { position: absolute; inset: 0; z-index: 0; background: #0b1a12; }
.leaflet-container { font-family: var(--font-body); background: #0b1a12; }
.leaflet-control-attribution {
  background: rgba(14, 42, 27, .65) !important;
  color: rgba(244, 235, 208, .75) !important;
  font-size: 9px !important;
  border-radius: 8px 0 0 0;
}
.leaflet-control-attribution a { color: var(--green) !important; }
.leaflet-bottom.leaflet-right { bottom: min(45%, 380px); }

/* Barra superior */
#topbar {
  position: absolute; z-index: 500;
  top: calc(12px + var(--sa-top));
  left: calc(12px + var(--sa-left));
  right: calc(12px + var(--sa-right));
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: 999px;
  background: rgba(14, 42, 27, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(43, 212, 107, .35);
  box-shadow: var(--shadow-soft);
}
.topbar__trail { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__dot {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #111;
  border: 3px solid var(--green-neon);
  transform: rotate(45deg) scale(.8);
  box-shadow: 0 0 12px rgba(57, 255, 122, .6);
}
.topbar__txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
#trail-name { font-family: var(--font-display); font-size: 21px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#trail-meta { font-size: 13px; font-weight: 800; color: var(--green); white-space: nowrap; }
.topbar__live {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--green);
  color: var(--ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4);
}
#online-count { font-family: var(--font-display); font-size: 20px; font-weight: 800; line-height: 1; }
.topbar__live-lbl { font-size: 12px; font-weight: 800; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* Botón centrar */
.fab {
  position: absolute; z-index: 500;
  right: calc(14px + var(--sa-right));
  bottom: calc(min(45%, 380px) + 14px);
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--cream);
  color: var(--green-600);
  box-shadow: var(--shadow-btn);
  transition: transform .12s;
}
.fab:active { transform: translateY(3px) scale(.96); }
.fab svg { transform: rotate(0deg); }

/* Hoja inferior */
#sheet {
  position: absolute; z-index: 600;
  left: 0; right: 0; bottom: 0;
  max-height: min(45%, 380px);
  display: flex; flex-direction: column; gap: 10px;
  padding: 8px calc(16px + var(--sa-right)) calc(12px + var(--sa-bottom)) calc(16px + var(--sa-left));
  border-radius: 30px 30px 0 0;
  background: linear-gradient(180deg, #17402A, var(--forest) 70%);
  border-top: 1.5px solid rgba(43, 212, 107, .4);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, .45);
}
body.is-biker #sheet { max-height: min(48%, 420px); }
body.is-biker .fab, body.is-biker .leaflet-bottom.leaflet-right { bottom: calc(min(48%, 420px) + 14px); }
.sheet__grab { width: 44px; height: 5px; margin: 0 auto 2px; border-radius: 999px; background: rgba(244, 235, 208, .3); }

.me { display: flex; align-items: center; gap: 12px; flex: none; }
.me__avatar {
  flex: none;
  width: 50px; height: 50px; display: grid; place-items: center;
  font-size: 26px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(43, 212, 107, .3);
}
.me__info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.me__line { display: flex; align-items: center; gap: 8px; min-width: 0; }
#me-name { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__type {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 900;
  background: rgba(43, 212, 107, .18);
  color: var(--green);
}
.me__status { font-size: 14px; font-weight: 700; color: var(--cream-dim); }

/* Botón ¡BAJANDO! */
#btn-bajando {
  display: none;
  position: relative;
  flex: none;
  width: 100%;
  min-height: 76px;
  border-radius: 26px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .25);
  background: linear-gradient(180deg, #FF9A45, var(--danger) 45%, var(--danger-deep));
  box-shadow: 0 7px 0 #A63A05, 0 14px 28px rgba(255, 122, 26, .35), inset 0 2px 0 rgba(255, 255, 255, .45);
  overflow: hidden;
  transition: transform .12s, box-shadow .12s;
  animation: bajando-breathe 2.4s ease-in-out infinite;
}
body.is-biker #btn-bajando { display: block; }
#btn-bajando::before {
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg);
  animation: shine 3s ease-in-out infinite;
}
#btn-bajando:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 1px 0 #A63A05, 0 4px 12px rgba(255, 122, 26, .35); }
@keyframes bajando-breathe { 50% { transform: scale(1.015); } }
@keyframes shine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
#btn-bajando.active {
  background: repeating-linear-gradient(-45deg, var(--danger) 0 22px, #FF8F3D 22px 44px);
  background-size: 200% 100%;
  animation: stripes .6s linear infinite;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .9), 0 0 30px rgba(255, 122, 26, .8);
}
#btn-bajando.active::before { display: none; }
@keyframes stripes { to { background-position: 62px 0; } }
#btn-bajando:disabled {
  animation: none;
  background: var(--green);
  color: var(--ink);
  text-shadow: none;
  box-shadow: 0 4px 0 #0E7A3A;
  cursor: default;
}
#btn-bajando:disabled::before { display: none; }

.sheet__h {
  flex: none;
  margin: 2px 0 0;
  font-size: 12px; font-weight: 900;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--green);
}
#people-list {
  flex: 1 1 auto;
  min-height: 52px;
  margin: 0; padding: 0 2px 0 0;
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 6px;
}
.person {
  --c: var(--green);
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 7px 12px 7px 7px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .06);
  border-left: 4px solid var(--c);
}
.person--caminante { --c: var(--c-caminante); }
.person--familia { --c: var(--c-familia); }
.person--deportista { --c: var(--c-deportista); }
.person--biker { --c: var(--c-biker); }
.person__emoji {
  grid-row: 1 / 3;
  width: 40px; height: 40px; display: grid; place-items: center;
  font-size: 20px;
  border-radius: 50%;
  background: var(--c);
}
.person--familia .person__emoji { border-radius: 12px; }
.person__name { font-weight: 900; font-size: 16px; color: #fff; line-height: 1.1; }
.person__meta { font-size: 13px; font-weight: 700; color: var(--cream-dim); line-height: 1.2; }
.person--descending {
  background: rgba(255, 122, 26, .18);
  border-left-color: var(--danger);
  animation: row-flash 1s ease-in-out infinite;
}
.person--descending .person__meta { color: #FFB27A; }
@keyframes row-flash { 50% { background: rgba(255, 122, 26, .32); } }

.sheet__actions { flex: none; display: flex; gap: 8px; align-items: center; }
.btn--ghost {
  flex: 1;
  min-height: 48px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--cream);
  background: rgba(255, 255, 255, .08);
  border: 1.5px solid rgba(244, 235, 208, .25);
}
.btn--ghost:active { transform: scale(.97); }
.btn--demo {
  flex: 1.2;
  min-height: 48px;
  padding: 0 12px;
  font-size: 13px;
  color: #FFB27A;
  background: transparent;
  border: 1.5px dashed rgba(255, 122, 26, .55);
}
.btn--demo:active { transform: scale(.97); }
#btn-mode { cursor: help; }
#btn-mode.is-gps { border-color: var(--green); color: var(--green); }
.person--empty { opacity: .8; }

/* ---------- Marcadores (divIcon 48x48, ancla al centro) ---------- */
.marker {
  --c: var(--green);
  position: relative;
  width: 48px; height: 48px;
  display: grid; place-items: center;
}
.marker--caminante { --c: var(--c-caminante); }
.marker--familia { --c: var(--c-familia); }
.marker--deportista { --c: var(--c-deportista); }
.marker--biker { --c: var(--c-biker); }
.marker::before {           /* forma del tipo */
  content: "";
  position: absolute; inset: 5px;
  background: var(--c);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}
.marker--familia::before { border-radius: 12px; }                       /* cuadrado redondeado */
.marker--deportista::before { border-radius: 50% 50% 50% 6px; transform: rotate(-45deg); } /* gota */
.marker--biker::before { border-radius: 10px; transform: rotate(45deg); inset: 7px; }      /* rombo */
.marker__emoji { position: relative; z-index: 1; font-size: 20px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); }
.marker__label {
  position: absolute; z-index: 2;
  top: 44px; left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font: 900 11px/1.35 var(--font-body);
  color: #fff;
  background: rgba(11, 31, 20, .88);
  border: 1.5px solid var(--c);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  pointer-events: none;
}
.marker--me::after {        /* anillo "tú" */
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 4px solid var(--green-neon);
  box-shadow: 0 0 0 3px rgba(11, 31, 20, .7), 0 0 18px var(--green-neon);
  animation: me-ring 2.2s ease-in-out infinite;
}
.marker--me .marker__label { background: var(--green); color: var(--ink); border-color: #fff; }
@keyframes me-ring { 50% { transform: scale(1.1); opacity: .7; } }

.marker--descending::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 122, 26, .45), 0 0 22px var(--danger); }
.marker--descending::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 122, 26, .55), rgba(255, 122, 26, 0) 70%);
  border: 3px solid var(--danger);
  animation: halo 1.1s ease-out infinite;
  z-index: -1;
}
.marker--descending .marker__label { background: var(--danger); border-color: #fff; }
@keyframes halo { from { transform: scale(.8); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }

.marker--yielding { opacity: .6; filter: saturate(.35); }
.marker--yielding .marker__emoji::after {
  content: "✓";
  position: absolute; top: -14px; right: -16px;
  width: 18px; height: 18px; display: grid; place-items: center;
  border-radius: 50%;
  font: 900 12px/1 var(--font-body);
  color: var(--ink);
  background: var(--green-neon);
  border: 2px solid #fff;
}

.marker-entrance {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px;
  background: var(--cream);
  border: 3px solid var(--forest);
  box-shadow: 0 0 0 3px var(--green), 0 4px 10px rgba(0, 0, 0, .5);
}
.marker-entrance span { font: 900 13px/1 var(--font-body); color: var(--forest); letter-spacing: .04em; }

/* ---------- Líneas (paths SVG de Leaflet) ---------- */
path.trail-glow {
  stroke: var(--trail-glow) !important;
  stroke-width: 22px !important;
  stroke-opacity: .28 !important;
  filter: blur(3px);
  animation: glow-breathe 3.5s ease-in-out infinite;
}
@keyframes glow-breathe { 50% { stroke-opacity: .42; } }
path.trail-line {
  stroke: var(--trail-color) !important;
  stroke-width: 6px !important;
  stroke-opacity: 1 !important;
  filter: drop-shadow(0 0 4px rgba(57, 255, 122, .9)) drop-shadow(0 0 1px #0B1F14);
}
path.trail-other {
  stroke: #ffffff !important;
  stroke-width: 2.5px !important;
  stroke-opacity: .4 !important;
}
path.trail-other--bici { stroke: #9BFFC0 !important; stroke-dasharray: 1 0; }
path.trail-other--sendero { stroke: #F4EBD0 !important; stroke-dasharray: 2 7; stroke-linecap: round; }
path.trail-other--camino { stroke: #E8D9A8 !important; stroke-width: 3.5px !important; stroke-opacity: .35 !important; stroke-dasharray: 10 6; }
path.comet-trail {
  stroke: var(--danger) !important;
  stroke-width: 9px !important;
  stroke-opacity: .9 !important;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px var(--danger)) drop-shadow(0 0 14px rgba(255, 180, 60, .7));
}

/* ---------- Aviso ¡BAJANDO! ---------- */
#alert {
  position: absolute; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: calc(20px + var(--sa-top)) calc(18px + var(--sa-right)) calc(20px + var(--sa-bottom)) calc(18px + var(--sa-left));
  background: radial-gradient(ellipse at center, rgba(255, 122, 26, .25), rgba(30, 10, 0, .72) 70%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s, visibility 0s .25s;
}
#alert.show { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .2s; }

/* Onda radar que entra desde los bordes */
body.alerting #app::after {
  content: "";
  position: absolute; inset: 0; z-index: 1900;
  pointer-events: none;
  border-radius: inherit;
  animation: edge-radar 1.2s ease-out infinite;
}
@keyframes edge-radar {
  0% { box-shadow: inset 0 0 0 0 rgba(255, 122, 26, .95), inset 0 0 0 0 rgba(255, 122, 26, .4); }
  60% { box-shadow: inset 0 0 0 10px rgba(255, 122, 26, .8), inset 0 0 90px 40px rgba(255, 122, 26, .35); }
  100% { box-shadow: inset 0 0 0 2px rgba(255, 122, 26, 0), inset 0 0 160px 90px rgba(255, 122, 26, 0); }
}
.alert__radar { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; pointer-events: none; }
.alert__radar span {
  position: absolute;
  width: 150vmax; height: 150vmax;
  border-radius: 50%;
  border: 6px solid rgba(255, 122, 26, .7);
  opacity: 0;
}
#alert.show .alert__radar span { animation: radar-in 1.8s ease-in infinite; }
#alert.show .alert__radar span:nth-child(2) { animation-delay: .6s; }
#alert.show .alert__radar span:nth-child(3) { animation-delay: 1.2s; }
@keyframes radar-in {
  from { transform: scale(1); opacity: .9; }
  to { transform: scale(.1); opacity: 0; }
}
.alert__card {
  position: relative;
  width: 100%; max-width: 380px;
  padding: 58px 22px 22px;
  border-radius: 34px;
  text-align: center;
  background: #FFF8EC;
  color: #2A1406;
  border: 5px solid var(--danger);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, .85), 0 30px 70px rgba(0, 0, 0, .55), 0 0 80px rgba(255, 122, 26, .6);
  transform: scale(.7) translateY(30px);
  transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
#alert.show .alert__card { transform: none; animation: shake .5s .35s; }
@keyframes shake { 20%, 60% { transform: rotate(-2deg); } 40%, 80% { transform: rotate(2deg); } }
.alert__icon-wrap {
  position: absolute; top: -52px; left: 50%;
  width: 104px; height: 104px; margin-left: -52px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFAB5E, var(--danger) 55%, var(--danger-deep));
  border: 5px solid #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
}
#alert.show .alert__icon-wrap { animation: icon-bounce .7s ease-in-out infinite alternate; }
@keyframes icon-bounce { to { transform: translateY(-6px) rotate(-6deg); } }
#alert-icon { font-size: 56px; line-height: 1; }
#alert-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 52px; font-weight: 800; line-height: 1;
  letter-spacing: .01em;
  color: var(--danger-deep);
}
#alert-text { margin: 10px 0 6px; font-size: 22px; line-height: 1.25; font-weight: 900; color: #2A1406; }
#alert-distance {
  display: inline-block;
  margin: 4px 0 18px;
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 16px; font-weight: 800; line-height: 1.3;
  background: #FFE2C7;
  color: #7A2E00;
}
#alert-ok {
  width: 100%;
  min-height: 64px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 21px; font-weight: 800;
  color: var(--ink);
  background: linear-gradient(180deg, #4BEA86, var(--green) 45%, var(--green-600));
  box-shadow: 0 6px 0 #0E7A3A, 0 10px 20px rgba(0, 0, 0, .2), inset 0 2px 0 rgba(255, 255, 255, .45);
  transition: transform .12s, box-shadow .12s;
}
#alert-ok:active { transform: translateY(4px); box-shadow: 0 2px 0 #0E7A3A; }

/* ---------- Toast ---------- */
#toast {
  position: absolute; z-index: 2100;
  left: 50%;
  top: calc(84px + var(--sa-top));
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 900; font-size: 15px; line-height: 1.3;
  text-align: center;
  color: var(--ink);
  background: var(--cream);
  border: 3px solid var(--green);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -16px) scale(.95);
  transition: opacity .25s, transform .3s cubic-bezier(.3, 1.5, .5, 1), visibility 0s .3s;
}
#toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .2s, transform .3s cubic-bezier(.3, 1.5, .5, 1); }

/* ---------- Teléfonos angostos ---------- */
@media (max-width: 360px) {
  .topbar__live-lbl { display: none; }
  .topbar__dot { width: 28px; height: 28px; }
  #trail-name { font-size: 19px; }
  .type-option__desc { font-size: 12px; }
  .brand__name { font-size: 48px; }
}

/* ---------- Pantallas bajas ---------- */
@media (max-height: 700px) {
  .brand__mark { width: 70px; height: 70px; border-radius: 24px; }
  .brand__mark svg { width: 50px; height: 50px; }
  .brand__name { font-size: 46px; }
  .card p { font-size: 15px; }
  .type-option { min-height: 112px; }
  .tip-badge { width: 120px; height: 120px; }
  #tip-icon { font-size: 60px; }
  #btn-bajando { min-height: 64px; font-size: 30px; }
}

/* ---------- Menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .topo { animation: none; }
  /* el aviso sigue siendo evidente sin animación */
  body.alerting #app::after { box-shadow: inset 0 0 0 10px rgba(255, 122, 26, .9), inset 0 0 80px 30px rgba(255, 122, 26, .35); }
  .marker--descending::after { transform: scale(1.8); opacity: .6; }
}

/* Firma */
.credit{margin:12px 0 0;text-align:center;font-size:12px;line-height:1.4;opacity:.6;font-family:Nunito,system-ui,sans-serif}
.credit a{color:inherit;font-weight:800;text-decoration:underline;text-underline-offset:2px}
#sheet .credit{margin:14px 0 4px}
