*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0d0d;
  --bg-card: #1a1a1a;
  --bg-hover: #252525;
  --bg-sidebar: #111;
  --bg-player: #141414;
  --text: #e0e0e0;
  --text-dim: #888;
  --accent: #00b4d8;
  --accent-hover: #48cae4;
  --border: #2a2a2a;
  --header-h: 48px;
  --player-h: 64px;
  --sidebar-w: 240px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

/* Header */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 100;
}

#header h1 {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

#header h1 a {
  color: var(--text);
}
#header h1 a:hover {
  color: var(--accent);
}

.search-wrapper {
  flex: 1;
  max-width: 400px;
}

#search-input {
  width: 100%;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
#search-input:focus {
  border-color: var(--accent);
}
#search-input::placeholder {
  color: var(--text-dim);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* Layout */
#layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  margin-top: var(--header-h);
  height: calc(100vh - var(--header-h));
}

body.player-visible #layout {
  height: calc(100vh - var(--header-h) - var(--player-h));
}

/* Sidebar */
#sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px 0;
}

.artist-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.artist-link:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.artist-link.active {
  background: var(--bg-hover);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.artist-count {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 10px;
}

/* Main content */
#content {
  overflow-y: auto;
  padding: 24px;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-dim);
  font-size: 16px;
}

/* Home: artist grid */
.artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.artist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.artist-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.artist-card-name {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.artist-card-count {
  font-size: 13px;
  color: var(--text-dim);
}

/* Artist view */
.artist-header {
  margin-bottom: 20px;
}

.artist-header h2 {
  font-size: 22px;
  margin-bottom: 4px;
}

.artist-aliases {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 12px;
}

.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters select {
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

.set-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.set-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
}
.set-row:hover {
  background: var(--bg-hover);
}

.set-row-title {
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.set-row-date, .set-row-venue {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Set detail view */
.set-detail {
  max-width: 800px;
}

.set-detail h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.set-meta {
  color: var(--text-dim);
  margin-bottom: 20px;
  font-size: 13px;
}
.set-meta span {
  margin-right: 16px;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 13px;
}

.file-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 500;
}

.file-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.file-table tr:hover td {
  background: var(--bg-hover);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: var(--accent-hover);
}
.btn-small {
  padding: 2px 8px;
  font-size: 11px;
}

.tracklist-section {
  margin-top: 24px;
}

.tracklist-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.tracklist-raw {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

/* Cue/track list with clickable items */
.track-list {
  list-style: none;
}

.track-item {
  display: flex;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
}
.track-item:hover {
  background: var(--bg-hover);
}
.track-item.active {
  background: var(--bg-hover);
  color: var(--accent);
}

.track-num {
  color: var(--text-dim);
  min-width: 24px;
  text-align: right;
}

.track-time {
  color: var(--accent);
  min-width: 48px;
  font-family: monospace;
}

.track-title {
  flex: 1;
}

/* Search results */
.search-header {
  margin-bottom: 16px;
  color: var(--text-dim);
}

.search-result {
  padding: 12px 14px;
  background: var(--bg-card);
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.1s;
}
.search-result:hover {
  background: var(--bg-hover);
}

.search-result-title {
  font-weight: 500;
  margin-bottom: 2px;
}

.search-result-meta {
  font-size: 12px;
  color: var(--text-dim);
}

/* Audio Player */
.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--player-h);
  background: var(--bg-player);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px;
  z-index: 100;
}

.player.hidden {
  display: none;
}

.player-info {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.player-title {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.player-btn:hover {
  color: var(--accent);
}

.play-btn {
  font-size: 20px;
}

.time {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-dim);
  min-width: 40px;
  text-align: center;
}

.seek-bar {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.seek-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.volume-bar {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.volume-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  cursor: pointer;
}

.volume-bar::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  cursor: pointer;
  border: none;
}

/* Error */
.error-msg {
  background: #3a1c1c;
  color: #f88;
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  #layout {
    grid-template-columns: 1fr;
  }

  #sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0,0,0,0.5);
    z-index: 89;
  }

  #content {
    padding: 16px;
  }

  .artist-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .set-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .volume-bar {
    display: none;
  }

  .player-controls {
    gap: 4px;
  }
}
