/* Overlay-specific tweaks on top of pulse_embed.css */
/* Chrome / phone-dock already have Today + Picks */
.overlay-rail-top {
  display: none;
}

.overlay-rail .pulse-rail-link .pulse-rail-meta {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--pulse-muted);
}

.overlay-rail .pulse-rail-link.is-live {
  box-shadow: inset 3px 0 0 var(--pulse-bad);
}

.overlay-rail .pulse-rail-link .live-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--pulse-bad);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.18);
}

@media (max-width: 980px) {
  /* Phone-dock already has Today / Picks — don't stack a second pair */
  .overlay-rail-top {
    display: none;
  }

  body.overlay-embed-host input,
  body.overlay-embed-host select,
  body.overlay-embed-host textarea {
    font-size: 16px;
  }

  /* Don't leave a leftover "Loading…" strip before track chips arrive */
  .overlay-rail .pulse-rail-empty {
    display: none;
  }

  .overlay-rail {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
    padding: 0.4rem 0 0.45rem;
  }

  /* Keep track chips swipeable; hide Live list on narrow screens */
  .overlay-rail .pulse-rail-section:last-child {
    display: none;
  }

  .overlay-rail .pulse-rail-section:nth-child(2) {
    display: block;
    margin-top: 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden; /* force #overlay-tracks to be the scrollport */
  }

  .overlay-rail .pulse-rail-head {
    display: none;
  }

  .overlay-rail #overlay-tracks {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.4rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.05rem max(0.55rem, env(safe-area-inset-right, 0px)) 0.1rem max(0.55rem, env(safe-area-inset-left, 0px));
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: max(0.55rem, env(safe-area-inset-left, 0px));
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 1.15rem), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 1.15rem), transparent 100%);
  }

  .overlay-rail #overlay-tracks::-webkit-scrollbar {
    display: none;
  }

  .overlay-rail #overlay-tracks .pulse-rail-link {
    display: inline-flex;
    flex: 0 0 auto;
    flex-shrink: 0;
    align-items: center;
    gap: 0.4rem;
    scroll-snap-align: start;
    white-space: nowrap;
    width: auto;
    max-width: none;
    padding: 0.48rem 0.8rem;
    font-size: 0.8rem;
    border: 1px solid var(--pulse-line);
    background: var(--pulse-rail-tile);
  }

  .overlay-rail #overlay-tracks .pulse-rail-link > span:last-child {
    overflow: visible;
    text-overflow: clip;
  }

  .overlay-rail #overlay-tracks .pulse-rail-link.is-on {
    border-color: rgba(0, 255, 163, 0.45);
    background: rgba(0, 255, 163, 0.14);
  }

  .overlay-rail #overlay-tracks .pulse-rail-link.is-live {
    box-shadow: none;
    border-color: rgba(255, 92, 122, 0.45);
  }

  .overlay-rail #overlay-tracks .pulse-rail-meta {
    display: none;
  }

  .overlay-rail #overlay-tracks .pulse-rail-ico {
    width: 0.35rem;
    height: 0.35rem;
    flex: 0 0 auto;
  }

  /* Upstream chrome + bottom dock already cover nav; trim footer noise */
  body.overlay-embed-host .footer {
    display: none;
  }

  /* Keep race jump / filter carousels from expanding the document */
  body.overlay-embed-host .pulse-embed-main,
  body.overlay-embed-host main,
  body.overlay-embed-host header.chrome,
  body.overlay-embed-host .chrome-main {
    max-width: 100%;
    min-width: 0;
  }

  body.overlay-embed-host .row-scroll,
  body.overlay-embed-host .race-jump,
  body.overlay-embed-host .filter-row,
  body.overlay-embed-host .sort-bar {
    max-width: 100%;
    min-width: 0;
  }
}
