:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232e;
  --border: #2a3442;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --accent: #7c5cff;
  --accent-2: #9d85ff;
  --danger: #e5484d;
  --ok: #2fa36b;
}

* { box-sizing: border-box; }

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

.screen.hidden { display: none !important; }

/* ---------- Landing ---------- */

#landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(800px 500px at 15% 10%, rgba(124, 92, 255, 0.14), transparent 60%),
              radial-gradient(700px 500px at 90% 90%, rgba(47, 163, 107, 0.10), transparent 60%),
              var(--bg);
}

.landing-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.logo, .brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo span, .brand span { color: var(--accent-2); }

.landing-card h1 {
  font-size: 24px;
  line-height: 1.25;
  margin: 20px 0 8px;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 24px;
}

#name-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s;
}

#name-input:focus { border-color: var(--accent); }

.landing-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
}

button.primary, button.ghost {
  flex: 1;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  transition: filter 0.15s, background 0.15s;
}

button.primary {
  background: var(--accent);
  color: #fff;
}

button.primary:hover { background: var(--accent-2); }

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.ghost:hover { background: var(--panel-2); }

.hint {
  min-height: 18px;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--danger);
  text-align: center;
}

.hint.ok { color: var(--ok); }

/* ---------- Call screen ---------- */

#call {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.meeting-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.meeting-meta span {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#copy-link-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s;
}

#copy-link-btn:hover { background: var(--border); }

#copy-link-btn svg { width: 14px; height: 14px; }

#participants {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

#participants svg { width: 14px; height: 14px; }

#grid {
  flex: 1;
  display: grid;
  --tile-size: 320px;
  grid-template-columns: repeat(auto-fit, minmax(var(--tile-size), var(--tile-size)));
  justify-content: center;
  gap: 14px;
  align-content: center;
  padding: 16px 20px;
  overflow-y: auto;
}

#grid.spotlight {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  align-content: stretch;
  padding: 0;
}

#grid.spotlight .tile:not(.spotlight) { display: none; }

#grid.spotlight .tile.spotlight {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: 0;
}

.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #05070b;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile .placeholder {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: #0d1117;
}

.tile.no-cam video { display: none; }
.tile.no-cam .placeholder { display: grid; }

.tile .placeholder svg {
  width: 44px;
  height: 44px;
  opacity: 0.45;
}

.tile .label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
  padding: 4px 10px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.tile .label .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
}

.badge[hidden] { display: none; }

.badge.muted { background: var(--danger); color: #fff; }
.badge.sharing { background: var(--accent); color: #fff; }

/* ---------- Controls ---------- */

#controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

.ctl {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.1s;
}

.ctl:hover { background: var(--border); }
.ctl:active { transform: scale(0.94); }

.ctl svg { width: 24px; height: 24px; }

.ctl.off, .ctl.off:hover { background: var(--danger); }
.ctl.active, .ctl.active:hover { background: var(--accent); }
.ctl.danger, .ctl.danger:hover { background: #d93025; color: #fff; }

.zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.zoom input[type="range"] {
  width: 110px;
  accent-color: var(--accent);
  cursor: pointer;
}

.zoom span {
  min-width: 38px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .ctl { width: 48px; height: 48px; }
  .ctl svg { width: 20px; height: 20px; }
  .meeting-meta span { display: none; }
  .zoom input[type="range"] { width: 80px; }
}