/* Entry host: transparent mount so workbench width/height rules apply. */
[data-video-tool-editor] {
  display: block;
  width: 100%;
}

/* Unified editor root — scroll target for CTAs / Start New (all landings). */
#video-tool-editor-root {
  scroll-margin-top: 5.5rem;
}

@media (min-width: 1024px) {
  #video-tool-editor-root {
    scroll-margin-top: 4.75rem;
  }
}

/* Editor focus — hide marketing hero; center workbench (specialty tool pages) */
body.tool-page--editor-focus {
  --site-header-h: 4.5rem;
}

body.tool-page--editor-focus #tool-page-hero {
  display: none;
}

body.tool-page--editor-focus main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - var(--site-header-h));
  padding-top: 2rem;
  padding-bottom: 2rem;
  box-sizing: border-box;
}

body.tool-page--editor-focus #video-tool-editor-root,
body.tool-page--editor-focus #tool-section {
  margin-top: 0;
  flex: 0 0 auto;
}

body.tool-page--editor-focus #tool-workbench {
  scroll-margin-top: calc(var(--site-header-h) + 1rem);
}

/* Money home — same focus contract, different hero id / root class */
body.money-page--editor-focus {
  --site-header-h: 4.5rem;
}

body.money-page--editor-focus #money-page-hero {
  display: none;
}

body.money-page--editor-focus main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - var(--site-header-h));
  padding-top: 2rem;
  padding-bottom: 2rem;
  box-sizing: border-box;
}

body.money-page--editor-focus #video-tool-editor-root.money-hero-tool {
  margin-top: 0;
  padding-top: 0;
  flex: 0 0 auto;
}

body.money-page--editor-focus #tool-workbench {
  scroll-margin-top: calc(var(--site-header-h) + 1rem);
}

body.money-page--editor-focus #video-tool-editor-root.money-hero-tool::before {
  opacity: 0.65;
}

/* Workbench — fixed footprint (EMPTY ↔ EDITOR). Video scales inside stage. */
.tool-workbench {
  --wb-stage-video-h: min(50vh, 420px);
  --wb-chrome: 5.25rem;
  --workbench-h: calc(var(--wb-stage-video-h) + var(--wb-chrome));
  width: 100%;
  height: var(--workbench-h);
  min-height: var(--workbench-h);
  max-height: var(--workbench-h);
  border-radius: 1rem;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

@media (min-width: 640px) {
  .tool-workbench {
    --wb-stage-video-h: min(54vh, 480px);
    --wb-chrome: 5.5rem;
  }
}

@media (min-width: 1024px) {
  .tool-workbench {
    --wb-stage-video-h: min(62vh, 580px);
    --wb-chrome: 5.75rem;
  }
}

.tool-workbench #main-layout-grid {
  height: 100%;
  min-height: 0;
}

/* Content-safety copy — same emphasis as payable charge subtext (amber). */
.editor-cta-subtext.editor-cta-subtext--content-safety,
#upload-cta-subtext.editor-cta-subtext--content-safety {
  color: rgb(252 211 77); /* amber-300 — match --charge */
  font-weight: 600;
}

/* Result CTA = same solid emerald as Start Removing (no teal gradient / black text). */
#btn-download-video.editor-primary-cta,
#btn-download-video {
  background-image: none;
  background-color: rgb(16 185 129);
  color: #fff;
  box-shadow: 0 4px 14px rgb(16 185 129 / 0.22);
}

#btn-download-video.editor-primary-cta:hover,
#btn-download-video:hover {
  background-image: none;
  background-color: rgb(52 211 153);
  box-shadow: 0 6px 18px rgb(16 185 129 / 0.28);
}

.tool-workbench--empty {
  --wb-accent: 16 185 129;
  --wb-border-a: 0.55;
  --wb-glow-a: 0.14;
  border: 2px dashed rgb(45 212 191 / var(--wb-border-a));
  background:
    repeating-linear-gradient(
      0deg,
      rgb(148 163 184 / 0.05) 0px,
      rgb(148 163 184 / 0.05) 1px,
      transparent 1px,
      transparent 32px
    ),
    repeating-linear-gradient(
      90deg,
      rgb(148 163 184 / 0.05) 0px,
      rgb(148 163 184 / 0.05) 1px,
      transparent 1px,
      transparent 32px
    ),
    radial-gradient(
      ellipse 85% 55% at 50% 20%,
      rgb(var(--wb-accent) / var(--wb-glow-a)) 0%,
      transparent 62%
    ),
    radial-gradient(
      ellipse 120% 85% at 50% 105%,
      rgb(2 6 23 / 0.55) 0%,
      transparent 58%
    ),
    linear-gradient(180deg, rgb(41 54 76) 0%, rgb(27 38 56) 100%);
  box-shadow:
    0 0 0 1px rgb(100 116 139 / 0.22),
    0 24px 60px rgb(0 0 0 / 0.5),
    0 0 90px rgb(var(--wb-accent) / 0.08),
    inset 0 1px 0 rgb(203 213 225 / 0.14);
}

.tool-workbench--empty:hover {
  --wb-border-a: 0.75;
  --wb-glow-a: 0.2;
  box-shadow:
    0 0 0 1px rgb(16 185 129 / 0.25),
    0 26px 64px rgb(0 0 0 / 0.52),
    0 0 110px rgb(var(--wb-accent) / 0.14),
    inset 0 1px 0 rgb(167 243 208 / 0.16);
}

.tool-workbench--dragover {
  --wb-accent: 52 211 153;
  --wb-border-a: 0.9;
  --wb-glow-a: 0.3;
  border-color: rgb(52 211 153 / var(--wb-border-a)) !important;
  box-shadow:
    0 0 0 1px rgb(52 211 153 / 0.35),
    0 28px 68px rgb(0 0 0 / 0.55),
    0 0 130px rgb(var(--wb-accent) / 0.2),
    inset 0 0 0 1px rgb(16 185 129 / 0.18) !important;
}

.tool-workbench--empty #main-layout-grid {
  padding: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
}

.tool-workbench--empty #tool-upload-panel {
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.tool-workbench--editor #main-layout-grid.editor-shell-layout {
  height: 100%;
}

.tool-workbench--editor {
  border: 1px solid rgb(51 65 85 / 0.55);
  background: rgb(15 23 42 / 0.92);
  box-shadow:
    0 16px 48px rgb(0 0 0 / 0.38),
    inset 0 1px 0 rgb(148 163 184 / 0.07);
}

/*
 * B2.10I-I1 — Dynamic Chrome Layout (EDITOR only).
 * EMPTY keeps fixed --workbench-h. EDITOR grows with Timeline expansion
 * so #video-controls is not clipped; page scrolls via document scrollingElement.
 * Media clipping stays on .media-stage / .media-viewport — not Preview Content.
 */
.tool-workbench--editor {
  height: auto;
  min-height: var(--workbench-h);
  max-height: none;
  overflow: visible;
}

.tool-workbench--editor #main-layout-grid.editor-shell-layout {
  height: auto;
  min-height: var(--workbench-h);
  max-height: none;
}

@media (min-width: 1024px) {
  .tool-workbench--editor #main-layout-grid.editor-shell-layout {
    height: auto;
    align-items: start;
  }
}

/* Editor shell — video left, control sidebar right, no gap */
.editor-shell-layout {
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  gap: 0;
}

@media (min-width: 1024px) {
  .editor-shell-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 22rem);
    align-items: stretch;
    height: 100%;
  }

  .editor-shell-layout #tool-preview-panel {
    order: 1;
  }

  .editor-shell-layout #tool-upload-panel {
    order: 2;
  }
}

.editor-video-stage {
  min-height: 0;
}

.editor-video-stage:not(.hidden) {
  display: flex;
  flex-direction: column;
}

.editor-sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.tool-workbench--editor .editor-sidebar-inner {
  height: 100%;
  min-height: 0;
}

.tool-upload-panel--editor:not(.tool-upload-panel--empty-hero) {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 1rem !important;
  border-radius: 0 !important;
}

.tool-workbench--editor #tool-preview-panel.editor-video-stage {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border-right: 1px solid rgb(51 65 85 / 0.42);
  padding: 0.75rem 1rem;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  flex: 0 0 auto;
}

.tool-workbench--editor #watermark-preview-content:not(.hidden),
.tool-workbench--editor .editor-preview-stack:not(.hidden) {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
  min-height: 0;
}

.tool-workbench--editor .editor-video-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.tool-workbench--editor #tool-upload-panel {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.tool-workbench--editor .tool-upload-panel--editor:not(.tool-upload-panel--empty-hero) {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
}

@media (min-width: 1024px) {
  .tool-upload-panel--editor:not(.tool-upload-panel--empty-hero) {
    position: relative;
    top: auto;
    align-self: stretch;
  }
}

/* Mobile editor — sidebar stacks below; grow shell, keep video stage fixed */
@media (max-width: 1023px) {
  .tool-workbench--editor {
    height: auto;
    min-height: var(--workbench-h);
    max-height: none;
    overflow: visible;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout {
    height: auto;
    min-height: var(--workbench-h);
  }
}

.editor-sidebar-tools {
  margin-top: 0;
  padding-top: 0.75rem;
  border-top: none;
}

form#watermark-form #editor-sidebar-tools,
form[id$="-form"] #editor-sidebar-tools {
  margin-top: 0;
  padding-top: 0.75rem;
  border-top: none;
}

.editor-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.editor-step-headline {
  min-width: 0;
  flex: 1;
}

.editor-step-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: rgb(241 245 249);
  letter-spacing: normal;
  text-transform: none;
}

.editor-step-description {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgb(148 163 184);
}

.mask-journey-card {
  margin-top: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  border: 1px solid rgb(45 212 191 / 0.22);
  background: rgb(30 41 59 / 0.72);
}

.mask-journey-card--guidance {
  border-color: rgb(71 85 105 / 0.45);
  background: rgb(30 41 59 / 0.55);
}

.mask-journey-card--feedback.mask-journey-card--ready {
  border-color: rgb(45 212 191 / 0.35);
  background: rgb(15 118 110 / 0.12);
}

.mask-journey-card--feedback.mask-journey-card--warning {
  border-color: rgb(251 191 36 / 0.35);
  background: rgb(120 53 15 / 0.18);
}

.mask-journey-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(226 232 240);
}

.mask-journey-card-kicker {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgb(148 163 184);
}

.mask-journey-card-headline {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  color: rgb(167 243 208);
}

.mask-journey-card--warning .mask-journey-card-headline {
  color: rgb(253 230 138);
}

.mask-journey-card-body {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgb(203 213 225);
}

.mask-journey-card-risk {
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: rgb(148 163 184);
}

.mask-journey-card-list {
  margin: 0.375rem 0 0;
  padding-left: 1rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgb(148 163 184);
}

.mask-journey-card-list li + li {
  margin-top: 0.2rem;
}

#drawing-toolbar .editor-tool-btn[title] {
  position: relative;
}

@media (hover: hover) and (pointer: fine) {
  #drawing-toolbar .editor-tool-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    z-index: 20;
    transform: translateX(-50%);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: rgb(15 23 42);
    border: 1px solid rgb(51 65 85);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.2;
    color: rgb(226 232 240);
    white-space: nowrap;
    pointer-events: none;
  }
}

.editor-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(148 163 184);
}

.editor-sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(148 163 184);
}

.editor-tutorial-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgb(110 231 183);
  text-decoration: none;
  cursor: pointer;
}

.editor-tutorial-link:hover {
  color: rgb(167 243 208);
}

/* Editor How it works — right float drawer; frosted glass, no page dim */
.editor-how-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.editor-how-drawer[hidden] {
  display: none !important;
}

/* No transform on ancestors — transform breaks backdrop-filter sampling */
.editor-how-drawer-slide {
  position: absolute;
  top: 0.75rem;
  bottom: 0.75rem;
  right: calc(-1 * min(22rem, calc(94vw - 1.5rem)) - 1rem);
  width: min(22rem, calc(94vw - 1.5rem));
  max-height: calc(100% - 1.5rem);
  pointer-events: none;
  transition: right 0.22s ease;
}

.editor-how-drawer.is-open .editor-how-drawer-slide {
  right: 0.75rem;
}

.editor-how-drawer-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  /* Visible glass over the dark editor (0.88 looked solid) */
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.08), transparent 30%),
    rgb(15 23 42 / 0.52);
  border: 1px solid rgb(148 163 184 / 0.3);
  border-left: 1px solid rgb(52 211 153 / 0.55);
  border-radius: 0.9rem;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.1),
    -10px 8px 36px rgb(0 0 0 / 0.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
}

.editor-how-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgb(148 163 184 / 0.18);
  background: rgb(2 6 23 / 0.22);
  border-radius: 0.9rem 0.9rem 0 0;
}

.editor-how-drawer-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: rgb(248 250 252);
}

.editor-how-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: rgb(148 163 184);
  cursor: pointer;
}

.editor-how-drawer-close:hover {
  background: rgb(30 41 59);
  color: rgb(226 232 240);
}

.editor-how-drawer-scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0.85rem 1rem 2rem;
  -webkit-overflow-scrolling: touch;
}

.editor-how-drawer-demo {
  margin-bottom: 0.95rem;
}

.editor-how-drawer-demo-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 0.75rem;
  border: 1px solid rgb(71 85 105 / 0.75);
  background: rgb(2 6 23 / 0.85);
  object-fit: contain;
}

/* Step list inside the drawer (no timeline connector) */
.editor-how-flow {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.editor-how-drawer .editor-how-step {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.editor-how-drawer .editor-how-step-summary {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 0.5rem;
  list-style: none;
  cursor: pointer;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  line-height: 1.35;
  overflow: visible;
}

.editor-how-drawer .editor-how-step-summary::-webkit-details-marker,
.editor-how-drawer .editor-how-step-summary::marker {
  display: none;
  content: "";
}

/* Kill legacy ▸/▾ ::before — it becomes a grid item and crushes the title */
.editor-how-drawer .editor-how-step-summary::before,
.editor-how-drawer .editor-how-step[open] > .editor-how-step-summary::before {
  content: none !important;
  display: none !important;
}

/* Light step index — plain number, no circle chrome */
.editor-how-drawer .editor-how-step-index {
  display: inline-block;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.2rem 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgb(100 116 139);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.editor-how-drawer .editor-how-step[open] .editor-how-step-index {
  color: rgb(110 231 183);
}

.editor-how-drawer .editor-how-step-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  padding-top: 0.15rem;
  overflow: visible;
}

.editor-how-drawer .editor-how-step-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 650;
  color: rgb(248 250 252);
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.editor-how-drawer .editor-how-step-teaser {
  display: block;
  padding-left: 0;
  font-size: 0.6875rem;
  font-weight: 400;
  line-height: 1.4;
  color: rgb(148 163 184);
  white-space: normal;
}

.editor-how-drawer .editor-how-step[open] > .editor-how-step-summary .editor-how-step-teaser {
  display: none;
}

.editor-how-drawer .editor-how-step-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.25rem;
  color: rgb(148 163 184);
  flex-shrink: 0;
}

.editor-how-drawer .editor-how-step-chevron::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.editor-how-drawer .editor-how-step[open] .editor-how-step-chevron {
  color: rgb(110 231 183);
}

.editor-how-drawer .editor-how-step[open] .editor-how-step-chevron::before {
  transform: rotate(45deg);
}

.editor-how-drawer .editor-how-step-body {
  margin: 0.45rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid rgb(148 163 184 / 0.2);
  background: rgb(2 6 23 / 0.55);
}

.editor-how-drawer .editor-how-step-kicker {
  margin: 0 0 0.3rem;
}

.editor-how-drawer .editor-how-tip-lead {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgb(203 213 225);
}

.editor-how-drawer .editor-how-tool-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.editor-how-drawer .editor-how-tool-row {
  display: grid;
  grid-template-columns: 1.35rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
}

.editor-how-drawer .editor-how-tool-row--text {
  grid-template-columns: minmax(0, 1fr);
  padding-left: 1.85rem;
}

.editor-how-drawer .editor-how-tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0;
  border-radius: 0.35rem;
  border: 1px solid rgb(51 65 85 / 0.85);
  background: rgb(15 23 42);
  color: rgb(226 232 240);
  flex-shrink: 0;
}

.editor-how-drawer .editor-how-tool-icon.is-active {
  /* Keep quiet chrome — avoid competing with tip copy */
  border-color: rgb(71 85 105);
  background: rgb(30 41 59);
  color: rgb(248 250 252);
  box-shadow: none;
}

.editor-how-drawer .editor-how-tool-icon svg {
  width: 0.85rem;
  height: 0.85rem;
}

.editor-how-drawer .editor-how-tool-icon--cta {
  border-color: rgb(52 211 153 / 0.45);
  background: rgb(6 78 59 / 0.4);
  color: rgb(167 243 208);
}

.editor-how-drawer .editor-how-tool-copy {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35rem;
  color: rgb(203 213 225);
}

.editor-how-drawer .editor-how-tool-copy strong {
  color: rgb(248 250 252);
  font-weight: 650;
}

.editor-how-drawer .editor-marking-tips-list strong {
  color: rgb(248 250 252);
  font-weight: 650;
}

.editor-how-drawer .editor-how-nested-list {
  margin: 0.35rem 0 0.25rem;
  padding: 0 0 0 0.85rem;
  list-style: none;
  display: grid;
  gap: 0.25rem;
}

.editor-how-drawer .editor-how-nested-list li {
  position: relative;
  padding-left: 0.7rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgb(186 198 212);
}

.editor-how-drawer .editor-how-nested-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: rgb(148 163 184);
}

.editor-how-drawer .editor-how-step-cta-note {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgb(51 65 85 / 0.55);
}

.editor-how-drawer .editor-how-step:not([open]) > *:not(summary) {
  display: none !important;
}

@media (max-width: 640px) {
  .editor-how-drawer-slide {
    top: 0.5rem;
    bottom: 0.5rem;
    right: calc(-100vw);
    width: calc(100vw - 1rem);
    max-height: calc(100% - 1rem);
  }

  .editor-how-drawer.is-open .editor-how-drawer-slide {
    right: 0.5rem;
  }
}

#drawing-toolbar.editor-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 0.625rem;
  margin-top: 0;
}

#drawing-toolbar.editor-toolbar .editor-toolbar-mask-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
}

#drawing-toolbar.editor-toolbar .editor-tool-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.375rem 0.4375rem;
  border-radius: 0.625rem;
  background: rgb(15 23 42 / 0.55);
  border: 1px solid rgb(51 65 85 / 0.38);
}

/* Desktop sidebar: keep Draw / Erase / Edit on one row — no scrollbar */
@media (min-width: 1024px) {
  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-toolbar-mask-tools {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.3rem;
    max-width: 100%;
    overflow: visible;
  }

  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group {
    flex: 0 0 auto;
    padding: 0.28rem 0.3rem;
    gap: 0.28rem;
  }

  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group-buttons {
    gap: 0.2rem;
  }

  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group-buttons button {
    width: 2.375rem;
    height: 2.375rem;
    min-width: 2.375rem;
    min-height: 2.375rem;
  }

  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group-buttons button svg {
    width: 1.05rem;
    height: 1.05rem;
  }
}

#drawing-toolbar.editor-toolbar .editor-tool-group-label {
  padding: 0 0.125rem;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(100 116 139);
  line-height: 1;
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons {
  display: flex;
  gap: 0.375rem;
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  border-radius: 0.625rem;
  background: rgb(30 41 59 / 0.85);
  color: rgb(203 213 225);
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button:hover:not(:disabled):not([aria-pressed="true"]):not(.active) {
  background: rgb(51 65 85 / 0.9);
  color: rgb(248 250 252);
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button svg {
  width: 1.375rem;
  height: 1.375rem;
  shape-rendering: geometricPrecision;
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.tool-btn[aria-pressed="true"],
#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.editor-tool-btn.active,
#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.tool-btn.active {
  background: rgb(16 185 129);
  color: rgb(255 255 255);
  box-shadow:
    0 0 0 1px rgb(16 185 129 / 0.55),
    0 0 12px rgb(16 185 129 / 0.28);
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.tool-btn[aria-pressed="true"]:hover,
#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.editor-tool-btn.active:hover,
#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.tool-btn.active:hover {
  background: rgb(5 150 105);
  color: rgb(255 255 255);
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.editor-tool-btn--action.is-pressed:not(:disabled),
#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.editor-tool-btn--action:active:not(:disabled) {
  background: rgb(16 185 129);
  color: rgb(255 255 255);
  box-shadow:
    0 0 0 1px rgb(16 185 129 / 0.55),
    0 0 12px rgb(16 185 129 / 0.28);
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.editor-tool-btn--action.is-ready:not(:disabled) {
  background: rgb(16 185 129 / 0.14);
  color: rgb(167 243 208);
  box-shadow: 0 0 0 1px rgb(16 185 129 / 0.32);
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.editor-tool-btn--danger.is-pressed:not(:disabled),
#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.editor-tool-btn--danger:active:not(:disabled) {
  background: rgb(185 28 28);
  color: rgb(255 255 255);
  box-shadow:
    0 0 0 1px rgb(248 113 113 / 0.45),
    0 0 12px rgb(185 28 28 / 0.28);
}

#drawing-toolbar.editor-toolbar .editor-tool-group-buttons button.editor-tool-btn--danger.is-ready:not(:disabled) {
  background: rgb(127 29 29 / 0.22);
  color: rgb(254 202 202);
  box-shadow: 0 0 0 1px rgb(248 113 113 / 0.28);
}

#drawing-toolbar.editor-toolbar .editor-toolbar-brush {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#drawing-toolbar.editor-toolbar .editor-toolbar-brush[hidden] {
  display: none !important;
}

#drawing-toolbar.editor-toolbar .editor-toolbar-brush label {
  margin-bottom: 0;
}

#drawing-toolbar.editor-toolbar .editor-toolbar-brush-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mask-track-panel {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgb(51 65 85 / 0.55);
  border-radius: 0.75rem;
  background: rgb(15 23 42 / 0.45);
}

.mask-track-panel--compact {
  padding: 0.45rem 0.65rem;
}

.mask-track-panel--compact:not(.mask-track-panel--advanced) {
  border-style: dashed;
  background: transparent;
}

.mask-advanced-toggle,
.mask-advanced-collapse {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: rgb(148 163 184);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  padding: 0.2rem 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.mask-advanced-toggle:hover,
.mask-advanced-collapse:hover {
  color: rgb(226 232 240);
}

.mask-track-advanced {
  margin-top: 0.35rem;
}

.mask-track-timing-slot {
  margin-bottom: 0.55rem;
}

.mask-track-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.mask-track-panel-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(148 163 184);
}

.mask-track-add-btn {
  border: 1px solid rgb(71 85 105 / 0.8);
  border-radius: 0.5rem;
  background: rgb(30 41 59 / 0.7);
  color: rgb(226 232 240);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}

.mask-track-add-btn:hover {
  border-color: rgb(16 185 129 / 0.55);
  color: rgb(167 243 208);
}

.mask-track-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mask-track-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

.mask-track-select {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  border: 1px solid rgb(51 65 85 / 0.7);
  border-radius: 0.55rem;
  background: rgb(15 23 42 / 0.55);
  color: rgb(226 232 240);
  padding: 0.4rem 0.55rem;
  cursor: pointer;
}

.mask-track-row--active .mask-track-select,
.mask-track-select[aria-pressed="true"] {
  border-color: rgb(16 185 129 / 0.65);
  background: rgb(6 78 59 / 0.28);
  box-shadow: 0 0 0 1px rgb(16 185 129 / 0.25);
}

.mask-track-name {
  font-size: 0.8125rem;
  font-weight: 600;
}

.mask-track-status {
  font-size: 0.6875rem;
  color: rgb(148 163 184);
}

.mask-track-row--active .mask-track-status {
  color: rgb(167 243 208);
}

.mask-track-delete {
  flex: 0 0 auto;
  width: 2rem;
  border: 1px solid rgb(71 85 105 / 0.7);
  border-radius: 0.55rem;
  background: rgb(30 41 59 / 0.55);
  color: rgb(203 213 225);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.mask-track-delete:hover:not(:disabled) {
  border-color: rgb(248 113 113 / 0.55);
  color: rgb(254 202 202);
}

.mask-track-delete:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.mask-track-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.mask-track-time-badge {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgb(125 211 252);
  max-width: 9.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mask-track-timing {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgb(51 65 85 / 0.55);
}

.mask-track-timing-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(148 163 184);
}

.mask-track-timing-help,
.mask-track-timing-note {
  margin: 0.35rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: rgb(148 163 184);
}

.mask-track-timing-modes {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.mask-track-timing-mode {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: rgb(226 232 240);
  cursor: pointer;
}

.mask-track-timing-fields {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

/* Author `display: grid` otherwise overrides the UA [hidden] rule. */
.mask-track-timing-fields[hidden],
.mask-track-timing-fields.hidden {
  display: none !important;
}

.mask-track-timing-field {
  display: grid;
  gap: 0.2rem;
  font-size: 0.6875rem;
  color: rgb(148 163 184);
}

.mask-track-timing-field input {
  border: 1px solid rgb(71 85 105 / 0.8);
  border-radius: 0.45rem;
  background: rgb(15 23 42 / 0.7);
  color: rgb(226 232 240);
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.mask-track-timing-actions {
  display: grid;
  gap: 0.35rem;
}

.mask-track-timing-actions button {
  border: 1px solid rgb(71 85 105 / 0.8);
  border-radius: 0.45rem;
  background: rgb(30 41 59 / 0.7);
  color: rgb(226 232 240);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  text-align: left;
}

.mask-track-timing-actions button:hover {
  border-color: rgb(16 185 129 / 0.55);
  color: rgb(167 243 208);
}

.mask-track-timing-error {
  margin: 0.4rem 0 0;
  font-size: 0.6875rem;
  color: rgb(252 165 165);
}

.playback-track {
  position: relative;
}

.mask-time-range-rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.45rem;
  height: 0.25rem;
  border-radius: 9999px;
  background: rgb(51 65 85 / 0.55);
  pointer-events: none;
}

.mask-time-range-rail.hidden {
  display: none;
}

.mask-time-range-rail-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 9999px;
  background: rgb(56 189 248 / 0.85);
}

.editor-video-frame {
  position: relative;
  flex: 0 0 var(--wb-stage-video-h);
  width: 100%;
  height: var(--wb-stage-video-h);
  min-height: var(--wb-stage-video-h);
  max-height: var(--wb-stage-video-h);
  overflow: hidden;
}

/*
 * H1.5-A/B — Media Slot wrapper.
 * H1.5-B: Slot owns height CONSTRAINT tokens (not physical height).
 * Physical height may still follow stage content; Geometry uses --media-slot-available-max-h.
 */
.media-slot {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  display: block;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
  border: 0;
  /* Constraint tokens owned by Slot (parent → child inheritance to .media-stage) */
  --media-slot-available-max-h: 62vh;
  --media-viewport-max-h: var(--media-slot-available-max-h);
}

.media-slot[data-media-slot-authority="measurement"] {
  /* measurement compatibility — physical height still content-driven */
}

.media-slot[data-media-slot-authority="geometry"] {
  /* constraint authority active; physical height still not parent-owned floor */
}

@media (min-width: 640px) {
  .media-slot {
    --media-slot-available-max-h: min(54vh, 480px);
  }
}

@media (min-width: 1024px) {
  .media-slot {
    --media-slot-available-max-h: min(62vh, 580px);
  }
}

/*
 * H1.5-C — Short-landscape Slot Constraint override (Model B).
 * Align stage footprint (--wb-stage-video-h) with media height budget so
 * portrait videos are not capped by the older tablet 54vh stage token (~210px
 * on a 390-tall landscape viewport) while --media-slot-available-max-h is higher.
 * max-height gate 560 matches COMPACT_WIDE_MAX_H (real-device landscape chrome).
 */
@media (max-width: 1023px) and (orientation: landscape) and (max-height: 560px) {
  .tool-workbench {
    --wb-stage-video-h: min(86vh, 360px);
    --wb-chrome: 4.25rem;
  }

  .media-slot {
    /* Height-first budget for portrait contain; no fixed 250/320 ceiling. */
    --media-slot-available-max-h: min(86vh, 360px);
  }

  /*
   * Do NOT use width/height:max-content on stage before contain-fit —
   * that collapses the stage to padding and yields 0×0 video.
   * Portrait stage width shrink is applied post-fit by layout shell JS.
   */
  .tool-workbench--editor .editor-video-frame.media-stage {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    flex: 0 0 auto;
    overflow: visible;
  }

  .tool-workbench--editor .editor-video-frame .media-viewport {
    max-height: var(--media-viewport-max-h);
  }

  /* C2 — vertical chrome density (spacing only; touch targets untouched) */
  body.tool-page--editor-focus main {
    justify-content: flex-start;
    min-height: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout {
    gap: 0.35rem;
  }

  .editor-step-headline {
    margin-bottom: 0.35rem;
  }

  .editor-step-description {
    margin-top: 0.1rem;
  }

  .tool-workbench--editor #tool-preview-panel.editor-video-stage {
    padding-block: 0.2rem;
  }

  .unified-mask-timeline.editor-playback-bar,
  #video-controls.unified-mask-timeline {
    margin-top: 0.2rem;
    padding-top: 0.1rem;
    padding-bottom: 0.15rem;
  }

  #drawing-toolbar.editor-toolbar {
    gap: 0.35rem;
    margin-top: 0.1rem;
  }

  .editor-sidebar-tools {
    padding-top: 0.35rem;
  }

  #upload-lifecycle-cta,
  .upload-lifecycle-cta {
    margin-top: 0.25rem;
    scroll-margin-top: calc(var(--site-header-h, 4.5rem) + 0.5rem);
  }

  /* C3 — Safe Area basics (fallback 0px → layout unchanged vs pre-H1.5-C) */
  .tool-workbench--editor #drawing-toolbar.editor-toolbar {
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
  }

  #upload-lifecycle-cta,
  .upload-lifecycle-cta {
    padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
  }

  #product-sidebar .tool-workbench--editor,
  #product-sidebar .tool-upload-panel--editor {
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
    padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
}

/* Media Stage — reserved footprint matches EMPTY upload height token;
   video keeps real aspect via contain, centered inside the stage. */
.editor-video-frame.media-stage {
  --media-stage-background: rgb(2 6 23);
  /* --media-viewport-max-h inherited from .media-slot when nested; fallback if orphaned */
  --media-viewport-max-h: var(--media-slot-available-max-h, 62vh);
  --video-aspect-ratio: 16 / 9;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 var(--wb-stage-video-h);
  width: 100%;
  max-width: 100%;
  height: var(--wb-stage-video-h);
  min-height: var(--wb-stage-video-h);
  max-height: var(--wb-stage-video-h);
  margin-inline: auto;
  padding: 5px;
  background: var(--media-stage-background);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.editor-video-frame .media-viewport {
  position: relative;
  flex: 0 0 auto;
  width: var(--media-viewport-w, 100%);
  height: var(--media-viewport-h, auto);
  max-width: 100%;
  max-height: var(--media-viewport-max-h);
  overflow: hidden;
  border-radius: 11px;
  background: #020617;
  /* Fallback before metadata: avoid 0-height collapse with absolutely positioned video */
  aspect-ratio: var(--video-aspect-ratio, 16 / 9);
}

.editor-video-frame video,
.editor-video-frame .media-viewport video,
.editor-video-frame .media-viewport canvas {
  display: block;
}

.editor-video-frame video {
  object-fit: contain;
  object-position: center center;
}

.tool-workbench--editor .editor-video-frame video,
.tool-workbench--editor .editor-video-frame .media-viewport video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* H1.5-B: breakpoint height tokens moved to .media-slot (do not redeclare on .media-stage) */

.editor-playback-bar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-shrink: 0;
  margin-top: 0.5rem;
  padding: 0.5rem 0.25rem 0;
  border-top: 1px solid rgb(51 65 85 / 0.35);
  background: transparent;
  border-radius: 0;
  gap: 0.75rem;
}

.editor-playback-bar .playback-time {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgb(203 213 225);
}

.editor-playback-bar .playback-track {
  flex: 1 1 auto;
  min-width: 0;
}

.editor-playback-bar #video-progress {
  display: block;
  width: 100%;
  height: 0.3125rem;
  border-radius: 9999px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.editor-playback-bar #video-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  background: rgb(16 185 129);
  border: 2px solid rgb(248 250 252);
  box-shadow: 0 0 0 1px rgb(16 185 129 / 0.35);
}

.editor-playback-bar #video-progress::-moz-range-thumb {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  background: rgb(16 185 129);
  border: 2px solid rgb(248 250 252);
  box-shadow: 0 0 0 1px rgb(16 185 129 / 0.35);
}

.editor-processing-bar {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin-top: 0.5rem;
  padding: 0.5rem 0.25rem 0;
  border-top: 1px solid rgb(51 65 85 / 0.35);
}

.editor-preview-stack {
  position: relative;
}

.video-processing-stage {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  pointer-events: auto;
  /* Must be a descendant of .media-viewport (overflow:hidden). Never inset:0 on
     .editor-preview-stack — that paints over the timeline below the video. */
  border-radius: inherit;
}

/* Legacy placement: overlay as a sibling of the timeline — clip to video height */
.editor-preview-stack > .video-processing-stage {
  bottom: auto;
  height: var(--wb-stage-video-h);
}

.video-processing-stage.hidden {
  display: none !important;
}

.video-processing-dim {
  position: absolute;
  inset: 0;
  /* Keep semi-transparent so the video remains visible under Analyzing/Processing */
  background: rgb(2 6 23 / 0.68);
  backdrop-filter: blur(1px);
  pointer-events: none;
}

.video-processing-panel {
  position: relative;
  z-index: 1;
  /* Wider so the leave-page / Usage & exports hint reads on fewer wraps */
  width: min(100%, 30rem);
  max-width: calc(100% - 0.5rem);
  padding: 1.125rem 1.35rem 1.05rem;
  border-radius: 0.875rem;
  border: 1px solid rgb(51 65 85 / 0.5);
  background: linear-gradient(
    165deg,
    rgb(30 41 59 / 0.96) 0%,
    rgb(15 23 42 / 0.98) 100%
  );
  box-shadow:
    0 16px 48px rgb(0 0 0 / 0.42),
    inset 0 1px 0 rgb(148 163 184 / 0.08);
  pointer-events: none;
}

/* Daily free-credit claim beat (same gift language as header Today's Free Credits). */
.video-stage-claim-beat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  text-align: center;
}

.video-stage-claim-beat[hidden] {
  display: none !important;
}

.video-stage-claim-beat__icon {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  color: rgb(52 211 153);
  background: rgb(6 78 59 / 0.85);
  border: 1px solid rgb(52 211 153 / 0.45);
  box-shadow: 0 0 0 1px rgb(16 185 129 / 0.12);
}

.video-stage-claim-beat__icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.video-stage-claim-beat__ring {
  position: absolute;
  inset: -0.35rem;
  border-radius: inherit;
  border: 2px solid rgb(52 211 153 / 0.4);
  pointer-events: none;
  opacity: 0;
}

.video-stage-claim-beat.is-pulsing .video-stage-claim-beat__ring {
  animation: video-stage-claim-pulse 1.1s ease-out 1;
}

@keyframes video-stage-claim-pulse {
  0% {
    transform: scale(0.88);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.28);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-stage-claim-beat.is-pulsing .video-stage-claim-beat__ring {
    animation: none;
    opacity: 0.45;
    transform: none;
  }
}

.video-stage-claim-beat__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: rgb(248 250 252);
}

.video-processing-panel--claim-beat .video-stage-progress-head {
  justify-content: center;
}

.video-processing-panel--claim-beat #video-stage-status-percent {
  display: none;
}

.video-stage-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  color: rgb(241 245 249);
}

.video-stage-progress-track {
  position: relative;
  margin-top: 0.625rem;
  height: 0.375rem;
  overflow: hidden;
  border-radius: 9999px;
  background: rgb(15 23 42 / 0.9);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.35);
}

#video-stage-status-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgb(52 211 153) 0%,
    rgb(16 185 129) 55%,
    rgb(45 212 191) 100%
  );
  box-shadow: 0 0 10px rgb(16 185 129 / 0.35);
  transition: width 0.25s ease-out;
}

#video-stage-status-bar.indeterminate {
  width: 42% !important;
  animation: stage-indeterminate-slide 1.5s ease-in-out infinite;
}

@keyframes stage-indeterminate-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

#video-stage-status-percent {
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(110 231 183);
  letter-spacing: 0.01em;
}

#video-stage-status-hint {
  margin-top: 0.625rem;
  font-size: 0.6875rem;
  line-height: 1.45;
  color: rgb(148 163 184);
}

.video-stage-hint-link {
  color: rgb(110 231 183);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.video-stage-hint-link:hover {
  color: rgb(167 243 208);
}

/* Usage → Edit again: local workbench cover (keep EMPTY visible under frost; no black void). */
html.edit-resume-pending #tool-workbench {
  /* Host for absolute veil; block stray clicks under the cover. */
  isolation: isolate;
}

#edit-resume-veil {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  border-radius: inherit;
  background: rgb(15 23 42 / 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgb(226 232 240);
  font-size: 0.9375rem;
  text-align: center;
  pointer-events: all;
}

/* Fallback when workbench not yet in DOM (script runs very early). */
#edit-resume-veil.edit-resume-veil--page {
  position: fixed;
  inset: 0;
  z-index: 80;
  border-radius: 0;
  background: rgb(15 23 42 / 0.45);
}

#edit-resume-veil[hidden] {
  display: none !important;
}

#edit-resume-veil .edit-resume-veil__card {
  max-width: 22rem;
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(71 85 105 / 0.7);
  background: rgb(30 41 59 / 0.92);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.28);
}

#edit-resume-veil .edit-resume-veil__title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: rgb(248 250 252);
}

#edit-resume-veil .edit-resume-veil__text {
  margin: 0;
  color: rgb(148 163 184);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* Result rail A′: hint + underlined Usage link above Download (not a third CTA). */
.result-usage-exports-wrap {
  margin: 0;
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.4;
}

.result-usage-exports-wrap.hidden,
.result-usage-exports-wrap[hidden] {
  display: none !important;
}

.result-usage-exports-hint {
  color: rgb(100 116 139);
  margin-right: 0.35em;
}

.result-usage-exports-link {
  font-weight: 500;
  color: rgb(148 163 184);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.result-usage-exports-link:hover {
  color: rgb(203 213 225);
}

#video-stage-status-bar.is-error {
  background: linear-gradient(90deg, rgb(248 113 113), rgb(239 68 68));
  box-shadow: 0 0 10px rgb(239 68 68 / 0.35);
  animation: none;
  transform: none;
  width: 100% !important;
}

.video-stage-recovery-actions {
  margin-top: 0.75rem;
  text-align: left;
}

.video-stage-recovery-text {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgb(254 226 226);
  overflow-wrap: anywhere;
}

.video-stage-recovery-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.video-stage-recovery-actions .upload-recovery-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgb(148 163 184 / 0.45);
  background: rgb(30 41 59 / 0.85);
  color: rgb(226 232 240);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.video-stage-recovery-actions .upload-recovery-btn--primary {
  border-color: rgb(16 185 129 / 0.55);
  background: rgb(16 185 129 / 0.2);
  color: rgb(167 243 208);
}

.tool-workbench--processing #tool-upload-panel {
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tool-workbench--processing #btn-start-remove,
.tool-workbench--processing #btn-start-remove-label {
  filter: grayscale(1);
  opacity: 0.55;
}

.tool-workbench--processing #btn-start-remove {
  pointer-events: none;
  cursor: not-allowed;
  box-shadow: none;
}

.editor-sidebar-tools--processing {
  opacity: 0.72;
  pointer-events: none;
}

/**
 * Stage progress is mounted on the video only. While busy, also lock + dim the
 * right rail (result export CTA) so loading is one surface, not dual CTAs.
 */
.tool-workbench--stage-busy #tool-upload-panel {
  position: relative;
  pointer-events: none;
}

.tool-workbench--stage-busy #tool-upload-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 25;
  border-radius: inherit;
  background: rgb(2 6 23 / 0.58);
  backdrop-filter: blur(1px);
  pointer-events: auto;
}

.tool-workbench--stage-busy [id$="-result-actions"],
.tool-workbench--stage-busy .result-actions--stage-busy {
  pointer-events: none;
}

.tool-workbench--stage-busy #btn-download-video.export-cta--stage-busy,
#btn-download-video.export-cta--stage-busy {
  opacity: 0.7;
  filter: grayscale(0.35);
  cursor: not-allowed;
  box-shadow: none;
}

.editor-playback-bar .playback-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.editor-playback-bar .playback-skip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 3rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  background: rgb(30 41 59 / 0.65);
  color: rgb(203 213 225);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, color 0.15s ease;
}

.editor-playback-bar .playback-skip-btn:hover {
  background: rgb(51 65 85 / 0.85);
  color: rgb(248 250 252);
}

.editor-playback-bar .playback-skip-btn svg {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
  shape-rendering: geometricPrecision;
}

.editor-playback-bar .playback-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: rgb(16 185 129);
  color: rgb(255 255 255);
  box-shadow: 0 2px 10px rgb(16 185 129 / 0.28);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.editor-playback-bar .playback-play-btn:hover {
  background: rgb(5 150 105);
  box-shadow: 0 3px 12px rgb(16 185 129 / 0.38);
}

.editor-playback-bar .playback-play-btn svg,
.editor-playback-bar .playback-play-btn .playback-play-icon {
  width: 1rem;
  height: 1rem;
  shape-rendering: geometricPrecision;
}

/* Processing: timeline stays in place (progress card stays on video only),
   but Mark tabs / track get the same dim veil as the right rail. Placed after
   play-btn color rules so grayscale still wins underneath the veil. */
.tool-workbench--processing #video-controls,
.tool-workbench--stage-busy #video-controls,
.editor-playback-bar.is-processing-hidden {
  pointer-events: none !important;
  position: relative;
  z-index: 5;
}

/* Match .tool-workbench--stage-busy #tool-upload-panel::after */
.tool-workbench--processing #video-controls::after,
.tool-workbench--stage-busy #video-controls::after,
.editor-playback-bar.is-processing-hidden::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 25;
  border-radius: inherit;
  background: rgb(2 6 23 / 0.58);
  backdrop-filter: blur(1px);
  pointer-events: auto;
}

.tool-workbench--processing #video-controls .playback-time,
.tool-workbench--stage-busy #video-controls .playback-time,
.editor-playback-bar.is-processing-hidden .playback-time {
  color: rgb(100 116 139);
}

.tool-workbench--processing #video-controls .playback-skip-btn,
.tool-workbench--processing #video-controls .playback-play-btn,
.tool-workbench--stage-busy #video-controls .playback-skip-btn,
.tool-workbench--stage-busy #video-controls .playback-play-btn,
.editor-playback-bar.is-processing-hidden .playback-skip-btn,
.editor-playback-bar.is-processing-hidden .playback-play-btn {
  opacity: 0.45;
  filter: grayscale(1);
  box-shadow: none;
  cursor: default;
}

.tool-workbench--processing #video-controls .playback-play-btn,
.tool-workbench--stage-busy #video-controls .playback-play-btn,
.editor-playback-bar.is-processing-hidden .playback-play-btn {
  background: rgb(71 85 105);
  color: rgb(203 213 225);
}

.tool-workbench--processing #video-controls .playback-skip-btn:hover,
.tool-workbench--processing #video-controls .playback-play-btn:hover,
.tool-workbench--stage-busy #video-controls .playback-skip-btn:hover,
.tool-workbench--stage-busy #video-controls .playback-play-btn:hover,
.editor-playback-bar.is-processing-hidden .playback-skip-btn:hover,
.editor-playback-bar.is-processing-hidden .playback-play-btn:hover {
  background: inherit;
  color: inherit;
  box-shadow: none;
}

.tool-workbench--processing #video-controls .mask-timeline-segment,
.tool-workbench--processing #video-controls .timeline-playback-progress,
.tool-workbench--processing #video-controls .unified-playback-progress,
.tool-workbench--processing #video-controls .timeline-playback-base,
.tool-workbench--processing #video-controls .timeline-preview-window,
.tool-workbench--processing #video-controls .mask-tabs-strip,
.tool-workbench--stage-busy #video-controls .mask-timeline-segment,
.tool-workbench--stage-busy #video-controls .timeline-playback-progress,
.tool-workbench--stage-busy #video-controls .unified-playback-progress,
.tool-workbench--stage-busy #video-controls .timeline-playback-base,
.tool-workbench--stage-busy #video-controls .timeline-preview-window,
.tool-workbench--stage-busy #video-controls .mask-tabs-strip,
.editor-playback-bar.is-processing-hidden .mask-timeline-segment,
.editor-playback-bar.is-processing-hidden .timeline-playback-progress,
.editor-playback-bar.is-processing-hidden .unified-playback-progress,
.editor-playback-bar.is-processing-hidden .timeline-playback-base,
.editor-playback-bar.is-processing-hidden .timeline-preview-window,
.editor-playback-bar.is-processing-hidden .mask-tabs-strip,
.tool-workbench--processing #video-controls #video-progress,
.tool-workbench--stage-busy #video-controls #video-progress,
.editor-playback-bar.is-processing-hidden #video-progress {
  opacity: 0.55;
  filter: grayscale(0.7);
}

/* Result mute: same chrome as ±3s / play — never overlay the comparison video */
.editor-playback-bar .playback-mute-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: rgb(30 41 59 / 0.65);
  color: rgb(203 213 225);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.editor-playback-bar .playback-mute-btn:hover {
  background: rgb(51 65 85 / 0.85);
  color: rgb(248 250 252);
}

.editor-playback-bar .playback-mute-btn .playback-mute-icon,
.editor-playback-bar .playback-mute-btn svg {
  width: 1rem;
  height: 1rem;
  shape-rendering: geometricPrecision;
}

.editor-playback-bar:not(.result-playback-mode) .playback-mute-btn {
  display: none !important;
}

#video-controls.result-playback-mode .playback-mute-btn {
  min-width: 2.5rem;
  min-height: 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
}

/* Result stage badge — Preview sample vs Full export (not editor). */
#video-controls.result-playback-mode[data-result-variant="preview"]
  .playback-time::before,
#video-controls.result-playback-mode[data-result-variant="formal_export"]
  .playback-time::before {
  margin-right: 0.4rem;
  color: rgb(148 163 184);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#video-controls.result-playback-mode[data-result-variant="preview"]
  .playback-time::before {
  content: "Preview";
}

#video-controls.result-playback-mode[data-result-variant="formal_export"]
  .playback-time::before {
  content: "Full";
}

@media (max-width: 420px) {
  #video-controls.result-playback-mode[data-result-variant="preview"]
    .playback-time::before,
  #video-controls.result-playback-mode[data-result-variant="formal_export"]
    .playback-time::before {
    content: none;
    margin: 0;
  }
}

/* Legacy chrome row (above video) — hide so it cannot steal height or duplicate labels. */
.comparison-label-row {
  display: none !important;
}

/* One-shot Before/After overlay inside the comparison video. */
.comparison-oneshot-labels {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.75rem 0.85rem;
  pointer-events: none;
  opacity: 1;
  transition: opacity 300ms ease;
}

.comparison-oneshot-labels.is-faded {
  opacity: 0 !important;
}

.comparison-label {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.comparison-label--before {
  background: rgb(15 23 42 / 0.92);
  color: rgb(226 232 240);
  border: 1px solid rgb(51 65 85 / 0.85);
}

.comparison-label--after {
  background: rgb(16 185 129);
  color: #fff;
  border: 1px solid rgb(52 211 153 / 0.55);
}

/* ========== A7.2 Unified Playback + Mask Timeline ========== */
.unified-progress-mirror,
#video-progress.unified-progress-mirror,
.unified-mask-timeline #video-progress {
  display: none !important;
  pointer-events: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
}

.tool-workbench--editor #watermark-preview-content:not(.hidden),
.tool-workbench--editor .editor-preview-stack:not(.hidden) {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
  min-height: 0;
}

.tool-workbench--editor .editor-video-frame:not(.media-stage) {
  flex: 1 1 auto;
  min-height: 0;
}

.tool-workbench--editor .editor-video-frame.media-stage {
  flex: 0 0 var(--wb-stage-video-h);
  height: var(--wb-stage-video-h);
  min-height: var(--wb-stage-video-h);
  max-height: var(--wb-stage-video-h);
}

.unified-mask-timeline.editor-playback-bar,
#video-controls.unified-mask-timeline {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 80px;
  flex-shrink: 0;
  height: 80px;
  max-height: 84px;
  min-height: 76px;
  margin-top: 0.35rem;
  padding: 0.2rem 0.25rem 0.25rem;
  gap: 0.15rem;
  border-top: 1px solid rgb(51 65 85 / 0.35);
  overflow: visible;
}

/* A7.4 dual fixed heights (not per-mask-count) — A7.6: collapsed=single row, expanded=tabs+row */
#video-controls.unified-mask-timeline.timeline-height-collapsed {
  flex: 0 0 48px;
  height: 48px;
  max-height: 52px;
  min-height: 44px;
  gap: 0;
}

#video-controls.unified-mask-timeline.timeline-height-expanded {
  /* Tabs + single track (light upper/lower hit pads when masked). */
  flex: 0 0 100px;
  height: 100px;
  max-height: 106px;
  min-height: 94px;
  gap: 0.2rem;
}

/* Edit mask timing sits on the same row as Mark tabs — no extra shell height. */
#video-controls.unified-mask-timeline.timeline-height-expanded.has-mask-time-range-toggle {
  flex: 0 0 100px;
  height: 100px;
  max-height: 106px;
  min-height: 94px;
}

#video-controls .mask-tabs-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  width: 100%;
}

#video-controls .mask-tabs-toolbar .mask-tabs-host {
  flex: 1 1 auto;
  min-width: 0;
}

#video-controls .mask-tabs-toolbar .mask-time-range-toggle-host {
  flex: 0 0 auto;
  padding: 0 0.1rem 0 0;
}

/* Delete Mark: local Undo bar under Tabs — temporarily grow shell */
#video-controls.unified-mask-timeline.has-mark-delete-undo {
  flex: 0 0 auto;
  height: auto;
  max-height: none;
  min-height: 48px;
}

#video-controls .mask-time-range-toggle-host {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  padding: 0.05rem 0.15rem 0.15rem;
}

#video-controls .mask-time-range-toggle-host[hidden] {
  display: none;
}

#video-controls .mask-time-range-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  max-width: 100%;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  color: rgb(203 213 225);
  cursor: pointer;
  user-select: none;
}

#video-controls .mask-time-range-toggle input {
  width: 0.875rem;
  height: 0.875rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: rgb(16 185 129);
  cursor: pointer;
}

#video-controls .mask-time-range-toggle__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#video-controls .mask-delete-undo-bar {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.15rem 0.2rem 0.3rem;
  font-size: 0.75rem;
  line-height: 1.25;
  color: rgb(203 213 225);
}

#video-controls .mask-delete-undo-bar:not([hidden]) {
  display: flex;
}

#video-controls .mask-delete-undo-bar__msg {
  min-width: 0;
  color: rgb(148 163 184);
}

#video-controls .mask-delete-undo-bar__undo {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.15rem 0.55rem;
  border-radius: 0.35rem;
  border: 1px solid rgb(16 185 129 / 0.55);
  background: rgb(6 78 59 / 0.45);
  color: rgb(167 243 208);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

#video-controls .mask-delete-undo-bar__undo:hover {
  border-color: rgb(52 211 153 / 0.85);
  background: rgb(6 95 70 / 0.65);
  color: rgb(209 250 229);
}

#video-controls.result-playback-mode #mask-delete-undo-bar {
  display: none !important;
}

#video-controls.unified-mask-timeline.timeline-ui-video-only .unified-toolbar-mask-group {
  display: none;
}

/* Result comparison: editor playback bar moved under the frame */
#video-controls.result-playback-mode {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 48px !important;
  max-height: none !important;
  margin-top: 0.75rem;
}
#video-controls.result-playback-mode #mask-tabs-host,
#video-controls.result-playback-mode #mask-timeline-editor,
#video-controls.result-playback-mode #mask-time-range-toggle-host,
#video-controls.result-playback-mode .mask-time-range-toggle-host,
#video-controls.result-playback-mode .mask-tabs-toolbar {
  display: none !important;
}
#video-controls.result-playback-mode .result-playback-track {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}
#video-controls.result-playback-mode #video-progress,
#video-controls.result-playback-mode #video-progress.unified-progress-mirror {
  display: block !important;
  position: static !important;
  width: 100% !important;
  height: 0.3125rem !important;
  min-height: 0.3125rem !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 9999px;
  background: linear-gradient(
    to right,
    rgb(16 185 129) 0%,
    rgb(16 185 129) var(--progress, 0%),
    rgb(51 65 85 / 0.9) var(--progress, 0%),
    rgb(51 65 85 / 0.9) 100%
  );
}
#video-controls.result-playback-mode #video-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  background: rgb(16 185 129);
  border: 2px solid rgb(248 250 252);
}
#video-controls.result-playback-mode #video-progress::-moz-range-thumb {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  background: rgb(16 185 129);
  border: 2px solid rgb(248 250 252);
}
.result-playback-caption {
  margin-top: 0.35rem;
  font-size: 11px;
  line-height: 1.4;
  color: rgb(100 116 139);
}

/* ========== A7.6 — Mask Tabs + single-line track shell ========== */
#video-controls .mask-tabs-host {
  display: block;
  flex: 0 0 44px;
  flex-shrink: 0;
  height: 44px;
  max-height: 44px;
  min-height: 40px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

#video-controls .mask-tabs-host[hidden],
#video-controls .mask-tabs-host.is-empty {
  display: none !important;
  height: 0;
  max-height: 0;
  min-height: 0;
  flex: 0 0 0;
}

#video-controls .mask-tabs-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.35rem;
  height: 100%;
  width: max-content;
  min-width: 100%;
  padding: 0.15rem 0.1rem 0.2rem;
}

#video-controls .mask-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 5.5rem;
  max-width: 9.5rem;
  height: 100%;
  padding: 0.2rem 0.55rem;
  border-radius: 0.35rem;
  border: 1px solid rgb(71 85 105 / 0.55);
  background: rgb(15 23 42 / 0.55);
  color: rgb(203 213 225);
  cursor: pointer;
  text-align: left;
  line-height: 1.15;
  font-family: inherit;
}

#video-controls .mask-tab:hover {
  border-color: rgb(100 116 139 / 0.85);
  background: rgb(30 41 59 / 0.75);
}

#video-controls .mask-tab.is-active {
  border-color: rgb(16 185 129 / 0.75);
  background: rgb(6 78 59 / 0.35);
  box-shadow: inset 0 -2px 0 rgb(16 185 129 / 0.85);
}

#video-controls .mask-tab.is-empty {
  opacity: 0.78;
}

#video-controls .mask-tab-title {
  font-size: 0.6875rem;
  font-weight: 650;
  color: rgb(248 250 252);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

#video-controls .mask-tab-sub {
  font-size: 0.5625rem;
  font-weight: 500;
  color: rgb(148 163 184);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  cursor: pointer;
}

#video-controls .mask-tab.is-active .mask-tab-sub {
  color: rgb(167 243 208);
}

#video-controls .playback-mask-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 48px;
  height: 48px;
  min-height: 44px;
  max-height: 48px;
  width: 100%;
  min-width: 0;
}

#video-controls .playback-mask-row .timeline-timecode,
#video-controls .playback-mask-row .playback-time {
  flex: 0 0 auto;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

#video-controls .playback-mask-row .timeline-controls,
#video-controls .playback-mask-row .playback-controls {
  flex: 0 0 auto;
  margin-left: 0;
}

#video-controls .mask-timeline-editor.timeline-track-host,
#video-controls .mask-timeline-editor.unified-timeline-canvas {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 14px;
  max-height: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
  display: block;
  overflow: visible;
  background: transparent;
  border: none;
}

/* Taller host when mask-edit split OR cyan Preview window (else 18px cyan clips in 14px flex). */
#video-controls .mask-timeline-editor.unified-timeline-canvas:has(.timeline-track-shell[data-split="1"]),
#video-controls .mask-timeline-editor.unified-timeline-canvas:has(.timeline-track-shell[data-has-preview-window="1"]) {
  height: 22px;
  max-height: 22px;
  min-height: 22px;
  overflow: visible;
}

#video-controls .timeline-track-shell {
  position: relative;
  width: 100%;
  height: 14px;
  min-height: 14px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  overflow: visible;
}

#video-controls .timeline-track-shell[data-split="1"],
#video-controls .timeline-track-shell[data-has-preview-window="1"] {
  height: 22px;
  min-height: 22px;
}

/* Transparent upper strip — playhead scrub only (does not move green/cyan visually). */
#video-controls .timeline-scrub-hit {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 10px;
  z-index: 8;
  cursor: ew-resize;
  touch-action: none;
  background: transparent;
}

#video-controls .timeline-playback-base {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 999px;
  background: rgb(51 65 85 / 0.9);
  z-index: 0;
  pointer-events: none;
}

#video-controls .timeline-playback-progress.unified-playback-progress,
#video-controls .unified-playback-progress {
  position: absolute;
  left: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 999px;
  background: rgb(148 163 184 / 0.85);
  z-index: 1;
  pointer-events: none;
  max-width: 100%;
}

/* Mask lane on the shared center track. Upper scrub-hit (z-index 8) steals top strip. */
#video-controls .timeline-mask-layer.mask-timeline-lane,
#video-controls .timeline-mask-layer.mask-timeline-main-lane {
  position: absolute;
  inset: 0;
  height: 100%;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  z-index: 2;
  cursor: inherit;
}

#video-controls .timeline-track-shell[data-split="1"] .timeline-mask-layer.mask-timeline-lane,
#video-controls .timeline-track-shell[data-split="1"] .timeline-mask-layer.mask-timeline-main-lane {
  cursor: ew-resize;
}

/* Scrub mode: green range is display-only; pointer falls through to shell scrub. */
#video-controls .timeline-track-shell[data-mask-timing-edit="0"] .timeline-mask-layer.mask-timeline-lane,
#video-controls .timeline-track-shell[data-mask-timing-edit="0"] .timeline-mask-layer.mask-timeline-main-lane {
  pointer-events: none;
}

#video-controls .timeline-track-shell .mask-timeline-segment.is-display-only {
  pointer-events: none;
}

#video-controls .timeline-track-shell .mask-timeline-segment {
  top: 50%;
  transform: translateY(-50%);
  height: 11px;
  border-radius: 0.25rem;
}

/* Cyan Preview sample window — hollow frame above green (must stay taller than 11px green). */
#video-controls .timeline-track-shell .timeline-preview-window {
  position: absolute;
  top: 50%;
  height: 20px;
  margin-top: -10px;
  border-radius: 0.35rem;
  background: rgb(14 165 233 / 0.08);
  border: 2px solid rgb(34 211 238);
  box-shadow:
    inset 0 0 0 1px rgb(207 250 254 / 0.55),
    0 0 0 1px rgb(8 47 73 / 0.65),
    0 0 12px rgb(34 211 238 / 0.35);
  z-index: 6;
  pointer-events: none;
  box-sizing: border-box;
}

#video-controls .timeline-track-shell .timeline-preview-window::before,
#video-controls .timeline-track-shell .timeline-preview-window::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  background: rgb(103 232 249);
  border-radius: 1px;
  pointer-events: none;
  box-shadow: 0 0 6px rgb(34 211 238 / 0.55);
}

#video-controls .timeline-track-shell .timeline-preview-window::before {
  left: -2px;
}

#video-controls .timeline-track-shell .timeline-preview-window::after {
  right: -2px;
}

/* Playhead: grab-able scrub handle (click-elsewhere on shell still seeks). */
#video-controls .timeline-track-shell .mask-timeline-playhead {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 3px;
  margin-left: -1.5px;
  background: rgb(15 23 42);
  z-index: 7;
  pointer-events: auto;
  cursor: ew-resize;
  touch-action: none;
  border-radius: 1px;
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 0.95),
    0 0 0 2px rgb(15 23 42 / 0.85),
    0 0 10px rgb(15 23 42 / 0.35);
}

/* Invisible expanded hit so the knob/stem is easy to grab. */
#video-controls .timeline-track-shell .mask-timeline-playhead::after {
  content: "";
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -8px;
  right: -8px;
}

#video-controls .timeline-track-shell[data-split="1"] .mask-timeline-playhead {
  top: 0;
  bottom: 0;
}

/* Edit mask timing: playhead is display-only — must not steal hits from green handles
   (siblings under the same shell; z-index 7 would otherwise create a dead zone). */
#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .mask-timeline-playhead,
#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .mask-timeline-playhead::before,
#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .mask-timeline-playhead::after {
  pointer-events: none !important;
  cursor: default;
}

/* Edit mask timing: de-emphasize Preview window + progress so only green Mask
   handles read as the interactive control (Guest/Preview cyan looked like a handle). */
#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .timeline-preview-window {
  opacity: 0.22;
  border-color: rgb(34 211 238 / 0.35);
  box-shadow: none;
  background: rgb(14 165 233 / 0.04);
}

#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .timeline-preview-window::before,
#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .timeline-preview-window::after {
  opacity: 0.35;
  box-shadow: none;
  width: 2px;
}

#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .unified-playback-progress,
#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .timeline-playback-progress {
  opacity: 0.35;
}

#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .mask-timeline-playhead {
  opacity: 0.4;
}

#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .mask-timeline-segment.is-active {
  z-index: 5;
  box-shadow: 0 0 0 1px rgb(167 243 208 / 0.9);
}

#video-controls .timeline-track-shell[data-mask-timing-edit="1"] .mask-timeline-handle {
  width: 0.5rem;
  background: rgb(255 255 255);
  box-shadow:
    0 0 0 2px rgb(16 185 129),
    0 0 0 3px rgb(15 23 42 / 0.75),
    0 1px 3px rgb(2 6 23 / 0.45);
  z-index: 6;
}

#video-controls .timeline-track-shell .mask-timeline-playhead::before {
  content: "";
  display: block;
  position: absolute;
  left: 50%;
  top: -3px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 999px;
  background: rgb(15 23 42);
  box-shadow:
    0 0 0 2px rgb(255 255 255),
    0 0 0 3px rgb(15 23 42 / 0.9),
    0 0 8px rgb(15 23 42 / 0.45);
  pointer-events: none;
}

#video-controls .timeline-track-shell[data-split="1"] .mask-timeline-playhead::before {
  top: 0;
}

#video-controls .timeline-track-shell .mask-timeline-drag-tooltip {
  position: absolute;
  top: -1.35rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  pointer-events: none;
  white-space: nowrap;
  font-size: 0.625rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  background: rgb(15 23 42 / 0.92);
  border: 1px solid rgb(71 85 105);
  color: rgb(226 232 240);
}

#drawing-toolbar .editor-tool-group-buttons--text {
  flex-wrap: wrap;
  gap: 0.35rem;
}

#drawing-toolbar .editor-tool-btn.editor-tool-btn--text {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

#drawing-toolbar .editor-tool-btn.editor-tool-btn--text:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.unified-timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 0 0 28px;
  height: 28px;
  min-height: 28px;
}

.unified-toolbar-mask-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
}

.unified-toolbar-playback-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  margin-left: auto;
}

.unified-mask-selector-host {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  flex: 1 1 auto;
}

.unified-mask-selector-host.is-empty {
  visibility: hidden;
  pointer-events: none;
}

.mask-scope-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 7.5rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  background: rgb(30 41 59 / 0.85);
  border: 1px solid rgb(71 85 105 / 0.7);
  color: rgb(148 163 184);
  font-size: 0.5625rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.unified-mask-timeline .playback-time {
  flex: 0 0 auto;
  font-size: 0.6875rem;
}

.unified-mask-timeline .playback-controls {
  flex: 0 0 auto;
  margin-left: 0;
}

.mask-timeline-editor.unified-timeline-canvas,
.unified-timeline-canvas {
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
}

.mask-timeline-editor.unified-timeline-canvas.hidden,
.mask-timeline-editor.unified-timeline-canvas[hidden] {
  display: none !important;
}

.unified-timeline-body.mask-timeline-body,
.timeline-semantic-lanes {
  position: relative;
  flex: 1 1 auto;
  overflow: visible;
  padding: 0.05rem 0.15rem 0.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  justify-content: center;
  min-height: 34px;
}

.timeline-playhead-rail {
  position: absolute;
  inset: 0 0.15rem;
  z-index: 6;
  pointer-events: none;
}

/* A7.4: VIDEO_ONLY — playhead spans Video lane only */
.timeline-playhead-rail.playhead-span-video-only {
  top: 0;
  bottom: auto;
  height: 10px;
}

.timeline-playhead-rail.playhead-span-with-mask {
  inset: 0 0.15rem;
}

.timeline-mode-video-only .timeline-semantic-lanes {
  min-height: 10px;
  justify-content: center;
}

.timeline-semantic-lanes .mask-timeline-playhead,
.timeline-playhead-rail .mask-timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(
    180deg,
    rgb(110 231 183) 0%,
    rgb(52 211 153) 35%,
    rgb(16 185 129) 100%
  );
  z-index: 6;
  pointer-events: none;
  box-shadow:
    0 0 0 1px rgb(6 78 59 / 0.35),
    0 0 10px rgb(52 211 153 / 0.35);
}

.timeline-semantic-lanes .mask-timeline-playhead::before,
.timeline-playhead-rail .mask-timeline-playhead::before {
  content: none;
  display: none;
}

.timeline-video-lane,
.timeline-mask-lane {
  display: grid;
  grid-template-columns: 2.35rem minmax(0, 1fr);
  align-items: center;
  gap: 0.25rem;
  position: relative;
  z-index: 1;
}

.timeline-lane-label {
  font-size: 0.5rem;
  font-weight: 650;
  color: rgb(100 116 139);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  user-select: none;
}

.timeline-video-lane {
  flex: 0 0 auto;
  height: 8px;
  cursor: pointer;
}

.timeline-video-track {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: rgb(51 65 85 / 0.85);
  overflow: hidden;
}

.unified-playback-progress {
  height: 100%;
  border-radius: inherit;
  background: rgb(56 189 248 / 0.45);
  max-width: 100%;
  pointer-events: none;
}

/* Legacy absolute midline track retired (A7.3) */
.unified-playback-track {
  display: none !important;
}

.timeline-mask-lane {
  flex: 0 0 auto;
  height: 20px;
}

.timeline-mask-lane .mask-timeline-main-lane,
.timeline-semantic-lanes .mask-timeline-main-lane {
  position: relative;
  z-index: 1;
  height: 20px;
  border-radius: 0.3rem;
  background: transparent;
  overflow: visible;
  cursor: default;
}

.timeline-semantic-lanes .mask-timeline-segment {
  height: 0.75rem; /* 12px */
}

.timeline-semantic-lanes .mask-timeline-segment.is-entire {
  background: rgb(16 185 129 / 0.55);
}

.timeline-semantic-lanes .mask-timeline-handle {
  top: -2px;
  bottom: -2px;
  width: 4px;
  background: rgb(248 250 252);
  border-radius: 1px;
  box-shadow:
    0 0 0 1px rgb(15 23 42 / 0.55),
    0 1px 2px rgb(2 6 23 / 0.35);
}

/* Invisible expanded hit target so Start/End handles are easy to grab */
.timeline-semantic-lanes .mask-timeline-handle::before,
.mask-timeline-handle::before {
  content: "";
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -8px;
  right: -8px;
}

.mask-lane-edge-label {
  position: absolute;
  top: -0.7rem;
  z-index: 4;
  font-size: 0.5rem;
  font-weight: 650;
  color: rgb(148 163 184);
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
  white-space: nowrap;
  transform: translateY(-100%);
}

.mask-lane-edge-label--start {
  /* left set inline from segment % */
}

.mask-lane-edge-label--end {
  /* left set inline from segment end % */
}

.mask-timeline-overview.timeline-overview-lane,
.timeline-semantic-lanes .mask-timeline-overview {
  display: grid;
  grid-template-columns: 2.35rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  z-index: 1;
  flex: 0 0 10px;
  height: 10px;
}

.timeline-semantic-lanes .mask-timeline-overview-lane {
  position: relative;
  height: 10px;
  border-radius: 0;
  background: transparent !important; /* no empty grey rail */
}

.mask-timeline-overview-bar {
  position: absolute;
  height: 3px;
  top: 0;
  border: 0;
  border-radius: 0.1rem;
  background: rgb(100 116 139 / 0.9);
  padding: 0;
  cursor: pointer;
  min-width: 0.35rem;
}

.mask-timeline-overview-bar[data-ov-row="1"] {
  top: 3.5px;
  background: rgb(71 85 105 / 0.95);
}

.mask-timeline-overview-bar[data-ov-row="2"] {
  top: 7px;
  background: rgb(148 163 184 / 0.75);
}

.mask-timeline-overview-more {
  border: 0;
  background: transparent;
  color: rgb(148 163 184);
  font-size: 0.5625rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.15rem;
}

.mask-timeline-overview-more:hover {
  color: rgb(167 243 208);
}

.mask-status-line {
  margin: 0.35rem 0 0;
  font-size: 0.6875rem;
  color: rgb(148 163 184);
  line-height: 1.35;
}

.mask-status-line.hidden {
  display: none !important;
}

#mask-feedback-card {
  display: none !important;
}

/* Keep prior compact tokens that still apply */
.mask-timeline-editor {
  margin-top: 0;
}

.mask-timeline-editor.hidden,
.mask-timeline-editor[hidden] {
  display: none !important;
}

.mask-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 0 0 auto;
  height: 1.875rem; /* 30px */
  padding: 0 0.55rem;
  border-bottom: 1px solid rgb(51 65 85 / 0.45);
}

.mask-timeline-selector {
  position: relative;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 9rem;
}

.mask-timeline-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: rgb(226 232 240);
  font-size: 0.8125rem;
  font-weight: 650;
  padding: 0.15rem 0.1rem;
  cursor: pointer;
}

.mask-timeline-selector-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mask-timeline-selector-chevron {
  color: rgb(148 163 184);
  font-size: 0.75rem;
}

.mask-timeline-selector-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.2rem);
  z-index: 40;
  min-width: 12rem;
  max-width: min(20rem, 80vw);
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.25rem;
  border-radius: 0.45rem;
  border: 1px solid rgb(71 85 105);
  background: rgb(15 23 42);
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.4);
}

.mask-timeline-selector-menu.hidden,
.mask-timeline-selector-menu[hidden] {
  display: none !important;
}

.mask-timeline-selector-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: rgb(203 213 225);
  font-size: 0.75rem;
  text-align: left;
  padding: 0.35rem 0.45rem;
  cursor: pointer;
}

.mask-timeline-selector-option:hover,
.mask-timeline-selector-option.is-selected {
  background: rgb(16 185 129 / 0.15);
  color: rgb(167 243 208);
}

.mask-timeline-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.mask-timeline-add-btn {
  border: 1px solid rgb(71 85 105 / 0.85);
  border-radius: 0.45rem;
  background: rgb(30 41 59 / 0.85);
  color: rgb(226 232 240);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}

.mask-timeline-add-btn:hover {
  border-color: rgb(16 185 129 / 0.55);
  color: rgb(167 243 208);
}

.mask-timeline-body {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  padding: 0.3rem 0.45rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  justify-content: center;
}

.mask-timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(
    180deg,
    rgb(110 231 183) 0%,
    rgb(52 211 153) 35%,
    rgb(16 185 129) 100%
  );
  z-index: 6;
  pointer-events: none;
  box-shadow:
    0 0 0 1px rgb(6 78 59 / 0.35),
    0 0 10px rgb(52 211 153 / 0.35);
}

.mask-timeline-playhead::before {
  content: none;
  display: none;
}

.mask-timeline-main {
  position: relative;
  z-index: 1;
}

.mask-timeline-lane,
.mask-timeline-main-lane {
  position: relative;
  height: 1.25rem; /* 20px */
  border-radius: 0.3rem;
  background: transparent;
  overflow: visible;
  cursor: default;
}

.mask-timeline-segment {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 0.875rem; /* 14px */
  border-radius: 0.2rem;
  background: rgb(16 185 129 / 0.72);
  border: 1px solid rgb(52 211 153 / 0.85);
  box-sizing: border-box;
  cursor: grab;
  z-index: 2;
}

.mask-timeline-segment.is-entire {
  background: rgb(16 185 129 / 0.45);
}

.mask-timeline-segment.is-active {
  background: rgb(16 185 129 / 0.88);
}

.mask-timeline-segment--readonly {
  background: rgb(100 116 139 / 0.65);
  border-color: rgb(148 163 184 / 0.55);
  cursor: default;
  pointer-events: none;
}

.mask-timeline-handle {
  position: absolute;
  top: -0.2rem;
  bottom: -0.2rem;
  width: 0.4rem;
  background: rgb(248 250 252);
  border-radius: 0.1rem;
  box-shadow:
    0 0 0 1px rgb(15 23 42 / 0.55),
    0 1px 2px rgb(2 6 23 / 0.35);
  cursor: ew-resize;
  z-index: 3;
  touch-action: none;
}

/* B2.10F: only the drawing surface — not body / stage / timeline / CTA */
#mask-canvas,
canvas#mask-canvas,
.mask-canvas--gesture {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Processing stage: hide green mask chrome; keep bitmap so hide() restores instantly */
#mask-canvas.mask-canvas--stage-hidden {
  visibility: hidden;
}

.mask-timeline-handle--left {
  left: -0.12rem;
}

.mask-timeline-handle--right {
  right: -0.12rem;
}

.mask-timeline-segment-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.5rem;
  font-weight: 650;
  color: rgb(15 23 42);
  white-space: nowrap;
  pointer-events: auto;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mask-timeline-empty-lane-hint {
  position: absolute;
  inset: 0.1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  color: rgb(148 163 184);
  pointer-events: none;
  border: 1px dashed rgb(71 85 105 / 0.85);
  border-radius: 0.25rem;
  background: rgb(15 23 42 / 0.25);
}

.mask-scope-badge {
  cursor: pointer;
}

.mask-scope-badge:hover {
  color: rgb(226 232 240);
  border-color: rgb(100 116 139);
}

.mask-timeline-multi-note {
  position: absolute;
  left: 0.35rem;
  bottom: -0.05rem;
  font-size: 0.5rem;
  color: rgb(253 230 138);
  pointer-events: none;
  z-index: 4;
}

.mask-timeline-overview {
  display: grid;
  grid-template-columns: 2.35rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  z-index: 1;
}

.mask-timeline-overview-label {
  font-size: 0.5625rem;
  font-weight: 600;
  color: rgb(148 163 184);
  white-space: nowrap;
}

.mask-timeline-overview-lane {
  position: relative;
  height: 0.625rem; /* 10px */
  border-radius: 0;
  background: transparent; /* A7.3: no empty grey rail */
}

.mask-timeline-overview-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 0;
  border-radius: 0.15rem;
  background: rgb(100 116 139 / 0.85);
  padding: 0;
  cursor: pointer;
  min-width: 0.35rem;
}

.mask-timeline-overview-bar:hover {
  background: rgb(148 163 184);
}

.mask-timeline-overview-bar.is-empty {
  opacity: 0.35;
}

.mask-timeline-delete {
  border: 0;
  background: transparent;
  color: rgb(148 163 184);
  font-size: 0.6875rem;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 0.25rem;
}

.mask-timeline-delete:hover {
  color: rgb(252 165 165);
  background: rgb(127 29 29 / 0.25);
}

.mask-timeline-drag-tooltip {
  position: absolute;
  right: 0.45rem;
  bottom: 0.15rem;
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
  background: rgb(15 23 42 / 0.92);
  border: 1px solid rgb(71 85 105);
  color: rgb(226 232 240);
  font-size: 0.625rem;
  font-variant-numeric: tabular-nums;
  z-index: 6;
  pointer-events: none;
}

.mask-timeline-popover {
  position: fixed;
  z-index: 80;
  /* ~3/5 of former 22rem width */
  width: min(13.2rem, calc(100vw - 1rem));
  max-width: calc(100vw - 1rem);
  padding: 0.45rem 0.5rem 0.5rem;
  border-radius: 0.55rem;
  background: rgb(15 23 42);
  border: 1px solid rgb(71 85 105);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  left: 0;
  top: 0;
}

.mask-timeline-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  color: rgb(226 232 240);
  font-size: 0.75rem;
}

.mask-timeline-popover-close {
  border: 0;
  background: transparent;
  color: rgb(148 163 184);
  font-size: 1.1rem;
  cursor: pointer;
}

.mask-timeline-popover-fields {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.35rem 0.4rem;
  align-items: end;
}

.mask-timeline-popover-field {
  display: grid;
  gap: 0.15rem;
  color: rgb(148 163 184);
  font-size: 0.5625rem;
  font-weight: 650;
  min-width: 0;
}

.mask-timeline-popover-field input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 0.3rem;
  border: 1px solid rgb(71 85 105);
  background: rgb(30 41 59);
  color: rgb(226 232 240);
  padding: 0.28rem 0.35rem;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.mask-timeline-popover-end-row {
  display: contents;
}

.mask-timeline-popover-playhead,
.mask-timeline-popover-row button,
.mask-timeline-popover-actions button,
.mask-timeline-popover-done {
  border: 0;
  border-radius: 0.3rem;
  background: rgb(51 65 85);
  color: rgb(226 232 240);
  font-size: 0.625rem;
  font-weight: 650;
  padding: 0.28rem 0.45rem;
  cursor: pointer;
  white-space: nowrap;
}

.mask-timeline-popover-playhead {
  justify-self: start;
}

.mask-timeline-popover-actions {
  display: none;
}

.mask-timeline-popover-actions [data-role="full"]:disabled,
.mask-timeline-popover-actions [data-role="full"].is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mask-timeline-popover-done {
  background: rgb(16 185 129 / 0.25) !important;
  border: 1px solid rgb(16 185 129 / 0.55) !important;
  color: rgb(167 243 208) !important;
  align-self: end;
  min-height: 1.7rem;
}

.mask-timeline-popover-error {
  margin: 0.3rem 0 0;
  font-size: 0.5625rem;
  color: rgb(252 165 165);
}

.mask-timeline-popover-error.hidden {
  display: none !important;
}

/* B2.10B-R2/R3 — Mobile mask timing bottom sheet */
.mask-timing-bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

/* B2.10B-R3 — compact mobile timing sheet; video stays interactive above */
.mask-timing-bottom-sheet--r3 {
  pointer-events: none;
}

.mask-timing-bottom-sheet--r3 .mask-timing-sheet-panel--compact {
  pointer-events: auto;
  max-height: 220px;
  margin-top: auto;
  box-shadow: 0 -8px 28px rgb(0 0 0 / 0.4);
}

.mask-timing-bottom-sheet--with-inline .mask-timing-sheet-panel--compact {
  max-height: min(70vh, 28rem);
}

.mask-timing-inline-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.25rem 0.25rem;
  border-top: 1px solid rgb(51 65 85);
}

.mask-timing-inline-editor[hidden] {
  display: none !important;
}

.mask-timing-inline-editor-head {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(226 232 240);
}

.mask-timing-inline-editor-body {
  display: flex;
}

.mask-timing-inline-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.mask-timing-inline-editor-actions .mask-timing-action-btn {
  flex: 1 1 auto;
  min-height: 2.5rem;
  font-size: 0.75rem;
}

.mask-timing-inline-editor-actions .mask-timing-footer-btn {
  flex: 0 0 auto;
  min-width: 4.5rem;
}

.mask-timing-sheet-hint {
  margin: 0;
  color: rgb(148 163 184);
  font-size: 0.75rem;
  line-height: 1.35;
}

/* B2.10B-R2.2 marker model: compact sheet without picker expansion */
.mask-timing-bottom-sheet[data-timing-marker="1"] .mask-timing-sheet-panel--compact {
  max-height: 220px;
}

.mask-timing-bottom-sheet--r3 .mask-timing-sheet-body {
  padding-top: 0.25rem;
  padding-bottom: 0.5rem;
  gap: 0.5rem;
}

.mask-timing-bottom-sheet--r3 .mask-timing-handle-card {
  min-height: 3.75rem;
}

.preview-preparing-panel[hidden] {
  display: none !important;
}

.mask-timing-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(2 6 23 / 0.55);
  pointer-events: auto;
}

.mask-timing-sheet-panel {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  width: 100%;
  max-height: min(88vh, 40rem);
  display: flex;
  flex-direction: column;
  border-radius: 1rem 1rem 0 0;
  background: rgb(15 23 42);
  border: 1px solid rgb(71 85 105);
  border-bottom: 0;
  box-shadow: 0 -12px 40px rgb(0 0 0 / 0.45);
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

.mask-timing-sheet-grab {
  width: 2.5rem;
  height: 0.25rem;
  margin: 0.5rem auto 0.25rem;
  border-radius: 999px;
  background: rgb(100 116 139);
}

.mask-timing-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1rem 0.75rem;
  color: rgb(241 245 249);
  font-size: 1rem;
}

.mask-timing-sheet-close {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: rgb(51 65 85);
  color: rgb(226 232 240);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.mask-timing-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mask-timing-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.mask-timing-mode-btn,
.mask-timing-handle-btn,
.mask-timing-handle-card,
.mask-timing-action-btn,
.mask-timing-step-btn,
.mask-timing-footer-btn {
  min-height: 2.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(71 85 105);
  background: rgb(30 41 59);
  color: rgb(226 232 240);
  font-size: 0.875rem;
  font-weight: 650;
  cursor: pointer;
  padding: 0.625rem 0.75rem;
}

.mask-timing-mode-btn.is-active,
.mask-timing-handle-btn.is-active,
.mask-timing-handle-card.is-active {
  border-color: rgb(16 185 129 / 0.7);
  background: rgb(16 185 129 / 0.18);
  color: rgb(167 243 208);
}

.mask-timing-current {
  margin: 0;
  color: rgb(148 163 184);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.mask-timing-custom-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mask-timing-custom-panel[hidden] {
  display: none !important;
}

.mask-timing-range-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.mask-timing-handle-card-wrap {
  position: relative;
  min-width: 0;
}

.mask-timing-mmss-picker {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(51 65 85 / 0.9);
  background: rgb(15 23 42 / 0.92);
}

.mask-timing-mmss-picker[hidden] {
  display: none !important;
}

.mask-timing-mmss-picker-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.55rem;
}

.mask-timing-mmss-picker-head strong {
  font-size: 0.8125rem;
  color: rgb(226 232 240);
}

.mask-timing-mmss-picker-sub {
  font-size: 0.6875rem;
  color: rgb(148 163 184);
}

.mask-timing-mmss-picker-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
}

.mask-timing-mmss-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
  font-size: 0.6875rem;
  color: rgb(148 163 184);
}

.mask-timing-mmss-field select {
  width: 100%;
  min-height: 2.75rem;
  border-radius: 0.55rem;
  border: 1px solid rgb(71 85 105);
  background: rgb(2 6 23);
  color: rgb(248 250 252);
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  padding: 0.35rem 0.45rem;
}

.mask-timing-mmss-sep {
  font-size: 1.25rem;
  font-weight: 700;
  color: rgb(148 163 184);
  padding-bottom: 0.55rem;
}

.mask-timing-mmss-done {
  flex: 0 0 auto;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  border-radius: 0.55rem;
  border: 1px solid rgb(16 185 129 / 0.55);
  background: rgb(16 185 129 / 0.22);
  color: rgb(167 243 208);
  font-weight: 600;
}

.mask-timing-card-time-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  /* Legacy overlay path retained unused; video MM:SS picker is the mobile path. */
  opacity: 0.011;
  cursor: pointer;
  z-index: 2;
  font-size: 16px;
  color: transparent;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  display: none;
}

.mask-timing-handle-btn,
.mask-timing-handle-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  position: relative;
  min-height: 4.5rem;
}

.mask-timing-handle-label {
  font-size: 0.6875rem;
  color: rgb(148 163 184);
  font-weight: 600;
}

.mask-timing-handle-value {
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
  color: inherit;
  line-height: 1.2;
}

.mask-timing-handle-value-wrap {
  position: relative;
  display: block;
  width: 100%;
  min-height: 2.75rem;
}

.mask-timing-inline-time-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.01;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  color: transparent;
  background: transparent;
}

.mask-timing-inline-time-input {
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0.15rem;
  border-radius: 0.5rem;
  border: 1px solid rgb(71 85 105 / 0.9);
  background: rgb(15 23 42 / 0.55);
  color: inherit;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  padding: 0.35rem 0.5rem;
}

.mask-timing-inline-time-input[hidden],
.mask-timing-inline-time-overlay[hidden],
.mask-timing-handle-value-wrap[hidden],
.mask-timing-inline-fallback[hidden] {
  display: none !important;
}

.mask-timing-inline-fallback {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.15rem;
}

.mask-timing-inline-fallback--value {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0;
  min-height: 2.75rem;
}

.mask-timing-inline-mm,
.mask-timing-inline-ss {
  width: 2.75rem;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgb(71 85 105 / 0.9);
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 0.25rem;
}

.mask-timing-inline-sep {
  color: rgb(148 163 184);
  font-size: 1.25rem;
  font-weight: 650;
}

.mask-timing-quick-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.mask-timing-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.mask-timing-sheet-error {
  margin: 0;
  color: rgb(252 165 165);
  font-size: 0.8125rem;
}

.mask-timing-sheet-error.hidden {
  display: none !important;
}

.mask-timing-sheet-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0;
  border-top: 1px solid rgb(51 65 85 / 0.8);
  flex-shrink: 0;
}

.mask-timing-sheet-footer--apply-only {
  grid-template-columns: 1fr auto;
}

.mask-timing-sheet-footer--apply-only .mask-timing-footer-btn[hidden] {
  display: none;
}

.mask-timing-sheet-footer--apply-only:has(.mask-timing-footer-btn[hidden]:last-child) {
  grid-template-columns: 1fr;
}

.mask-timing-footer-btn--primary {
  border-color: rgb(16 185 129 / 0.55);
  background: rgb(16 185 129 / 0.22);
  color: rgb(167 243 208);
}

.mask-timing-handle-hint {
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgb(148 163 184);
}

.mask-timing-full-panel {
  padding: 0.75rem 0.25rem 0.25rem;
}

.mask-timing-full-panel[hidden] {
  display: none !important;
}

.mask-timing-full-copy {
  margin: 0;
  color: rgb(203 213 225);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.mask-timing-exact-editor {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(71 85 105);
  background: rgb(30 41 59 / 0.85);
}

.mask-timing-exact-editor[hidden] {
  display: none !important;
}

.mask-timing-exact-title {
  margin: 0;
  color: rgb(226 232 240);
  font-size: 0.875rem;
  font-weight: 650;
}

.mask-timing-exact-native,
.mask-timing-exact-fallback {
  display: grid;
  gap: 0.5rem;
}

.mask-timing-exact-fallback {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mask-timing-exact-native[hidden],
.mask-timing-exact-fallback[hidden] {
  display: none !important;
}

.mask-timing-exact-label {
  display: grid;
  gap: 0.25rem;
  color: rgb(148 163 184);
  font-size: 0.75rem;
  font-weight: 600;
}

.mask-timing-exact-label input {
  min-height: 2.75rem;
  border-radius: 0.65rem;
  border: 1px solid rgb(71 85 105);
  background: rgb(15 23 42);
  color: rgb(226 232 240);
  padding: 0.5rem 0.65rem;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.mask-timing-exact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.mask-timing-advanced {
  border-radius: 0.75rem;
  border: 1px solid rgb(71 85 105 / 0.85);
  background: rgb(30 41 59 / 0.45);
  padding: 0.25rem 0.75rem 0.75rem;
}

.mask-timing-advanced > summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: rgb(203 213 225);
  font-size: 0.875rem;
  font-weight: 650;
  list-style: none;
}

.mask-timing-advanced > summary::-webkit-details-marker {
  display: none;
}

.mask-timing-advanced-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.25rem;
}

/* Chromium can still report non-zero rects for closed <details> children; force hide. */
.mask-timing-advanced:not([open]) > .mask-timing-advanced-body {
  display: none !important;
}

.mask-timing-advanced-active {
  margin: 0;
  color: rgb(148 163 184);
  font-size: 0.8125rem;
}

.mask-timing-stepper[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .mask-timeline-popover-fields {
    grid-template-columns: 1fr 1fr auto;
  }
}

.mask-timeline-selector--static {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 11rem;
}

.mask-timeline-selector--static .mask-timeline-selector-name {
  font-size: 0.75rem;
  font-weight: 650;
  color: rgb(226 232 240);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mask-timeline-delete {
  border: 0;
  background: transparent;
  color: rgb(148 163 184);
  font-size: 0.6875rem;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 0.25rem;
}

.mask-timeline-delete:hover {
  color: rgb(252 165 165);
  background: rgb(127 29 29 / 0.25);
}

/* Sidebar V1: hint only — no Selected Mask card / empty dashed shell */
.mask-track-panel--timeline-v1 {
  border: none;
  background: transparent;
  padding: 0;
  margin-top: 0.55rem;
}

.mask-track-panel--timeline-v1.hidden,
.mask-track-panel--timeline-v1[hidden] {
  display: none !important;
}

.mask-track-panel--timeline-v1 #btn-mask-advanced-toggle,
.mask-track-panel--timeline-v1 #mask-track-advanced,
html.mask-timeline-v1 #mask-time-range-rail {
  display: none !important;
}

.mask-selected-summary,
.mask-selected-summary.hidden,
.mask-selected-summary[hidden] {
  display: none !important;
}

/* ========== B2.10D-1 Mobile Video-first Layout Shell (Same DOM + slots) ========== */
.editor-micro-tip {
  display: none;
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: rgb(148 163 184);
}

/* Right-panel marking tips — PC wide only (isolation vs mobile portrait/landscape) */
.editor-marking-tips {
  display: none;
  margin-top: 0;
  margin-bottom: 0.35rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(51 65 85 / 0.85);
  background: rgb(15 23 42 / 0.55);
}

/* Desktop wide: show Tips card (layoutMode attr and/or CSS width gate). */
.tool-workbench[data-editor-layout-mode="wide"] .editor-marking-tips,
html[data-editor-layout-mode="wide"] .editor-marking-tips {
  display: block;
}

@media (min-width: 1024px) {
  .tool-workbench:not([data-editor-layout-mode="stacked"]):not([data-editor-layout-mode="compact-wide"])
    .editor-marking-tips {
    display: block;
  }
}

/* Explicit mobile modes: zero height, no card chrome. */
.tool-workbench[data-editor-layout-mode="stacked"] .editor-marking-tips,
.tool-workbench[data-editor-layout-mode="compact-wide"] .editor-marking-tips,
html[data-editor-layout-mode="stacked"] .editor-marking-tips,
html[data-editor-layout-mode="compact-wide"] .editor-marking-tips {
  display: none !important;
  height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 1023px) {
  .editor-marking-tips {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }
}

.editor-sidebar-cta .editor-marking-tips {
  flex-shrink: 0;
}

/* Paid optional Preview — sits between Marking tips and Start Removing */
.paid-preview-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.15rem 0 0.35rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.55rem;
  border: 1px solid rgb(51 65 85 / 0.45);
  background: rgb(15 23 42 / 0.55);
  color: rgb(203 213 225);
  cursor: pointer;
  user-select: none;
}

.paid-preview-option.hidden,
.paid-preview-option[hidden] {
  display: none !important;
}

.paid-preview-option input[type="checkbox"] {
  margin-top: 0.15rem;
  width: 0.95rem;
  height: 0.95rem;
  accent-color: rgb(16 185 129);
  flex-shrink: 0;
  cursor: pointer;
}

.paid-preview-option__copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.paid-preview-option__title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: rgb(226 232 240);
}

.paid-preview-option__hint {
  font-size: 0.6875rem;
  line-height: 1.35;
  color: rgb(148 163 184);
}

/* Selected + free-preview remaining may be two lines (\n). */
.editor-cta-subtext,
#upload-cta-subtext.editor-cta-subtext {
  white-space: pre-line;
}

/* Payable N under Start — stronger than default slate-500 guidance copy */
.editor-cta-subtext.editor-cta-subtext--charge,
#upload-cta-subtext.editor-cta-subtext--charge {
  color: rgb(252 211 77); /* amber-300 */
  font-weight: 600;
}

/* Soft too-small warning / hard >50% block — same amber emphasis as charge */
.editor-cta-subtext.editor-cta-subtext--warning,
#upload-cta-subtext.editor-cta-subtext--warning,
.editor-cta-subtext.editor-cta-subtext--emphasis,
#upload-cta-subtext.editor-cta-subtext--emphasis,
#upload-cta-subtext[data-hint-tone="blocked"],
#upload-cta-subtext[data-hint-tone="error"] {
  color: rgb(252 211 77); /* amber-300 */
  font-weight: 600;
}

/* Result CTA hint — charge (success/info quote) + deny/error emphasis */
#result-lifecycle-hint.result-lifecycle-hint--charge,
#result-lifecycle-hint.result-lifecycle-hint--emphasis,
#result-lifecycle-hint[data-hint-tone="blocked"],
#result-lifecycle-hint[data-hint-tone="error"] {
  color: rgb(252 211 77); /* amber-300 */
  font-weight: 600;
}

.editor-marking-tips-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(148 163 184);
}

.editor-marking-tips-summary::-webkit-details-marker {
  display: none;
}

.editor-marking-tips-list {
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgb(203 213 225);
}

.editor-marking-tips-list li::before {
  content: "• ";
  color: rgb(148 163 184);
}

.editor-marking-tips:not([open]) > *:not(summary) {
  display: none !important;
}

/* How it works accordion (nested steps under Marking tips shell) */
.editor-how-it-works-body {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
}

.editor-how-step {
  border-radius: 0.5rem;
  border: 1px solid rgb(51 65 85 / 0.55);
  background: rgb(2 6 23 / 0.35);
  padding: 0.35rem 0.5rem 0.4rem;
}

.editor-how-step-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 650;
  color: rgb(226 232 240);
  line-height: 1.35;
}

.editor-how-step-summary::-webkit-details-marker {
  display: none;
}

.editor-how-step-summary::before {
  content: "▸ ";
  color: rgb(110 231 183);
  font-size: 0.65rem;
}

.editor-how-step[open] > .editor-how-step-summary::before {
  content: "▾ ";
}

.editor-how-step-body {
  margin-top: 0.35rem;
}

.editor-how-step-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(110 231 183);
}

.editor-how-step:not([open]) > *:not(summary) {
  display: none !important;
}

#btn-delivery-preview {
  display: none !important;
}

/* Chromium may still report layout for closed <details> children — force hide. */
.result-tips-disclosure:not([open]) > *:not(summary) {
  display: none !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  visibility: hidden !important;
}

@media (max-width: 1023px) {
  /* Flatten nesting so children participate in one mobile column (slots via order) */
  .tool-workbench--editor #main-layout-grid.editor-shell-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    height: auto;
    min-height: 0;
  }

  .tool-workbench--editor #tool-upload-panel,
  .tool-workbench--editor .editor-sidebar-inner,
  .tool-workbench--editor [data-video-upload-root],
  .tool-workbench--editor form[data-lifecycle-state]:not([data-lifecycle-state="empty"]):not(.hidden),
  .tool-workbench--editor #editor-sidebar-tools:not(.hidden) {
    display: contents !important;
  }

  .tool-workbench--editor #tool-upload-panel.tool-upload-panel--editor:not(.tool-upload-panel--empty-hero),
  .tool-workbench--editor #tool-upload-panel {
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }

  .tool-workbench--editor #tool-preview-panel.editor-video-stage {
    border-right: none;
    padding: 0;
    height: auto;
    max-height: none;
    overflow: visible;
    justify-content: flex-start;
  }

  /* Mobile visual order — Editor State */
  .tool-workbench--editor #upload-uploaded-state {
    order: 10;
  }

  .tool-workbench--editor .editor-section-head {
    order: 20;
  }

  .tool-workbench--editor #tool-preview-panel {
    order: 30;
  }

  .tool-workbench--editor #drawing-toolbar {
    order: 40;
  }

  .tool-workbench--editor #draw-tool-size-control {
    order: 45;
  }

  .tool-workbench--editor #mask-track-panel {
    order: 50;
  }

  .tool-workbench--editor #upload-lifecycle-cta {
    order: 60;
  }

  .tool-workbench--editor #mask-status-line {
    order: 70;
  }

  .tool-workbench--editor #mask-feedback-card {
    order: 80;
  }

  .tool-workbench--editor #status-box {
    order: 100;
  }

  .tool-workbench--editor #watermark-result-actions {
    order: 110;
  }

  .tool-workbench--editor #upload-empty-state,
  .tool-workbench--editor #upload-entitlement-panel {
    order: 5;
  }

  /* Result / Preview result: video first, actions after */
  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #tool-preview-panel {
    order: 10;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #watermark-result-actions {
    order: 20;
  }

  /* Compact file info */
  .tool-workbench--editor .editor-uploaded-block {
    padding: 0.35rem 0.15rem 0.45rem;
    border-bottom: 1px solid rgb(51 65 85 / 0.28);
  }

  .tool-workbench--editor .editor-file-row {
    gap: 0.5rem;
    align-items: flex-start;
  }

  .tool-workbench--editor .editor-file-row [data-testid="upload-filename"] {
    font-size: 0.8125rem;
    line-height: 1.25;
  }

  .tool-workbench--editor .editor-file-row [id$="-video-meta"] {
    font-size: 0.6875rem;
    margin-top: 0.1rem;
  }

  .tool-workbench--editor .editor-file-change {
    padding: 0.35rem 0.55rem;
    font-size: 0.6875rem;
  }

  .tool-workbench--editor #upload-resolution-note:not(.hidden) {
    margin-top: 0.35rem;
    font-size: 0.6875rem;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
  }

  /* Step + micro tip */
  .tool-workbench--editor .editor-section-head {
    padding: 0 0.15rem;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.85rem;
  }

  .tool-workbench--editor .editor-step-title {
    font-size: 0.9375rem;
  }

  .tool-workbench--editor .editor-step-description {
    display: none;
  }

  .tool-workbench--editor .editor-micro-tip {
    display: block;
  }

  .tool-workbench--editor .editor-tutorial-link {
    font-size: 0.6875rem;
    white-space: nowrap;
  }

  /* Video canvas: aspect-fit via JS; do not force tall fixed stage */
  .tool-workbench--editor #tool-preview-panel .editor-video-frame.media-stage {
    min-height: 0;
    max-height: none;
  }

  .tool-workbench--editor #tool-preview-panel .editor-video-frame:not(.media-stage) {
    min-height: 11.5rem;
    max-height: min(52vh, 22rem);
  }

  /* Compact toolbar near video */
  .tool-workbench--editor #drawing-toolbar.editor-toolbar {
    padding: 0.35rem 0.1rem 0.15rem;
    margin: 0;
  }

  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-toolbar-mask-tools {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-bottom: 0.15rem;
    max-width: 100%;
  }

  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group {
    flex: 0 0 auto;
    min-width: 0;
    padding: 0.35rem 0.4rem;
  }

  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group-label {
    font-size: 0.5625rem;
    margin-bottom: 0.2rem;
  }

  .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group-buttons button {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
  }

  /* CTA after video/tools — sticky with safe-area */
  .tool-workbench--editor .editor-sidebar-cta:not(.hidden) {
    position: sticky;
    bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
    z-index: 6;
    margin-top: 0.25rem;
    padding: 0.55rem 0.15rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgb(51 65 85 / 0.35);
    background: linear-gradient(
      to top,
      rgb(15 23 42 / 0.98) 62%,
      rgb(15 23 42 / 0.88) 82%,
      transparent 100%
    );
  }

  .tool-workbench--editor .editor-primary-cta {
    min-height: 2.85rem;
  }

  /* Result actions compact under video */
  .tool-workbench--editor #watermark-result-actions:not(.hidden) {
    margin-top: 0.35rem;
    padding: 0 0.1rem 0.75rem;
  }

  .tool-workbench--editor #watermark-result-actions #btn-download-video {
    min-height: 3rem;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }

  /* Processing: keep video visible, dim tools via existing class */
  .tool-workbench--processing #tool-preview-panel {
    order: 30;
  }
}

/* Result rail: `hidden` must beat Tailwind `flex` on the same node */
[id$="-result-actions"].hidden {
  display: none !important;
}

.result-tips-disclosure > summary {
  list-style: none;
}

.result-tips-disclosure > summary::-webkit-details-marker {
  display: none;
}

.result-tips-summary::after {
  content: "";
}

/* Preview Tips → inline Adjust (all breakpoints; do not nest under mobile-only media) */
.result-tips-disclosure .preview-tips-adjust-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
}

.inline-adjust-mask-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2rem;
  margin: 0;
  padding: 0.15rem 0.2rem;
  border: 0;
  background: transparent;
  color: rgb(110 231 183);
  font-size: inherit;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  vertical-align: baseline;
}

.inline-adjust-mask-action:hover {
  color: rgb(167 243 208);
}

.inline-adjust-mask-action:focus-visible {
  outline: 2px solid rgb(52 211 153);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.inline-adjust-mask-action__icon,
.inline-adjust-mask-action svg {
  width: 0.85rem !important;
  height: 0.85rem !important;
  max-width: 0.85rem;
  max-height: 0.85rem;
  flex-shrink: 0;
  display: inline-block;
}

@media (max-width: 1023px) {
  .result-tips-summary::after {
    content: " ›";
    color: rgb(110 231 183);
    font-weight: 600;
  }

  .result-tips-disclosure[open] > .result-tips-summary::after {
    content: " ˄";
  }

  .result-tips-disclosure:not([open]) > *:not(summary) {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    visibility: hidden !important;
  }

  /* Result comparison — editor-identical stage: fixed budget + centered viewport */
  .tool-workbench--editor .result-comparison-frame,
  .result-comparison-frame {
    flex: 0 0 auto !important;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: stretch;
    background: rgb(2 6 23);
    /* Height set by MediaContainFit to the same stage budget as editor */
    min-height: 0;
  }

  .tool-workbench--editor #comparison-container,
  .result-comparison-frame #comparison-container,
  .result-comparison-frame [data-role="result-compare-viewport"] {
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
    min-height: 0;
    /* Width/height set by MediaContainFit contain viewport */
  }

  .tool-workbench--editor #comparison-container .result-comparison-stage,
  .result-comparison-frame .result-comparison-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .tool-workbench--editor #comparison-container video,
  .tool-workbench--editor #comparison-container img,
  .tool-workbench--editor #comparison-container canvas,
  .result-comparison-frame video,
  .result-comparison-frame img,
  .result-comparison-frame canvas {
    max-height: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
  }

  .tool-workbench--editor #watermark-result-state {
    justify-content: flex-start;
    gap: 0.35rem;
  }

  .tool-workbench--editor #watermark-result-state > .flex.items-center.justify-between {
    margin-bottom: 0.35rem !important;
  }

  .tool-workbench--editor #result-state-title {
    font-size: 0.9375rem;
  }

  /* Result: hide leaked upload/file chrome (display:contents vs .hidden conflict) */
  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #upload-uploaded-state,
  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #upload-empty-state,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #upload-lifecycle-cta,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #editor-marking-tips,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #upload-entitlement-panel,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    form.hidden {
    display: none !important;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #tool-preview-panel {
    order: 10 !important;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #watermark-result-actions {
    order: 20 !important;
  }

  /*
   * Result / Preview rail — same mobile info-flow as editor:
   * video first, then Tips + Export in document flow (order:20).
   * Do not position:fixed over marketing/FAQ (bleeds "How it works" under CTA).
   */
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #watermark-result-actions:not(.hidden),
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    [id$="-result-actions"]:not(.hidden) {
    position: static !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: auto !important;
    width: auto !important;
    max-width: none;
    margin: 0.35rem 0 0;
    padding: 0.55rem 0.1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgb(51 65 85 / 0.35);
    background: transparent;
    box-shadow: none;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #btn-download-video {
    min-height: 2.85rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    font-size: 1rem;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #rating-container-result {
    display: block;
    margin-bottom: 0.75rem;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #result-lifecycle-hint:not(.hidden) {
    margin-bottom: 0.35rem;
    font-size: 0.75rem;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] #btn-process-another {
    margin-top: 0.15rem;
  }

  .tool-workbench--editor #main-layout-grid.editor-shell-layout[data-custom-layout="result"] .result-tips-disclosure {
    margin-top: 0.35rem;
    padding: 0.55rem 0.7rem;
  }

  /* Error / retry IA — video + recovery CTA first; not empty-upload look */
  .tool-workbench--editor[data-mobile-error-layout="1"] #tool-preview-panel {
    order: 10 !important;
  }

  .tool-workbench--editor[data-mobile-error-layout="1"] #upload-lifecycle-cta:not(.hidden) {
    order: 20 !important;
    position: sticky;
    bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
    z-index: 6;
    padding: 0.55rem 0.15rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgb(51 65 85 / 0.35);
    background: linear-gradient(
      to top,
      rgb(15 23 42 / 0.98) 62%,
      rgb(15 23 42 / 0.88) 82%,
      transparent 100%
    );
  }

  .tool-workbench--editor[data-mobile-error-layout="1"] #upload-uploaded-state {
    order: 5;
  }

  .tool-workbench--editor[data-mobile-error-layout="1"] .editor-section-head {
    order: 8;
  }

  .tool-workbench--editor[data-mobile-error-layout="1"] #drawing-toolbar {
    order: 40;
  }

  .tool-workbench--editor[data-mobile-error-layout="1"] #upload-cta-subtext:not(.hidden) {
    display: block;
    margin-top: 0.45rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.65rem;
    border: 1px solid rgb(248 113 113 / 0.35);
    background: rgb(127 29 29 / 0.28);
    color: rgb(254 202 202);
    font-size: 0.8125rem;
    line-height: 1.35;
    text-align: left;
  }

  .tool-workbench--editor[data-mobile-error-layout="1"] #upload-empty-state {
    display: none !important;
  }

  .tool-workbench--editor[data-mobile-error-layout="1"] #video-stage-recovery-actions:not(.hidden) {
    order: 15;
    margin: 0.5rem 0.1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(248 113 113 / 0.35);
    background: rgb(15 23 42 / 0.92);
  }

  .tool-workbench--editor[data-mobile-error-layout="1"] .video-stage-recovery-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }
}

@media (min-width: 1024px) {
  .result-comparison-frame {
    /* Stage budget + centered viewport — same model as editor media-stage */
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .result-comparison-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .result-tips-disclosure {
    display: block;
  }

  .result-tips-disclosure > summary {
    cursor: default;
    pointer-events: none;
  }

  .result-tips-summary::after {
    content: none;
  }

  /*
   * Desktop Result: hide upload/editor chrome.
   * Mobile already hides these inside max-width:1023px; without this block,
   * form.hidden loses to .tool-upload-panel--editor form { display:flex } and
   * Marking tips / Start Removing leak into Preview Ready.
   */
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #upload-uploaded-state,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #upload-empty-state,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #upload-lifecycle-cta,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #editor-marking-tips,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #upload-entitlement-panel,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    form.hidden {
    display: none !important;
  }

  /*
   * Desktop Preview/Export: after the video stage shrinks, workbench min-height
   * still leaves empty chrome below. Keep left/right column stretch so the
   * preview panel border-right divider reaches the workbench bottom.
   * Editor (non-result) keeps align-items:start for dynamic timeline chrome.
   */
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"] {
    align-items: stretch;
    grid-template-rows: minmax(var(--workbench-h), auto);
  }

  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #tool-preview-panel.editor-video-stage,
  .tool-workbench--editor
    #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
    #tool-upload-panel {
    align-self: stretch;
    height: auto;
    min-height: 100%;
  }
}

/* ── Header/nav isolation: align with editor layoutMode (not bare md:768) ── */
html[data-editor-layout-mode="stacked"] #site-desktop-nav,
html[data-editor-layout-mode="compact-wide"] #site-desktop-nav,
html[data-editor-layout-mode="stacked"] header [data-desktop-nav="1"],
html[data-editor-layout-mode="compact-wide"] header [data-desktop-nav="1"] {
  display: none !important;
}

html[data-editor-layout-mode="stacked"] #mobile-menu-btn,
html[data-editor-layout-mode="compact-wide"] #mobile-menu-btn {
  display: inline-flex !important;
}

html[data-editor-layout-mode="wide"] #site-desktop-nav,
html[data-editor-layout-mode="wide"] header [data-desktop-nav="1"] {
  display: flex !important;
}

html[data-editor-layout-mode="wide"] #mobile-menu-btn {
  display: none !important;
}

/*
 * Any mobile/narrow landscape: hide desktop nav even when height > 480
 * (previous max-height:480 fallback missed real devices / URL-bar variants).
 */
@media (max-width: 1023px) and (orientation: landscape) {
  #site-desktop-nav,
  header [data-desktop-nav="1"] {
    display: none !important;
  }

  #mobile-menu-btn {
    display: inline-flex !important;
  }

  header > div {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  header img.block.h-10 {
    height: 2rem;
  }

  #login-btn {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    font-size: 0.8125rem;
  }
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench {
  --wb-stage-video-h: min(86vh, 360px);
}

html[data-editor-layout-mode="compact-wide"] .media-slot {
  --media-slot-available-max-h: min(86vh, 360px);
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-video-frame.media-stage {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  flex: 0 0 auto;
  overflow: visible;
}

/*
 * Compact-wide = SAME mobile Step 2 flow as portrait, single column.
 * Order: Step → Video → Timeline → Tools → CTA
 * NOT a left/right desktop split. Density + height-first video only.
 */
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #main-layout-grid.editor-shell-layout {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  height: auto;
  min-height: 0;
}

/* Keep mobile display:contents flatten — do NOT restore a right rail. */
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #tool-upload-panel,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-sidebar-inner,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor [data-video-upload-root],
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor form[data-lifecycle-state]:not([data-lifecycle-state="empty"]):not(.hidden),
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #editor-sidebar-tools:not(.hidden) {
  display: contents !important;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #tool-upload-panel,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #tool-upload-panel.tool-upload-panel--editor:not(.tool-upload-panel--empty-hero) {
  width: auto;
  max-width: none;
  height: auto !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #tool-preview-panel {
  order: 30;
  width: 100%;
  min-width: 0;
  padding-block: 0.1rem;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-uploaded-block,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #upload-empty-state,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #upload-entitlement-panel,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #mask-track-panel,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #mask-status-line,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #mask-feedback-card,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #status-box {
  display: none !important;
}

/* Focus: hide Step chrome so it cannot steal Timeline in-view pixels. */
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-section-head {
  display: none !important;
  height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-step-title,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-step-description,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-micro-tip,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-tutorial-link {
  display: none !important;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar {
  order: 40;
  margin: 0;
  padding: 0.1rem 0;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #upload-lifecycle-cta,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-sidebar-cta:not(.hidden) {
  order: 60;
  /* Stay in workbench flow — do not sticky-float over marketing/FAQ. */
  position: static !important;
  margin: 0.15rem 0 0 !important;
  padding: 0.1rem 0 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Result/Preview rail: same compact-wide rule as editor CTA (in-flow, not overlay). */
html[data-editor-layout-mode="compact-wide"]
  .tool-workbench--editor
  #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
  #watermark-result-actions:not(.hidden),
html[data-editor-layout-mode="compact-wide"]
  .tool-workbench--editor
  #main-layout-grid.editor-shell-layout[data-custom-layout="result"]
  [id$="-result-actions"]:not(.hidden) {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  margin: 0.15rem 0 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Compact single-column tools: one wrap row, no DRAW/ERASE/EDIT cards */
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-toolbar-mask-tools {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  max-height: none;
  overflow: visible;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group {
  display: contents;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group-label {
  display: none !important;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group-buttons {
  display: contents;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-tool-group-buttons button {
  width: 2.35rem;
  height: 2.35rem;
  min-width: 2.35rem;
  min-height: 2.35rem;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-toolbar-brush[hidden],
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #draw-tool-size-control.editor-toolbar-brush[hidden] {
  display: none !important;
}

/* Brush/eraser size: compact row when active (no permanent display:none). */
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-toolbar-brush:not([hidden]),
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #draw-tool-size-control.editor-toolbar-brush:not([hidden]) {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  margin: 0.15rem 0 0;
  padding: 0.2rem 0.35rem;
  max-width: 22rem;
  margin-inline: auto;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-toolbar-brush:not([hidden]) label,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #draw-tool-size-control.editor-toolbar-brush:not([hidden]) label {
  font-size: 0.625rem;
  white-space: nowrap;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #drawing-toolbar.editor-toolbar .editor-toolbar-brush-row,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #draw-tool-size-control .editor-toolbar-brush-row {
  flex: 1 1 auto;
  min-width: 0;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .editor-primary-cta,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #btn-start-remove {
  min-height: 2.45rem;
  width: 100%;
  max-width: 28rem;
  margin-inline: auto;
}

html[data-editor-layout-mode="compact-wide"] .landscape-focus-rotate-hint,
.landscape-focus-rotate-hint {
  /* After tools — never between video and timeline, never steal timeline pixels. */
  order: 50;
  margin: 0.1rem 0 0;
  padding: 0 0.25rem;
  font-size: 0.6875rem;
  line-height: 1.25;
  color: rgb(148 163 184);
  text-align: center;
  max-width: 36rem;
  margin-inline: auto;
  max-height: 1.35rem;
  overflow: hidden;
}

html[data-editor-layout-mode="compact-wide"] .landscape-focus-rotate-hint[hidden] {
  display: none !important;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #upload-cta-subtext:empty,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #upload-cta-subtext.hidden {
  display: none !important;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #upload-cta-subtext:not(.hidden) {
  margin-top: 0.2rem;
  font-size: 0.6875rem;
  line-height: 1.3;
  text-align: center;
}

html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor .unified-mask-timeline.editor-playback-bar,
html[data-editor-layout-mode="compact-wide"] .tool-workbench--editor #video-controls.unified-mask-timeline {
  margin-top: 0.15rem;
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
}

/*
 * Compact-wide header: fixed overlay chrome — default hidden, no document-flow height.
 * Portrait stacked / desktop wide are unaffected (attr absent).
 */
html[data-editor-layout-mode="compact-wide"] {
  --site-header-h: 0px;
}

html[data-editor-layout-mode="compact-wide"] body.tool-page--editor-focus main {
  min-height: 100dvh;
  padding-top: 0;
  padding-bottom: 0.15rem;
  justify-content: flex-start;
}

html[data-editor-layout-mode="compact-wide"] body.tool-page--editor-focus #video-tool-editor-root,
html[data-editor-layout-mode="compact-wide"] body.tool-page--editor-focus #tool-section {
  margin-top: 0;
  padding-top: 0;
}

html[data-editor-layout-mode="compact-wide"] header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  width: 100%;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
  will-change: transform, opacity;
}

html[data-editor-layout-mode="compact-wide"][data-mobile-chrome-state="hidden"] header,
html[data-editor-layout-mode="compact-wide"] header[data-mobile-chrome-state="hidden"] {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

html[data-editor-layout-mode="compact-wide"][data-mobile-chrome-state="visible"] header,
html[data-editor-layout-mode="compact-wide"][data-mobile-chrome-state="menu-open"] header,
html[data-editor-layout-mode="compact-wide"] header[data-mobile-chrome-state="visible"],
html[data-editor-layout-mode="compact-wide"] header[data-mobile-chrome-state="menu-open"] {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

/* Keep mobile menu usable under overlay chrome (class open, not md: breakpoint). */
html[data-editor-layout-mode="compact-wide"] #mobile-menu:not(.hidden) {
  display: block !important;
}

#compact-wide-chrome-hotzone {
  position: fixed;
  top: 0;
  left: 0;
  right: 3.25rem;
  height: max(14px, env(safe-area-inset-top, 0px) + 10px);
  z-index: 72;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#compact-wide-chrome-reveal {
  position: fixed;
  top: max(0.25rem, env(safe-area-inset-top, 0px));
  right: 0.45rem;
  z-index: 73;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgb(51 65 85 / 0.55);
  border-radius: 0.65rem;
  background: rgb(15 23 42 / 0.92);
  color: rgb(226 232 240);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#compact-wide-chrome-hotzone[hidden],
#compact-wide-chrome-reveal[hidden] {
  display: none !important;
}

html[data-editor-layout-mode="compact-wide"] header > div {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

/* Upload-empty: keep upload card primary — no editor reorder */
@media (max-width: 1023px) {
  .tool-workbench--empty #main-layout-grid {
    display: grid;
  }

  .tool-workbench--empty #tool-upload-panel,
  .tool-workbench--empty .editor-sidebar-inner {
    display: flex;
    flex-direction: column;
  }
}

/* Soft pending confirm banner (tool page; not a success claim). */
.tool-payment-confirm-banner {
  position: fixed;
  top: 4.75rem;
  left: 50%;
  z-index: 9998;
  width: calc(100% - 2rem);
  max-width: 32rem;
  transform: translateX(-50%);
  border-radius: 0.85rem;
  border: 1px solid rgb(245 158 11 / 0.42);
  background: rgb(15 23 42 / 0.96);
  box-shadow: 0 18px 40px rgb(2 6 23 / 0.45);
  padding: 0.9rem 1rem;
  color: rgb(254 243 199);
}

.tool-payment-confirm-banner__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: rgb(254 243 199);
}

.tool-payment-confirm-banner__detail {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: rgb(203 213 225);
}

.tool-payment-confirm-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.tool-payment-confirm-banner__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.45rem;
  border: 1px solid rgb(71 85 105 / 0.9);
  background: rgb(30 41 59);
  color: rgb(226 232 240);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.tool-payment-confirm-banner__btn--primary {
  border-color: rgb(245 158 11 / 0.55);
  background: rgb(245 158 11 / 0.18);
  color: rgb(254 243 199);
}

.tool-payment-confirm-banner__btn--ghost {
  background: transparent;
  border-color: rgb(71 85 105 / 0.65);
  color: rgb(148 163 184);
}

.tool-payment-confirm-banner__btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
