/* ChelaRadar — styles.css
   Mobile-first. Oscuro por defecto: se usa de noche, en la calle, con una mano. */

:root {
  --bg: #0b0d12;
  --bg-2: #141822;
  --bg-3: #1c2130;
  --line: #262c3b;
  --txt: #eef1f7;
  --muted: #8b93a7;
  --amber: #ffb020;
  --pink: #ff4d8d;
  --green: #35d07f;
  --red: #ff5c5c;
  --r: 14px;
}

* { box-sizing: border-box; }

/* El atributo `hidden` se aplica con `[hidden]{display:none}` del navegador, que
 * tiene especificidad casi nula: CUALQUIER regla de clase con `display` la pisa.
 * Eso dejaba la puerta 18+ (`.gate{display:grid}`) tapando la pantalla para
 * siempre y las dos hojas (`.sheet{display:flex}`) visibles desde el arranque.
 * Esta línea hace que `hidden` signifique oculto de verdad, acá y en lo que venga. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--muted); font-weight: 400; }
.ic { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* ── Puerta 18+ ─────────────────────────────────────────── */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(120% 90% at 50% 0%, #1a1030, var(--bg) 70%);
  display: grid; place-items: center; padding: 24px;
}
.gate-card { max-width: 380px; text-align: center; }
.gate-mark {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border: 2px solid var(--pink); border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; color: var(--pink); letter-spacing: -.02em;
}
.gate h1 { font-size: 30px; margin-bottom: 10px; }
.gate p { color: var(--muted); font-size: 15px; }
.gate .fine { font-size: 13px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.gate .fine strong { color: var(--txt); }
.gate .btn { margin-top: 12px; width: 100%; }
.bye { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ── Botones ────────────────────────────────────────────── */
.btn {
  appearance: none; border: 0; border-radius: 12px;
  padding: 13px 18px; font: inherit; font-weight: 600;
  cursor: pointer; transition: filter .15s, background .15s;
}
.btn-primary { background: var(--amber); color: #1a1206; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--txt); }
.btn-lg { padding: 15px 20px; font-size: 16px; }
.btn-block { display: block; width: 100%; }

.icon-btn {
  appearance: none; background: transparent; border: 0; color: var(--muted);
  padding: 8px; cursor: pointer; display: grid; place-items: center;
}
.icon-btn:hover { color: var(--txt); }

/* ── Barra superior ─────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: rgba(11, 13, 18, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand h1 { font-size: 18px; }
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 0 0 rgba(255, 176, 32, .6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 176, 32, .55); }
  70%  { box-shadow: 0 0 0 10px rgba(255, 176, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 176, 32, 0); }
}
.topbar-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.chip-city {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--txt);
  border-radius: 999px; padding: 8px 14px 8px 10px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  max-width: 55vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip-city .ic { width: 16px; height: 16px; color: var(--amber); }

/* ── Categorías ─────────────────────────────────────────── */
.cats {
  display: flex; gap: 8px; padding: 14px 16px 6px;
  overflow-x: auto; scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  display: flex; align-items: center; gap: 7px; flex: none;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 9px 15px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.cat .ic { width: 17px; height: 17px; }
.cat.is-on { background: var(--amber); border-color: var(--amber); color: #1a1206; }

/* ── Subcategorías ──────────────────────────────────────── */
.subs {
  display: flex; gap: 7px; padding: 10px 16px 2px;
  overflow-x: auto; scrollbar-width: none;
}
.subs::-webkit-scrollbar { display: none; }
.sub {
  flex: none; background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.sub.is-on { background: var(--bg-3); border-color: #4a5468; color: var(--txt); }
.sub.is-sensitive.is-on { border-color: var(--pink); color: #ffb3cd; }

/* ── Radio ──────────────────────────────────────────────── */
.radius {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 4px; font-size: 14px; color: var(--muted);
}
.radius input { flex: 1; accent-color: var(--amber); }
.radius output { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--txt); min-width: 58px; text-align: right; }

/* ── Radar ──────────────────────────────────────────────── */
.radar-wrap { position: relative; padding: 8px 16px 4px; }
#radar { width: 100%; max-width: 260px; margin: 0 auto; display: block; overflow: visible; }
.ring { fill: none; stroke: var(--line); stroke-width: 1; }
.blip { fill: var(--amber); opacity: .9; }
.blip.is-hot { fill: var(--pink); filter: drop-shadow(0 0 5px var(--pink)); }
.me { fill: #fff; }
.sweep path { fill: url(#none); fill: rgba(255, 176, 32, .13); transform-origin: 100px 100px; animation: sweep 4s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.radar-count {
  position: absolute; right: 16px; bottom: 8px;
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
  .sweep path { animation: none; }
  .brand-dot { animation: none; }
}

/* ── Ficha legal de ciudad ──────────────────────────────── */
.intel { margin: 12px 16px; }
.intel-h { font-size: 17px; margin-bottom: 10px; }
.price-strip { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price-num { font-size: 24px; font-weight: 750; color: var(--amber); letter-spacing: -.02em; }
.price-meta { font-size: 13px; color: var(--muted); }
.price-meta em { color: #b9a06a; font-style: normal; }
.price-note { font-size: 13px; color: var(--muted); margin: 6px 0 14px; }

.intel-card {
  border: 1px solid var(--line); border-left-width: 3px;
  background: var(--bg-2); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px;
}
.intel-card.ok   { border-left-color: var(--green); }
.intel-card.warn { border-left-color: var(--amber); }
.intel-card.no   { border-left-color: var(--red); }
.intel-top { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; flex-wrap: wrap; }
.intel-top strong { font-size: 14.5px; }
.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 8px; border-radius: 999px;
}
.ok .badge   { background: rgba(53, 208, 127, .16); color: var(--green); }
.warn .badge { background: rgba(255, 176, 32, .16); color: var(--amber); }
.no .badge   { background: rgba(255, 92, 92, .16); color: var(--red); }
.intel-card p { margin: 0; font-size: 13.5px; color: var(--muted); }

/* Formatos de oferta que existen en la ciudad */
.pat-h { font-size: 14px; margin: 16px 0 8px; }
.pats { list-style: none; margin: 0; padding: 0; }
.pat {
  display: grid; gap: 2px;
  border-left: 2px solid var(--pink);
  padding: 7px 0 7px 11px; margin-bottom: 8px;
}
.pat strong { font-size: 14px; }
.pat-what { font-size: 13px; color: var(--muted); }
.pat-when { font-size: 12px; color: #b9a06a; }

.intel-more { margin-top: 10px; }
.intel-more summary {
  cursor: pointer; font-size: 14px; color: var(--muted); font-weight: 600;
  padding: 8px 0; list-style: none;
}
.intel-more summary::-webkit-details-marker { display: none; }
.intel-more summary::before { content: '＋ '; color: var(--amber); }
.intel-more[open] summary::before { content: '－ '; }
.zones, .tips { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); }
.zones li, .tips li { margin-bottom: 6px; }
.zones strong { color: var(--txt); }

/* ── Leer las webs ──────────────────────────────────────── */
.scanbar { padding: 6px 16px 0; }
.btn-scan {
  width: 100%; background: var(--bg-3); color: var(--txt);
  border: 1px dashed #4a5468; border-radius: 12px;
  padding: 12px; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer;
  transition: all .15s;
}
.btn-scan:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }
.btn-scan:disabled { opacity: .55; cursor: default; }
.scan-note { font-size: 12px; color: var(--muted); margin: 7px 2px 0; }

.webdeal {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: var(--bg-3); border-left: 2px solid #4a5468;
  display: grid; gap: 4px;
}
.webdeal.is-strong { border-left-color: var(--amber); }
.webdeal.is-social { color: var(--muted); font-size: 12.5px; }
.webdeal-kw {
  justify-self: start; font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--amber); background: rgba(255, 176, 32, .12);
  padding: 2px 7px; border-radius: 999px;
}
.webdeal-txt { font-size: 12.5px; color: #c8cede; line-height: 1.45; }
.webdeal a { font-size: 11.5px; color: var(--muted); text-decoration: none; }
.webdeal a:hover { color: var(--amber); }
.card.has-web { border-color: rgba(255, 176, 32, .38); }

.ig {
  display: inline-block; margin-top: 8px;
  font-size: 12px; font-weight: 650; text-decoration: none;
  color: #ff9ec4; background: rgba(255, 77, 141, .12);
  padding: 5px 11px; border-radius: 999px;
}
.ig:hover { background: rgba(255, 77, 141, .22); color: #fff; }

/* ── Estado y lista ─────────────────────────────────────── */
.status { padding: 10px 16px; font-size: 14px; color: var(--muted); min-height: 20px; }
.status.is-loading::after {
  content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 8px;
  border: 2px solid var(--line); border-top-color: var(--amber);
  border-radius: 50%; vertical-align: -2px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.retry {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--amber);
  border-radius: 8px; padding: 4px 12px; margin-left: 6px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.retry:hover { border-color: var(--amber); }

.list { list-style: none; margin: 0; padding: 0 16px 110px; }
.card {
  display: flex; align-items: stretch; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 9px; overflow: hidden;
}
.card.has-deal { border-color: rgba(255, 77, 141, .45); }
.card-main { flex: 1; min-width: 0; padding: 12px 4px 12px 14px; }
.card-head { display: flex; align-items: baseline; gap: 10px; }
.card-head h3 { font-size: 15.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist { font-size: 14px; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; flex: none; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.kind { font-weight: 600; }
.walk { margin-left: auto; }
.addr { font-size: 12.5px; color: var(--muted); margin-top: 3px; opacity: .8; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.tag.open   { background: rgba(53, 208, 127, .15); color: var(--green); }
.tag.closed { background: rgba(255, 92, 92, .13); color: #d98080; }
.tag.unk    { background: var(--bg-3); color: var(--muted); cursor: help; }
.deal {
  margin-top: 8px; padding: 7px 10px; border-radius: 8px;
  background: rgba(255, 77, 141, .12); color: #ffc3d8; font-size: 13px;
}
.deal strong { color: #fff; }
.go {
  display: grid; place-items: center; width: 52px; flex: none;
  color: var(--muted); border-left: 1px solid var(--line); text-decoration: none;
}
.go:hover { color: var(--amber); background: var(--bg-3); }

/* ── FAB ────────────────────────────────────────────────── */
.fab {
  position: fixed; right: 18px; z-index: 30;
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--pink); color: #fff; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 6px 22px rgba(255, 77, 141, .38);
}
.fab .ic { width: 26px; height: 26px; }

/* ── Hojas ──────────────────────────────────────────────── */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .6);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-card {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--bg-2);
  border-radius: 20px 20px 0 0;
  padding: 6px 18px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(14px); opacity: .6; } }
.sheet-head { display: flex; align-items: center; gap: 6px; margin: 6px 0 14px; }
.sheet-head h2 { font-size: 18px; }
.sheet-note { font-size: 13.5px; color: var(--muted); margin: 14px 0 10px; }
.sheet-foot { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; text-align: center; }

.sheet label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.sheet input, .sheet select {
  display: block; width: 100%; margin-top: 5px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; color: var(--txt); font: inherit; font-weight: 400;
}
.sheet input:focus, .sheet select:focus { outline: 2px solid var(--amber); outline-offset: -1px; }
.row { display: flex; gap: 10px; }
.row label { flex: 1; }

.toggle {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; cursor: pointer; margin-bottom: 10px;
}
.toggle input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--amber); flex: none; }
.toggle span { display: grid; gap: 4px; }
.toggle strong { font-size: 14.5px; color: var(--txt); font-weight: 650; }
.toggle em { font-size: 12.5px; color: var(--muted); font-style: normal; line-height: 1.45; }

.city-list { list-style: none; margin: 0; padding: 0; }
.city-list button {
  width: 100%; text-align: left; background: var(--bg-3);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 15px; margin-bottom: 8px; color: var(--txt);
  font: inherit; cursor: pointer;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
}
.city-list button:hover { border-color: var(--amber); }
.city-list span { font-size: 13px; color: var(--muted); }

@media (min-width: 700px) {
  .sheet { align-items: center; }
  .sheet-card { border-radius: 20px; }
}
