:root {
  /* "Night chart": ink and lavender surfaces, a violet-to-magenta brand. Spotify green
     (--accent) is kept for actions that go to Spotify, so it never reads as Spotify's own UI. */
  --bg: #f7f5fc;
  --surface: #ffffff;
  --text: #17141f;
  --muted: #686379;
  --line: #e7e3f0;
  --brand: #6d4aff;
  --brand-2: #e93d82;
  --brand-text: #ffffff;
  --glow: rgb(124 92 255 / 0.12);
  --art-opacity: 0.13;
  --accent: #1db954;
  --accent-text: #0b3d1e;
  --missing: #a29db0;
  color-scheme: light dark;
}

/* Dark tokens: follow the system unless the viewer forced light, or forced dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0c15;
    --surface: #18151f;
    --text: #eeeaf6;
    --muted: #9b95ad;
    --line: #2a2536;
    --brand: #9d82ff;
    --brand-2: #ff5c9a;
    --brand-text: #120d24;
    --glow: rgb(124 92 255 / 0.22);
    --art-opacity: 0.2;
    --accent-text: #04140a;
    --missing: #5f5a6e;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0c15;
  --surface: #18151f;
  --text: #eeeaf6;
  --muted: #9b95ad;
  --line: #2a2536;
  --brand: #9d82ff;
  --brand-2: #ff5c9a;
  --brand-text: #120d24;
  --glow: rgb(124 92 255 / 0.22);
  --art-opacity: 0.2;
  --accent-text: #04140a;
  --missing: #5f5a6e;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  /* A soft glow behind the header. */
  background: radial-gradient(ellipse 900px 360px at 50% -140px, var(--glow), transparent 70%) no-repeat, var(--bg);
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main, .top, footer { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 16px;
  padding-top: 24px;
  padding-bottom: 16px;
}
.top h1 { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.top h1 .wordmark-2, .pos.top {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { margin: 4px 0 0; color: var(--muted); }

.brand { min-width: 0; display: flex; align-items: center; gap: 12px; }
.brand .logo { flex: none; width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 6px 18px rgb(124 92 255 / 0.35); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.menu { position: relative; flex: none; }
.menu-button { display: grid; place-items: center; padding: 0; width: 44px; height: 44px; background: var(--surface); }
.menu-button[aria-expanded="true"] { border-color: var(--muted); }
.options {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 14px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
.option { display: grid; gap: 6px; }
.option-label { font-size: 0.8rem; color: var(--muted); }
.option-check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.option-check input { width: 18px; height: 18px; accent-color: var(--brand); }
/* Equal-width options, each as wide as the widest label. */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.segmented button { min-height: 38px; border: 0; border-radius: 0; background: transparent; font-size: 0.9rem; white-space: nowrap; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--brand); color: var(--brand-text); font-weight: 600; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.controls label:first-child { flex: 1 1 240px; }
select, button { font: inherit; color: var(--text); }
select {
  min-height: 40px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
}
.stepper { display: flex; gap: 4px; }
button {
  min-height: 40px;
  min-width: 40px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

.list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 20px 0 8px; }
.list-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.meta { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.meta a { color: inherit; }
.hint { margin: 0 0 8px; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 0.9rem; }
.status { color: var(--muted); margin: 8px 0; }
.status:empty { display: none; }

.tracks { --pos-digits: 3; list-style: none; margin: 0; padding: 0; }
.tracks li { border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.tracks li > a.track { flex: 1; min-width: 0; }
.tracks a.fix { flex: none; margin-left: 4px; padding: 6px 10px; font-size: 0.8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.tracks a.fix:hover, .tracks a.fix:focus-visible { background: var(--surface); color: inherit; }
.tracks a.track {
  display: grid;
  /* 1ch per digit (tabular figures) plus a little for the bold weight. */
  grid-template-columns: calc(var(--pos-digits) * 1.1ch + 0.35em) 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
}
.tracks a.track:hover, .tracks a.track:focus-visible { background: var(--surface); }
.pos { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.cover { width: 48px; height: 48px; border-radius: 6px; background: var(--line); object-fit: cover; }
img.cover { box-shadow: 0 2px 6px rgb(0 0 0 / 0.25); }
span.cover { display: grid; place-items: center; color: var(--text); }
span.cover svg { width: 45%; height: 45%; opacity: 0.25; }
.names { min-width: 0; }
.names .title, .names .artist { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.names .artist { color: var(--muted); font-size: 0.9rem; }
.go { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.missing .names, .missing .go { color: var(--missing); }

/* Background art (site/art.js): faint, strongest at the top and gone by 60% of the screen,
   so song text keeps full contrast. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--art-opacity);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 18%, transparent 60%);
  mask-image: linear-gradient(to bottom, #000 0, #000 18%, transparent 60%);
}
.backdrop svg, .card-art svg { width: 100%; height: 100%; display: block; }

/* Home */
.home { margin-top: 20px; }
.hero { padding: 8px 0 4px; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 0.9rem; color: var(--muted);
}
.steps li strong { color: var(--text); font-weight: 600; }
.steps li::before {
  content: counter(step);
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; font-size: 0.8rem;
}
.section-title { margin: 32px 0 12px; font-size: 1.25rem; letter-spacing: -0.01em; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-head .section-title { margin-bottom: 0; }
.section-head button { min-height: 36px; font-size: 0.9rem; }
.section-sub { margin: 4px 0 12px; color: var(--muted); font-size: 0.9rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}
.card-head { position: relative; display: grid; padding: 14px 14px 10px; color: inherit; text-decoration: none; isolation: isolate; }
.card-art { position: absolute; inset: 0; z-index: -1; opacity: 0.35; -webkit-mask-image: linear-gradient(to bottom, #000, transparent); mask-image: linear-gradient(to bottom, #000, transparent); }
.card-group { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.card-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.card-period { font-size: 0.85rem; color: var(--muted); }
.card-head:hover .card-title { text-decoration: underline; }
.tracks.mini { padding: 0 6px; }
.tracks.mini li:last-child { border-bottom: 0; }
.tracks.mini a.track { grid-template-columns: calc(var(--pos-digits) * 1.1ch + 0.35em) 40px 1fr; gap: 10px; padding: 6px 4px; }
.tracks.mini .cover { width: 40px; height: 40px; }
.tracks.mini .go { display: none; }
.tracks.mini .names .title { font-size: 0.95rem; }
.card-more { margin-top: auto; padding: 10px 14px 12px; font-size: 0.85rem; font-weight: 600; color: var(--brand); text-decoration: none; }
.card-more:hover { text-decoration: underline; }

footer { padding: 32px 16px; color: var(--muted); font-size: 0.8rem; }
footer a { color: inherit; }

@media (max-width: 520px) {
  .brand { gap: 10px; }
  .brand .logo { width: 40px; height: 40px; border-radius: 10px; }
  .top h1 { font-size: 1.45rem; }
  .tagline { font-size: 0.9rem; }
  .tracks a.track { grid-template-columns: calc(var(--pos-digits) * 1.1ch + 0.35em) 40px 1fr; gap: 8px; padding: 8px 0; }
  .pos { font-size: 0.9rem; }
  .cover { width: 40px; height: 40px; }
  .go { display: none; }
}

/* beatport.html */
a.brand.home { color: inherit; text-decoration: none; }
.prose { line-height: 1.6; }
.prose h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.prose a { color: inherit; }
.bookmarklet {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff !important;
  font-weight: 600;
  text-decoration: none;
  cursor: grab;
}
