:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --bg-hover: #1a1a1a;
  --bg-active: #222222;
  --accent: #ffffff;
  --accent-hover: #cccccc;
  --accent-dim: rgba(255, 255, 255, 0.06);
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --text-muted: #555555;
  --border: #1c1c1c;
  --danger: #ff4444;
  --danger-dim: rgba(255, 68, 68, 0.1);
  --success: #44ff88;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar-width: 230px;
  --player-height: 84px;
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* AUTH */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #000000 0%, #0a0a0a 50%, #000000 100%);
}

.auth-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 380px;
  text-align: center;
}

.auth-logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 32px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

.auth-tab.active {
  background: var(--accent);
  color: #000;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}

.auth-form input:focus {
  border-color: var(--accent);
}

.auth-form button {
  padding: 12px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  margin-top: 4px;
}

.auth-form button:hover { background: var(--accent-hover); color: #000; }

.auth-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

/* LAYOUT */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr var(--player-height);
  height: 100vh;
}

/* SIDEBAR */
#sidebar {
  grid-row: 1 / 3;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow: hidden;
}

.sidebar-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  padding: 0 20px;
  margin-bottom: 28px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-link svg { flex-shrink: 0; }

.sidebar-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 0 10px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* CONTENT */
#content {
  overflow-y: auto;
  padding: 28px 32px;
  padding-bottom: 32px;
}

/* PLAYER BAR */
#player-bar {
  display: grid;
  grid-template-columns: 240px 1fr 200px;
  align-items: center;
  padding: 0 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  gap: 16px;
}

.player-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player-cover {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.player-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-cover svg { color: var(--text-muted); }

.player-text { min-width: 0; }

.player-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-artist {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-play:hover { transform: scale(1.05); }

.btn-play svg { margin-left: 2px; }

.player-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 600px;
}

.time-current, .time-total {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.progress-bar, .volume-bar {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-active);
  border-radius: 2px;
  outline: none;
  flex: 1;
  cursor: pointer;
}

.progress-bar::-webkit-slider-thumb, .volume-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.progress-bar:hover::-webkit-slider-thumb, .volume-bar:hover::-webkit-slider-thumb {
  opacity: 1;
}

.progress-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-primary);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.progress-bar:hover::-moz-range-thumb {
  opacity: 1;
}

.progress-bar::-moz-range-track {
  height: 4px;
  background: var(--bg-active);
  border-radius: 2px;
}

.volume-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-primary);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.volume-bar:hover::-moz-range-thumb {
  opacity: 1;
}

.player-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume-bar { width: 90px; }

/* BUTTONS */
.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-icon.active { color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: var(--transition);
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); color: #000; }

.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger { background: var(--danger-dim); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm { padding: 6px 10px; font-size: 12px; }

/* CARDS / SECTIONS */
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.section-subtitle {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

/* Stat cards — clean style on home */
.stat-card {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* TRACK LIST */
.track-list-header, .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
  width: 240px;
  transition: var(--transition);
}

.search-input:focus { border-color: var(--accent); }

.sort-select {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
  cursor: pointer;
}

.track-table {
  width: 100%;
  border-collapse: collapse;
}

.track-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.track-table td {
  padding: 12px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.track-table tr {
  cursor: pointer;
  transition: var(--transition);
}

.track-table tbody tr:hover {
  background: var(--bg-hover);
}

.track-table tbody tr.playing {
  background: var(--accent-dim);
}

.track-table .col-cover { width: 56px; padding-right: 0; }
.track-table .col-cover img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; display: block; }
.track-table .col-cover svg { color: var(--text-muted); }
.track-table .col-cover .cover-cell { width: 44px; height: 44px; border-radius: 6px; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.track-table .col-num { width: 40px; text-align: center; color: var(--text-muted); }
.track-table .col-title { font-weight: 500; }
.track-table .col-artist { color: var(--text-secondary); }
.track-table .col-album { color: var(--text-secondary); }
.track-table .col-duration { width: 60px; color: var(--text-muted); text-align: right; }
.track-table .col-actions { width: 100px; text-align: right; }

.track-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.15s;
}

.track-table tbody tr:hover .track-actions { opacity: 1; }

/* HORIZONTAL TRACK CARDS */
.track-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 24px;
}

/* Track cards — clean style on home */
.track-card {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  min-width: 160px;
  max-width: 160px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.track-card:hover { background: var(--bg-hover); transform: translateY(-2px); }

.track-card-cover {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.track-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.track-card-cover svg { color: var(--text-muted); }

.track-card-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-card-artist {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* PLAYLISTS */
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.playlist-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.playlist-card:hover { background: var(--bg-hover); transform: translateY(-2px); }

.playlist-card-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.playlist-card-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* QUEUE PANEL */
.queue-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: var(--player-height);
  width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.queue-header h3 { font-size: 16px; font-weight: 600; }

.queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.queue-item:hover { background: var(--bg-hover); }
.queue-item.active { background: var(--accent-dim); }

.queue-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-artist {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-num {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 20px;
  text-align: center;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  min-width: 380px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form label {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-form input, .modal-form textarea {
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}

.modal-form input:focus, .modal-form textarea:focus {
  border-color: var(--accent);
}

.modal-form textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.cover-edit-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.cover-edit-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.cover-edit-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-edit-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.upload-zone svg { margin-bottom: 8px; }
.upload-zone p { font-size: 14px; }
.upload-zone span { font-size: 12px; color: var(--text-muted); }

.remote-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  background: var(--danger-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.4;
}
.remote-warning svg { flex-shrink: 0; margin-top: 1px; }

/* STORAGE BROWSER */
.storage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}

.storage-item:hover { background: var(--bg-hover); }

.storage-item-name {
  font-size: 13px;
  flex: 1;
}

.storage-item-size {
  font-size: 12px;
  color: var(--text-muted);
}

/* DEVICE CARDS */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.device-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.device-card-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.device-card-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.device-card-playing {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.device-card-controls {
  display: flex;
  gap: 4px;
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: calc(var(--player-height) + 16px);
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
  max-width: 360px;
}

.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--success); color: var(--success); }

@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg { margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* INLINE TAG */
.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-right: 4px;
}

/* STORAGE / CONNECTION */
.storage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.storage-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.storage-entry-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.storage-entry-name { font-weight: 500; font-size: 14px; }
.storage-entry-type { font-size: 12px; color: var(--text-muted); }

/* FILE BROWSER */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 13px;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-muted); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.checkbox-label input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

.btn-accent {
  background: var(--accent);
  color: #000;
  border: none;
}
.btn-accent:hover { background: var(--accent-hover); color: #000; }

.sync-progress {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
}

.sync-result {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 14px;
  text-align: center;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
    --player-height: 64px;
  }
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr var(--player-height); height: calc(100vh - 56px); }
  #sidebar { display: none; }
  #content { padding: 16px 14px; padding-bottom: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #player-bar {
    grid-template-columns: 1fr auto;
    padding: 0 10px;
    gap: 8px;
  }
  .player-track-info {
    display: flex;
    min-width: 0;
  }
  .player-cover { width: 42px; height: 42px; }
  .player-text { min-width: 0; }
  .player-title { font-size: 12px; }
  .player-artist { font-size: 11px; }
  .player-controls { display: none; }
  .player-right { display: none; }
  .player-track-actions { display: none !important; }
  .player-mobile-controls {
    display: flex !important;
    align-items: center;
    gap: 4px;
  }
  .mobile-nav {
    display: flex !important;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .toolbar-left, .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }
  .search-input { width: 100%; }
  .section-title { font-size: 18px; }
  .track-table .col-album, .track-table th:nth-child(6) { display: none; }
  .track-table .col-actions, .track-table th:last-child { display: none; }
  .track-table td { padding: 8px 6px; font-size: 12px; }
  .track-table th { padding: 6px; font-size: 10px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10px; }
  .queue-panel, .device-panel { width: 100%; }
  .modal { min-width: auto; width: calc(100vw - 24px); padding: 20px; }
  .fullscreen-view .fs-cover { width: 260px; height: 260px; }
  .fs-content { padding: 20px; }
  .fs-title { font-size: 18px; }
  .fs-close { top: 16px; left: 16px; }
  .fs-top-right { top: 16px; right: 16px; }
  .track-cards { gap: 8px; }
  .track-card { min-width: 130px; max-width: 130px; padding: 10px; }
  .playlist-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .device-grid { grid-template-columns: 1fr; }
  .toast-container { bottom: calc(var(--player-height) + 60px); left: 16px; right: 16px; }
}

/* Mobile bottom navigation */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  z-index: 600;
  justify-content: space-around;
  padding: 4px 0 env(safe-area-inset-bottom, 4px);
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item svg { width: 20px; height: 20px; }

/* FULLSCREEN NOW PLAYING */
.fullscreen-view {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.fullscreen-view.active {
  opacity: 1;
  pointer-events: all;
}

.fs-bg {
  position: absolute;
  inset: -20%;
  overflow: hidden;
  z-index: 0;
}

/* Fullscreen background — varied shapes */
.fs-blob {
  position: absolute;
  filter: blur(100px);
  opacity: 0.5;
}
.fs-blob:nth-child(1) { border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%; width: 45vw; height: 45vw; top: -5%; left: -10%; animation: fsFloat1 8s ease-in-out infinite alternate; }
.fs-blob:nth-child(2) { border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%; width: 40vw; height: 40vw; bottom: -5%; right: -10%; animation: fsFloat2 10s ease-in-out infinite alternate; }
.fs-blob:nth-child(3) { border-radius: 30% 70% 50% 50% / 40% 50% 50% 60%; width: 35vw; height: 35vw; bottom: 10%; left: 20%; animation: fsFloat3 12s ease-in-out infinite alternate; }
.fs-blob:nth-child(4) { border-radius: 50% 30% 60% 40% / 70% 40% 60% 30%; width: 30vw; height: 30vw; top: 15%; right: 20%; animation: fsFloat4 9s ease-in-out infinite alternate; }
.fs-blob:nth-child(5) { border-radius: 45% 55% 40% 60% / 55% 45% 55% 45%; width: 25vw; height: 25vw; top: 50%; left: 50%; transform: translate(-50%, -50%); animation: fsFloat5 11s ease-in-out infinite alternate; opacity: 0.3; }

@keyframes fsFloat5 { from { transform: translate(-50%, -50%) scale(1) rotate(0deg); } to { transform: translate(-30%, -40%) scale(1.3) rotate(45deg); } }

@keyframes fsFloat1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(25%, 20%) scale(1.2); } }
@keyframes fsFloat2 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-20%, -25%) scale(1.15); } }
@keyframes fsFloat3 { from { transform: translate(0, 0) scale(1); } to { transform: translate(15%, -20%) scale(1.25); } }
@keyframes fsFloat4 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-25%, 15%) scale(1.1); } }

.fs-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  width: 100%;
  max-width: 420px;
  padding: 32px;
}

.fs-cover {
  width: 300px;
  height: 300px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fs-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fs-cover svg { color: #333; }

.fs-title {
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.fs-artist {
  font-size: 15px;
  color: rgba(255,255,255,0.6);
  margin-top: -8px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.fs-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.fs-progress .progress-bar {
  flex: 1;
}

.fs-progress .fs-time {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  min-width: 40px;
  font-variant-numeric: tabular-nums;
}

.fs-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 4px;
}

.fs-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.2s;
}

.fs-play:hover { transform: scale(1.06); background: #ddd; }

.fs-controls .btn-icon {
  color: rgba(255,255,255,0.7);
  padding: 10px;
}

.fs-controls .btn-icon:hover { color: #fff; background: rgba(255,255,255,0.1); }

.fs-close {
  position: absolute;
  top: 24px;
  left: 24px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-size: 20px;
  transition: background 0.2s;
  backdrop-filter: blur(10px);
}

.fs-close:hover { background: rgba(255,255,255,0.2); }

/* ARTIST GRID */
.artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.artist-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.artist-card:hover { background: var(--bg-hover); transform: translateY(-2px); }

.artist-card-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist-card-count {
  font-size: 12px;
  color: var(--text-muted);
}

.artist-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
  overflow: hidden;
}

.artist-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-toggle-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.view-toggle-btn.active {
  background: var(--accent);
  color: #000;
}

.player-track-info {
  cursor: pointer;
}

/* Player track actions */
.player-track-actions {
  display: flex;
  gap: 2px;
  margin-left: 4px;
  flex-shrink: 0;
}

/* Device panel */
.device-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: var(--player-height);
  width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.device-item:hover { background: var(--bg-hover); }
.device-item.active-output { background: var(--accent-dim); }
.device-item-name { font-size: 13px; font-weight: 500; flex: 1; }
.device-item-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--accent); color: #000; font-weight: 600; }

/* Fullscreen top-right actions */
.fs-top-right {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.fs-top-right .btn-icon {
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.1);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  backdrop-filter: blur(10px);
}
.fs-top-right .btn-icon:hover {
  color: #fff;
  background: rgba(255,255,255,0.2);
}

/* Batch selection */
.batch-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent);
  color: #000;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 500;
}
.batch-toolbar .btn {
  background: rgba(0,0,0,0.2);
  color: #000;
  font-weight: 600;
}
.batch-toolbar .btn:hover {
  background: rgba(0,0,0,0.3);
}
.batch-toolbar .batch-count { flex: 1; }

/* Checkbox — hidden by default, shown on hover or batch mode */
.track-table .col-select {
  width: 32px;
  text-align: center;
}
.track-table .col-select input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.track-table thead .col-select input[type="checkbox"] { opacity: 0; }
.track-table tbody tr:hover .col-select input[type="checkbox"],
.track-table .col-select input[type="checkbox"]:checked,
.track-table.batch-active .col-select input[type="checkbox"] {
  opacity: 1;
}
.track-table.batch-active thead .col-select input[type="checkbox"] {
  opacity: 1;
}

/* Download button in track actions */
.act-download {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Drag reorder in playlists */
.track-table tbody tr.dragging {
  opacity: 0.4;
  background: var(--bg-active);
}
.track-table tbody tr.drag-over {
  border-top: 2px solid var(--accent);
}
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  touch-action: none;
}
.drag-handle:active { cursor: grabbing; }

/* Sidebar logo flex */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo svg { flex-shrink: 0; }
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.auth-logo svg { flex-shrink: 0; }

/* Admin panel styles */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.admin-table td {
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.admin-table .role-select {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}
.admin-table .role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.role-badge.admin { background: var(--accent-dim); color: var(--accent); }
.role-badge.user { background: var(--bg-tertiary); color: var(--text-secondary); }

/* Mobile player touch target */
@media (max-width: 768px) {
  .player-track-info {
    cursor: pointer;
    flex: 1;
    min-width: 0;
  }
  #player-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
