:root {
  --bg: #0a0a0f;
  --panel: #14141c;
  --border: #26263a;
  --text: #e8e8f0;
  --muted: #9a9ab0;
  --accent: #6c5ce7;
  --accent-2: #00d2ff;
  --danger: #ff5470;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a1a2e 0%, var(--bg) 60%);
  color: var(--text);
}
.hidden { display: none !important; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- Card (landing / prejoin) ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px;
  width: min(460px, 92vw);
  margin: 8vh auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.tag { color: var(--muted); font-size: 0.92rem; margin: 4px 0 26px; }

.actions { display: grid; gap: 14px; }
button {
  font-size: 1rem; font-weight: 600; padding: 13px 16px; border-radius: 12px;
  cursor: pointer; border: 1px solid var(--border); color: var(--text);
  transition: transform 0.08s ease, opacity 0.2s ease;
}
button:disabled { opacity: 0.5; cursor: default; }
button:active { transform: translateY(1px); }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; width: 100%; }
.secondary { background: transparent; }

.divider { text-align: center; color: var(--muted); font-size: 0.8rem;
  position: relative; }
.divider span { background: var(--panel); padding: 0 10px; position: relative; z-index: 1; }
.divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--border); }

.join { display: grid; gap: 10px; }
input, select {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: #0e0e16; border: 1px solid var(--border); color: var(--text);
  font-size: 1rem;
}
.field { display: grid; gap: 6px; margin: 16px 0; }
.field > span { font-size: 0.82rem; color: var(--muted); }

.created { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 18px; }
.kv { display: flex; justify-content: space-between; gap: 12px; align-items: center;
  font-size: 0.9rem; margin: 8px 0; }
.kv span { color: var(--muted); }
.kv code { background: #0e0e16; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); word-break: break-all; }
.hint { color: var(--muted); font-size: 0.82rem; margin: 12px 0; }

.note { margin-top: 24px; font-size: 0.78rem; color: var(--muted); line-height: 1.5;
  border-top: 1px solid var(--border); padding-top: 16px; }
.error { color: var(--danger); font-size: 0.86rem; margin-top: 14px; }

/* ---- In-call ---- */
.room-body { display: flex; flex-direction: column; min-height: 100vh; }
.call { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 12px; }
.videos { flex: 1; position: relative; display: grid; place-items: center; }
.video-wrap { position: relative; border-radius: 16px; overflow: hidden;
  background: #000; border: 1px solid var(--border); }
.video-wrap.remote { width: 100%; height: 100%; min-height: 50vh; }
.video-wrap.remote video { width: 100%; height: 100%; object-fit: contain; }
.video-wrap.local { position: absolute; right: 20px; bottom: 20px;
  width: 200px; height: 132px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.video-wrap.local video { width: 100%; height: 100%; object-fit: cover; }
.label { position: absolute; left: 10px; top: 8px; font-size: 0.72rem;
  color: var(--muted); background: rgba(0,0,0,0.4); padding: 2px 8px; border-radius: 6px; }

.caption { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  max-width: 90%; text-align: center; font-size: 1.15rem; line-height: 1.4;
  color: #fff; background: rgba(0,0,0,0.62); padding: 8px 16px; border-radius: 10px;
  min-height: 0; }
.caption:empty { display: none; }

.bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; }
.status { color: var(--muted); font-size: 0.88rem; }
.timer { color: var(--accent-2); font-variant-numeric: tabular-nums; font-size: 0.88rem; }
.xlate { color: var(--muted); font-size: 0.82rem; }
.controls { margin-left: auto; display: flex; gap: 10px; }
.ctl { background: #0e0e16; border: 1px solid var(--border); }
.ctl.off { opacity: 0.45; }
.ctl.danger { background: rgba(255, 84, 112, 0.15); border-color: var(--danger);
  color: var(--danger); }

.my-caption { text-align: center; color: var(--muted); font-size: 0.9rem;
  min-height: 1.2em; }
.my-caption:empty { display: none; }

@media (max-width: 640px) {
  .video-wrap.local { width: 120px; height: 80px; right: 12px; bottom: 12px; }
  .caption { font-size: 1rem; }
}
