.now-playing-dimmer {
    display: none;
}

.now-playing {
    position: relative;
    width: 400px;
    max-width: 100%;
    margin: 0 auto;
    transition: filter 0.2s ease;
}

/* Playing interface */
.now-playing > .ui {
    position: relative;
    z-index: 1;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: 0;
    padding-bottom: 0;
}

@media only screen and (min-width: 1024px) {
  .now-playing > .ui {
    padding-top: 64px;
  }
}


.now-playing > .ui > .playing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    margin-top: env(safe-area-inset-top, 40px);
    margin-bottom: 10px;
    mask-image: linear-gradient(to bottom, black 78%, transparent 100%);
}

.now-playing > .ui > .playing-header > .primary {
    flex: 0 1 78px;
}

.now-playing > .ui > .playing-header > .primary > .return_icon {
    cursor: pointer;
    width: 28px;
    padding: 6px;
    margin-right: 10px;
    border-radius: 20px;
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-header > .primary > .return_icon:hover {
    background-color: var(--playing-bg-color-secondary);
}

.now-playing > .ui > .playing-header > .secondary {
    max-width: calc(100% - 116px);
}

.now-playing > .ui > .playing-header > .secondary > .title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--font-color-tertiary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.now-playing > .ui > .playing-header > .secondary > .desc {
    font-size: 0.95rem;
    font-weight: 700;
    /* Help with CJK letter spacing */
    line-height: 1.1875rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.now-playing > .ui > .playing-header > .tertiary {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    margin-right: 6px;
}

.now-playing > .ui > .playing-header > .tertiary > .favorite-state {
    cursor: pointer;
    padding: 6px;
    border-radius: 20px;
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-header > .tertiary > .favorite-state:hover {
    background-color: var(--playing-bg-color-secondary);
}

.now-playing > .ui > .playing-header > .tertiary > .favorite-state > svg {
    color: var(--brand-color);
}

.now-playing > .ui > .playing-header > .tertiary > .more {
    cursor: pointer;
    padding: 7px;
    border-radius: 20px;
    background-color: var(--playing-bg-color);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-header > .tertiary > .more:hover {
    background-color: var(--playing-bg-color-secondary);
}

.now-playing > .ui > .playing-header > .tertiary > .more.active {
    background-color: var(--playing-bg-color-secondary);
}

.now-playing > .ui > .playing-header > .tertiary > .more > svg {
    fill: var(--brand-color);
}

.now-playing > .ui > .playing-content {
    flex: 1;
    padding: 0 20px;
    margin-top: 20px;
    margin-bottom: 0;
    overflow-y: auto;
}

/* Thumbnail artwork */
.now-playing > .ui > .playing-content > .playing-artwork {
    position: relative;
    pointer-events: none;
    margin-bottom: 30px;
}

.now-playing > .ui > .playing-content > .playing-artwork > .thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
}

.now-playing > .ui > .playing-content > .playing-artwork > .thumbnail > img {
    display: block;
    width: 360px;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: inherit;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.now-playing > .ui > .playing-content > .playing-artwork > .thumbnail > .fallback-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 360px;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: inherit;
    aspect-ratio: 1 / 1;
    background-color: var(--bg-color-tertiary);
}

.now-playing > .ui > .playing-content > .playing-artwork > .thumbnail > .fallback-thumbnail > svg {
    fill: var(--font-color-tertiary);
    opacity: 0.4;
    margin-left: -4%;
}

.now-playing > .ui > .playing-content > .playing-artwork > .thumbnail > .shadow-border {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    box-shadow: var(--playing-border-color) 0px 0px 0px 1px inset;
}

/* Track title and artist */
.now-playing > .ui > .playing-content > .playing-info {
    text-align: center;
    margin: 0 8px;
    overflow: hidden;
    max-width: 100%;
    margin-bottom: 40px;
}

.now-playing > .ui > .playing-content > .playing-info > .song-name {
    font-size: 1rem;
    font-weight: 700;
    /* Help with CJK letter spacing */
    line-height: 1.25rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-bottom: 2px;
}

.now-playing > .ui > .playing-content > .playing-info > .artist {
    font-size: 0.75rem;
    font-weight: 600;
    /* Help with CJK letter spacing */
    line-height: 0.9375rem;
    color: var(--font-color-tertiary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Progress info */
.now-playing > .ui > .playing-content > .playing-progress {
    display: flex;
    flex-direction: column;
    margin-bottom: 40px;
}

.now-playing > .ui > .playing-content > .playing-progress > .info {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin: 0 2px;
    margin-bottom: 8px;
}

.now-playing > .ui > .playing-content > .playing-progress > .info > .duration {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--font-color-tertiary);
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

.now-playing > .ui > .playing-content > .playing-progress > .info > .quality {
    font-size: 0.725rem;
    font-weight: 500;
    color: var(--font-color-secondary);
    display: flex;
    align-items: center;
    margin: 0 8px;
    margin-bottom: 2px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--playing-bg-color-secondary);
}

.now-playing > .ui > .playing-content > .playing-progress > .info > .quality > .divider {
    width: 2px;
    height: 2px;
    margin: 0 4px;
    margin-left: 5px;
    border-radius: 50%;
    background-color: var(--font-color-secondary);
}

.now-playing > .ui > .playing-content > .playing-progress > .info > .quality > .bitrate > .number {
    font-variant-numeric: tabular-nums;
}

.now-playing > .ui > .playing-content > .playing-progress > .info > .quality > .download-state {
    fill: var(--font-color-secondary);
    margin-left: 6px;
    margin-right: -4px;
}

/* Progress bar */
.now-playing > .ui > .playing-content > .playing-progress > .progress {
    position: relative;
    display: flex;
    height: 8px;
    touch-action: none;
}

/* Progress loading */
.now-playing > .ui > .playing-content > .playing-progress > .progress:has(input.loading)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    user-select: none;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.1s linear;
    background-image: linear-gradient(
        90deg,
        var(--playing-bg-color-secondary) 0%,
        var(--playing-bg-color-quaternary) 20%,
        var(--playing-bg-color-secondary) 40%
    );
    background-size: 200%;
    animation: playing-loading-shimmer 1.4s infinite linear;
    animation-delay: 0.4s;
}

@keyframes playing-loading-shimmer {
    0% {
        opacity: 1;
        background-position: 100%;
    }
    60%,
    100% {
        opacity: 1;
        background-position: -100%;
    }
}

.now-playing > .ui > .playing-content > .playing-progress > .progress > input {
    position: relative;
    cursor: pointer;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    --progress-width: 0%;
    --buffered-width: 0%;
    --transition-duration: 0s;
}

/* WebKit progress visuals */
.now-playing > .ui > .playing-content > .playing-progress > .progress > input::-webkit-slider-runnable-track {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(var(--playing-bg-color-quaternary), var(--playing-bg-color-quaternary)) no-repeat 0 /
            var(--progress-width) 100%,
        linear-gradient(var(--playing-bg-color-tertiary), var(--playing-bg-color-tertiary)) no-repeat 0 /
            var(--buffered-width) 100%,
        var(--playing-bg-color-secondary);
    transition: background-size var(--transition-duration) linear;
}

/* Firefox progress visuals */
.now-playing > .ui > .playing-content > .playing-progress > .progress > input::-moz-range-track {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(var(--playing-bg-color-quaternary), var(--playing-bg-color-quaternary)) no-repeat 0 /
            var(--progress-width) 100%,
        linear-gradient(var(--playing-bg-color-tertiary), var(--playing-bg-color-tertiary)) no-repeat 0 /
            var(--buffered-width) 100%,
        var(--playing-bg-color-secondary);
    transition: background-size var(--transition-duration) linear;
}

/* Hiding the input slider thumbs for different browsers */
.now-playing > .ui > .playing-content > .playing-progress > .progress > input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 0;
}

.now-playing > .ui > .playing-content > .playing-progress > .progress > input::-moz-range-thumb {
    width: 0;
    height: 0;
    border: none;
}

.now-playing > .ui > .playing-content > .playing-progress > .progress > input::-ms-thumb {
    width: 0;
    height: 0;
}

/* Player controls */
.now-playing > .ui > .playing-content > .playing-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 36px;
    margin: 8px 4px 8px 4px; /* Reduce top and bottom margin to bring controls closer to progress bar */
}

.now-playing > .ui > .playing-content > .playing-controls > .shuffle {
    cursor: pointer;
    position: relative;
    top: -18px;
}

.now-playing > .ui > .playing-content > .playing-controls > .shuffle > .shuffle-icon {
    display: block;
    width: 32px;
    height: 28px;
    background-color: var(--font-color-secondary);
    mask-repeat: no-repeat;
    mask-image: url(/player-shuffle.svg);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-content > .playing-controls > .shuffle:hover > .shuffle-icon {
    background-color: var(--font-color);
}

.now-playing > .ui > .playing-content > .playing-controls > .shuffle.active > .shuffle-icon {
    background-color: var(--brand-color);
}

/* Primary controls */
.now-playing > .ui > .playing-content > .playing-controls > .primary {
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
    top: -18px;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .previous {
    cursor: pointer;
    padding: 2px 0;
    transform: rotate(180deg);
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .previous > .previous-icon {
    display: block;
    width: 32px;
    height: 28px;
    background-color: var(--font-color-secondary);
    mask-size: cover;
    mask-repeat: no-repeat;
    mask-image: url(/player-next.svg);
    transition: opacity 0.2s ease-out;
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .previous:hover > .previous-icon {
    background-color: var(--font-color);
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .container {
    position: relative;
    width: 46px;
    height: 40px;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .container > .play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
}

/* Hide play button when a track is playing */
.now-playing.playing > .ui > .playing-content > .playing-controls > .primary > .container > .play {
    opacity: 0;
    visibility: hidden;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .container > .play > .play-icon {
    display: block;
    width: 46px;
    height: 40px;
    background-color: var(--font-color-secondary);
    mask-repeat: no-repeat;
    mask-image: url(/play.svg);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .container > .play:hover > .play-icon {
    background-color: var(--font-color);
}

/* Hide pause button by default */
.now-playing > .ui > .playing-content > .playing-controls > .primary > .container > .pause {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    cursor: pointer;
    transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
}

/* Show pause button when a track is playing */
.now-playing.playing > .ui > .playing-content > .playing-controls > .primary > .container > .pause {
    opacity: 1;
    visibility: visible;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .container > .pause > .pause-icon {
    display: block;
    width: 46px;
    height: 40px;
    background-color: var(--font-color-secondary);
    mask-repeat: no-repeat;
    mask-image: url(/pause.svg);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .container > .pause:hover > .pause-icon {
    background-color: var(--font-color);
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .next {
    cursor: pointer;
    padding: 2px 0;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .next > .next-icon {
    display: block;
    width: 32px;
    height: 28px;
    background-color: var(--font-color-secondary);
    mask-size: cover;
    mask-repeat: no-repeat;
    mask-image: url(/player-next.svg);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-content > .playing-controls > .primary > .next:hover > .next-icon {
    background-color: var(--font-color);
}

.now-playing > .ui > .playing-content > .playing-controls > .repeat {
    cursor: pointer;
    position: relative;
    top: -18px;
}

.now-playing > .ui > .playing-content > .playing-controls > .repeat > .repeat-icon {
    display: block;
    width: 32px;
    height: 28px;
    background-color: var(--font-color-secondary);
    mask-repeat: no-repeat;
    mask-image: url(/player-repeat.svg);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-content > .playing-controls > .repeat > .repeat-icon-one {
    display: block;
    width: 32px;
    height: 28px;
    background-color: var(--font-color-secondary);
    mask-repeat: no-repeat;
    mask-image: url(/player-repeat-one.svg);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-content > .playing-controls > .repeat:hover > .repeat-icon,
.now-playing > .ui > .playing-content > .playing-controls > .repeat:hover > .repeat-icon-one {
    background-color: var(--font-color);
}

.now-playing > .ui > .playing-content > .playing-controls > .repeat.active > .repeat-icon,
.now-playing > .ui > .playing-content > .playing-controls > .repeat.active > .repeat-icon-one {
    background-color: var(--brand-color);
}

/* Volume control */
.now-playing > .ui > .playing-footer {
    padding-bottom: env(safe-area-inset-bottom, 40px);
    display: flex;
    align-items: center;
    flex-direction: column;
    margin-top: auto;
    margin-bottom: 44px;
}

.now-playing > .ui > .playing-header {
    padding-top: env(safe-area-inset-top, 40px);
}

.now-playing > .ui > .playing-content {
    flex: 1;
}

.now-playing > .ui > .playing-footer > .actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.now-playing > .ui > .playing-footer > .actions > .action {
    padding: 4px;
    fill: var(--font-color-secondary);
    transition: fill 0.2s ease-out;
}

.now-playing > .ui > .playing-footer > .actions > .action:hover {
    fill: var(--font-color);
}

/* Player volume */
.now-playing > .ui > .playing-footer > .playing-volume {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.now-playing > .ui > .playing-footer > .playing-volume > .indicator {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--font-color-tertiary);
    margin-bottom: 6px;
}

.now-playing > .ui > .playing-footer > .playing-volume > .control {
    display: flex;
}

.now-playing > .ui > .playing-footer > .playing-volume > .control > input {
    cursor: pointer;
    width: 160px;
    height: 8px;
    border-radius: 20px;
    background-color: var(--playing-bg-color);
    border: 1px solid var(--playing-border-color);
}

.now-playing > .ui > .playing-footer > .playing-volume > .control > input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 100%;
    background-color: var(--volume-dot-color);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-footer > .playing-volume > .control > input::-webkit-slider-thumb:active {
    background-color: var(--volume-dot-color-active);
}

.now-playing > .ui > .playing-footer > .playing-volume > .control > input::-moz-range-thumb {
    appearance: none;
    border: none;
    width: 14px;
    height: 14px;
    border-radius: 100%;
    background-color: var(--volume-dot-color);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease-out;
}

.now-playing > .ui > .playing-footer > .playing-volume > .control > input::-moz-range-thumb:active {
    background-color: var(--volume-dot-color-active);
}

/* Background blurred artwork toggle option? */
.now-playing > .background-artwork {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: blur(60px) saturate(1.6) contrast(200%);
    opacity: var(--playing-artwork-opacity);
    pointer-events: none;
}

.now-playing > .background-artwork > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.2);
}

/* Responsive */
@media only screen and (max-width: 480px), (pointer: coarse) {
    .now-playing-dimmer {
        display: block;
        position: fixed;
        z-index: 4;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow: visible;
        opacity: 0;
        visibility: hidden;
        background-color: var(--bg-color-dimmer);
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .music-app:has(.now-playing):has(.dropdown.active) > .now-playing-dimmer {
        opacity: 1;
        visibility: visible;
    }

    .music-app:has(.now-playing):has(.dropdown.active) > .now-playing > .ui {
        filter: blur(12px);
    }
}

@media only screen and (max-width: 500px) {
    .now-playing > .ui > .playing-header {
        margin-top: 10px;
        mask-image: linear-gradient(to bottom, black 72%, transparent 100%);
    }

    .now-playing > .ui > .playing-footer {
        margin-bottom: 34px;
    }
}

@media only screen and (max-width: 260px) {
    .now-playing > .ui > .playing-content > .playing-controls {
        gap: 14px;
    }

    .now-playing > .ui > .playing-content > .playing-controls > .primary {
        gap: 6px;
    }
}
