/* TG Music —— 前端样式 */
:root {
  --bg: #0b0b11;
  --sidebar: #101017;
  --panel: #15151f;
  --panel-2: #1b1b27;
  --border: #272733;
  --text: #f3f3f8;
  --muted: #8f8fa6;
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  --player-h: 92px;
  --sidebar-w: 248px;
  --radius: 14px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
code { background: #24242f; padding: 2px 6px; border-radius: 5px; font-size: 12px; color: #c4b5fd; }

/* ---------- 布局 ---------- */
.app-shell { display: flex; min-height: 100vh; padding-bottom: var(--player-h); }

.sidebar {
  position: fixed; top: 0; bottom: var(--player-h); left: 0;
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex; flex-direction: column;
  z-index: 20;
}

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }

.content { padding: 26px 34px 44px; max-width: 1400px; }

/* ---------- 侧边栏 ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; background: var(--grad);
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
  box-shadow: 0 8px 22px rgba(139, 92, 246, .32);
}
.brand-name { font-weight: 750; font-size: 17px; letter-spacing: .2px; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 11px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); text-align: left;
  transition: background .18s, color .18s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(139,92,246,.22), rgba(139,92,246,.05)); color: #c4b5fd; }
.nav-item span:nth-of-type(1) { flex: 1; }
.badge { font-size: 11px; background: #24242f; color: var(--muted); padding: 2px 7px; border-radius: 20px; }
.nav-item.active .badge { background: rgba(139,92,246,.3); color: #ddd6fe; }

.sidebar-section { margin-top: 30px; }
.section-label { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: #6f6f85; padding: 0 10px 10px; }
.library-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px; margin-bottom: 12px;
}
.library-card-icon { width: 36px; height: 36px; border-radius: 10px; background: #232330; display: grid; place-items: center; font-size: 18px; }
.library-card strong { display: block; font-size: 13px; }
.library-card span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }

.ghost-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 10px; border: 1px dashed #383848; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 12.5px;
  transition: .18s;
}
.ghost-btn:hover { border-color: var(--accent); color: #c4b5fd; background: rgba(139,92,246,.07); }
.sidebar-footer { margin-top: auto; padding-top: 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 18px;
  height: 74px; padding: 0 34px;
  background: rgba(11,11,17,.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(39,39,51,.7);
}
.search-wrap {
  display: flex; align-items: center; gap: 10px;
  width: min(400px, 46vw); padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted);
  transition: border-color .18s;
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); outline: none; }
.search-wrap input::placeholder { color: #6f6f85; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.tag { color: #6f6f85; font-size: 11px; border: 1px solid var(--border); padding: 5px 10px; border-radius: 999px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.mobile-menu { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 240px; padding: 34px 38px;
  border-radius: 22px;
  background: radial-gradient(900px 320px at 8% 120%, rgba(139,92,246,.28), transparent 65%),
              radial-gradient(700px 300px at 95% -20%, rgba(236,72,153,.2), transparent 60%),
              linear-gradient(135deg, #1a1529, #13131d);
  border: 1px solid #2b2340;
}
.hero-copy { position: relative; z-index: 2; }
.greeting { color: #b9a7f5; font-size: 13px; margin-bottom: 8px; }
.hero h1 { margin: 0 0 10px; font-size: clamp(26px, 3.2vw, 38px); letter-spacing: -.6px; }
.hero p { margin: 0 0 22px; color: #a9a8bd; max-width: 520px; line-height: 1.7; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.primary-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border: 0; border-radius: 999px;
  background: var(--grad); color: #fff; font-weight: 650;
  box-shadow: 0 8px 24px rgba(139,92,246,.3); transition: transform .18s, box-shadow .18s;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(139,92,246,.42); }
.soft-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border: 1px solid #3a3a4c; border-radius: 999px;
  background: rgba(255,255,255,.04); color: #dcdcea; transition: .18s;
}
.soft-btn:hover { border-color: var(--accent); background: rgba(139,92,246,.12); }

.hero-art { position: relative; width: 220px; height: 190px; flex-shrink: 0; }
.vinyl { position: absolute; border-radius: 50%; }
.vinyl-back { width: 170px; height: 170px; top: 8px; right: 26px; background: repeating-radial-gradient(circle, #22222e 0 3px, #1a1a24 3px 7px); border: 1px solid #3a3a4a; opacity: .55; }
.vinyl-front { width: 150px; height: 150px; top: 24px; right: 0; background: repeating-radial-gradient(circle, #1f1f2b 0 4px, #15151e 4px 9px); border: 2px solid #3a3a4a; box-shadow: 0 18px 40px rgba(0,0,0,.45); animation: spin 14s linear infinite; }
.vinyl-label { position: absolute; inset: 52px; border-radius: 50%; background: var(--grad); border: 4px solid #12121a; }
.vinyl-label::after { content: ''; position: absolute; inset: 18px; border-radius: 50%; background: #12121a; }
@keyframes spin { to { transform: rotate(360deg); } }
.float-note { position: absolute; color: #c4b5fd; font-size: 26px; opacity: .75; animation: float 4s ease-in-out infinite; }
.note-1 { top: 12px; left: 12px; }
.note-2 { bottom: 14px; left: 44px; font-size: 20px; animation-delay: 1.4s; }
@keyframes float { 50% { transform: translateY(-12px); opacity: 1; } }

/* ---------- 列表 ---------- */
.list-section { margin-top: 34px; }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.list-head h2 { margin: 0 0 5px; font-size: 22px; }
.list-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.sort-btn { padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 12px; }
.sort-btn:hover { color: var(--text); border-color: #4a4a5c; }

.table-head, .track-row {
  display: grid;
  grid-template-columns: 44px minmax(200px, 1fr) minmax(110px, .55fr) 74px 46px;
  align-items: center; gap: 12px;
  padding: 0 14px;
}
.table-head { color: #6f6f85; font-size: 11px; letter-spacing: .6px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.track-list { display: flex; flex-direction: column; }
.track-row {
  min-height: 66px; border-radius: 10px; transition: background .16s;
  border-bottom: 1px solid rgba(39,39,51,.45);
}
.track-row:hover { background: rgba(255,255,255,.035); }
.track-row.playing { background: rgba(139,92,246,.1); }
.track-index { position: relative; color: var(--muted); font-size: 13px; text-align: center; }
.row-play { display: none; position: absolute; inset: 0; margin: auto; border: 0; background: transparent; color: var(--text); font-size: 13px; }
.track-row:hover .num { opacity: 0; }
.track-row:hover .row-play, .track-row.playing .row-play { display: block; }
.track-row.playing .num { opacity: 0; }
.track-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.track-cover { width: 44px; height: 44px; border-radius: 9px; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-size: 18px; position: relative; }
.track-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.track-titles { min-width: 0; }
.t-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-row.playing .t-title { color: #c4b5fd; }
.t-sub { color: var(--muted); font-size: 11.5px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist, .track-duration { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-duration { font-variant-numeric: tabular-nums; }
.track-actions { display: flex; justify-content: flex-end; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); transition: .16s; }
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.07); }
.fav.on { color: #ec4899; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 44px; margin-bottom: 14px; }
.empty-state h3 { margin: 0 0 8px; font-size: 18px; }
.empty-state p { margin: 0 auto 20px; color: var(--muted); max-width: 420px; line-height: 1.7; }

/* ---------- 播放器 ---------- */
.player {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: var(--player-h);
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.5fr) minmax(140px, 1fr);
  align-items: center; gap: 20px; padding: 0 24px;
  background: rgba(18,18,26,.96); backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.player-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.now-cover { width: 50px; height: 50px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; font-size: 20px; }
.now-cover img { width: 100%; height: 100%; object-fit: cover; }
.now-meta { min-width: 0; }
.now-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-artist { color: var(--muted); font-size: 12px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.like-btn { margin-left: 4px; flex-shrink: 0; }
.like-btn.on { color: #ec4899; }

.player-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.controls { display: flex; align-items: center; gap: 14px; }
.controls .icon-btn.on { color: #c4b5fd; background: rgba(139,92,246,.15); }
.play-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: #fff; color: #111; display: grid; place-items: center;
  transition: transform .16s;
}
.play-btn:hover { transform: scale(1.08); }
.progress-row { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.progress-row span { width: 36px; text-align: center; flex-shrink: 0; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px; background: #333342; outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(139,92,246,.45); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }
#seek { flex: 1; min-width: 0; }
.player-right { display: flex; align-items: center; justify-content: flex-end; gap: 9px; color: var(--muted); }
#volume { width: 90px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.66); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; }
.modal { width: min(500px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 26px; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-desc { color: var(--muted); line-height: 1.75; font-size: 13px; margin: 0 0 20px; }
.field-label { display: block; font-size: 12px; color: #b9b9cc; margin-bottom: 8px; }
.text-input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: #101019; color: var(--text); outline: none; }
.text-input:focus { border-color: var(--accent); }
.test-result { min-height: 20px; margin: 10px 0 0; font-size: 12px; }
.test-result.ok { color: #4ade80; }
.test-result.err { color: #fb7185; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions.right { justify-content: flex-end; }
.modal-tip { color: #6f6f85; font-size: 11.5px; line-height: 1.6; margin: 16px 0 0; }
.steps { padding-left: 20px; color: #d0d0de; line-height: 1.9; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--player-h) + 22px); transform: translate(-50%, 20px); z-index: 80; background: #24242f; border: 1px solid #3a3a4a; color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .hero-art { width: 150px; transform: scale(.85); transform-origin: right center; }
  .tag { display: none; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; width: 248px; bottom: var(--player-h); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-menu { display: grid; }
  .content { padding: 20px 18px 36px; }
  .topbar { padding: 0 18px; }
  .search-wrap { width: 100%; }
  .hero { padding: 26px; }
  .hero-art { display: none; }
  .table-head, .track-row { grid-template-columns: 34px minmax(0,1fr) 60px 40px; }
  .table-head span:nth-child(3), .track-artist { display: none; }
  .player { grid-template-columns: 1fr auto; padding: 0 14px; }
  .player-center { grid-column: 1 / -1; grid-row: 1; }
  .player-left { grid-row: 2; }
  .player-right { grid-row: 2; }
  :root { --player-h: 118px; }
  #volume { width: 60px; }
}
@media (max-width: 520px) {
  .hero-actions .soft-btn { display: none; }
  .list-head { align-items: center; }
  .player-right { display: none; }
}
