/* =====================================================================
   Ember — tema scuro con accenti a gradiente giallo / arancio / rosso
   ===================================================================== */
:root {
  --bg: #0a0a0c;
  --bg-side: #0f0f12;
  --panel: #141418;
  --elev: #1b1b21;
  --elev-2: #24242c;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #f5f5f7;
  --muted: #a1a1ab;
  --dim: #6c6c77;
  --y: #ffd23f;
  --o: #ff8a1f;
  --r: #ff2e3d;
  --accent: #ff7a1a;
  --grad: linear-gradient(135deg, var(--y) 0%, var(--o) 50%, var(--r) 100%);
  --grad-h: linear-gradient(90deg, var(--y), var(--o) 55%, var(--r));
  --radius: 10px;
  --top-h: 76px;
  --side-w: 236px;
  --mini-h: 64px;
  --tab-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; overscroll-behavior: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
::selection { background: rgba(255, 138, 31, .35); }
.ic { width: 20px; height: 20px; flex: none; fill: currentColor; }
.grad-text { background: var(--grad-h); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- layout ---------- */
#app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: var(--top-h) 1fr;
  height: 100vh; height: 100dvh;
}
.topbar { grid-column: 1 / -1; }
.sidebar { grid-row: 2; grid-column: 1; }
main { grid-row: 2; grid-column: 2; overflow-y: auto; overflow-x: hidden; position: relative; scrollbar-color: #33333b transparent; }

/* ---------- controls ---------- */
.ctl { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text); transition: transform .12s, color .15s, background .15s, opacity .15s; }
.ctl:hover { background: rgba(255, 255, 255, .07); }
.ctl:active { transform: scale(.92); }
.ctl.sm { width: 32px; height: 32px; }
.ctl.sm .ic { width: 18px; height: 18px; }
.ctl.xs { width: 22px; height: 22px; border-radius: 6px; }
.ctl.xs .ic { width: 15px; height: 15px; }
.ctl.toggle { color: var(--dim); position: relative; }
.ctl.toggle.on { color: var(--accent); }
.ctl.toggle.on::after { content: ""; position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.ctl:disabled { opacity: .35; pointer-events: none; }
.ctl.play { background: var(--grad); color: #160700; box-shadow: 0 4px 18px rgba(255, 106, 31, .35); }
.ctl.play:hover { filter: brightness(1.08); background: var(--grad); }
.ctl.play .ic { width: 22px; height: 22px; }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 20px; border-radius: 999px; font-weight: 650; letter-spacing: .01em; background: var(--elev-2); transition: transform .12s, filter .15s, background .15s; white-space: nowrap; }
.btn:hover { background: #2c2c35; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); color: #1a0800; box-shadow: 0 6px 22px rgba(255, 90, 31, .28); }
.btn.primary:hover { filter: brightness(1.07); }
.btn .ic { width: 17px; height: 17px; }
.btn.icon { width: 38px; padding: 0; justify-content: center; }
.link { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.link:hover { color: var(--text); }
.link .ic { width: 16px; height: 16px; }

.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.badge:empty { display: none; }
.badge.hq { border-color: transparent; background: linear-gradient(var(--elev), var(--elev)) padding-box, var(--grad) border-box; border: 1px solid transparent; color: #ffb35c; }

/* ---------- range sliders ---------- */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: transparent; cursor: pointer; margin: 0; --p: 0%; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--y), var(--o) calc(var(--p) * .6), var(--r) var(--p), rgba(255, 255, 255, .14) var(--p)); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--grad-h); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); opacity: 0; transition: opacity .15s; }
.range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; opacity: 0; }
.range:hover::-webkit-slider-thumb, .range:active::-webkit-slider-thumb, .range:focus-visible::-webkit-slider-thumb { opacity: 1; }
.range:hover::-moz-range-thumb, .range:active::-moz-range-thumb { opacity: 1; }

/* ---------- top bar (stile iTunes) ---------- */
.topbar {
  display: grid; grid-template-columns: minmax(250px, 1fr) minmax(380px, 640px) minmax(250px, 1fr);
  align-items: center; gap: 18px; padding: 0 18px;
  background: linear-gradient(#18181d, #121216);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 5;
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--grad-h); opacity: .35; }
.transport { display: flex; align-items: center; gap: 6px; }
.transport .play { width: 46px; height: 46px; margin: 0 2px; }
.volume { display: flex; align-items: center; gap: 4px; margin-left: 14px; width: 150px; color: var(--muted); }

.lcd {
  height: 56px; display: grid; grid-template-columns: 56px 34px 1fr 34px; align-items: center; gap: 6px;
  border-radius: 10px; padding-right: 8px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #0c0c0f, #101014);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .06), 0 1px 0 rgba(255, 255, 255, .04);
}
.lcd-art { width: 56px; height: 56px; background: var(--elev); overflow: hidden; border-radius: 10px 0 0 10px; }
.lcd-art img, .mini-art img, .np-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lcd-center { min-width: 0; text-align: center; display: flex; flex-direction: column; justify-content: center; padding-top: 2px; }
.lcd-title { font-weight: 650; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcd-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcd-progress { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.lcd-progress .range { height: 12px; }
.lcd-progress .range::-webkit-slider-runnable-track { height: 3px; }
.lcd-progress .range::-webkit-slider-thumb { margin-top: -4.5px; }
.time { font-size: 10.5px; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 34px; }
.time:first-child { text-align: right; }
.lcd .q { position: absolute; right: 46px; top: 6px; height: 15px; font-size: 9px; padding: 0 5px; }

.top-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.searchbox { display: flex; align-items: center; gap: 8px; height: 34px; width: 240px; padding: 0 12px; border-radius: 999px; background: #0c0c0f; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--dim); transition: box-shadow .15s; }
.searchbox:focus-within { box-shadow: inset 0 0 0 1px var(--o), 0 0 0 3px rgba(255, 138, 31, .15); }
.searchbox .ic { width: 16px; height: 16px; }
.searchbox input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); }
.searchbox input::-webkit-search-cancel-button { filter: invert(.6); }

/* ---------- sidebar ---------- */
.sidebar { background: var(--bg-side); border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 10px 10px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 8px; padding: 2px 10px 14px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand .flame, .flame { fill: url(#g-ember); width: 26px; height: 26px; }
.side-label { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 8px; color: #d0d0d7; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.side-nav a .ic { width: 18px; height: 18px; color: var(--muted); }
.side-nav a:hover { background: rgba(255, 255, 255, .05); }
.side-nav a.active { background: rgba(255, 138, 31, .12); color: #fff; }
.side-nav a.active .ic { color: var(--o); }
.side-nav a.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--grad); }
.side-nav a.drop { outline: 2px dashed var(--o); }
.side-foot { margin-top: auto; padding: 16px 10px 4px; display: grid; gap: 6px; }
.stats { font-size: 11.5px; color: var(--dim); }

/* ---------- views ---------- */
#view { padding: 28px 32px 48px; min-height: 100%; }
.view-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.view-title { font-size: 30px; font-weight: 800; letter-spacing: -.025em; margin: 0; line-height: 1.1; }
.view-sub { color: var(--muted); margin-top: 4px; }
.view-head .actions { margin-left: auto; display: flex; gap: 8px; }
.section-title { font-size: 19px; font-weight: 750; letter-spacing: -.01em; margin: 30px 0 14px; }
.empty { text-align: center; color: var(--muted); padding: 80px 20px; max-width: 520px; margin: 0 auto; }
.empty .flame { width: 56px; height: 56px; margin-bottom: 12px; }
.empty h2 { color: var(--text); margin: 0 0 8px; }
.empty code { background: var(--elev); padding: 2px 6px; border-radius: 5px; color: #ffb35c; }

/* cover art */
.art { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: radial-gradient(120% 120% at 0% 0%, #2a1a10, #17121a 60%, #121216); display: grid; place-items: center; }
.art::before { content: ""; position: absolute; width: 34%; height: 34%; opacity: .5; background: var(--grad); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 18V5.6l11-2.1v12.2' fill='none' stroke='black' stroke-width='1.8'/%3E%3Ccircle cx='6.4' cy='18' r='2.6'/%3E%3Ccircle cx='17.4' cy='15.7' r='2.6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 18V5.6l11-2.1v12.2' fill='none' stroke='black' stroke-width='1.8'/%3E%3Ccircle cx='6.4' cy='18' r='2.6'/%3E%3Ccircle cx='17.4' cy='15.7' r='2.6'/%3E%3C/svg%3E") center / contain no-repeat; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.art img.ok { opacity: 1; }
.art.round { border-radius: 50%; }

/* album grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 26px 22px; }
.card { min-width: 0; cursor: pointer; }
.card .art { box-shadow: 0 8px 24px rgba(0, 0, 0, .45); transition: transform .18s, box-shadow .18s; }
.card:hover .art { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 138, 31, .25); }
.card .hover-play { position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px; opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; z-index: 2; }
.card:hover .hover-play { opacity: 1; transform: none; }
.card-title { margin-top: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.artist { text-align: center; }

/* album / playlist hero */
.hero { position: relative; display: flex; gap: 30px; align-items: flex-end; margin: -28px -32px 26px; padding: 40px 32px 28px; overflow: hidden; }
.hero-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(60px) saturate(1.4); opacity: .45; transform: scale(1.2); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(10, 10, 12, .2), var(--bg)); }
.hero > *:not(.hero-bg) { position: relative; z-index: 1; }
.hero .art { width: 232px; flex: none; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); border-radius: 10px; }
.hero-info { min-width: 0; }
.hero-kind { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.hero-title { font-size: clamp(26px, 4vw, 48px); font-weight: 850; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 8px; word-break: break-word; }
.hero-artist { font-size: 18px; font-weight: 650; display: inline-block; }
.hero-meta { color: var(--muted); margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.mosaic { display: grid; grid-template-columns: 1fr 1fr; }
.mosaic .art { width: auto; border-radius: 0; box-shadow: none; }

/* track tables */
.tracks { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tracks th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(10, 10, 12, .92); backdrop-filter: blur(10px); z-index: 2; user-select: none; }
.tracks th.sortable { cursor: pointer; }
.tracks th.sortable:hover { color: var(--text); }
.tracks th.sorted { color: var(--o); }
.tracks td { padding: 0 10px; height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); border-bottom: 1px solid rgba(255, 255, 255, .03); }
.tracks tr.row { cursor: pointer; }
.tracks tr.row:nth-child(even) td { background: rgba(255, 255, 255, .015); }
.tracks tr.row:hover td { background: rgba(255, 255, 255, .055); color: #d8d8de; }
.tracks td.t-title { color: var(--text); font-weight: 500; }
.tracks .c-num { width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.tracks .c-dur { width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.tracks .c-q { width: 140px; }
.tracks .c-more { width: 48px; text-align: center; padding: 0; }
.tracks .c-art { width: 52px; padding-right: 0; }
.tracks .c-art .art { width: 34px; border-radius: 5px; }
.tracks .c-art .art::before { width: 50%; height: 50%; }
.tracks td .more { opacity: 0; width: 32px; height: 32px; }
.tracks tr.row:hover .more, .tracks .more:focus-visible { opacity: 1; }
.tracks tr.playing td.t-title { color: transparent; background-image: var(--grad-h); -webkit-background-clip: text; background-clip: text; }
.tracks tr.playing:hover td.t-title { background-image: var(--grad-h); }
.tracks .sub-artist { display: none; }
.tracks .c-genre { width: 13%; }
.tracks .c-num .eq { display: none; }
.tracks tr.playing .c-num .eq { display: inline-flex; }
.tracks tr.playing .c-num .num { display: none; }
.hero-back { display: none; }
.disc-row td { color: var(--dim); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding-top: 18px; height: auto; cursor: default; background: none !important; }

/* playing equalizer */
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; vertical-align: middle; }
.eq i { width: 3px; background: var(--grad); border-radius: 1px; height: 30%; }
body.is-playing .eq i { animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s !important; height: 70%; }
.eq i:nth-child(3) { animation-delay: -.6s !important; height: 45%; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* genres */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.chip { position: relative; height: 92px; border-radius: 12px; padding: 14px 16px; overflow: hidden; font-weight: 750; font-size: 17px; background: var(--elev); display: flex; flex-direction: column; justify-content: space-between; transition: transform .15s; }
.chip:hover { transform: translateY(-2px); }
.chip::after { content: ""; position: absolute; right: -24px; bottom: -24px; width: 96px; height: 96px; border-radius: 22px; transform: rotate(25deg); background: var(--grad); opacity: .85; }
.chip small { color: var(--muted); font-weight: 500; font-size: 12.5px; position: relative; z-index: 1; }
.chip span { position: relative; z-index: 1; }

/* playlist list (mobile/desktop) */
.list { display: grid; gap: 2px; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.list-item:hover { background: rgba(255, 255, 255, .05); }
.list-item .art { width: 56px; flex: none; border-radius: 7px; }
.list-item .li-text { min-width: 0; flex: 1; }
.list-item .li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-sub { color: var(--muted); font-size: 13px; }
.new-pl .art { background: var(--elev); }
.new-pl .art::before { display: none; }
.new-pl .art .ic { width: 26px; height: 26px; color: var(--o); }

/* upload */
.storage { background: var(--panel); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; box-shadow: inset 0 0 0 1px var(--line); }
.storage-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.storage-row span, .storage small { color: var(--muted); font-size: 13px; }
.storage small { display: block; margin-top: 8px; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad-h); border-radius: 6px; transition: width .3s; }
.drop { border: 2px dashed rgba(255, 255, 255, .13); border-radius: 18px; padding: 40px 20px; text-align: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--o); background: rgba(255, 138, 31, .06); }
.drop-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; background: var(--grad); color: #1a0800; box-shadow: 0 10px 30px rgba(255, 90, 31, .3); }
.drop-icon .ic { width: 30px; height: 30px; }
.drop h3 { margin: 0; font-size: 18px; }
.drop p { color: var(--muted); margin: 6px 0 14px; }
.drop small { display: block; color: var(--dim); margin-top: 16px; font-size: 12.5px; }
.drop-actions, .up-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.up-actions { justify-content: flex-start; margin-top: 16px; }
.up-card { margin-top: 18px; background: var(--panel); border-radius: 14px; padding: 18px; box-shadow: inset 0 0 0 1px var(--line); }
.up-card.done { box-shadow: inset 0 0 0 1px rgba(255, 138, 31, .35); }
.up-card h3 { margin: 0 0 10px; font-size: 16px; }
.up-card p { color: var(--muted); margin: 8px 0 0; font-size: 13.5px; }
.up-current { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text) !important; }
.up-note { color: var(--dim) !important; font-size: 12.5px !important; }
.up-errors { margin-top: 12px; color: #ff8f8f; font-size: 13px; }
.up-errors summary { cursor: pointer; }
.up-errors ul { margin: 8px 0 0; padding-left: 18px; max-height: 220px; overflow: auto; color: var(--muted); }

/* search input in view (mobile) */
.view-search { display: none; }

/* ---------- mini player + tab bar (mobile only) ---------- */
.mini, .tabbar { display: none; }

/* ---------- now playing ---------- */
.np { position: fixed; inset: 0; z-index: 40; background: #09090b; transform: translateY(100%); transition: transform .38s cubic-bezier(.2, .8, .2, 1); visibility: hidden; overflow: hidden; }
.np.open { transform: none; visibility: visible; }
.np-bg { position: absolute; inset: -80px; background-size: cover; background-position: center; filter: blur(70px) saturate(1.5) brightness(.55); transform: scale(1.3); }
.np-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 10, 12, .2), rgba(10, 10, 12, .85)); }
.np-inner { position: relative; height: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; padding: max(14px, env(safe-area-inset-top)) 26px max(26px, var(--safe-b)); }
.np-head { display: flex; align-items: center; justify-content: space-between; }
.np-from { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); text-align: center; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 10px; }
.np-art { margin: auto 0; width: 100%; aspect-ratio: 1; max-height: 52vh; max-width: 52vh; align-self: center; border-radius: 14px; overflow: hidden; box-shadow: 0 30px 70px rgba(0, 0, 0, .65); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.np-art .art { width: 100%; height: 100%; border-radius: 0; }
body:not(.is-playing) .np-art { transform: scale(.88); }
.np-meta { display: flex; align-items: center; gap: 10px; margin-top: 26px; }
.np-text { min-width: 0; flex: 1; }
.np-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { font-size: 17px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-progress { margin-top: 18px; }
.np-progress .range { height: 22px; }
.np-progress .range::-webkit-slider-runnable-track { height: 5px; }
.np-progress .range::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -4.5px; opacity: 1; }
.np-progress .range::-moz-range-thumb { opacity: 1; }
.np-times { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.np-controls { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.ctl.big { width: 60px; height: 60px; }
.ctl.big .ic { width: 34px; height: 34px; }
.ctl.huge { width: 76px; height: 76px; }
.ctl.huge .ic { width: 34px; height: 34px; }

/* ---------- queue drawer ---------- */
.queue { position: fixed; top: var(--top-h); right: 0; bottom: 0; width: 360px; z-index: 30; background: rgba(18, 18, 22, .97); backdrop-filter: blur(20px); border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; visibility: hidden; }
.queue.open { transform: none; visibility: visible; }
.queue-head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 10px 20px; }
.queue-head h3 { margin: 0; font-size: 18px; flex: 1; }
.queue-list { overflow-y: auto; padding: 0 8px 20px; flex: 1; }
.q-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); padding: 14px 12px 6px; }
.q-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 8px; cursor: pointer; }
.q-item:hover { background: rgba(255, 255, 255, .05); }
.q-item .art { width: 40px; flex: none; border-radius: 5px; }
.q-item .art::before { width: 50%; height: 50%; }
.q-item .li-text { min-width: 0; flex: 1; }
.q-item .li-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.q-item .li-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item.current .li-title { color: var(--o); }
.q-item .ctl { opacity: 0; }
.q-item:hover .ctl { opacity: 1; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- context menu ---------- */
.menu { position: fixed; z-index: 60; min-width: 230px; max-width: 300px; padding: 6px; border-radius: 12px; background: rgba(32, 32, 39, .97); backdrop-filter: blur(24px); box-shadow: 0 18px 50px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-2); display: none; }
.menu.open { display: block; animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
.menu-head .art { width: 40px; flex: none; border-radius: 5px; }
.menu-head .art::before { width: 50%; height: 50%; }
.menu-head div { min-width: 0; }
.menu-head b, .menu-head small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-head small { color: var(--muted); }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 7px; text-align: left; }
.menu button:hover { background: rgba(255, 138, 31, .16); }
.menu button .ic { width: 18px; height: 18px; color: var(--muted); }
.menu button.danger { color: #ff6b6b; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- dialog ---------- */
.dlg { border: 0; padding: 0; border-radius: 16px; background: #1a1a20; color: var(--text); width: min(420px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px var(--line-2); }
.dlg::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); }
.dlg form { padding: 22px; }
.dlg h3 { margin: 0 0 14px; font-size: 18px; }
.dlg .field { width: 100%; height: 42px; padding: 0 14px; border-radius: 10px; border: 0; outline: 0; background: #0f0f13; box-shadow: inset 0 0 0 1px var(--line-2); }
.dlg .field:focus { box-shadow: inset 0 0 0 1px var(--o), 0 0 0 3px rgba(255, 138, 31, .18); }
.dlg .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dlg .pick { max-height: 300px; overflow-y: auto; display: grid; gap: 2px; margin: 0 -8px; }
.dlg .pick button { text-align: left; padding: 10px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; }
.dlg .pick button:hover { background: rgba(255, 138, 31, .14); }
.dlg .pick .ic { color: var(--o); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #2a2a32; color: var(--text); padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 70; font-weight: 550; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--grad); margin-right: 10px; vertical-align: 1px; }

/* =====================================================================
   Tablet
   ===================================================================== */
@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .volume { width: 110px; margin-left: 6px; }
  .searchbox { width: 180px; }
  .tracks .c-genre { display: none; }
}
@media (max-width: 980px) and (min-width: 821px) {
  :root { --side-w: 200px; }
  .volume { display: none; }
  .tracks .c-q { display: none; }
}

/* =====================================================================
   Mobile
   ===================================================================== */
@media (max-width: 820px) {
  :root { --radius: 8px; }
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .topbar, .sidebar { display: none; }
  main { grid-row: 1; grid-column: 1; padding-bottom: calc(var(--mini-h) + var(--tab-h) + var(--safe-b) + 12px); }
  #view { padding: max(18px, env(safe-area-inset-top)) 16px 24px; }
  .view-title { font-size: 30px; }
  .view-head { margin-bottom: 16px; }
  .view-head .actions { margin-left: 0; width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
  .card .hover-play { display: none; }
  .card-title { font-size: 13.5px; }
  .card-sub { font-size: 12.5px; }

  .hero { flex-direction: column; align-items: center; text-align: center; margin: calc(-1 * max(18px, env(safe-area-inset-top))) -16px 14px; padding: max(54px, calc(env(safe-area-inset-top) + 40px)) 20px 18px; gap: 18px; }
  .hero .art { width: min(62vw, 260px); }
  .hero-meta, .hero-actions { justify-content: center; }
  .hero-actions .btn:not(.icon) { flex: 1; justify-content: center; max-width: 170px; }
  .hero > .hero-back { display: inline-grid; position: absolute; top: max(10px, env(safe-area-inset-top)); left: 8px; z-index: 2; }

  .tracks thead { display: none; }
  .tracks .c-album, .tracks .c-genre, .tracks .c-q, .tracks .c-artist { display: none; }
  .tracks td { height: 58px; padding: 0 6px; }
  .tracks tr.row:nth-child(even) td { background: none; }
  .tracks td.t-title { white-space: normal; }
  .tracks td.t-title .t-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tracks .sub-artist { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-text-fill-color: var(--muted); }
  .tracks .c-num { width: 32px; }
  .tracks .c-dur { display: none; }
  .tracks .c-more { width: 40px; }
  .tracks td .more { opacity: 1; color: var(--muted); }
  .tracks .c-art { width: 54px; }
  .tracks .c-art .art { width: 44px; }

  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .chip { height: 84px; font-size: 15px; }

  .view-search { display: flex; position: sticky; top: 0; z-index: 3; margin: 0 -16px 18px; padding: 8px 16px 10px; background: rgba(10, 10, 12, .92); backdrop-filter: blur(16px); }
  .view-search .searchbox { width: 100%; height: 40px; }

  .mini { display: grid; grid-template-columns: 44px 1fr 44px 44px; align-items: center; gap: 10px; position: fixed; left: 8px; right: 8px; bottom: calc(var(--tab-h) + var(--safe-b) + 6px); height: var(--mini-h); padding: 0 6px 0 10px; z-index: 20; border-radius: 14px; background: rgba(34, 30, 30, .9); backdrop-filter: blur(24px) saturate(1.6); box-shadow: 0 10px 30px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .06); overflow: hidden; cursor: pointer; }
  .mini.empty { display: none; }
  .mini-art { width: 44px; height: 44px; border-radius: 7px; overflow: hidden; }
  .mini-art .art { border-radius: 7px; }
  .mini-art .art::before { width: 50%; height: 50%; }
  .mini-text { min-width: 0; }
  .mini-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mini-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mini .ctl .ic { width: 24px; height: 24px; }
  .mini-progress { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: rgba(255, 255, 255, .1); border-radius: 2px; overflow: hidden; }
  .mini-progress i { display: block; height: 100%; width: 0; background: var(--grad-h); }

  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 19; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(10, 10, 12, .9); backdrop-filter: blur(24px) saturate(1.4); border-top: 1px solid var(--line); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--dim); }
  .tabbar a .ic { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--o); }
  .tabbar a.active .ic { fill: url(#g-ember); color: var(--o); }

  .queue { top: 0; width: 100%; border-left: 0; z-index: 45; padding-top: env(safe-area-inset-top); padding-bottom: var(--safe-b); }
  .q-item .ctl { opacity: 1; color: var(--dim); }

  .menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + var(--safe-b)); max-width: none; min-width: 0; border-radius: 16px; padding: 8px; }
  .menu button { padding: 13px 12px; font-size: 15px; }
  .menu.open { animation: sheet .2s cubic-bezier(.2, .8, .2, 1); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }

  .toast { bottom: calc(var(--mini-h) + var(--tab-h) + var(--safe-b) + 18px); }
}

@media (hover: none) {
  .card:hover .art { transform: none; }
  .ctl:hover { background: none; }
  .ctl.play:hover { background: var(--grad); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
