:root {
  --bg: #0b1220;
  --bg-2: #111a2e;
  --ink: #0f172a;
  --paper: #f4f7fb;
  --card: #ffffff;
  --line: #dbe3ee;
  --accent: #38bdf8;
  --blue: #1d4ed8;
  --blue-2: #0ea5e9;
  --danger: #dc2626;
  --ok: #16a34a;
  --muted: #64748b;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.view { min-height: 100%; }

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  font-size: 18px;
}
.brand.small { color: #e2e8f0; font-size: 15px; }
.mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    linear-gradient(#0b1220, #0b1220) padding-box,
    linear-gradient(135deg, #38bdf8, #1d4ed8) border-box;
  border: 0;
  position: relative;
  box-shadow: inset 0 0 0 2px #0b1220;
  background-color: #0b1220;
}
.mark::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 9px;
  width: 12px;
  height: 9px;
  border-radius: 2px;
  background: #38bdf8;
}
.mark::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 11px;
  border-left: 6px solid #7dd3fc;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}
.spacer { flex: 1; }

.home {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto 48px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: start;
}
.hero { padding-top: 28px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}
h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.lead { margin: 0; color: #334155; font-size: 18px; line-height: 1.5; max-width: 36rem; }
.account-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.account-line { margin: 4px 0 12px; color: #334155; font-size: 14px; line-height: 1.45; }
.inline-link { color: var(--blue); font-weight: 700; }
.card, .downloads {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.downloads { grid-column: 1 / -1; }
.downloads h2 { margin: 0 0 6px; font-size: 20px; }
.downloads p { margin: 0 0 14px; color: #334155; }
.fine { color: var(--muted) !important; font-size: 13px; margin: 12px 0 0 !important; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 13px; font-weight: 650; color: #334155; }
input, select {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
input:focus, select:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2); }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: #e2e8f0;
  color: var(--ink);
  font-weight: 700;
}
.btn.primary {
  width: 100%;
  color: white;
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
}
.btn.primary:disabled { opacity: 0.6; cursor: wait; }
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  margin: 16px 0;
}
.or::before, .or::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; }
.error { min-height: 1.2em; color: var(--danger); font-size: 14px; margin: 10px 0 0; }
.dl-row { display: flex; flex-wrap: wrap; gap: 10px; }
.dl {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 650;
}
.dl:hover { border-color: var(--blue-2); }
.text-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
}
.text-btn:hover { background: rgba(148, 163, 184, 0.16); }

.lobby {
  width: min(1040px, calc(100% - 32px));
  margin: 8px auto 40px;
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 22px;
}
.preview-wrap {
  position: relative;
  background: #0b1220;
  border-radius: 20px;
  min-height: 420px;
  overflow: hidden;
}
#preview { width: 100%; height: 100%; min-height: 420px; object-fit: cover; transform: scaleX(-1); background: #0b1220; }
.avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 750;
}
.avatar.big {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 120px;
  height: 120px;
  font-size: 48px;
}
.preview-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
}
.lobby-side {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.lobby-side h2 { margin: 0 0 8px; }
.code-line { margin: 0 0 16px; color: #334155; font-variant-numeric: tabular-nums; }

body.in-call {
  background: #0b1220;
  color: #e2e8f0;
  overflow: hidden;
}
#view-call { height: 100%; display: flex; flex-direction: column; }
.call-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 0;
}
.call-meta { display: flex; align-items: center; gap: 8px; }
.call-meta.right { margin-left: auto; }
.chip {
  background: #172033;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.chip.quiet { font-weight: 600; color: #94a3b8; }
#view-call .text-btn { color: #e2e8f0; }

.net-banner, .share-banner {
  margin: 8px auto 0;
  background: #172033;
  color: #e2e8f0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.net-banner button, .share-banner button {
  border: 0;
  background: var(--accent);
  color: #0b1220;
  font-weight: 750;
  border-radius: 999px;
  padding: 6px 10px;
}
.call-body { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 10px 12px 92px; }
.stage-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; position: relative; }
.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  align-content: center;
}
.stage.share-mode { grid-template-columns: 1fr; }
.filmstrip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  height: 132px;
  flex: none;
}
.filmstrip .tile { width: 200px; height: 124px; flex: none; }
.tile {
  position: relative;
  background: #172033;
  border-radius: 14px;
  overflow: hidden;
  min-height: 160px;
  height: 100%;
}
.stage.share-mode .tile { min-height: 0; }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.screen video { object-fit: contain; }
.tile video.mirror { transform: scaleX(-1); }
.tile .avatar {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 72px;
  height: 72px;
  font-size: 28px;
}
.tile-name {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  background: rgba(11, 18, 32, 0.72);
  color: white;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 13px;
}
.tile-name span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.speaking { outline: 3px solid var(--accent); outline-offset: -3px; }
.host-tag { color: #7dd3fc; font-size: 11px; font-weight: 750; }
.mic-mini {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f87171;
  flex: none;
}
.alone {
  position: absolute;
  inset: auto 0 18px;
  text-align: center;
  color: #94a3b8;
  pointer-events: none;
}
.alone p { margin: 0 0 4px; }

.drawer {
  width: min(340px, 92vw);
  background: #111a2e;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.drawer-tabs { display: flex; gap: 6px; padding: 10px; }
.drawer-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: #94a3b8;
  border-radius: 10px;
  padding: 8px;
  font-weight: 750;
}
.drawer-tabs button.on { background: #1e293b; color: white; }
.chat-log, .people-list { flex: 1; overflow: auto; padding: 0 12px 12px; }
.chat-row { margin: 0 0 12px; }
.chat-row.system { color: #94a3b8; font-size: 13px; }
.chat-who { font-size: 12px; font-weight: 750; color: #7dd3fc; }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-time { color: #64748b; font-weight: 600; margin-left: 6px; }
.chat-form { display: flex; gap: 8px; padding: 10px; }
.chat-form input { background: #0b1220; color: white; border-color: #334155; }
.chat-form button {
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #0b1220;
  font-weight: 800;
  padding: 0 14px;
}
.person { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #1e293b; }
.person b { font-weight: 650; }

.dock {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(17, 26, 46, 0.92);
  border: 1px solid #243044;
  padding: 10px;
  border-radius: 999px;
  z-index: 5;
}
.round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: #1e293b;
  color: white;
  position: relative;
  display: grid;
  place-items: center;
}
.round.on { background: #334155; }
.round.off { background: #7f1d1d; }
.round.leave {
  width: auto;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--danger);
  font-weight: 800;
}
.round.active { background: #0369a1; }
.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 4px;
}
.ic { width: 22px; height: 22px; display: block; background: currentColor; }
.ic-mic {
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V20H9v2h6v-2h-2v-2.08A7 7 0 0 0 19 11z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V20H9v2h6v-2h-2v-2.08A7 7 0 0 0 19 11z'/></svg>") center / contain no-repeat;
}
.ic-cam {
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M17 10.5V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-3.5l5 4v-11z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M17 10.5V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-3.5l5 4v-11z'/></svg>") center / contain no-repeat;
}
.ic-share {
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M21 3H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h6v2H7v2h10v-2h-2v-2h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 12H3V5h18zM13 14h-2v-3H8l4-4 4 4h-3z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M21 3H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h6v2H7v2h10v-2h-2v-2h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 12H3V5h18zM13 14h-2v-3H8l4-4 4 4h-3z'/></svg>") center / contain no-repeat;
}
.ic-chat {
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 4V6a2 2 0 0 1 2-2z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 4V6a2 2 0 0 1 2-2z'/></svg>") center / contain no-repeat;
}
.ic-more {
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle fill='black' cx='5' cy='12' r='2'/><circle fill='black' cx='12' cy='12' r='2'/><circle fill='black' cx='19' cy='12' r='2'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle fill='black' cx='5' cy='12' r='2'/><circle fill='black' cx='12' cy='12' r='2'/><circle fill='black' cx='19' cy='12' r='2'/></svg>") center / contain no-repeat;
}
.pop {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  width: min(320px, calc(100% - 24px));
  background: #111a2e;
  border: 1px solid #243044;
  border-radius: 16px;
  padding: 14px;
  z-index: 6;
}
.pop .field span, .pop select { color: #e2e8f0; }
.pop select { background: #0b1220; border-color: #334155; }
.audio-sink { position: absolute; width: 0; height: 0; overflow: hidden; }
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  border-radius: 999px;
  padding: 10px 14px;
  z-index: 20;
  font-size: 14px;
}

@media (max-width: 860px) {
  .home, .lobby { grid-template-columns: 1fr; }
  .hero { padding-top: 0; }
  .call-top { flex-wrap: wrap; }
  .drawer {
    position: fixed;
    inset: auto 8px 88px 8px;
    height: min(52vh, 420px);
    z-index: 4;
  }
  .stage { grid-template-columns: 1fr; }
  .tile { min-height: 200px; }
}
