:root {
  --bg: #0a0a0f;
  --bg-2: #101018;
  --bg-3: #171722;
  --line: #262636;
  --text: #e8e8f0;
  --muted: #8b8ba3;
  --dim: #55556b;
  --accent: #e5ff5a;
  --header-h: 0px;
  --player-h: 0px;
  --panel-w: 380px;
  --c-house: #ff9f43;
  --c-trance: #a78bfa;
  --c-techno: #4cc9f0;
  --c-breakbeat: #ff6fb5;
  --c-jungle: #57e389;
  --c-hardcore: #ff5c5c;
  --c-downtempo: #2dd4bf;
  --c-gear: #c3c3d6;
  --c-samples: #e9c46a;
  --c-sounds: #f0abfc;
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
body.playing { --player-h: 68px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 30;
  display: flex; align-items: center; gap: 24px; padding: 0 20px;
  background: rgba(10, 10, 15, 0.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 500; margin-left: 4px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(var(--c-house), var(--c-trance), var(--c-techno), var(--c-breakbeat), var(--c-jungle), var(--c-hardcore), var(--c-downtempo), var(--c-house));
  box-shadow: 0 0 18px rgba(229, 255, 90, 0.25);
}
body.audio-on .brand-mark { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--bg-3); }
.search { position: relative; margin-left: auto; width: min(340px, 34vw); }
.search input {
  width: 100%; height: 36px; padding: 0 12px; border-radius: 10px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.results {
  position: absolute; top: 42px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; max-height: 60vh; overflow: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}
.results li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.results li[aria-selected="true"], .results li:hover { background: var(--bg-3); }
.results .r-main { font-weight: 500; }
.results .r-sub { color: var(--muted); font-size: 12px; font-family: var(--mono); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.results .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); transform: translateY(-1px); }

.btn { border: 1px solid var(--line); background: var(--bg-3); border-radius: 10px; padding: 7px 14px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; }
.btn-accent { background: var(--accent); color: #111; border-color: var(--accent); }
.btn-accent:hover { filter: brightness(1.08); border-color: var(--accent); }
#radio.on { background: var(--accent); color: #111; border-color: var(--accent); }

/* ---------- layout ---------- */
.layout { position: fixed; top: var(--header-h); bottom: var(--player-h); left: 0; right: 0; display: flex; }
.map { position: relative; flex: 1; overflow: auto; overscroll-behavior: contain; }
.map::-webkit-scrollbar { width: 10px; height: 10px; }
.map::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
.map::-webkit-scrollbar-track { background: transparent; }

.decades {
  position: sticky; top: 0; z-index: 5; height: 22px;
  background: linear-gradient(var(--bg) 70%, rgba(10, 10, 15, 0));
}
.decades span {
  position: absolute; top: 5px; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase;
}
.canvas { position: relative; margin-top: -22px; }
.stripe { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.018); border-left: 1px dashed rgba(255, 255, 255, 0.04); border-right: 1px dashed rgba(255, 255, 255, 0.04); }
.band { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.band::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 9%, transparent), transparent 30%);
  pointer-events: none;
}
.links { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.links path { fill: none; stroke: var(--c); stroke-opacity: 0.25; stroke-width: 1; transition: stroke-opacity 0.2s; }
.links path.cross { stroke: #9b9bb5; stroke-dasharray: 4 5; stroke-opacity: 0.12; }

.node {
  position: absolute; height: 20px; padding: 0 6px; display: flex; align-items: center; gap: 4px;
  border-radius: 5px; border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line));
  background: color-mix(in srgb, var(--c) 8%, var(--bg-2)); color: var(--text);
  font-size: 10.5px; font-weight: 500; line-height: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 0.2s, transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.2s;
}
.node::before { content: ""; flex: none; width: 4px; height: 4px; border-radius: 50%; background: var(--c); }
.node span { overflow: hidden; text-overflow: ellipsis; }
.node:hover { background: color-mix(in srgb, var(--c) 22%, var(--bg-2)); border-color: var(--c); transform: translateY(-1px); z-index: 2; }
.node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.node.hub {
  height: 30px; font-size: 12.5px; font-weight: 700; letter-spacing: -0.01em; border-radius: 8px; padding: 0 8px;
  background: color-mix(in srgb, var(--c) 18%, var(--bg-2)); border-color: var(--c); color: var(--c);
}
.node.hub::before { width: 6px; height: 6px; }
.node.sel { background: var(--c); color: #0a0a0f; border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 35%, transparent), 0 0 16px color-mix(in srgb, var(--c) 50%, transparent); z-index: 3; }
.node.sel::before { background: #0a0a0f; }
.node.now::after { content: "♪"; margin-left: auto; color: var(--accent); animation: pulse 1s ease-in-out infinite; }
.node.sel.now::after { color: #0a0a0f; }
@keyframes pulse { 50% { opacity: 0.3; } }
.scene-label {
  position: absolute; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--dim); white-space: nowrap; pointer-events: none;
}

/* ---------- side panel ---------- */
.panel {
  width: var(--panel-w); flex: none; overflow: auto; border-left: 1px solid var(--line); background: var(--bg-2);
  padding: 24px 24px 40px;
}
.panel-top {
  position: sticky; top: 0; z-index: 3; margin: -24px -24px 24px; padding: 14px 24px;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.back {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 22px 0 16px; border-radius: 999px; border: 0;
  background: var(--accent); color: #0a0a0f; font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 25%, transparent); transition: transform 0.12s, filter 0.12s;
}
.back:hover { filter: brightness(1.08); transform: translateX(-2px); }
.back:active { transform: scale(0.97); }
.back:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.back-arrow { font-size: 20px; line-height: 1; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  font-family: var(--mono); border: 1px solid var(--line); color: var(--muted); background: transparent; text-decoration: none;
}
.chip.type { color: var(--c); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
a.chip:hover, button.chip:hover { border-color: var(--c, var(--muted)); color: var(--text); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.panel h1 { font-size: 30px; line-height: 1.1; letter-spacing: -0.03em; margin: 4px 0 6px; }
.panel .aka { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.panel .aka b { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--dim); text-transform: uppercase; margin-right: 6px; }
.panel h3 { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin: 26px 0 10px; }
.panel p { margin: 0 0 12px; color: #cfcfdc; }
.panel .lede { font-size: 16px; }

.tracks { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.tracks li { counter-increment: t; }
.track {
  width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: 2px 10px; align-items: center;
  padding: 8px 10px; border-radius: 10px; background: transparent; border: 1px solid transparent; text-align: left;
}
.track:hover { background: var(--bg-3); }
.track .n { grid-row: span 2; font-family: var(--mono); font-size: 12px; color: var(--dim); text-align: center; }
.track .n::before { content: counter(t); }
.track:hover .n::before { content: "▶"; color: var(--text); }
.track .t { font-weight: 500; line-height: 1.25; }
.track .a { color: var(--muted); font-size: 13px; line-height: 1.25; }
.credit { margin: -2px 0 6px 46px; font-family: var(--mono); font-size: 10.5px; line-height: 1.5; color: var(--dim); }
.credit a { color: var(--muted); }
.credit a:hover { color: var(--text); }
.panel p.note { font-size: 13px; color: var(--muted); margin: -2px 0 10px; }
.track.on { background: color-mix(in srgb, var(--accent) 10%, var(--bg-3)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.track.on .n::before { content: "♪"; color: var(--accent); animation: pulse 1s ease-in-out infinite; }
.track.on.paused .n::before { content: "❚❚"; animation: none; font-size: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { color: var(--text); cursor: pointer; }
.decade-group { margin-bottom: 12px; }
.decade-group .dl { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-bottom: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.legend a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; font-weight: 600; color: var(--c); }
.legend a:hover { background: color-mix(in srgb, var(--c) 10%, transparent); border-color: var(--c); }
.legend a small { margin-left: auto; color: var(--dim); font-family: var(--mono); font-weight: 400; font-size: 11px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.hint { color: var(--dim); font-size: 12px; font-family: var(--mono); }
.hint kbd { border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-family: inherit; }

/* ---------- reader overlay ---------- */
.reader {
  position: fixed; top: var(--header-h); bottom: var(--player-h); left: 0; right: 0; z-index: 20; overflow: auto;
  background: rgba(10, 10, 15, 0.97); backdrop-filter: blur(6px);
}
.reader-inner { max-width: 760px; margin: 0 auto; padding: 40px 24px 100px; position: relative; }
.reader-close { position: sticky; top: 16px; float: right; z-index: 2; }
.reader h1 { font-size: 44px; letter-spacing: -0.04em; line-height: 1.05; margin: 0 0 8px; }
.reader .kicker { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.reader h2 { font-size: 28px; letter-spacing: -0.02em; margin: 56px 0 4px; scroll-margin-top: 70px; }
.reader h2 small { display: block; font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.reader p { color: #d0d0dc; font-size: 16.5px; line-height: 1.7; margin: 0 0 16px; }
.reader figure { margin: 20px 0; }
.reader img { max-width: 100%; border-radius: 12px; display: block; background: #fff; }
.reader figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 8px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 24px 0 8px; position: sticky; top: 0; padding: 10px 0; background: rgba(10, 10, 15, 0.97); z-index: 1; }
.toc a { font-family: var(--mono); font-size: 12px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--muted); }
.toc a:hover { color: var(--text); border-color: var(--muted); }
.gear-grid figure img { max-height: 320px; object-fit: contain; margin: 0 auto; }
.reader hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0; }

/* ---------- player ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h); z-index: 40;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 38%) auto; align-items: center; gap: 20px; padding: 0 20px;
  background: var(--bg-2); border-top: 1px solid var(--line);
}
.pl-controls { display: flex; gap: 4px; align-items: center; }
.icon { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; font-size: 14px; display: grid; place-items: center; color: var(--muted); }
.icon:hover { color: var(--text); background: var(--bg-3); }
.icon-main { width: 42px; height: 42px; background: var(--accent); color: #111; font-size: 15px; }
.icon-main:hover { background: var(--accent); color: #111; filter: brightness(1.08); }
.pl-info { min-width: 0; }
.pl-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-size: 12px; font-family: var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub a { text-decoration: none; color: var(--c, var(--muted)); }
.pl-sub a:hover { text-decoration: underline; }
#pl-mode { margin-left: 10px; color: var(--accent); }
.pl-progress { display: flex; align-items: center; gap: 10px; }
.pl-time { font-family: var(--mono); font-size: 11px; color: var(--dim); width: 34px; text-align: center; }
.pl-bar { flex: 1; height: 6px; border-radius: 6px; background: var(--bg-3); cursor: pointer; position: relative; }
.pl-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 6px; background: var(--accent); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  :root { --panel-w: 100%; }
  .nav { display: none; }
  .brand-text { display: none; }
  .search { width: auto; flex: 1; }
  .top { gap: 12px; padding: 0 12px; }
  .panel {
    position: fixed; left: 0; right: 0; bottom: var(--player-h); top: 35%; z-index: 15; border-left: 0;
    border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(0); transition: transform 0.25s;
  }
  .panel.closed { transform: translateY(105%); }

  .player { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 0 12px; }
  .pl-progress { position: absolute; left: 0; right: 0; top: -3px; gap: 0; }
  .pl-progress .pl-time { display: none; }
  .pl-bar { height: 3px; border-radius: 0; }
  .reader h1 { font-size: 34px; }
  .reader-inner { padding: 24px 16px 80px; }
}

/* ---------- phone: list view instead of the map ---------- */
.mlist { display: none; }
@media (max-width: 700px) {
  .map { display: none; }
  .mlist { display: block; flex: 1; overflow: auto; overscroll-behavior: contain; padding-bottom: 24px; }
  .mtabs {
    position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
    padding: 12px 16px; background: rgba(10, 10, 15, 0.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .mtabs::-webkit-scrollbar { display: none; }
  .mtab {
    flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line));
    background: transparent; color: var(--c); font-weight: 600; font-size: 14px;
  }
  .mtab.on { background: var(--c); color: #0a0a0f; border-color: var(--c); }
  .mbody { padding: 14px 16px 0; }
  .mhub {
    display: block; text-decoration: none; padding: 14px 16px; border-radius: 14px; margin-bottom: 6px;
    border: 1px solid color-mix(in srgb, var(--c) 40%, var(--line)); background: color-mix(in srgb, var(--c) 10%, var(--bg-2));
  }
  .mhub.sel { border-color: var(--c); }
  .mhub-t { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--c); }
  .mhub-p {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    color: var(--muted); font-size: 13px; margin-top: 2px;
  }
  .mdec { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--dim); margin: 18px 2px 8px; text-transform: uppercase; }
  .mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .mrow {
    display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 10px; text-decoration: none;
    border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line)); background: var(--bg-2); font-size: 14px; font-weight: 500; line-height: 1.2;
  }
  .mrow:active { background: color-mix(in srgb, var(--c) 18%, var(--bg-2)); }
  .mrow.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--bg-2)); }
  .mrow-t { flex: 1; min-width: 0; }
  .mrow-n { font-family: var(--mono); font-size: 11px; color: var(--dim); }
  .mrow.now .mrow-n { font-size: 0; }
  .mrow.now .mrow-n::after { content: "♪"; font-size: 14px; color: var(--accent); animation: pulse 1s ease-in-out infinite; }

  .panel { top: 8%; padding: 8px 18px 32px; z-index: 25; }
  .panel-top { margin: -8px -18px 22px; padding: 10px 18px; }
  .panel h1 { font-size: 26px; }
  .track { padding: 10px; }
}

.gimg { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: 12px; background: #000; margin: 4px 0 6px; }
