@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: light;
    }
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

#container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    height: auto;
    width: calc(100% - 20px);
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    position: relative;
    border: none;
}

#playPauseContainer {
    position: relative;
    height: 100%;
    margin-right: 10px;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#playPauseButton {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-align: center;
    line-height: 80px;
}

#playPauseButton.play::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 20px solid white;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    margin-left: 7px;
}

#playPauseButton.pause::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 30px;
    background-color: white;
    position: relative;
    margin-right: 4px;
}

#playPauseButton.pause::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 30px;
    background-color: white;
    position: relative;
    margin-left: 4px;
}

#trackInfo {
    background-color: #333;
    color: white;
    padding: 10px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#trackInfo a {
    display: block;
    color: inherit;
}

#trackInfo div {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#speedButton, #liveButton {
    padding: 5px 10px;
    margin-left: 10px;
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    margin-left: 5px;
}

#speedButton.active {
    background-color: red;
    color: white;
}

#liveButton.active {
    background-color: red;
    color: white;
}

#liveButton.inactive {
    background-color: #ccc;
    color: black;
}

#volumeControlContainer {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    height: 150px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    margin-left: 10px;
    padding-bottom: 5px;
    width: 35px;
    box-sizing: border-box;
    overflow: hidden;
}

#volumeIcon {
    width: 24px;
    height: 24px;
    margin-top: 5px;
    background: url('data:image/svg+xml,<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 9C16.5 9.5 17 10.5 17 12C17 13.5 16.5 14.5 16 15M19 6C20.5 7.5 21 10 21 12C21 14 20.5 16.5 19 18M13 3L7 8H5C3.89543 8 3 8.89543 3 10V14C3 15.1046 3.89543 16 5 16H7L13 21V3Z" stroke="%23FFFFFF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat center center;
    background-size: contain;
}

#volumeIcon.muted {
    background: url('data:image/svg+xml,<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 9L22 15M22 9L16 15M13 3L7 8H5C3.89543 8 3 8.89543 3 10V14C3 15.1046 3.89543 16 5 16H7L13 21V3Z" stroke="%23FFFFFF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat center center;
    background-size: contain;
}

#volumeIcon.low {
    background: url('data:image/svg+xml,<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 9C16.5 9.5 17 10.5 17 12C17 13.5 16.5 14.5 16 15M13 3L7 8H5C3.89543 8 3 8.89543 3 10V14C3 15.1046 3.89543 16 5 16H7L13 21V3Z" stroke="%23FFFFFF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat center center;
    background-size: contain;
}

#volumeBarContainer {
    width: 100%;
    height: calc(100% - 24px);
    background-color: #555;
    position: relative;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

#volumeBar {
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    position: absolute;
    bottom: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

#progressBarContainer {
    width: 100%;
    height: 35px;
    padding: 10px 0 15px 0;
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box;
    background-color: #333;
    color: white;
}

#currentTime, #totalTime {
    flex-shrink: 0;
    z-index: 1;
    margin: 0 10px;
    width: 50px;
    display: inline-block;
    text-align: center;
    color: white;
}

.total-time {
    float: right;
    padding-left: 5px;
}

#progressBarWrapper {
    flex-grow: 1;
    position: relative;
    height: 100%;
    z-index: 0;
    background-color: #555;
}

#bufferBar {
    height: 100%;
    background-color: #777;
    width: 0;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#progressBar {
    height: 100%;
    background-color: white;
    width: 0;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.live-label {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.live-circle {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: red;
    border-radius: 50%;
    margin-right: 5px;
    animation: blink 3s infinite;
}

@keyframes blink {
    0%, 100% {
        background-color: red;
    }
    50% {
        background-color: transparent;
    }
}

#playlistTitle {
    background-color: #333;
    color: white;
    font-size: 14px;
    padding: 10px 10px 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#playlistTitleText {
    flex-grow: 1;
}

#playlistContainer {
    overflow-y: auto;
    flex-grow: 1;
}

#playlist, .playlist-tracks {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

#playlist li, .playlist-tracks li {
    align-items: center;
    position: relative;
}

.playlist-tracks li {
    display: flex;
    padding: 5px;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    cursor: pointer;
}

#playlist li img, .playlist-tracks li img {
    width: 30px;
    height: 30px;
    margin-right: 10px;
}

.track-image {
    width: 30px;
    height: 30px;
    margin-right: 10px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    flex-shrink: 0;
}

#playlist li .title, .playlist-tracks li .title {
    flex-grow: 1;
    text-align: left;
}

#playlist li .duration, .playlist-tracks li .duration {
    margin-left: auto;
    text-align: right;
    padding-left: 5px;
}

#playlist li.playing, .playlist-tracks li.playing {
    background-color: #f0f0f0;
}

#playlist li .live-label, .playlist-tracks li .live-label {
    margin-right: 10px;
    padding-left: 5px;
}

#playlist li.playlist-title, .playlist-tracks li.playlist-title {
    background-color: #333;
    color: white;
    border: none;
    padding: 10px;
    display: flex;
    align-items: center;
    width: 100%;
    cursor: pointer;
}

#playlist li.last-playlist-item, .playlist-tracks li.last-playlist-item {
    border-bottom: none;
}

.playlist-title {
    display: flex;
    align-items: center;
    padding: 5px;
    cursor: pointer;
    background-color: #333;
    color: white;
    border-bottom: 1px solid #ccc;
}

.playlist-title.active {
    background-color: #505050;
}

.playlist-title-text {
    flex-grow: 1;
}

.playlist-tracks {
    display: none;
}

.playlist-tracks.expanded {
    display: block;
}

.playlist-tracks.collapsed {
    height: 0;
}

.live-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 8px;
    height: 8px;
    background-color: red;
    border-radius: 50%;
    transform: translate(-50%, 50%);
    clip-path: inset(0 0 50% 0);
    z-index: 3;
    visibility: hidden;
}

.play-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background-color: #333;
    width: 0;
    transition: width 0.1s linear;
    z-index: 2;
}

.playlist-track-playPauseButton {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-align: center;
    line-height: 22px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.playlist-track-playPauseButton.play::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 8px solid white;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    margin-left: 2px;
}

.playlist-track-playPauseButton.pause::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 12px;
    background-color: white;
    position: relative;
    margin-right: -5px;
}

.playlist-track-playPauseButton.pause::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 12px;
    background-color: white;
    position: relative;
    margin-left: -5px;
}

.track {
    position: relative;
    cursor: pointer;
}

.track .tooltip {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
}

.track .tooltip::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.7) transparent transparent transparent;
}

.track:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.track.playing .tooltip {
    visibility: visible;
    opacity: 1;
}

@media (max-width: 1000px) {
    #container {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow-x: hidden;
    }

    #player {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px;
        height: auto;
        width: calc(100% - 20px);
        aspect-ratio: 1 / 1;
        flex-shrink: 0;
        background-size: cover;
        background-position: center;
        position: relative;
        border: none;
        justify-content: center;
    }

    @media (max-height: 650px) {
        #playerContainer {
            display: none;
        }
    }
}

@media (min-width: 1000px) {
    #container {
        max-width: 1200px;
        display: flex;
        flex-direction: row;
    }

    #playerContainer, #playlistContainer {
        width: 50%;
        overflow-x: hidden;
    }

    #playerContainer {
        order: 1;
        height: 100vh;
        overflow-y: auto;
        background-color: #333;
        max-width: 600px;
    }

    #playlistContainer {
        order: 2;
        overflow-y: auto;
    }

    .playlist-title {
        border-left: 1px solid #ccc;
    }

    #playerContainer {
        display: flex;
        flex-direction: column;
    }

    #player {
        flex-shrink: 0;
        background-size: auto 100%;
        background-position: center center;
        background-repeat: no-repeat;
        background-color: #333;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    @media (max-height: 400px) {
        #playerContainer {
            display: none;
        }

        #container {
            max-width: 600px;
        }
    }
}
