* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --header-height: 60px;
    --page-bg: #000;
    --panel-bg: #080808;
    --panel-border: #1a1a1a;
    --text-muted: #666;
    --text-secondary: #aaa;
}

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--page-bg);
    color: #fff;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

header {
    height: var(--header-height);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid #222;
    position: relative;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(90deg, #fff, #888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-toggle,
.sidebar-close {
    display: none;
    border: 1px solid #2a2a2a;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-radius: 999px;
    cursor: pointer;
}

.sidebar-toggle {
    padding: 0.55rem 0.9rem;
    font-size: 0.9rem;
}

.sidebar-close {
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
}

.container {
    display: flex;
    height: calc(100vh - var(--header-height));
    min-height: 0;
}

.player-section {
    flex: 1;
    min-width: 0;
    background-color: #000;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
}

.video-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#mainPlayer {
    width: 100%;
    height: 100%;
    outline: none;
    display: block;
}

.video-title {
    margin-top: 1rem;
    padding-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ececec;
    word-break: break-word;
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
    background-color: var(--panel-bg);
    border-left: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 1.5rem 1rem;
}

.sidebar-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.video-list {
    list-style: none;
    overflow-y: auto;
    padding-bottom: 1rem;
}

.video-item {
    transition: background-color 0.2s ease;
}

.video-item a {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.video-item:hover {
    background-color: #111;
}

.video-item.active {
    background-color: #1a1a1a;
}

.video-item.active a {
    color: #fff;
    font-weight: 600;
}

.item-icon {
    margin-right: 12px;
    font-size: 0.8rem;
    opacity: 0.5;
}

.video-item.active .item-icon {
    opacity: 1;
    color: #fff;
}

.item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-video {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    text-align: center;
}

.no-video code {
    background: #222;
    padding: 2px 6px;
    border-radius: 4px;
    color: #888;
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #111 0%, #000 100%);
}

.login-card {
    background: #080808;
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid #1a1a1a;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
}

.login-card h2 {
    margin: 1.5rem 0 2rem;
    font-weight: 400;
    color: #666;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: #444;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.3s;
}

.login-btn:hover {
    opacity: 0.9;
}

.error-msg {
    color: #ff4444;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.hint {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #333;
}

.logout-link {
    margin-left: auto;
    color: #666;
    text-decoration: none;
    font-size: 0.85rem;
}

.logout-link:hover {
    color: #fff;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 992px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }

    header {
        padding: 0 1rem;
    }

    .sidebar-toggle,
    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .container {
        height: auto;
        min-height: calc(100vh - var(--header-height));
        display: block;
    }

    .player-section {
        min-height: calc(100vh - var(--header-height));
        padding: 1rem;
        padding-bottom: 2rem;
        overflow: visible;
    }

    .video-wrapper {
        border-radius: 10px;
    }

    .video-title {
        margin-top: 0.85rem;
        font-size: 1rem;
        line-height: 1.5;
        padding-bottom: 0;
    }

    .sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: min(62vh, 480px);
        border-left: none;
        border-top: 1px solid var(--panel-border);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.45);
        transform: translateY(calc(100% - 60px));
        transition: transform 0.25s ease;
        z-index: 120;
    }

    .sidebar.is-open {
        transform: translateY(0);
    }

    .sidebar-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: rgba(8, 8, 8, 0.98);
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .video-list {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .video-item a {
        padding: 0.95rem 1rem;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(0, 0, 0, 0.45);
        z-index: 110;
    }

    .sidebar-backdrop[hidden] {
        display: none;
    }
}

@media (max-width: 640px) {
    .logo {
        font-size: 1.25rem;
    }

    .sidebar-toggle {
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem;
    }

    .logout-link {
        font-size: 0.8rem;
    }
}
