/* Responsive editor shell: UI direction follows the language, timeline geometry stays LTR. */
:root { --timeline: 244px; }

@media (min-width: 1281px) {
    .studio:not(.phone-preview-layout) { --inspector: 270px; }
    .studio:not(.phone-preview-layout) .inspector-panel { padding-inline: 9px; }
}

.workspace-backdrop {
    display: none;
    position: fixed;
    inset: 62px 0 0;
    border: 0;
    background: rgba(3, 4, 8, .62);
    backdrop-filter: blur(2px);
    z-index: 40;
    cursor: default;
}

/* A compact two-plane mark for the transition tool: the diagonal seam
   represents the visual hand-off between two neighbouring clips. */
.transition-feature-icon {
    width: 22px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    line-height: 0;
}

.transition-feature-icon svg {
    width: 22px;
    height: 18px;
    display: block;
    overflow: visible;
}

.transition-icon-frame {
    fill: rgba(255, 255, 255, .025);
    stroke: currentColor;
    stroke-width: 1.35;
}

.transition-icon-plane {
    fill: currentColor;
}

.transition-icon-plane--strong { opacity: .92; }
.transition-icon-plane--soft { opacity: .22; }

.transition-icon-seam {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linecap: round;
}

.tool[data-panel="transitions"]:hover .transition-icon-plane--soft,
.tool[data-panel="transitions"].active .transition-icon-plane--soft {
    opacity: .4;
}

.tool[data-panel="transitions"]:hover .transition-icon-seam,
.tool[data-panel="transitions"].active .transition-icon-seam {
    transform: translateX(.7px);
}

.transition-icon-seam,
.transition-icon-plane--soft {
    transition: opacity .18s ease, transform .18s ease;
}

.media-panel-content[hidden],
.transitions-panel-content[hidden] { display: none !important; }

.transitions-panel-content { padding-bottom: 10px; }
.transition-library-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 9px;
    color: #c9c6d3;
    font-size: 10px;
}
.transition-library-head > span {
    min-width: 26px;
    padding: 2px 7px;
    border: 1px solid rgba(151,126,245,.16);
    border-radius: 999px;
    color: #b7a9ef;
    background: rgba(116,87,238,.1);
    text-align: center;
    font: 700 9px/1.35 ui-monospace, monospace;
}
.transition-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.transition-card {
    position: relative;
    min-width: 0;
    padding: 5px;
    border: 1px solid #292b34;
    border-radius: 9px;
    color: #c6c5ce;
    background: #15161c;
    text-align: start;
    cursor: grab;
    user-select: none;
    transition: border-color .16s ease, background .16s ease, transform .16s ease, opacity .16s ease;
}
.transition-card.is-subscriber-locked { border-color: #36333e; color: #a29eab; background: #191821; cursor: pointer; }
.transition-card.is-subscriber-locked:hover { border-color: #8b6bba; color: #dbd4eb; background: #211c2c; }
.transition-card-pro { position: absolute; top: 8px; inset-inline-end: 8px; padding: 2px 4px; border-radius: 4px; color: #e6c894; background: rgba(17, 15, 23, .85); font: 700 7px/1 Arial, sans-serif; pointer-events: none; }
.transition-card:hover,
.transition-card.selected {
    border-color: rgba(142,112,245,.72);
    color: #f3f0ff;
    background: #1b1926;
    transform: translateY(-1px);
}
.transition-card.dragging { opacity: .48; cursor: grabbing; }
.transition-placement-hint {
    position: fixed;
    z-index: 101;
    max-width: calc(100vw - 20px);
    padding: 6px 10px;
    border: 1px solid rgba(160, 133, 255, .7);
    border-radius: 7px;
    color: #f6f2ff;
    background: rgba(29, 24, 43, .96);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.transition-placement-hint[hidden] { display: none; }
.toast.toast-single-line {
    max-width: calc(100vw - 20px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.transition-drag-ghost {
    position: fixed;
    z-index: 500;
    top: 0;
    left: 0;
    width: 116px;
    padding: 5px;
    border: 1px solid rgba(126,98,232,.82);
    border-radius: 9px;
    color: #f4f1ff;
    background: rgba(20,19,29,.94);
    box-shadow: 0 14px 34px rgba(0,0,0,.48), 0 0 0 1px rgba(161,135,255,.12);
    pointer-events: none;
    will-change: transform;
}
.transition-drag-ghost .transition-card-preview { height: 34px; }
.transition-drag-ghost > b {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.transition-card > b {
    display: block;
    margin: 5px 2px 1px;
    overflow: hidden;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.transition-card-preview {
    position: relative;
    height: 42px;
    display: block;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 6px;
    background: #0c0d12;
    isolation: isolate;
}
.transition-card-preview i,
.transition-card-preview em {
    position: absolute;
    inset-block: 0;
    width: 58%;
    display: block;
    transition: transform .35s ease, opacity .35s ease, filter .35s ease, clip-path .35s ease;
}
.transition-card-preview i {
    inset-inline-start: 0;
    background: linear-gradient(135deg, #8667f3, #49318f 76%);
}
.transition-card-preview em {
    inset-inline-end: 0;
    background: linear-gradient(135deg, #1c8792, #2ac0a8);
    clip-path: polygon(24% 0,100% 0,100% 100%,0 100%);
}
.transition-card-preview::before,
.transition-card-preview::after {
    content: "";
    position: absolute;
    z-index: 3;
    pointer-events: none;
}
.transition-card-preview::before {
    inset: 7px 50% 7px auto;
    width: 1px;
    background: rgba(255,255,255,.72);
    box-shadow: 0 0 8px rgba(255,255,255,.28);
    transform: rotate(18deg);
}
.transition-card-preview::after {
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 14px rgba(0,0,0,.2);
}
.transition-card:hover .transition-preview--fade i { opacity: .2; }
.transition-card:hover .transition-preview--fade em { opacity: .9; }
.transition-preview--dissolve::after { background-image: radial-gradient(circle, rgba(255,255,255,.42) 0 1px, transparent 1.5px); background-size: 6px 6px; opacity: .28; }
.transition-preview--dark::after { background: linear-gradient(90deg, transparent, #050508 47% 55%, transparent); }
.transition-preview--light::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.9) 47% 55%, transparent); }
.transition-card:hover .transition-preview--slide-left i,
.transition-card:hover .transition-preview--wipe-left i { transform: translateX(-45%); }
.transition-card:hover .transition-preview--slide-right em,
.transition-card:hover .transition-preview--wipe-right em { transform: translateX(45%); }
.transition-card:hover .transition-preview--slide-up i,
.transition-card:hover .transition-preview--wipe-up i { transform: translateY(-45%); }
.transition-card:hover .transition-preview--slide-down em,
.transition-card:hover .transition-preview--wipe-down em { transform: translateY(45%); }
.transition-preview--wipe-left i,
.transition-preview--wipe-right em { clip-path: polygon(0 0,100% 18%,82% 100%,0 100%); }
.transition-preview--wipe-up i,
.transition-preview--wipe-down em { clip-path: polygon(0 0,100% 0,82% 100%,16% 84%); }
.transition-card:hover .transition-preview--zoom-in i { transform: scale(1.45); }
.transition-card:hover .transition-preview--zoom-out em { transform: scale(.62); }
.transition-preview--blur i { filter: blur(3px); }
.transition-card:hover .transition-preview--blur em { filter: blur(4px); }
.transition-preview--pixelate::after { background: repeating-conic-gradient(rgba(255,255,255,.2) 0 25%, transparent 0 50%) 0/9px 9px; opacity: .46; }
.transition-preview--circle::after { background: radial-gradient(circle, transparent 0 25%, rgba(8,9,13,.72) 27% 47%, transparent 49%); }
.transition-preview--iris::after { background: conic-gradient(from 45deg, transparent 0 12%, rgba(7,8,12,.67) 13% 25%, transparent 26% 37%, rgba(7,8,12,.67) 38% 50%, transparent 51% 62%, rgba(7,8,12,.67) 63% 75%, transparent 76% 87%, rgba(7,8,12,.67) 88%); }
.transition-preview--radial::after,
.transition-preview--clock::after { background: conic-gradient(from -25deg, rgba(255,255,255,.42), transparent 42%, rgba(0,0,0,.35) 43% 78%, transparent 79%); }
.transition-preview--clock::before { inset: 7px auto 7px 50%; transform: rotate(35deg); transform-origin: bottom; }
.transition-card:hover .transition-preview--flip-h i { transform: scaleX(.08); }
.transition-card:hover .transition-preview--flip-v em { transform: scaleY(.08); }
.transition-preview--cube-left i,
.transition-preview--cube-right em { transform: skewY(-12deg); }
.transition-card:hover .transition-preview--cube-left i { transform: translateX(-24%) skewY(-12deg); }
.transition-card:hover .transition-preview--cube-right em { transform: translateX(24%) skewY(-12deg); }
.transition-preview--page-left i,
.transition-preview--page-right em { transform-origin: center; box-shadow: 5px 0 10px rgba(0,0,0,.36); }
.transition-card:hover .transition-preview--page-left i { transform: perspective(90px) rotateY(48deg); }
.transition-card:hover .transition-preview--page-right em { transform: perspective(90px) rotateY(-48deg); }
.transition-preview--ripple::after { inset: 8px 30%; border: 2px solid rgba(255,255,255,.42); border-radius: 50%; box-shadow: 0 0 0 5px rgba(255,255,255,.1), 0 0 0 10px rgba(255,255,255,.05); }
.transition-preview--bars::after { background: repeating-linear-gradient(90deg, rgba(255,255,255,.28) 0 4px, transparent 4px 9px); }
.transition-preview--checker::after { background: repeating-conic-gradient(rgba(255,255,255,.22) 0 25%, transparent 0 50%) 0/12px 12px; }
.transition-preview--spiral::after { background: repeating-conic-gradient(from 35deg, rgba(255,255,255,.24) 0 9deg, transparent 10deg 24deg); }
.transition-preview--fold i { transform: skewX(-18deg); filter: brightness(.8); }
.transition-card:hover .transition-preview--fold i { transform: skewX(22deg) translateX(-16%); }
.transition-preview--blinds::after { background: repeating-linear-gradient(0deg, rgba(7,8,12,.7) 0 3px, transparent 3px 8px); }

body.transition-dragging .clip { cursor: copy; }
.clip.transition-drop-start,
.clip.transition-drop-end { overflow: visible; }
.clip.transition-drop-start::after,
.clip.transition-drop-end::after {
    content: "";
    position: absolute;
    z-index: 30;
    inset-block: -3px;
    width: max(24px, 28%);
    border: 2px solid #58e0b1;
    background: rgba(60,211,164,.2);
    box-shadow: 0 0 16px rgba(60,211,164,.32), inset 0 0 12px rgba(60,211,164,.14);
    pointer-events: none;
}
.clip.transition-drop-start::after { inset-inline-start: -2px; border-radius: 7px 3px 3px 7px; }
.clip.transition-drop-end::after { inset-inline-end: -2px; border-radius: 3px 7px 7px 3px; }
html[dir="rtl"] .clip.transition-drop-start::after { border-radius: 3px 7px 7px 3px; }
html[dir="rtl"] .clip.transition-drop-end::after { border-radius: 7px 3px 3px 7px; }
.clip.transition-drop-invalid { border-color: #e95268; box-shadow: 0 0 0 1px #e95268; cursor: not-allowed !important; }
.clip-transition-marker {
    position: absolute;
    z-index: 12;
    inset-block: 0;
    width: 9px;
    overflow: hidden;
    border-inline: 1px solid rgba(255,255,255,.34);
    background: linear-gradient(180deg, #57ddbc, #1b9d87);
    box-shadow: 0 0 9px rgba(49,214,178,.38);
    pointer-events: none;
}
.clip-transition-marker--in { inset-inline-start: 0; border-radius: 5px 0 0 5px; }
.clip-transition-marker--out {
    inset-inline-end: 0;
    border-radius: 0 5px 5px 0;
    background: linear-gradient(180deg, #ad8bff, #7150d0);
    box-shadow: 0 0 9px rgba(137,99,238,.38);
}
html[dir="rtl"] .clip-transition-marker--in { border-radius: 0 5px 5px 0; }
html[dir="rtl"] .clip-transition-marker--out { border-radius: 5px 0 0 5px; }
.clip-transition-marker i {
    position: absolute;
    inset: 0;
    display: block;
    background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,.52) 5px 6px);
    opacity: .55;
}
.clip.transition-applied { animation: transition-clip-applied .5s ease; }
@keyframes transition-clip-applied {
    45% { border-color: #58e0b1; box-shadow: 0 0 0 2px rgba(88,224,177,.4), 0 0 18px rgba(88,224,177,.25); }
}

.inspector-toggle { display: none !important; }
.stage-area, .timeline, .tracks-scroll { min-width: 0; }
.stage-toolbar {
    position: relative;
    inset: auto;
    z-index: 12;
    width: 100%;
    height: 34px;
    flex: 0 0 34px;
    padding: 0 12px;
    border-bottom: 0;
    pointer-events: auto;
}
.stage-toolbar > * { pointer-events: auto; }
.aspect-picker {
    position: relative;
    direction: rtl;
}
.aspect-picker .format-select {
    min-width: 124px;
    height: 28px;
    justify-content: flex-start;
    gap: 5px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.aspect-picker .format-select:focus-visible { outline: 2px solid #9b81f8; outline-offset: 2px; }
.aspect-picker .format-select > span { font: 800 10px/1 Arial, sans-serif; }
.aspect-picker .format-select > small {
    min-width: 0;
    overflow: hidden;
    color: #95919f;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.aspect-picker .format-select > b { margin-inline-start: auto; }
.aspect-ratio-icon {
    width: 24px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 24px;
    color: #b9a8f8;
    font-style: normal;
}
.aspect-ratio-icon::before {
    content: "";
    display: block;
    width: var(--aspect-icon-w);
    height: var(--aspect-icon-h);
    border: 1.5px solid currentColor;
    border-radius: 2.5px;
    background: none;
    box-shadow: none;
}
.aspect-phone { --aspect-icon-w: 8px; --aspect-icon-h: 17px; }
.aspect-post { --aspect-icon-w: 12px; --aspect-icon-h: 15px; }
.aspect-square { --aspect-icon-w: 15px; --aspect-icon-h: 15px; }
.aspect-tablet { --aspect-icon-w: 19px; --aspect-icon-h: 14px; }
.aspect-youtube { --aspect-icon-w: 21px; --aspect-icon-h: 12px; }
.aspect-ratio-menu[hidden] { display: none !important; }
.aspect-ratio-menu {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    right: auto;
    z-index: 30;
    width: 178px;
    padding: 5px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    border: 1px solid rgba(165, 137, 255, .25);
    border-radius: 12px;
    background: rgba(15, 15, 22, .97);
    box-shadow: 0 16px 42px rgba(0, 0, 0, .48);
    backdrop-filter: blur(16px);
}
.aspect-ratio-menu button {
    min-width: 0;
    min-height: 34px;
    padding: 4px 7px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: rgba(255, 255, 255, .025);
    color: #8e8998;
    cursor: pointer;
}
.aspect-ratio-menu button:hover,
.aspect-ratio-menu button:focus-visible,
.aspect-ratio-menu button[aria-selected="true"] {
    border-color: rgba(154, 126, 255, .5);
    background: rgba(116, 87, 238, .14);
    color: #f1edff;
    outline: 0;
}
.aspect-ratio-menu button[aria-selected="true"] .aspect-ratio-icon { color: #bdaeff; }
.aspect-ratio-menu button b {
    overflow: hidden;
    font-size: 10px;
    line-height: 1.2;
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.aspect-ratio-menu button small { color: #8d7fd0; font: 800 9px/1 Arial, sans-serif; direction: ltr; }
.canvas-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 18px 4px;
}
.stage-area:has(.video-canvas.ratio-wide) .canvas-wrap { padding-top: 6px; }
.preview-viewport {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 36px minmax(0, 1fr);
    grid-template-rows: max-content;
    align-content: center;
    align-items: center;
    justify-content: center;
    column-gap: 8px;
    direction: ltr;
    overflow: hidden;
    overscroll-behavior: contain;
    padding: 2px 4px 0;
}
.preview-viewport .video-canvas {
    grid-column: 2;
    grid-row: 1;
    flex: 0 0 auto;
    height: 100%;
    width: auto;
    max-width: none;
    max-height: none;
}
.preview-dock {
    flex: 0 0 auto;
    max-width: 86%;
    margin-top: 4px;
}
.preview-quick-tools {
    grid-column: 3;
    grid-row: 1;
    align-self: stretch;
    width: 32px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin: 0 0 0 4px;
    direction: ltr;
}
.preview-quick-tools .preview-volume-control { margin-top: auto; }
.preview-progress {
    width: 100%;
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .15);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025);
}
.preview-progress i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8061f5, #ed68b7);
    box-shadow: 0 0 10px rgba(136, 100, 247, .42);
    transition: width .1s linear;
}
html[dir="rtl"] .preview-progress i { margin-left: auto; }
.preview-dock .transport {
    width: 100%;
    height: 38px;
    padding: 0;
    justify-content: center;
    gap: 11px;
}
html[dir="rtl"] .preview-dock .transport { direction: rtl; }
html[dir="ltr"] .preview-dock .transport { direction: ltr; }
.preview-dock .transport-icon {
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
    line-height: 1;
}
html[dir="rtl"] .preview-dock .transport-icon { transform: scaleX(-1); }
.preview-dock .timecode {
    min-width: 100px;
    justify-content: center;
    direction: ltr;
}
.preview-dock .timecode > * {
    direction: ltr;
    unicode-bidi: isolate;
}
html[dir="rtl"] .preview-dock .timecode { direction: rtl; }
html[dir="ltr"] .preview-dock .timecode { direction: ltr; }
.preview-dock #totalTime {
    font-size: 11px;
    color: #a7a9b3;
}
.timeline, .timeline-toolbar, .timeline-body, .tracks-scroll, .time-ruler, .track { direction: ltr; }
html[dir="rtl"] .timeline-toolbar { direction: rtl; }
html[dir="rtl"] .timeline-toolbar .editing-tools { direction: rtl; }
html[dir="rtl"] .timeline-toolbar .timeline-zoom { direction: ltr; }
.timeline-toolbar .timeline-zoom-cycle {
    width: auto;
    min-width: 72px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 9px;
    border: 1px solid #383244;
    border-radius: 8px;
    background: linear-gradient(135deg, #201b2e, #171820);
    color: #d5c8ff;
    transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.timeline-toolbar .timeline-zoom-cycle:hover,
.timeline-toolbar .timeline-zoom-cycle:focus-visible {
    border-color: #8067e6;
    background: #29233b;
    color: #fff;
}
.timeline-zoom-cycle svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}
.timeline-zoom-cycle span {
    min-width: 30px;
    font: 700 10px/1 ui-monospace, Consolas, monospace;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.timeline-toolbar #undoBtn,
.timeline-toolbar #redoBtn {
    background: #191a23;
    box-shadow: inset 0 0 0 1px #33323f;
    transition: color .16s ease, background-color .16s ease, opacity .16s ease;
}
.timeline-toolbar .history-icon {
    width: 16px;
    height: 16px;
    display: block;
    margin: auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
html[dir="ltr"] .timeline-toolbar #undoBtn .history-icon { transform: none; }
html[dir="ltr"] .timeline-toolbar #redoBtn .history-icon { transform: scaleX(-1); }
html[dir="rtl"] .timeline-toolbar #undoBtn .history-icon { transform: scaleX(-1); }
html[dir="rtl"] .timeline-toolbar #redoBtn .history-icon { transform: none; }
.timeline-toolbar #undoBtn:not(:disabled),
.timeline-toolbar #redoBtn:not(:disabled) { color: #f4f5f8; background: #2a233a; box-shadow: inset 0 0 0 1px #665183; }
.timeline-toolbar #undoBtn:disabled,
.timeline-toolbar #redoBtn:disabled {
    color: #888b99;
    opacity: 1;
    cursor: default;
    background: #181921;
}
.timeline-toolbar #undoBtn:disabled:hover,
.timeline-toolbar #redoBtn:disabled:hover { color: #888b99; background: #181921; }
.timeline-toolbar .lock-tool.is-locked { color: #d1b8ff; background: rgba(116, 87, 238, .16); }
.timeline-toolbar .lock-tool:disabled { color: #626571; cursor: default; }
.track.is-locked { background-color: rgba(116, 87, 238, .055); }
.track.is-locked .clip { cursor: default; }
.track-labels > [data-track-label].is-locked { background: rgba(116, 87, 238, .1); }
.track-lock-indicator { width: 13px; height: 13px; flex: 0 0 13px; color: #cbb8ff !important; }
.track-lock-indicator svg { display: block; width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[dir="rtl"] .clip { direction: rtl; text-align: right; }
html[dir="ltr"] .tool-rail,
html[dir="ltr"] .library-panel,
html[dir="ltr"] .inspector-panel,
html[dir="ltr"] .track-labels { direction: ltr; }
.clip small { margin-left: 0; margin-inline-start: auto; }
.tracks-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: auto;
    overscroll-behavior-inline: contain;
}
.track-labels { overflow: hidden; }
.timeline-body.is-vertical-panning { user-select: none; }
.library-panel, .inspector-panel { scrollbar-gutter: stable; }
.library-panel {
    padding: 9px 12px 14px;
}
.library-panel .panel-heading {
    align-items: center;
    margin-bottom: 7px;
}
.library-panel .panel-heading h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
}
.library-panel .panel-heading span {
    display: block;
    margin-top: 1px;
    font-size: 8px;
    line-height: 1.45;
}
.library-panel .library-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    margin: 0 0 8px;
    padding: 3px;
    border: 1px solid #282a33;
    border-radius: 10px;
    background: #0b0c11;
}
.library-panel .library-tabs button {
    padding: 8px 2px;
    border: 0;
    border-radius: 7px;
    color: #838591;
    font-size: 9px;
}
.library-panel .library-tabs button.active {
    border: 0;
    color: #f1edff;
    background: linear-gradient(135deg, rgba(116,87,238,.38), rgba(116,87,238,.17));
    box-shadow: inset 0 0 0 1px rgba(151,126,245,.24);
}
.library-panel .upload-drop {
    height: 64px;
    margin-bottom: 10px;
    padding: 6px 10px 8px;
    gap: 1px;
}
.library-panel .upload-drop .upload-icon {
    font-size: 15px;
    line-height: 1;
}
.library-panel .upload-drop b {
    font-size: 10px;
    line-height: 1.35;
}
.library-panel .upload-drop small {
    margin-top: 1px;
    font-size: 8px;
    line-height: 1.45;
}
.upload-drop.is-dragover,
.upload-drop.is-loading { border-color: #8065f4; background: rgba(125,91,240,.13); }
.upload-drop.is-loading { opacity: .72; cursor: progress; }
.library-section-title { margin: 0 0 10px; }
.library-section-title > span {
    min-width: 23px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #1a1b22;
    color: #999ba6;
    text-align: center;
    font-size: 8px;
}
.uploaded-media .thumb video,
.uploaded-media .thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.uploaded-media .thumb i { position: relative; z-index: 2; }
.media-card { position: relative; width: 100%; }
.uploaded-media .thumb .media-duration {
    position: absolute;
    z-index: 3;
    inset-inline-start: 5px;
    bottom: 5px;
    margin: 0;
    padding: 2px 5px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 5px;
    color: #fff;
    background: rgba(5, 6, 10, .78);
    box-shadow: 0 2px 8px rgba(0,0,0,.28);
    font: 700 9px/1 ui-monospace, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    direction: ltr;
}
.uploaded-audio { background: linear-gradient(135deg, #132e34, #225d65); }
.uploaded-video-art { background: linear-gradient(135deg, #1a1630, #6650bc); }
.uploaded-video-art::after {
    content: "▶";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #e9e2ff;
    font-size: 11px;
}
.uploaded-image-art { background: linear-gradient(135deg, #233048, #885692); }
.tracks-scroll { --timeline-width: 1260px; --timeline-edge-inset: 0px; }
html.editor-booting .track > .clip,
html.editor-booting .playhead,
html.editor-booting .timeline-playhead-cluster,
html.editor-booting .timeline-cut-grip,
html.editor-booting .timeline-playhead-handle { visibility: hidden; }
.tracks-scroll.timeline-fits {
    overflow-x: hidden;
    overscroll-behavior-inline: none;
}
.timeline-handle-lane, .time-ruler, .track {
    width: var(--timeline-width);
    min-width: 0;
}
.clip { left: calc(var(--timeline-edge-inset) + var(--start) * var(--second)); }
.track > .clip {
    /* Keep transition markers and resize handles below the sticky ruler while scrolling. */
    z-index: 0;
}
.timeline-body {
    --track-label-width: 96px;
    --timeline-handle-lane-height: 30px;
    --timeline-ruler-height: 31px;
    --timeline-scroll-rail-width: 14px;
    position: relative;
    direction: ltr;
    grid-template-columns: var(--timeline-scroll-rail-width) var(--track-label-width) minmax(0, 1fr);
    grid-template-areas: "vertical-rail track-labels timeline-tracks";
}
.track-labels { grid-area: track-labels; }
.timeline-vertical-rail {
    grid-area: vertical-rail;
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: calc(var(--timeline-handle-lane-height) + var(--timeline-ruler-height)) minmax(0, 1fr);
    overflow: hidden;
    border-inline: 1px solid #202128;
    background: #0d0e13;
}
.timeline-vertical-rail::after {
    content: "";
    position: absolute;
    z-index: 2;
    top: calc(var(--timeline-handle-lane-height) + var(--timeline-ruler-height) + 3px);
    bottom: 3px;
    left: 4px;
    right: 4px;
    border-radius: 999px;
    background: #181922;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .035);
    pointer-events: none;
}
.tracks-scroll { grid-area: timeline-tracks; }
.timeline-vertical-ruler-gap {
    border-bottom: 1px solid #292a33;
    background:
        linear-gradient(to bottom, transparent calc(var(--timeline-handle-lane-height) - 1px), #292a33 var(--timeline-handle-lane-height), transparent calc(var(--timeline-handle-lane-height) + 1px)),
        linear-gradient(180deg, #111218 0%, #0d0e13 100%);
}
.timeline-vertical-scroll {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: scroll;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: none;
    background: #0d0e13;
}
.timeline-vertical-scroll::-webkit-scrollbar { width: 0; height: 0; }
.timeline-vertical-thumb {
    --timeline-thumb-offset: 3px;
    position: absolute;
    z-index: 4;
    top: calc(var(--timeline-handle-lane-height) + var(--timeline-ruler-height));
    left: 3px;
    right: 3px;
    min-height: 28px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(185, 159, 255, .28);
    border-radius: 999px;
    background: linear-gradient(180deg, #6950c9, #8b63e8);
    box-shadow: 0 1px 6px rgba(93, 65, 183, .46), inset 0 1px 0 rgba(255, 255, 255, .22);
    transform: translateY(var(--timeline-thumb-offset));
    cursor: grab;
    touch-action: none;
    opacity: 1;
}
.timeline-vertical-thumb:hover,
.timeline-vertical-thumb:focus-visible { filter: brightness(1.16); }
.timeline-vertical-thumb:focus-visible { outline: 1px solid #bda8ff; outline-offset: 1px; }
.timeline-vertical-thumb.dragging { cursor: grabbing; filter: brightness(1.2); }
.timeline-vertical-thumb.no-overflow {
    opacity: .42;
    cursor: default;
}
.timeline-vertical-scroll-content { width: 1px; min-height: 100%; }
.track-labels > div:not(.ruler-spacer) { padding-inline: 7px; gap: 5px; }
.track-labels > div:not(.ruler-spacer) b { width: 100%; text-align: center; }
.track,
.track-labels > div:not(.ruler-spacer) { height: 45px; }
.clip {
    top: 4px;
    height: 36px;
}
.clip-art { height: 28px; }
.clip.is-inserted {
    border-color: #f3bf70;
    background: linear-gradient(115deg, #664629, #493442 72%, #3d3150);
    box-shadow: inset 0 0 0 1px rgba(255, 220, 155, .35), 0 2px 10px rgba(237, 160, 73, .16);
}
.clip.is-inserted.selected { border-color: #ffd487; }
.clip.is-inserted .clip-duration-handle { display: none; }
.clip.is-inserted[data-type="image"] .clip-content { background: #624029; }
.clip.is-inserted[data-type="image"] .clip-content::after,
html[dir="rtl"] .clip.is-inserted[data-type="image"] .clip-content::after {
    background: linear-gradient(90deg, rgba(103, 64, 29, .3), rgba(76, 42, 26, .78));
}
.audio-clip { align-items: flex-start; padding: 3px 5px; }
.audio-clip > b {
    position: relative;
    z-index: 1;
    max-width: 100%;
    padding: 1px 3px;
    border-radius: 3px;
    background: rgba(9, 32, 36, .72);
    color: #d8f8f3;
    font-size: 9px;
    line-height: 13px;
}
.audio-waveform-canvas {
    position: absolute;
    inset: 18px 3px 3px;
    width: calc(100% - 6px);
    height: calc(100% - 21px);
    pointer-events: none;
}
.clip-content {
    width: 100%;
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    border-radius: 4px;
}
.clip-art {
    width: 41px;
    height: 32px;
    flex-basis: 41px;
}
.clip-art img {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}
.clip-art::before { z-index: 1; pointer-events: none; }
.clip[data-type="image"] { padding: 3px; }
.clip[data-type="image"] .clip-content {
    position: relative;
    isolation: isolate;
    padding-inline: 6px;
    background: linear-gradient(90deg, #211a35, #2b2244 50%, #211a35);
}
.clip[data-type="image"] .clip-content .clip-art {
    position: absolute;
    inset: auto;
    top: 3px;
    bottom: 3px;
    left: 50%;
    width: min(104px, calc(100% - 12px));
    height: auto;
    transform: translateX(-50%);
    overflow: hidden;
    border-radius: 3px;
    background: transparent;
}
.clip[data-type="image"] .clip-art img { object-fit: contain; }
.clip[data-type="image"] .clip-art::before { display: none; }
.clip[data-type="image"] .clip-content::after {
    display: none;
}
.clip[data-type="image"] .clip-content > b,
.clip[data-type="image"] .clip-content > small {
    position: absolute;
    z-index: 2;
    min-width: 0;
    max-width: min(42%, 200px);
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(9, 8, 17, .72);
    text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.clip[data-type="image"] .clip-content > b { top: 2px; inset-inline-start: 3px; }
.clip[data-type="image"] .clip-content > small { bottom: 2px; inset-inline-end: 3px; }
.clip[data-library-kind][data-type="video"] .clip-content {
    position: relative;
    isolation: isolate;
    background: linear-gradient(90deg, #211a35, #2b2244 50%, #211a35);
}
.clip[data-library-kind][data-type="video"] .clip-content .clip-art {
    position: absolute;
    inset: auto;
    top: 3px;
    bottom: 3px;
    left: 50%;
    width: min(104px, calc(100% - 12px));
    height: auto;
    transform: translateX(-50%);
    overflow: hidden;
    border-radius: 3px;
    background: transparent;
}
.clip[data-library-kind][data-type="video"] .clip-art::before,
.clip[data-library-kind][data-type="video"] .clip-art::after { display: none; }
.clip[data-library-kind][data-type="video"] .clip-art video {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}
.clip[data-library-kind][data-type="video"] .clip-content > b,
.clip[data-library-kind][data-type="video"] .clip-content > small {
    position: absolute;
    z-index: 2;
    min-width: 0;
    max-width: min(42%, 200px);
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(9, 8, 17, .72);
    text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.clip[data-library-kind][data-type="video"] .clip-content > b { top: 2px; inset-inline-start: 3px; }
.clip[data-library-kind][data-type="video"] .clip-content > small { bottom: 2px; inset-inline-end: 3px; }
.track-delete-button {
    display: none;
    place-items: center;
    flex: 0 0 23px;
    width: 23px;
    height: 23px;
    padding: 0 !important;
    border: 1px solid rgba(244, 92, 112, .2) !important;
    border-radius: 50%;
    background: rgba(244, 92, 112, .07) !important;
    color: #ee8b9b !important;
    cursor: pointer;
    overflow: hidden;
}
.track-labels > [data-track-label].active-track-label .track-delete-button { display: grid; }
.track-delete-button:hover,
.track-delete-button:focus-visible {
    border-color: rgba(255, 112, 132, .5) !important;
    background: rgba(244, 92, 112, .14) !important;
    color: #ffb0bd !important;
    outline: none;
}
.track-delete-button svg {
    display: block;
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.playhead { left: calc(var(--timeline-edge-inset) + var(--playhead-position, 0px) - 1px); }
.playhead {
    width: 2px;
    top: var(--timeline-handle-lane-height);
    bottom: 13px;
    transform: translateY(var(--timeline-scroll-y, 0px));
    background: linear-gradient(180deg, #f8f5ff, #a991ff 46%, #8063ee);
    box-shadow: 0 0 9px rgba(155, 124, 255, .46);
}
.playhead::before {
    top: 2px;
    left: -9px;
    width: 20px;
    height: 17px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 7px;
    background: linear-gradient(155deg, #fbf9ff 0%, #d5c8ff 52%, #a78cfb 100%);
    box-shadow: 0 5px 14px rgba(0, 0, 0, .52), 0 0 0 1px rgba(108, 76, 224, .76);
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.playhead::after {
    content: "";
    position: absolute;
    top: 17px;
    left: -4px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #aa91fa;
}
.playhead span {
    top: -7px;
    bottom: auto;
    left: -19px;
    width: 40px;
    height: 48px;
    border: 0;
    padding: 0;
    outline: none;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.playhead::before,
.playhead::after { display: none; }
.timeline-playhead-cluster {
    position: absolute;
    z-index: 80;
    top: 0;
    left: 0;
    width: 70px;
    height: 30px;
    transform: translateX(-50%);
    pointer-events: none;
}
.timeline-cut-cancel {
    position: static;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.timeline-cut-cancel svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}
.timeline-cut-cancel b { font-size: 9px; font-weight: 650; line-height: 1; }
.timeline-playhead-handle {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 22px;
    width: 26px;
    height: 30px;
    border: 0;
    padding: 0;
    outline: none;
    background: transparent;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.timeline-playhead-handle::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 2px;
    width: 22px;
    height: 19px;
    border-radius: 4px 4px 2px 2px;
    border: 1px solid rgba(183, 217, 224, .74);
    background: linear-gradient(180deg, #78969d 0%, #5c7880 58%, #425d64 100%);
    clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .5);
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.timeline-playhead-handle::after {
    content: "";
    position: absolute;
    top: 7px;
    left: 7px;
    width: 12px;
    height: 1px;
    background: rgba(255, 255, 255, .42);
    pointer-events: none;
}
.timeline-cut-grip {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 50%;
    width: 24px;
    height: 27px;
    border: 0;
    outline: none;
    background: transparent;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
    transition: filter .12s ease, opacity .12s ease, transform .12s ease;
}
.timeline-cut-grip::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 4px;
    width: 16px;
    height: 17px;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 4px;
    clip-path: polygon(0 0, 100% 0, 100% 76%, 50% 100%, 0 76%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .18);
    pointer-events: none;
}
.timeline-cut-grip::after,
.cut-guide-handle::before {
    content: "";
    display: block;
    position: absolute;
    top: 8px;
    left: 50%;
    width: 4px;
    height: 6px;
    border-inline: 1px solid rgba(16, 24, 27, .46);
    transform: translateX(-50%);
    opacity: .78;
    pointer-events: none;
}
.cut-guide-handle::before { top: 4px; width: 5px; height: 7px; }
.timeline-cut-start-grip::before { background: linear-gradient(180deg, #85c85b, #4e9a31); }
.timeline-cut-end-grip::before { background: linear-gradient(180deg, #f26b77, #c53749); }
html[dir="rtl"] .timeline-cut-start-grip,
html[dir="ltr"] .timeline-cut-end-grip {
    transform: translateX(15px);
}
html[dir="rtl"] .timeline-cut-end-grip,
html[dir="ltr"] .timeline-cut-start-grip {
    transform: translateX(-39px);
}
.timeline-cut-grip:hover,
.timeline-cut-grip:focus-visible { filter: brightness(1.2); }
.timeline-cut-grip:active { cursor: grabbing; }
body.timeline-cut-mode .timeline-cut-grip {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.timeline-playhead-handle:focus-visible {
    border-radius: 7px;
    box-shadow: 0 0 0 2px #8669f2;
}
.playhead-time {
    --playhead-time-shift-x: 0px;
    position: absolute;
    z-index: 4;
    top: calc((var(--timeline-handle-lane-height) * -1) + 3px);
    left: 46px;
    min-width: 66px;
    height: 22px;
    padding: 3px 8px;
    border: 1px solid rgba(174, 151, 255, .58);
    border-radius: 6px;
    background: rgba(20, 18, 31, .98);
    color: #f8f5ff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .52), inset 0 1px 0 rgba(255, 255, 255, .055);
    font: 700 11px/14px ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    translate: var(--playhead-time-shift-x) 0;
    transform: translateY(-2px) scale(.96);
    transform-origin: center;
    transition: opacity .14s ease, transform .14s ease, visibility 0s linear .14s;
}
.playhead.time-label-visible .playhead-time {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
}
body.timeline-cut-mode .playhead-time { display: none; }
.cut-boundary-time {
    position: absolute;
    z-index: 95;
    top: 3px;
    left: 0;
    display: block;
    height: 23px;
    padding: 3px 5px;
    border: 1px solid;
    border-radius: 5px;
    background: #15171b;
    box-shadow: 0 3px 9px rgba(0, 0, 0, .35);
    font: 700 10px/15px ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    white-space: nowrap;
    pointer-events: none;
}
.cut-boundary-time[hidden],
body:not(.timeline-cut-mode) .cut-boundary-time { display: none; }
.cut-start-time { border-color: #508c39; color: #a9e78e; }
.cut-end-time { border-color: #af4759; color: #ffabb9; }
.cut-current-time {
    position: absolute;
    z-index: 96;
    top: calc(var(--timeline-handle-lane-height) + var(--timeline-ruler-height) + 3px);
    left: 0;
    display: block;
    height: 21px;
    padding: 2px 6px;
    border: 1px solid rgba(174, 151, 255, .72);
    border-radius: 6px;
    background: #181425;
    color: #f8f5ff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .48);
    font: 700 10px/15px ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    white-space: nowrap;
    pointer-events: none;
}
.cut-current-time[hidden],
body:not(.timeline-cut-mode) .cut-current-time { display: none; }
html[dir="rtl"] .playhead-time {
    left: auto;
    right: 46px;
}
.playhead.at-end .playhead-time {
    left: auto;
    right: 46px;
}
html[dir="rtl"] .playhead.at-end .playhead-time {
    left: 46px;
    right: auto;
}
.playhead.near-left .playhead-time,
html[dir="rtl"] .playhead.near-left .playhead-time {
    left: 46px;
    right: auto;
}
.playhead.near-right .playhead-time,
html[dir="rtl"] .playhead.near-right .playhead-time {
    left: auto;
    right: 46px;
}
.playhead.at-start,
.playhead.at-end,
html[dir="rtl"] .playhead.at-start,
html[dir="rtl"] .playhead.at-end { margin-left: 0; }
.playhead span:focus-visible { border-radius: 7px; box-shadow: 0 0 0 2px #8669f2; }
.time-ruler,
.time-ruler *,
.playhead,
.playhead * {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}
.time-ruler { cursor: pointer; touch-action: none; }
body.timeline-scrubbing,
body.timeline-scrubbing * {
    user-select: none !important;
    -webkit-user-select: none !important;
}
body.timeline-scrubbing .playhead::before {
    filter: brightness(1.08);
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .55), 0 0 0 2px rgba(135, 102, 242, .88), 0 0 18px rgba(168, 137, 255, .46);
}
body.timeline-scrubbing .playhead { box-shadow: 0 0 13px rgba(168, 137, 255, .84); }
body.timeline-scrubbing .playhead span,
body.timeline-scrubbing .time-ruler { cursor: grabbing; }
body.timeline-scrubbing .timeline-playhead-handle { cursor: grabbing; }
body.timeline-scrubbing .timeline-playhead-handle::before {
    filter: brightness(1.08);
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .55), 0 0 0 2px rgba(135, 102, 242, .88), 0 0 18px rgba(168, 137, 255, .46);
}
.ruler-mark { left: calc(var(--timeline-edge-inset) + var(--time-position, 0px)); }
.timeline-handle-lane {
    height: var(--timeline-handle-lane-height);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid #292a33;
    background: linear-gradient(180deg, #12131a 0%, #0d0e13 100%);
}
.ruler-spacer { height: calc(var(--timeline-handle-lane-height) + var(--timeline-ruler-height)); }
.time-ruler { height: var(--timeline-ruler-height); }
.ruler-spacer {
    position: sticky;
    top: 0;
    z-index: 12;
    background: #0e0f14;
}
.time-ruler {
    position: sticky;
    top: var(--timeline-handle-lane-height);
    z-index: 8;
    background: linear-gradient(180deg, #111218 0%, #0d0e13 100%);
    border-bottom-color: #292a33;
    overflow: hidden;
}
.ruler-mark {
    top: 4px;
    min-width: 36px;
    color: #e2e3e9;
    font: 700 11px/1.1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
    text-align: center;
    text-shadow: 0 1px 2px #000;
}
.ruler-mark::after {
    content: "";
    position: absolute;
    top: 16px;
    left: 50%;
    width: 1px;
    height: 11px;
    background: #70727d;
}
.ruler-tick {
    position: absolute;
    left: calc(var(--timeline-edge-inset) + var(--time-position, 0px));
    bottom: 0;
    width: 1px;
    height: 5px;
    background: #383a44;
}
.ruler-tick.half { height: 8px; background: #51535e; }
.ruler-mark.edge-start { transform: none; text-align: left; }
.ruler-mark.edge-end { transform: translateX(-100%); text-align: right; }

.project-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.project-name-row input[readonly] {
    cursor: text;
    border-radius: 8px;
    transition: color .2s ease, background .2s ease;
}

.project-name-row input[readonly]:hover {
    color: #fff;
    background: rgba(255, 255, 255, .045);
}

.project-name-row.editing input {
    width: min(240px, 28vw);
    padding: 7px 10px;
    border: 1px solid rgba(139, 108, 246, .62);
    border-radius: 9px;
    background: #14151c;
    box-shadow: 0 0 0 3px rgba(116, 87, 238, .11);
}

.project-name-save {
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 11px;
    border: 1px solid rgba(172, 146, 255, .3);
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(135deg, #7558eb, #955ce8);
    box-shadow: 0 7px 20px rgba(116, 87, 238, .22);
    cursor: pointer;
}

.project-name-save:hover { filter: brightness(1.1); transform: translateY(-1px); }
.project-name-save span { font-size: 12px; }
.project-name-save b { font-size: 9px; }
.project-name-save[hidden] { display: none; }

.project-name-cancel {
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    border: 1px solid #3a3c47;
    border-radius: 9px;
    color: #c8cad2;
    background: #181920;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}
.project-name-cancel:hover,
.project-name-cancel:focus-visible {
    color: #fff;
    border-color: #545766;
    background: #21232c;
    transform: translateY(-1px);
    outline: none;
}
.project-name-cancel span { font-size: 15px; line-height: 1; }
.project-name-cancel b { font-size: 9px; }
.project-name-cancel[hidden] { display: none; }

.new-project-trigger {
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 0 11px;
    border: 1px solid #343640;
    border-radius: 9px;
    background: #17181f;
    color: #d9d9e0;
    cursor: pointer;
}
.new-project-trigger:hover { border-color: #6f5ad1; background: #1d1b29; color: #fff; }
.new-project-trigger span { color: #a88cff; font-size: 15px; line-height: 1; }
.new-project-trigger b { font-size: 9px; white-space: nowrap; }

.new-project-dialog {
    width: min(420px, calc(100% - 28px));
    padding: 27px;
    border: 1px solid #333541;
    border-radius: 18px;
    background: #121319;
    color: #f4f4f7;
    box-shadow: 0 28px 90px rgba(0,0,0,.72);
    direction: rtl;
}
.media-remove-dialog-icon { color: #ff91a5; background: rgba(225, 68, 95, .12); }
.media-remove-dialog-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.new-project-dialog-actions .confirm-media-remove:last-child { border-color: rgba(238, 83, 109, .45); color: #fff; background: linear-gradient(135deg, #b83955, #d84e68); }
.new-project-dialog-actions .confirm-media-remove:last-child:hover { background: linear-gradient(135deg, #c4415e, #e45b75); }
.new-project-dialog::backdrop { background: rgba(4,5,8,.76); backdrop-filter: blur(5px); }
.new-project-dialog .dialog-close { position: absolute; top: 13px; left: 13px; }
.new-project-dialog-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #c5b5ff;
    background: linear-gradient(135deg, rgba(116,87,238,.25), rgba(160,91,245,.12));
    font-size: 24px;
}
.new-project-dialog h2 { margin: 15px 0 7px; font-size: 18px; }
.new-project-dialog p { margin: 0; color: #9799a4; font-size: 11px; line-height: 1.8; }
.new-project-dialog-actions { display: flex; gap: 8px; margin-top: 22px; }
.new-project-dialog-actions button { flex: 1; min-height: 38px; border-radius: 9px; cursor: pointer; font-size: 10px; }
.new-project-dialog-actions button:first-child { border: 1px solid #343640; background: #191a21; color: #bfc0c8; }
.new-project-dialog-actions button:last-child { border: 0; background: linear-gradient(135deg, #7054e5, #955bea); color: #fff; font-weight: 700; }
.track-delete-dialog-icon {
    color: #ff9aaa;
    background: linear-gradient(135deg, rgba(244,92,112,.2), rgba(244,92,112,.07));
}
.track-delete-dialog-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.new-project-dialog-actions .confirm-track-delete:last-child {
    background: linear-gradient(135deg, #d84961, #f06578);
}
html[dir="ltr"] .new-project-dialog { direction: ltr; }
html[dir="ltr"] .new-project-dialog .dialog-close { left: auto; right: 13px; }

.editing-tools .lock-glyph {
    position: relative;
    display: block;
    width: 11px;
    height: 9px;
    margin: 3px auto 0;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    background: transparent;
}

.editing-tools .lock-glyph::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -7px;
    width: 7px;
    height: 7px;
    border: 1.5px solid currentColor;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
    transform: translateX(-50%);
}
.editing-tools .lock-tool:not(.is-locked) .lock-glyph::before {
    transform: translateX(-50%) rotate(-24deg);
    transform-origin: 1px 100%;
}

.ruler-spacer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--timeline-handle-lane-height) + 3px) 5px 3px;
}
.ruler-spacer .track-add-button {
    width: 100%;
    height: 24px;
    min-width: 0;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid rgba(128, 101, 244, .25);
    border-radius: 6px;
    background: rgba(116, 87, 238, .1);
    color: #bbaeff;
    cursor: pointer;
    white-space: nowrap;
}
.ruler-spacer .track-add-button:hover { border-color: rgba(151, 125, 255, .55); background: rgba(116, 87, 238, .18); color: #eee9ff; }
.track-add-button b { font-size: 9px; font-weight: 600; }
.track-add-button span { font-size: 12px; line-height: 1; }
.track-add-menu {
    position: absolute;
    z-index: 30;
    top: 33px;
    inset-inline-start: 0;
    width: 144px;
    padding: 6px;
    border: 1px solid #30313a;
    border-radius: 11px;
    background: rgba(18, 19, 25, .98);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
}
.track-add-menu[hidden] { display: none; }
.timeline-toolbar .track-add-menu button {
    width: 100%;
    height: 34px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 9px;
    color: #bfc0c8;
    text-align: start;
}
.track-add-menu button:hover { background: #20212a; color: #fff; }
.track-add-menu span { width: 18px; color: #9c86f6; text-align: center; }
.track-add-menu b { font-size: 9px; font-weight: 600; }

.clip { touch-action: none; user-select: none; cursor: grab; }
.clip.selected.duration-resizable { overflow: visible; }
.clip-resize-time {
    position: absolute;
    z-index: 30;
    top: 50%;
    left: var(--resize-label-x, 50%);
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid rgba(197, 175, 255, .72);
    border-radius: 6px;
    background: rgba(20, 16, 34, .96);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
    color: #fff;
    font: 800 12px/1.2 "Segoe UI", Tahoma, Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, -50%);
}
.clip.clip-duration-resizing .clip-resize-time { display: flex; }
.clip.clip-duration-resizing .clip-content > small { visibility: hidden; }
.clip-duration-handle {
    position: absolute;
    z-index: 35;
    top: 50%;
    width: 9px;
    height: 25px;
    display: none;
    border: 1px solid rgba(211,200,255,.82);
    border-radius: 999px;
    background: linear-gradient(180deg, #302846, #191622);
    box-shadow: 0 0 0 1px rgba(116,87,238,.22), 0 3px 8px rgba(0,0,0,.38);
    transform: translateY(-50%);
    cursor: ew-resize;
    touch-action: none;
}
.clip.selected.duration-resizable .clip-duration-handle { display: block; }
.clip-duration-handle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #efeaff, #9e87f8);
    transform: translate(-50%, -50%);
    opacity: .94;
}
.clip-duration-handle--start { inset-inline-start: 0; }
.clip-duration-handle--end { inset-inline-end: -4px; }
.clip-duration-handle:hover,
.clip-duration-handle:focus-visible {
    filter: brightness(1.22);
    outline: 1px solid rgba(183,162,255,.72);
    outline-offset: 2px;
}
.clip.clip-duration-resizing { cursor: ew-resize; transition: none !important; }
body.clip-duration-resizing { cursor: ew-resize; user-select: none; }
.clip:not(.dragging) { transition: border-color .14s ease, box-shadow .14s ease; }
.clip:active, .clip.dragging { cursor: grabbing; }
.clip.dragging {
    z-index: 25;
    opacity: .88;
    pointer-events: none;
    transform: translateY(var(--drag-y, 0));
    will-change: transform, left, right;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .45), 0 0 0 1px #aa94ff;
}
.clip.dragging.snap-active {
    border-color: #54dfbd;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .45), 0 0 0 1px #54dfbd, 0 0 18px rgba(84, 223, 189, .2);
}
.track.drop-target {
    background-color: rgba(116, 87, 238, .08);
    box-shadow: inset 0 0 0 1px rgba(146, 119, 246, .34);
}
.track-bottom-drop,
.track-labels > div.track-bottom-drop-label { display: none; }
body.timeline-dragging .track-bottom-drop {
    display: flex;
    position: sticky;
    bottom: 0;
    z-index: 5;
    width: var(--timeline-width);
    height: 38px;
    margin-top: -38px;
    align-items: center;
    justify-content: center;
    border: 1px dashed rgba(139, 117, 223, .5);
    border-radius: 7px;
    background: rgba(116, 87, 238, .06);
    color: #b5a7ee;
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
}
.track-bottom-drop.drop-target {
    border-color: #ad91ff;
    background: rgba(116, 87, 238, .23);
    color: #fff;
}
html[lang="en"] .track-bottom-drop-ar,
html:not([lang="en"]) .track-bottom-drop-en { display: none; }
body.timeline-dragging { cursor: grabbing; }

.timeline-toolbar #splitClipButton.cut-mode-active {
    color: #fff;
    background: rgba(235, 62, 91, .2);
    box-shadow: inset 0 0 0 1px rgba(255, 101, 126, .55), 0 0 15px rgba(226, 51, 81, .18);
}
.timeline-toolbar #splitClipButton.cut-range-ready {
    background: #d93350;
    box-shadow: inset 0 0 0 1px #ff8398, 0 0 18px rgba(226, 51, 81, .28);
}
.timeline-toolbar { position: relative; }
.timeline-phone-transport {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    align-items: center;
    gap: 6px;
    direction: ltr;
}
html[dir="rtl"] .timeline-phone-transport { direction: rtl; }
.timeline-toolbar .timeline-phone-transport button {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 7px;
    color: #a6a8b3;
    font-size: 12px;
}
.timeline-toolbar .timeline-phone-transport button:hover { color: #fff; background: #262331; }
.timeline-phone-transport .transport-icon { display: inline-block; direction: ltr; line-height: 1; }
html[dir="rtl"] .timeline-phone-transport .transport-icon { transform: scaleX(-1); }
.timeline-toolbar .timeline-phone-transport .timeline-phone-play {
    width: 29px;
    height: 29px;
    border-radius: 50%;
    color: #17131f;
    background: #ebe7f6;
    box-shadow: 0 4px 12px rgba(235,231,246,.15);
}
.timeline-toolbar .timeline-phone-transport .timeline-phone-play:hover { color: #100d18; background: #fff; }
.timeline-toolbar #splitClipButton {
    display: grid;
    place-items: center;
    padding: 0;
    color: #ffc0ca;
    background: #35202a;
    box-shadow: inset 0 0 0 1px #9f4b61;
}
.timeline-toolbar #splitClipButton:hover,
.timeline-toolbar #splitClipButton:focus-visible {
    color: #fff;
    background: #592938;
    box-shadow: inset 0 0 0 1px #e66b84;
}
.timeline-toolbar #toolbarDeleteClip {
    display: grid;
    place-items: center;
    color: #d5c7fb;
    background: #262036;
    box-shadow: inset 0 0 0 1px #64547f;
}
.timeline-toolbar #toolbarDeleteClip:hover,
.timeline-toolbar #toolbarDeleteClip:focus-visible {
    color: #fff;
    background: #3a2b52;
    box-shadow: inset 0 0 0 1px #a187df;
}
.timeline-toolbar #toolbarDeleteClip svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.toolbar-cut-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.cut-range-actions {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 8;
    height: 32px;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    direction: rtl;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background: rgba(20, 21, 28, .94);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .025);
}
html[dir="ltr"] .cut-range-actions { direction: ltr; }
.cut-range-actions[hidden],
body:not(.timeline-cut-mode) .cut-range-actions { display: none !important; }
.timeline-toolbar .cut-range-actions button {
    width: auto;
    min-width: 72px;
    height: 24px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    direction: rtl;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #d7d5dd;
    white-space: nowrap;
}
.timeline-toolbar .cut-range-actions .cut-preview-button {
    min-width: 116px;
    background: #217448;
    color: #f2fff6;
}
.timeline-toolbar .cut-range-actions .timeline-cut-cancel {
    width: auto;
    min-width: 58px;
    height: 24px;
    padding: 0 8px;
    border: 1px solid #55414d;
    border-radius: 7px;
    background: #2a2029;
    color: #f0cbd4;
}
html[lang="en"] .timeline-toolbar .cut-range-actions button { direction: ltr; }
.timeline-toolbar .cut-range-actions button:hover:not(:disabled) { background: rgba(255, 255, 255, .055); }
.timeline-toolbar .cut-range-actions .cut-preview-button:hover:not(:disabled) { background: #2b985f; }
.timeline-toolbar .cut-range-actions .timeline-cut-cancel:hover,
.timeline-toolbar .cut-range-actions .timeline-cut-cancel:focus-visible {
    border-color: #a96578;
    background: #3b2934;
    color: #fff;
    outline: none;
}
.timeline-toolbar .cut-range-actions button b { font-size: 10px; font-weight: 650; line-height: 1; }
.timeline-toolbar .cut-range-actions .cut-action-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    display: grid;
    place-items: center;
    margin: 0;
    background: transparent;
    color: currentColor;
}
.cut-action-icon svg {
    grid-area: 1 / 1;
    width: 15px;
    height: 15px;
}
.cut-play-glyph,
.cut-pause-glyph { fill: currentColor; }
html[dir="rtl"] .cut-play-glyph { transform: scaleX(-1); transform-origin: center; }
.cut-scissors-glyph {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.cut-pause-glyph,
.cut-preview-button.is-playing .cut-play-glyph { display: none; }
.cut-preview-button.is-playing .cut-pause-glyph { display: block; }
.timeline-toolbar .cut-range-actions .cut-apply-button:not(:disabled) {
    background: #d93350;
    color: #fff;
}
.timeline-toolbar .cut-range-actions button:disabled { cursor: default; opacity: .42; }
body.timeline-cut-mode .track,
body.timeline-cut-mode .clip { cursor: default; }
body.timeline-cut-mode .timeline-playhead-handle {
    z-index: 1;
    pointer-events: none;
}
body.timeline-cut-mode .cut-guide { z-index: 90; }
body.timeline-cut-mode .cut-start-guide { z-index: 92; }
body.timeline-cut-mode .cut-end-guide { z-index: 91; }
.cut-guide {
    position: absolute;
    z-index: 28;
    top: 0;
    bottom: 0;
    left: calc(var(--timeline-edge-inset) + var(--cut-position, 0px) - 1px);
    width: 2px;
    --cut-guide-color: #ff3f5f;
    --cut-guide-glow: rgba(255, 63, 95, .82);
    background: transparent;
    box-shadow: none;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-1px);
}
.cut-guide:not(.show),
.cut-range:not(.show) {
    display: none;
}
.cut-guide::before {
    display: none;
}
.cut-guide::after {
    content: "";
    position: absolute;
    top: var(--timeline-handle-lane-height);
    bottom: 0;
    left: 0;
    width: 2px;
    background: var(--cut-guide-color);
    box-shadow: 0 0 9px var(--cut-guide-glow);
}
.cut-guide.coincident::after { background: transparent; box-shadow: none; }
.cut-guide.show { opacity: 1; }
body.timeline-cut-mode .cut-guide.show { pointer-events: none; }
.cut-guide-handle {
    --cut-handle-offset: 0px;
    width: 24px;
    height: 23px;
    position: absolute;
    z-index: 2;
    top: calc(3px + var(--cut-handle-scroll-top, 0px));
    left: 50%;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 3px;
    background: linear-gradient(180deg, #ef4456, #b82235);
    clip-path: polygon(0 0, 100% 0, 100% 70%, 24% 70%, 0 100%);
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .5));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
    pointer-events: none;
    visibility: hidden;
    cursor: grab;
    transform: translateX(calc(-50% + var(--cut-handle-offset)));
    transition: transform .14s ease;
    touch-action: none;
}
.cut-guide.show .cut-guide-handle {
    pointer-events: auto;
    visibility: visible;
}
.cut-guide-handle:active,
.cut-guide.dragging .cut-guide-handle { cursor: grabbing; transition: none; }
.cut-start-guide {
    z-index: 30;
    --cut-guide-color: #61a931;
    --cut-guide-glow: rgba(97, 169, 49, .7);
}
.cut-start-guide::before,
.cut-start-guide .cut-guide-handle {
    background: linear-gradient(180deg, #70bd3c, #438522);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.cut-end-guide { z-index: 29; }
html[dir="rtl"] .cut-start-guide .cut-guide-handle,
html[dir="ltr"] .cut-end-guide .cut-guide-handle {
    --cut-handle-offset: 12px;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 24% 70%, 0 100%);
}
html[dir="rtl"] .cut-end-guide .cut-guide-handle,
html[dir="ltr"] .cut-start-guide .cut-guide-handle {
    --cut-handle-offset: -12px;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 76% 70%, 0 70%);
}
html[dir="rtl"] .cut-start-guide.at-start .cut-guide-handle,
html[dir="ltr"] .cut-end-guide.at-end .cut-guide-handle {
    --cut-handle-offset: -12px;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 76% 70%, 0 70%);
}
html[dir="rtl"] .cut-end-guide.at-start .cut-guide-handle,
html[dir="ltr"] .cut-start-guide.at-end .cut-guide-handle { --cut-handle-offset: -36px; }
html[dir="ltr"] .cut-start-guide.at-start .cut-guide-handle,
html[dir="rtl"] .cut-end-guide.at-end .cut-guide-handle {
    --cut-handle-offset: 12px;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 24% 70%, 0 100%);
}
html[dir="ltr"] .cut-end-guide.at-start .cut-guide-handle,
html[dir="rtl"] .cut-start-guide.at-end .cut-guide-handle { --cut-handle-offset: 36px; }
html[dir="rtl"] .cut-start-guide .cut-guide-handle {
    --cut-handle-offset: clamp(-13px, calc(var(--cut-position, 0px) - 13px), 11px);
}
html[dir="ltr"] .cut-start-guide .cut-guide-handle {
    --cut-handle-offset: clamp(-11px, calc(13px - var(--cut-position, 0px)), 13px);
}
html[dir="rtl"] .cut-start-guide.at-start .cut-guide-handle { --cut-handle-offset: -13px; }
html[dir="ltr"] .cut-start-guide.at-start .cut-guide-handle { --cut-handle-offset: 13px; }
html[dir="rtl"] .cut-guide {
    left: calc(var(--timeline-width) - var(--timeline-edge-inset) - var(--cut-position, 0px) - 1px);
    right: auto;
    transform: translateX(1px);
}
html[dir="rtl"] .cut-guide.at-start,
html[dir="ltr"] .cut-guide.at-end { margin-left: 0; }
.cut-range {
    position: absolute;
    z-index: 8;
    top: var(--cut-range-top, 25px);
    left: calc(var(--timeline-edge-inset) + var(--cut-range-start, 0px));
    width: var(--cut-range-width, 0px);
    height: var(--cut-range-height, 57px);
    border-inline: 1px solid rgba(255, 85, 112, .88);
    background: linear-gradient(90deg, rgba(37, 210, 187, .27), rgba(255, 61, 94, .28));
    box-shadow: inset 0 0 18px rgba(255, 61, 94, .1);
    pointer-events: none;
    opacity: 0;
}
.cut-range.show { opacity: 1; }
.cut-range.locked {
    background: linear-gradient(90deg, rgba(37, 210, 187, .34), rgba(255, 61, 94, .38));
    box-shadow: inset 0 0 0 1px rgba(255, 115, 137, .28), inset 0 0 22px rgba(255, 61, 94, .14);
}
html[dir="rtl"] .cut-range {
    left: calc(var(--timeline-width) - var(--timeline-edge-inset) - var(--cut-range-start, 0px) - var(--cut-range-width, 0px));
    right: auto;
}
html[dir="rtl"] .cut-range {
    background: linear-gradient(90deg, rgba(255, 61, 94, .28), rgba(37, 210, 187, .27));
}
html[dir="rtl"] .cut-range.locked {
    background: linear-gradient(90deg, rgba(255, 61, 94, .38), rgba(37, 210, 187, .34));
}

@media (max-width: 700px) {
    .timeline-toolbar .cut-range-actions button { padding-inline: 7px; }
    .timeline-toolbar .cut-range-actions button b { display: none; }
}

@media (max-width: 1280px) {
    :root {
        --rail: 68px;
        --library: 258px;
        --inspector: 270px;
        --timeline: clamp(244px, 27vh, 260px);
    }

    .topbar { grid-template-columns: calc(var(--rail) + var(--library)) minmax(180px, 1fr) auto; }
    .workspace { grid-template-columns: var(--rail) var(--library) minmax(0, 1fr) var(--inspector); }
    .timeline { grid-column: 1 / 5; }
    .inspector-toggle { display: none !important; }

    .inspector-panel {
        display: block;
        position: relative;
        grid-column: 4;
        grid-row: 1;
        min-width: 0;
        min-height: 0;
        inset: auto;
        width: auto;
        padding: 16px 0;
        scrollbar-gutter: auto;
        box-shadow: none;
        transform: none;
        transition: none;
        visibility: visible;
    }

    .inspector-head .icon-btn { display: none; }
    .workspace-backdrop.active { display: block; }
    .timeline-body { --track-label-width: 92px; }
    .track-labels b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 1099px) {
    :root {
        --rail: 64px;
        --library: 0px;
        --timeline: clamp(244px, 27vh, 260px);
    }

    .topbar { grid-template-columns: var(--rail) minmax(150px, 1fr) auto; }
    .workspace { grid-template-columns: var(--rail) minmax(0, 1fr) var(--inspector); }
    .stage-area { grid-column: 2; }
    .inspector-panel { grid-column: 3; }
    .timeline { grid-column: 1 / 4; }
    .library-panel {
        display: block;
        position: fixed;
        z-index: 50;
        top: 62px;
        bottom: 0;
        left: var(--rail);
        right: auto;
        width: min(300px, calc(100vw - var(--rail) - 12px));
        padding: 18px 15px;
        background: #101116;
        border-right: 1px solid var(--line);
        box-shadow: 22px 0 70px rgba(0, 0, 0, .48);
        transform: translateX(calc(-100% - var(--rail)));
        transition: transform .24s ease, visibility .24s;
        visibility: hidden;
    }

    .library-panel.open { transform: translateX(0); visibility: visible; }
    .panel-close { display: grid; place-items: center; }
    .tool { width: 54px; }
    .tool small { font-size: 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .timeline-body { --track-label-width: 88px; }
    .track-labels b { display: block; font-size: 8px; }
}

@media (max-width: 700px) {
    .top-actions > .icon-btn, .top-actions > .divider, .preview-button { display: none; }
    .project-title input { width: min(38vw, 190px); }
    .timeline-toolbar { padding-inline: 7px; }
    .timeline-toolbar .timeline-zoom-cycle { min-width: 66px; padding-inline: 7px; }
    .timeline-body { --track-label-width: 74px; }
    .track-labels > div:not(.ruler-spacer) { padding-inline: 6px; gap: 4px; }
    .ruler-spacer .track-add-button b { display: none; }
    .project-name-row.editing input { width: min(34vw, 170px); }
    .project-name-save, .project-name-cancel { width: 32px; padding: 0; }
    .project-name-save b, .project-name-cancel b { display: none; }
    .new-project-trigger { width: 32px; padding: 0; }
    .new-project-trigger b { display: none; }
}

@media (max-width: 600px) {
    .workspace { grid-template-rows: minmax(0, 1fr) minmax(110px, 26vh) var(--timeline); }
    .tool-rail { grid-row: 1 / 3; }
    .stage-area { grid-row: 1; }
    .inspector-panel { grid-column: 2; grid-row: 2; border-top: 1px solid var(--line); }
    .timeline { grid-row: 3; }
}

@media (max-width: 520px) {
    .workspace-backdrop { inset-block-start: 56px; }
    .library-panel { top: 56px; }
    .timeline-body { --track-label-width: 64px; }
    .track-labels b { display: block; font-size: 7px; }
}

/* Arabic mirrors the editor shell, without reversing timeline time coordinates. */
html[dir="rtl"] .workspace { direction: rtl; }
html[dir="rtl"] .editor-brand-lockup {
    justify-content: flex-end;
    padding-right: 14px;
    padding-left: 14px;
}
html[dir="rtl"] .tool-rail {
    border-right: 0;
    border-left: 1px solid var(--line);
}
html[dir="rtl"] .library-panel {
    border-right: 0;
    border-left: 1px solid var(--line);
}
html[dir="rtl"] .inspector-panel {
    border-left: 0;
    border-right: 1px solid var(--line);
}
html[dir="rtl"] .stage-toolbar,
html[dir="rtl"] .timeline-body {
    direction: ltr;
    grid-template-columns: minmax(0, 1fr) var(--track-label-width) var(--timeline-scroll-rail-width);
    grid-template-areas: "timeline-tracks track-labels vertical-rail";
}
html[dir="rtl"] .tracks-scroll,
html[dir="rtl"] .time-ruler,
html[dir="rtl"] .track { direction: ltr; }
html[dir="rtl"] .clip {
    left: auto;
    right: calc(var(--timeline-edge-inset) + var(--start) * var(--second));
}
html[dir="rtl"] .ruler-mark {
    left: auto;
    right: calc(var(--timeline-edge-inset) + var(--time-position, 0px));
    transform: translateX(50%);
}
html[dir="rtl"] .ruler-tick { left: auto; right: calc(var(--timeline-edge-inset) + var(--time-position, 0px)); }
html[dir="rtl"] .ruler-mark.edge-start { transform: none; text-align: right; }
html[dir="rtl"] .ruler-mark.edge-end { transform: translateX(100%); text-align: left; }
html[dir="rtl"] .playhead {
    left: calc(var(--timeline-width) - var(--timeline-edge-inset) - var(--playhead-position, 0px) - 1px);
    right: auto;
}
html[dir="rtl"] .playhead.at-start {
    left: calc(var(--timeline-width) - var(--timeline-edge-inset) - var(--playhead-position, 0px) - 2px);
}
html[dir="rtl"] .track-labels {
    direction: rtl;
    border-right: 0;
    border-left: 1px solid var(--line);
}

@media (max-width: 980px) {
    html[dir="rtl"] .library-panel {
        left: auto;
        right: var(--rail);
        border-right: 0;
        border-left: 1px solid var(--line);
        box-shadow: -22px 0 70px rgba(0, 0, 0, .48);
        transform: translateX(calc(100% + var(--rail)));
    }
    html[dir="rtl"] .library-panel.open { transform: translateX(0); }
}

/* Optional portrait-focused layout: the phone preview occupies the side column
   while the inspector takes over the former central preview area. */
.asset-library-tool .library-feature-icon {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(149,122,246,.26);
    border-radius: 9px;
    color: #bcaeff;
    background: linear-gradient(145deg, rgba(116,87,238,.18), rgba(52,40,91,.16));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.asset-library-tool .library-feature-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.asset-library-tool .library-feature-icon .library-shadow { opacity: .48; }
.asset-library-tool .library-feature-icon .library-play { fill: #f0eaff; stroke: none; }
.asset-library-tool .library-feature-icon .library-spark { color: #ef88c7; stroke-width: 1.8; }
.asset-library-tool:hover .library-feature-icon,
.asset-library-tool[aria-expanded="true"] .library-feature-icon {
    transform: translateY(-1px);
    border-color: rgba(190,169,255,.62);
    color: #f3efff;
    background: linear-gradient(145deg, rgba(116,87,238,.72), rgba(159,83,230,.42));
    box-shadow: 0 7px 18px rgba(102,72,211,.28), inset 0 1px 0 rgba(255,255,255,.12);
}
.phone-layout-toggle[hidden] { display: none !important; }
.stage-actions .phone-layout-toggle {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(151,125,244,.28) !important;
    border-radius: 9px;
    color: #b8a9f4;
    background: linear-gradient(145deg, rgba(116,87,238,.13), rgba(28,25,43,.72));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
.phone-layout-toggle svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.phone-layout-toggle .phone-layout-screen { fill: rgba(169,139,255,.24); stroke: none; }
.phone-layout-toggle .phone-layout-arrow { color: #eb83c5; stroke-width: 1.7; }
.phone-layout-toggle .phone-layout-speaker { stroke-width: 1.7; }
.stage-actions .phone-layout-toggle:hover {
    border-color: rgba(186,164,255,.58) !important;
    color: #f0ebff;
    background: linear-gradient(145deg, rgba(116,87,238,.35), rgba(68,45,103,.42));
    transform: translateY(-1px);
}
.stage-actions .phone-layout-toggle.is-active {
    color: #f5f1ff;
    background: linear-gradient(135deg, rgba(116,87,238,.88), rgba(157,88,236,.72));
    box-shadow: 0 0 0 1px rgba(184,161,255,.32), 0 7px 18px rgba(116,87,238,.24);
}

@media (max-width: 1099px) {
    .phone-layout-toggle { display: none !important; }
}

@media (min-width: 1100px) {
    .studio.phone-preview-layout {
        --timeline: 248px;
        --phone-preview-column: clamp(340px, 32vw, 520px);
        --phone-library-column: clamp(360px, 36vw, 570px);
        --phone-inspector-column: clamp(280px, 27vw, 430px);
    }

    .studio.phone-preview-layout .workspace {
        grid-template-columns: var(--rail) var(--phone-library-column) var(--phone-inspector-column) minmax(340px, 1fr);
        grid-template-rows: minmax(300px, 1fr) var(--timeline);
    }

    .studio.phone-preview-layout .asset-library-drawer {
        width: min(var(--phone-library-column), var(--asset-library-preview-limit, 570px));
        max-width: calc(100vw - var(--rail) - var(--phone-inspector-column) - 340px);
    }

    .studio.phone-preview-layout .library-panel .media-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .studio.phone-preview-layout .library-panel .media-card .thumb {
        height: 64px;
        margin-bottom: 4px;
        border-radius: 8px;
    }

    .studio.phone-preview-layout .library-panel .upload-drop {
        width: min(72%, 390px);
        height: 54px;
        margin-inline: auto;
        padding-block: 5px 6px;
    }

    .studio.phone-preview-layout .stage-area {
        grid-column: 4;
        grid-row: 1 / 3;
        z-index: 13;
        border-inline-start: 1px solid var(--line);
        background: radial-gradient(circle at 50% 38%, rgba(77,54,145,.16), transparent 42%), #090a0e;
    }

    .studio.phone-preview-layout .stage-toolbar {
        inset: auto;
    }

    .studio.phone-preview-layout .canvas-wrap {
        padding: 8px 12px 11px;
    }

    .studio.phone-preview-layout .preview-viewport {
        grid-template-columns: minmax(0, 1fr) auto 36px minmax(0, 1fr);
        padding-inline: 0;
    }

    .studio.phone-preview-layout .preview-dock {
        max-width: calc(100% - 34px);
        margin-top: 7px;
    }

    .studio.phone-preview-layout .inspector-panel {
        display: block;
        position: relative;
        inset: auto;
        grid-column: 3;
        grid-row: 1;
        z-index: 2;
        width: auto;
        min-width: 0;
        padding: 18px 0;
        overflow-y: auto;
        visibility: visible;
        transform: none;
        transition: none;
        border-inline: 0;
        box-shadow: none;
        background: radial-gradient(circle at 50% 10%, rgba(116,87,238,.055), transparent 35%), #101116;
    }

    .studio.phone-preview-layout .inspector-panel > * {
        width: 100%;
        max-width: 410px;
        margin-inline: auto;
    }

    .studio.phone-preview-layout .inspector-head .icon-btn { display: none; }
    .studio.phone-preview-layout .workspace-backdrop { display: none !important; }

    .studio.phone-preview-layout .timeline {
        grid-column: 1 / 4;
        grid-row: 2;
    }

    .studio.phone-preview-layout .timeline-toolbar {
        height: 33px;
        flex-basis: 33px;
    }
    .studio.phone-preview-layout .timeline-toolbar .cut-range-actions { height: 28px; padding-block: 2px; }
    .studio.phone-preview-layout .timeline-toolbar .cut-range-actions button { height: 22px; }

    .studio.phone-preview-layout .timeline-phone-transport { display: flex; }

    .studio.phone-preview-layout .timeline-body {
        --track-label-width: 82px;
        --timeline-ruler-height: 27px;
    }

    .studio.phone-preview-layout .time-ruler { height: var(--timeline-ruler-height); }

    .studio.phone-preview-layout .track,
    .studio.phone-preview-layout .track-labels > div:not(.ruler-spacer) { height: 43px; }

    .studio.phone-preview-layout .clip {
        top: 4px;
        height: 34px;
        gap: 5px;
        padding-block: 2px;
    }

    .studio.phone-preview-layout .clip-art {
        width: 34px;
        height: 26px;
        flex-basis: 34px;
    }

    .studio.phone-preview-layout .track-labels > div:not(.ruler-spacer) { padding-inline: 5px; }
    .studio.phone-preview-layout .track-delete-button { width: 19px; height: 19px; flex-basis: 19px; }
}
