/* gppls daily — styled after the ellomix design: white canvas, light grey chrome,
   heavy black type, black pill buttons, softly rounded artwork. */

:root {
    --bg: #ffffff;
    --chrome: rgba(242, 242, 242, 0.86);
    --surface: #f2f2f2;
    --surface-2: #e8e8e8;
    --text: #000000;
    --muted: #6e6e73;
    --line: #e3e3e6;
    --accent: #000000;
    --on-accent: #ffffff;
    --elevated: rgba(255, 255, 255, 0.92);
    --shadow-art: 0 6px 18px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
    --radius-art: 8px;
    --page-pad: 16px;
    --mini-h: 64px;
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0b0c;
        --chrome: rgba(20, 20, 22, 0.86);
        --surface: #1a1a1c;
        --surface-2: #26262a;
        --text: #ffffff;
        --muted: #9a9aa1;
        --line: #2a2a2e;
        --accent: #ffffff;
        --on-accent: #000000;
        --elevated: rgba(28, 28, 30, 0.92);
        --shadow-art: 0 6px 18px rgba(0, 0, 0, 0.5);
        --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.6);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.35;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body.np-open { overflow: hidden; }

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

button:disabled { cursor: default; }

:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
    border-radius: 6px;
}

svg { width: 24px; height: 24px; fill: currentColor; flex: none; }

[hidden] { display: none !important; }

/* ---------- Top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--chrome);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
}

.topbar-inner {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    height: 52px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 calc(var(--page-pad) - 10px);
}

.brand {
    justify-self: center;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text);
    text-decoration: none;
}

.search-row {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 var(--page-pad) 12px;
}

.search-row input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    outline: none;
}

.search-row input:focus-visible { box-shadow: 0 0 0 2px var(--text); }

/* ---------- Generic controls ---------- */

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--text);
    transition: transform 0.15s, opacity 0.15s, background-color 0.15s;
}

.icon-btn:active { transform: scale(0.9); }
.icon-btn.lg svg { width: 36px; height: 36px; }

.icon-btn.toggle { color: var(--muted); }
.icon-btn.toggle.is-on { color: var(--text); position: relative; }
.icon-btn.toggle.is-on::after {
    content: "";
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 46px;
    padding: 0 26px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 18px;
    font-weight: 700;
    border: 2px solid var(--accent);
    transition: transform 0.15s, opacity 0.15s;
}

.pill svg { width: 20px; height: 20px; }
.pill:active { transform: scale(0.96); }
.pill:disabled { opacity: 0.35; }
.pill-outline { background: transparent; color: var(--text); }

.segmented {
    display: inline-flex;
    padding: 2px;
    border-radius: 9px;
    background: var(--surface);
}

.segmented button {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.segmented button svg { width: 18px; height: 18px; }

.segmented button[aria-pressed="true"] {
    background: var(--bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ---------- Artwork ---------- */

.art {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-art);
    background:
        radial-gradient(120% 120% at 15% 10%, hsl(var(--hue, 0) 70% 72%), transparent 60%),
        linear-gradient(135deg, hsl(var(--hue, 0) 55% 45%), hsl(calc(var(--hue, 0) + 50) 60% 30%));
    box-shadow: var(--shadow-art);
}

.art-num {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 800;
    font-size: 2.6em;
    letter-spacing: -0.03em;
}

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

.art img.loaded { opacity: 1; }

/* Animated "now playing" bars */
.eq {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 22px;
    padding: 5px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.6);
}

.eq i {
    width: 3px;
    height: 100%;
    border-radius: 1px;
    background: #fff;
    transform-origin: bottom;
    animation: eq 0.9s ease-in-out infinite alternate;
}

.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }

body:not(.is-playing) .eq i { animation-play-state: paused; transform: scaleY(0.35); }

@keyframes eq {
    from { transform: scaleY(0.25); }
    to { transform: scaleY(1); }
}

/* ---------- Page ---------- */

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px var(--page-pad) calc(48px + env(safe-area-inset-bottom));
}

body.has-player .page { padding-bottom: calc(var(--mini-h) + 56px + env(safe-area-inset-bottom)); }

.hero {
    display: grid;
    grid-template-columns: clamp(120px, 34vw, 232px) 1fr;
    grid-template-areas: "art body" "actions actions";
    align-items: center;
    gap: 18px 18px;
    margin-bottom: 32px;
}

.hero-art { grid-area: art; }
.hero-body { grid-area: body; min-width: 0; }
.hero-actions { grid-area: actions; }

@media (max-width: 559px) {
    .hero-actions .pill { flex: 1; }
}

@media (min-width: 560px) {
    .hero {
        grid-template-areas: "art body" "art actions";
        align-content: center;
        row-gap: 0;
    }
    .hero-body { align-self: end; }
    .hero-actions { align-self: start; }
}

.hero-art .art { font-size: 1.4em; }

.eyebrow {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.hero-title {
    margin: 0;
    font-size: clamp(26px, 4.5vw, 48px);
    overflow-wrap: anywhere;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.02;
}

.hero-sub {
    margin: 6px 0 16px;
    color: var(--muted);
    font-weight: 600;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.hero.is-loading .hero-art { aspect-ratio: 1; border-radius: var(--radius-art); }

.section-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.section-meta { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

/* Playlists shelf, after the ellomix artist profile */
.playlists { margin-bottom: 28px; }
.shelf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* Arrow buttons only where there's a mouse; touch devices swipe the shelf */
.shelf-nav { display: none; gap: 6px; }

@media (hover: hover) and (pointer: fine) {
    .shelf-nav { display: flex; }
}

.shelf-btn { width: 32px; height: 32px; background: var(--surface); }
.shelf-btn svg { width: 20px; height: 20px; }
.shelf-btn:hover:not(:disabled) { background: var(--surface-2); }
.shelf-btn:disabled { opacity: 0.3; }

.shelf {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 280px);
    gap: 12px;
    margin: 0 calc(-1 * var(--page-pad));
    padding: 2px var(--page-pad) 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 var(--page-pad);
    scrollbar-width: none;
}

.shelf::-webkit-scrollbar { display: none; }

/* Compact release tile: small cover with the title beside it */
.pl-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-align: left;
    scroll-snap-align: start;
}

.pl-card .cover { width: 64px; flex: none; border-radius: 6px; transition: transform 0.15s; }
.pl-card .card-text { padding-top: 0; flex: 1; }
.pl-card .card-title { font-size: 17px; }
.pl-card:active .cover { transform: scale(0.95); }

/* Selected release */
.pl-card { padding: 6px; margin: -6px; border-radius: 12px; transition: background-color 0.15s; }
.pl-card.is-selected { background: var(--surface); }
.pl-card.is-selected .card-title { font-weight: 800; }
@media (hover: hover) {
    .pl-card:not(.is-selected):hover { background: var(--surface); }
}

/* Playlist cover */
.cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-art);
    /* the same colored placeholder as the day tiles while the cover loads */
    background:
        radial-gradient(120% 120% at 15% 10%, hsl(var(--hue, 0) 70% 72%), transparent 60%),
        linear-gradient(135deg, hsl(var(--hue, 0) 55% 45%), hsl(calc(var(--hue, 0) + 50) 60% 30%));
    box-shadow: var(--shadow-art);
}

.cover > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.35s;
}

.cover > img.loaded { opacity: 1; }




/* Same spacing above Play / Shuffle as the home page; the description tucks under the subtitle */
.pl-desc { margin: -12px 0 16px; color: var(--muted); font-size: 14px; }



.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-tools { display: flex; gap: 8px; }

/* ---------- Library ---------- */

.library.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 24px 18px;
}

.card {
    display: block;
    width: 100%;
    text-align: left;
    border-radius: var(--radius-art);
}

.card .art { transition: transform 0.2s var(--ease), box-shadow 0.2s; }

@media (hover: hover) {
    .card:hover .art { transform: translateY(-2px); box-shadow: var(--shadow-float); }
    .card:hover .hover-play { opacity: 1; transform: none; }
}

.card:active .art { transform: scale(0.97); }

.hover-play {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s, transform 0.2s var(--ease);
}

.hover-play svg { width: 20px; height: 20px; }

.card-text { display: block; padding-top: 8px; min-width: 0; }

.card-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-sub {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card.is-current .card-title { font-weight: 800; }
.card.is-current .eq { display: flex; }
.card.is-current .hover-play { display: none; }

.card.is-unavailable { opacity: 0.45; cursor: default; }
.card.is-unavailable .hover-play { display: none; }

/* List layout, after the ellomix playlist view */
.library.list { display: flex; flex-direction: column; }

.library.list .card,
.row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
}

.library.list .card .art,
.row .art {
    width: 56px;
    border-radius: 4px;
    font-size: 0.55em;
    box-shadow: none;
    flex: none;
}

.library.list .card-text,
.row .card-text { padding-top: 0; flex: 1; }

/* Track numbers for releases with an official order (list view only) */
.track-no { display: none; }
.library.list .track-no {
    display: block;
    width: 18px;
    flex: none;
    text-align: right;
    color: var(--muted);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.library.list .card-title,
.row .card-title { font-size: 17px; font-weight: 500; }

.library.list .card.is-current .card-title { font-weight: 800; }

.library.list .eq,
.row .eq { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); }

.library.list .hover-play { display: none; }

.row { width: 100%; text-align: left; }


/* States */
.skeleton .art { box-shadow: none; background: var(--surface); }
.skeleton .bar { display: block; height: 12px; margin-top: 8px; border-radius: 4px; background: var(--surface); }
.skeleton .bar + .bar { width: 50%; }
.shimmer { position: relative; overflow: hidden; }
.shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.hero.is-loading .hero-art { background: var(--surface); }

.empty,
.error {
    grid-column: 1 / -1;
    padding: 48px 16px;
    text-align: center;
    color: var(--muted);
}

.error strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 4px; }
.error .pill { margin-top: 16px; }

/* ---------- Mini player ---------- */

.mini {
    position: fixed;
    z-index: 30;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    height: var(--mini-h);
    padding: 0 6px 0 8px;
    border-radius: 14px;
    background: var(--elevated);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: var(--shadow-float);
    overflow: hidden;
    animation: rise 0.35s var(--ease);
}

@keyframes rise { from { transform: translateY(120%); } }

.mini-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--line);
}

.mini-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--text);
    transform-origin: left;
    transform: scaleX(0);
}

.mini-open {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    text-align: left;
}

.mini-art { width: 48px; flex: none; }
.mini-art .art { border-radius: 6px; font-size: 0.45em; box-shadow: none; }

.mini-text { min-width: 0; display: flex; flex-direction: column; }
.mini-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mini-controls { display: flex; align-items: center; }

@media (max-width: 599px) {
    .hide-sm { display: none; }
}

/* Loading spinner on play buttons while audio buffers */
.play-btn { position: relative; }
.play-btn.is-buffering::before {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: currentColor;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Full-screen now playing ---------- */

.np {
    position: fixed;
    inset: 0;
    z-index: 50;
    overflow-y: auto;
    overflow-x: hidden;          /* up and down only, like the page */
    overscroll-behavior: contain;
    touch-action: pan-y pinch-zoom;
    background: var(--bg);
    transform: translateY(100%);
    transition: transform 0.42s var(--ease);
}

.np.is-open { transform: none; }

.np-bg {
    position: absolute;
    inset: 0 0 auto;
    height: 75vh;
    background-size: cover;
    background-position: center;
    filter: blur(60px) saturate(1.6);
    opacity: 0.35;
    transform: scale(1.3);
    pointer-events: none;
    -webkit-mask-image: linear-gradient(#000 30%, transparent);
    mask-image: linear-gradient(#000 30%, transparent);
}

.np-inner {
    position: relative;
    max-width: 460px;
    margin: 0 auto;
    padding: calc(8px + env(safe-area-inset-top)) 22px calc(32px + env(safe-area-inset-bottom));
}

.np-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -10px 12px;
}

/* Now Playing opens with the close button focused; no ring around it */
#npClose:focus-visible { outline: none; }

.np-context { display: flex; flex-direction: column; align-items: center; font-size: 15px; }
.np-context-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.np-art .art {
    font-size: 2em;
    border-radius: 10px;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.28), 0 4px 10px rgba(0, 0, 0, 0.1);
    transform: scale(0.86);
    transition: transform 0.45s var(--ease), box-shadow 0.45s;
}

body.is-playing .np-art .art { transform: none; }

.np-meta {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    margin: 20px -10px 8px;
}

.np-titles { min-width: 0; text-align: center; }
.np-titles h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.np-titles p { margin: 2px 0 0; color: var(--muted); font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

input[type="range"] {
    --p: 0%;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 24px;
    margin: 0;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--text) var(--p), var(--surface-2) var(--p));
}

input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--text) var(--p), var(--surface-2) var(--p));
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--text);
    border: 0;
    transition: transform 0.15s;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text);
    border: 0;
}

input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.35); }

.np-times {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.np-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin: 14px 0 10px;
}

.play-btn.xl {
    width: 76px;
    height: 76px;
    background: var(--accent);
    color: var(--on-accent);
}

.play-btn.xl svg { width: 36px; height: 36px; }

.np-volume {
    display: none;
    align-items: center;
    gap: 6px;
    color: var(--muted);
}

@media (hover: hover) and (pointer: fine) {
    .np-volume { display: flex; }
}

.up-next { margin-top: 28px; }
.up-next .section-title { font-size: 18px; margin-bottom: 4px; }
.up-next ol { list-style: none; margin: 0; padding: 0; }
.up-next .row .art { width: 44px; }
.up-next .row .card-title { font-size: 16px; }

/* No vertical scrollbar on mobile; the page and Now Playing still scroll */
@media (max-width: 719px), (pointer: coarse) {
    html, .np { scrollbar-width: none; }
    html::-webkit-scrollbar, .np::-webkit-scrollbar { display: none; }
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    z-index: 60;
    left: 50%;
    bottom: calc(var(--mini-h) + 28px + env(safe-area-inset-bottom));
    max-width: calc(100% - 32px);
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */

@media (min-width: 720px) {
    :root { --page-pad: 28px; }
    .hero { column-gap: 32px; margin-bottom: 40px; }
    .library.grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 32px 24px; }
}

@media (max-width: 420px) {
    .pill { height: 42px; padding: 0 20px; font-size: 16px; }
    .section-tools { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
