/* Keep the image stage and actions stable across artwork ratios. The existing
   carousel, action hooks and topic paging continue to own their interactions. */
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-card > .memory-feed-visual {
  --memory-stage-height: max(376px, calc(var(--memory-page-height, calc(100svh - 156px)) - 180px));
  box-sizing: border-box;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: var(--memory-stage-height) !important;
  min-height: var(--memory-stage-height) !important;
  max-height: var(--memory-stage-height) !important;
  aspect-ratio: auto !important;
  background: #171816 !important;
}

body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-card > .memory-feed-visual > .memory-feed-carousel {
  grid-column: 1 !important;
  grid-row: 1;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  background: transparent !important;
}

/* Images use the full screen width. Short images center vertically; tall
   images scroll inside the fixed stage while the actions stay overlaid. */
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-visual .memory-feed-slide {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto;
  touch-action: pan-x pan-y !important;
  scrollbar-width: none;
}

body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-visual .memory-feed-slide::-webkit-scrollbar { display: none; }

body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-visual .memory-feed-slide img {
  flex: 0 0 auto !important;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: none !important;
  margin: auto 0 !important;
  object-fit: contain !important;
  object-position: center !important;
}

body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-card > .memory-feed-visual > .memory-feed-actions {
  position: absolute !important;
  inset: auto !important;
  right: max(10px, env(safe-area-inset-right, 0px)) !important;
  bottom: 14px !important;
  display: grid !important;
  grid-template-columns: 48px !important;
  grid-template-rows: repeat(6, 48px) !important;
  align-items: center;
  gap: 10px !important;
  width: 48px !important;
  height: 338px !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  pointer-events: none;
}

body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-card > .memory-feed-visual > .memory-feed-actions > button {
  box-sizing: border-box !important;
  flex: 0 0 48px !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  pointer-events: auto !important;
}

/* Optional media actions have their own slots above the four common actions. */
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-actions > [data-memory-feed-play] { grid-row: 2; }
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-actions > [data-memory-feed-video] { grid-row: 1; }
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-actions:not(:has(> [data-memory-feed-play])) > [data-memory-feed-video] { grid-row: 2; }
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-actions > [data-memory-feed-favorite] { grid-row: 3; }
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-actions > [data-memory-feed-annotate] { grid-row: 4; }
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-actions > [data-memory-feed-comments] { grid-row: 5; }
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-actions > [data-memory-feed-enter] { grid-row: 6; }

/* Reserve the indicator row even when a topic has only one image. */
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-copy > .memory-feed-dots,
body.student-page:is(.museum-refined, .student-paper) #podcastPanel #podcastLibrary .memory-feed-copy:not(:has(> .memory-feed-dots))::before {
  content: "";
  display: flex;
  height: 8px;
  min-height: 8px;
}
