/* ===== tokens ===== */
:root {
  --bg: #0e1012;
  --bg-soft: #14171a;
  --panel: #171b1f;
  --panel-2: #1e2328;
  --line: #262c32;
  --line-soft: #1f2429;
  --text: #eef1f3;
  --muted: #98a3ac;
  --muted-2: #6f7a84;
  --accent: #2fd6a5;
  --accent-ink: #06251d;
  --accent-soft: rgba(47, 214, 165, .13);
  --heart: #ff5d73;
  --danger: #ff6b6b;
  --shadow: 0 18px 44px rgba(0, 0, 0, .45);
  --radius: 8px;
  --player-h: 88px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f5f6;
  --bg-soft: #eceef0;
  --panel: #ffffff;
  --panel-2: #f2f3f5;
  --line: #dfe3e6;
  --line-soft: #eaedef;
  --text: #14181b;
  --muted: #5f6a73;
  --muted-2: #8b959d;
  --accent: #10a97d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(16, 169, 125, .12);
  --heart: #e8465f;
  --danger: #d94141;
  --shadow: 0 16px 36px rgba(20, 24, 27, .14);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: block;
}

button { font: inherit; color: inherit; }
input, select, button { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

/* ===== buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.btn:hover { background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible,
.chip:focus-visible, .track-row:focus-visible, .btn-rate:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, transform .12s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.is-on { color: var(--accent); background: var(--accent-soft); }

.play-btn {
  width: 44px;
  height: 44px;
  background: var(--text);
  color: var(--bg);
}
.play-btn:hover { background: var(--text); color: var(--bg); transform: scale(1.05); }
.play-btn .icon { width: 22px; height: 22px; }
.play-btn-lg { width: 62px; height: 62px; }
.play-btn-lg .icon { width: 30px; height: 30px; }

.heart-btn.is-on { color: var(--heart); background: transparent; }
.heart-btn.is-on .icon { fill: var(--heart); }

/* ===== layout ===== */
.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  height: 100vh;
  padding-bottom: var(--player-h);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 14px;
  background: var(--bg-soft);
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: 0; }
.brand-text small { color: var(--muted-2); font-size: 11.5px; }
.brand-mobile { display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-item span { flex: 1; font-size: 14px; font-weight: 500; }
.nav-item em { font-style: normal; font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.is-active { background: var(--panel); color: var(--text); font-weight: 600; }
.nav-item.is-active .icon { color: var(--accent); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.storage { padding: 0 10px; }
.storage-head {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted-2);
  margin-bottom: 7px;
}
.storage-bar { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.storage-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.sidebar-hint { margin: 0; padding: 0 10px; font-size: 11.5px; line-height: 1.5; color: var(--muted-2); }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
  flex: none;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 460px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--accent); }
.search .icon { color: var(--muted-2); width: 18px; height: 18px; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search input::placeholder { color: var(--muted-2); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
}
.search-clear .icon { width: 13px; height: 13px; }

.select {
  height: 40px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b959d' stroke-width='2' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right 9px center / 16px;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  appearance: none;
}
.select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.topbar .btn { margin-left: auto; }
.topbar .icon-btn { border: 1px solid var(--line); }

.chips { display: none; }

/* ===== list ===== */
.listhead, .track-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 200px 44px 62px 78px;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.listhead {
  height: 36px;
  flex: none;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--muted-2);
}
.listhead .col-index { text-align: center; }
.listhead .col-time { text-align: right; }

.listwrap { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 28px; overscroll-behavior: contain; }
.tracklist { list-style: none; margin: 0; padding: 6px 0 0; }

.track-row {
  height: 58px;
  border-radius: var(--radius);
  cursor: default;
  transition: background .12s;
}
.track-row:hover { background: var(--panel); }
.track-row.is-current { background: var(--accent-soft); }
.track-row.is-current .track-title { color: var(--accent); }

.cell-index { position: relative; display: grid; place-items: center; height: 100%; }
.row-num { font-size: 13px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.row-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 30px;
  height: 30px;
  opacity: 0;
  background: transparent;
}
.track-row:hover .row-play { opacity: 1; }
.track-row:hover .row-num { opacity: 0; }
.row-play .icon { width: 18px; height: 18px; }

.cell-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-title .np-art { width: 40px; height: 40px; border-radius: 6px; }
.title-text { display: flex; flex-direction: column; min-width: 0; }
.track-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-artist {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-album { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-time { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.cell-like, .cell-actions { display: flex; justify-content: flex-end; }
.cell-like .icon-btn, .cell-actions .icon-btn { width: 34px; height: 34px; }
.cell-like .icon-btn { opacity: 0; }
.cell-like .icon-btn.is-on { opacity: 1; }
.track-row:hover .cell-like .icon-btn { opacity: 1; }
.cell-like .icon-btn .icon, .cell-actions .icon-btn .icon { width: 17px; height: 17px; }
.cell-actions .icon-btn { opacity: 0; }
.track-row:hover .cell-actions .icon-btn,
.track-row:focus-within .cell-actions .icon-btn { opacity: 1; }
.cell-actions .icon-btn:hover { color: var(--danger); }

/* playing equalizer */
.eq { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.eq i {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  animation: eq .9s ease-in-out infinite;
}
.eq i:nth-child(1) { height: 60%; animation-delay: -.2s; }
.eq i:nth-child(2) { height: 100%; animation-delay: -.55s; }
.eq i:nth-child(3) { height: 42%; animation-delay: -.35s; }
.eq.is-paused i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

/* artwork placeholder */
.np-art {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--panel-2);
  color: var(--muted-2);
  border-radius: var(--radius);
  flex: none;
}
.np-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.np-art .icon { width: 40%; height: 40%; opacity: .5; }
.np-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, .06), transparent 65%);
  pointer-events: none;
}
.np-art-sm { width: 52px; height: 52px; }
.np-art-lg {
  width: min(340px, 62vw);
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.np-art-lg .icon { width: 30%; height: 30%; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 84px 24px;
  text-align: center;
}
.empty-art {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted-2);
}
.empty-art .icon { width: 34px; height: 34px; }
.empty h2 { margin: 0; font-size: 17px; font-weight: 600; }
.empty p { margin: 0; max-width: 380px; font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.empty-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

/* ===== player ===== */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr) minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  height: var(--player-h);
  padding: 0 20px calc(0px + env(safe-area-inset-bottom, 0px) * 0);
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.mini-progress {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--line-soft);
}
.mini-progress-fill { height: 100%; width: 0; background: var(--accent); }

.np-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 6px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
}
.np-mini:hover { background: var(--panel-2); }
.np-meta { display: flex; flex-direction: column; min-width: 0; }
.np-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-center { display: flex; flex-direction: column; align-items: center; gap: 9px; min-width: 0; width: 100%; }
.controls { display: flex; align-items: center; gap: 6px; }
.controls .play-btn { margin: 0 6px; }

.seekrow { display: flex; align-items: center; gap: 10px; width: 100%; }
.time { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; min-width: 34px; }
.time:last-child { text-align: right; }

.range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 16px;
  background: transparent;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line) var(--p, 0%));
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  opacity: 0;
  transition: opacity .15s;
}
.range:hover::-webkit-slider-thumb, .range:focus-visible::-webkit-slider-thumb { opacity: 1; }
.range::-moz-range-track { height: 4px; border-radius: 99px; background: var(--line); }
.range::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
.range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--text); }
.range:focus-visible { outline: none; }

.player-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.range-vol { flex: none; width: 96px; }
.btn-rate {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.btn-rate:hover { color: var(--text); border-color: var(--muted-2); }

/* ===== now playing ===== */
.now-playing {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  animation: npIn .22s ease;
}
@keyframes npIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.np-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: min(560px, 100%);
  max-height: 100%;
}
.np-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.np-head-title { font-size: 12px; letter-spacing: 1px; color: var(--muted-2); }

.visualizer {
  width: 100%;
  height: 64px;
  display: block;
}

.np-info { text-align: center; max-width: 100%; }
.np-info h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-info p { margin: 0; font-size: 13.5px; color: var(--muted); }

.seekrow-lg { max-width: 460px; }
.controls-lg .play-btn { margin: 0 14px; }

/* ===== drop overlay + toast ===== */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 12, .72);
  backdrop-filter: blur(3px);
}
.drop-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 56px;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  background: var(--panel);
  text-align: center;
}
.drop-box .icon { width: 34px; height: 34px; color: var(--accent); }
.drop-box strong { font-size: 16px; }
.drop-box span { font-size: 12.5px; color: var(--muted); }

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 18px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toastIn .2s ease;
}
.toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== responsive ===== */
@media (max-width: 1080px) {
  .listhead, .track-row { grid-template-columns: 40px minmax(0, 1fr) 150px 42px 58px 72px; padding: 0 18px; }
  .topbar { padding: 14px 18px; }
}

@media (max-width: 900px) {
  :root { --player-h: 74px; }
  body { overflow: hidden; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .brand-mobile { display: flex; padding: 0; }
  .brand-mobile strong { font-size: 15px; }
  .topbar { gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
  .search { max-width: none; order: 3; flex-basis: 100%; }
  .select { flex: 1; }
  .topbar .btn { margin-left: 0; }
  .btn-label { display: none; }
  .topbar .btn { width: 40px; padding: 0; }

  .chips {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    overflow-x: auto;
    flex: none;
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
  }
  .chip em { font-style: normal; font-size: 11px; color: var(--muted-2); }
  .chip.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
  .chip.is-active em { color: var(--accent); }

  .listhead { display: none; }
  .listwrap { padding-bottom: 16px; }
  .track-row {
    grid-template-columns: 34px minmax(0, 1fr) 46px;
    gap: 8px;
    height: 62px;
    padding: 0 14px;
  }
  .cell-album, .cell-time, .cell-actions { display: none; }
  .cell-like .icon-btn { opacity: 1; width: 30px; height: 30px; }
  .row-play { opacity: 0; }
  .track-row.is-touching .row-play { opacity: 1; }

  .player {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    height: var(--player-h);
    padding: 0 10px calc(0px + env(safe-area-inset-bottom, 0px));
  }
  .mini-progress { display: block; }
  .player-center { display: none; }
  .player-right { gap: 2px; }
  .range-vol, #rateBtn, .only-wide { display: none; }
  .np-art-sm { width: 46px; height: 46px; }
  .np-mini { padding: 4px 6px; }
  .controls-main .icon-btn { width: 36px; height: 36px; }

  .now-playing { padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px)); align-items: stretch; }
  .np-panel { gap: 16px; height: 100%; justify-content: center; }
  .np-art-lg { width: min(74vw, 320px); }
  .np-info h2 { font-size: 19px; }
  .controls-lg .icon-btn { width: 42px; height: 42px; }
  .controls-lg .play-btn { width: 66px; height: 66px; margin: 0 12px; }
  .toasts { bottom: calc(var(--player-h) + 12px); width: calc(100% - 28px); }
  .toast { max-width: 100%; text-align: center; }
}

@media (max-width: 380px) {
  .controls-main { gap: 2px; }
  .controls-main .icon-btn { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ===== 管理权限弹窗 + 共享标识 ===== */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
  padding: 20px;
}

.admin-panel {
  width: min(360px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.admin-panel h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.admin-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.admin-panel input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.admin-panel input[type="password"]:focus {
  border-color: var(--accent);
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.admin-actions .btn { min-width: 84px; }

.badge-shared {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--accent);
  background: var(--accent-soft);
  vertical-align: 1px;
}
