/* ── Kit: shared browse-page primitives ─────────────────────────────── */
:root {
    --k-raised: rgba(255,255,255,.06);
    --k-line: rgba(255,255,255,.08);
    --k-hover: rgba(255,255,255,.12);
    --k-accent: var(--primary);
    --k-radius: 12px;
}

/* Section head */
.k-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.k-section-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.k-see-all { border: 0; background: none; padding: 8px 0; color: var(--text-secondary); font: 600 13px/1 inherit; cursor: pointer; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.k-see-all:hover { color: var(--text-primary); text-decoration: underline; }

/* Shelf */
.k-shelf { position: relative; margin: 0 calc(-1 * var(--content-pad)); }
.k-shelf-track { display: flex; gap: 12px; padding: 4px var(--content-pad) 12px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.k-shelf-track::-webkit-scrollbar { display: none; }
.k-shelf::after { content: ''; position: absolute; top: 0; right: 0; bottom: 12px; width: 32px; background: linear-gradient(90deg, transparent, var(--bg-base)); pointer-events: none; }
.k-shelf .k-card, .k-shelf .k-skel-card { flex: 0 0 calc((100vw - 2 * var(--content-pad) - 12px) / 2.4); scroll-snap-align: start; }
.k-shelf-btn { display: none; }

/* Card */
.k-card { display: flex; flex-direction: column; gap: 8px; width: 100%; min-width: 0; padding: 10px; border: 0; border-radius: var(--k-radius); background: var(--k-raised); color: var(--text-primary); text-align: left; text-decoration: none; cursor: pointer; transition: background .2s, transform .12s; }
.k-card:hover { background: var(--k-hover); }
.k-card:active { transform: scale(.98); }
.k-card-art { position: relative; display: block; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #282828; }
.k-card-art img, .k-hero-art img, .k-row-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.k-card.is-round .k-card-art { border-radius: 50%; }
.k-card.is-round { text-align: center; align-items: center; }
.k-card-title { font-size: 14px; font-weight: 600; line-height: 1.3; width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.k-card-sub { font-size: 13px; color: var(--text-secondary); width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.k-play { position: absolute; right: 8px; bottom: 8px; width: 44px; height: 44px; border-radius: 50%; background: var(--k-accent); color: #000; display: inline-flex; align-items: center; justify-content: center; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; box-shadow: 0 6px 16px rgba(0,0,0,.5); }
.k-play svg { width: 22px; height: 22px; fill: currentColor; }
.k-card:hover .k-play, .k-card:focus-visible .k-play { opacity: 1; transform: none; }
.k-dl { position: absolute; left: 8px; bottom: 8px; width: 36px; height: 36px; border-radius: 50%; background: var(--bg-highlight, #282828); color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.k-dl svg { width: 18px; height: 18px; fill: currentColor; }
.k-card:hover .k-dl, .k-card:focus-within .k-dl, .k-dl:focus-visible { opacity: 1; }
.k-dl:hover { background: var(--bg-press, #3e3e3e); }
.k-art-blank { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: rgba(255,255,255,.35); }
.k-art-blank svg { width: 40%; height: 40%; fill: currentColor; }

/* Row */
.k-list { display: flex; flex-direction: column; gap: 2px; }
.k-row { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto auto; align-items: center; gap: 12px; min-height: 56px; padding: 6px 10px; border-radius: 10px; color: var(--text-primary); transition: background .15s; }
.k-row:hover, .k-row:focus-within { background: var(--k-raised); }
.k-row.is-playing .k-row-title { color: var(--k-accent); }
.k-row-lead { position: relative; width: 28px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: 13px; }
.k-row-play { position: absolute; inset: -8px -8px; border: 0; background: none; color: var(--text-primary); display: none; align-items: center; justify-content: center; cursor: pointer; }
.k-row-play svg { width: 20px; height: 20px; fill: currentColor; }
.k-row:hover .k-row-play, .k-row:focus-within .k-row-play { display: inline-flex; }
.k-row:hover .k-row-idx, .k-row:focus-within .k-row-idx { visibility: hidden; }
.k-row-art { width: 44px; height: 44px; border-radius: 6px; overflow: hidden; background: #282828; flex: none; }
.k-row-art.is-round { border-radius: 50%; }
.k-row-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.k-row-title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-row-sub { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-row-sub .artist-link { cursor: pointer; }
.k-row-sub .artist-link:hover { color: var(--text-primary); text-decoration: underline; }
.k-row-meta { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-row-actions { display: flex; gap: 2px; }
.k-icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.k-icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.k-icon-btn:hover { background: var(--k-hover); color: var(--text-primary); }
.k-row[draggable="true"] { cursor: grab; }
.k-row.drag-over { box-shadow: inset 0 2px 0 var(--k-accent); }
.k-row.is-liked .k-row-art { background: linear-gradient(135deg, #450af5, #c4efd9); }
.k-list-head { display: none; }
.k-note { margin: 0 0 8px; }

/* Chips + pills */
.k-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.k-chips::-webkit-scrollbar { display: none; }
.k-chip, .k-pill { flex: none; height: 44px; padding: 0 16px; border: 1px solid var(--k-line); border-radius: 22px; background: var(--k-raised); color: rgba(255,255,255,.75); font: 600 13px/1 inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; text-decoration: none; }
.k-chip:hover, .k-pill:hover { background: var(--k-hover); color: #fff; }
.k-chip.is-on { background: #fff; color: #000; border-color: #fff; }
.k-chip svg { width: 16px; height: 16px; fill: currentColor; }
.k-chip-count { font-weight: 500; opacity: .7; }
.k-pill.is-primary { background: var(--k-accent); color: #000; border-color: transparent; }
.k-pill:disabled { opacity: .4; cursor: default; }

/* Pill input (Search) */
.k-pill-input { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px 0 14px; border-radius: 22px; background: var(--k-raised); border: 1px solid var(--k-line); }
.k-pill-input:focus-within { border-color: rgba(255,255,255,.3); background: var(--k-hover); }
.k-pill-input svg { width: 20px; height: 20px; fill: currentColor; color: var(--text-secondary); flex: none; }
.k-pill-input input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text-primary); font-size: 16px; outline: none; }
.k-pill-input input:focus-visible { background: none; box-shadow: none; }
.k-genre { display: flex; align-items: flex-end; min-height: 96px; padding: 12px; border: 0; border-radius: var(--k-radius); font: 700 16px/1.2 inherit; text-align: left; cursor: pointer; }
.k-genre:hover { filter: brightness(1.1); }

/* Hero */
.k-hero { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 8px 0 20px; text-align: center; position: relative; }
.k-hero::before { content: ''; position: absolute; inset: -20px calc(-1 * var(--content-pad)) 0; background: radial-gradient(60% 60% at 50% 0%, color-mix(in srgb, var(--k-accent) 28%, transparent), transparent 70%); pointer-events: none; z-index: -1; }
.k-hero-art { width: 160px; height: 160px; border-radius: 12px; overflow: hidden; background: #282828; box-shadow: 0 16px 48px rgba(0,0,0,.6); flex: none; }
.k-hero-art.is-mosaic { display: grid; grid-template-columns: 1fr 1fr; }
.k-hero.is-compact { flex-direction: row; text-align: left; padding: 12px; border-radius: var(--k-radius); background: var(--k-raised); align-items: center; }
.k-hero.is-compact::before { display: none; }
.k-hero.is-compact .k-hero-art { width: 120px; height: 120px; box-shadow: none; }
.k-hero-body { min-width: 0; }
.k-hero-kicker { display: inline-block; padding: 4px 10px; border-radius: 10px; background: var(--k-raised); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; }
.k-hero-title { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.k-hero-sub { margin: 6px 0 0; color: var(--text-secondary); font-size: 14px; }
.k-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center; margin-top: 14px; }
.k-hero.is-compact .k-hero-actions { justify-content: flex-start; }
.k-play-big { width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--k-accent); color: #000; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.k-play-big svg { width: 28px; height: 28px; fill: currentColor; }
.k-play-big:disabled { opacity: .4; cursor: default; }

/* KPI */
.k-kpis { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.k-kpi { padding: 16px; border-radius: var(--k-radius); background: var(--k-raised); }
.k-kpi.is-bad { box-shadow: inset 0 0 0 1px rgba(255,80,80,.5); }
.k-kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.k-kpi-label { margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.k-kpi-sub { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

/* Skeletons */
.k-skel { border-radius: var(--k-radius); }
.k-skel i, .k-skel b { display: block; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,.12), rgba(255,255,255,.06)); background-size: 200% 100%; animation: k-shimmer 1.4s ease infinite; }
.k-skel-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; width: 100%; }
.k-skel-card i { aspect-ratio: 1; }
.k-skel b { height: 12px; } .k-skel b.w60 { width: 60%; }
.k-skel-row { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; min-height: 56px; padding: 6px 10px; }
.k-skel-row i { width: 44px; height: 44px; }
.k-skel-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0 20px; }
.k-skel-hero i { width: 160px; height: 160px; }
.k-skel-kpi { height: 92px; background: var(--k-raised); }
@keyframes k-shimmer { to { background-position: -200% 0; } }

/* Empty */
.k-empty { margin: 24px auto; max-width: 420px; text-align: center; padding: 24px; color: rgba(255,255,255,.7); }
.k-empty-glyph { font-size: 44px; color: var(--k-accent); margin-bottom: 14px; }
.k-empty h3 { margin: 0 0 8px; font-size: 20px; color: #fff; }
.k-empty p { margin: 0 0 20px; font-size: 15px; }

/* Page-level layout helpers */
.k-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.k-tiles { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 0 0 24px; }
.k-tile { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px; border: 0; border-radius: 8px; background: var(--k-raised); color: var(--text-primary); text-align: left; cursor: pointer; overflow: hidden; }
.k-tile:hover { background: var(--k-hover); }
.k-tile img { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; flex: none; }
.k-tile span { font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.k-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.k-page-head h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.k-page-head .k-actions { display: flex; gap: 8px; }
.k-sticky { position: sticky; top: 0; z-index: 3; padding: 8px 0 12px; background: linear-gradient(var(--bg-base) 70%, transparent); }
.section { margin: 0 0 28px; }

/* Focus */
.k-card:focus-visible, .k-row:focus-visible, .k-chip:focus-visible, .k-pill:focus-visible, .k-icon-btn:focus-visible, .k-tile:focus-visible, .k-see-all:focus-visible, .k-play-big:focus-visible, .k-genre:focus-visible { outline: 2px solid var(--k-accent); outline-offset: 3px; }

@media (min-width: 768px) {
    .k-shelf .k-card, .k-shelf .k-skel-card { flex-basis: calc((100% - 5 * 12px) / 5); }
    .k-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
    .k-tiles { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .k-kpis { grid-template-columns: repeat(4, minmax(0,1fr)); }
    .k-hero { flex-direction: row; text-align: left; align-items: flex-end; gap: 24px; }
    .k-hero-actions { justify-content: flex-start; }
    .k-hero-art { width: 200px; height: 200px; }
    .k-hero-title { font-size: 40px; }
}
@media (min-width: 1024px) {
    .k-shelf .k-card, .k-shelf .k-skel-card { flex-basis: calc((100% - 7 * 12px) / 8); }
    /* Arrows: desktop only, shown while the pointer is over the shelf or
       an arrow has focus. Sit over the edge fades. */
    .k-shelf-btn { position: absolute; top: calc(50% - 6px - 22px); width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--bg-highlight, #282828); color: var(--text-primary); box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: pointer; opacity: 0; transition: opacity .15s; z-index: 1; display: inline-flex; align-items: center; justify-content: center; }
    .k-shelf-btn svg { width: 24px; height: 24px; fill: currentColor; }
    .k-shelf-btn.is-prev { left: calc(var(--content-pad) - 22px); transform: scaleX(-1); }
    .k-shelf-btn.is-next { right: calc(var(--content-pad) - 22px); }
    .k-shelf:hover .k-shelf-btn, .k-shelf-btn:focus-visible { opacity: 1; }
    .k-shelf-btn:hover { background: var(--bg-press, #3e3e3e); }
    .k-grid { grid-template-columns: repeat(6, minmax(0,1fr)); }
    .k-list-head { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 0 10px 8px; border-bottom: 1px solid var(--k-line); margin-bottom: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
}
@media (prefers-reduced-motion: reduce) {
    .k-skel i, .k-skel b { animation: none; }
    .k-shelf-track { scroll-snap-type: none; }
}

/* Your Music Zone */
/* .mz-page/.mz-sub are not in the brief's move list, but init() still emits
   them and every other kit page keeps its own page-wrapper class (home-page,
   library-page, search-page in style.css) — dropping them would leave #/me
   unpadded, so they come along too. No h1 rule here: the heading lives in
   .k-page-head, same as every other kit page, and .k-page-head h1 already
   supplies its size — an .mz-page h1 override at the same specificity would
   fight it depending on source order. */
.mz-page { padding: 24px 0 120px; max-width: 900px; }
.mz-sub { color: var(--text-secondary, #b3b3b3); margin: 0 0 28px; font-size: 0.92rem; }
.mz-section { margin: 0 0 28px; }
.mz-note { color: var(--text-secondary, #b3b3b3); font-size: 0.85rem; margin: 10px 0 0; }

/* 30-day activity bars */
.mz-bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding: 8px; border-radius: 10px; background: var(--bg-elevated, #181818); }
.mz-bar { flex: 1; min-height: 2px; height: var(--h, 2%); border-radius: 2px 2px 0 0; background: var(--accent, #1db954); }
.mz-bar.is-empty { background: var(--border, #2a2a2a); height: 2px; }

/* Achievement badges — laid out in a .k-grid .mz-badges wrapper, badge itself
   is a .k-card so k-card already supplies flex column, padding and background. */
.mz-badge { align-items: center; text-align: center; opacity: 0.55; }
.mz-badge.is-earned { opacity: 1; border-color: var(--primary, #1ED760); }
.mz-badge-icon { font-size: 26px; line-height: 1; }
.mz-badge-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.mz-badge-state { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary, #1ED760); }

/* Songs you skip — skippedSection still hand-rolls its own rows rather than
   UIKit.row, so its layout classes stay scoped under .mz-list to avoid
   colliding with .k-row's grid layout (top-song rows carry both .k-row and
   .mz-row, but live in a .k-list, never a .mz-list). */
.mz-list { display: flex; flex-direction: column; }
.mz-list .mz-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; cursor: pointer; transition: background 0.15s ease; }
.mz-list .mz-row:hover { background: var(--bg-elevated, #181818); }
.mz-list .mz-row.is-removed { opacity: 0.4; pointer-events: none; }
.mz-list .mz-row img { width: 44px; height: 44px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }
.mz-row-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mz-row-title, .mz-row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mz-row-sub { font-size: 0.8rem; color: var(--text-secondary, #b3b3b3); }
.mz-row-stat { font-size: 0.8rem; color: var(--text-secondary, #b3b3b3); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.mz-skip-rate { color: var(--warning, #e0a458); }
.mz-row-spacer { width: 32px; flex-shrink: 0; }

@media (max-width: 640px) {
    .mz-bars { height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
    .mz-list .mz-row { transition: none; }
}

/* Artist/Album pages: hero image bled edge-to-edge as a blurred banner.
   Assumes .main-content padding of 20px var(--content-pad) (see style.css). */
.k-hero-banner { position: relative; margin: -20px calc(-1 * var(--content-pad)) 0; padding: 20px var(--content-pad) 0; }
.k-hero-banner::before { content: ''; position: absolute; inset: 0; background: var(--k-banner) center/cover; filter: blur(40px) brightness(.45); z-index: -1; }
.k-hero-artist .k-hero-art { border-radius: 50%; }
