@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #0e1116; --fg: #eef1f5; --muted: #a3adbb; --glass: rgba(16, 20, 27, .72); --line: rgba(255, 255, 255, .14);
  --accent: #4c8dff; --ok: #2fbf71; --warn: #f0a531; --bad: #ef5350;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--fg); overscroll-behavior: none; touch-action: manipulation;
  font: 15px/1.65 "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }
main { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); }
video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
video.mirror { transform: scaleX(-1); }
/* Receiver is the mobile app (it shows the picture as sent, upright included): the preview fills the phone's screen. */
video.cover { object-fit: cover; }
svg { width: 24px; height: 24px; fill: currentColor; display: block; }

/* ---- start / message card ---- */
.card { position: relative; z-index: 4; width: min(88vw, 380px); padding: 26px 22px 22px; text-align: center; border-radius: 20px;
  background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.card .logo { width: 44px; height: 44px; margin: 0 auto 8px; color: var(--accent); }
.card h1 { margin: 0 0 6px; font-size: 19px; font-weight: 700; direction: ltr; }
.card p { margin: 6px 0; color: var(--muted); }
.card p.error { color: #ffb0ac; }
.hint { font-size: 13px; }
button { font: inherit; color: var(--fg); border: 0; background: none; padding: 0; }
button.primary { margin-top: 14px; width: 100%; min-height: 54px; border-radius: 14px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 700; }
button.primary:active { filter: brightness(.9); }
button:disabled { opacity: .5; }

.card { max-height: calc(100% - 24px); overflow-y: auto; }
.help { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); text-align: right; font-size: 13.5px; }
.help-text { color: var(--fg) !important; margin: 0 0 6px !important; }
.help ol { margin: 6px 0 10px; padding-inline-start: 20px; color: var(--muted); }
.help li { margin: 4px 0; }
.help-actions { display: flex; gap: 8px; }
.secondary { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; border-radius: 12px;
  background: rgba(255, 255, 255, .1); border: 1px solid var(--line); color: var(--fg); font: inherit; font-weight: 600; text-decoration: none; }
.help input { width: 100%; margin-top: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35);
  color: var(--fg); font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; text-align: left; }
.code { margin: 8px 0 0 !important; font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--muted); text-align: left; word-break: break-all;
  user-select: text; -webkit-user-select: text; }
.textlink { display: block; margin: 12px auto 0; color: #9cc2ff; font-size: 13px; text-decoration: underline; }
.net { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); text-align: right; }
.net .dot { display: inline-block; vertical-align: middle; margin-inline-end: 6px; }
.net p { display: inline; margin: 0 !important; color: var(--fg) !important; font-size: 13.5px; }
.net.green { border-color: rgba(47, 191, 113, .5); } .net.green .dot { background: var(--ok); }
.net.yellow { border-color: rgba(240, 165, 49, .6); } .net.yellow .dot { background: var(--warn); }
.net.red { border-color: rgba(239, 83, 80, .7); } .net.red .dot { background: var(--bad); }
.net .textlink { margin-top: 8px; }

.details { position: absolute; z-index: 3; top: calc(44px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right));
  max-width: 460px; margin: 0 auto; padding: 10px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; font-size: 12.5px; }
.details dt { color: var(--muted); white-space: nowrap; }
.details dd { margin: 0; direction: ltr; text-align: left; font-variant-numeric: tabular-nums; word-break: break-word; }
.details dd.warn { color: #ffd98a; }
.details .wide { grid-column: 1 / -1; margin: 6px 0 0; text-align: center; }

/* ---- face guide (front camera): a local overlay, never part of the stream ---- */
.face { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.face svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.face-text { position: absolute; display: flex; flex-direction: column; gap: 2px; text-align: center; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.face-text b { font-size: 15px; font-weight: 700; }
.face-text span { font-size: 12.5px; line-height: 1.55; color: rgba(255, 255, 255, .88); }
.face-text.side { text-align: right; }
.icon.mini { position: absolute; z-index: 3; top: calc(48px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); width: 38px; height: 38px; }
.icon.mini svg { width: 20px; height: 20px; }
.icon.mini.off { opacity: .55; }

/* ---- top status bar ---- */
#bar { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 14px calc(12px + env(safe-area-inset-left));
  background: linear-gradient(rgba(0, 0, 0, .7), transparent); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(47, 191, 113, .25); }
.dot.bad { background: var(--bad); }
.status { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 6px; direction: ltr; flex: none; }
.chip { padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.warn { background: rgba(240, 165, 49, .3); }

.rotate { position: absolute; z-index: 3; top: calc(46px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 16px; width: max-content; max-width: calc(100% - 24px);
  background: rgba(240, 165, 49, .92); color: #201500; font-size: 13px; font-weight: 600; line-height: 1.5; }
.rotate svg { flex: none; }
.rotate svg { width: 18px; height: 18px; }

/* ---- bottom dock ---- */
#dock { position: absolute; z-index: 3; bottom: 0; left: 0; right: 0;
  padding: 26px calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  background: linear-gradient(transparent, rgba(0, 0, 0, .78)); }
.buttons { display: flex; align-items: center; justify-content: center; gap: 10px; }
.icon { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.icon:active { background: rgba(255, 255, 255, .22); }
.icon.on { background: var(--warn); color: #201500; border-color: var(--warn); }
.icon.danger { color: #ffb0ac; }
.seg { display: flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); direction: ltr; }
.seg button { min-height: 42px; padding: 0 13px; border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.seg button.on { background: var(--accent); color: #fff; }
.zoom { display: flex; align-items: center; gap: 10px; max-width: 420px; margin: 0 auto 12px; padding: 4px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font-size: 13px; }
.zoom input { flex: 1; min-width: 0; height: 32px; accent-color: var(--accent); direction: ltr; }
#zoomVal { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 370px) {
  .seg button { padding: 0 9px; font-size: 12px; }
  .icon { width: 46px; height: 46px; }
  .buttons { gap: 7px; }
}
