.topic-row-with-video {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topic-row-with-video h3 { flex: 1; min-width: 0; }
.topic-slides-link,
.topic-video-link,
.topic-notes-link,
.topic-quiz-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid rgba(115, 228, 255, .55);
  border-radius: 9px;
  background: rgba(115, 228, 255, .1);
  color: var(--cyan, #73e4ff);
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
}
.topic-slides-link:hover:not([aria-disabled]),
.topic-video-link:hover:not([aria-disabled]),
.topic-notes-link:hover:not([aria-disabled]),
.topic-quiz-link:hover:not([aria-disabled]) { background: rgba(115, 228, 255, .2); }
.topic-slides-link:focus-visible,
.topic-video-link:focus-visible,
.topic-notes-link:focus-visible,
.topic-quiz-link:focus-visible { outline: 2px solid var(--cyan, #73e4ff); outline-offset: 3px; }
.topic-resource-actions [aria-disabled="true"] { opacity: .4; cursor: default; }
.topic-notes-link { white-space: nowrap; }
.topic-resource-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.topic-header-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.unit-class-grid { align-items: stretch; }
.class-card-with-video {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-button);
}
.class-card-with-video > .class-card {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.class-card-with-video > .topic-resource-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
.class-card-with-video .topic-resource-actions > a {
  min-height: 36px;
  padding: 5px 10px;
  font-size: .825rem;
  white-space: nowrap;
}
/* The video view fits the visible viewport, including its native controls. */
body.study-page.topic-video-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.study-page.topic-video-page .app-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 8px 0 0;
}
.study-page.topic-video-page .resource-topbar {
  flex: 0 0 auto;
  margin-bottom: 8px;
}
.study-page.topic-video-page #resultPanel {
  display: flex;
  flex: 1;
  min-height: 0;
}
.study-page.topic-video-page .video-resource-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.study-page.topic-video-page .resource-page-header {
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  padding: 10px 12px;
}
.study-page.topic-video-page .resource-page-header > div { min-width: 0; }
.study-page.topic-video-page .resource-page-header .eyebrow { display: none; }
.study-page.topic-video-page .resource-page-header h2 {
  margin: 0;
  font-size: clamp(1.05rem, 1.6vw, 1.4rem);
  line-height: 1.3;
}
.study-page.topic-video-page .bilingual-course-label-english {
  margin-top: 3px;
  font-size: .85em;
}
.study-page.topic-video-page .resource-page-header .secondary-link {
  flex: 0 0 auto;
  width: auto;
  min-height: 36px;
  padding: 6px 12px;
  font-size: .875rem;
}
.study-page.topic-video-page .resource-page-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}
.study-page.topic-video-page .connected-video {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.study-page.topic-video-page .connected-video-header { display: none; }
.study-page.topic-video-page .connected-video-player {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  flex: 1;
  place-items: center;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: none;
  margin: 0;
  background: #07101b;
  box-shadow: none;
}
.study-page.topic-video-page .connected-video-player > video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: auto;
  object-fit: contain;
}
.study-page.topic-video-page .connected-video-player > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}
.study-page.topic-video-page .connected-video-player > video:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
}
.study-page.topic-video-page > .legal-footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 12px;
  gap: 3px 10px;
  font-size: .7rem;
  line-height: 1.3;
}
@media (max-width: 640px) {
  .topic-row-with-video { gap: 10px; }
  .topic-slides-link, .topic-video-link, .topic-notes-link, .topic-quiz-link { padding-inline: 10px; font-size: .875rem; }
  .topic-resource-actions { flex-direction: column; align-items: stretch; }
  .topic-row-with-video { flex-wrap: wrap; }
  .topic-row-with-video > .topic-resource-actions { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; }
  .topic-header-actions { justify-content: flex-end; }
  .topic-header-actions .secondary-link { width: auto; }
}

/* AP PDF notes keep their page controls and annotation tools in one reader. */
body.study-page.topic-notes-pdf-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.study-page.topic-notes-pdf-page .app-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 8px 0 0;
}
.study-page.topic-notes-pdf-page .resource-topbar { flex: 0 0 auto; margin-bottom: 8px; }
.study-page.topic-notes-pdf-page #resultPanel,
.study-page.topic-notes-pdf-page .notes-resource-page,
.study-page.topic-notes-pdf-page .resource-page-body,
.study-page.topic-notes-pdf-page .study-guide,
.study-page.topic-notes-pdf-page .study-guide > .collapsible-content,
.study-page.topic-notes-pdf-page .topic-summary-pdf {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.study-page.topic-notes-pdf-page .notes-resource-page,
.study-page.topic-notes-pdf-page .study-guide,
.study-page.topic-notes-pdf-page .study-guide > .collapsible-content,
.study-page.topic-notes-pdf-page .topic-summary-pdf { flex-direction: column; }
.study-page.topic-notes-pdf-page .notes-resource-page,
.study-page.topic-notes-pdf-page .resource-page-body { overflow: hidden; }
.study-page.topic-notes-pdf-page .resource-page-header {
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  padding: 10px 12px;
}
.study-page.topic-notes-pdf-page .resource-page-header .eyebrow { display: none; }
.study-page.topic-notes-pdf-page .resource-page-header h2 {
  margin: 0;
  font-size: clamp(1.05rem, 1.6vw, 1.4rem);
  line-height: 1.3;
}
.study-page.topic-notes-pdf-page .bilingual-course-label-english { margin-top: 3px; font-size: .85em; }
.study-page.topic-notes-pdf-page .resource-page-header .secondary-link {
  flex: 0 0 auto;
  width: auto;
  min-height: 36px;
  padding: 6px 12px;
  font-size: .875rem;
}
.study-page.topic-notes-pdf-page .resource-page-body { padding: 8px; }
.study-page.topic-notes-pdf-page .study-guide { margin: 0; border: 0; background: transparent; }
.study-page.topic-notes-pdf-page .study-guide > .collapsible-heading { display: none; }
.study-page.topic-notes-pdf-page .study-guide > .collapsible-content { padding: 0; }
.study-page.topic-notes-pdf-page .pdf-annotation-toolbar {
  position: static;
  flex: 0 0 auto;
  padding: 8px;
  margin-bottom: 8px;
  gap: 6px;
}
.study-page.topic-notes-pdf-page .topic-summary-pdf-pages.pdf-paginated {
  display: grid;
  grid-template: auto / minmax(0, 1fr);
  place-items: start center;
  flex: 1;
  height: auto;
  min-height: 0;
  overflow: auto;
  container-type: size;
}
.study-page.topic-notes-pdf-page .pdf-paginated .topic-summary-pdf-page {
  width: min(100%, 800px);
  margin: 0;
}
.study-page.topic-notes-pdf-page .topic-summary-pdf-page > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
}
.study-page.topic-notes-pdf-page > .legal-footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 12px;
  gap: 3px 10px;
  font-size: .7rem;
  line-height: 1.3;
}
@media (max-width: 760px) {
  .study-page.topic-notes-pdf-page .topic-summary-pdf-pages.pdf-paginated {
    grid-template-rows: auto;
    place-items: start center;
  }
  .study-page.topic-notes-pdf-page .pdf-paginated .topic-summary-pdf-page { width: 100%; }
}
/* Compact tools sit beneath the notes; Back stays separate inside the reader. */
@media screen {
  .study-page.topic-notes-pdf-page .resource-page-header {
    display: flex;
    position: relative;
    z-index: 25;
    justify-content: flex-end;
    gap: 8px;
    padding: 4px 8px;
    border-bottom: 0;
    background: transparent;
  }
  .study-page.topic-notes-pdf-page .resource-page-header > div:not(.pdf-reader-downloads) { display: none; }
  .study-page.topic-notes-pdf-page .resource-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 0;
  }
  .study-page.topic-notes-pdf-page .resource-topbar .brand-lockup { order: 0; }
  .study-page.topic-notes-pdf-page .resource-topbar .language-switch {
    position: static;
    order: 2;
    flex: 0 0 auto;
    margin-left: auto;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-edit,
  .study-page.topic-notes-pdf-page .pdf-reader-back {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 10px;
    font-size: .875rem;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-edit[aria-expanded="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
  }
  .study-page.topic-notes-pdf-page .pdf-reader-downloads {
    display: flex;
    flex: 0 0 auto;
    width: auto;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-downloads > .pdf-annotation-download-toggle {
    min-height: 36px;
    padding: 6px 10px;
    border-color: var(--line);
    background: var(--glass-button);
    color: var(--ink);
    font-size: .875rem;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-downloads .pdf-annotation-download-toggle::after { display: none; }
  .study-page.topic-notes-pdf-page .pdf-reader-downloads .pdf-annotation-download-menu {
    top: calc(100% + 6px);
    bottom: auto;
    right: 0;
    left: auto;
    width: max-content;
    min-width: 210px;
  }
  .study-page.topic-notes-pdf-page .study-guide > .collapsible-content { container-type: size; }
  .study-page.topic-notes-pdf-page .pdf-reader-document {
    --pdf-edit-space: 0px;
    display: grid;
    grid-template: minmax(0, 1fr) / 40px minmax(0, 1fr) 40px;
    gap: 0 8px;
    align-self: center;
    width: min(100%, max(440px, calc(96px + var(--pdf-spread-gaps, 0px) + (100cqh - var(--pdf-edit-space)) * var(--pdf-spread-ratio, .7071))));
    max-width: 100%;
    height: 100%;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-document.pdf-editing {
    --pdf-edit-space: 56px;
    grid-template-rows: minmax(0, 1fr) 48px;
    row-gap: 8px;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-rail[hidden] { display: none; }
  .study-page.topic-notes-pdf-page .pdf-reader-rail {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    top: auto;
    bottom: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    align-self: center;
    justify-self: center;
    gap: 8px;
    width: max-content;
    max-width: 100%;
    height: auto;
    min-height: 0;
    padding: 4px;
    margin: 0;
    border-radius: 9px;
    overflow: visible;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-tool,
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-action:not(.pdf-annotation-menu-item) {
    flex: 0 0 auto;
    width: 38px;
    min-height: 38px;
    padding: 0;
    gap: 0;
    font-size: 0;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-button-icon { width: 18px; height: 18px; flex-basis: 18px; }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-download-toggle::after { display: none; }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-tools {
    flex: 0 1 auto;
    flex-wrap: nowrap;
    flex-direction: row;
    gap: 4px;
    padding-bottom: 0;
    min-height: 0;
    overflow: auto;
    scrollbar-width: thin;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-color {
    flex: 0 0 auto;
    justify-content: center;
    width: 38px;
    min-height: 38px;
    padding: 4px;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-color > span,
  .study-page.topic-notes-pdf-page .pdf-reader-navigation .pdf-page-counter {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-color input { width: 28px; height: 26px; }
  .study-page.topic-notes-pdf-page .pdf-reader-navigation { display: contents; }
  .study-page.topic-notes-pdf-page .pdf-reader-navigation > button {
    grid-row: 1;
    align-self: center;
    justify-self: center;
    width: 40px;
    min-height: 44px;
    padding: 0;
    border-color: rgba(115, 228, 255, .4);
    border-radius: 50%;
    background: rgba(115, 228, 255, .08);
    color: var(--cyan, #73e4ff);
    font-size: 0;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-navigation > button:first-child { grid-column: 1; }
  .study-page.topic-notes-pdf-page .pdf-reader-navigation > button:last-child { grid-column: 3; }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-resource-actions {
    display: flex;
    flex: 0 0 auto;
    width: auto;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-download-menu {
    top: auto;
    bottom: calc(100% + 8px);
    left: auto;
    right: 0;
    min-width: 210px;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-rail .pdf-annotation-menu-item { font-size: .875rem; }
  .study-page.topic-notes-pdf-page .pdf-reader-document .topic-summary-pdf-pages.pdf-paginated {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template: minmax(0, 1fr) / repeat(var(--pdf-spread-count, 1), minmax(0, 1fr));
    gap: 12px;
    place-items: center;
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
  }
  .study-page.topic-notes-pdf-page .pdf-reader-document .pdf-paginated .topic-summary-pdf-page {
    width: min(100%, calc(100cqh * var(--pdf-page-ratio, .7071)));
    margin: 0;
  }
  @media (max-width: 760px) {
    .study-page.topic-notes-pdf-page .resource-topbar { gap: 8px; }
    .study-page.topic-notes-pdf-page .pdf-reader-downloads > .pdf-annotation-download-toggle { width: 36px; padding: 0; gap: 0; font-size: 0; }
    .study-page.topic-notes-pdf-page .pdf-reader-downloads { position: static; }
    .study-page.topic-notes-pdf-page .pdf-reader-downloads .pdf-annotation-download-menu { top: calc(100% + 2px); right: 8px; }
    .study-page.topic-notes-pdf-page .resource-topbar .language-switch button { padding: 8px 10px; }
    .study-page.topic-notes-pdf-page .pdf-reader-document {
      position: relative;
      grid-template-columns: minmax(0, 1fr);
      width: min(100%, max(264px, calc((100cqh - var(--pdf-edit-space)) * var(--pdf-spread-ratio, .7071))));
    }
    .study-page.topic-notes-pdf-page .pdf-reader-document .topic-summary-pdf-pages.pdf-paginated { grid-column: 1 / -1; }
    .study-page.topic-notes-pdf-page .pdf-reader-rail { grid-column: 1; }
    .study-page.topic-notes-pdf-page .pdf-reader-navigation > button {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      z-index: 5;
      background: rgba(25, 45, 70, .85);
    }
    .study-page.topic-notes-pdf-page .pdf-reader-document.pdf-editing .pdf-reader-navigation > button { top: calc(50% - 28px); }
    .study-page.topic-notes-pdf-page .pdf-reader-navigation > button:first-child { left: 0; }
    .study-page.topic-notes-pdf-page .pdf-reader-navigation > button:last-child { right: 0; }
  }
  .pdf-reader-document.annotation-enabled .topic-summary-pdf-page[data-annotation-active="true"] {
    outline: 2px solid #73e4ff;
    outline-offset: 2px;
  }
}
@media print {
  .study-page.topic-notes-pdf-page .pdf-reader-back,
  .study-page.topic-notes-pdf-page .pdf-reader-edit,
  .study-page.topic-notes-pdf-page .pdf-reader-downloads { display: none; }
  body.study-page.topic-notes-pdf-page { height: auto; overflow: visible; }
  .study-page.topic-notes-pdf-page .notes-resource-page,
  .study-page.topic-notes-pdf-page .resource-page-body { overflow: visible; }
  .study-page.topic-notes-pdf-page .topic-summary-pdf-pages.pdf-paginated { display: block; height: auto; container-type: normal; overflow: visible; }
  .study-page.topic-notes-pdf-page .pdf-paginated .topic-summary-pdf-page { width: 100%; }
}

/* Resource row titles are labels; only the three resource buttons navigate. */
.topic-resource-title { cursor: text; }
.class-card-with-video > .class-card.topic-resource-title:hover {
  border: 0;
  background: transparent;
}
