:root {
  --bg: #0a0a0f;
  --surface: #13131f;
  --border: #1e1e33;
  --border2: #2a2a44;
  --neon: #c084fc;
  --dim: #6b7280;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --mono: "Share Tech Mono", monospace;
  --display: "VT323", monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 300;
}
#sitebar {
  position: relative;
  flex: 0 0 auto;
  z-index: 5;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 1.5rem;
  overflow-x: auto;
  background: #0a0a0f;
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}
#sitebar a {
  color: var(--text2);
  text-decoration: none;
  white-space: nowrap;
}
#sitebar a:hover, #sitebar a.here { color: var(--neon); }
#sitebar a.mark {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  gap: 0.5rem;
  line-height: 1;
  margin: -0.55rem 0.45rem -0.55rem -1.25rem;
  padding: 0 1.35rem 0 0.9rem;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0) 40%),
    linear-gradient(180deg, #463f5c 0%, #241f33 58%, #14111c 100%);
  clip-path: polygon(0 0, calc(100% - 0.65rem) 0, 100% 50%, calc(100% - 0.65rem) 100%, 0 100%);
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.2)) drop-shadow(0 2px 2px rgba(0,0,0,0.65));
}
#sitebar a.mark:hover,
#sitebar a.mark.here { color: var(--neon); }
#sitebar a.mark:not(.here) {
  margin: 0;
  padding: 0;
  color: var(--text2);
  background: none;
  clip-path: none;
  filter: none;
}
#sitebar a.mark:not(.here):hover { color: var(--neon); }
#sitebar a.here:not(.mark) {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  line-height: 1;
  margin: -0.55rem 0.15rem;
  padding: 0 1.35rem 0 1.2rem;
  color: var(--neon);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0) 40%),
    linear-gradient(180deg, #463f5c 0%, #241f33 58%, #14111c 100%);
  clip-path: polygon(0 0, calc(100% - 0.65rem) 0, 100% 50%, calc(100% - 0.65rem) 100%, 0 100%, 0.65rem 50%);
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.2)) drop-shadow(0 2px 2px rgba(0,0,0,0.65));
}
#sitebar a.mark img { height: 1.15rem; width: auto; display: block; }
#sitebar a.mark .mark-label { line-height: 1; }
#sitebar a.lamp .dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: #3a3a44;
  vertical-align: 0.05em;
}
#sitebar a.lamp.on .dot {
  background: #ff1f1f;
  box-shadow: 0 0 8px #ff1f1f;
  animation: live-dot 1.4s ease-in-out infinite;
}
#sitebar a.lamp.off { color: var(--dim); }
#bar-tools { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; flex: 0 0 auto; }
#bar-tools .bar-donate { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.12em; color: var(--text); background: var(--surface); border: 1px solid var(--neon); border-radius: 4px; padding: 0.2rem 0.55rem; cursor: pointer; }
#bar-tools .bar-donate:hover { color: var(--bg); background: var(--neon); }
#bar-tools .bar-chat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--text);
  background: var(--surface);
  border: 2px solid #4ade80;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}
#bar-tools .bar-chat .dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  flex: 0 0 auto;
}
#bar-tools .bar-chat:hover,
#bar-tools .bar-chat.on { color: #0a0a0f; background: #4ade80; }
#bar-tools .bar-chat:hover .dot,
#bar-tools .bar-chat.on .dot { background: #0a0a0f; box-shadow: none; }
#bar-clock { font-family: var(--display); font-size: 1.35rem; letter-spacing: 0.06em; color: var(--text); font-variant-numeric: tabular-nums; min-width: 5.6rem; text-align: right; }
#bar-donate-menu { position: fixed; z-index: 200; display: flex; flex-direction: column; gap: 0.35rem; background: var(--surface); border: 1px solid var(--border2); padding: 0.55rem; min-width: 9rem; }
#bar-donate-menu[hidden] { display: none !important; }
#bar-donate-menu a { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.06em; text-decoration: none; padding: 0.35rem 0.6rem; border-radius: 4px; border: 1px solid; white-space: nowrap; }
#bar-donate-menu a.venmo { color: #818cf8; border-color: #818cf8; }
#bar-donate-menu a.paypal { color: var(--neon); border-color: var(--neon); }
#bar-donate-menu a.cashapp { color: #f472b6; border-color: #f472b6; }
#bar-donate-menu a.xmoney { color: var(--text); border-color: var(--text); }
#bar-donate-menu a:hover { color: var(--bg); }
#bar-donate-menu a.venmo:hover { background: #818cf8; }
#bar-donate-menu a.paypal:hover { background: var(--neon); }
#bar-donate-menu a.cashapp:hover { background: #f472b6; }
#bar-donate-menu a.xmoney:hover { background: var(--text); }
@keyframes live-dot {
  0%, 100% { box-shadow: 0 0 4px #ff1f1f; }
  50% { box-shadow: 0 0 12px #ff1f1f; }
}
#lw-view { flex: 1 1 auto; width: 100%; border: 0; background: var(--bg); }
#lw-player {
  position: relative;
  flex: 0 0 auto;
  z-index: 6;
  background: var(--surface);
  border-top: 1px solid var(--neon);
  box-shadow: 0 -2px 16px rgba(192,132,252,0.18);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.player-bar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  padding: 0.45rem 0.9rem;
}
.player-now-text { min-width: 0; }
.player-track-name {
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-meta {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-meta a { color: var(--dim); }
.player-controls, .mode, .bar-right { display: flex; align-items: center; gap: 0.55rem; }
.player-controls { justify-self: center; }
.bar-right { justify-self: end; min-width: 0; }
.mode button, .ctrl-btn, .queue-toggle {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: var(--mono);
  cursor: pointer;
}
.mode button { font-size: 0.78rem; letter-spacing: 0.06em; padding: 0.2rem 0.45rem; display: inline-flex; align-items: center; }
.mode button.on { color: var(--neon); border-color: var(--neon); }
.mode button .dot {
  display: none;
  width: 0.42rem;
  height: 0.42rem;
  margin-right: 0.32rem;
  border-radius: 50%;
  background: #ff1f1f;
  box-shadow: 0 0 6px #ff1f1f;
  vertical-align: 0.08em;
}
.mode button.live .dot { display: inline-block; animation: live-dot 1.4s ease-in-out infinite; }
.ctrl-btn { border: 0; padding: 0; display: flex; color: var(--text2); }
.ctrl-btn.play-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border2);
  border-radius: 50%;
  color: var(--neon);
  align-items: center;
  justify-content: center;
}
.player-progress-wrap { width: min(340px, 36vw); }
.progress-bar, .vol-slider { width: 100%; accent-color: var(--neon); }
.time-row, .live-read {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--dim);
}
.vol-wrap { display: flex; align-items: center; gap: 0.35rem; }
.vol-slider { width: 72px; }
#lw-player.mode-radio .seek-only,
#lw-player.mode-video .seek-only { display: none; }
#lw-player.mode-playlist .live-read,
#lw-player.mode-video .live-read { display: none; }
#player-queue {
  position: absolute;
  left: 0.7rem;
  bottom: calc(100% + 0.45rem);
  width: min(28rem, calc(100vw - 1.4rem));
  max-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid transparent;
  box-shadow: none;
  z-index: 30;
}
#player-queue.open {
  max-height: min(52vh, 30rem);
  overflow: auto;
  border-color: var(--border2);
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
.q-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.q-head button {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}
.q-head button[hidden] { display: none !important; }
.q-head button.on { color: var(--neon); border-color: var(--neon); }
.queue-toggle.on { color: var(--neon); border-color: var(--neon); }
#lw-pip, #lw-chat {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: #0a0a0f;
  border: 1px solid var(--border2);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
#lw-pip[hidden], #lw-chat[hidden] { display: none !important; }
#lw-pip {
  right: 0.8rem;
  bottom: var(--dock-bottom, 5.4rem);
  width: min(320px, 46vw);
  z-index: 40;
  overflow: hidden;
}
#lw-pip.expanded {
  left: 0.8rem;
  top: 3.4rem;
  width: auto;
}
#lw-pip iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  border: 0;
  background: #000;
}
#lw-pip.expanded iframe,
#lw-pip:fullscreen iframe {
  flex: 1 1 0%;
  width: 100%;
  height: 0;
  min-height: 0;
  aspect-ratio: auto;
}
#lw-chat {
  top: var(--sitebar-h, 2.6rem);
  right: 0.5rem;
  width: min(380px, calc(100vw - 1rem));
  height: min(60vh, calc(100vh - var(--sitebar-h, 2.6rem) - var(--player-h, 4.5rem)));
  background: #13131f;
  border: 1px solid #2a2a44;
  z-index: 45;
}
body.lw-chat-open.lw-chat-expanded #lw-chat {
  width: min(40vw, calc(100vw - 1rem));
  height: calc(100vh - var(--sitebar-h, 2.6rem) - var(--player-h, 4.5rem));
}
body.lw-chat-open #lw-pip {
  right: calc(min(380px, calc(100vw - 1rem)) + 1rem);
  width: min(320px, 46vw, calc(100vw - min(380px, calc(100vw - 1rem)) - 2.2rem));
}
body.lw-chat-open.lw-chat-expanded #lw-pip {
  right: calc(min(40vw, calc(100vw - 1rem)) + 1rem);
  width: min(320px, 46vw, calc(100vw - min(40vw, calc(100vw - 1rem)) - 2.2rem));
}
body.lw-chat-open #lw-pip.expanded {
  top: var(--sitebar-h, 3.4rem);
  bottom: var(--player-h, 4.5rem);
  left: 0.8rem;
  right: calc(min(380px, calc(100vw - 1rem)) + 1rem);
  width: auto;
}
body.lw-chat-open.lw-chat-expanded #lw-pip.expanded {
  right: calc(min(40vw, calc(100vw - 1rem)) + 1rem);
}
body.lw-chat-open #player-queue {
  width: min(28rem, calc(100vw - min(380px, calc(100vw - 1rem)) - 1.8rem));
}
body.lw-chat-open.lw-chat-expanded #player-queue {
  width: min(28rem, calc(100vw - min(40vw, calc(100vw - 1rem)) - 1.8rem));
}
#lw-chat iframe { flex: 1; min-height: 0; border: 0; background: #111; }
.overlay-bar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.45rem;
  padding: 0.28rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text2);
  background: var(--surface);
}
.overlay-bar span { margin-right: auto; }
.overlay-bar button, .overlay-bar a {
  background: none;
  border: 0;
  color: var(--neon);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
#lw-pip:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  inset: 0;
  border: 0;
}
.album-folder { border-bottom: 1px solid var(--border); }
.album-fold {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: none;
  border: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}
.album-folder.open > .album-fold { color: var(--neon); }
.album-fold .chev { flex: 0 0 auto; display: inline-block; }
.album-folder:not(.open) .chev { transform: rotate(-90deg); }
.album-fold .name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-badge { flex: 0 0 auto; color: var(--neon); font-size: 0.66rem; }
.album-folder:not(.open) .album-tracks { display: none; }
.album-track, .v-row {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  width: 100%;
  padding: 0.38rem 0.75rem 0.38rem 1.35rem;
  background: none;
  border: 0;
  border-top: 1px solid var(--border);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}
.album-track.playing, .v-row.playing { color: var(--neon); }
.q-num { flex: 0 0 1.6rem; color: var(--dim); }
.q-title {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-year { flex: 0 0 auto; color: var(--dim); font-size: 0.72rem; }
.dl-mini {
  flex: 0 0 auto;
  color: var(--dim);
  font-size: 0.68rem;
  text-decoration: none;
}
.v-section, .v-label, .v-hint {
  font-family: var(--mono);
  color: var(--dim);
}
.v-section {
  padding: 0.5rem 0.75rem 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}
.v-label {
  padding: 0.4rem 0.75rem 0.1rem;
  color: var(--text2);
  font-size: 0.78rem;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.v-hint { margin: 0; padding: 0 0.75rem 0.35rem; font-size: 0.72rem; }
@media (max-width: 720px) {
  #sitebar { gap: 1.1rem; padding: 0.5rem 0.75rem; }
  #sitebar a.mark.here { margin-left: -0.75rem; }
  .player-bar-inner { grid-template-columns: 1fr; gap: 0.35rem; }
  .player-controls, .bar-right { justify-self: start; }
  .vol-wrap { display: none; }
  .player-progress-wrap { width: 100%; }
  #lw-pip { width: min(320px, calc(100vw - 1.6rem)); }
}
@media (max-width: 700px) {
  #lw-chat,
  body.lw-chat-open.lw-chat-expanded #lw-chat {
    left: 0;
    right: 0;
    width: auto;
  }
  body.lw-chat-open.lw-chat-expanded #lw-chat {
    height: calc(100vh - var(--sitebar-h, 2.6rem) - var(--player-h, 4.5rem));
  }
  body.lw-chat-open #lw-pip,
  body.lw-chat-open.lw-chat-expanded #lw-pip {
    right: 0.8rem;
    width: min(320px, calc(100vw - 1.6rem));
  }
  body.lw-chat-open #lw-pip.expanded,
  body.lw-chat-open.lw-chat-expanded #lw-pip.expanded {
    left: 0.8rem;
    right: 0.8rem;
    width: auto;
  }
  body.lw-chat-open #player-queue,
  body.lw-chat-open.lw-chat-expanded #player-queue {
    width: min(28rem, calc(100vw - 1.4rem));
  }
}
