.studio-timing-block {
  display: grid;
  gap: 0;
}

.studio-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  user-select: none;
}

.studio-switch-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.studio-switch-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.studio-switch-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.studio-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.studio-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.studio-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  transition: background 0.2s var(--ease), border-color 0.2s ease;
}

.studio-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s var(--ease);
}

.studio-switch input:checked + .studio-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.studio-switch input:checked + .studio-switch-track::after {
  transform: translateX(18px);
}

.studio-switch input:focus-visible + .studio-switch-track {
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.studio-timing-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  visibility: hidden;
  transition:
    grid-template-rows 0.28s var(--ease),
    opacity 0.22s ease,
    margin-top 0.28s var(--ease),
    visibility 0s linear 0.22s;
}

.studio-timing-panel > .studio-timing-row {
  overflow: hidden;
  min-height: 0;
}

.studio-timing-panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 10px;
  visibility: visible;
  transition:
    grid-template-rows 0.28s var(--ease),
    opacity 0.22s ease,
    margin-top 0.28s var(--ease),
    visibility 0s linear 0s;
}

.studio-reveal-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  visibility: hidden;
  transition:
    grid-template-rows 0.28s var(--ease),
    opacity 0.22s ease,
    margin-top 0.28s var(--ease),
    visibility 0s linear 0.22s;
}

.studio-reveal-panel-inner {
  overflow: hidden;
  min-height: 0;
}

.studio-reveal-panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 10px;
  visibility: visible;
  transition:
    grid-template-rows 0.28s var(--ease),
    opacity 0.22s ease,
    margin-top 0.28s var(--ease),
    visibility 0s linear 0s;
}

.studio-block-toggle {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.studio-block-toggle .studio-switch {
  width: 40px;
  height: 22px;
}

.studio-block-toggle .studio-switch-track::after {
  width: 16px;
  height: 16px;
  top: 2px;
  left: 2px;
}

.studio-block-toggle .studio-switch input:checked + .studio-switch-track::after {
  transform: translateX(16px);
}

.studio-timing-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.studio-timing {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.studio-timing-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 2px;
}

.studio-stepper {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: stretch;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  overflow: hidden;
}

.studio-step-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.studio-step-btn:hover {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

.studio-step-btn:active {
  background: rgba(91, 140, 255, 0.22);
  color: #fff;
}

.studio-step-input {
  width: 100%;
  min-width: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: center;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  padding: 9px 4px !important;
  -moz-appearance: textfield;
}

.studio-step-input::-webkit-outer-spin-button,
.studio-step-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.studio-step-input:focus {
  outline: none;
  box-shadow: none !important;
}

.studio-block-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.phone-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.phone-guides.is-on {
  opacity: 1;
}

.guide {
  position: absolute;
  background: #ff4d6d;
  box-shadow: 0 0 0 1px rgba(255, 77, 109, 0.25);
}

.guide-v {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  opacity: 0;
}

.guide-h {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
  opacity: 0;
}

.phone-guides.snap-x .guide-v,
.phone-guides.snap-y .guide-h {
  opacity: 1;
}

.phone-overlays {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.phone-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  /* 50px margins on 1080×1920 */
  max-width: calc(100% - (100 / 1080 * 100%));
  width: max-content;
  box-sizing: border-box;
  text-align: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.18;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: opacity 0.12s ease, outline-color 0.15s ease, visibility 0.12s ease;
}

.phone-overlay.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Selected but outside its interval — dim ghost so you can still edit position */
.phone-overlay.is-ghost {
  opacity: 0.38;
  visibility: visible;
  pointer-events: auto;
}

.phone-overlay.is-selected {
  outline: 2px solid rgba(91, 140, 255, 0.95);
  outline-offset: 6px;
}

.phone-overlay:active {
  cursor: grabbing;
}

.phone-overlay--media {
  z-index: 1;
  width: 36%;
  max-width: none;
  padding: 0;
  background: transparent;
  overflow: hidden;
  line-height: 0;
  white-space: normal;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  outline-offset: 4px;
  border-radius: 0;
}

.phone-overlay:not(.phone-overlay--media) {
  z-index: 2;
}

.phone-overlay--media.shape-rect {
  aspect-ratio: 9 / 16;
}

.phone-overlay--media.shape-circle {
  border-radius: 50% !important;
  aspect-ratio: 1 / 1;
}

.phone-overlay--media video,
.phone-overlay--media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.phone-overlay--media .media-resize {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 0;
  padding: 0;
  cursor: nwse-resize;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.phone-overlay--media.is-selected .media-resize {
  opacity: 1;
}

.phone-overlay--media .media-resize::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-right: 2px solid #111;
  border-bottom: 2px solid #111;
  border-radius: 1px;
}

.trim-strip {
  position: relative;
  height: var(--studio-main-strip-h, 44px);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0a0c10;
  user-select: none;
  touch-action: none;
  cursor: ew-resize;
}

.trim-strip.is-scrubbing {
  cursor: grabbing;
}

.trim-shimmer {
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    #12151c 0%,
    #12151c 35%,
    #1c2430 45%,
    #2a3548 50%,
    #1c2430 55%,
    #12151c 65%,
    #12151c 100%
  );
  background-size: 220% 100%;
  transition: opacity 0.25s ease;
}

.trim-strip.is-loading .trim-shimmer {
  opacity: 1;
  animation: trimShimmer 1.15s ease-in-out infinite;
}

.trim-strip.is-loading .trim-film,
.trim-strip.is-loading .trim-dim,
.trim-strip.is-loading .trim-window,
.trim-strip.is-loading .trim-playhead {
  opacity: 0;
}

.trim-film {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.trim-dim,
.trim-window,
.trim-playhead {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.trim-strip.is-ready .trim-film,
.trim-strip.is-ready .trim-dim,
.trim-strip.is-ready .trim-window,
.trim-strip.is-ready .trim-playhead {
  opacity: 1;
}

@keyframes trimShimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.trim-dim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 2;
}

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

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

.trim-window {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.25);
  z-index: 3;
  pointer-events: none;
}

.trim-handle {
  appearance: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  border: 0;
  padding: 0;
  cursor: ew-resize;
  pointer-events: auto;
  background: var(--accent);
  z-index: 4;
}

.trim-handle--start {
  left: -2px;
  border-radius: 6px 0 0 6px;
}

.trim-handle--end {
  right: -2px;
  border-radius: 0 6px 6px 0;
}

.trim-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 18px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 4px 0 0 rgba(255, 255, 255, 0.85);
}

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

@media (max-width: 980px) {
  .shell.is-studio .main {
    padding-bottom: calc(12px + var(--dock-h) + var(--safe-b));
  }

  .studio {
    grid-template-columns: 1fr !important;
    grid-template-rows: minmax(0, 1fr) minmax(0, 42vh);
  }

  .studio-panel {
    order: 2;
    height: 100%;
  }

  .studio-stage {
    order: 1;
    min-height: 0;
  }
}

@media (max-width: 860px) {
  .mobile-dock {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .dock-item span {
    font-size: 9.5px;
  }
}

.studio-asr-btn {
  appearance: none;
  position: relative;
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.studio-voice-captions {
  display: grid;
  gap: 10px;
}

.studio-asr-btn[hidden],
.studio-captions-box[hidden],
.studio-voice-captions[hidden] {
  display: none !important;
}

.studio-asr-btn:hover {
  border-color: rgba(91, 140, 255, 0.45);
}

.studio-asr-btn.is-loading {
  opacity: 0.75;
  pointer-events: none;
  cursor: wait;
}

.studio-asr-btn.is-loading .btn-label {
  opacity: 0;
}

.studio-asr-btn .btn-spinner {
  display: none;
}

.studio-asr-btn.is-loading .btn-spinner {
  display: inline-block;
  position: absolute;
}

.studio-captions-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.studio-captions-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.studio-captions-text {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  padding: 10px;
}

.studio-captions-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.studio-captions-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.studio-captions-setting {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 140px;
}

.studio-captions-setting--color {
  flex: 0 0 auto;
}

.studio-captions-setting-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.studio-captions-setting .studio-size-wrap {
  flex: 1;
  min-width: 0;
}

.studio-captions-color {
  appearance: none;
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

.studio-captions-color::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.studio-captions-color::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}

.studio-captions-color::-moz-color-swatch {
  border: 0;
  border-radius: 5px;
}

.studio-captions-note {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.phone-overlay--captions {
  z-index: 3;
  width: max-content;
  max-width: calc(100% - (100 / 1080 * 100%));
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.22em 0.28em;
  padding: 0.22em 0.35em;
  background: transparent;
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  white-space: normal;
  /* Hidden until voice hits this phrase — not a static label */
  opacity: 0 !important;
  pointer-events: none;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.95),
    0 2px 4px rgba(0, 0, 0, 0.75),
    1px 1px 0 rgba(0, 0, 0, 0.8),
    -1px -1px 0 rgba(0, 0, 0, 0.8);
}

.phone-overlay--captions.is-on {
  opacity: 1 !important;
  pointer-events: auto;
}

/* Placement ghost only while paused & selected */
.phone-overlay--captions.is-selected:not(.is-on) {
  opacity: 0.42 !important;
  pointer-events: auto;
}

.phone-overlay--captions .cap-word {
  opacity: 1;
  color: #fff;
  transition: color 0.08s ease, transform 0.08s ease;
}

.phone-overlay--captions .cap-word.is-on {
  opacity: 1;
  color: var(--cap-hi, #ffe566);
  transform: scale(1.07);
}

.phone-overlay--captions .media-resize {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 0;
  padding: 0;
  cursor: nwse-resize;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.phone-overlay--captions.is-selected .media-resize {
  opacity: 1;
}

.phone-overlay--captions .media-resize::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-right: 2px solid #333;
  border-bottom: 2px solid #333;
}



