/* Phone workspace. The editing engine and project state remain shared with desktop. */
.editor-close-control { place-items: center; padding: 0; line-height: 1; }
#closeRecordingSetup, #videoTrimClose, #closeClipSpeed { display: grid; }
.editor-close-control .editor-close-mark { display: block; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.inspector-panel .inspector-head .inspector-expand { display: none; }
.timeline-toolbar #timelinePropertiesButton { display: none; }

@media (max-width: 700px), (max-width: 950px) and (orientation: landscape) and (max-height: 500px) {
  .tool-rail .tool[data-panel="recording"] { display: none; }

  :root {
    --rail: 0px;
    --timeline: clamp(226px, 32dvh, 292px);
    --mobile-rail-width: 56px;
  }

  html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
  button { -webkit-tap-highlight-color: transparent; }
  .studio {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-width: 0;
    overflow: hidden;
    background: #090a10;
  }

  .topbar,
  .topbar.has-header-ad {
    position: relative;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: calc(58px + env(safe-area-inset-top, 0px));
    flex: 0 0 calc(58px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 10px 0;
    border-bottom: 1px solid #292433;
    background: #101017;
  }
  .topbar .header-identity { display: flex; flex: 0 0 auto; width: auto; min-width: 0; }
  .topbar .header-ad-placement { display: none !important; }
  .topbar .editor-brand-lockup,
  html[dir="rtl"] .topbar .editor-brand-lockup {
    display: flex;
    width: auto;
    height: 42px;
    min-width: 0;
    padding: 0;
    border: 0;
  }
  .topbar .editor-brand-lockup img,
  .topbar.has-header-ad .header-identity > .editor-brand-lockup img {
    display: block;
    width: 95px;
    height: auto;
    max-height: 34px;
    object-fit: contain;
    content: url("../brand/medbaa-logo-compact.svg");
  }
  .topbar > .top-actions,
  .topbar:not(.has-header-ad) > .top-actions,
  .topbar.has-header-ad > .top-actions,
  .topbar.has-header-ad:has(.editor-ad-slot--adsense) > .top-actions {
    display: flex;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: auto;
    max-width: none;
    height: auto;
    margin: 0;
    padding: 0;
  }
  .topbar .top-actions-account-row,
  .topbar.has-header-ad .top-actions-account-row { flex: 0 1 auto; width: auto; gap: 4px; }
  .topbar .account-link,
  .topbar:not(.has-header-ad) .account-link,
  .topbar.has-header-ad .account-link {
    flex: 0 1 auto;
    min-width: 0;
    width: auto;
    max-width: 104px;
    min-height: 34px;
    padding: 3px 6px;
    gap: 5px;
    border-radius: 4px;
  }
  .topbar .account-link .avatar,
  .topbar.has-header-ad .account-link .avatar { flex: 0 0 26px; width: 26px; height: 26px; }
  .topbar .account-name { font-size: 10px; }
  .topbar .account-plan { display: none; }
  .topbar .editor-language { min-width: 46px; height: 30px; font-size: 9px; }
  .topbar .header-action-buttons,
  .topbar:not(.has-header-ad) .header-action-buttons,
  .topbar.has-header-ad .header-action-buttons {
    position: static;
    display: flex;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    gap: 5px;
    transform: none;
  }
  .topbar .header-action-buttons > button,
  .topbar:not(.has-header-ad) .header-action-buttons > button,
  .topbar.has-header-ad .header-action-buttons > button {
    width: auto;
    min-height: 34px;
    padding: 5px 7px;
    gap: 4px;
    font-size: 10px;
    border-radius: 9px;
  }
  .topbar .header-action-buttons svg { width: 14px; height: 14px; flex-basis: 14px; }

  .workspace,
  .studio:not(.phone-preview-layout) .topbar.has-header-ad ~ .workspace {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 1 1 0;
    display: grid;
    grid-template-columns: var(--mobile-rail-width) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) var(--timeline);
    overflow: hidden;
  }
  .stage-area {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    border-bottom: 1px solid #292536;
    background: radial-gradient(circle at 50% 52%, #1c1729, #0d0e14 64%);
  }
  .stage-toolbar,
  html[dir="rtl"] .stage-toolbar {
    position: absolute;
    inset-block-start: 7px;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    z-index: 20;
  }
  html[dir="rtl"] .stage-toolbar { direction: rtl; right: 7px; left: auto; }
  html[dir="ltr"] .stage-toolbar { direction: ltr; left: 7px; right: auto; }
  html[dir="ltr"] .studio:not(.phone-preview-layout) .stage-toolbar { right: 7px; left: auto; }
  .stage-actions { display: none; }
  .aspect-picker .format-select {
    width: 34px;
    min-width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }
  .aspect-picker .format-select > span,
  .aspect-picker .format-select > small,
  .aspect-picker .format-select > b { display: none; }
  .aspect-picker .format-select .aspect-ratio-icon { flex-basis: 24px; }
  .aspect-ratio-menu {
    inset-inline-start: 0;
    left: auto;
    right: auto;
    top: calc(100% + 5px);
    width: 152px;
    max-height: calc(100dvh - 190px);
    overflow-y: auto;
  }
  html[dir="rtl"] .aspect-ratio-menu { right: 0; left: auto; }
  html[dir="ltr"] .aspect-ratio-menu { left: 0; right: auto; }
  html[dir="ltr"] .studio:not(.phone-preview-layout) .aspect-ratio-menu { right: 0; left: auto; }
  .aspect-ratio-menu button { min-height: 31px; }
  .canvas-wrap,
  .stage-area:has(.video-canvas.ratio-wide) .canvas-wrap {
    min-width: 0;
    min-height: 0;
    padding: 3px 5px 2px;
  }
  .preview-viewport {
    min-width: 0;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto 56px minmax(0, 1fr);
    column-gap: 3px;
    padding: 0;
  }
  .preview-quick-tools {
    width: 46px;
    margin: 0;
    justify-self: center;
    padding-top: 43px;
  }
  .preview-quick-tools > button { max-width: 38px; }
  .source-transform-toggle {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: rgba(38, 31, 59, .86);
  }
  .source-transform-toolbar {
    width: 46px;
    gap: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .source-move-handle {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 10px;
    background: rgba(116, 87, 238, .25);
  }
  .source-move-handle svg { width: 18px; height: 18px; }
  .source-scale-button {
    width: 36px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 9px;
    background: rgba(38, 31, 59, .72);
    font-size: 17px;
  }
  .source-transform-toolbar output {
    min-width: 44px;
    padding: 0;
    font-size: 10px;
    line-height: 14px;
  }
  .source-reset-button {
    width: 42px;
    min-height: 30px;
    margin-top: 0;
    border: 0;
    border-radius: 9px;
    background: rgba(38, 31, 59, .72);
    font-size: 10px;
  }
  .source-resize-nw { top: -6px; left: -6px; width: 32px; height: 32px; }
  .source-resize-ne { top: -6px; right: -6px; width: 32px; height: 32px; }
  .source-resize-sw { bottom: -6px; left: -6px; width: 32px; height: 32px; }
  .source-resize-se { bottom: -6px; right: -6px; width: 32px; height: 32px; }
  .source-resize-nw::after { left: 6px; top: 6px; }
  .source-resize-ne::after { left: auto; right: 6px; top: 6px; transform: translate(50%, -50%); }
  .source-resize-sw::after { left: 6px; top: auto; bottom: 6px; transform: translate(-50%, 50%); }
  .source-resize-se::after { left: auto; right: 6px; top: auto; bottom: 6px; transform: translate(50%, 50%); }
  .source-resize-w,
  .source-resize-e { width: 30px; height: 44px; }
  .source-resize-w { left: -6px; }
  .source-resize-e { right: -6px; }
  .source-resize-w::after { left: 6px; }
  .source-resize-e::after { left: auto; right: 6px; transform: translate(50%, -50%); }
  .source-resize-n,
  .source-resize-s { width: 44px; height: 30px; }
  .source-resize-n { top: -6px; }
  .source-resize-s { bottom: -6px; }
  .source-resize-n::after { top: 6px; }
  .source-resize-s::after { top: auto; bottom: 6px; transform: translate(-50%, 50%); }
  .stage-area.mobile-wide-preview .preview-viewport {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .stage-area.mobile-wide-preview .preview-quick-tools {
    position: absolute;
    top: 8px;
    z-index: 19;
    grid-column: auto;
    grid-row: auto;
    width: auto;
    height: 34px;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    align-self: auto;
    justify-content: flex-start;
    gap: 4px;
    margin: 0;
    padding-top: 0;
  }
  html[dir="rtl"] .stage-area.mobile-wide-preview .preview-quick-tools { right: 53px; left: auto; }
  html[dir="ltr"] .stage-area.mobile-wide-preview .preview-quick-tools { left: 53px; right: auto; }
  .stage-area.mobile-wide-preview .preview-quick-tools > button { max-width: none; }
  .stage-area.mobile-wide-preview .source-transform-toolbar {
    width: max-content;
    min-height: 36px;
    flex-direction: row;
    gap: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .stage-area.mobile-wide-preview .source-transform-toggle,
  .stage-area.mobile-wide-preview .source-transform-toggle:hover,
  .stage-area.mobile-wide-preview .source-transform-toggle:focus-visible,
  .stage-area.mobile-wide-preview .source-transform-toggle.active {
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .stage-area.mobile-wide-preview .source-move-handle {
    flex: 0 0 36px;
    width: 36px;
    min-height: 36px;
    padding: 5px;
    background: rgba(116, 87, 238, .22);
  }
  .stage-area.mobile-wide-preview .source-scale-button {
    width: 33px;
    height: 36px;
    flex-basis: 33px;
    background: transparent;
  }
  .stage-area.mobile-wide-preview .source-move-handle:hover,
  .stage-area.mobile-wide-preview .source-scale-button:hover,
  .stage-area.mobile-wide-preview .source-reset-button:hover,
  .stage-area.mobile-wide-preview .source-reset-button:focus-visible {
    border: 0;
    background: transparent;
    color: #fff;
  }
  .stage-area.mobile-wide-preview .source-move-handle:hover,
  .stage-area.mobile-wide-preview .source-move-handle:focus-visible {
    background: rgba(116, 87, 238, .34);
  }
  .stage-area.mobile-wide-preview .source-transform-toolbar output { min-width: 46px; }
  .stage-area.mobile-wide-preview .source-reset-button {
    width: 40px;
    min-height: 36px;
    margin-top: 0;
    border: 0;
    background: transparent;
  }
  .stage-area.mobile-wide-preview.mobile-side-preview .preview-viewport {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
    padding: 0 54px 0 0;
  }
  html[dir="ltr"] .stage-area.mobile-wide-preview.mobile-side-preview .preview-viewport {
    padding: 0 0 0 54px;
  }
  .stage-area.mobile-wide-preview.mobile-side-preview .preview-viewport .video-canvas {
    grid-column: 1;
    justify-self: start;
  }
  html[dir="rtl"] .stage-area.mobile-wide-preview.mobile-side-preview .stage-toolbar { right: 11px; left: auto; }
  html[dir="ltr"] .stage-area.mobile-wide-preview.mobile-side-preview .stage-toolbar { left: 11px; right: auto; }
  html[dir="ltr"] .studio:not(.phone-preview-layout) .stage-area.mobile-wide-preview.mobile-side-preview .stage-toolbar { right: 11px; left: auto; }
  .stage-area.mobile-wide-preview.mobile-side-preview .preview-quick-tools {
    position: absolute;
    top: 49px;
    right: 0;
    left: auto;
    width: 46px;
    height: auto;
    min-height: 0;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    padding: 0;
  }
  html[dir="rtl"] .stage-area.mobile-wide-preview.mobile-side-preview .preview-quick-tools { right: 0; left: auto; }
  html[dir="ltr"] .stage-area.mobile-wide-preview.mobile-side-preview .preview-quick-tools { left: 0; right: auto; }
  .stage-area.mobile-wide-preview.mobile-side-preview .source-transform-toolbar {
    width: 46px;
    min-height: 0;
    flex-direction: column;
    gap: 3px;
  }
  .stage-area.mobile-wide-preview.mobile-side-preview .source-transform-toggle,
  .stage-area.mobile-wide-preview.mobile-side-preview .source-transform-toggle.active {
    width: 38px;
    height: 38px;
    background: rgba(38, 31, 59, .86);
  }
  .stage-area.mobile-wide-preview.mobile-side-preview .source-move-handle {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .stage-area.mobile-wide-preview.mobile-side-preview .source-scale-button {
    width: 36px;
    height: 32px;
    flex-basis: 32px;
    background: rgba(38, 31, 59, .72);
  }
  .stage-area.mobile-wide-preview.mobile-side-preview .source-transform-toolbar output {
    min-width: 44px;
  }
  .stage-area.mobile-wide-preview.mobile-side-preview .source-reset-button {
    width: 42px;
    min-height: 30px;
    background: rgba(38, 31, 59, .72);
  }
  .preview-dock {
    width: min(100%, 290px) !important;
    max-width: 100%;
    margin: 1px auto 3px;
    padding: 6px 8px 5px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 3px 30px;
    row-gap: 5px;
    align-items: center;
    border: 1px solid rgba(157, 137, 216, .22);
    border-radius: 12px;
    background: linear-gradient(180deg, #1b1925, #14131c);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .035);
    transform: none !important;
  }
  html[dir="rtl"] .preview-dock { direction: rtl; }
  html[dir="ltr"] .preview-dock { direction: ltr; }
  .preview-dock .preview-progress {
    grid-column: 1 / -1;
    grid-row: 1;
    height: 3px;
    background: #393543;
    box-shadow: none;
  }
  .preview-dock .transport { grid-column: 1; grid-row: 2; height: 30px; gap: 5px; }
  .preview-dock .transport button:not(.play-main) { width: 24px; height: 28px; padding: 0; color: #b8b3c5; }
  .preview-dock .transport .play-main {
    width: 29px;
    height: 29px;
    padding: 0;
    background: linear-gradient(135deg, #8a6cf0, #a85dd9);
    color: white;
    box-shadow: 0 3px 11px rgba(129, 96, 238, .24);
  }
  .preview-dock .transport-icon svg { width: 16px; height: 16px; display: block; }
  .preview-dock .timecode { min-width: 0; font-size: 9px; gap: 3px; }
  .preview-dock #totalTime { font-size: 9px; }
  .preview-dock:has(> #previewVolumeControl:not([hidden])) {
    width: min(100%, 310px) !important;
    grid-template-columns: minmax(0, 1fr) 86px;
    column-gap: 5px;
  }
  .preview-dock #previewVolumeControl:not([hidden]) {
    position: static;
    grid-column: 2;
    grid-row: 2;
    width: 86px;
    height: 28px;
    min-height: 0;
    flex-direction: row;
    gap: 3px;
    padding: 0 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .preview-dock #previewVolumeControl button,
  .preview-dock #previewVolumeControl button:hover {
    background: transparent;
    color: #b7aecf;
  }
  .preview-dock #previewVolumeControl input[type="range"] {
    flex: 1 1 auto;
    width: 25px;
    min-width: 0;
    height: 18px;
    appearance: none;
    background: transparent;
    writing-mode: horizontal-tb;
    direction: ltr;
  }
  .preview-dock #previewVolumeControl input[type="range"]::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #a58ff5 0 var(--preview-volume-fill, 50%), #5c546e var(--preview-volume-fill, 50%) 100%);
  }
  .preview-dock #previewVolumeControl input[type="range"]::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    margin-top: -4.5px;
    appearance: none;
    border: 0;
    border-radius: 50%;
    background: #a58ff5;
  }
  .preview-dock #previewVolumeControl input[type="range"]::-moz-range-track { height: 3px; border-radius: 999px; background: linear-gradient(90deg, #a58ff5 0 var(--preview-volume-fill, 50%), #5c546e var(--preview-volume-fill, 50%) 100%); }
  .preview-dock #previewVolumeControl input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #a58ff5; }
  .preview-dock #previewVolumeControl output { display: none; }
  .studio:has(#videoCanvas.project-empty) .preview-viewport,
  .studio:has(#videoCanvas.project-empty) .preview-dock { visibility: hidden; }
  .studio:has(#videoCanvas.project-empty) .empty-stage-welcome {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: grid;
    place-items: center;
    padding: 12px 18px;
    pointer-events: none;
  }
  .empty-stage-welcome-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 350px;
    text-align: center;
    pointer-events: auto;
  }
  .empty-stage-welcome-art {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border: 1px solid #7058b0;
    border-radius: 18px;
    background: linear-gradient(145deg, #362652, #1d172e);
    box-shadow: 0 16px 40px rgba(82,55,140,.24);
  }
  .empty-stage-welcome-art svg { width: 38px; height: 38px; fill: none; stroke: #cbb9ff; stroke-width: 1.7; stroke-linecap: round; }
  .empty-stage-welcome-copy { display: flex; flex-direction: column; align-items: center; }
  .empty-stage-welcome-copy h2 { margin: 0 0 4px; font-size: 22px; color: #faf8ff; }
  .empty-stage-welcome-copy p { margin: 0; font-size: 11px; line-height: 1.65; color: #aea9bb; }
  .empty-stage-welcome-copy button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 39px;
    margin-top: 16px;
    padding: 7px 17px;
    border: 1px solid #9a79f2;
    border-radius: 10px;
    background: linear-gradient(115deg, #7654e9, #aa61dc);
    color: #fff;
    font-size: 12px;
    font-weight: 750;
  }

  .tool-rail {
    position: relative;
    z-index: 15;
    grid-column: 1;
    grid-row: 1;
    width: var(--mobile-rail-width);
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 7px 3px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    border: 0;
    border-inline-start: 1px solid #302a3b;
    background: #121019;
    box-shadow: -7px 0 22px rgba(0,0,0,.13);
  }
  .tool-rail::-webkit-scrollbar { display: none; }
  .tool-rail .tool {
    flex: 0 0 48px;
    width: calc(var(--mobile-rail-width) - 4px);
    height: 48px;
    min-width: 0;
    gap: 2px;
    border-radius: 9px;
  }
  .tool-rail .tool small { font-size: 8px; line-height: 1.15; }
  .tool-rail .tool-icon { font-size: 16px; }
  .tool-rail .tool,
  .tool-rail .tool:hover,
  .tool-rail .tool:focus-visible,
  .tool-rail .tool.active,
  .tool-rail .asset-library-tool[aria-expanded="true"] {
    position: relative;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .tool-rail .tool.active::before,
  .tool-rail .asset-library-tool[aria-expanded="true"]::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 10px;
    bottom: 10px;
    width: 2px;
    border-radius: 2px;
    background: #b39af5;
  }
  .tool-rail .tool .rail-brand-icon,
  .tool-rail .tool:hover .rail-brand-icon,
  .tool-rail .tool:focus-visible .rail-brand-icon,
  .tool-rail .tool.active .rail-brand-icon,
  .tool-rail .asset-library-tool[aria-expanded="true"] .rail-brand-icon {
    transform: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .tool-rail .tool.active .rail-brand-icon,
  .tool-rail .asset-library-tool[aria-expanded="true"] .rail-brand-icon { color: #d3c2ff; }

  .timeline {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 0;
    background: #0b0c12;
  }
  .timeline-toolbar { flex: 0 0 39px; min-height: 39px; padding-inline: 6px; gap: 3px; }
  .timeline-toolbar .editing-tools { min-width: 0; gap: 1px; }
  .timeline-toolbar .editing-tools #toolbarDeleteClip { margin-inline-start: 5px; }
  .timeline-toolbar .editing-tools > button { width: 26px; height: 26px; min-width: 26px; }
  .timeline-toolbar .editing-tools #undoBtn,
  .timeline-toolbar .editing-tools #redoBtn { display: grid; place-items: center; }
  .timeline-toolbar .cut-range-actions {
    height: 28px;
    padding: 2px;
    gap: 3px;
    border-color: #443c55;
    border-radius: 9px;
    background: #1a1723;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  }
  html[dir="rtl"] .timeline-toolbar .cut-range-actions { left: calc(50% - 9px); }
  html[dir="ltr"] .timeline-toolbar .cut-range-actions { left: calc(50% + 12px); }
  .timeline-toolbar .cut-range-actions button,
  .timeline-toolbar .cut-range-actions .cut-preview-button {
    flex: 0 0 28px;
    width: 28px;
    min-width: 28px;
    height: 22px;
    padding: 0;
    border-radius: 6px;
  }
  .timeline-toolbar .cut-range-actions .cut-preview-button { background: #217448; color: #f2fff6; }
  .timeline-toolbar .cut-range-actions .cut-apply-button { background: #41212d; color: #ffa0af; }
  .timeline-toolbar .cut-range-actions .timeline-cut-cancel {
    flex: 0 0 auto;
    width: auto;
    min-width: 44px;
    height: 22px;
    padding-inline: 5px;
    gap: 3px;
  }
  .timeline-toolbar .cut-range-actions .timeline-cut-cancel b { display: inline; font-size: 9px; }
  .timeline-toolbar .cut-range-actions button:disabled { opacity: .58; }
  .timeline-toolbar .cut-range-actions .cut-action-icon,
  .timeline-toolbar .cut-range-actions .cut-action-icon svg { width: 17px; height: 17px; }
  .timeline-toolbar .timeline-zoom-cycle { min-width: 54px; height: 26px; padding-inline: 5px; }
  .cut-boundary-time { top: 4px; height: 21px; padding: 2px 4px; font-size: 9px; }
  .timeline:has(.clip.selected) .timeline-toolbar #timelinePropertiesButton {
    position: absolute;
    top: 50%;
    left: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: auto;
    min-width: 83px;
    height: 29px;
    padding: 0 9px;
    transform: translate(-50%, -50%);
    border: 1px solid #7458b4;
    border-radius: 8px;
    background: #241c36;
    color: #eadfff;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    touch-action: manipulation;
  }
  .timeline-toolbar #timelinePropertiesButton svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .timeline:has(.clip.selected) .timeline-toolbar #timelinePropertiesButton:hover { background: #32244f; border-color: #a47cf4; }
  body.timeline-cut-mode .timeline:has(.clip.selected) .timeline-toolbar #timelinePropertiesButton { display: none; }
  .timeline-body { flex: 1 1 0; min-height: 0; --track-label-width: 57px; --timeline-scroll-rail-width: 10px; }
  .timeline-body .track-labels,
  .timeline-body .tracks-scroll { display: flex; flex-direction: column; }
  .timeline-body .track-labels::before,
  .timeline-body .tracks-scroll::before {
    content: "";
    display: block;
    flex: 1 0 0;
    min-height: 0;
    pointer-events: none;
  }
  .timeline-body .track-labels::before { order: 1; }
  .timeline-body .tracks-scroll::before { order: 2; width: var(--timeline-width); }
  .timeline-body .ruler-spacer,
  .timeline-body .timeline-handle-lane,
  .timeline-body .time-ruler,
  .timeline-body .track-labels > [data-track-label],
  .timeline-body .tracks-scroll > .track { flex: 0 0 auto; }
  .timeline-body .ruler-spacer,
  .timeline-body .timeline-handle-lane { order: 0; }
  .timeline-body .time-ruler { order: 1; }
  .timeline-body .track-labels > [data-track-label] { order: 2; }
  .timeline-body .tracks-scroll > .track { order: 3; }
  .timeline-body .track-bottom-drop { order: 4; }
  .studio:not(.phone-preview-layout) .timeline-toolbar { height: 34px; min-height: 34px; flex: 0 0 34px; }
  .studio:not(.phone-preview-layout) .timeline-body { --timeline-handle-lane-height: 27px; --timeline-ruler-height: 25px; }
  .studio:not(.phone-preview-layout) .ruler-mark { top: 3px; min-width: 32px; font-size: 10px; }
  .studio:not(.phone-preview-layout) .ruler-mark::after { top: 14px; height: 9px; }
  .studio:not(.phone-preview-layout) .ruler-spacer .track-add-button { height: 19px; }
  .studio:not(.phone-preview-layout) .track,
  .studio:not(.phone-preview-layout) .track-labels > div:not(.ruler-spacer) {
    height: 39px;
    border-bottom-color: #262431;
  }
  .studio:not(.phone-preview-layout) .track { background-color: #0e0d15; }
  .studio:not(.phone-preview-layout) .track:nth-of-type(even) { background-color: #11101a; }
  .studio:not(.phone-preview-layout) .clip { top: 4px; height: 31px; gap: 4px; padding: 2px 4px; border-radius: 6px; }
  .studio:not(.phone-preview-layout) .clip-content { gap: 4px; border-radius: 5px; }
  .studio:not(.phone-preview-layout) .clip-art { width: 35px; height: 25px; flex-basis: 35px; }
  .studio:not(.phone-preview-layout) .audio-clip > b { font-size: 8px; line-height: 10px; }
  .studio:not(.phone-preview-layout) .audio-waveform-canvas { inset: 14px 3px 2px; height: calc(100% - 16px); }
  .timeline-body .track-labels b { font-size: 8px; }
  .timeline-body .track-labels > [data-track-label] b { font-size: 0; }
  .timeline-body .track-labels > [data-track-label] b::after {
    content: attr(data-mobile-number);
    font-size: 11px;
    line-height: 1;
  }
  .timeline-body .track-labels > div:not(.ruler-spacer) { padding-inline: 3px; }
  .timeline-body .tracks-scroll { overscroll-behavior: contain; touch-action: pan-x; }
  .timeline-body .track-labels { touch-action: none; }
  .timeline-playhead-handle { touch-action: none; }

  .workspace-backdrop,
  .workspace-backdrop.active {
    position: fixed;
    z-index: 45;
    inset-block: calc(58px + env(safe-area-inset-top, 0px)) 0;
  }
  html[dir="rtl"] .workspace-backdrop { left: 0; right: var(--mobile-rail-width); }
  html[dir="ltr"] .workspace-backdrop { left: var(--mobile-rail-width); right: 0; }
  .library-panel,
  html[dir="rtl"] .library-panel {
    position: fixed;
    z-index: 70;
    inset-block: auto 0;
    width: auto;
    height: min(74dvh, 690px);
    min-height: 0;
    padding: 8px 12px 12px;
    overflow-y: auto;
    border: 1px solid #413552;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: #14131c;
    box-shadow: 0 -24px 65px rgba(0,0,0,.55);
    transform: translateY(calc(100% + 2px));
    visibility: hidden;
    transition: transform .24s ease, visibility .24s;
  }
  html[dir="rtl"] .library-panel { right: var(--mobile-rail-width); left: 0; }
  html[dir="ltr"] .library-panel { left: var(--mobile-rail-width); right: 0; }
  .library-panel.open,
  html[dir="rtl"] .library-panel.open { transform: translateY(0); visibility: visible; }
  .library-panel .panel-heading { margin-bottom: 4px; padding-bottom: 2px; }
  .library-panel .panel-close,
  .inspector-panel .inspector-head .icon-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #4a4259;
    border-radius: 9px;
    background: #22202d;
    color: #e5ddf1;
    font-size: 19px;
  }
  .library-panel .upload-drop {
    width: max-content;
    min-width: 136px;
    max-width: 100%;
    height: 34px;
    min-height: 34px;
    margin-inline: auto;
    margin-bottom: 8px;
    padding: 4px 14px;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .library-panel .upload-drop .upload-icon { font-size: 16px; }
  .library-panel .upload-drop b { white-space: nowrap; }
  .library-panel .upload-drop small { display: none; }
  .library-panel .media-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px 5px;
  }
  .library-panel .media-card { min-width: 0; }
  .library-panel .media-card .thumb {
    height: clamp(48px, 16vw, 66px);
    margin-bottom: 3px;
    border-radius: 6px;
  }
  .library-panel .media-card > b {
    display: -webkit-box;
    min-height: 20px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    line-height: 10px;
    font-size: 8px;
  }
  .library-panel .media-card > small { font-size: 7px; }
  .library-panel .media-card.image > small { display: none; }
  .library-panel .uploaded-media .thumb .media-duration {
    inset-inline-start: 2px;
    bottom: 2px;
    padding: 1px 2px;
    font-size: 7px;
  }
  .library-panel .uploaded-media .thumb .media-quick-add {
    inset-inline-end: 2px;
    bottom: 2px;
    width: 20px;
    height: 20px;
    font-size: 14px;
  }
  .library-panel .media-card-toolbar .media-more-button {
    flex-basis: 20px;
    height: 20px;
  }
  .elements-preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .element-preset-art { height: 62px; padding: 6px; overflow: hidden; }
  .element-preset-art img {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
  }
  .element-preset-caption { min-height: 36px; padding: 4px 5px; gap: 3px; }
  .element-preset-caption b,
  .element-preset-card--premium .element-preset-caption b {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    font-size: 8px;
    line-height: 1.25;
  }
  .element-preset-caption em { flex: 0 0 15px; width: 15px; height: 15px; font-size: 12px; }
  .asset-library-drawer,
  html[dir="ltr"] .asset-library-drawer {
    position: fixed;
    z-index: 72;
    inset-block: auto 0;
    width: auto;
    max-width: none;
    height: min(78dvh, 730px);
    border: 1px solid #413552;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -24px 65px rgba(0,0,0,.55);
    transform: translateY(calc(100% + 2px));
  }
  html[dir="rtl"] .asset-library-drawer { right: var(--mobile-rail-width); left: 0; }
  html[dir="ltr"] .asset-library-drawer { left: var(--mobile-rail-width); right: 0; }
  .asset-library-drawer.open,
  html[dir="ltr"] .asset-library-drawer.open { transform: translateY(0); }
  .asset-library-head {
    min-height: 39px;
    gap: 10px;
    padding: 5px 10px 4px;
  }
  .asset-library-head button { width: 28px; height: 28px; }
  .asset-library-tabs {
    min-height: 40px;
    gap: 4px;
    padding: 7px 9px 3px;
  }
  .asset-library-filters {
    gap: 6px;
    padding: 6px 10px;
  }
  .asset-library-filters label { height: 34px; }
  .asset-category-list { gap: 4px; padding: 0 10px 5px; }
  .asset-category-list button { padding: 5px 9px; }
  .asset-library-grid:not(.audio-list) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-inline: 8px; }
  .asset-library-grid:not(.audio-list) .asset-card { min-height: 122px; --mobile-card-preview-height: 76px; }
  .asset-library-grid:not(.audio-list) .asset-card.sticker { min-height: 110px; }
  .asset-library-grid:not(.audio-list) .asset-card-preview { height: var(--mobile-card-preview-height); }
  .asset-library-grid:not(.audio-list) .asset-card-preview img,
  .asset-library-grid:not(.audio-list) .asset-card-preview video { object-fit: contain; }
  .asset-library-grid:not(.audio-list) .asset-card-info { display: block; min-height: 44px; padding: 5px 6px; }
  .asset-library-grid:not(.audio-list) .asset-card.sticker .asset-card-info { min-height: 33px; }
  .asset-library-grid:not(.audio-list) .asset-card-copy b {
    display: -webkit-box;
    min-height: 21px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    font-size: 8px;
    line-height: 1.35;
  }
  .asset-library-grid:not(.audio-list) .asset-card.video .asset-card-copy b {
    display: block;
    min-height: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .asset-library-grid:not(.audio-list) .asset-card-copy small { margin-top: 2px; font-size: 8px; }
  .asset-library-grid:not(.audio-list) .asset-card.sticker .asset-lock { top: 4px; padding: 2px 4px; border-radius: 5px; font-size: 7px; line-height: 1.2; }
  html[dir="rtl"] .asset-library-grid:not(.audio-list) .asset-card.sticker .asset-lock { left: 4px; }
  html[dir="ltr"] .asset-library-grid:not(.audio-list) .asset-card.sticker .asset-lock { right: 4px; }
  .asset-library-grid:not(.audio-list) .asset-card-add {
    position: absolute;
    z-index: 4;
    top: calc(var(--mobile-card-preview-height) - 27px);
    inset-inline-end: 5px;
    width: 22px;
    height: 22px;
    font-size: 14px;
  }
  .asset-library-grid:not(.audio-list) .asset-card.video .asset-card-add { inset-inline-start: 5px; inset-inline-end: auto; }
  .asset-library-grid:not(.audio-list) .asset-card.previewing .asset-card-add { display: none; }
  .asset-library-grid:not(.audio-list) .asset-card-play { width: 27px; height: 27px; }
  .asset-library-grid:not(.audio-list) .asset-card.video .asset-card-play { bottom: 4px; inset-inline-end: 4px; width: 22px; height: 22px; font-size: 9px; }
  .asset-library-grid:not(.audio-list) .asset-card.video .asset-inline-playback { bottom: 3px; inset-inline-end: 3px; width: 22px; height: 22px; font-size: 10px; }
  .asset-library-grid:not(.audio-list) .asset-card-preview .asset-inline-preview-actions { gap: 2px; inset: auto 3px 3px auto; }
  html[dir="rtl"] .asset-library-grid:not(.audio-list) .asset-card-preview .asset-inline-preview-actions { right: auto; left: 3px; }
  html[dir="rtl"] .asset-library-grid:not(.audio-list) .asset-card.video .asset-card-preview .asset-inline-preview-actions { right: 3px; left: auto; }
  html[dir="ltr"] .asset-library-grid:not(.audio-list) .asset-card.video .asset-card-preview .asset-inline-preview-actions { right: auto; left: 3px; }
  .asset-library-grid:not(.audio-list) .asset-card-preview .asset-inline-preview-actions button { width: 21px; height: 21px; font-size: 13px; }

  .inspector-panel,
  html[dir="rtl"] .inspector-panel {
    position: fixed;
    z-index: 71;
    inset-block: auto 0;
    grid-column: auto;
    grid-row: auto;
    display: block;
    width: auto;
    height: min(70dvh, 660px);
    min-height: 0;
    padding: 8px 12px 16px;
    overflow-y: auto;
    border: 1px solid #413552;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: #15141d;
    box-shadow: 0 -24px 65px rgba(0,0,0,.55);
    transform: translateY(calc(100% + 2px));
    visibility: hidden;
    pointer-events: none;
    transition: transform .24s ease, visibility .24s;
  }
  html[dir="rtl"] .inspector-panel,
  html[dir="ltr"] .inspector-panel { left: 0; right: 0; }
  .studio:not(.phone-preview-layout) #inspectorPanel {
    padding: 8px 9px 10px;
    overflow: visible;
    border-radius: 0;
  }
  .inspector-panel.open,
  html[dir="rtl"] .inspector-panel.open { transform: translateY(0); visibility: visible; pointer-events: auto; }
  .inspector-panel .inspector-head .icon-btn { display: grid; place-items: center; }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head { display: contents; }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head h2 { display: none; }
  .studio:not(.phone-preview-layout) #inspectorPanel > :is(#emptySelection, #clipProperties, #exportPanel):not([hidden]) {
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  #inspectorPanel .clip-properties { padding-top: 0; }
  #inspectorPanel .clip-properties > .property-label { display: none; }
  #inspectorPanel .clip-properties .clip-identity { margin: 0 0 8px; }
  #inspectorPanel .clip-properties .clip-identity h3 { line-height: 1.4; }
  #inspectorPanel .clip-properties .clip-identity .clip-trim-open { min-height: 27px; }
  .inspector-panel:has(#clipProperties:not([hidden])):not(.expanded) {
    height: min(var(--timeline), 38dvh);
    box-shadow: 0 -12px 32px rgba(0,0,0,.42);
  }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorExpand {
    position: absolute;
    top: -28px;
    inset-inline-start: 2px;
    inset-inline-end: auto;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    touch-action: none;
    cursor: pointer;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorExpand[hidden] { display: none; }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorClose {
    position: absolute;
    z-index: 2;
    top: -28px;
    inset-inline-start: 50px;
    inset-inline-end: auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 28px;
    padding: 0;
    border: 1px solid #9d4a5c;
    border-radius: 0;
    background: #2b1a24;
    color: #ff8192;
    box-shadow: none;
    cursor: pointer;
    touch-action: manipulation;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel:has(#clipProperties[hidden]) .inspector-head #inspectorClose {
    inset-inline-start: 2px;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorClose:hover,
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorClose:focus-visible {
    border-color: #ec778a;
    background: #43202d;
    color: #fff;
    outline: none;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorClose .editor-close-mark {
    width: 15px;
    height: 15px;
    stroke-width: 2.25;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorExpand::before {
    content: "";
    position: absolute;
    pointer-events: none;
    inset: 0 0 auto;
    height: 28px;
    border: 1px solid #685387;
    border-bottom: 0;
    border-radius: 0;
    background: #15141d;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorExpand svg {
    display: block;
    position: absolute;
    z-index: 1;
    top: 4px;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translateX(-50%);
    fill: none;
    stroke: #bdaaff;
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel:is(.expanded, :has(#clipProperties[hidden])) .inspector-head #inspectorExpand svg {
    transform: translateX(-50%) rotate(180deg);
  }
  #inspectorPanel .inspector-head #inspectorExpand:hover::before { border-color: #b39af2; }
  #inspectorPanel .inspector-head #inspectorExpand:hover svg { stroke: #e2d8ff; }
  #inspectorPanel .inspector-head #inspectorExpand:focus-visible { outline: 2px solid #b99aff; outline-offset: 2px; }

  .studio:not(.phone-preview-layout) #inspectorPanel .clip-properties { font-size: 11px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .clip-properties h3 { font-size: 11px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .clip-properties > label { font-size: 10px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .clip-properties :is(input:not([type="range"]):not([type="color"]), select, textarea) { font-size: 10px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-properties { gap: 8px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-properties > :not(:first-child) { padding-top: 7px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-property-field,
  .studio:not(.phone-preview-layout) #inspectorPanel .text-property-slider,
  .studio:not(.phone-preview-layout) #inspectorPanel .text-align-field { gap: 4px; font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-content-head { min-height: 46px; padding: 4px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-content-tools { grid-template-columns: 30px 54px minmax(0, 1fr); }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-content-tool { grid-template-rows: 10px 24px; padding-inline: 2px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-content-tools :is(.text-color-picker, .text-background-picker) { width: 22px; height: 22px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-content-tools #textOpacitySlot { justify-content: center; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-content-tools #opacityControl { width: min(100%, 132px); grid-template-rows: 10px 24px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-content-tools #opacityRange { height: 24px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-property-field textarea { height: 55px; min-height: 55px; padding: 6px 8px; font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-property-field select { height: 30px; padding-block: 4px; font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-select-field--text .inspector-select-trigger { height: 30px; font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-property-row > *,
  .studio:not(.phone-preview-layout) #inspectorPanel .text-layout-row > * { padding: 5px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-layout-row { grid-template-columns: minmax(0, 1fr) 120px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-font-size-field input { height: 30px; font-size: 10px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-properties .text-property-slider input[type="range"] { height: 30px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-duration-loop-row .text-property-slider { grid-template-rows: 12px 30px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-duration-loop-row .text-property-field select { height: 30px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-align-row button { height: 28px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-motion-timing-group { gap: 8px; padding: 7px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .text-motion-head b { font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .image-duration-property { margin-block: 7px; padding: 5px 7px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .image-duration-property > label { font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .image-duration-input-wrap input { height: 25px; font-size: 10px; }
  .studio:not(.phone-preview-layout) #inspectorPanel :is(.audio-properties, .visual-effects, .clip-transition-properties) { margin-top: 10px; padding-top: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel :is(.audio-properties-head, .clip-transition-properties-head) { margin-bottom: 8px; }
  .studio:not(.phone-preview-layout) #inspectorPanel :is(.audio-properties-head, .clip-transition-properties-head) b { font-size: 10px; }
  .studio:not(.phone-preview-layout) #inspectorPanel :is(.audio-main-slider, .audio-dual-sliders) { margin-bottom: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel :is(.audio-select-grid select, .audio-effect-field select) { height: 29px; font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .clip-properties :is(.element-color-control, .element-stroke-control) { margin-block: 8px; padding: 6px 8px; font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .element-color-actions input[type="color"] { width: 27px; height: 27px; flex-basis: 27px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .element-color-actions button { padding: 4px 6px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .element-stroke-control output { font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .element-motion-control { margin-block: 8px; padding: 8px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .element-motion-head { margin-bottom: 7px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .element-motion-head h4 { font-size: 9px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .element-motion-options button { min-height: 27px; padding-block: 4px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .element-motion-speed { margin-top: 8px; }

  dialog { max-width: calc(100vw - 18px); max-height: calc(100dvh - 24px); }
}

@media (max-width: 360px) {
  .timeline-toolbar .editing-tools { gap: 0; }
  .timeline-toolbar .editing-tools > button { width: 24px; min-width: 24px; height: 24px; }
  .timeline-toolbar .editing-tools > .tool-divider { margin-inline: 1px; }
  .preview-dock:has(> #previewVolumeControl:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 72px;
    column-gap: 4px;
  }
  .preview-dock #previewVolumeControl:not([hidden]) { width: 72px; }
  .preview-dock .transport { gap: 2px; }
  .preview-dock .transport button:not(.play-main) { width: 21px; }
  .preview-dock .transport .play-main { width: 26px; height: 26px; }
  .preview-dock .timecode,
  .preview-dock #totalTime { font-size: 8px; }
}

@media (max-width: 390px) {
  .topbar .account-identity { display: none; }
  .topbar .account-link,
  .topbar:not(.has-header-ad) .account-link,
  .topbar.has-header-ad .account-link { width: 34px; padding: 3px; justify-content: center; }
  .topbar .editor-brand-lockup img,
  .topbar.has-header-ad .header-identity > .editor-brand-lockup img { width: 95px; }
  .topbar .header-action-buttons > button b { font-size: 9px; }
  :root { --mobile-rail-width: 52px; }
}

@media (max-width: 700px) and (max-height: 680px) {
  :root { --timeline: 210px; }
  .tool-rail .tool { flex-basis: 44px; height: 44px; }
}

@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  :root { --timeline: auto; --mobile-rail-width: 48px; }
  .topbar, .topbar.has-header-ad {
    height: calc(46px + env(safe-area-inset-top, 0px));
    flex-basis: calc(46px + env(safe-area-inset-top, 0px));
  }
  .workspace,
  .studio:not(.phone-preview-layout) .topbar.has-header-ad ~ .workspace {
    grid-template-columns: var(--mobile-rail-width) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .studio:has(.video-canvas.ratio-social) .workspace,
  .studio:not(.phone-preview-layout):has(.video-canvas.ratio-social) .topbar.has-header-ad ~ .workspace {
    grid-template-columns: var(--mobile-rail-width) minmax(0, clamp(240px, 38vw, 340px)) minmax(0, 1fr);
  }
  .studio:has(.video-canvas.ratio-square) .workspace,
  .studio:not(.phone-preview-layout):has(.video-canvas.ratio-square) .topbar.has-header-ad ~ .workspace {
    grid-template-columns: var(--mobile-rail-width) minmax(0, clamp(260px, 42vw, 360px)) minmax(0, 1fr);
  }
  .stage-area.mobile-wide-preview.mobile-side-preview:has(.video-canvas:is(.ratio-social, .ratio-square)) .preview-viewport .video-canvas {
    justify-self: center;
  }
  .stage-area { grid-column: 2; grid-row: 1; border-bottom: 0; border-inline-end: 1px solid #292536; }
  .timeline { grid-column: 3; grid-row: 1; }
  .tool-rail { grid-column: 1; grid-row: 1; height: 100%; }
  .tool-rail .tool { flex-basis: 43px; height: 43px; }
  .preview-dock .transport { height: 30px; }
  .timeline-toolbar { flex-basis: 35px; min-height: 35px; }
  .workspace-backdrop, .workspace-backdrop.active { inset-block-start: calc(46px + env(safe-area-inset-top, 0px)); }
  .library-panel, html[dir="rtl"] .library-panel,
  .asset-library-drawer, html[dir="ltr"] .asset-library-drawer,
  .inspector-panel, html[dir="rtl"] .inspector-panel {
    height: calc(100dvh - 46px - env(safe-area-inset-top, 0px));
  }
  .inspector-panel:has(#clipProperties:not([hidden])):not(.expanded) {
    height: calc(100dvh - 46px - env(safe-area-inset-top, 0px));
  }
  #inspectorPanel:not(.open) {
    visibility: hidden;
    pointer-events: none;
    transition: none;
  }
  html[dir="rtl"] .inspector-panel:has(#clipProperties:not([hidden])):not(.expanded) {
    left: 0;
    right: calc(50% + 24px);
  }
  html[dir="ltr"] .inspector-panel:has(#clipProperties:not([hidden])):not(.expanded) {
    left: calc(50% + 24px);
    right: 0;
  }
  .asset-library-head { min-height: 32px; gap: 8px; padding: 3px 9px 1px; }
  .asset-library-head h2 { margin-top: 1px; font-size: 12px; line-height: 1.25; }
  .asset-library-head span { font-size: 8px; }
  .asset-library-head button { width: 24px; height: 24px; }
  .asset-library-tabs { min-height: 32px; gap: 4px; padding: 3px 8px; }
  .asset-library-tabs button { flex-basis: 36px; width: 36px; height: 24px; }
  .asset-library-tabs button span { font-size: 15px; }
  .asset-library-filters { padding: 4px 8px; }
  .asset-library-filters label { height: 28px; }
  .asset-library-filters > b { min-width: 29px; height: 25px; }
  .asset-category-list { gap: 4px; padding: 0 8px 4px; }
  .asset-category-list button { padding: 3px 7px; font-size: 8px; }
  .asset-library-grid:not(.audio-list) { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 2px 8px 8px; }
  .asset-library-grid:not(.audio-list) .asset-card,
  .asset-library-grid:not(.audio-list) .asset-card.sticker { min-height: 92px; --mobile-card-preview-height: 54px; }
  .asset-library-grid:not(.audio-list) .asset-card-info,
  .asset-library-grid:not(.audio-list) .asset-card.sticker .asset-card-info { min-height: 29px; padding: 3px 4px; }
  .asset-library-grid:not(.audio-list) .asset-card-copy b { min-height: 17px; font-size: 8px; line-height: 1.2; }
  .asset-library-grid:not(.audio-list) .asset-card-copy small { margin-top: 1px; font-size: 8px; }
  .asset-library-grid:not(.audio-list) .asset-card-add { top: calc(var(--mobile-card-preview-height) - 22px); width: 19px; height: 19px; font-size: 12px; }
  .asset-library-grid:not(.audio-list) .asset-card.video .asset-card-play,
  .asset-library-grid:not(.audio-list) .asset-card.video .asset-inline-playback { width: 19px; height: 19px; font-size: 8px; }
  .asset-library-more { height: 25px; min-width: 78px; margin-block: 2px 6px; padding-inline: 9px; font-size: 9px; }
  .asset-library-grid.audio-list { gap: 3px; padding-inline: 8px; }
  .asset-library-grid.audio-list .asset-audio-row { min-height: 32px; padding-block: 2px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head {
    display: flex;
    align-items: center;
    min-height: 31px;
    margin-bottom: 6px;
    padding: 0 0 5px;
    border-bottom: 1px solid #312b3c;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head h2 { display: block; font-size: 11px; }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorExpand { display: none; }
  .studio:not(.phone-preview-layout) #inspectorPanel .inspector-head #inspectorClose {
    position: static;
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    margin-inline-start: auto;
    border-radius: 6px;
  }
  .studio:not(.phone-preview-layout) #inspectorPanel > :is(#emptySelection, #clipProperties, #exportPanel):not([hidden]) {
    max-height: calc(100% - 37px);
  }
  .studio:has(#videoCanvas.project-empty) .empty-stage-welcome { inset-block-start: 0; }
  .empty-stage-welcome-inner { gap: 8px; }
  .empty-stage-welcome-art { width: 48px; height: 48px; border-radius: 13px; }
  .empty-stage-welcome-art svg { width: 30px; height: 30px; }
  .empty-stage-welcome-copy h2 { font-size: 17px; }
  .empty-stage-welcome-copy p { font-size: 10px; }
  .empty-stage-welcome-copy button { min-height: 32px; margin-top: 8px; padding: 4px 12px; }
}

@media (max-width: 700px) and (max-height: 500px) and (orientation: landscape) {
  .asset-library-grid:not(.audio-list) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 500px) and (max-height: 500px) and (orientation: landscape) {
  .asset-library-grid:not(.audio-list) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* On portrait phones, non-phone formats use the full stage width. */
@media (max-width: 700px) and (orientation: portrait) {
  .studio.mobile-nonphone-aspect { --timeline: 210px; }
  .studio.mobile-nonphone-aspect .workspace,
  .studio.mobile-nonphone-aspect:not(.phone-preview-layout) .topbar.has-header-ad ~ .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 52px minmax(0, 1fr) var(--timeline);
  }
  .studio.mobile-nonphone-aspect .tool-rail {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: 52px;
    flex-direction: row;
    justify-content: space-around;
    gap: 2px;
    padding: 3px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    border-inline-start: 0;
    border-bottom: 0;
    box-shadow: none;
  }
  .studio.mobile-nonphone-aspect .tool-rail .tool {
    flex: 1 0 58px;
    width: 58px;
    max-width: 58px;
    height: 46px;
    gap: 2px;
    color: #d8d1e9;
  }
  .studio.mobile-nonphone-aspect .tool-rail .tool .rail-brand-icon {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }
  .studio.mobile-nonphone-aspect .tool-rail .tool[data-panel="transitions"] {
    flex-basis: 66px;
    width: 66px;
    max-width: 66px;
  }
  .studio.mobile-nonphone-aspect .tool-rail .tool small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    padding-bottom: 3px;
    text-decoration: none;
  }
  html[dir="ltr"] .studio.mobile-nonphone-aspect .tool-rail .tool small { font-size: 9.5px; }
  .studio.mobile-nonphone-aspect .tool-rail .tool.active,
  .studio.mobile-nonphone-aspect .tool-rail .asset-library-tool[aria-expanded="true"] {
    background: rgba(116, 87, 238, .15);
    color: #fff;
  }
  .studio.mobile-nonphone-aspect .tool-rail .tool.active::before,
  .studio.mobile-nonphone-aspect .tool-rail .asset-library-tool[aria-expanded="true"]::before {
    display: block;
    inset-inline-start: 8px;
    inset-inline-end: 8px;
    top: 0;
    bottom: auto;
    width: auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, #c4adff 25%, #c4adff 75%, transparent);
    box-shadow: 0 2px 9px rgba(172, 138, 255, .68);
  }
  .studio.mobile-nonphone-aspect .stage-area {
    grid-column: 1;
    grid-row: 2;
  }
  .studio.mobile-nonphone-aspect .timeline {
    grid-column: 1;
    grid-row: 3;
  }
  .studio.mobile-nonphone-aspect .stage-area .canvas-wrap {
    padding-inline: 2px;
  }
  html[dir="rtl"] .studio.mobile-nonphone-aspect .stage-area:has(.video-canvas.ratio-social) .stage-toolbar {
    top: auto;
    right: auto;
    bottom: 10px;
    left: 4px;
  }
  html[dir="ltr"] .studio.mobile-nonphone-aspect .stage-area:has(.video-canvas.ratio-social) .stage-toolbar {
    top: auto;
    right: 4px;
    bottom: 10px;
    left: auto;
  }
  .studio.mobile-nonphone-aspect .stage-area:has(.video-canvas.ratio-social) .aspect-picker .format-select {
    width: 30px;
    min-width: 30px;
    height: 30px;
  }
  .studio.mobile-nonphone-aspect .stage-area:has(.video-canvas.ratio-social) .aspect-ratio-menu {
    top: auto;
    bottom: calc(100% + 5px);
  }
  html[dir="rtl"] .studio.mobile-nonphone-aspect .stage-area:has(.video-canvas.ratio-social) .aspect-ratio-menu {
    right: auto;
    left: 0;
  }
  html[dir="ltr"] .studio.mobile-nonphone-aspect .stage-area:has(.video-canvas.ratio-social) .aspect-ratio-menu {
    right: 0;
    left: auto;
  }
  .studio.mobile-nonphone-aspect .workspace-backdrop,
  html[dir="rtl"] .studio.mobile-nonphone-aspect .workspace-backdrop,
  html[dir="ltr"] .studio.mobile-nonphone-aspect .workspace-backdrop { left: 0; right: 0; }
  .studio.mobile-nonphone-aspect .library-panel,
  html[dir="rtl"] .studio.mobile-nonphone-aspect .library-panel,
  html[dir="ltr"] .studio.mobile-nonphone-aspect .library-panel,
  .studio.mobile-nonphone-aspect .asset-library-drawer,
  html[dir="rtl"] .studio.mobile-nonphone-aspect .asset-library-drawer,
  html[dir="ltr"] .studio.mobile-nonphone-aspect .asset-library-drawer { left: 0; right: 0; }
}

@media (max-width: 360px) and (orientation: portrait) {
  html[dir="rtl"] .studio.mobile-nonphone-aspect .stage-area:has(.video-canvas.ratio-social) #previewDock {
    width: calc(100% - 44px) !important;
    margin-right: 0;
    margin-left: auto;
  }
  html[dir="ltr"] .studio.mobile-nonphone-aspect .stage-area:has(.video-canvas.ratio-social) #previewDock {
    width: calc(100% - 44px) !important;
    margin-right: auto;
    margin-left: 0;
  }
}

/* Compact, horizontal dialogs for a phone held sideways. */
@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  .editor-account-dialog[open] {
    display: block;
    width: min(620px, calc(100vw - 24px));
    max-height: calc(100dvh - 16px);
    padding: 10px 12px;
    overflow: auto;
    scrollbar-width: none;
    border-radius: 12px;
  }
  .editor-account-dialog .editor-modal-head {
    min-height: 25px;
    margin: 0 0 5px;
    padding: 0 0 5px;
  }
  .editor-account-dialog::-webkit-scrollbar { display: none; }
  .editor-account-dialog .editor-auth-tabs { gap: 5px; }
  .editor-account-dialog .editor-auth-tabs button { min-height: 29px; font-size: 11px; }
  .editor-account-dialog .editor-google-auth {
    width: min(255px, 100%);
    min-height: 30px;
    margin: 7px auto 0;
    padding-inline: 5px;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
  }
  .editor-account-dialog .editor-auth-divider { display: none; }
  .editor-account-dialog .editor-account-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px 7px;
    align-content: start;
    margin-top: 8px;
  }
  .editor-account-dialog .editor-account-form > label:not(.editor-auth-remember) {
    grid-column: span 3;
    gap: 3px;
    font-size: 10.5px;
  }
  .editor-account-dialog .editor-account-form:has(.editor-auth-name:not([hidden])) > label:not(.editor-auth-remember) { grid-column: span 2; }
  .editor-account-dialog .editor-account-form input[type=text],
  .editor-account-dialog .editor-account-form input[type=email],
  .editor-account-dialog .editor-account-form input[type=password] { height: 32px; font-size: 11px; }
  .editor-account-dialog .editor-auth-password button { top: 1px; width: 30px; height: 30px; }
  .editor-account-dialog .editor-auth-remember { grid-column: 1 / span 2; grid-row: 3; align-self: center; min-height: 18px; font-size: 10.5px; }
  .editor-account-dialog .editor-auth-captcha { grid-column: 1 / -1; grid-row: 2; justify-self: center; width: min(100%, 300px); min-height: 0; padding: 0; }
  .editor-account-dialog .editor-auth-error:not([hidden]) { grid-column: 1 / -1; grid-row: 4; }
  .editor-account-dialog .editor-auth-submit { grid-column: 3 / -1; grid-row: 3; align-self: center; min-height: 33px; margin-top: 0; font-size: 11px; }

  #inspectorPanel:is(:has(#emptySelection:not([hidden])), :has(#exportPanel:not([hidden]))) {
    top: 50%;
    bottom: auto;
    left: 50%;
    right: auto;
    width: min(740px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100dvh - 20px);
    margin: 0;
    padding: 9px 12px 11px;
    overflow: visible;
    border: 1px solid #4b3c61;
    border-radius: 12px;
    background: linear-gradient(145deg, #1a1725, #12141d 75%);
    box-shadow: 0 18px 55px #000a;
    transform: translate(-50%, -50%);
    transition: opacity .16s ease, visibility .16s;
  }
  #inspectorPanel.open:is(:has(#emptySelection:not([hidden])), :has(#exportPanel:not([hidden]))) {
    transform: translate(-50%, -50%);
  }
  #inspectorPanel:is(:has(#emptySelection:not([hidden])), :has(#exportPanel:not([hidden]))) .inspector-head {
    display: flex;
    align-items: center;
    min-height: 25px;
    margin-bottom: 7px;
    padding: 0 0 5px;
    border-bottom: 1px solid #ffffff1a;
  }
  #inspectorPanel:is(:has(#emptySelection:not([hidden])), :has(#exportPanel:not([hidden]))) .inspector-head h2 { display: block; font-size: 11px; }
  #inspectorPanel:is(:has(#emptySelection:not([hidden])), :has(#exportPanel:not([hidden]))) #inspectorExpand { display: none; }
  #inspectorPanel:is(:has(#emptySelection:not([hidden])), :has(#exportPanel:not([hidden]))) #inspectorClose {
    position: static;
    display: grid;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin-inline-start: auto;
  }
  #inspectorPanel > :is(#emptySelection, #exportPanel):not([hidden]) { max-height: none; overflow: visible; }
  #emptySelection.project-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 16px;
    align-items: start;
    padding: 2px 3px 0;
  }
  #emptySelection .project-name-field { grid-column: 1; grid-row: 1; }
  #emptySelection .project-primary-actions { grid-column: 1; grid-row: 2; margin-top: 10px; }
  #emptySelection .project-overview-divider { display: none; }
  #emptySelection .project-info-list { grid-column: 2; grid-row: 1 / span 2; width: 100%; }
  #emptySelection .project-info-list > div { min-height: 27px; }

  #exportPanel.export-panel {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 5px 13px;
    align-items: start;
  }
  #exportPanel > :not(.export-plan-card) { grid-column: 1; }
  #exportPanel > .export-plan-card { grid-column: 2; grid-row: 1 / span 6; }
  #exportPanel .export-overview { gap: 5px; }
  #exportPanel .export-summary > div,
  #exportPanel .export-quality-picker > summary { min-height: 34px; padding-block: 5px; }
  #exportPanel .export-watermark-note,
  #exportPanel .export-lock-note { margin: 2px 0; padding: 4px 5px; font-size: 10px; line-height: 1.3; }
  #exportPanel .export-watermark-note > span,
  #exportPanel .export-lock-note > span { white-space: normal; }
  #exportPanel .export-actions-row { margin-top: 3px; }
  #exportPanel .export-actions-row > button { min-height: 33px; font-size: 10px; }
  #exportPanel .export-footer-actions { margin-top: 3px; gap: 5px; }
  #exportPanel .export-footer-actions > button { min-height: 30px; font-size: 10px; }
  #exportPanel .export-plan-comparison { gap: 5px; }
  #exportPanel .export-plan-column { padding: 4px 6px 3px; border-radius: 6px; }
  #exportPanel .export-plan-column-head { height: 23px; padding-bottom: 3px; }
  #exportPanel .export-plan-feature { min-height: 20px; font-size: 9.5px; }
  #exportPanel .export-plan-feature > b { font-size: 9.5px; }
}
