/* 下载中心（download-center.mjs）与专辑 / 歌单页的下载对话框（views/download-dialog.mjs）。
   下载中心与播放条同样是悬浮卡片，叠在播放条上方（右对齐）；展开后在其上方列出各下载任务 */
.dl-dock {
  --dl-bottom: max(14px, env(safe-area-inset-bottom));
  position: fixed; left: calc(50% + var(--nav-w) / 2); bottom: var(--dl-bottom); z-index: 10;
  width: min(1040px, calc(100% - var(--nav-w) - 24px)); transform: translateX(-50%); pointer-events: none;
}
.dl-dock[hidden] { display: none; }
body.has-player .dl-dock { bottom: calc(var(--dl-bottom) + var(--player-height, 72px) + 8px); }
body.lyrics-open .dl-dock { display: none; }
body.has-downloads { padding-bottom: calc(var(--downloads-height, 52px) + 32px + env(safe-area-inset-bottom)); }
body.has-downloads.has-player { padding-bottom: calc(var(--player-height, 110px) + var(--downloads-height, 52px) + 40px + env(safe-area-inset-bottom)); }
.dlc-bar {
  position: relative; display: flex; align-items: center; gap: 4px; margin-left: auto; width: min(420px, 100%); overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; pointer-events: auto;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.dlc-bar-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 6px 9px 10px;
  border: 0; background: none; color: var(--text); text-align: left;
}
.dl-ring { position: relative; flex: 0 0 34px; width: 34px; height: 34px; }
.dl-ring > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dl-ring circle { fill: none; stroke-width: 3; }
.dl-ring-track { stroke: var(--surface-3); }
.dl-ring-fill { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .3s ease; }
.dl-dock:not(.is-busy) .dl-ring-fill { stroke: var(--ok); }
.dl-dock.has-failed .dl-ring-fill { stroke: var(--warn); }
.dl-ring-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text); }
.dl-ring-icon svg { width: 16px; height: 16px; }
.dl-dock.is-busy .dl-ring-icon svg { animation: dl-bob 1.6s ease-in-out infinite; }
@keyframes dl-bob { 50% { transform: translateY(2px); } }
.dlc-bar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dlc-bar-title, .dlc-bar-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlc-bar-title { font-size: 13px; font-weight: 700; }
.dlc-bar-sub { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dlc-bar-chevron { flex: 0 0 18px; width: 18px; height: 18px; color: var(--muted); transition: transform .15s ease; }
.dl-dock.is-open .dlc-bar-chevron { transform: rotate(180deg); }
.dlc-bar-track { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; }
.dlc-bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.dl-dock:not(.is-busy) .dlc-bar-fill { background: var(--ok); }
.dl-dock.has-failed .dlc-bar-fill { background: var(--warn); }
.dl-icon-btn {
  flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 8px; background: none; color: var(--muted);
}
.dl-icon-btn:hover { color: var(--text); background: var(--surface-3); }
.dl-icon-btn svg { width: 17px; height: 17px; }
.dl-icon-btn[hidden] { display: none; }
.dlc-bar-hide { margin-right: 6px; }

.dl-panel {
  position: absolute; right: 0; bottom: calc(100% + 8px); width: min(480px, 100%); max-height: min(640px, 70dvh);
  display: flex; flex-direction: column; pointer-events: auto;
  border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(24px); box-shadow: var(--shadow);
  animation: queue-in .18s ease-out;
}
.dl-panel[hidden] { display: none; }
.dl-panel-head { display: flex; align-items: center; gap: 4px; padding: 16px 12px 8px 18px; }
.dl-panel-title { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 700; }
.dl-settings, .dl-clear {
  min-height: 30px; padding: 0 8px; display: inline-flex; align-items: center; border: 0; border-radius: 7px;
  background: none; color: var(--accent); font-size: 14px; text-decoration: none;
}
.dl-settings:hover, .dl-clear:hover { background: var(--accent-soft); }
.dl-clear:disabled { color: var(--faint); background: none; cursor: default; }
.dl-empty { margin: 0; padding: 20px 24px 28px; color: var(--muted); font-size: 13px; text-align: center; }
.dl-empty[hidden] { display: none; }
.dl-jobs { margin: 0; padding: 0 8px 8px; list-style: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.dl-job { position: relative; padding: 8px 6px 10px; }
.dl-job + .dl-job { border-top: 1px solid var(--line); }
.dl-job-head { display: flex; align-items: center; gap: 8px; }
.dl-job-toggle { width: 24px; height: 40px; margin-right: -4px; }
.dl-job-toggle svg { width: 13px; height: 13px; transition: transform .15s ease; }
.dl-job.is-expanded .dl-job-toggle svg { transform: rotate(90deg); }
.dl-job-art { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--surface-3); }
.dl-job-art[hidden] { display: block; visibility: hidden; }
.dl-job-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dl-job-title { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.dl-job-title:hover { color: var(--accent); text-decoration: underline; }
.dl-job-sub, .dl-job-status { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.dl-job-status { font-variant-numeric: tabular-nums; }
.dl-job.is-error .dl-job-status, .dl-job.is-partial .dl-job-status { color: var(--warn); }
.dl-job.is-done .dl-job-status { color: var(--ok); }
.dl-job-actions { display: flex; align-items: center; }
.dl-job-progress { height: 3px; margin: 8px 6px 0 32px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.dl-job-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.dl-job.is-partial .dl-job-progress i, .dl-job.is-error .dl-job-progress i { background: var(--warn); }
.dl-job.is-done .dl-job-progress, .dl-job.is-cancelled .dl-job-progress { display: none; }
.dl-tasks { margin: 8px 0 0 26px; padding: 0; list-style: none; }
.dl-tasks[hidden] { display: none; }
.dl-task { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 4px 4px 8px; border-radius: 6px; }
.dl-task:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.dl-task-index { flex: 0 0 20px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.dl-task-main { flex: 1; min-width: 0; }
.dl-task-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.dl-task-name { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.dl-task-quality { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--faint); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dl-task-status { display: block; overflow: hidden; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.dl-task.is-error .dl-task-status { color: var(--error); }
.dl-task.is-done .dl-task-status { color: var(--ok); }
.dl-task.is-cancelled .dl-task-name, .dl-task.is-skipped .dl-task-name { color: var(--muted); }
.dl-task-progress { height: 2px; margin-top: 3px; border-radius: 1px; background: var(--surface-3); overflow: hidden; }
.dl-task-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.dl-task:not(.is-downloading):not(.is-tagging):not(.is-saving):not(.is-resolving) .dl-task-progress { display: none; }
.dl-task-actions { display: flex; }
.dl-task-actions .dl-icon-btn { width: 28px; height: 28px; }
@media (max-width: 760px) {
  .dl-dock { --dl-bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (max-width: 483px) {
  .dl-dock { width: calc(100% - 16px); }
  .dlc-bar { width: 100%; }
  .dl-panel { width: 100%; max-height: min(640px, 72dvh); }
  .dl-job-actions .dl-icon-btn { width: 40px; height: 40px; }
}

/* ---------- 下载对话框 ---------- */
.dl-dialog {
  width: min(560px, calc(100vw - 24px)); max-height: min(720px, calc(100dvh - 40px)); padding: 0;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.dl-dialog[open] { display: flex; flex-direction: column; }
.dl-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dl-dialog-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 12px; }
.dl-dialog-art { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--surface-3); }
.dl-dialog-titles { flex: 1; min-width: 0; }
.dl-dialog-title { margin: 0; overflow: hidden; font-size: 17px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.dl-dialog-sub { margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.dl-dialog-opts { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px 14px; padding: 4px 18px 12px; font-size: 13px; }
.dl-dialog-opts > span:nth-child(odd) { color: var(--muted); }
.dl-dialog-opts select { justify-self: start; max-width: 100%; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit; }
.dl-dialog-opts a { color: var(--accent); }
.dl-dialog-tools { display: flex; align-items: center; gap: 8px; padding: 8px 18px; border-top: 1px solid var(--line); font-size: 13px; }
.dl-dialog-count { flex: 1; color: var(--muted); }
.dl-dialog-tools button { min-height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: none; color: var(--text); font-size: 12px; }
.dl-dialog-list { flex: 1; min-height: 80px; margin: 0; padding: 4px 10px; overflow-y: auto; list-style: none; border-top: 1px solid var(--line); }
.dl-dialog-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.dl-dialog-item:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.dl-dialog-item input { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.dl-dialog-item.is-disabled { color: var(--faint); cursor: default; }
.dl-dialog-num { flex: 0 0 22px; color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; }
.dl-dialog-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-dialog-artist { color: var(--muted); }
.dl-dialog-mv { flex: 0 0 auto; padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; color: var(--muted); font-size: 10px; font-weight: 600; line-height: 14px; }
.dl-dialog-time { flex: 0 0 auto; color: var(--faint); font-variant-numeric: tabular-nums; }
.dl-dialog-disc { padding: 10px 8px 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.dl-dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.dl-dialog-foot button { min-height: 36px; padding: 0 18px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.dl-dialog-cancel { border: 1px solid var(--line-strong); background: none; color: var(--text); }
.dl-dialog-start { border: 0; background: var(--accent); color: #fff; }
.dl-dialog-start:hover { background: var(--accent-hover); }
.dl-dialog-start:disabled { opacity: .5; cursor: default; }
