/* ============================================================
   Seedance Video — scoped стили страницы (скелет как у Omni/Fish:
   hero → форма слева / заказы справа). Загружается только на
   seedance-video.php. JS-хуки (speed-btn, option-btn, upload-zone…)
   сохранены, layout-классы — sd-*.
   ============================================================ */

:root {
    --sd-grad: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    --sd-grad-soft: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(217, 70, 239, 0.18));
    --sd-card-bg: linear-gradient(180deg, rgba(28, 19, 52, 0.72), rgba(17, 11, 34, 0.72));
    --sd-card-border: rgba(139, 92, 246, 0.16);
    --sd-input-bg: rgba(7, 11, 24, 0.62);
    --sd-text: #f0f7ff;
    --sd-muted: rgba(240, 247, 255, 0.55);
    --sd-faint: rgba(240, 247, 255, 0.38);
}

.sd-shell { max-width: 1440px; }

/* ================= Hero ================= */
.sd-hero {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 26px 28px;
    margin-bottom: 20px;
    background:
        radial-gradient(circle at 88% 15%, rgba(139, 92, 246, 0.40), transparent 42%),
        radial-gradient(circle at 65% 90%, rgba(139, 92, 246, 0.30), transparent 45%),
        linear-gradient(120deg, #4c1d95 0%, #6d28d9 45%, #86198f 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 22px 60px rgba(109, 40, 217, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.sd-hero h1 { margin: 0 0 8px; font-size: 1.8rem; font-weight: 800; color: #fff; line-height: 1.15; }
.sd-hero-sub { margin: 0 0 14px; color: rgba(240, 248, 255, 0.85); font-size: 0.92rem; max-width: 560px; }
.sd-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.sd-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 13px; border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(8, 20, 40, 0.30);
    color: rgba(240, 248, 255, 0.88);
    font-size: 0.78rem; font-weight: 500;
}
.sd-hero-deco {
    position: absolute; right: 26px; top: 50%;
    transform: translateY(-50%);
    width: 108px; height: 108px;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    filter: drop-shadow(0 10px 26px rgba(139, 92, 246, 0.55));
}
.sd-hero-deco svg { width: 100%; height: 100%; }
@media (max-width: 640px) { .sd-hero-deco { display: none; } }

/* ================= Layout: форма + панель заказов ================= */
.sd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 348px;
    gap: 18px;
    align-items: start;
}
.sd-layout--single { grid-template-columns: 1fr; }
.sd-main { min-width: 0; }

.sd-card {
    background: var(--sd-card-bg);
    border: 1px solid var(--sd-card-border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.sd-card > :last-child { margin-bottom: 0; }
.sd-label {
    display: flex; align-items: center; gap: 10px;
    color: var(--sd-text); font-weight: 700; font-size: 0.95rem;
    margin-bottom: 12px;
}
.sd-step {
    width: 24px; height: 24px; border-radius: 8px;
    background: var(--sd-grad); color: #fff;
    font-size: 0.75rem; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ================= CTA ================= */
.sd-cta-wrap { margin-top: 4px; }

/* ================= Правая панель «Мои заказы» ================= */
.sd-panel {
    background: var(--sd-card-bg);
    border: 1px solid var(--sd-card-border);
    border-radius: 18px;
    padding: 16px;
    position: sticky;
    top: 110px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(217, 70, 239, 0.4) transparent;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.sd-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sd-panel-title {
    display: inline-flex; align-items: center; gap: 8px; margin: 0;
    color: #fff; font-weight: 700; font-size: 0.98rem;
}
.sd-panel-title svg { width: 17px; height: 17px; color: #a78bfa; }
.sd-panel-count {
    min-width: 24px; height: 24px; padding: 0 8px;
    border-radius: 999px; background: var(--sd-grad); color: #fff;
    font-size: 0.72rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.sd-refresh {
    width: 30px; height: 30px; border-radius: 9px; margin-left: auto;
    border: 1px solid var(--sd-card-border); background: var(--sd-input-bg);
    color: var(--sd-muted); cursor: pointer; display: grid; place-items: center;
    transition: color 0.18s, border-color 0.18s;
}
.sd-refresh:hover { color: #fff; border-color: rgba(139, 92, 246, 0.5); }
.sd-refresh svg { width: 15px; height: 15px; }

.sd-latest {
    background: var(--sd-grad-soft);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 14px;
}
.sd-latest-title { color: #fff; font-weight: 600; font-size: 0.85rem; line-height: 1.3; margin-bottom: 8px; }
.sd-video {
    width: 100%; aspect-ratio: 16 / 9;
    border-radius: 11px; background: #060b18;
    display: block;
}
.sd-latest-sub { color: var(--sd-muted); font-size: 0.72rem; margin: 8px 0 10px; }
.sd-open-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: #ddd6fe; font-size: 0.8rem; font-weight: 600; text-decoration: none;
}
.sd-open-link:hover { color: #fff; }

.sd-orders-head { color: var(--sd-muted); font-size: 0.8rem; font-weight: 600; margin-bottom: 8px; }
.sd-orders { display: flex; flex-direction: column; gap: 8px; }

.sd-order {
    display: block; text-decoration: none;
    background: rgba(12, 20, 40, 0.5);
    border: 1px solid rgba(167, 139, 250, 0.13);
    border-radius: 13px;
    padding: 10px;
    transition: border-color 0.18s;
}
.sd-order:hover { border-color: rgba(139, 92, 246, 0.4); }
.sd-order-main { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; }
.sd-order-prev {
    width: 96px; height: 62px; border-radius: 10px;
    object-fit: cover; background: #060b18; display: block;
}
.sd-order-prev-ph {
    width: 96px; height: 62px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--sd-grad-soft);
    color: rgba(255, 255, 255, 0.7);
}
.sd-order-prev-ph svg { width: 20px; height: 20px; }
.sd-order-info { min-width: 0; }
.sd-order-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem; font-weight: 600; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sd-order-sub { color: var(--sd-faint); font-size: 0.68rem; margin-top: 3px; }
.sd-order-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }

.sd-badge {
    flex-shrink: 0;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.68rem; font-weight: 600;
}
.sd-badge.ready { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.sd-badge.error { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.sd-badge.processing { background: rgba(139, 92, 246, 0.16); color: #c4b5fd; }
.sd-badge.render { background: rgba(217, 70, 239, 0.24); color: #c4b5fd; }
.sd-badge.muted { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }

.sd-orders-empty {
    text-align: center;
    padding: 1.4rem 0.8rem;
    color: var(--sd-faint);
    font-size: 0.82rem;
    border: 1px dashed rgba(167, 139, 250, 0.2);
    border-radius: 12px;
}
.sd-orders-empty svg { width: 28px; height: 28px; margin-bottom: 8px; color: rgba(167, 139, 250, 0.55); }
.sd-all-link {
    display: block;
    margin-top: 12px;
    padding: 10px;
    text-align: center;
    border-radius: 12px;
    border: 1px solid rgba(167, 139, 250, 0.22);
    background: rgba(217, 70, 239, 0.08);
    color: #a78bfa;
    font-size: 0.85rem; font-weight: 600;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
}
.sd-all-link:hover { background: rgba(217, 70, 239, 0.2); color: #fff; }

/* ================= Адаптив ================= */
@media (max-width: 1279.98px) {
    .sd-layout { grid-template-columns: 1fr; }
    .sd-panel { position: static; max-height: none; }
    .sd-orders { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .sd-orders-empty { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
    .sd-orders { grid-template-columns: 1fr; }
    .sd-hero { padding: 20px 18px; }
    .sd-hero h1 { font-size: 1.4rem; }
}

/* ================= Наследованные стили формы (бывший inline <style>) ================= */
    .form-label {
        display: block;
        color: rgba(255, 255, 255, 0.9);
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        font-weight: 500;
    }
    .alert {
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    .alert-danger {
        background: rgba(239, 68, 68, 0.1);
        border: 1px solid rgba(239, 68, 68, 0.3);
        color: #fca5a5;
    }
    .speed-toggle-container {
        display: flex;
        gap: 0.4rem;
        margin-bottom: 0.75rem;
    }
    .speed-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 0.5rem 0.75rem;
        background: rgba(30, 20, 50, 0.6);
        border: 1px solid rgba(139, 92, 246, 0.3);
        border-radius: 10px;
        color: rgba(255, 255, 255, 0.7);
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: 500;
        font-size: 0.85rem;
    }
    .speed-btn:hover {
        border-color: rgba(139, 92, 246, 0.6);
        color: white;
    }
    .speed-btn.active {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.25) 100%);
        border-color: rgba(139, 92, 246, 0.6);
        color: white;
    }
    .toggle-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    .toggle-item {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        padding: 0 16px;
        height: 44px;
        display: flex;
        align-items: center;
    }
    .sound-toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        cursor: pointer;
    }
    .sound-toggle input { display: none; }
    .toggle-slider {
        width: 40px;
        height: 22px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 11px;
        position: relative;
        transition: background 0.3s;
        flex-shrink: 0;
    }
    .toggle-slider::after {
        content: '';
        position: absolute;
        width: 18px;
        height: 18px;
        background: white;
        border-radius: 50%;
        top: 2px;
        left: 2px;
        transition: transform 0.3s;
    }
    .sound-toggle input:checked + .toggle-slider {
        background: linear-gradient(135deg, #8b5cf6, #ec4899);
    }
    .sound-toggle input:checked + .toggle-slider::after {
        transform: translateX(18px);
    }
    .toggle-label {
        display: flex;
        align-items: center;
        gap: 6px;
        color: rgba(255, 255, 255, 0.9);
        font-size: 0.85rem;
        white-space: nowrap;
    }
    .upload-zone {
        border: 2px dashed rgba(139, 92, 246, 0.4);
        border-radius: 16px;
        padding: 1.5rem;
        text-align: center;
        background: rgba(139, 92, 246, 0.05);
        transition: all 0.3s ease;
        cursor: pointer;
        min-height: 140px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .upload-zone:hover, .upload-zone.dragover {
        border-color: #8b5cf6;
        background: rgba(139, 92, 246, 0.1);
    }
    .upload-zone.has-file {
        border-style: solid;
        border-color: rgba(34, 197, 94, 0.5);
        background: rgba(34, 197, 94, 0.05);
    }
    .upload-zone-sm {
        min-height: 100px;
        padding: 1rem;
    }
    .upload-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 0.5rem;
        color: rgba(139, 92, 246, 0.6);
    }
    .upload-text {
        color: rgba(255, 255, 255, 0.8);
        font-size: 0.85rem;
        margin-bottom: 0.15rem;
    }
    .upload-hint {
        color: rgba(255, 255, 255, 0.4);
        font-size: 0.75rem;
    }
    .preview-container {
        position: relative;
        width: 100%;
    }
    .preview-image {
        width: 100%;
        max-height: 160px;
        object-fit: contain;
        border-radius: 12px;
    }
    .remove-preview {
        position: absolute;
        top: 6px;
        right: 6px;
        width: 24px;
        height: 24px;
        background: rgba(239, 68, 68, 0.9);
        border: none;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        transition: all 0.2s;
    }
    .remove-preview:hover {
        background: #ef4444;
        transform: scale(1.1);
    }
    .frames-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .frame-label {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.6);
        margin-bottom: 0.35rem;
    }
    .ref-images-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        margin-top: 8px;
    }
    .ref-img-card {
        position: relative;
        aspect-ratio: 1;
        border-radius: 10px;
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    .ref-img-card img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .ref-img-card.has-error {
        border-color: rgba(239, 68, 68, 0.8);
    }
    .ref-img-overlay {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(1px);
    }
    .ref-img-overlay-error {
        background: rgba(120, 0, 0, 0.55);
        flex-direction: column;
        gap: 6px;
        padding: 6px;
    }
    .ref-img-errtext {
        font-size: 10px;
        line-height: 1.25;
        color: #fff;
        text-align: center;
        max-height: 60%;
        overflow: hidden;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    }
    .ref-img-spinner {
        width: 22px;
        height: 22px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-top-color: #fff;
        border-radius: 50%;
        animation: refImgSpin 0.7s linear infinite;
    }
    @keyframes refImgSpin {
        to { transform: rotate(360deg); }
    }
    .ref-img-retry {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        background: rgba(255, 255, 255, 0.92);
        color: #b91c1c;
        font-size: 16px;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .ref-img-remove {
        position: absolute;
        top: 3px;
        right: 3px;
        width: 20px;
        height: 20px;
        background: rgba(239, 68, 68, 0.9);
        border: none;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 12px;
        line-height: 1;
        padding: 0;
    }
    .ref-file-list {
        margin-top: 8px;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .ref-file-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 10px;
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.8);
    }
    .ref-file-item .file-name {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .ref-file-item .file-size {
        color: rgba(255, 255, 255, 0.4);
        font-size: 0.75rem;
        flex-shrink: 0;
    }
    .ref-file-item .file-remove {
        width: 20px;
        height: 20px;
        background: rgba(239, 68, 68, 0.7);
        border: none;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 11px;
        flex-shrink: 0;
        padding: 0;
    }
    .ref-file-item .file-status {
        font-size: 0.72rem;
        padding: 2px 8px;
        border-radius: 8px;
        flex-shrink: 0;
    }
    .ref-file-item .file-status.uploading { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
    .ref-file-item .file-status.ok { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
    .ref-file-item .file-status.error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
    .ref-file-item.has-error { flex-wrap: wrap; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.05); }
    .ref-file-item .file-error-msg { flex-basis: 100%; font-size: .8rem; color: #fca5a5;
                                      margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(239,68,68,.2);
                                      line-height: 1.35; word-break: break-word; }
    .ref-file-item .ref-file-retry { background: rgba(99,102,241,.2); border: 0; color: #c4b5fd;
                                      width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
                                      font-size: 14px; line-height: 1; margin-right: 4px; }
    .ref-file-item .ref-file-retry:hover { background: rgba(99,102,241,.35); }
    .ref-file-item .ref-file-remove {
        width: 20px; height: 20px; background: rgba(239, 68, 68, 0.7); border: none;
        border-radius: 50%; cursor: pointer; color: white; font-size: 14px;
        line-height: 1; flex-shrink: 0; padding: 0;
    }
    .upload-zone.compact { padding: 12px; min-height: auto; }
    .upload-zone.compact .upload-icon { width: 28px; height: 28px; }
    .upload-zone.compact .upload-text { font-size: 0.8rem; }
    .upload-zone.compact .upload-hint { display: none; }
    .ref-add-btn {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 6px 12px;
        background: rgba(139, 92, 246, 0.1);
        border: 1px dashed rgba(139, 92, 246, 0.4);
        border-radius: 8px;
        color: rgba(139, 92, 246, 0.9);
        font-size: 0.8rem;
        cursor: pointer;
        margin-top: 8px;
        transition: all 0.2s;
    }
    .ref-add-btn:hover {
        background: rgba(139, 92, 246, 0.2);
        border-color: rgba(139, 92, 246, 0.6);
    }
    .option-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .option-btn {
        padding: 8px 14px;
        background: rgba(30, 20, 50, 0.6);
        border: 1px solid rgba(139, 92, 246, 0.3);
        border-radius: 10px;
        color: rgba(255, 255, 255, 0.7);
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: 500;
        font-size: 0.85rem;
    }
    .option-btn:hover {
        border-color: rgba(139, 92, 246, 0.6);
        color: white;
    }
    .option-btn.active {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.25) 100%);
        border-color: rgba(139, 92, 246, 0.6);
        color: white;
    }
    .duration-slider-wrap {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .duration-slider {
        flex: 1;
        -webkit-appearance: none;
        appearance: none;
        height: 6px;
        background: rgba(139, 92, 246, 0.2);
        border-radius: 3px;
        outline: none;
    }
    .duration-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, #8b5cf6, #ec4899);
        border-radius: 50%;
        cursor: pointer;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    .duration-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, #8b5cf6, #ec4899);
        border-radius: 50%;
        cursor: pointer;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    .duration-value {
        min-width: 48px;
        padding: 6px 10px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 8px;
        color: white;
        font-size: 0.9rem;
        text-align: center;
        font-weight: 500;
    }
    .section-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0.5rem;
    }
    .section-collapse-btn {
        background: none;
        border: none;
        color: rgba(139, 92, 246, 0.7);
        cursor: pointer;
        font-size: 0.8rem;
        padding: 2px 6px;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .section-collapse-btn:hover {
        color: #8b5cf6;
    }
    .section-body.collapsed {
        display: none;
    }
    .mc-slider-section { margin-top: 0.75rem; }
    .mc-slider-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
    .mc-slider-title { font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); font-weight: 500; }
    .mc-slider-arrows { display: flex; gap: 4px; }
    .mc-slider-arrow { width: 24px; height: 24px; background: rgba(139, 92, 246, 0.2); border: 1px solid rgba(139, 92, 246, 0.3); border-radius: 6px; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
    .mc-slider-arrow:hover:not(:disabled) { background: rgba(139, 92, 246, 0.4); }
    .mc-slider-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
    .mc-slider-track { display: flex; gap: 8px; overflow-x: auto; scroll-behavior: smooth; padding-bottom: 4px; -ms-overflow-style: none; scrollbar-width: none; }
    .mc-slider-track::-webkit-scrollbar { display: none; }
    .mc-slider-card { flex-shrink: 0; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; cursor: pointer; border: 2px solid transparent; position: relative; transition: all 0.2s; }
    .mc-slider-card:hover { border-color: rgba(139, 92, 246, 0.5); }
    .mc-slider-card.selected { border-color: #8b5cf6; }
    .mc-slider-card img { width: 100%; height: 100%; object-fit: cover; }
    .mc-slider-card .card-check { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; background: #8b5cf6; border-radius: 50%; display: none; align-items: center; justify-content: center; }
    .mc-slider-card.selected .card-check { display: flex; }
    .asset-form { display: none; }
    .video-form { display: block; }

    .mode-toggle {
        display: flex;
        gap: 0;
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid rgba(139, 92, 246, 0.25);
        background: rgba(30, 20, 50, 0.4);
    }
    .mode-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 16px;
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.5);
        cursor: pointer;
        font-size: 0.9rem;
        font-weight: 500;
        transition: all 0.25s ease;
        position: relative;
    }
    .mode-btn:hover { color: rgba(255, 255, 255, 0.8); }
    .mode-btn.active {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(217, 70, 239, 0.25));
        color: #fff;
    }
    .mode-btn.active::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 20%;
        right: 20%;
        height: 2px;
        background: linear-gradient(90deg, #8b5cf6, #d946ef);
        border-radius: 1px;
    }
    .mode-hint {
        font-size: 0.82rem;
        color: rgba(255, 255, 255, 0.65);
        margin-top: 8px;
        line-height: 1.45;
        padding: 8px 12px;
        background: rgba(139, 92, 246, 0.08);
        border-left: 2px solid rgba(139, 92, 246, 0.4);
        border-radius: 0 8px 8px 0;
    }
    .frames-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .frames-note {
        font-size: 0.78rem;
        color: rgba(255, 255, 255, 0.4);
        margin-top: 6px;
        line-height: 1.4;
    }
    @media (max-width: 576px) {
        .frames-row { grid-template-columns: 1fr; }
    }

    .photo-upload-zone {
        min-height: 180px;
        border: 2px dashed rgba(139, 92, 246, 0.5);
        border-radius: 16px;
        padding: 2rem;
        text-align: center;
        background: rgba(139, 92, 246, 0.06);
        transition: all 0.3s ease;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .photo-upload-zone:hover, .photo-upload-zone.dragover {
        border-color: #8b5cf6;
        background: rgba(139, 92, 246, 0.12);
    }
    .photo-upload-zone.has-file {
        border-style: solid;
        border-color: rgba(34, 197, 94, 0.5);
        background: rgba(34, 197, 94, 0.05);
    }
    .photo-upload-zone .preview-image {
        max-height: 220px;
    }
    @media (max-width: 576px) {
        .container.my-5 {
            padding-left: 8px !important;
            padding-right: 8px !important;
            margin-top: 0.5rem !important;
            margin-bottom: 0.5rem !important;
        }
        .card-header-custom {
            border-radius: 16px 16px 0 0 !important;
            padding: 0.75rem 1rem !important;
        }
        .card-header-custom h1 { font-size: 1.3rem !important; }
        .card-header-custom p { font-size: 0.8rem !important; margin-top: 0.25rem !important; }
        .card-body-custom { padding: 0.75rem !important; }
        .form-label { font-size: 0.85rem !important; margin-bottom: 0.35rem !important; }
        .frames-grid { gap: 0.5rem; }
        .speed-toggle-container { gap: 0.3rem; }
        .speed-btn { padding: 0.45rem 0.5rem; font-size: 0.75rem; }
        .option-btn { padding: 6px 10px; font-size: 0.8rem; }
        .toggle-row { gap: 0.4rem; }
        .toggle-item { padding: 0 10px; height: 40px; }
        .toggle-label { font-size: 0.8rem; }
        .ref-images-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
        .frames-row { grid-template-columns: 1fr; }
        .params-row { flex-direction: column; gap: 0.5rem; }
    }
    /* ── Compact form layout ── */
    .frames-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 0.6rem;
    }
    .video-form .mb-3 { margin-bottom: 0.6rem !important; }
    .video-form .mb-4 { margin-bottom: 0.75rem !important; }
    .photo-upload-zone { min-height: 110px !important; padding: 1rem !important; }
    .refs-group {
        border: 1px solid rgba(139, 92, 246, 0.18);
        border-radius: 12px;
        overflow: hidden;
    }
    .refs-item {
        padding: 0.45rem 0.75rem;
        border-bottom: 1px solid rgba(139, 92, 246, 0.12);
    }
    .refs-item:last-child { border-bottom: none; }
    .refs-item .section-header { margin-bottom: 0; }
    .refs-item .section-body { padding-top: 0.4rem; }
    .params-row {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        align-items: flex-start;
    }
    .params-col { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
    .params-col-wide { flex: 1; min-width: 0; }
    .duration-compact { gap: 6px; }
    .duration-compact .duration-slider { flex: 1; min-width: 80px; }
    .params-sublabel {
        font-size: 0.78rem;
        color: rgba(255,255,255,0.45);
        font-weight: 500;
        letter-spacing: 0.02em;
    }
    .toggle-row.mb-1 { margin-bottom: 0.5rem !important; }
    .toggle-item-wrap {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    .toggle-desc {
        font-size: 0.74rem;
        color: rgba(255, 255, 255, 0.38);
        line-height: 1.4;
        padding: 0 4px;
        max-width: 220px;
    }
    .frames-row .upload-zone {
        height: 160px;
        min-height: 0;
        padding: 0.75rem;
        overflow: hidden;
        position: relative;
    }
    .frame-select-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.7);
        z-index: 9999;
        display: flex;
        align-items: center;
        justify-content: center;
        animation: fadeIn 0.15s ease;
    }
    @keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
    .frame-select-dialog {
        background: #180f2a;
        border: 1px solid rgba(139,92,246,0.35);
        border-radius: 18px;
        padding: 1.25rem;
        max-width: 300px;
        width: 90%;
        text-align: center;
        box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    }
    .frame-select-title {
        font-size: 0.95rem;
        font-weight: 600;
        color: rgba(255,255,255,0.9);
        margin-bottom: 0.75rem;
    }
    .frame-select-thumb {
        width: 100%;
        height: 110px;
        object-fit: cover;
        border-radius: 10px;
        margin-bottom: 0.85rem;
        border: 1px solid rgba(139,92,246,0.2);
    }
    .frame-select-btns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .frame-select-btn {
        background: rgba(139,92,246,0.12);
        border: 1px solid rgba(139,92,246,0.3);
        color: rgba(255,255,255,0.85);
        border-radius: 10px;
        padding: 0.55rem 0.4rem;
        font-size: 0.8rem;
        cursor: pointer;
        transition: all 0.18s;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
    .frame-select-btn:hover {
        background: rgba(139,92,246,0.28);
        border-color: #8b5cf6;
        color: #fff;
    }
    .frame-select-btn svg { opacity: 0.75; }
    .frame-select-cancel {
        margin-top: 0.65rem;
        background: none;
        border: none;
        color: rgba(255,255,255,0.35);
        font-size: 0.78rem;
        cursor: pointer;
        display: block;
        width: 100%;
        padding: 0.25rem;
        transition: color 0.15s;
    }
    .frame-select-cancel:hover { color: rgba(255,255,255,0.6); }
    .frames-row .preview-container {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
    }
    .frames-row .preview-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 10px;
        max-height: none;
    }
    .frames-row .remove-preview {
        top: 6px;
        right: 6px;
        z-index: 2;
    }
    .frames-row .upload-zone > div:first-child {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }
    .upload-zone-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0.5rem;
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    .frames-mode-toggle { margin: 0; }
    .frames-mode-toggle .toggle-label { color: rgba(255,255,255,0.6); }
    .conflict-note {
        background: rgba(234, 179, 8, 0.08);
        border: 1px solid rgba(234, 179, 8, 0.28);
        border-radius: 10px;
        padding: 0.6rem 0.85rem;
        font-size: 0.8rem;
        color: rgba(234, 179, 8, 0.85);
        margin-bottom: 0.75rem;
        display: flex;
        align-items: flex-start;
        gap: 8px;
        line-height: 1.45;
    }
    .conflict-note svg { flex-shrink: 0; margin-top: 1px; }
    .mode-switch-note {
        background: rgba(139, 92, 246, 0.08);
        border: 1px solid rgba(139, 92, 246, 0.2);
        border-radius: 10px;
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
        color: rgba(139, 92, 246, 0.8);
        margin-bottom: 0.75rem;
        animation: noteFade 2.8s ease forwards;
    }
    @keyframes noteFade { 0%,55%{opacity:1;} 100%{opacity:0;} }
