/* Plan #494: the explainer's play buttons and its one player, large or mini.
   Loaded only on the allowed public pages, and only while the video's ID is
   set. The player's own bar stays dark in both themes, like a video player. */

/* The round play buttons beside the homepage's main buttons. */
.ctx-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem; }
.ct-explainer-play { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0;
  border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.ct-explainer-play-dot { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 9999px;
  border: 2px solid #2BB8A0; color: #2BB8A0; transition: background .2s ease, color .2s ease; }
.ct-explainer-play-dot svg { width: 1.2rem; height: 1.2rem; margin-left: 2px; fill: currentColor; }
.ct-explainer-play:hover .ct-explainer-play-dot { background: #2BB8A0; color: #06110d; }
.ct-explainer-play-time { font-size: .8rem; font-weight: 600; color: #9aa3b5; }
.ct-explainer-play:focus-visible { outline: none; }
.ct-explainer-play:focus-visible .ct-explainer-play-dot { outline: 2px solid #2BB8A0; outline-offset: 3px; }

/* The player. */
#ct-explainer { position: fixed; z-index: 120; }
#ct-explainer[hidden] { display: none; }
.ctx-backdrop { display: none; }
.ctx-frame { position: relative; overflow: hidden; border-radius: 12px; border: 1px solid rgba(244,246,248,.18);
  background: #0E141C; color: #F4F6F8; box-shadow: 0 30px 80px -24px rgba(0,0,0,.9); }
.ctx-screen { position: relative; aspect-ratio: 16 / 9; background: #000; }
.ctx-player, .ctx-player iframe, .ctx-poster { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ctx-poster { object-fit: cover; }
.ctx-poster[hidden], .ctx-big[hidden] { display: none; }
.ctx-big { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-height: 44px;
  padding: .6rem 1.25rem; border: 0; border-radius: 9999px; background: #2BB8A0; color: #06110d;
  font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer; box-shadow: 0 8px 30px -8px rgba(0,0,0,.8); }
.ctx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .4rem .5rem; }
.ctx-note { margin-right: auto; font-size: .75rem; color: #9aa3b5; }
.ctx-btn { min-height: 36px; padding: .3rem .75rem; border-radius: 8px; border: 1px solid rgba(244,246,248,.25);
  background: transparent; color: #F4F6F8; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.ctx-btn:hover { background: rgba(244,246,248,.1); }
.ctx-btn:focus-visible, .ctx-big:focus-visible { outline: 2px solid #2BB8A0; outline-offset: 2px; }
@media (pointer: coarse) { .ctx-btn { min-height: 44px; min-width: 44px; } }

/* Large: centred, up to 900px wide (plan #495: about a quarter bigger than the How it works picture view,
   so YouTube starts it at 480p or better), keeping 16:9 and room for the bar. */
#ct-explainer.ctx-large { inset: 0; display: flex; align-items: center; justify-content: center; }
.ctx-large .ctx-backdrop { display: block; position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.ctx-large .ctx-frame { width: min(900px, 92vw, calc((100vh - 120px) * 16 / 9)); }
@media (hover: none) { .ctx-large .ctx-frame { width: min(94vw, calc((100svh - 120px) * 16 / 9)); } }

/* Mini: bottom-left, never in the way of the page around it. */
#ct-explainer.ctx-mini { left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 320px; }
#ct-explainer.ctx-mini.ctx-top { bottom: auto; top: 80px; }     /* a footer is showing */
.ctx-mini .ctx-frame { border-radius: 10px; }
.ctx-mini .ctx-note { display: none; }
.ctx-mini .ctx-bar { justify-content: flex-end; }
.ctx-mini .ctx-big { padding: .45rem .9rem; font-size: .85rem; }
@media (max-width: 640px) { #ct-explainer.ctx-mini { width: max(200px, 60vw); } }
@media (orientation: landscape) and (max-height: 500px) { #ct-explainer.ctx-mini { width: max(200px, 40vw); } }

@media (prefers-reduced-motion: no-preference) {
  .ctx-large .ctx-frame { animation: ctx-in .2s ease; }
  /* A fade, not a zoom (plan #495): the frame is full size when YouTube measures it. */
  @keyframes ctx-in { from { opacity: 0; } to { opacity: 1; } }
}

/* Plan #560: a lesson's poster (its number and title on our dark panel, never YouTube's
   thumbnail) and the "Lesson page" link back to its own page, in both sizes. */
.ctx-text-poster[hidden] { display: none; }
.ctx-text-poster { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center; background: #0E141C;
  color: #F4F6F8; font-weight: 700; font-size: clamp(.9rem, 2.4vw, 1.4rem); line-height: 1.3; }
.ctx-link { display: inline-flex; align-items: center; min-height: 36px; padding: .3rem .5rem; border-radius: 8px;
  color: #2BB8A0; font-size: .8rem; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ctx-link[hidden] { display: none; }
.ctx-link:focus-visible { outline: 2px solid #2BB8A0; outline-offset: 2px; }
.ctx-mini .ctx-link { margin-right: auto; }
.ctx-mini .ctx-text-poster { font-size: .85rem; }
@media (pointer: coarse) { .ctx-link { min-height: 44px; } }

/* Plan #561: inside the app. Under the phone filter sheet (65/70), the phone menu drawer (74/75) and the
   early-access screen (80); toasts (90) and confirm windows (showModal) are clear of it. The mini player
   sits just right of the side menu (w-36 plus the body's safe-area padding) where the menu shows, and is
   smaller up to 1023px so it clears the 360 view's "Show" strip. On a phone it keeps left: 16px. */
#ct-explainer.is-app { z-index: 60; }
@media (min-width: 768px) {
  #ct-explainer.is-app.ctx-mini { left: calc(9rem + 16px + env(safe-area-inset-left)); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  #ct-explainer.is-app.ctx-mini { width: 240px; }
}

/* Plan #561: the video-help icon. 20px in lines and titles, 24px in the empty Feedback page; a 44px tap
   area whose padding is taken back by negative margins, so no line gets taller. */
.ct-video-help { display: inline-flex; align-items: center; gap: .35rem; vertical-align: middle;
  padding: 12px; margin-block: -12px; border: 0; background: none; font: inherit; color: inherit;
  cursor: pointer; border-radius: 12px; -webkit-tap-highlight-color: transparent; }
.ct-video-help-icon { display: block; width: 20px; height: 20px; flex-shrink: 0; overflow: visible; }
.ct-video-help--title { margin-inline: -8px -12px; }
.ct-video-help--line { padding-inline: 6px; margin-inline-start: 2px; }
.ct-video-help--list { padding-inline: 6px; margin-inline: -6px 0; }
.ct-video-help--empty { padding: 10px 6px; margin-block: -10px; margin-inline-start: -6px; }
.ct-video-help--empty .ct-video-help-icon { width: 24px; height: 24px; }
.ct-video-help-words { font-size: .8125rem; font-weight: 600; line-height: 1.2; letter-spacing: 0; white-space: nowrap;
  color: rgb(var(--brand-600)); }
.ct-video-help:hover .ct-video-help-words { text-decoration: underline; text-underline-offset: 2px; }
.ct-video-help:hover .ct-video-help-icon rect { filter: brightness(1.12); }
.ct-video-help:focus { outline: none; }
.ct-video-help:focus-visible { outline: 2px solid rgb(var(--brand-600)); outline-offset: -4px; }
html.dark .ct-video-help rect { stroke: #5fd1c6; stroke-width: 1.5; }
html.dark .ct-video-help-words { color: #5fd1c6; }
html.dark .ct-video-help:focus-visible { outline-color: #5fd1c6; }
.ct-video-help-row { margin-top: .75rem; }
