:root {
  --bg: #FFFFFF;
  --panel: #F7F7F5;
  --ink: #17170F;
  --faint: #6F6F68;
  --muted: #A3A39B;
  --line: #E8E8E4;
  --line-strong: #DCDCD6;
  --fire: #D4380D;
  --hover: #F4F4F1;
  --sidebar-w: 248px;
}

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

html {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.mobile-bar,
.nav-backdrop,
.nav-close {
  display: none;
}

aside {
  background: var(--panel);
  border-right: 1px solid var(--line-strong);
  padding: 24px 20px 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.02em;
  display: inline-block;
  flex-shrink: 0;
}
.side-logo {
  font-size: 22px;
}
.logo::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fire);
  margin-left: 3px;
  vertical-align: super;
}
.side-logo::after {
  width: 6px;
  height: 6px;
}

.group-label {
  font-size: 11px;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin-bottom: 10px;
}

.side-nav a {
  display: block;
  padding: 6px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 460;
  color: var(--faint);
}
.side-nav a:hover { color: var(--ink); background: #EFEFEB; }
.side-nav a.active {
  color: var(--ink);
  font-weight: 550;
  background: #ECECE7;
}

.side-artists a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--faint);
}
.side-artists a:hover { color: var(--ink); background: #EFEFEB; }
.side-artists a.current { color: var(--ink); font-weight: 550; }
.side-artists a.current::after {
  content: "•";
  color: var(--fire);
}

/* ============ MAIN COLUMN ============ */
.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 40px;
  min-height: 60px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.crumbs {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { margin: 0 7px; color: var(--line-strong); }
.crumbs .here { color: var(--ink); font-weight: 500; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  width: 280px;
  max-width: 100%;
  flex-shrink: 0;
}
.search:focus-within { border-color: var(--ink); background: var(--bg); }
.search input {
  font: inherit;
  font-size: 16px;
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  min-width: 0;
  color: var(--ink);
}
.search input::placeholder { color: var(--muted); }
.search kbd {
  font: inherit;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  background: var(--bg);
  flex-shrink: 0;
}

main {
  flex: 1;
  padding: 48px 40px 64px;
  max-width: 880px;
  width: 100%;
  min-width: 0;
}

.page-head,
.artist-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 28px;
  flex-wrap: wrap;
  padding-bottom: 28px;
  margin-bottom: 8px;
}

.page-head > div:first-child,
.artist-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.page-head .btn-group,
.artist-head .btn-play,
.artist-head .btn-group {
  flex: 0 0 auto;
}

body.page-track .track-hero {
  width: 100%;
  max-width: 880px;
}

.eyebrow {
  font-size: 11.5px;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--fire);
  margin-bottom: 12px;
}

h1 {
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1.05;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.page-lead {
  margin-top: 14px;
  font-size: 15px;
  color: var(--faint);
  max-width: 42ch;
}

.artist-meta,
.page-meta {
  margin-top: 14px;
  font-size: 14px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.artist-meta b,
.page-meta b { font-weight: 550; color: var(--ink); }

.btn-play,
.btn-link,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  text-align: center;
}

.btn-play,
.btn-link {
  background: var(--ink);
  color: var(--bg);
  padding-left: 19px;
}
.btn-play:hover,
.btn-link:hover { background: #000; }
.btn-play svg { display: block; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  gap: 8px;
  padding: 11px 20px;
}
.btn-ghost:hover { background: var(--hover); }

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--fire);
  color: #fff;
  flex-shrink: 0;
  border: none;
}
.btn-download:hover { background: #b82f0a; }
.btn-download svg { display: block; }

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ---- tracklist ---- */
.tracks {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
}

.t-head,
.t-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 64px;
  align-items: center;
}

.tracks.show-artist .t-head,
.tracks.show-artist .t-row {
  grid-template-columns: 48px minmax(0, 1fr) minmax(0, 140px) 64px;
}

.t-head {
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
  padding: 10px 0;
  font-size: 11px;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.t-head > span:first-child,
.t-num { text-align: center; }

.t-head > span:last-child,
.t-dur {
  text-align: right;
  padding-right: 16px;
}

.t-row {
  padding: 12px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.t-row:last-child { border-bottom: none; }
.t-row:hover { background: var(--hover); }

.t-num {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
}
.t-num > * { grid-area: 1 / 1; }
.t-num .tri { display: none; color: var(--ink); }
.t-row:hover .t-num .num { visibility: hidden; }
.t-row:hover .t-num .tri { display: block; }

.t-title {
  font-weight: 480;
  letter-spacing: -0.005em;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
}
.t-title a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.t-title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.t-artist {
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
  min-width: 0;
}
.t-artist:hover { color: var(--ink); }

.t-dur {
  font-size: 13px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.eq {
  display: none;
  gap: 2.5px;
  height: 12px;
  align-items: flex-end;
}
.eq i {
  width: 2.5px;
  background: var(--fire);
  animation: eq 0.9s ease-in-out infinite;
}
.eq i:nth-child(1) { height: 60%; }
.eq i:nth-child(2) { height: 100%; animation-delay: 0.25s; }
.eq i:nth-child(3) { height: 45%; animation-delay: 0.5s; }
@keyframes eq {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .eq i { animation: none; }
}

.t-row.playing .num,
.t-row.playing:hover .tri { display: none; }
.t-row.playing .eq { display: flex; }
.t-row.playing .t-title,
.t-row.playing .t-title a { color: var(--fire); font-weight: 550; }

.empty {
  display: none;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ---- grids ---- */
.section { margin-top: 36px; }
.section:first-of-type { margin-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.section-head a {
  font-size: 13.5px;
  color: var(--faint);
  white-space: nowrap;
}
.section-head a:hover { color: var(--ink); }

.artist-grid,
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.artist-tile,
.collection-tile {
  display: block;
  padding: 16px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  min-width: 0;
}
.artist-tile:hover,
.collection-tile:hover { background: var(--hover); }

.artist-tile .name,
.collection-tile .name {
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.artist-tile .meta,
.collection-tile .meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--faint);
}

.collection-tile { background: var(--panel); }

.track-artist-link {
  color: var(--ink);
  font-weight: 550;
}
.track-artist-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- footer ---- */
.site-footer {
  background: var(--panel);
  border-top: 1px solid var(--line-strong);
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--faint);
}
.site-footer .f-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.site-footer a:hover { color: var(--ink); }
.site-footer .f-note { color: var(--muted); }

/* ---- player ---- */
.player {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-strong);
  transform: translateY(100%);
  transition: transform 0.25s ease;
  z-index: 10;
}
.player.on { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .player { transition: none; }
}

.player-in {
  max-width: 880px;
  padding: 12px 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.p-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
}
.p-mid { min-width: 0; }
.p-title {
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-bar {
  margin-top: 7px;
  height: 2px;
  background: var(--line);
  border-radius: 1px;
  overflow: hidden;
  cursor: pointer;
}
.p-fill {
  height: 100%;
  width: 0%;
  background: var(--fire);
}
.p-time {
  font-size: 12.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body.player-on main { padding-bottom: 120px; }

.error-box { padding: 40px 0; }
.error-box .code,
.error-box h1.code {
  font-size: clamp(40px, 10vw, 64px);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
}
.error-box p {
  margin-top: 12px;
  color: var(--faint);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============ TABLET / MOBILE ============ */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line-strong);
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
  }

  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    display: block;
    width: 16px;
    height: 1.5px;
    background: var(--ink);
    border-radius: 1px;
    position: relative;
  }
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
  }
  .nav-toggle-bars::before { top: -5px; }
  .nav-toggle-bars::after { top: 5px; }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(23, 23, 15, 0.35);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .nav-backdrop[hidden] {
    display: none !important;
  }

  aside {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 86vw);
    height: 100vh;
    height: 100dvh;
    z-index: 40;
    padding: 20px 18px 28px;
    border-right: 1px solid var(--line-strong);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .side-logo { display: inline-block; }
  .nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--faint);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
  }
  .nav-close:hover { color: var(--ink); background: var(--hover); }

  body.nav-open {
    overflow: hidden;
  }
  body.nav-open aside {
    transform: translateX(0);
  }
  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  @media (prefers-reduced-motion: reduce) {
    aside,
    .nav-backdrop { transition: none; }
  }

  .topbar {
    padding: 10px 16px;
    min-height: 52px;
  }
  .crumbs { display: none; }
  .search {
    width: 100%;
    flex: 1;
  }
  .search kbd { display: none; }
  .search input { font-size: 16px; }

  main { padding: 24px 16px 72px; }

  .page-head,
  .artist-head {
    align-items: flex-start;
    padding-bottom: 20px;
    gap: 16px;
  }

  h1 { font-size: clamp(26px, 8vw, 36px); }

  .btn-play,
  .btn-link,
  .btn-ghost {
    width: 100%;
  }
  .btn-group { width: 100%; }

  body.page-track .track-hero .btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  body.page-track .track-hero .btn-play {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
  }
  body.page-track .track-hero .btn-download {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    order: 2;
  }
  body.page-track .track-hero .btn-play { order: 1; }
  body.page-track .track-hero .btn-ghost {
    width: 100%;
    order: 3;
  }

  .t-head { display: none; }
  .t-head,
  .t-row,
  .tracks.show-artist .t-head,
  .tracks.show-artist .t-row {
    grid-template-columns: 40px minmax(0, 1fr) 52px;
  }
  .tracks.show-artist .t-artist { display: none; }
  .t-dur { padding-right: 12px; font-size: 12px; }
  .t-row { padding: 11px 0; }

  .artist-grid,
  .collection-grid {
    grid-template-columns: 1fr 1fr;
  }

  .player { left: 0; }
  .player-in {
    padding: 10px 16px;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr);
  }
  .p-time { display: none; }

  .site-footer {
    padding: 20px 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  body.player-on main { padding-bottom: 100px; }
}

@media (max-width: 420px) {
  .artist-grid,
  .collection-grid {
    grid-template-columns: 1fr;
  }

  .mobile-bar { padding: 10px 12px; }
  .mobile-bar .logo { font-size: 16px; }
  .side-logo { font-size: 20px; }
  main { padding: 20px 12px 72px; }
  .topbar { padding: 10px 12px; }
}
