/* ---------- Tokens ---------- */
:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --soft: #f3f5f5;
    --line: #dfe4e4;
    --text: #182022;
    --muted: #5a6669;
    --accent: #0b7258;
    --accent-soft: #e4f2ed;
    --on-accent: #ffffff;
    --shadow: 0 6px 24px rgb(15 30 32 / .16);
    --radius: 8px;
    --gutter: 16px;
    --top: 56px;
    --tabs: 0px;
    --player: 0px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14181a;
        --soft: #1e2427;
        --line: #2f383b;
        --text: #e9eeee;
        --muted: #9eabad;
        --accent: #4cc9a0;
        --accent-soft: #1b322b;
        --on-accent: #0b1f19;
        --shadow: 0 6px 24px rgb(0 0 0 / .5);
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 12px); }

body {
    margin: 0;
    padding-bottom: calc(var(--tabs) + var(--player) + env(safe-area-inset-bottom));
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    overflow-wrap: break-word;
}

h1, h2, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1 { font-size: 1.5rem; line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.125rem; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
p a, .detail-note a, .facts a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
small { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main { display: block; min-height: 60vh; }
main:focus { outline: 0; }

.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon .solid, symbol .solid { fill: currentColor; stroke: none; }
.sprite { position: absolute; }
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--bg); }
.skip:focus { top: 8px; }
html:not(.js) .needs-js, .js .no-js { display: none; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 14px; height: var(--top); }
.logo { font-size: 1.1875rem; letter-spacing: -.02em; white-space: nowrap; }
.logo b { color: var(--accent); }
.top-nav { display: none; }

.search { position: relative; flex: 1; min-width: 0; }
.search-form { position: relative; display: block; }
.search-form .icon { position: absolute; left: 10px; top: 10px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search-form input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 38px;
    border: 1px solid transparent;
    border-radius: 20px;
    background: var(--soft);
    font-size: 16px; /* below 16px ios zooms the page on focus */
    appearance: none;
}
.search-form input::placeholder { color: var(--muted); opacity: 1; }
.search-form input:focus { outline: 0; border-color: var(--accent); background: var(--bg); }

.suggest {
    position: fixed;
    inset: calc(var(--top) + 1px) 0 auto;
    max-height: calc(100dvh - var(--top) - 1px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 0 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.suggest h3 { margin: 0; padding: 10px var(--gutter) 4px; font-size: .8125rem; font-weight: 600; color: var(--muted); }
.suggest-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 5px var(--gutter); }
.suggest-item .poster { width: 42px; }
.suggest-item.is-active, .suggest-item:hover { background: var(--soft); }
.suggest-item > span:last-child { min-width: 0; line-height: 1.3; }
.suggest-item b, .suggest-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item b { font-weight: 500; }
.suggest-all { color: var(--accent); font-weight: 600; }
.suggest-message { padding: 14px var(--gutter); color: var(--muted); }

/* ---------- Page blocks ---------- */
.crumbs { padding-top: 14px; font-size: .875rem; color: var(--muted); }
.crumbs ol { display: flex; white-space: nowrap; }
.crumbs li { display: flex; align-items: center; min-width: 0; }
.crumbs li:nth-child(-n+2) { flex: none; }
.crumbs li + li::before { content: "/"; margin-inline: 8px; opacity: .6; }
.crumbs a, .crumbs span { padding-block: 4px; overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { color: var(--accent); }

.intro { padding-top: 18px; }
.crumbs + .intro { padding-top: 8px; }
.intro p { margin-top: 6px; max-width: 65ch; color: var(--muted); }
.intro .pills, .intro .filter, .intro .letters { margin-top: 14px; }
.intro .filter + .filter { margin-top: 8px; }

.block { padding-top: 28px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.block-head a { flex: none; padding-block: 6px; font-size: .9375rem; color: var(--accent); }
.block-head a:hover { text-decoration: underline; }

.decade { padding-top: 24px; }
.decade h2 { margin-bottom: 10px; }

/* ---------- Posters and album cards ---------- */
.poster { position: relative; display: grid; place-items: center; flex: none; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius); background: var(--soft); color: var(--muted); }
.poster > .icon { grid-area: 1 / 1; width: 34%; height: 34%; opacity: .45; }
.poster img { grid-area: 1 / 1; z-index: 1; width: 100%; height: 100%; object-fit: cover; font-size: 0; }
.poster img.is-broken { visibility: hidden; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 30%; gap: 10px; margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 10px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.scroller > li { scroll-snap-align: start; }
.card a { display: block; }
.card-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 7px; font-size: .875rem; font-weight: 500; line-height: 1.3; }
.card-note { display: block; margin-top: 1px; font-size: .8125rem; color: var(--muted); }
.card a:hover .card-name { color: var(--accent); }

/* ---------- Links in rows ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills a, .filter a { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 20px; font-size: .9375rem; }
.pills a:hover, .filter a:hover, .letters a:hover { border-color: var(--accent); color: var(--accent); }

.filter { display: flex; gap: 8px; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); overflow-x: auto; scrollbar-width: none; }
.filter::-webkit-scrollbar { display: none; }
.filter a { flex: none; }
.filter a[aria-current], .letters a[aria-current] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.letters a { display: grid; place-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius); font-size: .9375rem; }

.names, .ranking { display: grid; column-gap: 32px; }
.names a, .ranking a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding-block: 8px; border-bottom: 1px solid var(--line); }
.names a:hover span, .ranking a:hover span { color: var(--accent); }
.names small, .ranking small { flex: none; }
.ranking { grid-template-columns: minmax(0, 1fr); counter-reset: rank; }
.ranking li { counter-increment: rank; }
.ranking a::before { content: counter(rank); width: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ranking a span { flex: 1; min-width: 0; }
/* ten are plenty on a phone, the full list is one tap away */
.ranking li:nth-child(n+11) { display: none; }

/* ---------- Tracks ---------- */
.tracks { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 40px; }
.track { display: flex; align-items: center; gap: 10px; min-height: 64px; border-bottom: 1px solid var(--line); }
.track-lead { position: relative; display: flex; align-items: center; flex: none; }
.track-number { width: 26px; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.track-lead .poster { width: 48px; border-radius: 6px; }
.track-play { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--accent); }
.track-number + .track-play { background: var(--soft); width: 40px; height: 40px; }
.track-play .icon { width: 20px; height: 20px; }
.poster + .track-play { position: absolute; inset: 0; z-index: 2; width: 48px; height: 48px; border-radius: 6px; color: #fff; }
.poster + .track-play .icon { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: rgb(10 18 20 / .66); }
.when-playing, .is-playing > .when-paused { display: none; }
.is-playing > .when-playing { display: block; }
.track-main { flex: 1; min-width: 0; padding-block: 9px; line-height: 1.35; }
.track-name { display: block; font-weight: 500; }
.track-name:hover, .track-note a:hover { color: var(--accent); }
.track-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; font-size: .8125rem; color: var(--muted); }
.track-time { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.track-get { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px; border-radius: 50%; color: var(--muted); }
.track-get:hover { color: var(--accent); }
.track.is-here .track-name, .track.is-current .track-name { color: var(--accent); font-weight: 600; }

/* ---------- Album and song header ---------- */
.detail { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 16px; align-items: start; padding-top: 12px; }
.detail > .poster { width: 100%; }
.detail-note { margin-top: 6px; font-size: .9375rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid var(--accent); border-radius: 22px; background: var(--accent); color: var(--on-accent); font-weight: 600; white-space: nowrap; }
.button:hover { filter: brightness(1.08); }
.button .icon { width: 18px; height: 18px; }
p .button.is-plain { background: none; color: var(--accent); text-decoration: none; }
.intro .actions { margin-top: 14px; }
.detail audio { width: 100%; margin-top: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 18px; font-size: .9375rem; }
.facts dt { font-size: .8125rem; color: var(--muted); }

/* artist profile: round photo, figures right under the name */
.profile { align-items: center; }
.profile > .poster { border-radius: 50%; }
.profile > .poster > .icon { width: 50%; height: 50%; stroke-width: 1.2; }
.profile .facts { gap: 8px 24px; margin-top: 10px; }
.profile dd { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.pager ul { display: flex; }
.pager a, .pager span { display: grid; place-items: center; min-width: 40px; height: 44px; padding-inline: 6px; border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.pager a:hover { background: var(--soft); }
.pager > a { padding-inline: 14px; border: 1px solid var(--line); color: var(--accent); }
.pager [aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- Footer ---------- */
.foot { margin-top: 48px; padding-block: 28px 24px; border-top: 1px solid var(--line); background: var(--soft); font-size: .9375rem; }
.foot-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.foot-about { grid-column: 1 / -1; }
.foot-about p { margin-top: 6px; max-width: 44ch; color: var(--muted); }
.foot h2 { margin-bottom: 4px; font-size: .9375rem; }
.foot li a { display: inline-block; padding-block: 7px; color: var(--muted); }
.foot li a:hover { color: var(--accent); }
.foot-end { margin-top: 20px; font-size: .8125rem; color: var(--muted); }

/* ---------- Bottom tabs (phones) ---------- */
.tabs { position: fixed; inset: auto 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tabs) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--bg); border-top: 1px solid var(--line); }
.tabs a { display: grid; place-content: center; justify-items: center; gap: 1px; font-size: .75rem; color: var(--muted); }
.tabs a[aria-current] { color: var(--accent); font-weight: 600; }

/* ---------- Player ---------- */
.has-player { --player: 62px; }
.bar { position: fixed; inset: auto 0 calc(var(--tabs) + env(safe-area-inset-bottom)); z-index: 29; background: var(--bg); border-top: 1px solid var(--line); }
.bar-row { display: flex; align-items: center; gap: 10px; height: 61px; }
.bar .poster { width: 44px; border-radius: 6px; }
.bar-open { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; }
.bar-text { min-width: 0; line-height: 1.3; }
.bar-text b, .bar-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-text b { font-size: .9375rem; font-weight: 600; }
.bar-progress { position: absolute; inset: -2px auto auto 0; height: 2px; background: var(--accent); }
.bar .bar-seek { display: none; }
.bar-buttons { display: flex; align-items: center; }
.round { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
.round:hover { background: var(--soft); }
.round:disabled { opacity: .35; cursor: default; background: none; }
.round.is-main { background: var(--accent); color: var(--on-accent); }
.is-loading .is-main { animation: pulse 1s ease-in-out infinite alternate; }
.bar .wide-only { display: none; }
.is-error { color: #b3261e !important; }

.seek { display: flex; align-items: center; gap: 10px; font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek span { min-width: 36px; }
.seek span:last-child { text-align: right; }
.seek input { flex: 1; min-width: 0; height: 28px; margin: 0; accent-color: var(--accent); cursor: pointer; }

.sheet { width: 100%; max-width: 480px; height: 100dvh; max-height: none; margin: 0 0 0 auto; padding: 0; border: 0; background: var(--bg); color: var(--text); }
.sheet[open] { display: flex; flex-direction: column; animation: rise .22s ease-out; }
.sheet::backdrop { background: rgb(10 18 20 / .45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 0 var(--gutter); }
.sheet-now { padding: 4px var(--gutter) 16px; border-bottom: 1px solid var(--line); text-align: center; }
.sheet-now .poster { width: min(52vw, 30dvh, 240px); margin: 4px auto 14px; }
.sheet-now b { display: block; font-size: 1.125rem; line-height: 1.3; }
.sheet-now p { font-size: .9375rem; color: var(--muted); }
.sheet-now .seek { margin-top: 10px; }
.sheet-buttons { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 4px; }
.sheet-buttons .round { width: 52px; height: 52px; }
.sheet-buttons .is-main { width: 60px; height: 60px; }
.sheet-queue { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
.sheet-queue button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 6px var(--gutter); text-align: left; }
.sheet-queue button:hover { background: var(--soft); }
.sheet-queue button > span:first-child { width: 24px; flex: none; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.sheet-queue .bar-text b { font-weight: 500; }
.sheet-queue [aria-current] { background: var(--accent-soft); }
.sheet-queue [aria-current] b { color: var(--accent); }

/* ---------- Page loading line ---------- */
.loading-line { position: fixed; inset: 0 0 auto; z-index: 60; height: 3px; background: var(--accent); transform-origin: left; animation: load 8s cubic-bezier(.1, .7, .2, 1) forwards; }

@keyframes load { from { transform: scaleX(.05); } to { transform: scaleX(.95); } }
@keyframes pulse { to { opacity: .55; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* ---------- Wider screens ---------- */
@media (max-width: 859px) {
    :root { --tabs: 56px; }
}

@media (max-width: 359px) {
    .detail { grid-template-columns: 84px minmax(0, 1fr); gap: 12px; }
    .detail .button { padding-inline: 10px; font-size: .9375rem; }
}

@media (min-width: 600px) {
    :root { --gutter: 24px; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
    .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; }
    .scroller { grid-auto-columns: 21%; gap: 16px; }
    .names { grid-template-columns: 1fr 1fr; }
    .detail { grid-template-columns: 200px minmax(0, 1fr); gap: 28px; padding-top: 18px; }
    .suggest { position: absolute; inset: calc(100% + 6px) 0 auto; max-height: min(560px, calc(100dvh - 80px)); border: 1px solid var(--line); border-radius: 12px; }
    .foot-cols { grid-template-columns: 2fr 1fr 1fr; }
    .foot-about { grid-column: auto; }
}

@media (min-width: 860px) {
    :root { --top: 64px; }
    .tabs { display: none; }
    .top-row { gap: 24px; }
    .top-nav { display: flex; gap: 2px; flex: 1; }
    .top-nav a { padding: 9px 11px; border-radius: 20px; font-size: .9375rem; }
    .top-nav a:hover { background: var(--soft); }
    .top-nav a[aria-current] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
    .search { flex: 0 1 320px; }
    .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .scroller { grid-auto-columns: calc((100% - 80px) / 6); }
    .card-name { font-size: .9375rem; }
    .names { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tracks.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 48px; }
    .ranking li:nth-child(n+11) { display: block; }
    .ranking li:nth-child(n+15) { display: none; }
    .block { padding-top: 36px; }
    .detail { grid-template-columns: 240px minmax(0, 1fr); }

    .has-player { --player: 76px; }
    .bar-row { height: 75px; gap: 24px; }
    .bar-open { flex: 0 1 300px; }
    .bar .poster { width: 52px; }
    .bar-progress { display: none; }
    .bar .bar-seek { display: flex; flex: 1; }
    .bar .wide-only { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (prefers-color-scheme: dark) {
    .is-error { color: #ffb4ab !important; }
}
