/* XPlayer Main Stylesheet — v1.0
 * Strictly consumes tokens from tokens.css.
 * Zero external dependencies, zero glassmorphism bloat, restrained studio typography.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: var(--s-0);
  padding: var(--s-0);
  height: 100%;
  width: 100%;
  background: var(--bg-base);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: var(--t-body-size);
  line-height: var(--t-body-lh);
  font-weight: var(--t-body-w);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  user-select: none;
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* Focus accessibility: visible accent ring everywhere, never outline: none */
:focus-visible {
  outline: var(--focus-ring-w) solid var(--accent);
  outline-offset: var(--focus-ring-offset);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: var(--s-0);
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: var(--s-0);
}

/* Custom sleek scrollbars */
::-webkit-scrollbar {
  width: var(--scrollbar-w);
  height: var(--scrollbar-w);
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--r-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* =========================================================
 * App Shell Layout
 * ========================================================= */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg-base);
}

.app-body {
  display: flex;
  flex: 1;
  min-height: var(--s-0);
  width: 100%;
  overflow: hidden;
}

/* =========================================================
 * Sidebar (AppSidebar)
 * ========================================================= */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elev-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: var(--s-0);
  transition: width var(--d-base) var(--ease);
  overflow: hidden;
}

.sidebar.is-collapsed {
  width: var(--sidebar-w-collapsed);
}

.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-0) var(--s-3);
  border-bottom: 1px solid var(--line-subtle);
  flex-shrink: 0;
}

.sidebar.is-collapsed .sidebar-header {
  justify-content: center;
  padding: var(--s-0) var(--s-2);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: var(--s-2-5);
  min-width: var(--s-0);
  padding: var(--s-1);
  border-radius: var(--r-sm);
}

.brand-icon {
  width: var(--icon-btn-sm);
  height: var(--icon-btn-sm);
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--text-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-name {
  font-size: var(--t-h2-size);
  font-weight: var(--t-h2-w);
  line-height: var(--t-h2-lh);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.is-collapsed .brand-mark {
  display: none;
}

.sidebar-scroll {
  flex: 1;
  min-height: var(--s-0);
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-3) var(--s-2);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--s-0-5);
}

.nav-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-1) var(--s-2-5);
  color: var(--text-3);
  font-size: var(--t-caption-size);
  font-weight: var(--t-weight-semibold);
  letter-spacing: 0.04em;
}

.sidebar.is-collapsed .nav-group-head {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-2-5);
  height: var(--input-h);
  padding: var(--s-0) var(--s-2-5);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--t-body-size);
  font-weight: var(--t-body-w);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
  position: relative;
}

.sidebar.is-collapsed .nav-item {
  justify-content: center;
  padding: var(--s-0);
}

.nav-item:hover {
  background: var(--bg-elev-3);
  color: var(--text-1);
}

.nav-item:active {
  background: var(--bg-elev-4);
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: var(--t-weight-medium);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: var(--s-0);
  top: var(--s-2);
  bottom: var(--s-2);
  width: var(--border-accent-w);
  border-radius: var(--r-pill);
  background: var(--accent);
}

.nav-icon {
  width: var(--icon-md);
  height: var(--icon-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.nav-count {
  font-size: var(--t-caption-size);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.nav-item.is-active .nav-count {
  color: var(--accent);
}

.sidebar.is-collapsed .nav-label,
.sidebar.is-collapsed .nav-count {
  display: none;
}

.sidebar-footer {
  padding: var(--s-2);
  border-top: 1px solid var(--line-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--s-0-5);
  flex-shrink: 0;
}

/* =========================================================
 * Main Column & TopBar
 * ========================================================= */
.main-col {
  flex: 1;
  min-width: var(--s-0);
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  position: relative;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr minmax(0, var(--search-w)) 1fr;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-0) var(--s-5);
  border-bottom: 1px solid var(--line);
  background: var(--bg-base);
  z-index: var(--z-topbar);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: var(--s-0);
}

.topbar-title {
  font-size: var(--t-h2-size);
  font-weight: var(--t-h2-w);
  line-height: var(--t-h2-lh);
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: var(--s-1);
}

.topbar-center {
  display: flex;
  justify-content: center;
  width: 100%;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: var(--search-w);
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: var(--s-3);
  color: var(--text-3);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
}

.search-input {
  width: 100%;
  height: var(--input-h);
  padding: var(--s-0) var(--s-7) var(--s-0) var(--s-6);
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size: var(--t-small-size);
  transition: border-color var(--d-fast) var(--ease), background var(--d-fast) var(--ease);
}

.search-input::placeholder {
  color: var(--text-3);
}

.search-input:hover {
  border-color: var(--bg-elev-4);
}

.search-input:focus {
  background: var(--bg-elev-2);
  border-color: var(--accent);
}

.search-clear {
  position: absolute;
  right: var(--s-1-5);
  display: none;
}

.search-box.has-value .search-clear {
  display: inline-flex;
}

.search-kbd {
  position: absolute;
  right: var(--s-2-5);
  padding: var(--s-0-5) var(--s-1-5);
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text-3);
  font-size: var(--t-micro-size);
  font-family: var(--font-mono);
  pointer-events: none;
}

.search-box.has-value .search-kbd,
.search-input:focus ~ .search-kbd {
  display: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  min-width: var(--s-0);
}

.scan-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1-5);
  padding: var(--s-1) var(--s-2-5);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--t-caption-size);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.scan-dot {
  width: var(--status-dot-size);
  height: var(--status-dot-size);
  border-radius: var(--r-pill);
  background: var(--accent);
  animation: pulse-opacity var(--d-skeleton) var(--ease) infinite;
}

/* 2px top scanning bar */
.scan-progress {
  height: var(--scan-bar-h);
  width: 100%;
  background: var(--line-subtle);
  overflow: hidden;
  flex-shrink: 0;
  display: none;
}

.scan-progress.is-active {
  display: block;
}

.scan-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width var(--d-base) var(--ease);
}

/* =========================================================
 * Buttons & Controls
 * ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: var(--btn-h);
  padding: var(--s-0) var(--s-3-5);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text-1);
  font-size: var(--t-small-size);
  font-weight: var(--t-weight-medium);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--bg-elev-3);
  border-color: var(--bg-elev-4);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-sm {
  height: var(--btn-h-sm);
  padding: var(--s-0) var(--s-2-5);
  font-size: var(--t-caption-size);
}

.btn-lg {
  height: var(--btn-h-lg);
  padding: var(--s-0) var(--s-5);
  font-size: var(--t-body-size);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  font-weight: var(--t-weight-semibold);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-active);
  border-color: var(--accent-active);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elev-3);
  border-color: transparent;
  color: var(--text-1);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--text-pure);
  font-weight: var(--t-weight-semibold);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.icon-btn {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  padding: var(--s-0);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}

.icon-btn-sm {
  width: var(--icon-btn-sm);
  height: var(--icon-btn-sm);
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-elev-3);
  color: var(--text-1);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.icon-btn.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.segmented {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s-0-5);
  gap: var(--s-0-5);
}

.segmented-btn {
  height: var(--icon-btn-sm);
  padding: var(--s-0) var(--s-2-5);
  border-radius: var(--r-xs);
  border: var(--s-0);
  background: transparent;
  color: var(--text-2);
  font-size: var(--t-caption-size);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}

.segmented-btn:hover {
  color: var(--text-1);
}

.segmented-btn.is-active {
  background: var(--bg-elev-3);
  color: var(--text-1);
  font-weight: var(--t-weight-medium);
}

/* =========================================================
 * View Host & Common Page Layouts
 * ========================================================= */
.view-host {
  flex: 1;
  min-height: var(--s-0);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 两个 view-host（命令式 / Vue）互斥显示：hidden 必须盖过 display:flex */
.view-host[hidden] {
  display: none;
}

.page-scroll {
  flex: 1;
  min-height: var(--s-0);
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-5);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.page-title {
  margin: var(--s-0);
  font-size: var(--t-h1-size);
  line-height: var(--t-h1-lh);
  font-weight: var(--t-h1-w);
  color: var(--text-1);
}

.page-subtitle {
  margin: var(--s-1) var(--s-0) var(--s-0);
  font-size: var(--t-small-size);
  line-height: var(--t-small-lh);
  color: var(--text-2);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}

.section-title {
  margin: var(--s-0);
  font-size: var(--t-h2-size);
  line-height: var(--t-h2-lh);
  font-weight: var(--t-h2-w);
  color: var(--text-1);
}

/* =========================================================
 * P3 Album Detail & P5 Playlist Detail Hero
 * ========================================================= */
.detail-hero {
  display: flex;
  align-items: flex-end;
  gap: var(--s-5);
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--line);
}

.detail-cover {
  width: var(--cover-md);
  height: var(--cover-md);
  flex-shrink: 0;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: var(--s-2-5);
  min-width: var(--s-0);
}

.detail-kicker {
  font-size: var(--t-caption-size);
  color: var(--text-3);
  font-weight: var(--t-weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-title {
  margin: var(--s-0);
  font-size: var(--t-display-size);
  line-height: var(--t-display-lh);
  font-weight: var(--t-display-w);
  color: var(--text-1);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-2);
  font-size: var(--t-small-size);
  font-variant-numeric: tabular-nums;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2-5);
  margin-top: var(--s-1-5);
}

.related-shelf {
  margin-top: var(--s-6);
}

.h-scroll-row {
  display: flex;
  gap: var(--s-4);
  overflow-x: auto;
  padding-bottom: var(--s-2);
}

/* =========================================================
 * P5 Playlists & Drag Handle
 * ========================================================= */
.drag-handle {
  color: var(--text-3);
  cursor: grab;
  display: inline-flex;
  align-items: center;
  margin-right: var(--s-1-5);
}

.drag-handle:active {
  cursor: grabbing;
}

.playlist-hint {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1-5);
  color: var(--text-3);
  font-size: var(--t-caption-size);
}

/* =========================================================
 * P6 Search View
 * ========================================================= */
.search-group {
  margin-bottom: var(--s-6);
}

/* =========================================================
 * P7 Now Playing View (Responsive >=1280 wide / <1280 narrow)
 * ========================================================= */
.now-view {
  flex: 1;
  min-height: var(--s-0);
  display: grid;
  grid-template-columns: 40% 60%;
  overflow: hidden;
  padding: var(--s-5) var(--s-6);
  gap: var(--s-6);
}

.now-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-5);
  min-width: var(--s-0);
}

.now-cover-frame {
  width: 100%;
  max-width: var(--cover-lg-max);
}

.now-cover-frame .cover-box {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-cover);
}

.now-meta {
  width: 100%;
  max-width: var(--cover-lg-max);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.now-title {
  margin: var(--s-0);
  font-size: var(--t-display-size);
  line-height: var(--t-display-lh);
  font-weight: var(--t-display-w);
  color: var(--text-1);
}

.now-sub {
  font-size: var(--t-body-size);
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.now-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
  flex-wrap: wrap;
}

.now-right {
  position: relative;
  min-height: var(--s-0);
  min-width: var(--s-0);
  display: flex;
  flex-direction: column;
}

.now-lyric-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  flex-shrink: 0;
}

.lyric-viewport {
  flex: 1;
  min-height: var(--s-0);
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000000 var(--lyric-mask-h),
    #000000 calc(100% - var(--lyric-mask-h)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000000 var(--lyric-mask-h),
    #000000 calc(100% - var(--lyric-mask-h)),
    transparent 100%
  );
}

.lyric-track {
  position: absolute;
  left: var(--s-0);
  right: var(--s-0);
  top: var(--s-0);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4-5);
  padding: var(--s-6) var(--s-4);
  will-change: transform;
  transition: transform var(--d-slow) var(--ease);
}

.lyric-line {
  text-align: center;
  max-width: 100%;
  cursor: pointer;
  padding: var(--s-1-5) var(--s-3);
  border-radius: var(--r-sm);
  opacity: 0.35;
  color: var(--text-3);
  font-size: var(--t-h2-size);
  line-height: var(--t-h2-lh);
  font-weight: var(--t-body-w);
  transition: opacity var(--d-base) var(--ease), color var(--d-base) var(--ease), background var(--d-fast) var(--ease);
}

.lyric-line:hover {
  background: var(--bg-elev-2);
  opacity: 0.72;
}

.lyric-line.is-active {
  opacity: 1;
  color: var(--text-1);
  font-size: var(--t-h1-size);
  line-height: var(--t-h1-lh);
  font-weight: var(--t-h1-w);
}

.lyric-line.is-interlude {
  opacity: 0.5;
  color: var(--text-2);
  font-size: var(--t-body-size);
}

.lyric-tr {
  display: block;
  margin-top: var(--s-1);
  font-size: var(--t-small-size);
  line-height: var(--t-small-lh);
  font-weight: var(--t-body-w);
  color: var(--text-2);
  opacity: 0.75;
}

/* Word-level karaoke fill: accent completed, pure white remaining */
.lrc-word {
  display: inline;
  background-image: linear-gradient(90deg, var(--accent) var(--wp, 0%), var(--text-pure) var(--wp, 0%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Line-level fallback: left-to-right fill over an estimated sung length
   (js/lyric.js lineFill). No per-word timing is implied. */
.lrc-line-sweep {
  display: inline;
  background-image: linear-gradient(
    90deg,
    var(--accent) var(--lp, 0%),
    var(--text-pure) var(--lp, 0%)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lyric-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  color: var(--text-2);
  text-align: center;
}

.lyric-skeleton-row {
  display: flex;
  gap: var(--s-2-5);
  align-items: center;
}

.lyric-skeleton-pill {
  height: var(--skeleton-title-h);
  border-radius: var(--r-pill);
  background: var(--skeleton-b);
  animation: skeleton-pulse var(--d-skeleton) var(--ease) infinite;
}

.lyric-skeleton-pill.w-sm { width: var(--s-7); }
.lyric-skeleton-pill.w-md { width: var(--album-sm); }
.lyric-skeleton-pill.w-lg { width: var(--cover-md); }

@media (max-width: 1279px) {
  .now-view {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    padding: var(--s-4) var(--s-5);
    gap: var(--s-4);
  }

  .now-left {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--s-5);
  }

  .now-cover-frame {
    width: var(--cover-narrow);
    max-width: var(--cover-narrow);
  }

  .now-meta {
    max-width: 100%;
  }
}

/* =========================================================
 * P8 Settings View
 * ========================================================= */
.settings-wrap {
  max-width: var(--settings-max-w);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.settings-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.settings-card-head {
  padding: var(--s-3-5) var(--s-4);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-row {
  padding: var(--s-3-5) var(--s-4);
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.settings-row:last-child {
  border-bottom: var(--s-0);
}

.settings-row.is-broken {
  border-left: var(--border-accent-w) solid var(--warn);
  background: var(--warn-soft);
}

.settings-row-info {
  min-width: var(--s-0);
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.settings-row-title {
  font-size: var(--t-body-size);
  font-weight: var(--t-weight-medium);
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.settings-row-desc {
  font-size: var(--t-small-size);
  color: var(--text-2);
}

.settings-row-warn {
  font-size: var(--t-caption-size);
  color: var(--warn);
}

.dir-path {
  font-family: var(--font-mono);
  font-size: var(--t-small-size);
  color: var(--text-1);
}

.dir-tag {
  padding: var(--s-0-5) var(--s-1-5);
  border-radius: var(--r-xs);
  font-size: var(--t-micro-size);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text-2);
}

.status-dot {
  width: var(--status-dot-size);
  height: var(--status-dot-size);
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

.status-dot.is-ok { background: var(--success); }
.status-dot.is-warn { background: var(--warn); }

.settings-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: var(--toggle-w);
  height: var(--toggle-h);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-elev-3);
  cursor: pointer;
  padding: var(--s-0);
  flex-shrink: 0;
  transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease);
}

.toggle::after {
  content: "";
  position: absolute;
  top: var(--s-0-5);
  left: var(--s-0-5);
  width: var(--toggle-knob);
  height: var(--toggle-knob);
  border-radius: var(--r-pill);
  background: var(--text-1);
  transition: transform var(--d-fast) var(--ease);
}

.toggle[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle[aria-checked="true"]::after {
  background: var(--text-on-accent);
  transform: translateX(var(--s-4));
}

.select-input {
  height: var(--btn-h);
  padding: var(--s-0) var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text-1);
  font-size: var(--t-small-size);
  cursor: pointer;
}

.kbd-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2) var(--s-5);
  padding: var(--s-4);
}

.kbd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-1-5) var(--s-0);
  border-bottom: 1px solid var(--line-subtle);
  font-size: var(--t-small-size);
}

.kbd-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--kbd-min-w);
  padding: var(--s-0-5) var(--s-1-5);
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  font-family: var(--font-mono);
  font-size: var(--t-caption-size);
  color: var(--text-1);
}

/* =========================================================
 * P9 Welcome Wizard
 * ========================================================= */
.welcome-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
  overflow-y: auto;
}

.welcome-card {
  width: 100%;
  max-width: var(--welcome-max-w);
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.wizard-steps {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-small-size);
  color: var(--text-3);
}

.wizard-step.is-active {
  color: var(--text-1);
  font-weight: var(--t-weight-medium);
}

.wizard-step.is-done {
  color: var(--success);
}

.wizard-dot {
  width: var(--step-dot);
  height: var(--step-dot);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-caption-size);
  font-variant-numeric: tabular-nums;
}

.wizard-step.is-active .wizard-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  font-weight: var(--t-weight-semibold);
}

.wizard-step.is-done .wizard-dot {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}

.wizard-title {
  margin: var(--s-0);
  font-size: var(--t-display-size);
  line-height: var(--t-display-lh);
  font-weight: var(--t-display-w);
}

.wizard-desc {
  margin: var(--s-0);
  color: var(--text-2);
  font-size: var(--t-body-size);
}

.wizard-dropzone {
  padding: var(--s-5);
  border-radius: var(--r-md);
  border: 1px dashed var(--line);
  background: var(--bg-elev-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  text-align: center;
}

.wizard-bar {
  width: 100%;
  height: var(--track-bar-h-hover);
  border-radius: var(--r-pill);
  background: var(--bg-elev-3);
  overflow: hidden;
}

.wizard-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width var(--d-base) var(--ease);
}

.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-2);
}

/* =========================================================
 * Global PlayBar (88px active / 60px idle)
 * ========================================================= */
.playbar {
  height: var(--playbar-h);
  flex-shrink: 0;
  background: var(--bg-elev-1);
  border-top: 1px solid var(--line);
  padding: var(--s-0) var(--s-5);
  display: grid;
  grid-template-columns: 1fr minmax(0, var(--play-ctrl-max)) 1fr;
  align-items: center;
  gap: var(--s-5);
  z-index: var(--z-playbar);
  transition: height var(--d-base) var(--ease);
}

.playbar.is-idle {
  height: var(--playbar-h-idle);
}

.playbar.is-idle .pb-center,
.playbar.is-idle .pb-right {
  opacity: 0.4;
  pointer-events: none;
}

.pb-left {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: var(--s-0);
}

.pb-cover-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  flex-shrink: 0;
}

.pb-cover-btn {
  padding: var(--s-0);
  border: var(--s-0);
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: block;
}

.pb-eq-under {
  height: var(--s-2);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.pb-track-meta {
  min-width: var(--s-0);
  display: flex;
  flex-direction: column;
  gap: var(--s-0-5);
}

.pb-title {
  font-size: var(--t-body-size);
  font-weight: var(--t-weight-medium);
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.pb-title:hover {
  color: var(--accent);
}

.pb-artist {
  font-size: var(--t-small-size);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pb-idle-text {
  font-size: var(--t-small-size);
  color: var(--text-3);
}

.pb-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100%;
}

.pb-controls {
  display: flex;
  align-items: center;
  gap: var(--s-2-5);
}

.pb-play-btn {
  width: var(--play-btn-size);
  height: var(--play-btn-size);
  border-radius: var(--r-pill);
  border: var(--s-0);
  background: var(--accent);
  color: var(--text-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}

.pb-play-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.pb-play-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.pb-progress-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-2-5);
}

.pb-time {
  font-size: var(--t-caption-size);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: var(--s-7);
}

.pb-time.is-end {
  text-align: right;
}

/* Scrubbable 4px->6px progress bar with floating bubble */
.scrub-bar {
  position: relative;
  flex: 1;
  height: var(--s-4);
  display: flex;
  align-items: center;
  cursor: pointer;
}

.scrub-track {
  position: relative;
  width: 100%;
  height: var(--track-bar-h);
  border-radius: var(--r-pill);
  background: var(--bg-elev-3);
  transition: height var(--d-fast) var(--ease);
}

.scrub-bar:hover .scrub-track,
.scrub-bar.is-dragging .scrub-track {
  height: var(--track-bar-h-hover);
}

.scrub-fill {
  position: absolute;
  left: var(--s-0);
  top: var(--s-0);
  bottom: var(--s-0);
  border-radius: var(--r-pill);
  background: var(--accent);
}

.scrub-thumb {
  position: absolute;
  top: 50%;
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: var(--r-pill);
  background: var(--text-1);
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--d-fast) var(--ease);
  pointer-events: none;
}

.scrub-bar:hover .scrub-thumb,
.scrub-bar.is-dragging .scrub-thumb,
.scrub-bar:focus-visible .scrub-thumb {
  transform: translate(-50%, -50%) scale(1);
}

.scrub-bubble {
  position: absolute;
  bottom: calc(100% + var(--s-1-5));
  transform: translateX(-50%);
  padding: var(--s-0-5) var(--s-2);
  border-radius: var(--r-xs);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  color: var(--text-1);
  font-size: var(--t-caption-size);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--d-fast) var(--ease);
  box-shadow: var(--shadow-toast);
}

.scrub-bar:hover .scrub-bubble,
.scrub-bar.is-dragging .scrub-bubble {
  opacity: 1;
}

.pb-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
}

.vol-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.vol-slider-wrap {
  width: var(--vol-slider-w);
  display: flex;
  align-items: center;
}

/* Volume collapses to icon + hover popover below 900px */
@media (max-width: 899px) {
  .vol-slider-wrap {
    position: absolute;
    bottom: calc(100% + var(--s-2));
    left: 50%;
    transform: translateX(-50%);
    width: var(--popover-vol-w);
    height: var(--popover-vol-h);
    padding: var(--s-3) var(--s-0);
    background: var(--bg-elev-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-menu);
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--d-fast) var(--ease);
  }

  .vol-control:hover .vol-slider-wrap,
  .vol-control:focus-within .vol-slider-wrap {
    opacity: 1;
    pointer-events: auto;
  }

  .vol-slider-wrap .scrub-bar {
    width: var(--s-4);
    height: 100%;
    justify-content: center;
  }

  .vol-slider-wrap .scrub-track {
    width: var(--track-bar-h);
    height: 100%;
  }
}

/* =========================================================
 * Queue Drawer
 * ========================================================= */
.drawer-backdrop {
  position: fixed;
  inset: var(--s-0);
  background: var(--scrim);
  z-index: var(--z-drawer);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--d-base) var(--ease);
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.queue-drawer {
  position: fixed;
  top: var(--s-0);
  right: var(--s-0);
  bottom: var(--playbar-h);
  width: var(--drawer-w);
  background: var(--bg-elev-1);
  border-left: 1px solid var(--line);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--d-base) var(--ease);
}

.queue-drawer.is-open {
  transform: translateX(var(--s-0));
}

.drawer-head {
  height: var(--topbar-h);
  padding: var(--s-0) var(--s-4);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-list {
  flex: 1;
  min-height: var(--s-0);
  overflow-y: auto;
  padding: var(--s-2);
}

.queue-item {
  display: flex;
  align-items: center;
  gap: var(--s-2-5);
  padding: var(--s-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--d-fast) var(--ease);
}

.queue-item:hover {
  background: var(--bg-elev-3);
}

.queue-item.is-active {
  background: var(--accent-soft);
}

.queue-item.is-active .qi-title {
  color: var(--accent);
  font-weight: var(--t-weight-medium);
}

.qi-meta {
  flex: 1;
  min-width: var(--s-0);
}

.qi-title {
  font-size: var(--t-small-size);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.qi-artist {
  font-size: var(--t-caption-size);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.queue-item .qi-actions { opacity: 0.35; }

.queue-item:hover .qi-actions,
.queue-item:focus-within .qi-actions { opacity: 1; }

.qi-dur {
  font-size: var(--t-caption-size);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* =========================================================
 * ContextMenu & Dropdown Menu (keyboard accessible)
 * ========================================================= */
.context-menu {
  position: fixed;
  min-width: var(--menu-min-w);
  padding: var(--s-1-5);
  border-radius: var(--r-md);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-menu);
  z-index: var(--z-menu);
  display: none;
  flex-direction: column;
  gap: var(--s-0-5);
}

.context-menu.is-open {
  display: flex;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-2-5);
  border-radius: var(--r-sm);
  border: var(--s-0);
  background: transparent;
  color: var(--text-1);
  font-size: var(--t-small-size);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}

.menu-item:hover,
.menu-item.is-focused {
  background: var(--bg-elev-3);
}

.menu-item.is-active {
  color: var(--accent);
}

.menu-item.is-danger {
  color: var(--danger);
}

.menu-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.menu-sep {
  height: 1px;
  background: var(--line);
  margin: var(--s-1) var(--s-1);
}

.menu-sublabel {
  padding: var(--s-1) var(--s-2-5);
  font-size: var(--t-micro-size);
  color: var(--text-3);
  font-weight: var(--t-weight-semibold);
}

/* =========================================================
 * Dialog Modal (Confirm / Form / Danger with red button on right)
 * ========================================================= */
.dialog-backdrop {
  position: fixed;
  inset: var(--s-0);
  background: var(--scrim);
  z-index: var(--z-dialog);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-5);
}

.dialog-backdrop.is-open {
  display: flex;
}

.dialog-box {
  width: 100%;
  max-width: var(--dialog-w);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-dialog);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dialog-box.is-lg {
  max-width: var(--dialog-w-lg);
}

.dialog-head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-title {
  margin: var(--s-0);
  font-size: var(--t-h2-size);
  font-weight: var(--t-h2-w);
}

.dialog-body {
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3-5);
}

.dialog-foot {
  padding: var(--s-3-5) var(--s-5);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2-5);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: var(--s-1-5);
  font-size: var(--t-small-size);
  color: var(--text-2);
}

.text-input {
  height: var(--input-h);
  padding: var(--s-0) var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev-1);
  color: var(--text-1);
  font-size: var(--t-body-size);
}

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

.prop-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-2) var(--s-4);
  font-size: var(--t-small-size);
}

.prop-key {
  color: var(--text-3);
}

.prop-val {
  color: var(--text-1);
  word-break: break-all;
}

.prop-val.is-mono {
  font-family: var(--font-mono);
  font-size: var(--t-caption-size);
}

/* =========================================================
 * Toast Stack (Success / Error / Undo)
 * ========================================================= */
.toast-stack {
  position: fixed;
  right: var(--s-5);
  bottom: calc(var(--playbar-h) + var(--s-4));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: var(--toast-max-w);
  padding: var(--s-2-5) var(--s-3-5);
  border-radius: var(--r-md);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-left: var(--border-accent-w) solid var(--accent);
  box-shadow: var(--shadow-toast);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--t-small-size);
  color: var(--text-1);
}

.toast.is-success { border-left-color: var(--success); }
.toast.is-error { border-left-color: var(--danger); }
.toast.is-warn { border-left-color: var(--warn); }

.toast-msg {
  flex: 1;
}

/* =========================================================
 * Inline Floating Desktop Lyrics Preview (toggleable via L)
 * ========================================================= */
.mini-overlay-host {
  position: fixed;
  left: 50%;
  bottom: calc(var(--playbar-h) + var(--s-4));
  transform: translateX(-50%);
  width: var(--overlay-default-w);
  max-width: calc(100% - var(--s-6));
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-lg);
  background: var(--overlay-pill-bg);
  border: 1px solid var(--overlay-pill-border);
  box-shadow: var(--shadow-dialog);
  z-index: var(--z-drawer);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  text-align: center;
}

.mini-overlay-host.is-open {
  display: flex;
}

.mini-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: var(--t-caption-size);
  color: var(--text-3);
  margin-bottom: var(--s-1);
}

.mini-overlay-line {
  font-size: var(--t-h1-size);
  font-weight: var(--t-weight-semibold);
  color: var(--text-pure);
  text-shadow: var(--overlay-text-shadow);
}

.mini-overlay-sub {
  font-size: var(--t-small-size);
  color: var(--text-2);
  opacity: 0.72;
}

/* =========================================================
 * Keyframes & Reduced Motion
 * ========================================================= */
@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.28); }
  50% { transform: scaleY(1); }
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .eq-bars i {
    animation: none;
    transform: scaleY(0.6);
  }
}

/* =========================================================
 * 无边框窗口的自绘标题栏（壳 v0.2 + window.frameless）
 * ========================================================= */
.titlebar {
  display: none;
}

html[data-frameless="1"] .titlebar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: 32px;
  flex: none;
  padding: 0 var(--s-2) 0 var(--s-3);
  background: var(--bg-elev-1);
  border-bottom: 1px solid var(--line);
  user-select: none;
}

html[data-frameless="1"] .titlebar-brand {
  width: 16px;
  height: 16px;
  display: inline-flex;
  flex: none;
}

.titlebar-title {
  font-size: var(--t-caption-size);
  font-weight: var(--t-weight-medium);
  color: var(--text-2);
  white-space: nowrap;
}

.titlebar-drag {
  flex: 1;
  align-self: stretch;
  cursor: default;
}

.titlebar-btn {
  width: 30px;
  height: 22px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.titlebar-btn:hover {
  background: var(--bg-elev-3);
  color: var(--text-1);
}

.titlebar-btn.is-close:hover {
  background: var(--danger);
  color: var(--text-pure);
}

/* 无边框窗口的边缘拖拽改尺寸 */
.resize-frame {
  display: none;
}

html[data-frameless="1"] .resize-frame {
  display: block;
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-toast) + 1);
  pointer-events: none;
}

.resize-frame .rf {
  position: absolute;
  pointer-events: auto;
}

.rf-n { top: 0; left: 10px; right: 10px; height: 5px; cursor: ns-resize; }
.rf-s { bottom: 0; left: 10px; right: 10px; height: 5px; cursor: ns-resize; }
.rf-e { right: 0; top: 10px; bottom: 10px; width: 5px; cursor: ew-resize; }
.rf-w { left: 0; top: 10px; bottom: 10px; width: 5px; cursor: ew-resize; }
.rf-ne { top: 0; right: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.rf-nw { top: 0; left: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.rf-se { bottom: 0; right: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.rf-sw { bottom: 0; left: 0; width: 12px; height: 12px; cursor: nesw-resize; }

/* =========================================================
 * PWA / 宿主适配层（js/pwa.js · js/host.js）
 * ========================================================= */

/* 设置页「运行环境」里的能力胶囊 */
.host-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1-5);
  margin-top: var(--s-1);
}

.host-chip {
  font-size: var(--t-micro-size);
  line-height: 1.6;
  padding: 1px var(--s-2);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text-3);
  white-space: nowrap;
}

.host-chip.is-ok {
  color: var(--success);
  border-color: rgba(61, 220, 151, 0.35);
  background: var(--success-soft);
}

.host-chip.is-missing {
  border-style: dashed;
  color: var(--text-3);
}

/* 安装 / 更新提示条（左下角，避开播放条与 toast） */
.pwa-banner {
  position: fixed;
  left: var(--s-5);
  bottom: calc(var(--playbar-h) + var(--s-4));
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  max-width: min(560px, calc(100% - var(--s-8)));
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  border-left: var(--border-accent-w) solid var(--accent);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-toast);
  color: var(--text-1);
  font-size: var(--t-small-size);
}

.pwa-banner[hidden] {
  display: none;
}

.pwa-banner-msg {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
}

.pwa-banner .btn {
  flex: none;
}

/* 离线角标：只提示“看到的是缓存”，不阻断操作 */
.offline-chip {
  position: fixed;
  top: calc(var(--topbar-h, 56px) + var(--s-2));
  right: var(--s-4);
  z-index: var(--z-toast);
  padding: 2px var(--s-2);
  border-radius: 999px;
  border: 1px solid var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--t-micro-size);
}

.offline-chip[hidden] {
  display: none;
}


/* ---------- 在线音源：搜索页的「在线」分组 ---------- */
.online-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.online-row:hover { background: var(--bg-elev-2); }
.online-main { flex: 1 1 auto; min-width: 0; }
.online-title {
  color: var(--text-1);
  font-size: var(--t-small-size);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.online-sub {
  color: var(--text-3);
  font-size: var(--t-caption-size);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.online-dur {
  color: var(--text-2);
  font-size: var(--t-caption-size);
  font-variant-numeric: tabular-nums;
}

/* 在线结果的次要操作：悬停才明显，不抢视线 */
.online-acts { display: flex; gap: 4px; opacity: .45; transition: opacity var(--d-fast) var(--ease); }
.online-row:hover .online-acts { opacity: 1; }
.online-badge {
  display: inline-block;
  padding: 0 6px;
  margin-right: 4px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--text-3);
  font-size: var(--t-micro-size);
  vertical-align: 1px;
}

/* 试听曲目：弱化一档，避免被当成整曲 */
.online-row.is-preview { opacity: .72; }
.online-row.is-preview:hover { opacity: 1; }

/* 在线歌单：关键词搜歌单 + 详情分页（加载更多 / 滚动自动加载） */
.online-playlist-search {
  display: flex;
  gap: var(--s-2);
  max-width: 560px;
  margin-bottom: var(--s-4);
}
.online-playlist-search .text-input { flex: 1 1 auto; min-width: 0; }
.online-load-more {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  flex-wrap: wrap;
}

/* 播放条 / 正在播放：来源徽标（在线曲目才有，点它 = 换源） */
.pb-source {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
  padding: 0 6px;
  height: 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: var(--t-micro-size);
  line-height: 1;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-source:hover { color: var(--accent); border-color: var(--accent); }
.pb-source.is-preview { color: var(--warn); border-color: rgba(255, 176, 32, .35); }
.pb-source.is-cached::before { content: "⚡"; margin-right: 3px; }
.now-sub + .pb-source { margin-left: var(--s-2); }

/* 在线结果：封面 + 两行元信息 + 来源/码率标签 */
.online-cover-wrap {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-elev-3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.online-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.online-cover-fb { color: var(--text-3); font-size: 16px; line-height: 1; display: none; }
.online-row.is-fb .online-cover-fb { display: block; }
.online-cover-wrap.is-fb .online-cover-fb { display: block; }
.online-tags { display: flex; gap: 6px; margin-top: 2px; align-items: center; }
.online-src {
  font-size: var(--t-micro-size);
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 0 6px;
  line-height: 16px;
}
.online-q {
  font-size: var(--t-micro-size);
  color: var(--accent);
  border: 1px solid rgba(255, 122, 69, .35);
  border-radius: var(--r-pill);
  padding: 0 6px;
  line-height: 16px;
}


/* 插件配置面板（默认折叠，点「配置」展开） */
.plg-config {
  padding: var(--s-3) var(--s-4) var(--s-4);
  border-top: 1px dashed var(--line);
  display: grid;
  gap: var(--s-3);
  background: var(--bg-base);
}
.plg-config-head {
  font-size: var(--t-small-size);
  font-weight: var(--t-weight-semibold);
  color: var(--text-2);
  display: flex;
  gap: var(--s-2);
  align-items: baseline;
}
.plg-field {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--s-2);
  align-items: start;
  font-size: var(--t-small-size);
}
.plg-field-label { color: var(--text-3); line-height: 28px; }
.plg-field-input { display: grid; gap: 2px; min-width: 0; }
.plg-field-input .select-input { width: 100%; }

/* 搜索结果分组标题（歌曲 / 专辑 / 艺术家 / 歌单） */
.online-group-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: var(--s-3) 0 var(--s-2);
  padding-bottom: var(--s-1);
  border-bottom: 1px solid var(--line-subtle);
  font-size: var(--t-h2-size);
  font-weight: var(--t-h2-w);
  color: var(--text-1);
}
.online-group-count { font-size: var(--t-caption-size); color: var(--text-3); font-weight: 400; }

/* ---------- 搜索闭环补充：分组操作 / 快捷播放 / 入库标识 / 空态 ---------- */
.search-view .search-group { margin-bottom: var(--s-5); }

.group-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

.group-count {
  font-size: var(--t-caption-size);
  font-weight: 400;
  color: var(--text-3);
  margin-left: var(--s-1);
}

.sort-select {
  height: 28px;
  padding: 0 var(--s-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text-2);
  font-size: var(--t-caption-size);
}


.online-badge.is-saved {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}

.online-row .online-badge + .online-badge.is-saved { margin-left: var(--s-1); }

.online-errors {
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-left: 3px solid var(--warn);
  border-radius: var(--r-sm);
  background: var(--bg-elev-2);
  color: var(--text-2);
  font-size: var(--t-caption-size);
}

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-6) var(--s-4);
  text-align: center;
}

.search-empty .state-title { margin: var(--s-1) 0 0; }
.search-empty .state-desc { max-width: 520px; }

.search-empty-actions {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.hl { color: var(--accent); }

.drawer-head-actions { display: flex; align-items: center; gap: var(--s-2); }

.queue-item .qi-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--d-fast) var(--ease);
}

.queue-item:hover .qi-actions,
.queue-item:focus-within .qi-actions { opacity: 1; }

.queue-item .qi-actions .icon-btn { width: 22px; height: 22px; font-size: 10px; color: var(--text-3); }

.online-detail-actions,
.detail-actions { flex-wrap: wrap; }

/* 触屏没有 hover：行操作常驻，避免「看不见的按钮」 */
@media (hover: none) {
  .tr-actions {
    opacity: 1;
    pointer-events: auto;
  }
}
