:root {
    color-scheme: dark;
    --bg: #0a0a0f;
    --ink: #fafafa;
    --muted: #a1a1aa;
    --faint: #52525b;
    --violet: #a855f7;
    --violet-deep: #7c3aed;
    --violet-soft: #c084fc;
    --glass: rgba(29, 33, 37, 0.6);
    --track: #101014;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font: 16px/1.5 Inter, "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(60rem 30rem at 75% -8rem, rgba(124, 59, 237, 0.38), transparent 70%),
        radial-gradient(42rem 26rem at 5% 2rem, rgba(217, 70, 239, 0.13), transparent 70%),
        var(--bg);
    background-repeat: no-repeat;
}
body.sorting, body.sorting * { cursor: grabbing !important; }

header.bar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 56px;
    background: rgba(15, 15, 15, 0.7);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
header.bar .inner {
    max-width: 72rem;
    height: 100%;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}
.brand svg { width: 22px; height: 22px; color: var(--violet); }
.chip {
    font-size: 0.85rem;
    font-weight: 500;
    color: #ede9fe;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    background: linear-gradient(to right, rgba(139, 92, 246, 0.2), rgba(217, 70, 239, 0.2));
    box-shadow: 0 0 18px -5px rgba(167, 139, 250, 0.6);
}

main { max-width: 72rem; margin: 0 auto; padding: 3.5rem 1.25rem 4rem; }

.hero { text-align: center; margin-bottom: 2.25rem; }
.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 6px;
    background: #27272a;
    margin-bottom: 1.1rem;
}
h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.12;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin: 0 0 1rem;
}
h1 .accent {
    display: block;
    background: linear-gradient(to right, #c084fc, #a855f7, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 auto 0.5rem; max-width: 38rem; }
.sublead { color: var(--faint); margin: 0 auto 1.4rem; max-width: 36rem; }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 30px;
    padding: 0 13px 0 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    font-size: 12.5px;
    font-weight: 500;
    color: #eef0f2;
}
.pill i, .lane-name i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dot);
    box-shadow: 0 0 8px var(--dot);
}

.steps {
    display: flex;
    list-style: none;
    margin: 0 auto 2rem;
    padding: 0;
    max-width: 36rem;
}
.steps li {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--faint);
}
.steps li::before {
    content: "";
    position: absolute;
    top: 16px;
    right: 50%;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
}
.steps li:first-child::before { display: none; }
.steps b {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    background: #15151b;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.steps li.current, .steps li.done { color: var(--ink); }
.steps li.current b { background: #fff; color: #141518; box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.25); }
.steps li.done b { background: linear-gradient(135deg, var(--violet-deep), var(--violet)); color: #fff; box-shadow: none; }
.steps li.done + li::before, .steps li.current::before {
    height: 2px;
    top: 15px;
    background: linear-gradient(to right, var(--violet-deep), var(--violet));
}

.stack { display: grid; gap: 1.25rem; }
.card {
    display: grid;
    gap: 0.9rem;
    padding: 1.5rem;
    border-radius: 24px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(50px);
    backdrop-filter: blur(50px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 0; }
h2 em { font-style: normal; color: var(--violet-soft); }
.note, .sync, .status { margin: 0; color: var(--muted); font-size: 0.92rem; }
.sync { color: #d4d4d8; }

.banner {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(244, 63, 94, 0.12);
    color: #fecdd3;
    box-shadow: inset 0 0 0 1px rgba(244, 63, 94, 0.35);
    white-space: pre-wrap;
}

.drops { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 9.5rem;
    padding: 1.25rem;
    border-radius: 20px;
    border: 1.5px dashed rgba(167, 139, 250, 0.35);
    background: linear-gradient(rgba(139, 92, 246, 0.1), rgba(255, 255, 255, 0.02));
    text-align: center;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.drop.audio {
    border-color: rgba(244, 114, 182, 0.4);
    background: linear-gradient(rgba(244, 114, 182, 0.1), rgba(255, 255, 255, 0.02));
}
.drop:hover, .drop.over, .drop:focus-within {
    border-color: var(--violet);
    box-shadow: 0 0 24px -6px rgba(168, 85, 247, 0.6);
}
.drop.audio:hover, .drop.audio.over, .drop.audio:focus-within {
    border-color: #f472b6;
    box-shadow: 0 0 24px -6px rgba(244, 114, 182, 0.55);
}
.drop.has { border-style: solid; }
.drop svg { width: 28px; height: 28px; color: var(--violet-soft); }
.drop.audio svg { color: #fda4af; }
.drop strong { font-weight: 600; }
.drop .ext, .drop-status { color: var(--faint); font-size: 0.82rem; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.progress {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #7c3aed, #e879f9);
}

.zoom { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 13px; white-space: nowrap; }
.zoom input { accent-color: var(--violet); width: 120px; }

.timeline-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 16px;
    background: var(--track);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.timeline-scroll::-webkit-scrollbar { height: 10px; }
.timeline-scroll::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, 0.45); border-radius: 999px; }
.timeline-scroll::-webkit-scrollbar-track { background: transparent; }

.lane, .ruler-row { display: flex; width: max-content; min-width: 100%; align-items: stretch; }
.ruler-row { padding: 10px 16px 0 0; }
.lane { padding: 6px 16px 8px 0; }
.lane + .lane { padding-top: 0; }

.lane-label {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 118px;
    flex: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 0 12px;
    background: var(--track);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.lane-label.spacer { border-right-color: transparent; }
.lane-name { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 13px; font-weight: 600; }
.lane-label b { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }

.ruler { position: relative; height: 22px; flex: none; }
.ruler span {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 10px;
    color: #71717a;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.ruler span::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 14px;
    width: 1px;
    height: 6px;
    background: #3f3f46;
}

.track { display: flex; align-items: stretch; min-height: 76px; min-width: 160px; }
.track:empty::before {
    content: "Блоки появятся здесь";
    color: var(--faint);
    font-size: 13px;
    display: flex;
    align-items: center;
    min-height: 76px;
    padding-left: 10px;
}
.track[data-kind="video"]:empty::before { content: "Видео появится здесь"; }
.track[data-kind="audio"]:empty::before { content: "Аудио появится здесь"; }

.block {
    box-sizing: border-box;
    width: calc(var(--seconds) * var(--px, 48px));
    padding: 0 3px;
    height: 76px;
    flex: none;
    position: relative;
    touch-action: none;
    cursor: grab;
    user-select: none;
}
.block.dragging { opacity: 0.55; }
.block-inner {
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: white;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.block.video .block-inner {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 42%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 12px),
        linear-gradient(135deg, #6d28d9, #a855f7 55%, #e879f9);
}
.block.audio .block-inner {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 40%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 2px, transparent 2px 6px),
        linear-gradient(135deg, #be185d, #e11d48 42%, #fb7185);
}
.block .name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.block .dur { font-size: 12px; opacity: 0.9; font-variant-numeric: tabular-nums; }
.remove {
    position: absolute;
    top: -6px;
    right: 0;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: #18181b;
    color: #fafafa;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    opacity: 0;
    line-height: 18px;
    font-size: 13px;
}
.block:hover .remove, .block:focus-within .remove { opacity: 1; }
@media (hover: none) { .remove { opacity: 1; } }

.mix { display: grid; gap: 0.85rem; }
.fade-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
}
.check {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    cursor: pointer;
    color: var(--ink);
    font-size: 0.95rem;
}
.check input {
    margin-top: 0.2rem;
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--violet);
    flex: none;
}
.check b { font-weight: 600; }
.check small {
    display: block;
    margin-top: 0.12rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 400;
}
.fade-field {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.88rem;
    white-space: nowrap;
}
.fade-field input {
    width: 5.5rem;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #101014;
    color: var(--ink);
    font: inherit;
    padding: 0 0.7rem;
}
.fade-field input:disabled { opacity: 0.4; }
.fade-field.bad input { border-color: rgba(244, 63, 94, 0.75); }

.actions { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
button.primary, a.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    border-radius: 999px;
    padding: 0.8rem 1.5rem;
    font: 600 0.95rem/1 Inter, "Segoe UI", system-ui, sans-serif;
    color: #141518;
    background: #fafafa;
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.18);
}
button.primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
button.primary:not(:disabled):hover, a.primary:hover { box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.32); }
button.primary.busy::before {
    content: "";
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border-radius: 50%;
    border: 2px solid rgba(20, 21, 24, 0.25);
    border-top-color: #141518;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ghost {
    background: transparent;
    color: var(--muted);
    border: 0;
    font: inherit;
    cursor: pointer;
    padding: 0.4rem 0.2rem;
}
.ghost:hover { color: var(--ink); }

video {
    width: 100%;
    max-height: 520px;
    border-radius: 16px;
    background: #000;
}

footer { margin-top: 1.5rem; text-align: center; color: var(--faint); font-size: 0.82rem; }
:focus-visible { outline: 2px solid var(--violet-soft); outline-offset: 3px; }

@media (max-width: 800px) {
    main { padding-top: 2.2rem; }
    .drops { grid-template-columns: 1fr; }
    .card-head { align-items: flex-start; flex-direction: column; }
}
