/*
 * Player box: a pagina inteira e o player.
 *
 * Ele e usado em caixas de tamanhos bem diferentes, entao quase nada aqui tem
 * medida fixa: a capa, o texto e os botoes saem de clamp() sobre a menor
 * dimensao da caixa, e o cartao deita ou fica de pe conforme o espaco.
 *
 * O fundo e a propria capa da musica, borrada e escurecida; sem capa fica o
 * degrade escuro.
 */

:root {
    --pb-bg: #10141a;
    --pb-fg: #ffffff;
    --pb-muted: rgba(255, 255, 255, .68);
    --pb-accent: #ffffff;
    --pb-accent-fg: #11161c;
    --pb-line: rgba(255, 255, 255, .28);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--pb-fg);
    background: var(--pb-bg);
    -webkit-font-smoothing: antialiased;
}

.pb {
    position: relative;
    display: grid;
    place-items: center;
    height: 100%;
    padding: clamp(14px, 4vmin, 36px);
    overflow: hidden;
    background: radial-gradient(120% 100% at 20% 0%, #1d2530, #0b0e13);
}

/* ---------- fundo ---------- */

.pb__bg {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .5s ease;
}

.pb__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* a escala esconde a borda que o desfoque deixa transparente */
    transform: scale(1.15);
    filter: blur(30px) saturate(1.25) brightness(.42);
}

.pb.has-cover .pb__bg { opacity: 1; }

/* ---------- cartao ---------- */

.pb__card {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(16px, 3.4vw, 36px);
    width: min(1100px, 100%);
    max-height: 100%;
}

.pb__art {
    position: relative;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: clamp(96px, 46vmin, 320px);
    aspect-ratio: 1;
    overflow: hidden;
    color: rgba(255, 255, 255, .55);
    border-radius: clamp(6px, 1.6vmin, 14px);
    background: rgba(255, 255, 255, .09);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
}

.pb__art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pb__art img[hidden] { display: none; }
.pb__art svg { width: 34%; height: 34%; }
.pb.has-cover .pb__art svg { display: none; }

/* ---------- texto ---------- */

.pb__info {
    flex: 1 1 auto;
    min-width: 0;
}

.pb__label {
    display: block;
    font-size: clamp(13px, 2.2vmin, 17px);
    line-height: 1.2;
    color: var(--pb-muted);
}

/* a tag antiga e a que entra e sai na hora certa; o css cuida do esmaecido */
.pb__song {
    width: 100%;
    margin-top: 4px;
    font-size: clamp(18px, 3.2vw, 36px);
    font-weight: 600;
    line-height: 1.25;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent);
}

/* ---------- controles ---------- */

.pb__row {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.6vw, 18px);
    margin-top: clamp(12px, 2.6vmin, 26px);
}

.pb__play {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: clamp(48px, 6.4vw, 86px);
    aspect-ratio: 1;
    padding: 0;
    color: var(--pb-accent-fg);
    border: 0;
    border-radius: 50%;
    background: var(--pb-accent);
    cursor: pointer;
    transition: transform .12s ease, filter .12s ease;
}

.pb__play:hover { filter: brightness(.94); }
.pb__play:active { transform: scale(.95); }
.pb__play:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 3px; }
.pb__play svg { width: 42%; height: 42%; }
.pb__play svg path { stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }

.pb__play .pl__ico-stop,
.pb.is-playing .pb__play .pl__ico-play { display: none; }
.pb.is-playing .pb__play .pl__ico-stop { display: block; }

.pb.is-loading .pb__play svg { display: none; }

.pb.is-loading .pb__play::after {
    content: "";
    width: 42%;
    aspect-ratio: 1;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: pb-spin .7s linear infinite;
}

@keyframes pb-spin { to { transform: rotate(360deg); } }

.pb__ico {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: clamp(32px, 3.4vw, 46px);
    aspect-ratio: 1;
    padding: 0;
    color: var(--pb-muted);
    border: 0;
    border-radius: 8px;
    background: none;
    cursor: pointer;
}

.pb__ico[hidden] { display: none; }
.pb__ico:hover { color: var(--pb-fg); }
.pb__ico:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 1px; }
.pb__ico svg { width: 60%; height: 60%; }

.pb__ico .pl__ico-mute,
.pb.is-mute .pb__ico .pl__ico-sound { display: none; }
.pb.is-mute .pb__ico .pl__ico-mute { display: block; }

.pb.is-casting [data-cast] { color: var(--pb-fg); }

.pb__range {
    --vol: 100%;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 320px;
    height: 22px;
    margin: 0;
    padding: 0;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.pb__range:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 4px; }

.pb__range::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--pb-accent) var(--vol), var(--pb-line) var(--vol));
}

.pb__range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--pb-line); }
.pb__range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--pb-accent); }

.pb__range::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -4px;
    border: 0;
    border-radius: 50%;
    background: var(--pb-accent);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .35);
    -webkit-appearance: none;
    appearance: none;
}

.pb__range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 50%;
    background: var(--pb-accent);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .35);
}

/* ---------- caixa estreita ---------- */

/* sem largura para os dois lados, a capa sobe e tudo fica centralizado */
@media (max-width: 620px) {
    .pb__card {
        flex-direction: column;
        gap: clamp(12px, 3vmin, 22px);
        text-align: center;
    }

    .pb__info { width: 100%; }
    .pb__row { justify-content: center; margin-top: clamp(10px, 2vmin, 18px); }
    .pb__range { max-width: 150px; }
}

/* caixa baixa e larga: a capa encolhe para o texto continuar cabendo */
@media (max-height: 260px) {
    .pb__art { width: clamp(72px, 62vmin, 150px); }
    .pb__song { font-size: clamp(16px, 2.4vw, 24px); }
}
