/* ============================================================
   🃏 شلم — میز سبز کلاسیک (مینی‌اپ تلگرام)
   بوم پشمی سبز تیره، ورق‌های سفید با خال قرمز/مشکی، هماهنگ با تم تلگرام
   ============================================================ */

@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  /* سلف‌هاست — CDN در ایران کند/فیلتر می‌شود؛ فونت از همان دامنهٔ مینی‌اپ می‌آید */
  src: url('/fonts/Vazirmatn.woff2') format('woff2');
}

:root {
  --bg: #0d2818;
  --felt: #1c6a41;
  --felt-2: #14522f;
  --felt-3: #0f3f25;
  --rim: #6b4423;
  --rim-2: #4a2d15;
  --ink: #f3efe2;
  --ink-dim: #b9c9b4;
  --card-bg: #fbf8ef;
  --card-edge: #c9c2ad;
  --red: #c0392b;
  --black: #20242b;
  --gold: #e3b34c;
  --team-a: #4da3ff;
  --team-b: #ff7b6b;
  --turn: #ffd76a;
  --ok: #58d68d;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 100% at 50% 0%, #143c26 0%, var(--bg) 70%);
  overscroll-behavior: none;
}

body { user-select: none; -webkit-user-select: none; }
.hidden { display: none !important; }

/* ---------------- دروازه (خارج از تلگرام) ---------------- */
.gate { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.gate-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  max-width: 340px;
}
.gate-logo { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 10px; box-shadow: 0 10px 26px rgba(0,0,0,0.5); }
.gate-card h1 { font-size: 20px; margin-bottom: 10px; color: var(--gold); }
.gate-card p { color: var(--ink-dim); font-size: 14px; line-height: 1.9; margin-bottom: 18px; }
.gate-btn {
  display: inline-block;
  background: linear-gradient(180deg, #2ea6ff, #1f7ed8);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 14px;
  font-size: 15px;
}

/* ---------------- 🏠 خانهٔ مینی‌اپ (شروع یک‌ضربه‌ای مثل بازی‌های کلیکی) ---------------- */
.home { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.home-card {
  width: 100%; max-width: 340px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 30px 22px;
  text-align: center;
}
.home-logo { display: flex; justify-content: center; margin-bottom: 8px; }
.home-logo img { width: 110px; height: 110px; border-radius: 24px; box-shadow: 0 12px 30px rgba(0,0,0,0.55); }
.home-title { font-size: 21px; margin-bottom: 4px; color: var(--gold); }
.home-sub { color: var(--ink-dim); font-size: 13px; line-height: 1.9; margin-bottom: 20px; }

/* 🏠 نوار بالای خانه — سکه (چپ) | سطح (وسط) | تنظیمات (راست) */
.home-hud {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; margin-bottom: 8px;
}
.hud-cell {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px; padding: 7px 0 5px;
  color: var(--ink); font-family: inherit;
  cursor: pointer;
}
.hud-cell.mid { cursor: default; }
.hud-cell:active { transform: scale(0.95); }
.hud-ic { font-size: 19px; line-height: 1.1; }
.hud-v { font-size: 13.5px; font-weight: 800; color: var(--gold); }
.home-who {
  display: flex; align-items: center; gap: 9px;
  background: rgba(0,0,0,0.18); border-radius: 14px;
  padding: 7px 10px; margin-bottom: 14px;
  direction: rtl;
}
.avatar.sm { width: 38px; height: 38px; font-size: 17px; }
.who-txt { display: flex; flex-direction: column; min-width: 0; text-align: right; }
.who-name { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.who-sub { font-size: 10.5px; color: var(--ink-dim); }
.home-btn {
  width: 100%;
  font-family: inherit;
  font-size: 16.5px; font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #2ea6ff, #1f7ed8);
  border: none;
  border-radius: 16px;
  padding: 15px 0;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(31, 126, 216, 0.35);
  transition: transform 0.12s ease;
}
.home-btn:active { transform: scale(0.97); }
.home-btn:disabled { opacity: 0.7; }
/* 🌐 دکمهٔ بازی آنلاین — رنگ متمایز بالای بازی با ربات‌ها */
.home-btn.alt {
  background: linear-gradient(180deg, #35c48f, #1d9e6c);
  box-shadow: 0 10px 24px rgba(29, 158, 108, 0.35);
  margin-bottom: 10px;
}
.home-btn.secondary { margin-top: 10px; background: linear-gradient(180deg, #6b7280, #4b5563); box-shadow: none; }
.home-status { min-height: 20px; font-size: 13px; color: var(--ink-dim); margin-top: 12px; line-height: 1.8; }
.home-coins { font-size: 13px; color: var(--gold); margin-top: 4px; min-height: 18px; }

/* 🛒 فروشگاه — بخش‌های سکه/آواتار/اسکین ورق زیر یک سقف */
.shopbox { margin-top: 12px; text-align: right; }
.shop-sec { border-top: 1px dashed rgba(255,255,255,0.14); padding-top: 10px; margin-top: 8px; }
.shop-sec:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.shop-title { font-size: 13px; font-weight: 800; color: var(--ink-dim); margin-bottom: 7px; }
.csbox { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cscard {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: rgba(0,0,0,0.25); border: 2px solid rgba(255,255,255,0.16);
  border-radius: 14px; padding: 10px 6px;
  color: var(--ink); font-family: inherit; cursor: pointer;
}
.cscard.sel { border-color: var(--ok); background: rgba(90,220,160,0.10); }
.cscard .csdemo { display: flex; gap: 4px; }
.cscard .csmini { width: 17px; height: 24px; border-radius: 4px; background: linear-gradient(160deg, #fffef9, #fbf8ef); border: 1px solid #c9c2ad; color: #20242b; font-size: 11px; line-height: 24px; text-align: center; }
.cscard.dark .csmini { background: linear-gradient(160deg, #2b3350, #1a2033); border-color: #4a5478; color: #f5f2e8; }
.cscard .csname { font-size: 12px; font-weight: 800; }
.cscard .csprice { font-size: 10.5px; color: var(--ink-dim); }
.home-link {
  margin-top: 14px;
  background: none; border: none;
  font-family: inherit; font-size: 12.5px;
  color: var(--ink-dim);
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 10px;
}

/* ---------------- چیدمان کلی ---------------- */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  gap: 6px;
  overflow-y: auto; /* 🛡 در صفحه‌های کوتاه همهٔ خانه‌های پیشنهاد قابل دسترس می‌مانند */
}

/* نوار بالا */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--ink-dim);
  /* 🎯 بالای اورلی مزایده بماند — دکمهٔ موسیقی و درخواست لغو در مزایده هم کار کند */
  position: relative; z-index: 49;
}
.tb-title { font-weight: 800; color: var(--gold); font-size: 15px; letter-spacing: 0.3px; }
/* 🖼 لوگوی کوچک نوار بالای بازی — همان لوگوی رسمی، هم‌ترازِ متن */
.tb-logo { width: 20px; height: 20px; border-radius: 6px; vertical-align: -4px; margin-left: 4px; }
.tb-item { background: rgba(0, 0, 0, 0.25); padding: 4px 10px; border-radius: 10px; }
.tb-right { display: flex; align-items: center; gap: 6px; }
.tb-btn {
  background: rgba(0, 0, 0, 0.25);
  border: none; color: var(--ink);
  font-size: 15px; font-family: inherit;
  padding: 3px 9px; border-radius: 10px;
  cursor: pointer;
}
.tb-btn:active { transform: scale(0.93); }
/* 🚪 حالت تأیید خروج — دو بار ضربه؛ بار اول قرمز و لرزان می‌شود */
.tb-btn.warn {
  background: rgba(160, 32, 26, 0.55);
  color: #ffe1dc;
  animation: warnPulse 0.6s ease infinite alternate;
}
@keyframes warnPulse { from { box-shadow: 0 0 0 0 rgba(255, 90, 70, 0.45); } to { box-shadow: 0 0 0 6px rgba(255, 90, 70, 0); } }

/* 🏅 قرارداد و 🎯 امتیاز لحظه‌ای — درون زمین */
.hudrow {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding-top: 2px;
}
.contract, .hud {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  padding: 3px 12px;
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contract b, .hud b { color: var(--gold); }
.contract .trumpc { color: #fff; font-size: 13px; }
.hud .ta { color: var(--team-a); font-weight: 800; }
.hud .tb { color: var(--team-b); font-weight: 800; }

/* 📜 لاگ زندهٔ مزایده روی میز — کی چه پیشنهادی داد/پاس داد/تایم‌اوت شد */
.bidlog {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  max-width: 100%; padding: 0 4px;
}
.blitem {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
}
.blitem.me { border-color: rgba(227, 179, 76, 0.55); color: var(--gold); }

/* ⏱ مهلت ۲ دقیقه‌ای نوبتِ پیشنهاد من */
.bidclock-wrap {
  text-align: center; font-size: 11.5px; color: rgba(255,255,255,0.75);
  padding-top: 2px;
}
.bidclock-wrap b { color: var(--gold); font-size: 13px; }
.bidclock-wrap.outnote { color: #ffb0a6; }

/* 🎯 شبکهٔ خانه‌های پیشنهاد — ۵ ستونه؛ خونهٔ انتخاب‌شده و خونه‌های قبلیش غیرفعال و خاکستری */
.chipgrid.nums { grid-auto-flow: row; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.chip.num { padding: 7px 0; font-size: 13.5px; border-radius: 9px; }
.chip.dead { opacity: 0.30; filter: grayscale(0.75); pointer-events: none; }
.chip.locked { opacity: 0.55; pointer-events: none; }

/* 🎯 در مزایده چت مخفی می‌شود تا خانه‌های پیشنهاد جا داشته باشند */
#app.bidmode #chatwrap { display: none; }

/* ---------------- 🎯 باکس مزایده — پنلِ بالای صفحه ----------------
   قبلاً باکس با پس‌زمینهٔ تیرهٔ تمام‌صفحه (fixed inset:0) میز و ورق‌های دست را
   کامل می‌پوشاند؛ کاربر در مزایده دستش را نمی‌دید (نمی‌دانست چه بپیشنهاد دهد)
   و حتی دکمهٔ 🚪 خروجِ نوار بالا زیرِ اورلی غیرقابل‌لمس بود. حالا:
   • پنل فقط در بالای صفحه است — میز و دستِ پایینِ صفحه دیده می‌شوند
   • لایهٔ والد کلیک‌ناپذیر است (pointer-events:none) — فقط کارتِ مزایده کلیک می‌گیرد
   • دکمهٔ ⬆ کارت را جمع می‌کند تا کل میز هم دیده شود */
.bidbox {
  position: fixed; top: 0; left: 0; right: 0; z-index: 48;
  display: flex; align-items: flex-start; justify-content: center;
  /* زیرِ نوار بالا شروع می‌شود — لوگو، ساعت و دکمه‌های صدا/خروج سرِ جایشان می‌مانند */
  padding: 46px 8px 8px;
  opacity: 1;
  transition: opacity 0.45s ease;
  pointer-events: none; /* کل لایه شفاف به کلیک — فقط کارت مزایده تعاملی است */
}
.bidbox.out { opacity: 0; pointer-events: none; }
/* پس‌زمینهٔ تیرهٔ تمام‌صفحه حذف شد — دستِ بازیکن باید در مزایده دیده شود */
.bidbox-backdrop { display: none; }
.bb-card {
  position: relative;
  pointer-events: auto;
  width: min(440px, 100%);
  /* حداکثر نیمهٔ بالای صفحه — میز و ورق‌های دست پایینِ صفحه همیشه دیده می‌شوند */
  max-height: 62vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(19, 42, 29, 0.98), rgba(10, 24, 16, 0.98));
  border: 1.5px solid rgba(227, 179, 76, 0.55);
  border-radius: 20px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65);
  padding: 12px;
  animation: bbIn 0.3s cubic-bezier(0.2, 1.2, 0.4, 1);
}
/* ⬆ حالت جمع‌شده — فقط سرصفحه (عنوان + ساعت) می‌ماند و میز کاملاً باز می‌شود */
.bidbox.min .bb-card > :not(.bb-head) { display: none; }
.bidbox.min .bb-card { max-height: none; overflow: visible; }
@keyframes bbIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.bb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.bb-title { font-size: 16px; font-weight: 800; color: var(--gold); }
.bb-clock {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 3px 10px;
  font-size: 13.5px; font-weight: 800; color: var(--gold);
  white-space: nowrap;
}
.bb-high {
  font-size: 12.5px; color: var(--ink-dim); text-align: center;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  padding: 5px 8px; margin-bottom: 8px;
}
.bb-high b { color: var(--gold); }
.bb-seats { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.bbs {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
}
.bbs.turn { border-color: rgba(227, 179, 76, 0.65); background: rgba(227, 179, 76, 0.10); }
.bbs .avatar { width: 32px; height: 32px; font-size: 15px; border-width: 2px; }
.bbs-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bbstag { font-size: 10px; color: var(--ink-dim); font-weight: 400; }
.bbs-state { flex: 0 0 auto; font-size: 11.5px; font-weight: 800; color: rgba(255, 255, 255, 0.55); white-space: nowrap; }
.bbs-state.bid { color: var(--gold); }
.bbs-state.pass { color: #ffb0a6; }
.bbs-state.accept { color: #7ce8b4; }
.bbs-state.timeout { color: #ff9c8f; }
.bb-card .bidlog { margin-bottom: 8px; }
.bb-actions { display: flex; flex-direction: column; gap: 7px; }
.bb-actions .chipgrid.nums { gap: 6px; }
.bb-actions .chip.num { padding: 10px 0; font-size: 15px; }
.bb-actions .chip.wide { padding: 11px 0; font-size: 14px; }
.bb-note { text-align: center; font-size: 11.5px; color: rgba(255, 255, 255, 0.75); padding-top: 2px; }
.bb-note b { color: var(--gold); font-size: 13.5px; }
.bb-note.outnote { color: #ffb0a6; }

/* ⛔ پنل رأی‌گیری لغو بازی */
.cancelbox {
  /* 🎯 درخواست لغو در مزایده هم باید دیده و لمس شود — بالای اورلی مزایده */
  position: relative; z-index: 49;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: rgba(70, 18, 16, 0.38);
  border: 1px solid rgba(255, 123, 107, 0.45);
  border-radius: 14px;
  padding: 9px 12px;
}
.cv-title { font-size: 13px; font-weight: 800; color: #ffb0a6; }
.cv-title b { color: var(--ink); }
.cv-meta { font-size: 12px; color: var(--ink-dim); }
.cv-meta b { color: var(--gold); }
.cv-note { font-size: 11.5px; color: var(--ink-dim); }
.cv-acts { display: flex; gap: 8px; }
.cv-acts .chip { padding: 7px 20px; font-size: 13px; }

/* نوار امتیاز */
#scorebar {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 6px 12px;
}
.score { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.score b { font-size: 19px; font-weight: 800; }
.score .dot { width: 10px; height: 10px; border-radius: 50%; }
.team-a .dot { background: var(--team-a); box-shadow: 0 0 8px var(--team-a); }
.team-b .dot { background: var(--team-b); box-shadow: 0 0 8px var(--team-b); }
.team-a b { color: var(--team-a); }
.team-b b { color: var(--team-b); }
.mid { color: var(--ink-dim); font-size: 12px; }

/* ---------------- میز پشمی ---------------- */
#table { flex: 1; min-height: 0; display: flex; }
.felt {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border-radius: 26px;
  padding: 8px 10px;
  background:
    radial-gradient(90% 90% at 50% 40%, var(--felt) 0%, var(--felt-2) 58%, var(--felt-3) 100%);
  border: 5px solid var(--rim);
  outline: 2px solid var(--rim-2);
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.45),
    inset 0 0 4px rgba(255, 255, 255, 0.06),
    0 12px 30px rgba(0, 0, 0, 0.5);
}

/* 🖼 واترمارک لوگو — محو (حدود ۱۵٪) وسط میز؛ جای کاراکتر قبلی */
.felt::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(148px, 38vw);
  height: min(148px, 38vw);
  background: url('/logo.png') no-repeat center / contain;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}
.felt::after {
  content: '';
  position: absolute; inset: 0; border-radius: 20px;
  background: repeating-radial-gradient(circle at 50% 45%, rgba(255,255,255,0.015) 0 2px, transparent 2px 4px);
  pointer-events: none;
}

/* صندلی‌ها — جایگاه ثابت، محتوای چرخان */
.slot-top { display: flex; justify-content: center; }
.slot-bottom { display: flex; justify-content: center; }
.midrow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 0; }
.slot-left { display: flex; justify-content: flex-start; }
.slot-right { display: flex; justify-content: flex-end; }

.seat {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border-radius: 14px;
  position: relative;
  max-width: 100%;
  transition: background 0.3s, box-shadow 0.3s;
}

.avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2b3f52, #1d2c3a);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; color: #fff;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  flex: 0 0 auto;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
}
/* 🎭 رنگ آواتار هر ربات — هر ربات رنگ و شخصیت خودش */
.avatar.botav0 { background: linear-gradient(160deg, #a78bfa, #6d28d9); }
.avatar.botav1 { background: linear-gradient(160deg, #fbbf24, #b45309); }
.avatar.botav2 { background: linear-gradient(160deg, #34d399, #047857); }
.avatar.botav3 { background: linear-gradient(160deg, #f87171, #b91c1c); }
.seat.team-0 .avatar { border-color: var(--team-a); }
.seat.team-1 .avatar { border-color: var(--team-b); }

.pinfo { display: flex; flex-direction: column; min-width: 0; direction: rtl; }
.pname {
  font-size: 14px; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 110px;
}
.ptag { font-size: 10.5px; color: var(--ink-dim); }

/* هالهٔ نوبت — کادر مستطیلی زرد حذف شد (درخواست کاربر): حلقهٔ شمارش معکوس دور آواتار
   + چراغ نوبت کافی است؛ فقط یک تپش خیلی ملایم روی خود آواتار می‌ماند */
.seat.turn .avatar { animation: turnPulse 1.6s ease-in-out infinite; }
@keyframes turnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}
.turn-chip {
  font-size: 10px; font-weight: 800; color: #241c04;
  background: var(--turn); border-radius: 8px; padding: 1px 7px;
}

/* 🟢 چراغ حضور روی آواتار — سبز: آنلاین | زرد: هوش یک دست به‌جایش بازی کرد |
   قرمز + آواتار تیره: کاربر آنلاین نیست (هوش ۲ دست و بیشتر به‌جایش بازی کرده) */
.avwrap { position: relative; flex: 0 0 auto; }
.pres-dot {
  position: absolute; bottom: -1px; inset-inline-end: -1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #22c55e;
  border: 2px solid rgba(6, 22, 14, 0.9);
  box-shadow: 0 0 7px rgba(34, 197, 94, 0.85);
  z-index: 3;
  pointer-events: none;
}
.pres-dot.away { background: #facc15; border-color: rgba(31, 22, 2, 0.9); box-shadow: 0 0 7px rgba(250, 204, 21, 0.85); }
.pres-dot.offline { background: #ef4444; border-color: rgba(26, 5, 5, 0.9); box-shadow: 0 0 7px rgba(239, 68, 68, 0.9); }
.pres-dot.sm { width: 10px; height: 10px; }
/* آواتار تیره — کاربر آنلاین نیست */
.avatar.afk { filter: brightness(0.5) saturate(0.55); }
/* ⬛ آواتار سیاه — بازیکنی که دکمهٔ لغو بازی را زده (تا رأی بازیکنان دیگر) */
.avatar.blackout { filter: brightness(0.14) grayscale(1); }
.avatar.afk.blackout { filter: brightness(0.14) grayscale(1); }

/* ⏱ حلقهٔ شمارش معکوس نوبت — دور آواتارِ نوبت‌دار، مثل یک نوار در حال خالی شدن */
.turn-ring {
  position: absolute; inset: -5px;
  width: calc(100% + 10px); height: calc(100% + 10px);
  transform: rotate(-90deg);
  pointer-events: none; z-index: 4;
}
.turn-ring circle { fill: none; stroke-width: 3.4; }
.turn-ring .tr-bg { stroke: rgba(255, 255, 255, 0.16); }
.turn-ring .tr-fg {
  stroke: var(--turn, #ffd76a);
  stroke-linecap: round;
  stroke-dasharray: 169.65;
  filter: drop-shadow(0 0 5px rgba(255, 215, 106, 0.75));
  transition: stroke 0.25s;
}
.turn-ring .tr-fg.low { stroke: #f87171; filter: drop-shadow(0 0 5px rgba(248, 113, 113, 0.8)); }

/* نشان حاکم */
.badge-decl {
  position: absolute; top: -4px; inset-inline-start: -2px;
  font-size: 15px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

/* دستهٔ ورق بقیهٔ بازیکنان */
.handpile { display: flex; align-items: center; gap: 5px; }
.pile { position: relative; width: 30px; height: 20px; }
.pile::before, .pile::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 4px;
  background: linear-gradient(135deg, #274e8f, #1b3a6d);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.pile::after { transform: translate(3px, -3px) rotate(6deg); }
.pilecount { font-size: 11px; color: var(--ink-dim); font-weight: 700; }

/* مرکز میز — بزرگ‌تر برای ورق‌های بزرگ */
.center { position: relative; width: clamp(178px, 46vw, 240px); height: clamp(146px, 38vw, 196px); align-self: center; }
.pot {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px dashed rgba(255, 255, 255, 0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.played {
  position: absolute;
  width: 0; height: 0;
  display: flex; align-items: center; justify-content: center;
}
.played .card {
  position: absolute;
  /* 🎯 قرارگیری قطعی و یکسان در همهٔ گوشی‌ها — نقطهٔ صندلی + خودتراشی به اندازهٔ نصف کارت
     (قبلاً جای استاتیک کارتِ absolute به موتور رندر واگذار شده بود و روی بعضی گوشی‌ها کارت کمی چپ می‌افتاد) */
  top: 0; left: 0;
  transform: translate(-50%, -50%) scale(0.96);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
  /* 🃏 ورق در لحظهٔ آمدن روی میز — پرش نرم و چرخش کوچک */
  animation: playedIn 0.26s cubic-bezier(0.2, 1.1, 0.35, 1.12) backwards;
}
@keyframes playedIn {
  0% { transform: translate(-50%, -50%) scale(1.4) rotate(9deg); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(0.96) rotate(0deg); opacity: 1; }
}
.pp-top { top: 6%; left: 50%; }
.pp-bottom { bottom: 6%; left: 50%; }
.pp-left { left: 14%; top: 50%; }
.pp-right { left: 86%; top: 50%; }
.winner-glow .card { box-shadow: 0 0 0 2.5px var(--gold), 0 6px 16px rgba(0, 0, 0, 0.55); animation: winnerPulse 0.8s ease-in-out infinite alternate; }
@keyframes winnerPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.25) saturate(1.15); }
}

/* ---------------- ورق‌ها — بزرگ‌تر، با اندیس مرتب گوشه‌ای ---------------- */
.card {
  width: clamp(56px, 15vw, 70px);
  height: clamp(82px, 21.5vw, 100px);
  border-radius: 10px;
  background: linear-gradient(160deg, #fffef9, var(--card-bg));
  border: 1px solid var(--card-edge);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  position: relative;
  font-family: 'Segoe UI', 'Vazirmatn', sans-serif;
}
/* اندیس گوشهٔ بالا-چپ: عدد بالای نماد، دقیقاً زیر هم — مثل ورق واقعی؛
   پس‌زمینهٔ روشنِ کوچک دارد تا روی کارت‌های روی‌هم‌افتاده هم خوانا باشد */
.card .idx {
  position: absolute; top: 3px; left: 5px;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1.05; z-index: 2;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 6px;
  padding: 1px 3px 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}
.card .idx .rank { font-size: clamp(16px, 4.6vw, 20px); font-weight: 800; letter-spacing: -0.5px; }
.card .idx .suit-sm { font-size: clamp(12px, 3.4vw, 15px); }
/* اندیس چرخیده گوشهٔ پایین-راست */
.card .idx2 { top: auto; left: auto; bottom: 3px; right: 5px; transform: rotate(180deg); }
/* نماد بزرگ وسط ورق — با فاصله از اندیس‌ها */
.card .suit-big {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(26px, 7.4vw, 33px);
  z-index: 1;
}
.card.red { color: var(--red); }
.card.black { color: var(--black); }
.card.back {
  background: linear-gradient(135deg, #274e8f, #1b3a6d);
  border-color: rgba(255, 255, 255, 0.35);
}

/* 🃏 اسکین ورق «شبانهٔ تیره» — ورق سرمه‌ای با نمادهای روشن */
body.cs-night .card {
  background: linear-gradient(160deg, #2c3552, #1a2033);
  border-color: #4a5478;
}
body.cs-night .card.red { color: #ff8f86; }
body.cs-night .card.black { color: #f0ead8; }
/* اندیس در اسکین شبانه — پس‌زمینهٔ تیره تا با کارتِ سرمه‌ای هماهنگ بماند */
body.cs-night .card .idx { background: rgba(14, 20, 36, 0.92); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
body.cs-night .card.back { background: linear-gradient(135deg, #1b3a6d, #274e8f); }

/* دست بازیکن */
#handwrap { flex: 0 0 auto; }
.hand-label {
  font-size: 11.5px; color: var(--ink-dim);
  text-align: center; margin-bottom: 5px;
}
#hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: clamp(106px, 26vw, 124px);
  padding-bottom: 4px;
}
#hand .card {
  flex: 0 0 auto;
  margin-inline-start: -30px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  touch-action: manipulation;
}
#hand .card:first-child { margin-inline-start: 0; }
/* 🧺 دستِ ۱۶ کارتی حاکم — هم‌پوشانی بیشتر تا همهٔ ورق‌ها داخل صفحه بمانند و کنار کشیده نشوند */
#hand.crowd .card { margin-inline-start: -42px; }
#hand.crowd .card:first-child { margin-inline-start: 0; }
#hand .card.playable:hover { transform: translateY(-12px); }
#hand .card.playable:active { transform: translateY(-16px) scale(1.04); }
#hand .card.playable { box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
#hand .card.dimmed { filter: brightness(0.62) saturate(0.7); }
#hand .card.selected { transform: translateY(-16px); box-shadow: 0 0 0 2.5px var(--ok), 0 8px 16px rgba(0,0,0,0.45); }
#hand .card.gone { opacity: 0; pointer-events: none; }
#hand .card.deal { animation: dealIn 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) backwards; }
@keyframes dealIn {
  0% { transform: translate(-6vw, -34vh) rotate(12deg) scale(0.55); opacity: 0; }
  70% { opacity: 1; }
  100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
}
#hand .card.shake { animation: shake 0.35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* ---------------- نوار فاز و عمل‌ها ---------------- */
.phasebar {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-dim);
  min-height: 18px;
}
.actionbar {
  display: flex; flex-direction: column; gap: 7px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 9px 10px;
}
.chipgrid { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.chip {
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px; font-weight: 800;
  border-radius: 11px;
  padding: 9px 0;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s;
}
.chip:active { transform: scale(0.96); background: rgba(255, 255, 255, 0.16); }
.chip.ok { border-color: rgba(90, 220, 160, 0.65); color: #7ce8b4; background: rgba(90, 220, 160, 0.10); }
.chip.wide { font-size: 13.5px; }
.chip.shelem { border-color: rgba(227, 179, 76, 0.6); color: var(--gold); }
.chip.top { border-color: rgba(227, 179, 76, 0.85); color: var(--gold); background: rgba(227, 179, 76, 0.10); }
.chip.accept { border-color: rgba(90, 220, 160, 0.65); color: #7ce8b4; background: rgba(90, 220, 160, 0.10); }
.chip.pass { border-color: rgba(255, 123, 107, 0.55); color: #ffb0a6; }
.chip.suitbtn { font-size: 16px; }

/* ---------------- نتیجهٔ دست/بازی ---------------- */
.result {
  position: fixed; inset: 0;
  background: rgba(5, 14, 9, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 50;
}
.result-card {
  width: 100%; max-width: 340px;
  background: linear-gradient(180deg, #173a27, #102a1c);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 20px 18px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: pop 0.28s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.r-title { font-size: 17px; font-weight: 800; color: var(--gold); margin-bottom: 12px; }
#r-body { font-size: 13.5px; line-height: 2.1; color: var(--ink); }
#r-body .sep { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 0; }
#r-body .win { color: var(--ok); font-weight: 800; }
#r-body .lose { color: #ff9c8f; }
.r-actions { display: flex; gap: 8px; margin-top: 14px; }
.r-actions .chip { flex: 1; }

/* ---------------- توست ---------------- */
.toast {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 22, 15, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--ink);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 13px;
  max-width: 86vw;
  text-align: center;
  z-index: 60;
  animation: toastIn 0.25s ease;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* کارت پرنده (انیمیشن بازی‌شدن کارت) — transform روی GPU */
.fly-card {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  will-change: transform;
  transition: transform 0.42s cubic-bezier(0.25, 1, 0.4, 1), opacity 0.42s;
}
.fly-card .card { will-change: transform; }

/* ---------------- 💬 چت درون‌بازی ---------------- */
#chatwrap { flex: 0 0 auto; position: relative; margin-top: 5px; }
#chatbar {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  padding: 5px 7px;
}
.chatbtn {
  flex: 0 0 auto; min-width: 36px; height: 32px;
  border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08); color: var(--ink);
  font-size: 14px; cursor: pointer; font-family: inherit;
  padding: 0 8px;
}
.chatbtn:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.16); }
#chat-send { color: #9be7b9; }
#chat-last {
  flex: 0 1 auto; min-width: 0; max-width: 40%;
  font-size: 11px; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
#chat-input {
  flex: 1 1 auto; min-width: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px; color: var(--ink);
  font-family: inherit; font-size: 12.5px;
  padding: 6px 10px; outline: none;
}
#chat-input::placeholder { color: rgba(185, 201, 180, 0.6); }
#chat-input:focus { border-color: rgba(255, 215, 106, 0.55); }
#chatpanel {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  background: rgba(7, 18, 12, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  max-height: 215px; overflow-y: auto;
  z-index: 45;
  padding: 8px;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.55);
  animation: chatIn 0.18s ease;
}
@keyframes chatIn { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
#chat-list { display: flex; flex-direction: column; }
.cmsg {
  font-size: 12.5px; line-height: 1.7;
  padding: 4px 10px; border-radius: 10px; margin: 2px 0;
  background: rgba(255, 255, 255, 0.05);
  max-width: 92%;
}
.cmsg.mine { background: rgba(77, 163, 255, 0.16); margin-inline-start: auto; }
.cmsg .cname { color: var(--gold); font-weight: 700; }
.cmsg .cts { color: var(--ink-dim); font-size: 9.5px; margin-inline-start: 6px; }
.cmsg .ctext { margin-top: 1px; word-break: break-word; }
.cmsg.sysmsg { background: rgba(227, 179, 76, 0.10); color: var(--gold); text-align: center; margin: 2px auto; font-size: 11.5px; }

/* مینی‌اپ تمام‌صفحه */
body { padding-top: env(safe-area-inset-top); }

@media (max-height: 640px) {
  .card { width: 52px; height: 76px; }
  #hand { height: 92px; }
  #hand .card { margin-inline-start: -32px; }
  .avatar { width: 42px; height: 42px; font-size: 19px; }
  .center { width: clamp(150px, 42vw, 200px); height: clamp(124px, 34vw, 168px); }
  #chatpanel { max-height: 150px; }
}

/* صندلی‌های کناری — چیدمان ستونی تا نام‌ها نپیچند */
.slot-left .seat, .slot-right .seat {
  flex-direction: column;
  gap: 4px;
  padding: 4px 5px;
}
.slot-left .seat .pinfo, .slot-right .seat .pinfo { align-items: center; }
.slot-left .seat .pname, .slot-right .seat .pname {
  max-width: 72px; text-align: center; font-size: 11.5px;
}
.slot-left .seat .ptag, .slot-right .seat .ptag { font-size: 9.5px; text-align: center; }
.slot-left .seat .avatar, .slot-right .seat .avatar { width: 44px; height: 44px; font-size: 19px; }
.slot-left .seat .handpile, .slot-right .seat .handpile { transform: scale(0.9); }

/* ---------------- 🎮 لابی — تنظیمات میز داخل نسخهٔ گرافیکی ---------------- */
.lobby { padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.lobby-title { font-size: 16px; color: var(--ink); text-align: center; }
.lobby-code { color: var(--gold); font-weight: 800; }
.lobby-sub { font-size: 12.5px; color: var(--ink-dim); text-align: center; margin-top: -4px; }
.lobby-coins { font-size: 12.5px; color: var(--gold); text-align: center; min-height: 16px; }
#lobby-seats { display: flex; flex-direction: column; gap: 7px; }
.lseat {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 8px 10px;
}
.lseat.team-0 { border-inline-start: 3px solid var(--team-a); }
.lseat.team-1 { border-inline-start: 3px solid var(--team-b); }
.lseat.empty { opacity: 0.55; }
.lseat .avatar { width: 44px; height: 44px; font-size: 19px; }
.lseat-info { flex: 1; min-width: 0; }
.lseat-info .pname { font-size: 14px; font-weight: 700; text-align: right; }
.lseat-info .ptag { font-size: 11.5px; color: var(--ink-dim); text-align: right; }
.lseat-num { font-size: 12px; color: var(--ink-dim); font-weight: 800; }
#lobby-actions { display: flex; flex-direction: column; gap: 7px; }
.chip.start, .chip.join {
  border-color: rgba(88, 214, 141, 0.6);
  color: #7ce8a4;
  background: rgba(88, 214, 141, 0.10);
}
.chip.tgsel {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(227, 179, 76, 0.12);
}
.target-row { font-size: 12.5px; color: var(--ink-dim); margin: 4px 2px 0; }
.lobby-target { font-size: 12.5px; color: var(--ink-dim); text-align: center; margin-top: 2px; }
.lobby-shop { border-top: 1px dashed rgba(255,255,255,0.14); padding-top: 10px; margin-top: 2px; }
.shop-title { font-size: 12.5px; color: var(--ink-dim); margin-bottom: 7px; }
.shopgrid { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
.shopnote { font-size: 11px; color: var(--ink-dim); margin-top: 7px; line-height: 1.7; }

/* 🖼 عکس پروفایل تلگرامی داخل آواتار */
.avatar { position: relative; overflow: hidden; }
.avatar .avfb { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.avatar .avimg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* 🛒 فروشگاه در خانهٔ مینی‌اپ */
.home-btn.secondary { background: linear-gradient(180deg, #3a4d63, #2b3a4b); box-shadow: none; margin-top: 9px; }
.shopbox { margin-top: 10px; }
.shopbox .chipgrid { margin-bottom: 2px; }

/* 🏅 سطح بازیکن در خانهٔ مینی‌اپ */
.home-level { font-size: 13px; color: var(--gold); margin-top: 4px; min-height: 18px; font-weight: 700; }

/* 🖼 فروشگاه آواتار (اسکین) — پیش‌فرض ۴ آواتار رایگان؛ پولی‌ها بعداً همین‌جا */
.avbox {
  margin-top: 10px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
}
@media (max-width: 359px) { .avbox { grid-template-columns: repeat(2, 1fr); } }
.avcard {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 7px 4px 6px;
  cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink);
}
.avcard:active { transform: scale(0.95); }
.avcard img {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
}
.avcard .avname { font-size: 10.5px; font-weight: 700; }
.avcard .avprice { font-size: 10px; color: var(--gold); }
.avcard.sel {
  border-color: var(--gold);
  box-shadow: 0 0 0 1.5px rgba(227, 179, 76, 0.45);
  background: rgba(227, 179, 76, 0.10);
}

/* ============================================================
   🛡 پنل مدیریت شلم‌بات — فقط برای آی‌دی مدیر (ADMIN_IDS)
   ============================================================ */
.home-btn.admin {
  background: linear-gradient(180deg, #7a5c1e, #59400f);
  border: 1px solid #a97f2c;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  margin-top: 9px;
}
#admin {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px 28px;
  background: radial-gradient(120% 100% at 50% 0%, #143c26 0%, var(--bg) 70%);
}
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.admin-title { font-size: 17px; font-weight: 800; color: var(--gold); }
.admin-topbtns { display: flex; gap: 8px; }
.admin-topbtns .chatbtn { width: 36px; height: 36px; font-size: 15px; }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.atab {
  flex: 1 1 auto;
  padding: 9px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.atab.on { background: var(--gold); color: #241b06; font-weight: 800; border-color: var(--gold); }
.agrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.acard {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 4px;
  text-align: center;
}
.acard-v { font-size: 17px; font-weight: 800; color: var(--turn); }
.acard-l { font-size: 10.5px; color: var(--ink-dim); margin-top: 3px; line-height: 1.5; }
.apanel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}
.apanel-t { font-weight: 800; font-size: 14px; margin-bottom: 9px; color: var(--gold); }
.aprow {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 9px 10px;
  margin-bottom: 7px;
  font-size: 13px;
  line-height: 1.9;
}
.aprow:last-child { margin-bottom: 0; }
.apmeta { color: var(--ink-dim); font-size: 11.5px; }
.apbadge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 8px; margin-inline-start: 4px; vertical-align: 1px; }
.apbadge.wait { background: rgba(227, 179, 76, 0.2); color: var(--gold); }
.apbadge.ok { background: rgba(88, 214, 141, 0.18); color: #7ce8a4; }
.apbadge.no { background: rgba(192, 57, 43, 0.22); color: #ff9d92; }
.amuted { color: var(--ink-dim); font-size: 12px; line-height: 1.9; }
.aurow {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
}
.aurow.aublocked { border-color: rgba(192, 57, 43, 0.55); background: rgba(192, 57, 43, 0.10); }
.aur-name { font-weight: 800; font-size: 14px; }
.aur-meta, .aur-coins { font-size: 12px; color: var(--ink-dim); margin-top: 4px; line-height: 1.9; }
.aur-coins b { color: var(--turn); }
.aubadge { background: var(--red); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 8px; margin-inline-start: 6px; }
.aur-acts { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.grantform { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ainput {
  flex: 1 1 90px;
  min-width: 84px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  user-select: text;
  -webkit-user-select: text;
}
.ainput:focus { outline: none; border-color: var(--gold); }
textarea.newstext { width: 100%; min-height: 110px; resize: vertical; line-height: 1.9; }
.aloading { text-align: center; color: var(--ink-dim); padding: 30px 0; font-size: 14px; line-height: 2; }
.chip.small { padding: 7px 12px; font-size: 12.5px; }
.chip.ok { border-color: rgba(88, 214, 141, 0.6); color: #7ce8a4; background: rgba(88, 214, 141, 0.10); }

/* ---------------- 🎛 تب کنترل بازی — کلیدها، مجازها، مدیرها ---------------- */
.trow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.trow:last-child { border-bottom: none; }
.trow-name { font-size: 13.5px; font-weight: 800; }
.trow-desc { font-size: 11px; color: var(--ink-dim); line-height: 1.7; margin-top: 2px; }
.tbtn {
  flex: 0 0 auto; min-width: 74px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 800;
  cursor: pointer;
}
.tbtn.on { border-color: rgba(88, 214, 141, 0.65); color: #7ce8a4; background: rgba(88, 214, 141, 0.12); }
.tbtn.off { border-color: rgba(255, 123, 107, 0.55); color: #ffb0a6; background: rgba(255, 123, 107, 0.10); }
.arow {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.arow:last-of-type { border-bottom: none; }
.arow-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow-id { flex: 0 0 auto; font-size: 11px; color: var(--ink-dim); font-weight: 400; }
.abadge {
  flex: 0 0 auto;
  font-size: 10px; font-weight: 800;
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(227, 179, 76, 0.16);
  border: 1px solid rgba(227, 179, 76, 0.5);
  color: var(--gold);
}
.anote { font-size: 11.5px; color: var(--ink-dim); line-height: 1.9; margin-top: 8px; }
.anote.warn { color: #ffc46b; }

/* ============================================================
   🌐 لابی بازی آنلاین — فهرست میزهای باز + ساخت میز جدید (+)
   ============================================================ */
#online {
  position: fixed; inset: 0; z-index: 60;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 12px 30px;
  background: radial-gradient(120% 100% at 50% 0%, #143c26 0%, var(--bg) 70%);
}
.ol-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ol-title { flex: 1; font-size: 17px; font-weight: 800; color: var(--gold); }
.ol-top .chatbtn { width: 38px; height: 38px; font-size: 16px; }
.chip.new { border-color: rgba(53, 196, 143, 0.6); color: #7ce8b4; background: rgba(53, 196, 143, 0.10); }
.ol-create {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 12px;
  margin: 10px 0 14px;
}
.ol-lbl { font-size: 12.5px; color: var(--ink-dim); margin: 8px 0 5px; }
.ol-create .ainput { width: 100%; margin-top: 2px; }
#ol-create-go { margin-top: 12px; }
#ol-list { display: flex; flex-direction: column; gap: 9px; }
.olrow {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 10px 12px;
}
.olrow-host { font-size: 14px; font-weight: 800; }
.olrow-meta { font-size: 11.5px; color: var(--ink-dim); margin-top: 3px; line-height: 1.8; }
.olrow-meta b { color: var(--turn); }
.olrow-avs { display: flex; gap: -4px; margin-top: 7px; }
.olrow-avs .avatar { width: 30px; height: 30px; font-size: 13px; margin-inline-end: -6px; border-width: 2px; }
.olrow-acts { display: flex; gap: 8px; margin-top: 9px; }
.olrow .chip { flex: 1; }
.ol-empty { text-align: center; color: var(--ink-dim); font-size: 13px; padding: 26px 10px; line-height: 2; }

/* ============================================================
   ⚙️ تنظیمات و پروفایل — آمار، نام دلخواه، آواتار و اسکین‌ها، خریدها
   (از استایل پنل مدیریت ارث می‌برد: .admin، .apanel، .ainput…)
   ============================================================ */
#settings-body { display: flex; flex-direction: column; }
.set-profile {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}
.set-profile .avatar { width: 56px; height: 56px; font-size: 24px; }
.set-pname { font-size: 16px; font-weight: 800; }
.set-psub { font-size: 11.5px; color: var(--ink-dim); margin-top: 2px; line-height: 1.8; }
.nameform { display: flex; gap: 6px; margin-top: 9px; }
.nameform .ainput { flex: 1; }

/* ============================================================
   💬 چت — جملات پیش‌فرض + اعلان ۳ ثانیه‌ای بالای کادر گفتگو
   ============================================================ */
/* 📝 توضیح بالای جملات آماده — تایپ آزاد خاموش است */
.chat-note {
  padding: 8px 12px 0;
  font-size: 10.5px;
  color: var(--ink-dim);
}
.chat-presets {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 6px 10px 4px;
  scrollbar-width: none;
}
.chat-presets::-webkit-scrollbar { display: none; }
.pchip {
  flex: 0 0 auto;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-family: inherit; font-size: 12px; font-weight: 700;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.pchip:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.16); }
.chat-toast {
  position: absolute;
  inset-inline: 12px;
  bottom: 54px;
  z-index: 20;
  background: rgba(12, 30, 20, 0.92);
  border: 1px solid rgba(227, 179, 76, 0.5);
  color: var(--ink);
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.7;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: ctIn 0.25s ease;
}
.chat-toast b { color: var(--gold); }
@keyframes ctIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- 🎫 پشتیبانی — گفتگوی کاربر با مدیر ----------------
   حباب‌های گفتگو: پیام کاربر سمت چپ (طلایی)، پاسخ مدیر سمت راست (سبز) */
#support .admin-top { margin-bottom: 10px; }
.sup-msgs {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 8px;
  padding: 6px 2px 10px;
  min-height: 40vh;
  max-height: 62vh;
}
.sup-empty {
  margin: auto; text-align: center;
  font-size: 13px; color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 14px; padding: 18px 14px;
}
.supmsg { display: flex; flex-direction: column; gap: 2px; max-width: 86%; }
.supmsg.me { align-self: flex-start; }        /* پیام خود کاربر — چپ */
.supmsg.admin { align-self: flex-end; align-items: flex-end; } /* پاسخ مدیر — راست */
.supmsg .sup-bub {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}
.supmsg.me .sup-bub {
  background: linear-gradient(160deg, rgba(227, 179, 76, 0.92), rgba(196, 148, 48, 0.92));
  color: #221a06; font-weight: 600;
  border-start-start-radius: 4px;
}
.supmsg.admin .sup-bub {
  background: linear-gradient(160deg, rgba(24, 66, 42, 0.95), rgba(14, 44, 28, 0.95));
  border: 1px solid rgba(124, 232, 180, 0.35);
  color: #e8fff1;
  border-start-end-radius: 4px;
}
.supmsg .sup-ts { font-size: 10px; color: var(--ink-dim); padding: 0 4px; }
.sup-inputrow {
  display: flex; gap: 8px; align-items: stretch;
  padding-top: 6px;
}
.sup-inputrow .ainput { flex: 1; }
.sup-inputrow .chip { flex: 0 0 auto; padding: 10px 18px; }
#support .anote, #admin .anote { margin-top: 8px; }
/* دکمهٔ گفتگو با پشتیبانی در تنظیمات + badge پاسخ دیده‌نشده */
.sup-open { text-align: center; }
.supdot {
  display: inline-block; min-width: 18px; padding: 1px 6px;
  margin-inline-start: 4px;
  background: #e0442e; color: #fff;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 800;
  animation: supPulse 1.2s ease infinite alternate;
}
@keyframes supPulse { from { transform: scale(1); } to { transform: scale(1.12); } }
/* ردیف‌های فهرست تیکت‌ها در پنل مدیریت */
button.suprow { display: block; width: 100%; text-align: start; cursor: pointer; margin-bottom: 7px; }
.suprow.unread { border-color: rgba(224, 68, 46, 0.55); }
.suprow-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
