:root {
  --bg: #05060f;
  --ink: #f2ece6;
  --muted: rgba(242, 236, 230, 0.6);
  --accent: #ff7a3d;
  --glass: rgba(10, 12, 28, 0.55);
  --line: rgba(255, 255, 255, 0.12);
  --gutter: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", ui-sans-serif, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.orb-label {
  position: absolute;
  left: 0; top: 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
  transition: color 0.2s;
  color: var(--muted);
}
.orb-label.on { color: var(--ink); }
.orb-label .name { display: none; margin-left: 8px; }
.orb-label.on .name { display: inline; }

.brand {
  position: fixed;
  top: 18px; left: var(--gutter);
  z-index: 5;
  pointer-events: none;
}
.brand h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: 0.32em; }
.brand h1 span, #intro h2 span { color: var(--accent); }
.clock { margin-top: 10px; font-size: 13px; letter-spacing: 0.24em; font-variant-numeric: tabular-nums; color: var(--muted); transition: color 0.4s; }
.clock.hit { color: var(--accent); text-shadow: 0 0 14px var(--accent); }

#titleCard { position: fixed; left: 0; right: 0; top: 15vh; z-index: 4; padding: 0 var(--gutter); text-align: center; pointer-events: none; opacity: 0; }
#titleCard .n { display: block; font-size: 12px; letter-spacing: 0.5em; color: var(--accent); }
#titleCard strong { display: block; margin-top: 10px; font-size: clamp(26px, 5.2vw, 54px); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; text-shadow: 0 4px 34px rgba(0, 0, 0, 0.7); }
#titleCard.show { animation: titleIn 3.6s ease both; }
@keyframes titleIn {
  0% { opacity: 0; transform: translateY(14px); filter: blur(8px); }
  18% { opacity: 1; transform: none; filter: none; }
  72% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-8px); }
}

#hint {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 5;
  transform: translate(-50%, 8px);
  padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(10px);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }
.brand p { margin: 4px 0 0; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }

.topbar {
  position: fixed;
  top: 18px; right: var(--gutter);
  z-index: 6;
  display: flex;
  gap: 8px;
}
.brand, .topbar, #player { transition: opacity 0.9s ease, transform 0.9s ease; }
body:not(.live) .brand, body:not(.live) .topbar { opacity: 0; transform: translateY(-10px); }
body:not(.live) #player { opacity: 0; transform: translateY(16px); }

.chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(10px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
}

#tracklist {
  position: fixed;
  top: 64px; right: var(--gutter);
  bottom: 120px;
  width: min(340px, calc(100vw - 2 * var(--gutter)));
  z-index: 6;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  overflow-y: auto;
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
#tracklist.open { transform: none; opacity: 1; }
#tracklist ol { list-style: none; margin: 0; padding: 0; }
#tracklist li { display: flex; align-items: center; }
#tracklist li > a:not(.dl) { display: block; padding: 12px; color: var(--ink); text-decoration: none; }
#tracklist .dl { flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin-right: 4px; border-radius: 50%; color: var(--muted); }
#tracklist .dl:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
#tracklist button {
  display: flex; align-items: center; gap: 12px;
  flex: 1; min-width: 0;
  width: 100%;
  padding: 12px;
  border: 0; border-radius: 10px;
  background: transparent;
  text-align: left;
}
#tracklist button:hover, #tracklist button.active { background: rgba(255, 255, 255, 0.08); }
#tracklist .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; background: currentColor; }
#tracklist .num { color: var(--muted); font-size: 12px; width: 22px; flex: none; }
#tracklist .t { display: flex; flex-direction: column; min-width: 0; }
#tracklist .t b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tracklist .t i { font-style: normal; font-size: 12px; color: var(--muted); }

#player {
  position: fixed;
  left: var(--gutter); right: var(--gutter); bottom: max(var(--gutter), env(safe-area-inset-bottom));
  z-index: 7;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.4fr) 110px;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass);
  backdrop-filter: blur(14px);
}
#player .meta { display: flex; flex-direction: column; min-width: 0; }
#player .meta strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#player .meta span { font-size: 12px; color: var(--muted); }
#player .controls { display: flex; align-items: center; gap: 6px; }
#player .controls button {
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: transparent;
  font-size: 16px;
}
#player .controls button:hover { background: rgba(255, 255, 255, 0.1); }
#player .controls .primary { width: 46px; height: 46px; background: var(--accent); color: #140a05; }
#player .controls .primary:hover { background: var(--accent); filter: brightness(1.15); }
#player .controls .share { position: relative; width: 32px; height: 32px; margin-left: 4px; color: var(--muted); }
#player .controls .share:hover { color: var(--ink); }
#player .controls .share .tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent); color: #140a05;
  font-size: 11px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
#player .controls .share.done .tip { opacity: 1; }
.seek { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wave { position: relative; flex: 1; min-width: 0; height: 30px; border-radius: 6px; }
.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wave input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.wave:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

#about {
  width: min(520px, calc(100vw - 32px));
  padding: 28px;
  color: var(--ink);
  background: rgba(10, 12, 28, 0.94);
  border: 1px solid var(--line);
  border-radius: 20px;
}
#about::backdrop { background: rgba(3, 4, 12, 0.6); backdrop-filter: blur(6px); }
#about h2 { margin: 0 0 14px; font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase; }
#about p { margin: 0 0 12px; line-height: 1.65; color: var(--muted); }
#about p.sep { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
#about .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
#about .links a {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.08em;
}
#about .links a:hover { border-color: var(--accent); }
#about .close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px;
  border: 0; border-radius: 50%;
  background: transparent;
  font-size: 22px; line-height: 1;
  color: var(--muted);
}
#about .close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }

.noscript { position: fixed; left: var(--gutter); right: var(--gutter); bottom: var(--gutter); z-index: 30; margin: 0; padding: 14px; border-radius: 12px; background: var(--glass); color: var(--muted); }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 0; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 0; }

#intro {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 100%, rgba(58, 26, 34, 0.7) 0%, rgba(5, 6, 15, 0.5) 65%);
  backdrop-filter: blur(12px);
  text-align: center;
  transition: opacity 1s ease, visibility 1s;
}
#intro.gone { opacity: 0; visibility: hidden; pointer-events: none; }
#intro h2 { margin: 0; font-size: clamp(44px, 12vw, 96px); font-weight: 800; letter-spacing: 0.28em; padding-left: 0.28em; }
#intro p { margin: 10px 0 36px; color: var(--muted); letter-spacing: 0.22em; text-transform: uppercase; font-size: 12px; }
#intro button {
  padding: 14px 44px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 13px;
  transition: background 0.25s, color 0.25s;
}
#intro button:not(:disabled):hover { background: var(--accent); color: #140a05; }
#intro button:disabled { opacity: 0.5; cursor: default; }
#intro small { display: block; margin-top: 22px; color: var(--muted); font-size: 11px; letter-spacing: 0.12em; }

/* no WebGL: the list becomes the whole experience */
body.no3d #stage, body.no3d #labels, body.no3d #listToggle, body.no3d .clock, body.no3d #hint { display: none; }
body.no3d #tracklist { transform: none; opacity: 1; left: var(--gutter); right: var(--gutter); width: auto; top: 90px; }

@media (max-width: 760px) {
  #player { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  #player .seek { grid-column: 1 / -1; order: 3; }
  #player #vol { display: none; }
  #player .meta strong {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
    line-height: 1.25;
  }
  #player .controls { gap: 2px; }
  #player .controls button { width: 34px; height: 34px; }
  #player .controls .primary { width: 44px; height: 44px; }
  #player .controls .share { margin-left: 0; }
  #tracklist { bottom: 190px; }
  .brand p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #intro, #tracklist { transition: none; }
}
