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

:root {
    --active-color: #ffeb3b;
    /* z-index scale */
    --z-base: 1;
    --z-footer: 999;
    --z-settings-btn: 1000;
    --z-overlay: 9999;
    --z-modal: 10000;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    pointer-events: none;
}

.countdown-overlay.active {
    display: flex;
}

.countdown-number {
    font-size: 20em;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 50px rgba(255, 235, 59, 0.8),
                 0 0 100px rgba(255, 235, 59, 0.5),
                 0 10px 30px rgba(0, 0, 0, 0.8);
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    color: white;
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.2), transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100vw;
    height: 100vh;
    padding: 20px 10px 0;
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 20px;
}

.karaoke-header {
    text-align: center;
}

.karaoke-header h1 {
    font-size: 3.5em;
    margin-bottom: 8px;
    font-weight: 800;
    color: white;
    letter-spacing: 2px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.artist {
    font-size: 1.6em;
    opacity: 0.95;
    font-style: italic;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.player-footer {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.audio-player {
    flex: 1;
    display: flex;
    justify-content: center;
}

.audio-player audio {
    width: 100%;
    max-width: 500px;
    height: 50px;
    outline: none;
}

.audio-player audio::-webkit-media-controls-panel {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.5) 0%, rgba(118, 75, 162, 0.5) 100%);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3), 0 4px 20px rgba(0, 0, 0, 0.2);
}

.audio-player audio::-webkit-media-controls-play-button,
.audio-player audio::-webkit-media-controls-pause-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 0 15px rgba(102, 126, 234, 0.8)) drop-shadow(0 2px 10px rgba(0, 0, 0, 0.4));
}

.audio-player audio::-webkit-media-controls-current-time-display,
.audio-player audio::-webkit-media-controls-time-remaining-display {
    color: white;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.8), 0 2px 8px rgba(0, 0, 0, 0.6);
    font-weight: 700;
}

.audio-player audio::-webkit-media-controls-timeline {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 15px;
    margin: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.audio-player audio::-webkit-media-controls-volume-slider {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lyrics-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0;
    padding: 30px 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    backdrop-filter: blur(10px);
    border: none;
    box-shadow: none;
    overflow: hidden;
    position: relative;
    height: 100%;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.lyrics-display {
    text-align: center;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.lyrics-display::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

#group-container {
    width: 100%;
    position: relative;
    padding: 20px 0;
}

.lyric-line {
    font-size: 4.5em;
    font-weight: 600;
    margin: 0;
    padding: 0;
    text-shadow: 0 3px 15px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    white-space: normal;
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    min-height: calc((100vh - 200px) / 3);
    width: 100vw;
}

.lyric-line.new-group {
    margin-top: 0;
}

.lyric-preview {
    font-size: 1.4em;
    opacity: 0.5;
    margin-top: 30px;
    font-weight: 400;
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity, font-size;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.lyric-line.fade-out {
    opacity: 0;
    transform: translateY(-40px) scale(0.9);
}

.lyric-preview.grow-in {
    font-size: 2.8em;
    opacity: 1;
    margin-top: 20px;
    font-weight: 600;
    transform: translateY(-60px);
}

.word {
    display: inline-block;
    margin: 0 12px;
    padding: 0px;
    color: rgba(255, 255, 255, 0.4);
    transition: color 1.5s ease, transform 0.1s ease, text-shadow 0.1s ease, opacity 1.5s ease, filter 0.1s ease;
}

.word.upcoming {
    color: rgba(255, 255, 255, 0.7);
}

.word.active {
    color: #ffff00;
    filter: brightness(1.5);
    transition: color 0.1s ease, filter 0.1s ease;
}

.word.sung-recent {
    color: rgba(150, 150, 150, 0.8);
    transition: color 0.1s ease, filter 0.1s ease;
}

.word.sung {
    color: rgba(255, 255, 255, 0.18);
    transition: color 1.5s ease, filter 0.1s ease;
}


@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.92);
    }
    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
    }
}

.controls {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
}

button {
    padding: 12px 30px;
    font-size: 0.95em;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

button:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

button:active {
    transform: translateY(0);
}

.song-info {
    flex-shrink: 0;
    min-width: 250px;
    text-align: right;
}

#song-title {
    font-size: 1.2em;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin-bottom: 4px;
}

#song-artist {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .container {
        padding: 20px 30px;
        gap: 15px;
    }

    .karaoke-header h1 {
        font-size: 2.2em;
    }

    .artist {
        font-size: 1.2em;
    }

    .lyrics-container {
        padding: 40px 20px;
    }

    .lyric-line {
        font-size: 1.8em;
        margin: 12px 0;
    }

    .word {
        margin: 0 6px;
    }

    .controls {
        gap: 15px;
        flex-wrap: wrap;
    }

    button {
        padding: 12px 35px;
        font-size: 0.95em;
    }
}

/* Settings Button */
.settings-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 2em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.settings-modal.active {
    display: flex;
}

.settings-content {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 40px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

.settings-content h2 {
    font-size: 2.5em;
    color: white;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 2em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 0, 0, 0.5);
    transform: scale(1.1);
}

/* Themes Grid */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 40px;
    margin-top: 20px;
}

.theme-card {
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.theme-card.active {
    border-color: #00ff00;
    border-width: 4px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.theme-preview {
    width: 100%;
    height: 120px;
    border-radius: 15px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.theme-name {
    color: white;
    font-size: 1.2em;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
