/* The shared player is the second row of the header surface. */
.chat-audio-bar:not([hidden]) {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  flex: none; gap: 0 var(--ds-space-2);
  padding: 0 var(--chat-head-right) var(--ds-space-1) var(--chat-head-left);
  background-color: var(--chat-head-fill); color: var(--ds-ink);
}
#screen-text-chat[data-call-expanded="true"] > .chat-audio-bar,
#screen-text-chat:has(#chat-1x1-circle:not([hidden])) > .chat-audio-bar { display: none; }
.chat-audio-source.ds-btn {
  flex: 1; justify-content: start; gap: var(--ds-space-2); min-width: 0; width: 100%;
  padding-inline: var(--ds-space-2); text-align: start;
}
.chat-audio-meter { display: flex; align-items: center; justify-content: center; gap: 2px; flex: none; width: 23px; height: 26px; color: var(--ds-ink-accent); }
.chat-audio-meter i { width: 3px; height: 65%; border-radius: var(--ds-radius-pill); background: currentColor; transform: scaleY(.5); }
.chat-audio-meter i:nth-child(2) { height: 92%; animation-delay: -.3s; }
.chat-audio-meter i:nth-child(3) { height: 76%; animation-delay: -.54s; }
.chat-audio-meter i:nth-child(4) { height: 54%; animation-delay: -.14s; }
.chat-audio-bar[data-playing="true"] .chat-audio-meter i { animation-name: chat-audio-equalizer; animation-duration: .9s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
@keyframes chat-audio-equalizer { 0%, 100% { transform: scaleY(.32); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .chat-audio-bar[data-playing] .chat-audio-meter i { animation: none; } }
html[data-hub-motion="reduced"] .chat-audio-bar[data-playing] .chat-audio-meter i { animation: none; }
.chat-audio-copy { display: grid; flex: 1; min-width: 0; line-height: 1.2; }
.chat-audio-copy > span { font-size: var(--ds-fs-micro); color: var(--ds-ink-muted); }
.chat-audio-copy > *, .chat-library-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-audio-copy strong, .chat-library-copy strong { font-size: var(--ds-fs-body); }
.chat-audio-actions { display: flex; }
.chat-audio-actions .ds-btn { flex: none; padding: 0; }
#chat-audio-play { color: var(--ds-ink-accent); }
/* Keep the hit area big; only the painted track and thumb are slim. */
.chat-playhead {
  --chat-playhead-ink: var(--ds-ink-accent);
  --chat-playhead-line: var(--ds-edge);
  appearance: none; background: none; height: 26px; min-width: 0; margin: 0; cursor: pointer;
}
.chat-playhead:disabled { cursor: default; }
:where(html:not([data-lc-pointer-input])) .chat-playhead:focus-visible { outline-offset: var(--ds-focus-offset); }
.chat-playhead::-webkit-slider-runnable-track { height: 3px; border-radius: 9px; background: linear-gradient(to right, var(--chat-playhead-ink) var(--chat-playhead-fill, 0%), var(--chat-playhead-line) 0); }
.chat-playhead::-moz-range-track { height: 3px; border-radius: 9px; background: var(--chat-playhead-line); }
.chat-playhead::-moz-range-progress { height: 3px; border-radius: 9px; background: var(--chat-playhead-ink); }
.chat-playhead::-webkit-slider-thumb { appearance: none; width: 9px; height: 9px; margin-top: -3px; border-radius: 50%; background: var(--chat-playhead-ink); }
.chat-playhead::-moz-range-thumb { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--chat-playhead-ink); }
#chat-audio-progress { width: calc(100% - var(--ds-space-1)); margin-inline-start: var(--ds-space-1); }
/* The first row is independent, so its action buttons do not shorten the seek line below. */
.chat-audio-head { display: flex; grid-column: 1 / -1; min-width: 0; align-items: center; }
@media (forced-colors: active) {
  .chat-playhead { appearance: auto; accent-color: Highlight; }
  .chat-playhead::-webkit-slider-runnable-track { background: none; height: auto; }
  .chat-playhead::-webkit-slider-thumb { appearance: auto; background: none; margin: 0; }
}
.chat-audio-time { padding-inline-end: var(--ds-space-2); color: var(--ds-ink-muted); font-size: var(--ds-fs-label); font-variant-numeric: tabular-nums; text-align: end; }
@media (max-width: 360px) { .chat-audio-bar { column-gap: 0; } .chat-audio-source.ds-btn { padding-inline: var(--ds-space-1); gap: var(--ds-space-1); } }
@media (max-height: 355px) { .chat-audio-meter { height: 19px; } }
@media (max-height: 380px) {
  /* The circle already has its own seek ring. Keep the transport actions and
     jump target, and leave more of a shallow transcript to the actual video.
     A focused range stays available if the viewport shrinks during use. */
  .chat-audio-bar[data-kind="circle"] :is(.chat-audio-meter, #chat-audio-kind),
  .chat-audio-bar[data-kind="circle"]:not(:has(#chat-audio-progress:focus)) :is(#chat-audio-progress, #chat-audio-time) { display: none; }
}

.lc-modal.chat-library:modal {
  --lc-modal-width: 540px;
  --lc-modal-limit: 66dvh;
  display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); overflow: hidden;
}
.chat-library #chat-library-tabs { margin: 0 var(--ds-space-3) var(--ds-space-2); }
.chat-library-scroll { grid-row: 4; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 var(--ds-space-3) max(var(--ds-space-3), var(--ds-safe-bottom)); }
.chat-library ul { list-style: none; padding: 0; margin: 0; }
.chat-library :is(#chat-library-status, #chat-library-empty) { padding: var(--ds-space-3); margin: 0; color: var(--ds-ink-muted); }
#chat-library-status:empty { display: none; }
.chat-library-row {
  display: flex; align-items: center; column-gap: var(--ds-space-1); min-height: 54px;
  border-block-end: 1px solid var(--ds-edge);
}
.chat-library-row[data-playing-item] .chat-library-copy strong { color: var(--ds-ink-accent); }
.chat-library-row > .ds-btn { flex: none; }
.chat-library-icon { display: grid; place-items: center; width: 35px; height: 35px; flex: none; border-radius: var(--ds-radius-control); background: var(--ds-control); color: var(--ds-ink-accent); }
.chat-library-copy { display: grid; flex: 1; min-width: 0; padding-inline: var(--ds-space-1); }
.chat-library-copy small { color: var(--ds-ink-muted); font-size: var(--ds-fs-label); }
.chat-bubble[tabindex="-1"]:focus-visible { outline: var(--ds-focus-ring); outline-offset: -2px; }

/* Two calm, visible pulses once the attachment's message is in view. */
.chat-bubble[data-jump-pulse] .chat-lc-bubble { position: relative; }
.chat-bubble[data-jump-pulse] .chat-lc-bubble::after {
  content: ''; position: absolute; z-index: 4; inset: -2px; border-radius: inherit; pointer-events: none;
  background: color-mix(in srgb, var(--ds-ink) 12%, transparent);
  box-shadow: none;
}
@keyframes chat-attachment-pulse {
  0%, 100% { opacity: 0; }
  24%, 40% { opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  html:not([data-hub-motion="reduced"]) .chat-bubble[data-jump-pulse] .chat-lc-bubble::after {
    animation: chat-attachment-pulse 280ms ease-out 2 both;
  }
}
@media (forced-colors: active) {
  .chat-bubble[data-jump-pulse] .chat-lc-bubble::after { border: 2px solid Highlight; }
}
.chat-library-once-badge {
  display: grid; place-items: center; flex: none; inline-size: var(--chat-mark-width); block-size: var(--chat-mark-height);
  border-radius: var(--chat-mark-radius); background: var(--ds-control); color: var(--ds-ink-accent);
  font: 750 var(--chat-mark-font)/1 var(--lc-font);
}
