:root {
  --bg: #05060d;
  --ink: #e9edff;
  --muted: #8b93b8;
  --line: rgba(255, 255, 255, 0.08);
  --glass: rgba(14, 18, 36, 0.55);
  --glass-strong: rgba(18, 23, 44, 0.82);
  --cyan: #62e6ff;
  --violet: #a78bfa;
  --pink: #ff7ac6;
  --radius: 18px;
  --max: 1180px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- background ---------- */
#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.aurora {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
}
.a1 {
  width: 46vw; height: 46vw; left: -12vw; top: -14vw;
  background: radial-gradient(circle, rgba(98, 230, 255, 0.55), transparent 65%);
  animation: drift1 22s ease-in-out infinite alternate;
}
.a2 {
  width: 42vw; height: 42vw; right: -10vw; top: 6vh;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.5), transparent 65%);
  animation: drift2 26s ease-in-out infinite alternate;
}
.a3 {
  width: 38vw; height: 38vw; left: 28vw; bottom: -18vw;
  background: radial-gradient(circle, rgba(255, 122, 198, 0.35), transparent 65%);
  animation: drift3 30s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate3d(8vw, 6vh, 0) scale(1.12); } }
@keyframes drift2 { to { transform: translate3d(-6vw, 10vh, 0) scale(1.08); } }
@keyframes drift3 { to { transform: translate3d(6vw, -8vh, 0) scale(1.15); } }

.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 70%);
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px min(5vw, 48px);
  background: rgba(5, 6, 13, 0.55);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 13px;
}
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 0 14px var(--cyan);
}
.topbar nav { display: flex; gap: 28px; }
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.12em;
  transition: color 0.2s ease;
}
.topbar nav a:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.ghost-btn, .primary-btn {
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  font-family: inherit;
}
.ghost-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.ghost-btn:hover { border-color: rgba(98, 230, 255, 0.45); }
.primary-btn {
  border: 0;
  color: #05060d;
  font-weight: 700;
  background: linear-gradient(120deg, var(--cyan), var(--violet) 60%, var(--pink));
  box-shadow: 0 8px 28px rgba(98, 230, 255, 0.25);
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 34px rgba(167, 139, 250, 0.35); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- hero ---------- */
main { position: relative; z-index: 1; }

.hero {
  min-height: calc(100vh - 65px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8vh 5vw 12vh;
}
.kicker {
  margin: 0 0 22px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.42em;
  color: var(--cyan);
  opacity: 0.85;
  animation: fadeUp 0.9s ease both;
}
.hero h1 {
  margin: 0;
  font-size: clamp(46px, 11vw, 132px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.grad {
  background: linear-gradient(100deg, #ffffff 5%, var(--cyan) 35%, var(--violet) 62%, var(--pink) 92%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 9s linear infinite, fadeUp 1s 0.1s ease both;
  filter: drop-shadow(0 0 38px rgba(98, 230, 255, 0.22));
}
@keyframes shine { to { background-position: 220% 0; } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.sub {
  margin: 24px 0 0;
  color: var(--muted);
  letter-spacing: 0.32em;
  font-size: clamp(12px, 1.4vw, 15px);
  animation: fadeUp 1s 0.25s ease both;
}
.stats {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 42px;
  padding: 16px 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 16, 32, 0.45);
  backdrop-filter: blur(12px);
  animation: fadeUp 1s 0.4s ease both;
}
.stats div { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.stats b { font-size: 22px; font-weight: 700; }
.stats span { font-size: 11px; letter-spacing: 0.16em; color: var(--muted); }
.stats .divider { width: 1px; height: 28px; background: var(--line); min-width: 0; }
.scroll-cue {
  margin-top: 54px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.24em;
}
.scroll-cue i {
  width: 1px; height: 42px;
  background: linear-gradient(var(--cyan), transparent);
  animation: cue 2.2s ease-in-out infinite;
}
@keyframes cue {
  0%, 100% { opacity: 0.2; transform: scaleY(0.5); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); transform-origin: top; }
}

/* ---------- sections ---------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 80px min(5vw, 24px) 40px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0.04em;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.section-head .num {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: 0.1em;
}
.empty { color: var(--muted); font-size: 14px; padding: 22px 0; }

/* ---------- dropzone / upload ---------- */
.dropzone {
  margin-bottom: 18px;
  padding: 22px;
  text-align: center;
  color: var(--cyan);
  font-size: 14px;
  border: 1.5px dashed rgba(98, 230, 255, 0.4);
  border-radius: var(--radius);
  background: rgba(98, 230, 255, 0.05);
}
.dropzone.active {
  background: rgba(98, 230, 255, 0.12);
  border-color: var(--cyan);
  box-shadow: inset 0 0 40px rgba(98, 230, 255, 0.12);
}
.upload-queue { display: grid; gap: 8px; margin-bottom: 18px; }
.uq-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.uq-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uq-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.uq-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--violet)); transition: width 0.2s ease; }
.uq-item.done .uq-bar i { background: #46e1a0; }

/* ---------- gallery ---------- */
.masonry { columns: 4 250px; column-gap: 16px; }
.card {
  position: relative;
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  cursor: zoom-in;
  transform: translateZ(0);
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
  animation: pop 0.5s ease both;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(98, 230, 255, 0.35);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45), 0 0 30px rgba(98, 230, 255, 0.1);
}
.card img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.card img.loaded { opacity: 1; }
.card:hover img { transform: scale(1.035); }
.card .meta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 12px 10px;
  font-size: 11px;
  color: #dfe6ff;
  background: linear-gradient(transparent, rgba(4, 6, 14, 0.85));
  opacity: 0;
  transition: opacity 0.25s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card:hover .meta { opacity: 1; }
.card .del {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(5, 6, 13, 0.7);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.card:hover .del { opacity: 1; }
.card .del:hover { background: #c3345c; border-color: transparent; }

/* ---------- player ---------- */
.player-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
}
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.player { padding: 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.disc {
  width: 92px; height: 92px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #0b0e1c 0 18%, transparent 19%),
    conic-gradient(from 0deg, #1b2140, #2c3566, #1b2140, #2c3566, #1b2140);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.02), 0 12px 30px rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  position: relative;
}
.disc::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.disc-hole {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 0 18px rgba(98, 230, 255, 0.5);
}
.player.playing .disc { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#viz { width: 100%; height: 64px; display: block; opacity: 0.9; }
#trackTitle {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seek-row {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.seek-row span:last-child { text-align: right; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--cyan);
  border: 0;
  box-shadow: 0 0 12px rgba(98, 230, 255, 0.7);
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border: 0; border-radius: 50%;
  background: var(--cyan);
}
.controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: relative;
}
.controls button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.controls button:hover { border-color: rgba(98, 230, 255, 0.5); transform: translateY(-1px); }
.controls .play {
  width: 54px; height: 54px;
  font-size: 18px;
  border: 0;
  color: #05060d;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 10px 26px rgba(98, 230, 255, 0.28);
}
.volume {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
  width: 110px;
}
.volume input { height: 3px; }

.playlist {
  margin: 0;
  padding: 10px;
  list-style: none;
  overflow-y: auto;
  max-height: 420px;
}
.playlist li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #cfd6f2;
  transition: background 0.18s ease;
}
.playlist li:hover { background: rgba(255, 255, 255, 0.05); }
.playlist li.active { background: rgba(98, 230, 255, 0.1); color: #fff; }
.playlist .idx {
  font-family: Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
}
.playlist li.active .idx { color: var(--cyan); }
.playlist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist .dur { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.playlist:empty::after { content: "暂无曲目"; color: var(--muted); font-size: 13px; padding: 20px; display: block; text-align: center; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 4, 10, 0.9);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 6vw;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 100%;
  max-height: 86vh;
  border-radius: 10px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
  animation: zoomIn 0.28s ease;
}
@keyframes zoomIn { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.lb-close {
  position: absolute;
  top: 22px; right: 26px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.lb-nav.prev { left: 2vw; }
.lb-nav.next { right: 2vw; }
.lb-close:hover, .lb-nav:hover { background: rgba(98, 230, 255, 0.16); border-color: rgba(98, 230, 255, 0.4); }
#lbCaption {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- modal ---------- */
body.auth-locked { overflow: hidden; }
body.auth-locked .topbar,
body.auth-locked main,
body.auth-locked .footer,
body.auth-locked #chatFab,
body.auth-locked #chatPanel,
body.auth-locked #lightbox { display: none !important; }
body.auth-locked .modal { z-index: 96; }
.auth-switch {
  justify-self: start;
  font-size: 13px;
  padding: 0;
}
body.auth-locked .auth-switch { color: var(--cyan); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(3, 4, 10, 0.72);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-card {
  width: min(400px, 100%);
  padding: 28px;
  display: grid;
  gap: 12px;
  animation: zoomIn 0.24s ease;
}
.modal-card h3 { margin: 0; font-size: 18px; letter-spacing: 0.04em; }
.modal-card .hint { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.modal-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.modal-card input:focus { border-color: rgba(98, 230, 255, 0.55); box-shadow: 0 0 0 3px rgba(98, 230, 255, 0.1); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- toast ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: grid;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.24s ease;
}
.toast.err { border-color: rgba(255, 90, 120, 0.45); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.footer {
  position: relative;
  z-index: 1;
  padding: 60px 20px 40px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: rgba(139, 147, 184, 0.6);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .player-wrap { grid-template-columns: 1fr; }
  .masonry { columns: 3 200px; }
}
@media (max-width: 620px) {
  .topbar { padding: 12px 18px; gap: 12px; }
  .topbar nav { gap: 16px; }
  .masonry { columns: 2 140px; column-gap: 10px; }
  .card { margin-bottom: 10px; border-radius: 10px; }
  .section { padding-top: 56px; }
  .stats { gap: 14px; padding: 14px 20px; }
  .volume { display: none; }
  .controls { justify-content: center; }
  .lb-nav { width: 42px; height: 42px; }
  .lb-nav.prev { left: 8px; }
  .lb-nav.next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .aurora { animation: none; }
}

/* ================= multi-user additions ================= */
.auth { display: flex; align-items: center; gap: 8px; position: relative; }
.user-area { display: flex; align-items: center; gap: 8px; position: relative; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.icon-btn:hover { border-color: rgba(98, 230, 255, .45); background: rgba(98, 230, 255, .08); }
.badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff4d75;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  max-width: 170px;
}
.user-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip:hover { border-color: rgba(98, 230, 255, .4); }
.avatar {
  width: 26px; height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #06070f;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
}
.avatar.small { width: 20px; height: 20px; font-size: 9px; }
.menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 60;
  width: 176px;
  padding: 8px;
  display: grid;
  gap: 2px;
  animation: zoomIn .18s ease;
}
.menu button, .menu a {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.menu button:hover, .menu a:hover { background: rgba(98, 230, 255, .1); }
.notif-panel {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  z-index: 60;
  width: min(360px, calc(100vw - 24px));
  max-height: min(520px, 68vh);
  display: flex;
  flex-direction: column;
  animation: zoomIn .18s ease;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.notif-list { overflow-y: auto; padding: 6px; }
.notif-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.notif-item:hover { background: rgba(255, 255, 255, .04); }
.notif-item.unread { background: rgba(98, 230, 255, .07); }
.notif-top { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; font-size: 12px; }
.notif-top b { color: var(--cyan); }
.notif-top span { color: var(--muted); }
.notif-item p { margin: 4px 0; font-size: 12px; color: #cfd6f2; overflow-wrap: anywhere; }
.notif-item time { font-size: 10px; color: var(--muted); }
.link-btn {
  border: 0; background: none; color: var(--cyan);
  font-family: inherit; font-size: 12px; cursor: pointer; padding: 2px 0;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #ff7d9b; }
.pill-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.pill-btn:hover { border-color: rgba(98, 230, 255, .4); }
.pill-btn.liked { color: #ff7d9b; border-color: rgba(255, 90, 120, .4); background: rgba(255, 90, 120, .1); }
.pill-btn.danger { color: #ff9db2; }

/* card info */
.card-info {
  position: absolute;
  inset: auto 0 0 0;
  padding: 34px 11px 10px;
  background: linear-gradient(transparent, rgba(4, 6, 14, .88) 60%);
  pointer-events: none;
}
.card-info > * { pointer-events: auto; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-owner { font-size: 10px; color: var(--cyan); letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-like {
  border: 0; background: rgba(5, 6, 13, .4);
  color: #dfe6ff; font-family: inherit; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; cursor: pointer;
  flex: 0 0 auto;
}
.card-like.liked { color: #ff8fae; }
.card-title {
  margin-top: 3px;
  font-size: 12px; color: #eef2ff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-comments { display: inline-block; margin-top: 2px; font-size: 10px; color: var(--muted); }
.card .del { opacity: 0; }
.card:hover .del { opacity: 1; }
@media (hover: none) { .card .del { opacity: 1; } }

/* lightbox with comments */
.lightbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
  align-items: stretch;
  padding: 3vh 3vw;
}
.lb-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}
.lb-stage img { max-height: 76vh; max-width: 100%; }
.lb-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 60px;
}
.lb-info { min-width: 0; }
.lb-info h3 { margin: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-info p { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.lb-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.lb-close { top: 4px; right: 4px; z-index: 2; }
.lb-nav { top: 42%; }
.lb-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 88vh;
  overflow: hidden;
}
.side-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.muted { color: var(--muted); font-size: 11px; }
.comment-list { flex: 1 1 auto; overflow-y: auto; padding: 8px 12px; }
.comment { padding: 9px 4px 9px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.comment:last-child { border-bottom: 0; }
.comment.deleted { opacity: .6; }
.comment-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; }
.comment-head b { font-size: 12px; color: #eaf0ff; }
.comment-head time { margin-left: auto; color: var(--muted); font-size: 10px; }
.comment-reply-to { color: var(--violet); font-size: 10px; }
.comment-body { margin: 4px 0 0 26px; font-size: 12.5px; color: #dce4ff; overflow-wrap: anywhere; line-height: 1.55; }
.comment-actions { margin-left: 26px; display: flex; gap: 12px; }
.mention { color: var(--cyan); }
.composer { position: relative; border-top: 1px solid var(--line); padding: 10px 12px 12px; }
.composer-row { display: flex; gap: 8px; }
.composer input, .chat-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .25);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.composer input:focus, .chat-form input:focus { border-color: rgba(98, 230, 255, .5); }
.composer .primary-btn, .chat-form .primary-btn { padding: 8px 14px; font-size: 12px; }
.reply-hint {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 7px;
  font-size: 11px; color: var(--muted);
}
.reply-hint b { color: var(--violet); }
.reply-hint button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.mention-box {
  position: absolute;
  bottom: calc(100% - 2px);
  left: 12px; right: 12px;
  z-index: 5;
  display: flex; flex-direction: column;
  padding: 5px;
  max-height: 180px; overflow-y: auto;
  border-radius: 10px;
  border: 1px solid rgba(98, 230, 255, .25);
  background: rgba(12, 16, 32, .97);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.mention-item {
  border: 0; background: none; color: var(--ink);
  text-align: left; font-family: inherit; font-size: 12px;
  padding: 7px 9px; border-radius: 7px; cursor: pointer;
}
.mention-item:hover { background: rgba(98, 230, 255, .12); }
.empty.small { font-size: 12px; padding: 14px; }

/* music lock */
.lock-panel {
  padding: 34px 22px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-bottom: 18px;
}
.lock-panel h3 { margin: 4px 0 0; font-size: 16px; }
.lock-panel p { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.lock-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--cyan);
  border: 1px solid rgba(98, 230, 255, .3);
  background: rgba(98, 230, 255, .07);
}

/* chat */
.chat-fab {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 70;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid rgba(98, 230, 255, .35);
  background: linear-gradient(135deg, rgba(98, 230, 255, .94), rgba(167, 139, 250, .94));
  color: #06070f;
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(98, 230, 255, .25);
}
.chat-fab .badge { top: -6px; right: -6px; }
.chat-panel {
  position: fixed;
  right: 20px; bottom: 84px;
  z-index: 80;
  width: min(360px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: zoomIn .2s ease;
}
.chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.chat-head .muted { margin-left: auto; }
.chat-head button { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.chat-messages { flex: 1 1 auto; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 9px; }
.chat-msg { max-width: 88%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; }
.chat-msg.deleted { opacity: .55; }
.chat-meta { display: flex; gap: 7px; align-items: baseline; font-size: 10px; color: var(--muted); }
.chat-msg.mine .chat-meta { justify-content: flex-end; }
.chat-meta b { color: var(--cyan); font-weight: 600; }
.chat-msg.mine .chat-meta b { color: var(--violet); }
.chat-body {
  margin-top: 2px;
  padding: 7px 11px;
  border-radius: 12px 12px 12px 4px;
  background: rgba(255, 255, 255, .06);
  font-size: 12.5px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-msg.mine .chat-body {
  border-radius: 12px 12px 4px 12px;
  background: rgba(98, 230, 255, .12);
}
.chat-form {
  position: relative;
  display: flex; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.chat-form .mention-box { left: 12px; right: 12px; bottom: calc(100% - 4px); }
.hidden { display: none !important; }
#filterMineBtn.active { border-color: rgba(98, 230, 255, .5); color: var(--cyan); }

@media (max-width: 900px) {
  .lightbox { grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); }
  .lb-bar { padding: 0 46px; }
}
@media (max-width: 760px) {
  .topbar nav { display: none; }
  .lightbox {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(260px, 46vh);
    gap: 0;
    padding: 0;
  }
  .lb-stage { padding: 10px 10px 6px; justify-content: center; }
  .lb-stage img { max-height: 46vh; }
  .lb-bar { padding: 0 8px; }
  .lb-info h3 { font-size: 13px; }
  .lb-info p { display: none; }
  .lb-nav { width: 40px; height: 40px; top: 40%; }
  .lb-close { top: 8px; right: 8px; }
  .lb-side { max-height: 46vh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .comment-list { padding: 6px 10px; }
  .chat-panel { right: 8px; bottom: 76px; width: calc(100vw - 16px); height: min(70vh, 560px); }
  .chat-fab { right: 12px; bottom: 14px; }
  .notif-panel { position: fixed; top: 64px; right: 10px; }
  .user-chip { padding-right: 8px; }
  .user-chip span:last-child { display: none; }
}
.comment-list { min-height: 0; }
.chat-messages { min-height: 0; }
