/* ===== Workspace Header ===== */
.project-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}

.project-header-title {
  flex: 1;
  min-width: 200px;
}

.project-header-title h2,
.project-name-editable {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.project-name-editable {
  cursor: text;
  display: inline-block;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background 0.15s;
}

.project-name-editable:hover {
  background: var(--surface-hover);
}

.project-name-input {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  background: var(--surface-hover);
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  outline: none;
  width: 100%;
  max-width: 320px;
}

.project-header-title p {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.project-header-tabs {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-pressed);
  border-radius: var(--r-sm);
  padding: 2px;
}

.wtab {
  padding: 6px 14px;
  min-width: 64px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
}

.wtab:hover {
  color: var(--text);
}

.wtab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.project-header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* Project name row (name + menu trigger) */
.project-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Project menu (⋮ trigger + dropdown) */
.project-menu-wrapper {
  position: relative;
  display: inline-flex;
}

.project-menu-trigger {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  opacity: 0;
  touch-action: manipulation;
  transition:
    opacity 0.15s,
    background 0.15s,
    color 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.project-name-row:hover .project-menu-trigger,
.project-menu-wrapper.open .project-menu-trigger {
  opacity: 1;
}

.project-menu-trigger:hover {
  background: var(--surface-pressed);
  color: var(--text);
}

.project-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  padding: 4px;
  z-index: 200;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.project-menu-wrapper.open .project-menu-dropdown {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.project-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  font-size: 13px;
  cursor: pointer;
  text-align: right;
  transition: background 0.12s;
  color: var(--text);
}

.project-menu-item:hover {
  background: var(--surface-hover);
}

.project-menu-item-danger {
  color: var(--danger, #ef4444);
}

.project-menu-item-danger:hover {
  background: var(--danger-soft, #fef2f2);
}

/* Audio pill in header */
.audio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  max-width: 180px;
}

.audio-pill-icon {
  font-size: 13px;
}

.audio-pill-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.audio-pill-remove {
  background: rgba(0, 113, 227, 0.15);
  border: none;
  color: var(--accent);
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.audio-pill-remove:hover {
  background: rgba(0, 113, 227, 0.25);
}

/* ===== Shots layout (3 columns - full height) ===== */
.shots-layout {
  display: grid;
  grid-template-columns: 248px 1fr 324px;
  gap: var(--s-3);
  align-items: stretch;
  min-height: calc(100vh - var(--topbar-h) - 120px);
}

@media (max-width: 1280px) {
  .shots-layout {
    grid-template-columns: 220px 1fr 230px;
  }
}

@media (max-width: 1024px) {
  .shots-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== Video selector tab ===== */
.video-selector-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
  min-height: calc(100vh - var(--topbar-h) - 130px);
}

.selector-shot-sidebar {
  position: sticky;
  top: var(--s-3);
  align-self: start;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 150px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.selector-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.selector-sidebar-head span:last-child {
  color: var(--text-3);
  font-weight: 600;
}

.selector-shot-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--s-2);
  overflow: auto;
}

.selector-shot-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  text-align: start;
  cursor: pointer;
}

.selector-shot-item:hover {
  background: var(--surface-hover);
}

.selector-shot-item.is-active {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
}

.selector-shot-thumb {
  width: 48px;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-pressed);
}

.selector-shot-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.selector-shot-title,
.selector-assign-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-shot-title {
  font-size: 13px;
  font-weight: 650;
}

.selector-shot-meta {
  font-size: 11.5px;
  color: var(--text-3);
}

.selector-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.selector-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.selector-main-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.selector-main-head p {
  margin: 3px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
}

.selector-main-hint {
  margin-top: 2px !important;
  font-size: 12px !important;
  line-height: 1.45;
  max-width: 42rem;
}

.selector-main .shot-notes-card {
  flex-shrink: 0;
  margin: 0;
}

.selector-main .shot-notes-card--compact {
  padding: var(--s-2) var(--s-3);
}

.selector-main .shot-notes-card--compact .shot-notes-input {
  max-height: min(28vh, 200px);
  height: auto;
}

.selector-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-2);
}

.selector-exclude-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
}

.selector-exclude-row.is-checked {
  color: var(--danger, #ef4444);
  border-color: color-mix(in srgb, var(--danger, #ef4444) 32%, var(--border));
}

.selector-primary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.selector-primary-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0;
  align-items: stretch;
}

.selector-primary-player .vplayer-wrap {
  border-radius: 0;
  background: #050505;
}

.selector-primary-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: var(--s-4);
  border-inline-start: 1px solid var(--border);
}

.selector-primary-label,
.selector-primary-badge,
.selector-sequence-badge,
.selector-video-tags span,
.selector-video-tags .res-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  border-radius: var(--r-pill);
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 650;
}

.selector-primary-label,
.selector-primary-badge {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
}

.selector-primary-meta strong {
  font-size: 16px;
  line-height: 1.3;
}

.selector-primary-meta span:last-child {
  color: var(--text-3);
  font-size: 12px;
}

.selector-primary-empty,
.selector-no-videos,
.selector-empty-state {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  color: var(--text-3);
  text-align: center;
}

.selector-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-3);
}

.selector-video-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.selector-video-card.is-selected {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.selector-video-card.is-primary {
  box-shadow:
    var(--shadow-xs),
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.selector-video-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  background: #0a0a0a;
  overflow: hidden;
  cursor: zoom-in;
}

.selector-video-thumb-wrap {
  position: relative;
}

.selector-video-fav-btn {
  position: absolute;
  bottom: 8px;
  inset-inline-start: 8px;
  z-index: 3;
}

.selector-video-thumb video,
.selector-video-thumb img,
.selector-shot-thumb img,
.selector-shot-thumb video,
.selector-assign-thumb video,
.selector-assign-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.selector-primary-badge,
.selector-sequence-badge {
  position: absolute;
  top: 8px;
  z-index: 2;
}

.selector-primary-badge {
  inset-inline-start: 8px;
}

.selector-sequence-badge {
  inset-inline-end: 8px;
  min-width: 24px;
  justify-content: center;
  background: rgba(17, 24, 39, 0.82);
  color: #fff;
}

.video-fav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s,
    transform 0.12s;
}

.video-fav-toggle:hover {
  background: rgba(0, 0, 0, 0.72);
  transform: scale(1.05);
}

.video-fav-toggle.is-on {
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
}

.video-fav-toggle.is-on svg {
  fill: currentColor;
}

.video-fav-badge {
  position: absolute;
  bottom: 6px;
  inset-inline-start: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.video-fav-badge svg {
  fill: currentColor;
}

.ws-version .video-fav-badge {
  bottom: auto;
  top: 4px;
  inset-inline-start: 4px;
  width: 18px;
  height: 18px;
}

.selector-video-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-3);
}

.selector-video-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.selector-video-title-row h3 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.selector-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
}

.selector-video-card.is-primary .selector-icon-btn {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.selector-video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selector-video-tags span,
.selector-video-tags .res-badge {
  background: var(--surface-pressed);
  color: var(--text-2);
}

.selector-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
}

.selector-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selector-card-actions .btn[disabled],
.selector-head-actions .btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.selector-trim-modal,
.selector-assign-modal {
  width: 100%;
}

/* Trim modal — fixed viewport, no scroll */
.modal-backdrop:has(.selector-trim-modal) {
  padding: var(--s-3);
}

.modal.modal-lg:has(.selector-trim-modal) {
  width: min(1080px, 97vw);
  max-width: min(1080px, 97vw);
  height: min(88vh, 720px);
  max-height: min(88vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
}

.selector-trim-modal {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.selector-trim-modal .modal-header {
  margin-bottom: var(--s-3);
  flex-shrink: 0;
}

.selector-trim-modal .modal-footer {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  flex-shrink: 0;
}

.selector-trim-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  overflow: hidden;
}

.selector-trim-top {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: var(--s-4);
  overflow: hidden;
}

.selector-trim-player-col {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #050505;
  border-radius: var(--r-md);
  overflow: hidden;
}

.selector-trim-video {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050505;
  border-radius: 0;
}

.selector-trim-side {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-height: 0;
  overflow: hidden;
}

.selector-trim-strip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: visible;
}

.selector-trim-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.selector-trim-strip-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.selector-trim-strip-meta {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  font-size: 12px;
}

.selector-trim-track-wrap {
  padding: 28px 18px 8px;
  overflow: visible;
}

.selector-trim-ruler {
  position: relative;
  height: 22px;
  margin-bottom: 6px;
  flex-shrink: 0;
  user-select: none;
  pointer-events: none;
}

.selector-trim-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  margin-inline-start: -0.5px;
  background: color-mix(in srgb, var(--text-3) 35%, transparent);
}

.selector-trim-tick.is-major {
  background: color-mix(in srgb, var(--text-2) 55%, transparent);
}

.selector-trim-tick-label {
  position: absolute;
  top: 0;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  white-space: nowrap;
  direction: ltr;
}

.selector-trim-track {
  position: relative;
  height: 52px;
  flex-shrink: 0;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface) 80%, #000) 0%,
    color-mix(in srgb, var(--surface) 60%, #000) 100%
  );
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--r-sm);
  cursor: pointer;
  user-select: none;
  touch-action: none;
  overflow: visible;
}

.selector-trim-dim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.selector-trim-dim--left {
  left: 0;
}

.selector-trim-dim--right {
  right: 0;
}

.selector-trim-sel {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-left: 3px solid #248a3d;
  border-right: 3px solid #c93400;
  pointer-events: none;
}

.selector-trim-handle {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 20px;
  margin-inline-start: -10px;
  border-radius: 5px;
  cursor: ew-resize;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

.selector-trim-handle--in {
  background: #248a3d;
}

.selector-trim-handle--out {
  background: #c93400;
}

.selector-trim-handle-tag {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1;
  pointer-events: none;
}

.selector-trim-handle::before {
  content: "";
  width: 2px;
  height: 20px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 4px 0 0 rgba(255, 255, 255, 0.9), -4px 0 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.selector-trim-handle-label {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  direction: ltr;
  pointer-events: none;
  line-height: 1.3;
  box-shadow: var(--shadow-xs);
}

.selector-trim-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-inline-start: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 2;
}

.selector-trim-playhead::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #fff;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.35));
}

.selector-trim-meta-row,
.selector-trim-range-meta,
.selector-trim-strip-meta .selector-trim-range-meta {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  color: var(--text);
}

.selector-trim-duration {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.3;
}

.selector-trim-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex-shrink: 0;
}

.selector-trim-quick-actions .btn {
  justify-content: center;
  padding-inline: 10px;
  font-size: 12px;
  min-height: 36px;
}

.selector-trim-fields {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex-shrink: 0;
}

.selector-trim-fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
}

.selector-trim-number {
  direction: ltr;
  text-align: left;
  padding-block: 6px;
  font-size: 13px;
}

.selector-trim-footer {
  justify-content: space-between;
}

.selector-assign-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  max-height: min(70vh, 680px);
  overflow: auto;
}

.selector-assign-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  border: 1px dashed var(--border-strong, var(--border));
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-weight: 650;
}

.selector-assign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--s-3);
}

.selector-assign-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  text-align: start;
  cursor: pointer;
}

.selector-assign-item.is-selected {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.selector-assign-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  background: #0a0a0a;
  overflow: hidden;
}

.selector-assign-check {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.88);
  color: var(--accent);
}

.selector-empty-inline {
  padding: var(--s-5);
  text-align: center;
  color: var(--text-3);
}

@media (max-width: 760px) {
  .modal.modal-lg:has(.selector-trim-modal) {
    width: min(96vw, 680px);
    max-width: 96vw;
    height: min(92vh, 680px);
    max-height: 92vh;
    padding: var(--s-3);
  }

  .selector-trim-top {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .selector-trim-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
  }

  .selector-trim-quick-actions {
    flex: 1;
    min-width: 200px;
  }

  .selector-trim-fields {
    flex: 1;
    min-width: 180px;
    flex-direction: row;
    gap: var(--s-2);
  }

  .selector-trim-fields label {
    flex: 1;
  }

  .selector-trim-track-wrap {
    padding-inline: 14px;
  }
}

@media (max-width: 1100px) {
  .video-selector-layout,
  .selector-primary-player {
    grid-template-columns: 1fr;
  }

  .selector-shot-sidebar {
    position: static;
    max-height: none;
  }

  .selector-shot-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }

  .selector-primary-meta {
    border-inline-start: none;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 720px) {
  .selector-main-head {
    align-items: stretch;
    flex-direction: column;
  }

  .selector-head-actions {
    justify-content: stretch;
  }

  .selector-head-actions .btn {
    flex: 1;
  }

  .selector-video-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Shot rail (left) ===== */
.shot-rail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: var(--s-3);
  height: calc(100vh - var(--topbar-h) - 100px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rail-add-btn {
  margin-top: var(--s-2);
  flex-shrink: 0;
}

/* .rail-section-title replaced by panel-header-row - see workspace-tools.css */

.rail-list {
  flex: 1;
  overflow-y: auto;
  margin-top: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.rail-item:hover {
  background: var(--surface-hover);
}
.rail-item.active {
  background: var(--accent-soft);
}

/* Delete shot button */
.rail-delete-btn {
  width: 20px;
  height: 20px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.rail-item:hover .rail-delete-btn {
  opacity: 0.6;
}

.rail-delete-btn:hover:not(:disabled) {
  background: var(--danger-soft, #fef2f2);
  color: var(--danger, #ef4444);
  opacity: 1;
}

.rail-delete-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Drag-and-drop states */
.rail-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.rail-item.drag-over {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

/* A video from the panel is being dragged over this shot — drop to move it. */
.rail-item--video-drop {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.panel-video-thumb.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

/* Insert between slots */
.rail-insert {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  margin: -2px 0;
}

.rail-list:hover .rail-insert {
  opacity: 0.5;
}

.rail-insert:hover {
  opacity: 1 !important;
}

.rail-insert.drag-over {
  opacity: 1 !important;
}

.rail-insert.drag-over .rail-insert-line {
  background: var(--accent);
  height: 2px;
}

.rail-insert-line {
  flex: 1;
  height: 1px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.rail-insert:hover .rail-insert-line {
  background: var(--accent);
}

.rail-insert-plus {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-2);
  font-weight: 600;
  transition: all 0.15s;
}

.rail-insert:hover .rail-insert-plus {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.rail-num {
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--surface-pressed);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.rail-item.active .rail-num {
  background: var(--accent);
  color: white;
}

.rail-thumb {
  width: 42px;
  height: 28px;
  border-radius: 5px;
  background: var(--surface-pressed);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.rail-thumb-empty {
  background: repeating-linear-gradient(
    45deg,
    var(--surface-pressed),
    var(--surface-pressed) 4px,
    var(--surface-hover) 4px,
    var(--surface-hover) 8px
  );
}

.rail-thumb.media-thumb--video {
  overflow: hidden;
}

.media-thumb--video .media-thumb-video-el,
.frame-slot-image--video-fb .frame-slot-video-fb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.frame-slot.has-video-fallback .frame-slot-overlay--video-fb {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 50%);
}

.rail-info {
  flex: 1;
  min-width: 0;
}

.rail-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  cursor: text;
  border-radius: 3px;
  padding: 1px 3px;
  margin: -1px -3px;
  transition: background 0.12s;
}

.rail-title:hover {
  background: var(--surface-hover);
}

.rail-title-input {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-hover);
  border: 1.5px solid var(--accent);
  border-radius: 3px;
  padding: 1px 5px;
  outline: none;
  min-width: 0;
  width: 100%;
}

.rail-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.status-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-pip.status-empty {
  background: var(--text-muted);
}
.status-pip.status-desc {
  background: var(--orange);
}
.status-pip.status-prompt {
  background: var(--accent);
}
.status-pip.status-image {
  background: var(--purple);
}
.status-pip.status-done {
  background: var(--green);
}
.status-pip.status-skip {
  background: var(--text-3);
}

.rail-item--excluded .rail-title {
  opacity: 0.72;
}

/* ===== Shot stage (center) ===== */
.shot-stage {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  position: sticky;
  top: var(--s-3);
  height: calc(100vh - var(--topbar-h) - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px; /* prevent scrollbar overlap */
}

.stage-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  box-shadow: var(--shadow-xs);
}

.stage-position {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  padding: 0 var(--s-2);
}

/* Frame chooser: start → end */
.frame-chooser {
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  gap: var(--s-3);
  align-items: stretch;
}

.frame-slot {
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  min-height: 0;
  transition: all 0.15s;
  /* aspect-ratio is set inline from project.settings.aspect so the slot
     keeps the project's frame shape whether or not it has an image. */
}

/* End-frame slot when the selected model doesn't support it */
.frame-slot.frame-slot-disabled {
  border-style: dashed;
  border-color: var(--border);
  pointer-events: none;
  cursor: default;
}

.frame-slot.frame-slot-disabled:not(.has-image) {
  opacity: 0.45;
}

.frame-slot.frame-slot-disabled.has-image {
  border-style: solid;
  border-color: var(--border);
  background: var(--surface-2, #f0f0f2);
  pointer-events: auto;
}

.frame-slot.frame-slot-disabled.has-image .frame-slot-disabled-inner {
  pointer-events: none;
}

.frame-slot.frame-slot-disabled.has-image .frame-slot-overlay {
  pointer-events: auto;
}

.frame-slot-image--inactive {
  z-index: 0;
}

.frame-slot-image--inactive img {
  filter: grayscale(1);
  opacity: 0.42;
}

.frame-slot-disabled-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--s-2);
}

.frame-slot-disabled-inner--overlay {
  z-index: 1;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

.frame-slot-label-static {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.frame-slot-disabled-msg {
  font-size: 10px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.3;
}

.frame-slot.has-image {
  border-style: solid;
  border-color: var(--border);
  background: var(--surface);
}

.frame-slot.required:not(.has-image) {
  border-color: rgba(0, 113, 227, 0.4);
}

.frame-slot-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 var(--s-2);
}

.frame-slot.has-image .frame-slot-label {
  position: absolute;
  top: var(--s-2);
  inset-inline-start: var(--s-2);
  z-index: 1;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.req-mark {
  color: var(--accent);
  margin-inline-start: 4px;
}

.frame-slot-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  cursor: pointer;
  color: var(--text-3);
  transition: color 0.15s;
}

.frame-slot-empty:hover {
  color: var(--text);
}

.frame-slot-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--surface-pressed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 300;
  color: var(--text-3);
}

.frame-slot-empty:hover .frame-slot-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.frame-slot-hint {
  font-size: 12px;
  font-weight: 500;
}

/* Empty slot - flex column centering the icon + hint + buttons */
.frame-slot-empty-btns {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3);
}

.frame-slot-hint-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-align: center;
}

.frame-slot-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  width: 100%;
}

.frame-slot-image {
  position: absolute;
  inset: 0;
}

.frame-slot-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.frame-slot-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 5px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

/* Filled slot: show buttons on hover on desktop */
.frame-slot.has-image:hover .frame-slot-overlay {
  opacity: 1;
}

/* Always show on touch / small screens */
@media (hover: none), (max-width: 768px) {
  .frame-slot.has-image .frame-slot-overlay {
    opacity: 1;
  }
}

/* Small action chips */
.frame-slot-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s;
  flex-shrink: 0;
}

.frame-slot-action-btn:hover {
  background: rgba(0, 0, 0, 0.82);
}

.frame-slot-action-remove:hover {
  background: rgba(200, 40, 40, 0.82);
}

.frame-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
  font-weight: 300;
}

/* Touch devices: always show the icon chips (no hover available). */
/* (Handled above with .frame-slot.has-image .frame-slot-overlay) */

/* Mobile: tighten frame-slot buttons - layout/stacking is handled by polish.css */
@media (max-width: 640px) {
  .frame-slot-overlay .btn {
    font-size: 11px;
    padding: 3px 8px;
    line-height: 1.4;
    min-height: 0;
  }
  .frame-slot-btn-row .btn {
    font-size: 11px;
    padding: 4px 8px;
    line-height: 1.4;
    min-height: 0;
    flex: 1 1 auto;
  }
}

/* Stage fields */
.stage-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-hint-inline {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Prompt card */
.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  box-shadow: var(--shadow-xs);
}

.prompt-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
}

.prompt-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.prompt-card-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.prompt-explanation {
  background: var(--accent-soft);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}

.prompt-explanation-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.textarea-mono {
  font-family: "SF Mono", Consolas, monospace !important;
  font-size: 12px !important;
  direction: ltr;
  text-align: left;
  background: var(--surface-2) !important;
}

/* Generate row */
.generate-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.step-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.duration-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.input-tiny {
  width: 56px !important;
  padding: 4px 8px !important;
  font-size: 13px !important;
}

/* Video result */
.video-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  box-shadow: var(--shadow-xs);
}

.video-result-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.video-result-frame {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
}

.video-result-frame video,
.video-result-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder-tag {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 10px;
  border-radius: 4px;
  font-weight: 500;
}

.video-result-actions {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
}

.stage-footer {
  margin-top: var(--s-2);
}

/* ===== Library panel (right) - kept for reference ===== */
.library-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: var(--s-3);
  height: calc(100vh - var(--topbar-h) - 100px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.library-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-pressed);
  border-radius: var(--r-sm);
  padding: 2px;
  margin-bottom: var(--s-3);
}

.library-tab {
  flex: 1;
  padding: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  border-radius: 6px;
  cursor: pointer;
}

.library-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.library-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--divider);
}

.library-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.library-item {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.15s;
}

.library-item:hover {
  border-color: var(--border-strong);
}

.library-item.in-use {
  border-color: var(--accent);
}

.library-item-thumb {
  aspect-ratio: 16/9;
  background: var(--surface-pressed);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.library-item-thumb img,
.library-item-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-item-info {
  padding: 6px 8px;
}

.library-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-item-meta {
  font-size: 10px;
  color: var(--text-3);
}

.library-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-top: 1px solid var(--divider);
  background: var(--surface);
}

.library-item-actions .btn {
  flex: 1;
  font-size: 11px;
  padding: 4px 6px;
}

.library-item-actions .btn-icon {
  flex: 0;
  width: 24px;
  height: 24px;
}

.library-empty {
  padding: var(--s-5) var(--s-3);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Image picker grid */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--s-2);
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.picker-item {
  aspect-ratio: 16/9;
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.picker-item:hover {
  border-color: var(--accent);
  transform: scale(1.03);
}

.picker-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--s-2);
}

/* ===== Workshop Tab ===== */

/* Glowing accent on the tab button */
.wtab--workshop {
  position: relative;
}
.wtab--workshop.active {
  color: var(--accent);
}

/* Three-column layout (RTL):
 *   right   → compact shot list
 *   center  → ONE stage card: live preview (also the effects monitor) + versions
 *   left    → ONE options panel: action menu + the selected action's full options
 */
.workshop-grid {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 480px;
  grid-template-areas: "shots stage options";
  gap: var(--s-3);
  align-items: stretch;
  min-height: calc(100vh - var(--topbar-h) - 120px);
}

.workshop-grid > .workshop-shot-list {
  grid-area: shots;
}
.ws-area-stage {
  grid-area: stage;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ws-area-options {
  grid-area: options;
  min-width: 0;
  --ws-pad: 10px;
  --ws-gap: 8px;
  --ws-gap-lg: 10px;
  --ws-text: 12px;
  --ws-text-sm: 11px;
  --ws-text-xs: 10px;
  --ws-label: 10px;
  --ws-grid-gap: 6px;
  --ws-btn-h: 32px;
}

@media (max-width: 1100px) {
  .workshop-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "shots"
      "stage"
      "options";
  }
  .workshop-grid > .workshop-shot-list {
    max-height: none;
    position: static;
  }
  .workshop-shot-items {
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px;
    scroll-snap-type: x proximity;
  }
  .workshop-shot-item {
    flex: 0 0 88px;
    scroll-snap-align: start;
    border-bottom: none;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
  }
  .workshop-shot-item.active {
    border-color: var(--accent);
  }
  .ws-area-options {
    height: auto;
    max-height: none;
    position: static;
  }
  .ws-options-split {
    flex-direction: column;
    overflow: visible;
  }
  .ws-options-menu {
    width: 100%;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    overflow-x: hidden;
    overflow-y: visible;
    border-inline-start: none;
    border-bottom: 1px solid var(--border);
    gap: 4px;
    padding: 6px 8px;
    flex-shrink: 0;
  }
  .ws-menu-group {
    width: 100%;
    padding: 4px 0 0;
    text-align: start;
  }
  .ws-menu-btn {
    flex: 0 0 auto;
    width: auto;
    flex-direction: row;
    padding: 6px 10px;
  }
  .ws-menu-label {
    white-space: nowrap;
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }
  .ws-options-content:has(.ws-wan-panel) {
    display: block;
    overflow-y: visible;
    flex: none;
  }
  .ws-wan-panel {
    flex: none;
    overflow: visible;
  }
  .ws-wan-grid-scroll {
    flex: none;
    overflow: visible;
    max-height: none;
  }
}

@media (max-width: 640px) {
  /* Workshop action menu: swipe through all tools instead of clipping */
  .ws-options-menu {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    gap: 6px;
    padding: 8px;
  }

  .ws-menu-group {
    width: auto;
    flex: 0 0 auto;
    align-self: center;
    padding: 0 2px 0 10px;
    margin-inline-start: 2px;
    border-inline-start: 1px solid var(--border);
    white-space: nowrap;
  }

  .ws-menu-group:first-child {
    border-inline-start: none;
    margin-inline-start: 0;
    padding-inline-start: 0;
  }

  .ws-menu-btn {
    scroll-snap-align: start;
  }
}

/* ── Shot list sidebar ──────────────────────────────────── */
.workshop-shot-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  position: sticky;
  top: var(--s-3);
  max-height: calc(100vh - var(--topbar-h) - 100px);
  display: flex;
  flex-direction: column;
}

.workshop-shot-list-header {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  text-align: center;
}

.workshop-shot-items {
  overflow-y: auto;
  flex: 1;
  padding: 4px;
}

.workshop-shot-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  cursor: pointer;
  transition:
    background 0.12s,
    box-shadow 0.12s;
  border-radius: var(--r-sm);
  margin-bottom: 3px;
}

.workshop-shot-item:last-child {
  margin-bottom: 0;
}

.workshop-shot-item:hover {
  background: var(--surface-hover);
}

.workshop-shot-item.active {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.workshop-shot-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: var(--r-sm);
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
  flex-shrink: 0;
}

.workshop-shot-thumb--empty {
  background-image: none;
  border: 1.5px dashed var(--border);
}

.workshop-shot-thumb.media-thumb--video {
  overflow: hidden;
}

.workshop-shot-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
}

.workshop-shot-num {
  font-size: 9px;
  color: var(--text-3);
  font-weight: 600;
  line-height: 1;
}

.workshop-shot-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}

.workshop-shot-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.workshop-shot-status-label {
  font-size: 9px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Main content area ──────────────────────────────────── */
.workshop-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.workshop-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 240px;
  color: var(--text-3);
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

/* ── Top bar: shot name + send-to-editor ────────────────── */
.ws-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px var(--s-4);
  box-shadow: var(--shadow-xs);
}

.ws-topbar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ws-topbar-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.ws-topbar-desc {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-send-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Preview row: video player + color section ──────────── */
.ws-preview-row {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: var(--s-4);
  align-items: start;
}

@media (max-width: 1100px) {
  .ws-preview-row {
    grid-template-columns: 1fr;
  }
}

/* ── Sub-tabs (color / effects / ai) ────────────────────── */
.ws-subtabs {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-pressed);
  border-radius: var(--r-md);
  padding: 3px;
  align-self: flex-start;
}

.ws-subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}

.ws-subtab:hover {
  color: var(--text);
}

.ws-subtab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.ws-subtab-badge {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: var(--r-pill);
  padding: 1px 7px;
}

.ws-subview {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.ws-fx-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

/* ── Inline VFX studio (no modal chrome) ────────────────── */
.vfx-studio--inline {
  display: flex;
  flex-direction: column;
  direction: rtl;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  height: min(760px, 80vh);
}

/* ── Video player wrapper ───────────────────────────────── */
.ws-preview-wrap {
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.ws-preview-wrap video,
.ws-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ws-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  width: 100%;
  color: #666;
}

.ws-preview-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.45);
  opacity: 0.85;
}

.ws-preview-empty-text {
  font-size: 14px;
  font-weight: 600;
}

.ws-preview-empty-hint {
  font-size: 12px;
  opacity: 0.7;
}

/* ── Generic section card ───────────────────────────────── */
.ws-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  box-shadow: var(--shadow-xs);
}

.ws-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--s-3);
}

.ws-section-icon {
  color: var(--accent);
  display: flex;
  align-items: center;
}

.ws-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.ws-section-hint {
  font-size: 11px;
  color: var(--text-3);
}

/* ── Color & Look ───────────────────────────────────────── */
.ws-color-panel {
  max-width: none;
}

.ws-color-actions {
  display: flex;
  align-items: stretch;
  gap: var(--ws-grid-gap);
  margin-bottom: 0;
}

.ws-fit-blur-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  font-size: var(--ws-text-sm);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.ws-fit-blur-row.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ws-fit-blur-row input {
  accent-color: var(--accent);
}

.ws-stage-frame .fit-blur-wrap {
  width: 100%;
  height: 100%;
}

.ws-color-reset-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--ws-btn-h);
  padding-inline: 10px;
  white-space: nowrap;
  font-size: var(--ws-text-sm);
}

.ws-color-group-label {
  font-size: var(--ws-label);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 8px 0 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.ws-color-group-label:first-of-type {
  margin-top: 0;
}

.ws-look-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ws-grid-gap);
  direction: ltr;
}

.ws-look-chip {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  background: var(--surface-2);
  transition:
    transform 0.12s ease-out,
    border-color 0.12s,
    box-shadow 0.12s;
}

.ws-look-swatch {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.ws-look-chip[data-look="natural"] .ws-look-swatch {
  background-image: linear-gradient(135deg, #b9c3cf, #8c9aa8);
}
.ws-look-chip[data-look="cinematic"] .ws-look-swatch {
  background-image: linear-gradient(135deg, #2e3a4b, #c69a6a);
}
.ws-look-chip[data-look="cool"] .ws-look-swatch {
  background-image: linear-gradient(135deg, #1f3957, #4ea6e0);
}
.ws-look-chip[data-look="warm"] .ws-look-swatch {
  background-image: linear-gradient(135deg, #6a3b1d, #e8a85a);
}
.ws-look-chip[data-look="bw"] .ws-look-swatch {
  background-image: linear-gradient(135deg, #1d1d1f, #d0d0d3);
}
.ws-look-chip[data-look="vivid"] .ws-look-swatch {
  background-image: linear-gradient(135deg, #1a6b4a, #f0c040);
}

.ws-look-chip:hover {
  transform: scale(1.04);
  border-color: var(--text-3);
}

.ws-look-chip.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft, rgba(0, 113, 227, 0.18));
}

.ws-look-name {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 1;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  padding: 8px 2px 3px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  letter-spacing: 0.02em;
  pointer-events: none;
  line-height: 1.15;
}

.ws-auto-correct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--ws-btn-h);
  margin-bottom: 0;
  padding: 0 10px;
  font-size: var(--ws-text-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  box-shadow: none;
  transition:
    filter 0.12s ease-out,
    background 0.12s ease-out;
}

.ws-auto-correct-btn:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  filter: brightness(1.06);
}

.ws-auto-correct-btn:active:not(:disabled) {
  transform: translateY(0);
}

.ws-auto-correct-btn.is-analyzing {
  animation: ws-auto-pulse 1s ease-in-out infinite;
}

@keyframes ws-auto-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

/* legacy aliases — kept for any other callers */
.ws-color-hint {
  display: none;
}

.ws-color-divider {
  display: none;
}

.ws-color-label {
  display: none;
}

/* Sliders block */
.ws-color-sliders,
.ws-sliders {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.ws-slider-row {
  display: grid;
  grid-template-columns: 58px 1fr 34px;
  align-items: center;
  gap: 6px;
}

.ws-slider-row > label {
  font-size: var(--ws-text-sm);
  color: var(--text-2);
  font-weight: 500;
}

.ws-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    to right,
    var(--accent) var(--slider-fill, 50%),
    var(--surface-pressed) var(--slider-fill, 50%)
  );
  border-radius: var(--r-pill);
  outline: none;
  cursor: pointer;
  direction: ltr;
}

.ws-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  background: #fff;
  border: 1.5px solid var(--border-strong, var(--border));
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  cursor: grab;
}

.ws-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  border-color: var(--accent);
}

.ws-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  cursor: grab;
}

.ws-slider-value {
  font-size: var(--ws-text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  text-align: end;
  font-family: "SF Mono", Consolas, monospace;
}

@media (max-width: 520px) {
  .ws-look-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ws-color-actions {
    flex-direction: column;
  }
  .ws-color-reset-btn {
    justify-content: center;
  }
}

/* ── Version strip ──────────────────────────────────────── */
.ws-versions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--shadow-xs);
}

.ws-versions-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.ws-versions-row {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  padding-bottom: 4px;
}

.ws-version {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  border-radius: var(--r-md);
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color 0.12s;
  position: relative;
}

.ws-versions-row .ws-version:only-child {
  cursor: default;
}

.ws-version:hover {
  border-color: var(--border-strong, var(--border));
}

.ws-version.active {
  border-color: var(--accent);
}

.ws-version video,
.ws-version img {
  width: 100%;
  height: 56px;
  object-fit: cover;
  display: block;
  background: #000;
}

.ws-version-name {
  display: block;
  font-size: 10px;
  color: var(--text-2);
  padding: 3px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-version-active-badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border-radius: var(--r-pill);
  padding: 2px 5px;
  line-height: 1.2;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* ── AI Effects Studio ──────────────────────────────────── */
.ws-ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-3);
}

.ws-ai-card {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  text-align: start;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition:
    border-color 0.12s,
    background 0.12s,
    transform 0.08s;
}

.ws-ai-card:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.ws-ai-card:active:not(:disabled) {
  transform: scale(0.99);
}

.ws-ai-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ws-ai-card-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.ws-ai-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ws-ai-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.ws-ai-card-desc {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-3);
}

.ws-ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--s-3);
  font-size: 12px;
  color: var(--accent);
}

.ws-ai-status--warn {
  color: var(--text-3);
}

/* card-style shot list in the right column */
.workshop-grid > .workshop-shot-list .workshop-shot-item {
  padding: 4px;
  gap: 4px;
}
.workshop-grid > .workshop-shot-list .workshop-shot-title {
  font-size: 10px;
}

/* ════════════ Workshop redesign — 3 columns ════════════ */

.ws-autosave {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--success, #16a34a);
}

/* ── Center stage card: preview + versions in ONE box ───── */
.ws-area-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  padding: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.ws-area-stage .shot-notes-card {
  flex-shrink: 0;
  margin: 0;
  padding: var(--s-2) var(--s-3);
  border: none;
  box-shadow: none;
  background: transparent;
}

.ws-area-stage .shot-notes-card--compact {
  padding: 0 0 var(--s-2);
}

.ws-area-stage .shot-notes-card--compact .shot-notes-input {
  max-height: min(28vh, 200px);
  height: auto;
  /* min-height: calc(2 * 1.45em + 20px); */
}

.ws-stage-top {
  flex-shrink: 0;
  /* padding: 0 4px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px; */
}

.ws-stage-context--compact {
  padding: 2px 4px 0;
  border-bottom: none;
  margin-bottom: 0;
}

/* Legacy full context bar */
.ws-stage-context {
  flex-shrink: 0;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.ws-stage-context-shot {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.ws-stage-context-clip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  min-width: 0;
}

.ws-stage-context-kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  flex-shrink: 0;
}

.ws-stage-context-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.ws-stage-context-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  padding: 2px 8px;
  flex-shrink: 0;
}

.ws-stage-context-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.ws-stage-context-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
}

/* Outer area centers the black frame; frame size follows project aspect */
.ws-stage-preview-area {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 160px;
  max-height: min(62vh, 100%);
}

.ws-stage-frame {
  position: relative;
  background: #0a0a0c;
  aspect-ratio: var(--ws-aspect-ratio, 16 / 9);
  width: min(100%, calc(min(62vh, 100%) * var(--ws-ar, 1.7777777778)));
  max-height: min(62vh, 100%);
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--r-md);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 24px rgba(0, 0, 0, 0.45);
}

/* Single-canvas live effects monitor (video + effects composited in one pass) */
.ws-fx-monitor {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ws-fx-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* "Preparing preview" message over the monitor until the first frame is ready */
.ws-fx-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.2s;
}

.ws-fx-loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.ws-fx-loading svg {
  color: var(--accent);
}

.ws-fx-loading.is-error {
  color: #ffb4b4;
}

.ws-fx-loading.is-error svg {
  color: #ff6b6b;
}

/* Off-screen decode pool — kept in the DOM so the videos keep producing frames,
   but never painted directly (the canvas does the compositing). */
.ws-fx-pool {
  position: absolute;
  width: 1px;
  height: 1px;
  inset-inline-start: -9999px;
  top: -9999px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Free overlay loops composited over the preview (screen blend) */
.ws-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

/* Inside the custom player: effects sit on the picture, controls stay on top */
.vplayer-wrap .ws-overlay-layer {
  z-index: 1;
}

.vplayer-wrap .vplayer-overlay {
  z-index: 2;
}

.vplayer-wrap .vplayer-bar {
  z-index: 3;
}

.ws-overlay-vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.ws-overlay-vid-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  isolation: isolate;
  overflow: hidden;
}

.ws-overlay-tint {
  position: absolute;
  inset: 0;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.ws-mask-studio-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: auto;
  touch-action: none;
  cursor: crosshair;
}

.ws-mask-studio-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Isolate: drag a line along the subject */
.ws-isolate-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: crosshair;
  touch-action: none;
}
.ws-isolate-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.ws-isolate-line {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.65));
}
.ws-isolate-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.ws-isolate-rect {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.12);
  border-radius: 4px;
  pointer-events: none;
  box-sizing: border-box;
}
.ws-isolate-rect--hint {
  border-style: dotted;
  opacity: 0.55;
}
.ws-isolate-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ws-grid-gap);
  padding: 6px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.ws-isolate-count {
  font-size: var(--ws-text-sm);
  font-weight: 600;
  color: var(--text-2);
}

/* ── Subject layers panel (aura / outline / shadow / bg) ─── */
.ws-layers-panel {
  display: flex;
  flex-direction: column;
  gap: var(--ws-gap);
}

/* The live compositor monitor fills the stage frame. */
.ws-layers-monitor {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 180px;
  background: #000;
  overflow: hidden;
}
.ws-layers-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ws-sky-mask-overlay {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 6;
  height: 55%;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(255, 139, 56, 0.34) 0%,
    rgba(255, 139, 56, 0.28) calc(100% - var(--sky-feather, 8%)),
    rgba(255, 139, 56, 0) 100%
  );
  border-bottom: 1px solid rgba(255, 210, 127, 0.85);
  mix-blend-mode: screen;
}

.ws-layer-group {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ws-layer-group-title {
  font-size: var(--ws-label);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ws-layer-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.ws-layer-label {
  flex: 0 0 64px;
  font-size: var(--ws-text-sm);
  color: var(--text-2);
}
.ws-layer-range {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.ws-layer-color-field {
  justify-content: space-between;
}

.ws-layer-color-btn {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 2px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.12);
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    transform 0.1s ease;
}

.ws-layer-color-btn:hover {
  border-color: var(--accent);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 2px var(--accent-soft);
}

.ws-layer-color-btn:active {
  transform: scale(0.96);
}

.ws-layer-color-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

.ws-layer-color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  opacity: 0;
  cursor: pointer;
}

.ws-layer-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ws-layer-chip {
  min-height: 28px;
  padding: 0 12px;
  font-size: var(--ws-text-sm);
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-1, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease;
}
.ws-layer-chip:hover {
  border-color: var(--accent);
}
.ws-layer-chip.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.ws-layer-subject-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.ws-layer-subject-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.ws-layer-subject-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #111;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ws-layer-subject-thumb-vid,
.ws-layer-subject-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-layer-subject-copy {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 2px;
}

.ws-layer-subject-title {
  font-size: var(--ws-text-sm);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.ws-layer-subject-desc {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-3);
}

.ws-layer-subject-rebtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: flex-end;
  width: auto;
  margin-top: 2px;
}

/* ── Overlay visual cards ───────────────────────────────── */
.ws-overlays-panel {
  max-width: none;
}

.ws-overlay-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ws-grid-gap);
}

.ws-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.ws-overlay-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #080808;
  border: 1.5px solid var(--border);
  transition:
    border-color 0.12s,
    transform 0.12s ease-out;
}

.ws-overlay-card:hover .ws-overlay-thumb {
  border-color: var(--text-3);
  transform: none;
}

.ws-overlay-card.active .ws-overlay-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft, rgba(0, 113, 227, 0.18));
}

.ws-overlay-thumb video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.ws-overlay-check {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ws-overlay-card-name {
  font-size: var(--ws-text-xs);
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
  line-height: 1.2;
}

.ws-overlay-card.active .ws-overlay-card-name {
  color: var(--accent);
}

.ws-ai-overlay-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.ws-ai-overlay-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--ws-text-sm);
  font-weight: 600;
}

.ws-ai-overlay-desc {
  margin-top: 0.25rem;
  margin-bottom: 0.65rem;
}

.ws-ai-overlay-prompt {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  margin-bottom: 0.5rem;
}

.ws-ai-overlay-gen {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ws-ai-overlay-active {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.ws-ai-overlay-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--r-xs);
  background: #000;
  flex-shrink: 0;
}

.ws-ai-overlay-thumb video,
video.ws-ai-overlay-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
}

.ws-ai-overlay-active-label {
  flex: 1;
  font-size: var(--ws-text-sm);
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
}

.ws-overlay-vid-wrap img.ws-overlay-vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* legacy fallback chips (kept for safety) */
.ws-overlay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px;
}
.ws-overlay-chip {
  padding: 6px 5px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--ws-text-xs);
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  text-align: center;
}
.ws-overlay-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── AI link buttons (bodyFx panel) ────────────────────── */
.ws-ai-links-row {
  display: flex;
  flex-direction: column;
  gap: var(--ws-grid-gap);
}

.ws-ai-link-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  text-align: start;
  transition:
    background 0.12s,
    border-color 0.12s;
}

.ws-ai-link-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.ws-ai-link-icon {
  flex-shrink: 0;
  color: var(--accent);
  display: flex;
}

.ws-ai-link-label {
  font-size: var(--ws-text-sm);
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.ws-ai-link-desc {
  display: none;
}

/* the plain colour preview fills the project-aspect frame */
.ws-stage-frame > .ws-preview-wrap {
  position: relative;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  max-height: none;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.ws-stage-frame .ws-preview-wrap .vplayer-wrap {
  width: 100%;
  height: 100%;
  border-radius: 0;
  flex: 1 1 auto;
  min-height: 0;
}

.ws-stage-frame .ws-preview-wrap .vplayer-video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ws-stage-frame .ws-preview-wrap video,
.ws-stage-frame .ws-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* the effects monitor takes over the same slot, no extra chrome */
.ws-stage-frame > .vfx-m-panel--preview {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ws-stage-frame > .vfx-m-panel--preview > .vfx-m-panel-head {
  display: none;
}

/* versions live inside the same card → tight strip directly under preview */
.ws-area-stage .ws-versions {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 8px 0 0;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.ws-area-stage .ws-versions-label {
  margin-bottom: 4px;
  font-size: 10px;
}

.ws-area-stage .ws-versions-row {
  gap: 6px;
}

/* .ws-area-stage .ws-version {
  width: 84px;
} */

.ws-area-stage .ws-version video,
.ws-area-stage .ws-version img {
  height: 48px;
}

/* Active enhancements — below versions, outside the preview frame */
.ws-enhancements {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.ws-enh-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  min-height: 30px;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.ws-enh-empty {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  padding: 4px 2px;
  white-space: nowrap;
}

.ws-enh-chip {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
  transition:
    border-color 0.12s,
    background 0.12s;
}

.ws-enh-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ws-enh-chip-main {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px 4px 7px;
  border: none;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  min-width: 0;
  transition: color 0.12s;
}

.ws-enh-chip:hover .ws-enh-chip-main {
  color: var(--accent);
}

.ws-enh-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-inline-start: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
}

.ws-enh-chip-remove:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.ws-enh-chip-icon {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
  color: var(--accent);
  opacity: 0.9;
}

.ws-enh-chip-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ── Left options panel: vertical menu rail (right) + action area (left) ─ */
.ws-area-options {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--s-3);
  height: calc(100vh - var(--topbar-h) - 80px);
  max-height: calc(100vh - var(--topbar-h) - 80px);
  --ws-pad: 10px;
  --ws-gap: 8px;
  --ws-gap-lg: 10px;
  --ws-text: 12px;
  --ws-text-sm: 11px;
  --ws-text-xs: 10px;
  --ws-label: 10px;
  --ws-grid-gap: 6px;
  --ws-btn-h: 32px;
}

.ws-options-split {
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.ws-options-menu {
  width: 136px;
  flex-shrink: 0;
  padding: 6px 5px;
  border-bottom: none;
  border-inline-start: 1px solid var(--border);
  background: var(--surface-2);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-menu-group {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.78;
  padding: 10px 4px 2px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  line-height: 1.1;
  text-align: start;
}
.ws-menu-group:first-child {
  padding-top: 2px;
  margin-top: 0;
  border-top: none;
}

/* Vertical stack — one button per row in the menu rail */
.ws-menu-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ws-menu-btn {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  width: 100%;
  min-height: 0;
  padding: 6px 5px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  text-align: start;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
}

.ws-menu-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

.ws-menu-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.ws-menu-icon {
  display: flex;
  flex-shrink: 0;
  line-height: 0;
}

.ws-menu-label {
  line-height: 1.25;
  font-size: 11px;
  white-space: normal;
  overflow: visible;
  flex: 1;
  min-width: 0;
  text-align: start;
}

.ws-menu-badge {
  flex-shrink: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ws-menu-btn.active .ws-menu-badge {
  background: var(--accent);
  color: #fff;
}

.ws-action-badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: var(--r-pill);
  padding: 0 4px;
  line-height: 14px;
}

.ws-menu-spin {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  display: inline-flex;
  color: var(--accent);
  animation: ws-spin 1s linear infinite;
}

@keyframes ws-spin {
  to {
    transform: rotate(360deg);
  }
}

.ws-options-body {
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ws-options-head {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-2);
}

.ws-options-head-action {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.ws-options-head-help {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  line-height: 1.35;
}

.ws-options-head-source {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1.35;
  min-width: 0;
}

.ws-options-head-source--empty {
  color: var(--text-3);
  font-weight: 500;
}

.ws-options-head-kicker {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.ws-options-head-name {
  color: var(--text);
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-options-head-index {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ws-options-head-meta {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.ws-options-head-meta::before {
  content: "·";
  margin-inline: 2px 4px;
}

.ws-options-head-note {
  flex: 1 1 100%;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  line-height: 1.35;
}

.ws-options-content {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: var(--ws-pad);
}

/* the effects studio controls drop straight into the options body */
.ws-options-content > .vfx-m-tabs {
  margin-bottom: var(--ws-gap);
}

/* ── Inline action panel (AI controls) ──────────────────── */
.ws-action-panel {
  display: flex;
  flex-direction: column;
  gap: var(--ws-gap);
}

.ws-action-body {
  display: flex;
  flex-direction: column;
  gap: var(--ws-gap);
}

.ws-action-desc {
  margin: 0;
  padding: 0;
  font-size: var(--ws-text-sm);
  line-height: 1.45;
  color: var(--text-3);
  background: none;
  border: none;
  border-radius: 0;
}

.ws-ai-step-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0 10px;
  border-bottom: 1px solid var(--border);
}

.ws-ai-step-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ws-ai-step-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.ws-ai-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ws-ai-step-copy {
  min-width: 0;
}

.ws-ai-step-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.ws-ai-step-hint {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.ws-mask-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ws-grid-gap);
}

.ws-mask-mode {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 7px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  text-align: start;
}

.ws-mask-mode:hover {
  border-color: var(--border-strong);
}

.ws-mask-mode.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.ws-mask-mode .ui-icon {
  grid-row: 1 / span 2;
}

.ws-mask-mode-label {
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ws-mask-mode-hint {
  min-width: 0;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.ws-mask-detect-status {
  display: block;
  font-size: 11px;
  color: var(--text-2);
  margin: 4px 0 8px;
}

.ws-ai-range-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.ws-range-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ws-range-input {
  width: 100%;
  min-width: 0;
}

.ws-range-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ws-ai-mask-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.ws-ai-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ws-ai-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.ws-ai-status-row .ws-ai-status {
  margin-top: 0;
}

.ws-ai-status-row .btn {
  flex-shrink: 0;
}

.ws-mask-tool-row,
.ws-mask-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ws-mask-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.ws-mask-tool:hover {
  border-color: var(--border-strong);
}

.ws-mask-tool.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.ws-mask-guard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.35;
}

.ws-mask-guard-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ws-mask-guard span:not(.ws-mask-guard-title) {
  white-space: pre-line;
}

.ws-advanced-details {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.ws-advanced-details summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.ws-advanced-details .ws-mask-guard {
  margin: 0 10px 10px;
}

.ws-advanced-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 10px 10px;
}

.ws-advanced-stack .ws-mask-guard {
  margin: 0;
}

.ws-replace-presets .ws-style-preset-grid {
  margin: 0 10px 10px;
}

.ws-engine-note {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .ws-ai-status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .ws-ai-row-actions {
    justify-content: stretch;
  }

  .ws-ai-row-actions .btn {
    flex: 1 1 auto;
  }
}

.ws-tracker-layer-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ws-tracker-layer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.8fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.ws-tracker-layer-name {
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.ws-runway-actions,
.ws-final-look-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Aleph 2 / 3-step premium panel ──────────────────────────────────────── */
.ws-runway-panel--steps {
  gap: 0;
}

.ws-step {
  padding-top: 12px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}

.ws-step--locked {
  opacity: 0.35;
  pointer-events: none;
}

.ws-step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ws-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent, #6d56fa);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ws-step-title {
  font-weight: 600;
  font-size: 13px;
}

.ws-step-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.ws-original-frame-btn--active {
  border-color: var(--accent, #6c8cff);
  background: color-mix(in srgb, var(--accent, #6c8cff) 12%, transparent);
}

.ws-frame-original-pick {
  margin-top: 8px;
}

.ws-step-status {
  font-size: 11px;
  color: var(--text-2);
}

.ws-scrub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.ws-scrub-range {
  flex: 1;
  min-width: 0;
}

.ws-scrub-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
  color: var(--text-2);
}

.ws-scrub-video-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--r-sm);
  overflow: hidden;
  min-height: 80px;
}

.ws-scrub-proxy-badge {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.ws-step-hint {
  margin: 0 0 var(--s-2);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-3);
}

.ws-scrub-video {
  width: 100%;
  display: block;
}

.ws-frame-thumb {
  width: 100%;
  border-radius: var(--r-sm);
  display: block;
  margin-top: 6px;
}

.ws-frame-img-wrap {
  position: relative;
  margin-top: 6px;
}

.ws-frame-img-wrap .ws-frame-thumb {
  margin-top: 0;
}

.ws-frame-img-wrap .ws-frame-zoom-btn,
.ws-gen-thumb .ws-gen-thumb-zoom {
  opacity: 0.9;
}

.ws-gen-thumb-zoom {
  top: 3px;
  inset-inline-start: 3px;
  inset-inline-end: auto;
  width: 22px;
  height: 22px;
}

.ws-frame-pair-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.ws-frame-pair-label {
  display: block;
  font-size: 10px;
  color: var(--text-2);
  text-align: center;
  margin-bottom: 2px;
}

.ws-gen-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 0;
}

.ws-gen-thumb {
  position: relative;
  width: calc(33.333% - 4px);
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  padding: 0;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.ws-gen-thumb:hover {
  border-color: var(--text-2);
}

.ws-gen-thumb--selected {
  border-color: var(--accent, #6d56fa);
  box-shadow: 0 0 0 1px var(--accent, #6d56fa);
}

.ws-gen-thumb-img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.ws-gen-thumb-num {
  position: absolute;
  bottom: 3px;
  right: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
}

.ws-gen-thumb--selected .ws-gen-thumb-num {
  background: var(--accent, #6d56fa);
}

.ws-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.ws-preset-chip {
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-1);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1.4;
}

.ws-preset-chip:hover {
  background: var(--surface-2);
}

.ws-range-section {
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.ws-range-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ws-range-header .field-label {
  margin: 0;
}

.ws-range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ws-range-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ws-range-label {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  min-width: 14px;
}

.ws-range-cost {
  font-size: 11px;
  color: var(--text-2);
  margin-right: 2px;
}

.ws-step3-engines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.ws-step3-engines > div {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-step3-engine-name {
  font-weight: 600;
  font-size: 12px;
}

.ws-step3-engine-hint {
  font-size: 10px;
  color: var(--text-2);
  line-height: 1.4;
}

.ws-final-look-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.ws-final-look-check {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.ws-restyle-warning {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--r-sm);
  background: rgba(245, 158, 11, 0.08);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.4;
}

.ws-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ws-sound-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* max-height: min(42vh, 280px); */
  overflow-y: auto;
  padding-inline-end: 2px;
}

.ws-sound-suggestion-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-sound-panel .ws-run-btn {
  margin-top: 2px;
}

/* ── Style / Relight visual preset cards ──────────────────── */
.ws-style-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ws-grid-gap);
}

.ws-style-card {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  padding: 0;
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}

.ws-style-card:hover {
  transform: none;
  border-color: var(--text-muted);
  box-shadow: none;
}

.ws-style-card.active,
.ws-style-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}

.ws-style-card-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 0.3s var(--ease-out);
}

.ws-style-card:hover .ws-style-card-preview {
  transform: none;
}

.ws-style-card-label {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 1;
  padding: 10px 6px 5px;
  font-size: var(--ws-text-xs);
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.2;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-style-card:hover .ws-style-card-label {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

.ws-run-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--ws-btn-h);
  padding: 0 12px;
  margin-top: 2px;
  font-size: var(--ws-text-sm);
  font-weight: 600;
}

/* Price chip beside run button (not stacked inside full-width button) */
.ws-action-body > .generate-btn-with-price,
.ws-wan-panel > .generate-btn-with-price,
.ws-lipsync-footer .generate-btn-with-price,
.ws-restyle-footer .generate-btn-with-price {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
  direction: ltr;
}

.ws-action-body > .generate-btn-with-price .ws-run-btn,
.ws-wan-panel > .generate-btn-with-price .ws-run-btn,
.ws-lipsync-footer .generate-btn-with-price .ws-run-btn,
.ws-restyle-footer .generate-btn-with-price .ws-run-btn {
  width: auto;
  flex: 1;
  min-width: 0;
  margin-top: 0;
  direction: rtl;
}

.ws-action-body > .generate-btn-with-price .generate-btn-price,
.ws-wan-panel > .generate-btn-with-price .generate-btn-price,
.ws-lipsync-footer .generate-btn-with-price .generate-btn-price,
.ws-restyle-footer .generate-btn-with-price .generate-btn-price {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
}

/* lip-sync quality options */
.ws-lipsync-options {
  display: flex;
  flex-direction: column;
  gap: var(--ws-grid-gap);
}

.ws-lipsync-option {
  text-align: start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  width: 100%;
  transition:
    border-color 0.12s,
    background 0.12s;
}

.ws-lipsync-option:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.ws-lipsync-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ws-lipsync-title {
  font-size: var(--ws-text-sm);
  font-weight: 700;
  color: var(--text);
}

.ws-lipsync-sub {
  font-size: var(--ws-text-xs);
  line-height: 1.4;
  color: var(--text-3);
  margin-top: 2px;
}

.ws-lipsync-price {
  font-size: var(--ws-text-xs);
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
}

/* Wan preset effect picker — selectable chip grid */
.ws-wan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ws-grid-gap);
  padding: 1px;
}

/* Wan panel — scrollable grid, run button pinned at bottom */
.ws-options-content:has(.ws-wan-panel) {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  overflow: hidden;
  min-height: 0;
}

.ws-options-content:has(.ws-wan-panel) > .ws-action-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ws-wan-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--ws-gap);
}

.ws-wan-panel-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ws-gap);
}

.ws-wan-grid-scroll {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-bottom: 2px;
}

.ws-wan-grid-scroll .ws-wan-grid {
  align-content: start;
}

.ws-wan-panel .ws-run-btn {
  flex-shrink: 0;
  margin-top: auto;
}

/* Lip-sync panel — inline audio list + pinned run button */
.ws-options-content:has(.ws-lipsync-panel) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.ws-lipsync-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ws-gap);
}

.ws-lipsync-panel-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ws-gap);
}

.ws-lipsync-panel .ws-inline-audio-picker {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ws-gap);
}

.ws-lipsync-panel .audio-picker-library--inline {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ws-lipsync-panel .audio-picker-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.ws-lipsync-footer {
  flex-shrink: 0;
  margin-top: auto;
}

.ws-lipsync-speech {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  background: var(--surface-2);
}

.ws-lipsync-speech summary {
  cursor: pointer;
  font-size: var(--ws-text-sm);
  font-weight: 600;
  color: var(--text);
  list-style: none;
  user-select: none;
}

.ws-lipsync-speech summary::-webkit-details-marker {
  display: none;
}

.ws-lipsync-speech .textarea {
  margin-top: 6px;
  width: 100%;
  min-height: 48px;
  max-height: 84px;
  font-size: var(--ws-text-sm);
}

.ws-lipsync-speech-btn {
  margin-top: 6px;
}

.audio-picker-quick--inline {
  flex-shrink: 0;
}

.audio-picker-library--inline {
  gap: 4px;
}

.ws-wan-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  padding: 7px 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.12s,
    background-color 0.12s;
}

.ws-wan-chip:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: none;
}

.ws-wan-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft-2);
}

.ws-wan-chip-icon {
  color: var(--text-3);
  transition: color 0.16s;
}

.ws-wan-chip.active .ws-wan-chip-icon {
  color: var(--accent);
}

.ws-wan-chip-label {
  font-size: var(--ws-text-xs);
  font-weight: 600;
  color: var(--text-2);
  line-height: 1.2;
  transition: color 0.12s;
}

.ws-wan-chip.active .ws-wan-chip-label {
  color: var(--accent);
  font-weight: 700;
}

.ws-wan-chip:hover .ws-wan-chip-label {
  color: var(--text);
}

/* ── Effects section ────────────────────────────────────── */
.ws-effect-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  padding: 2px 9px;
}

.ws-fx-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ws-fx-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-3);
  margin: 8px 0 0;
}

.ws-fx-presets-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--s-4) 0 6px;
}

/* ── Scene presets — visual example cards ───────────────── */
.ws-presets-panel {
  max-width: none;
}

.ws-presets-empty {
  margin: 0;
  padding: 0;
  font-size: var(--ws-text-sm);
  color: var(--text-3);
  background: none;
  border: none;
  border-radius: 0;
}

.ws-preset-group-label {
  font-size: var(--ws-label);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 8px 0 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.ws-preset-group-label:first-of-type {
  margin-top: 0;
}

.ws-preset-group-sublabel {
  font-size: var(--ws-label);
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: 0.03em;
  margin: 10px 0 4px;
}

.ws-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ws-grid-gap);
}

.ws-preset-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: start;
  min-width: 0;
}

.ws-preset-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ws-preset-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: #0a0a0a;
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}

.ws-preset-card:hover:not(:disabled) .ws-preset-preview {
  transform: none;
  border-color: var(--text-3);
}

.ws-preset-card.is-selected .ws-preset-preview {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft, rgba(0, 113, 227, 0.18));
}

.ws-preset-check {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  z-index: 3;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.ws-preset-base {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.ws-preset-vfx {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: screen;
  pointer-events: none;
}

.ws-preset-vfx-fallback {
  transition: opacity 0.2s ease;
}

.ws-preset-fx-badge {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  z-index: 2;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: var(--r-pill);
  padding: 2px 6px;
  line-height: 1.3;
  pointer-events: none;
}

.ws-preset-label {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 3;
  padding: 10px 6px 5px;
  font-size: var(--ws-text-xs);
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.2;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  pointer-events: none;
}

.ws-preset-example {
  margin: 0;
  padding: 0 1px;
  font-size: 9px;
  line-height: 1.35;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ws-preset-tune {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  margin: 2px 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.ws-overlay-tune {
  align-items: flex-start;
  gap: 8px;
}

.ws-overlay-tune .ws-tune-title {
  flex: 0 0 100%;
}

.ws-tune-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  margin-inline-end: 2px;
}

.ws-tune-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ws-tune-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  width: 52px;
  flex-shrink: 0;
}

.ws-tune-range {
  width: 72px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.ws-tune-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  min-width: 26px;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.ws-tune-field--select {
  min-width: 150px;
}

.ws-tune-select {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.ws-tune-color {
  width: 36px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}

.ws-tune-beat {
  min-height: 30px;
  align-self: center;
}

.ws-fx-group-label {
  font-size: var(--ws-text-sm);
  font-weight: 600;
  color: var(--text-2);
  margin: 6px 0 4px;
}

.ws-fx-preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ws-fx-preset-chip {
  padding: 5px 10px;
  border-radius: var(--r-pill);
  font-size: var(--ws-text-xs);
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s;
}

@media (max-width: 520px) {
  .ws-preset-grid,
  .ws-overlay-card-grid,
  .ws-style-preset-grid,
  .ws-mask-mode-grid,
  .ws-final-look-grid,
  .ws-wan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ws-tracker-layer-row {
    grid-template-columns: 1fr;
  }
}

.ws-fx-preset-chip:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.ws-fx-preset-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Restyle modal extras (workshop) ─────────────────────── */
.ws-restyle-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ws-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ws-text-sm);
  font-weight: 600;
  color: var(--text-2);
}

.ws-field > span {
  min-width: 52px;
  flex-shrink: 0;
}

.ws-field .input {
  flex: 1;
}

.ws-restyle-opts {
  display: flex;
  gap: var(--ws-gap);
  flex-wrap: wrap;
}

.ws-restyle-luma-note {
  margin: 0;
  font-size: var(--ws-text-xs);
  line-height: 1.4;
  color: var(--text-3);
}

.ws-restyle-footer {
  margin-top: auto;
  padding-top: 2px;
}

.ws-restyle-footer .generate-btn-with-price {
  margin-top: 0;
}

.ws-restyle-footer .ws-run-btn {
  margin-top: 0;
}

.ws-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ws-text-sm);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.ws-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.ws-seg {
  display: inline-flex;
  background: var(--surface-pressed);
  border-radius: var(--r-xs);
  padding: 2px;
  gap: 2px;
}

.ws-seg button {
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: 5px;
  font-size: var(--ws-text-xs);
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
  white-space: nowrap;
}

.ws-seg button:hover:not(.active) {
  color: var(--text);
  background: var(--surface-hover);
}

.ws-seg button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

/* ─── Add-structure button in shots rail header ──────────────────────────────── */
.rail-add-structure-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
  white-space: nowrap;
}

.rail-add-structure-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── Add-structure dialog ─────────────────────────────────────────────────── */
.modal:has(.add-structure-modal) {
  width: min(560px, 94vw);
  max-width: min(560px, 94vw);
  max-height: min(78vh, 620px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: var(--s-4) var(--s-5);
}

.add-structure-modal {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.add-structure-modal .modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: var(--s-2);
}

.add-structure-hint {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
}

.add-structure-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.add-structure-blocks {
  flex: 1;
  min-height: 0;
  max-height: min(46vh, 380px);
  overflow-y: auto;
  padding: 2px 1px;
  -webkit-overflow-scrolling: touch;
}

.add-structure-block {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.add-structure-divider {
  border: none;
  margin: var(--s-3) 0;
  height: 0;
  border-top: 1px solid color-mix(in srgb, var(--border) 88%, var(--text-3));
}

.add-structure-line {
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.55;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  direction: rtl;
  text-align: right;
  transition: border-color 0.15s;
}

.add-structure-line:focus {
  outline: none;
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   Workshop — unified panel scale (options content)
   ═══════════════════════════════════════════════════════════ */

.ws-options-content .input,
.ws-options-content .input-select,
.ws-options-content select {
  font-size: var(--ws-text-sm);
  padding: 6px 8px;
  min-height: var(--ws-btn-h);
}

.ws-options-content .textarea,
.ws-options-content .ws-prompt-textarea {
  font-size: var(--ws-text-sm);
  line-height: 1.45;
  padding: 6px 8px;
  min-height: 48px;
  max-height: 84px;
  resize: vertical;
}

.ws-prompt-field-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.ws-options-content .ai-modal-textarea {
  min-height: 48px;
  max-height: 84px;
}

.ws-options-content .btn {
  font-size: var(--ws-text-sm);
}

.ws-options-content .btn-sm {
  min-height: 28px;
  padding: 0 8px;
  font-size: var(--ws-text-xs);
}

.ws-options-content .control-chip {
  padding: 4px 8px;
  font-size: var(--ws-text-xs);
}

.ws-options-content .ws-restyle-opts {
  gap: var(--ws-gap);
}

.ws-options-content .ws-io-panel {
  gap: var(--ws-gap);
}

/* Shot list — menu rail only (panels use --ws-* tokens above) */
.workshop-shot-list-header {
  font-size: 11px;
}
.workshop-shot-title {
  font-size: 11px;
}

.ws-menu-group {
  font-size: 9px;
}
.ws-menu-btn {
  font-size: 11px;
}
.ws-menu-label {
  font-size: 11px;
}

/* ── Video frame picker modal (frame-slot.js) ────────────────────────────── */

/* "קח פריים מסרטון" card in the library picker grid */
.assign-picker-video-frame {
  border: 1.5px dashed var(--accent);
  background: var(--accent-soft);
}
.assign-picker-video-frame:hover {
  opacity: 0.82;
}
.assign-picker-video-frame-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

/* ── Make the .modal shell behave like the library modal ─────────────────── */
.modal:has(.vfp-modal) {
  display: flex;
  flex-direction: column;
  height: min(90vh, 740px);
  max-height: min(90vh, 740px);
  overflow: hidden;
  padding: 0;
  min-height: 0;
}

/* ── Inner flex container ────────────────────────────────────────────────── */
.vfp-modal {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.vfp-modal .modal-header {
  padding: 16px 20px 14px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Two-column layout: sidebar (right, RTL col-1) + main (left, col-2) ─── */
.vfp-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Sidebar: scrollable video list ─────────────────────────────────────── */
.vfp-sidebar {
  overflow-y: auto;
  border-inline-start: 1px solid var(--border);
  background: var(--surface-2);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.vfp-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
  padding: 2px 4px 4px;
  min-width: 0;
}

.vfp-sidebar-expand {
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 8px;
  white-space: nowrap;
}

.vfp-vid-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

.vfp-vid-empty {
  margin: 0;
  padding: 12px 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-3);
  text-align: center;
}

.vfp-sidebar-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 4px 4px 0;
  flex: 1;
  min-width: 0;
}

.vfp-vid-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.1s;
  min-width: 0;
}
.vfp-vid-item:hover {
  background: var(--surface-hover);
}
.vfp-vid-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.vfp-vid-thumb {
  width: 52px;
  height: 33px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--surface-3);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-3);
  border: 1px solid var(--border);
}

.vfp-vid-name {
  font-size: 12px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}

/* ── Main area: video player + controls ─────────────────────────────────── */
.vfp-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  overflow: hidden;
  min-height: 0;
  flex: 1;
}

.vfp-video-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  border-radius: var(--r-md);
}

/* Custom vplayer fills the entire frame-picker area */
.vfp-video-wrap .vplayer-wrap {
  flex: 1;
  min-height: 0;
  border-radius: var(--r-md);
}

.vfp-video-wrap .vplayer-video {
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.vfp-time-label,
.vfp-blur-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 40px;
  text-align: start;
  flex-shrink: 0;
}

.vfp-blur-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.vfp-blur-row-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 40px;
}

.vfp-blur-row .ws-slider {
  flex: 1;
}

.vfp-actions {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 8px;
}

.vfp-confirm-btn {
  min-width: 120px;
}

/* ── Frame image crop modal (frame-slot.js) ──────────────────────────────── */
.modal:has(.fcm-modal) {
  max-width: min(720px, 96vw);
}

.fcm-modal {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.fcm-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 20px 20px;
  min-height: 0;
}

.fcm-preview-wrap {
  position: relative;
  width: 100%;
  max-height: min(52vh, 420px);
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius-md, 10px);
  background: #000;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.fcm-preview-wrap.is-dragging {
  cursor: grabbing;
}

.fcm-preview-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.fcm-preview-frame {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.fcm-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}

.fcm-aspect-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.fcm-aspect-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fcm-aspect-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.fcm-aspect-chip:hover {
  border-color: var(--accent);
  color: var(--text-1);
}

.fcm-aspect-chip.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--text-1);
}

.fcm-slider-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 10px;
}

.fcm-slider-label,
.fcm-zoom-label {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.fcm-zoom-label {
  min-width: 42px;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.fcm-slider-row .ws-slider {
  flex: 1;
  min-width: 0;
}

.fcm-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}
