:root {
  --bg: #0a0a0a;
  --rail: #070707;
  --panel: #151515;
  --panel-2: #1d1d1d;
  --border: #262626;
  --border-soft: #1c1c1c;
  --text: #ededed;
  --muted: #6b6b6b;
  --muted-2: #909090;
  --sp-green: #1db954;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.brand-bar {
  position: fixed;
  top: 14px;
  left: 0;
  width: 100%;
  z-index: 1000;
  pointer-events: none;
}

.brand-left {
  position: absolute;
  left: 650px;
  top: -3px;
  color: var(--text);
}

.brand-center {
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--text);
  opacity: 0.85;
}

.kitty-logo svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* ---------- Rail ---------- */
.rail {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 60px;
  background: var(--rail);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0; gap: 4px;
  z-index: 30;
}
.rail-item {
  position: relative;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: none; background: transparent;
  color: var(--muted-2);
  border-radius: 11px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.rail-item:hover { background: var(--panel); color: var(--text); }
.rail-item.active { background: var(--panel); color: var(--text); }
.rail-spacer { flex: 1; }
.rail-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 52px; top: 50%;
  transform: translateY(-50%);
  background: var(--panel-2); color: var(--text);
  padding: 4px 9px; border-radius: 7px;
  font-size: 11px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.12s ease;
  border: 1px solid var(--border);
}
.rail-item:hover::after { opacity: 1; }

/* ---------- Stage ---------- */
.stage {
  margin-left: 60px;
  min-height: 100vh;
  display: flex;
  align-items: center; justify-content: center;
  gap: 40px;
  padding: 60px 40px;
  flex-wrap: wrap;
}

/* ---------- Player ---------- */
.player { width: 300px; flex-shrink: 0; }

.art-wrap {
  position: relative;
  width: 300px; height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1.5px dashed var(--border);
  display: grid; place-items: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.player.dragover .art-wrap { border-color: var(--text); background: var(--panel-2); }
.art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.art.show { display: block; }
.art.show ~ .art-empty { display: none; }
.art-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--muted); font-size: 13px; cursor: pointer;
}

.meta { text-align: center; margin: 22px 0 4px; }
.title {
  font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artist { color: var(--muted-2); font-size: 12px; margin-top: 4px; }

.progress-row { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }
.time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 30px; }
.time:last-child { text-align: right; }

.seek {
  position: relative; flex: 1; height: 4px;
  border-radius: 999px; background: var(--panel-2); cursor: pointer;
}
.seek-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; border-radius: 999px; background: var(--text); }
.seek-handle {
  position: absolute; top: 50%; left: 0%;
  width: 11px; height: 11px; border-radius: 50%; background: #fff;
  transform: translate(-50%,-50%) scale(0); transition: transform 0.12s ease;
}
.seek:hover .seek-handle { transform: translate(-50%,-50%) scale(1); }

.controls { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 14px; }
.ctrl {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: none; background: transparent; color: var(--text);
  border-radius: 11px; cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, color 0.15s ease;
}
.ctrl:hover { background: var(--panel); }
.ctrl:active { transform: scale(0.93); }
.ctrl.ghost { color: var(--muted); width: 36px; height: 36px; }
.ctrl.ghost:hover { color: var(--text); }
.ctrl.ghost.active { color: var(--text); }
.ctrl.small { width: 32px; height: 32px; }
.ctrl.play {
  width: 48px; height: 48px;
  background: var(--text); color: #0a0a0a;
}
.ctrl.play:hover { background: #fff; }

.volume-row { display: flex; align-items: center; gap: 8px; max-width: 180px; margin: 0 auto; }
.seek.vol { height: 4px; }

/* ---------- Queue ---------- */
.queue {
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 460px;
  display: flex; flex-direction: column;
}
.queue-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.queue-head > span:first-child { font-weight: 600; }
.count {
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px;
}
.track-list { list-style: none; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.track-list::-webkit-scrollbar { width: 5px; }
.track-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.track { display: flex; align-items: center; gap: 10px; padding: 7px; border-radius: 10px; cursor: pointer; transition: background 0.12s ease; }
.track:hover, .track.active { background: var(--panel-2); }
.track-art {
  width: 36px; height: 36px; border-radius: 7px; flex-shrink: 0; overflow: hidden;
  background: #0f0f0f; border: 1px solid var(--border-soft);
  display: grid; place-items: center; color: var(--muted);
}
.track-art img { width: 100%; height: 100%; object-fit: cover; }
.track-info { min-width: 0; flex: 1; }
.track-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-dur { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.track-open { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 4px; flex-shrink: 0; }
.track-open:hover { color: var(--text); }
.track.active .track-name { color: #fff; }

.eq { display: flex; align-items: flex-end; gap: 2px; width: 15px; height: 15px; }
.eq span { flex: 1; background: var(--text); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: 0.2s; }
.eq span:nth-child(3) { animation-delay: 0.4s; }
@keyframes eq { 0%,100% { height: 30%; } 50% { height: 100%; } }

.queue-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.7; }
.queue-empty.hidden { display: none; }

/* ---------- Drawers ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 40;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 360px; max-width: 90vw;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 20px;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(.4,0,.2,1);
  z-index: 50;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.drawer.wide { width: 420px; }
.drawer.open { transform: translateX(0); }

.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.drawer-head > span { font-weight: 600; font-size: 15px; }
.drawer-actions { display: flex; align-items: center; gap: 10px; }
.x { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.x:hover { color: var(--text); }
.mini-select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 8px; font-family: inherit; font-size: 12px; cursor: pointer;
}

/* EQ */
.viz { width: 100%; height: 60px; border-radius: 10px; background: #0d0d0d; border: 1px solid var(--border-soft); margin-bottom: 22px; }
.eq-bands { display: flex; justify-content: space-between; gap: 8px; }
.eq-band { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; }
.eq-band input[type=range] {
  -webkit-appearance: none; appearance: none;
  writing-mode: vertical-lr; direction: rtl;
  width: 5px; height: 150px;
  background: var(--panel-2); border-radius: 99px; cursor: pointer;
}
.eq-band input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--text); cursor: pointer;
}
.eq-band input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 50%; background: var(--text); cursor: pointer; }
.eq-freq { font-size: 10px; color: var(--muted); }
.eq-gain { font-size: 10px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* Drawer text + shared inputs (youtube / playlists) */
.drawer-note { color: var(--muted-2); font-size: 12px; line-height: 1.6; margin-bottom: 14px; }
.drawer-fine { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 16px; }
.sp-input {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font-family: inherit; font-size: 13px; width: 100%;
}
.sp-input::placeholder { color: var(--muted); }
.sp-btn {
  background: var(--text); color: #0a0a0a;
  border: none; border-radius: 9px; padding: 10px 14px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}
.sp-btn:hover { background: #fff; }
.sp-btn.small { padding: 9px 12px; white-space: nowrap; }
.sp-row { display: flex; gap: 8px; margin-bottom: 14px; }
.sp-status { font-size: 12px; color: var(--muted-2); margin-bottom: 12px; min-height: 16px; line-height: 1.5; }

/* Queue tools + youtube badge */
.queue-tools { display: flex; align-items: center; gap: 8px; }
.tool { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 2px 8px; font-family: inherit; font-size: 11px; cursor: pointer; }
.tool:hover { color: var(--text); }
.src-badge { display: inline-block; font-size: 9px; font-weight: 600; color: #0a0a0a; border-radius: 4px; padding: 0 4px; margin-right: 6px; vertical-align: middle; }
.src-badge.yt { background: #ff5858; }
.src-badge.sc { background: #ff7700; }
.src-badge.blk { background: #b23b3b; color: #fff; }
.src-badge.fix { background: #2f9e57; color: #fff; }
.track.blocked .track-name { color: var(--muted-2); }

/* youtube advanced (api key) */
.yt-adv { margin-top: 18px; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.yt-adv summary { cursor: pointer; font-size: 12px; color: var(--muted-2); user-select: none; }
.yt-adv summary:hover { color: var(--text); }
.yt-adv[open] summary { color: var(--text); margin-bottom: 10px; }
.yt-adv a { color: var(--text); }

/* Saved playlists */
.pl-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.pl-empty { color: var(--muted); font-size: 12px; padding: 8px 4px; }
.pl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 8px; border-radius: 10px; transition: background 0.12s ease; }
.pl-row:hover { background: var(--panel-2); }
.pl-info { min-width: 0; }
.pl-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-size: 11px; color: var(--muted); }
.pl-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pl-load { background: var(--text); color: #0a0a0a; border: none; border-radius: 7px; padding: 5px 10px; font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.pl-del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.pl-del:hover { color: #ff5858; }

/* ---------- Account + cloud playlists ---------- */
.rail-item.signed::before {
  content: ''; position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sp-green); border: 1.5px solid var(--rail);
}

.seg-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.auth-tab, .pl-tab {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--muted-2); border-radius: 8px; padding: 8px;
  font-family: inherit; font-size: 12px; cursor: pointer;
  transition: color 0.13s ease, border-color 0.13s ease;
}
.auth-tab:hover, .pl-tab:hover { color: var(--text); }
.auth-tab.active, .pl-tab.active { color: var(--text); border-color: var(--text); }

#authForms { display: flex; flex-direction: column; gap: 10px; }
.auth-who { font-size: 13px; color: var(--muted-2); margin-bottom: 14px; }
.auth-who strong { color: var(--text); }

.sp-btn.ghost { background: transparent; color: var(--muted-2); border: 1px solid var(--border); }
.sp-btn.ghost:hover { background: var(--panel-2); color: var(--text); }

.pl-gate { display: flex; flex-direction: column; gap: 12px; color: var(--muted-2); font-size: 13px; line-height: 1.6; }
.pl-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted-2); margin-bottom: 12px; cursor: pointer; }
.pl-check input { accent-color: var(--text); }
.pl-badge { font-size: 9px; color: var(--sp-green); border: 1px solid var(--sp-green); border-radius: 4px; padding: 0 4px; vertical-align: middle; }
.pl-pub, .pl-del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.pl-pub:hover, .pl-del:hover { color: var(--text); }
.pl-del:hover { color: #ff5858; }

/* rail avatar */
.rail-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

/* profile block */
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.avatar-edit { position: relative; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; cursor: pointer; flex-shrink: 0; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-cam {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22px;
  display: grid; place-items: center; font-size: 10px; color: #fff;
  background: rgba(0,0,0,0.6); opacity: 0; transition: opacity 0.15s ease;
}
.avatar-edit:hover .avatar-cam { opacity: 1; }
.profile-meta { min-width: 0; }
.profile-name { font-size: 15px; font-weight: 600; }
.profile-uid { font-size: 11px; color: var(--muted); margin-top: 2px; }
.profile-follow { font-size: 12px; color: var(--muted-2); margin-top: 4px; }
.profile-follow b { color: var(--text); }

/* public playlist rows */
.pl-row.pub { align-items: flex-start; }
.owner-av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #0f0f0f; }
.pl-rate { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.stars { display: inline-flex; }
.star { color: #3a3a3a; cursor: pointer; font-size: 13px; line-height: 1; transition: color 0.1s ease; }
.star.on { color: var(--muted-2); }
.star.mine { color: #f7c948; }
.star:hover { color: #f7c948; }
.rate-avg { font-size: 10px; color: var(--muted); }
.pl-follow {
  background: transparent; border: 1px solid var(--border); color: var(--muted-2);
  border-radius: 7px; padding: 4px 10px; font-family: inherit; font-size: 11px; cursor: pointer;
  white-space: nowrap; transition: color 0.13s ease, border-color 0.13s ease, background 0.13s ease;
}
.pl-follow:hover { color: var(--text); border-color: var(--text); }
.pl-follow.on { background: var(--sp-green); border-color: var(--sp-green); color: #08160c; }

/* clickable owner */
.owner-av.link { cursor: pointer; }
.owner-link { cursor: pointer; }
.owner-link:hover { color: var(--text); text-decoration: underline; }

/* sort row */
.pl-sort-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sort-label { font-size: 11px; color: var(--muted); }

/* profile page */
.pl-back { background: transparent; border: none; color: var(--muted-2); cursor: pointer; font-family: inherit; font-size: 12px; padding: 0 0 12px; }
.pl-back:hover { color: var(--text); }
.profile-card { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 12px; margin-bottom: 16px; }
.profile-card-av { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #0f0f0f; }
.profile-card-meta { flex: 1; min-width: 0; }
.profile-card-name { font-size: 16px; font-weight: 600; }
.group-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }

/* notifications */
.notif-badge {
  position: absolute; top: 5px; right: 5px;
  min-width: 15px; height: 15px; padding: 0 3px;
  display: grid; place-items: center;
  background: #ff5858; color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
  border-radius: 99px; border: 1.5px solid var(--rail);
}
.notif-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.notif { display: flex; align-items: center; gap: 11px; padding: 10px 8px; border-radius: 10px; }
.notif.unread { background: rgba(29,185,84,0.08); }
.notif-av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #0f0f0f; cursor: pointer; }
.notif-body { font-size: 13px; color: var(--muted-2); line-height: 1.4; }
.notif-body b { color: var(--text); font-weight: 600; }
.notif-stars { color: #f7c948; }
.notif-time { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* hidden youtube + soundcloud hosts */
#ytHost, #scHost { position: fixed; bottom: 0; left: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
#scHost iframe { width: 1px; height: 1px; border: 0; }

@media (max-width: 760px) {
  .stage { flex-direction: column; padding: 50px 20px; }
  .player, .queue { width: 100%; max-width: 320px; }
  .art-wrap { width: 100%; }
}
