/* Wusper Music — Modern Monochrome Flat Streamlined UI */
:root {
  --bg: #080808;
  --surface: #111111;
  --surface-2: #191919;
  --surface-hover: #222222;
  --fg: #F5F5F5;
  --fg-muted: #8E8E93;
  --fg-subtle: #55555A;
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.24);
  --accent: #FFFFFF;
  --accent-fg: #080808;
  --radius-card: 24px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Noto Sans TC", "PingFang TC", sans-serif;
}

[data-theme="light"] {
  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --surface-2: #EFEFEF;
  --surface-hover: #E6E6E6;
  --fg: #0A0A0A;
  --fg-muted: #66666B;
  --fg-subtle: #9A9AA0;
  --border: rgba(0, 0, 0, 0.10);
  --border-strong: rgba(0, 0, 0, 0.22);
  --accent: #0A0A0A;
  --accent-fg: #FFFFFF;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

button, input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* Icons */
.ico {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.ico.xs {
  width: 14px;
  height: 14px;
}

/* Shell Layout */
.app-shell {
  max-width: 1220px;
  min-height: 100%;
  margin: 0 auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-left: 4px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
  display: block;
}

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

/* Buttons — Streamlined Pill System */
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.pill-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.pill-btn:active {
  transform: scale(0.96);
}

.pill-btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 600;
}

.pill-btn.primary:hover {
  opacity: 0.9;
}

.pill-btn.sm {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.icon-btn:active {
  transform: scale(0.93);
}

.icon-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.icon-btn.sm {
  width: 32px;
  height: 32px;
}

.icon-btn.xs {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
}

.icon-btn.lg {
  width: 44px;
  height: 44px;
}

/* Workspace Split */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

/* Library Panel */
.library-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 560px;
}

.nav-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-pills::-webkit-scrollbar { display: none; }

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}

.nav-pill:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

.nav-pill.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 600;
}

.nav-pill .badge {
  font-style: normal;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(128, 128, 128, 0.22);
}

.nav-pill.active .badge {
  background: rgba(128, 128, 128, 0.25);
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-capsule {
  flex: 1;
  min-width: 180px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.2s var(--ease);
}

.search-capsule:focus-within {
  border-color: var(--accent);
}

.search-ico {
  color: var(--fg-muted);
}

.search-capsule input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
}

.search-capsule input::placeholder {
  color: var(--fg-subtle);
}

/* Track List & Drop Zone */
.track-list-wrap {
  flex: 1;
  min-height: 410px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  border-radius: 18px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.track-list-wrap.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: var(--surface-2);
}

.empty-state {
  height: 100%;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
  gap: 12px;
}

.empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: var(--fg);
  margin-bottom: 4px;
}

.empty-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.empty-state h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 380px;
  color: var(--fg-muted);
  font-size: 13px;
}

.empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.track-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}

.track-item:hover {
  background: var(--surface-2);
}

.track-item.active {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.track-leading {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--fg-muted);
}

.track-item.active .track-leading {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* Live Playing Bars Icon */
.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 14px;
}

.eq-bars i {
  display: block;
  width: 2.5px;
  border-radius: 99px;
  background: currentColor;
  animation: eqPulse 0.9s ease-in-out infinite;
}

.eq-bars i:nth-child(1) { height: 6px; animation-delay: 0s; }
.eq-bars i:nth-child(2) { height: 13px; animation-delay: 0.2s; }
.eq-bars i:nth-child(3) { height: 9px; animation-delay: 0.4s; }

.eq-bars.paused i {
  animation: none;
  height: 5px;
}

@keyframes eqPulse {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

.track-info {
  min-width: 0;
}

.track-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-sub {
  font-size: 11.5px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fmt-tag {
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}

.track-dur {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--fg-muted);
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.track-actions .icon-btn {
  width: 30px;
  height: 30px;
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
}

.track-actions .icon-btn:hover {
  background: var(--surface-hover);
  color: var(--fg);
  border-color: var(--border);
}

.track-actions .icon-btn.fav-on {
  color: var(--fg);
}

.track-actions .icon-btn.fav-on svg {
  fill: currentColor;
}

/* Player Panel */
.player-panel {
  position: sticky;
  top: 16px;
}

.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stage-visual {
  position: relative;
  height: 170px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#visualizer {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}

.now-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.now-titles {
  min-width: 0;
}

.now-titles h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-titles p {
  font-size: 12.5px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

#btnNowFav.fav-on svg {
  fill: currentColor;
}

/* Capsule Range Slider */
.seek-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.capsule-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  outline: none;
  cursor: pointer;
}

.capsule-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}

.capsule-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.capsule-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
}

/* Transport Controls */
.transport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.play-capsule {
  width: 68px;
  height: 52px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-fg);
  display: inline-grid;
  place-items: center;
  transition: transform 0.18s var(--ease), opacity 0.18s var(--ease);
}

.play-capsule .ico {
  width: 24px;
  height: 24px;
}

.play-capsule:hover {
  opacity: 0.92;
}

.play-capsule:active {
  transform: scale(0.94);
}

/* Utility Chips */
.util-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.18s var(--ease);
}

.chip-btn:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

.chip-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 600;
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}

.vol-pct {
  width: 34px;
  text-align: right;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 12px;
  color: var(--fg-muted);
}

.field input {
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 12.5px;
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* Responsive */
@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .player-panel {
    position: static;
    order: -1;
  }
  .library-panel {
    min-height: 360px;
  }
  .track-list-wrap {
    max-height: none;
  }
  .stage-visual {
    height: 120px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px 12px 20px;
    gap: 12px;
  }
  .hide-sm {
    display: none;
  }
  .top-bar {
    padding: 8px 10px;
  }
  .pill-btn {
    padding: 0 12px;
  }
}
