.ve-editor__workspace:has(.ve-canvas-aspect) {
  --ve-stage-stable-height: 403px;
  --ve-timeline-split-height: 132px;
  grid-template-rows: auto auto minmax(0, auto) 10px minmax(112px, var(--ve-timeline-split-height));
  row-gap: 0;
  align-content: start;
}

@media (max-width: 760px) {
  .ve-editor__workspace:has(.ve-canvas-aspect) {
    grid-template-rows: auto auto minmax(0, auto) 10px minmax(82px, var(--ve-timeline-split-height));
  }
}

.ve-canvas-aspect {
  position: relative;
  width: 100%;
  max-width: 980px;
  margin-bottom: 0;
  z-index: 8;
  grid-row: 1;
  grid-column: 1;
  align-self: start;
  justify-self: center;
  display: flex;
  justify-content: flex-end;
}

.ve-canvas-aspect + .ve-editor__stage {
  grid-row: 1;
  grid-column: 1;
  margin-top: 5px;
  height: var(--ve-stage-stable-height);
}

.ve-editor__workspace:has(.ve-canvas-aspect) > .ve-player__controls {
  grid-row: 2;
  margin-top: 10px;
}

.ve-editor__workspace:has(.ve-canvas-aspect) > .ve-editor__trim-stage {
  grid-row: 3;
}

.ve-editor__workspace:has(.ve-canvas-aspect) > .ve-editor__stage-divider {
  grid-row: 4;
  justify-self: stretch;
  align-self: center;
}

.ve-editor__workspace:has(.ve-canvas-aspect) > .ve-layout-timeline {
  grid-row: 5;
  max-height: var(--ve-timeline-split-height);
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage {
  background: var(--ve-color-surface-subtle);
  border: 1px solid var(--ve-color-border-soft);
  border-radius: var(--ve-radius-block);
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-player__wrap {
  width: 100%;
  height: 100%;
  padding: 5px;
  display: grid;
  place-items: center;
  background: transparent;
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-player__video-frame {
  background: #000;
  border: 1px solid rgba(148, 163, 184, 0.62);
  border-radius: 2px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-player__video-frame::after {
  content: none;
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-player__video-frame video,
.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage > video {
  background: transparent;
  object-fit: contain;
}

.ve-editor__canvas-add {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  min-width: 92px;
  min-height: 82px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.92);
  color: #111827;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

.ve-editor__canvas-add[hidden] {
  display: none;
}

.ve-editor__canvas-add-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e5e7eb;
  color: #111827;
  font-size: 22px;
  line-height: 1;
}

.ve-canvas-aspect__button {
  display: inline-flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 74px;
  height: 74px;
  min-height: 74px;
  max-width: 74px;
  padding: 10px 8px 8px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
  color: #202033;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.08;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  white-space: nowrap;
}

.ve-canvas-aspect__button-icon {
  position: relative;
  display: block;
  width: 30px;
  height: 20px;
  border: 1.25px solid currentColor;
  border-radius: 4px;
  flex: 0 0 auto;
  opacity: 0.9;
  box-sizing: border-box;
}

.ve-canvas-aspect__button-icon::before,
.ve-canvas-aspect__button-icon::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0.42;
}

.ve-canvas-aspect__button-icon::before {
  left: 18%;
  right: 18%;
  bottom: 25%;
  height: 1px;
  background: currentColor;
}

.ve-canvas-aspect__button-icon::after {
  width: 3px;
  height: 3px;
  right: 22%;
  top: 24%;
  border-radius: 999px;
  background: currentColor;
  box-shadow: -5px 2px 0 -0.5px currentColor;
}

.ve-canvas-aspect__button-icon--source { width: 30px; height: 20px; }
.ve-canvas-aspect__button-icon--wide { width: 34px; height: 19px; }
.ve-canvas-aspect__button-icon--story { width: 19px; height: 34px; }
.ve-canvas-aspect__button-icon--square { width: 26px; height: 26px; }
.ve-canvas-aspect__button-icon--classic { width: 31px; height: 23px; }
.ve-canvas-aspect__button-icon--portrait { width: 22px; height: 31px; }
.ve-canvas-aspect__button-icon--panorama { width: 36px; height: 18px; }

.ve-canvas-aspect__button-icon--story::before,
.ve-canvas-aspect__button-icon--portrait::before {
  left: 50%;
  right: auto;
  top: 32%;
  bottom: 22%;
  width: 1px;
  height: auto;
  transform: translateX(-50%);
}

.ve-canvas-aspect__button-icon--story::after,
.ve-canvas-aspect__button-icon--portrait::after {
  left: 50%;
  right: auto;
  top: 18%;
  transform: translateX(-50%);
  box-shadow: 0 5px 0 -1px currentColor;
}

.ve-canvas-aspect__button-icon--square::before {
  left: 28%;
  right: 28%;
}

.ve-canvas-aspect__button-icon--square::after {
  right: 50%;
  transform: translateX(50%);
  box-shadow: -4px 4px 0 -1px currentColor, 4px 4px 0 -1px currentColor;
}

.ve-canvas-aspect__button-icon--panorama::before {
  left: 14%;
  right: 14%;
}

.ve-canvas-aspect__button-icon--panorama::after {
  box-shadow: -6px 2px 0 -0.75px currentColor, -12px 3px 0 -1px currentColor;
}

.ve-canvas-aspect__button-chevron {
  position: absolute;
  right: 9px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-right: 1.25px solid currentColor;
  border-bottom: 1.25px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
  opacity: 0.62;
}

.ve-canvas-aspect__menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 268px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
  color: #111827;
  backdrop-filter: blur(14px);
}

.ve-canvas-aspect__option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 7px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #1f2937;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.ve-canvas-aspect__option:hover {
  background: #f8fafc;
  color: #1f2937;
}

.ve-canvas-aspect__option[data-active="true"] {
  background: rgba(109, 40, 217, 0.075);
  color: #4c1d95;
}

.ve-canvas-aspect__shape {
  display: block;
  position: relative;
  justify-self: center;
  border: 1.25px solid currentColor;
  border-radius: 3px;
  box-sizing: border-box;
  opacity: 0.78;
}

.ve-canvas-aspect__shape::before,
.ve-canvas-aspect__shape::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0.42;
}

.ve-canvas-aspect__shape::before {
  left: 18%;
  right: 18%;
  bottom: 25%;
  height: 1px;
  background: currentColor;
}

.ve-canvas-aspect__shape::after {
  width: 3px;
  height: 3px;
  right: 22%;
  top: 24%;
  border-radius: 999px;
  background: currentColor;
  box-shadow: -5px 2px 0 -0.5px currentColor;
}

.ve-canvas-aspect__shape--source { width: 25px; height: 16px; }
.ve-canvas-aspect__shape--wide { width: 29px; height: 16px; }
.ve-canvas-aspect__shape--story { width: 16px; height: 29px; }
.ve-canvas-aspect__shape--square { width: 22px; height: 22px; }
.ve-canvas-aspect__shape--classic { width: 26px; height: 20px; }
.ve-canvas-aspect__shape--portrait { width: 18px; height: 26px; }
.ve-canvas-aspect__shape--panorama { width: 31px; height: 15px; }

.ve-canvas-aspect__shape--story::before,
.ve-canvas-aspect__shape--portrait::before {
  left: 50%;
  right: auto;
  top: 32%;
  bottom: 22%;
  width: 1px;
  height: auto;
  transform: translateX(-50%);
}

.ve-canvas-aspect__shape--story::after,
.ve-canvas-aspect__shape--portrait::after {
  left: 50%;
  right: auto;
  top: 18%;
  transform: translateX(-50%);
  box-shadow: 0 5px 0 -1px currentColor;
}

.ve-canvas-aspect__shape--square::before {
  left: 28%;
  right: 28%;
}

.ve-canvas-aspect__shape--square::after {
  right: 50%;
  transform: translateX(50%);
  box-shadow: -4px 4px 0 -1px currentColor, 4px 4px 0 -1px currentColor;
}

.ve-canvas-aspect__shape--panorama::before {
  left: 14%;
  right: 14%;
}

.ve-canvas-aspect__shape--panorama::after {
  box-shadow: -6px 2px 0 -0.75px currentColor, -12px 3px 0 -1px currentColor;
}

.ve-canvas-aspect__option-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ve-canvas-aspect__option-copy strong,
.ve-canvas-aspect__option-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ve-canvas-aspect__option-copy strong {
  font-size: 13px;
  line-height: 1.08;
  font-weight: 700;
}

.ve-canvas-aspect__option-copy small {
  color: #64748b;
  font-size: 11.5px;
  line-height: 1.12;
  font-weight: 500;
}

.ve-canvas-aspect__check {
  width: 12px;
  height: 7px;
  justify-self: end;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0;
  transform: rotate(-45deg) translateY(-1px);
}

.ve-canvas-aspect__option[data-active="true"] .ve-canvas-aspect__check {
  opacity: 1;
}

.ve-canvas-aspect__separator {
  display: block;
  height: 1px;
  margin: 8px 4px;
  background: #e5e7eb;
}

.ve-editor__stage[data-project-canvas-aspect] .ve-player__video-frame {
  max-width: 100%;
  max-height: 100%;
  align-self: center;
  justify-self: center;
  background: #000;
}

.ve-editor__stage[data-project-canvas-aspect="16:9"] .ve-player__video-frame,
.ve-editor__stage[data-project-canvas-aspect="2:1"] .ve-player__video-frame {
  width: min(100%, 900px);
  height: auto;
}

.ve-editor__stage[data-project-canvas-aspect="source"] .ve-player__video-frame {
  width: auto;
  height: 100%;
  aspect-ratio: var(--ve-project-source-aspect, 16 / 9);
}

.ve-editor__stage[data-project-canvas-aspect="16:9"] .ve-player__video-frame {
  aspect-ratio: 16 / 9;
}

.ve-editor__stage[data-project-canvas-aspect="2:1"] .ve-player__video-frame {
  aspect-ratio: 2 / 1;
}

.ve-editor__stage[data-project-canvas-aspect="4:3"] .ve-player__video-frame,
.ve-editor__stage[data-project-canvas-aspect="1:1"] .ve-player__video-frame,
.ve-editor__stage[data-project-canvas-aspect="9:16"] .ve-player__video-frame,
.ve-editor__stage[data-project-canvas-aspect="3:4"] .ve-player__video-frame {
  width: auto;
  height: 100%;
}

.ve-editor__stage[data-project-canvas-aspect="4:3"] .ve-player__video-frame {
  aspect-ratio: 4 / 3;
}

.ve-editor__stage[data-project-canvas-aspect="1:1"] .ve-player__video-frame {
  aspect-ratio: 1 / 1;
}

.ve-editor__stage[data-project-canvas-aspect="9:16"] .ve-player__video-frame {
  aspect-ratio: 9 / 16;
}

.ve-editor__stage[data-project-canvas-aspect="3:4"] .ve-player__video-frame {
  aspect-ratio: 3 / 4;
}

.ve-editor__stage[data-project-canvas-aspect] .ve-player__wrap video,
.ve-editor__stage[data-project-canvas-aspect] > video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-player__wrap {
  container-type: size;
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage[data-project-canvas-aspect] .ve-player__video-frame {
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage[data-project-canvas-aspect="source"] .ve-player__video-frame {
  width: min(100cqw, calc(100cqh * var(--ve-project-source-ratio, 1.777777)));
  height: min(100cqh, calc(100cqw / var(--ve-project-source-ratio, 1.777777)));
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage[data-project-canvas-aspect="16:9"] .ve-player__video-frame {
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage[data-project-canvas-aspect="9:16"] .ve-player__video-frame {
  width: min(100cqw, calc(100cqh * 9 / 16));
  height: min(100cqh, calc(100cqw * 16 / 9));
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage[data-project-canvas-aspect="1:1"] .ve-player__video-frame {
  width: min(100cqw, 100cqh);
  height: min(100cqh, 100cqw);
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage[data-project-canvas-aspect="4:3"] .ve-player__video-frame {
  width: min(100cqw, calc(100cqh * 4 / 3));
  height: min(100cqh, calc(100cqw * 3 / 4));
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage[data-project-canvas-aspect="3:4"] .ve-player__video-frame {
  width: min(100cqw, calc(100cqh * 3 / 4));
  height: min(100cqh, calc(100cqw * 4 / 3));
}

.ve-editor__workspace:has(.ve-canvas-aspect) .ve-editor__stage[data-project-canvas-aspect="2:1"] .ve-player__video-frame {
  width: min(100cqw, calc(100cqh * 2));
  height: min(100cqh, calc(100cqw / 2));
}

@media (max-width: 560px) {
  .ve-canvas-aspect {
    max-width: none;
  }

  .ve-canvas-aspect__menu {
    top: calc(100% + 8px);
    left: auto;
    right: auto;
    width: min(220px, calc(100vw - 24px));
  }

  .ve-editor__stage[data-project-canvas-aspect="16:9"] .ve-player__video-frame,
  .ve-editor__stage[data-project-canvas-aspect="source"] .ve-player__video-frame,
  .ve-editor__stage[data-project-canvas-aspect="4:3"] .ve-player__video-frame,
  .ve-editor__stage[data-project-canvas-aspect="2:1"] .ve-player__video-frame,
  .ve-editor__stage[data-project-canvas-aspect="9:16"] .ve-player__video-frame,
  .ve-editor__stage[data-project-canvas-aspect="3:4"] .ve-player__video-frame,
  .ve-editor__stage[data-project-canvas-aspect="1:1"] .ve-player__video-frame {
    max-width: 100%;
    max-height: 48vh;
  }

  .ve-editor__stage[data-project-canvas-aspect="16:9"] .ve-player__video-frame {
    width: min(100%, calc(48vh * 16 / 9));
    height: auto;
  }

  .ve-editor__stage[data-project-canvas-aspect="source"] .ve-player__video-frame {
    width: min(100%, calc(48vh * var(--ve-project-source-ratio, 1.777777)));
    height: auto;
  }

  .ve-editor__stage[data-project-canvas-aspect="2:1"] .ve-player__video-frame {
    width: min(100%, calc(48vh * 2));
    height: auto;
  }

  .ve-editor__stage[data-project-canvas-aspect="4:3"] .ve-player__video-frame {
    width: min(100%, calc(48vh * 4 / 3));
    height: auto;
  }

  .ve-editor__stage[data-project-canvas-aspect="1:1"] .ve-player__video-frame {
    width: min(100%, 48vh);
    height: auto;
  }

  .ve-editor__stage[data-project-canvas-aspect="9:16"] .ve-player__video-frame {
    width: min(100%, calc(48vh * 9 / 16));
    height: auto;
  }

  .ve-editor__stage[data-project-canvas-aspect="3:4"] .ve-player__video-frame {
    width: min(100%, calc(48vh * 3 / 4));
    height: auto;
  }
}
