/* ═══════════════════════════════════════════════════════════════════════
   Radar de retos (2026-10-29, mockups/radar-de-retos.html; lógica en js/radar.js)
   Chip arriba en Cerca, alcance punteado con barrido, pines con el símbolo de radar que late
   y la tarjeta del reto más cercano. Colores de la piel (un solo acento).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── El chip de arriba (en .w-flota-top) ── */
.rd-chip {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; height: 40px; padding: 0 8px 0 6px;
  border: 0; border-radius: 999px; background: var(--surf); color: var(--ink); box-shadow: var(--csh);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.rd-chip .rd-ico { position: relative; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--muted2); color: #fff; display: grid; place-items: center; }
.rd-chip .rd-ico .trazo { width: 17px; height: 17px; stroke-width: 2; }
.rd-chip.on .rd-ico { background: var(--acc); }
.rd-chip.on .rd-ico::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--acc); animation: rd-vivo 2.4s ease-out infinite; }
.rd-chip .rd-lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-chip .rd-sw { width: 36px; height: 22px; flex: none; border-radius: 999px; background: var(--muted2); position: relative; transition: background .2s; }
.rd-chip .rd-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s; }
.rd-chip.on .rd-sw { background: var(--ink); }
.rd-chip.on .rd-sw::after { left: 17px; }
@keyframes rd-vivo { from { transform: scale(.85); opacity: .9 } to { transform: scale(1.5); opacity: 0 } }

/* Con el radar, Cerca muestra solo los negocios con reto: las burbujas de siempre se esconden. */
body.radar-on .w-burbuja { display: none; }

/* ── Quien camina: alcance y barrido ── */
.rd-yo { width: 0; height: 0; pointer-events: none; }
.rd-yo .rd-rango, .rd-yo .rd-barrido { position: absolute; left: 0; top: 0; width: var(--rad, 300px); height: var(--rad, 300px); margin: calc(var(--rad, 300px) / -2) 0 0 calc(var(--rad, 300px) / -2); border-radius: 50%; }
.rd-yo .rd-rango { border: 2px dashed color-mix(in srgb, var(--ink) 65%, transparent); background: rgba(255,255,255,.18); }
.rd-yo .rd-barrido { background: conic-gradient(from 0deg, transparent 0deg, transparent 300deg, color-mix(in srgb, var(--acc) 30%, transparent) 360deg); animation: rd-giro 4s linear infinite; }
@keyframes rd-giro { to { transform: rotate(360deg); } }
.rd-yo .rd-punto { position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(31,29,26,.4); }
.rd-yo .rd-rango-txt { position: absolute; left: 0; top: calc(var(--rad, 300px) / -2 - 11px); transform: translateX(-50%); background: color-mix(in srgb, var(--ink) 85%, transparent); color: var(--surf); font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* ── El pin del reto (MapLibre pone transform en .rd-marca: lo que se anima va adentro) ── */
.rd-marca { width: 0; height: 0; }
.rd-pin { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; cursor: pointer; transition: opacity .5s; }
.rd-pin.oculto { opacity: 0; pointer-events: none; }
.rd-nucleo { position: absolute; inset: 0; border-radius: 50%; background: var(--acc); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px #fff, 0 6px 14px rgba(31,29,26,.3); z-index: 3; transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.rd-nucleo .trazo { width: 20px; height: 20px; stroke-width: 1.9; }
.rd-pin.oculto .rd-nucleo { transform: scale(.3); }
.rd-pin.asoma .rd-nucleo { transform: scale(.72); }
.rd-pin.cerca .rd-nucleo { transform: scale(1); }
.rd-pin.aqui .rd-nucleo { transform: scale(1.18); }
.rd-pin.late .rd-nucleo .trazo { animation: rd-late .34s ease-out; }
.rd-pin.late .rd-nucleo { animation: rd-latefondo .34s ease-out; }
@keyframes rd-late { 0% { scale: 1 } 30% { scale: 1.3 } 100% { scale: 1 } }
@keyframes rd-latefondo {
  0%, 100% { box-shadow: 0 0 0 3px #fff, 0 6px 14px rgba(31,29,26,.3) }
  30% { box-shadow: 0 0 0 5px #fff, 0 0 0 10px color-mix(in srgb, var(--acc) 35%, transparent), 0 6px 14px rgba(31,29,26,.3) }
}
.rd-pin.aparece .rd-nucleo { animation: rd-aparece .6s cubic-bezier(.3,1.6,.5,1); }
@keyframes rd-aparece { 0% { scale: .2 } 60% { scale: 1.25 } 100% { scale: 1 } }
.rd-onda { position: absolute; left: 50%; top: 50%; width: var(--od); height: var(--od); margin: calc(var(--od) / -2) 0 0 calc(var(--od) / -2); border-radius: 50%; border: 2px solid var(--acc); pointer-events: none; z-index: 1; animation: rd-ping var(--odur, 1.1s) cubic-bezier(.15,.6,.3,1) forwards; }
.rd-onda.llena { background: color-mix(in srgb, var(--acc) 20%, transparent); border-width: 3px; }
@keyframes rd-ping { from { transform: scale(.35); opacity: .95 } to { transform: scale(1); opacity: 0 } }
.rd-etq { position: absolute; left: 44px; top: 50%; transform: translateY(-50%); background: var(--surf); color: var(--ink); border-radius: 12px; padding: 5px 10px; box-shadow: 0 4px 14px rgba(31,29,26,.18); white-space: nowrap; z-index: 4; line-height: 1.25; transition: opacity .3s; }
.rd-pin.izq .rd-etq { left: auto; right: 44px; }
.rd-etq b { display: block; font-weight: 500; font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.rd-etq small { display: block; font-size: 12px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.rd-etq .m { color: var(--acc); font-weight: 500; }
.rd-pin.oculto .rd-etq { opacity: 0; }
.rd-pin.asoma .rd-etq b, .rd-pin.asoma .rd-etq .r { display: none; }

/* Pintar esconde los marcadores ajenos durante la pestaña; los del radar se quedan en la salida. */
body.pintando .maplibregl-marker.rd-marca, body.pintando .maplibregl-marker.rd-yo { display: block !important; }
body.pintando .rd-yo .rd-punto, body.pintando .rd-yo .rd-rango-txt { display: none; }   /* Pintar ya marca dónde estás */

/* ── La tarjeta del más cercano (solo en Cerca) ── */
#radar-card {
  position: absolute; left: 12px; right: 12px; bottom: calc(62px + var(--sa-abajo) + 64px); z-index: 1150;
  background: var(--surf); color: var(--ink); border-radius: 22px; padding: 12px 14px; box-shadow: var(--tsh); cursor: pointer;
  max-width: 480px; margin: 0 auto;
}
#radar-card[hidden] { display: none; }
#radar-card.aqui { box-shadow: 0 0 0 2px var(--acc), var(--tsh); }
body.pintando #radar-card { display: none; }
#radar-card .rd-fila { display: flex; gap: 12px; align-items: center; }
#radar-card .rd-mono, #radar-card .rd-logo { width: 40px; height: 40px; border-radius: 14px; background: var(--field, var(--surf2)); display: grid; place-items: center; font-weight: 500; font-size: 14px; flex: none; object-fit: cover; }
#radar-card .rd-txt { min-width: 0; flex: 1; }
#radar-card .rd-txt b { display: block; font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#radar-card .rd-txt small { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#radar-card .rd-vacio { font-size: 13px; color: var(--muted); line-height: 1.4; }
#radar-card .rd-dist { text-align: right; flex: none; }
#radar-card .rd-dist b { display: block; font-size: 24px; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1; }
#radar-card .rd-dist small { font-size: 12px; color: var(--muted); }
#radar-card .rd-mas { width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; margin-right: -6px; }
#radar-card .rd-pulso { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
#radar-card .rd-pulso canvas { flex: 1; min-width: 0; height: 34px; display: block; }
#radar-card .rd-lbl2 { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 96px; }
#radar-card .rd-lbl2 b { display: block; color: var(--ink); font-weight: 500; font-size: 13px; }
#radar-card .rd-acciones { display: none; gap: 8px; margin-top: 10px; }
#radar-card.aqui .rd-acciones { display: flex; }
.rd-btn { flex: 1; min-height: 44px; border: 0; border-radius: 999px; background: var(--acc); color: var(--acc-ink, #fff); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; padding: 0 16px; }
.rd-btn.sec { background: var(--surf); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.rd-btn.ancho { width: 100%; min-height: 50px; font-size: 15px; margin-top: 14px; }

/* ── La hoja de ajustes (CG.abrirHoja) ── */
.rd-hoja h2 { font-size: 22px; font-weight: 300; line-height: 1.15; }
.rd-hoja .rd-sub { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 6px; }
.rd-caja { background: var(--surf); border-radius: 18px; padding: 2px 14px; margin-top: 12px; box-shadow: var(--csh); }
/* .cg-hoja label pone display: block; con .rd-hoja delante gana el de aquí. */
.rd-hoja .rd-ajuste { display: flex; align-items: center; gap: 12px; padding: 12px 0; margin: 0; border-top: 1px solid var(--line); cursor: pointer; color: var(--ink); font-size: 14px; }
.rd-ajuste:first-child { border-top: 0; }
.rd-hoja .rd-ajuste.col { display: block; cursor: default; }
.rd-ajuste .tx { flex: 1; min-width: 0; }
.rd-ajuste .tx b { display: block; font-weight: 500; font-size: 14px; }
.rd-ajuste .tx small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.rd-ajuste input.rd-sw { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; flex: none; border-radius: 999px; background: var(--muted2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.rd-ajuste input.rd-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s; }
.rd-ajuste input.rd-sw:checked { background: var(--ink); }
.rd-ajuste input.rd-sw:checked::after { left: 21px; }
.rd-ajuste input.rd-sw:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.rd-seg { display: flex; background: var(--field, var(--surf2)); border-radius: 999px; padding: 3px; margin-top: 8px; }
.rd-seg button { flex: 1; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 500; padding: 8px 4px; border-radius: 999px; color: var(--muted); cursor: pointer; }
.rd-seg button.on { background: var(--surf); color: var(--ink); box-shadow: 0 1px 4px rgba(31,29,26,.12); }
.rd-privado { display: flex; gap: 10px; align-items: flex-start; background: var(--surf); border-radius: 14px; padding: 10px 12px; font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 10px; }
.rd-privado .trazo { color: var(--ok, #1E9A5E); flex: none; margin-top: 1px; }

@media (prefers-reduced-motion: reduce) {
  .rd-yo .rd-barrido, .rd-chip.on .rd-ico::after { animation: none; }
}
