@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
    --bg: #070b12;
    --panel: #0d1420;
    --line: #1d2b3d;
    --muted: #738398;
    --white: #edf6ff;
    --cyan: #55dcff;
    --blue: #286cff;
    --red: #ff405c;
    --player: #000
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: radial-gradient(ellipse at 12% 5%, #112033 0, transparent 42%), var(--bg);
    color: var(--white);
    font-family: 'Space Grotesk', Arial, sans-serif;
    min-height: 100vh
}

.app {
    max-width: 1600px;
    margin: auto;
    padding: 22px 34px 42px
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding: 0 0 18px;
    margin-bottom: 22px
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1.8px
}

.brand small {
    font: 10px 'Space Mono', monospace;
    color: #8293a9;
    letter-spacing: 1.5px;
    border-left: 1px solid #344459;
    padding-left: 10px;
    margin-left: 4px
}

.brand-symbol {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid #315b83;
    color: var(--cyan);
    border-radius: 8px;
    font: 700 13px 'Space Mono', monospace;
    background: #102238
}

.topmeta {
    font: 10px 'Space Mono', monospace;
    color: #7c90a7;
    letter-spacing: 1px
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #50e6a2;
    box-shadow: 0 0 12px #50e6a2;
    margin-right: 8px
}

.divider {
    padding: 0 12px;
    color: #334457
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 26px;
    align-items: start
}

.preview-column {
    width: 100%;
    min-width: 0
}

.player-shell {
    width: 100%;
    background: #080b10;
    border: 1px solid #182638;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 26px 80px #0008
}

.stage-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden
}

.stage-frame canvas {
    position: absolute;
    display: block;
    height: 100%;
    width: 100%;
    inset: 0;
    object-fit: contain;
    background: #000
}

.stage-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, #02071132, transparent 16%, transparent 73%, #02071188);
    z-index: 1
}

.stage-label,
.stage-bottom {
    position: absolute;
    left: 3.5%;
    right: 3.5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font: 10px 'Space Mono', monospace;
    letter-spacing: 1.6px;
    color: #a9bed4;
    pointer-events: none;
    z-index: 2
}

.stage-label {
    top: 3.6%
}

.stage-label span:first-child {
    color: #dff8ff;
    font-weight: 700
}

.stage-bottom {
    bottom: 13.5%;
    color: #78b9d6
}

.player-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    padding: 0 14px 10px;
    background: linear-gradient(0deg, #000e, transparent);
    transition: opacity .2
}

.progress-line {
    height: 16px;
    display: flex;
    align-items: center;
    margin: 0 -3px 2px
}

.progress-line input {
    width: 100%;
    height: 4px;
    margin: 0;
    appearance: none;
    background: linear-gradient(90deg, #ff4141 0%, #ff4141 var(--progress, 0%), #ffffff55 var(--progress, 0%), #ffffff55 100%);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: height .12s
}

.progress-line:hover input {
    height: 7px
}

.progress-line input::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff4545;
    opacity: 0;
    transition: opacity .1s
}

.progress-line:hover input::-webkit-slider-thumb {
    opacity: 1
}

.progress-line input::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 0;
    border-radius: 50%;
    background: #ff4545;
    opacity: 0
}

.progress-line:hover input::-moz-range-thumb {
    opacity: 1
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px
}

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

.icon-control,
.text-control {
    border: 0;
    background: transparent;
    color: #f3f8ff;
    cursor: pointer;
    border-radius: 7px;
    height: 34px;
    min-width: 34px;
    display: grid;
    place-items: center;
    font-size: 18px;
    transition: background .15s
}

.icon-control:hover,
.text-control:hover {
    background: #ffffff22
}

.text-control {
    font: 12px 'Space Mono', monospace;
    padding: 0 9px
}

.video-time {
    font: 11px 'Space Mono', monospace;
    color: #e1eaf3;
    white-space: nowrap;
    margin-left: 3px
}

.volume-control {
    width: 78px;
    height: 4px;
    accent-color: #fff;
    cursor: pointer
}

.below-player {
    padding: 18px 20px 16px
}

.video-title {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.35px
}

.video-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px
}

.channel-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #11273b;
    border: 1px solid #28516e;
    color: #55dcff;
    font: 700 12px 'Space Mono', monospace
}

.video-meta strong {
    display: block;
    font-size: 13px
}

.video-meta small {
    display: block;
    font-size: 10px;
    color: #778ca4;
    margin-top: 3px
}

.film-chip {
    margin-left: auto;
    border: 1px solid #263c52;
    border-radius: 20px;
    padding: 6px 10px;
    font: 9px 'Space Mono', monospace;
    color: #6e9ab8;
    letter-spacing: .7px
}

.video-description {
    margin: 12px 0 0;
    background: #101821;
    border-radius: 10px;
    padding: 12px 14px;
    color: #91a5bb;
    font-size: 12px;
    line-height: 1.6
}

.side-panel {
    padding: 15px 0 0;
    min-width: 0
}

.playlist-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start
}

.playlist-head small {
    font: 10px 'Space Mono', monospace;
    color: #6e8aa4;
    letter-spacing: 2px
}

.playlist-head h1 {
    font-size: clamp(36px, 3.4vw, 52px);
    line-height: .97;
    letter-spacing: -2.5px;
    margin: 14px 0 0;
    font-weight: 600
}

.edition {
    font: 10px 'Space Mono', monospace;
    color: #5e7892;
    text-align: right;
    line-height: 1.8;
    border-left: 1px solid #1b2a3c;
    padding-left: 12px
}

.intro {
    color: #9aadc2;
    font-size: 12px;
    line-height: 1.65;
    margin: 18px 0 18px
}

.scene-list {
    display: grid;
    gap: 7px;
    max-height: calc(100vh - 290px);
    overflow: auto;
    padding-right: 4px
}

.scene-card {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 11px;
    border: 1px solid #172435;
    border-radius: 10px;
    background: #0b121d;
    cursor: pointer;
    transition: transform .2s, border .2s, background .2s
}

.scene-card:hover {
    transform: translateX(3px);
    border-color: #2c4c67
}

.scene-card.active {
    background: linear-gradient(110deg, #12263a, #0d1622);
    border-color: #2b82ac;
    box-shadow: inset 3px 0 #50dcff
}

.scene-index {
    font: 11px 'Space Mono', monospace;
    color: #59738d
}

.scene-card.active .scene-index {
    color: #65dcff
}

.scene-title {
    font-size: 12px;
    font-weight: 600
}

.scene-sub {
    font: 8px 'Space Mono', monospace;
    color: #6c8096;
    margin-top: 3px;
    letter-spacing: .7px
}

.scene-duration {
    font: 9px 'Space Mono', monospace;
    color: #71869a
}

.panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #1a293b;
    margin-top: 16px;
    padding-top: 13px;
    color: #5e7890;
    font: 9px 'Space Mono', monospace;
    letter-spacing: 1px
}

.footer-mark {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a9d9ee;
    font-size: 11px
}

.footer-mark .brand-symbol {
    width: 23px;
    height: 23px;
    font-size: 9px;
    border-radius: 6px
}

.export-box {
    border: 1px solid #1a3043;
    background: #0b131e;
    border-radius: 10px;
    padding: 12px;
    margin-top: 14px
}

.export-button {
    width: 100%;
    border: 1px solid #2a6c8e !important;
    color: #7ddfff !important;
    background: #102333;
    border-radius: 8px;
    padding: 12px 14px;
    font: 10px 'Space Mono', monospace;
    cursor: pointer
}

.export-button:hover {
    background: #173247
}

.export-button span {
    color: #ff4966;
    margin-right: 6px
}

.export-box small {
    display: block;
    color: #60778e;
    font-size: 9px;
    line-height: 1.5;
    margin-top: 8px
}

.speed-menu {
    display: none;
    position: fixed;
    z-index: 20;
    bottom: 90px;
    right: 40px;
    background: #141d29;
    border: 1px solid #2a3a4d;
    border-radius: 10px;
    box-shadow: 0 12px 40px #0009;
    padding: 6px;
    min-width: 120px
}

.speed-menu.open {
    display: grid
}

.speed-menu button {
    border: 0;
    background: transparent;
    color: #e8f3fc;
    text-align: left;
    padding: 9px 12px;
    border-radius: 6px;
    font: 11px 'Space Mono', monospace;
    cursor: pointer
}

.speed-menu button:hover,
.speed-menu button.selected {
    background: #22374d;
    color: #64dfff
}

.player-shell.theater {
    position: fixed;
    inset: 3vh 2vw;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 0 0 0 100vmax #000e
}

.player-shell.theater .stage-frame {
    width: 100%;
    max-height: calc(100vh - 7vh);
    aspect-ratio: 16/9
}

.player-shell.theater .below-player {
    display: none
}

.player-shell.theater+.side-panel {
    display: none
}

body.theater-active .app {
    max-width: none
}

body.theater-active .layout {
    grid-template-columns: 1fr
}

body.theater-active .side-panel {
    display: none
}

@media(max-width:1050px) {
    .app {
        padding: 16px
    }

    .layout {
        grid-template-columns: 1fr;
        gap: 16px
    }

    .side-panel {
        padding: 0
    }

    .scene-list {
        grid-template-columns: 1fr 1fr;
        max-height: none
    }

    .playlist-head h1 {
        font-size: 46px
    }

    .preview-column {
        max-width: 1100px;
        margin: auto
    }
}

@media(max-width:560px) {
    .app {
        padding: 10px
    }

    .topmeta {
        display: none
    }

    .stage-frame {
        aspect-ratio: 16/9
    }

    .controls-row {
        gap: 5px
    }

    .controls-left,
    .controls-right {
        gap: 2px
    }

    .volume-control {
        width: 46px
    }

    .video-time {
        font-size: 9px
    }

    .icon-control {
        min-width: 29px;
        height: 30px
    }

    .below-player {
        padding: 14px
    }

    .video-title {
        font-size: 17px
    }

    .film-chip {
        font-size: 7px;
        padding: 5px 7px
    }

    .scene-list {
        grid-template-columns: 1fr
    }

    .playlist-head h1 {
        font-size: 42px
    }

    .stage-label,
    .stage-bottom {
        font-size: 8px
    }

    .speed-menu {
        right: 12px;
        bottom: 75px
    }
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important
}