/* ========================
   RESET & VARIABLES
======================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #080c1a;
    --surface: rgba(15, 23, 42, 0.75);
    --surface2: rgba(30, 40, 65, 0.7);
    --border: rgba(148, 163, 184, 0.12);
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --accent: #c084fc;
    --text: #f1f5f9;
    --text2: #94a3b8;
    --red: #f87171;
    --radius: 14px;
    --blur: blur(18px);
    --trans: 0.2s ease;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================
   BACKGROUND BLOBS
======================== */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #6366f1, transparent);
    top: -150px;
    left: -100px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #c084fc, transparent);
    bottom: -100px;
    right: -80px;
}

/* ========================
   APP LAYOUT
======================== */
.app {
    position: relative;
    z-index: 1;
    max-width: 1300px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 1.25rem;
}

/* ========================
   HEADER
======================== */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    padding: 0.9rem 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, #a5b4fc 0%, #e879f9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ========================
   BUTTONS
======================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--trans);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
    color: #fff;
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover:not(:disabled) {
    background: var(--surface2);
}

/* ========================
   MAIN LAYOUT
======================== */
main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
    min-height: 0;
}

/* ========================
   VIDEO AREA
======================== */
.video-area {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 400px;
}

/* Drop zone */
.drop-zone {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--trans);
    border: 2px dashed transparent;
    border-radius: var(--radius);
    padding: 3rem;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.drop-content {
    text-align: center;
    pointer-events: none;
}

.upload-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.upload-icon svg {
    width: 36px;
    height: 36px;
}

.drop-content h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.drop-content p {
    color: var(--text2);
    font-size: 0.9rem;
}

/* Player */
.player-wrap {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sub-overlay {
    position: absolute;
    bottom: 8%;
    left: 0;
    right: 0;
    text-align: center;
    pointer-events: none;
    padding: 0 5%;
    transition: bottom 0.2s ease;
}

.sub-text {
    display: inline-block;
    /* dynamic vars injected by JS */
    font-family: var(--sub-font, 'Inter', sans-serif);
    font-size: var(--sub-size, 24px);
    font-weight: var(--sub-weight, 600);
    color: var(--sub-color, #fff);
    background-color: var(--sub-bg, rgba(0, 0, 0, 0.6));
    padding: 0.2em 0.6em;
    border-radius: 4px;
    line-height: 1.5;
    max-width: 90%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Progress overlay */
.progress-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 26, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    border-radius: var(--radius);
    z-index: 5;
}

.loader-circle {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#progress-label {
    color: var(--text);
    font-weight: 500;
}

.progress-track {
    width: 280px;
    height: 6px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-dark), var(--accent));
    border-radius: 99px;
    width: 0%;
    transition: width 0.4s ease;
}

/* ========================
   SIDE PANEL
======================== */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.panel::-webkit-scrollbar {
    width: 4px;
}

.panel::-webkit-scrollbar-thumb {
    background: var(--surface2);
    border-radius: 4px;
}

.panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.section-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text2);
    margin-bottom: -0.25rem;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
}

/* Fields */
.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field label {
    font-size: 0.85rem;
    color: var(--text2);
}

.input-control {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 0.85rem;
    border-radius: 9px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.input-control:focus {
    border-color: var(--primary);
}

/* Range slider */
.slider {
    width: 100%;
    height: 5px;
    background: var(--surface2);
    border-radius: 99px;
    appearance: none;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

/* Color pickers */
.color-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.color-pick {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 0.35rem 0.6rem;
}

input[type="color"] {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-pick span {
    font-family: monospace;
    font-size: 0.78rem;
    color: var(--text2);
}

/* Hint text */
.hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text2);
    margin-top: -0.25rem;
}

/* ========================
   UTILITIES
======================== */
.hidden {
    display: none !important;
}

/* ========================
   RESPONSIVE
======================== */
@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }

    .video-area {
        min-height: 260px;
    }

    .panel {
        max-height: none;
    }
}