/* ============================================
   SUNO EXPLORER - Standalone Web App
   1:1 port of extension library.css + insights.css
   ============================================ */

:root {
  --bg-base: #0a0a0f;
  --bg-surface: #12121a;
  --bg-elevated: #1a1a25;
  --bg-hover: #22222f;
  --bg-active: #2a2a3a;

  --text-primary: #f5f5f7;
  --text-secondary: #e6e6e6;
  --text-muted: #606070;

  --accent: #a855f7;
  --accent-bright: #c084fc;
  --accent-dim: rgba(168, 85, 247, 0.15);

  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.15);
  --error: #ef4444;
  --liked: #f43f5e;
  --liked-dim: rgba(244, 63, 94, 0.15);

  --border: #2a2a3a;
  --border-subtle: #1f1f2a;

  /* Aliases used by lyrics/prompts pages */
  --surface-1: var(--bg-surface);
  --surface-2: var(--bg-elevated);
  --text-1: var(--text-primary);
  --text-2: var(--text-secondary);
  --text-3: var(--text-muted);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);

  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Roboto Mono', 'Consolas', monospace;

  --sidebar-width: 280px;
  --panel-width: 480px;
  --header-height-base: 56px;
  --header-height: calc(var(--header-height-base) + env(safe-area-inset-top, 0px));
  --np-height: 56px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Suppress all focus rings on mouse/touch click; keep for keyboard nav */
button:focus, select:focus { outline: none; }
button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-btn:focus, .view-btn:focus, .name-mode-toggle:focus,
.gp-btn:focus, .song-menu-btn:focus, .thumb-size-select:focus,
.thumb-mode-select:focus, .sort-select:focus {
  outline: none; box-shadow: none; border-color: var(--border);
}
.filter-btn:focus-visible, .view-btn:focus-visible, .name-mode-toggle:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ============================================
   Loading Screen
   ============================================ */

.loading-screen {
  position: fixed; inset: 0; background: var(--bg-base);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999; gap: 16px;
}
.loading-screen .spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--bg-elevated); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.loading-screen p { color: var(--text-muted); font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Auth Gate
   ============================================ */

.auth-gate {
  position: fixed; inset: 0; background: var(--bg-base);
  overflow-y: auto; z-index: 9000; scroll-behavior: smooth;
}
.auth-scroll {
  max-width: 680px; width: 100%; margin: 0 auto;
  padding: 0 24px 60px; text-align: center;
}

/* -- Hero -- */
.go-hero { padding: 80px 0 48px; }
.go-hero-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--accent-bright); margin-bottom: 16px;
}
.go-hero-title {
  font-size: 48px; font-weight: 800; line-height: 1.1; margin-bottom: 20px;
  color: var(--text-primary);
}
.go-highlight {
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.go-hero-sub {
  font-size: 17px; color: var(--text-secondary); line-height: 1.6;
  max-width: 480px; margin: 0 auto 32px;
}
.go-hero-cta {
  display: inline-block; padding: 14px 36px;
  background: var(--accent); color: #fff; text-decoration: none;
  border-radius: var(--radius-md); font-size: 15px; font-weight: 600;
  transition: all 0.2s;
}
.go-hero-cta:hover { background: #9333ea; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(168, 85, 247, 0.35); }

/* -- Features -- */
.go-features {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px; margin-bottom: 48px; text-align: left;
}
.go-feature {
  padding: 24px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.go-feature-icon { font-size: 28px; margin-bottom: 12px; }
.go-feature h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.go-feature p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* -- Pricing (auth gate) -- */
.go-pricing { margin-bottom: 48px; }
.go-section-title {
  font-size: 22px; font-weight: 700; margin-bottom: 20px; color: var(--text-primary);
}
.go-pricing-note {
  margin-top: 12px; font-size: 12px; color: var(--text-muted);
}

/* -- Sign In -- */
.go-signin { max-width: 400px; margin: 0 auto 48px; }
.auth-options { display: flex; flex-direction: column; gap: 12px; }
.auth-btn { width: 100%; padding: 14px; font-size: 15px; border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s; }
.auth-btn:hover { transform: translateY(-1px); }
.auth-divider { display: flex; align-items: center; gap: 16px; margin: 8px 0; color: var(--text-muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-import p { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

/* -- Footer -- */
.go-footer { font-size: 13px; color: var(--text-muted); padding-top: 24px; border-top: 1px solid var(--border); }
.go-footer a { color: var(--accent-bright); text-decoration: none; }
.go-footer a:hover { text-decoration: underline; }
.go-footer p { margin: 4px 0; }
.go-footer-install { color: var(--text-secondary); font-size: 13px; }

/* -- Responsive -- */
@media (max-width: 600px) {
  .go-hero-title { font-size: 36px; }
  .go-hero-sub { font-size: 15px; }
  .go-hero { padding: 48px 0 32px; }
  .go-features { grid-template-columns: 1fr; gap: 12px; }
  .go-feature { padding: 16px; }
  .auth-scroll { padding: 0 16px 40px; }
}

/* ============================================
   App Layout
   ============================================ */

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* ============================================
   Site Header (SPA navigation)
   ============================================ */

.site-header {
  height: var(--header-height);
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 200;
}
.header-content { display: flex; align-items: center; height: var(--header-height-base); padding: 0 16px; gap: 16px; }

.sidebar-toggle {
  display: none; width: 36px; height: 36px; background: transparent;
  border: 1px solid var(--border); cursor: pointer; padding: 0; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 16px;
  align-items: center; justify-content: center;
}
.sidebar-toggle:hover { background: var(--bg-hover); }
.filter-icon { display: block; line-height: 1; }

.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; }
.logo-text {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* Nav toggle (mobile menu for page nav) */
.nav-toggle {
  display: none; width: 36px; height: 36px; background: transparent;
  border: 1px solid var(--border); cursor: pointer; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 18px; align-items: center; justify-content: center;
  order: 99; /* Push to far right in flex header */
}
.nav-toggle:hover { background: var(--bg-hover); }

.header-nav { display: flex; gap: 4px; margin-left: 24px; }
.nav-btn {
  padding: 8px 16px; background: transparent; border: none; border-radius: var(--radius-md);
  color: var(--text-muted); font-family: var(--font-sans); font-size: 14px;
  font-weight: 500; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }
.nav-btn.active { background: var(--accent-dim); color: var(--accent-bright); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* User Menu */
.user-menu { position: relative; }
.user-btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-elevated);
  border: 1px solid var(--border); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.user-btn:hover { border-color: var(--accent); }
.user-avatar { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.user-avatar.signed-in { color: var(--accent-bright); background: var(--accent-dim); border-radius: 50%; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 220px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 300; overflow: hidden;
}
.dropdown-header { padding: 12px 16px; font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border-subtle); margin: 0; }
.dropdown-item {
  display: block; width: 100%; padding: 10px 16px; background: none; border: none;
  color: var(--text-primary); font-family: var(--font-sans); font-size: 13px;
  text-align: left; cursor: pointer; transition: background 0.1s;
}
.dropdown-item:hover { background: var(--bg-hover); }

/* Sync dot on avatar */
.user-btn .sync-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  border: 2px solid var(--bg-base);
  display: none; transition: background 0.3s;
}
.user-btn .sync-dot.visible { display: block; }
.user-btn .sync-dot.synced { background: var(--success); }
.user-btn .sync-dot.syncing { background: var(--accent-bright); animation: sync-pulse 1.2s ease-in-out infinite; }
.user-btn .sync-dot.error { background: var(--danger); }
.user-btn .sync-dot.needs-sync { background: var(--warning); }

@keyframes sync-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

/* Dropdown sync status row */
.dropdown-sync-status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; font-size: 11px; color: var(--text-muted);
}
.dropdown-sync-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
}
.dropdown-sync-dot.synced { background: var(--success); }
.dropdown-sync-dot.syncing { background: var(--accent-bright); animation: sync-pulse 1.2s ease-in-out infinite; }
.dropdown-sync-dot.error { background: var(--danger); }
.dropdown-sync-dot.needs-sync { background: var(--warning); }

/* ============================================
   Page Container
   ============================================ */

.page-container { flex: 1; min-height: 0; overflow: hidden; }
.page { height: 100%; overflow: hidden; }
#pagGuide { overflow-y: auto; }

/* ============================================
   Library Layout (matches extension)
   ============================================ */

.library-layout { display: flex; height: 100%; }

/* ============================================
   Sidebar (1:1 extension port)
   ============================================ */

.sidebar {
  width: var(--sidebar-width); background: var(--bg-surface);
  border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 24px 16px;
}

/* Search */
.search-container { margin-bottom: 20px; position: relative; }
.search-input {
  width: 100%; padding: 12px 36px 12px 16px; background: var(--bg-base);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-primary); font-family: var(--font-sans); font-size: 14px;
  transition: all 0.2s;
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-input::placeholder { color: var(--text-muted); }

/* Search help button */
.search-help-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-muted); font-size: 11px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1; transition: all 0.2s;
}
.search-help-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* Search legend (collapsible panel below search bar) */
.search-legend {
  display: none; margin-top: 6px; margin-bottom: 12px; padding: 10px 12px 10px;
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); font-size: 12px;
  color: var(--text-secondary); line-height: 1.6;
}
.search-legend.visible { display: block; }
.search-legend-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.search-legend-title {
  font-weight: 600; color: var(--text-primary); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.search-legend-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px; transition: color 0.2s;
}
.search-legend-close:hover { color: var(--text-primary); }
.search-legend-body { display: flex; gap: 16px; flex-wrap: wrap; }
.search-legend-col { flex: 1; min-width: 140px; }
.search-help-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 2px; }
.search-legend code {
  background: var(--bg-base); padding: 1px 5px; border-radius: 3px;
  font-family: var(--font-mono, monospace); font-size: 11px; color: var(--accent);
}
.search-help-hint { font-size: 10px; color: var(--text-muted); font-style: italic; }

/* ============================================
   Controls Panel (Collapsible - matches extension)
   ============================================ */

.controls-panel {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
  flex-shrink: 0;
}

.controls-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
}

.controls-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.controls-toggle .toggle-icon { font-size: 14px; }
.controls-toggle .toggle-text { flex: 1; text-align: left; font-weight: 500; }
.controls-toggle .toggle-chevron { font-size: 10px; transition: transform 0.2s; color: var(--text-muted); }
.controls-toggle.open .toggle-chevron { transform: rotate(180deg); }

.controls-content {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.controls-section-header {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-weight: 600;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.control-label { font-size: 12px; color: var(--text-secondary); }

.control-select {
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 11px;
  cursor: pointer;
  min-width: 90px;
  font-family: var(--font-sans);
}

.control-select.compact { padding: 3px 6px; font-size: 10px; min-width: 80px; }

.control-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.control-toggle:hover { color: var(--text-primary); }
.control-toggle input[type="checkbox"] { accent-color: var(--accent); margin: 0; }

/* ============================================
   Compact Filter System (1:1 extension port)
   ============================================ */

.filter-system { margin-bottom: 20px; }

/* Filter Header */
.filter-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.filter-clear {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.filter-count-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.filter-header-label {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.filter-expand-toggle {
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-expand-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Filter Groups */
.filter-group { margin-bottom: 10px; }

.filter-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-left: 2px;
}

.filter-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Filter Chips (Compact by default) */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.filter-chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-bright);
}

.filter-chip.active .filter-count {
  background: var(--accent);
  color: white;
}

.filter-icon { font-size: 14px; line-height: 1; }

.filter-label {
  display: none; /* Hidden by default (compact mode) */
  font-size: 11px;
}

.filter-system.expanded .filter-label { display: inline; }

.filter-count {
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-base);
  padding: 1px 5px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

/* Small chips for model versions */
.filter-chip-small { padding: 4px 6px; font-size: 11px; }
.filter-chip-small .filter-label { display: inline; }
.filter-chip-small .filter-count { font-size: 9px; padding: 1px 4px; min-width: 14px; }

/* 3-State Filter (Tags/Notes) */
/* Tristate filter states — applies to ALL filter chips */
.filter-chip[data-state="off"] { opacity: 0.8; }
.filter-chip[data-state="include"] {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--success);
  color: var(--success);
}
.filter-chip[data-state="include"]::after { content: "\2713"; font-size: 10px; margin-left: 2px; }
.filter-chip[data-state="exclude"] {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--error);
  color: var(--error);
}
.filter-chip[data-state="exclude"]::after { content: "\2717"; font-size: 10px; margin-left: 2px; }
.filter-exclude-label {
  font-size: 9px; font-weight: 700; color: var(--error);
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* Date Range Filter */
.filter-date-row { display: flex; align-items: center; gap: 6px; }
.filter-date-input {
  flex: 1;
  padding: 5px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  min-width: 0;
  transition: all 0.15s;
}
.filter-date-input:focus { outline: none; border-color: var(--accent); }
.filter-date-input::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.5; cursor: pointer; }
.filter-date-sep { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.filter-date-clear {
  padding: 5px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.filter-date-clear:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--error);
  color: var(--error);
}
.filter-date-row.has-dates .filter-date-input {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Active filter indicator */
.filter-system.has-active-filters .filter-header { border-bottom-color: var(--accent); }
.filter-system.has-active-filters .filter-header-label::after { content: " (active)"; color: var(--accent-bright); }

/* Stats Card */
.stats-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.stats-card.compact {
  padding: 10px 12px;
  margin-bottom: 8px;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.stats-card.compact .stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.stat { text-align: center; }
.stats-card.compact .stat { text-align: left; }

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-bright);
  font-family: var(--font-mono);
}
.stats-card.compact .stat-value {
  font-size: 16px;
  display: inline;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stats-card.compact .stat-label {
  font-size: 10px;
  margin-left: 3px;
}

.stats-links-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.stats-links-row .stats-quick-link {
  flex: 1;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  text-align: center;
}

.stats-links-row .stats-quick-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.stats-info {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 4px 12px;
}

/* Playlists Nav Button */
.playlists-nav {
  margin-bottom: 12px;
}

.playlists-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.playlists-nav-btn:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.playlists-nav-icon { font-size: 16px; }
.playlists-nav-label { flex: 1; text-align: left; }
.playlists-nav-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-base);
  padding: 2px 8px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

/* Insights Card */
.insights-card {
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
.insights-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--accent-bright); }
.insight {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 0; border-top: 1px solid var(--border-subtle);
}
.insight:first-of-type { border-top: none; padding-top: 0; }
.insight-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.insight-value {
  font-size: 13px; color: var(--text-primary); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Keyboard Hints */
.keyboard-hints {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px; padding: 12px;
  background: var(--bg-base); border-radius: var(--radius-md);
}
.hint { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
kbd {
  display: inline-block; padding: 2px 6px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 4px; font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary);
}

/* Sidebar Actions */
.sidebar-actions {
  display: flex; gap: 8px; margin-top: auto; padding-top: 16px;
}
.sidebar-action-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; font-family: var(--font-sans);
  flex: 1;
}
.sidebar-action-btn:hover {
  background: var(--bg-hover); color: var(--text-secondary); border-color: var(--text-muted);
}

/* ============================================
   Main Content (matches extension)
   ============================================ */

.main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg-base); min-height: 0;
}

/* Header / Toolbar */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-surface); flex-shrink: 0;
}

.header-info { margin-right: 10px; }
.header-title { font-size: 24px; font-weight: 600; }
.header-count { font-size: 14px; color: var(--text-muted); }

.header-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.header-controls.compact { gap: 4px; }
.header-controls.compact select,
.header-controls.compact button { padding: 6px 8px; font-size: 12px; }

.sort-select {
  padding: 8px 12px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-family: var(--font-sans); font-size: 13px; cursor: pointer;
}
.sort-select:focus { outline: none; }
.sort-select:focus-visible { border-color: var(--accent); }

.name-mode-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
  font-family: var(--font-sans);
}
.name-mode-toggle:hover { border-color: var(--accent); }
.name-mode-toggle.active {
  border-color: var(--accent); background: var(--accent-dim); color: var(--accent-bright);
}

.thumb-mode-select,
.thumb-size-select {
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-primary); padding: 6px 10px;
  border-radius: var(--radius-sm); font-family: var(--font-sans);
  font-size: 12px; cursor: pointer; min-width: 0; width: auto;
}
.thumb-mode-select { min-width: 105px; }
.thumb-mode-select:hover,
.thumb-size-select:hover { border-color: var(--accent); }

.view-toggle {
  display: flex; background: var(--bg-elevated);
  border-radius: var(--radius-sm); overflow: hidden;
}
.view-btn {
  padding: 8px 12px; background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
  font-family: var(--font-sans);
}
.view-btn:hover { color: var(--text-primary); }
.view-btn.active { background: var(--accent); color: white; }

/* ============================================
   Song Container (matches extension exactly)
   ============================================ */

.song-container {
  flex: 1; min-height: 0; overflow-y: auto; padding: 24px;
}

/* ============================================
   Song Cards — Base (applies to both grid + list)
   ============================================ */

.song-card {
  position: relative; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer;
  width: 200px;
  overflow: hidden;
}
.song-card > .song-cover-wrapper:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.song-card.active { border-color: var(--accent); background: var(--accent-dim); }

/* Upload/origin card borders */
.song-card.is-upload { border-color: rgba(59, 130, 246, 0.3); }
.song-card.derived-from-upload { border-color: rgba(139, 92, 246, 0.3); }
.song-card.strand-from-upload { border-color: rgba(59, 130, 246, 0.3); }
.song-card.strand-from-scratch { border-color: rgba(16, 185, 129, 0.3); }

/* Desktop hover — mouse users only */
@media (hover: hover) and (pointer: fine) {
  .song-card { transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; }
  .song-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
  .song-card.is-upload:hover { border-color: #3b82f6; }
}

/* Cover Wrapper — ::after is the always-present placeholder icon.
   Loaded images sit on top (z-index: 1) and cover it. */
.song-cover-wrapper {
  position: relative; width: 100%; height: 200px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-active));
  overflow: hidden;
}
.song-cover-wrapper::after {
  content: '\1F3B5';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; opacity: 0.15; pointer-events: none;
}
.song-cover { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; max-width: 100%; }
.song-cover-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-active));
  display: flex; align-items: center; justify-content: center; font-size: 48px;
  position: relative; z-index: 1;
}

/* Play Overlay — desktop mouse only */
.play-overlay {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 60px; height: 60px;
  background: rgba(168, 85, 247, 0.9); border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  font-size: 24px; color: white;
  opacity: 0; pointer-events: none; z-index: 2; cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .play-overlay { display: flex; transition: all 0.2s; }
  .song-card:hover .play-overlay {
    opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto;
  }
}

/* Badge System */
.song-badges {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  display: flex; gap: 6px; padding-left: 6px; flex-wrap: wrap;
  justify-content: flex-end; max-width: 70%;
}

/* ============================================
   Grid View
   ============================================ */

.song-container.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: minmax(240px, auto);
  gap: 16px; align-content: start; justify-content: start;
}
.song-container.view-grid .song-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 200px auto 280px;
}

/* Grid: Small */
.song-container.view-grid.size-small {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  grid-auto-rows: minmax(180px, auto);
  gap: 10px;
}
.song-container.view-grid.size-small .song-card { width: auto; min-height: 180px; contain-intrinsic-size: auto 120px auto 180px; }
.song-container.view-grid.size-small .song-cover-wrapper { height: auto; aspect-ratio: 1; }
.song-container.view-grid.size-small .song-title { font-size: 12px; }
.song-container.view-grid.size-small .song-meta { font-size: 10px; }
.song-container.view-grid.size-small .song-badges { gap: 2px; }
.song-container.view-grid.size-small .badge { font-size: 9px; padding: 2px 4px; }
.song-container.view-grid.size-small .song-cover-placeholder { font-size: 32px; }
.song-container.view-grid.size-small .song-cover-wrapper::after { font-size: 32px; }
.song-container.view-grid.size-small .song-menu-btn { width: 24px; height: 24px; font-size: 14px; }

/* Grid: Large */
.song-container.view-grid.size-large {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: minmax(260px, auto);
  gap: 14px;
}
.song-container.view-grid.size-large .song-card { width: auto; min-height: 260px; contain-intrinsic-size: auto 180px auto 260px; }
.song-container.view-grid.size-large .song-cover-wrapper { height: auto; aspect-ratio: 1; }
.song-container.view-grid.size-large .song-title { font-size: 14px; }
.song-container.view-grid.size-large .song-cover-placeholder { font-size: 48px; }
.song-container.view-grid.size-large .song-info { padding: 12px; }
.song-container.view-grid.size-large .badge { font-size: 11px; padding: 3px 6px; }

/* ============================================
   List View — overrides base card completely
   ============================================ */

.song-container.view-list {
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
}
.song-container.view-list .song-card {
  display: flex; flex-direction: row; align-items: center;
  width: 100% !important; min-height: auto !important;
  overflow: visible; gap: 10px;
  border-radius: var(--radius-sm); padding: 8px 12px;
  background: transparent; border: none; box-shadow: none;
  cursor: pointer;
}
.song-container.view-list .song-card:hover { background: var(--bg-hover); transform: none; box-shadow: none; }
.song-container.view-list .song-cover-wrapper {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--radius-sm);
  overflow: hidden; position: relative;
}
.song-container.view-list .song-cover-placeholder { font-size: 18px; }
.song-container.view-list .song-cover-wrapper::after { font-size: 18px; }
.song-container.view-list .play-overlay { display: none !important; }
.song-container.view-list .song-info {
  flex: 1; min-width: 0; padding: 0; display: flex; flex-direction: column; justify-content: center;
}
.song-container.view-list .song-title {
  font-size: 13px; font-weight: 500; color: var(--text-primary, var(--text-1));
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
  white-space: normal;
}
.song-container.view-list .song-meta {
  font-size: 11px; color: var(--text-muted, var(--text-3)); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-container.view-list .song-badges {
  position: static; display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap;
}
.song-container.view-list .badge { font-size: 10px; padding: 2px 5px; }
.song-container.view-list .song-menu-btn { position: static; opacity: 0.5; flex-shrink: 0; }

/* List: Small */
.song-container.view-list.size-small .song-cover-wrapper { width: 40px; height: 40px; }
.song-container.view-list.size-small .song-card { padding: 6px 10px; gap: 10px; }
.song-container.view-list.size-small .song-title { font-size: 12px; -webkit-line-clamp: 1; white-space: nowrap; }
.song-container.view-list.size-small .song-meta { font-size: 10px; }
.song-container.view-list.size-small .badge { font-size: 9px; padding: 1px 4px; }

/* List: Large */
.song-container.view-list.size-large .song-cover-wrapper { width: 56px; height: 56px; }
.song-container.view-list.size-large .song-card { padding: 10px 14px; gap: 12px; }
.song-container.view-list.size-large .song-title { font-size: 14px; -webkit-line-clamp: 2; }
.song-container.view-list.size-large .song-meta { font-size: 12px; }
.song-container.view-list.size-large .badge { font-size: 11px; padding: 3px 6px; }
.badge {
  padding: 4px 8px; background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px); border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge-versions { background: var(--accent); color: white; }
.badge-liked { background: var(--liked); color: white; }
.badge-disliked { background: #6b7280; color: white; }
.badge-plays { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }
.badge-upload { background: #3b82f6; color: white; }
.badge-derived { background: linear-gradient(135deg, #8b5cf6, #3b82f6); color: white; }
.badge-strand-upload { background: linear-gradient(135deg, #3b82f6, #6366f1); color: white; }
.badge-strand-scratch { background: linear-gradient(135deg, #10b981, #34d399); color: white; }
.badge-vocal, .badge-instr, .badge-mixed { font-size: 10px; padding: 2px 4px; }
.badge-definitive { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #000; }
.badge-comments { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }

/* Song Info */
.song-info { padding: 14px; }
.song-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-custom-title { color: var(--accent-bright); }
.song-original-title { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.song-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }

/* Song Menu Button */
.song-menu-btn {
  position: absolute; bottom: 14px; right: 14px;
  width: 28px; height: 28px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-size: 16px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  opacity: 0.5;
}
@media (hover: hover) and (pointer: fine) {
  .song-menu-btn { transition: all 0.15s; }
  .song-card:hover .song-menu-btn { opacity: 1; }
  .song-menu-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
}

.more-songs { grid-column: 1 / -1; text-align: center; color: var(--text-secondary); padding: 20px; }

/* ============================================
   Empty State
   ============================================ */

.empty-state {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center;
}
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ============================================
   Version Panel (1:1 extension port)
   ============================================ */

.version-panel {
  position: fixed; top: var(--header-height); right: 0;
  width: var(--panel-width); height: calc(100vh - var(--header-height) - env(safe-area-inset-bottom, 0px));
  background: var(--bg-surface); border-left: 1px solid var(--border);
  overflow-y: auto; z-index: 150;
  transform: translateX(100%); transition: transform 0.3s ease;
}
.version-panel.open { transform: translateX(0); }

.panel-close {
  position: sticky; top: 12px; float: right; margin: 12px 12px 0 0;
  width: 32px; height: 32px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 50%; color: var(--text-secondary);
  font-size: 18px; cursor: pointer; z-index: 10;
  transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.panel-close:hover { background: var(--bg-active); color: var(--text-primary); }

.panel-header {
  display: flex; gap: 16px; padding: 24px;
  background: linear-gradient(180deg, var(--bg-elevated), transparent);
}
.panel-cover {
  width: 100px; height: 100px; object-fit: cover;
  border-radius: var(--radius-lg); background: var(--bg-active);
}
.panel-info { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.panel-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; line-height: 1.3; word-break: break-word; }
.panel-custom-name { color: var(--accent-bright); display: block; }
.panel-original-name { font-size: 13px; color: var(--text-muted); display: block; margin-top: 2px; font-weight: 400; }
.panel-meta { display: flex; gap: 12px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }

.dna-badge {
  background: var(--accent-dim); padding: 2px 6px; border-radius: 4px;
  font-size: 11px; color: var(--accent-bright);
}

/* Quick Play Buttons */
.quick-play-buttons {
  display: flex; gap: 8px; padding: 12px 20px;
  background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.quick-play-btn {
  padding: 8px 14px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 12px; cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; gap: 6px;
  font-family: var(--font-sans);
}
.quick-play-btn:hover { background: var(--accent); border-color: var(--accent); color: white; }
.quick-play-btn.vocals { border-color: var(--accent-dim); }
.quick-play-btn.instr { border-color: rgba(34, 197, 94, 0.3); }
.quick-play-btn.upload { border-color: rgba(59, 130, 246, 0.3); }

/* Panel Tabs */
.panel-tabs {
  display: flex; gap: 4px; padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
}
.panel-tab {
  padding: 10px 16px; background: none; border: none;
  border-bottom: 2px solid transparent; color: var(--text-muted);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.panel-tab:hover { color: var(--text-secondary); }
.panel-tab.active { color: var(--accent-bright); border-bottom-color: var(--accent); }

.tab-actions { margin-left: auto; display: flex; gap: 8px; }
.tab-actions .filter-btn,
.tab-actions .copy-btn,
.tab-actions .stems-btn {
  padding: 4px 8px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 11px; cursor: pointer;
  transition: all 0.15s; font-family: var(--font-sans);
  display: flex; align-items: center; gap: 4px;
}
.tab-actions .filter-btn.active {
  background: var(--accent-dim); color: var(--accent-bright); border-color: var(--accent);
}
.tab-actions .filter-btn:hover,
.tab-actions .copy-btn:hover,
.tab-actions .stems-btn:hover {
  background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent);
}

.panel-tab-content { padding: 16px 24px; }

/* Panel Sections */
.panel-section { padding: 12px 20px; border-top: 1px solid var(--border); }
.panel-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 0; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.cycle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}

.cycle-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--accent);
}

.section-link {
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  color: var(--accent);
  opacity: 0.6;
  transition: opacity 0.15s;
  cursor: pointer;
}

.section-link:hover { opacity: 1; }

/* Lyrics */
.panel-lyrics {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  white-space: pre-wrap; max-height: 300px; overflow-y: auto;
  padding: 12px; background: var(--bg-elevated); border-radius: var(--radius-md);
}
.panel-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 4px 10px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary);
}
.tag-empty { color: var(--text-muted); font-style: italic; border-style: dashed; }

/* Lineage */
.lineage-controls {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 12px; padding: 8px;
  background: var(--bg-elevated); border-radius: var(--radius-sm);
}
.lineage-controls button {
  padding: 4px 8px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 11px; cursor: pointer;
  font-family: var(--font-sans);
}
.lineage-controls button.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-bright); }
.lineage-controls button:hover { border-color: var(--accent); }

/* Stems */
.stems-count { font-size: 12px; color: var(--text-muted); }
.stems-list { display: flex; flex-direction: column; gap: 4px; }
.stem-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--bg-elevated); border-radius: var(--radius-sm); font-size: 12px;
}
.stem-type { font-weight: 500; color: var(--text-primary); flex: 1; }
.stem-duration { color: var(--text-muted); }
.stem-play {
  width: 28px; height: 28px; background: var(--bg-active); border: none;
  border-radius: 50%; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-primary); transition: all 0.15s;
}
.stem-play:hover { background: var(--accent); }

/* ============================================
   Version List (1:1 extension port)
   ============================================ */

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

.version-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px;
  background: var(--bg-elevated); border-radius: var(--radius-md);
  cursor: pointer; transition: all 0.15s;
}
.version-item:hover { background: var(--bg-active); }
.version-item.playing { border: 1px solid var(--accent); background: var(--accent-dim); }

/* Origin row borders */
.version-item.origin-upload { border-left: 2px solid #a78bfa; }
.version-item.origin-fresh { border-left: 2px solid #ffd700; }
.version-item.origin-from-upload { border-left: 2px solid #c4b5fd; }
.version-item.origin-derived { border-left: 2px solid #93c5fd; }
.version-item.origin-incomplete { border-left: 2px solid #f97316; }

/* Version action buttons */
.version-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  align-self: center;
}
.version-action-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-decoration: none;
  transition: all 0.15s;
}
.version-action-btn:hover { background: var(--bg-base); color: var(--text-primary); }
.version-action-btn svg { width: 14px; height: 14px; }

/* Definitive version highlight */
.version-item.is-definitive {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.1), transparent);
  border-left: 3px solid #fbbf24;
}

.version-thumb {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0;
}
.version-thumb img { width: 100%; height: 100%; object-fit: cover; }
.version-thumb-placeholder {
  width: 100%; height: 100%; background: var(--bg-base);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}

.version-info { flex: 1; min-width: 0; }
.version-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-meta {
  display: flex; gap: 8px; font-size: 11px; color: var(--text-muted);
  flex-wrap: wrap; align-items: center; margin-top: 2px;
}
.version-liked { color: var(--liked); }
.version-disliked { color: #6b7280; }
.play-count { color: var(--text-muted); }
.version-date { color: var(--text-muted); }

/* Version Tags Row */
.version-tags { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.version-tag { padding: 1px 6px; border-radius: 3px; font-size: 10px; background: var(--bg-base); color: var(--text-secondary); }
.version-vocal-tag.vocals { color: var(--accent-bright); }
.version-vocal-tag.instrumental { color: #22c55e; }
.version-vocal-tag.unknown { color: var(--text-muted); }

/* Origin Tags */
.origin-tag { padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 500; }
.origin-tag.origin-upload { background: rgba(124, 92, 255, 0.15); color: #a78bfa; }
.origin-tag.origin-fresh { background: rgba(255, 215, 0, 0.15); color: #ffd700; }
.origin-tag.origin-from-upload { background: rgba(124, 92, 255, 0.1); color: #c4b5fd; }
.origin-tag.origin-derived { background: rgba(100, 149, 237, 0.15); color: #93c5fd; }
.origin-tag.origin-incomplete { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.origin-tag.origin-released { background: rgba(92, 255, 124, 0.15); color: #86efac; }

/* Definitive Badge */
.definitive-badge { font-size: 12px; margin-left: 6px; vertical-align: middle; }
.definitive-badge.vocals { color: var(--accent-bright); }
.definitive-badge.instr { color: #22c55e; }

/* Custom Tags */
.custom-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.custom-tag { padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 500; }
.custom-tag.private { background: var(--bg-base); color: var(--text-secondary); border: 1px solid var(--border); }
.custom-tag.public { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }

/* Custom Notes */
.custom-notes { margin-top: 6px; }
.custom-note {
  padding: 6px 8px; border-radius: var(--radius-sm);
  font-size: 11px; line-height: 1.4; margin-bottom: 4px;
}
.custom-note.private { background: var(--bg-base); color: var(--text-secondary); }
.custom-note.public { background: var(--accent-dim); color: var(--text-secondary); }
.custom-note-label { font-weight: 600; font-size: 10px; margin-right: 4px; }

/* DNA Strand Headers */
.dna-strand-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: var(--radius-sm);
  margin: 8px 0 4px 0; font-size: 12px;
}
.dna-strand-header:first-child { margin-top: 0; }
.dna-strand-icon { font-size: 14px; }
.dna-strand-label { font-weight: 600; color: var(--accent-bright); }
.dna-strand-count { color: var(--text-muted); font-size: 11px; }
.dna-strand-root { margin-left: auto; color: var(--text-muted); font-size: 10px; opacity: 0.8; }

/* ============================================
   Now Playing Bar (1:1 extension port)
   ============================================ */

.now-playing-bar {
  position: fixed; bottom: 0; left: var(--sidebar-width); right: 0;
  background: var(--bg-surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; z-index: 200; height: 56px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  transition: right 0.3s;
}

.version-panel.open ~ .now-playing-bar,
.library-layout.panel-open .now-playing-bar {
  right: var(--panel-width);
}

.np-left {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex-shrink: 1;
}
.np-right {
  display: flex; align-items: center; gap: 8px;
  flex: 1; justify-content: flex-end; min-width: 0;
}

.np-cover {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--bg-elevated); flex-shrink: 0;
}
.np-info { min-width: 0; max-width: 200px; }
.np-title {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.np-tags { display: flex; gap: 4px; margin-top: 1px; }
.np-tag {
  font-size: 9px; padding: 1px 5px;
  background: var(--bg-elevated); border-radius: 3px; color: var(--text-muted);
}
.np-tag.liked { color: #ef4444; }
.np-tag.definitive { color: #fbbf24; background: rgba(251, 191, 36, 0.15); }
.np-tag.vocal { color: var(--accent-bright); }
.np-tag.instr { color: #22c55e; }
.np-tag.upload { color: #3b82f6; }

.np-controls { display: flex; align-items: center; gap: 2px; }

.np-progress-wrap {
  flex: 1; max-width: 280px; min-width: 80px;
  height: 4px; background: var(--bg-elevated);
  border-radius: 2px; cursor: pointer; position: relative;
}

.np-progress {
  height: 100%; background: var(--accent);
  border-radius: 2px; width: 0%; transition: width 0.1s;
}

.np-time {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono); min-width: 36px; text-align: right;
}

.np-actions { display: flex; align-items: center; gap: 2px; }

.np-btn {
  width: 28px; height: 28px; border: none;
  background: transparent; border-radius: 50%;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.15s; color: var(--text-secondary); padding: 0;
}
.np-btn svg { flex-shrink: 0; }
.np-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.np-btn.np-prev, .np-btn.np-next { width: 26px; height: 26px; }
.np-btn.np-play { width: 34px; height: 34px; background: var(--accent); color: white; border-radius: 50%; }
.np-btn.np-play:hover { background: var(--accent-bright); }
.np-btn.np-shuffle { background: transparent; }
.np-btn.np-shuffle.active { color: var(--accent-bright); background: var(--accent-dim); }
.np-btn.np-open { border-radius: var(--radius-sm); }
.np-btn.np-menu { background: transparent; }

/* Player body padding — only library song grid needs bottom space for the fixed now-playing bar
   (the bar is hidden on non-library pages; the FAB doesn't need spacing) */
.has-player .song-container { padding-bottom: calc(var(--np-height) + env(safe-area-inset-bottom, 0px) + 16px); }

/* ============================================
   Insights Page (1:1 extension port)
   ============================================ */

.insights-layout { display: flex; height: 100%; position: relative; }

.insights-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px; gap: 16px; color: var(--text-muted); font-size: 14px;
}
.insights-loading .spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--bg-elevated); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* Insights nav toggle button */
.insights-nav-toggle {
  position: absolute; top: 12px; left: 12px; z-index: 110;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-size: 18px; width: 36px; height: 36px;
  cursor: pointer; display: none; /* shown via JS or media query */
  align-items: center; justify-content: center;
  transition: all 0.15s;
}
.insights-nav-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* When nav is collapsed */
.insights-layout.nav-collapsed .section-nav {
  transform: translateX(-100%);
  position: absolute; z-index: 100; height: 100%;
  box-shadow: none;
}
.insights-layout.nav-collapsed .insights-nav-toggle { display: flex; }
.insights-layout.nav-collapsed .insights-main { margin-left: 0; }

/* When nav is expanded over content (collapsed mode but open) */
.insights-layout.nav-collapsed .section-nav.open {
  transform: translateX(0);
  box-shadow: var(--shadow-lg);
}

.section-nav {
  width: 200px; background: var(--bg-surface);
  border-right: 1px solid var(--border); padding: 20px 12px;
  flex-shrink: 0; overflow-y: auto;
  transition: transform 0.25s ease;
}
.nav-header {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 12px;
  padding-left: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-collapse-btn {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; padding: 2px 6px;
  border-radius: var(--radius-sm); transition: all 0.15s;
}
.nav-collapse-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13px;
  text-decoration: none; transition: all 0.15s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--accent-dim); color: var(--accent-bright); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.insights-main {
  flex: 1; padding: 24px; overflow-y: auto; overflow-x: hidden;
  min-width: 0; max-width: 100%;
}

.insights-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 32px;
}
.insight-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 16px; text-align: center;
}
.insight-card .insight-value { font-size: 24px; font-weight: 700; color: var(--accent-bright); font-family: var(--font-mono); }
.insight-card .insight-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 6px; }

.insight-section { margin-bottom: 32px; overflow-x: hidden; max-width: 100%; }
.insights-main section { overflow-x: hidden; max-width: 100%; }
.insight-section h3 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 16px; }

.insight-bars { display: flex; flex-direction: column; gap: 8px; }
.insight-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; background: var(--bg-surface);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
}
.bar-label { font-size: 13px; color: var(--text-secondary); min-width: 60px; flex-shrink: 0; }
.bar-track { flex: 1; height: 6px; background: var(--bg-base); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; min-width: 4px; }
.bar-value { font-size: 13px; font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); min-width: 40px; text-align: right; }

/* Achievements */
.achievements-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.achievement-badge {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); transition: border-color 0.15s;
}
.achievement-badge:hover { border-color: var(--accent); }
.achievement-badge.tier-bronze { border-color: #cd7f32; }
.achievement-badge.tier-silver { border-color: #c0c0c0; }
.achievement-badge.tier-gold { border-color: #ffd700; }
.achievement-icon { font-size: 20px; flex-shrink: 0; }
.achievement-text { display: flex; flex-direction: column; }
.achievement-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.achievement-desc { font-size: 11px; color: var(--text-muted); }

/* Top List */
.top-songs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.top-list { display: flex; flex-direction: column; gap: 6px; }
.top-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; background: var(--bg-surface);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  transition: border-color 0.15s; cursor: pointer;
}
.top-item:hover { border-color: var(--accent); }
.top-rank { font-size: 14px; font-weight: 700; color: var(--accent-bright); font-family: var(--font-mono); min-width: 24px; text-align: center; }
.top-thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg-active); flex-shrink: 0; }
.top-info { flex: 1; min-width: 0; }
.top-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================
   Genre Explorer
   ============================================ */

.tag-search-container {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.tag-search-input {
  flex: 1; padding: 12px 16px;
  background: var(--bg-elevated); border: 2px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-size: 14px; font-family: var(--font-sans);
  outline: none; transition: border-color 0.15s;
}
.tag-search-input:focus { border-color: var(--accent); }
.tag-search-input::placeholder { color: var(--text-muted); }
.tag-search-btn {
  padding: 12px 20px; background: var(--accent);
  border: none; border-radius: var(--radius-md);
  color: white; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.15s; white-space: nowrap;
}
.tag-search-btn:hover { background: var(--accent-bright); }

.search-tags-display { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.search-tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--accent-dim);
  border: 1px solid var(--accent); border-radius: 20px;
  color: var(--accent-bright); font-size: 13px;
}
.tag-remove-btn {
  background: none; border: none; color: var(--accent-bright);
  font-size: 16px; cursor: pointer; opacity: 0.6;
  padding: 0; margin-left: 4px; line-height: 1; transition: opacity 0.15s;
}
.tag-remove-btn:hover { opacity: 1; }
.tag-plus { color: var(--text-muted); font-size: 16px; font-weight: 500; display: flex; align-items: center; }
.btn-back { margin-left: auto; }

.genre-container { min-height: 300px; }
.genre-overview {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 20px;
}
.genre-category {
  background: var(--bg-elevated); border-radius: var(--radius-md);
  padding: 16px; border: 1px solid var(--border);
}
.genre-category-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.genre-category-icon { font-size: 18px; }
.genre-category-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.genre-category-count {
  margin-left: auto; font-size: 11px; color: var(--text-muted);
  background: var(--bg-surface); padding: 2px 8px; border-radius: 10px;
}
.genre-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.genre-tag {
  padding: 6px 12px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.genre-tag:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-bright); }
.genre-tag-count { font-size: 10px; opacity: 0.6; font-weight: 500; }
.genre-more { font-size: 11px; color: var(--text-muted); padding: 6px 8px; }

/* Genre Detail View */
.genre-detail {
  background: var(--bg-elevated); border-radius: var(--radius-md);
  border: 1px solid var(--border); padding: 20px; display: none;
}
.genre-detail-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.genre-detail-header h3 { font-size: 18px; font-weight: 600; color: var(--accent-bright); margin: 0; }
.genre-detail-count {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-surface); padding: 4px 10px; border-radius: 12px;
}
.genre-song-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 12px; max-width: 100%;
}

/* Insights Song Card (used in Genre Explorer, Top Lists) */
.insights-song-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; padding-right: 40px;
  background: var(--bg-surface); border-radius: var(--radius-sm);
  cursor: pointer; position: relative;
  min-width: 0; max-width: 100%; overflow: hidden;
}
.insights-song-card.playing { background: var(--accent-dim); outline: 1px solid var(--accent); }
.card-thumb { width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.card-info { flex: 1; min-width: 0; }
.card-title { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-tags { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.card-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--bg-elevated); color: var(--text-muted); }
.card-tag.liked { background: rgba(244, 63, 94, 0.15); color: var(--liked); padding: 2px 4px; }
.card-tag.model { background: var(--accent-dim); color: var(--accent-bright); }
.card-tag.type { padding: 2px 4px; }
.card-play {
  position: absolute; left: 10px;
  width: 32px; height: 32px;
  background: var(--accent); border: none; border-radius: 50%;
  color: white; font-size: 12px; cursor: pointer;
  opacity: 0.7; z-index: 2;
}
.insights-song-card.playing .card-play { opacity: 1; }
.card-menu {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px;
  background: var(--bg-elevated); border: none; border-radius: 4px;
  color: var(--text-secondary); font-size: 14px;
  cursor: pointer; opacity: 0.5;
}
@media (hover: hover) and (pointer: fine) {
  .insights-song-card { transition: background 0.1s; }
  .insights-song-card:hover { background: var(--bg-hover); }
  .card-play { opacity: 0; transition: opacity 0.1s; }
  .insights-song-card:hover .card-play { opacity: 1; }
  .insights-song-card:hover .card-thumb { opacity: 0.5; }
  .card-menu { opacity: 0; transition: opacity 0.1s; }
  .insights-song-card:hover .card-menu { opacity: 1; }
  .card-play:hover { background: var(--accent-bright); }
  .card-menu:hover { background: var(--accent); color: white; }
}

/* ============================================
   Creative DNA / Word Cloud
   ============================================ */

.word-cloud-container {
  background: var(--bg-base); border-radius: var(--radius-md);
  padding: 24px; border: 1px solid var(--border);
  min-height: 200px;
}
.word-cloud {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px 12px; padding: 16px 0;
}
.word-cloud-word {
  cursor: pointer; transition: all 0.15s;
  font-weight: 500; padding: 2px 4px;
  border-radius: var(--radius-sm); background: transparent;
  border: none; color: var(--text-secondary);
}
.word-cloud-word:hover { color: var(--accent-bright); background: var(--accent-dim); }
.word-cloud-word.size-1 { font-size: 12px; opacity: 0.5; }
.word-cloud-word.size-2 { font-size: 15px; opacity: 0.65; }
.word-cloud-word.size-3 { font-size: 19px; opacity: 0.8; color: var(--text-primary); }
.word-cloud-word.size-4 { font-size: 24px; opacity: 0.9; color: var(--accent); }
.word-cloud-word.size-5 { font-size: 30px; opacity: 1; color: var(--accent-bright); font-weight: 700; }
.word-cloud-tabs, .dna-view-tabs {
  display: flex; gap: 4px; margin-bottom: 12px;
}
.word-cloud-tabs button, .dna-view-tabs button {
  padding: 6px 14px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 12px;
  cursor: pointer; transition: all 0.15s;
}
.word-cloud-tabs button:hover, .dna-view-tabs button:hover { border-color: var(--accent); color: var(--accent); }
.word-cloud-tabs button.active, .dna-view-tabs button.active {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent-bright);
}
.dna-controls {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 12px;
}
.dna-controls label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; }

/* Tag Cloud */
.tag-cloud {
  padding: 16px; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); line-height: 2; text-align: center;
}
.cloud-tag {
  display: inline-block; padding: 2px 8px; margin: 2px;
  color: var(--accent-bright); cursor: default; transition: opacity 0.15s;
}
.cloud-tag:hover { opacity: 1 !important; }

/* Fun Facts */
.fun-facts { display: flex; flex-direction: column; gap: 8px; }
.fun-fact {
  padding: 12px 16px; background: var(--bg-surface);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
}
.empty-message { font-size: 13px; color: var(--text-muted); padding: 16px 0; }

/* ============================================
   Data Management Page
   ============================================ */

/* Subscription Banner & Pricing Cards */
.upgrade-banner {
  margin-bottom: 24px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: var(--radius-lg);
}

.upgrade-header {
  text-align: center;
  margin-bottom: 20px;
}

.upgrade-header h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.upgrade-header p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pricing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.pricing-card {
  position: relative;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: border-color 0.15s;
}

.pricing-card:hover {
  border-color: rgba(168, 85, 247, 0.4);
}

.pricing-card-featured {
  border-color: rgba(168, 85, 247, 0.5);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(139, 92, 246, 0.03));
}

.pricing-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  padding: 2px 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-plan {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-price {
  margin-bottom: 16px;
}

.pricing-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.pricing-interval {
  font-size: 13px;
  color: var(--text-muted);
}

.pricing-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  text-align: left;
}

.pricing-perks li {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
  padding-left: 18px;
  position: relative;
}

.pricing-perks li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent-bright);
  font-weight: 700;
}

.pricing-card .btn-accent {
  width: 100%;
}

.btn-accent {
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-accent:hover {
  background: #9333ea;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.4);
}

.btn-accent:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.upgrade-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

.subscription-badge {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 8px;
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-bright);
  font-size: 11px;
  font-weight: 600;
  border-radius: 99px;
  vertical-align: middle;
}

@media (max-width: 480px) {
  .pricing-cards { grid-template-columns: 1fr; }
  .upgrade-banner { padding: 16px; }
  .pricing-card { padding: 16px; }
  .pricing-amount { font-size: 24px; }
  .sync-health-detail { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .sync-health-row { flex-direction: column; align-items: flex-start; gap: 4px; }
}

.data-container { padding: 24px; overflow-y: auto; height: 100%; max-width: 680px; margin: 0 auto; }
.data-section { margin-bottom: 32px; padding: 24px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.data-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
/* Data page sync health panel */
.sync-health { padding: 16px; background: var(--bg-elevated); border-radius: var(--radius-md); margin-bottom: 16px; }
.sync-health-row { display: flex; align-items: center; justify-content: space-between; }
.sync-health-indicator { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.data-sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.data-sync-dot.synced { background: var(--success); }
.data-sync-dot.syncing { background: var(--accent-bright); animation: sync-pulse 1.2s ease-in-out infinite; }
.data-sync-dot.error { background: var(--danger); }
.data-sync-dot.needs-sync { background: var(--warning); }
.sync-timestamp { font-size: 11px; color: var(--text-muted); }
.sync-health-detail {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle);
}
.sync-detail-item { display: flex; flex-direction: column; gap: 2px; }
.sync-detail-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.sync-detail-value { font-size: 14px; font-weight: 600; color: var(--text-primary); font-family: var(--font-mono, monospace); }
.sync-actions { display: flex; gap: 10px; }
.sync-sign-in-actions { display: flex; gap: 10px; }
.data-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.claim-form { display: flex; gap: 10px; margin-top: 12px; }
.claim-form input { flex: 1; padding: 10px 14px; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-primary); font-family: var(--font-sans); font-size: 13px; }
.claim-form input:focus { outline: none; border-color: var(--accent); }
.storage-info p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.claimed-account { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg-elevated); border-radius: var(--radius-md); margin-bottom: 8px; }
.account-handle { font-weight: 600; color: var(--accent-bright); }
.account-meta { font-size: 12px; color: var(--text-muted); }

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border: none; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-bright); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================
   Context Menu
   ============================================ */

.context-menu {
  position: fixed; z-index: 500;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  min-width: 180px; overflow: hidden;
}
.context-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; color: var(--text-primary);
  font-size: 13px; cursor: pointer; transition: background 0.1s;
}
.context-menu-item:hover { background: var(--bg-hover); }
.context-menu-separator { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* ============================================
   Modal Overlay
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: modalFadeIn 0.15s ease;
  /* PWA safe areas — keep modals away from notch/home indicator */
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 400px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.15s ease;
}

@keyframes modalSlideIn {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal.modal-wide {
  width: 600px;
  max-width: 95vw;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

.modal-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.modal-description strong {
  color: var(--accent-bright);
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

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

.modal-input::placeholder {
  color: var(--text-muted);
}

.modal-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 8px 0 0 0;
}

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* ============================================
   Tags Modal
   ============================================ */

.tags-modal .modal { width: 550px; max-width: 95vw; }

.tags-section {
  margin-bottom: 24px;
}

.tags-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tags-section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.tags-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.tags-input:focus { outline: none; border-color: var(--accent); }
.tags-input::placeholder { color: var(--text-muted); }

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.quick-tag {
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.quick-tag:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.quick-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.tags-preview {
  min-height: 32px;
  padding: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.tags-preview:empty::after {
  content: 'No tags yet';
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ============================================
   Notes Modal
   ============================================ */

.notes-modal .modal { width: 600px; max-width: 95vw; }

.notes-section {
  margin-bottom: 24px;
}

.notes-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notes-section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.notes-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.notes-textarea:focus { outline: none; border-color: var(--accent); }
.notes-textarea::placeholder { color: var(--text-muted); }

.notes-char-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Custom notes display */
.custom-notes { margin-top: 6px; font-size: 12px; line-height: 1.5; }
.custom-note {
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--bg-surface);
  border-left: 3px solid var(--border);
  margin-bottom: 4px;
}
.custom-note.private { border-left-color: var(--text-muted); color: var(--text-secondary); }
.custom-note.public { border-left-color: var(--accent); color: var(--text-primary); }

/* Custom tag display */
.custom-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}
.custom-tag.private { background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.custom-tag.public { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }

/* ============================================
   Lineage Tree
   ============================================ */

/* Inline lineage tree (version panel) */
.lineage-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.lineage-controls button {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.lineage-controls button:hover { background: var(--bg-active); }
.lineage-controls button.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.lineage-tree-inline {
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-x: auto;
  padding: 8px;
}

.lineage-tree-inline .tree-row {
  display: flex;
  align-items: flex-start;
  margin: 2px 0;
  min-width: 0;
}

.lineage-tree-inline .tree-branch {
  flex-shrink: 0;
  color: var(--text-muted);
  white-space: pre;
  font-family: monospace;
}

.lineage-tree-inline .tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.tree-node-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
}
.tree-node-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-decoration: none;
  transition: all 0.15s;
}
.tree-node-btn:hover { background: var(--bg-base); color: var(--text-primary); }
.tree-node-btn svg { width: 12px; height: 12px; }

.lineage-tree-inline .tree-node:hover { background: var(--bg-active); }

.lineage-tree-inline .tree-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.lineage-tree-inline .tree-info {
  flex: 1;
  min-width: 0;
}

.lineage-tree-inline .node-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  font-size: 12px;
  color: var(--text-primary);
}

.lineage-tree-inline .tree-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.lineage-tree-inline .node-model {
  font-size: 10px;
  padding: 1px 4px;
  background: var(--bg-surface);
  border-radius: 3px;
  color: var(--text-muted);
}

/* Compact mode (no thumbnails) */
.lineage-tree-inline.compact .tree-thumb { display: none; }
.lineage-tree-inline.compact .tree-node { padding: 4px 8px; }

/* Collapsed unliked */
.collapsed-group {
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.collapsed-group:hover { background: var(--bg-hover); }
.collapsed-group-expand { color: var(--accent); margin-left: 8px; }

/* Definitive badges in tree */
.definitive-badge { font-size: 12px; margin-left: 6px; vertical-align: middle; }
.definitive-badge.vocals { color: var(--accent-bright, var(--accent)); }
.definitive-badge.instr { color: #22c55e; }

/* Type colors */
.node-type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.type-upload .node-type-dot { background: #ec4899; }
.type-extend .node-type-dot { background: #22c55e; }
.type-edit .node-type-dot, .type-remix .node-type-dot { background: #f59e0b; }
.type-cover .node-type-dot { background: #8b5cf6; }
.type-upsample .node-type-dot { background: #0ea5e9; }
.type-other .node-type-dot { background: #6b7280; }

/* DNA Strand headers in lineage */
.lineage-strand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin: 8px 0 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.strand-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.strand-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
}

.strand-root {
  font-size: 11px;
  color: var(--text-muted);
}

.strand-count {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 6px;
  background: var(--bg-hover);
  border-radius: 8px;
}

.strand-expand-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.strand-expand-btn:hover { background: var(--accent-dim); color: var(--accent); }

.lineage-strand-content { margin-bottom: 16px; }

/* Lineage Modal */
.lineage-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  backdrop-filter: blur(4px);
}

.lineage-modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh; max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}

.lineage-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.lineage-modal-title h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.lineage-root-name {
  font-size: 13px;
  color: var(--text-muted);
}

.lineage-modal-controls {
  display: flex;
  gap: 6px;
}

.lineage-mode-btn, .lineage-filter-btn, .lineage-thumbs-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.lineage-mode-btn:hover, .lineage-filter-btn:hover, .lineage-thumbs-btn:hover {
  background: var(--bg-active);
}

.lineage-mode-btn.active, .lineage-filter-btn.active, .lineage-thumbs-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.lineage-modal-stats {
  display: flex;
  gap: 12px;
}

.lineage-stat {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}

.lineage-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.lineage-close:hover { color: var(--text-primary); }

.lineage-tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.lineage-tree-container .tree-row {
  display: flex;
  align-items: flex-start;
  margin: 2px 0;
}

.lineage-tree-container .tree-branch {
  flex-shrink: 0;
  color: var(--text-muted);
  white-space: pre;
  font-family: monospace;
}

.lineage-tree-container .tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.lineage-tree-container .tree-node:hover { background: var(--bg-active); }

.lineage-tree-container .tree-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.lineage-tree-container .tree-info {
  flex: 1;
  min-width: 0;
}

.lineage-tree-container .node-title {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.lineage-tree-container .tree-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  align-items: center;
}

.lineage-tree-container .node-model {
  font-size: 10px;
  padding: 1px 4px;
  background: var(--bg-surface);
  border-radius: 3px;
}

.lineage-tree-container.compact .tree-thumb { display: none; }

/* Multi-root sections */
.multi-root-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.multi-root-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-primary);
}

.multi-root-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.multi-root-label {
  font-size: 14px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
}

.multi-root-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.multi-root-stats {
  font-size: 12px;
  color: var(--text-muted);
}

/* Ancestry chain (direct view + trace origin) */
.direct-ancestry { padding: 8px 0; }

.ancestry-summary {
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.ancestry-root-type {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}
.ancestry-root-type.upload { background: #ec489920; color: #ec4899; }
.ancestry-root-type.derived { background: #f59e0b20; color: #f59e0b; }
.ancestry-root-type.generated { background: #22c55e20; color: #22c55e; }
.ancestry-root-type.incomplete { background: #6b728020; color: #6b7280; }

.trace-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.trace-depth {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}

.ancestry-chain {
  display: flex;
  flex-direction: column;
}

.ancestry-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.ancestry-item:hover { background: var(--bg-hover); }
.ancestry-item.current { border-left: 3px solid var(--accent); }
.ancestry-item.root { border-left: 3px solid #5cff7c; }

.ancestry-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  flex-shrink: 0;
}

.ancestry-info { flex: 1; min-width: 0; }
.ancestry-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ancestry-meta {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  align-items: center;
}

.ancestry-tag {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg-hover);
  border-radius: 4px;
  color: var(--text-muted);
}
.ancestry-tag.upload { background: #ec489920; color: #ec4899; }

.ancestry-play {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.ancestry-play:hover { opacity: 1; }

.ancestry-connector {
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px 0;
}

/* Legend */
.lineage-legend {
  display: flex;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.upload { background: #ec4899; }
.legend-dot.extend { background: #22c55e; }
.legend-dot.edit { background: #f59e0b; }
.legend-dot.cover { background: #8b5cf6; }
.legend-dot.other { background: #6b7280; }

/* ============================================
   Toast
   ============================================ */

.toast {
  position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; z-index: 9999;
  opacity: 0; transition: all 0.3s ease; box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast-info { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary); }
.toast-success { background: var(--success-dim); border: 1px solid var(--success); color: var(--success); }
.toast-error { background: var(--danger-dim); border: 1px solid var(--danger); color: var(--danger); }
.toast-warning { background: var(--warning-dim); border: 1px solid var(--warning); color: var(--warning); }

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   Mobile Responsive
   ============================================ */

/* ============================================
   GLOBAL FLOATING PLAYER (FAB)
   ============================================ */

.global-player {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  z-index: 1000;
}

.gp-fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  border: none;
  background: var(--bg-elevated);
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  overflow: visible;
}
.gp-fab:hover { transform: scale(1.06); }

.gp-fab-art {
  width: 46px; height: 46px;
  object-fit: cover;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  background: var(--bg-elevated);
}
.gp-fab-art[src=""], .gp-fab-art:not([src]) { visibility: hidden; }

.gp-fab-ring {
  position: absolute;
  inset: 0;
  width: 56px; height: 56px;
  z-index: 2;
  pointer-events: none;
}

.gp-fab-play {
  position: absolute;
  top: 0; left: 0;
  width: 56px; height: 56px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: rgba(0,0,0,0.35);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.gp-fab:hover .gp-fab-play { opacity: 1; }
.gp-fab.playing .gp-fab-play { opacity: 0; }
.gp-fab.playing:hover .gp-fab-play { opacity: 0.85; }

/* Expanded bar */
.gp-bar {
  position: absolute;
  bottom: 0; right: 0;
  width: min(380px, calc(100vw - 48px));
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: none;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
}
.gp-bar.open { display: flex; }

.gp-bar-art {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.gp-bar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gp-bar-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gp-bar-progress {
  height: 4px;
  background: var(--bg-base);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}

.gp-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.gp-bar-time {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.gp-bar-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.gp-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.gp-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.gp-btn-play { font-size: 20px; color: var(--text-primary); }

.gp-btn-collapse {
  font-size: 18px;
  margin-left: 4px;
}


/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .version-panel { width: 340px; }
  .section-nav { width: 160px; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 260px; --header-height-base: 52px; --header-height: calc(var(--header-height-base) + env(safe-area-inset-top, 0px)); }
  /* Prevent iOS auto-zoom on focus — requires >= 16px */
  input, select, textarea { font-size: 16px !important; }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed; top: var(--header-height); left: 0; bottom: 0;
    z-index: 300; transform: translateX(-100%); transition: transform 0.3s ease; box-shadow: none;
    overflow-x: hidden; max-width: 85vw;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar .stats-links-row { flex-wrap: wrap; }
  .sidebar .stats-links-row .stats-quick-link { white-space: normal; min-width: 0; }
  .sidebar .sidebar-actions { flex-wrap: wrap; }
  .sidebar .sidebar-action-btn { min-width: 0; flex: 1 1 auto; font-size: 12px; padding: 8px 12px; }
  .sidebar .filter-chip { font-size: 11px; }
  .now-playing-bar { left: 0; }
  /* Collapse nav into dropdown on mobile */
  .nav-toggle { display: flex; }
  .header-nav {
    display: none; position: absolute; top: var(--header-height); left: 0; right: 0;
    background: var(--bg-surface); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 8px; gap: 2px; margin-left: 0;
    box-shadow: var(--shadow-lg); z-index: 250;
  }
  .header-nav.open { display: flex; }
  .nav-btn { padding: 10px 16px; font-size: 14px; text-align: left; border-radius: var(--radius-sm); }
  .song-container.view-grid .song-card { width: auto; min-height: auto; }
  .song-container.view-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px; }
  .song-container.view-grid.size-small { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .song-container.view-grid.size-small .song-cover-wrapper { height: 100px; }
  .song-container.view-grid.size-small .song-title { font-size: 11px; }
  .song-container.view-grid.size-small .song-meta { font-size: 10px; }
  .song-container.view-grid.size-small .badge { font-size: 9px; padding: 1px 3px; }
  .song-container.view-grid.size-large { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .song-container.view-grid.size-large .song-cover-wrapper { height: 140px; }
  .song-container.view-grid .song-cover-wrapper { height: 140px; }
  .song-container.view-list { padding: 12px; }
  .song-container.view-list .song-card { padding: 8px; }
  .version-panel { width: 100%; top: var(--header-height); height: calc(100vh - var(--header-height) - var(--np-height)); left: 0; }
  /* Lineage modal: tighter padding, smaller header on mobile */
  .lineage-modal { padding: 8px; }
  .lineage-modal-content { max-height: 95vh; max-height: 95dvh; }
  .lineage-modal-header { flex-wrap: wrap; gap: 8px; padding: 12px; }
  .lineage-modal-controls { gap: 4px; }
  .lineage-modal-controls button { padding: 5px 8px; font-size: 11px; }
  .lineage-modal-title h2 { font-size: 16px; }
  .now-playing-bar { left: 0; height: auto; padding: 8px 12px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); gap: 8px; flex-wrap: wrap; }

  /* Library/page header — two-row layout on mobile */
  .header {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 16px;
    gap: 8px;
  }
  .header-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-right: 0;
  }
  .header-title { font-size: 18px; }
  .header-count { font-size: 12px; }

  /* Controls become a horizontally scrollable strip */
  .header-controls,
  .header-controls.compact {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 2px; /* room for scrollbar */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  .header-controls::-webkit-scrollbar { display: none; }
  .header-controls select,
  .header-controls button,
  .header-controls .sort-select,
  .header-controls .name-mode-toggle,
  .header-controls .thumb-mode-select,
  .header-controls .thumb-size-select,
  .header-controls .view-toggle {
    flex-shrink: 0;
  }
  .header-controls select,
  .header-controls button {
    padding: 6px 10px;
    font-size: 12px;
  }
  .np-left { flex: 1 1 100%; }
  .np-right { flex: 1 1 100%; justify-content: center; }
  .np-info { max-width: none; flex: 1; }
  .np-progress-wrap { max-width: none; }
  .insights-layout { flex-direction: column; }
  .insights-nav-toggle { display: flex; top: 8px; left: 8px; }
  .section-nav {
    position: absolute; z-index: 100; height: auto; max-height: 80vh;
    width: 220px; transform: translateX(-100%);
    border-right: 1px solid var(--border); border-radius: 0 0 var(--radius-md) 0;
    box-shadow: none; flex-direction: column;
  }
  .section-nav.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .section-nav .nav-item { white-space: nowrap; }
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
  .genre-overview { grid-template-columns: 1fr; }
  .genre-song-list { grid-template-columns: 1fr; }
  .top-songs-grid { grid-template-columns: 1fr; }
  .data-container { padding: 16px; }
  .data-section { padding: 16px; }
  .sync-actions, .data-actions { flex-direction: column; }
  .claim-form { flex-direction: column; }
  .auth-container { padding: 24px; }
  .user-dropdown { width: min(220px, 90vw); }
}

@media (max-width: 480px) {
  .header-content { padding: 0 10px; gap: 8px; }
  .logo-text { font-size: 14px; }
  .header-title { font-size: 16px; }
  .header-controls select,
  .header-controls button { padding: 5px 8px; font-size: 11px; }
  .song-container.view-grid .song-card { width: auto; }
  .song-container.view-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px; padding: 12px;
  }
  .song-container.view-grid.size-small {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .song-container.view-grid.size-small .song-card { min-height: auto; }
  .song-container.view-grid.size-small .song-cover-wrapper { height: auto; aspect-ratio: 1; }
  .song-container.view-grid.size-large {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .song-container.view-grid.size-large .song-card { min-height: auto; }
  .song-container.view-grid.size-large .song-cover-wrapper { height: auto; aspect-ratio: 1; }
  .song-container.view-grid .song-cover-wrapper { height: auto; aspect-ratio: 1; }
  .song-container.view-grid .song-info { padding: 8px; }
  .song-container.view-grid .song-title { font-size: 12px; }
  .song-container.view-grid .song-meta { font-size: 10px; }
  .insights-grid { grid-template-columns: 1fr 1fr; }
  .np-controls { gap: 1px; }
  .np-btn.np-play { width: 30px; height: 30px; }
  .modal { width: 95vw; max-width: 380px; }
  .auth-container { padding: 20px; }
  .card-thumb { width: 36px; height: 36px; }
  .global-player { bottom: 16px; right: 16px; }
  .gp-fab { width: 48px; height: 48px; }
  .gp-fab-art { width: 38px; height: 38px; }
  .gp-fab-ring { width: 48px; height: 48px; }
  .gp-fab-play { width: 48px; height: 48px; }
}

@media (max-width: 380px) {
  .header-content { padding: 0 8px; gap: 6px; }
  .logo-text { font-size: 13px; }
  .header-controls.compact select { font-size: 10px; padding: 4px 5px; }
  .header-controls.compact button { font-size: 10px; padding: 4px 5px; }
  .thumb-size-select, .thumb-mode-select { display: none; }
  .song-container.view-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px; padding: 8px;
  }
  .song-container.view-grid.size-small { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .song-container.view-grid.size-large { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .song-info { padding: 6px; }
  .song-title { font-size: 11px; }
  .song-meta { font-size: 9px; }
  .badge { font-size: 8px; padding: 1px 3px; }
  .insights-grid { grid-template-columns: 1fr 1fr; }
  .insight-card .insight-value { font-size: 18px; }
  .insight-card .insight-label { font-size: 10px; }
  .np-progress-wrap { max-width: 100%; min-width: 60px; }
  .now-playing-bar { padding: 8px 12px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .modal { width: 98vw; padding: 14px; }
  .data-container { padding: 12px; }
  .data-section { padding: 12px; }
  .guide-container { padding: 16px 12px 48px; }
  .guide-features { grid-template-columns: 1fr; }
  .auth-container { padding: 16px; }
  .user-dropdown { width: min(200px, 85vw); }
  .insights-main { padding: 16px; }
  .insights-song-card { padding-right: 32px; }
  .bar-label { min-width: 50px; font-size: 12px; }
  .bar-value { min-width: 32px; font-size: 12px; }
  .word-cloud-container { padding: 12px; }
  .tag-search-input { padding: 10px 12px; }
  .tag-search-btn { padding: 10px 14px; }
}

/* ============================================
   Heatmap (calendar year with navigation)
   ============================================ */

.heatmap-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.heatmap-nav-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.heatmap-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.heatmap-year-label {
  font-size: 18px;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}

.heatmap-year-total {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
}

.heatmap-container {
  overflow-x: auto;
  padding-bottom: 8px;
}

.heatmap-months {
  display: flex;
  padding-left: 0;
  margin-bottom: 4px;
}

.heatmap-month {
  font-size: 11px;
  color: var(--text-muted);
  text-align: left;
  flex-shrink: 0;
}

.heatmap-grid {
  display: flex;
  gap: 3px;
}

.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--bg-elevated);
  transition: all 0.15s;
  cursor: pointer;
}

.heatmap-cell:hover {
  transform: scale(1.3);
  outline: 2px solid var(--accent);
}

.heatmap-cell[data-level="0"] { background: var(--bg-elevated); }
.heatmap-cell[data-level="1"] { background: rgba(168, 85, 247, 0.25); }
.heatmap-cell[data-level="2"] { background: rgba(168, 85, 247, 0.45); }
.heatmap-cell[data-level="3"] { background: rgba(168, 85, 247, 0.65); }
.heatmap-cell[data-level="4"] { background: rgba(168, 85, 247, 0.85); }
.heatmap-cell[data-level="5"] { background: var(--accent); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
}

.heatmap-legend .heatmap-cell {
  width: 12px;
  height: 12px;
  cursor: default;
}

.heatmap-legend .heatmap-cell:hover {
  transform: none;
  outline: none;
}

/* ============================================
   Guide / How to Use Page
   ============================================ */

.guide-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.guide-hero {
  text-align: center;
  margin-bottom: 48px;
}

.guide-hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.guide-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-bottom: 48px;
}

.guide-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.guide-step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-step-content h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.guide-step-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.guide-step-content a {
  color: var(--accent);
  text-decoration: underline;
}

.guide-detail {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.guide-detail-icon {
  flex-shrink: 0;
}

.guide-section {
  margin-bottom: 40px;
}

.guide-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
}

.guide-tips {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-tip {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.guide-tip strong {
  color: var(--text-primary);
}

.guide-tip-icon {
  flex-shrink: 0;
  font-size: 18px;
}

.guide-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.guide-feature {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.guide-feature-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* -- Install as App -- */
.guide-install-intro {
  font-size: 14px; color: var(--text-secondary); line-height: 1.6;
  margin-bottom: 20px;
}
.guide-platform-cards {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px;
}
.guide-platform-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; text-align: left;
}
.guide-platform-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.guide-platform-icon { font-size: 24px; }
.guide-platform-header h3 {
  font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0;
}
.guide-platform-steps {
  list-style: decimal; padding-left: 20px; margin: 0 0 12px;
  font-size: 13px; color: var(--text-secondary); line-height: 1.8;
}
.guide-platform-steps strong { color: var(--text-primary); }
.guide-key {
  display: inline-block; font-size: 14px; color: var(--text-muted);
  vertical-align: middle;
}
.guide-platform-card .guide-detail { margin-top: 8px; }

.guide-footer {
  text-align: center;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.guide-footer a {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .guide-platform-cards { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .guide-container { padding: 24px 16px 60px; }
  .guide-hero h1 { font-size: 22px; }
  .guide-features { grid-template-columns: 1fr; }
  .guide-step { gap: 14px; }
  .guide-step-number { width: 32px; height: 32px; font-size: 14px; }
}

/* ============================================
   LYRICS EXPLORER
   ============================================ */

.lyrics-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Toolbar */
.lyrics-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.lyrics-toolbar-left, .lyrics-toolbar-center, .lyrics-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lyrics-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  min-width: min(100%, 220px);
}
.lyrics-search-box svg { color: var(--text-3); flex-shrink: 0; }
.lyrics-search-box input { background: none; border: none; color: var(--text-1); font-size: 13px; width: 100%; outline: none; }
.lyrics-search-box input::placeholder { color: var(--text-3); }

.lyrics-filter-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-2);
}
.lyrics-filter-toggle:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.lyrics-filter-toggle input { display: none; }

.lyrics-sort-select {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-1);
  font-size: 12px;
  cursor: pointer;
}

.lyrics-stats-badge {
  background: var(--accent);
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* Settings Panel */
.lyrics-settings-panel {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  flex-shrink: 0;
}
.lyrics-settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.lyrics-setting-group { display: flex; flex-direction: column; gap: 4px; }
.lyrics-setting-group label { font-size: 12px; color: var(--text-2); }
.lyrics-slider {
  width: 120px; height: 4px; border-radius: 2px;
  background: var(--surface-2); outline: none; -webkit-appearance: none;
}
.lyrics-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
.lyrics-checkbox {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  cursor: pointer; color: var(--text-2);
}
.lyrics-checkbox input { accent-color: var(--accent); }
.lyrics-exclusion-textarea {
  width: 200px; padding: 6px 8px; font-size: 12px; font-family: inherit;
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-1); resize: none;
}

/* Loading / Empty */
.lyrics-loading, .lyrics-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-3);
}
.lyrics-empty h2 { font-size: 18px; margin-bottom: 8px; color: var(--text-1); }

/* Grid */
.lyrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 12px;
  padding: 16px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  max-width: 100%;
}
#pagLyrics.panel-open .lyrics-grid {
  margin-right: 440px;
}

/* Cards */
.lyrics-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0; max-width: 100%;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lyrics-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.1);
}
.lyrics-card.has-similar { border-left: 3px solid var(--accent); }

.lyrics-card-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px;
}
.lyrics-card-title {
  font-size: 13px; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lyrics-card-title.custom-name { color: var(--accent); }
.lyrics-card-badge {
  background: var(--accent); color: #fff; padding: 2px 8px;
  border-radius: 10px; font-size: 10px; font-weight: 500; white-space: nowrap;
}
.lyrics-card-preview {
  font-size: 12px; color: var(--text-3); line-height: 1.5;
  white-space: pre-wrap; max-height: 54px; overflow: hidden; margin-bottom: 8px;
}
.lyrics-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.lyrics-card-tag {
  background: var(--surface-2); color: var(--text-3);
  padding: 2px 7px; border-radius: 4px; font-size: 10px;
}
.lyrics-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.lyrics-card-meta { font-size: 11px; color: var(--text-3); }
.lyrics-card-copy-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-3);
  padding: 3px 10px; border-radius: 4px; font-size: 11px; cursor: pointer;
  transition: all 0.15s;
}
.lyrics-card-copy-btn:hover { color: var(--text-1); border-color: var(--accent); }

/* ============================================
   Lyrics Detail Panel — fixed to viewport, scrollable
   ============================================ */
.lyrics-detail-panel {
  position: fixed;
  top: var(--header-height); right: 0; bottom: 0;
  width: 440px; max-width: 100%;
  background: var(--surface-1);
  border-left: 1px solid var(--border);
  z-index: 100;
  overflow-y: auto;
  animation: lyricsSlideIn 0.2s ease-out;
}
@keyframes lyricsSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* Header — sticks to top of panel scroll */
.lyrics-detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  background: var(--surface-1);
}
.lyrics-detail-header-content { flex: 1; min-width: 0; }
.lyrics-detail-header h2 {
  font-size: 16px; font-weight: 600; word-break: break-word; margin-bottom: 4px;
}
.lyrics-detail-header .custom-name { color: var(--accent); }
.lyrics-detail-meta { font-size: 12px; color: var(--text-3); }

/* Tags — full height, no internal scroll */
.lyrics-detail-tags { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.lyrics-detail-tags h4 {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; margin-bottom: 8px;
}
.lyrics-tags-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.lyrics-tag-pill {
  background: var(--surface-2); color: var(--text-1); padding: 4px 10px;
  border-radius: 10px; font-size: 11px; cursor: pointer; border: 1px solid transparent;
  transition: all 0.15s;
}
.lyrics-tag-pill:hover { background: var(--accent); color: #fff; }
.lyrics-tag-count { color: var(--text-3); margin-left: 3px; }
.lyrics-tag-pill:hover .lyrics-tag-count { color: rgba(255,255,255,0.7); }

/* Actions */
.lyrics-detail-actions {
  display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border);
}

/* Lyrics Content — collapsible */
.lyrics-detail-content {
  padding: 16px; position: relative;
  border-bottom: 1px solid var(--border);
}
.lyrics-detail-content.collapsed {
  max-height: 300px; overflow: hidden;
}
.lyrics-detail-content.collapsed::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 60px;
  background: linear-gradient(transparent, var(--surface-1)); pointer-events: none;
}
.lyrics-detail-content pre {
  font-family: inherit; font-size: 13px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; color: var(--text-1);
  margin: 0;
}
.lyrics-expand-btn {
  display: block; width: 100%; padding: 8px 16px; background: none;
  border: none; border-bottom: 1px solid var(--border);
  color: var(--accent); cursor: pointer; font-size: 12px; text-align: center;
}
.lyrics-expand-btn:hover { background: var(--bg-hover, rgba(255,255,255,0.04)); }

/* Songs Section — flows freely */
.lyrics-detail-songs { padding: 0; }
.lyrics-songs-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
}
.lyrics-songs-header h4 { font-size: 13px; font-weight: 600; color: var(--text-1); margin: 0; }
.lyrics-songs-list { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 4px; }

/* ============================================
   Detail Panel Song Items (shared: lyrics + prompts)
   ============================================ */

/* Filter buttons — shared by both pages */
.detail-songs-filters { display: flex; gap: 4px; }
.detail-songs-filter-btn {
  padding: 3px 8px; border-radius: 10px; font-size: 11px;
  border: 1px solid var(--border); background: var(--surface-2, var(--bg-tertiary, #1f1f1f));
  color: var(--text-3, var(--text-muted)); cursor: pointer; transition: all 0.15s;
}
.detail-songs-filter-btn:hover { border-color: var(--accent); color: var(--text-1, var(--text-primary)); }
.detail-songs-filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Base song item */
.detail-song-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px;
  border-radius: 6px; transition: background 0.15s;
}
.detail-song-item:hover { background: var(--bg-hover, rgba(255,255,255,0.04)); }

.detail-song-play {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: var(--accent); color: white; cursor: pointer;
  font-size: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.detail-song-play:hover { background: var(--accent-bright, #9333ea); }

.detail-song-img {
  width: 40px; height: 40px; border-radius: 4px;
  object-fit: cover; flex-shrink: 0; background: var(--bg-elevated, var(--surface-1));
}
.detail-song-img-placeholder {
  width: 40px; height: 40px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated, var(--surface-1)); color: var(--text-3, var(--text-muted));
  font-size: 16px; flex-shrink: 0;
}

/* Heart badge — overlaid on art thumbnail */
.detail-song-art-wrap {
  position: relative; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 4px;
  background: var(--bg-elevated, var(--surface-1)); overflow: hidden;
}
.detail-song-art-wrap::after {
  content: '\266B';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-3, var(--text-muted)); opacity: 0.4;
  pointer-events: none;
}
.detail-song-art-wrap .detail-song-img { position: relative; z-index: 1; }
.detail-song-heart {
  position: absolute; bottom: -2px; right: -2px;
  font-size: 9px; line-height: 1; color: #f43f5e;
  background: var(--surface-1, #0a0a0a); border-radius: 50%;
  width: 14px; height: 14px; display: flex; align-items: center; justify-content: center;
}

.detail-song-info { flex: 1; min-width: 0; }
.detail-song-title {
  font-size: 13px; font-weight: 500; color: var(--text-1, var(--text-primary));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.detail-song-meta { font-size: 11px; color: var(--text-3, var(--text-muted)); margin-top: 1px; }

.detail-song-link {
  color: var(--text-3, var(--text-muted)); text-decoration: none; font-size: 14px;
  flex-shrink: 0; padding: 4px; opacity: 0; transition: opacity 0.15s;
}
.detail-song-item:hover .detail-song-link { opacity: 1; }
.detail-song-link:hover { color: var(--accent); }

/* Grouped songs (prompts page) */
.detail-song-group { border-radius: 6px; }
.detail-song-group.expanded { background: var(--bg-hover, rgba(255,255,255,0.03)); }
.detail-song-item.has-versions { cursor: pointer; }
.detail-song-expand {
  background: none; border: none; color: var(--text-3, var(--text-muted)); cursor: pointer;
  font-size: 14px; padding: 4px 6px; flex-shrink: 0; line-height: 1;
}
.detail-song-expand:hover { color: var(--text-1, var(--text-primary)); }
.detail-song-versions { padding-left: 20px; }
.detail-song-item.version-item { opacity: 0.85; }
.detail-song-item.version-item .detail-song-img,
.detail-song-item.version-item .detail-song-img-placeholder { width: 32px; height: 32px; }
.detail-song-item.version-item .detail-song-play { width: 24px; height: 24px; font-size: 10px; }

/* Export Modal */
.lyrics-export-modal {
  position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; z-index: 2000;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.lyrics-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.8); }
.lyrics-modal-content {
  position: relative; background: var(--surface-1); border-radius: 12px;
  width: 420px; max-width: 90vw; max-height: 90vh; overflow: hidden;
  z-index: 1;
}
.lyrics-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.lyrics-modal-header h2 { font-size: 16px; font-weight: 600; }
.lyrics-modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.lyrics-export-option {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  background: var(--surface-2); border-radius: 6px; cursor: pointer; font-size: 13px;
}
.lyrics-export-option input[type="radio"] { accent-color: var(--accent); }
.lyrics-export-preview {
  text-align: center; padding: 10px; background: var(--surface-2);
  border-radius: 6px; color: var(--text-3); font-size: 13px;
}
.lyrics-export-preview span { color: var(--accent); font-weight: 600; }
.lyrics-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border);
}

/* Lyrics Toast */
.lyrics-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--accent); color: #fff; z-index: 400;
  animation: lyricsToastIn 0.2s ease-out;
}
@keyframes lyricsToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  .lyrics-toolbar { flex-direction: column; align-items: stretch; }
  .lyrics-toolbar-left, .lyrics-toolbar-center, .lyrics-toolbar-right { justify-content: center; flex-wrap: wrap; }
  .lyrics-search-box { min-width: 100%; }
  .lyrics-grid { grid-template-columns: 1fr; padding: 12px; }
  .lyrics-detail-panel { width: 100%; left: 0; }
  #pagLyrics.panel-open .lyrics-grid { margin-right: 0; }
}

/* ============================================
   PROMPTS EXPLORER
   ============================================ */

.prompts-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* View Tabs */
.prompts-view-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.prompts-view-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.prompts-view-tab:hover { color: var(--text-primary); }
.prompts-view-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent, #7c3aed);
}

#pagPrompts.panel-open .prompts-view-tabs,
#pagPrompts.panel-open .prompts-toolbar {
  margin-right: 500px;
}

/* Toolbar */
.prompts-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.prompts-toolbar-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; flex-wrap: wrap; }
.prompts-toolbar-center { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.prompts-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.prompts-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 6px;
  padding: 6px 12px;
  flex: 1;
  min-width: 180px;
}

.prompts-search-box svg { color: var(--text-muted); flex-shrink: 0; }

.prompts-search-box input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.prompts-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.prompts-filter-toggle input { accent-color: var(--accent, #7c3aed); }

.prompts-stats-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary, #141414);
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.prompts-sort-select {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 6px;
}

.prompts-min-songs-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.prompts-min-songs-input {
  width: 48px;
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
}

/* Loading / Empty */
.prompts-loading, .prompts-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: var(--text-muted);
  text-align: center;
}

.prompts-empty h2 { color: var(--text-primary); margin-bottom: 8px; }
.prompts-hint { color: var(--text-muted); font-size: 0.85rem; }

/* Prompts Grid */
.prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

#pagPrompts.panel-open .prompts-grid,
#pagPrompts.panel-open .prompts-keywords-view,
#pagPrompts.panel-open .prompts-recommendations-view {
  margin-right: 500px;
}

/* Prompt Card */
.prompts-card {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.prompts-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent, #7c3aed);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.prompts-card.favorited {
  border-left: 3px solid #f59e0b;
}

.prompts-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.prompts-card-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prompts-card-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-tertiary, #1f1f1f);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.prompts-card-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.prompts-keyword {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-tertiary, #1f1f1f);
  padding: 2px 6px;
  border-radius: 4px;
}

.prompts-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prompts-card-stats {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.prompts-liked { color: #f43f5e; }

.prompts-card-actions {
  display: flex;
  gap: 4px;
}

.prompts-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.prompts-action-btn:hover { color: var(--text-primary); background: var(--bg-tertiary, #1f1f1f); }
.prompts-action-btn.fav-active { color: #f59e0b; }

/* Keywords View */
.prompts-keywords-view {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.prompts-keywords-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 16px 0;
  justify-content: center;
}

.prompts-keyword-bubble {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.prompts-keyword-bubble:hover { background: var(--bg-hover, #2a2a2a); border-color: var(--accent, #7c3aed); }
.prompts-keyword-bubble.size-1 { font-size: 0.7rem; opacity: 0.7; }
.prompts-keyword-bubble.size-2 { font-size: 0.8rem; }
.prompts-keyword-bubble.size-3 { font-size: 0.9rem; }
.prompts-keyword-bubble.size-4 { font-size: 1rem; font-weight: 600; }
.prompts-keyword-bubble.size-5 { font-size: 1.15rem; font-weight: 600; }

.prompts-keywords-table {
  margin-top: 16px;
}

.prompts-keyword-row {
  display: grid;
  grid-template-columns: 32px 1fr 2fr 80px 100px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.prompts-keyword-row:hover { background: var(--bg-hover, #2a2a2a); }

.prompts-kw-rank { font-size: 0.75rem; color: var(--text-muted); text-align: center; }
.prompts-kw-name { font-size: 0.85rem; color: var(--text-primary); }

.prompts-kw-bar-container {
  height: 6px;
  background: var(--bg-tertiary, #1f1f1f);
  border-radius: 3px;
  overflow: hidden;
}

.prompts-kw-bar {
  height: 100%;
  background: var(--accent, #7c3aed);
  border-radius: 3px;
  transition: width 0.3s;
}

.prompts-kw-count { font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.prompts-kw-ratio { font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.prompts-kw-ratio .high { color: #22c55e; }
.prompts-kw-ratio .medium { color: #f59e0b; }
.prompts-kw-ratio .low { color: #ef4444; }

/* Recommendations View */
.prompts-recommendations-view {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.prompts-collapsible-section { margin-bottom: 16px; }

.prompts-collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}

.prompts-collapsible-header h3, .prompts-collapsible-header h4 {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin: 0;
}

.prompts-collapse-icon { transition: transform 0.2s; color: var(--text-muted); flex-shrink: 0; }
.prompts-collapsible-section.collapsed .prompts-collapse-icon { transform: rotate(-90deg); }
.prompts-collapsible-section.collapsed .prompts-collapsible-content { display: none; }

.prompts-top-performing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 12px;
  padding: 8px 0;
}

.prompts-reco-card {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.prompts-reco-card:hover { border-color: var(--accent, #7c3aed); }
.prompts-reco-prompt { font-size: 0.85rem; color: var(--text-primary); margin-bottom: 8px; line-height: 1.4; }

.prompts-reco-stats {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.prompts-highlight { color: #22c55e; font-weight: 600; }

.prompts-suggestion-card {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.prompts-suggestion-prompt {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.prompts-suggestion-reason {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.prompts-suggestion-actions {
  display: flex;
  gap: 8px;
}

/* Genre Bars */
.prompts-genre-row {
  display: grid;
  grid-template-columns: 100px 1fr 60px;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
}

.prompts-genre-row:hover .prompts-genre-label { color: var(--text-primary); }

.prompts-genre-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompts-genre-bar-container {
  height: 20px;
  background: var(--bg-tertiary, #1f1f1f);
  border-radius: 4px;
  overflow: hidden;
}

.prompts-genre-bar {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 0.7rem;
  color: #fff;
  font-weight: 600;
  transition: width 0.3s;
}

.prompts-genre-bar.color-0 { background: #7c3aed; }
.prompts-genre-bar.color-1 { background: #3b82f6; }
.prompts-genre-bar.color-2 { background: #06b6d4; }
.prompts-genre-bar.color-3 { background: #22c55e; }
.prompts-genre-bar.color-4 { background: #f59e0b; }
.prompts-genre-bar.color-5 { background: #ef4444; }
.prompts-genre-bar.color-6 { background: #ec4899; }
.prompts-genre-bar.color-7 { background: #8b5cf6; }
.prompts-genre-bar.color-8 { background: #14b8a6; }
.prompts-genre-bar.color-9 { background: #f97316; }

.prompts-genre-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

/* Detail Panel */
.prompts-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 500px; max-width: 100vw;
  background: var(--bg-primary, #0a0a0a);
  border-left: 1px solid var(--border-color, #2a2a2a);
  z-index: 200;
  overflow-y: auto;
  animation: promptsSlideIn 0.2s ease-out;
}

@keyframes promptsSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.prompts-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color, #2a2a2a);
  position: sticky; top: 0; z-index: 10;
  background: var(--bg-primary, #0a0a0a);
}

.prompts-detail-header-content { flex: 1; min-width: 0; }
.prompts-detail-header-content h2 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin: 0 0 4px;
  line-height: 1.4;
  word-break: break-word;
}

.prompts-detail-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.prompts-detail-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.prompts-detail-fav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.prompts-detail-fav-btn:hover { color: #f59e0b; }
.prompts-detail-fav-btn.active { color: #f59e0b; }

.prompts-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.prompts-detail-stat {
  text-align: center;
}

.prompts-detail-stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.prompts-detail-stat-value.positive { color: #22c55e; }

.prompts-detail-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prompts-detail-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.prompts-detail-kw-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}

.prompts-detail-kw-pill {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.prompts-detail-kw-pill:hover { background: var(--bg-hover, #2a2a2a); }

.prompts-detail-keywords, .prompts-detail-songs {
  padding: 0 16px;
}

/* Song filters + items use shared .detail-songs-* and .detail-song-* (see lyrics section) */
.prompts-songs-list { padding: 8px 0; display: flex; flex-direction: column; gap: 4px; }

/* Prompts Toast */
.prompts-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary, #141414);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color, #2a2a2a);
  z-index: 10000;
  animation: promptsToastIn 0.3s ease-out;
}

@keyframes promptsToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 768px) {
  .prompts-toolbar { flex-direction: column; align-items: stretch; }
  .prompts-toolbar-left, .prompts-toolbar-center, .prompts-toolbar-right { justify-content: center; }
  .prompts-search-box { min-width: 100%; }
  .prompts-grid { grid-template-columns: 1fr; }
  .prompts-keyword-row { grid-template-columns: 28px 1fr 1fr 60px; }
  .prompts-keyword-row .prompts-kw-ratio { display: none; }
  .prompts-detail-panel { width: 100%; left: 0; }
  #pagPrompts.panel-open .prompts-grid,
  #pagPrompts.panel-open .prompts-keywords-view,
  #pagPrompts.panel-open .prompts-recommendations-view,
  #pagPrompts.panel-open .prompts-view-tabs,
  #pagPrompts.panel-open .prompts-toolbar { margin-right: 0; }
  .prompts-genre-row { grid-template-columns: 80px 1fr 50px; }
}

/* ============================================
   PLAYLISTS
   ============================================ */

.pl-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.pl-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Browse Header */
.pl-browse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.pl-browse-header h2 { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }

.pl-browse-list {
  padding: 12px;
  flex: 1;
}

/* Playlist Card */
.pl-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 6px;
}

.pl-card:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.pl-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-dim), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(168, 85, 247, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--accent);
  flex-shrink: 0;
}

.pl-card-info { flex: 1; min-width: 0; }
.pl-card-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pl-card-tags {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.pl-card-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-tertiary, #1f1f1f);
  padding: 1px 6px;
  border-radius: 4px;
}

.pl-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.pl-card-play, .pl-card-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: color 0.15s, background 0.15s;
}

.pl-card-play:hover { color: var(--text-primary); background: var(--bg-tertiary, #1f1f1f); }
.pl-card-delete:hover { color: #ef4444; background: var(--bg-tertiary, #1f1f1f); }

/* Section headers (My Playlists / From Suno) */
.pl-section-header {
  padding: 16px 16px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pl-section-badge {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

/* Suno playlist card */
.pl-card-suno { border-left: 2px solid rgba(99, 102, 241, 0.4); }
.pl-card-suno-img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.pl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: 16px;
}

.pl-empty h3 { color: var(--text-primary); margin-bottom: 8px; font-size: 1.1rem; }

/* Generate View */
.pl-gen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.pl-gen-header h2 { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }

.pl-gen-input-row {
  display: flex;
  gap: 8px;
  padding: 16px;
}

.pl-gen-input {
  flex: 1;
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 6px;
  outline: none;
}

.pl-gen-input:focus { border-color: var(--accent, #7c3aed); }

/* Collapsible section headers */
.pl-section-collapsible {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.pl-section-collapsible:hover { color: var(--text-primary); }
.pl-section-chevron {
  font-size: 10px;
  color: var(--text-muted);
  width: 12px;
}
.pl-variant-badge {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--bg-secondary, #141414);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}
.pl-card-all { opacity: 0.7; }
.pl-card-all:hover { opacity: 1; }

/* Grouped clip display */
.pl-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
  font-size: 0.75rem;
  border-top: 1px solid var(--border-color, #2a2a2a);
}
.pl-group-header:first-child { border-top: none; }
.pl-group-name { font-weight: 600; color: var(--text-primary); }
.pl-group-count { font-size: 0.65rem; color: var(--text-muted); }
.pl-clip-indented { padding-left: 20px !important; }

.pl-clip-play-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary, #141414);
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.pl-clip-play-btn:hover { background: var(--accent); color: white; }

.pl-clip-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  align-self: center;
}
.pl-clip-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-decoration: none;
  transition: all 0.15s;
}
.pl-clip-action-btn:hover { background: var(--bg-secondary, #141414); color: var(--text-primary); }
.pl-clip-action-btn svg { width: 13px; height: 13px; }

/* Smart playlist cards */
.pl-card-smart .pl-smart-icon {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.15)) !important;
  border-color: rgba(168, 85, 247, 0.3) !important;
  color: var(--accent, #a855f7);
}
.pl-card-smart:hover {
  border-color: rgba(168, 85, 247, 0.5);
}

/* Duplicate playlist prompt */
.pl-duplicate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.pl-duplicate-modal {
  width: 420px;
  max-width: 90vw;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.pl-duplicate-header {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.pl-duplicate-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}
.pl-duplicate-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pl-duplicate-rename-row {
  display: flex;
  gap: 8px;
}
.pl-dup-input {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.pl-dup-input:focus { border-color: var(--accent); }

.pl-input-wrapper {
  flex: 1;
  position: relative;
}
.pl-input-wrapper .pl-gen-input {
  width: 100%;
  padding-right: 32px;
}
.pl-search-help-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
}
.pl-search-help-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.pl-search-help-popover {
  display: none;
  margin: 0 16px 12px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.pl-search-help-popover.visible { display: block; }
.pl-help-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pl-help-title { font-weight: 600; color: var(--text-primary); font-size: 13px; }
.pl-help-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 0 2px; }
.pl-help-close:hover { color: var(--text-primary); }
.pl-help-section { margin-bottom: 8px; }
.pl-help-section:last-child { margin-bottom: 0; }
.pl-help-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 2px; }
.pl-search-help-popover code {
  background: var(--bg-base);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-bright);
}

.pl-date-input {
  width: 120px;
  padding: 4px 6px;
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  border-radius: 4px;
  outline: none;
  color-scheme: dark;
}
.pl-date-input:focus { border-color: var(--accent); }

.pl-custom-input {
  width: 52px;
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 3px 6px;
  border-radius: 4px;
  outline: none;
  -moz-appearance: textfield;
}
.pl-custom-input::-webkit-outer-spin-button,
.pl-custom-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pl-custom-input:focus { border-color: var(--accent); }

.pl-gen-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 16px 12px;
}

.pl-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pl-filter-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 2px;
}

.pl-filter-btn {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.pl-filter-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.pl-filter-btn.active {
  background: var(--accent, #7c3aed);
  border-color: var(--accent, #7c3aed);
  color: #fff;
}

.pl-select {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 3px 6px;
  border-radius: 4px;
}

.pl-gen-stats {
  padding: 0 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 20px;
}

.pl-gen-actions {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
}

/* Clip List (shared between generate + detail) */
.pl-clip-list {
  padding: 8px 12px;
  flex: 1;
}

.pl-clip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.pl-clip:hover { background: var(--bg-hover, #2a2a2a); }
.pl-clip.playing { background: var(--bg-active, rgba(124,58,237,0.15)); }

.pl-clip-index {
  width: 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pl-clip-img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.pl-clip-img-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: var(--bg-tertiary, #1f1f1f);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1rem;
  flex-shrink: 0;
}

.pl-clip-info { flex: 1; min-width: 0; }
.pl-clip-title {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-clip-meta { font-size: 0.75rem; color: var(--text-muted); }

.pl-clip-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Detail View */
.pl-detail-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.pl-detail-title-row { margin: 8px 0; }
.pl-detail-title-row h2 { margin: 0; font-size: 1.1rem; color: var(--text-primary); }
.pl-detail-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.pl-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pl-delete-btn:hover { color: #ef4444 !important; }

/* Mini Player */
.pl-mini-player {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary, #141414);
  border-top: 1px solid var(--border-color, #2a2a2a);
  z-index: 100;
}

.pl-player-cover {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.pl-player-info { flex: 1; min-width: 0; }
.pl-player-title {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.pl-player-progress {
  height: 4px;
  background: var(--bg-tertiary, #1f1f1f);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}

.pl-player-progress-fill {
  height: 100%;
  background: var(--accent, #7c3aed);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.pl-player-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.pl-player-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pl-player-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.pl-player-btn:hover { color: var(--text-primary); }

.pl-player-play {
  font-size: 1.2rem;
  padding: 4px 8px;
}

/* Playlists Toast */
.pl-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary, #141414);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color, #2a2a2a);
  z-index: 10000;
  animation: plToastIn 0.3s ease-out;
}

@keyframes plToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 768px) {
  .pl-gen-input-row { flex-direction: column; }
  .pl-gen-filters { flex-direction: column; }
  .pl-mini-player { padding: 8px 12px; }
}

/* ============================================
   Samples Manager
   ============================================ */

.samples-page {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  overflow-y: auto;
}

/* -- View Tabs -- */
.samples-view-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.samples-tab {
  background: none;
  border: none;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.samples-tab:hover { color: var(--text-secondary); }
.samples-tab.active {
  color: var(--accent-bright);
  border-bottom-color: var(--accent);
}
.samples-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent-bright);
  border-radius: 9px;
}

/* -- Toolbar -- */
.samples-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-xs {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-xs:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}
.select-sm {
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: auto;
}
.select-sm:hover { border-color: var(--text-muted); }

/* -- Sample Row -- */
.sample-row-web {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.1s, opacity 0.25s cubic-bezier(0.25, 1, 0.5, 1),
              max-height 0.25s cubic-bezier(0.25, 1, 0.5, 1),
              margin 0.25s cubic-bezier(0.25, 1, 0.5, 1),
              padding 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  max-height: 120px;
  overflow: hidden;
}
.sample-row-web:hover { background: var(--bg-hover); }
.sample-row-web + .sample-row-web { border-top: 1px solid var(--border-subtle); }
.sample-row-web.exiting {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.sample-play-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.sample-play-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-bright);
}
.sample-play-btn.playing {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-bright);
}
.sample-info-web {
  flex: 1;
  min-width: 0;
}
.sample-title-web {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sample-meta-web {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* -- Triage Zone -- */
.sample-triage-web {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.rec-chips-web {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.rec-chip-web {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.12s;
}
.rec-chip-web:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-bright);
}
.rec-chip-web.primary {
  background: var(--accent-dim);
  border-color: rgba(168, 85, 247, 0.3);
  color: var(--accent-bright);
}
.rec-chip-web.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.no-recs-web {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
}
.confirmed-badge-web {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  background: var(--success-dim);
  color: var(--success);
  white-space: nowrap;
}
.btn-overflow-web {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}
.btn-overflow-web:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-trash-web {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
  opacity: 0.5;
}
.btn-trash-web:hover {
  background: var(--danger-dim);
  border-color: var(--danger);
  color: var(--danger);
  opacity: 1;
}

/* -- Browser Layout -- */
.samples-browser-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  min-height: 400px;
}
.samples-tree {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 0;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
}
.tree-grp { /* collapsed by default */ }
.tree-grp-hdr {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s;
}
.tree-grp-hdr:hover { background: var(--bg-hover); }
.tree-vars {
  display: none;
  padding-left: 12px;
}
.tree-grp.expanded .tree-vars { display: block; }
.tree-var {
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.1s, color 0.1s;
}
.tree-var:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.tree-var.active {
  background: var(--accent-dim);
  color: var(--accent-bright);
}
.samples-browser-main {
  min-height: 200px;
}

/* -- Export Panel -- */
.samples-export-panel {
  max-width: 480px;
}
.samples-export-panel h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.samples-export-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.samples-export-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.samples-export-fields input {
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.samples-export-fields input:focus {
  outline: none;
  border-color: var(--accent);
}

/* -- Empty State -- */
.empty-state-msg {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* -- Responsive -- */
@media (max-width: 900px) {
  .samples-browser-layout {
    grid-template-columns: 1fr;
  }
  .samples-tree {
    max-height: 200px;
  }
  .samples-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .select-sm { margin-left: 0; }
}
