:root {
  color-scheme: dark;
  --bg: #050711;
  --panel: rgba(15, 19, 34, .82);
  --line: rgba(157, 169, 211, .16);
  --text: #f5f7ff;
  --muted: #98a1bc;
  --violet: #9d78ff;
  --cyan: #72edff;
  --green: #6ff2b4;
  --red: #ff728b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(114, 237, 255, .11), transparent 28rem),
    radial-gradient(circle at 88% 0%, rgba(157, 120, 255, .14), transparent 34rem),
    var(--bg);
}
button { font: inherit; cursor: pointer; }
.page-header, main { width: min(1200px, calc(100% - 40px)); margin-inline: auto; }
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 38px 0 30px;
}
.back-link { display: inline-block; margin-bottom: 24px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--cyan); }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: .72rem; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.055em; }
.intro { max-width: 610px; margin: 13px 0 0; color: var(--muted); line-height: 1.55; }
.sync-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(8, 11, 22, .72);
  font-size: .82rem;
  white-space: nowrap;
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 12px currentColor; }
.sync-state.synced .sync-dot { background: var(--green); }
.sync-state.error .sync-dot { background: var(--red); }
.space-section {
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(12, 16, 30, .62);
  backdrop-filter: blur(15px);
}
.recent-section { background: linear-gradient(135deg, rgba(78, 51, 145, .2), rgba(12, 16, 30, .62)); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.section-heading h2 { margin: 0; font-size: clamp(1.25rem, 3vw, 1.7rem); letter-spacing: -.025em; }
.space-count { min-width: 34px; padding: 6px 10px; border-radius: 999px; color: var(--muted); background: #20263a; text-align: center; font-size: .78rem; font-weight: 750; }
.space-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.space-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid rgba(157, 169, 211, .15);
  border-radius: 16px;
  background: rgba(17, 22, 40, .95);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .14);
}
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.live-badge span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.space-card[data-recent="true"] .live-badge { color: var(--violet); }
.space-card time { color: #6f7895; font-size: .68rem; }
.space-card h3 { margin: 18px 0 7px; overflow-wrap: anywhere; font-size: 1.08rem; line-height: 1.35; }
.room-id { margin: 0; overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 18px; }
.join-link, .copy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 41px;
  padding: 10px 13px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  font-size: .78rem;
  font-weight: 750;
  text-decoration: none;
}
.join-link { gap: 7px; background: linear-gradient(135deg, #7046e8, #9d6fff); box-shadow: 0 8px 22px rgba(124, 82, 244, .2); }
.join-link:hover, .copy-link:hover { filter: brightness(1.1); }
.copy-link { border: 1px solid var(--line); background: #20263a; }
.copy-status { min-height: 1em; margin: 7px 0 -2px; color: var(--green); font-size: .68rem; text-align: right; }
.empty-state { margin: 0; padding: 28px 12px; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }

@media (max-width: 900px) { .space-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .page-header, main { width: min(100% - 24px, 1200px); }
  .page-header { display: block; padding: 24px 0 22px; }
  .back-link { margin-bottom: 18px; }
  .sync-state { width: max-content; margin-top: 20px; padding: 9px 11px; }
  .space-section { padding: 16px; border-radius: 18px; }
  .space-grid { grid-template-columns: 1fr; }
  .card-actions { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
