* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

html,
body {
    min-height: 100%;
    min-height: 100dvh;
}

body {
    display: flex;
    flex-direction: column;
    background-color: var(--rp-bg, #0b1220);
    background-image:
        radial-gradient(ellipse 90% 70% at 8% -8%, rgba(var(--rp-accent-rgb, 255, 45, 85), 0.42), transparent 56%),
        radial-gradient(ellipse 70% 55% at 100% 0%, rgba(var(--rp-accent-rgb, 255, 45, 85), 0.22), transparent 52%),
        radial-gradient(ellipse 80% 50% at 70% 110%, rgba(var(--rp-accent-rgb, 255, 45, 85), 0.18), transparent 58%),
        linear-gradient(165deg, var(--rp-bg, #0b1220) 0%, rgba(var(--rp-accent-rgb, 255, 45, 85), 0.16) 48%, var(--rp-bg, #0b1220) 100%);
    background-attachment: fixed;
    color: var(--rp-text, #f8fafc);
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
}

.rp-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.rp-ambient {
    position: fixed;
    inset: -12%;
    background-size: cover;
    background-position: center;
    filter: blur(80px) saturate(1.45) brightness(0.38);
    opacity: 0.42;
    z-index: 0;
    pointer-events: none;
}

.rp-top,
.rp-main,
.rp-foot {
    position: relative;
    z-index: 1;
    width: 100%;
}

.rp-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(12px + constant(safe-area-inset-top)) 16px 12px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
    background: color-mix(in srgb, var(--rp-bg, #0b1220) 78%, transparent);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

.rp-share {
    flex-shrink: 0;
    border: 1px solid rgba(var(--rp-accent-rgb, 255, 45, 85), 0.45);
    background: rgba(var(--rp-accent-rgb, 255, 45, 85), 0.16);
    color: var(--rp-text, #fff);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.rp-share.is-on {
    background: var(--rp-accent, #ff2d55);
    border-color: var(--rp-accent, #ff2d55);
    color: #fff;
}

.rp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    max-width: calc(100% - 16px);
}

.rp-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.rp-station {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70vw;
    letter-spacing: -0.02em;
}

.rp-tagline {
    margin-top: 2px;
    font-size: 0.72rem;
    line-height: 1.3;
    opacity: 0.58;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70vw;
}

.rp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0;
    padding: calc(72px + constant(safe-area-inset-top)) 16px 20px;
    padding: calc(72px + env(safe-area-inset-top, 0px)) 16px 20px;
}

.rp-now,
.rp-history,
.rp-request,
.rp-upnext {
    width: 100%;
    background: color-mix(in srgb, var(--rp-bg, #0b1220) 78%, #000 22%);
    border: 1px solid rgba(var(--rp-accent-rgb, 255, 45, 85), 0.2);
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
}

.rp-now {
    padding: 22px 18px 20px;
}

.rp-art-wrap {
    position: relative;
    width: min(280px, 78vw);
    aspect-ratio: 1;
    margin: 0 auto 18px;
}

.rp-art {
    width: 100%;
    height: 100%;
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(145deg, var(--rp-accent, #ff2d55), #1a0b14);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5);
}

.rp-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rp-live {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #e11d48;
    color: #fff;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.35);
}

.rp-now-label {
    text-align: center;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.5;
    font-weight: 700;
    margin-bottom: 6px;
}

.rp-title {
    text-align: center;
    font-size: 1.35rem;
    line-height: 1.2;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
    letter-spacing: -0.03em;
}

.rp-artist {
    text-align: center;
    opacity: 0.68;
    font-size: 0.95rem;
    min-height: 1.3em;
    overflow-wrap: anywhere;
}

.rp-progress {
    margin: 18px 2px 4px;
}

.rp-progress-track {
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.rp-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: var(--rp-accent, #ff2d55);
}

.rp-progress-times {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.72rem;
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
}

.rp-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px 20px;
    margin-top: 18px;
}

.rp-vol-wrap {
    display: none;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex: 0 0 auto;
}

.rp-vol-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(var(--rp-accent-rgb, 255, 45, 85), 0.45);
    background: rgba(var(--rp-accent-rgb, 255, 45, 85), 0.16);
    color: var(--rp-text, #fff);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.rp-vol-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.rp-vol-level {
    min-width: 3.2em;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--rp-accent, #ff2d55);
    user-select: none;
    -webkit-user-select: none;
}

.rp-vol-level.is-bump {
    animation: rp-vol-bump 0.28s ease;
}

@keyframes rp-vol-bump {
    0% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.rp-play {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    margin-left: 0;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: var(--rp-accent, #ff2d55);
    color: transparent;
    font-size: 0;
    cursor: pointer;
    position: relative;
    isolation: isolate;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--rp-accent, #ff2d55) 40%, transparent);
}

.rp-play::after {
    content: '';
    position: absolute;
    left: 26px;
    top: 22px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 16px;
    border-color: transparent transparent transparent #fff;
}

.rp-play.is-on {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.rp-play.is-on::after {
    left: 25px;
    top: 25px;
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 2px;
    background: #fff;
}

.rp-status {
    text-align: center;
    font-size: 0.78rem;
    opacity: 0.5;
    margin-top: 12px;
    min-height: 1.2em;
}

.rp-votes {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

.rp-vote {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font-weight: 700;
}

.rp-vote.is-on {
    border-color: var(--rp-accent, #ff2d55);
    background: color-mix(in srgb, var(--rp-accent, #ff2d55) 22%, transparent);
}

.rp-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.rp-upnext,
.rp-history,
.rp-request {
    padding: 18px 16px;
    background: var(--rp-lp-bg, #111827);
    color: var(--rp-lp-text, #e5e7eb);
    border-color: rgba(var(--rp-lp-accent-rgb, 255, 45, 85), 0.28);
}

.rp-upnext[hidden],
.rp-history[hidden],
.rp-request[hidden] {
    display: none;
}

.rp-side-title,
.rp-history-title {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rp-lp-accent, #ff2d55);
    margin-bottom: 14px;
    font-weight: 800;
}

.rp-upnext-row,
.rp-track {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    min-width: 0;
}

.rp-track-meta {
    flex: 1;
    min-width: 0;
}

.rp-upnext-row img,
.rp-track img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.rp-track-title {
    font-weight: 700;
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-track-artist {
    font-size: 0.78rem;
    opacity: 0.65;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ─────────────────────────────── Song requests ─────────────────────────── */

.rp-request-search {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(var(--rp-lp-accent-rgb, 255, 45, 85), 0.3);
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    font: inherit;
    font-size: 0.9rem;
    -webkit-appearance: none;
    appearance: none;
}

.rp-request-search::placeholder {
    color: inherit;
    opacity: 0.55;
}

.rp-request-search:focus {
    outline: none;
    border-color: var(--rp-lp-accent, #ff2d55);
    box-shadow: 0 0 0 3px rgba(var(--rp-lp-accent-rgb, 255, 45, 85), 0.18);
}

.rp-request-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Long libraries must not push Last played off the screen. */
    max-height: 320px;
    overflow-y: auto;
    margin-top: 12px;
}

.rp-request-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    min-width: 0;
}

.rp-request-empty {
    margin: 6px 2px;
    font-size: 0.82rem;
    opacity: 0.6;
}

.rp-request-pick-btn,
.rp-request-send,
.rp-request-cancel {
    flex-shrink: 0;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(var(--rp-lp-accent-rgb, 255, 45, 85), 0.45);
    background: transparent;
    color: var(--rp-lp-accent, #ff2d55);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.rp-request-pick-btn:hover,
.rp-request-send:hover,
.rp-request-cancel:hover {
    background: rgba(var(--rp-lp-accent-rgb, 255, 45, 85), 0.14);
}

.rp-request-send {
    background: var(--rp-lp-accent, #ff2d55);
    color: var(--rp-lp-bg, #111827);
}

.rp-request-send[disabled] {
    opacity: 0.55;
    cursor: default;
}

.rp-request-cancel {
    border-color: rgba(255, 255, 255, 0.2);
    color: inherit;
    opacity: 0.75;
}

.rp-request-confirm {
    margin-top: 12px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(var(--rp-lp-accent-rgb, 255, 45, 85), 0.1);
    border: 1px solid rgba(var(--rp-lp-accent-rgb, 255, 45, 85), 0.3);
}

.rp-request-confirm[hidden] {
    display: none;
}

.rp-request-pick {
    margin: 0 0 10px;
    font-size: 0.88rem;
    font-weight: 700;
}

.rp-request-msg {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    margin-bottom: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    resize: vertical;
}

.rp-request-msg[hidden] {
    display: none;
}

.rp-request-actions {
    display: flex;
    gap: 8px;
}

.rp-request-status {
    margin: 10px 2px 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--rp-lp-accent, #ff2d55);
}

.rp-request-status[hidden] {
    display: none;
}

.rp-request-status.is-error {
    color: #fca5a5;
}

.rp-home {
    display: none;
}

.rp-home:not([hidden]) {
    display: block;
    margin-top: 16px;
    text-align: center;
}

.rp-home-btn {
    border: 0;
    background: transparent;
    color: var(--rp-accent, #ff2d55);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 4px 0;
}

.rp-home-ios {
    margin-top: 8px;
    font-size: 0.8rem;
    line-height: 1.45;
    opacity: 0.72;
}

.rp-foot {
    flex-shrink: 0;
    text-align: center;
    padding: 12px 16px calc(18px + constant(safe-area-inset-bottom));
    padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    opacity: 0.5;
}

.rp-foot a,
.rp-brand-link {
    color: #ff6b00;
    font-weight: 800;
    text-decoration: none;
}

.rp-foot a:hover,
.rp-brand-link:hover {
    color: #ff8a33;
}

@media (display-mode: standalone) {
    .rp-home {
        display: none !important;
    }
}

@media (min-width: 861px) {
    .rp-top {
        position: relative;
        justify-content: space-between;
        max-width: 1180px;
        margin: 0 auto;
        padding: 36px 32px 8px;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .rp-brand {
        gap: 16px;
        max-width: none;
    }

    .rp-brand-logo {
        width: 56px;
        height: 56px;
        border-radius: 16px;
    }

    .rp-station {
        font-size: 2rem;
        max-width: none;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .rp-tagline {
        font-size: 0.95rem;
        max-width: 42rem;
        white-space: normal;
        opacity: 0.62;
    }

    .rp-main {
        display: grid;
        grid-template-columns: 1.15fr 0.85fr;
        gap: 28px;
        max-width: 1180px;
        margin: 0 auto;
        padding: 20px 32px 48px;
        align-items: stretch;
    }

    .rp-now,
    .rp-side {
        min-width: 0;
        height: 100%;
    }

    .rp-side {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .rp-history {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .rp-history-list {
        flex: 1;
        justify-content: space-between;
    }

    /* The side column scrolls as a whole here, so the inner request list does
       not need its own scrollbar competing with it. */
    .rp-request-list {
        max-height: 260px;
    }

    .rp-now {
        display: flex;
        flex-direction: column;
        align-items: center;
        border-radius: 32px;
        padding: 32px;
    }

    .rp-art-wrap {
        width: min(320px, 100%);
        margin: 0 auto 18px;
    }

    .rp-art {
        border-radius: 26px;
    }

    .rp-now-meta {
        width: 100%;
        max-width: 420px;
        min-width: 0;
    }

    .rp-controls {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 16px;
    }

    .rp-vol-wrap {
        display: flex;
    }

    .rp-play {
        margin-left: auto;
    }

    .rp-now-label,
    .rp-title,
    .rp-artist,
    .rp-status {
        text-align: center;
    }

    .rp-title {
        font-size: 2rem;
    }

    .rp-artist {
        font-size: 1.05rem;
    }

    .rp-votes {
        justify-content: center;
    }

    .rp-vol-btn {
        width: 48px;
        height: 48px;
    }

    .rp-share {
        padding: 10px 18px;
        font-size: 0.82rem;
    }

    .rp-home:not([hidden]) {
        text-align: center;
    }

    .rp-upnext,
    .rp-history,
    .rp-request {
        border-radius: 24px;
        padding: 20px 18px;
    }

    .rp-foot {
        max-width: 1180px;
        margin: 0 auto;
        padding: 4px 32px 28px;
    }
}

html.rp-is-phone .rp-vol-wrap {
    display: none;
}

html.rp-is-phone .rp-controls {
    justify-content: center;
}

html.rp-is-phone .rp-play {
    margin-left: 0;
}
