:root {
  --bg: #111318;
  --bg-soft: #181b22;
  --card: #1e222b;
  --line: #2a2f3a;
  --text: #eef1f6;
  --muted: #9aa3b2;
  --accent: #5b8cff;
  --accent-2: #7b5cff;
  --danger: #ff6b6b;
  --ok: #3ecf8e;
  --player-h: 132px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom));
}

a { color: var(--accent); }
button { font-family: inherit; }
input, select {
  font-family: inherit;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  font-size: 15px;
}
input:focus, select:focus { border-color: var(--accent); }

/* ---------------- 登录页 ---------------- */
.login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #1d2333 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 26px 24px;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo { width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 18px; }
.login-title { text-align: center; font-size: 30px; margin: 0 0 4px; letter-spacing: 2px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; min-width: 0; margin-bottom: 12px; letter-spacing: 3px; text-align: center; }
.login-msg { min-height: 18px; font-size: 13px; color: var(--danger); text-align: center; margin: 10px 0 0; }

/* 登录方式 Tab */
.login-tabs { display: flex; gap: 0; margin: 0 0 18px; background: var(--bg-soft); border-radius: 10px; padding: 4px; }
.ltab { flex: 1; background: none; border: none; color: var(--muted); padding: 9px 0; font-size: 14px; border-radius: 7px; cursor: pointer; }
.ltab.active { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.lt-panel { display: none; flex-direction: column; }
.lt-panel.active { display: flex; }

/* 模式切换：登录/注册 */
.mode-switch { display: flex; gap: 14px; margin-bottom: 12px; }
.ms-opt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }

/* 微信扫码区 */
.wechat-area { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wechat-qr { width: 200px; height: 200px; border-radius: 14px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.wechat-qr img { width: 100%; height: 100%; object-fit: contain; }
.wechat-tip { font-size: 13px; color: var(--muted); text-align: center; margin: 0; min-height: 18px; }

/* ---------------- 通用控件 ---------------- */
.btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; border-radius: 10px;
  padding: 12px 18px; cursor: pointer; font-weight: 600; font-size: 15px;
  white-space: nowrap;
}
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); padding: 12px 14px; }
.btn:disabled { opacity: .5; cursor: default; }

.icon-btn {
  background: none; border: none; color: var(--text);
  font-size: 17px; padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.icon-btn:hover { background: var(--card); }
.icon-btn.big { font-size: 20px; }

/* ---------------- 顶栏 / Tabs ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(17,19,24,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: 1px; }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.user-phone { color: var(--muted); font-size: 13px; margin-right: 4px; }

.tabs {
  display: flex; gap: 6px; padding: 10px 12px 0;
  position: sticky; top: 53px; z-index: 15;
  background: var(--bg);
}
.tab {
  flex: 1; padding: 10px 4px; border-radius: 12px 12px 0 0;
  background: none; border: 1px solid transparent; color: var(--muted);
  cursor: pointer; font-size: 14px;
}
.tab.active { color: var(--text); background: var(--bg-soft); border-color: var(--line); border-bottom-color: var(--bg-soft); font-weight: 600; }

.view { padding: 14px 12px 20px; }
.panel { display: none; }
.panel.active { display: block; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1; min-width: 0; }
.toolbar.wrap { flex-wrap: wrap; }
.toolbar.wrap select { flex: 1 1 30%; }
.notes { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* ---------------- 曲目行 ---------------- */
.group-title {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 4px 8px; font-size: 13px; color: var(--muted);
  letter-spacing: .05em;
}
.group-title:first-child { margin-top: 4px; }
.track-count { background: var(--card); border-radius: 20px; padding: 1px 8px; font-size: 12px; }

.track-list { display: flex; flex-direction: column; gap: 6px; }
.track {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 10px;
  cursor: pointer;
}
.track.playing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.t-cover {
  width: 44px; height: 44px; border-radius: 8px; flex: none;
  background: var(--bg-soft) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  overflow: hidden;
}
.t-cover img { width: 100%; height: 100%; object-fit: cover; }
.t-info { flex: 1; min-width: 0; }
.t-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub a { color: inherit; }
.t-time { color: #6d7686; font-size: 12px; }
.t-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.t-dur { color: var(--muted); font-size: 12px; min-width: 38px; text-align: right; }

.license-badge {
  display: inline-block; font-size: 11px; line-height: 1;
  border: 1px solid currentColor; border-radius: 6px;
  padding: 2px 5px; text-decoration: none; margin-left: 6px;
  color: var(--muted);
}
.license-badge.cc0 { color: var(--ok); }
.license-badge.ccby { color: #e0b341; }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; }

/* ---------------- 播放器 ---------------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(24,27,34,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(8px + env(safe-area-inset-bottom));
}
.player-main { display: flex; align-items: center; gap: 10px; }
.p-cover {
  width: 48px; height: 48px; border-radius: 10px; flex: none;
  background: var(--card); display: flex; align-items: center; justify-content: center;
  font-size: 20px; overflow: hidden;
}
.p-cover img { width: 100%; height: 100%; object-fit: cover; }
.p-meta { flex: 1; min-width: 0; }
.p-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub a { color: inherit; }
.p-attr { font-size: 11px; color: #7d8798; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-controls { display: flex; align-items: center; gap: 2px; flex: none; }
.icon-btn.play {
  width: 42px; height: 42px; border-radius: 50%; font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.p-seek { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.p-seek span { font-size: 11px; color: var(--muted); min-width: 34px; text-align: center; }
#p-progress { flex: 1; padding: 0; height: 4px; -webkit-appearance: none; appearance: none; background: var(--line); border-radius: 2px; }
#p-volume { width: 80px; padding: 0; height: 4px; -webkit-appearance: none; appearance: none; background: var(--line); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}

/* ---------------- 队列抽屉 ---------------- */
.drawer {
  position: fixed; top: 0; bottom: var(--player-h); right: 0; width: min(86vw, 360px);
  background: var(--bg-soft); border-left: 1px solid var(--line); z-index: 40;
  display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,.4);
}
.drawer.hidden { display: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
#queue-list { overflow-y: auto; padding: 8px; }
.compact .track { padding: 6px 8px; }
.compact .t-cover { width: 34px; height: 34px; font-size: 14px; }

.hidden { display: none !important; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 20px);
  transform: translateX(-50%); background: #000a; color: #fff;
  padding: 9px 16px; border-radius: 20px; font-size: 13px; z-index: 60;
  max-width: 86vw; text-align: center;
}

@media (min-width: 720px) {
  .view { max-width: 860px; margin: 0 auto; }
  .topbar, .tabs { padding-left: max(12px, calc((100vw - 860px)/2)); padding-right: max(12px, calc((100vw - 860px)/2)); }
}
