/* زمزم۱۰ — پوستهٔ فارسی، راست‌به‌چپ. پالتِ «سبزِ نازرو روی سرمه‌ای» (هم‌ریختِ بی‌سیمِ نازرو). */
:root {
  color-scheme: dark;
  /* توکن‌های مرجع */
  --gold:       #76b900;
  --gold2:      #5a8c00;
  --bg:         #0a1018;
  --panel:      #0e1b30;
  --panel2:     #12233d;
  --line:       rgba(120,150,190,.22);
  --line2:      rgba(120,150,190,.14);
  --text:       #e8f0fa;
  --muted:      #8fb0d8;
  --muted2:     #6a85a8;
  --green:      #5fd08a;
  --red:        #e06060;
  --blue:       #5aa0ff;
  --radius:     14px;
  /* هم‌نام‌های سازگاری: قواعدِ موجودِ زمزم۱۰ که هنوز از این توکن‌ها استفاده می‌کنند
     اکنون به مقادیرِ مرجع نگاشته می‌شوند تا کلِ اپ یک‌جا هم‌ریخت شود. */
  --bg-2:       #0e1b30;
  --olive:      #223a5a;   /* مرزها/پرکردنِ ملایمِ سرمه‌ای (جای زیتونیِ قبلی) */
  --olive-lt:   #2f5286;
  --olive-dk:   #0c1830;   /* نوارِ بالا/کشو */
  --amber:      #76b900;   /* CTA اکنون سبز است */
  --amber-lt:   #9be000;
  --danger:     #e06060;
  --ok:         #5fd08a;
  font-family: 'Vazirmatn', 'Noto Sans Arabic', 'Inter', 'Tahoma', system-ui, sans-serif;
}
* { box-sizing: border-box; }
/* اصلاحِ ریشه‌ای: صفتِ [hidden] باید همیشه بر هر display: کلاسی غلبه کند.
   (بدونِ این، پوشش‌های position:fixed مانندِ اسکنر/کشو/مودال روی صفحه می‌مانند.) */
[hidden] { display: none !important; }
/* قفلِ پنجرهٔ اپ: کلِ صفحه جابه‌جا/کشیده/زوم نمی‌شود (اندروید). فقط نواحیِ درون‌اسکرول
   (جریان/فهرست‌ها) اسکرول می‌کنند و کششِ‌بیش‌ازحدشان به بدنه سرایت نمی‌کند. */
html, body {
  margin: 0; position: fixed; inset: 0; width: 100%; height: 100%;
  overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
}
body {
  background: radial-gradient(1200px 700px at 50% -10%, #132743, var(--bg) 60%);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  /* ستونِ انعطافی: نوارِ بالا + صفحهٔ فعال. صفحهٔ اتاق بقیهٔ فضا را می‌گیرد، پس
     دکمهٔ صحبت هرچقدر هم نوارِ بالا بلند باشد (safe-area) هرگز بریده نمی‌شود. */
  display: flex; flex-direction: column;
}
/* نواحیِ اسکرول‌پذیر: کششِ‌بیش‌ازحد در خودشان مهار می‌شود (به پنجره سرایت نمی‌کند). */
.feed, .archive-list, .members-list, .discover-list, .rpane, .modal, .modal-card,
.hint-overlay, .hint-card, .lb-stage { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* نوارِ بالا */
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--olive-dk); border-bottom: 2px solid var(--olive);
  flex: 0 0 auto; z-index: 20;
}
#topbar[hidden] { display: none; }
.topbar-title { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.icon-btn { background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; }
/* چیپِ اتصال — قرصِ خط‌دار با رنگِ وضعیت (هم‌ریختِ .net-chip مرجع) */
.chip { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); white-space: nowrap; }
.chip-off { color: #f4c430; border-color: rgba(244,196,48,.5); }
.chip-lan { color: var(--blue); border-color: rgba(90,160,255,.45); }
.chip-net { color: var(--green); border-color: rgba(95,208,138,.45); }
.chip-local { color: var(--green); border-color: rgba(95,208,138,.35); }   /* روی دستگاه (محلی‌نخست) */
.chip-pending { color: #f4c430; border-color: rgba(244,196,48,.5); }
.chip-pending[hidden] { display: none; }
/* دکمهٔ اضطراری — نگه‌داشتنی: نوارِ رنگی از راست پر می‌شود تا وقتی که فعال شود
   (جلوگیری از فشارِ تصادفی + بازخوردِ دیداریِ «تا کِی نگه دارم»). */
.sos-btn {
  position: relative; overflow: hidden;
  background: #b3161d; color: #fff; border: 1px solid #e5484d; font-weight: 800;
  padding: 6px 12px; border-radius: 10px; cursor: pointer; touch-action: none;
  transition: transform .1s; font-size: 13px; flex: none;
}
.sos-btn .sos-lbl { position: relative; z-index: 1; white-space: nowrap; }
.sos-btn .sos-fill { position: absolute; inset: 0; z-index: 0; background: #ff3b2f; transform-origin: right; transform: scaleX(0); }
.sos-btn.arming .sos-fill { transform: scaleX(1); transition: transform 1.1s linear; }  /* پر‌شدن هم‌زمان با شمارشِ ۱٫۱ ثانیه‌ای نگه‌داشتن */
.sos-btn:active { transform: scale(.97); }
.sos-btn.fired { animation: sosFired .3s 2; }
@keyframes sosFired { 50% { background: #fff; color: #b3161d; } }
@media (prefers-reduced-motion: reduce) { .sos-btn.arming .sos-fill { transition: none; } }

/* صفحه‌ها */
/* هر صفحه بقیهٔ فضای بعد از نوارِ بالا را می‌گیرد و در صورتِ نیاز درون‌خودش می‌لغزد. */
.screen { padding: 10px 16px; max-width: 640px; margin: 0 auto; width: 100%; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
#welcome { overflow-y: auto; overflow-x: hidden; }
/* برندِ فشرده تا صفحهٔ ورود بی‌پیمایش جا شود */
.brand { text-align: center; margin: 4px 0 2px; }
.brand img { width: 54px; height: 54px; }
.brand h1 { margin: 2px 0 1px; font-size: 21px; }
.tagline { color: var(--muted); margin: 0; font-size: 11.5px; }
.brand-flag { display: block; margin: 4px auto 0; width: 40px; height: 40px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }

/* زبانه‌ها */
.tabs { display: flex; gap: 8px; margin: 10px 0 8px; }
.tab {
  flex: 1; padding: 10px; border: 1px solid var(--olive); background: transparent;
  color: var(--muted); border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 15px;
}
.tab.active { background: var(--panel); border-color: var(--gold); color: var(--gold); font-weight: 800; }

.pane { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.pane[hidden] { display: none; }   /* پنِ غیرفعال (فرمِ پیوستن/مدیر) باید پنهان شود */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input {
  padding: 9px 11px; border-radius: 10px; border: 1px solid var(--olive);
  background: var(--panel); color: var(--text); font-family: inherit; font-size: 16px;
}
input:focus { outline: 2px solid var(--amber); }
.hint { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.6; }

/* چشمکِ «نمایشِ گذرواژه» — دکمهٔ چشم درونِ خانهٔ گذرواژه (لبهٔ چپ در RTL) */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { width: 100%; padding-left: 44px; }
.pw-eye {
  position: absolute; left: 5px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; cursor: pointer; font-size: 19px; line-height: 1;
  padding: 6px 7px; opacity: .55; filter: grayscale(1);
}
.pw-eye:hover, .pw-eye.on { opacity: 1; filter: none; }

.btn-primary {
  background: linear-gradient(var(--amber-lt), var(--amber)); color: #3a2a08;
  border: none; padding: 10px; border-radius: 12px; font-weight: 800; font-size: 16px;
  cursor: pointer; font-family: inherit;
}
/* گوشیِ کوتاه: برندِ فشرده‌تر تا صفحهٔ ورود بی‌پیمایش بماند */
@media (max-height: 760px) {
  .brand img { width: 44px; height: 44px; }
  .brand-flag { width: 34px; height: 34px; }
  .tagline { font-size: 10.5px; margin: 0; }   /* «بی‌سیمِ صحرایی…» روی گوشیِ کوتاه هم دیده شود */
  .brand h1 { font-size: 19px; }
}
.btn-primary.sm { padding: 8px 12px; font-size: 14px; }
.btn-ghost {
  background: transparent; color: var(--gold); border: 1px solid var(--line);
  padding: 11px; border-radius: 12px; cursor: pointer; font-family: inherit; font-size: 15px;
  transition: border-color .12s, color .12s;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold2); }

/* گروه‌ها */
/* سربرگِ فهرست: در گوشیِ باریک دکمه‌ها می‌پیچند تا «+ گروهِ نو» هیچ‌گاه بریده نشود. */
.section-head { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 12px; gap: 8px 10px; }
.section-head h2 { margin: 0; flex: 1 0 100%; }
.section-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.section-actions .btn-ghost.sm, .section-actions .btn-primary.sm { flex: 0 1 auto; white-space: nowrap; }
.g-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.g-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.g-badge.pub { color: var(--green); border: 1px solid rgba(95,208,138,.4); background: transparent; }
.g-badge.priv { color: var(--gold); border: 1px solid rgba(118,185,0,.4); background: transparent; }
.g-count { font-size: 11px; color: var(--muted); }
/* انتخابِ نوعِ کانال (خصوصی/همگانی) */
.vis-pick { display: flex; gap: 10px; }
.vis-opt { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; text-align: center; transition: border-color .12s, background .12s; }
.vis-opt.active { border-color: var(--gold); background: rgba(118,185,0,.08); }
.vis-opt .vt { font-weight: 700; font-size: 14px; }
.vis-opt .vh { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
/* فهرستِ کشفِ کانال‌های همگانی */
.discover-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.disc-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.disc-row .g-ico { font-size: 22px; }
.disc-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.disc-sub { font-size: 11px; color: var(--muted); }
.groups { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.group-card {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--panel); border: 1px solid var(--olive); border-radius: var(--radius); cursor: pointer;
}
.group-card .g-ico { font-size: 26px; }
.group-card .g-name { font-weight: 700; flex: 1; }
.group-card .g-badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--olive-dk); color: var(--muted); }
.group-card.archived { opacity: .6; }
.empty { color: var(--muted); text-align: center; margin-top: 40px; }

/* اتاق + جریانِ پیام */
#roomScreen { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: 0; max-width: 720px; width: 100%; margin: 0 auto; overflow: hidden; }
#roomScreen[hidden] { display: none; }   /* غلبه بر [hidden] هنگامِ نمایشِ صفحه‌های دیگر */
.feed { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
/* نوارِ پیامِ سنجاق‌شده (همیشه بالای اتاق، مثلِ تلگرام/ایتا) */
.pinned-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 8px 14px; direction: rtl;
  background: var(--olive-dk); border-bottom: 1px solid var(--gold); cursor: pointer; }
.pinned-bar[hidden] { display: none; }
.pinned-bar .pin-ico { font-size: 15px; flex: 0 0 auto; }
.pinned-bar .pin-info { display: flex; flex-direction: column; min-width: 0; }
.pinned-bar .pin-lbl { font-size: 11px; color: var(--gold); }
.pinned-bar .pin-txt { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.flash .bubble { animation: pinflash 1.3s ease; }
.msg.bookmarked .bubble { position: relative; }
.msg.bookmarked .bubble::after { content: "⭐"; position: absolute; top: -6px; inset-inline-end: -4px; font-size: 12px; }
@keyframes pinflash { 0%, 100% { } 25% { box-shadow: 0 0 0 2px var(--gold); } }
/* حبابِ دوستونی: نشانگرِ فرستنده + حباب. پیامِ خودم به سمتِ مقابل می‌چسبد. */
.msg { display: flex; gap: 10px; max-width: 82%; }
.msg.mine { margin-inline-start: auto; flex-direction: row-reverse; }
.msg .who { width: 34px; height: 34px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none; }
.bubble { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 9px 13px; min-width: 0; }
.msg.mine .bubble { border-color: rgba(95,208,138,.32); background: #0f2136; }
.bubble .name { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.bubble .name b { color: var(--text); font-weight: 600; }
.bubble .body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.bubble .time { font-size: 10.5px; color: var(--muted2); }
/* پابرگِ حباب: آیکونِ ترجمه + زمان */
.bubble-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.msg-tr { border: none; background: transparent; color: var(--muted); font-size: 14px; line-height: 1; padding: 2px; cursor: pointer; border-radius: 6px; opacity: .75; }
.msg-tr:hover { opacity: 1; background: rgba(118,185,0,.12); }
.msg-tr.busy { opacity: .5; animation: trpulse 1s infinite; }
.msg-tr.done { color: var(--green); opacity: 1; }
.msg.mine .bubble-foot { flex-direction: row-reverse; }
/* خطِ ترجمهٔ نتیجه زیرِ پیام */
.msg-tr-out { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.msg-tr-src { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.msg-tr-txt { font-size: 14px; line-height: 1.6; color: #d6eefb; }
.msg-tr-txt .tr-badge { color: var(--blue); }
/* صوت (کلیپِ PTT) — پخش‌کنندهٔ بومیِ مرورگر (پخش/توقف/بلندگو/جابه‌جایی) + برچسبِ مدت */
.voice-clip { display: flex; align-items: center; gap: 9px; margin-top: 3px; max-width: 270px; }
/* دکمهٔ آغازِ پخش (پیش از گرفتنِ Blob)؛ سپس با <audio> بومی جایگزین می‌شود */
.vp-btn { flex: 0 0 auto; min-width: 74px; height: 38px; border-radius: 19px; border: none; cursor: pointer;
  background: var(--accent, #128C7E); color: #fff; font-size: 14px; padding: 0 14px; user-select: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.vp-btn.vp-load { opacity: .6; pointer-events: none; }
.voice-clip .voice-audio { flex: 1; min-width: 0; height: 38px; max-width: 240px; }
.vp-err { font-size: 12px; color: #c0392b; }
.vp-time, .voice-dur { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 30px; text-align: left; direction: ltr; }
/* عکس/ویدیو درون‌خطی */
.bubble img.att { max-width: 240px; max-height: 220px; border-radius: 10px; margin-top: 2px; display: block; }
.bubble video.att { max-width: 260px; max-height: 240px; border-radius: 10px; margin-top: 2px; }
/* فایل */
.file-att { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-top: 2px; text-decoration: none; color: inherit; }
.file-att .fi { font-size: 22px; flex: none; }
.file-att .fn { font-size: 12.5px; font-weight: 600; display: block; }
.file-att .fs { font-size: 11px; color: var(--muted); }
/* موقعیت — نقشهٔ کوچکِ تک‌سنجاق */
.loc-att { display: block; border: 1px solid var(--line); border-radius: 12px; margin-top: 2px; overflow: hidden; max-width: 240px; background: var(--panel2); }
.loc-att .loc-mini { display: block; width: 100%; height: 120px; background: #0a1524; }
.loc-att .loc-info { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.loc-att .loc-info > span { display: flex; flex-direction: column; min-width: 0; }
.loc-att .fn { font-size: 12.5px; font-weight: 600; }
.loc-att .fs { font-size: 11px; color: var(--muted); }
.loc-att .loc-open { font-size: 11px; color: var(--gold); font-weight: 700; margin-top: 2px; }
.loc-att:hover { border-color: var(--gold); }

/* نمای تمام‌صفحهٔ موقعیت (نقشهٔ رصد + سنجاق) */
.locview { position: fixed; inset: 0; z-index: 92; background: #0a1524; display: flex; flex-direction: column; }
.locview[hidden] { display: none; }
.locview-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--olive-dk); border-bottom: 1px solid var(--line); }
/* دکمهٔ بستنِ موقعیت — بزرگ و واضح (کاربرپسند) */
.locview-close { width: auto; padding: 0 16px; height: 44px; font-size: 15px; font-weight: 700; white-space: nowrap; background: var(--red, #b3161d); color: #fff; border-color: #e5484d; }
.locview-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.locview-title { font-weight: 700; font-size: 15px; }
.locview-coords { font-size: 12px; color: var(--muted); }
.locview-map { flex: 1; width: 100%; display: block; background: #0a1524; touch-action: none; min-height: 0; }
/* ترجمهٔ متنِ رسیده — ردیفِ کاملِ آبی‌رنگ */
.msg.translated { display: block; max-width: 82%; align-self: center; background: #12233d; border: 1px solid #2f5a70; color: #d6eefb; font-style: italic; padding: 8px 12px; border-radius: 12px; }
.msg.translated .who { display: inline; width: auto; height: auto; background: none; border: none; font-size: 12px; color: var(--blue); }
/* خطِ اعلامِ اضطراری در جریان */
.sos-line { display: flex; align-items: center; gap: 8px; align-self: center; max-width: 94%; background: rgba(224,96,96,.12); border: 1px solid rgba(224,96,96,.5); color: #ffb3b3; border-radius: 999px; padding: 6px 14px; font-size: 12.5px; }
.sos-line-ico { font-size: 15px; }
.sos-line-txt b { color: #ffd6d6; }
.mesh-box { margin: 10px 0; padding: 10px; border: 1px solid #2f5a70; border-radius: 10px; background: #16242e; }
.mesh-box .mesh-t { font-weight: 600; margin-bottom: 4px; }
.mesh-box .mesh-peers { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #223a4a; color: #bfe3f5; text-align: center; }

/* دکمهٔ PTT — گِردِ بزرگِ سبز با هالهٔ «آماده» + حالتِ کهربایی (اتصال) + سرخِ ضربان‌دار (پخش).
   هم‌ریختِ .ptt-big در بی‌سیمِ نازرو. */
/* بی‌سیمِ نوبتی: بنرِ «کانال مشغول» + قفلِ دیداریِ دکمهٔ صحبت */
.channel-busy { flex: none; text-align: center; background: rgba(224,96,96,.16); color: #ff9a8a; border-top: 1px solid rgba(224,96,96,.4); padding: 7px 12px; font-size: 13px; font-weight: 700; }
.channel-busy[hidden] { display: none; }
.ptt.busy { opacity: .45; filter: grayscale(.7); pointer-events: none; animation: none; }
.ptt-wrap { padding: 12px 18px 14px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; flex: none; }
.ptt {
  --ptt-size: clamp(150px, 43vw, 216px);
  position: relative; width: var(--ptt-size); height: var(--ptt-size); border-radius: 50%; border: none; flex: none;
  color: #08120a; cursor: pointer; font-family: inherit; user-select: none; -webkit-user-select: none; touch-action: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: radial-gradient(circle at 50% 30%, #9be000 0%, var(--gold) 46%, var(--gold2) 74%, #3f6600 100%);
  box-shadow:
    0 0 0 6px rgba(118,185,0,.16),
    0 0 34px rgba(118,185,0,.28),
    0 12px 30px rgba(0,0,0,.5),
    inset 0 3px 6px rgba(255,255,255,.4),
    inset 0 -10px 18px rgba(46,72,0,.5);
  transition: transform .1s ease, box-shadow .18s ease, background .18s ease;
  animation: pttready 2.6s ease-in-out infinite;
}
.ptt::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; border: 2px solid rgba(255,255,255,.28); pointer-events: none; }
.ptt .ptt-ico { color: #123; line-height: 0; transition: transform .12s; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.ptt .ptt-lbl { font-weight: 800; font-size: 14px; letter-spacing: .02em; text-shadow: 0 1px 1px rgba(255,255,255,.25); }
.ptt:hover { filter: brightness(1.05); }
.ptt:active { transform: scale(.96); }
@keyframes pttready {
  0%,100% { box-shadow: 0 0 0 6px rgba(118,185,0,.16),0 0 34px rgba(118,185,0,.26),0 12px 30px rgba(0,0,0,.5),inset 0 3px 6px rgba(255,255,255,.4),inset 0 -10px 18px rgba(46,72,0,.5); }
  50%     { box-shadow: 0 0 0 10px rgba(118,185,0,.10),0 0 44px rgba(118,185,0,.40),0 12px 30px rgba(0,0,0,.5),inset 0 3px 6px rgba(255,255,255,.4),inset 0 -10px 18px rgba(46,72,0,.5); }
}
/* اتصال/گرم‌شدنِ میکروفون — کهربایی */
.ptt.arming { color: #3a2a00; animation: none;
  background: radial-gradient(circle at 50% 30%, #ffe6a0 0%, #f4c430 44%, #c99400 72%, #7a5a00 100%);
  box-shadow: 0 0 0 8px rgba(244,196,48,.18),0 0 34px rgba(244,196,48,.34),0 12px 30px rgba(0,0,0,.5),inset 0 3px 6px rgba(255,255,255,.4);
}
.ptt.arming::before { border-color: rgba(255,255,255,.45); }
.ptt.arming .ptt-ico { color: #5a3d00; }
/* در حالِ صحبت — سرخِ ضربان‌دار */
.ptt.live { color: #2a0606; animation: pttpulse .95s ease-in-out infinite;
  background: radial-gradient(circle at 50% 30%, #ffbcbc 0%, #ff7676 42%, var(--red) 70%, #a83030 100%);
}
.ptt.live::before { border-color: rgba(255,255,255,.5); }
.ptt.live .ptt-ico { color: #5a0d0d; transform: scale(1.06); }
@keyframes pttpulse {
  0%,100% { box-shadow: 0 0 0 8px rgba(224,96,96,.28),0 0 30px rgba(224,96,96,.5),0 12px 30px rgba(0,0,0,.5),inset 0 3px 6px rgba(255,255,255,.4); }
  50%     { box-shadow: 0 0 0 20px rgba(224,96,96,.08),0 0 46px rgba(224,96,96,.65),0 12px 30px rgba(0,0,0,.5),inset 0 3px 6px rgba(255,255,255,.4); }
}
@media (prefers-reduced-motion: reduce) { .ptt, .ptt.live { animation: none; } }
/* نشانِ هدفون روی دکمهٔ صحبت وقتی هدفون/هندزفری وصل است */
body.handsfree .ptt::after { content: "🎧"; position: absolute; top: 10px; inset-inline-end: 14px; font-size: 15px; opacity: .9; }

/* کشو */
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 260px; z-index: 40;
  background: var(--olive-dk); border-left: 2px solid var(--olive);
  padding: 16px; padding-top: calc(16px + env(safe-area-inset-top));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
  /* منو باید بلغزد تا همهٔ گزینه‌ها (از جمله «خروج») روی گوشیِ کوتاه دیده شوند */
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.drawer[hidden] { display: none; }
.drawer-head { font-size: 20px; font-weight: 800; margin-bottom: 12px; flex: 0 0 auto; }
.drawer-item { flex: 0 0 auto; text-align: right; background: none; border: none; color: var(--text); padding: 12px 8px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 15px; }
.drawer-item:hover { background: var(--olive); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }

/* پنجرهٔ ماژولار */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--bg-2); border: 1px solid var(--olive); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.modal-card h3 { margin: 0; }
/* پرسشِ تأیید فارسی (askConfirm) — روی همه‌چیز، حتی روی پنجرهٔ باز */
.confirm-overlay { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.62); padding: 20px; }
.confirm-box { background: var(--bg-2); border: 1px solid var(--olive); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.confirm-box h3 { margin: 0; font-size: 17px; }
.confirm-box p { margin: 0; color: var(--muted); line-height: 1.7; }
.confirm-row { display: flex; gap: 10px; margin-top: 4px; }
.confirm-row button { flex: 1; }
.btn-primary.danger { background: #c0392b; border-color: #c0392b; color: #fff; }
.qr-box { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 12px; }
.code-big { font-size: 30px; font-weight: 800; letter-spacing: 4px; text-align: center; color: var(--amber-lt); direction: ltr; }

/* توست */
.toast { position: fixed; bottom: 24px; right: 50%; transform: translateX(50%); background: var(--olive); color: var(--text); padding: 12px 18px; border-radius: 10px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.4); max-width: 90%; text-align: center; }
.toast.err { background: var(--danger); }

/* پیوندِ کوچک + نگارش */
.link-btn { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-family: inherit; font-size: 12px; margin-top: 8px; display: block; width: 100%; }
.drawer-ver { margin-top: auto; color: var(--muted); font-size: 12px; padding: 8px; direction: rtl; }

/* زبانه‌های اتاق */
.room-tabs { display: flex; gap: 4px; padding: 6px 8px 0; background: var(--olive-dk); border-bottom: 1px solid var(--olive); }
.rtab { flex: 1; padding: 9px 4px; border: none; background: transparent; color: var(--muted); border-radius: 8px 8px 0 0; cursor: pointer; font-family: inherit; font-size: 14px; }
.rtab.active { background: var(--panel); color: var(--gold); font-weight: 800; border-bottom: 2px solid var(--gold); }
.rpane { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.rpane[hidden] { display: none; }   /* پنهان‌سازیِ پنِ غیرفعال باید بر display:flex غلبه کند */
#feedPane { display: flex; position: relative; }
#feedPane[hidden] { display: none; }

/* دکمهٔ رفتن به تازه‌ترین پیام (پایین-چپ، پیام‌رسان‌وار) */
.scroll-last {
  position: absolute; bottom: 14px; left: 14px; z-index: 5;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--olive-lt);
  background: var(--olive); color: var(--amber-lt); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.5); font-family: inherit;
  transition: opacity .16s, transform .16s;
}
.scroll-last[hidden] { display: none; }
.scroll-last .sl-arrow { font-size: 24px; line-height: 1; font-weight: 800; }
.scroll-last:active { transform: scale(.92); }
.scroll-last .sl-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; direction: ltr; box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.scroll-last .sl-badge[hidden] { display: none; }

/* نویسندهٔ پیامِ متنی */
.text-bar { display: flex; gap: 8px; padding: 8px 12px; background: var(--olive-dk); border-top: 1px solid var(--olive); }
.text-bar input { flex: 1; padding: 10px 12px; border-radius: 999px; border: 1px solid var(--olive); background: var(--panel); color: var(--text); font-family: inherit; font-size: 15px; }
.text-send { width: 44px; border: none; border-radius: 50%; background: linear-gradient(var(--amber-lt), var(--amber)); color: #3a2a08; font-size: 18px; cursor: pointer; font-family: inherit; transform: scaleX(-1); }
.text-send:active { transform: scaleX(-1) scale(.92); }
.msg.pending { opacity: .6; }
.msg.pending::after { content: ' ⏳'; font-size: 11px; }

/* نقشه */
.map-wrap { position: relative; flex: 1; min-height: 240px; display: flex; }
.mini-map { width: 100%; flex: 1; min-height: 240px; display: block; background: #0a1524; touch-action: none; }
/* نشانِ حق‌تکثیرِ رصد روی نقشه */
.map-attr { position: absolute; bottom: 8px; right: 8px; z-index: 5; display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; padding: 3px 9px; border-radius: 12px; pointer-events: none; }
.map-attr .attr-flag { border-radius: 2px; box-shadow: 0 0 0 .5px rgba(255,255,255,.35); }
/* منویِ پیام (سنجاق/حذف) + نشانِ سنجاق + قفلِ پخشِ مجدد + اختیارهای مدیر */
.msg-menu { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.msg-menu:hover { color: var(--gold); }
.pin-badge { font-size: 12px; margin-inline-end: 3px; }
.msg.pinned .bubble { box-shadow: inset 3px 0 0 var(--gold); }
.voice-locked { color: var(--muted); font-size: 13px; padding: 6px 4px; }
.admin-toggles { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.admin-toggles .chk { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.6; cursor: pointer; }
.admin-toggles .chk input { margin-top: 3px; }
/* کنترل‌های روی نقشه (بزرگ‌نمایی/چرخش/بازگشت) */
.map-ctl { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.map-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--olive-lt);
  background: rgba(20,27,48,.82); color: var(--text); font-size: 20px; line-height: 1;
  cursor: pointer; font-family: inherit; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px); box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.map-btn:active { transform: scale(.94); background: var(--olive); }
.map-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--olive-dk); flex-wrap: wrap; }
.map-legend { display: flex; gap: 16px; align-items: center; padding: 6px 14px 10px; background: var(--olive-dk); font-size: 12px; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend .lg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-legend .lg-pin { font-size: 12px; font-style: normal; }
.chk { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; flex-direction: row; }
.chk input { width: auto; }

/* بایگانی */
.arc-search { flex: 0 0 auto; margin: 10px 12px 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-family: inherit; font-size: 14px; direction: rtl; }
.arc-none { text-align: center; }
/* نمایشِ خوانا (درشت و پرکنتراست) — نورِ آفتاب/شرایطِ سخت */
body.readable .msg .bubble { font-size: 16px; }
body.readable .msg .name b { font-size: 14px; }
body.readable .body { font-size: 16px; line-height: 1.75; color: #fff; }
body.readable .arc-row, body.readable .arc-body { font-size: 16px; }
body.readable .pq-btn, body.readable .ptt-lbl, body.readable .drawer-item { font-size: 15px; }
.archive-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.arc-row { background: var(--panel); border: 1px solid var(--olive); border-radius: 12px; padding: 10px 12px; }
.arc-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.arc-head b { color: var(--amber-lt); }
.arc-img { max-width: 100%; border-radius: 8px; }
.arc-vid { max-width: 100%; border-radius: 8px; }

/* اعضا */
.members-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.mem-row { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 8px 10px; background: var(--panel); border: 1px solid var(--olive); border-radius: 10px; padding: 10px 12px; }
.mem-ava { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--olive-dk); border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center; font-size: 18px; overflow: hidden; }
/* عکسِ نیم‌رخِ کاربر (از فایلِ تصویر) در حباب و فهرستِ اعضا و پنجرهٔ نیم‌رخ */
.msg .who .who-img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.mem-ava .who-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ava-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; }
.ava-preview { width: 68px; height: 68px; border-radius: 50%; object-fit: cover; background: var(--olive-dk); border: 1px solid var(--gold); display: flex; align-items: center; justify-content: center; font-size: 34px; flex: none; }
.ava-actions { display: flex; flex-direction: column; gap: 6px; }
.mem-name { font-weight: 600; flex: 1; min-width: 90px; }
.members-hint { color: var(--muted); font-size: 12.5px; line-height: 1.9; background: var(--panel); border: 1px dashed var(--line2); border-radius: 10px; padding: 12px 14px; margin: 0 0 6px; }
/* افزودنِ مستقیمِ عضو (مدیر) */
.members-addbar { display: flex; margin: 0 0 8px; }
.members-addbar .btn-primary { flex: 1; }
.add-mem-list { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; margin-top: 6px; }
.add-mem-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--olive); border-radius: 10px; padding: 9px 12px; }
/* شبکهٔ گزینشِ نماد نیم‌رخ */
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 4px; }
.qm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.qm-pick { background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; padding: 12px 10px; font-size: 15px; font-family: inherit; cursor: pointer; direction: rtl; }
.qm-pick:active { background: var(--olive-dk); }
.bm-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; margin-top: 6px; }
.bm-item { text-align: right; background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 14px; cursor: pointer; direction: rtl; }
.bm-item b { color: var(--amber-lt); margin-inline-end: 6px; }
.log-ta { width: 100%; box-sizing: border-box; height: 40vh; margin: 8px 0; background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; padding: 10px; font-family: inherit; font-size: 13px; direction: rtl; resize: vertical; }
.coords-box { background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 10px 12px; margin: 6px 0; font-size: 15px; letter-spacing: .5px; text-align: center; }
.compass { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 5; background: rgba(0,0,0,.55); color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 5px 12px; font-size: 13px; pointer-events: none; }
/* کلیدِ ردیابیِ زنده در کشو — کمی برجسته چون قابلیتِ کلیدیِ کاروان است */
.drawer-item.track-chk { border: 1px solid #2f6bff55; border-radius: 8px; }
/* دقتِ موقعیت (خطای متر) — چیپِ بالای نقشه، رنگ بر پایهٔ کیفیت */
.gnss-acc { position: absolute; top: 44px; inset-inline-start: 10px; z-index: 5; background: rgba(0,0,0,.6); border-radius: 999px; padding: 4px 11px; font-size: 12px; pointer-events: none; border: 1px solid currentColor; }
.gnss-acc.good { color: #37d67a; } .gnss-acc.ok { color: var(--gold, #e6c873); } .gnss-acc.poor { color: #ff8a70; }
.gnss-acc[hidden] { display: none; }
/* لایهٔ روکشِ برچسب‌های نام (روی نقشه؛ موقعیتش با JS هر فریم روی نماد می‌نشیند) */
.mz-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 450; }
/* برچسبِ نامِ همیشگیِ اعضا روی نقشه (بالای نمادِ موقعیت) */
.mz-name-label { position: absolute; transform: translate(-50%, -100%) translateY(-6px);
  display: flex; flex-direction: column; align-items: center; gap: 0; white-space: nowrap; pointer-events: none;
  background: rgba(6, 20, 16, .85); color: #eaf3ea; border: 1px solid rgba(255,255,255,.22); border-radius: 8px;
  padding: 2px 7px; font-size: 12px; line-height: 1.35; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.mz-name-label b { font-weight: 700; }
.mz-name-label i { font-style: normal; font-size: 10.5px; opacity: .82; }
.mz-name-label.me { border-color: #22c55e; color: #d6ffe4; }
.mz-name-label.leader { border-color: #2f6bff; color: #d6e4ff; background: rgba(10, 20, 40, .9); }
.mz-name-label.rv { border-color: #ff4fa3; color: #ffd6ea; }
.receipt { font-size: 11px; color: var(--muted); margin-inline-end: 6px; }
.receipt.seen { color: var(--blue, #4aa3ff); }
.msg.dm-msg .bubble { outline: 1px dashed var(--gold); }
.roster-list { display: flex; flex-direction: column; gap: 6px; max-height: 48vh; overflow-y: auto; margin-top: 8px; }
.rc-row { display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; }
.rc-name { flex: 1; }
.rc-st { font-size: 12px; }
.rc-here { color: var(--green, #2e7d32); font-size: 12px; }
.rc-status { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.rc-set { background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 999px; padding: 6px 12px; font-family: inherit; font-size: 13px; cursor: pointer; }
.rc-set.sel { background: var(--olive-dk); border-color: var(--gold); }
.rc-dm { flex: 0 0 auto; }
.icon-pick { font-size: 24px; padding: 8px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.icon-pick.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.icon-pick:active { transform: scale(.94); }
/* یادداشتِ «قابلیتِ موقتاً غیرفعال» در پنجرهٔ توضیح */
.inactive-note { color: var(--amber, #f4c430); font-size: 13px; line-height: 1.8; background: rgba(244,196,48,.08); border: 1px solid rgba(244,196,48,.35); border-radius: 10px; padding: 10px 12px; margin: 4px 0; }
.mem-tag { font-size: 11px; padding: 2px 6px; border-radius: 999px; background: var(--olive); color: var(--amber-lt); }
.mem-tag.mute-tag { background: #5a2020; color: #ffb0b0; }
.mem-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* نوارِ رسانه */
/* نوارِ رسانه: هر ۷ نماد باید در عرضِ صفحه جا شوند (روی گوشیِ باریک هم). */
.media-bar { display: flex; align-items: center; gap: 2px; padding: 6px 6px; background: var(--olive-dk); border-top: 1px solid var(--olive); justify-content: space-between; }
.media-bar .icon-btn { flex: 1 1 0; min-width: 0; font-size: 19px; padding: 7px 0; border-radius: 10px; text-align: center; }
.media-bar .icon-btn.on { background: var(--olive); }
.media-bar .icon-btn.live { box-shadow: 0 0 0 2px var(--amber) inset; }
.media-bar .icon-btn.locked { opacity: .6; position: relative; }
/* قابلیتِ موقتاً غیرفعال: دیده می‌شود ولی خاکستری و بی‌اثر (فقط پیامِ راهنما). */
.icon-btn.inactive { opacity: .32; filter: grayscale(1); }
.icon-btn.inactive:active { transform: none; }
.media-bar .icon-btn.locked::after { content: '🔒'; position: absolute; top: -3px; left: -3px; font-size: 12px; filter: drop-shadow(0 1px 1px #000); }

/* پنجرهٔ ترجمهٔ زندهٔ گفتار (نمایان اما قفل) */
.tr-lock, .tr-unlock { font-size: 20px; }
.tr-select {
  padding: 12px; border-radius: 10px; border: 1px solid var(--olive);
  background: var(--panel); color: var(--text); font-family: inherit; font-size: 16px;
}
.tr-switch { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
.tr-switch input { width: auto; }
.tr-locked-note {
  background: #3a2a12; border: 1px solid var(--amber); color: var(--amber-lt);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.7;
}
.tr-live { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: 14px; }
.tr-live[hidden] { display: none; }
.tr-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(76,154,42,.7); animation: trpulse 1.4s infinite; }
@keyframes trpulse { 0% { box-shadow: 0 0 0 0 rgba(76,154,42,.6);} 70% { box-shadow: 0 0 0 8px rgba(76,154,42,0);} 100% { box-shadow: 0 0 0 0 rgba(76,154,42,0);} }
.ptt-hint { display: none; }
.ptt-quick { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pq-btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-family: inherit; cursor: pointer; }
.pq-btn:active { background: var(--olive-dk); }
.pq-btn[hidden] { display: none; }
#pttLockBtn[aria-pressed="true"] { background: var(--green, #2e7d32); color: #fff; border-color: var(--green, #2e7d32); }
.sos-loc { font-size: 12px; direction: ltr; color: #ffb0b0; margin-top: 4px; }
.msg.sos.resolved { opacity: .5; }
.sos-ack { margin-top: 6px; }

/* پویشگرِ رمزینهٔ اتاق (تمیز، بدونِ کنترلِ پخشِ سرگردان) */
.scan-overlay { position: fixed; inset: 0; z-index: 70; background: #05070c; display: flex; flex-direction: column; align-items: center; }
.scan-overlay[hidden] { display: none; }   /* [hidden] باید بر display:flex غلبه کند */
.scan-topbar {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; color: #fff;
  background: linear-gradient(#000a, transparent); position: relative; z-index: 2;
}
.scan-title { font-weight: 700; font-size: 16px; }
.scan-close {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid #ffffff44;
  background: #ffffff1a; color: #fff; font-size: 18px; cursor: pointer; line-height: 1;
}
.scan-stage { position: relative; flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
/* کنترل‌های بومیِ ویدیو را کاملاً پنهان کن تا آیکونِ پخشِ سرگردان دیده نشود */
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #05070c; pointer-events: none; }
.scan-video::-webkit-media-controls, .scan-video::-webkit-media-controls-start-playback-button,
.scan-video::-webkit-media-controls-play-button, .scan-video::-webkit-media-controls-panel { display: none !important; -webkit-appearance: none; }
.scan-frame { position: relative; width: 240px; height: 240px; border-radius: 18px; box-shadow: 0 0 0 3000px rgba(0,0,0,.5); }
.sc-corner { position: absolute; width: 30px; height: 30px; border: 4px solid var(--amber-lt); }
.sc-corner.tl { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.sc-corner.tr { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.sc-corner.bl { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.sc-corner.br { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.scan-hint { color: #fff; text-align: center; padding: 14px 20px 4px; font-size: 15px; }
.scan-overlay .btn-ghost { margin: 4px 0 calc(20px + env(safe-area-inset-bottom)); }
.join-hint { line-height: 1.9; background: var(--panel); border: 1px solid var(--olive); border-radius: 12px; padding: 10px 12px; }

/* پوششِ دوربین */
.cam-overlay { position: fixed; inset: 0; z-index: 65; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.cam-overlay[hidden] { display: none; }
.cam-video { width: 100%; max-width: 480px; max-height: 70vh; object-fit: cover; background: #000; }
.cam-controls { display: flex; gap: 16px; padding: 12px; align-items: center; justify-content: center; }
.cam-shot { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: radial-gradient(circle at 50% 30%, var(--gold), var(--gold2)); color: #0a1018; font-size: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.cam-shot:active { transform: scale(.94); }
.cam-shot:disabled { opacity: .5; }

/* پخشِ زندهٔ ویدیوی رسیده */
.live-in { position: fixed; bottom: 90px; left: 12px; z-index: 55; background: #000; border: 2px solid var(--amber); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 6px; max-width: 180px; }
.live-in[hidden] { display: none; }
.live-in img { width: 160px; border-radius: 8px; display: block; }
.live-who { color: var(--amber-lt); font-size: 12px; }

/* دکمهٔ موقعیتِ زنده (روشن) */
.map-bar .btn-ghost.on { background: var(--danger); color: #fff; border-style: solid; border-color: #ff8a70; }

/* رهیاب: دکمه‌های «مسیر/تماس با سرپرست» — پررنگ و روشن برای زائرِ سالخورده */
#routeLeaderBtn, #contactLeaderBtn { border-style: solid; border-color: #2f6bff; color: #cfe0ff; font-weight: 700; }
#routeLeaderBtn:hover, #contactLeaderBtn:hover { background: #2f6bff; color: #fff; border-color: #2f6bff; }
#routeLeaderBtn:disabled { opacity: .5; border-color: var(--line); color: var(--muted); cursor: not-allowed; }
/* «گم شده‌ام» — کهربایی و برجسته (آرام‌تر از سرخِ اضطراری) */
.lost-btn { border-style: solid; border-color: #f0a03c; color: #ffdca8; font-weight: 800; }
.lost-btn:hover { background: #f0a03c; color: #1a1200; border-color: #f0a03c; }

/* ── پوششِ تمام‌صفحهٔ اعلامِ اضطراری (سرخِ هشداردهنده + نقشهٔ زندهٔ فردِ در خطر) ── */
.sos-layer {
  position: fixed; inset: 0; z-index: 80; overflow: hidden;
  display: flex; flex-direction: column;
  background: transparent; pointer-events: none;   /* حالتِ نوارِ خلاصه: اتاق زیرش کار می‌کند */
}
.sos-layer[hidden] { display: none; }
/* حالتِ آژیرِ تمام‌صفحه (اعلامِ دیده‌نشدهٔ یک هم‌تیمی) */
.sos-layer.full { background: #2a0606; pointer-events: auto; animation: sosflash 1s ease-in-out infinite; }
@keyframes sosflash {
  0%, 100% { background: #2a0606; }
  50%      { background: #5c0f0f; }
}
/* نقشهٔ زندهٔ فردِ در خطر — فقط در حالتِ تمام‌صفحه دیده می‌شود */
.sos-map { position: absolute; inset: 0; width: 100%; height: 100%; display: none; background: #0a1524; touch-action: none; }
.sos-layer.full .sos-map { display: block; }
/* پنلِ اطلاعات: در حالتِ تمام‌صفحه روی نقشه؛ در حالتِ نوار، فقط ته‌صفحه */
.sos-panel {
  position: relative; z-index: 2; margin-top: auto; pointer-events: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px; padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.sos-layer.full .sos-panel {
  padding-top: 16px;
  background: linear-gradient(to top, rgba(30,3,3,.94) 55%, rgba(30,3,3,.2) 100%);
}
.sos-alarm-inner {
  background: rgba(120,12,12,.82); border: 2px solid #ff6a5a; border-radius: 16px;
  padding: 16px; text-align: center; color: #fff;
  box-shadow: 0 0 34px rgba(255,60,47,.5); backdrop-filter: blur(3px);
}
.sos-siren-ico { font-size: 46px; line-height: 1; animation: sosshake .7s ease-in-out infinite; }
@keyframes sosshake {
  0%, 100% { transform: rotate(-9deg) scale(1); }
  50%      { transform: rotate(9deg) scale(1.12); }
}
.sos-title { font-size: 26px; font-weight: 900; letter-spacing: 1px; margin-top: 4px; }
.sos-who { font-size: 18px; font-weight: 700; color: #ffd9d2; margin-top: 2px; }
.sos-note { font-size: 14px; color: #ffe9e4; margin-top: 6px; }
.sos-endwait { font-size: 12.5px; color: #ffd8a8; background: rgba(0,0,0,.25); border: 1px solid rgba(255,180,120,.4); border-radius: 10px; padding: 6px 10px; margin-top: 10px; line-height: 1.7; }
.sos-loc { font-size: 13px; direction: ltr; color: #ffc7bf; margin-top: 8px; }
.sos-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.sos-big {
  border: none; border-radius: 12px; padding: 14px; font-family: inherit; font-size: 16px; font-weight: 800; cursor: pointer;
  background: #fff; color: #7a0e0e;
}
.sos-big.ghost { background: transparent; color: #ffd9d2; border: 1px solid #ff8a70; }
.sos-big:active { transform: scale(.97); }
/* نوارِ خلاصهٔ اعلام‌های جاری (اعلامِ خودم / دیده‌شده‌ها) */
.sos-banner { display: flex; flex-direction: column; gap: 6px; }
.sos-banner-row {
  display: flex; align-items: center; gap: 8px;
  background: rgba(70,8,8,.85); border: 1px solid #b6483a; border-radius: 10px; padding: 8px 10px; color: #ffdad3;
}
.sos-dot { font-size: 16px; }
.sos-banner-txt { flex: 1; font-size: 13px; }
.sos-mini {
  border: none; border-radius: 8px; padding: 6px 10px; font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  background: #ffffff22; color: #fff;
}
.sos-mini.danger { background: var(--danger); color: #fff; }
.sos-mini:active { transform: scale(.94); }

/* ── نوربخشِ عکسِ تمام‌صفحه (lightbox) ─────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(3,7,13,.94); display: none; flex-direction: column; touch-action: none; user-select: none; }
.lightbox.open { display: flex; }
.lb-toolbar { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: linear-gradient(180deg, rgba(3,7,13,.7), transparent); }
.lb-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: rgba(14,27,48,.9); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; text-decoration: none; cursor: pointer; }
.lb-btn:hover { border-color: var(--gold); color: var(--gold2); }
.lb-stage { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 12px; }
.lb-img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ── راهنمای نخستین اجرا ──────────────────────────────────────────────────── */
.hint-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(4,9,16,.86); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 18px; overflow: auto; }
.hint-overlay[hidden] { display: none; }
.hint-card { width: min(440px,100%); background: linear-gradient(180deg,#0f1d33,#0b1728); border: 1px solid var(--line); border-radius: 18px; padding: 22px; max-height: 92vh; overflow: auto; }
.hint-card h3 { margin: 0 0 14px; font-size: 19px; }
.hint-item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; }
.hint-item .hi { width: 44px; height: 44px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.hint-item .ht { font-size: 13.5px; font-weight: 700; }
.hint-item .hb { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-top: 2px; }
.hint-card .btn-primary { width: 100%; margin-top: 14px; }

/* ── مدیریتِ کاربران + مجوزها ──────────────────────────────────── */
.user-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; padding: 4px 0; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; }
.user-row span { flex: 1; font-size: 14px; font-weight: 600; }
.user-actions { display: flex; gap: 6px; }
.user-actions button { font-size: 12px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); cursor: pointer; }
.user-actions button:active { opacity: .7; }
.user-actions .btn-danger { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.perm-toggle { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; cursor: pointer; }
.perm-toggle input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex: none; }

/* ── پاورقی: شمارِ غیبت + نگارش + حقِ نشر ──────────────────────────────── */
.app-footer { margin-top: 6px; padding-top: 5px; padding-bottom: calc(3px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); text-align: center; }
.app-footer .foot-dedic { font-size: 11px; color: var(--gold, #e6c873); line-height: 1.6; margin: 0 0 4px; }
.app-footer .ghaybat { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 5px; }
.app-footer .ghaybat-lbl { font-size: 11px; color: var(--muted); }
.app-footer .ghaybat-val { font-size: 12.5px; font-weight: 700; color: var(--green); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.app-footer .foot-copy { font-size: 10px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; line-height: 1.7; }
.app-footer .foot-sep { opacity: .5; }

/* ── روپوشِ کم‌نورِ باطری ─────────────────────────────────────────────────── */
.dim-overlay { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center; }
.dim-overlay[hidden] { display: none; }
.dim-overlay .dim-hint { color: #1a1a1a; font-size: 12px; text-align: center; line-height: 2; user-select: none; }
