:root {
  --navy: #10151f;
  --navy-2: #171d2b;
  --navy-3: #1d2436;
  --border: #2a3348;
  --silver: #eef1f5;
  --silver-muted: #9aa3b8;
  --gold: #e8891a;
  --gold-light: #f7b955;
  --gold-text: #10151f;
  --success: #4ade80;
  --success-bg: #10381f;
  --error: #ff6b6b;
  --error-bg: #3a1414;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--navy);
  color: var(--silver);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--gold-light); text-decoration: none; }

/* ---------- landing (host: create/name a studio) ---------- */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.landing-card {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.wordmark { font-size: 2rem; font-weight: 700; letter-spacing: 0.02em; margin: 0 0 0.25rem; }
.wordmark span { color: var(--gold); }
.landing-card p.subtle { color: var(--silver-muted); margin: 0 0 1.5rem; font-size: 0.95rem; }
.landing-card input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--navy-3);
  color: var(--silver);
  font-size: 1rem;
  margin-bottom: 1rem;
}
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--gold);
  color: var(--gold-text);
  width: 100%;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--gold-light); }
.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--silver);
}
.btn.secondary:hover { border-color: var(--gold); color: var(--gold-light); }
.btn.danger { background: var(--error); color: #fff; }

/* ---------- green room (pre-join camera/mic check) ---------- */
.greenroom {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.greenroom-card {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
}
.greenroom-preview {
  position: relative;
  background: var(--navy-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin: 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.greenroom-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror, like a real mirror/webcam preview */
}
.greenroom-toggles {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.greenroom-card .btn { margin-top: 0.5rem; }
.device-selects { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.device-select {
  background: var(--navy-3);
  color: var(--silver);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  max-width: 160px;
}

/* ---------- studio (the actual call UI) ---------- */
.studio {
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--navy-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.studio-topbar .brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.studio-topbar .brand .badge {
  background: var(--gold);
  color: var(--gold-text);
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-size: 0.85rem;
}
.studio-topbar .room-name { color: var(--silver-muted); font-size: 0.9rem; margin-left: 0.75rem; }
.studio-topbar .invite-btn {
  background: var(--navy-3);
  border: 1px solid var(--border);
  color: var(--silver);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.studio-topbar .invite-btn:hover { border-color: var(--gold); color: var(--gold-light); }

.studio-stage {
  flex: 1;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  overflow: auto;
  align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.tile {
  position: relative;
  background: var(--navy-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .name-tag {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(16, 21, 31, 0.75);
  color: var(--silver);
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}
.tile .avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--navy-2);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-light);
}

.studio-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--navy-2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ctrl-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--navy-3);
  color: var(--silver);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ctrl-btn:hover { border-color: var(--gold); }
.ctrl-btn.off { background: var(--error-bg); border-color: var(--error); color: var(--error); }
.ctrl-btn.leave { background: var(--error); border-color: var(--error); color: #fff; }
.ctrl-btn.leave:hover { background: #ff8787; }

.status-banner {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.85rem;
  color: var(--silver-muted);
}
.status-banner.error { color: var(--error); }
.status-banner.success { color: var(--success); }
