/* Instagram-like */
.phone-overlay.style-plate {
  background: #fff;
  color: #111;
  padding: 0.3em 0.48em;
  border-radius: 0.55em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.phone-overlay.style-plain {
  background: transparent;
  color: #fff;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.9),
    0 1px 2px rgba(0, 0, 0, 0.8),
    1px 1px 0 rgba(0, 0, 0, 0.75),
    -1px -1px 0 rgba(0, 0, 0, 0.75),
    1px -1px 0 rgba(0, 0, 0, 0.75),
    -1px 1px 0 rgba(0, 0, 0, 0.75);
}

.phone-overlay.style-bar {
  width: calc(100% - (100 / 1080 * 100%));
  max-width: calc(100% - (100 / 1080 * 100%));
  padding: 0.35em 0.5em;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 0;
  color: #fff;
}

.studio-block--text .studio-text-form {
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--surface-2);
  box-shadow: var(--shadow);
}

.studio-text-area {
  resize: vertical;
  min-height: 84px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  border-radius: 12px;
  padding: 12px 14px;
  border-color: transparent;
  background: var(--input-bg);
}

.studio-text-area:focus {
  border-color: rgba(91, 140, 255, 0.45);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.studio-translate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.studio-translate-row .country-picker {
  flex: 1 1 200px;
  max-width: 280px;
}

.studio-translate-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 14px;
  white-space: nowrap;
}

.studio-text-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-chip-btn {
  appearance: none;
  position: relative;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.studio-chip-check {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ok);
  color: #0b0c0f;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s ease, transform 0.15s var(--ease);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.studio-chip-btn.is-active .studio-chip-check {
  opacity: 1;
  transform: scale(1);
}

.studio-chip-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(91, 140, 255, 0.28);
}

.studio-chip-btn:not(.is-active):hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.studio-block--text .studio-block-head {
  margin-bottom: 2px;
}

.studio-block--media .studio-media-form {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--surface-2);
  box-shadow: var(--shadow);
}

.studio-drop {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(91, 140, 255, 0.35);
  background: rgba(91, 140, 255, 0.06);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.studio-drop:hover,
.studio-drop.is-dragover {
  border-color: var(--accent);
  background: rgba(91, 140, 255, 0.12);
  transform: translateY(-1px);
}

.studio-drop-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent-hover);
  background: rgba(91, 140, 255, 0.14);
  margin-bottom: 2px;
}

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

.studio-drop-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 550;
}

.studio-media-controls {
  display: grid;
  gap: 10px;
}

.studio-media-controls[hidden] {
  display: none !important;
}

.studio-media-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.studio-media-meta {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.studio-media-remove {
  flex: 0 0 auto;
}

.studio-media-field {
  display: grid;
  gap: 6px;
}

.studio-media-field.is-disabled {
  display: none !important;
}

.studio-trim-row {
  display: grid;
  /* Fixed equal rails → film strip aligns with phone width */
  grid-template-columns: var(--studio-sound-rail, 148px) minmax(0, 1fr) var(--studio-sound-rail, 148px);
  gap: 6px;
  align-items: center;
}

.studio-trim-balance {
  min-height: 1px;
  min-width: var(--studio-sound-rail, 148px);
  pointer-events: none;
}

.studio-sound-ctrl {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 36px;
  max-width: 100%;
  width: 100%;
  height: 36px;
  flex-shrink: 0;
  justify-self: end;
  overflow: visible;
}

.studio-vol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 36px;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  flex: 0 1 auto;
  pointer-events: none;
  transform: translateX(6px) scale(0.96);
  transform-origin: right center;
  transition:
    max-width 0.28s var(--ease, ease),
    opacity 0.22s ease,
    padding 0.28s var(--ease, ease),
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.28s var(--ease, ease);
}

.studio-sound-ctrl:not(.is-muted) .studio-vol {
  max-width: 108px;
  opacity: 1;
  padding: 0 3px;
  pointer-events: auto;
  transform: translateX(0) scale(1);
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    #0e1118;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 14px rgba(0, 0, 0, 0.28);
}

.studio-vol-range {
  display: none !important;
}

.studio-vol-btn {
  appearance: none;
  border: 0;
  padding: 0;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    transform 0.15s var(--ease, ease);
}

.studio-vol-btn:hover {
  color: var(--text);
  background: rgba(91, 140, 255, 0.22);
}

.studio-vol-btn:active {
  transform: scale(0.92);
  background: rgba(91, 140, 255, 0.32);
}

.studio-vol-val {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
  opacity: 0.88;
  user-select: none;
  min-width: 34px;
  flex: 0 0 auto;
  text-align: center;
  padding: 0 1px;
}

.studio-media-track-row[hidden],
.studio-audio-track-row[hidden] {
  /* Keep the reserved track slot (override [hidden] display:none) */
  display: grid !important;
  visibility: hidden;
  pointer-events: none;
}

.studio-media-track-row,
.studio-audio-track-row {
  min-height: var(--studio-track-h, 44px);
  height: var(--studio-track-h, 44px);
}

.studio-media-track-main {
  min-width: 0;
  position: relative;
  height: 100%;
}

.studio-media-track-main .media-strip,
.studio-media-track-main .media-scroll-strip {
  width: 100%;
  height: 100%;
}

.media-strip {
  position: relative;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(62, 207, 142, 0.28);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(62, 207, 142, 0.06) 0 12px,
      rgba(62, 207, 142, 0.1) 12px 24px
    ),
    #0c1210;
  user-select: none;
  touch-action: none;
}

.media-scroll-strip {
  position: relative;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(62, 207, 142, 0.28);
  background: #0a100e;
  user-select: none;
  touch-action: none;
  cursor: grab;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.media-scroll-strip[hidden] {
  display: none !important;
}

.media-scroll-strip.is-dragging {
  cursor: grabbing;
}

.media-scroll-track {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  border-radius: 8px;
  will-change: transform;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(62, 207, 142, 0.14) 0 10px,
      rgba(94, 226, 166, 0.32) 10px 14px,
      rgba(62, 207, 142, 0.1) 14px 24px
    );
  box-shadow: inset 0 0 0 1px rgba(62, 207, 142, 0.28);
}

.media-scroll-frame {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  z-index: 2;
  box-shadow:
    inset 0 0 0 1.5px rgba(94, 226, 166, 0.75),
    inset 28px 0 18px -14px rgba(0, 0, 0, 0.32),
    inset -28px 0 18px -14px rgba(0, 0, 0, 0.32);
}

.media-scroll-hint {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(232, 255, 244, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.media-strip-dim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 1;
}

.media-strip-dim--left {
  left: 0;
}

.media-strip-dim--right {
  right: 0;
}

.media-clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 30%;
  z-index: 2;
  border-radius: 8px;
  cursor: grab;
  display: grid;
  grid-template-columns: 10px 1fr 10px;
  align-items: center;
  padding: 0 2px;
  background: linear-gradient(135deg, #5ee2a6, #3ecf8e 55%, #2bb87a);
  box-shadow:
    0 0 0 1px rgba(62, 207, 142, 0.45),
    0 6px 16px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.media-clip:active {
  cursor: grabbing;
}

.media-clip-handle {
  appearance: none;
  border: 0;
  padding: 0;
  width: 10px;
  height: 70%;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.28);
  cursor: ew-resize;
  justify-self: center;
}

.media-clip-handle:hover {
  background: rgba(0, 0, 0, 0.45);
}

.media-strip-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: 3;
  pointer-events: none;
  left: 0;
  opacity: 0.9;
}

.studio-audio-form {
  display: grid;
  gap: 10px;
}

.studio-audio-actions {
  display: grid;
  gap: 8px;
}

.studio-drop--compact {
  min-height: 56px;
  padding: 18px 14px;
  margin: 2px 0;
}

.studio-drop--compact:hover,
.studio-drop--compact.is-dragover {
  transform: none;
}

.studio-drop--compact .studio-drop-title {
  font-size: 13px;
}

.studio-block--media .studio-reveal-panel-inner,
.studio-block--audio .studio-reveal-panel-inner {
  padding: 4px 2px 6px;
}

.studio-record-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  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;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.studio-record-btn:hover {
  border-color: rgba(255, 90, 90, 0.45);
}

.studio-record-btn.is-recording {
  border-color: rgba(255, 70, 70, 0.7);
  background: rgba(255, 70, 70, 0.12);
  color: #ff8d8d;
}

.studio-record-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4d4d;
  box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.5);
}

.studio-record-btn.is-recording .studio-record-dot {
  animation: recordPulse 1.1s ease-out infinite;
}

@keyframes recordPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.55);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(255, 77, 77, 0);
  }
}

.studio-audio-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.studio-audio-track-row {
  align-items: stretch;
}

/* audio [hidden] handled with media rows above */

.studio-audio-track-main {
  min-width: 0;
  position: relative;
  height: 100%;
}

.studio-audio-track-main .audio-place-strip,
.studio-audio-track-main .audio-wave-strip {
  width: 100%;
  height: 100%;
}

.audio-place-strip {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a0c10;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.audio-place-clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 30%;
  z-index: 2;
  border-radius: 8px;
  cursor: grab;
  display: block;
  padding: 0;
  color: #eef0ff;
  font-size: 10px;
  font-weight: 750;
  background: linear-gradient(180deg, rgba(91, 110, 255, 0.45), rgba(70, 85, 220, 0.75));
  box-shadow:
    0 0 0 1px rgba(107, 124, 255, 0.45),
    0 6px 16px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.audio-place-clip:active {
  cursor: grabbing;
}

.audio-place-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.9;
  pointer-events: none;
}

.audio-place-clip .audio-clip-label {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.audio-wave-strip {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a0c10;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  cursor: grab;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.audio-wave-strip.is-dragging {
  cursor: grabbing;
}

.audio-wave-track {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  height: auto;
  will-change: transform;
}

.audio-wave-canvas {
  display: block;
  height: 100%;
  width: auto;
  border-radius: 10px;
}

.audio-wave-frame {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  z-index: 2;
  box-shadow:
    inset 0 0 0 1.5px rgba(139, 157, 255, 0.75),
    inset 36px 0 22px -18px rgba(0, 0, 0, 0.28),
    inset -36px 0 22px -18px rgba(0, 0, 0, 0.28);
}

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

.studio-mute-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    #141821;
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.25);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.15s var(--ease, ease);
}

.studio-mute-btn svg {
  display: block;
  grid-area: 1 / 1;
  width: 16px;
  height: 16px;
  transition: opacity 0.15s ease;
}

.studio-mute-btn .ico-sound-off {
  opacity: 0;
  pointer-events: none;
}

.studio-mute-btn.is-muted {
  color: #f07178;
  border-color: rgba(240, 113, 120, 0.28);
  background:
    linear-gradient(180deg, rgba(240, 113, 120, 0.14), rgba(240, 113, 120, 0.05)),
    #161018;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(240, 113, 120, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.25);
}

.studio-mute-btn.is-muted .ico-sound-on {
  opacity: 0;
}

.studio-mute-btn.is-muted .ico-sound-off {
  opacity: 1;
}

.studio-mute-btn:hover {
  border-color: rgba(91, 140, 255, 0.45);
  color: #fff;
  transform: translateY(-1px);
}

.studio-mute-btn.is-muted:hover {
  border-color: rgba(240, 113, 120, 0.5);
  color: #ff9aa2;
}

.studio-mute-btn:active {
  transform: scale(0.94);
}

.studio-drop[hidden] {
  display: none !important;
}

.studio-media-remove {
  appearance: none;
  border: 1px solid rgba(240, 113, 120, 0.35);
  background: var(--red-dim);
  color: #ffb4b8;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.studio-media-remove:hover {
  background: rgba(240, 113, 120, 0.22);
  border-color: rgba(240, 113, 120, 0.55);
}

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

.studio-shape-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--muted);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.studio-shape-btn.is-active {
  background: var(--accent-dim);
  border-color: rgba(91, 140, 255, 0.55);
  color: var(--text);
}

.studio-media-scale {
  width: 100%;
}

.studio-size-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
}

.studio-size-val {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 650;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.studio-size-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

.studio-size-range:focus {
  outline: none;
}

.studio-size-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dim), rgba(91, 140, 255, 0.35));
  border: 1px solid rgba(91, 140, 255, 0.22);
}

.studio-size-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.studio-size-range:hover::-webkit-slider-thumb,
.studio-size-range:active::-webkit-slider-thumb {
  transform: scale(1.08);
}

.studio-size-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dim), rgba(91, 140, 255, 0.35));
  border: 1px solid rgba(91, 140, 255, 0.22);
}

.studio-size-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}


/* Studio blur / effect / loop */
.studio-fx-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted, #8b919a);
  line-height: 1.35;
}
.studio-media-loop-row {
  margin-top: 0.55rem;
}
.media-strip.is-loop-locked .media-clip-handle {
  pointer-events: none;
  opacity: 0.35;
}
.studio-block--blur .studio-block-actions,
.studio-block--blur-spotlight .studio-block-actions,
.studio-block--blur-bounce .studio-block-actions,
.studio-block--effect .studio-block-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.studio-effect-form .tpl-effect-grid {
  margin-bottom: 0;
}
.studio-effect-form,
.studio-blur-form {
  display: grid;
  gap: 0.65rem;
}
.studio-effect-form .studio-timing-block,
.studio-blur-form .studio-timing-block {
  margin-top: 0;
}
