:root {
    --primary: #ff2d55;
    --secondary: #1c1c1e;
    --on-primary: #ffffff;
    --bg: #0b0c10;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-strong: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.62);
    --border: rgba(255, 255, 255, 0.12);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-tema="claro"] {
    --bg: #f4f4f7;
    --surface: rgba(20, 20, 30, 0.05);
    --surface-strong: rgba(20, 20, 30, 0.08);
    --text: #17181c;
    --text-muted: rgba(20, 20, 30, 0.6);
    --border: rgba(20, 20, 30, 0.1);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.player-shell {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    isolation: isolate;
    overflow: hidden;
}

.player-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    background-size: cover;
    background-position: center;
    filter: saturate(1.15) brightness(0.55) blur(2px);
    transform: scale(1.1);
}

.player-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 55%, transparent) 0%, var(--bg) 92%),
                radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--primary) 30%, transparent), transparent 60%),
                radial-gradient(100% 70% at 100% 100%, color-mix(in srgb, var(--secondary) 45%, transparent), transparent 65%);
}

.player-bg.sem-capa {
    background: radial-gradient(120% 70% at 50% -10%, color-mix(in srgb, var(--primary) 35%, var(--secondary)) 0%, var(--secondary) 65%, var(--bg) 100%);
    filter: none;
    transform: none;
}

.player-top {
    padding: calc(1rem + var(--safe-top)) 1.25rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
}

.player-badge .live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff4757;
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.6);
    animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
    0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(255, 71, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

.icon-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}

.icon-btn svg {
    display: block;
}

.player-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    text-align: center;
    gap: 1.5rem;
}

.art-stage {
    position: relative;
    width: min(84vw, 340px);
    aspect-ratio: 4/3;
}

.art-frame {
    position: absolute;
    inset: 0;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    background: var(--surface-strong);
    border: 1px solid var(--border);
}

.art-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.7s ease;
}

.art-frame img.visible {
    opacity: 1;
}

.art-frame .art-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: var(--primary);
    background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%);
}

.art-ad-tag {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 2;
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem 0.9rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.art-ad-tag::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, transparent 100%);
}

.art-ad-tag.show {
    display: flex;
    opacity: 1;
}

.ad-badge {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.ad-nome {
    flex: 1;
    min-width: 0;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.art-frame.girando {
    animation: art-pulse 3.2s ease-in-out infinite;
}

@keyframes art-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

.radio-info h1 {
    font-size: 1.35rem;
    margin: 0 0 0.15rem;
    font-weight: 800;
}

.radio-info .genero {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.equalizer {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.equalizer span {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    animation: eq 1s ease-in-out infinite;
    height: 4px;
}

.equalizer span:nth-child(1) { animation-delay: -0.9s; }
.equalizer span:nth-child(2) { animation-delay: -0.6s; }
.equalizer span:nth-child(3) { animation-delay: -0.3s; }
.equalizer span:nth-child(4) { animation-delay: 0s; }

.player-shell:not(.tocando) .equalizer span {
    animation-play-state: paused;
    height: 3px;
}

@keyframes eq {
    0%, 100% { height: 3px; }
    50% { height: 16px; }
}

.play-btn {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    font-size: 1.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 14px 34px color-mix(in srgb, var(--primary) 55%, transparent);
    transition: transform 0.12s ease;
    position: relative;
}

.play-btn:active {
    transform: scale(0.94);
}

.play-btn .spinner {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.8);
    display: none;
    animation: spin 0.8s linear infinite;
}

.player-shell.carregando .play-btn .spinner {
    display: block;
}

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

.marquee-bar {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
    overflow: hidden;
}

.marquee-bar .tag {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.04em;
}

.marquee-bar .tag.tag-proximo {
    color: var(--secondary);
}

.marquee-track {
    overflow: hidden;
    flex: 1;
    white-space: nowrap;
    position: relative;
}

.marquee-track span {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 14s linear infinite;
    color: var(--text);
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.player-bottom {
    padding: 0.5rem 1.25rem calc(1.25rem + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.social-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}

.app-install-btn {
    display: none;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    max-width: 380px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.7rem 1rem;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.app-install-btn.show {
    display: flex;
}

.app-install-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary);
    color: var(--on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-install-texto {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    gap: 0.15rem;
}

.app-install-texto strong {
    font-size: 0.92rem;
}

.app-install-texto small.platform-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #25d366;
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 0.7rem 1.3rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
}

.whatsapp-btn svg {
    font-size: 1.15em;
    flex-shrink: 0;
}

.audio-hidden {
    display: none;
}

@media (min-height: 760px) {
    .player-main {
        gap: 2rem;
    }
}

/* Telas baixas: encolhe a arte e os espaçamentos pra tudo caber sem cortar os controles */
@media (max-height: 700px) {
    .art-stage {
        width: min(42vw, 170px);
    }

    .player-main {
        gap: 0.9rem;
    }

    .player-bottom {
        gap: 0.6rem;
    }
}

@media (max-height: 560px) {
    .art-stage {
        width: min(30vw, 120px);
    }

    .player-top {
        padding-top: calc(0.6rem + var(--safe-top));
    }
}
