/* ---------- Tokens ---------- */
:root {
  --bg: #f2f2f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --text: #0b0b0f;
  --text-2: rgba(60, 60, 67, 0.72);
  --text-3: rgba(60, 60, 67, 0.45);
  --hairline: rgba(60, 60, 67, 0.16);
  --green: #1db954;
  --green-text: #0f8a3c;
  --lastfm: #d51007;
  --danger: #e5332a;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  --pin-ring: #ffffff;
  --pin-track: #d1d1d6;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --peek: calc(196px + var(--safe-bottom));
  --sheet-h: min(74dvh, 680px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0f;
    --surface: rgba(28, 28, 32, 0.78);
    --surface-solid: #1c1c20;
    --fill: rgba(118, 118, 128, 0.22);
    --fill-strong: rgba(118, 118, 128, 0.34);
    --text: #f5f5f7;
    --text-2: rgba(235, 235, 245, 0.66);
    --text-3: rgba(235, 235, 245, 0.38);
    --hairline: rgba(255, 255, 255, 0.1);
    --green: #1ed760;
    --green-text: #1ed760;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --pin-ring: #1c1c20;
    --pin-track: #3a3a42;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0f;
  --surface: rgba(28, 28, 32, 0.78);
  --surface-solid: #1c1c20;
  --fill: rgba(118, 118, 128, 0.22);
  --fill-strong: rgba(118, 118, 128, 0.34);
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.66);
  --text-3: rgba(235, 235, 245, 0.38);
  --hairline: rgba(255, 255, 255, 0.1);
  --green: #1ed760;
  --green-text: #1ed760;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --pin-ring: #1c1c20;
  --pin-track: #3a3a42;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
h1, h2, h3, p { margin: 0; }

#map { position: fixed; inset: 0; background: var(--space); }
:root { --space: radial-gradient(circle at 55% 45%, #ffffff 0%, #e6e6ec 75%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --space: radial-gradient(circle at 55% 45%, #191a22 0%, #050507 70%); }
}
:root[data-theme="dark"] { --space: radial-gradient(circle at 55% 45%, #191a22 0%, #050507 70%); }

.glass {
  background: var(--surface);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow);
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; z-index: 10;
  top: calc(var(--safe-top) + 10px); left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px 0 12px; border-radius: 999px;
}
.brand { padding-left: 6px; }
.brand-logo { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.brand-name { font-family: "Outfit", inherit; font-weight: 700; letter-spacing: -0.01em; font-size: 17px; }
.brand-count { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.brand-count:not(:empty)::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 var(--green); animation: live 2s infinite;
}
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(30, 215, 96, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(30, 215, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(30, 215, 96, 0); }
}
.me-btn {
  height: 40px; padding: 0 16px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  transition: transform 0.15s var(--ease);
}
.me-btn:active, .fab:active { transform: scale(0.94); }
.me-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }

/* Tarjeta "Compartiendo": portada + canción + línea de progreso */
.me-btn.me-card {
  position: relative; overflow: hidden;
  height: auto; min-height: 58px; padding: 8px 14px 9px 8px; border-radius: 18px;
  gap: 11px; text-align: left;
  width: min(290px, calc(100vw - 170px));
}
.me-card:active { transform: scale(0.97); }
.me-card .me-art { width: 42px; height: 42px; border-radius: 10px; font-size: 17px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }
.me-info { flex: 1; min-width: 0; line-height: 1.25; }
.me-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--green-text);
}
.me-label.off { color: var(--text-3); }
.me-label.off .dot { background: var(--text-3); }
.me-title, .me-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-title { font-size: 14px; font-weight: 600; margin-top: 2px; }
.me-artist { font-size: 12.5px; color: var(--text-2); }
.me-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--fill); }
.me-progress i { display: block; height: 100%; width: 0; background: var(--green); border-radius: 0 2px 2px 0; }
.eq.sm { height: 10px; gap: 1.5px; }
.eq.sm i { width: 2px; animation-name: eq-sm; }
@keyframes eq-sm { 0%, 100% { height: 3px; } 50% { height: 10px; } }
.topbar { align-items: flex-start; }
.me-art-wrap { display: grid; place-items: center; flex: none; }
.me-mini { display: none; }
.dot.off { background: var(--text-3); }

/* Celular/tablet: la tarjeta se vuelve una burbuja compacta; al tocarla se abren los detalles */
@media (max-width: 859px) {
  .me-btn.me-card {
    width: auto; height: 44px; min-height: 0;
    padding: 3px 12px 3px 3px; border-radius: 999px; gap: 8px;
  }
  .me-card .me-info, .me-card .me-progress { display: none; }
  .me-card .me-mini {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums;
  }
  .me-card .me-art-wrap {
    width: 38px; height: 38px; padding: 2.5px; border-radius: 50%;
    background: conic-gradient(var(--green) calc(var(--p, 0) * 1turn), var(--pin-track) 0);
  }
  .me-card .me-art-wrap.no-progress { background: var(--green); }
  .me-card .me-art { width: 100%; height: 100%; border-radius: 50%; box-shadow: none; font-size: 13px; }
}

.demo-chip {
  position: fixed; z-index: 9; left: 12px;
  top: calc(var(--safe-top) + 58px);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; color: var(--text-2);
  white-space: nowrap;
}

/* ---------- Locate button ---------- */
.fab {
  position: fixed; z-index: 8; right: 12px;
  bottom: calc(var(--peek) + 12px);
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text);
  transition: opacity 0.3s var(--ease), transform 0.15s var(--ease);
}
.brand { cursor: pointer; transition: transform 0.15s var(--ease); }
.brand:active { transform: scale(0.96); }
.sheet-open .fab { opacity: 0; pointer-events: none; }

/* ---------- Map pins ---------- */
.marker { cursor: pointer; }
/* El borde del pin es un anillo que se llena con el avance de la canción (--p de 0 a 1) */
.pin {
  --p: 0; --ring: var(--green);
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  padding: 3px;
  background: conic-gradient(var(--ring) calc(var(--p) * 1turn), var(--pin-track) 0);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s var(--ease), opacity 0.3s;
}
.pin.no-progress { background: var(--pin-ring); padding: 2.5px; }
.pin.paused { --ring: var(--text-3); }
.pin .art { width: 100%; height: 100%; border-radius: 50%; font-size: 14px; }
#map.far .pin { width: 26px; height: 26px; padding: 2px; }
#map.far .pin .art { font-size: 0; }
.pin.playing.no-progress::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--green); opacity: 0;
  animation: ring 2.6s var(--ease) infinite;
}
@keyframes ring {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.45); opacity: 0; }
}
.pin.paused { opacity: 0.6; }
.pin.paused .art { filter: grayscale(0.7); }
.pin.me { box-shadow: 0 0 0 2px var(--text), 0 6px 18px rgba(0, 0, 0, 0.35); }
.pin.selected { transform: scale(1.3); }
.marker:hover .pin:not(.selected) { transform: scale(1.1); }

/* Album art (image or generated gradient) */
.art {
  flex: none; background: var(--fill) center / cover no-repeat;
  display: grid; place-items: center; overflow: hidden;
  color: rgba(255, 255, 255, 0.92); font-weight: 700;
}
.art.fallback {
  background-image: linear-gradient(135deg, hsl(var(--h) 72% 58%), hsl(calc(var(--h) + 50) 70% 38%));
}

/* ---------- Bottom sheet ---------- */
.sheet {
  position: fixed; z-index: 12; left: 0; right: 0; bottom: 0;
  height: var(--sheet-h);
  background: var(--surface);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(calc(var(--sheet-h) - var(--peek)));
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
  display: flex; flex-direction: column;
  max-width: 640px; margin: 0 auto;
}
.sheet.open { transform: translateY(0); }
.sheet.dragging { transition: none; }
.grabber { flex: none; height: 22px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.grabber span { width: 38px; height: 5px; border-radius: 3px; background: var(--fill-strong); }

.view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.view[hidden] { display: none; }

.sheet-head { padding: 2px 16px 10px; touch-action: none; }
.headline { margin-bottom: 12px; }
.headline h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.headline p { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }

.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 2px; border-radius: 9px; background: var(--fill);
}
.segmented button {
  height: 30px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.segmented button[aria-selected="true"] { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }

.list {
  list-style: none; margin: 0; padding: 0 0 calc(var(--safe-bottom) + 16px);
  overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 8px 16px; position: relative;
  transition: background 0.15s;
}
.row:active, .row:hover { background: var(--fill); }
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 76px; height: 0.5px; background: var(--hairline);
}
.row .art { width: 48px; height: 48px; border-radius: 10px; font-size: 18px; }
.row-main { flex: 1; min-width: 0; }
.row-title, .row-sub, .row-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title { font-weight: 600; font-size: 15px; }
.row-sub { color: var(--text-2); font-size: 14px; }
.row-meta { color: var(--text-3); font-size: 12px; margin-top: 1px; }
.row.paused .row-title { color: var(--text-2); }
.row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tag-me { font-size: 11px; font-weight: 700; color: var(--green-text); }

.eq { display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; border-radius: 1px; background: var(--green); animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.paused-label { font-size: 11px; color: var(--text-3); }

.empty { color: var(--text-2); text-align: center; padding: 28px 32px; font-size: 14px; line-height: 1.5; }

/* ---------- Detail view ---------- */
.detail { padding: 4px 16px calc(var(--safe-bottom) + 20px); overflow-y: auto; }
.detail-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; background: var(--fill);
  display: grid; place-items: center; color: var(--text-2);
}
.detail-source { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.detail-hero { display: flex; gap: 16px; align-items: center; }
.detail-hero .art { width: 112px; height: 112px; border-radius: 14px; font-size: 40px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.detail-hero h2 { font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.detail-hero .artist { color: var(--text-2); font-size: 16px; margin-top: 3px; }
.detail-hero .album { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.progress { margin-top: 18px; }
.progress .bar { height: 4px; border-radius: 2px; background: var(--fill-strong); overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--green); }
.progress .times {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.who {
  display: flex; align-items: center; gap: 10px; margin: 18px 0; padding: 12px; border-radius: 14px; background: var(--fill);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 60% 55%), hsl(calc(var(--h) + 40) 60% 42%));
}
.who-name { font-weight: 600; }
.who-meta { color: var(--text-2); font-size: 13px; }
.actions { display: grid; gap: 10px; }

/* ---------- Buttons ---------- */
.btn {
  height: 50px; border-radius: 14px; width: 100%;
  font-weight: 600; font-size: 16px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform 0.15s var(--ease), opacity 0.2s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-spotify { background: var(--green); color: #000; }
.btn-lastfm { background: var(--lastfm); color: #fff; }
.btn-plain { background: var(--fill); color: var(--text); }
.btn-danger { background: var(--fill); color: var(--danger); }

/* ---------- Dialog ---------- */
dialog {
  border: 0; padding: 0; color: var(--text); background: var(--surface-solid);
  width: 100%; max-width: 480px; max-height: 92dvh;
  margin: auto auto 0; border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow);
}
dialog[open] { animation: up 0.45s var(--ease); }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.dialog-body { padding: 10px 20px calc(var(--safe-bottom) + 22px); }
.dialog-body .grabber { margin: 0 -20px 4px; }
.dialog-body h2 { font-size: 24px; letter-spacing: -0.02em; margin: 4px 0 6px; }
.dialog-body .lead { color: var(--text-2); font-size: 15px; margin-bottom: 18px; }
.field {
  display: block; width: 100%; height: 50px; padding: 0 14px; border-radius: 14px;
  background: var(--fill); border: 0; outline: none; font-size: 16px; margin-bottom: 10px;
}
.field:focus { box-shadow: 0 0 0 2px var(--green); }
.label { display: block; font-size: 13px; color: var(--text-2); margin: 0 4px 6px; font-weight: 600; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 13px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 0.5px; background: var(--hairline); }
.fine { color: var(--text-3); font-size: 12.5px; line-height: 1.45; margin-top: 14px; }
.fine a { color: var(--text-2); }
.privacy { display: flex; gap: 10px; align-items: flex-start; padding: 12px; background: var(--fill); border-radius: 14px; color: var(--text-2); font-size: 13px; margin: 16px 0 0; }
.privacy svg { flex: none; margin-top: 1px; color: var(--green-text); }
.now-card { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; background: var(--fill); margin-bottom: 16px; }
.now-card .art { width: 64px; height: 64px; border-radius: 10px; font-size: 24px; }
.now-card .t { font-weight: 600; }
.now-card .a { color: var(--text-2); font-size: 14px; }

/* ---------- Landing (portada sobre el mapa en vivo) ---------- */
.landing {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: flex-end;
  padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 28px);
  background: linear-gradient(to top, var(--bg) 22%, color-mix(in srgb, var(--bg) 72%, transparent) 50%, transparent 72%);
  pointer-events: none; /* el globo de atrás se puede mover */
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}
.landing-inner { width: 100%; max-width: 580px; pointer-events: auto; }
.landing-brand {
  position: absolute; top: calc(var(--safe-top) + 18px); left: 20px;
  display: flex; align-items: center; gap: 10px;
  font-family: "Outfit", inherit; font-weight: 700; font-size: 22px; letter-spacing: -0.01em;
}
.landing-brand img { width: 40px; height: 40px; border-radius: 50%; }
@media (min-width: 860px) { .landing-brand { top: 32px; left: 72px; } }
body:not(.landing-on) .landing { opacity: 0; visibility: hidden; }
#map { transition: transform 1.2s var(--ease); }
body.landing-on #map { transform: translateY(-21vh); }
/* los créditos del mapa se quedan en su sitio aunque el globo se mueva */
.maplibregl-ctrl-top-right { transition: transform 1.2s var(--ease); }
body.landing-on .maplibregl-ctrl-top-right { transform: translateY(21vh); }
@media (min-width: 860px) {
  body.landing-on #map { transform: translateX(24vw); }
  body.landing-on .maplibregl-ctrl-top-right { transform: translateX(-24vw); }
}
.topbar, .demo-chip { transition: opacity 0.5s var(--ease); }
body.landing-on .topbar, body.landing-on .sheet, body.landing-on .fab, body.landing-on .demo-chip { opacity: 0; pointer-events: none; }

.landing-live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px; border-radius: 999px; background: var(--fill);
  font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums;
  margin-bottom: 18px;
}
.landing-title {
  font-size: clamp(38px, 10vw, 76px); line-height: 1.02; letter-spacing: -0.045em; font-weight: 800;
  text-wrap: balance;
}
.landing-title em { font-style: normal; color: var(--green-text); }
.landing-sub { margin-top: 14px; font-size: clamp(16px, 2.2vw, 19px); line-height: 1.45; color: var(--text-2); max-width: 30em; }

.landing-ticker {
  display: flex; align-items: center; gap: 10px; max-width: 100%;
  margin-top: 22px; height: 48px; padding: 6px 14px 6px 6px; border-radius: 14px;
  background: var(--fill); text-align: left; font-size: 14px;
}
.landing-ticker:empty { display: none; }
.landing-ticker .art { width: 36px; height: 36px; border-radius: 9px; font-size: 14px; }
.landing-ticker.muted { padding-left: 14px; color: var(--text-2); cursor: default; }
.ticker-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ticker-text b { font-weight: 600; }
.ticker-text span { color: var(--text-2); }
.landing-ticker.swap { animation: tick 0.5s var(--ease); }
@keyframes tick { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.landing-cta { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.landing-cta .btn { flex: 1 1 180px; width: auto; height: 54px; padding: 0 24px; border-radius: 999px; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-outline { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--fill-strong); }
.btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.landing-fine { margin-top: 16px; font-size: 13px; color: var(--text-3); }
.landing-fine a, .terms-note a { color: var(--text-2); text-underline-offset: 2px; }
.terms-note { text-align: center; }

@media (min-width: 860px) {
  .landing {
    align-items: center; padding: 104px 72px 40px;
    background: linear-gradient(to right, var(--bg) 26%, color-mix(in srgb, var(--bg) 60%, transparent) 48%, transparent 66%);
  }
  .landing-cta .btn { flex: 0 0 auto; }
}

/* Last.fm como opción secundaria en el diálogo */
.link-btn {
  display: block; width: 100%; padding: 16px 0 4px; text-align: center;
  font-size: 14px; color: var(--text-2);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--fill-strong);
}
.lf-box { margin-top: 12px; }
.lf-box[hidden], .am-box[hidden] { display: none; }
.link-btn + .link-btn { padding-top: 8px; }

/* Instrucciones de Apple Music */
.am-box {
  margin-top: 12px; padding: 14px 14px 12px; border-radius: 14px; background: var(--fill);
  font-size: 13.5px; line-height: 1.45; color: var(--text-2);
}
.am-title { color: var(--text); font-weight: 600; margin-bottom: 8px; }
.steps { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.steps b { color: var(--text); font-weight: 600; }
.steps a { color: var(--text); text-underline-offset: 2px; }
dialog { overflow-y: auto; }

/* ---------- 🔥 Reacciones ---------- */
.fire-burst {
  position: absolute; left: 50%; top: -10px; z-index: 5;
  font-size: 22px; pointer-events: none;
  animation: fire-up 1.5s var(--ease) forwards;
}
@keyframes fire-up {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.5); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -42px) scale(1); }
}
.btn-fire { background: linear-gradient(135deg, #ff9a3c, #ff4d1f); color: #fff; }
.btn-fire.sent, .btn-fire:disabled { background: var(--fill); color: var(--text-2); opacity: 1; }
.who-text { flex: 1; min-width: 0; }
.who-fires {
  display: flex; align-items: center; gap: 4px; flex: none;
  padding: 6px 10px; border-radius: 999px; background: var(--surface-solid);
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.who-fires b { font-weight: 700; }
.who-fires.big { margin-left: auto; font-size: 17px; }
.now-text { min-width: 0; }
.row-fires { font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.me-fires, .me-incog { margin-left: 2px; color: var(--text-2); letter-spacing: 0; text-transform: none; font-weight: 600; }
.me-card.got-fire { animation: got-fire 0.9s var(--ease); }
@keyframes got-fire {
  0% { box-shadow: var(--shadow); }
  30% { box-shadow: 0 0 0 3px #ff7a2f, var(--shadow); transform: scale(1.04); }
  100% { box-shadow: var(--shadow); transform: none; }
}

/* ---------- Lo más escuchado hoy ---------- */
.top-row { color: inherit; text-decoration: none; }
.rank {
  flex: none; width: 22px; text-align: center;
  font-size: 15px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.rank.podium { color: var(--green-text); }
.landing-link {
  display: inline-block; margin-top: 18px; padding: 0;
  font-size: 15px; font-weight: 600; color: var(--green-text);
}
.landing-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Modo incógnito (interruptor tipo iOS) ---------- */
.switch-row {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 12px; margin-bottom: 10px; border-radius: 14px; background: var(--fill);
}
.switch-icon { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.switch-text { flex: 1; min-width: 0; }
.switch-title { font-weight: 600; font-size: 15px; }
.switch-sub { font-size: 12.5px; color: var(--text-2); line-height: 1.35; margin-top: 1px; }
.switch-row input[role="switch"] {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 50px; height: 30px; border-radius: 999px; background: var(--fill-strong);
  position: relative; transition: background 0.25s var(--ease);
}
.switch-row input[role="switch"]::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.25s var(--ease);
}
.switch-row input[role="switch"]:checked { background: var(--green); }
.switch-row input[role="switch"]:checked::before { transform: translateX(20px); }
.switch-row input[role="switch"]:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.avatar.incog { background: none; object-fit: cover; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 50; left: 50%; top: calc(var(--safe-top) + 60px);
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500;
  max-width: calc(100vw - 32px); text-align: center;
  transition: opacity 0.3s, transform 0.4s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- MapLibre tweaks ---------- */
.maplibregl-ctrl-top-right { top: calc(var(--safe-top) + 56px); }
.maplibregl-ctrl-attrib { background: var(--surface) !important; color: var(--text-2); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--text-2) !important; }
.maplibregl-ctrl-attrib-button { filter: var(--attrib-filter, none); }
@media (prefers-color-scheme: dark) { :root { --attrib-filter: invert(1); } }

/* ---------- Desktop: floating side panel ---------- */
@media (min-width: 860px) {
  :root { --peek: 0px; }
  .topbar { left: 16px; right: 16px; top: 16px; }
  .sheet {
    left: 16px; right: auto; top: 72px; bottom: 16px; width: 380px; height: auto; margin: 0;
    border-radius: 20px; transform: none !important;
    box-shadow: var(--shadow);
  }
  .grabber { display: none; }
  .sheet-head { padding-top: 16px; }
  .fab { bottom: 24px; right: 16px; }
  .sheet-open .fab { opacity: 1; pointer-events: auto; }
  dialog { margin: auto; border-radius: 24px; }
  dialog[open] { animation: pop 0.35s var(--ease); }
  .dialog-body .grabber { display: none; }
  .dialog-body { padding-top: 22px; }
  .demo-chip { top: 22px; left: 50%; transform: translateX(-50%); }
  .maplibregl-ctrl-top-right { top: 64px; right: 6px; }
  body.is-sharing .maplibregl-ctrl-top-right { top: 90px; }
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
