:root {
  --bg: #0d1117;
  --bg-soft: #151b24;
  --panel: #171e28;
  --panel-2: #1d2632;
  --line: #26313f;
  --text: #e8edf4;
  --muted: #8b98a9;
  --accent: #5865f2;
  --accent-2: #7c4dff;
  --ok: #3ba55c;
  --warn: #faa61a;
  --err: #ed4245;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(88, 101, 242, .22), transparent 60%),
    radial-gradient(700px 460px at 95% 0%, rgba(124, 77, 255, .16), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.muted { color: var(--muted); }
.error { color: var(--err); margin: 12px 0 0; font-size: 14px; }
[hidden] { display: none !important; }

/* ---------------------------------- login --------------------------------- */

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; position: relative; }

.login-card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.brand { text-align: center; margin-bottom: 26px; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: 50%;
  font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px rgba(88, 101, 242, .35);
}
.brand h1 { font-size: 20px; margin: 14px 0 2px; letter-spacing: .2px; }
.brand p { margin: 0; font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

input[type="password"], input[type="search"], input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* --------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 40px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #24303e; border-color: #33404f; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary {
  width: 100%;
  margin-top: 14px;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #ffd9da; border-color: #4a2a2c; background: #2a1b1d; }
.btn.danger:hover { background: #3a2325; border-color: #6b3a3d; }
.btn.ghost { background: transparent; }
.btn.icon { width: 44px; padding: 0; }
.btn[aria-pressed="true"] {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------------------------------- shell --------------------------------- */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 18px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px 20px;
  flex-wrap: wrap;
}
.topbar .brand-mark { width: 38px; height: 38px; font-size: 19px; box-shadow: none; }
.topbar h1 { font-size: 16px; margin: 0; }
.topbar .sub { margin: 0; font-size: 12px; }
.topbar .spacer { flex: 1 1 auto; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.live { color: #bff3cd; border-color: #264a30; background: #16261a; }
.pill.live .dot { background: var(--ok); }

.grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 14px; }

/* ------------------------------- now playing ------------------------------ */

.np { display: flex; gap: 16px; align-items: center; }
.np-art {
  width: 116px; height: 116px;
  flex: 0 0 auto;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.np-art.placeholder { display: grid; place-items: center; font-size: 30px; color: #3a4757; }
.np-meta { min-width: 0; flex: 1 1 auto; }
.np-title { font-size: 18px; font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.np-artist { margin: 2px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.np-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.np-idle { color: var(--muted); padding: 12px 0; }

.progress { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.progress .time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); min-width: 42px; }
.bar {
  position: relative;
  flex: 1 1 auto;
  height: 8px;
  border-radius: 999px;
  background: #232d3a;
  cursor: pointer;
  overflow: hidden;
}
.bar .fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; }
.bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.controls { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.controls .big { width: 52px; height: 52px; min-height: 52px; border-radius: 50%; }
.controls .big svg { width: 22px; height: 22px; }
.toggles { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.vol { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.vol input[type="range"] { flex: 1 1 auto; accent-color: var(--accent); height: 22px; }
.vol .value { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); min-width: 38px; text-align: right; }

/* --------------------------------- search ------------------------------- */

.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row input { flex: 1 1 220px; }
.search-row select {
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

.results { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}
.result img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #202935; flex: 0 0 auto; }
.result .thumb-fallback { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; background: #202935; color: #3a4757; flex: 0 0 auto; }
.result .who { min-width: 0; flex: 1 1 auto; display: block; }
.result .t { display: block; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .s { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------- queue ------------------------------- */

.queue { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.qrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); }
.qrow .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; width: 22px; flex: 0 0 auto; text-align: right; }
.qrow .who { min-width: 0; flex: 1 1 auto; display: block; }
.qrow .t { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow .s { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow .dur { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qrow .x { width: 30px; min-height: 30px; padding: 0; flex: 0 0 auto; }
.empty { color: var(--muted); font-size: 14px; }

/* --------------------------------- connect ------------------------------ */

select.wide { width: 100%; padding: 10px 12px; color: var(--text); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1 1 180px; }

/* ---------------------------------- toast ------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(460px, 92vw);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #1f2833;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.toast.err { border-color: #5a2b2e; background: #2a1b1d; color: #ffd9da; }
.toast.ok { border-color: #264a30; background: #16261a; color: #bff3cd; }

footer { margin-top: 26px; text-align: center; font-size: 12px; color: var(--muted); }
