@font-face {
  font-family: "Vazirmatn";
  src: url("/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --bg: #0f172a;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0284c7;
  --brand-ink: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

/* ---------- simple pages ---------- */
.page { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.card {
  width: 100%; max-width: 460px; background: var(--card); border-radius: 22px;
  padding: 28px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.brand { display: flex; justify-content: center; margin-bottom: 8px; }
h1 { font-size: 1.45rem; margin: 6px 0 8px; text-align: center; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
.lead { color: var(--muted); text-align: center; margin: 0 0 20px; line-height: 1.9; }
.note { color: var(--muted); font-size: .86rem; line-height: 1.9; margin: 18px 0 0; }
.muted { color: var(--muted); font-size: .86rem; }
.steps { color: #334155; line-height: 2; padding-inline-start: 22px; margin: 22px 0 0; font-size: .95rem; }

.btn {
  font: inherit; border: 1px solid var(--line); background: #f8fafc; color: var(--ink);
  border-radius: 12px; padding: 10px 14px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn:hover { background: #f1f5f9; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: #0369a1; }
.btn.big { width: 100%; padding: 14px 16px; font-size: 1.05rem; font-weight: 600; }
.choice { display: grid; gap: 10px; margin-top: 18px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: #334155; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; }

.share label { display: block; font-size: .9rem; color: #334155; margin-bottom: 6px; }
.linkrow { display: flex; gap: 6px; }
.linkrow input {
  flex: 1; min-width: 0; font: inherit; font-size: .85rem; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: #f8fafc; color: #0f172a;
}
.ico { display: inline-flex; width: 1.25em; height: 1.25em; }
.ico svg { width: 100%; height: 100%; }

/* ---------- call ---------- */
.callpage { position: fixed; inset: 0; background: #000; color: #fff; overflow: hidden; }
.stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#remoteVideo { width: 100%; height: 100%; object-fit: contain; background: #000; }
.offtile {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; background: #111827; color: #cbd5e1; font-size: 1rem; text-align: center;
}
.avatar {
  width: 112px; height: 112px; border-radius: 50%; background: #1f2937; display: flex;
  align-items: center; justify-content: center; color: #94a3b8;
}
.avatar .ico { width: 56px; height: 56px; }
.waitbox {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; background: rgba(15,23,42,.92); padding: 24px; text-align: center; font-size: 1.05rem;
}
.waitbox .linkrow { width: 100%; max-width: 440px; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255,255,255,.2);
  border-top-color: #38bdf8; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#tapToPlay { position: absolute; z-index: 5; }

.topbar {
  position: absolute; top: 0; inset-inline: 0; display: flex; gap: 8px; flex-wrap: wrap;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; z-index: 4;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), rgba(0,0,0,0));
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(15,23,42,.7);
  color: #e2e8f0; border-radius: 999px; padding: 6px 12px; font-size: .85rem; border: 0; font-family: inherit;
}
.pill.ok { color: #bbf7d0; }
.btnlike { cursor: pointer; }

.local {
  position: absolute; z-index: 3; width: 28vw; max-width: 200px; min-width: 104px; aspect-ratio: 3 / 4;
  bottom: calc(env(safe-area-inset-bottom) + 96px); inset-inline-start: 12px;
  border-radius: 14px; overflow: hidden; background: #1f2937; box-shadow: 0 6px 24px rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.15);
}
@media (min-aspect-ratio: 1/1) { .local { aspect-ratio: 4 / 3; } }
#localVideo { width: 100%; height: 100%; object-fit: cover; }
#localVideo.mirror { transform: scaleX(-1); }
.offtile.small { font-size: .78rem; gap: 6px; }
.offtile.small .ico { width: 28px; height: 28px; }

.controls {
  position: absolute; bottom: 0; inset-inline: 0; z-index: 4; display: flex; justify-content: center; gap: 14px;
  padding: 14px 12px calc(env(safe-area-inset-bottom) + 16px);
  background: linear-gradient(to top, rgba(0,0,0,.6), rgba(0,0,0,0));
}
.cbtn {
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; display: flex;
  align-items: center; justify-content: center; background: rgba(255,255,255,.16); color: #fff;
  backdrop-filter: blur(6px);
}
.cbtn .ico { width: 26px; height: 26px; }
.cbtn:hover { background: rgba(255,255,255,.26); }
.cbtn.off { background: #f8fafc; color: #0f172a; }
.cbtn.hang { background: var(--danger); }
.cbtn.hang:hover { background: #b91c1c; }

.sheet {
  position: absolute; z-index: 6; inset-inline: 12px; bottom: calc(env(safe-area-inset-bottom) + 100px);
  max-width: 440px; margin: 0 auto; background: #fff; color: var(--ink); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.5); line-height: 1.9; font-size: .95rem;
}
.codebig { font-size: 2.2rem; font-weight: 800; letter-spacing: .12em; text-align: center; margin: 6px 0 8px; color: #0369a1; }

#toast {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 100px);
  background: rgba(15,23,42,.95); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .92rem;
  max-width: calc(100% - 32px); text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.nojs { color: #fff; text-align: center; padding: 40px; }
