:root {
    --bg-dark: #07090e;
    --bg-card: rgba(255, 255, 255, 0.02);
    --border-glass: rgba(255, 255, 255, 0.06);
    --text-primary: #f1f3f9;
    --text-secondary: #8c9bb0;
    --primary-color: #6c5ce7;
    --primary-glow: rgba(108, 92, 231, 0.4);
    --accent-color: #a29bfe;
    --hover-bg: rgba(255, 255, 255, 0.05);
    --active-bg: rgba(108, 92, 231, 0.15);
    --transition-speed: 0.25s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Glow Effects */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.25;
}

.bg-glow-left {
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    top: -150px;
    left: -150px;
}

.bg-glow-right {
    background: radial-gradient(circle, #0984e3 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
}

/* Glassmorphism Wrapper */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Core Layout */
.app-container {
    display: flex;
    width: 95vw;
    height: 90vh;
    max-width: 1400px;
    max-height: 850px;
    gap: 24px;
    z-index: 10;
}

/* Sidebar Styling */
.sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.episode-select {
    width: 100%;
    background: rgba(13, 16, 27, 0.85);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.episode-select:hover, .episode-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

.episode-select option {
    background: #0d101b;
    color: #f3f4f6;
}

.clips-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Custom Scrollbar for Sidebar */
.clips-list::-webkit-scrollbar {
    width: 6px;
}

.clips-list::-webkit-scrollbar-track {
    background: transparent;
}

.clips-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.clips-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Sidebar List Item Card */
.clip-item {
    display: flex;
    flex-direction: column;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid transparent;
    transition: all var(--transition-speed) ease;
}

.clip-item:hover {
    background: var(--hover-bg);
    border-color: rgba(255, 255, 255, 0.04);
}

.clip-item.active {
    background: var(--active-bg);
    border-color: rgba(108, 92, 231, 0.3);
}

.clip-item.active .clip-meta-title {
    color: var(--text-primary);
    font-weight: 600;
}

.clip-item-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.clip-meta-title {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition-speed);
}

.clip-duration {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: monospace;
}

/* Main Workspace */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Viewport Card */
.viewport-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    overflow: hidden;
}

.canvas-wrapper {
    width: 100%;
    height: calc(100% - 30px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#viewport {
    max-height: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background-color: #000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.viewport-status {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.viewport-overlay-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 10;
}

.canvas-wrapper:hover .viewport-overlay-btn {
    opacity: 0.85;
}

.viewport-overlay-btn:hover {
    opacity: 1 !important;
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.75);
    border-color: var(--accent-glow);
}

/* Fullscreen Mode Styling */
.viewport-card:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    background: #000 !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewport-card:fullscreen .canvas-wrapper {
    width: 100vw;
    height: 100vh;
}

.viewport-card:fullscreen #viewport {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    box-shadow: none;
}

.viewport-card:fullscreen .viewport-status {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 16px;
    border-radius: 20px;
    backdrop-filter: blur(6px);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.viewport-card:fullscreen:hover .viewport-status {
    opacity: 1;
}

/* Controls Card */
.controls-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Seeker Container */
.seeker-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.time-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    width: 45px;
    font-family: monospace;
}

#currentTimeLabel {
    text-align: right;
}

.seek-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: height 0.15s ease;
}

.seek-track:hover {
    height: 8px;
}

.seek-track:hover .seek-handle {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
}

.seek-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: 4px;
    position: absolute;
    top: 0;
    left: 0;
}

.seek-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 14px;
    height: 14px;
    background: var(--text-primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary-glow);
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    opacity: 0;
}

.seek-tooltip {
    position: absolute;
    bottom: 18px;
    left: 0;
    transform: translateX(-50%);
    background: rgba(13, 16, 27, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 3px 6px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    z-index: 100;
}

/* Controls Layout */
.controls-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.controls-right {
    justify-content: flex-end;
}

.controls-middle {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
    gap: 16px;
}

/* Button Stylings */
.control-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.15rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-speed) ease;
}

.control-btn:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.play-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border: none;
    color: var(--text-primary);
    font-size: 1.35rem;
    cursor: pointer;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 8px 24px var(--primary-glow);
    transition: all var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 28px rgba(108, 92, 231, 0.6);
}

.play-btn:active {
    transform: scale(0.95);
}

/* Volume Slider Overlay styling */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
}

/* Loading indicators */
.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 12px;
    color: var(--text-secondary);
}

.loading-placeholder i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

/* Mode Toggle Container & Buttons */
.mode-toggle-card {
    display: flex;
    padding: 12px 16px;
    gap: 10px;
    border-bottom: 1px solid var(--border-glass);
}

.mode-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition-speed);
}

.mode-btn:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.mode-btn.active {
    background: var(--active-bg);
    border-color: rgba(108, 92, 231, 0.3);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.15);
}

/* Top Nav Link to Curator */
.top-nav-curator-link {
    font-size: 0.75rem;
    color: var(--accent-color);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.top-nav-curator-link:hover {
    background: rgba(108, 92, 231, 0.25);
    color: #ffffff;
    border-color: rgba(108, 92, 231, 0.5);
}

/* Master Episode Export Button */
.btn-export-episode {
    width: 100%;
    margin-top: 10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-export-episode:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
}
.btn-export-episode:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Clip Transition Settings Strip in Sidebar */
.clip-transition-strip {
    margin-top: 8px;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.transition-strip-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.step-input-group {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}
.step-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 18px;
    height: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.step-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}
.trim-input {
    width: 48px;
    background: transparent;
    border: none;
    color: #38bdf8;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: bold;
    text-align: center;
    padding: 0;
    -moz-appearance: textfield;
}
.trim-input::-webkit-outer-spin-button,
.trim-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.toggle-intro-btn {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.toggle-intro-btn.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    color: #ffffff;
}
.toggle-intro-btn:hover {
    color: #ffffff;
}

/* ==========================================================================
   Mobile Responsive Experience (DDMA Mobile Infographics View)
   ========================================================================== */
@media (max-width: 860px) {
    body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        min-height: 100vh !important;
        display: block !important;
        padding: 0.6rem 0.6rem 2.5rem !important;
    }

    .bg-glow {
        width: 280px !important;
        height: 280px !important;
    }

    .app-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        max-width: 520px !important;
        max-height: none !important;
        margin: 0 auto !important;
        gap: 12px !important;
    }

    /* Workspace on Mobile - Placed FIRST for immediate player view */
    .workspace {
        width: 100% !important;
        gap: 10px !important;
        order: 1 !important;
    }

    /* Viewport Card on Mobile */
    .viewport-card {
        padding: 8px !important;
        border-radius: 16px !important;
        width: 100% !important;
    }

    .canvas-wrapper {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    #viewport {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: 12px !important;
        cursor: pointer;
    }

    .viewport-overlay-btn {
        opacity: 0.9 !important;
        width: 34px !important;
        height: 34px !important;
        top: 8px !important;
        right: 8px !important;
    }

    .viewport-status {
        margin-top: 6px !important;
        font-size: 0.75rem !important;
    }

    /* Controls Panel on Mobile */
    .controls-card {
        padding: 12px 14px !important;
        border-radius: 16px !important;
    }

    .seeker-container {
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .seek-track {
        height: 8px !important;
    }

    .time-label {
        font-size: 0.75rem !important;
        min-width: 32px !important;
    }

    .controls-layout {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 6px !important;
    }

    .controls-middle {
        gap: 12px !important;
    }

    .play-btn {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.15rem !important;
    }

    .control-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.85rem !important;
    }

    /* Hide desktop volume slider on mobile, retain mute button */
    .volume-slider {
        display: none !important;
    }

    .volume-container {
        gap: 0 !important;
    }

    /* Sidebar on Mobile - Placed SECOND below the controls */
    .sidebar {
        width: 100% !important;
        height: auto !important;
        border-radius: 16px !important;
        order: 2 !important;
    }

    .sidebar-header {
        padding: 14px !important;
    }

    .sidebar-header h2 {
        font-size: 1.15rem !important;
    }

    .top-nav-curator-link {
        font-size: 0.72rem !important;
        padding: 4px 8px !important;
    }

    .episode-select {
        padding: 9px 10px !important;
        font-size: 0.85rem !important;
    }

    .btn-export-episode {
        font-size: 0.8rem !important;
        padding: 8px 12px !important;
    }

    .mode-toggle-card {
        padding: 8px 12px !important;
    }

    .mode-btn {
        padding: 7px 10px !important;
        font-size: 0.75rem !important;
    }

    .clips-list {
        max-height: 420px !important;
        padding: 10px !important;
        gap: 8px !important;
    }

    .clip-item {
        padding: 10px 12px !important;
        border-radius: 10px !important;
    }

    .clip-meta-title {
        font-size: 0.85rem !important;
    }
}
