:root {
  --bg: #0b0d12;
  --bg-elev: #12161f;
  --bg-soft: #181e2a;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --muted: #93a0b8;
  --primary: #7c6cff;
  --primary-2: #4fd1c5;
  --danger: #ff6b8a;
  --ok: #3dd68c;
  --warn: #f0b429;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: 100px;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(124, 108, 255, 0.28), transparent 60%),
    radial-gradient(700px 400px at 90% 0%, rgba(79, 209, 197, 0.18), transparent 55%),
    radial-gradient(600px 400px at 50% 100%, rgba(255, 107, 138, 0.08), transparent 50%);
  z-index: 0;
}

.topbar, .layout, .player, .cookie-bar { position: relative; z-index: 1; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 28px 8px;
  flex-wrap: wrap;
}

.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 24px rgba(124, 108, 255, 0.35);
}
.brand h1 { margin: 0; font-size: 1.25rem; letter-spacing: 0.02em; }
.brand .muted, .muted { color: var(--muted); font-size: 0.85rem; margin: 2px 0 0; }

.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.credit-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  font-size: 0.9rem;
}
.credit-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.15);
}
.credit-pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.15); }
.credit-pill.err .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 107, 138, 0.15); }

/* Cookie 状态条 */
.cookie-bar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 28px 0;
}
.cookie-bar-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(240, 180, 41, 0.35);
  background: linear-gradient(90deg, rgba(240, 180, 41, 0.12), rgba(18, 22, 31, 0.9));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.cookie-bar.ok .cookie-bar-inner {
  border-color: rgba(61, 214, 140, 0.45);
  background: linear-gradient(90deg, rgba(61, 214, 140, 0.14), rgba(18, 22, 31, 0.9));
}
.cookie-bar.err .cookie-bar-inner {
  border-color: rgba(255, 107, 138, 0.5);
  background: linear-gradient(90deg, rgba(255, 107, 138, 0.14), rgba(18, 22, 31, 0.9));
}
.cookie-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}
.cookie-lamp {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(240, 180, 41, 0.2), 0 0 16px rgba(240, 180, 41, 0.55);
  flex-shrink: 0;
  animation: lamp-pulse 1.4s ease-in-out infinite;
}
.cookie-bar.ok .cookie-lamp {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(61, 214, 140, 0.2), 0 0 16px rgba(61, 214, 140, 0.55);
  animation: none;
}
.cookie-bar.err .cookie-lamp {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 107, 138, 0.2), 0 0 16px rgba(255, 107, 138, 0.55);
  animation: none;
}
@keyframes lamp-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.75; }
}
.cookie-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cookie-copy strong {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
.cookie-copy span {
  font-size: 1rem;
  font-weight: 700;
}
.cookie-hint {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
}
#btnCheckCookie {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .cookie-bar { padding: 8px 14px 0; }
  .cookie-bar-inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #btnCheckCookie { width: 100%; }
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, 1fr);
  gap: 20px;
  padding: 12px 28px 28px;
  max-width: 1280px;
  margin: 0 auto;
}

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%), var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.tabs {
  display: flex; gap: 8px; margin-bottom: 18px;
  background: var(--bg-soft);
  padding: 6px; border-radius: 12px;
}
.tab {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 600;
}
.tab.active {
  background: rgba(124, 108, 255, 0.2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(124, 108, 255, 0.35);
}

.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack.hidden { display: none; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.field span { color: var(--muted); }
.field.inline { min-width: 160px; }

input[type="text"], textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(124, 108, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.15);
}

.row {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
}
.row.tools { justify-content: flex-start; }

.check {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); cursor: pointer; user-select: none;
}
.check input { accent-color: var(--primary); width: 16px; height: 16px; }

.btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, background .15s, opacity .15s;
}
.btn:hover { background: rgba(255,255,255,0.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), #5b8cff);
  border: 0;
  box-shadow: 0 10px 28px rgba(124, 108, 255, 0.35);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; padding: 14px; }
.btn.danger { color: var(--danger); border-color: rgba(255,107,138,0.3); }
.btn.sm { padding: 6px 10px; font-size: 0.82rem; border-radius: 8px; }

.hint { margin: 16px 0 0; line-height: 1.5; }

.status-box {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(124, 108, 255, 0.08);
  border: 1px solid rgba(124, 108, 255, 0.2);
}
.status-head {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  margin-bottom: 10px; flex-wrap: wrap;
}
.progress {
  height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden;
}
.progress .bar {
  height: 100%; width: 15%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  border-radius: inherit;
  transition: width .4s ease;
  animation: pulse 1.6s ease-in-out infinite;
}
.progress .bar.done { width: 100% !important; animation: none; }
@keyframes pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

.task-list {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.task-list li {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 0.88rem; color: var(--muted);
}
.task-list .st { font-weight: 600; }
.task-list .st.complete { color: var(--ok); }
.task-list .st.error { color: var(--danger); }
.task-list .st.streaming,
.task-list .st.queue,
.task-list .st.submitted { color: var(--warn); }

.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 1.05rem; }

.song-list { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 180px); overflow: auto; }
.empty { text-align: center; padding: 40px 12px; }

.song-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  align-items: center;
}
.song-card img {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover;
  background: #000; display: block;
}
.song-card .meta { min-width: 0; }
.song-card h3 {
  margin: 0 0 4px; font-size: 0.98rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-card .tags {
  color: var(--muted); font-size: 0.8rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge {
  display: inline-block; margin-top: 6px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  background: rgba(255,255,255,0.06); color: var(--muted);
}
.badge.complete { color: var(--ok); background: rgba(61,214,140,0.12); }
.badge.error { color: var(--danger); background: rgba(255,107,138,0.12); }
.badge.streaming, .badge.queue, .badge.submitted {
  color: var(--warn); background: rgba(240,180,41,0.12);
}
.song-actions { display: flex; flex-direction: column; gap: 6px; }

.lyric-preview {
  grid-column: 1 / -1;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: pre-wrap;
  line-height: 1.45;
  transition: max-height .25s ease, margin .25s ease;
}
.song-card.open .lyric-preview {
  max-height: 220px; margin-top: 4px; overflow: auto;
}

.player {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  display: grid;
  grid-template-columns: 52px 1fr minmax(220px, 1.2fr);
  gap: 14px; align-items: center;
  padding: 12px 16px;
  background: rgba(18, 22, 31, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.player[hidden] { display: none !important; }
.player-cover {
  width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #000;
}
.player-meta { min-width: 0; }
.player-meta strong {
  display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player audio { width: 100%; height: 36px; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 50; padding: 12px 18px; border-radius: 12px;
  background: #1c2433; border: 1px solid var(--line);
  box-shadow: var(--shadow); max-width: min(90vw, 480px);
  font-size: 0.92rem;
}
.toast.err { border-color: rgba(255,107,138,0.4); color: #ffd0da; }
.toast.ok { border-color: rgba(61,214,140,0.4); color: #c9ffe2; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 8px 14px 28px; }
  .topbar { padding: 16px 14px 4px; }
  .song-list { max-height: none; }
  .player {
    grid-template-columns: 44px 1fr;
    grid-template-rows: auto auto;
  }
  .player audio { grid-column: 1 / -1; }
}