/* vital-meet — dark, minimal, no framework. */
:root {
  --bg: #111418; --panel: #1b2026; --text: #e8eaed; --muted: #9aa0a6;
  --accent: #4f9cf9; --danger: #e25555; --rec: #ff5252; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---- cards / forms (landing + prejoin) ---- */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 16px; overflow-y: auto; z-index: 10;
}
main.card { max-width: 460px; margin: 8vh auto; padding: 0 16px; }
.card { background: var(--panel); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 460px; }
main.card { background: var(--panel); }
h1 { font-size: 1.5rem; margin: 0 0 6px; }
.sub { color: var(--muted); margin-top: 0; }
.muted { color: var(--muted); font-size: .9rem; }
label { display: block; margin: 14px 0 6px; font-size: .95rem; }
label.row { display: flex; gap: 8px; align-items: center; }
input[type=text], input[type=password] {
  width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid #333a42; background: #12161a; color: var(--text); font-size: 1rem;
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
button, .button {
  display: inline-block; margin-top: 16px; padding: 10px 18px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer; text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
button.danger { background: var(--danger); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.error { color: var(--danger); }
.rec-note { color: var(--rec); font-weight: 600; }
.share-line a { color: var(--accent); word-break: break-all; }

/* prejoin toggles + preview */
button.toggle { background: #2a3138; }
button.toggle.on { background: var(--accent); }
#pj-preview-wrap { margin-top: 14px; }
#pj-preview {
  width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 8px;
  object-fit: cover; transform: scaleX(-1);
}

/* ---- call screen ---- */
.room-body { overflow: hidden; }
#call { position: fixed; inset: 0; display: flex; flex-direction: column; }
#topbar {
  display: flex; gap: 14px; align-items: center; padding: 10px 16px;
  background: var(--panel); font-size: .95rem;
}
#room-title { font-weight: 600; }
#stage { flex: 1; display: flex; min-height: 0; padding: 8px; gap: 8px; }
#grid {
  flex: 1; display: grid; gap: 8px; min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  grid-auto-rows: 1fr;
}
.focus-mode #grid { flex: 0 0 180px; display: flex; flex-direction: column; overflow-y: auto; }
.focus-mode #grid .tile { flex: 0 0 120px; }
#focus { flex: 1; position: relative; min-width: 0; }
#focus-video { width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: var(--radius); }

.tile {
  position: relative; background: #20262d; border-radius: var(--radius);
  overflow: hidden; min-height: 0; border: 2px solid transparent;
}
.tile.speaking { border-color: var(--accent); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile video.mirror { transform: scaleX(-1); }
.tile.novideo video { visibility: hidden; }
.tile.novideo::before {
  content: "🎙"; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: 2.2rem; opacity: .5;
}
.name-label {
  position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px;
  background: rgba(0,0,0,.55); font-size: .85rem; max-width: 85%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; z-index: 2;
}
.mic-badge {
  position: absolute; right: 8px; top: 8px; padding: 2px 6px; border-radius: 6px;
  background: rgba(0,0,0,.55); font-size: .85rem; z-index: 2;
}

#toolbar {
  display: flex; gap: 10px; justify-content: center; padding: 10px max(16px, env(safe-area-inset-left));
  padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--panel);
}
#toolbar button { margin-top: 0; font-size: 1.15rem; min-width: 52px; }
#toolbar .toggle:not(.on) { background: var(--danger); }
#tb-share.toggle:not(.on) { background: #2a3138; }

#banner {
  position: fixed; top: 56px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.75); padding: 8px 16px; border-radius: 8px; z-index: 20;
}
#audio-unlock {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 20;
}

@media (max-width: 640px) {
  #grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .focus-mode #stage { flex-direction: column; }
  .focus-mode #grid { flex: 0 0 110px; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .focus-mode #grid .tile { flex: 0 0 150px; }
}
