.nq-video-player,
[data-nq-video-section] {
  --nq-video-max: min(78vh, 720px);
  --nq-video-width: calc(var(--nq-video-max) * var(--nq-video-ratio, 1));
}
.nq-video-player {
  box-sizing: border-box;
  display: grid;
  align-content: center;
  width: 100%;
  min-width: 0;
  background: #171b18;
  color: #faf9f5;
  border-radius: 8px;
}
.nq-video-player[data-nq-video-portrait] {
  width: min(100%, var(--nq-video-width));
  margin-inline: auto;
}
[data-nq-video-visual], [data-nq-video-copy] { min-width: 0; }
figure[data-nq-video-visual] { margin-inline: 0; }
@media (min-width: 900px) {
  dialog:has([data-nq-video-section][data-nq-video-portrait]) {
    width: min(calc(100% - 20px), 840px);
  }
  [data-nq-video-section][data-nq-video-portrait] {
    display: grid;
    grid-template-columns: minmax(0, min(48%, var(--nq-video-width))) minmax(0, 1fr);
    grid-template-areas: "visual copy";
    gap: clamp(16px, 3vw, 48px);
    align-items: start;
  }
  [data-nq-video-section][data-nq-video-portrait] > [data-nq-video-visual] { grid-area: visual; }
  [data-nq-video-section][data-nq-video-portrait] > [data-nq-video-copy] { grid-area: copy; }
}
.nq-video-player > .nq-video-frame,
.cycle2-viewer .comparison-row .nq-video-player > .nq-video-frame {
  box-sizing: border-box;
  position: relative;
  aspect-ratio: auto;
  width: 100%;
  min-height: 0;
  max-height: none;
  margin: 0 auto;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.nq-video-frame:focus-visible { outline: 2px solid #b6edce; outline-offset: -3px; }
.nq-video-frame > video.nq-video-media,
.cycle2-viewer #stage > video.nq-video-media {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}
.nq-video-frame > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.nq-video-controls {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
  padding: 4px 6px;
}
.nq-video-controls button {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.nq-video-controls button:hover,
.nq-video-controls button[aria-pressed="true"] { background: #343e36; }
.nq-video-controls input {
  flex: 1;
  width: 0;
  min-width: 0;
  margin: 0 4px;
  accent-color: #b6edce;
}
.nq-video-status { margin: 0; padding: 4px 12px 12px; color: inherit; }
.nq-video-player > .nq-video-caption {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 4px 12px 12px;
  color: inherit;
  font: inherit;
  font-size: .875rem;
  text-align: start;
  text-transform: none;
  overflow-wrap: anywhere;
}
.nq-video-expanded {
  box-sizing:border-box;
  position:fixed;
  inset:0;
  width:100vw;
  height:100dvh;
  max-width:none;
  max-height:none;
  padding:0;
  margin:0;
  border:0;
  background:#171b18;
}
.nq-video-expanded > .nq-video-player {height:100%;border-radius:0;}
.nq-video-player:fullscreen,
.nq-video-expanded > .nq-video-player {
  --nq-video-max: calc(100dvh - 60px);
  --nq-video-full-width: min(100%, calc(var(--nq-video-max) * var(--nq-video-ratio, 1.7777777778)));
  width: 100%;
  border-radius: 0;
}
.nq-video-player:is(:fullscreen, .nq-video-expanded > *):has(> .nq-video-caption) {
  --nq-video-max: calc(100dvh - 110px);
}
.nq-video-player:is(:fullscreen, .nq-video-expanded > *) > :is(.nq-video-frame, .nq-video-controls, .nq-video-caption) {
  width: var(--nq-video-full-width);
  margin-inline: auto;
}
.nq-video-player:is(:fullscreen, .nq-video-expanded > *) > .nq-video-controls {
  /* Keep the three touch targets and the seek bar usable beside a narrow clip. */
  width: min(100%, max(232px, var(--nq-video-full-width)));
}
.cycle2-viewer .nq-video-analysis {
  --nq-video-max: 57vh;
  --nq-video-max: 57svh;
}
.cycle2-viewer .nq-video-analysis > .nq-video-frame {
  width: min(100%, calc(var(--nq-video-max) * var(--nq-video-ratio, 1.7777777778)));
}
@media (min-width: 761px) {
  .cycle2-viewer .nq-video-analysis {
    --nq-video-max: max(120px, calc(100vh - 270px));
    --nq-video-max: max(120px, calc(100svh - 270px));
  }
}
.cycle2-viewer .nq-video-analysis:fullscreen {
  --nq-video-max: calc(100vh - 160px);
  --nq-video-max: calc(100svh - 160px);
}
/* Give inline portrait controls their own width while keeping the video height limit. */
.nq-video-player[data-nq-video-portrait]:not(:fullscreen, .nq-video-expanded > *) {
  width: min(100%, max(232px, var(--nq-video-width)));
}
.nq-video-player[data-nq-video-portrait]:not(:fullscreen, .nq-video-expanded > *) > .nq-video-frame {
  width: min(100%, var(--nq-video-width));
}
.nq-video-player[data-nq-video-portrait] > .nq-video-controls {
  flex-wrap: wrap;
}
.nq-video-player[data-nq-video-portrait] > .nq-video-controls input {
  min-width: min(64px, 100%);
}
@media (min-width: 900px) {
  [data-nq-video-section][data-nq-video-portrait] {
    grid-template-columns: minmax(0, min(48%, max(232px, var(--nq-video-width)))) minmax(0, 1fr);
  }
}
