.repiet-sound {
    position: fixed;
    z-index: 20;
    right: max(1rem, env(safe-area-inset-right));
    inset-block-end: max(1rem, env(safe-area-inset-bottom));
    display: grid;
    justify-items: end;
    gap: .5rem;
    color: #fff;
    font-size: .875rem;
}

.repiet-sound-toggle,
#repiet-spotify-panel {
    background: #111;
    border: 1px solid #444;
    box-shadow: 0 .6rem 2rem #0005;
}

.repiet-sound-toggle {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    min-height: 44px;
    padding: .6rem 1rem;
    border-radius: 100px;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.repiet-sound-toggle:focus-visible,
#repiet-spotify-panel a:focus-visible {
    outline: 2px solid #77f2b3;
    outline-offset: 3px;
}

.repiet-sound-meter {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 16px;
    color: #77f2b3;
}

.repiet-sound-meter i {
    width: 2px;
    height: 100%;
    border-radius: 2px;
    background: currentColor;
    transform: scaleY(.4);
}

.repiet-sound-meter i:nth-child(2) {
    transform: scaleY(.85);
    animation-delay: -.25s;
}

.repiet-sound-meter i:nth-child(3) {
    animation-delay: -.5s;
}

.repiet-sound.is-playing .repiet-sound-meter i {
    animation-name: repiet-meter;
    animation-duration: .65s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.repiet-sound-chevron {
    display: inline-block;
}

.repiet-sound-toggle[aria-expanded="true"] .repiet-sound-chevron {
    transform: rotate(180deg);
}

#repiet-spotify-panel {
    grid-row: 1;
    width: min(350px, calc(100vw - 2rem));
    padding: .75rem;
    border-radius: 1.25rem;
    box-sizing: border-box;
    transform-origin: bottom right;
    animation: repiet-sound-open .22s ease-out;
}

#repiet-spotify-panel a {
    display: inline-block;
    margin-block-start: .35rem;
    color: inherit;
}

@keyframes repiet-meter {
    from { transform: scaleY(.25); }
    to { transform: scaleY(1); }
}

@keyframes repiet-sound-open {
    from { opacity: 0; transform: translateY(8px) scale(.96); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .repiet-sound.is-playing .repiet-sound-meter i,
    #repiet-spotify-panel {
        animation: none;
    }
}

.repiet-sound-toggle {
    width: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

.repiet-sound-toggle[aria-expanded="true"] {
    visibility: hidden;
}

.repiet-sound-label,
.repiet-sound-chevron {
    display: none;
}

#repiet-spotify-panel {
    position: relative;
    width: min(280px, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    overflow: auto;
    border-radius: 1.65rem;
    animation-name: repiet-card-open;
}

.repiet-cover {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 1.05rem;
    vertical-align: middle;
}

.repiet-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: .65rem .25rem;
}

.repiet-track strong {
    font-size: 1.2rem;
}

.repiet-sound-close,
.repiet-play {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.repiet-sound-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #111d;
    color: white;
    font-size: 1.4rem;
}

.repiet-play {
    background: white;
    color: #111;
}

.repiet-play:disabled {
    opacity: .4;
}

#repiet-spotify-panel details {
    margin-top: .5rem;
    color: #bbb;
    font-size: .75rem;
}

#repiet-spotify-panel iframe {
    max-width: 100%;
}

@keyframes repiet-card-open {
    from { opacity: 0; transform: scale(.5); border-radius: 50%; }
    to { opacity: 1; transform: scale(1); border-radius: 1.65rem; }
}

@media (prefers-reduced-motion: reduce) {
    #repiet-spotify-panel { animation: none; }
}

.repiet-spotify-transport {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 152px;
    clip-path: inset(50%);
    pointer-events: none;
}

.repiet-track-controls {
    display: flex;
    align-items: center;
    gap: .15rem;
}

.repiet-skip {
    width: 36px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.repiet-skip:disabled {
    opacity: .3;
    cursor: default;
}

.repiet-cover[hidden] {
    display: none;
}

.repiet-sound-toggle {
    transition: transform .28s cubic-bezier(.18,.9,.3,1.2), background-color .2s, opacity .2s;
}

@media (hover: hover) {
    .repiet-sound-toggle:hover {
        background: #202520;
    }
}

.repiet-sound-toggle:active,
.repiet-play:active,
.repiet-skip:not(:disabled):active,
.repiet-sound-close:active {
    transform: scale(.91);
}

.repiet-sound-toggle[aria-expanded="true"] {
    visibility: visible;
    opacity: 0;
    pointer-events: none;
}

#repiet-spotify-panel {
    animation: none;
    transform-origin: calc(100% - 28px) calc(100% - 28px);
}

@media (prefers-reduced-motion: reduce) {
    .repiet-sound-toggle {
        transition: none;
    }
}

.repiet-sound-start {
    width: 13px;
    height: 15px;
    margin-inline-start: 3px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.repiet-sound-toggle .repiet-sound-meter,
.repiet-sound.is-playing .repiet-sound-start {
    display: none;
}

.repiet-sound.is-playing .repiet-sound-toggle .repiet-sound-meter {
    display: flex;
}

.repiet-sound.is-morphing .repiet-sound-toggle {
    transition: none;
    opacity: 0;
}

#repiet-spotify-panel {
    padding: 0;
    background: #111;
}

.repiet-panel-content {
    box-sizing: border-box;
    width: calc(min(280px, 100vw - 2rem) - 2px);
    padding: .75rem;
}

.repiet-sound.is-morphing #repiet-spotify-panel {
    overflow: hidden;
}

.repiet-sound.is-playing .repiet-sound-meter {
    color: #fff;
}

.repiet-skip,
.repiet-play {
    display: inline-grid;
    place-items: center;
}

.repiet-transport-icon {
    width: 16px;
    height: 16px;
    background: currentColor;
    clip-path: polygon(24% 8%, 88% 50%, 24% 92%);
}

.repiet-play.is-playing .repiet-transport-icon {
    clip-path: polygon(19% 10%, 42% 10%, 42% 90%, 19% 90%, 19% 10%, 58% 10%, 81% 10%, 81% 90%, 58% 90%, 58% 10%);
}

.repiet-skip .repiet-transport-icon {
    clip-path: polygon(10% 11%, 69% 50%, 10% 89%, 10% 11%, 75% 11%, 91% 11%, 91% 89%, 75% 89%, 75% 11%);
}

.repiet-skip[data-step="-1"] .repiet-transport-icon {
    transform: scaleX(-1);
}

#repiet-spotify-panel[inert] {
    pointer-events: none;
}

.repiet-cover-frame {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 1.05rem;
    background: #1b1b1b;
}

.repiet-cover-frame .repiet-cover {
    width: 100%;
    height: 100%;
}

.repiet-track > :first-child {
    min-width: 0;
}

.repiet-track strong {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.repiet-track-controls {
    flex-shrink: 0;
}


.repiet-sound-toggle,
.repiet-sound.is-playing .repiet-sound-toggle {
    width: auto;
    height: 44px;
    gap: .5rem;
    padding: 0 .85rem;
    border-color: #ffffff29;
    border-radius: 8px;
    background: rgb(10 10 12 / .78);
    color: #f5f5f5;
    font-weight: 650;
}

.repiet-sound-toggle .repiet-sound-label {
    display: block;
}

.repiet-sound.is-playing .repiet-sound-toggle {
    box-shadow: inset 0 1px #ffffff1a, 0 .55rem 1.4rem #0007;
}

@media (hover: hover) {
    .repiet-sound-toggle:hover,
    .repiet-sound.is-playing .repiet-sound-toggle:hover {
        background: rgb(27 27 30 / .86);
    }
}

#repiet-spotify-panel {
    width: min(248px, calc(100vw - 2rem));
    border-radius: 1.2rem;
}

.repiet-panel-content {
    width: calc(min(248px, 100vw - 2rem) - 2px);
}

.repiet-cover-frame {
    aspect-ratio: 1.5;
}

.repiet-play {
    background: rgb(10 10 12 / .78);
}

.repiet-cover-frame {
    position: relative;
}

.repiet-cover-outgoing {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.repiet-sound.is-playing .repiet-sound-toggle .repiet-sound-meter {
    color: currentColor;
}

#repiet-spotify-panel {
    width: min(338px, calc(100vw - 2rem));
    border-radius: 10px;
    border-color: #ffffff29;
    background: rgb(10 10 12 / .78);
    box-shadow: inset 0 1px #ffffff16, 0 .55rem 1.4rem #0007;
    color: #f5f5f5;
}

.repiet-panel-content {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    gap: .4rem;
    width: calc(min(338px, 100vw - 2rem) - 2px);
    padding: .3rem .35rem;
}

.repiet-panel-content .repiet-cover-frame {
    grid-area: 1 / 1;
    width: 40px;
    height: 40px;
    aspect-ratio: 1;
    border-radius: 5px;
    background: #242428;
}

.repiet-panel-content .repiet-track {
    grid-area: 1 / 2;
    min-width: 0;
    gap: .25rem;
    margin: 0;
    font-size: .68rem;
    line-height: 1.15;
}

.repiet-panel-content .repiet-track strong {
    font-size: .8rem;
}

.repiet-panel-content .repiet-track-controls {
    gap: 0;
}

.repiet-panel-content .repiet-skip,
.repiet-panel-content .repiet-play,
.repiet-panel-content .repiet-sound-close {
    flex-shrink: 0;
    width: 32px;
    height: 40px;
    color: inherit;
}

.repiet-panel-content .repiet-play {
    width: 36px;
    height: 36px;
    border: 1px solid #ffffff26;
    border-radius: 6px;
    background: #ffffff1a;
    box-shadow: inset 0 1px #ffffff16;
    color: #fff;
}

.repiet-panel-content .repiet-sound-close {
    position: static;
    grid-area: 1 / 3;
    justify-self: center;
    width: 28px;
    background: transparent;
    font-size: 1.15rem;
}

.repiet-panel-content button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.repiet-panel-content .repiet-transport-icon {
    width: 13px;
    height: 13px;
}


.repiet-panel-content .repiet-cover {
    border-radius: inherit;
}

.repiet-panel-content .repiet-skip,
.repiet-panel-content .repiet-sound-close {
    border-radius: 5px;
}

@media (hover: hover) {
    .repiet-panel-content .repiet-play:hover:not(:disabled) {
        background: #ffffff35;
    }

    .repiet-panel-content :is(.repiet-skip, .repiet-sound-close):hover:not(:disabled) {
        background: #ffffff1a;
    }
}


.repiet-sound-toggle,
#repiet-spotify-panel {
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    backdrop-filter: blur(18px) saturate(1.15);
}

.repiet-sound-toggle:focus-visible {
    outline-color: #fff;
}

.repiet-sound-mini-cover {
    display: none;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
}

.repiet-sound.is-playing .repiet-sound-toggle .repiet-sound-mini-cover:not([hidden]) {
    display: block;
}

.repiet-sound-toggle .repiet-sound-label {
    font: 550 .67rem/1 ui-monospace, monospace;
    letter-spacing: .095em;
    text-transform: uppercase;
}

.repiet-sound-toggle,
#repiet-spotify-panel {
    background-image: linear-gradient(150deg, rgb(255 255 255 / .055), transparent 55%);
}

.repiet-sound.is-playing .repiet-sound-toggle,
.repiet-sound.is-playing #repiet-spotify-panel {
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .09),
        inset 0 -1px 0 rgb(255 56 45 / .48),
        0 6px 22px rgb(0 0 0 / .42),
        0 5px 21px -9px rgb(255 48 35 / .65);
}

.repiet-sound.is-playing .repiet-panel-content .repiet-play {
    border-color: rgb(255 104 92 / .46);
}

.repiet-moving-cover {
    position: fixed;
    z-index: 22;
    inset: 0 auto auto 0;
    object-fit: cover;
    pointer-events: none;
}

.repiet-sound.is-cover-moving .repiet-sound-mini-cover,
.repiet-sound.is-cover-moving .repiet-cover-frame {
    visibility: hidden;
}

.repiet-sound.is-hidden-for-live-set {
    visibility: hidden;
    pointer-events: none;
}

#repiet-spotify-panel,
#repiet-spotify-panel :is(.repiet-cover-frame, .repiet-cover, .repiet-play, .repiet-skip, .repiet-sound-close),
.repiet-sound .repiet-sound-mini-cover {
    border-radius: 0;
}
