:root {
  --bg: #0d1117;
  --card: #161b26;
  --accent: #00e6c8;
  --accent-2: #6c63ff;
  --text: #e2e8f0;
  --muted: #64748b;
  --danger: #ef4444;
  --success: #22c55e;
  --surface: #0a0e17;
  --surface-2: #1e293b;
  --border: #1e293b;
  --transition-fast: 0.15s ease;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --glow: 0 0 16px rgba(0, 230, 200, 0.25);
  --glow-accent: 0 0 12px rgba(0, 230, 200, 0.2);
  --neon-cyan: #00e6c8;
  --neon-purple: #6c63ff;
  --neon-pink: #e040fb;
  --neon-yellow: #fbbf24;
  --radius: 4px;
  --radius-lg: 6px;
}

body[data-theme="light"] {
  --bg: #f0f2f5;
  --card: #ffffff;
  --accent: #0891b2;
  --accent-2: #6c63ff;
  --text: #0f172a;
  --muted: #475569;
  --surface: #f1f5f9;
  --surface-2: #e2e8f0;
  --border: #cbd5e1;
}

body[data-theme="y2k"] {
  --bg: #fff7e6;
  --card: #fffdf7;
  --accent: #ff9f1c;
  --accent-2: #2ec4b6;
  --text: #1b1b1b;
  --muted: #6b7280;
  --surface: #fff1dc;
  --surface-2: #ffe8c7;
  --border: #f1c27d;
}

* { box-sizing: border-box; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

body {
  margin: 0;
  font-family: "Consolas", "Fira Code", "JetBrains Mono", monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 13px;
  letter-spacing: 0.3px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tooltips */
[title] {
  position: relative;
}

button[title]::before,
a[title]::before {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 100;
  pointer-events: none;
}

button[title]:hover::before,
a[title]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

/* Skeleton loading animation */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 4px;
}

/* Focus states for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection color */
::selection {
  background: rgba(29, 185, 84, 0.3);
  color: var(--text);
}

body[data-theme="light"],
body[data-theme="y2k"] {
  background: radial-gradient(circle at top, #ffffff, var(--bg) 55%);
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-direction: column;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

/* ========== TOPBAR USER ACTIONS ========== */
.topbar-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-dropdown {
  position: relative;
}

.topbar-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.topbar-icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.topbar-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger, #ef4444);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.topbar-user-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}

.topbar-username {
  font-size: 14px;
  font-weight: 500;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-arrow {
  font-size: 10px;
  color: var(--muted);
}

.topbar-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 100;
  overflow: hidden;
}

.topbar-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Notifications Menu */
.notifications-menu {
  width: 320px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}

.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.mark-all-read-btn {
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}

.mark-all-read-btn:hover {
  text-decoration: underline;
}

.notifications-list {
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.notification-item:hover {
  background: var(--surface);
}

.notification-item.unread {
  background: rgba(var(--accent-rgb, 0, 198, 255), 0.1);
}

.notification-item.unread:hover {
  background: rgba(var(--accent-rgb, 0, 198, 255), 0.15);
}

.notification-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.notification-time {
  font-size: 11px;
  color: var(--muted);
}

.notification-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.dropdown-footer-link {
  display: block;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.dropdown-footer-link:hover {
  background: var(--surface);
}

/* User Menu */
.user-menu {
  padding: 8px 0;
}

.dropdown-section {
  padding: 4px 0;
}

.dropdown-section-title {
  display: block;
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: rgba(0, 230, 200, 0.05);
  color: var(--accent);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.logout-item {
  color: var(--danger, #ef4444);
}

body[data-theme="light"] .topbar,
body[data-theme="y2k"] .topbar {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid #e2e8f0;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

.search {
  display: flex;
  gap: 6px;
  flex: 1;
  max-width: 980px;
  margin: 0 auto;
  justify-content: center;
}

.search input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 230, 200, 0.1);
}

.search input[name="q"] {
  min-width: 520px;
}

.search button, .search .ghost {
  background: rgba(0, 230, 200, 0.1);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  font-size: 12px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.search button:hover, .search .ghost:hover {
  background: rgba(0, 230, 200, 0.2);
  box-shadow: var(--glow-accent);
}

.search-btn {
  min-width: 38px;
}

.sort-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-weight: 600;
  font-family: inherit;
  font-size: 12px;
  transition: border-color var(--transition-fast);
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

.search .ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.search .ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: none;
}

.date-compact {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}

/* ── Compact homepage search bar (date pickers + sort) ── */
.search-input-wrap {
  position: relative;
  flex: 1 1 320px;
  display: flex;
  min-width: 240px;
}
.search-input-wrap > input {
  width: 100%;
  min-width: 0 !important; /* override .search input[name="q"] */
}
/* Date inputs collapsed to icon-only — the picker still opens on click. */
.date-icon-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 30px;
}
.date-icon-wrap .date-icon-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  padding: 0;
  z-index: 2;
  pointer-events: auto;
}
.date-icon-wrap .date-icon-btn:hover {
  border-color: var(--accent);
}
.date-icon-wrap.has-value .date-icon-btn {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,230,200,0.08);
}
.date-icon-wrap .date-icon-clear {
  position: absolute;
  top: -4px; right: -4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  border: none;
  cursor: pointer;
  z-index: 3;
  display: none;
}
.date-icon-wrap.has-value .date-icon-clear { display: block; }
.search .date-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;          /* click goes to the visible button */
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color-scheme: dark;
}
.search .sort-select {
  flex: 0 0 auto;
  width: 72px;
  padding: 6px 4px;
  font-size: 11px;
}
.search-kind-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  user-select: none;
  background: var(--surface);
  color: var(--text-muted, #aaa);
  transition: all .15s;
  white-space: nowrap;
}
.search-kind-toggle input { display: none; }
.search-kind-toggle:has(input:checked) {
  background: rgba(0, 230, 200, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Suggest dropdown ── */
.search-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  /* Span well past the input so long titles don't get cut off. */
  min-width: 100%;
  width: max-content;
  max-width: min(640px, 80vw);
  margin-top: 4px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  max-height: 460px;
  overflow-y: auto;
  z-index: 1000;
}
.search-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.search-suggest-item:last-child { border-bottom: none; }
.search-suggest-item:hover { background: var(--surface-2, #222); }
.search-suggest-item .ssi-cover {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.search-suggest-item .ssi-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(0,230,200,0.08);
  border-radius: 4px;
  flex-shrink: 0;
}
.search-suggest-item .ssi-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.search-suggest-item .ssi-title {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 560px;
}
.search-suggest-item .ssi-sub {
  font-size: 11px;
  color: var(--text-muted, #999);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 560px;
}
.search-suggest-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-muted, #999);
  font-size: 12px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.toolbar #themeSelect {
  margin-left: auto;
}

.artist-filters {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.artist-search-row {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.artist-search-row input {
  flex: 1;
  min-width: 280px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.artist-search-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.letter-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.letter-pill {
  text-decoration: none;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.letter-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.letter-pill.active {
  background: rgba(0, 230, 200, 0.12);
  color: var(--accent);
  border-color: var(--accent);
}

.year-filter {
  display: grid;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}

.year-range {
  display: grid;
  gap: 6px;
}

.year-range label {
  color: var(--muted);
  font-size: 12px;
}

.year-actions {
  display: flex;
  justify-content: flex-end;
}

.artist-list {
  display: grid;
  gap: 10px;
}

.artist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.artist-row:hover {
  border-color: var(--accent);
}

.artist-row .artist-count {
  color: var(--muted);
  font-size: 12px;
}

.artist-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.artist-meta {
  color: var(--muted);
  margin-bottom: 16px;
}

.pill {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill.icon-only {
  padding: 5px;
  min-width: 30px;
  text-align: center;
}

.profile-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill.active {
  background: rgba(0, 230, 200, 0.12);
  color: var(--accent);
  border-color: var(--accent);
}

.content {
  padding: 18px;
  padding-bottom: 160px;
}

.hero {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

/* Safety net: force content visible after 1.5s in case anime.js sets opacity:0 */
@keyframes forceVisible {
  to { opacity: 1 !important; }
}
.hero,
.album-card,
.sidebar-link {
  animation: forceVisible 0s 1.5s both;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(0, 230, 200, 0.06), transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 1px;
}

.hero p {
  color: var(--muted);
  margin: 0;
  font-size: 12px;
}

body[data-theme="light"] .hero,
body[data-theme="y2k"] .hero {
  background: var(--card);
  border-color: var(--border);
}

.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 10px;
}

body[data-view="compact"] .albums-grid {
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 10px;
}

body[data-view="minimal"] .albums-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

body[data-view="covers"] .albums-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

 .album-card.cover-only {
  display: none;
}

body[data-view="covers"] .album-card:not(.cover-only) {
  display: none;
}

body[data-view="covers"] .album-card.cover-only {
  display: flex;
}

body[data-view="covers"] .album-card.cover-only .album-body {
  padding-top: 6px;
}

/* ══════════════ LIST VIEW — Dense Playlist ══════════════ */

body[data-view="list"] .albums-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

body[data-view="list"] .album-card {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 5px 14px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(30, 41, 59, 0.2);
  box-shadow: none;
  min-height: 42px;
  transition: background 0.12s ease;
}

body[data-view="list"] .album-card:nth-child(even) {
  background: rgba(0, 0, 0, 0.08);
}

body[data-view="list"] .album-card:hover {
  background: rgba(0, 230, 200, 0.05) !important;
}

body[data-view="list"] .album-cover-wrap {
  width: 36px;
  min-width: 36px;
  height: 36px;
  border-radius: 4px;
  flex-shrink: 0;
}

body[data-view="list"] .album-cover-wrap::after { display: none; }

body[data-view="list"] .album-cover {
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

body[data-view="list"] .play-album { display: none; }

body[data-view="list"] .album-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

body[data-view="list"] .album-body h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
}

body[data-view="list"] .album-title {
  font-size: 12px;
  margin: 0;
  font-weight: 600;
}

body[data-view="list"] .album-title-toggle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

body[data-view="list"] .sub {
  flex-shrink: 0;
  font-size: 10px;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  opacity: 0.8;
}

body[data-view="list"] .sub span:nth-child(2n) { display: none; }

body[data-view="list"] .album-stats { display: none; }

body[data-view="list"] .album-actions,
body[data-view="list"] .progress { display: none !important; }

body[data-view="list"] .album-download-row {
  flex-shrink: 0;
}

body[data-view="list"] .album-download-row .btn {
  font-size: 10px;
  padding: 3px 8px;
}

body[data-view="list"] .track-details {
  display: none;
  background: transparent;
  border: none;
  padding: 0;
}

body[data-view="list"] .album-card.list-tracks-open .track-details {
  display: block;
  flex-basis: 100%;
}

body[data-view="list"] .track-details summary { display: none; }

body[data-view="list"] .tracklist {
  gap: 0;
  padding: 2px 0 2px 48px;
}

body[data-view="list"] .track-row {
  grid-template-columns: 22px 1fr auto;
  padding: 2px 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid rgba(30, 41, 59, 0.12);
  font-size: 11px;
}

body[data-view="list"] .track-row:nth-child(even) {
  background: rgba(0, 0, 0, 0.06);
}

body[data-view="list"] .track-row:hover {
  background: rgba(0, 230, 200, 0.04);
}

body[data-view="list"] .track-title {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-view="list"] .track-file,
body[data-view="list"] .track-count,
body[data-view="list"] .track-likes,
body[data-view="list"] .track-wave,
body[data-view="list"] .track-progress,
body[data-view="list"] .track-meta { display: none !important; }

body[data-view="list"] .track-actions {
  opacity: 0;
  transition: opacity 0.12s;
  margin: 0;
  gap: 2px;
  flex-wrap: nowrap;
}

body[data-view="list"] .track-row:hover .track-actions { opacity: 1; }

body[data-view="list"] .track-play,
body[data-view="list"] .track-like,
body[data-view="list"] .track-add,
body[data-view="list"] .track-download-btn {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  font-size: 9px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.track-info {
  cursor: pointer;
}

.track-info:hover .track-title {
  color: var(--accent);
}

body[data-view="grid"] .albums-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

body[data-view="grid"] .album-card {
  padding: 12px;
  gap: 8px;
}

body[data-view="grid"] .sub {
  display: none;
}

body[data-view="grid"] .album-actions,
body[data-view="grid"] .download-album,
body[data-view="grid"] .progress,
body[data-view="grid"] .track-details {
  display: none;
}

/* ══════════════ MADSONIC VIEW — Studio Console ══════════════ */

body[data-view="madsonic"] .albums-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

body[data-view="madsonic"] .album-card {
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-radius: 0;
  background: var(--card);
  border: none;
  border-bottom: 2px solid var(--border);
  box-shadow: none;
  overflow: hidden;
  transition: background 0.2s ease;
}

body[data-view="madsonic"] .album-card:hover {
  border-color: var(--border);
  box-shadow: inset 3px 0 0 var(--accent);
}

body[data-view="madsonic"] .album-cover-wrap {
  width: 140px;
  min-width: 140px;
  border-radius: 0;
  flex-shrink: 0;
}

body[data-view="madsonic"] .album-cover-wrap::after { display: none; }

body[data-view="madsonic"] .album-cover {
  border-radius: 0;
  box-shadow: none;
  height: 100%;
  object-fit: cover;
}

body[data-view="madsonic"] .play-album {
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  font-size: 13px;
  background: rgba(0, 230, 200, 0.9);
  box-shadow: 0 2px 10px rgba(0, 230, 200, 0.3);
}

body[data-view="madsonic"] .album-body {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body[data-view="madsonic"] .album-title {
  font-size: 14px;
  margin: 0 0 2px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  letter-spacing: 0.3px;
}

body[data-view="madsonic"] .sub {
  font-size: 10px;
  gap: 8px;
  margin: 0;
  opacity: 0.8;
}

body[data-view="madsonic"] .sub span:nth-child(2n) { opacity: 0.3; }

body[data-view="madsonic"] .album-stats { display: none; }

body[data-view="madsonic"] .album-actions {
  gap: 4px;
}

body[data-view="madsonic"] .album-actions button {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
}

body[data-view="madsonic"] .album-download-row .btn {
  font-size: 11px;
  padding: 5px 12px;
}
body[data-view="madsonic"] .progress { display: none; }

/* Track table */
body[data-view="madsonic"] .track-details {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: auto;
}

body[data-view="madsonic"] .track-details summary { display: none; }

body[data-view="madsonic"] .tracklist {
  gap: 0;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

body[data-view="madsonic"] .track-row {
  grid-template-columns: 28px 1fr auto;
  padding: 5px 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid rgba(30, 41, 59, 0.2);
  font-size: 11px;
  transition: background 0.1s;
}

body[data-view="madsonic"] .track-row:nth-child(even) {
  background: rgba(0, 0, 0, 0.12);
}

body[data-view="madsonic"] .track-row:hover {
  background: rgba(0, 230, 200, 0.06) !important;
}

body[data-view="madsonic"] .track-title {
  font-size: 12px;
}

body[data-view="madsonic"] .track-file { display: none; }
body[data-view="madsonic"] .track-wave,
body[data-view="madsonic"] .track-progress { display: none; }

body[data-view="madsonic"] .track-actions {
  opacity: 0;
  transition: opacity 0.12s;
  gap: 3px;
  flex-wrap: nowrap;
  margin: 0;
}

body[data-view="madsonic"] .track-row:hover .track-actions { opacity: 1; }

body[data-view="madsonic"] .track-play,
body[data-view="madsonic"] .track-like,
body[data-view="madsonic"] .track-add,
body[data-view="madsonic"] .track-download-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  font-size: 10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.album-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.album-card:hover {
  border-color: rgba(0, 230, 200, 0.35);
  box-shadow: var(--shadow-md), 0 0 20px rgba(0, 230, 200, 0.08);
}

/* ══════════════ MINIMAL VIEW — Elegant Catalog ══════════════ */

body[data-view="minimal"] .album-card {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(30, 41, 59, 0.2);
  background: transparent;
  box-shadow: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

body[data-view="minimal"] .album-card:nth-child(odd) {
  background: rgba(0, 0, 0, 0.04);
}

body[data-view="minimal"] .album-card:hover {
  background: rgba(0, 230, 200, 0.04) !important;
  box-shadow: inset 3px 0 0 var(--accent);
}

body[data-view="minimal"] .album-cover-wrap {
  width: 56px;
  min-width: 56px;
  height: 56px;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body[data-view="minimal"] .album-cover-wrap::after { display: none; }

body[data-view="minimal"] .album-cover {
  border-radius: 6px;
  box-shadow: none;
}

body[data-view="minimal"] .play-album { display: none; }

body[data-view="minimal"] .album-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

body[data-view="minimal"] .album-body h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
}

body[data-view="minimal"] .album-title {
  font-size: 13px;
  margin: 0;
  font-weight: 600;
}

body[data-view="minimal"] .album-title-toggle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

body[data-view="minimal"] .sub {
  flex-shrink: 0;
  font-size: 10px;
  gap: 8px;
  margin: 0;
  opacity: 0.7;
}

body[data-view="minimal"] .sub span:nth-child(2n) { display: none; }

body[data-view="minimal"] .album-stats,
body[data-view="minimal"] .album-actions,
body[data-view="minimal"] .progress { display: none !important; }

body[data-view="minimal"] .album-download-row {
  flex-shrink: 0;
}

body[data-view="minimal"] .album-download-row .btn {
  font-size: 10px;
  padding: 4px 10px;
}

body[data-view="minimal"] .track-details {
  display: none;
  background: transparent;
  border: none;
  padding: 0;
}

body[data-view="minimal"] .album-card.list-tracks-open .track-details {
  display: block;
  flex-basis: 100%;
}

body[data-view="minimal"] .track-details summary { display: none; }

body[data-view="minimal"] .tracklist {
  gap: 0;
  padding: 4px 0 0 74px;
}

body[data-view="minimal"] .track-row {
  grid-template-columns: 22px 1fr auto;
  padding: 3px 6px;
  border: none;
  border-radius: 0;
  background: transparent;
  align-items: center;
}

body[data-view="minimal"] .track-row:hover {
  background: rgba(0, 230, 200, 0.04);
}

body[data-view="minimal"] .track-play {
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  font-size: 9px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.12s;
}

body[data-view="minimal"] .track-row:hover .track-play { opacity: 1; }

body[data-view="minimal"] .track-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

body[data-view="minimal"] .track-title {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

body[data-view="minimal"] .track-file,
body[data-view="minimal"] .track-count,
body[data-view="minimal"] .track-likes,
body[data-view="minimal"] .track-wave,
body[data-view="minimal"] .track-progress,
body[data-view="minimal"] .track-meta { display: none !important; }

body[data-view="minimal"] .track-actions {
  opacity: 0;
  transition: opacity 0.12s;
  margin: 0;
  gap: 2px;
  flex-wrap: nowrap;
}

body[data-view="minimal"] .track-row:hover .track-actions { opacity: 1; }

body[data-view="minimal"] .track-like,
body[data-view="minimal"] .track-add,
body[data-view="minimal"] .track-download-btn {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  font-size: 9px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ══════════════ COMPACT VIEW — Clean Card Style ══════════════ */

body[data-view="compact"] .album-card {
  padding: 10px;
  gap: 8px;
  border-radius: var(--radius-lg);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

body[data-view="compact"] .album-card:hover {
  border-color: rgba(0, 230, 200, 0.35);
  box-shadow: 0 4px 20px rgba(0, 230, 200, 0.08);
  transform: translateY(-1px);
}

body[data-view="compact"] .album-body {
  gap: 6px;
}

body[data-view="compact"] .album-title {
  font-size: 13px;
  margin: 0 0 1px;
  font-weight: 700;
}

body[data-view="compact"] .sub {
  font-size: 10px;
  gap: 6px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

body[data-view="compact"] .sub span:nth-child(2n) { opacity: 0.3; font-size: 6px; }

body[data-view="compact"] .album-stats { display: none; }

body[data-view="compact"] .album-actions {
  gap: 4px;
  margin-top: 2px;
}

body[data-view="compact"] .album-actions button {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}

body[data-view="compact"] .album-actions button:hover {
  border-color: var(--accent);
  background: rgba(0, 230, 200, 0.08);
}

body[data-view="compact"] .album-download-row .btn {
  font-size: 11px;
  padding: 5px 12px;
}

body[data-view="compact"] .progress { display: none; }

/* Compact tracks — disco style */
body[data-view="compact"] .track-details {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: auto;
}

body[data-view="compact"] .track-details summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  padding: 2px 0;
}

body[data-view="compact"] .track-details summary::before {
  font-size: 8px;
}

body[data-view="compact"] .tracklist {
  gap: 0;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.album-cover-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  display: block;
  text-decoration: none;
  color: inherit;
}

a.album-cover-wrap:hover {
  text-decoration: none;
}

.album-cover-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.6) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.album-cover-wrap:hover::after {
  opacity: 1;
}

.album-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), filter var(--transition);
}

.album-cover-wrap:hover .album-cover {
  transform: scale(1.02);
}

.play-album {
  position: absolute;
  bottom: 16px;
  right: 16px;
  left: auto;
  transform: translateY(10px);
  opacity: 0;
  border: none;
  background: var(--accent);
  color: #0b0f14;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(29, 185, 84, 0.4);
  transition: all var(--transition);
  z-index: 2;
}

.album-cover-wrap:hover .play-album {
  opacity: 1;
  transform: translateY(0);
}

.play-album:hover {
  transform: scale(1.1) !important;
  box-shadow: 0 12px 32px rgba(29, 185, 84, 0.5);
}

.album-body h2 {
  margin: 0 0 4px;
}

.album-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.album-title-toggle {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  transition: color var(--transition-fast);
}

.album-title-toggle:hover {
  color: var(--accent);
}

.sub {
  display: flex;
  gap: 6px;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 11px;
}

.scan-progress {
  height: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 8px;
}

.scan-progress.is-paused {
  background: #3b2f0b;
}

.scan-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #1ed760);
}

.scan-progress.is-paused .scan-progress-bar {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.scan-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn-small {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-small:hover {
  transform: scale(1.05);
}

.btn-warn {
  background: #f59e0b;
  color: #000;
}

.btn-warn:hover {
  background: #fbbf24;
}

.btn-success {
  background: #22c55e;
  color: #fff;
}

.btn-success:hover {
  background: #4ade80;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

.btn-muted {
  background: var(--surface-3);
  color: var(--muted);
}

.btn-muted:hover {
  background: var(--surface-2);
  color: var(--text);
}

.admin-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.album-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.like-album {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 11px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.like-album:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
  color: #ef4444;
}

.like-album[aria-pressed="true"] {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: #ef4444;
}

.like-album[aria-pressed="true"]:hover {
  background: rgba(239, 68, 68, 0.2);
}

.album-body {
  display: grid;
  gap: 8px;
}

.btn {
  background: rgba(0, 230, 200, 0.1);
  border: 1.2px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-weight: 700;
  font-size: 12px;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:hover {
  background: rgba(0, 230, 200, 0.18);
  border-width: 1.5px;
  box-shadow: var(--glow-accent);
}

.btn:active {
  background: rgba(0, 230, 200, 0.25);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.download-album {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.download-album::before {
  content: '⬇';
  font-size: 12px;
}

.tracklist {
  display: grid;
  gap: 4px;
}

.tracklist-placeholder {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 8px 4px;
}

.tracklist-placeholder.error {
  color: var(--danger, #ff6b6b);
}

.track-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  transition: border-color var(--transition-fast);
}

.track-details:hover {
  border-color: rgba(0, 230, 200, 0.2);
}

.track-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.track-details summary::before {
  content: '▶';
  font-size: 10px;
  color: var(--muted);
  transition: transform var(--transition-fast);
}

.track-details[open] summary::before {
  transform: rotate(90deg);
}

.track-details summary::-webkit-details-marker {
  display: none;
}

.track-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.track-row:hover {
  background: rgba(0, 230, 200, 0.04);
  border-color: rgba(0, 230, 200, 0.15);
}

body[data-view="compact"] .track-row {
  grid-template-columns: 22px 1fr auto;
  padding: 2px 6px;
  border: none;
  border-radius: 3px;
  background: transparent;
  font-size: 11px;
}

body[data-view="compact"] .track-row:hover {
  background: rgba(0, 230, 200, 0.06);
  border-color: transparent;
}

body[data-view="compact"] .track-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

body[data-view="compact"] .track-title {
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-view="compact"] .track-file,
body[data-view="compact"] .track-count,
body[data-view="compact"] .track-likes,
body[data-view="compact"] .track-wave,
body[data-view="compact"] .track-progress,
body[data-view="compact"] .track-meta { display: none !important; }

body[data-view="compact"] .track-actions {
  opacity: 0;
  transition: opacity 0.12s;
  flex-wrap: nowrap;
  margin: 0;
  gap: 3px;
}

body[data-view="compact"] .track-row:hover .track-actions { opacity: 1; }

body[data-view="compact"] .track-play,
body[data-view="compact"] .track-like,
body[data-view="compact"] .track-add,
body[data-view="compact"] .track-download-btn {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  font-size: 9px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

body[data-view="compact"] .track-play:hover,
body[data-view="compact"] .track-like:hover,
body[data-view="compact"] .track-add:hover,
body[data-view="compact"] .track-download-btn:hover {
  background: rgba(0, 230, 200, 0.15);
  color: var(--accent);
}

.track-row.simple {
  grid-template-columns: 1fr;
}

.track-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
}

/* (minimal/compact track-actions now defined in view sections above) */

.track-file {
  color: var(--muted);
  font-size: 10px;
  word-break: break-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-count {
  color: var(--muted);
  font-size: 10px;
}

.track-status {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 2px;
}

.track-status.is-downloading {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--download-pct, 0%), var(--surface-2) 0);
  color: #0b0f14;
  font-weight: 600;
  margin-top: 6px;
}

body[data-view="minimal"] .track-status {
  margin-top: 4px;
}

.track-likes {
  color: var(--muted);
  font-size: 11px;
}

.track-wave {
  display: grid;
  grid-auto-flow: column;
  gap: 2px;
  height: 30px;
  align-items: end;
  cursor: pointer;
}

body[data-view="compact"] .track-wave {
  height: 48px;
  opacity: 0.85;
  transition: opacity var(--transition-fast);
}

body[data-view="compact"] .track-row:hover .track-wave {
  opacity: 1;
}

body[data-view="minimal"] .track-wave {
  height: 40px;
}

body[data-view="compact"] .track-progress {
  height: 6px;
  border-radius: 3px;
}

body[data-view="minimal"] .track-progress {
  height: 8px;
}

.track-wave span {
  width: 3px;
  background: linear-gradient(180deg, var(--muted), var(--surface-2));
  border-radius: 2px 2px 0 0;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.track-wave:hover span {
  background: linear-gradient(180deg, var(--accent), var(--surface-2));
}

.track-row.active .track-wave span {
  background: linear-gradient(180deg, var(--accent), #0ea5e9);
  animation: wave-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes wave-pulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.track-progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
}

.track-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  transition: width 0.1s linear;
}

.track-play {
  border: 1px solid var(--border);
  background: rgba(0, 230, 200, 0.08);
  color: var(--accent);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  min-width: 32px;
  min-height: 32px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.track-play:hover {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 230, 200, 0.3); }
  50% { box-shadow: 0 0 16px rgba(0, 230, 200, 0.6); }
}

body[data-view="minimal"] .track-play,
body[data-view="minimal"] .track-like,
body[data-view="minimal"] .track-add,
body[data-view="minimal"] .track-download-btn {
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 6px;
}

.track-row.active .track-play {
  background: var(--accent);
  color: #0b0f14;
  animation: pulse-glow 2s ease-in-out infinite;
}

.track-row.active {
  background: rgba(29, 185, 84, 0.08);
  border-color: rgba(29, 185, 84, 0.3);
}

.track-like {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  min-width: 28px;
  min-height: 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.track-like:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.track-add {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  min-width: 28px;
  min-height: 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.track-add:hover {
  background: rgba(0, 230, 200, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

.track-like[aria-pressed="true"] {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: #ef4444;
}

.track-download button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
  transition: all var(--transition-fast);
}

.track-download button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.track-download-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  min-width: 28px;
  min-height: 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.track-download-btn:hover {
  background: rgba(0, 230, 200, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

body[data-view="list"] .track-actions,
body[data-view="list"] .track-wave,
body[data-view="list"] .track-progress {
  display: none !important;
}

.progress {
  position: relative;
  height: 6px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.progress-label .pct {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

.admin {
  margin-top: 30px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.admin-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.admin-toggle input {
  accent-color: var(--accent);
}

.admin-card input, .admin-card button {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.admin-card button {
  background: var(--accent);
  color: #0b0f14;
  font-weight: 700;
  cursor: pointer;
  border: none;
}

.admin-result {
  color: var(--muted);
  font-size: 13px;
}

.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 17, 23, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 10px 20px;
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) auto auto minmax(120px, 0.5fr) minmax(200px, 2fr);
  gap: 16px;
  align-items: center;
  z-index: 100;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.now-playing img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
  transition: none;
}

.now-playing:hover img {
  transform: none;
}

.now-playing > div {
  min-width: 0;
  overflow: hidden;
}

#playerTitle {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.controls button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.controls button:hover {
  background: rgba(0, 230, 200, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

#playPauseBtn {
  width: 40px;
  height: 40px;
  font-size: 16px;
  background: rgba(0, 230, 200, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

#playPauseBtn:hover {
  background: var(--accent);
  color: #0d1117;
  box-shadow: var(--glow-accent);
}

/* Pulse animation when autoplay is blocked */
@keyframes pulse-attention {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent); }
  50% { transform: scale(1.1); box-shadow: 0 0 16px 3px var(--accent); }
}

#playPauseBtn.pulse-attention {
  animation: pulse-attention 0.6s ease-in-out 3;
}

/* SPA loading indicator */
body.spa-loading .content {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
body.spa-loading::after {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: spa-progress 0.8s ease-in-out infinite;
  z-index: 9999;
}
@keyframes spa-progress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.volume-control button {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.volume-control button:hover {
  color: var(--accent);
}

.volume-control input[type="range"] {
  width: 90px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface);
  border-radius: 2px;
  cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: var(--glow-accent);
}

.volume-control input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.progress-outer {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.progress-wrap {
  background: var(--surface);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
  transition: height var(--transition-fast);
}

.progress-wrap:hover {
  height: 8px;
}

.progress-wrap .progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  transition: width 0.1s linear;
}

/* ── AB Repeat ─────────────────────────────────────────── */
.ab-overlay {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 14px;
  transform: translateY(-50%);
  pointer-events: none;
}

.ab-region {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(88, 166, 255, 0.28);
  border-radius: 2px;
  display: none;
  pointer-events: none;
}

/* Cursor changes on progress bar while picking A or B */
.progress-outer[data-ab-state="1"] .progress-wrap,
.progress-outer[data-ab-state="2"] .progress-wrap {
  cursor: crosshair;
}

/* AB button states */
.ab-btn {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.ab-btn[data-ab-state="1"] {
  color: #3fb950;
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.12);
}

.ab-btn[data-ab-state="2"] {
  color: #f85149;
  border-color: #f85149;
  background: rgba(248, 81, 73, 0.12);
  animation: ab-pulse 1s ease-in-out infinite;
}

.ab-btn[data-ab-state="3"] {
  color: #58a6ff;
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.15);
}

.ab-download-btn {
  font-size: 15px;
  font-weight: 700;
}

.ab-download-btn[data-active="1"] {
  color: #3fb950;
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.14);
}

.player-action-btn:disabled,
.player-action-btn[aria-disabled="true"] {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.player-action-btn:disabled:hover,
.player-action-btn[aria-disabled="true"]:hover {
  background: var(--surface);
  transform: none;
}

@keyframes ab-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ── Hover time tooltip on progress bar ─────────────────── */
.progress-hover-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 3px 7px;
  border-radius: 5px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.progress-hover-tip.visible {
  opacity: 1;
}

/* In AB state 1 = picking A */
.progress-outer[data-ab-state="1"] .progress-hover-tip {
  color: #3fb950;
  border-color: #3fb950;
}

/* In AB state 2 = picking B */
.progress-outer[data-ab-state="2"] .progress-hover-tip {
  color: #f85149;
  border-color: #f85149;
}

/* ── AB marker improvements ──────────────────────────────── */
.ab-marker {
  position: absolute;
  top: 0; bottom: 0;
  width: 4px;
  border-radius: 2px;
  display: none;
  pointer-events: auto;
  cursor: ew-resize;
  transform: translateX(-50%);
  z-index: 10;
  touch-action: none;
  transition: width 0.1s;
}

.ab-marker:hover,
.ab-marker.dragging {
  width: 6px;
}

.ab-label {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  padding: 2px 5px;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  min-width: 28px;
  text-align: center;
}

.ab-marker-a { background: #3fb950; }
.ab-marker-b { background: #f85149; }
.ab-marker-a .ab-label { color: #3fb950; background: rgba(63, 185, 80, 0.18); }
.ab-marker-b .ab-label { color: #f85149; background: rgba(248, 81, 73, 0.18); }

/* While waiting for the user to set B (state 2), marker A blinks to make it
   obvious that the loop is incomplete — especially helpful on mobile where
   the user uses the toolbar A↔B button instead of clicking the progress bar. */
.progress-outer[data-ab-state="2"] .ab-marker-a {
  animation: ab-marker-blink 0.9s ease-in-out infinite;
}
@keyframes ab-marker-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.6); }
  50%      { opacity: 0.45; box-shadow: 0 0 0 4px rgba(63, 185, 80, 0); }
}

.player-progress {
  display: flex;
  gap: 12px;
  align-items: center;
}

.progress-time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 42px;
}

.progress-time.current {
  text-align: right;
}

.progress-time.duration {
  text-align: left;
}

.progress-percent {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  min-width: 38px;
  text-align: right;
}

.player-album-btn {
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
}

.player-album-btn #playerAlbum {
  color: var(--text);
  font-weight: 600;
}

.player-queue {
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: min(420px, 92vw);
  max-height: 60vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  display: none;
  grid-template-rows: auto 1fr auto;
  z-index: 30;
}

.player-queue.active {
  display: grid;
}

.player-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.player-queue-header button {
  background: var(--surface-2);
  border: none;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.player-queue-body {
  overflow: auto;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}

.queue-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
}

.queue-row:hover {
  background: var(--surface-2);
}

.queue-row.active {
  border-color: var(--accent);
  background: rgba(29, 185, 84, 0.15);
}

.queue-row .queue-index {
  color: var(--muted);
  font-size: 12px;
}

.queue-row .queue-title {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-queue-actions {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.player-queue-actions button {
  background: var(--accent);
  border: none;
  color: #0b0f14;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

/* Player Actions (like, playlist) */
.player-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.player-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-action-btn:hover {
  background: var(--surface-2);
  transform: scale(1.1);
}

.player-action-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0f14;
}

.album-card.highlight {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(29, 185, 84, 0.2);
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 16px 0 32px;
}

.pagination a {
  color: var(--accent);
  background: rgba(0, 230, 200, 0.08);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.pagination a:hover {
  background: rgba(0, 230, 200, 0.2);
  box-shadow: var(--glow-accent);
}

.pagination span {
  color: var(--muted);
  font-size: 12px;
}

.artist-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  display: grid;
  gap: 0;
}

.artist-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  width: 100%;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.artist-header .artist-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.artist-body {
  display: none;
  gap: 16px;
  padding: 16px;
}

.albums-grid[data-grouped="true"] {
  grid-template-columns: 1fr;
}

.artist-body {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}

body[data-view="compact"] .artist-body {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

body[data-view="minimal"] .artist-body,
body[data-view="list"] .artist-body,
body[data-view="madsonic"] .artist-body {
  grid-template-columns: 1fr;
}

body[data-view="covers"] .artist-body,
body[data-view="grid"] .artist-body {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.artist-group.is-open .artist-body {
  display: grid;
}

/* ========== PROFILE PAGE ========== */
.profile-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 32px;
  overflow-x: hidden;
}

.profile-banner {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, rgba(0, 230, 200, 0.15), rgba(108, 99, 255, 0.15));
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-lg);
  margin-bottom: -50px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.banner-upload-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(13, 17, 23, 0.8);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  backdrop-filter: blur(4px);
  z-index: 5;
  border: 1px solid var(--border);
}

.profile-banner:hover .banner-upload-overlay,
.banner-upload-overlay:hover {
  opacity: 1;
}

.banner-upload-icon {
  font-size: 14px;
}

.profile-header {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 0 16px 16px;
  position: relative;
  z-index: 1;
}

.profile-avatar-container {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar-img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  object-fit: cover;
  background: var(--surface);
}

.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 17, 23, 0.7);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.profile-avatar-container:hover .avatar-upload-overlay {
  opacity: 1;
}

.avatar-upload-icon {
  font-size: 20px;
}

.avatar-upload-text {
  font-size: 10px;
  color: #fff;
}

.profile-info {
  flex: 1;
  padding-bottom: 6px;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-badge {
  background: rgba(0, 230, 200, 0.12);
  color: var(--accent);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius);
  font-weight: 700;
  border: 1px solid var(--accent);
}

.profile-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.admin-link {
  color: var(--accent);
  font-size: 12px;
  margin-top: 6px;
  display: inline-block;
}

.profile-content {
  display: grid;
  gap: 16px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  transition: border-color var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--accent);
}

.stat-card span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card strong {
  font-size: 16px;
  color: var(--accent);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.profile-form {
  display: grid;
  gap: 8px;
}

.profile-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.profile-form input {
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  transition: border-color var(--transition-fast);
}

.profile-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.profile-form button {
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: rgba(0, 230, 200, 0.1);
  color: var(--accent);
  font-weight: 700;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-form button:hover {
  background: rgba(0, 230, 200, 0.2);
}

.profile-status {
  font-size: 11px;
  color: var(--muted);
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.profile-row strong {
  color: var(--text);
}

.profile-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.profile-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.profile-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.profile-item .mini-btn {
  margin-left: auto;
}

.profile-item img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-2);
}

.profile-title {
  font-weight: 700;
}

.profile-meta {
  color: var(--muted);
  font-size: 12px;
}

.profile-table {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.profile-track {
  align-items: center;
}

.profile-section .profile-track {
  grid-template-columns: 28px 1fr;
}

.profile-track .track-play {
  justify-self: start;
  margin-right: 8px;
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.see-all {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.see-all:hover {
  color: var(--accent);
}

/* Albums Preview Grid (Profile Page) */
.albums-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  overflow: hidden;
}

.album-preview-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.album-preview-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.album-preview-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface-2);
}

.album-preview-title {
  padding: 8px 8px 2px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-preview-artist {
  padding: 0 8px 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Playlists Preview */
.playlists-preview {
  display: grid;
  gap: 8px;
}

.playlist-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.playlist-icon {
  font-size: 20px;
}

.playlist-preview-name {
  font-size: 13px;
  font-weight: 600;
}

.playlist-preview-count {
  font-size: 11px;
  color: var(--muted);
}

/* History Preview */
.history-preview {
  display: grid;
  gap: 8px;
}

.history-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.history-preview-row img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-2);
}

.history-preview-title {
  font-size: 13px;
  font-weight: 500;
}

.history-preview-artist {
  font-size: 11px;
  color: var(--muted);
}

/* Empty State Hint */
.empty-hint {
  color: var(--muted);
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}

/* Profile Sections Container */
.profile-sections {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.playlist-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.playlist-tracks {
  margin: 6px 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: none;
  gap: 6px;
}

.playlist-tracks.active {
  display: grid;
}

.mini-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.mini-btn.primary {
  background: var(--accent);
  color: #0b0f14;
  border: none;
}

/* Playlist track rows — compact layout with select-and-move + drag */
.playlist-track-row .track-play {
  padding: 2px 4px;
  font-size: 11px;
}

.playlist-track-row.dragging {
  opacity: 0.4;
}

.playlist-track-row.drag-over {
  border-left-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.playlist-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
}

.playlist-modal.active {
  display: flex;
}

.playlist-modal-content {
  width: min(420px, 90vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}

.playlist-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.playlist-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.playlist-modal-close {
  background: var(--surface-2);
  border: none;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.playlist-modal-close:hover {
  background: var(--surface-alt);
}

.playlist-modal-body {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playlist-modal-body .loading,
.playlist-modal-body .empty,
.playlist-modal-body .error {
  padding: 16px;
  text-align: center;
  color: var(--muted);
}

.playlist-modal-body .error {
  color: var(--error, #ff6b6b);
}

.playlist-modal-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.playlist-modal-footer input {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.playlist-modal-footer button {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #0b0f14;
  cursor: pointer;
  font-weight: 500;
}

.playlist-dialog {
  width: min(420px, 90vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}

.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.playlist-body {
  display: grid;
  gap: 10px;
}

.playlist-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.playlist-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.playlist-create {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.playlist-create input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.playlist-create button,
.playlist-close {
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #0b0f14;
  cursor: pointer;
}

.playlist-close {
  background: var(--surface-2);
  color: var(--text);
}

.playlist-status {
  color: var(--muted);
  font-size: 12px;
}

.login-content {
  display: grid;
  gap: 16px;
}

.login-card {
  max-width: 380px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.login-form input {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  transition: border-color var(--transition-fast);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-actions {
  display: flex;
  gap: 8px;
}

.login-actions button {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: rgba(0, 230, 200, 0.1);
  color: var(--accent);
  font-weight: 700;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.login-actions button:hover {
  background: rgba(0, 230, 200, 0.2);
}

.login-actions .ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.login-actions .ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(239, 68, 68, 0.45);
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.08);
}
.login-error b { font-weight: 700; }
.login-error code {
  background: rgba(0,0,0,0.18);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12.5px;
}
.login-actions button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

@media (max-width: 960px) {
  .album-card {
    grid-template-columns: 1fr;
  }
  .player {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: sticky;
    left: 0;
    right: 0;
    top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }
  
  /* Topbar User Actions Mobile */
  .topbar-user-actions {
    gap: 6px;
  }
  
  .topbar-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .topbar-user-btn {
    padding: 4px 8px 4px 4px;
  }
  
  .topbar-username {
    display: none;
  }
  
  .dropdown-arrow {
    display: none;
  }
  
  .topbar-avatar {
    width: 28px;
    height: 28px;
  }

  /* Older bottom-sheet rule disabled — see MOBILE RESPONSIVE FIXES block
     for the new "above-player overlay" behavior. */

  .content {
    padding: 12px;
    padding-top: 10px;
    padding-bottom: 180px;
  }

  .search {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .search input[name="q"] {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-size: 15px;
  }

  .search-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Hide date pickers and sort on mobile */
  .date-input,
  .date-compact,
  .sort-select,
  .search .ghost {
    display: none !important;
  }

  .toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .artist-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .year-actions {
    justify-content: stretch;
  }

  .player-queue {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 160px;
    max-height: 50vh;
  }

  .view-switch {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .view-switch::-webkit-scrollbar {
    display: none;
  }

  .albums-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .pill {
    padding: 8px 12px;
    font-size: 13px;
  }

  #themeSelect {
    padding: 8px 12px;
    font-size: 13px;
  }

  body[data-view="compact"] .sub {
    grid-template-columns: 1fr 1fr;
  }

  /* Mobile track buttons - larger touch targets */
  .track-play,
  .track-like,
  .track-add,
  .track-download-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 18px;
  }

  .like-album {
    padding: 10px 14px;
    font-size: 15px;
  }

  /* Mobile player improvements */
  .player {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 12px;
    padding: 14px 16px 20px;
  }

  .now-playing {
    justify-content: flex-start;
  }

  .now-playing img {
    width: 48px;
    height: 48px;
  }

  #playerTitle {
    font-size: 13px;
  }

  .controls {
    order: -1;
    justify-content: center;
    gap: 12px;
  }

  .controls button {
    width: 44px;
    height: 44px;
  }

  #playPauseBtn {
    width: 52px;
    height: 52px;
  }

  .volume-control {
    display: none;
  }

  /* Keep A↔B button reachable on mobile, hide only Like / Add (saving width). */
  .player-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    order: -1;
  }
  .player-actions #playerLikeBtn,
  .player-actions #playerAddBtn {
    display: none;
  }
  .player-actions .ab-btn {
    min-width: 56px;
    height: 36px;
    font-size: 12px;
  }

  .player-progress {
    gap: 10px;
  }

  .progress-time {
    font-size: 11px;
    min-width: 36px;
  }

  body[data-view="compact"] .track-row,
  body[data-view="minimal"] .track-row,
  body[data-view="madsonic"] .track-row {
    grid-template-columns: 48px 1fr;
    padding: 12px;
    gap: 14px;
  }

  body[data-view="compact"] .track-title {
    font-size: 15px;
  }

  body[data-view="madsonic"] .album-card {
    flex-direction: column;
    align-items: stretch;
  }

  body[data-view="madsonic"] .album-cover {
    width: 100%;
    max-width: 240px;
    align-self: center;
  }

  /* Hide progress percent on mobile, show times */
  .progress-percent {
    display: none;
  }

  /* Sidebar mobile */
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
  }

  .sidebar-overlay.is-open {
    display: block;
  }

  .main-wrap {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  /* Download panel mobile */
  .download-panel {
    left: 8px;
    right: 8px;
    bottom: 170px;
    width: auto;
  }

  /* Profile Page Mobile */
  .profile-page {
    padding: 0 12px 40px;
  }

  .profile-banner {
    height: 140px;
    margin-bottom: -50px;
    border-radius: 12px;
  }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 12px 16px;
    gap: 12px;
  }

  .profile-avatar-img {
    width: 90px;
    height: 90px;
  }

  .profile-name {
    font-size: 20px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
    text-align: center;
  }

  .stat-value {
    font-size: 18px;
    font-weight: 700;
    display: block;
  }

  .stat-label {
    font-size: 11px;
  }

  /* Albums Preview Mobile - 2 columns with smaller cards */
  .albums-preview {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .album-preview-card img {
    aspect-ratio: 1;
  }

  .album-preview-title {
    font-size: 11px;
    padding: 6px 6px 2px;
  }

  .album-preview-artist {
    font-size: 10px;
    padding: 0 6px 6px;
  }

  .profile-section {
    padding: 12px;
    border-radius: 12px;
  }

  .section-header h2 {
    font-size: 14px;
  }

  .see-all {
    font-size: 12px;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  .topbar {
    padding: 8px 10px;
  }

  .content {
    padding: 10px;
    padding-bottom: 190px;
  }

  .album-card {
    padding: 12px;
  }

  .btn {
    padding: 12px 16px;
    font-size: 13px;
  }

  .track-details {
    padding: 10px;
  }

  /* Profile Extra Small */
  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .albums-preview {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .album-preview-card {
    border-radius: 8px;
  }

  .album-preview-title {
    font-size: 10px;
    padding: 5px 5px 2px;
  }

  .album-preview-artist {
    font-size: 9px;
    padding: 0 5px 5px;
  }

  .profile-section {
    padding: 10px;
  }

  .section-header h2 {
    font-size: 13px;
  }

  .history-preview-row img {
    width: 32px;
    height: 32px;
  }

  .history-preview-title {
    font-size: 12px;
  }

  .history-preview-artist {
    font-size: 10px;
  }
}

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 200px;
  background: var(--card);
  border-right: 1px solid var(--border);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-section {
  padding: 6px 8px;
}

.sidebar-section-title {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 6px;
  padding: 0 8px;
  font-weight: 700;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.sidebar-link:hover {
  background: rgba(0, 230, 200, 0.05);
  border-color: rgba(0, 230, 200, 0.1);
}

.sidebar-link.active {
  background: rgba(0, 230, 200, 0.12);
  color: var(--accent);
  font-weight: 700;
  border-color: rgba(0, 230, 200, 0.25);
}

/* Dark theme override for active sidebar link */
[data-theme="dark"] .sidebar-link.active {
  color: var(--accent);
  text-shadow: none;
}

.sidebar-link .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 55;
  display: none;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
}

.main-wrap {
  margin-left: 200px;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* ========== DOWNLOAD PANEL ========== */
.download-panel {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 320px;
  max-height: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 80;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.download-panel.is-open {
  display: flex;
}

.download-panel.is-minimized {
  max-height: 40px;
  overflow: hidden;
}

.download-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.download-panel-title {
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.download-panel-title .count {
  background: rgba(0, 230, 200, 0.12);
  color: var(--accent);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
}

.download-panel-actions {
  display: flex;
  gap: 6px;
}

.download-panel-actions button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition-fast);
}

.download-panel-actions button:hover {
  color: var(--text);
}

.download-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.download-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 6px;
}

.download-item-info {
  min-width: 0;
}

.download-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-item-status {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.download-item-progress {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.download-item-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.download-item-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

/* ========== SHARE & SOCIAL ========== */
.share-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.share-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
}

.copy-link-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.copy-link-btn:hover {
  background: var(--accent);
  color: #0b0f14;
  border-color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--card);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  box-shadow: var(--glow-accent);
  z-index: 200;
  opacity: 0;
  font-size: 12px;
  transition: all var(--transition);
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== PLAYLIST MODAL FIX ========== */
.playlist-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.playlist-item-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.playlist-item-btn span:first-child {
  font-weight: 500;
}

.playlist-item-btn span:last-child {
  color: var(--muted);
  font-size: 12px;
}

/* ========== COUNTERS SOCIAL ========== */
.album-stats {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.stat-badge .icon {
  font-size: 14px;
}

.play-count {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Add album to playlist */
.add-album-playlist {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.add-album-playlist:hover {
  background: var(--accent);
  color: #0b0f14;
  border-style: solid;
  border-color: var(--accent);
}

/* ========== MOBILE FIXES ========== */
@media (max-width: 720px) {
  /* Ensure sidebar is hidden properly */
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    z-index: 150;
  }
  
  .sidebar.is-open {
    transform: translateX(0);
  }
  
  /* Main content takes full width */
  .main-wrap {
    margin-left: 0 !important;
    width: 100%;
  }
  
  /* Topbar improvements */
  .topbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  
  .menu-toggle {
    display: flex !important;
    order: -1;
  }
  
  /* Search form mobile */
  .search {
    flex: 1;
    min-width: 0;
  }
  
  .search input[name="q"] {
    width: 100%;
  }
  
  /* Album cards on mobile */
  .album-card {
    padding: 14px;
  }
  
  .album-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .album-cover {
    width: 100%;
    max-width: 200px;
    align-self: center;
  }
  
  .album-info {
    width: 100%;
  }
  
  .album-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .album-download-row {
    flex-wrap: wrap;
  }
  
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  /* Player mobile layout */
  .player {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 16px;
  }
  
  .now-playing {
    width: 100%;
    justify-content: flex-start;
  }
  
  .player-controls {
    width: 100%;
    justify-content: center;
    gap: 16px;
  }
  
  .player-controls button {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  #playPauseBtn {
    width: 52px;
    height: 52px;
    font-size: 24px;
  }
  
  .player-volume {
    display: none !important;
  }
  /* .player-actions kept visible: see MOBILE RESPONSIVE FIXES block */
  
  .player-progress {
    width: 100%;
    order: 3;
  }
  
  /* Track rows mobile */
  .track-row {
    padding: 10px 12px !important;
  }
  
  .track-controls {
    gap: 8px;
  }
  
  .track-controls button {
    min-width: 38px;
    min-height: 38px;
  }
  
  /* Queue panel mobile */
  .player-queue {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    bottom: 150px !important;
  }
  
  .queue-row {
    padding: 8px 10px;
  }
  
  /* Download panel mobile */
  .download-panel {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    bottom: 155px !important;
  }
  
  /* Modal mobile */
  .playlist-modal-content {
    width: 90%;
    max-width: 320px;
    padding: 20px;
  }
  
  /* ========== MINIMAL VIEW MOBILE FIX ========== */
  body[data-view="minimal"] .track-row {
    grid-template-columns: 1fr;
    padding: 8px 0;
  }
  
  body[data-view="minimal"] .track-num {
    display: none;
  }
  
  body[data-view="minimal"] .track-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  body[data-view="minimal"] .track-title {
    font-size: 14px;
    line-height: 1.3;
    max-width: 100%;
  }
  
  body[data-view="minimal"] .track-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-content: flex-start;
    margin-top: 0;
  }
  
  body[data-view="minimal"] .track-play,
  body[data-view="minimal"] .track-like,
  body[data-view="minimal"] .track-add,
  body[data-view="minimal"] .track-download-btn {
    padding: 4px 8px !important;
    font-size: 10px !important;
    min-width: unset !important;
    min-height: 24px !important;
    height: 24px !important;
    border-radius: 4px !important;
  }
  
  body[data-view="minimal"] .track-play i,
  body[data-view="minimal"] .track-like i,
  body[data-view="minimal"] .track-add i,
  body[data-view="minimal"] .track-download-btn i {
    font-size: 12px;
  }
}

/* Tablet adjustments */
@media (min-width: 721px) and (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }
  
  .main-wrap {
    margin-left: 200px;
  }
  
  .player {
    grid-template-columns: minmax(140px, 1fr) auto auto minmax(100px, 0.5fr) minmax(180px, 1.5fr);
    gap: 16px;
    padding: 12px 20px;
  }
}

/* ========================== */
/* CYBERPUNK ANIMATIONS       */
/* ========================== */

/* Cyber scanline effect */
.cyber-scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  pointer-events: none;
  z-index: 9999;
  opacity: 0.6;
}

/* Neon glow effects */
.neon-glow {
  box-shadow: 0 0 10px var(--neon-cyan),
              0 0 20px var(--neon-cyan),
              0 0 40px rgba(5, 217, 232, 0.3);
}

.neon-glow-pink {
  box-shadow: 0 0 10px var(--neon-pink),
              0 0 20px var(--neon-pink),
              0 0 40px rgba(255, 42, 109, 0.3);
}

/* Glitch text effect */
.glitching {
  animation: glitch 0.3s ease-in-out;
}

@keyframes glitch {
  0%, 100% { transform: translate(0); filter: hue-rotate(0deg); }
  20% { transform: translate(-2px, 2px); filter: hue-rotate(90deg); }
  40% { transform: translate(2px, -2px); filter: hue-rotate(180deg); }
  60% { transform: translate(-1px, -1px); filter: hue-rotate(270deg); }
  80% { transform: translate(1px, 1px); filter: hue-rotate(360deg); }
}

/* Heart burst particles */
.heart-particle {
  position: absolute;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  text-shadow: 0 0 10px var(--neon-pink);
}

/* Cyber button hover effects */
.btn:hover,
button:hover,
.album-card:hover,
.track-row:hover {
  box-shadow: 0 0 15px var(--neon-glow);
}

/* CRT flicker animation */
@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.98; }
  51% { opacity: 1; }
  52% { opacity: 0.97; }
}

.crt-flicker {
  animation: crt-flicker 0.1s infinite;
}

/* Neon text glow */
.neon-text {
  text-shadow: 0 0 5px var(--neon-cyan),
               0 0 10px var(--neon-cyan),
               0 0 20px var(--neon-cyan);
}

.neon-text-pink {
  text-shadow: 0 0 5px var(--neon-pink),
               0 0 10px var(--neon-pink),
               0 0 20px var(--neon-pink);
}

/* Pulse animation for playing indicator */
@keyframes neon-pulse {
  0%, 100% { 
    box-shadow: 0 0 5px var(--neon-cyan);
    opacity: 1;
  }
  50% { 
    box-shadow: 0 0 20px var(--neon-cyan), 0 0 40px var(--neon-cyan);
    opacity: 0.8;
  }
}

.playing-glow {
  animation: neon-pulse 1.5s ease-in-out infinite;
}

/* Grid line overlay (optional) */
.cyber-grid::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(rgba(5, 217, 232, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(5, 217, 232, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: -1;
}

/* Accent color updates for cyberpunk theme */
.accent-glow {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-glow);
}

/* Toast notification cyber style */
.toast {
  border-left: 3px solid var(--neon-cyan);
  box-shadow: 0 0 20px var(--neon-glow), var(--shadow-md);
}

/* Input focus cyber glow */
input:focus,
textarea:focus,
select:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px var(--neon-glow);
}

/* Sidebar nav hover */
.nav-link:hover,
.nav-link.active {
  background: linear-gradient(90deg, rgba(5, 217, 232, 0.1), transparent);
  border-left: 3px solid var(--neon-cyan);
}

/* Player cyberpunk style */
.player {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg) 100%);
  border-top: 1px solid var(--neon-cyan);
  box-shadow: 0 -5px 30px rgba(5, 217, 232, 0.1);
}

/* ════════════════════════════════════════════════════════════════════
   DISCOGRAPHY CARDS — artists page album layout
   ════════════════════════════════════════════════════════════════════ */

.disco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 12px;
}

@media (max-width: 520px) {
  .disco-grid {
    grid-template-columns: 1fr;
  }
}

.disco-card {
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition), transform 0.2s ease;
}

.disco-card:hover {
  border-color: rgba(0, 230, 200, 0.4);
  box-shadow: 0 4px 24px rgba(0, 230, 200, 0.07);
  transform: translateY(-1px);
}

/* Cover thumbnail */
.disco-cover {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  display: block;
}

.disco-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.disco-cover:hover img {
  transform: scale(1.06);
  filter: brightness(0.7);
}

.disco-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  opacity: 0;
  background: rgba(0, 0, 0, 0.35);
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.disco-cover:hover .disco-play-overlay {
  opacity: 1;
}

/* Info section */
.disco-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.disco-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-fast);
}

.disco-title:hover {
  color: var(--accent);
}

.disco-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.disco-meta span {
  white-space: nowrap;
}

.disco-date {
  opacity: 0.7;
}

/* Compact track list */
.disco-tracks {
  margin-top: auto;
}

.disco-tracks summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  padding: 3px 0;
  user-select: none;
  transition: color var(--transition-fast);
}

.disco-tracks summary:hover {
  color: #fff;
}

.disco-tracks summary::-webkit-details-marker { display: none; }

.disco-tracks-arrow::before {
  content: '▶';
  font-size: 8px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.disco-tracks[open] .disco-tracks-arrow::before {
  transform: rotate(90deg);
}

.disco-tracklist {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  counter-reset: track;
}

.disco-tracklist::-webkit-scrollbar { width: 4px; }
.disco-tracklist::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.disco-track {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
  counter-increment: track;
  transition: background 0.15s ease, color 0.15s ease;
}

.disco-track:hover {
  background: rgba(0, 230, 200, 0.06);
  color: var(--text);
}

.disco-track::before {
  content: counter(track, decimal-leading-zero);
  font-size: 10px;
  color: var(--muted);
  opacity: 0.5;
  min-width: 16px;
  text-align: right;
}

.disco-track-play {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
  padding: 0;
  width: 16px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.disco-track:hover .disco-track-play {
  opacity: 1;
}

.disco-track-play:hover {
  color: var(--accent);
}

.disco-track-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.disco-track-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.disco-track:hover .disco-track-actions {
  opacity: 1;
}

.disco-track-actions .track-like,
.disco-track-actions .track-add {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}

.disco-track-actions .track-like:hover {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.1);
}

.disco-track-actions .track-like.is-liked {
  color: #f43f5e;
}

.disco-track-actions .track-add:hover {
  color: var(--accent);
  background: rgba(0, 230, 200, 0.1);
}

/* Playing state */
.disco-track.is-playing {
  color: var(--accent);
  background: rgba(0, 230, 200, 0.08);
}

.disco-track.is-playing::before {
  color: var(--accent);
  opacity: 1;
}

/* Responsive: stack on small screens */
@media (max-width: 400px) {
  .disco-cover {
    width: 80px;
    height: 80px;
  }
  .disco-title { font-size: 12px; }
}

/* ════════════════════════════════════════════════════════════════════
   TELEGRAM LOGIN WIDGET (v20260421c)
   ═══════════════════════════════════════════════════════════════════ */
.login-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.4rem 0 1rem;
  color: var(--text-secondary, #888);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border, #333), transparent);
}
.telegram-login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  padding: .25rem;
}
.telegram-login-wrap iframe {
  filter: drop-shadow(0 4px 14px rgba(0, 136, 204, .35));
  border-radius: 10px;
}
.tg-hint {
  margin: 0;
  font-size: .8rem;
  color: var(--text-secondary, #888);
  text-align: center;
}

/* ─── Round 2: Follows + Tags + Profile fields (v20260421d) ─────────────── */

/* Follow button */
.btn-follow,
.btn-follow-active {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px;
  border: 1px solid var(--accent, #6366f1);
  font-weight: 600; cursor: pointer;
  transition: transform .12s ease, background .15s ease, color .15s ease;
}
.btn-follow {
  background: transparent;
  color: var(--accent, #6366f1);
}
.btn-follow:hover {
  background: var(--accent, #6366f1);
  color: #fff;
  transform: translateY(-1px);
}
.btn-follow-active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; border-color: #10b981;
}
.btn-follow-active:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #ef4444;
}
.btn-follow-active:hover .follow-label::after {
  content: " (annulla)";
  font-weight: 400; opacity: .85;
}
.follow-icon { font-size: 1em; line-height: 1; }

.profile-follow-stats {
  margin-top: 10px;
  display: flex; gap: 8px;
  font-size: .9em; color: var(--text-muted, #94a3b8);
}
.profile-follow-stats strong { color: var(--text, #f1f5f9); }

/* Followers preview */
.followers-preview {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.follower-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px;
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  text-decoration: none; color: inherit;
  transition: background .15s ease;
}
.follower-chip:hover { background: rgba(99,102,241,.2); }
.follower-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover;
}
.follow-mini-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  object-fit: cover; margin-right: 6px;
  vertical-align: middle;
}

/* Profile fields list (read view) */
.profile-fields-list {
  display: grid; gap: 10px; margin: 0;
}
.profile-field-row {
  display: grid; grid-template-columns: 180px 1fr; gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.profile-field-row dt {
  font-weight: 600; color: var(--text-muted, #94a3b8);
}
.profile-field-row dd {
  margin: 0; word-break: break-word;
}

.custom-fields-form .setting-item {
  display: grid; gap: 6px; margin-bottom: 12px;
}
.custom-fields-form input,
.custom-fields-form textarea {
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text, #f1f5f9);
  padding: 8px 12px; border-radius: 6px;
  font: inherit; width: 100%;
}
.saved-hint {
  margin-left: 12px; color: #10b981; font-weight: 600;
}

/* Tags */
.topic-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.tag-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(135deg,
    rgba(99,102,241,.18), rgba(139,92,246,.15));
  border: 1px solid rgba(99,102,241,.3);
  color: var(--accent, #818cf8);
  text-decoration: none;
  font-size: .85em; font-weight: 500;
  transition: transform .12s ease, background .15s ease;
}
.tag-chip:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--accent, #6366f1), #8b5cf6);
  color: #fff;
}
.tag-chip sup {
  background: rgba(0,0,0,.25);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: .75em;
  margin-left: 2px;
}

.tags-cloud,
.tags-cloud-mini {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 0;
}
.tags-cloud .tag-chip {
  font-size: 1em;
  padding: 5px 14px;
}

/* ── Album genre chips (homepage card + detail page) ──────────────── */
.album-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 4px;
  align-items: center;
}
/* Use `a.genre-chip` to win specificity over the global `a` rule from
   base.html which adds `border-bottom: 1px solid var(--border)`. */
a.genre-chip,
.genre-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg,
    rgba(99,102,241,.22), rgba(139,92,246,.18));
  border: 1px solid rgba(129,140,248,.45) !important;
  border-bottom: 1px solid rgba(129,140,248,.45) !important;
  color: #a5b4fc !important;
  text-decoration: none !important;
  font-size: .72em;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .25px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
  transition: transform .12s ease, background .15s ease,
              color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
a.genre-chip:hover,
.genre-chip:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 10px rgba(99,102,241,.35);
}
a.genre-chip:visited { color: #a5b4fc !important; }
@media (max-width: 600px) {
  a.genre-chip, .genre-chip { font-size: .7em; padding: 2px 9px; }
}

/* ── Genre filter input (homepage search bar) ─────────────────────── */
/* Plain compact input that piggy-backs on `.search input` styling but
   overrides the flex-grow so it stays small and inline. */
.search input.genre-search-input {
  flex: 0 0 auto;
  width: 160px;
  min-width: 0 !important;        /* override .search input[name="q"] */
  padding: 8px 10px;
  font-size: 12px;
}
.search input.genre-search-input.has-value {
  border-color: var(--accent);
  background: rgba(0,230,200,0.08);
  color: var(--accent);
}
@media (max-width: 600px) {
  .search input.genre-search-input { width: 120px; }
}

/* ── Advanced-filters toggle (collapses date range, sort, show-all) ─ */
/* Selectors include `.search button.adv-toggle-btn` to win specificity over
   `.search button { padding:8px 12px; font-weight:700; ... }` defined above. */
.adv-toggle-btn,
.search button.adv-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  line-height: 1;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.adv-toggle-btn:hover,
.search button.adv-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
  box-shadow: none;
}
.adv-toggle-btn .adv-toggle-icon { font-size: 13px; line-height: 1; }
.adv-toggle-btn .adv-toggle-label { font-weight: 500; }
.adv-toggle-btn .adv-toggle-caret {
  display: inline-block;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  margin-left: 2px;
  transition: transform .15s ease;
}
.adv-toggle-btn.is-open .adv-toggle-caret { transform: rotate(45deg); } /* + → × */
.adv-toggle-btn.has-active,
.adv-toggle-btn.is-open {
  border-color: var(--accent);
  background: rgba(0,230,200,0.08);
  color: var(--accent);
}
.adv-toggle-btn .adv-toggle-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.adv-filters-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.adv-filters-group[hidden] { display: none; }
@media (max-width: 600px) {
  .adv-toggle-btn .adv-toggle-label { display: none; }  /* icon-only on small screens */
  .adv-toggle-btn { padding: 0 8px; }
}

/* Activity feed */
.activity-page { max-width: 1100px; margin: 0 auto; padding: 20px; }
.activity-header { margin-bottom: 24px; }
.activity-header h1 { margin: 0 0 6px; }
.activity-sub { color: var(--text-muted, #94a3b8); margin: 0; }

.activity-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}
@media (max-width: 900px) {
  .activity-layout { grid-template-columns: 1fr; }
}

.activity-feed {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.activity-item {
  display: flex; gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  border-left: 3px solid var(--accent, #6366f1);
  transition: transform .12s ease, background .15s ease;
}
.activity-item:hover {
  background: rgba(255,255,255,.07);
  transform: translateX(2px);
}
.activity-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover;
}
.activity-body { flex: 1; min-width: 0; }
.activity-user {
  font-weight: 600; color: var(--text, #f1f5f9);
  text-decoration: none;
}
.activity-user:hover { color: var(--accent, #818cf8); }
.activity-title {
  font-weight: 600; color: var(--accent, #818cf8);
  text-decoration: none; margin: 0 4px;
}
.activity-title:hover { text-decoration: underline; }
.activity-time {
  color: var(--text-muted, #94a3b8);
  font-size: .85em; margin-left: 6px;
}
.activity-empty {
  padding: 40px; text-align: center;
  color: var(--text-muted, #94a3b8);
  background: rgba(255,255,255,.04);
  border-radius: 10px;
}

.activity-sidebar { display: flex; flex-direction: column; gap: 16px; }
.sidebar-card {
  background: rgba(255,255,255,.04);
  padding: 16px; border-radius: 10px;
}
.sidebar-card h3 { margin: 0 0 12px; font-size: 1em; }
.sidebar-link {
  display: block; margin-top: 10px;
  color: var(--accent, #818cf8); text-decoration: none;
  font-size: .85em;
}
.sidebar-link:hover { text-decoration: underline; }

.following-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.following-list a {
  display: flex; align-items: center;
  color: inherit; text-decoration: none;
  padding: 4px 6px; border-radius: 6px;
  transition: background .15s ease;
}
.following-list a:hover { background: rgba(99,102,241,.15); }

/* Tag detail page (topic list) */
.topic-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.topic-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: rgba(255,255,255,.04);
  border-radius: 8px;
}
.topic-row:hover { background: rgba(255,255,255,.07); }
.topic-row-main { flex: 1; min-width: 0; }
.topic-title-link {
  font-weight: 600; color: var(--text, #f1f5f9);
  text-decoration: none; font-size: 1.05em;
}
.topic-title-link:hover { color: var(--accent, #818cf8); }
.topic-row-meta {
  margin-top: 4px;
  color: var(--text-muted, #94a3b8);
  font-size: .85em;
  display: flex; gap: 8px;
}
.topic-row-meta a { color: inherit; }
.topic-row-stats {
  display: flex; gap: 12px;
  color: var(--text-muted, #94a3b8);
  font-size: .9em;
}

/* Admin profile-fields table */
.admin-table {
  width: 100%; border-collapse: collapse;
  background: rgba(255,255,255,.04);
  border-radius: 8px; overflow: hidden;
  margin: 16px 0;
}
.admin-table th, .admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: left;
  vertical-align: middle;
}
.admin-table th {
  background: rgba(0,0,0,.25);
  font-size: .85em; text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
}
.admin-table input[type=text],
.admin-table select,
.admin-table input[type=number] {
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text, #f1f5f9);
  padding: 4px 8px; border-radius: 4px;
}
.inline-edit-form, .inline-delete-form { display: inline; }
.admin-form {
  background: rgba(255,255,255,.04);
  padding: 16px; border-radius: 8px; margin-top: 16px;
}
.admin-form .form-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-bottom: 12px;
}
.admin-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: .85em; color: var(--text-muted, #94a3b8);
}
.admin-form input[type=text],
.admin-form select {
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text, #f1f5f9);
  padding: 6px 10px; border-radius: 6px;
  min-width: 200px;
}
.admin-hint {
  color: var(--text-muted, #94a3b8);
  font-size: .9em; margin-bottom: 16px;
}

/* Form hint */
.form-hint {
  color: var(--text-muted, #94a3b8);
  font-weight: 400; font-size: .85em;
}

/* ─── Round 3: Achievements / Badges ─────────────────────────────── */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.badge-grid-large {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
.achievement-card {
  background: var(--bg-card, #1c1c22);
  border: 1px solid var(--border-color, #2a2a32);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  overflow: hidden;
}
.achievement-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.achievement-icon {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}
.achievement-label {
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 4px;
  color: var(--text-primary, #f0f0f5);
}
.achievement-desc {
  font-size: .8rem;
  color: var(--text-secondary, #9a9aa8);
  margin-bottom: 6px;
  min-height: 2.4em;
}
.achievement-thr {
  font-size: .72rem;
  color: var(--text-muted, #6c6c78);
  font-style: italic;
}
.achievement-earned {
  border-color: #d4af37;
  background: linear-gradient(135deg, rgba(212,175,55,.08), rgba(212,175,55,.02));
}
.achievement-earned .achievement-icon {
  filter: drop-shadow(0 0 6px rgba(212,175,55,.6));
}
.achievement-locked {
  opacity: .55;
  filter: grayscale(.85);
}
.achievement-locked:hover { opacity: .8; }
.achievements-page { padding: 8px 0 32px; }
.achievements-header { margin-bottom: 18px; }
.achievements-subtitle { color: var(--text-secondary, #9a9aa8); }

/* ════════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE FIXES (v20260420g)
   - Topbar back button (mobile only)
   - Topbar header layout (icons no longer overflow / dropdowns scrollable)
   - Forum embedded album/track/playlist cards fit on narrow screens
   - Compact view: bigger covers + readable typography on phones
   ════════════════════════════════════════════════════════════════════════════ */

/* Back button: hidden on desktop; shown on mobile beside hamburger */
.topbar-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.topbar-back-btn:hover { background: var(--surface); }

/* Make sure embeds inside post bodies never overflow horizontally */
.post-body,
.message-content-view {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}
.post-body img,
.post-body video,
.post-body iframe { max-width: 100%; height: auto; }
.post-body .embedded-album,
.post-body .embedded-track,
.post-body .embedded-playlist,
.message-content-view .embedded-album,
.message-content-view .embedded-track,
.message-content-view .embedded-playlist {
  max-width: 100%;
  box-sizing: border-box;
}
.embedded-info { min-width: 0; }
.embedded-artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  /* ─── Topbar back button ───────────────────────────────────── */
  .topbar-back-btn {
    display: flex !important;
    flex: 0 0 auto;
  }

  /* ─── Topbar layout: keep .topbar as column (topbar-row above topbar_extra)
         and only force the inner row to be a single non-wrapping line ─── */
  .topbar-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .topbar .page-title {
    font-size: 14px;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
  }
  .topbar-user-actions {
    flex: 0 0 auto;
    margin-left: auto;
  }
  .topbar-icon-btn {
    position: relative;
    overflow: visible;
  }
  .topbar-badge {
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
    line-height: 16px;
    padding: 0 4px;
  }

  /* Bottom-sheet dropdowns: full-width sheet ABOVE the player, scrollable
     content with sticky header & footer. */
  .topbar-dropdown-menu {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    top: 64px !important;          /* just below the topbar */
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    border-radius: 14px !important;
    /* leave room for topbar (~64px) and player (~190px) and 16px padding */
    max-height: calc(100vh - 64px - 200px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 1000 !important;       /* above the player (z:100) */
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
    transform: translateY(-8px) !important;
  }
  .topbar-dropdown-menu.active {
    transform: translateY(0) !important;
  }
  .topbar-dropdown-menu .notifications-list,
  .topbar-dropdown-menu .user-menu-list,
  .topbar-dropdown-menu > .dropdown-section {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }
  .topbar-dropdown-menu .dropdown-header,
  .topbar-dropdown-menu .dropdown-footer-link {
    flex: 0 0 auto;
    background: var(--card);
  }
  .topbar-dropdown-menu .dropdown-footer-link {
    border-top: 1px solid var(--border);
  }

  /* ─── Forum embedded cards (album/track/playlist) ───────────────── */
  .embedded-album,
  .embedded-track,
  .embedded-playlist {
    padding: 10px;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: nowrap;
  }
  .embedded-cover {
    width: 56px;
    height: 56px;
    border-radius: 6px;
  }
  .embedded-title {
    font-size: 0.92rem;
  }
  .embedded-artist {
    font-size: 0.78rem;
  }
  .embedded-play-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  /* ─── Compact view: bigger cover, readable text, single column ─── */
  body[data-view="compact"] .album-card {
    display: grid !important;
    grid-template-columns: 110px 1fr;
    padding: 10px;
    gap: 12px;
    align-items: start;
    overflow: hidden;          /* never let content escape the card */
  }
  body[data-view="compact"] .album-cover-wrap {
    width: 110px;
    height: 110px;
    flex: none;
    margin: 0;
  }
  body[data-view="compact"] .album-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
  }
  body[data-view="compact"] .album-body {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
  }
  body[data-view="compact"] .album-title,
  body[data-view="compact"] .album-title-toggle {
    font-size: 14px !important;
    line-height: 1.3 !important;
    font-weight: 700;
    white-space: normal !important;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    margin: 0;
    text-align: left;
    width: 100%;
  }
  body[data-view="compact"] .album-title { display: block; margin: 0 0 2px; }
  body[data-view="compact"] .sub {
    font-size: 11px !important;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin: 0;
  }
  /* Hide the 6px dot separators that became unreadable */
  body[data-view="compact"] .sub span:nth-child(2n) { display: none !important; }
  body[data-view="compact"] .album-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
    flex-wrap: wrap;
  }
  body[data-view="compact"] .album-actions button {
    padding: 6px 8px !important;
    font-size: 13px !important;
    min-height: 34px;
    min-width: 34px;
    border-radius: 8px;
  }
  body[data-view="compact"] .album-download-row {
    margin-top: 4px;
  }
  body[data-view="compact"] .album-download-row .btn {
    font-size: 12px !important;
    padding: 8px 12px !important;
    min-height: 36px;
    width: 100%;
  }
  body[data-view="compact"] .track-details summary {
    font-size: 12px !important;
  }
}

/* Smaller phones: stack compact cards as cover-on-top for legibility */
@media (max-width: 420px) {
  body[data-view="compact"] .album-card {
    grid-template-columns: 1fr !important;
  }
  body[data-view="compact"] .album-cover-wrap {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    max-width: 260px;
    margin: 0 auto;
  }
  body[data-view="compact"] .album-cover {
    aspect-ratio: 1;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   MOBILE PLAYER REDESIGN (v20260420i)
   4-row stacked layout: now-playing │ progress │ main controls │ secondary
   Wins over earlier mobile rules via cascade order + targeted !important.
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 720px) {

  .player {
    /* override desktop 5-col grid with a clean stacked flex layout */
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
  }

  /* ─── Row 1: now-playing (cover + title + artist) ─── */
  .player .now-playing {
    order: 1;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .player .now-playing img {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 6px;
  }
  .player .now-playing > div {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }
  .player #playerTitle {
    font-size: 13px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .player .player-album-btn,
  .player #playerAlbum {
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
  }

  /* ─── Row 2: progress (times + bar full width) ─── */
  .player .player-progress {
    order: 2;
    width: 100%;
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    margin: 0;
  }
  .player .player-progress .progress-outer {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }
  .player .player-progress .progress-time.current {
    grid-column: 1;
    grid-row: 1;
    text-align: left;
  }
  .player .player-progress .progress-time.duration {
    grid-column: 3;
    grid-row: 1;
    text-align: right;
  }
  .player .player-progress .progress-percent {
    display: none;             /* redundant on mobile, save space */
  }
  .player .progress-time {
    font-size: 11px;
    min-width: 36px;
    color: var(--muted);
  }
  .player .progress-wrap {
    height: 6px;
  }
  .player .ab-marker {
    /* enlarge touch target without making the dot big */
    width: 14px;
    height: 14px;
  }
  .player .ab-marker .ab-label {
    font-size: 9px;
    padding: 1px 3px;
  }

  /* ─── Row 3: main transport controls, centered ─── */
  .player .controls {
    order: 3;
    width: 100%;
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 14px;
  }
  .player .controls button {
    width: 44px;
    height: 44px;
    font-size: 18px;
    border-radius: 50%;
  }
  .player #playPauseBtn {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }

  /* ─── Row 4: secondary actions (A↔B + ❤ + +) ─── */
  .player .player-actions {
    order: 4;
    width: 100%;
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .player .player-actions #playerLikeBtn,
  .player .player-actions #playerAddBtn,
  .player .player-actions #abDownloadBtn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    padding: 0;
    font-size: 16px;
    border-radius: 8px;
  }
  .player .player-actions .ab-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 8px;
  }

  /* Volume slider stays hidden on mobile — controlled by OS volume buttons */
  .player .volume-control {
    display: none !important;
  }
}

/* Very small phones: tighten further */
@media (max-width: 380px) {
  .player .controls { gap: 10px; }
  .player .controls button { width: 40px; height: 40px; font-size: 16px; }
  .player #playPauseBtn { width: 50px; height: 50px; font-size: 20px; }
  .player .player-actions { gap: 6px; }
  .player .player-actions .ab-btn { min-width: 56px; padding: 0 8px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   MOBILE HOMEPAGE POLISH (v20260420k)
   - Kill horizontal page scroll
   - Make album titles always wrap (no word can break the layout)
   - Polish DEFAULT/LIST/MADSONIC views on phones
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 720px) {
  /* No horizontal scroll, ever */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }
  .content, .main-wrap {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Long unbroken strings (album titles, filenames) must wrap */
  .album-title,
  .album-title-toggle,
  .album-card,
  .album-body {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* DEFAULT view on mobile: hero cover full width, info below */
  body:not([data-view]) .album-card,
  body[data-view=""] .album-card,
  body[data-view="grid"] .album-card,
  body[data-view="madsonic"] .album-card {
    padding: 12px;
    gap: 10px;
    border-radius: 14px;
  }
  body:not([data-view]) .album-cover-wrap,
  body[data-view=""] .album-cover-wrap,
  body[data-view="grid"] .album-cover-wrap,
  body[data-view="madsonic"] .album-cover-wrap {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
  }
  body:not([data-view]) .album-cover,
  body[data-view=""] .album-cover,
  body[data-view="grid"] .album-cover,
  body[data-view="madsonic"] .album-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  body:not([data-view]) .album-title,
  body[data-view=""] .album-title,
  body[data-view="grid"] .album-title,
  body[data-view="madsonic"] .album-title {
    font-size: 15px !important;
    line-height: 1.3;
    margin: 4px 0 2px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  body:not([data-view]) .sub,
  body[data-view=""] .sub,
  body[data-view="grid"] .sub,
  body[data-view="madsonic"] .sub {
    font-size: 12px;
    color: var(--muted);
    flex-wrap: wrap;
    gap: 4px 8px;
  }
  body:not([data-view]) .album-actions,
  body[data-view=""] .album-actions,
  body[data-view="grid"] .album-actions,
  body[data-view="madsonic"] .album-actions {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }
  body:not([data-view]) .album-actions button,
  body[data-view=""] .album-actions button,
  body[data-view="grid"] .album-actions button,
  body[data-view="madsonic"] .album-actions button {
    min-height: 36px;
    min-width: 36px;
    padding: 6px 10px;
    border-radius: 8px;
  }
  body:not([data-view]) .album-download-row .btn,
  body[data-view=""] .album-download-row .btn,
  body[data-view="grid"] .album-download-row .btn,
  body[data-view="madsonic"] .album-download-row .btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    min-height: 40px;
  }

  /* Albums grid: always single column on mobile (was already 1fr but enforce) */
  .albums-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  /* Hero/intro card on homepage (the big "Album da Telegram, stile Hufeland") */
  .hero, .home-hero, .intro-card {
    padding: 14px;
  }
  .hero h1, .home-hero h1, .intro-card h1 {
    font-size: 22px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
  .hero p, .home-hero p, .intro-card p {
    font-size: 13px;
  }

  /* ─── LIST view on mobile: stack title above sub, hide download text ─── */
  body[data-view="list"] .album-card {
    align-items: flex-start;
    padding: 8px 12px;
    min-height: 56px;
    gap: 10px;
  }
  body[data-view="list"] .album-cover-wrap {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }
  body[data-view="list"] .album-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 2px !important;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }
  body[data-view="list"] .album-body h2 {
    width: 100%;
    flex: none;
  }
  body[data-view="list"] .album-title {
    font-size: 14px !important;
    font-weight: 700;
    line-height: 1.25;
  }
  body[data-view="list"] .album-title-toggle {
    white-space: normal !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    text-align: left;
    width: 100%;
  }
  body[data-view="list"] .sub {
    font-size: 11px !important;
    flex-wrap: wrap;
    gap: 2px 8px;
    color: var(--muted);
  }
  body[data-view="list"] .album-download-row {
    flex-shrink: 0;
    align-self: center;
  }
  body[data-view="list"] .album-download-row .btn {
    font-size: 0;            /* hide "Scarica album (7z)" text */
    padding: 8px 10px !important;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
    line-height: 1;
  }
  body[data-view="list"] .album-download-row .btn::before {
    content: "↓";
    font-size: 18px;
    font-weight: 700;
  }

  /* ─── MINIMAL view on mobile: same treatment ─── */
  body[data-view="minimal"] .album-card {
    align-items: flex-start;
    padding: 10px 14px;
    gap: 12px;
  }
  body[data-view="minimal"] .album-cover-wrap {
    width: 56px;
    min-width: 56px;
    height: 56px;
    flex: none;
  }
  body[data-view="minimal"] .album-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }
  body[data-view="minimal"] .album-title {
    font-size: 14px !important;
    line-height: 1.3;
  }
  body[data-view="minimal"] .album-title-toggle {
    white-space: normal !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    text-align: left;
    width: 100%;
  }
  body[data-view="minimal"] .sub {
    font-size: 11px !important;
    flex-wrap: wrap;
    gap: 2px 8px;
  }
  body[data-view="minimal"] .album-download-row .btn {
    font-size: 0;
    padding: 8px 10px !important;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
    line-height: 1;
  }
  body[data-view="minimal"] .album-download-row .btn::before {
    content: "↓";
    font-size: 18px;
    font-weight: 700;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   GENERIC MODAL (used by review modal, etc.) — desktop + mobile
   ════════════════════════════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  overflow-y: auto;
}
.modal.active {
  display: flex;
}
.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.modal-close:hover {
  background: var(--surface);
  color: var(--text);
}
.modal-body {
  padding: 16px 18px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.modal-body form {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.modal-body textarea,
.modal-body input[type="text"],
.modal-body input[type="range"] {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}
.modal-body textarea {
  min-height: 120px;
  resize: vertical;
}

/* Mobile: full-screen sheet, comfortable touch targets */
@media (max-width: 720px) {
  .modal {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  .modal-content {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  .modal-header {
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  .modal-header h3 {
    font-size: 15px;
  }
  .modal-body {
    padding: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .modal-body textarea {
    min-height: 160px;
    font-size: 16px;       /* prevents iOS auto-zoom on focus */
    padding: 12px !important;
  }
  .modal-body input[type="range"] {
    height: 32px;          /* easier to grab */
  }
  .modal-body .btn,
  .modal-body button[type="submit"] {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 14px;
  }
  /* Stack action buttons full-width on mobile */
  .modal-body form > div[style*="justify-content:flex-end"],
  .modal-body form > div[style*="justify-content: flex-end"] {
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }
  .modal-body form > div[style*="justify-content:flex-end"] .btn,
  .modal-body form > div[style*="justify-content: flex-end"] .btn {
    width: 100%;
  }
}






/* ── Review button (.review-album-btn) — accent color, visible in compact ── */
.album-actions .review-album-btn {
  color: var(--accent, #00e6c8) !important;
  font-weight: 600;
}
.album-actions .review-album-btn:hover {
  background: rgba(0, 230, 200, 0.12);
  border-color: var(--accent, #00e6c8) !important;
}
.album-actions .review-album-btn .btn-rating {
  color: #ffd24a;
  font-weight: 600;
  margin-left: 4px;
}

/* ── Review modal: rich editor (forum-style) ── */
#reviewModal .modal-content { max-width: 760px; }
#reviewModal .editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg-2, #1a1a1a);
  border: 1px solid var(--border, #444);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  align-items: center;
}
#reviewModal .toolbar-group { display: inline-flex; gap: 2px; }
#reviewModal .toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border, #444);
  margin: 0 4px;
}
#reviewModal .toolbar-btn {
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  min-width: 28px;
}
#reviewModal .toolbar-btn:hover {
  background: rgba(0, 230, 200, 0.10);
  border-color: var(--accent, #00e6c8);
}
#reviewModal #reviewContent {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* ── Album info popover (anchored, metalarea-style) ─────────────────── */
.album-info-pop {
  position: absolute;
  z-index: 9999;
  max-width: 92vw;
  background: var(--bg-1, #15171c);
  color: var(--fg, #e7e9ee);
  border: 1px solid var(--accent, #00e6c8);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(0, 230, 200, 0.15);
  font-size: 13.5px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: auto;
}
.album-info-pop.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.album-info-pop .aip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 230, 200, 0.06);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}
.album-info-pop .aip-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.album-info-pop .aip-close {
  background: transparent;
  color: inherit;
  border: 0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.7;
}
.album-info-pop .aip-close:hover { opacity: 1; }
.album-info-pop .aip-body {
  padding: 10px 14px 12px;
  white-space: pre-wrap;
  max-height: 60vh;
  overflow: auto;
  word-break: break-word;
}
/* Sidebar Upload CTA: persistent green tint, but yields to .active */
.sidebar-link.sidebar-upload-cta {
  background: linear-gradient(135deg, rgba(0,230,200,.18), rgba(0,179,255,.12));
  border: 1px solid rgba(0,230,200,.35);
}
.sidebar-link.sidebar-upload-cta.active {
  background: rgba(0,230,200,.28);
  border-color: rgba(0,230,200,.55);
  color: var(--accent);
  font-weight: 700;
}
.sidebar-link.sidebar-upload-cta:not(.active):hover {
  background: linear-gradient(135deg, rgba(0,230,200,.28), rgba(0,179,255,.18));
}


/* =============================================================
   RESPONSIVE OVERHAUL v20260503c — deep mobile redesign.

   Goals:
   - Compact, "jewel-box" mobile UI: small icon-first buttons everywhere.
   - Player has minimize/expand toggle on every viewport.
   - Forum embeds (album/track/playlist) NEVER overflow on mobile.
   - Date pickers actually work on mobile (single, native, tap-to-open).
   - Forum action buttons stop stacking like fat full-width walls.
   - "Cerca nel forum" stays visible (compact icon + popover) on mobile.
   - History / Cronologia toolbar lays out cleanly.
   - Use Font Awesome where helpful (icons rendered via CSS classes).
   ============================================================= */

/* ---------- 1. PLAYER COLLAPSE BUTTON (all viewports) ---------- */
/* NB: il player base è già `position: fixed; bottom:0` (vedi `.player`
   regola principale ~riga 2435). Lo ri-affermiamo qui in modo esplicito
   perché la versione precedente lo metteva a `position: relative` per
   ancorare il bottone collapse — col risultato che il player spariva
   scrollando la pagina (regressione segnalata 2026-05-10).
   `position: fixed` crea comunque un containing-block per i figli con
   `position: absolute`, quindi il collapse-btn continua a funzionare. */
.player {
  position: fixed !important;
  bottom: 0; left: 0; right: 0;
}
.player-collapse-btn {
  position: absolute;
  top: -16px;
  right: 12px;
  width: 38px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  z-index: 5;
  padding: 0;
  box-shadow: 0 -2px 6px rgba(0,0,0,.18);
  transition: color .15s, background .15s, border-color .15s;
}
.player-collapse-btn:hover {
  color: var(--accent);
  background: rgba(0,230,200,.08);
  border-color: var(--accent);
}
.player-collapse-btn .pcb-icon {
  line-height: 1;
  font-family: "Segoe UI Symbol", system-ui, sans-serif;
}

.player.is-collapsed {
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-areas: "np ctl" !important;
  padding-top: 4px !important;
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)) !important;
  gap: 8px !important;
  min-height: 44px !important;
}
.player.is-collapsed .now-playing { grid-area: np; min-width: 0; }
.player.is-collapsed .controls    { grid-area: ctl; }
.player.is-collapsed .player-actions,
.player.is-collapsed .volume-control,
.player.is-collapsed .player-progress,
.player.is-collapsed .player-queue { display: none !important; }
.player.is-collapsed .now-playing img {
  width: 32px !important; height: 32px !important;
}
.player.is-collapsed #playerTitle {
  font-size: 12.5px !important; line-height: 1.25 !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player.is-collapsed .player-album-btn,
.player.is-collapsed #playerAlbum {
  font-size: 11px !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 60vw;
}
.player.is-collapsed .controls button {
  width: 32px !important; height: 32px !important;
  font-size: 13px !important;
}
.player.is-collapsed #playPauseBtn {
  width: 38px !important; height: 38px !important;
}

/* ---------- 2. EMBED CARDS — universal class, never overflow ---------- */
.embed-card,
.embedded-album,
.embedded-track,
.embedded-playlist {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-ground, #0f0f1a);
  border: 1px solid var(--border, #1f2630);
  border-radius: 10px;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;        /* hard stop overflow */
  margin: 6px 0;
}
.embed-cover,
.embedded-album > img,
.embedded-track > img,
.embedded-playlist > div:first-child {
  flex: 0 0 56px;
  width: 56px !important;
  height: 56px !important;
  border-radius: 6px;
  object-fit: cover;
}
.embed-meta,
.embedded-album > div:not(:last-child),
.embedded-track > div:not(:last-child),
.embedded-playlist > div:not(:first-child):not(:last-child) {
  flex: 1 1 auto;
  min-width: 0;            /* allows ellipsis inside flex */
  overflow: hidden;
}
.embed-kind {
  font-size: 0.72rem;
  color: var(--accent, #00e6c8);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 2px;
}
.embed-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.embed-sub {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.embed-play-btn {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--accent, #00e6c8);
  color: #001;
  font-size: 1.1rem;
  cursor: pointer;
}
.embed-play-btn:hover { filter: brightness(1.1); }

/* Force ellipsis on legacy inline-styled embeds too */
.embedded-album > div:not(:last-child) > div,
.embedded-track > div:not(:last-child) > div,
.embedded-playlist > div:not(:first-child):not(:last-child) > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ---------- 3. ALBUM/CARD .sub line wraps cleanly ---------- */
.album-card .sub,
.album-body .sub {
  flex-wrap: wrap;
  row-gap: 2px;
}

/* =============================================================
   MOBILE BREAKPOINT: ≤720px  — comprehensive redesign
   ============================================================= */
@media (max-width: 720px) {

  /* --- Topbar layout: wrapping with smaller targets --- */
  .topbar {
    padding: 6px 8px !important;
  }
  .topbar-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
    row-gap: 6px;
    align-items: center;
  }

  /* Menu + back: compact 32px squares */
  .menu-toggle, .topbar-back-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    font-size: 14px !important;
    padding: 0 !important;
    border-radius: 8px !important;
  }

  /* Forum quick-search in topbar: visible but compact (icon-only collapsed) */
  .topbar-search {
    flex: 1 1 0 !important;
    min-width: 0;
    max-width: none;
    margin: 0 !important;
    position: relative;
  }
  .topbar-search input[type="search"] {
    width: 100%;
    height: 34px;
    font-size: 12.5px;
    padding: 0 10px 0 30px;
    border-radius: 8px;
    background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2388a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 10px center;
    border: 1px solid var(--border);
  }
  .topbar-search input[type="search"]::placeholder {
    font-size: 12px;
    color: var(--text-muted);
  }

  /* User-actions cluster: tight, smaller icons */
  .topbar-user-actions {
    gap: 4px !important;
    margin-left: 0 !important;
    flex: 0 0 auto;
  }
  .topbar-icon-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 13.5px !important;
  }
  .topbar-icon-btn .topbar-badge {
    font-size: 9px !important;
    padding: 0 3px !important;
    min-width: 14px !important;
    height: 14px !important;
    line-height: 14px !important;
  }
  .topbar-lang-switch { gap: 3px !important; margin-right: 0 !important; }
  .topbar-lang-switch a { font-size: 15px !important; }
  .topbar-username, .dropdown-arrow { display: none !important; }
  .topbar-avatar { width: 28px !important; height: 28px !important; }
  .topbar-user-btn { padding: 2px !important; }

  /* Page title shouldn't crash the row when present */
  .topbar-row > .page-title,
  .topbar-row .page-title {
    flex: 1 1 100%;
    order: 1;
    font-size: 1rem !important;
    margin: 0 !important;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* History page: the input that comes from {% block topbar %} */
  .topbar-row > .page-controls {
    flex: 1 1 100%;
    order: 2;
  }
  .topbar-row > .page-controls .search-input {
    width: 100%;
    height: 34px;
    font-size: 13px;
    padding: 0 10px;
    border-radius: 8px;
  }

  /* --- Home search form: own row, MUCH more compact --- */
  .topbar-row > .search,
  .topbar-row > form.search {
    order: 99;
    flex: 0 0 100%;
    margin-top: 2px;
    gap: 6px !important;
    flex-wrap: wrap;
  }
  .topbar-row > .search .search-input-wrap {
    flex: 1 1 60%;
    min-width: 0;
  }
  .topbar-row > .search input[name="q"] {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 13px;
    height: 34px;
    padding: 0 10px;
  }
  .search-kind-toggle {
    padding: 4px 8px !important;
    flex: 0 0 auto;
  }
  .search-kind-toggle span {
    font-size: 11px !important;
  }

  /* Date pickers on mobile: ONE native, fully visible, tappable */
  .search .date-icon-wrap {
    width: auto !important;
    height: 34px !important;
    flex: 0 0 auto !important;
    position: relative !important;
  }
  /* Hide the "to" date entirely on phones */
  .search .date-icon-wrap:nth-of-type(2) { display: none !important; }
  /* Hide our overlay button + clear (we let the native input show) */
  .search .date-icon-wrap .date-icon-btn { display: none !important; }
  .search .date-icon-wrap .date-icon-clear {
    top: -2px !important;
    right: -2px !important;
    z-index: 4;
  }
  /* Make the native input itself the visible control */
  .search .date-icon-wrap .date-input {
    position: static !important;
    inset: auto !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 92px !important;
    height: 34px !important;
    padding: 0 4px !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    font-size: 11px !important;
    color-scheme: dark;
  }
  .search .date-icon-wrap.has-value .date-input {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
  }

  .search .sort-select {
    width: auto !important;
    min-width: 70px;
    height: 34px !important;
    padding: 0 6px !important;
    font-size: 11px !important;
  }
  .search-btn {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    font-size: 14px !important;
    flex: 0 0 auto;
  }
  .search .ghost { display: none !important; }
  .topbar-row > .search .search-suggest {
    width: 100% !important;
    max-width: 100% !important;
    left: 0; right: 0;
    top: 38px;
  }

  /* --- Toolbar (view-switch + theme) --- */
  .toolbar {
    gap: 6px !important;
    padding: 6px 0 !important;
    flex-wrap: wrap;
  }
  .view-switch {
    flex: 1 1 auto;
    gap: 4px !important;
    display: flex;
    flex-wrap: wrap;
  }
  .view-switch .pill {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 8px !important;
    font-size: 11.5px !important;
    height: 32px;
  }
  .toolbar #themeSelect {
    margin-left: 0 !important;
    flex: 0 0 auto;
    width: 90px !important;
    height: 32px !important;
    font-size: 11.5px !important;
    padding: 0 8px !important;
  }

  /* --- Player on mobile (when expanded) --- */
  .player {
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
      "np actions"
      "progress progress"
      "controls controls" !important;
    gap: 6px 8px !important;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    min-height: auto !important;
  }
  .player .now-playing       { grid-area: np; min-width: 0; }
  .player .player-actions    { grid-area: actions; gap: 4px; }
  .player .player-progress   { grid-area: progress; padding: 0; }
  .player .controls          { grid-area: controls; justify-self: center; }
  .player .volume-control    { display: none; }

  .player .now-playing img {
    width: 44px !important; height: 44px !important;
    border-radius: 6px;
  }
  .player #playerTitle {
    font-size: 13.5px !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .player .player-album-btn,
  .player #playerAlbum {
    font-size: 11.5px !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 55vw;
  }
  .player .controls { gap: 8px; }
  .player .controls button {
    width: 38px !important; height: 38px !important;
    font-size: 14px !important;
  }
  .player #playPauseBtn {
    width: 46px !important; height: 46px !important;
    font-size: 18px !important;
  }
  .player .player-action-btn {
    width: 32px !important; height: 32px !important;
    font-size: 13px !important;
  }
  .player .progress-time { font-size: 10.5px; min-width: 32px; }
  .player .progress-percent { display: none; }

  /* Reserve enough page bottom padding for the player */
  body { padding-bottom: 0 !important; }
  .content { padding-bottom: 200px !important; }
  body:has(.player.is-collapsed) .content { padding-bottom: 64px !important; }

  /* --- Embed cards on small screens --- */
  .embed-card,
  .embedded-album,
  .embedded-track,
  .embedded-playlist {
    padding: 8px !important;
    gap: 10px !important;
  }
  .embed-cover,
  .embedded-album > img,
  .embedded-track > img,
  .embedded-playlist > div:first-child {
    flex: 0 0 48px !important;
    width: 48px !important;
    height: 48px !important;
  }
  .embed-title,
  .embedded-album .embed-title,
  .embedded-track .embed-title {
    font-size: 0.88rem !important;
  }
  .embed-sub { font-size: 0.75rem !important; }
  .embed-play-btn {
    width: 32px !important; height: 32px !important;
    font-size: 0.95rem !important;
  }

  /* Hero / intro card on home */
  .hero, .intro-card {
    padding: 14px 16px !important;
    margin: 0 0 14px !important;
  }
  .hero h1, .intro-card h1, .intro-card h2 {
    font-size: 1.3rem !important;
    line-height: 1.2 !important;
  }

  /* Forum: compact action bars on mobile */
  .forum-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 14px 14px !important;
  }
  .forum-header-content h1 {
    font-size: 1.4rem !important;
    line-height: 1.2 !important;
  }
  .forum-header > .btn,
  .forum-header > a.btn {
    align-self: flex-start;
    padding: 8px 14px !important;
    font-size: 13px !important;
  }
  .forum-header-actions,
  .forum-actionbar,
  .forum-actionbar-links {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center;
    gap: 6px !important;
  }
  .forum-header-actions .btn,
  .forum-actionbar .btn,
  .forum-actionbar-links .btn {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 7px 11px !important;
    font-size: 12.5px !important;
    height: 34px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    border-radius: 8px !important;
  }
  .forum-actionbar {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .forum-actionbar-search {
    display: flex;
    gap: 6px;
    width: 100%;
  }
  .forum-actionbar-search input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 34px;
    font-size: 12.5px;
    padding: 0 10px;
  }
  .forum-actionbar-search .btn {
    flex: 0 0 auto;
    padding: 0 12px !important;
    font-size: 12.5px !important;
  }
  .forum-actionbar-links {
    justify-content: flex-start;
  }

  /* Topic / single thread page polish */
  .topic-actions, .post-actions {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .topic-actions .btn, .post-actions .btn,
  .topic-actions button, .post-actions button {
    padding: 6px 10px !important;
    font-size: 12px !important;
    height: 32px !important;
  }

  /* Edit page: heading shouldn't take half the screen */
  .container > h1, .forum-container h1 {
    font-size: 1.4rem !important;
    line-height: 1.2 !important;
    margin-bottom: 10px !important;
  }

  /* Library / favorites grid */
  .library-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .library-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .library-controls .btn {
    flex: 1 1 auto;
    padding: 8px 10px !important;
    font-size: 12.5px !important;
    min-width: 0;
  }

  /* History rows: tighter */
  .history-row {
    padding: 8px !important;
    gap: 8px !important;
  }
  .history-row .history-cover {
    width: 44px !important; height: 44px !important;
  }
  .history-row .row-actions {
    gap: 4px !important;
  }
  .history-row .row-actions button,
  .history-row .row-actions .btn {
    width: 30px !important;
    height: 30px !important;
    font-size: 13px !important;
    padding: 0 !important;
  }

  /* Generic .btn shrink on mobile */
  .btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .btn-sm {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* =============================================================
   ULTRA-SMALL BREAKPOINT: ≤420px  — squeeze further
   ============================================================= */
@media (max-width: 420px) {

  .topbar-search input[type="search"] {
    font-size: 12px;
    padding-left: 26px;
  }
  .topbar-icon-btn { width: 30px !important; height: 30px !important; font-size: 12.5px !important; }
  .topbar-lang-switch a { font-size: 14px !important; }
  .topbar-avatar { width: 26px !important; height: 26px !important; }

  .topbar-row > .search input[name="q"] { font-size: 12px; }
  .search-kind-toggle span { font-size: 10.5px !important; }
  .search .date-icon-wrap .date-input { width: 84px !important; font-size: 10.5px !important; }
  .search .sort-select { min-width: 60px; font-size: 10.5px !important; }

  .view-switch .pill { padding: 5px 6px !important; font-size: 11px !important; }
  .toolbar #themeSelect { width: 82px !important; font-size: 11px !important; }

  .player .now-playing img { width: 38px !important; height: 38px !important; }
  .player .controls button {
    width: 34px !important; height: 34px !important;
  }
  .player #playPauseBtn { width: 42px !important; height: 42px !important; }
  .player .player-action-btn {
    width: 28px !important; height: 28px !important;
    font-size: 11.5px !important;
  }
  .player .player-actions .ab-btn {
    min-width: 48px !important;
    padding: 0 6px !important;
  }

  .embed-cover { flex: 0 0 42px !important; width: 42px !important; height: 42px !important; }
  .embed-title { font-size: 0.82rem !important; }
  .embed-sub { font-size: 0.7rem !important; }

  .forum-header-content h1 { font-size: 1.2rem !important; }
  .forum-header-actions .btn,
  .forum-actionbar-links .btn { padding: 6px 9px !important; font-size: 11.5px !important; height: 32px !important; }
}


/* Mobile library pages: prefer multi-line titles over ellipsis. */
@media (max-width: 768px) {
  .favorite-title,
  .favorite-artist,
  .download-title,
  .download-artist,
  .download-meta,
  .liked-title,
  .liked-artist,
  .liked-album a,
  .history-title,
  .history-artist,
  .history-album a,
  .track-download-row .track-title,
  .track-download-row .track-album-link {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.26;
  }

  .favorite-title,
  .download-title,
  .liked-title,
  .history-title,
  .track-download-row .track-title {
    font-size: 13.5px !important;
  }

  .favorite-artist,
  .download-artist,
  .liked-artist,
  .history-artist,
  .track-download-row .track-album-link {
    font-size: 12.5px !important;
  }
}


/* ════════════════════════════════════════════════════════════════════
   VLC STREAM POPOVER — bottone 📡 nelle action-bar dell'album.
   Mostra l'URL assoluto della playlist M3U/XSPF da incollare in
   "VLC ▸ Media ▸ Apri flusso di rete" + scorciatoie download.
   ════════════════════════════════════════════════════════════════════ */
.vlc-stream-btn {
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; min-width: 70px; gap: 6px;
  border-radius: 999px; font-weight: 800;
}
.vlc-stream-popover {
  z-index: 10000;
  width: 360px; max-width: 92vw;
  background: var(--card, #161b26);
  border: 1px solid var(--accent, #00e6c8);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 24px rgba(0,230,200,.18);
  padding: 14px 14px 12px;
  color: var(--text, #e6edf3);
  font-size: 13px;
  animation: vlcPopIn .14s ease-out;
}
@keyframes vlcPopIn { from { opacity:0; transform: translateY(-4px); } to { opacity:1; transform:none; } }
.vlc-pop-title {
  font-weight: 700; font-size: 14px; color: var(--accent, #00e6c8);
  margin-bottom: 6px;
}
.vlc-pop-hint { color: var(--text-dim, #9aa6b2); font-size: 12px; margin-bottom: 8px; }
.vlc-pop-foot { margin-top: 10px; margin-bottom: 0; opacity: .75; }
.vlc-pop-row { display: flex; gap: 6px; margin-bottom: 10px; }
.vlc-pop-url {
  flex: 1; min-width: 0;
  background: var(--bg, #0d1117);
  border: 1px solid var(--border, #2a3540);
  color: var(--text, #e6edf3);
  border-radius: 6px; padding: 6px 8px; font-family: ui-monospace, monospace;
  font-size: 11.5px;
}
.vlc-pop-copy {
  background: var(--accent, #00e6c8); color: #001a17;
  border: none; border-radius: 6px; font-weight: 700; cursor: pointer;
  padding: 0 12px; font-size: 12px;
}
.vlc-pop-copy:hover { filter: brightness(1.08); }
.vlc-pop-actions { display: flex; gap: 8px; }
.vlc-pop-dl {
  flex: 1; text-align: center;
  background: rgba(0,230,200,.10);
  border: 1px solid var(--accent, #00e6c8);
  color: var(--accent, #00e6c8);
  text-decoration: none; padding: 6px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
}
.vlc-pop-dl:hover { background: rgba(0,230,200,.20); }
