.timeline-video-viewer {
  --viewer-top: max(64px, calc(env(safe-area-inset-top) + 16px));
  --viewer-footer: 160px;
  --viewer-inline: 48px;
  position: fixed;
  inset: 0;
  z-index: 30010;
  color: #fff;
  background: #020813;
  font-family: inherit;
}
.timeline-video-viewer[hidden] { display: none; }
body.timeline-video-open { overflow: hidden; }
body:is(.timeline-video-open, .core-glimpse-open) .comments-modal {
  z-index: 30020;
  align-items: end;
  padding: 0 16px;
}
body:is(.timeline-video-open, .core-glimpse-open) .comments-sheet {
  width: min(100%, 760px);
  max-height: min(65dvh, 680px);
  min-height: 220px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.timeline-video-close {
  position: absolute;
  z-index: 5;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(2, 8, 19, .55);
  font: 400 2rem/1 sans-serif;
  cursor: pointer;
}
.timeline-video-layout {
  display: grid;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 0;
}
.timeline-video-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  padding: var(--viewer-top) var(--viewer-inline) calc(var(--viewer-footer) + env(safe-area-inset-bottom));
  background: #000;
}
.timeline-video-frame {
  --video-aspect: 1.7777778;
  position: relative;
  width: min(100%, 1440px, calc((100dvh - var(--viewer-top) - var(--viewer-footer) - env(safe-area-inset-bottom)) * var(--video-aspect)));
  max-height: calc(100dvh - var(--viewer-top) - var(--viewer-footer) - env(safe-area-inset-bottom));
  aspect-ratio: var(--video-aspect);
  overflow: hidden;
  background: #000;
}
.timeline-video-frame video,
.timeline-video-frame img,
.timeline-video-specimen {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #000;
}
.timeline-text-only-preview {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: clamp(24px, 5vw, 80px);
  overflow-wrap: anywhere;
  color: #fff;
  background: #102451;
  font-size: clamp(1.25rem, 3vw, 2.5rem);
  line-height: 1.35;
  text-align: center;
}
.timeline-media-nav {
  position: absolute;
  z-index: 5;
  top: 50%;
  width: 46px;
  height: 54px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: rgba(2, 8, 19, .66);
  font: 400 2.2rem/1 sans-serif;
  cursor: pointer;
}
.timeline-media-nav[hidden], .timeline-media-position[hidden] { display: none; }
.timeline-media-nav:disabled { opacity: .35; cursor: default; }
.timeline-media-prev { left: max(8px, env(safe-area-inset-left)); }
.timeline-media-next { right: max(8px, env(safe-area-inset-right)); }
.timeline-media-position {
  position: absolute;
  z-index: 4;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 5px #000;
}
.timeline-video-frame video { cursor: default; }
.timeline-video-date {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 13px;
  color: #fff;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px #000, 0 2px 10px #000;
  pointer-events: none;
}
.timeline-video-info {
  position: fixed;
  z-index: 4;
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 60px);
  left: 50%;
  display: grid;
  gap: 3px;
  width: min(calc(100% - 32px), 1120px);
  transform: translateX(-50%);
  background: none;
}
.timeline-video-owner { display: grid; gap: 2px; }
.timeline-video-owner strong { font-size: clamp(1rem, 2vw, 1.25rem); }
.timeline-video-owner small { color: #52698f; font-size: .78rem; }
.timeline-video-caption { max-width: 52ch; margin: 0; font-size: .9rem; line-height: 1.45; }
.timeline-video-actions {
  position: fixed;
  z-index: 4;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: min(calc(100% - 32px), 1120px);
  transform: translateX(-50%);
}
.timeline-video-actions button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 48px;
  min-height: 48px;
  padding: 4px;
  border: 0;
  color: #fff;
  background: transparent;
  font: inherit;
  font-size: .72rem;
  font-weight: 750;
  text-shadow: 0 2px 5px #000;
  cursor: pointer;
}
.timeline-video-actions button[aria-pressed="true"] { color: #b892ff; }
.timeline-video-actions svg { width: 22px; height: 22px; }
.timeline-video-expand {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,.8);
  border-radius: 50%;
  color: #fff;
  background: rgba(3, 12, 30, .65);
  cursor: pointer;
}
.timeline-video-expand::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 20px solid currentColor;
}
body.is-logged-in .timeline-view .timeline-api-media > video,
body.is-logged-in .timeline-view .core-social-video > video,
body.is-logged-in .timeline-view .timeline-user-media:is(video) {
  object-fit: contain;
  background: #000;
  cursor: pointer;
}
@media (min-width: 600px) and (max-width: 1199px) {
  .timeline-video-viewer { --viewer-footer: 158px; --viewer-inline: 24px; }
  .timeline-video-info,
  .timeline-video-actions { width: min(calc(100% - 48px), 960px); }
}
@media (max-width: 599px) {
  .timeline-video-viewer { --viewer-top: max(58px, calc(env(safe-area-inset-top) + 12px)); --viewer-footer: 148px; --viewer-inline: 0px; }
  .timeline-video-caption { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .78rem; }
  .timeline-video-info { gap: 2px; }
  .timeline-video-date { bottom: 8px; font-size: .62rem; }
  .timeline-video-actions button { min-width: 42px; min-height: 42px; font-size: .62rem; }
  .timeline-video-actions svg { width: 20px; height: 20px; }
  .timeline-media-nav { width: 38px; height: 48px; font-size: 1.8rem; }
}
@media (max-height: 600px) and (orientation: landscape) {
  .timeline-video-viewer { --viewer-top: max(52px, calc(env(safe-area-inset-top) + 8px)); --viewer-footer: 118px; }
  .timeline-video-date { bottom: 8px; }
  .timeline-video-caption { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .timeline-video-viewer * { scroll-behavior: auto; }
}

/* Keep the preview clickable without drawing a play badge over moving video. */
.timeline-video-playing > .timeline-video-expand,
.timeline-video-playing > .timeline-play { opacity:0; }
