:root {
    --panelH: clamp(520px, calc(100vh - 360px), 640px);
}

/* ---------------------------------------
   Overall media row layout
--------------------------------------- */

.player-row {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
    gap: 22px;
    align-items: stretch;
}

.player {
    min-width: 0;
}

.tour-card {
    min-width: 0;
}

/* ---------------------------------------
   Shared card shell
--------------------------------------- */

#playerCard,
#tourCard {
    height: var(--panelH);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(10, 10, 12, 0.42);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

/* ---------------------------------------
   Player split layout
--------------------------------------- */

#playerCard {
    overflow: hidden;
    display: flex;
    gap: 0;
    align-items: stretch;
}

#playerCard .playlist {
    display: flex;
    flex-direction: column;
    flex: 0 0 360px;
    min-width: 300px;
    height: 100%;
    background: rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

#playerCard .deck {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 280px;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    padding: 22px;
}

/* ---------------------------------------
   Playlist header
--------------------------------------- */

.playlist-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.playlist-title {
    font-size: 1.05rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    text-align: center;
    width: 100%;
}

.playlist-status {
    font-size: 12px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.58);
    white-space: nowrap;
}

/* ---------------------------------------
   Playlist tabs / playlist switcher
--------------------------------------- */

#playlistTabs,
.playlist-tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 18px 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

#playlistTabs::-webkit-scrollbar,
.playlist-tabs::-webkit-scrollbar {
    display: none;
}

#playlistTabs button,
.playlist-tabs button {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
    scroll-snap-align: start;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
    cursor: pointer;
}

#playlistTabs button:hover,
.playlist-tabs button:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

#playlistTabs button.is-active,
.playlist-tabs button.is-active,
#playlistTabs button[aria-selected="true"],
.playlist-tabs button[aria-selected="true"] {
    background: rgba(255, 255, 255, 0.96);
    color: #0d0d10;
    border-color: rgba(255, 255, 255, 0.96);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

/* ---------------------------------------
   Playlist viewport + item scroller
--------------------------------------- */

.playlist-viewport {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
}

#playlistItems,
.playlist-items {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

#playlistItems::-webkit-scrollbar,
.playlist-items::-webkit-scrollbar {
    width: 8px;
}

#playlistItems::-webkit-scrollbar-thumb,
.playlist-items::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

#playlistItems::-webkit-scrollbar-track,
.playlist-items::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------------------------------------
   Individual track rows
--------------------------------------- */

.track {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 18px;
    color: #fff;
    background: transparent;
    border: 1px solid transparent;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
    cursor: pointer;
}

.track+.track {
    margin-top: 8px;
}

.track:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.track.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.track-name {
    min-width: 0;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-meta {
    font-size: 14px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
}

/* ---------------------------------------
   Deck / now playing side
--------------------------------------- */

.np-label {
    font-size: 13px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.70);
    text-align: center;
    margin-bottom: 10px;
}

.np-title {
    font-size: clamp(1.3rem, 1.9vw, 2rem);
    line-height: 1.18;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-align: center;
    color: #fff;
    margin-bottom: 16px;
    min-height: 2.4em;
}

.seek {
    width: 100%;
    margin-top: 6px;
    margin-bottom: 8px;
}

.time-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.time {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: nowrap;
}

.ctrl {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease, border-color .18s ease, transform .18s ease, opacity .18s ease;
}

.ctrl:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.10);
    transform: translateY(-1px);
}

.ctrl.play {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ---------------------------------------
   Banner
--------------------------------------- */

#playerBannerWrap,
.watch-panel {
    margin-top: auto;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.03);
}

#playerBannerWrap a,
.watch-panel a {
    display: block;
    width: 100%;
}

#playerBannerWrap img,
.watch-panel img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
}

/* ---------------------------------------
   Tour card
--------------------------------------- */

#tourCard {
    padding: 24px;
}

.tour-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
}

.tour-sub {
    margin-top: 10px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.78);
}

.tour-list {
    margin-top: 26px;
    display: grid;
    gap: 22px;
    align-content: start;
}

.tour-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
}

.tour-item-main {
    min-width: 0;
}

.tour-item-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.tour-item-meta {
    margin-top: 4px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.72);
}

.tour-item-cta {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

/* ---------------------------------------
   Tablet / small desktop
--------------------------------------- */

@media (max-width: 1180px) {
    #playerCard .playlist {
        flex-basis: 320px;
        min-width: 280px;
    }

    #playerCard .deck {
        padding: 20px;
    }

    .controls {
        gap: 12px;
    }
}

/* ---------------------------------------
   Mobile / stacked layout
--------------------------------------- */

@media (max-width: 980px) {
    .player-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    #playerCard,
    #tourCard {
        height: auto;
    }

    #playerCard {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    #playerCard .playlist {
        flex: 0 0 auto;
        min-width: 0;
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .playlist-head {
        padding: 16px 16px 8px;
    }

    #playlistTabs,
    .playlist-tabs {
        padding: 10px 16px 4px;
    }

    .playlist-viewport {
        min-height: 0;
    }

    #playlistItems,
    .playlist-items {
        max-height: 320px;
        padding: 8px 10px 14px;
    }

    #playerCard .deck {
        min-width: 0;
        width: 100%;
        padding: 18px 18px 16px;
    }

    #playerBannerWrap,
    .watch-panel {
        margin-top: 18px;
    }

    #playerBannerWrap img,
    .watch-panel img {
        height: 180px;
    }

    .np-title {
        font-size: 1.9rem;
        min-height: auto;
    }

    .controls {
        gap: 10px;
    }
}

/* ---------------------------------------
   Phone
--------------------------------------- */

@media (max-width: 640px) {
    .playlist-head {
        padding: 14px 14px 8px;
    }

    .playlist-title {
        font-size: 0.98rem;
    }

    .playlist-status {
        font-size: 11px;
    }

    #playlistTabs,
    .playlist-tabs {
        padding: 10px 14px 2px;
        gap: 7px;
    }

    #playlistTabs button,
    .playlist-tabs button {
        padding: 9px 12px;
        font-size: 11px;
    }

    #playlistItems,
    .playlist-items {
        max-height: 260px;
        padding: 8px 10px 12px;
    }

    .track {
        padding: 13px 14px;
        border-radius: 16px;
    }

    .track-name {
        font-size: 15px;
    }

    .track-meta {
        font-size: 13px;
    }

    #playerCard .deck {
        padding: 16px 16px 14px;
    }

    .np-label {
        font-size: 12px;
    }

    .np-title {
        font-size: 1.3rem;
        line-height: 1.2;
        margin-bottom: 14px;
    }

    .controls {
        gap: 8px;
    }

    .ctrl {
        width: 40px;
        height: 40px;
    }

    .ctrl.play {
        width: 48px;
        height: 48px;
    }

    #playerBannerWrap img,
    .watch-panel img {
        height: 160px;
    }

    #tourCard {
        padding: 18px;
    }

    .tour-list {
        gap: 18px;
    }

    .tour-item-title {
        font-size: 15px;
    }

    .tour-item-meta {
        font-size: 13px;
    }

    .tour-item-cta {
        font-size: 14px;
    }
}