:root {
  --bg: #0e0f11;
  --surface: #17191d;
  --surface-2: #1f2227;
  --line: #2a2e35;
  --text: #f2f1ee;
  --muted: #9ba0a8;
  --accent: #ff6b1a;
  --accent-ink: #1a0b02;
  --go: #3ddc84;
  --radius: 16px;
  --gutter: 16px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--body);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: rgba(14, 15, 17, .86);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-mark { font-size: 20px; }
.brand-name { font: 800 20px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.ig { font-size: 14px; color: var(--muted); text-decoration: none; padding: 6px 0; }

main { max-width: 640px; margin: 0 auto; }

.banner-old {
  margin: 12px var(--gutter) 0; padding: 10px 12px;
  border-radius: 12px; background: var(--surface-2); font-size: 14px; color: var(--muted);
}
.banner-old a { color: var(--accent); font-weight: 600; }

/* Hero */
.hero { padding: 20px var(--gutter) 14px; }
.kicker {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
}
.when { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 107, 26, .2); animation: pulse 2s infinite; }
.kicker.pasada { color: var(--muted); }
.kicker.pasada .dot { background: var(--muted); box-shadow: none; animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 107, 26, 0); } }
h1 {
  margin: 0; font: 800 clamp(38px, 11vw, 60px)/.95 var(--display);
  text-transform: uppercase; letter-spacing: .01em; text-wrap: balance;
}
.sub { margin: 10px 0 0; color: var(--muted); font-size: 15px; text-wrap: pretty; }

/* Map */
.map-wrap { position: relative; margin: 0 var(--gutter); border-radius: var(--radius); overflow: hidden; background: #e8e6df; border: 1px solid var(--line); }
#map { width: 100%; height: min(62svh, 520px); min-height: 340px; }
.hud {
  position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; pointer-events: none;
}
.hud span {
  padding: 5px 10px; border-radius: 999px; background: rgba(14, 15, 17, .82);
  font: 700 17px/1.1 var(--display); letter-spacing: .03em; font-variant-numeric: tabular-nums;
}
.hud .hud-alt:empty { display: none; }
.map-ctrls { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.chip {
  border: 1px solid rgba(255,255,255,.14); background: rgba(14, 15, 17, .82); color: var(--text);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; min-height: 36px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip { box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.hud span { box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.map-note {
  position: absolute; left: 10px; right: 10px; bottom: 52px; padding: 8px 10px; border-radius: 10px;
  background: rgba(14, 15, 17, .9); font-size: 13px; color: var(--muted);
}

.pin {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 800 14px/1 var(--display); color: var(--accent-ink); background: var(--accent);
  border: 3px solid #0e0f11; box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: pointer;
}
.pin.salida { background: var(--go); }
.pin.destino { background: #fff; font-size: 15px; }
.rider { width: 22px; height: 22px; }
.rider.oculto .rider-dot { opacity: 0; }
.rider-dot {
  display: block; transition: opacity .3s;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  border: 4px solid var(--accent);
  box-shadow: 0 0 0 6px rgba(255, 107, 26, .35), 0 0 18px 6px rgba(255, 107, 26, .55);
}
.mapboxgl-popup-content, .maplibregl-popup-content { background: var(--surface-2); color: var(--text); border-radius: 12px; padding: 10px 12px; font: 14px/1.4 var(--body); }
.mapboxgl-popup-tip, .maplibregl-popup-tip { border-top-color: var(--surface-2) !important; border-bottom-color: var(--surface-2) !important; }
.mapboxgl-popup-close-button, .maplibregl-popup-close-button { color: var(--muted); font-size: 18px; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.mapboxgl-touch-pan-blocker, .mapboxgl-scroll-zoom-blocker, .maplibregl-cooperative-gesture-screen { font: 600 16px/1.4 var(--body); }
.map-wrap .maplibregl-ctrl-bottom-right { bottom: 0; }
@media (max-width: 380px) { .ig { font-size: 12px; } .brand-name { font-size: 18px; } }

/* Stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px var(--gutter) 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font: 800 34px/1.05 var(--display); font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-value small { font-size: 18px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.stat-foot { font-size: 12px; color: var(--muted); }
.dif { display: inline-flex; gap: 4px; vertical-align: middle; }
.dif i { width: 12px; height: 18px; border-radius: 3px; background: var(--line); }
.dif i.on { background: var(--accent); }

/* Cards */
.card { margin: 14px var(--gutter) 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { margin: 0 0 12px; font: 800 24px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.card p { margin: 0 0 12px; color: var(--muted); }
.meet { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.meet-row { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.meet-row .ico { font-size: 18px; line-height: 1.4; }
.meet-row .lbl { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.meet-row strong { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }

/* Buttons */
.actions { padding: 14px var(--gutter) 0; display: grid; gap: 10px; }
.btn-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: 16px; font-weight: 700; }
.join .btn + .btn { margin-top: 8px; }
.btn:focus-visible, .chip:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Perfil */
.perfil { position: relative; touch-action: pan-y; }
.perfil svg { display: block; width: 100%; height: auto; }
.perfil .lbl { fill: var(--muted); font: 600 11px var(--body); font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; margin: 8px 0 0 !important; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding-bottom: 16px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: -2px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .pin { width: 30px; height: 30px; cursor: default; }
.timeline h3 { margin: 3px 0 0; font-size: 16px; font-weight: 600; }
.timeline .meta { font-size: 13px; color: var(--accent); font-weight: 600; }
.timeline .nota { font-size: 14px; color: var(--muted); margin-top: 2px; }
.timeline li.activa h3 { color: var(--accent); }

/* Tips */
.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.tips li { position: relative; padding-left: 26px; color: var(--text); font-size: 15px; }
.tips li::before { content: "⚠️"; position: absolute; left: 0; top: 0; font-size: 14px; }

/* Archivo */
.archivo { list-style: none; margin: 0; padding: 0; }
.archivo li + li { border-top: 1px solid var(--line); }
.archivo a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; text-decoration: none; }
.archivo .t { font-weight: 600; }
.archivo .d { color: var(--muted); font-size: 13px; white-space: nowrap; }

.disclaimer { margin: 16px var(--gutter) 0; font-size: 12px; color: var(--muted); }
.foot { max-width: 640px; margin: 20px auto 0; padding: 16px var(--gutter) 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* Sticky bar */
.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: rgba(14, 15, 17, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  transform: translateY(110%); transition: transform .25s ease;
}
.sticky.show { transform: none; }
.sticky .btn { min-height: 50px; }
.btn-icon { width: 54px; padding: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #fff; color: #111; padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .map-wrap { margin-top: 4px; }
  .sticky { display: none; }
  body { padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
