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

:root {
  --bg: #0d0d0f;
  --bg-surface: #141416;
  --bg-raised: #1a1a1e;
  --bg-hover: #202024;
  --accent: #c084fc;
  --accent-dim: #7c3aed;
  --accent-glow: rgba(192, 132, 252, 0.08);
  --text-primary: #f0edf6;
  --text-secondary: #9b96a8;
  --text-muted: #5c5868;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.13);
  --lost-text: #c97b7b;
  --lost-badge: rgba(201, 123, 123, 0.12);
  --font-sans: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", monospace;
  --sidebar-w: 350px;
  --content-w: 1160px;
  --support-w: 360px;
}

html {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

body {
  min-height: 100vh;
}

/* scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Layout ── */
.layout {
  max-width: calc(var(--sidebar-w) + var(--content-w) + 4rem);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 4rem;
  align-items: start;
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  padding: 2.5rem 0;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

.crumb {
  font-family: var(--font-mono);
  font-size: 12px;
}
.crumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.crumb a:hover {
  color: var(--accent);
}

h1 {
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text-primary);
  text-transform: lowercase;
}

.lede {
  margin-top: 1rem;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Stats ── */
.stats {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}
.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.stat-row dt {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.stat-row dd {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Search ── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  pointer-events: none;
}
#search {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem 0.6rem 2.1rem;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition:
    border-color 0.15s,
    background 0.15s;
}
#search::placeholder {
  color: var(--text-muted);
}
#search:hover {
  border-color: var(--border-hover);
}
#search:focus {
  border-color: rgba(192, 132, 252, 0.45);
  background: var(--bg-raised);
}

/* ── Genre filters ── */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.filter-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.genre-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.genre-filter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}
.genre-filter:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.genre-filter.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-color: rgba(192, 132, 252, 0.4);
}

/* ── Sidebar footer ── */
.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Content ── */
.content {
  min-width: 0;
  padding: 2.5rem 0 6rem;
}

.content-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--support-w);
  gap: 2.5rem;
  align-items: start;
}

.archive-col {
  min-width: 0;
}

.support-col {
  position: sticky;
  top: 2.5rem;
}

.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.results-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.toggle-all {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.toggle-all:hover {
  color: var(--accent);
  border-color: rgba(192, 132, 252, 0.35);
}

/* archive list */
.archive {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.era {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  position: relative;
}
.era::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 10px 0 0 10px;
  opacity: 0;
  transition: opacity 0.2s;
}
.era:hover {
  border-color: var(--border-hover);
}
.era.open {
  border-color: rgba(192, 132, 252, 0.25);
  box-shadow: 0 0 0 1px rgba(192, 132, 252, 0.08);
}
.era.open::before {
  opacity: 1;
}

.era-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem 1rem 1.5rem;
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  color: inherit;
  transition: background 0.15s;
}
.era-header:hover {
  background: var(--bg-hover);
}

.era-year {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 48px;
  transition: color 0.2s;
}
.era.open .era-year {
  color: var(--accent);
}

.era-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  flex-wrap: wrap;
}
.era-count {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-raised);
  padding: 2px 8px;
  border-radius: 4px;
}
.era-genres {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.genre-pill {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(192, 132, 252, 0.2);
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.era-chevron {
  color: var(--text-muted);
  transition:
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.2s;
  flex-shrink: 0;
  display: flex;
}
.era.open .era-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.era-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.era.open .era-body {
  max-height: 4000px;
}

.track-list {
  border-top: 1px solid var(--border);
  list-style: none;
}

.track-item {
  display: grid;
  grid-template-columns: 2rem 1fr auto auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.track-item:last-child {
  border-bottom: none;
}
.track-item:hover {
  background: var(--bg-hover);
}
.track-item.is-lost {
  opacity: 0.55;
}
.track-item.is-hidden {
  display: none;
}

.track-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.track-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.track-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-item.is-lost .track-title {
  color: var(--text-secondary);
}

mark {
  background: rgba(192, 132, 252, 0.3);
  color: inherit;
  border-radius: 2px;
}

.track-sub {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.track-genre {
  color: var(--text-secondary);
}

.track-dur {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
}

.lost-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lost-text);
  background: var(--lost-badge);
  border: 1px solid rgba(201, 123, 123, 0.2);
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}

.dl-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent);
  text-decoration: none;
  background: var(--accent-glow);
  border: 1px solid rgba(192, 132, 252, 0.25);
  padding: 4px 10px;
  border-radius: 4px;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
  white-space: nowrap;
}
.dl-btn:hover {
  background: rgba(192, 132, 252, 0.18);
  border-color: rgba(192, 132, 252, 0.55);
  color: #d8b4fe;
}

.yt-btn {
  color: #e88a8a;
  background: rgba(232, 138, 138, 0.08);
  border: 1px solid rgba(232, 138, 138, 0.25);
}
.yt-btn:hover {
  background: rgba(232, 138, 138, 0.16);
  border-color: rgba(232, 138, 138, 0.5);
  color: #f2a8a8;
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
  font-size: 14px;
}

.support-card {
  border: 1px solid rgba(192, 132, 252, 0.18);
  border-radius: 12px;
  background: var(--bg-surface);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 0 40px rgba(192, 132, 252, 0.05);
}

.support-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.support-icon {
  font-size: 14px;
  color: var(--accent);
}

.support-divider {
  height: 1px;
  background: var(--border);
}

.support-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.kofi-frame-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(192, 132, 252, 0.22);
  background: linear-gradient(
    160deg,
    rgba(192, 132, 252, 0.1),
    rgba(192, 132, 252, 0.02)
  );
  padding: 3px;
  max-height: 640px;
  overflow-y: auto;
}

.kofi-frame-wrap iframe {
  border-radius: 7px;
  display: block;
}

.license-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.license-card .license-title {
  font-size: 12px;
}

.license-card .license-body {
  font-size: 12px;
  gap: 0.6rem;
}

.license-card .license-warning {
  font-size: 11px;
  padding: 0.55rem 0.75rem;
}

.license-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.license-icon {
  font-size: 15px;
  color: var(--accent);
}

.license-chip {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(192, 132, 252, 0.25);
  padding: 2px 8px;
  border-radius: 3px;
}

.license-divider {
  height: 1px;
  background: var(--border);
}

.license-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.license-body a {
  color: var(--accent);
  text-decoration: none;
}
.license-body a:hover {
  text-decoration: underline;
}
.license-body strong {
  color: var(--text-primary);
  font-weight: 500;
}
.license-body em {
  color: var(--text-secondary);
  font-style: normal;
}

.license-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(201, 123, 123, 0.07);
  border: 1px solid rgba(201, 123, 123, 0.18);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  font-size: 12px;
  color: var(--lost-text);
  line-height: 1.6;
}

.license-warning-icon {
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Responsive ── */
@media (max-width: 1320px) {
  .content-columns {
    grid-template-columns: 1fr;
  }
  .support-col {
    position: static;
    margin-top: 2rem;
    max-width: 480px;
  }
}

@media (max-width: 900px) {
  .layout {
    display: block;
    max-width: 640px;
    padding: 0 1.25rem;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 2rem 0 1.5rem;
  }
  .sidebar-inner {
    overflow-y: visible;
    max-height: none;
  }
  .sidebar-footer {
    margin-top: 1.5rem;
  }
  .content {
    padding: 0 0 5rem;
  }
}

@media (max-width: 580px) {
  .track-item {
    grid-template-columns: 1.5rem 1fr auto;
  }
  .track-dur {
    display: none;
  }
  h1 {
    font-size: 2rem;
  }
}