.stage-actions .video-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e9efe7;
  border-color: #a8bbae;
  color: var(--green);
}

.stage-actions .video-trigger:hover {
  background: #dfeae0;
  border-color: #6f947e;
}

.video-trigger svg {
  flex: none;
}

.studio-video {
  width: min(92rem, calc(100% - 36px));
  max-width: none;
  max-height: calc(100vh - 30px);
  max-height: calc(100dvh - 30px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 18px 70px #17231e55;
}

.studio-video[open] {
  display: flex;
  flex-direction: column;
}

.studio-video::backdrop {
  background: #17231eba;
}

.studio-video__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(12px, 2vw, 28px);
  border-bottom: 1px solid var(--line);
}

.studio-video__header h2 {
  font-family: Georgia, serif;
  font-size: clamp(21px, 2.4vw, 32px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -.035em;
}

.studio-video__header button {
  flex-shrink: 0;
}

.studio-video__header button span {
  margin-inline-start: 2px;
  font-size: 17px;
  line-height: 1;
}

.studio-video__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(19rem, 26vw, 23rem);
  grid-template-rows: auto 1fr;
  grid-template-areas: "preview mode" "preview editor";
  align-items: start;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.studio-video__preview {
  grid-area: preview;
  min-width: 0;
  padding: clamp(12px, 1.8vw, 24px);
}

.studio-video__mode {
  grid-area: mode;
  min-width: 0;
  padding: clamp(13px, 1.7vw, 22px) clamp(13px, 1.7vw, 22px) 13px;
  border-inline-start: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #eef1e9;
}

.studio-video__mode label {
  display: block;
  margin-block-end: 5px;
  font-size: 14px;
  font-weight: 700;
}

.studio-video__mode select {
  width: 100%;
  min-height: 39px;
  border-color: #a8bbae;
  font-size: 13px;
  font-weight: 650;
}

.studio-video__mode p {
  margin-block-start: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.studio-video__sources {
  display: grid;
  grid-template-columns: minmax(0, .78fr) minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 8px;
  margin-block-start: 11px;
}

.studio-video__sources > div {
  min-width: 0;
}

.studio-video__sources label {
  margin-block-end: 4px;
  font-size: 12px;
  font-weight: 650;
}

.studio-video__sources select {
  min-width: 0;
  padding-inline-start: 7px;
  text-overflow: ellipsis;
}

.studio-video__source-action {
  margin-block-start: 9px;
}

#videoSourceStatus:empty {
  display: none;
}

#videoSourceStatus.error {
  color: #8b3022;
}

.studio-video__monitor {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(40vh, 22rem);
  min-height: min(40dvh, 22rem);
  padding: clamp(4px, .6vw, 9px);
  overflow: hidden;
  border: 1px solid #343833;
  border-radius: 12px;
  background: #151917;
}

.studio-video__viewport {
  position: relative;
  display: grid;
  width: fit-content;
  max-width: 100%;
  line-height: 0;
}

.studio-video__viewport canvas {
  display: block;
  max-width: 100%;
  max-height: min(66vh, 48rem);
  max-height: min(66dvh, 48rem);
  width: auto;
  height: auto;
  background: #151917;
}

.studio-video:has(#videoFocus[aria-pressed="true"]) .studio-video__viewport {
  cursor: crosshair;
  touch-action: manipulation;
}

.studio-video__focus-marker {
  position: absolute;
  z-index: 1;
  width: 26px;
  height: 26px;
  border: 2px solid #fffefa;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #192821, 0 0 7px #192821bf;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.studio-video__focus-marker::after {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #fffefa;
  box-shadow: 0 0 0 1px #192821;
  content: "";
}

.studio-video__empty {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 19px;
  background: #151917;
  color: #fffefa;
  text-align: center;
}

.studio-video__empty p {
  width: min(100%, 22rem);
  color: #d3dfd5;
  font-size: 13px;
  line-height: 1.45;
}

.studio-video__caption {
  min-height: 1.3em;
  margin-block: 9px 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.studio-video__timeline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block-end: 10px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.studio-video__timeline input {
  display: block;
  flex: 1;
  min-width: 0;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}

.studio-video__transport,
.studio-video__playback,
.studio-video__inspection-tools,
.studio-video__feedback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.studio-video__transport {
  justify-content: space-between;
}

.studio-video__playback .primary {
  min-width: 5.6rem;
}

.studio-video__focus-help,
.studio-video__feedback p,
.studio-video__import-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.studio-video__focus-help {
  display: none;
  margin-block-start: 9px;
}

.studio-video:has(#videoFocus[aria-pressed="true"]) .studio-video__focus-help {
  display: block;
}

.studio-video__feedback:not(:has(p:empty)) {
  margin-block-start: 9px;
}

.studio-video__feedback p.error,
.studio-video__import-status.error {
  color: #8b3022;
}

.studio-video__editor {
  grid-area: editor;
  align-self: stretch;
  min-width: 0;
  padding: clamp(13px, 1.7vw, 22px);
  border-inline-start: 1px solid var(--line);
  background: #f7f6f0;
}

.studio-video__settings {
  min-width: 0;
  margin: 17px 0 0;
  padding: 0;
  border: 0;
}

.studio-video__settings legend,
.studio-video__sequence h3 {
  margin: 0 0 10px;
  padding: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
}

.studio-video__settings legend {
  display: block;
  width: 100%;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.studio-video__settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(4rem, 1fr);
  gap: 8px;
}

.studio-video__settings-grid label,
.studio-video__zoom label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.studio-video__settings-grid select {
  margin-block-start: 5px;
  font-size: 13px;
}

.studio-video__zoom {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 9px;
  margin-block: 13px 8px;
}

.studio-video__motion {
  margin-block-start: 12px;
}

.studio-video__zoom output {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.studio-video__zoom input {
  width: 100%;
  grid-column: 1 / -1;
  min-height: 23px;
  margin: 0;
}

.studio-video__zoom-help {
  grid-column: 1 / -1;
  margin-block: 2px 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.studio-video input[type="range"],
.studio-video input[type="checkbox"] {
  accent-color: var(--green);
}

.studio-video input:focus-visible,
.studio-video__viewport:focus-visible {
  outline: 2px solid #779b84;
  outline-offset: 3px;
}

.studio-video__check {
  display: flex;
  align-items: center;
  min-height: 28px;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.studio-video__check:has(#videoDetail:disabled) {
  display: none;
}

.studio-video__check input,
.video-variant__include input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
}

.studio-video__sequence-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 7px;
}

#videoSequenceCount {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.studio-video__sequence-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  margin-block-end: 7px;
}

.studio-video__sequence-tools :is(.select, .action),
.video-import {
  min-height: 34px;
  font-size: 12px;
}

.studio-video__sequence-tools .action {
  padding-inline: 8px;
}

.studio-video__variants {
  display: grid;
  gap: 6px;
  max-height: min(35vh, 22rem);
  max-height: min(35dvh, 22rem);
  margin: 0;
  padding: 3px 4px 3px 0;
  overflow: auto;
  scrollbar-gutter: stable;
  list-style: none;
}

.studio-video__variants:not(:empty) {
  margin-block-end: 8px;
}

.studio-video__import-status:not(:empty) {
  margin-block-start: 8px;
}

.video-variant {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 7px;
  min-width: 0;
  padding: 6px 7px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.video-variant:has(:checked) {
  border-color: #a8bbae;
  background: #eef3eb;
}

.video-variant:is(.is-active, [aria-current="true"]) {
  border-color: #47705b;
  box-shadow: inset 2px 0 #47705b;
}

.video-variant[hidden] {
  display: none;
}

.video-variant__include {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 36px;
  gap: 7px;
  cursor: pointer;
}

.video-variant__thumb {
  display: block;
  flex: none;
  width: clamp(37px, 4.3vw, 68px);
  height: 39px;
  overflow: hidden;
  border: 1px solid #d9dbd0;
  border-radius: 5px;
  background: #e8e8df;
  object-fit: cover;
}

.video-variant__copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.video-variant__name,
.video-variant__source {
  display: block;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.video-variant__name {
  font-size: 12px;
  font-weight: 700;
}

.video-variant__source {
  color: var(--muted);
  font-size: 11px;
}

.video-variant__position {
  min-width: 15px;
  color: #4b6758;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.video-variant__order {
  display: flex;
  align-items: center;
  gap: 4px;
}

.video-variant__order .action {
  min-width: 32px;
  min-height: 32px;
  padding: 4px 6px;
  font-size: 15px;
  line-height: 1;
}

.studio-video button:disabled {
  cursor: default;
}

@media (max-width: 840px) {
  .studio-video {
    width: calc(100% - 14px);
    max-height: calc(100vh - 14px);
    max-height: calc(100dvh - 14px);
    border-radius: 11px;
  }

  .studio-video__body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: "mode" "preview" "editor";
  }

  .studio-video__mode {
    border-inline-start: 0;
  }

  .studio-video__mode select {
    min-height: 42px;
  }

  .studio-video__monitor {
    min-height: 0;
  }

  .studio-video__monitor:has(.studio-video__empty:not([hidden])) {
    min-height: 13rem;
  }

  .studio-video__viewport canvas {
    max-height: min(53vh, 40rem);
    max-height: min(53dvh, 40rem);
  }

  .studio-video__editor {
    border-inline-start: 0;
    border-top: 1px solid var(--line);
  }

  .studio-video__check,
  .studio-video__transport .action,
  .studio-video__sequence-tools :is(.select, .action),
  .video-import,
  .video-variant__order .action {
    min-height: 42px;
  }

  .video-variant__order .action {
    min-width: 42px;
  }

  .video-variant__thumb {
    width: 53px;
  }
}

@media (max-width: 350px) {
  .studio-video__sequence-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .video-variant__thumb {
    width: 41px;
    height: 32px;
  }

  .video-variant__position {
    min-width: 11px;
  }
}
