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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #fff;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
}

.header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

#playlist-info {
    color: #aaa;
    font-size: 0.9rem;
}

.main {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

.player-section {
    position: sticky;
    top: 16px;
    height: fit-content;
}

.player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.player-wrapper iframe,
.player-wrapper #player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.now-playing {
    margin-top: 16px;
}

.now-playing h2 {
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 8px;
}

.now-playing p {
    color: #aaa;
    font-size: 0.95rem;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.control-btn {
    padding: 10px 20px;
    background: #272727;
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.control-btn:hover:not(:disabled) {
    background: #3a3a3a;
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.autoplay-toggle {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aaa;
    font-size: 0.9rem;
    cursor: pointer;
}

.autoplay-toggle input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.playlist-section {
    background: #181818;
    border-radius: 12px;
    overflow: hidden;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #212121;
}

.playlist-header h3 {
    font-size: 1rem;
    font-weight: 500;
}

#video-count {
    color: #aaa;
    font-size: 0.85rem;
}

.playlist {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.playlist-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #272727;
}

.playlist-item:hover {
    background: #272727;
}

.playlist-item.active {
    background: #3a3a3a;
}

.playlist-item .index {
    color: #aaa;
    font-size: 0.85rem;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playlist-item.active .index {
    color: #fff;
}

.playlist-item .thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.playlist-item .info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.playlist-item .title {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.playlist-item .meta {
    font-size: 0.8rem;
    color: #aaa;
}

@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }

    .player-section {
        position: static;
    }

    .playlist-section {
        max-height: 400px;
    }

    .playlist-item .thumbnail {
        width: 100px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .now-playing h2 {
        font-size: 1rem;
    }

    .controls {
        flex-wrap: wrap;
    }

    .autoplay-toggle {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }

    .playlist-item .thumbnail {
        width: 80px;
        height: 45px;
    }

    .playlist-item .title {
        font-size: 0.85rem;
    }
}
