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

body {
    font-family: Arial, sans-serif;
    background: #0f0f0f;
    color: #fff;
    line-height: 1.6;
}

header {
    background: #ff0000;
    padding: 20px;
    text-align: center;
}

header h1 { font-size: 2.5em; }
header p { margin-top: 6px; opacity: 0.95; }

#authArea {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

#authArea button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

#signInBtn { background: #fff; color: #111; }
#signInBtn:hover { background: #f0f0f0; }
#signOutBtn { background: #333; color: #fff; }
#signOutBtn:hover { background: #444; }
#userStatus { font-size: 13px; opacity: 0.9; }

.input-section { padding: 20px; text-align: center; }

#videoUrl {
    width: 60%;
    padding: 12px;
    font-size: 16px;
    border: none;
    border-radius: 4px 0 0 4px;
}

#analyzeBtn {
    padding: 12px 24px;
    background: #ff0000;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    border-radius: 0 4px 4px 0;
}

#analyzeBtn:hover { background: #cc0000; }

.player-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
    gap: 20px;
}

#videoContainer { flex: 1; min-width: 300px; }
#videoContainer iframe {
    width: 100%;
    max-width: 560px;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 8px;
}

#analysisPanel {
    flex: 1;
    min-width: 300px;
    background: #1a1a1a;
    padding: 20px;
    border-radius: 8px;
}

#progressBar {
    width: 100%;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

#progressFill {
    height: 100%;
    width: 0%;
    background: #00ff00;
    transition: width 0.3s;
}

#detectedTags { list-style: none; margin-top: 10px; }
#detectedTags li {
    background: #333;
    margin: 5px 0;
    padding: 8px;
    border-radius: 4px;
    display: inline-block;
    margin-right: 5px;
}

.playlist-section { padding: 20px; }

#playlistContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.playlist-item {
    background: #1a1a1a;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

.playlist-item:hover { background: #252525; }
.playlist-item img { width: 100%; border-radius: 4px; }
.playlist-item h4 { margin: 8px 0 4px; font-size: 14px; }
.playlist-item p { font-size: 12px; opacity: 0.75; }

.playlist-actions { text-align: center; }

#playAllBtn,
#openPlaylistBtn,
#createYtPlaylistBtn {
    display: inline-block;
    margin: 10px 8px;
    padding: 12px 28px;
    background: #ff0000;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
}

#playAllBtn:hover,
#openPlaylistBtn:hover,
#createYtPlaylistBtn:hover { background: #cc0000; }

#createYtPlaylistBtn:disabled { opacity: 0.6; cursor: not-allowed; }

#realPlaylistLinks { margin-top: 1rem; text-align: center; }
#realPlaylistLinks a { color: #4ade80; word-break: break-all; }

footer {
    text-align: center;
    padding: 20px;
    background: #111;
    font-size: 12px;
}

@media (max-width: 768px) {
    .player-section { flex-direction: column; }
    #videoUrl { width: 80%; border-radius: 4px; margin-bottom: 8px; }
    #analyzeBtn { border-radius: 4px; width: 80%; }
    #authArea { flex-direction: column; }
}
