/* صفحه‌ی اصلی مینی‌اپ (هاب). همان رنگ‌ها و فونت صفحه‌های بازی. */
@font-face { font-family: Vazirmatn; src: url("/arcade/font/regular.ttf") format("truetype"); font-weight: 100 600; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("/arcade/font/bold.ttf") format("truetype"); font-weight: 700 1000; font-display: swap; }
:root {
  --bg: #0d1024;
  --bg2: #1b1446;
  --panel: rgba(30, 34, 68, .78);
  --panel2: rgba(44, 50, 96, .7);
  --stroke: rgba(255, 255, 255, .1);
  --ink: #f5f6ff;
  --muted: #9aa3cf;
  --accent: #6ee7ff;
  --accent2: #a78bfa;
  --gold: #ffc857;
  --good: #34d399;
  --danger: #ff5c7a;
  --safe-top: calc(env(safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--tg-safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* پس‌زمینه روی لایه‌ی ثابتِ جدا (نه background-attachment: fixed): روی اندرویدِ تلگرام، پس‌زمینه‌ی fixed هر فریم
   اسکرول کل صفحه را دوباره رنگ می‌کرد؛ این لایه یک بار کشیده و فقط ترکیب می‌شود. */
html { background: var(--bg); }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Vazirmatn, Tahoma, system-ui, sans-serif;
  font-size: 15px;
  overscroll-behavior: none;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(110, 231, 255, .14), transparent 70%),
    radial-gradient(60% 45% at 90% 10%, rgba(167, 139, 250, .2), transparent 70%),
    radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.8; }
h2 { margin: 18px 2px 8px; font-size: 15px; font-weight: 900; }
h2 small { color: var(--muted); font-weight: 400; }
h3 { margin: 4px 0 8px; font-size: 18px; }

/* ---------------------------------------------------------------- سربرگ */
#top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 10px) 14px 10px;
  background: linear-gradient(180deg, rgba(13, 16, 36, .98), rgba(13, 16, 36, .93));
  border-bottom: 1px solid var(--stroke);
}
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--accent2), var(--accent)); font-size: 20px; }
.who { flex: 1 1 auto; min-width: 0; }
.who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.level i { flex: 1 1 auto; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .12); overflow: hidden; max-width: 140px; }
.level em { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.coins { padding: 6px 12px; border-radius: 99px; background: rgba(255, 200, 87, .14); border: 1px solid rgba(255, 200, 87, .4); color: var(--gold); font-weight: 900; white-space: nowrap; }

main { padding: 6px 14px calc(var(--safe-bottom) + 90px); max-width: 640px; margin: 0 auto; }

/* ---------------------------------------------------------------- کارت و دکمه */
.card { margin: 10px 0; padding: 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--stroke); }
.card.center { text-align: center; }
.card.result { border-color: rgba(255, 200, 87, .45); }
.btn {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 11px 14px;
  background: var(--panel2);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .28);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .28); }
.btn.go { border: 0; background: linear-gradient(180deg, #b8f76a, #34d399 55%, #10b6a0); color: #06281f; }
.btn.danger { border: 0; background: linear-gradient(180deg, #ff9aa9, var(--danger) 60%, #e6375a); color: #3d0514; }
.btn.violet { border-color: rgba(167, 139, 250, .55); background: linear-gradient(180deg, rgba(167, 139, 250, .3), rgba(167, 139, 250, .14)); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.line { background: rgba(110, 231, 255, .08); border-color: rgba(110, 231, 255, .45); color: #dff8ff; }
.btn.wide { display: block; width: 100%; margin-top: 12px; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row .btn { flex: 1 1 0; }

.daily { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.daily small { display: block; color: var(--muted); font-size: 12px; }

.banner {
  display: block;
  width: 100%;
  padding: 18px 16px;
  border: 0;
  border-radius: 20px;
  text-align: right;
  color: #fff;
  font: inherit;
  background: radial-gradient(120% 140% at 0% 0%, #ff7aa8, #7c3aed 55%, #312e81);
  box-shadow: 0 10px 28px rgba(124, 58, 237, .35);
  cursor: pointer;
}
.banner span { display: block; font-size: 20px; font-weight: 900; }
.banner small { opacity: .85; }

/* ---------------------------------------------------------------- برند و کیف پول */
.brand { display: flex; align-items: baseline; gap: 8px; margin: 14px 2px 4px; }
.brand-mark { font-size: 22px; }
.brand b {
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--gold), #ffe9a8 45%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand small { color: var(--muted); font-size: 12px; }
.card.wallet {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 200, 87, .35);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255, 200, 87, .22), transparent 55%),
    linear-gradient(160deg, rgba(44, 50, 96, .92), rgba(24, 27, 58, .92));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}
.wallet-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wallet-top small { display: block; color: var(--muted); font-size: 12px; }
.wallet-top b { display: block; margin-top: 2px; font-size: 26px; font-weight: 900; color: var(--gold); direction: ltr; text-align: right; unicode-bidi: plaintext; }
.wallet-icon { font-size: 34px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.card.wallet .row { margin-top: 12px; }
.card.wallet .btn { padding: 10px 6px; font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(44, 50, 96, .72), rgba(30, 34, 68, .78));
  border: 1px solid var(--stroke);
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  transition: transform .12s ease, border-color .12s ease;
}
.tile:active { transform: scale(.96); border-color: rgba(110, 231, 255, .55); }
.tile b { font-size: 13px; font-weight: 800; line-height: 1.5; }
.tile .icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  font-size: 32px;
  line-height: 1;
  border-radius: 16px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35));
}
.tile .icon canvas { display: block; border-radius: 16px; }
.tile .icon.chess { background: radial-gradient(circle at 35% 30%, #3b3f73, #1a1d3f 70%); border: 1px solid rgba(255, 255, 255, .18); }
.tile .icon.chess img { width: 46px; height: 46px; }

/* ---------------------------------------------------------------- حریف */
/* حریف تصادفی: دو بخش جمع‌وجور (نوبتی و آرکید)، مبلغ دلخواه و گفت‌وگو */
.duel-kind { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 12px 2px 6px; }
.duel-kind b { font-size: 13.5px; }
.duel-kind small { color: var(--muted); font-size: 11.5px; text-align: left; }
.duel-board { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.duel-game {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--stroke); border-radius: 14px; background: var(--panel); color: var(--ink);
  font: inherit; text-align: right; cursor: pointer;
}
.duel-game .duel-emoji { grid-row: span 2; font-size: 26px; line-height: 1; }
.duel-game b { font-size: 14px; }
.duel-game small { color: var(--muted); font-size: 11.5px; direction: rtl; unicode-bidi: plaintext; }
.duel-game.on, .duel-tile.on { border-color: var(--accent); background: rgba(110, 231, 255, .16); box-shadow: 0 0 0 1px rgba(110, 231, 255, .35) inset; }
.duel-arcade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.duel-tile {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 7px;
  border: 1px solid var(--stroke); border-radius: 12px; background: var(--panel); color: var(--ink); font: inherit; cursor: pointer;
}
.duel-tile .icon { display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 11px; font-size: 26px; }
.duel-tile .icon canvas { width: 44px !important; height: 44px !important; display: block; }
.duel-tile b { font-size: 10.5px; font-weight: 800; line-height: 1.3; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.duel-pick { margin: 10px 2px 0; color: #dff8ff; }
.custom-stake { display: flex; gap: 8px; margin-top: 8px; }
.custom-stake input {
  flex: 1 1 auto; min-width: 0; padding: 10px 12px; border: 1px solid var(--stroke); border-radius: 12px;
  background: rgba(255, 255, 255, .06); color: var(--ink); font: inherit; direction: rtl;
}
.custom-stake .btn { flex: none; padding: 10px 14px; }
.chat { margin-top: 12px; padding: 10px; border: 1px solid var(--stroke); border-radius: 14px; background: rgba(9, 11, 28, .45); }
.chat:empty { display: none; }
.chat-title { display: block; margin-bottom: 6px; font-size: 13px; }
.chat-log { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; padding: 2px; }
.chat-msg { align-self: flex-start; max-width: 85%; padding: 6px 10px; border-radius: 12px 12px 12px 4px; background: rgba(255, 255, 255, .08); font-size: 13.5px; line-height: 1.6; word-break: break-word; }
.chat-msg small { display: block; color: var(--accent); font-size: 11px; font-weight: 800; }
.chat-msg.mine { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: rgba(52, 211, 153, .2); }
.chat-quick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chat-quick .chip { flex: none; padding: 5px 10px; font-size: 12.5px; }
.chat-input { display: flex; gap: 6px; margin-top: 6px; }
.chat-input input { flex: 1 1 auto; min-width: 0; padding: 9px 12px; border: 1px solid var(--stroke); border-radius: 12px; background: rgba(255, 255, 255, .06); color: var(--ink); font: inherit; }
.chat-input .btn { flex: none; padding: 9px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 13px;
  border-radius: 99px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.chip.on { border-color: var(--accent); background: rgba(110, 231, 255, .18); color: #e8fbff; }
.radar { position: relative; width: 90px; height: 90px; margin: 6px auto 10px; }
.radar i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); animation: ping 2.4s ease-out infinite; opacity: 0; }
.radar i:nth-child(2) { animation-delay: .8s; }
.radar i:nth-child(3) { animation-delay: 1.6s; }
@keyframes ping { from { transform: scale(.2); opacity: .9; } to { transform: scale(1); opacity: 0; } }
.vs { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; text-align: center; }
.vs > div { flex: 1 1 0; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .05); }
.vs small { color: var(--muted); font-size: 12px; }
.vs-mark { flex: 0 0 auto !important; background: none !important; font-weight: 900; color: var(--accent2); }
.offer { color: var(--gold); font-weight: 900; }

/* ---------------------------------------------------------------- رتبه‌ها، فروشگاه، من */
.seg { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: var(--panel); margin-top: 10px; }
.seg button { flex: 1 1 0; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-weight: 800; }
.seg button.on { background: rgba(110, 231, 255, .18); color: var(--ink); }
.list { list-style: none; margin: 10px 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--stroke); }
.list li.me { border-color: var(--accent); }
.list .rank { width: 30px; text-align: center; font-weight: 900; }
.list .name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .val { font-weight: 900; color: var(--gold); white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.list .val.minus { color: var(--danger); }
.list .val.plus { color: var(--good); }
.list small { display: block; color: var(--muted); font-size: 12px; }
/* خرید سکه در فروشگاه */
.card.coinshop {
  border-color: rgba(255, 200, 87, .4);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 200, 87, .2), transparent 55%),
    linear-gradient(160deg, rgba(44, 50, 96, .92), rgba(24, 27, 58, .92));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}
.coinshop-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.coinshop-top b { display: block; font-size: 18px; font-weight: 900; }
.coinshop-top small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.coinshop-balance { flex: none; padding: 4px 10px; border-radius: 999px; background: rgba(255, 200, 87, .14); color: var(--gold); font-size: 12px; font-weight: 800; white-space: nowrap; }
.packs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.pack {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px;
  border: 1px solid rgba(255, 200, 87, .35); border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 200, 87, .16), rgba(255, 200, 87, .05));
  color: var(--ink); font: inherit; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .28);
  transition: transform .08s ease;
}
.pack:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .28); }
.pack:disabled { opacity: .45; }
.pack b { font-size: 24px; font-weight: 900; color: var(--gold); line-height: 1.2; }
.pack b::after { content: " 🪙"; font-size: 18px; }
.pack .unit { color: var(--muted); font-size: 12px; }
.pack .price { margin-top: 6px; padding: 4px 10px; border-radius: 999px; background: linear-gradient(180deg, #b8f76a, #34d399 55%, #10b6a0); color: #06281f; font-size: 13px; font-weight: 900; }
.steps { margin: 12px 0 4px; padding-inline-start: 20px; color: var(--muted); font-size: 12.5px; line-height: 1.9; list-style-type: persian; }
.soon { padding: 12px; border-radius: 14px; background: var(--panel); text-align: center; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.item { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--stroke); }
.item.equipped { border-color: var(--good); }
.item b { font-size: 18px; }
.item .btn { padding: 8px; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stats div { padding: 12px 6px; border-radius: 14px; background: var(--panel); text-align: center; }
.stats b { display: block; font-size: 20px; }
.stats small { color: var(--muted); font-size: 12px; }
.progress { height: 8px; margin: 8px 0; border-radius: 8px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.progress em { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--good), var(--accent)); }

/* ---------------------------------------------------------------- نوار تب‌ها */
#tabs {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  padding: 6px 6px calc(var(--safe-bottom) + 6px);
  background: rgba(13, 16, 36, .97);
  border-top: 1px solid var(--stroke);
}
#tabs button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; border-radius: 12px; background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 800; }
#tabs button span { font-size: 20px; }
#tabs button.on { color: var(--ink); background: rgba(110, 231, 255, .12); }
/* جوین اجباری */
.gate { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(9, 11, 28, .9); backdrop-filter: blur(8px); }
.gate .card { width: min(100%, 360px); padding: 20px 16px; }
.gate-icon { font-size: 46px; line-height: 1.2; }
.gate-title { display: block; margin: 6px 0 2px; font-size: 18px; }
.gate-list { display: grid; gap: 8px; margin: 14px 0; }
.gate-list .btn { width: 100%; }
#toast { position: fixed; inset-inline: 16px; bottom: calc(var(--safe-bottom) + 84px); z-index: 9; padding: 12px 14px; border-radius: 14px; background: rgba(20, 24, 52, .96); border: 1px solid var(--stroke); text-align: center; font-weight: 700; }


/* ================================================================ نسخه‌ی باکیفیت‌تر رابط
   بنر براق با برق در حال حرکت، ردیف بازی‌های محبوب، کاشی‌ها و کارت‌های بازی با نور بالا و سایه‌ی نرم، نشان روشن پشت
   ایموجی بازی‌های نوبتی (حکم مشکی روی زمینه‌ی تیره دیده نمی‌شد) و نوار پایین شیشه‌ای. فقط transform/opacity جان دارد. */
.banner { position: relative; overflow: hidden; background: radial-gradient(120% 140% at 0% 0%, #ff8fb5, #8b5cf6 50%, #312e81); box-shadow: 0 12px 30px rgba(124, 58, 237, .4), inset 0 1px 0 rgba(255, 255, 255, .35); }
.banner::after { content: "⚔️"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%) rotate(-12deg); font-size: 46px; opacity: .9; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.banner span, .banner small { position: relative; z-index: 1; display: block; padding-left: 70px; }
.banner-shine { position: absolute; inset: -40% -60%; background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .28) 50%, transparent 58%); transform: translateX(-70%); animation: banner-shine 4.5s ease-in-out infinite; pointer-events: none; }
@keyframes banner-shine { 0%, 55% { transform: translateX(-70%); } 100% { transform: translateX(70%); } }
.featured { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.featured button {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 4px 9px; border-radius: 16px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .1); color: var(--ink); font: inherit;
  background: linear-gradient(180deg, rgba(60, 66, 120, .75), rgba(26, 30, 62, .9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 6px 14px rgba(0, 0, 0, .3);
  transition: transform .12s ease;
}
.featured button:active { transform: scale(.95); }
.featured span {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 50%; font-size: 24px;
  background: radial-gradient(circle at 35% 30%, #ffffff, #e7e9f5 55%, #b9bed6); box-shadow: 0 4px 10px rgba(0, 0, 0, .35), inset 0 -2px 4px rgba(0, 0, 0, .15);
}
.featured span, .duel-game .duel-emoji { color: #1a1d3f; }
.featured b { font-size: 13px; font-weight: 900; }
.featured small { color: var(--muted); font-size: 11px; }

.card { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 8px 22px rgba(0, 0, 0, .25); }
.card.daily { background: linear-gradient(160deg, rgba(52, 211, 153, .16), rgba(30, 34, 68, .85) 55%); border-color: rgba(52, 211, 153, .35); }
.tile { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 8px 18px rgba(0, 0, 0, .28); }
.tile .icon { box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }

.duel-game { background: linear-gradient(180deg, rgba(52, 58, 108, .8), rgba(26, 30, 62, .9)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }
.duel-game .duel-emoji {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, #ffffff, #e7e9f5 55%, #b9bed6); box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
}
.duel-game.on, .duel-tile.on { background: linear-gradient(180deg, rgba(110, 231, 255, .22), rgba(110, 231, 255, .08)); }
.duel-tile { background: linear-gradient(180deg, rgba(52, 58, 108, .8), rgba(26, 30, 62, .9)); }

@media (prefers-reduced-motion: reduce) { .banner-shine { animation: none; } }
