/* ── VARIABLES ── */
:root {
    --bg: #141413;
    --surface: #1b1b19;
    --surface-2: #242421;
    --surface-3: #2e2e2a;
    --text: #f0ede8;
    --text-soft: rgba(240, 237, 232, 0.92);
    --text-faint: rgba(240, 237, 232, 0.72);
    --rule: rgba(240, 237, 232, 0.14);
    --rule-mid: rgba(240, 237, 232, 0.28);
    --btn-fill: #f0ede8;
    --btn-text: #0d0d0d;
    --spotify: #1db954;
    --spotify-bright: #1ed760;

    --sidebar-w: 272px;
    --queue-w: 340px;
    --bar-h: 80px;
    --pl: #6b7078; /* playlist colour, set per view */

    /* Spotify's own typeface (Circular / Spotify Mix) is licensed, so the
       closest free match, Figtree, stands in. If you own Circular, add an
       @font-face for it and it will be picked up first. */
    --font: "Circular Std", "Circular", "CircularSp", "Spotify Mix", "Figtree",
        system-ui, -apple-system, "Segoe UI", sans-serif;
    --sans: var(--font);
    --serif: var(--font);
}

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

html {
    color-scheme: dark;
}

body {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    cursor: pointer;
}

a {
    color: inherit;
}

img {
    display: block;
}

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

/* Slim, unobtrusive scrollbars. */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--rule-mid) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--rule-mid);
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
    background-clip: content-box;
}

.sr-only,
.skip-link:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link:focus {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 300;
    padding: 0.5rem 1rem;
    background: var(--btn-fill);
    color: var(--btn-text);
    border-radius: 8px;
    font-family: var(--sans);
}

[hidden] {
    display: none !important;
}

/* ── ICONS ── */
[data-icon] {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

[data-icon] svg,
.ico {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Icons inside buttons should never fill the whole hit area. */
.icon-btn .ico,
.icon-btn [data-icon] {
    width: 18px;
    height: 18px;
}

.ico.fill,
.ico .fill {
    fill: currentColor;
    stroke: none;
}

/* ── LAYOUT ── */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) var(--bar-h);
    height: 100dvh;
}

.sidebar {
    grid-row: 1;
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.25rem 0.75rem 0.75rem;
    overflow-y: auto;
    border-right: 1px solid var(--rule);
}

.main {
    grid-row: 1;
    grid-column: 2;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    outline: none;
    scroll-behavior: smooth;
}

.queue-panel {
    grid-row: 1;
    grid-column: 3;
    width: var(--queue-w);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--rule);
    background: var(--surface);
    min-height: 0;
}

.player-bar {
    grid-row: 2;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 1.1fr) minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    background: var(--surface);
    border-top: 1px solid var(--rule);
}

.mobile-nav {
    display: none;
}

/* ── SIDEBAR ── */
.sidebar-top {
    padding: 0 0.5rem 1rem;
}

.brand {
    display: block;
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 800;
    text-decoration: none;
    line-height: 1.1;
}

.sidebar-back {
    display: inline-block;
    margin-top: 0.4rem;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--text-faint);
    text-decoration: none;
}

.sidebar-back:hover {
    color: var(--text);
}

.side-nav {
    display: flex;
    flex-direction: column;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-soft);
    transition: background 0.15s ease, color 0.15s ease;
}

.side-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.side-link.active {
    color: var(--text);
    background: var(--surface-3);
}

.side-count {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--text-faint);
}

.side-label {
    margin: 1.25rem 0.7rem 0.4rem;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.side-playlists {
    display: flex;
    flex-direction: column;
}

.side-pl {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 0.7rem;
    align-items: center;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.side-pl:hover {
    background: var(--surface-2);
}

.side-pl.active {
    background: var(--surface-3);
}

.side-pl img,
.thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 5px;
    background: var(--surface-3);
}

.side-pl-title {
    font-size: 0.92rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.side-pl-sub {
    font-family: var(--sans);
    font-size: 0.75rem;
    color: var(--text-faint);
}

.side-pl.is-playing .side-pl-title {
    color: var(--spotify-bright);
}

/* ── VIEWS ── */
.view {
    padding-bottom: 3rem;
}

.view-pad {
    padding: 2rem 2.5rem 0;
}

.view-title {
    font-size: clamp(1.9rem, 4.5vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.view-sub {
    margin-top: 0.4rem;
    color: var(--text-soft);
    font-size: 1rem;
}

.section-title {
    margin: 2.25rem 2.5rem 0.85rem;
    font-size: 1.35rem;
    font-weight: 700;
}

.eyebrow {
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-soft);
}

/* playlist / liked header, tinted with the playlist colour */
.hero {
    position: relative;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.75rem;
    align-items: end;
    padding: 2.5rem 2.5rem 1.5rem;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--pl) 60%, var(--bg)) 0%,
        color-mix(in srgb, var(--pl) 22%, var(--bg)) 100%
    );
}

.hero-cover {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    background: color-mix(in srgb, var(--pl) 40%, var(--bg));
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    display: grid;
    place-items: center;
    color: var(--text);
}

.hero-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-cover .ico {
    width: 72px;
    height: 72px;
}

.hero h1 {
    margin: 0.3rem 0 0.45rem;
    font-size: clamp(2rem, 5.5vw, 4rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.hero p {
    font-size: 1rem;
    color: var(--text);
    max-width: 60ch;
}

.hero .hero-meta {
    margin-top: 0.6rem;
    font-family: var(--sans);
    font-size: 0.9rem;
    color: var(--text-soft);
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem 0.5rem;
    flex-wrap: wrap;
}

.big-play {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--spotify);
    color: var(--btn-text);
    transition: transform 0.12s ease, background 0.15s ease;
}

.big-play:hover {
    background: var(--spotify-bright);
    transform: scale(1.05);
}

.big-play .ico {
    width: 24px;
    height: 24px;
}

.btn {
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--rule-mid);
    text-decoration: none;
    color: var(--text);
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.btn:hover {
    background: var(--surface-2);
    border-color: var(--text-faint);
}

.btn[aria-pressed="true"] {
    border-color: var(--spotify);
    color: var(--spotify-bright);
}

.btn .ico {
    width: 16px;
    height: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

.btn-icon .ico {
    width: 18px;
    height: 18px;
}

.toolbar {
    margin-left: auto;
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.field {
    font-family: var(--sans);
    font-size: 0.95rem;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--rule-mid);
    background: var(--surface);
    min-width: 0;
}

.field::placeholder {
    color: var(--text-faint);
}

.field:focus {
    outline: none;
    border-color: var(--text);
}

select.field option {
    background: var(--surface);
}

.search-box {
    position: relative;
    max-width: 560px;
    margin-top: 1.25rem;
}

.search-box .field {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 3rem;
    font-size: 1.05rem;
    border-radius: 999px;
    background: var(--surface-2);
}

.search-box [data-icon] {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    pointer-events: none;
}

/* ── CARDS ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem 1rem;
    padding: 0 2.5rem;
}

.card {
    position: relative;
    padding: 0.75rem;
    border-radius: 10px;
    background: var(--surface);
    transition: background 0.15s ease;
}

.card:hover {
    background: var(--surface-2);
}

.card-link {
    display: block;
    text-decoration: none;
}

.card-link:focus-visible {
    outline-offset: 4px;
}

.card-cover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-3);
    margin-bottom: 0;
}

.card-media .card-link {
    display: block;
}

.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card p {
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-top: 0.15rem;
}

.card-media {
    position: relative;
    margin-bottom: 0.75rem;
}

.card-play {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--spotify);
    color: var(--btn-text);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.card:hover .card-play,
.card:focus-within .card-play,
.card.is-playing .card-play {
    opacity: 1;
    transform: translateY(0);
}

.card-play:hover {
    background: var(--spotify-bright);
}

.card-play .ico {
    width: 20px;
    height: 20px;
}

/* ── TRACK LIST ── */
.tracks {
    padding: 0.5rem 1.25rem 0;
}

.row,
.row-head {
    display: grid;
    grid-template-columns: 36px minmax(0, 6fr) minmax(0, 4fr) 64px 76px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
}

.tracks.with-cover .row,
.tracks.with-cover .row-head {
    grid-template-columns: 36px minmax(0, 6fr) minmax(0, 4fr) 64px 76px;
}

.row-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg);
    border-radius: 0;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 0.35rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.row-head button {
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    text-align: left;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.row-head button:hover,
.row-head button[aria-sort="ascending"],
.row-head button[aria-sort="descending"] {
    color: var(--text);
}

.row-head .num-h,
.row .num {
    text-align: center;
}

.row {
    cursor: pointer;
    user-select: none;
    min-height: 56px;
}

.row:hover,
.row:focus-visible {
    background: var(--surface-2);
}

.row:focus-visible {
    outline-offset: -2px;
}

.row.is-current {
    background: var(--surface);
}

.row .num {
    position: relative;
    height: 24px;
    display: grid;
    place-items: center;
    font-family: var(--sans);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
}

.row .num > * {
    grid-area: 1 / 1;
}

/* The number stays put; only a playing track swaps it for the equaliser. */
.eq {
    display: none;
    width: 14px;
    height: 14px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2px;
}

.row.is-current.is-playing .eq {
    display: flex;
}

.row.is-current.is-playing .idx {
    display: none;
}

.eq i {
    display: block;
    width: 3px;
    height: 40%;
    background: var(--spotify-bright);
    border-radius: 1px;
}

.row.is-playing .eq i {
    animation: eq 0.9s ease-in-out infinite alternate;
}

.row.is-playing .eq i:nth-child(2) {
    animation-delay: -0.3s;
}

.row.is-playing .eq i:nth-child(3) {
    animation-delay: -0.6s;
}

@keyframes eq {
    from {
        height: 25%;
    }
    to {
        height: 100%;
    }
}

.cell-title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.cell-title .thumb {
    width: 40px;
    height: 40px;
}

.t-text {
    min-width: 0;
}

.t-title {
    font-size: 0.94rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row.is-current .t-title {
    color: var(--spotify-bright);
}

.t-artist {
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-album {
    font-size: 0.8rem;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-time {
    font-family: var(--sans);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
    text-align: right;
}

.cell-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.15rem;
}

.row .icon-btn.like-btn:not([aria-pressed="true"]),
.row .more-btn {
    opacity: 0;
}

.row:hover .icon-btn,
.row:focus-within .icon-btn,
.row .like-btn[aria-pressed="true"] {
    opacity: 1;
}

.empty {
    padding: 3rem 2.5rem;
    color: var(--text-soft);
    font-size: 1rem;
    max-width: 52ch;
}

/* ── BUTTONS ── */
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: var(--text-soft);
    transition: color 0.15s ease, background 0.15s ease, transform 0.12s ease;
    position: relative;
    flex: 0 0 auto;
}

.icon-btn:hover {
    color: var(--text);
}

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

.icon-btn[aria-pressed="true"] {
    color: var(--spotify-bright);
}

.icon-btn[aria-pressed="true"]::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 3px;
    height: 3px;
    margin-left: -1.5px;
    border-radius: 50%;
    background: currentColor;
}

.like-btn[aria-pressed="true"] {
    color: var(--spotify-bright);
}

.like-btn[aria-pressed="true"]::after {
    display: none;
}

.like-btn[aria-pressed="true"] .ico {
    fill: currentColor;
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.text-btn {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 600;
    width: auto;
    min-width: 32px;
    padding: 0 0.35rem;
    border-radius: 999px;
}

.icon-btn.has-badge::before {
    content: attr(data-badge);
    position: absolute;
    top: 0;
    right: -3px;
    font-family: var(--sans);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--spotify);
    color: var(--btn-text);
    line-height: 1.4;
}

/* ── PLAYER BAR ── */
.pb-track {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.pb-cover {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    flex: 0 0 auto;
    background: var(--surface-3);
    padding: 0;
}

.pb-cover img,
.np-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pb-text {
    min-width: 0;
    flex: 1 1 auto;
}

.pb-title {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-artist {
    font-size: 0.75rem;
    color: var(--text-soft);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-center {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
}

.controls .icon-btn .ico.fill {
    width: 18px;
    height: 18px;
}

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--btn-fill);
    color: var(--btn-text);
    transition: transform 0.12s ease;
}

.play-btn:hover {
    transform: scale(1.06);
}

.play-btn .ico {
    width: 18px;
    height: 18px;
}

.seek {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--sans);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
}

.seek [data-role="cur"] {
    text-align: right;
}

.pb-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.15rem;
    min-width: 0;
}

.volume {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    margin-left: 0.25rem;
}

.volume input {
    width: 80px;
}

.demo-pill {
    font-family: var(--sans);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    margin-right: 0.3rem;
    border: 1px solid var(--rule-mid);
    border-radius: 999px;
    color: var(--text-soft);
    cursor: help;
}

/* range sliders */
input[type="range"] {
    --p: 0%;
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    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(--rule-mid) var(--p)
    );
}

input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: var(--rule-mid);
}

input[type="range"]::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--text);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--text);
    border: 0;
    opacity: 0;
    transition: opacity 0.12s ease;
}

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

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus-visible::-webkit-slider-thumb,
input[type="range"]:active::-webkit-slider-thumb {
    opacity: 1;
}

input[type="range"]:hover::-moz-range-thumb,
input[type="range"]:focus-visible::-moz-range-thumb {
    opacity: 1;
}

input[type="range"]:hover::-webkit-slider-runnable-track {
    background: linear-gradient(
        to right,
        var(--spotify-bright) var(--p),
        var(--rule-mid) var(--p)
    );
}

/* ── QUEUE PANEL ── */
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0.75rem 0.4rem 1.25rem;
}

.panel-head h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.6rem 1.25rem;
}

.q-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 1rem 0.65rem 0.4rem;
}

.q-head h3 {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.link-btn {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--text-faint);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.link-btn:hover {
    color: var(--text);
}

.q-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
}

.q-item:hover,
.q-item:focus-visible {
    background: var(--surface-2);
}

.q-item.dragging {
    opacity: 0.4;
}

.q-item.drop-before {
    box-shadow: 0 -2px 0 var(--spotify-bright);
}

.q-item.drop-after {
    box-shadow: 0 2px 0 var(--spotify-bright);
}

.q-item .thumb {
    width: 40px;
    height: 40px;
}

.q-item.is-now .t-title {
    color: var(--spotify-bright);
}

.q-item .icon-btn {
    opacity: 0;
}

.q-item:hover .icon-btn,
.q-item:focus-within .icon-btn {
    opacity: 1;
}

.q-empty {
    padding: 0.5rem 0.75rem;
    color: var(--text-faint);
    font-size: 0.9rem;
}

/* ── NOW PLAYING (full screen) ── */
.np {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    flex-direction: column;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--pl) 65%, var(--bg)) 0%,
        var(--bg) 85%
    );
    overflow-y: auto;
    overscroll-behavior: contain;
}

.np-top {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    padding: 0.75rem 1rem 0;
}

.np-from {
    text-align: center;
    line-height: 1.3;
}

.np-from span {
    display: block;
    font-family: var(--sans);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.np-from strong {
    font-weight: 600;
    font-size: 0.85rem;
}

.np-body {
    width: min(100%, 480px);
    margin: 0 auto;
    padding: 1.25rem 1.25rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.np-cover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.np-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.np-title {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.15;
}

.np-artist {
    font-size: 0.95rem;
    color: var(--text);
}

.np-album {
    font-size: 0.82rem;
    color: var(--text-soft);
}

.np-controls {
    gap: 0.75rem;
}

.np-controls .play-btn {
    width: 56px;
    height: 56px;
}

.np-controls .play-btn .ico {
    width: 24px;
    height: 24px;
}

.np-extra {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

/* ── MENU, TOAST, HELP ── */
.menu {
    position: fixed;
    z-index: 200;
    min-width: 200px;
    max-width: 300px;
    padding: 0.35rem;
    border: 1px solid var(--rule-mid);
    border-radius: 10px;
    background: var(--surface-2);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.menu button,
.menu a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    color: var(--text);
}

.menu button:hover,
.menu a:hover,
.menu button:focus-visible,
.menu a:focus-visible {
    background: var(--surface-3);
    outline: none;
}

.menu .ico {
    width: 16px;
    height: 16px;
}

.menu .check {
    margin-left: auto;
    color: var(--spotify-bright);
}

.menu hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 0.35rem 0.25rem;
}

.menu .menu-label {
    padding: 0.4rem 0.75rem 0.2rem;
    font-family: var(--sans);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--bar-h) + 0.75rem);
    z-index: 250;
    transform: translate(-50%, 12px);
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    background: var(--btn-fill);
    color: var(--btn-text);
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.help {
    margin: auto;
    padding: 1.75rem 2rem;
    border: 1px solid var(--rule-mid);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    width: min(92vw, 460px);
}

.help::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.help h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.help dl > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--rule);
}

.help dt {
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.help dd {
    color: var(--text-soft);
    text-align: right;
    font-size: 0.95rem;
}

.help form {
    margin-top: 1.25rem;
}

.row-head .h-duration {
    justify-self: end;
    text-align: right;
}

.row-head button {
    justify-self: start;
}

.side-pl > span {
    min-width: 0;
}

.side-pl-title,
.side-pl-sub {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.count {
    margin-left: 0.4rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-faint);
}

.np-cover {
    max-width: min(100%, 46vh);
    margin-inline: auto;
}

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
    .pb-right .demo-pill {
        display: none;
    }
    .volume input {
        width: 64px;
    }
}

@media (max-width: 1000px) {
    .volume input,
    .pb-right [data-act="open-now-playing"] {
        display: none;
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-w: 0px;
    }
    .sidebar {
        display: none;
    }
    .row,
    .row-head,
    .tracks.with-cover .row,
    .tracks.with-cover .row-head {
        grid-template-columns: 32px minmax(0, 1fr) 60px 76px;
    }
    .cell-album,
    .row-head .h-album {
        display: none;
    }
}

@media (max-width: 800px) {
    :root {
        --bar-h: 104px;
    }

    .app {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto auto;
    }

    .sidebar {
        display: none;
    }

    .main {
        grid-column: 1;
    }

    .queue-panel {
        position: fixed;
        inset: 0;
        z-index: 110;
        width: auto;
        border-left: 0;
    }

    .player-bar {
        grid-column: 1;
        grid-row: 2;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "track controls"
            "seek seek";
        gap: 0.2rem 0.6rem;
        padding: 0.5rem 0.75rem 0.35rem;
        height: auto;
    }

    .pb-track {
        grid-area: track;
    }

    .pb-center {
        display: contents;
    }

    .pb-center .controls {
        grid-area: controls;
        justify-content: flex-end;
        gap: 0.15rem;
    }

    .pb-center .controls [data-act="shuffle"],
    .pb-center .controls [data-act="repeat"],
    .pb-center .controls [data-act="prev"] {
        display: none;
    }

    .pb-center .seek {
        grid-area: seek;
        grid-template-columns: 36px minmax(0, 1fr) 36px;
    }

    .pb-right,
    .pb-track .like-btn {
        display: none;
    }

    .pb-cover {
        width: 44px;
        height: 44px;
    }

    .mobile-nav {
        grid-row: 3;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        border-top: 1px solid var(--rule);
        background: var(--surface);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav a,
    .mobile-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.15rem;
        padding: 0.55rem 0 0.5rem;
        font-family: var(--sans);
        font-size: 0.75rem;
        text-decoration: none;
        color: var(--text-faint);
    }

    .mobile-nav .active {
        color: var(--text);
    }

    .toast {
        bottom: calc(var(--bar-h) + 4rem);
    }

    .view-pad {
        padding: 1.5rem 1.25rem 0;
    }

    .hero {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        padding: 2rem 1.25rem 1.25rem;
        gap: 1.25rem;
    }

    .hero-cover {
        width: 160px;
        height: 160px;
    }

    .actions {
        padding: 1rem 1.25rem 0.5rem;
    }

    .toolbar {
        margin-left: 0;
        width: 100%;
    }

    .toolbar .field:first-child {
        flex: 1;
    }

    .section-title {
        margin: 2rem 1.25rem 0.75rem;
    }

    .card-play {
        opacity: 1;
        transform: none;
        width: 40px;
        height: 40px;
    }

    .card-grid {
        padding: 0 1.25rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .tracks {
        padding: 0.5rem 0.65rem 0;
    }

    .row,
    .row-head,
    .tracks.with-cover .row,
    .tracks.with-cover .row-head {
        grid-template-columns: 28px minmax(0, 1fr) 76px;
        gap: 0.5rem;
        padding: 0.35rem 0.5rem;
    }

    .cell-time {
        display: none;
    }

    .row-head .h-duration {
        display: none;
    }

    .row .icon-btn.like-btn:not([aria-pressed="true"]),
    .row .more-btn {
        opacity: 1;
    }

    .empty {
        padding: 2rem 1.25rem;
    }
}

/* Touch devices have no hover: keep the row actions visible. */
@media (hover: none) {
    .row .icon-btn.like-btn:not([aria-pressed="true"]),
    .row .more-btn,
    .q-item .icon-btn {
        opacity: 1;
    }

    .card-play {
        opacity: 1;
        transform: none;
    }
}

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