:root {
  --bg: #0b0d12;
  --panel: #141821;
  --panel-2: #1b2130;
  --line: #262d3d;
  --text: #e8ebf2;
  --muted: #8a93a6;
  --accent: #f59e0b;
  --accent-ink: #1a1203;
  --good: #22c55e;
  --bad: #ef4444;
  --radius: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent); }
button, input { font: inherit; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #11151d, var(--bg));
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 800; letter-spacing: .02em; font-size: 18px; }
.brand span { color: var(--accent); }
.topbar .spacer { flex: 1; }
.who-btn {
  background: none; border: 1px solid transparent; color: var(--muted); font-size: 14px;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.who-btn:hover { border-color: var(--line); color: var(--text); }
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.slots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.slot {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); display: inline-flex; align-items: center; gap: 6px;
}
.slot.empty { color: var(--muted); border-style: dashed; }
.badge.building { color: #fbbf24; border-color: #fbbf2455; }
.badge.planned { color: var(--muted); }

/* ---- buttons ---- */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 9px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: #3a4357; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: transparent; color: var(--bad); border-color: #4a2323; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- layout ---- */
main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }
h1 { font-size: 26px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 24px; }

.now-playing {
  display: none; align-items: center; gap: 16px; flex-wrap: wrap;
  border: 1px solid #3b2f12; background: #1a1508; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 24px;
}
.now-playing.show { display: flex; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px var(--good); }
.now-playing .grow { flex: 1; min-width: 200px; }

/* ---- library grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.cover {
  aspect-ratio: 3 / 4; background-size: cover; background-position: center;
  display: flex; align-items: flex-end; padding: 16px; position: relative;
}
.cover .cover-title { font-weight: 800; font-size: 22px; line-height: 1.1; text-shadow: 0 2px 12px #000a; }
.badge {
  position: absolute; top: 12px; left: 12px; font-size: 12px; font-weight: 700;
  padding: 4px 9px; border-radius: 999px; background: #000a; border: 1px solid #ffffff22;
}
.badge.live { color: var(--good); border-color: #22c55e55; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .desc { font-size: 14px; color: #c3c9d6; margin: 0; flex: 1; }
.card .actions { display: flex; gap: 8px; }
.card .actions .btn { flex: 1; }

.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px; text-align: center; }

/* ---- host panel ---- */
.host { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 24px; }
.host h2 { font-size: 18px; margin: 0 0 12px; }
.invite-out { margin-top: 12px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; color: var(--muted); }

/* ---- auth pages ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth form {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.auth label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.auth input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 11px 12px; border-radius: 9px;
}
.auth input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.error { color: var(--bad); font-size: 14px; min-height: 1em; margin: 0; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px;
  opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; }

@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  main { padding: 20px 16px 48px; }
  .who-btn .label { display: none; }
}
