/* Playlist-watch queue, transcript, category pills. Default template only (body.ov-page). */
body.ov-page .playlist-container {
  background: color-mix(in srgb, var(--ov-brand) 10%, var(--ov-surface));
  border: 0.5px solid var(--ov-border);
  border-radius: var(--ov-radius-card);
  overflow: hidden;
  max-height: 300px;
  display: flex;
  flex-direction: column;
}
body.ov-page .playlist-container-header {
  padding: 10px 12px;
  font-size: var(--ov-fs-meta);
  font-weight: 500;
  border-bottom: 0.5px solid var(--ov-border);
  flex-shrink: 0;
}
body.ov-page .playlist-container-header h5 {
  margin: 0;
  font-size: var(--ov-fs-body);
  font-weight: 500;
}
body.ov-page .playlist-container-header a {
  color: inherit;
  text-decoration: none;
}
body.ov-page .ov-queue-sub {
  margin: 4px 0 0;
  font-size: var(--ov-fs-caption);
  color: var(--ov-text-secondary);
  font-weight: 400;
}
body.ov-page .transcript-time {
  cursor: pointer;
  color: var(--ov-brand);
}
body.ov-page .playlist-item-container {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
body.ov-page .playlist-items {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}
body.ov-page .playlist-items .side-video {
  padding: 8px 10px !important;
  background: transparent !important;
}
body.ov-page .playlist-items.is-current .side-video,
body.ov-page .playlist-items[aria-current="true"] .side-video {
  background: color-mix(in srgb, var(--ov-brand) 16%, var(--ov-surface)) !important;
}
body.ov-page .playlist-items.is-current .playlist-index-container,
body.ov-page .playlist-items.is-current .side-video-title,
body.ov-page .playlist-items[aria-current="true"] .playlist-index-container,
body.ov-page .playlist-items[aria-current="true"] .side-video-title {
  color: var(--ov-brand) !important;
}
body.ov-page .ov-queue-toggle {
  display: none;
}
body.ov-page .ov-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
body.ov-page .ov-tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--ov-fs-caption);
  color: var(--ov-text-secondary);
  background: var(--ov-surface-sunken);
  border: 0.5px solid var(--ov-border);
  border-radius: var(--ov-radius-pill);
  padding: 4px 10px;
}
body.ov-page .ov-transcript { margin-top: 8px; }
body.ov-page .ez-playlist-up-next,
body.ov-page .next-video-container {
  border-radius: var(--ov-radius-media);
  font-size: var(--ov-fs-body);
}
body.ov-page .next-video-container .up-next-text {
  font-size: var(--ov-fs-meta);
  font-weight: 500;
}
body.ov-page .next-video-card {
  border-radius: var(--ov-radius-media);
  border: 0.5px solid var(--ov-border);
}
@media (max-width: 767.98px) {
  /* video_task #340: on mobile the page stacks into one column
     (custom-main-layout.scss <=767px), which drops the queue -- it lives in
     #video-row-right -- below the entire left column, i.e. under Latest
     Videos at the very bottom of the page. The #271 spec puts a collapsed
     bar directly under the player, above the title. Flattening the four
     wrappers between #video-row and the player/queue makes them siblings of
     one flex container, so two `order` declarations are enough to place the
     bar; no markup move, no JS, and desktop (>=768px) is not reached by this
     query. The breakpoint must stay in step with the column-stack
     breakpoint: if the bar's range is narrower than the stack's range there
     is a band with no bar and a full-height queue at the page bottom
     (video_task #340 E6). */
  body.ov-page .ov-row--playlist,
  body.ov-page .ov-row--playlist > #video-row-left,
  body.ov-page .ov-row--playlist > #video-row-left > main,
  body.ov-page .ov-row--playlist > #video-row-left > main > section.mb-2,
  body.ov-page .ov-row--playlist > #video-row-right {
    display: contents;
  }
  body.ov-page .ov-row--playlist #default-mode-container {
    order: -2;
  }
  body.ov-page .ov-row--playlist > #video-row-right > aside {
    order: -1;
  }
  /* section.mb-2 carried the gap between #video-actions-row and the
     description; flattening it away drops that 8px gap (video_task #340 E8,
     finding 1). */
  body.ov-page .ov-row--playlist #video-actions-row {
    margin-bottom: .5rem;
  }

  /* The bar leaves #video-row-right's `overflow: hidden` once flattened
     (custom-main-layout.scss), so it needs its own containment
     (video_task #340 E5). */
  body.ov-page .ov-row--playlist .ov-queue-toggle {
    display: flex;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    justify-content: center;
    margin-bottom: 8px;
  }
  /* The toggle text used to be a bare text node -- no element for
     text-overflow: ellipsis to attach to (video_task #340 E5) -- so
     watch-page.html wraps it in this span. */
  body.ov-page .ov-row--playlist .ov-queue-toggle__label {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The <=640px predecessor released max-height but not
     custom-body.scss's playlist-container height of 400px, so a
     *closed* queue rendered as 357px of empty bordered box
     (video_task #340 E4). Closed = the bar only. */
  body.ov-page .ov-row--playlist .playlist-container:not(.is-open) {
    display: none;
  }
  body.ov-page .ov-row--playlist .playlist-container.is-open {
    height: auto;
    max-height: min(60vh, 420px);
  }
}
