/* Sanctuary design system tokens, shared with MochiStream (sanctuary-frontend theme/Color.kt + theme/Theme.kt) */
:root {
  color-scheme: dark;
  /* Surfaces */
  --eclipse: #0b0a10;
  --midnight: #15131c;
  --onyx: #1b1924;
  --slate: #221f2c;
  --graphite: #2e2a38;
  --smoke: #3a3645;
  /* Primary */
  --champagne: #d7b673;
  --champagne-soft: #eed9b0;
  --champagne-deep: #463620;
  /* Text */
  --pearl: #ede8f2;
  --mist: #a29daf;
  --whisper: #6e6979;
  /* Accents */
  --lavender: #b8a8c9;
  --jade: #8fb69e;
  --coral: #e89a92;
  --amber: #e0a868;
  --online: #7bc79a;

  /* Material roles */
  --bg: var(--eclipse);
  --surface: var(--midnight);
  --surface-container: var(--onyx);
  --surface-container-high: var(--slate);
  --surface-container-highest: var(--smoke);
  --outline: var(--graphite);
  --outline-variant: var(--slate);
  --text: var(--pearl);
  --muted: var(--mist);
  --subtle: var(--whisper);
  --accent: var(--champagne);
  --on-accent: var(--eclipse);
  --active-tint: color-mix(in srgb, var(--champagne-deep) 35%, transparent);

  /* Dimens */
  --gutter: 20px;
  --corner-lg: 20px;
  --corner-md: 14px;
  --corner-sm: 8px;
  --card-gradient: linear-gradient(180deg, var(--surface-container), var(--surface));
  --luxe-gradient: linear-gradient(135deg, color-mix(in srgb, var(--champagne-deep) 55%, transparent), color-mix(in srgb, var(--slate) 55%, transparent));

  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --page-pad: clamp(20px, 4.1vw, 64px);
  --player-h: 0px;
  --tint: #2e2a38; /* the playing song's artwork colour, set by app.js */
}
body.has-player { --player-h: 92px; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 20px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .4; }
input, textarea { color: var(--text); }
::selection { background: color-mix(in srgb, var(--champagne) 40%, transparent); color: var(--pearl); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; }

/* Logo: Mochi's champagne tile, with sound bars in place of the letter */
.logo { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo-mark { width: 40px; height: 40px; display: inline-grid; place-items: center; background: var(--champagne); color: var(--eclipse); border-radius: 12px; flex-shrink: 0; }
.logo-mark svg { width: 24px; height: 24px; }
.logo-word { font-size: 17px; font-weight: 600; letter-spacing: -.2px; white-space: nowrap; color: var(--pearl); }
.logo-word span { font-weight: 300; color: var(--mist); }

/* Nav links (Library dropdown + mobile drawer) */
.nav-caption { padding: 0 14px; color: var(--mist); letter-spacing: .6px; font-weight: 500; font-size: 12px; margin: 8px 0 10px; text-transform: uppercase; }
.nav-caption-second { margin-top: 32px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 500; letter-spacing: .4px; padding: 12px 14px; color: var(--mist); border-radius: var(--corner-md); white-space: nowrap; transition: background .18s, color .18s; }
.nav-link svg { width: 22px; height: 22px; stroke-width: 1.75; }
.nav-link:hover { color: var(--pearl); background: var(--surface-container); }
.nav-link.active { color: var(--champagne); background: var(--active-tint); }
.nav-link > span:not([data-icon]):not(.nav-count) { overflow: hidden; text-overflow: ellipsis; }
button.nav-link { width: 100%; border: 0; background: transparent; text-align: left; }
.nav-count { margin-left: auto; padding: 1px 7px; border-radius: 999px; background: var(--surface-container-high); color: var(--mist); font-size: 10px; font-weight: 600; letter-spacing: 0; }

/* Workspace + top bar */
.workspace { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: relative; z-index: 6; height: 92px; display: flex; align-items: center; padding: 0 var(--page-pad); gap: 12px; }
.topbar > .logo { margin-right: clamp(8px, 2vw, 28px); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0; border: 0; border-radius: 12px; background: transparent; color: var(--pearl); transition: background .18s, color .18s; }
.icon-button:hover { background: var(--surface-container); color: var(--champagne); }
.icon-button [data-icon] { display: grid; place-items: center; }
.menu-button { display: none; margin-left: -8px; }
.top-link { height: 46px; display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 0 16px; border: 1px solid transparent; background: transparent; color: var(--mist); border-radius: 12px; font-size: 14px; font-weight: 500; letter-spacing: .4px; white-space: nowrap; transition: background .18s, color .18s, border-color .18s; }
.top-link [data-icon] { display: grid; place-items: center; }
.top-link svg { width: 19px; height: 19px; }
.top-link:hover { color: var(--pearl); background: var(--surface-container); }
.top-link.active { color: var(--champagne); background: var(--active-tint); }
.top-link .caret svg { width: 15px; height: 15px; transform: rotate(90deg); transition: transform .18s; }
.top-link[aria-expanded="true"] { color: var(--pearl); background: var(--surface-container); border-color: var(--outline-variant); }
.top-link[aria-expanded="true"] .caret svg { transform: rotate(-90deg); }
.library-menu { position: relative; }
/* Account (Sanctuary sign-in): the profile picture, or initials on champagne, as on auth.sk96.uk */
.account-menu { position: relative; }
.account-button { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; transition: box-shadow .18s; }
.account-button:hover, .account-button[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--champagne); }
.avatar { position: relative; width: 36px; height: 36px; flex-shrink: 0; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--champagne-deep); color: var(--champagne-soft); font-size: 13px; font-weight: 600; letter-spacing: .5px; user-select: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-panel { min-width: 260px; }
.account-head { display: flex; align-items: center; gap: 12px; padding: 8px 10px 12px; margin-bottom: 2px; border-bottom: 1px solid var(--outline); }
.account-head > div { min-width: 0; display: flex; flex-direction: column; }
.account-head strong { font-weight: 500; color: var(--pearl); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head small { color: var(--mist); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 240px; display: flex; flex-direction: column; gap: 4px; background: var(--slate); border: 1px solid var(--outline); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.55); padding: 6px; }
.library-panel .nav-link { padding: 10px 12px; border-radius: 10px; color: var(--pearl); }
.library-panel .nav-link svg { width: 20px; height: 20px; color: var(--mist); }
.library-panel .nav-link:hover { background: var(--surface-container-highest); }
.library-panel .nav-link.active, .library-panel .nav-link.active svg { color: var(--champagne); }

/* Mobile drawer */
.drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(300px, 84vw); background: var(--surface); border-right: 1px solid var(--outline-variant); box-shadow: 20px 0 60px rgba(0,0,0,.5); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); transform: translateX(-100%); visibility: hidden; transition: transform .26s ease, visibility 0s linear .26s; }
.drawer.open { transform: none; visibility: visible; transition: transform .26s ease; }
.drawer-head { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 20px; }
.drawer-scroll { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(11,10,16,.6); backdrop-filter: blur(4px); }
body.drawer-open { overflow: hidden; }
.section-tabs { display: flex; gap: 2px; padding: 4px; flex-shrink: 0; background: var(--surface-container); border: 1px solid var(--outline-variant); border-radius: 12px; }
.section-tab { height: 36px; display: inline-flex; align-items: center; padding: 0 14px; border: 0; background: transparent; border-radius: 9px; color: var(--mist); font-size: 14px; font-weight: 500; letter-spacing: .4px; white-space: nowrap; transition: background .18s, color .18s; }
.section-tab:hover { color: var(--pearl); }
.section-tab.active { color: var(--champagne); background: var(--active-tint); }
.search-box { position: relative; flex: 0 1 430px; min-width: 0; height: 46px; background: var(--surface-container); border: 1px solid var(--outline-variant); display: flex; align-items: center; gap: 12px; padding: 0 16px; border-radius: 12px; color: var(--mist); transition: border-color .2s; }
.search-box:focus-within { border-color: var(--champagne); }
.search-history { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; background: var(--slate); border: 1px solid var(--outline); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.55); padding: 6px; }
.search-history-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 10px; }
.search-history-head span { color: var(--mist); font-size: 11px; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; }
.search-history-clear { border: 0; background: none; color: var(--mist); font-size: 12px; font-weight: 500; letter-spacing: .4px; padding: 2px 6px; border-radius: 8px; }
.search-history-clear:hover { color: var(--champagne); }
.search-history-item { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--pearl); text-align: left; font-size: 14px; padding: 9px 10px; border-radius: 10px; }
.search-history-item svg { color: var(--whisper); flex-shrink: 0; }
.search-history-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-history-item:hover,.search-history-item.active { background: var(--surface-container-highest); }
.search-box svg { width: 18px; height: 18px; flex-shrink: 0; }
.search-box input { background: none; border: 0; outline: none; min-width: 0; width: 100%; font-size: 14px; }
.search-box input::placeholder { color: var(--whisper); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box kbd { font-family: var(--font); font-size: 11px; color: var(--mist); border: 1px solid var(--outline); min-width: 22px; text-align: center; padding: 1px 4px; border-radius: 6px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.install-button { height: 40px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--champagne); color: var(--on-accent); border-radius: 999px; font-size: 14px; font-weight: 600; letter-spacing: .4px; transition: background .2s; }
.install-button:hover { background: var(--champagne-soft); }
.install-button svg { width: 18px; height: 18px; }
.install-button [data-icon] { display: grid; place-items: center; }
.offline-banner { margin: 0 var(--page-pad) 8px; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--corner-md); background: color-mix(in srgb, var(--amber) 12%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); color: var(--amber); font-size: 13px; font-weight: 500; }
.offline-banner [data-icon] { display: grid; }

.main { width: 100%; flex: 1; padding: 8px var(--page-pad) calc(72px + var(--player-h)); }
.home-view { display: flex; flex-direction: column; gap: 40px; }

/* Spotlight (FeaturedWatchCard): the album cover blurred behind, sharp on the right */
.hero { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: end; margin: -100px calc(-1 * var(--page-pad)) 0; min-height: clamp(520px, 74vh, 760px); background: var(--bg); }
.hero-slide { position: absolute; inset: 0; display: flex; align-items: flex-end; isolation: isolate; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s linear .8s; }
.hero-slide.active { opacity: 1; visibility: visible; z-index: 1; transition: opacity .8s ease; }
.hero-image { position: absolute; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px); object-fit: cover; z-index: -3; filter: blur(48px) saturate(1.25); opacity: .55; transform: scale(1.1); }
.hero-wash { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(11,10,16,.92) 0%, rgba(11,10,16,.6) 38%, rgba(11,10,16,.15) 70%, transparent 100%), linear-gradient(0deg, var(--bg) 0%, rgba(11,10,16,.5) 22%, transparent 48%), linear-gradient(180deg, rgba(11,10,16,.8) 0%, transparent 26%); }
.hero-cover { position: absolute; right: calc(var(--page-pad) + 2vw); bottom: clamp(80px, 13vh, 132px); z-index: -2; width: clamp(240px, 30vw, 420px); aspect-ratio: 1; border-radius: 22px; object-fit: cover; box-shadow: 0 40px 90px rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.08); }
.hero-content { position: relative; z-index: 2; width: min(720px, 56%); padding: 0 var(--page-pad) clamp(56px, 10vh, 112px); }
.hero-label { color: var(--champagne); letter-spacing: 1.5px; font-weight: 500; font-size: 10px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.hero h1 { font-size: clamp(38px, 5vw, 68px); font-weight: 300; line-height: 1.08; letter-spacing: -1px; margin: 0 0 14px; text-wrap: balance; color: #fff; overflow-wrap: anywhere; }
.hero-artist { display: inline-block; font-size: 18px; font-weight: 500; color: var(--champagne-soft); margin-bottom: 14px; }
.hero-artist:hover { text-decoration: underline; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: rgba(255,255,255,.78); font-size: 13px; font-weight: 500; letter-spacing: .4px; margin-bottom: 26px; }
.hero-dots { position: absolute; left: calc(var(--page-pad) - 7px); bottom: clamp(16px, 3.4vh, 34px); z-index: 3; display: flex; align-items: center; }
.hero-dot { width: 10px; height: 10px; padding: 0; box-sizing: content-box; border: 7px solid transparent; background: rgba(255,255,255,.35); background-clip: padding-box; border-radius: 999px; transition: width .35s ease, background-color .35s ease; }
.hero-dot:hover { background-color: rgba(255,255,255,.6); }
.hero-dot.active { width: 32px; background-color: var(--champagne); }
.hero-arrow { position: absolute; bottom: clamp(16px, 3.4vh, 34px); z-index: 3; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(11,10,16,.35); color: var(--pearl); backdrop-filter: blur(12px); transition: background .18s, color .18s; }
.hero-arrow:hover { background: rgba(11,10,16,.6); color: var(--champagne); }
.hero-prev { right: calc(var(--page-pad) + 54px); }
.hero-prev svg { transform: rotate(180deg); }
.hero-next { right: var(--page-pad); }

/* Buttons (PillButton / GhostButton) */
.btn { border: 1px solid transparent; border-radius: 999px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 12px 22px; font-size: 14px; font-weight: 600; letter-spacing: .4px; transition: background .18s, border-color .18s, color .18s; white-space: nowrap; }
.btn-primary { color: var(--on-accent); background: var(--champagne); }
.btn-primary:hover { background: var(--champagne-soft); }
.btn-secondary { color: var(--pearl); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); backdrop-filter: blur(12px); }
.btn-secondary:hover { background: rgba(255,255,255,.18); }
.btn-secondary.active { color: var(--champagne); border-color: color-mix(in srgb, var(--champagne) 55%, transparent); }
.btn-outline { border-color: var(--outline); background: transparent; color: var(--mist); font-weight: 500; padding: 10px 18px; }
.btn-outline:hover { color: var(--pearl); border-color: var(--smoke); }
.btn-compact { padding: 7px 14px; font-size: 13px; gap: 6px; }
.btn-icon { width: 46px; height: 46px; padding: 0; }
.btn-danger { color: var(--coral); border-color: color-mix(in srgb, var(--coral) 40%, transparent); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--coral) 12%, transparent); }
.hero-buttons, .detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

/* Shelves */
.media-section { min-width: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; gap: 14px; }
.eyebrow { color: var(--champagne); font-size: 12px; letter-spacing: 2px; font-weight: 500; line-height: 1.5; text-transform: uppercase; }
.section-heading h2 { font-size: 20px; line-height: 26px; font-weight: 600; margin: 4px 0 0; }
.rail-controls { display: flex; align-items: center; gap: 8px; }
.rail-controls button { color: var(--pearl); border: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-container); font-size: 20px; line-height: 1; }
.rail-controls button:hover { color: var(--champagne); background: var(--surface-container-high); }
.rail { --rail-cards: 7; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--rail-cards) - 1) * 14px) / var(--rail-cards)); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { min-width: 0; scroll-snap-align: start; }
.section-link { padding: 8px 14px; font-size: 13px; }

/* Cards: albums, songs, playlists, artists */
.card { position: relative; display: block; min-width: 0; padding: 10px; margin: -10px; border-radius: 18px; transition: background .2s; }
.card:hover { background: var(--surface-container); }
.cover { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-container-high); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--whisper); background: var(--luxe-gradient); }
.card.artist .cover { border-radius: 50%; }
.card h3 { margin: 10px 0 2px; font-weight: 500; font-size: 14px; line-height: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pearl); }
.card p { color: var(--mist); font-size: 12px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.artist h3, .card.artist p { text-align: center; }
/* Sits on the cover's bottom corner: below it are the card's padding and two lines of text. */
.card-play { position: absolute; right: 18px; bottom: 72px; z-index: 2; width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--champagne); color: var(--on-accent); box-shadow: 0 10px 24px rgba(0,0,0,.45); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s, background .2s; }
.card-play svg { fill: currentColor; margin-left: 2px; }
.card-play.playing svg { margin-left: 0; }
.card-play:hover { background: var(--champagne-soft); }
.card:hover .card-play, .card:focus-within .card-play, .card-play.playing { opacity: 1; transform: none; }
.mosaic { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.liked-cover { position: absolute; inset: 0; display: grid; place-items: center; color: var(--champagne-soft); background: linear-gradient(135deg, var(--champagne-deep), #6b4f86 70%, var(--slate)); }
.liked-cover svg { fill: currentColor; }
.downloads-cover { position: absolute; inset: 0; display: grid; place-items: center; color: var(--jade); background: linear-gradient(135deg, #1f3a2c, var(--slate)); }

/* Quick picks: songs in a compact grid of rows on the home page */
.quick-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(4, auto); grid-auto-columns: calc((100% - 2 * 14px) / 3); gap: 6px 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.quick-grid::-webkit-scrollbar { display: none; }
.quick-grid .track-row { scroll-snap-align: start; }

/* Track rows */
.track-list { display: flex; flex-direction: column; }
.track-head, .track-row { display: grid; grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 1fr) 72px 88px; align-items: center; gap: 14px; padding: 0 12px; }
.track-head { height: 36px; margin-bottom: 8px; border-bottom: 1px solid var(--outline-variant); color: var(--mist); font-size: 12px; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; }
.track-head .num, .track-row .num { text-align: center; }
.track-head .dur { text-align: right; }
.track-row { position: relative; min-height: 60px; padding-top: 8px; padding-bottom: 8px; border-radius: 12px; transition: background .15s; user-select: none; -webkit-user-select: none; }
.track-row:hover, .track-row:focus-within, .track-row.menu-open { background: var(--surface-container); }
.track-row.current .row-title strong { color: var(--champagne); }
.track-row .num { color: var(--mist); font-variant-numeric: tabular-nums; font-size: 15px; position: relative; height: 32px; display: grid; place-items: center; }
.track-row .num .row-play { position: absolute; inset: 0; display: none; place-items: center; border: 0; background: none; color: var(--pearl); }
.track-row .num .row-play svg { fill: currentColor; }
.track-row:hover .num .row-play, .track-row:focus-within .num .row-play { display: grid; }
.track-row:hover .num .num-label, .track-row:focus-within .num .num-label { visibility: hidden; }
.track-row.chart .num { font-size: 18px; font-weight: 300; color: var(--pearl); }
.row-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.row-art { position: relative; width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--surface-container-high); }
.row-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.quick-grid .row-art { width: 52px; height: 52px; }
.track-row.compact { grid-template-columns: minmax(0, 1fr) auto; }
.track-list.no-album .track-head, .track-list.no-album .track-row:not(.compact) { grid-template-columns: 40px minmax(0, 1fr) 72px 88px; }
.track-list.no-album .row-album { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.compact .row-art .row-play { position: absolute; inset: 0; display: grid; place-items: center; border: 0; color: #fff; background: rgba(11,10,16,.55); opacity: 0; transition: opacity .15s; }
.compact .row-art .row-play svg { fill: currentColor; }
.compact:hover .row-art .row-play, .compact:focus-within .row-art .row-play { opacity: 1; }
.row-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title strong { font-weight: 500; font-size: 15px; color: var(--pearl); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; }
.row-title strong span { overflow: hidden; text-overflow: ellipsis; }
.row-title small { color: var(--mist); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title small a:hover, .row-album a:hover { color: var(--pearl); text-decoration: underline; }
.row-album { color: var(--mist); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dur { color: var(--mist); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.row-actions .icon-button { width: 34px; height: 34px; border-radius: 10px; color: var(--mist); }
.row-actions .icon-button svg { width: 18px; height: 18px; }
.row-actions [data-like] { opacity: 0; }
.track-row:hover [data-like], .track-row:focus-within [data-like], [data-like][aria-pressed="true"] { opacity: 1; }
[data-like][aria-pressed="true"], [data-like-current][aria-pressed="true"] { color: var(--champagne); }
[data-like][aria-pressed="true"] svg, [data-like-current][aria-pressed="true"] svg { fill: currentColor; }
.saved-mark { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 6px; border-radius: 50%; background: var(--jade); color: var(--eclipse); flex-shrink: 0; vertical-align: -3px; }
.saved-mark svg { width: 10px; height: 10px; stroke-width: 3; }
.saved-mark.loading { background: none; border: 2px solid var(--graphite); border-top-color: var(--jade); animation: spin .85s linear infinite; }
.track-row .drag-handle { cursor: grab; touch-action: none; }
.track-row.dragging { opacity: .5; }
.track-row.drop-before::before, .track-row.drop-after::after { content: ''; position: absolute; left: 12px; right: 12px; height: 2px; border-radius: 2px; background: var(--champagne); }
.track-row.drop-before::before { top: -1px; }
.track-row.drop-after::after { bottom: -1px; }
.disc-label { margin: 18px 12px 6px; color: var(--mist); font-size: 12px; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.show-more { border: 0; background: transparent; color: var(--mist); padding: 14px 12px; font-size: 14px; font-weight: 600; letter-spacing: .4px; }
.show-more:hover { color: var(--pearl); }

/* Playing indicator: sound bars in the champagne accent */
.bars { display: inline-flex; align-items: flex-end; gap: 2px; width: 14px; height: 14px; }
.bars i { width: 3px; height: 100%; border-radius: 2px; background: var(--champagne); transform-origin: bottom; animation: bar 1s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: -.4s; }
.bars i:nth-child(3) { animation-delay: -.7s; }
.bars.paused i { animation-play-state: paused; transform: scaleY(.35); }
@keyframes bar { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* Page headings */
.page-heading { margin: 20px 0 32px; }
.page-heading h1 { font-size: clamp(30px,4vw,44px); font-weight: 300; line-height: 1.18; margin: 6px 0 8px; letter-spacing: -.5px; }
.page-heading p { color: var(--muted); font-size: 14px; margin: 0; }
.page-heading.with-actions { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filter-control { height: 44px; background: var(--surface-container); border: 1px solid var(--outline-variant); border-radius: 12px; color: var(--pearl); padding: 0 12px; font-size: 14px; outline: none; transition: border-color .18s; }
.filter-control:hover { border-color: var(--outline); }
.filter-control:focus { border-color: var(--champagne); }
input.filter-control { width: 100%; }
select.filter-control { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a29daf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select.filter-control option { background: var(--slate); color: var(--pearl); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 22px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; background: transparent; border: 1px solid var(--outline); color: var(--mist); border-radius: 999px; padding: 7px 15px; font-size: 13px; font-weight: 500; letter-spacing: .4px; white-space: nowrap; transition: color .18s, border-color .18s, background .18s; }
.chip:hover { color: var(--pearl); border-color: var(--smoke); }
.chip.active { background: var(--active-tint); border-color: var(--champagne); color: var(--champagne); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 28px 18px; }

/* Genre tiles (search with no query) */
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
/* Spotify-style: a solid, saturated tile with the genre's #1 album tilted into the corner. */
.genre-tile { position: relative; overflow: hidden; height: 124px; padding: 16px; border-radius: 12px; background: var(--tile); color: #fff; font-size: 22px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15; transition: transform .2s, filter .2s; isolation: isolate; }
.genre-tile span { position: relative; z-index: 1; display: block; max-width: 70%; overflow-wrap: anywhere; }
.genre-tile:hover { transform: translateY(-3px); filter: brightness(1.08); }
.genre-tile img, .genre-tile svg { position: absolute; right: -14px; bottom: -8px; width: 92px; height: 92px; transform: rotate(25deg); }
.genre-tile img { border-radius: 6px; object-fit: cover; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
.genre-tile svg { color: rgba(255,255,255,.4); }

/* Search */
.search-top { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 28px; margin-bottom: 40px; }
.top-result { display: flex; flex-direction: column; gap: 18px; padding: 22px; border-radius: 22px; border: 1px solid var(--outline-variant); background: var(--card-gradient); position: relative; transition: background .2s; }
.top-result:hover { background: var(--surface-container); }
.top-result .cover { width: 110px; }
.top-result.artist .cover { border-radius: 50%; }
.top-result h3 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-result p { margin: 4px 0 0; color: var(--mist); }
.top-result .card-play { top: auto; bottom: 22px; right: 22px; opacity: 1; transform: none; }
.search-section { margin-bottom: 40px; }

/* Album, artist and playlist headers (detail page pattern) */
.detail-view { position: relative; margin: -8px calc(-1 * var(--page-pad)) 0; }
.detail-backdrop { position: absolute; top: -92px; left: 0; right: 0; height: 520px; pointer-events: none; overflow: hidden; z-index: -1; }
.detail-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: .5; filter: blur(60px) saturate(1.3); transform: scale(1.2); }
.detail-wash { position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg) 0%, rgba(11,10,16,.55) 45%, rgba(11,10,16,.2) 100%); }
.detail-top { padding: 12px var(--page-pad) 32px; }
.back-link { color: var(--mist); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; letter-spacing: .4px; border: 0; background: none; padding: 0; }
.back-link svg { transform: rotate(180deg); }
.back-link:hover { color: var(--champagne); }
.detail-main { display: flex; align-items: end; gap: clamp(24px,4vw,48px); margin-top: 32px; }
.detail-cover { position: relative; flex: 0 0 232px; width: 232px; aspect-ratio: 1; border-radius: var(--corner-lg); overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.5); background: var(--surface-container-high); }
.detail-cover > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.detail-cover.round { border-radius: 50%; }
.detail-info { flex: 1; min-width: 0; padding-bottom: 2px; }
.detail-info .eyebrow span { color: var(--whisper); margin: 0 5px; }
.detail-info h1 { font-size: clamp(32px,4.6vw,60px); font-weight: 300; line-height: 1.1; letter-spacing: -.8px; margin: 10px 0; max-width: 900px; text-wrap: balance; overflow-wrap: anywhere; }
.detail-info h1.editable { cursor: pointer; }
.detail-desc { color: var(--mist); font-size: 14px; margin: 0 0 10px; max-width: 720px; }
.detail-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; font-weight: 500; letter-spacing: .2px; color: var(--pearl); margin: 12px 0 22px; }
.detail-stats a:hover { color: var(--champagne); text-decoration: underline; }
.detail-stats .dot { color: var(--whisper); }
.detail-stats small { font-size: 14px; font-weight: 400; color: var(--mist); }
.detail-body { padding: 8px var(--page-pad) 0; display: flex; flex-direction: column; gap: 40px; }
.copyright { color: var(--whisper); font-size: 12px; margin: 18px 12px 0; }
.storage-meter { margin: 0 0 20px; padding: 16px 18px; border: 1px solid var(--outline-variant); background: var(--card-gradient); border-radius: 18px; }
.storage-text { font-size: 13px; color: var(--mist); margin-bottom: 10px; }
.storage-text strong { color: var(--pearl); font-weight: 600; }
.progress-track { height: 4px; background: var(--graphite); border-radius: 4px; overflow: hidden; }
.progress-track span { height: 100%; display: block; border-radius: 4px; background: var(--champagne); }

/* Loading + empty */
.page-loading,.initial-loading { min-height: 380px; display: flex; justify-content: center; align-items: center; flex-direction: column; gap: 12px; color: var(--mist); text-align: center; font-size: 14px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--graphite); border-top-color: var(--champagne); animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { margin: 48px 0; min-height: 265px; padding: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--outline-variant); background: var(--card-gradient); border-radius: 22px; }
.empty-state.compact { margin: 8px 0; min-height: 200px; }
.empty-symbol { color: var(--champagne); }
.empty-state h2 { font-size: 20px; font-weight: 600; margin: 14px 0 4px; }
.empty-state p { color: var(--mist); font-size: 14px; max-width: 420px; line-height: 20px; }
.empty-state .btn { margin-top: 12px; }

/* Player bar */
.player-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: var(--player-h); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); align-items: center; gap: 20px; padding: 0 20px env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--outline-variant); backdrop-filter: blur(20px); }
.mini-progress { display: none; }
.pb-track { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pb-art { width: 58px; height: 58px; flex-shrink: 0; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--surface-container-high); box-shadow: 0 8px 20px rgba(0,0,0,.4); }
.pb-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pb-title { border: 0; background: none; padding: 0; color: var(--pearl); font-size: 14px; font-weight: 500; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-title:hover { text-decoration: underline; }
.pb-artist { color: var(--mist); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-artist a:hover { color: var(--pearl); text-decoration: underline; }
.pb-like { color: var(--mist); }
.pb-center { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.pb-controls, .np-controls { display: flex; align-items: center; gap: 14px; }
.control-button { position: relative; background: none; border: 0; color: var(--mist); width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 50%; transition: color .18s, background .18s; }
.control-button [data-icon] { display: grid; }
.control-button:hover { color: var(--pearl); background: rgba(255,255,255,.06); }
.control-button[aria-pressed="true"] { color: var(--champagne); }
.control-button[aria-pressed="true"]::after { content: ''; position: absolute; bottom: 2px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--champagne); }
.control-button .repeat-one { position: absolute; top: 5px; right: 4px; font-size: 9px; font-weight: 700; color: var(--champagne); }
.play-button { width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--pearl); color: var(--eclipse); transition: transform .15s, background .18s; }
.play-button svg { fill: currentColor; }
.play-button:hover { transform: scale(1.05); background: #fff; }
.play-button.busy svg { display: none; }
.play-button.busy::after, .pb-mobile-play.busy::after { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(11,10,16,.25); border-top-color: var(--eclipse); animation: spin .85s linear infinite; }
.pb-seek { width: 100%; max-width: 640px; display: flex; align-items: center; gap: 10px; }
.player-time { font-size: 11px; font-weight: 500; letter-spacing: .4px; font-variant-numeric: tabular-nums; color: var(--mist); min-width: 34px; text-align: center; }
.pb-side { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.pb-mobile-play { display: none; }
.seek-bar,.volume-bar { -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; margin: 0; --pct: 0%; }
.seek-bar { flex: 1; min-width: 0; height: 16px; }
.volume-bar { width: 96px; height: 16px; }
.seek-bar::-webkit-slider-runnable-track,.volume-bar::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--pearl) var(--pct), rgba(255,255,255,.2) var(--pct)); }
.seek-bar:hover::-webkit-slider-runnable-track,.volume-bar:hover::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--champagne) var(--pct), rgba(255,255,255,.2) var(--pct)); }
.seek-bar::-moz-range-track,.volume-bar::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.2); }
.seek-bar::-moz-range-progress,.volume-bar::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--pearl); }
.seek-bar:hover::-moz-range-progress,.volume-bar:hover::-moz-range-progress { background: var(--champagne); }
.seek-bar::-webkit-slider-thumb,.volume-bar::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: var(--pearl); border: 0; opacity: 0; transition: opacity .15s; }
.seek-bar::-moz-range-thumb,.volume-bar::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--pearl); border: 0; opacity: 0; }
.seek-bar:hover::-webkit-slider-thumb,.volume-bar:hover::-webkit-slider-thumb,.seek-bar:focus-visible::-webkit-slider-thumb { opacity: 1; }
.seek-bar:hover::-moz-range-thumb,.volume-bar:hover::-moz-range-thumb { opacity: 1; }

/* Now playing: a wash of the artwork's main colour (--tint, set by app.js), like Spotify. Lyrics and
   Up next slide in from the right: beside the player on wide screens, over it on phones. */
.now-playing { position: fixed; inset: 0; z-index: 70; background: var(--bg); overflow: hidden; isolation: isolate; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); animation: rise .28s ease-out; }
.now-playing.dragging { animation: none; transition: none; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
.np-tint { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 80%, var(--bg)) 0%, color-mix(in srgb, var(--tint) 30%, var(--bg)) 55%, var(--bg) 100%); transition: background .6s; }
.np-layout { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 0px; transition: grid-template-columns .32s ease; }
.now-playing.sheet-open .np-layout { grid-template-columns: minmax(0, 1fr) min(480px, 40vw); }
.np-player { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px var(--page-pad); }
.np-head .icon-button svg { width: 24px; height: 24px; }
.np-source { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.np-source .eyebrow { font-size: 10px; color: rgba(255,255,255,.7); }
.np-source a { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.np-source a:hover { color: var(--champagne); }
.np-main { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; padding: 0 var(--page-pad) 28px; }
.np-art-wrap, .np-info, .np-seek, .np-controls, .np-extras { width: min(100%, 50vh, 520px); flex-shrink: 0; }
.np-art { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.55); background: var(--surface-container-high); -webkit-user-drag: none; user-select: none; }
.np-art.settle { transition: transform .2s ease, opacity .2s ease; }
/* The music video takes the artwork's square: a 16:9 frame as tall as the square and cropped at the
   sides (like object-fit: cover), fading in over the cover. Full screen shows the whole frame. */
.np-art-box { position: relative; width: 100%; }
.np-video { position: absolute; inset: 0; overflow: hidden; border-radius: 12px; background: #000; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.np-video.shown { opacity: 1; }
.np-video iframe { position: absolute; top: 0; left: 50%; height: 100%; width: auto; aspect-ratio: 16 / 9; transform: translateX(-50%); border: 0; pointer-events: none; }
.np-video:fullscreen { border-radius: 0; opacity: 1; }
.np-video:fullscreen iframe { left: 0; width: 100%; aspect-ratio: auto; transform: none; pointer-events: auto; }
.np-art-button { position: absolute; bottom: 10px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; backdrop-filter: blur(6px); transition: background .18s; }
.np-art-button:hover { background: rgba(0,0,0,.72); }
.np-art-button svg { width: 18px; height: 18px; }
.np-video-toggle { right: 10px; }
.np-video-toggle[aria-pressed="true"] { background: var(--champagne); color: #111; }
.np-video-fullscreen { right: 54px; }
.np-info { display: flex; align-items: center; gap: 12px; }
.np-text { flex: 1; min-width: 0; }
.np-text h2 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-text p { margin: 4px 0 0; color: rgba(255,255,255,.7); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-text p a:hover { color: var(--pearl); text-decoration: underline; }
.np-info .pb-like { color: rgba(255,255,255,.8); }
.np-seek .seek-bar { width: 100%; }
.np-times { display: flex; justify-content: space-between; }
.np-times .player-time { color: rgba(255,255,255,.7); }
.np-controls { display: flex; align-items: center; justify-content: space-between; }
.np-extras { display: flex; justify-content: space-between; margin-top: -6px; }
.np-extras .control-button { color: rgba(255,255,255,.75); }
.control-button.big { width: 48px; height: 48px; color: var(--pearl); }
.control-button.big svg { width: 28px; height: 28px; fill: currentColor; }
.play-button.big { width: 68px; height: 68px; }
.play-button.big svg { width: 28px; height: 28px; }
.np-sheet { min-width: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: color-mix(in srgb, var(--tint) 25%, var(--surface)); border-left: 1px solid rgba(255,255,255,.06); visibility: hidden; transition: visibility 0s linear .32s, background .6s; }
.now-playing.sheet-open .np-sheet { visibility: visible; transition: background .6s; }
.np-sheet-head { display: flex; align-items: center; gap: 8px; padding: 16px 18px 10px 10px; flex-shrink: 0; }
.np-sheet-head .icon-button svg { width: 24px; height: 24px; }
.np-sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.np-sheet-title .eyebrow { font-size: 10px; }
.np-sheet-title strong { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-panel-body { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--smoke) transparent; padding: 4px 18px 18px; }
.lyrics { display: flex; flex-direction: column; gap: 14px; padding: 12px 6px 40vh; }
.lyrics p { margin: 0; font-size: clamp(20px, 1.8vw, 26px); line-height: 1.35; font-weight: 700; color: rgba(255,255,255,.38); transition: color .3s; cursor: pointer; }
.lyrics p:hover { color: rgba(255,255,255,.65); }
.lyrics p.active { color: var(--pearl); }
.lyrics p.past { color: rgba(255,255,255,.6); }
.lyrics.plain p { cursor: default; color: var(--pearl); font-size: 18px; font-weight: 500; }
.lyrics-note { color: rgba(255,255,255,.45); font-size: 12px; margin-top: 18px; }
.np-message { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; color: rgba(255,255,255,.7); padding: 24px; }
.queue-caption { color: var(--mist); font-size: 12px; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; margin: 6px 12px 8px; }
.queue-caption:not(:first-child) { margin-top: 24px; }

/* Popover menu (dialog surface, like the Library panel) */
.menu-popover { position: fixed; z-index: 80; min-width: 230px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; background: var(--slate); border: 1px solid var(--outline); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.55); padding: 6px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--pearl); text-align: left; font-size: 14px; padding: 9px 12px; border-radius: 10px; white-space: nowrap; }
.menu-item svg { width: 18px; height: 18px; color: var(--mist); flex-shrink: 0; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-container-highest); outline: none; }
.menu-item.danger, .menu-item.danger svg { color: var(--coral); }
.menu-sep { height: 1px; background: var(--outline); margin: 4px 6px; }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--outline); min-width: 0; }
.menu-head img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.menu-head div { min-width: 0; }
.menu-head strong, .menu-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.menu-head small { color: var(--mist); font-size: 12px; }

/* Dialogs (Mochi's party dialog surface) */
.app-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 28px; border-radius: 22px; background: var(--surface); color: var(--text); border: 1px solid var(--outline-variant); box-shadow: 0 20px 90px rgba(0,0,0,.6); overflow: auto; }
.app-dialog[open] { animation: rise .25s ease-out; }
.app-dialog::backdrop { background: rgba(11,10,16,.85); backdrop-filter: blur(9px); }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.app-dialog h2 { margin: 6px 0 8px; font-size: 22px; font-weight: 600; line-height: 1.25; padding-right: 32px; }
.dialog-lede { margin: 0 0 20px; color: var(--mist); line-height: 21px; }
.dialog-form { display: flex; flex-direction: column; gap: 14px; }
.dialog-field { display: flex; flex-direction: column; gap: 8px; }
.dialog-field > span { font-size: 12px; color: var(--mist); letter-spacing: .4px; }
textarea.filter-control { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.dialog-actions { margin-top: 10px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.pick { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--pearl); text-align: left; padding: 8px 10px; border-radius: 12px; }
.pick:hover { background: var(--surface-container); }
.pick .pick-art { position: relative; width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--surface-container-high); }
.pick .pick-art img { width: 100%; height: 100%; object-fit: cover; }
.pick > span:not(.pick-art) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick small { color: var(--mist); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .pick-check { color: var(--champagne); }
.pick.selected { background: var(--active-tint); }
.pick.selected strong { color: var(--champagne); }
.pick-new { color: var(--champagne); }
.pick-new .pick-art { display: grid; place-items: center; color: var(--champagne); background: var(--active-tint); }

/* Toast */
.toast { position: fixed; bottom: calc(24px + var(--player-h)); right: 24px; padding: 12px 18px; color: var(--pearl); background: var(--slate); border: 1px solid color-mix(in srgb, var(--jade) 35%, transparent); border-radius: var(--corner-md); box-shadow: 0 14px 40px rgba(0,0,0,.5); font-size: 14px; font-weight: 500; max-width: 390px; opacity: 0; transform: translateY(24px); pointer-events: none; z-index: 90; transition: .23s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: color-mix(in srgb, var(--champagne) 45%, transparent); }

@media (min-width:1600px) {
  .rail { --rail-cards: 8; }
}
@media (max-width:1300px) {
  .rail { --rail-cards: 6; }
  .track-head, .track-row:not(.compact) { grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 1fr) 60px 80px; }
}
@media (max-width:1150px) {
  .logo-word { font-size: 16px; }
  .rail { --rail-cards: 5; }
  .quick-grid { grid-auto-columns: calc((100% - 14px) / 2); }
  .detail-cover { flex-basis: 190px; width: 190px; }
  .pb-side .volume-bar { width: 72px; }
}
@media (max-width:1000px) {
  .search-box kbd { display: none; }
  .topbar > .logo .logo-word { display: none; }
  .track-head, .track-row:not(.compact) { grid-template-columns: 40px minmax(0, 1fr) 60px 80px; }
  .track-head .row-album, .track-row .row-album { display: none; }
}
@media (max-width:780px) {
  .menu-button { display: grid; }
  .library-menu, .section-tabs { display: none; }
  .topbar > .logo { margin-right: 4px; }
  .search-box { flex: 1 1 auto; }
  .topbar { height: 80px; }
  .hero { margin-top: -88px; }
  .rail { --rail-cards: 4; }
  .search-top { grid-template-columns: 1fr; }
  .detail-backdrop { top: -80px; }
  .detail-cover { flex-basis: 150px; width: 150px; }
  /* Mini player, as on Spotify: a floating card in the artwork's colour with the progress along its
     bottom edge. Tap it (or swipe up) for Now playing; swipe sideways to change song. */
  body.has-player { --player-h: 72px; }
  .player-bar { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); height: 56px; grid-template-columns: minmax(0, 1fr) auto; gap: 2px; padding: 0 6px 0 8px; border: 0; border-radius: 10px; background: color-mix(in srgb, var(--tint) 85%, #000); backdrop-filter: none; box-shadow: 0 10px 30px rgba(0,0,0,.5); overflow: hidden; touch-action: none; cursor: pointer; transition: background .6s; -webkit-tap-highlight-color: transparent; }
  .pb-center, .pb-side { display: none; }
  .pb-track { gap: 10px; }
  .pb-art { width: 40px; height: 40px; border-radius: 6px; box-shadow: none; pointer-events: none; }
  .pb-text { flex: 1; gap: 1px; will-change: transform; }
  .pb-text.settle { transition: transform .2s ease, opacity .2s ease; }
  .pb-title { font-size: 13.5px; font-weight: 600; pointer-events: none; }
  .pb-artist { color: rgba(255,255,255,.72); font-size: 12.5px; pointer-events: none; }
  .pb-track .pb-like { width: 38px; height: 38px; color: rgba(255,255,255,.85); }
  .mini-progress { display: block; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 2px; overflow: hidden; background: rgba(255,255,255,.22); }
  .mini-progress i { display: block; height: 100%; width: 0; background: #fff; }
  .pb-mobile-play { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: #fff; }
  .pb-mobile-play svg { width: 24px; height: 24px; fill: currentColor; }
  .pb-mobile-play.busy svg { display: none; }
  .pb-mobile-play.busy::after { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
  /* Now playing on a phone: the player scrolls if the screen is short; the panel covers it. */
  .np-layout { display: block; position: relative; }
  .np-player { height: 100%; overflow-x: hidden; overflow-y: auto; }
  .np-head, .np-art-wrap { touch-action: none; }
  .np-sheet { position: absolute; inset: 0; z-index: 2; border-left: 0; background: color-mix(in srgb, var(--tint) 60%, var(--bg)); transform: translateX(100%); touch-action: pan-y; transition: transform .3s ease, visibility 0s linear .3s, background .6s; }
  .now-playing.sheet-open .np-sheet { transform: none; transition: transform .3s ease, background .6s; }
  .np-sheet.dragging { transition: none !important; }
  .np-sheet-head [data-close-sheet] svg { transform: rotate(180deg); }
}
@media (max-width:600px) {
  .topbar { padding: 14px 16px; height: auto; flex-wrap: wrap; gap: 14px 6px; }
  .topbar .logo { gap: 10px; }
  .topbar .logo-mark { width: 32px; height: 32px; border-radius: 10px; }
  .topbar .logo-mark svg { width: 19px; height: 19px; }
  .topbar > .logo .logo-word { display: inline; }
  .search-box { width: 100%; flex: 1 0 100%; order: 2; height: 44px; }
  .top-actions { margin-left: auto; gap: 8px; }
  .install-button { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .install-label { display: none; }
  .offline-banner { margin: 0 16px 8px; }
  .main { padding: 12px 16px calc(56px + var(--player-h)); }
  .home-view { gap: 32px; }
  .hero { margin: -12px -16px 0; min-height: 560px; }
  .hero-cover { left: 50%; right: auto; top: 28px; bottom: auto; width: min(62vw, 260px); transform: translateX(-50%); }
  .hero-content { width: 100%; padding: 0 20px 56px; }
  .hero h1 { font-size: 32px; }
  .hero-artist { font-size: 16px; }
  .hero-meta { margin-bottom: 18px; }
  .hero-arrow { display: none; }
  .hero-dots { left: 13px; bottom: 12px; }
  .section-heading h2 { font-size: 18px; line-height: 24px; }
  .rail-controls button { display: none; }
  .rail { grid-auto-columns: 140px; margin-right: -16px; padding-right: 16px; }
  .quick-grid { grid-auto-columns: 84vw; margin-right: -16px; padding-right: 16px; }
  .card { padding: 8px; margin: -8px; }
  .card-play { opacity: 1; transform: none; width: 40px; height: 40px; right: 14px; bottom: 68px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .genre-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .genre-tile { height: 104px; padding: 12px; font-size: 17px; }
  .genre-tile img, .genre-tile svg { width: 72px; height: 72px; right: -12px; bottom: -6px; }
  .track-head { display: none; }
  .track-row, .track-list .track-row:not(.compact), .track-list.no-album .track-row:not(.compact) { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 6px 4px 6px 8px; min-height: 56px; }
  .track-row .num, .track-row .row-dur { display: none; }
  .track-list .track-row.ranked:not(.compact) { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .track-row.ranked .num { display: grid; font-size: 14px; }
  .track-row .row-actions [data-like] { display: none; }
  .row-actions .icon-button { width: 40px; height: 40px; }
  .detail-view { margin: -12px -16px 0; }
  /* The top bar wraps to two rows here, so its height varies; reach well past it so the artwork
     wash runs up behind the menu button and logo, then on to the same point below as before. */
  .detail-backdrop { top: -200px; height: 640px; }
  .detail-top { padding: 14px 16px 26px; }
  .detail-main { flex-direction: column; align-items: flex-start; gap: 20px; margin-top: 18px; }
  .detail-cover { flex-basis: auto; width: min(58vw, 240px); align-self: center; }
  .detail-info { width: 100%; }
  .detail-info h1 { font-size: 30px; letter-spacing: -.3px; }
  .detail-actions .btn-primary { flex: 1 1 auto; }
  .detail-body { padding: 0 12px; }
  .top-result h3 { font-size: 22px; }
  .np-head { padding: 10px 12px; }
  /* Use the whole screen: the song details and controls rest at the bottom, within thumb reach, and
     the artwork takes the space left above them, as big as fits. */
  .np-main { gap: 16px; padding: 10px 24px 24px; }
  .np-info, .np-seek, .np-controls, .np-extras { width: 100%; }
  .np-art-wrap { flex: 1 1 0; min-height: 180px; width: 100%; display: grid; place-items: center; padding: 10px 0 14px; container-type: size; }
  .np-art-box { width: min(100cqw, 100cqh); }
  .np-art, .np-video { border-radius: 8px; }
  .np-text h2 { font-size: 22px; }
  .np-panel-body { padding: 4px 22px 22px; }
  .lyrics p { font-size: 22px; }
  .toast { bottom: calc(16px + var(--player-h) + env(safe-area-inset-bottom)); right: 12px; left: 12px; }
  .app-dialog { padding: 24px 20px; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior: auto!important; animation-duration: .001s!important; transition-duration: .001s!important; } }

/* Listening along with someone (public/app.js, "Listening, and listening along"). */
.along-bar { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--player-h) + 14px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--slate); border: 1px solid color-mix(in srgb, var(--champagne) 40%, transparent); box-shadow: 0 14px 40px rgba(0,0,0,.5); color: var(--pearl); font-size: 13px; white-space: nowrap; }
.along-bar svg { color: var(--champagne); flex-shrink: 0; }
.along-bar .btn-small { padding: 5px 12px; font-size: 12px; }
.track-row.linked { background: color-mix(in srgb, var(--champagne) 14%, transparent); }
/* Inside Kiko's frame: Kiko has the account menu and installs itself. */
.in-kiko #accountMenu, .in-kiko #installButton { display: none !important; }

/* The Architect: Kiko's, in a little chat over whatever is playing (see "The Architect" in app.js) */
.architect-face { width: 24px; height: 24px; display: inline-grid; flex-shrink: 0; border-radius: 50%; overflow: hidden; }
.architect-face svg { width: 100%; height: 100%; }
.architect-button .architect-face { width: 30px; height: 30px; box-shadow: 0 0 0 1px var(--outline); }
.architect-panel { position: fixed; right: 20px; bottom: calc(var(--player-h) + 16px); z-index: 65; width: min(380px, calc(100vw - 24px)); max-height: min(560px, calc(100dvh - var(--player-h) - 120px)); display: flex; flex-direction: column; background: var(--slate); border: 1px solid var(--outline); border-radius: var(--corner-lg); box-shadow: 0 24px 70px rgba(0,0,0,.6); overflow: hidden; animation: rise .22s ease-out; }
.architect-panel[hidden] { display: none; }
.architect-head { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-bottom: 1px solid var(--outline); }
.architect-head .architect-face { width: 34px; height: 34px; }
.architect-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.architect-head small { color: var(--mist); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.architect-head .icon-button { width: 34px; height: 34px; }
.architect-body { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.architect-body .spinner { margin: 24px auto; }
.architect-note { color: var(--mist); font-size: 13.5px; line-height: 1.5; }
.architect-note.error { color: var(--coral); }
.architect-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.architect-msg small { display: block; margin-top: 4px; color: var(--mist); font-size: 12px; }
.architect-msg.theirs { align-self: flex-start; background: var(--surface-container); color: var(--pearl); border-bottom-left-radius: 4px; }
.architect-msg.mine { align-self: flex-end; background: var(--champagne-deep); color: var(--champagne-soft); border-bottom-right-radius: 4px; }
.architect-msg.thinking { display: flex; gap: 4px; padding: 12px 14px; }
.architect-msg.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--mist); animation: architect-dot 1s infinite ease-in-out; }
.architect-msg.thinking i:nth-child(2) { animation-delay: .15s; }
.architect-msg.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes architect-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.architect-form { display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--outline); }
.architect-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 10px 12px; border: 1px solid var(--outline); border-radius: 12px; background: var(--surface-container); color: var(--pearl); font: inherit; font-size: 14px; }
.architect-form textarea:focus { outline: none; border-color: var(--champagne); }
.architect-form .icon-button:disabled { opacity: .45; }
.architect-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 12px; }
.architect-private { display: inline-flex; align-items: center; gap: 6px; color: var(--mist); font-size: 13px; }
@media (max-width:600px) {
  .architect-panel { right: 12px; left: 12px; width: auto; }
}
