/**
 * Persistent Brief + music chrome (outside React) — Mini + web, all tabs incl. News
 * md4: PC web — music sits on the BRIEF row, right-aligned (phones stay stacked).
 */
:root {
  --gt-persist-chrome-h: 110px;
}

#gt-persist-chrome {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9300;
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    90deg,
    var(--bg-card, #0b1218),
    var(--bg-secondary, #080e12)
  );
  border-top: 1px solid var(--border-accent, rgba(61, 187, 255, 0.28));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  /* Do NOT stack env(safe-area-inset-bottom) here.
     Mini + viewport-fit=cover already clears the system nav; the inset
     painted an empty darker band under the tinted .sc-player row (~48px). */
  padding-bottom: 0;
  margin: 0;
  /* gtm21: scroll-through dock — empty chrome must not eat Browse page swipes */
  pointer-events: none;
}

/* gtm22: Brief text + player chrome scroll-through; only controls capture taps */
#gt-persist-chrome .gt-persist-brief,
#gt-persist-chrome .gt-persist-brief__label,
#gt-persist-chrome .gt-persist-brief__text,
#gt-persist-chrome .sc-player,
#gt-persist-chrome .sc-player__track {
  pointer-events: none !important;
}

#gt-persist-chrome button,
#gt-persist-chrome a,
#gt-persist-chrome input,
#gt-persist-chrome select,
#gt-persist-chrome textarea,
#gt-persist-chrome .sc-player__btn,
#gt-persist-chrome .sc-player__controls,
#gt-persist-chrome .sc-player__controls *,
#gt-persist-chrome #gt-music-title {
  pointer-events: auto !important;
}

/* Mini iframe: pin flush to the frame bottom (parent already handles OS inset) */
html.wead-mini-embed #gt-persist-chrome,
html[data-wead-mini-embed="1"] #gt-persist-chrome {
  bottom: 0 !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

.gt-persist-brief {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.45rem 0.85rem 0.2rem;
}

.gt-persist-brief__label {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-blue, #3dbbff);
  font-family: Inter, system-ui, sans-serif;
}

.gt-persist-brief__text {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 500;
  color: #e8fff3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: Inter, system-ui, sans-serif;
}

#gt-music-dock.sc-player {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  width: 100%;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.35rem 0.75rem 0.4rem;
  box-sizing: border-box;
  background: transparent;
}

#gt-music-dock .sc-player__track {
  position: relative;
  flex: 1 1 auto;
  min-width: 7.5rem;
  height: 1.2rem;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e8fff3;
  font-family: Inter, system-ui, sans-serif;
}

#gt-music-dock .sc-player__line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2rem;
  letter-spacing: 0.01em;
  color: #e8fff3;
  font-weight: 600;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}

#gt-music-dock .sc-player__line.is-active {
  opacity: 1;
  transform: translateY(0);
}

#gt-music-dock .sc-player__line--user {
  color: var(--accent-blue, #00aaff);
  font-weight: 500;
}

#gt-music-dock .sc-player__line--title {
  color: #e8fff3;
}

#gt-music-dock .sc-player__line--brand {
  color: #c8e4ff;
}

#gt-music-dock .sc-player__controls {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: 0 0 auto;
}

#gt-music-dock .sc-player__btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e8fff3;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#gt-music-dock .sc-player__btn--primary {
  border-color: rgba(0, 255, 136, 0.45);
  background: rgba(0, 255, 136, 0.12);
  color: #00ff88;
}

#gt-music-dock .sc-player__btn--toggle.active {
  border-color: rgba(0, 255, 136, 0.5);
  color: #00ff88;
}

@keyframes gt-sc-brand-shine {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

@keyframes gt-sc-brand-swap {
  0% { opacity: 0; transform: translateY(4px); }
  14% { opacity: 1; transform: translateY(0); }
  82% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-4px); }
}

/* Always-visible SoundChains.org — chrome text like WeAD Projects name, no button box */
#gt-music-dock .sc-player__brand {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  min-width: 7.6em !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 0.05rem 0 0.28rem !important;
  border: 0 !important;
  border-left: 0 !important;
  background: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  overflow: visible !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

#gt-music-dock .sc-player__brand-word {
  display: inline-block;
  white-space: nowrap;
  background: linear-gradient(
    90deg,
    #b8dcff 0%,
    #e8f6ff 35%,
    #ffffff 50%,
    #e8f6ff 65%,
    #b8dcff 100%
  );
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #e8f6ff;
  filter: drop-shadow(0 0 5px rgba(200, 228, 255, 0.55));
  animation: gt-sc-brand-shine 2.4s linear infinite;
}

#gt-music-dock .sc-player__brand-word.is-swap {
  animation:
    gt-sc-brand-shine 2.4s linear infinite,
    gt-sc-brand-swap 2.8s ease-in-out;
}

#gt-music-dock .sc-player__brand:hover .sc-player__brand-word,
#gt-music-dock .sc-player__brand:focus-visible .sc-player__brand-word {
  filter: brightness(1.18);
}

#gt-music-dock audio {
  display: none;
}

/* Hide React Brief+player — shell chrome owns the footer.
   Must beat gt-mobile-shell.css mobile force-show (display:block/flex !important). */
html body.gt-persist-chrome-on .gt-brief-footer-wrap,
html body.gt-persist-chrome-on .gt-brief-footer,
html body.gt-persist-chrome-on #root .gt-brief-footer-wrap,
html body.gt-persist-chrome-on #root .gt-brief-footer,
html body.gt-persist-chrome-on #root .gt-brief-footer .sc-player,
html body.gt-persist-chrome-on #root .gt-brief-footer-wrap .sc-player,
html body.gt-persist-chrome-on #root .sc-player {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* When tab has no brief copy, dock shows music only */
html body.gt-persist-chrome-on.gt-persist-brief-off .gt-persist-brief {
  display: none !important;
}

/* Desktop music-only: do not paint a full-width empty bar */
@media (min-width: 900px) {
  html body.gt-persist-chrome-on.gt-persist-brief-off #gt-persist-chrome {
    left: auto !important;
    right: 0 !important;
    width: auto !important;
    background: transparent !important;
    border-top: none !important;
    box-shadow: none !important;
    padding: 0.2rem 0.75rem 0.35rem 0 !important;
    min-height: 0 !important;
  }

  html body.gt-persist-chrome-on.gt-persist-brief-off #gt-music-dock.sc-player {
    margin-left: 0 !important;
    border-left: none !important;
    padding: 0.25rem 0.55rem !important;
    background: linear-gradient(
      90deg,
      var(--bg-card, #0b1218),
      var(--bg-secondary, #080e12)
    ) !important;
    border: 1px solid var(--border-accent, rgba(61, 187, 255, 0.28)) !important;
    border-radius: 10px !important;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.35);
  }

  html body.gt-persist-chrome-on.gt-persist-brief-off #root > div {
    padding-bottom: 8px !important;
  }
}

/* Leave room in the page for the fixed chrome */
body.gt-persist-chrome-on #root > div {
  padding-bottom: calc(var(--gt-persist-chrome-h, 110px) + 8px) !important;
}

/* News stage ends above persistent Brief+music */
body.gt-persist-chrome-on.gt-news-active .gt-news-stage,
html.gt-news-active body.gt-persist-chrome-on .gt-news-stage {
  bottom: var(--gt-persist-chrome-h, 110px) !important;
}

/*
 * PC web (Mini embed + non-Mini): one footer row —
 * BRIEF text left · music player right. Phone keeps stacked column above.
 */
@media (min-width: 900px) {
  :root {
    --gt-persist-chrome-h: 52px;
  }

  #gt-persist-chrome {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.65rem !important;
    padding: 0.3rem 0.75rem !important;
    min-height: 48px;
  }

  .gt-persist-brief {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    padding: 0.15rem 0 !important;
    gap: 0.55rem !important;
  }

  .gt-persist-brief__text {
    -webkit-line-clamp: 1 !important;
    font-size: 0.78rem !important;
    line-height: 1.3 !important;
  }

  #gt-music-dock.sc-player {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 40px !important;
    margin-left: auto !important;
    padding: 0.1rem 0.35rem 0.1rem 0.45rem !important;
    gap: 0.35rem !important;
    border-left: 1px solid rgba(61, 187, 255, 0.18);
  }

  #gt-music-dock .sc-player__track {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: 12.5rem !important;
    min-width: 4.5rem !important;
    height: 1.2rem !important;
    font-size: 0.82rem !important;
    padding-left: 0.12rem !important;
  }

  /* Active line in-flow so the slot hugs the title instead of a 200px hole */
  #gt-music-dock .sc-player__line {
    right: auto !important;
    width: max-content;
    max-width: 12.5rem;
  }

  #gt-music-dock .sc-player__line.is-active {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    width: auto !important;
    max-width: 12.5rem;
    transform: none;
  }

  #gt-music-dock .sc-player__btn {
    width: 28px !important;
    height: 28px !important;
    border-radius: 7px !important;
    font-size: 0.78rem !important;
  }

  #gt-music-dock .sc-player__brand {
    font-size: 0.7rem !important;
    padding-left: 0.32rem !important;
  }

  /* Music-only tabs: keep dock on the right */
  html body.gt-persist-chrome-on.gt-persist-brief-off #gt-music-dock.sc-player {
    margin-left: auto !important;
    border-left: none !important;
    padding-left: 0 !important;
  }
}

/* Mini embed on PC widths — same single-row layout (iframe often reports desktop width) */
@media (min-width: 900px) {
  html.wead-mini-embed #gt-persist-chrome,
  html[data-wead-mini-embed="1"] #gt-persist-chrome {
    flex-direction: row !important;
    align-items: center !important;
  }
}

/* Phone music row: keep SoundChains readable, no harsh underline */
@media (max-width: 899px) {
  #gt-persist-chrome {
    flex-direction: column !important;
  }

  #gt-music-dock.sc-player {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    border-left: none !important;
    padding: 0.3rem 0.55rem 0.35rem !important;
    justify-content: flex-start !important;
    gap: 0.35rem !important;
  }

  #gt-music-dock .sc-player__track {
    flex: 1 1 auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 1.2rem !important;
  }

  #gt-music-dock .sc-player__brand,
  #gt-music-dock .sc-player__brand:link,
  #gt-music-dock .sc-player__brand:visited,
  #gt-music-dock .sc-player__brand:hover,
  #gt-music-dock .sc-player__brand:active {
    flex: 0 0 auto !important;
    margin: 0 !important;
    max-width: none !important;
    font-size: 0.72rem !important;
    padding: 0 0.05rem 0 0.2rem !important;
    color: inherit !important;
    text-decoration: none !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    overflow: visible !important;
  }
}

@media (max-width: 899px) {
  #gt-persist-chrome {
    padding-left: 0.45rem !important;
    padding-right: 0.4rem !important;
    box-sizing: border-box !important;
  }
  #gt-music-dock.sc-player {
    padding-right: 0.1rem !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
  }
  #gt-music-dock .sc-player__btn {
    width: 26px !important;
    height: 26px !important;
  }
  #gt-music-dock .sc-player__brand {
    margin-right: 0 !important;
    max-width: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #gt-music-dock .sc-player__line {
    transition: none;
  }
  #gt-music-dock .sc-player__brand-word {
    animation: none;
    -webkit-text-fill-color: #e8fff3;
    background: none;
    color: #c8e4ff;
  }
}
