.watch-page:has([data-theater="true"]) {
  max-width: none;
  padding-inline: 0;
}

@media (min-width: 80rem) {
  .watch-page > .grid:has(> aside .sticky a):not(:has([data-theater="true"])) > .min-w-0:has(> section > .overflow-y-auto) {
    display: flex;
    flex-direction: column;

    & > section:has(> .overflow-y-auto) {
      display: flex;
      flex: 1;
      flex-direction: column;

      & > .overflow-y-auto {
        /* Let the recommendations set the row height while episodes scroll inside it. */
        contain: size;
        flex: 1;
        min-height: 6rem;
        max-height: none;
      }
    }
  }

  .watch-page > .grid:has([data-theater="true"]) {
    grid-template-columns: minmax(0, 1fr);
  }

  .watch-page:has([data-theater="true"]) aside .space-y-4 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;

    & > * { margin: 0; }
  }
}

/* Keep the seek control clear of the centre play target on short video frames. */
@media (max-width: 640px) {
  .watch-page video ~ .justify-end > .relative:has(> p) {
    position: absolute; inset: 0 0 auto; padding: 8px 12px; pointer-events: none;
  }
  .watch-page video ~ .justify-end > .relative:has(> p) p {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .watch-page video ~ .justify-end > .relative:has(input[step="0.1"]) {
    position: absolute; inset: auto 0 48px; padding: 0 12px;
  }
  .watch-page video ~ .justify-end > .relative:has(input[step="0.1"]) > .justify-between {
    position: absolute; inset: auto 12px 100%; pointer-events: none;
  }
  .watch-page video ~ .justify-end > .relative:has(> .flex > button) {
    padding: 0 8px 4px;
  }
}
