/* Shared player and in-page selection follow the section title and resume access. */
.section-audio-dock {
  width:100%;
  min-width:0;
  margin:20px 0 14px;
}
.section-audio-dock > .study-player {
  width:100%;
  margin:0;
}
.section-audio-dock .study-player-selection { max-width:720px; }
.section-audio-dock .study-player-transport { justify-content:flex-start; }
.section-audio-dock .study-player-list[aria-expanded=true] {
  border-color:#a52f7b;
  background:#f1ddeb;
  color:#8c2468;
  box-shadow:0 0 0 1px #d5a2c5;
}
.classroom-heading.classroom-heading-external-player {
  grid-template-columns:minmax(0,1fr);
}
.gallery-heading:not(:has(.study-player)),
.gallery-heading:has(.section-audio-dock) { grid-template-columns:minmax(0,1fr); }
.gallery-heading > div:has(> .section-audio-dock) { min-width:0; }
.page-intro:has(> .section-audio-dock) { max-width:none; }
.gallery-heading > .gallery-header-player:empty { display:none; }

.section-audio-picker {
  box-sizing:border-box;
  min-width:0;
  max-width:100%;
  margin:0 0 24px;
  padding:22px;
  border:1px solid #8e567f;
  border-radius:16px;
  background:#211c30;
  color:#f5e6f0;
}
.section-audio-picker[hidden],.section-audio-picker [hidden] { display:none!important; }
.section-audio-picker:has(> .classroom-selection) { padding:0; border:0; background:transparent; }
.section-audio-picker > .classroom-selection { margin:0; }
.section-audio-picker .playlist-settings { min-width:0; }
.section-audio-picker .playlist-settings > .eyebrow {
  margin:0 0 6px;
  color:#cfb1d4;
  font-size:11px;
}
.section-audio-picker .playlist-settings > h2 {
  margin:0 0 9px;
  color:#f9edf7;
  font-size:24px;
  line-height:1.25;
  overflow-wrap:anywhere;
}
.section-audio-picker .playlist-intro {
  max-width:90ch;
  margin:0 0 14px;
  color:#ddc7d7;
  font-size:14px;
  line-height:1.6;
}
.section-audio-picker .playlist-selection-tools { align-items:flex-end; padding:12px 0; gap:12px; }
.section-audio-picker .playlist-group {
  flex:1 1 240px;
  min-width:0;
  margin:0;
  color:#e2cce3;
  font-size:13px;
  line-height:1.4;
}
.section-audio-picker .playlist-group select,
.section-audio-picker .playlist-search input {
  display:block;
  box-sizing:border-box;
  width:100%;
  min-width:0;
  min-height:44px;
  padding:10px 12px;
  border:1px solid #ad87a8;
  border-radius:9px;
  background:#fffafd;
  color:#49304e;
  font:inherit;
  font-size:15px;
  line-height:1.4;
}
.section-audio-picker .playlist-group select { margin-top:5px; padding-right:30px; }
.section-audio-picker .playlist-bulk-actions { display:flex; flex:1 1 300px; gap:8px; flex-wrap:wrap; min-width:0; }
.section-audio-picker .playlist-bulk-actions button:not([hidden]) {
  flex:1 1 130px;
  min-width:0;
  min-height:44px;
  margin:0;
  padding:10px 12px;
  border:1px solid #ad87a8;
  border-radius:9px;
  background:#49304e;
  color:#f7e4f1;
  font:inherit;
  font-size:13px;
  line-height:1.4;
  white-space:normal;
  cursor:pointer;
}
.section-audio-picker .playlist-bulk-actions button:disabled { opacity:.42; cursor:default; }
.section-audio-picker .playlist-search { display:block; min-width:0; margin:14px 0 0; }
.section-audio-picker #playlist-summary { margin:12px 0 5px; color:#f5d6e9; font-size:14px; font-weight:650; line-height:1.45; }
.section-audio-picker .playlist-duration-total { margin:0 0 17px; color:#e8cce0; font-size:13px; line-height:1.45; font-variant-numeric:tabular-nums; }
.section-audio-picker .playlist-combined-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; min-width:0; }
.section-audio-picker .playlist-pick-group { min-width:0; margin:0; padding:0; }
.section-audio-picker .playlist-pick-group:has(> .playlist-pick-list:empty) { display:none; }
.section-audio-picker .playlist-combined-list:not(:has(.playlist-pick-group:nth-child(2) > .playlist-pick-list:not(:empty))),
.section-audio-picker .playlist-combined-list:not(:has(.playlist-pick-group:first-child > .playlist-pick-list:not(:empty))) { grid-template-columns:minmax(0,1fr); }
.section-audio-picker .playlist-pick-group > h3 { margin:0 0 9px; color:#ffe4f4; font-size:15px; line-height:1.4; }
.section-audio-picker .playlist-pick-list {
  display:grid;
  gap:8px;
  min-width:0;
  max-height:420px;
  margin:0;
  padding:3px 7px 3px 2px;
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  scrollbar-width:thin;
  scrollbar-color:#aa85b3 #37243f;
  list-style:none;
}
.section-audio-picker .playlist-topic-row {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  align-items:center;
  gap:8px;
  min-width:0;
  min-height:66px;
  margin:0;
  padding:0 10px;
  border:1px solid #d9c7df;
  border-radius:10px;
  background:#fffafd;
  color:#4b3555;
}
.section-audio-picker .playlist-topic-row.is-selected { grid-template-columns:minmax(0,1fr) 94px; border-color:#d2a4c2; background:#f4dfed; }
.section-audio-picker .playlist-topic-row:hover { border-color:#b57da5; }
.section-audio-picker .playlist-topic-option { display:flex; align-items:center; align-self:stretch; gap:10px; min-width:0; min-height:66px; margin:0; padding:11px 0; color:inherit; cursor:pointer; }
.section-audio-picker .playlist-topic-option > span { min-width:0; }
.section-audio-picker .playlist-topic-option strong { font-size:14px; }
.section-audio-picker .playlist-topic-option .playlist-duration { color:#68425d; font-weight:650; font-variant-numeric:tabular-nums; }
.section-audio-picker .playlist-position { color:#81516f; font-variant-numeric:tabular-nums; }
.section-audio-picker .playlist-order-controls { display:flex; align-items:center; gap:6px; }
.section-audio-picker .playlist-order-controls button:not([hidden]) {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
  width:44px;
  min-width:44px;
  height:44px;
  min-height:44px;
  margin:0;
  padding:0;
  border:1px solid #ac719d;
  border-radius:8px;
  background:#f0d5e8;
  color:#4a2851;
  cursor:pointer;
}
.section-audio-picker .playlist-order-controls button:hover:not(:disabled) { background:#e4b8d4; border-color:#814a74; }
.section-audio-picker .playlist-order-controls button:disabled { opacity:.3; cursor:default; }
.section-audio-picker .playlist-order-controls svg { width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.section-audio-picker .playlist-empty { grid-column:1/-1; margin:10px 0; padding:14px; border:1px dashed #be98b8; border-radius:10px; color:#e4cde1; font-size:14px; line-height:1.5; }
.section-audio-picker .playlist-footer { display:flex; align-items:stretch; margin:16px 0 0; padding:14px 0 0; border-top:1px solid #d4a7ce36; }
.section-audio-picker .playlist-footer .primary:not([hidden]) { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-width:0; min-height:48px; margin:0; padding:12px 20px; border:1px solid #e6b4d0; border-radius:11px; background:#e9b7d3; color:#39213c; font-size:15px; font-weight:750; line-height:1.35; white-space:normal; }
.section-audio-picker .playlist-footer .primary:disabled { opacity:.45; }
.section-audio-picker :is(button,input,select):focus-visible { outline:3px solid #8cc3b8; outline-offset:3px; }

@media(max-width:700px) {
  .section-audio-dock { margin-top:15px; }
  .section-audio-picker { padding:15px; margin-bottom:20px; }
  .section-audio-picker .playlist-settings > h2 { font-size:22px; }
  .section-audio-picker .playlist-intro { font-size:13px; }
  .section-audio-picker .playlist-combined-list { grid-template-columns:minmax(0,1fr); gap:18px; }
  .section-audio-picker .playlist-pick-list { max-height:320px; }
  .section-audio-picker .playlist-footer .primary:not([hidden]) { width:100%; }
}
@media(max-width:430px) {
  .section-audio-picker .playlist-topic-row.is-selected { grid-template-columns:minmax(0,1fr) 44px; padding-block:6px; }
  .section-audio-picker .playlist-order-controls { flex-direction:column; }
  .section-audio-picker .playlist-topic-option { gap:8px; }
}
/* The extra tools fit below the transport before a horizontal scrollbar is needed. */
@container study-player (min-width:431px) and (max-width:620px) {
  .section-audio-dock .study-player-transport { display:grid; grid-template-columns:42px minmax(104px,1fr) 64px; gap:8px; overflow:visible; }
  .section-audio-dock .study-player-button[data-action="section-audio-prev"] { grid-column:1; grid-row:1; }
  .section-audio-dock .study-player-button.study-player-play { grid-column:2; grid-row:1; width:100%; min-width:104px; max-width:none; }
  .section-audio-dock .study-player-button[data-action="section-audio-next"] { grid-column:3; grid-row:1; justify-self:end; }
  .section-audio-dock .study-player-button[data-action="section-audio-restart"] { grid-column:1; grid-row:2; }
  .section-audio-dock .study-player-list { grid-column:2; grid-row:2; justify-self:center; }
  .section-audio-dock .study-player-speed { grid-column:3; grid-row:2; justify-self:end; margin-left:0; }
  .section-audio-dock .gallery-player-tools { grid-column:1/-1; grid-row:3; justify-content:center; gap:10px; }
  .section-audio-dock [data-section-play-label] { position:static; width:auto; height:auto; padding:0; margin:0; overflow:visible; clip-path:none; white-space:normal; }
}
/* Every section uses the same native disclosure around its in-page picker. */
.section-playlist-selection > [data-inline-playlist-body] {
  min-width:0;
  padding:20px;
}
.section-playlist-selection > summary {
  overflow-wrap:anywhere;
}
.section-playlist-selection .playlist-settings > h2 { margin-top:0; }
.section-playlist-selection .playlist-selection-tools { margin-top:14px; }
@media(max-width:700px) {
  .section-playlist-selection > [data-inline-playlist-body] { padding:14px; }
  .section-playlist-selection > summary { padding:14px; }
}
/* A fine, slow pink outline marks only the currently unfolded selection. */
.section-audio-dock .study-player-list[aria-expanded=true] {
  animation:section-picker-outline 2.4s ease-in-out infinite;
}
.section-audio-dock .study-player-list:not([aria-expanded=true]) {
  animation:none;
  box-shadow:none;
}
@keyframes section-picker-outline {
  0%,100% { box-shadow:0 0 0 1px #ed5fb338,0 0 5px #ed5fb314; }
  50% { box-shadow:0 0 0 1px #ed5fb380,0 0 8px #ed5fb333; }
}
@media(prefers-reduced-motion:reduce) {
  .section-audio-dock .study-player-list[aria-expanded=true] {
    animation:none;
    box-shadow:0 0 0 1px #ed5fb380;
  }
}
/* Mobile transport: compact Play beside speed, with the remaining tools below. */
@media(max-width:700px) {
  .section-audio-dock > .study-player { padding:10px; }
}
@container study-player (max-width:620px) {
  .section-audio-dock .study-player-transport {
    display:grid;
    grid-template-columns:44px minmax(44px,88px) 64px 44px 44px;
    justify-content:center;
    align-items:center;
    gap:4px;
    margin-top:8px;
    overflow:visible;
  }
  .section-audio-dock .study-player-button,
  .section-audio-dock .gallery-player-tools button:not([hidden]) {
    box-sizing:border-box;
    width:44px;
    min-width:44px;
    height:44px;
    min-height:44px;
    margin:0;
    padding:8px;
    justify-self:center;
  }
  .section-audio-dock .study-player-button[data-action="section-audio-prev"] { grid-area:1 / 1; }
  .section-audio-dock .study-player-button.study-player-play {
    grid-area:1 / 2;
    width:100%;
    min-width:44px;
    max-width:88px;
    padding:8px;
  }
  .section-audio-dock .study-player-speed {
    grid-area:1 / 3;
    justify-self:center;
    width:64px;
    min-width:0;
    margin:0;
  }
  .section-audio-dock .study-player-speed select {
    box-sizing:border-box;
    width:64px;
    min-width:0;
    height:44px;
    min-height:44px;
    margin:0;
    padding:6px;
    font-size:13px;
  }
  .section-audio-dock .study-player-button[data-action="section-audio-next"] { grid-area:1 / 4; }
  .section-audio-dock .study-player-button[data-action="section-audio-restart"] { grid-area:1 / 5; }
  .section-audio-dock .study-player-list { grid-area:2 / 1; }
  .section-audio-dock .gallery-player-tools { display:contents; }
  .section-audio-dock .gallery-player-tools [data-action="audio-expand"] { grid-area:2 / 2; }
  .section-audio-dock .gallery-player-tools [data-action="audio-repeat"] { grid-area:2 / 3; }
  .section-audio-dock .gallery-player-tools [data-action="settings"] { grid-area:2 / 4; }
  .section-audio-dock .gallery-player-tools [data-action="audio-close"] { grid-area:2 / 5; }
  .section-audio-dock [data-section-play-label] {
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip-path:inset(50%);
    white-space:nowrap;
  }
  .section-audio-dock .study-player-detail { margin-top:6px!important; }
}
/* Nested cards at 320px retain five 44px targets without a horizontal scroll. */
@container study-player (max-width:255px) {
  .section-audio-dock .study-player-transport {
    grid-template-columns:repeat(5,minmax(44px,1fr));
    column-gap:2px;
  }
  .section-audio-dock .study-player-speed,
  .section-audio-dock .study-player-speed select { width:44px; }
  .section-audio-dock .study-player-speed select {
    appearance:none;
    -webkit-appearance:none;
    padding:0 2px;
    font-size:12px;
    text-align:center;
    text-align-last:center;
  }
}
