/* ===== Town: پوششِ تمام‌صفحه روی سایت ===== */
#townRoot{
  position:fixed;inset:0;z-index:9000;display:none;
  --t-ink:#e8ecf6;--t-dim:#9aa4bd;--t-glass:rgba(16,20,32,.62);--t-hair:rgba(255,255,255,.08);
  --t-mint:#7cf5c4;
  font-family:"Vazirmatn","YekanBakh",system-ui,"Segoe UI",Tahoma,sans-serif;color:var(--t-ink)
}
#townRoot.open{display:block;animation:townIn .25s ease}
@keyframes townIn{from{opacity:0}to{opacity:1}}
#townRoot.closing{animation:townOut .22s ease forwards}
@keyframes townOut{to{opacity:0}}

#townCanvas{position:fixed;inset:0;width:100vw;height:100vh;display:block;touch-action:none;outline:none;background:#12172a}
/* پنِ کلیکِ وسط: بازخوردِ دیداری تا کاربر بفهمد در حالتِ پن است */
#townRoot.panning #townCanvas{cursor:grabbing}
/* چرخشِ آزاد (ضربه‌ی کلیکِ وسط، و خودکار در اول‌شخص): نشانگر قفل و پنهان است، پس حالت باید
   نشانِ دیداری داشته باشد — وگرنه کاربر نمی‌فهمد چرا حرکتِ موس دوربین را می‌چرخاند.
   کراس‌هِیرِ وسط هم لازم است: در این حالت کلیک، هدفِ **مرکزِ صفحه** را انتخاب می‌کند (نشانگر
   قفل است و مختصاتِ موس یخ زده)، پس باید معلوم باشد کجا را نشانه گرفته‌ای. */
#townRoot.look-mode #townCanvas{cursor:none}
#townRoot.look-mode::after{content:'';position:fixed;inset:0;z-index:3;pointer-events:none;
  box-shadow:inset 0 0 0 2px rgba(124,245,196,.42), inset 0 0 26px rgba(124,245,196,.12)}
#townRoot.look-mode .tcross{display:block}
#townRoot .tcross{display:none;position:fixed;left:50%;top:50%;z-index:4;pointer-events:none;
  width:16px;height:16px;margin:-8px 0 0 -8px}
#townRoot .tcross::before,#townRoot .tcross::after{content:'';position:absolute;background:rgba(255,255,255,.72);
  box-shadow:0 0 3px rgba(0,0,0,.6)}
#townRoot .tcross::before{left:50%;top:0;width:1.5px;height:100%;margin-left:-.75px}
#townRoot .tcross::after{top:50%;left:0;height:1.5px;width:100%;margin-top:-.75px}

#townRoot .thud{position:fixed;z-index:2;pointer-events:none}
#townRoot .tpanel{
  pointer-events:auto;background:var(--t-glass);backdrop-filter:blur(14px) saturate(1.2);
  -webkit-backdrop-filter:blur(14px) saturate(1.2);border:1px solid var(--t-hair);
  border-radius:16px;box-shadow:0 12px 40px rgba(0,0,0,.45)
}

/* عنوان + وضعیت اتصال + خروج (بالا-راست) */
#townRoot .ttop{top:calc(16px + env(safe-area-inset-top));right:calc(16px + env(safe-area-inset-right));display:flex;gap:10px;align-items:flex-start}
#townRoot .ttop .tpanel{padding:12px 16px}
#townRoot .ttop h1{margin:0;font-size:16px;font-weight:800;letter-spacing:.3px}
#townRoot .ttop .status{margin-top:5px;font-size:12px;color:var(--t-dim);display:flex;align-items:center;gap:7px}
#townRoot .dot{width:8px;height:8px;border-radius:50%;background:#e0574f;transition:background .2s}
#townRoot.connected .dot{background:var(--t-mint)}
#townRoot .tclose{
  pointer-events:auto;width:44px;height:44px;border-radius:14px;cursor:pointer;
  display:grid;place-items:center;background:var(--t-glass);border:1px solid var(--t-hair);
  color:var(--t-ink);backdrop-filter:blur(14px);box-shadow:0 12px 40px rgba(0,0,0,.45);
  font-size:20px;line-height:1;transition:background .15s
}
#townRoot .tclose:hover{background:rgba(224,87,79,.22);border-color:rgba(224,87,79,.5)}
#townRoot .tclose svg{display:block}
#townRoot #townMic{color:var(--t-dim)}
#townRoot #townMic:hover{background:rgba(124,245,196,.18);border-color:rgba(124,245,196,.45);color:var(--t-ink)}
#townRoot #townMic.on{background:rgba(124,245,196,.28);border-color:rgba(124,245,196,.65);color:var(--t-mint)}
#townRoot .tmicbtn.on{background:rgba(124,245,196,.3);border-color:rgba(124,245,196,.65);color:var(--t-mint)}
/* میکروفن: آیکونِ خط‌خورده وقتی خاموش است، آیکونِ ساده وقتی روشن */
#townRoot .tmic .i-mic{display:none}
#townRoot .tmic.on .i-mic{display:block}
#townRoot .tmic.on .i-mic-off{display:none}

/* هیستوریِ چت (چپ) + فلشِ باز/بست */
#townRoot .tchatlog{top:calc(16px + env(safe-area-inset-top));left:calc(16px + env(safe-area-inset-left));transition:transform .28s cubic-bezier(.4,0,.2,1)}
#townRoot .tchatlog.collapsed{transform:translateX(-100%)}
#townRoot .tchatlog .tpanel{padding:12px 14px;display:flex;flex-direction:column;max-height:44vh;width:230px}
#townRoot .tchatlog h2{margin:0 0 8px;font-size:11px;font-weight:800;color:var(--t-dim);letter-spacing:1px}
#townRoot .tlog{overflow-y:auto;display:flex;flex-direction:column;gap:9px}
#townRoot .tlog::-webkit-scrollbar{width:6px}
#townRoot .tlog::-webkit-scrollbar-thumb{background:var(--t-hair);border-radius:99px}
#townRoot .tline{font-size:12.5px;line-height:1.6;word-break:break-word}
#townRoot .tline .who{font-weight:800}
#townRoot .tline time{font-size:10px;color:var(--t-dim);margin-inline-start:6px;font-variant-numeric:tabular-nums}
#townRoot .tempty{font-size:12px;color:var(--t-dim)}
#townRoot .ttoggle{
  position:absolute;top:14px;right:-15px;width:30px;height:30px;border-radius:50%;
  display:grid;place-items:center;cursor:pointer;pointer-events:auto;
  background:var(--t-glass);border:1px solid var(--t-hair);color:var(--t-ink);
  backdrop-filter:blur(14px);box-shadow:0 6px 18px rgba(0,0,0,.4);
  line-height:1;transition:transform .28s,background .15s;z-index:1
}
#townRoot .ttoggle svg{display:block}
#townRoot .ttoggle:hover{background:rgba(30,38,58,.85)}
#townRoot .tchatlog.collapsed .ttoggle{transform:rotate(180deg)}

/* راهنما (پایین-چپ) */
#townRoot .thints{bottom:16px;left:16px}
#townRoot .thints .tpanel{padding:10px 14px;font-size:12px;color:var(--t-dim);line-height:1.9}
#townRoot .thints b{color:var(--t-ink);font-weight:700}
#townRoot kbd{font-family:inherit;font-size:11px;color:var(--t-ink);background:#0e1422;border:1px solid var(--t-hair);border-bottom-width:2px;border-radius:6px;padding:1px 6px;margin:0 1px}

/* نوارِ ورودیِ چت */
#townRoot .tinput{left:50%;bottom:20px;transform:translateX(-50%);opacity:0;pointer-events:none;transition:opacity .18s ease,bottom .2s ease;width:min(560px,92vw)}
#townRoot .tinput.open{opacity:1;pointer-events:auto}
#townRoot .tinput .tpanel{display:flex;align-items:center;gap:8px;padding:7px 14px 7px 7px;width:100%}
#townRoot .tinput input{flex:1;min-width:0;font-family:inherit;font-size:15px;color:var(--t-ink);background:transparent;border:0;outline:0}
#townRoot .tinput input::placeholder{color:var(--t-dim)}
#townRoot .tsend{flex:none;width:42px;height:42px;border-radius:12px;border:0;background:var(--t-mint);color:#08221a;display:grid;place-items:center;cursor:pointer;pointer-events:auto;transition:transform .1s}
#townRoot .tsend:active{transform:scale(.92)}

/* کنترلرِ موبایل (فقط روی دستگاه‌های لمسی) */
#townRoot .tmobile{display:none}
#townRoot.mobile .tmobile{display:block}
#townRoot.mobile #townMic{display:none}          /* روی موبایل میکروفن در پایین است */
/* جوی‌استیکِ شناور — هرجای نیمه‌چپ که انگشت بگذاری همان‌جا ظاهر می‌شود (فقط نمایشی؛ لمس را canvas می‌گیرد) */
#townRoot .tjoy{position:fixed;left:0;top:0;width:134px;height:134px;border-radius:50%;
  background:radial-gradient(circle,rgba(124,245,196,.12),rgba(16,20,32,.42));
  border:1.5px solid rgba(255,255,255,.14);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  transform:translate(-50%,-50%);display:none;pointer-events:none;z-index:3}
#townRoot .tjoy.on{display:block}
#townRoot .tjoy-knob{position:absolute;left:50%;top:50%;width:58px;height:58px;border-radius:50%;transform:translate(-50%,-50%);background:rgba(124,245,196,.55);border:2px solid rgba(255,255,255,.5);box-shadow:0 6px 18px rgba(0,0,0,.45)}
/* دکمه‌ها (پایین-راست) */
#townRoot .tbtns{position:fixed;z-index:4;display:flex;flex-direction:column;gap:13px;
  right:calc(16px + env(safe-area-inset-right));bottom:calc(24px + env(safe-area-inset-bottom))}
#townRoot .tmbtn{pointer-events:auto;touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;
  width:62px;height:62px;border-radius:20px;border:1px solid var(--t-hair);background:rgba(16,20,32,.55);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);color:var(--t-ink);cursor:pointer;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  user-select:none;-webkit-user-select:none;box-shadow:0 8px 24px rgba(0,0,0,.4);transition:transform .1s,background .15s}
#townRoot .tmbtn i{font-style:normal;font-size:10px;font-weight:800;opacity:.85}
#townRoot .tmbtn:active{transform:scale(.9)}
#townRoot .tjumpbtn{background:rgba(124,245,196,.2);border-color:rgba(124,245,196,.45);color:var(--t-mint)}

/* کارتِ پروفایل (با تپ/کلیک روی بازیکن) */
#townRoot .tprofile{position:fixed;z-index:5;left:50%;top:calc(76px + env(safe-area-inset-top));transform:translateX(-50%) scale(.94);
  display:none;flex-direction:column;align-items:center;gap:8px;padding:18px 26px 14px;min-width:180px;
  background:var(--t-glass);backdrop-filter:blur(16px) saturate(1.2);-webkit-backdrop-filter:blur(16px) saturate(1.2);
  border:1px solid var(--t-hair);border-radius:20px;box-shadow:0 16px 50px rgba(0,0,0,.55);opacity:0;
  transition:opacity .18s,transform .18s;pointer-events:auto}
#townRoot .tprofile.open{display:flex;opacity:1;transform:translateX(-50%) scale(1)}
#townRoot .tp-x{position:absolute;top:8px;left:8px;width:26px;height:26px;border-radius:50%;border:1px solid var(--t-hair);
  background:transparent;color:var(--t-dim);cursor:pointer;line-height:1;display:grid;place-items:center}
#townRoot .tp-x svg{display:block}
#townRoot .tp-x:hover{color:var(--t-ink);background:rgba(255,255,255,.06)}
#townRoot .tp-av{width:64px;height:64px;border-radius:50%;overflow:hidden;display:grid;place-items:center;border:2px solid rgba(255,255,255,.35)}
#townRoot .tp-av img{width:100%;height:100%;object-fit:cover}
#townRoot .tp-av span{font-size:26px;font-weight:800;color:#fff}
#townRoot .tp-name{font-size:15px;font-weight:800}
#townRoot .tp-badge{font-size:11px;font-weight:700;padding:3px 10px;border-radius:999px;background:rgba(255,255,255,.08);color:var(--t-dim)}
#townRoot .tp-badge.reg{background:hsla(45,85%,45%,.25);color:hsl(45,90%,70%);border:1px solid hsla(45,90%,70%,.35)}

/* دکمه‌ی زیرنویس (CC) */
#townRoot #townCCBtn.on{background:rgba(124,245,196,.28);border-color:rgba(124,245,196,.65);color:var(--t-mint)}
#townRoot .tbuildbtn.on{background:rgba(255,207,106,.26);border-color:rgba(255,207,106,.6);color:#ffcf6a}
/* دکمه‌ی حالتِ پینت (F3) */
#townRoot .tpaintbtn:hover{background:rgba(168,140,255,.2);border-color:rgba(168,140,255,.5)}
#townRoot .tpaintbtn.on{background:rgba(168,140,255,.26);border-color:rgba(168,140,255,.6);color:#c3aeff}

/* ═══ پنلِ حالتِ ساخت — اینسپکتورِ سه‌بعدی (سمتِ چپ)، فقط در بیلد‌مود ═══
   رنگِ محورها هم‌رنگِ دستگیره‌های گیزمو: X=قرمز، Y=سبز، Z=آبی */
#townRoot .tbuild{--tb-x:#ff6b6b;--tb-y:#53e08a;--tb-z:#6ea8ff;--tb-gold:#ffcf6a;--tb-sunk:#0e1422;
  position:fixed;z-index:6;top:calc(76px + env(safe-area-inset-top));left:calc(16px + env(safe-area-inset-left));
  width:252px;max-height:calc(100vh - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display:none;flex-direction:column;gap:9px;padding:13px;pointer-events:auto;
  background:var(--t-glass);backdrop-filter:blur(16px) saturate(1.2);-webkit-backdrop-filter:blur(16px) saturate(1.2);
  border:1px solid var(--t-hair);border-radius:18px;box-shadow:0 16px 50px rgba(0,0,0,.55)}
#townRoot.building .tbuild{display:flex}
#townRoot.building .tchatlog{display:none}          /* در بیلد‌مود لاگِ چت مزاحم نشود */
#townRoot.building .tmobile{display:none}            /* کنترلِ حرکت در بیلد‌مود پنهان */
#townRoot .tb-head{display:flex;align-items:center;justify-content:space-between;font-size:13px;font-weight:800;flex:none}
#townRoot .tb-head .tp-x{position:static}

/* ── ردیفِ افزودن: سه دکمه‌ی آیکونیِ هم‌عرض ── */
#townRoot .tb-addrow{display:flex;gap:6px;flex:none}
#townRoot .tb-add{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  padding:8px 2px;border-radius:11px;cursor:pointer;transition:background .15s,border-color .15s;
  border:1px solid rgba(255,207,106,.42);background:rgba(255,207,106,.12);color:var(--tb-gold);font-family:inherit}
#townRoot .tb-add i{font-style:normal;font-size:10.5px;font-weight:700}
#townRoot .tb-add:hover{background:rgba(255,207,106,.22);border-color:rgba(255,207,106,.7)}

/* ── نوارِ تب ── */
#townRoot .tb-tabs{display:flex;gap:3px;padding:3px;border-radius:11px;flex:none;
  background:rgba(0,0,0,.3);border:1px solid var(--t-hair)}
#townRoot .tb-tab{flex:1;padding:6px 0;border-radius:8px;border:0;background:transparent;cursor:pointer;
  color:var(--t-dim);font-family:inherit;font-size:11px;font-weight:700;transition:background .15s,color .15s}
#townRoot .tb-tab[hidden]{display:none}
/* با مدلِ انتخاب‌شده پنج تب هم‌زمان دیده می‌شوند؛ تقسیمِ مساوی «ترنسفورم» را می‌بُرید،
   پس عرض از رویِ متن گرفته می‌شود و فضای اضافه بینشان پخش می‌شود. */
#townRoot .tb-tab{flex:1 1 auto;min-width:0;white-space:nowrap;padding-inline:4px}
#townRoot .tb-tab:hover{color:var(--t-ink)}
#townRoot .tb-tab.on{background:rgba(255,255,255,.1);color:var(--t-ink);box-shadow:0 1px 0 rgba(255,255,255,.06) inset}

/* ── بدنه‌ی اسکرول‌شونده (پنل هیچ‌وقت از صفحه بیرون نمی‌زند) ── */
#townRoot .tb-body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  display:flex;flex-direction:column;gap:9px;padding-inline-end:2px}
#townRoot .tb-body::-webkit-scrollbar{width:5px}
#townRoot .tb-body::-webkit-scrollbar-thumb{background:var(--t-hair);border-radius:99px}
#townRoot .tb-pane{display:flex;flex-direction:column;gap:7px}
#townRoot .tb-pane[hidden],#townRoot #tbShadeWrap[hidden],#townRoot #tbTexWrap[hidden],
#townRoot #tbColOps[hidden],#townRoot #tbColFields[hidden],#townRoot #tbColList[hidden]{display:none}

/* ── تیترِ بخش ── */
#townRoot .tb-sec{display:flex;align-items:center;gap:7px;font-size:10px;font-weight:800;color:var(--t-dim);
  letter-spacing:.3px;margin-top:2px}
#townRoot .tb-sec::after{content:"";flex:1;height:1px;background:var(--t-hair)}
#townRoot .tb-sec em{font-style:normal;font-weight:600;opacity:.65;font-size:9.5px;order:3}
#townRoot .tb-sec>button{order:4;flex:none}

/* ── گریدِ فیلدهای عددیِ محوری ── */
#townRoot .tb-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}
#townRoot .tb-f{display:flex;align-items:center;gap:0;border-radius:8px;overflow:hidden;
  border:1px solid var(--t-hair);background:var(--tb-sunk);transition:border-color .15s}
#townRoot .tb-f:focus-within{border-color:rgba(255,255,255,.3)}
#townRoot .tb-f>span{flex:none;padding:0 6px;font-size:9.5px;font-weight:800;line-height:26px;
  background:rgba(255,255,255,.05);color:var(--t-dim)}
#townRoot .tb-f>input{width:100%;min-width:0;padding:0 5px;height:26px;border:0;outline:0;background:transparent;
  color:var(--t-ink);font-family:inherit;font-size:11px;direction:ltr;text-align:left;font-variant-numeric:tabular-nums}
#townRoot .tb-f>input::-webkit-outer-spin-button,#townRoot .tb-f>input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
#townRoot .tb-f>input[type=number]{-moz-appearance:textfield}
#townRoot .tb-f>input:read-only{color:var(--t-dim)}
#townRoot .tb-f>input:disabled{opacity:.45;cursor:not-allowed}
#townRoot .tb-f.ax-x>span{color:var(--tb-x);background:rgba(255,107,107,.14)}
#townRoot .tb-f.ax-y>span{color:var(--tb-y);background:rgba(83,224,138,.14)}
#townRoot .tb-f.ax-z>span{color:var(--tb-z);background:rgba(110,168,255,.14)}
#townRoot .tb-f.ax-x:focus-within{border-color:var(--tb-x)}
#townRoot .tb-f.ax-y:focus-within{border-color:var(--tb-y)}
#townRoot .tb-f.ax-z:focus-within{border-color:var(--tb-z)}

/* ── قفلِ اندازه‌ی یکنواخت ── */
#townRoot .tb-lock{display:flex;align-items:center;gap:4px;padding:2px 7px;border-radius:7px;cursor:pointer;
  border:1px solid var(--t-hair);background:var(--tb-sunk);color:var(--t-dim);font-family:inherit;font-size:9.5px;font-weight:700}
#townRoot .tb-lock i{font-style:normal}
#townRoot .tb-lock.on{background:rgba(124,245,196,.16);border-color:rgba(124,245,196,.45);color:var(--t-mint)}
#townRoot .tb-lock:disabled{opacity:.4;cursor:not-allowed}

/* ── دکمه‌های ریز (نرمال‌ها، کلایدر، تکسچر) ── */
#townRoot .tb-mini-row{display:flex;gap:5px}
#townRoot .tb-mini{flex:1;padding:6px 4px;border-radius:8px;cursor:pointer;transition:background .15s,border-color .15s,color .15s;
  border:1px solid var(--t-hair);background:var(--tb-sunk);color:var(--t-dim);font-family:inherit;font-size:10.5px;font-weight:600}
#townRoot .tb-mini:hover:not(:disabled){background:#131a2c;color:var(--t-ink)}
#townRoot .tb-mini.on{background:rgba(124,245,196,.18);border-color:rgba(124,245,196,.5);color:var(--t-mint)}
#townRoot .tb-mini:disabled{opacity:.4;cursor:not-allowed}
#townRoot .tb-mini-w{width:100%;flex:none}
#townRoot .tb-mini b{color:var(--t-ink);font-variant-numeric:tabular-nums}
#townRoot .tb-mini-dgr{border-color:rgba(224,87,79,.4);color:#ff9d96}
#townRoot .tb-mini-dgr:hover:not(:disabled){background:rgba(224,87,79,.16);color:#ffb3ad}

/* ── سواچ‌های رنگ ── */
#townRoot .tb-swatches{display:flex;gap:5px;flex-wrap:wrap}
#townRoot .tb-sw{width:23px;height:23px;border-radius:7px;border:2px solid rgba(255,255,255,.22);cursor:pointer;padding:0;transition:transform .1s}
#townRoot .tb-sw:hover:not(:disabled){border-color:#fff;transform:scale(1.08)}
#townRoot .tb-sw.on{border-color:#fff;box-shadow:0 0 0 2px rgba(255,255,255,.28)}
#townRoot .tb-sw:disabled{opacity:.35;cursor:not-allowed}

/* ── تکسچرِ مدل: پیش‌نمایش + دکمه‌ها ── */
#townRoot .tb-tex{display:flex;gap:7px;align-items:stretch}
#townRoot .tb-tex-p{flex:none;width:46px;height:46px;border-radius:9px;display:grid;place-items:center;overflow:hidden;
  border:1px dashed var(--t-hair);background:var(--tb-sunk);color:var(--t-dim);font-size:12px}
#townRoot .tb-tex-p.has{border-style:solid;border-color:rgba(124,245,196,.45)}
#townRoot .tb-tex-p img{width:100%;height:100%;object-fit:cover;display:block}
#townRoot .tb-tex-b{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px}
#townRoot .tb-tex-b .tb-mini{flex:1}

/* ── تبِ نقاشی: مدادِ آزاد روی سطحِ مدل (جدا از رنگِ یک‌دستِ تبِ آبجکت و از پینتِ کاراکتر) ── */
#townRoot #tbPanePaint .tb-sec em{color:var(--t-ink);opacity:.9;font-size:9.5px;direction:ltr;
  font-variant-numeric:tabular-nums;text-transform:uppercase}
#townRoot #tbPaintOn.on{background:rgba(168,140,255,.2);border-color:rgba(168,140,255,.55);color:#c3aeff}
/* مداد و پاک‌کن دوتایی‌اند — رنگِ روشنشان فرق دارد تا از هم پیدا باشند */
#townRoot #tbPencil.on{background:rgba(168,140,255,.2);border-color:rgba(168,140,255,.55);color:#c3aeff}
#townRoot #tbErase.on{background:rgba(255,255,255,.16);border-color:rgba(255,255,255,.5);color:#fff}
/* اسلایدرهای قلم (اندازه/شفافیت) */
#townRoot .tb-brush{display:flex;flex-direction:column;gap:6px}
#townRoot .tb-brush .tb-f{display:flex;align-items:center;gap:7px}
#townRoot .tb-brush .tb-f > span{flex:none;width:42px;font-size:10px;color:var(--t-dim)}
#townRoot .tb-brush .tb-f > input[type=range]{flex:1;min-width:0;accent-color:#a88cff}
#townRoot .tb-brush .tb-f > b{flex:none;width:34px;text-align:left;font-size:10px;color:var(--t-ink)}
/* «پاک‌کردنِ نقاشی» در حالتِ مسلح (کلیکِ دوم واقعاً پاک می‌کند) */
#townRoot #tbPaintClear.arm{background:rgba(224,87,79,.24);border-color:rgba(224,87,79,.75);color:#ffb3ad}
#townRoot #tbPanePaint .tb-hint{margin-top:2px}

/* ── فهرستِ کلایدرها ── */
#townRoot .tb-collist{display:flex;flex-direction:column;gap:4px;max-height:104px;overflow-y:auto}
#townRoot .tb-col-row{display:flex;align-items:center;gap:7px;width:100%;padding:5px 7px;border-radius:8px;cursor:pointer;text-align:right;
  border:1px solid var(--t-hair);background:var(--tb-sunk);color:var(--t-dim);font-family:inherit;font-size:11px}
#townRoot .tb-col-row:hover{color:var(--t-ink)}
#townRoot .tb-col-row.on{background:rgba(124,245,196,.16);border-color:rgba(124,245,196,.5);color:var(--t-mint)}
#townRoot .tb-col-i{flex:none;min-width:16px;height:16px;border-radius:5px;display:grid;place-items:center;
  background:rgba(255,255,255,.1);font-size:9px;font-weight:800}

/* ── اسلایدرِ اندازه‌ی گیزمو ── */
#townRoot .tb-gz{display:flex;align-items:center;gap:7px}
#townRoot .tb-gz > span{flex:none;width:34px;font-size:10px;color:var(--t-dim)}
#townRoot .tb-gz > input[type=range]{flex:1;min-width:0;accent-color:var(--tb-gold)}
#townRoot .tb-gz > b{flex:none;width:34px;text-align:left;font-size:10px;color:var(--t-ink)}

/* ── متریالِ مدل: زبری/فلزی + مپ‌ها ── */
#townRoot .tb-mat{display:flex;flex-direction:column;gap:6px}
#townRoot .tb-mat .tb-f{display:flex;align-items:center;gap:7px}
#townRoot .tb-mat .tb-f > span{flex:none;width:34px;font-size:10px;color:var(--t-dim)}
#townRoot .tb-mat .tb-f > input[type=range]{flex:1;min-width:0;accent-color:var(--t-mint)}
#townRoot .tb-mat .tb-f > b{flex:none;width:34px;text-align:left;font-size:10px;color:var(--t-ink)}
#townRoot .tb-mat .tb-tex-b{flex-direction:row}
#townRoot .tb-hint2{margin-top:8px;font-size:10px;line-height:1.6;color:var(--t-dim);opacity:.85}

/* ── تبِ نور ── */
#townRoot #tbPaneLight .tb-f{display:flex;align-items:center;gap:7px;margin-top:4px}
#townRoot #tbPaneLight .tb-f > span{flex:none;width:42px;font-size:10px;color:var(--t-dim)}
#townRoot #tbPaneLight .tb-f > input[type=range]{flex:1;min-width:0;accent-color:var(--tb-gold)}
#townRoot #tbPaneLight .tb-f > b{flex:none;width:34px;text-align:left;font-size:10px;color:var(--t-ink)}
#townRoot #tbLightPresets{flex-wrap:wrap}
#townRoot #tbLightPresets .tb-mini{flex:1 1 30%}

/* ── اینونتوری (جمع‌وجور + اسکرول تا پنل را نبلعد) ── */
#townRoot #tbInv{display:flex;flex-direction:column;gap:3px;margin-top:2px;
  padding-top:8px;border-top:1px solid var(--t-hair);max-height:132px;overflow-y:auto;overscroll-behavior:contain}
#townRoot #tbInv::-webkit-scrollbar{width:6px}
#townRoot #tbInv::-webkit-scrollbar-thumb{background:rgba(255,255,255,.14);border-radius:3px}
#townRoot .tb-inv-t{display:flex;gap:6px;font-size:10px;font-weight:800;color:var(--t-dim);letter-spacing:.3px}
#townRoot .tb-inv-t b{color:var(--t-ink);font-variant-numeric:tabular-nums}
#townRoot .tb-inv-row{display:flex;align-items:center;gap:5px;width:100%;padding:3px 6px;border-radius:6px;cursor:pointer;text-align:right;
  border:1px solid var(--t-hair);background:var(--tb-sunk);color:var(--t-ink);font-family:inherit;font-size:10px;line-height:1.5}
#townRoot .tb-inv-row:hover{background:#131a2c}
#townRoot .tb-inv-row.on{background:rgba(255,207,106,.16);border-color:rgba(255,207,106,.5);color:var(--tb-gold)}
#townRoot .tb-inv-row.new{border-style:dashed}
#townRoot .tb-inv-k{flex:none;padding:1px 5px;border-radius:5px;font-size:9px;font-weight:800;
  background:rgba(255,255,255,.08);color:var(--t-dim)}
#townRoot .tb-inv-row.k-model .tb-inv-k{background:rgba(110,168,255,.18);color:var(--tb-z)}
#townRoot .tb-inv-row.k-photo .tb-inv-k{background:rgba(83,224,138,.18);color:var(--tb-y)}
#townRoot .tb-inv-row.k-box .tb-inv-k{background:rgba(255,207,106,.18);color:var(--tb-gold)}
#townRoot .tb-inv-n{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:ltr;text-align:right}
#townRoot .tb-inv-b{flex:none;padding:1px 5px;border-radius:5px;background:rgba(255,255,255,.08);color:var(--t-dim);font-size:9px;text-transform:uppercase}
#townRoot .tb-inv-d{flex:none;font-size:9px;color:var(--t-dim);opacity:.8}
#townRoot .tb-inv-e{font-size:10.5px;color:var(--t-dim);opacity:.7;padding:3px 1px}

/* ── فوتر: تأیید/حذف + راهنما ── */
#townRoot .tb-foot{flex:none;display:flex;flex-direction:column;gap:7px;padding-top:9px;border-top:1px solid var(--t-hair)}
#townRoot .tb-actions{display:flex;gap:7px}
#townRoot .tb-ok{flex:1;padding:9px;border-radius:10px;border:0;background:var(--t-mint);color:#08221a;font-family:inherit;font-size:12.5px;font-weight:800;cursor:pointer}
#townRoot .tb-del{padding:9px 13px;border-radius:10px;border:1px solid rgba(224,87,79,.5);background:rgba(224,87,79,.15);color:#ff9d96;font-family:inherit;font-size:12.5px;cursor:pointer}
#townRoot .tb-ok:disabled,#townRoot .tb-del:disabled{opacity:.4;cursor:not-allowed}
#townRoot .tb-hint{font-size:10px;color:var(--t-dim);line-height:1.7}

/* ── صفحه‌ی باریک ── */
@media (max-width:560px){
  #townRoot .tbuild{top:calc(66px + env(safe-area-inset-top));width:min(78vw,240px);padding:11px;gap:8px;
    max-height:calc(100vh - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
  #townRoot .tb-f>span{padding:0 4px;font-size:9px}
  #townRoot .tb-f>input{font-size:10.5px}
  #townRoot .tb-collist{max-height:88px}
  #townRoot .tb-tab{font-size:10px;padding-inline:2px}   /* پنج تب در پنلِ باریکِ موبایل */
}

/* ═══ پنلِ حالتِ پینت (F3) — جای همان پنلِ ساخت (هر دو هم‌زمان روشن نمی‌شوند) ═══ */
#townRoot .tpaint{--tb-sunk:#0e1422;--tb-gold:#ffcf6a;
  position:fixed;z-index:6;top:calc(76px + env(safe-area-inset-top));left:calc(16px + env(safe-area-inset-left));
  width:222px;max-height:calc(100vh - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display:none;flex-direction:column;gap:9px;padding:13px;pointer-events:auto;overflow-y:auto;overscroll-behavior:contain;
  background:var(--t-glass);backdrop-filter:blur(16px) saturate(1.2);-webkit-backdrop-filter:blur(16px) saturate(1.2);
  border:1px solid var(--t-hair);border-radius:18px;box-shadow:0 16px 50px rgba(0,0,0,.55)}
#townRoot.painting .tpaint{display:flex}
#townRoot.painting .tchatlog{display:none}           /* مثلِ بیلد‌مود، لاگِ چت مزاحم نشود */
#townRoot.painting.paint-tool #townCanvas{cursor:crosshair}
#townRoot .tpaint::-webkit-scrollbar{width:5px}
#townRoot .tpaint::-webkit-scrollbar-thumb{background:var(--t-hair);border-radius:99px}
#townRoot .tpaint .tb-sec em{color:var(--t-ink);opacity:.9;font-size:9.5px;direction:ltr;font-variant-numeric:tabular-nums}
/* انتخابِ بخش: پوست/مو/لباس/شلوار/کفش */
#townRoot .tpa-slots{display:flex;flex-wrap:wrap;gap:5px}
#townRoot .tpa-slots .tb-mini{flex:1 1 30%}
/* رنگِ آزاد (input[type=color]) */
#townRoot .tpa-free{display:flex;align-items:center;gap:8px;padding:5px 8px;border-radius:9px;
  border:1px solid var(--t-hair);background:var(--tb-sunk);color:var(--t-dim);font-size:10.5px;font-weight:600;cursor:pointer}
#townRoot .tpa-free span{flex:1}
#townRoot .tpa-free input[type=color]{flex:none;width:34px;height:24px;padding:0;border:1px solid var(--t-hair);
  border-radius:6px;background:transparent;cursor:pointer}
#townRoot .tpa-free input[type=color]::-webkit-color-swatch-wrapper{padding:2px}
#townRoot .tpa-free input[type=color]::-webkit-color-swatch{border:0;border-radius:4px}
#townRoot .tpaint .tb-mini.on{background:rgba(168,140,255,.2);border-color:rgba(168,140,255,.55);color:#c3aeff}
@media (max-width:560px){
  #townRoot .tpaint{top:calc(66px + env(safe-area-inset-top));width:min(74vw,214px);padding:11px;gap:8px;
    max-height:calc(100vh - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
}

/* دکمه‌ی اشتراکِ صفحه — سبز اگر خودم، کم‌رنگ/غیرفعال اگر یکی دیگر مشغول است */
#townRoot .tshare.on,#townRoot .tsharebtn.on{background:rgba(124,245,196,.28);border-color:rgba(124,245,196,.65);color:var(--t-mint)}
#townRoot .tshare.busy,#townRoot .tsharebtn.busy{opacity:.4;pointer-events:none}
/* بنرِ «X در حالِ اشتراک» (بالا-وسط) */
#townRoot .tsharebar{position:fixed;z-index:6;top:calc(16px + env(safe-area-inset-top));left:50%;transform:translateX(-50%) translateY(-140%);
  display:flex;align-items:center;gap:10px;padding:8px 14px;border-radius:999px;pointer-events:auto;
  background:var(--t-glass);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border:1px solid var(--t-hair);
  box-shadow:0 10px 30px rgba(0,0,0,.45);font-size:12.5px;color:var(--t-ink);opacity:0;transition:transform .3s cubic-bezier(.4,0,.2,1),opacity .3s;white-space:nowrap}
#townRoot .tsharebar.on{transform:translateX(-50%) translateY(0);opacity:1}
#townRoot .tsharebar .tsb-dot{width:9px;height:9px;border-radius:50%;background:#ff5a7a;box-shadow:0 0 0 0 rgba(255,90,122,.6);animation:tsbPulse 1.6s infinite}
#townRoot .tsharebar.mine .tsb-dot{background:var(--t-mint);box-shadow:0 0 0 0 rgba(124,245,196,.6)}
@keyframes tsbPulse{0%{box-shadow:0 0 0 0 rgba(255,90,122,.5)}70%{box-shadow:0 0 0 8px rgba(255,90,122,0)}100%{box-shadow:0 0 0 0 rgba(255,90,122,0)}}
#townRoot .tsb-stop{display:none;padding:4px 12px;border-radius:999px;border:1px solid rgba(255,90,122,.5);background:rgba(255,90,122,.15);color:#ff9db0;font-family:inherit;font-size:12px;cursor:pointer}
#townRoot .tsharebar.mine .tsb-stop{display:inline-block}
/* توستِ کوتاه (وسط-پایین) */
#townRoot .ttoast{position:fixed;z-index:7;left:50%;bottom:96px;transform:translateX(-50%) translateY(14px);
  padding:9px 18px;border-radius:12px;background:rgba(10,14,24,.9);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  border:1px solid var(--t-hair);color:var(--t-ink);font-size:13px;opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;white-space:nowrap}
#townRoot .ttoast.on{opacity:1;transform:translateX(-50%) translateY(0)}

/* پنلِ تنظیماتِ صدا */
#townRoot .tsettings{position:fixed;z-index:6;top:calc(76px + env(safe-area-inset-top));right:calc(16px + env(safe-area-inset-right));
  width:272px;display:none;flex-direction:column;gap:11px;padding:16px;pointer-events:auto;
  background:var(--t-glass);backdrop-filter:blur(16px) saturate(1.2);-webkit-backdrop-filter:blur(16px) saturate(1.2);
  border:1px solid var(--t-hair);border-radius:18px;box-shadow:0 16px 50px rgba(0,0,0,.55)}
#townRoot .tsettings.open{display:flex}
#townRoot .tsettings h3{margin:0 0 2px;font-size:13px;font-weight:800}
#townRoot .ts-row{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--t-dim)}
#townRoot .ts-row b{color:var(--t-ink);font-variant-numeric:tabular-nums}
#townRoot .tsettings select,#townRoot .tp-row select{width:100%;padding:7px 9px;border-radius:10px;background:#0e1422;border:1px solid var(--t-hair);color:var(--t-ink);font-family:inherit;font-size:12.5px;outline:0;cursor:pointer}
#townRoot input[type=range]{width:100%;accent-color:var(--t-mint);cursor:pointer;margin:0}
#townRoot .ts-check{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--t-ink);cursor:pointer}
#townRoot .ts-check input{accent-color:var(--t-mint);width:15px;height:15px;cursor:pointer;margin:0}
#townRoot .ts-meter{position:relative;height:8px;border-radius:99px;background:#0e1422;border:1px solid var(--t-hair);overflow:hidden}
#townRoot #tsLevel{position:absolute;left:0;top:0;height:100%;width:0;background:#4a5a72;border-radius:99px;transition:width .09s linear}
#townRoot #tsLevel.open{background:linear-gradient(90deg,#7cf5c4,#ffd166)}
#townRoot #tsFloor{position:absolute;top:-2px;width:2px;height:12px;background:#ff9d96;border-radius:2px;transition:left .2s linear}
#townRoot .ts-test{padding:9px;border-radius:11px;border:1px solid var(--t-hair);background:#0e1422;color:var(--t-ink);font-family:inherit;font-size:12.5px;cursor:pointer;transition:background .15s}
#townRoot .ts-test.on{background:rgba(255,209,102,.18);border-color:rgba(255,209,102,.5);color:#ffd166}
#townRoot .ts-hint{font-size:10.5px;color:var(--t-dim);line-height:1.7}
#townRoot .ts-sep{height:1px;background:var(--t-hair);margin:2px 0}

/* کنترل‌های داخلِ کارتِ بازیکن (میوت / بلندی / زیرنویس) */
#townRoot .tprofile{min-width:224px}
#townRoot .tp-ctrls{display:flex;flex-direction:column;gap:9px;width:100%;margin-top:6px;padding-top:11px;border-top:1px solid var(--t-hair)}
#townRoot .tp-row{display:flex;flex-direction:column;gap:5px;font-size:11.5px;color:var(--t-dim);text-align:right}
#townRoot .tp-row b{color:var(--t-ink);font-variant-numeric:tabular-nums}
#townRoot .tp-mute{display:flex;align-items:center;justify-content:center;gap:7px;padding:8px;border-radius:11px;cursor:pointer;
  border:1px solid var(--t-hair);background:#0e1422;color:var(--t-ink);font-family:inherit;font-size:12.5px;transition:background .15s}
#townRoot .tp-mute.on{background:rgba(224,87,79,.18);border-color:rgba(224,87,79,.5);color:#ff9d96}

/* آیکونِ Town در تاپ‌بارِ سایت */
#townBtn{display:inline-flex;align-items:center;gap:7px}
#townBtn .tw-badge{display:inline-flex;width:8px;height:8px;border-radius:50%;background:var(--t-mint, #7cf5c4)}

/* پرسیدنِ نام از مهمان قبل از ورود */
.tname-wrap{position:fixed;inset:0;z-index:9500;display:none;place-items:center;background:rgba(6,8,14,.6);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);font-family:"Vazirmatn","YekanBakh",system-ui,"Segoe UI",Tahoma,sans-serif}
.tname-wrap.open{display:grid}
.tname-card{width:min(360px,88vw);padding:22px;border-radius:18px;background:#141a2a;border:1px solid rgba(255,255,255,.08);box-shadow:0 20px 60px rgba(0,0,0,.55);text-align:center;color:#e8ecf6}
.tname-card h3{margin:0 0 4px;font-size:18px;font-weight:800}
.tname-card p{margin:0 0 14px;font-size:13px;color:#9aa4bd}
.tname-card input{width:100%;padding:11px 12px;border-radius:12px;background:#0e1422;border:1px solid rgba(255,255,255,.1);color:#e8ecf6;font-family:inherit;font-size:15px;outline:0;text-align:center}
.tname-card input:focus{border-color:#7cf5c4}
.tname-row{display:flex;gap:10px;margin-top:14px}
.tname-row button{flex:1;padding:10px;border-radius:12px;font-family:inherit;font-size:14px;cursor:pointer}
.tname-go{background:#7cf5c4;color:#08221a;font-weight:800;border:0}
.tname-cancel{background:transparent;color:#9aa4bd;border:1px solid rgba(255,255,255,.12)}
.tname-hint{margin-top:12px;font-size:11.5px;color:#8892a6;line-height:1.7}

@media (max-width:560px){
  #townRoot .thints{display:none}
  #townRoot .ttop .tpanel{padding:9px 13px}
  #townRoot .ttop h1{font-size:14px}
  #townRoot .ttop .status{font-size:11px;margin-top:3px}
  #townRoot .tclose{width:42px;height:42px}
  #townRoot .tchatlog{top:calc(66px + env(safe-area-inset-top))}
  #townRoot .tchatlog .tpanel{width:min(66vw,240px);max-height:26vh;padding:10px 12px}
  #townRoot .ttoggle{width:36px;height:36px;right:-18px}
}
