/* Video Library player: larger responsive 16:9 player (library.html modal + dashboard My Training embeds).
   Why: YouTube picks its starting quality from the player's on-screen size (plus connection and device).
   The old modal was capped at 700px wide, so YouTube often started at 360p-480p. A bigger player lets YouTube
   choose higher starting quality. YouTube cannot be forced to 1080p; viewers can always pick it in Settings. */

.vlib-modal-overlay { padding: 16px; }

/* Wide as the screen allows (max 1180px) but never taller than the window: player height is width * 9/16. */
.vlib-modal {
  max-width: min(100%, max(700px, min(1180px, calc((100vh - 150px) * 1.7778))));
}
.vlib-modal #vlib-modal-embed .video-embed { aspect-ratio: 16 / 9; padding-top: 0; height: auto; }
.vlib-modal #vlib-modal-embed .video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Small, unobtrusive quality tip under every embed */
.video-quality-tip {
  margin: 8px 12px 0; font-size: 12px; line-height: 1.4; color: var(--text-muted, #6b7a6f); text-align: center;
}
.vlib-modal .video-quality-tip { margin: 8px 16px 0; }

/* Phones: full-width player (no side gutters), modal fills the screen */
@media (max-width: 640px) {
  .vlib-modal-overlay { padding: 0; align-items: flex-start; }
  .vlib-modal { max-width: 100%; max-height: 100vh; min-height: 100vh; border-radius: 0; }
  .vlib-modal-close { top: 8px; right: 8px; width: 40px; height: 40px; font-size: 22px; }
}

/* Landscape phones: the whole 16:9 picture must fit the short screen */
@media (orientation: landscape) and (max-height: 520px) {
  .vlib-modal-overlay { padding: 0; align-items: flex-start; }
  .vlib-modal { max-width: min(100%, calc((100vh - 8px) * 1.7778)); max-height: 100vh; border-radius: 0; }
}
