/* ═══════════════════════════════════════════════════════════
   حکم — استایل مینی‌اپ
   پالت: فرش ایرانی (کرم، لاجوردی، فیروزه‌ای، طلایی، لاکی)
   ═══════════════════════════════════════════════════════════ */

   @font-face {
  font-family: 'AhangBlack';
  src: url('/static/shared/fonts/Ahang-Black.ttf') format('truetype');
}

@font-face {
  font-family: 'IRANSans';
  src: url('/static/shared/fonts/IRANSans.ttf') format('truetype');
  font-weight: normal;
}

@font-face {
  font-family: 'IRANSans';
  src: url('/static/shared/fonts/IRANSans-Bold.ttf') format('truetype');
  font-weight: 700;
}

@font-face {
  font-family: 'IRANSans';
  src: url('/static/shared/fonts/IRANSans-Black.ttf') format('truetype');
  font-weight: 900;
}

:root{
  --cream:#efe3c8;
  --cream-2:#e2d2ae;
  --navy:#16283f;
  --navy-2:#0d1a2b;
  --teal:#2f7f8c;
  --gold:#d9b45c;
  --gold-2:#a8862f;
  --crimson:#8d2230;
  --ink:#1a1206;
  --ok:#3f9a5e;
  --warn:#c98a2b;
  --err:#b3352f;
  --card-w:68px;
  --card-h:90px;
  --safe-t:env(safe-area-inset-top,0px);
  --safe-b:env(safe-area-inset-bottom,0px);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;width:100%;margin:0;overflow:hidden}
body{
  font-family:'IRANSans', sans-serif;
  background:var(--navy-2);
  color:var(--cream);
  user-select:none;
  -webkit-user-select:none;
}
button{font-family:inherit;cursor:pointer;border:0;background:none;color:inherit}
input{font-family:inherit}
/* Image file dimensions do not control UI slots; existing class sizes do. */
img{object-fit:contain;object-position:center}
/* Every card, including inline previews, fills its display slot. */
.card-svg{display:block;width:100%;height:100%}

/* ─── صفحه‌ها ─── */
.screen{
  position:fixed;inset:0;display:none;flex-direction:column;
  padding-top:var(--safe-t);padding-bottom:var(--safe-b);
  width:100%;height:100%;overflow-x:hidden;
}
.screen.active{display:flex}

/* ═══════════ پس‌زمینه فرش ═══════════ */
.carpet{
  background-color:#d9c7a2;
  background-image:
    radial-gradient(ellipse 60% 45% at 50% 50%, rgba(239,227,200,.95) 0%, rgba(226,210,174,.9) 45%, rgba(0,0,0,0) 70%),
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(22,40,63,.10) 0deg 6deg, rgba(0,0,0,0) 6deg 12deg),
    repeating-linear-gradient(45deg, rgba(47,127,140,.10) 0 6px, rgba(0,0,0,0) 6px 14px),
    repeating-linear-gradient(-45deg, rgba(141,34,48,.07) 0 6px, rgba(0,0,0,0) 6px 14px),
    linear-gradient(#c9b48c,#b89f74);
}

/* ═══════════ اسپلش ═══════════ */
#splash{align-items:center;justify-content:center;background:
  radial-gradient(circle at 50% 30%, #1d3550 0%, #0d1a2b 70%)}
.splash-inner{text-align:center}
.guest-join-form,.invite-options{display:grid;gap:10px}
.guest-join-form{width:min(280px,calc(100vw - 40px));margin:16px auto 0;text-align:right}
.guest-join-form[hidden],.spinner[hidden],#btnShare[hidden]{display:none}
.guest-join-form label{font-size:13px}
.guest-join-form input,.invite-options input{width:100%;min-width:0;padding:10px 12px;border:1px solid #496179;border-radius:10px;background:#0d1a2b;color:#fff}
.guest-join-form .btn,.invite-options .btn{min-height:42px;padding:8px 12px}
.invite-options input{direction:ltr;text-align:left}
.splash-logo{width:120px;height:168px;margin:0 auto 18px;filter:drop-shadow(0 12px 26px rgba(0,0,0,.6));
  animation:floaty 3.2s ease-in-out infinite}
.splash-logo svg{width:100%;height:100%}
@keyframes floaty{0%,100%{transform:translateY(0) rotate(-3deg)}50%{transform:translateY(-12px) rotate(3deg)}}
.brand{margin:0;font-size:44px;letter-spacing:2px;color:var(--gold);
  text-shadow:0 2px 0 var(--gold-2),0 8px 24px rgba(0,0,0,.6)}
.brand-sub{margin:2px 0 26px;color:#9fb2c6;font-size:14px}
.spinner{width:30px;height:30px;margin:0 auto;border:3px solid rgba(217,180,92,.25);
  border-top-color:var(--gold);border-radius:50%;animation:spin .9s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.splash-msg{margin-top:14px;color:#8ea3b8;font-size:13px}

#menu, #unoMenu, #chessMenu {
  background: #09121d url('/static/shared/images/bg_pattern.webp') no-repeat center center / cover;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

.game-select-back {
  flex: 0 0 30px;
  width:30px;height:30px;
  margin:0;
  padding:0;
  display:flex;align-items:center;justify-content:center;
  border: 1px solid rgba(217, 180, 92, 0.4);
  border-radius: 9px;
  color: var(--gold);
  font-size:22px;line-height:1;
}
#menu > .menu-head,#unoMenu > .menu-head,#chessMenu > .menu-head{gap:12px}
#menu > .menu-head .user-info-right,#unoMenu > .menu-head .user-info-right,#chessMenu > .menu-head .user-info-right{margin-left:auto}

.btn-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.link-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  width: 100%;
  direction: ltr;
}

.menu-burger-btn {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.burger-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.burger-line span {
  width: 28px;
  height: 4px;
  border-radius: 2px;
}

.burger-line.cyan span { background-color: #38a5b5; }
.burger-line.gold span { background-color: #e6bc62; }
.burger-line.red span { background-color: #d93d59; }

.burger-line img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.user-info-right {
  display: flex;
  align-items: center;
  gap: 12px;
  direction: rtl;
}

.menu-head-text {
  text-align: right;
}

.menu-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-name {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
}

.btn-rejoin-game {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, #e5bc5c 0%, #b88a28 100%);
  color: #0e1722;
  font-family: 'IRANSans', sans-serif;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid #f2c766;
  box-shadow: 0 0 10px rgba(229, 188, 98, 0.5);
  cursor: pointer;
  animation: pulseRejoin 1.8s infinite;
}

.rejoin-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #27ae60;
  box-shadow: 0 0 6px #27ae60;
}

@keyframes pulseRejoin {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(229, 188, 98, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 0 16px rgba(229, 188, 98, 0.8); }
}

.menu-stat {
  font-size: 11px;
  color: #8fa0b0;
  margin-top: 2px;
  letter-spacing: 0.3px;
}

.avatar-container {
  position: relative;
  width: 56px;
  height: 56px;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #e6bc62;
  box-shadow: 0 0 10px rgba(230, 188, 98, 0.4);
  background-size: cover;
  background-position: center;
}

.avatar-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  object-fit: contain;
  z-index: 3;
  filter: drop-shadow(0 0 1.5px #e6bc62) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.menu-body {
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  width: calc(100% - 32px);
  margin: 10px auto 30px;
  background: rgba(13, 22, 33, 0.82);
  border: 1px solid rgba(217, 180, 92, 0.25);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}


.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  direction: ltr;
}

.mode-opt {
  padding: 4px 4px 10px;
  border-radius: 16px;
  font-size: 13.5px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1.5px solid transparent;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.mode-opt span {
  font-family: 'AhangBlack', 'Vazirmatn', sans-serif;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.mode-opt[data-mode="4"] {
  background: linear-gradient(180deg, #327b87 0%, #1f5761 100%);
  color: #ffe066;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 4px 10px rgba(0, 0, 0, 0.3);
}

.mode-opt[data-mode="2"] {
  background: linear-gradient(180deg, #e5bc5c 0%, #b88a28 100%);
  color: #0b1824;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 4px 10px rgba(0, 0, 0, 0.3);
}

.mode-opt[data-mode="4"].active {
  border: 2px solid #f2c766;
  box-shadow: 0 0 12px rgba(242, 199, 102, 0.45);
}

.mode-opt[data-mode="2"].active {
  border: 2px solid #3ca0b0;
  box-shadow: 0 0 14px rgba(60, 160, 176, 0.6);
}

.mode-suits {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 0;
}

.mode-suits img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.field label {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #b0c6d4;
  text-align: center;
  margin-top: 2px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  direction: ltr;
}

.chip {
  height: 76px;
  border-radius: 14px;
  background: linear-gradient(180deg, #18283a 0%, #101c2b 100%);
  border: 1px solid #23374d;
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chip-suit {
  position: absolute;
  width: 12px;
  height: 12px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
  transition: filter 0.15s;
}

.chip-suit.top {
  top: 5px;
  left: 6px;
}

.chip-suit.bottom {
  bottom: 5px;
  right: 6px;
}

.chip.active {
  border: 2px solid #e5bc5c;
  box-shadow: 0 0 14px rgba(229, 188, 98, 0.5);
  background: linear-gradient(180deg, #1f3045 0%, #132233 100%);
  color: #f2c766;
  text-shadow: 0 0 8px rgba(242, 199, 102, 0.5);
}

.chip.active .chip-suit {
  filter: brightness(0) saturate(100%) invert(82%) sepia(48%) saturate(680%) hue-rotate(352deg) brightness(98%) contrast(92%) drop-shadow(0 0 4px rgba(242, 199, 102, 0.6));
}

.btn {
  border-radius: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: none;
  cursor: pointer;
}

.btn.primary.big {
  background: linear-gradient(180deg, #e5bc5c 0%, #b88a28 100%);
  color: #121922;
  padding: 14px 20px;
  font-size: 26px;
  font-family: 'AhangBlack', 'Vazirmatn', sans-serif;
  font-weight: 900;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 6px 18px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: visible;
  flex-direction: row-reverse;
  border: 1px solid #f2c766;
  border-radius: 22px;
}

.btn.primary.big .btn-img {
  width: 110px;
  height: 110px;
  margin-top: -50px;
  margin-bottom: -30px;
  margin-right: 20px;
  margin-left: -12px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
}

.btn.gold {
  background: linear-gradient(180deg, #327b87 0%, #1f5761 100%);
  color: #ffffff;
  padding: 12px 18px;
  font-size: 20px;
  font-family: 'AhangBlack', 'Vazirmatn', sans-serif;
  font-weight: 900;
  border: 1px solid #3ca0b0;
  border-radius: 22px;
  flex-direction: row-reverse;
  position: relative;
  overflow: visible;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.3);
}

.btn.gold .btn-img {
  width: 76px;
  height: 76px;
  margin-top: -18px;
  margin-bottom: -14px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.btn-sub-container {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.btn-sub-container small {
  font-family: 'IRANSans', sans-serif;
  font-size: 12px;
  color: #a4c8cf;
  font-weight: 700;
  margin-top: 2px;
}

.btn.primary.big .btn-sub-container small {
  color: #3b2a10;
}

.join-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  flex-direction: row-reverse;
}

.join-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-suit {
  position: absolute;
  width: 11px;
  height: 11px;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.8;
}

.input-suit.top-left {
  top: 6px;
  left: 8px;
}

.input-suit.top-right {
  top: 6px;
  right: 8px;
}

.input-suit.bottom-left {
  bottom: 6px;
  left: 8px;
}

.input-suit.bottom-right {
  bottom: 6px;
  right: 8px;
}

.join-row input {
  width: 100%;
  height: 48px;
  background: #0d1722;
  border: 1.5px solid #23364a;
  border-radius: 12px;
  color: #ffffff;
  font-family: 'IRANSans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  padding: 0 28px;
  outline: none;
}

.join-row input::placeholder {
  color: #8da0b3;
  font-size: 15px;
  font-weight: 700;
}

.diamond-btn {
  width: 50px;
  height: 50px;
  background: linear-gradient(180deg, #1f3547 0%, #122230 100%);
  color: #f2c766;
  font-family: 'AhangBlack', 'IRANSans', sans-serif;
  font-weight: 900;
  font-size: 18px;
  border-radius: 14px;
  transform: rotate(45deg);
  margin: 0 10px;
  flex-shrink: 0;
  border: 2px solid #e5bc5c;
  box-shadow: 0 0 12px rgba(229, 188, 98, 0.45);
}

.diamond-btn span {
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-45deg);
  text-shadow: 0 0 6px rgba(242, 199, 102, 0.4);
}

.menu-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
  direction: ltr;
}

.link-btn {
  height: 52px;
  background: linear-gradient(180deg, #1b2c3d 0%, #101c2b 100%);
  border: 1px solid #283e52;
  border-radius: 14px;
  color: #ffffff;
  font-family: 'AhangBlack', 'IRANSans', sans-serif;
  font-size: 17px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 0 10px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.25);
}

.link-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

/* ═══════════ لابی ═══════════ */
#lobby {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #152436 0%, #09121d 80%);
  padding: 16px;
}

.lobby-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(22, 36, 52, 0.85) 0%, rgba(13, 23, 35, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

.lobby-title {
  margin: 0;
  text-align: center;
  font-size: 26px;
  font-family: 'AhangBlack', 'IRANSans', sans-serif;
  color: #d0a672;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.5px;
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f1c2a;
  border: 1px solid #1f3246;
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.code-copy-btn {
  background: none;
  border: none;
  color: #8a9ea8;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.code-copy-btn:active {
  color: #d0a672;
}

.code-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.code-content .code {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffffff;
  font-family: 'IRANSans', sans-serif;
  line-height: 1;
  margin-bottom: 4px;
}

.code-content .code-label {
  font-size: 12px;
  color: #728796;
  font-weight: 700;
}

.lobby-meta {
  text-align: center;
  font-size: 13.5px;
  color: #b0c4d4;
  font-weight: 700;
  margin-top: -4px;
}

.seats.grid-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.seat-card {
  background: linear-gradient(180deg, #162638 0%, #101d2c 100%);
  border: 1px solid #203548;
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  position: relative;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05), 0 4px 10px rgba(0, 0, 0, 0.2);
}

.seat-card.filled {
  border: 1.5px solid #8d734e;
  background: linear-gradient(180deg, #1a2c3f 0%, #122131 100%);
}

.seat-card .seat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.seat-card .seat-avatar-ring {
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  border-radius: 50%;
  border: 2px solid #d0a672;
  box-shadow: 0 0 12px rgba(208, 166, 114, 0.35);
  background: #0f1c29;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.seat-card.empty .seat-avatar-ring {
  border: 1.5px solid #4a5c6e;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
  color: #4a5c6e;
}

.seat-card .seat-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.seat-card.empty .seat-name {
  font-size: 13px;
  color: #6a7e8f;
  margin-top: 8px;
}

.seat-card .seat-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.badge-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
}

.badge-tag.host {
  background: #193628;
  border: 1px solid #2b5e43;
  color: #74c297;
}

.badge-tag.me {
  background: #183144;
  border: 1px solid #28516b;
  color: #70b1db;
}

.lobby-status-msg {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #8fa0b0;
  margin: 2px 0;
}

.lobby-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.lobby-btn {
  height: 48px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #18283a 0%, #101c2a 100%);
  border: 1px solid #2d4256;
  color: #ffffff;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 4px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.lobby-btn.leave-btn {
  border: 1px solid #73593b;
  color: #d0a672;
}

.lobby-btn:active {
  transform: scale(0.97);
}

#btnStart {
  width: 100%;
  height: 50px;
  border-radius: 16px;
  background: linear-gradient(180deg, #e5bc5c 0%, #b88a28 100%);
  color: #121922;
  font-family: 'AhangBlack', 'IRANSans', sans-serif;
  font-size: 20px;
  font-weight: 900;
  border: 1px solid #f2c766;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 6px 16px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
  margin: 4px 0;
}

#btnStart:active:not(:disabled) {
  transform: scale(0.98);
}

#btnStart:disabled {
  background: linear-gradient(180deg, #1b2c3d 0%, #101c2b 100%);
  color: #728796;
  border: 1px solid #283e52;
  box-shadow: none;
  font-family: 'IRANSans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: not-allowed;
}

/* ═══════════ میز بازی ═══════════ */
#table{position:fixed;inset:0;overflow:hidden}
.felt{
  position:absolute;
  inset:0;
  background: #0d1a2b url('/static/hokm/cards/gameback.webp') no-repeat center center / cover;
}
.felt::before, .felt::after{
  display:none;
}

.hud-top {
  position: absolute;
  top: calc(var(--safe-t) + 6px);
  left: 10px;
  right: 10px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-radius: 19px;
  background: rgba(224, 212, 190, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  z-index: 30;
  color: #2c2013;
  overflow: hidden;
}

.hud-icon-btn {
  background: none;
  border: none;
  color: #4a3924;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.hud-icon-btn:active {
  transform: scale(0.92);
}

.scoreboard {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 6px;
  font-family: 'IRANSans', sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: #2c2013;
  direction: rtl;
  overflow: hidden;
}

.sb-side {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.sb-avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-avatar {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border-radius: 50%;
  border: 2px solid #27ae60;
  box-shadow: 0 0 6px rgba(39, 174, 96, 0.6);
  background: #101c2b;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.sb-avatar.offline {
  border-color: #e74c3c !important;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.8) !important;
  animation: pulseOffline 1.5s infinite;
}

.sb-avatar.hakem {
  outline: 2px solid #e5bc5c;
  outline-offset: 1px;
}

@keyframes pulseOffline {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sb-crown-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.sb-score {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
}

.sb-score b {
  font-size: 12.5px;
  color: #121922;
}

.sb-divider {
  width: 1px;
  height: 18px;
  background: rgba(74, 57, 36, 0.25);
  flex-shrink: 0;
}

/* ── جایگاه بازیکنان ── */
.seat{position:absolute;display:flex;align-items:center;justify-content:center;z-index:12}
.seat-top{top:calc(var(--safe-t) + 52px);left:0;right:0;flex-direction:column;gap:4px}
.seat-left{left:2px;top:50%;transform:translateY(-50%);flex-direction:row;gap:4px}
.seat-right{right:2px;top:50%;transform:translateY(-50%);flex-direction:row-reverse;gap:4px}
.seat:empty{display:none}

.fan-back{display:flex;justify-content:center;pointer-events:none}
.fan-back .mini{width:46px;height:56px;margin:0 -10px;filter:drop-shadow(0 3px 5px rgba(0,0,0,.4))}
.fan-back.vert{flex-direction:column}
.fan-back.vert .mini{margin:-17px 0;width:38px;height:50px}
.fan-back .mini svg{width:100%;height:100%;display:block}

.nameplate {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(239, 227, 200, 0.95) 0%, rgba(220, 204, 172, 0.95) 100%);
  border: 1.5px solid #d0a672;
  color: #2c2013;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  max-width: 48vw;
}
.nameplate .nm {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
  color: #2c2013;
  font-weight: 800;
}
.nameplate .badge {
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 8px;
  background: linear-gradient(180deg, #327b87 0%, #1f5761 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  border: 1px solid #3ca0b0;
}
.nameplate .crown{font-size:13px}
.nameplate.turn{border-color:var(--gold);box-shadow:0 0 0 2px rgba(217,180,92,.35),0 0 22px rgba(217,180,92,.5);
  animation:pulseTurn 1.6s ease-in-out infinite}
.nameplate.offline{opacity:.5}
.nameplate.mate{border-color:#3f9a5e}
@keyframes pulseTurn{0%,100%{box-shadow:0 0 0 2px rgba(217,180,92,.3),0 0 14px rgba(217,180,92,.35)}
  50%{box-shadow:0 0 0 3px rgba(217,180,92,.5),0 0 30px rgba(217,180,92,.7)}}

.seat-left .nameplate,.seat-right .nameplate{writing-mode:vertical-rl;padding:12px 5px;max-width:none}
.seat-left .nameplate .nm,.seat-right .nameplate .nm{max-width:86px}

.won-tricks-stack {
  position: relative;
  height: 34px;
  min-width: 32px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-inline-start: 6px;
  padding: 2px 5px;
  border-radius: 8px;
  background: rgba(224, 212, 190, 0.2);
  border: 1px solid rgba(229, 188, 98, 0.45);
  backdrop-filter: blur(4px);
  user-select: none;
  transition: background 0.2s, transform 0.15s;
}
.won-tricks-stack:active {
  transform: scale(0.95);
  background: rgba(224, 212, 190, 0.35);
}
.won-tricks-stack .tr-card {
  position: absolute;
  width: 22px;
  height: 30px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  border: 1px solid #d0a672;
  background: #0d1a2b;
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.won-tricks-stack .tr-card svg {
  width: 100%;
  height: 100%;
  display: block;
}

.trump-badge {
  position: absolute;
  left: 50%;
  top: 31%;
  transform: translate(-50%, -50%);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(224, 212, 190, 0.94);
  border: 1.5px solid #d0a672;
  color: #2c2013;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.trump-badge .tb-label {
  font-size: 13px;
  color: #4a3924;
  font-weight: 800;
}
.trump-badge .tb-suit {
  display: flex;
  align-items: center;
  justify-content: center;
}
.trump-badge .tb-suit img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.trump-badge.none {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.trump-announce {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  z-index: 35;
  pointer-events: none;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  transition: transform 0.45s cubic-bezier(0.17, 0.89, 0.32, 1.28), opacity 0.35s ease;
}
.trump-announce.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.trump-announce .crown-img {
  width: 38px;
  height: 38px;
  animation: crownBounce 0.5s ease-out;
  filter: drop-shadow(0 0 10px rgba(229, 188, 98, 0.9));
}
.trump-announce .suit-img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(242, 199, 102, 0.95));
}
.trump-announce span {
  color: #f2c766;
  font-family: 'AhangBlack', 'IRANSans', sans-serif;
  font-size: 20px;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.9), 0 2px 4px #000;
}

@keyframes crownBounce {
  0% { transform: translateY(-20px) scale(0.4); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.sb-avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-avatar-timer {
  position: absolute;
  inset: -3px;
  width: 32px;
  height: 32px;
  pointer-events: none;
  transform: rotate(-90deg);
}

.sb-avatar-timer circle.bg {
  stroke: rgba(231, 76, 60, 0.25);
  stroke-width: 2.5;
  fill: none;
}

.sb-avatar-timer circle.progress {
  stroke: #e74c3c;
  stroke-width: 2.5;
  fill: none;
  stroke-dasharray: 82;
  stroke-dashoffset: var(--dash-offset, 82);
  transition: stroke-dashoffset 0.5s linear;
  stroke-linecap: round;
}

.excluded-badge {
  position: absolute;
  right: 12px;
  top: calc(var(--safe-t) + 52px);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(239, 227, 200, 0.95) 0%, rgba(220, 204, 172, 0.95) 100%);
  border: 1.5px solid #d0a672;
  font-size: 12px;
  font-weight: 800;
  color: #2c2013;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
}

.excluded-cards-pop {
  display: none;
  gap: 4px;
}

.excluded-badge.open .excluded-cards-pop {
  display: flex;
}

.excluded-cards-pop .mini-card {
  width: 22px;
  height: 31px;
}

.excluded-cards-pop .mini-card svg {
  width: 100%;
  height: 100%;
  border-radius: 3px;
}

.chat-badge {
  position: absolute;
  left: 12px;
  top: calc(var(--safe-t) + 52px);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(239, 227, 200, 0.95) 0%, rgba(220, 204, 172, 0.95) 100%);
  border: 1.5px solid #d0a672;
  font-size: 12px;
  font-weight: 800;
  color: #2c2013;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
}

.chat-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 55;
  display: none;
}
.chat-overlay.on {
  display: block;
}

.chat-unread-badge {
  background: #e74c3c;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.chat-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  z-index: 55;
  display: none;
}
.chat-overlay.on {
  display: block;
}

.chat-box {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-t) + 52px);
  bottom: calc(var(--safe-b) + var(--card-h) + 14px);
  transform: translateX(-50%) scale(0.95);
  width: min(92vw, 410px);
  background: linear-gradient(180deg, rgba(240, 230, 215, 0.18) 0%, rgba(130, 120, 110, 0.12) 100%);
  border: 1.5px solid rgba(255, 235, 205, 0.38);
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(28px) saturate(160%) brightness(1.05);
  -webkit-backdrop-filter: blur(28px) saturate(160%) brightness(1.05);
  z-index: 60;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.2s ease;
}
.chat-box.on {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 235, 205, 0.2);
  color: #f2c766;
  font-family: 'AhangBlack', 'IRANSans', sans-serif;
  font-weight: 900;
  font-size: 21px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  direction: rtl;
}

.chat-close {
  background: none;
  border: none;
  color: #efe3c8;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.85;
}

.chat-messages {
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  direction: rtl;
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.chat-row.me {
  flex-direction: row;
  justify-content: flex-start;
}

.chat-row.other {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(217, 180, 92, 0.85);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  background-size: cover;
  background-position: center;
  background-color: rgba(22, 34, 48, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #f2c766;
  flex-shrink: 0;
}

.chat-bubble {
  padding: 10px 18px;
  font-size: 14.5px;
  font-weight: 700;
  max-width: 74%;
  word-break: break-word;
  line-height: 1.45;
  color: #ffffff;
  direction: rtl;
  text-align: right;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.chat-row.me .chat-bubble {
  border-radius: 20px 6px 20px 20px;
}

.chat-row.other .chat-bubble {
  border-radius: 6px 20px 20px 20px;
}

.chat-bubble.theme-0 {
  background: rgba(45, 95, 85, 0.38);
  border: 1px solid rgba(110, 195, 175, 0.35);
}
.chat-bubble.theme-1 {
  background: rgba(115, 70, 80, 0.38);
  border: 1px solid rgba(195, 135, 150, 0.35);
}
.chat-bubble.theme-2 {
  background: rgba(140, 115, 50, 0.38);
  border: 1px solid rgba(225, 190, 105, 0.35);
}
.chat-bubble.theme-3 {
  background: rgba(65, 85, 120, 0.38);
  border: 1px solid rgba(130, 165, 210, 0.35);
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 235, 205, 0.2);
  direction: rtl;
}

.chat-input-row input {
  flex: 1;
  height: 46px;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  color: #ffffff;
  padding: 0 16px;
  font-size: 14.5px;
  outline: none;
  font-family: 'IRANSans', sans-serif;
  text-align: right;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-input-row input::placeholder {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}

.chat-send-btn {
  height: 46px;
  padding: 0 20px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 800;
  font-family: 'IRANSans', sans-serif;
  background: linear-gradient(180deg, #fcd56b 0%, #e6a72e 100%);
  color: #1a1206;
  border: 1px solid #ffea9f;
  box-shadow: 0 4px 14px rgba(230, 167, 46, 0.42), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.chat-send-btn:active {
  transform: scale(0.96);
}

.chat-send-btn svg {
  transform: rotate(180deg);
}

.chat-send-btn:active {
  transform: scale(0.96);
}

.chat-send-btn svg {
  transform: rotate(180deg);
}

.table-center{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:min(74vw,300px);height:min(52vh,230px);z-index:13;pointer-events:none}
.played{position:absolute;width:var(--card-w);height:var(--card-h);
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.55));transition:all .38s cubic-bezier(.175,.885,.32,1.275)}
.played svg{width:100%;height:100%;display:block;border-radius:8px}
.played.pos-bottom{left:50%;top:62%;transform:translate(-50%,-50%) rotate(2deg) scale(1)}
.played.pos-top{left:50%;top:38%;transform:translate(-50%,-50%) rotate(-3deg) scale(1)}
.played.pos-left{left:32%;top:50%;transform:translate(-50%,-50%) rotate(-8deg) scale(1)}
.played.pos-right{left:68%;top:50%;transform:translate(-50%,-50%) rotate(8deg) scale(1)}
.played.enter{animation:throwIn .38s cubic-bezier(.175,.885,.32,1.275)}
@keyframes throwIn{from{opacity:0;transform:translate(-50%,60px) scale(.5) rotate(-18deg)}}
.played.win{animation:winGlow .8s ease-in-out infinite alternate;z-index:20}
@keyframes winGlow{0%{filter:drop-shadow(0 0 8px rgba(217,180,92,.6));transform:scale(1)}100%{filter:drop-shadow(0 0 22px rgba(242,199,102,0.95)) scale(1.08)}}
.table-center.sweep .played{opacity:0;transform:translate(-50%,-50%) scale(.2) rotate(360deg);transition:all .45s cubic-bezier(.4,0,.2,1)}

.bank-zone{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:13;
  display:none;flex-direction:column;align-items:center;gap:10px}
.bank-zone.on{display:flex}
.bank-stack{position:relative;width:var(--card-w);height:var(--card-h)}
.bank-stack .s1{position:absolute;inset:0;transform:translate(-5px,5px) rotate(-4deg);z-index:1}
.bank-stack .s2{position:absolute;inset:0;transform:translate(4px,3px) rotate(3deg);z-index:2}
.bank-stack .s3{position:absolute;inset:0;transform:translate(0,0);z-index:3}
.bank-stack svg{width:100%;height:100%;border-radius:7px;display:block;
  filter:drop-shadow(0 4px 10px rgba(0,0,0,.5))}
.bank-count{font-size:11.5px;color:#3d2a12;background:rgba(239,227,200,.8);
  padding:3px 10px;border-radius:9px;font-weight:700}
.flip-in{animation:flipIn .4s ease}
@keyframes flipIn{from{transform:rotateY(90deg) scale(.9)}to{transform:rotateY(0) scale(1)}}

.turn-timer {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + var(--card-h) + 44px);
  transform: translateX(-50%);
  z-index: 22;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(239, 227, 200, 0.95) 0%, rgba(220, 204, 172, 0.95) 100%);
  border: 1.5px solid #d0a672;
  color: #2c2013;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
}
.turn-timer.on { display: flex; }
.turn-timer span { font-size: 12px; font-weight: 800; color: #1f5761; min-width: 22px; text-align: center; }
.tt-bar{width:88px;height:5px;border-radius:3px;background:rgba(255,255,255,.15);overflow:hidden;position:relative}
.tt-bar::after{content:'';position:absolute;inset:0;transform-origin:left center;
  background:linear-gradient(90deg,var(--teal),var(--gold));transform:scaleX(var(--p,1));
  transition:transform .3s linear}
.turn-timer.urgent .tt-bar::after{background:linear-gradient(90deg,#b3352f,#e0663d)}
.turn-timer.urgent span{color:#ff9d97}

/* ── دست من ── */
.my-area{position:absolute;left:0;right:0;bottom:0;z-index:45;
  padding-bottom:calc(var(--safe-b) + 6px);display:flex;flex-direction:column;align-items:center;gap:2px}
.my-hand{display:flex;justify-content:center;align-items:flex-end;
  height:calc(var(--card-h) + 26px);width:100%;padding:0 6px}
.hcard{width:var(--card-w);height:var(--card-h);flex:0 0 auto;position:relative;
  transition:transform .18s cubic-bezier(.2,.9,.3,1.3),filter .18s;
  transform-origin:bottom center;filter:drop-shadow(0 4px 8px rgba(0,0,0,.42))}
.hcard svg{width:100%;height:100%;display:block;border-radius:7px}
.hcard.playable{cursor:pointer}
.hcard.playable:active{transform:translateY(-16px) scale(1.05)}
.hcard.sel{transform:translateY(-20px) scale(1.06);filter:drop-shadow(0 0 14px rgba(217,180,92,.9));z-index:100 !important}
.hcard.dim { opacity: 0.45; filter: brightness(0.75); pointer-events: none; }
.hcard.dealt{animation:dealIn .35s backwards cubic-bezier(.2,.9,.3,1.15)}
@keyframes dealIn{from{opacity:0;transform:translate(0,-160px) scale(.5) rotate(20deg)}}
.hcard.gone{animation:playOut .3s forwards}
@keyframes playOut{to{opacity:0;transform:translateY(-70px) scale(.75)}}

.nameplate.me{margin-bottom:2px}

/* ── پنل تصمیم ── */
.overlay{position:absolute;inset:0;background:rgba(6,12,20,.55);backdrop-filter:blur(2px);
  z-index:40;display:none}
.overlay.on{display:block}
.panel{position:absolute;left:50%;top:42%;transform:translate(-50%,-50%) scale(.9);
  z-index:50;width:min(90vw,400px);opacity:0;pointer-events:none;transition:.22s}
.panel.on{opacity:1;pointer-events:auto;transform:translate(-50%,-50%) scale(1)}
.panel-inner {
  background: linear-gradient(180deg, rgba(22, 40, 63, 0.95) 0%, rgba(10, 20, 32, 0.98) 100%);
  border: 1.5px solid #d0a672;
  border-radius: 26px;
  padding: 24px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  text-align: center;
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-family: 'AhangBlack', 'IRANSans', sans-serif;
  color: #f2c766;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.panel p {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 700;
  color: #dce7f5;
  line-height: 1.8;
  text-wrap: balance;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.glass-btn-green {
  background: linear-gradient(180deg, rgba(46, 125, 75, 0.8) 0%, rgba(25, 75, 45, 0.9) 100%);
  border: 1.5px solid #42b872;
  color: #ffffff;
  font-family: 'IRANSans', sans-serif;
  font-size: 15px;
  font-weight: 800;
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 12px rgba(66, 184, 114, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.glass-btn-green:active {
  transform: scale(0.96);
}

.glass-btn-red {
  background: linear-gradient(180deg, rgba(160, 42, 42, 0.8) 0%, rgba(95, 22, 22, 0.9) 100%);
  border: 1.5px solid #d94d4d;
  color: #ffffff;
  font-family: 'IRANSans', sans-serif;
  font-size: 15px;
  font-weight: 800;
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 12px rgba(217, 77, 77, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.glass-btn-red:active {
  transform: scale(0.96);
}
.suit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.suit-btn {
  padding: 12px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #1d3248 0%, #112030 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 14px;
  border: 1.5px solid rgba(212, 175, 55, 0.35);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.suit-btn:active {
  transform: scale(0.94);
  border-color: #e5bc5c;
  box-shadow: 0 0 14px rgba(229, 188, 98, 0.5);
}
.suit-btn img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}
.panel-wait-spinner {
  width: 42px;
  height: 42px;
  margin: 14px auto;
  border: 3px solid rgba(242, 199, 102, 0.2);
  border-top-color: #f2c766;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.panel-wait-text {
  font-size: 14px;
  font-weight: 700;
  color: #e2d2ae;
  animation: pulseWait 1.8s ease-in-out infinite;
}
@keyframes pulseWait {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
.two-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.two-btn { aspect-ratio: .72; border-radius: 12px; overflow: hidden; border: 2px solid transparent; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
.two-btn svg { width: 100%; height: 100%; display: block; }
.two-btn.picked {
  border: 2px solid #e5bc5c;
  box-shadow: 0 0 16px rgba(229, 188, 98, 0.65);
  transform: translateY(-4px) scale(1.04);
}
.panel-actions{display:flex;gap:10px;margin-top:16px}
.panel-actions .btn{flex:1;padding:13px;font-size:14.5px}
.bank-preview{width:96px;height:134px;margin:0 auto 14px}
.bank-preview svg{width:100%;height:100%;border-radius:9px;
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.5))}

.result-icon{font-size:52px;margin-bottom:6px}
.score-lines { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.score-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.score-line.win {
  background: rgba(63, 154, 94, 0.28);
  border: 1.5px solid rgba(63, 154, 94, 0.6);
  color: #a6f0c0;
}

.glass-home-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-family: 'IRANSans', sans-serif;
  font-size: 15px;
  font-weight: 800;
  border-radius: 16px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s, border-color 0.15s;
  cursor: pointer;
}

.glass-home-btn:active {
  transform: scale(0.96);
}

/* ── توست ── */
.toast-wrap{position:fixed;left:0;right:0;top:calc(var(--safe-t) + 58px);z-index:90;
  display:flex;flex-direction:column;align-items:center;gap:6px;pointer-events:none}
.toast{padding:9px 18px;border-radius:13px;font-size:13px;max-width:86vw;text-align:center;
  background:rgba(13,26,43,.94);border:1px solid rgba(217,180,92,.45);
  box-shadow:0 6px 20px rgba(0,0,0,.45);animation:toastIn .25s}
.toast.warn{border-color:rgba(201,138,43,.7);color:#ffd79a}
.toast.error{border-color:rgba(179,53,47,.7);color:#ffa9a3}
.toast.good{border-color:rgba(63,154,94,.7);color:#a6f0c0}
@keyframes toastIn{from{opacity:0;transform:translateY(-12px)}}
.toast.out{animation:toastOut .3s forwards}
@keyframes toastOut{to{opacity:0;transform:translateY(-10px)}}

/* ── شیت ── */
.sheet-back{position:fixed;inset:0;background:rgba(4,10,18,.6);z-index:70;display:none}
.sheet-back.on{display:block}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:71;max-height:82vh;
  background:linear-gradient(180deg,#16283f,#0b1622);border-radius:24px 24px 0 0;
  border-top:2px solid var(--gold-2);transform:translateY(102%);transition:transform .28s cubic-bezier(.2,.9,.3,1);
  padding-bottom:var(--safe-b);display:flex;flex-direction:column}
.sheet.on{transform:translateY(0)}
.sheet-handle{width:42px;height:4px;border-radius:3px;background:rgba(255,255,255,.25);
  margin:10px auto 4px;flex:0 0 auto}
.sheet-body{overflow-y:auto;padding:8px 20px 26px}
.sheet-body h3{margin:14px 0 8px;font-size:17px;color:var(--gold)}
.sheet-body h4{margin:16px 0 6px;font-size:14.5px;color:var(--teal)}
.sheet-body p,.sheet-body li{font-size:13.5px;line-height:1.9;color:#c3d1de}
.sheet-body ol,.sheet-body ul{padding-right:20px;margin:6px 0}
.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin:10px 0 4px}
.stat-box{background:rgba(255,255,255,.06);border-radius:14px;padding:13px 6px;text-align:center}
.stat-box b{display:block;font-size:21px;color:var(--gold)}
.stat-box span{font-size:11.5px;color:#8ea3b8}
.lb-row{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:12px;
  background:rgba(255,255,255,.05);margin-bottom:7px}
.lb-row .rk{width:24px;text-align:center;font-weight:800;color:var(--gold)}
.lb-row .avatar{width:32px;height:32px;font-size:12px}
.lb-row .nm{flex:1;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lb-row .wn{font-size:12.5px;color:#7fe0a0}
.hist-row{display:flex;justify-content:space-between;padding:8px 12px;border-radius:10px;
  background:rgba(255,255,255,.04);margin-bottom:6px;font-size:12.5px}
.hist-row .w{color:#7fe0a0}
.hist-row .l{color:#ff9d97}
.profile-tabs{display:flex;gap:7px;margin:12px 0}
.profile-tabs button{flex:1;padding:10px 4px;border:1px solid #365267;border-radius:12px;background:#192c3e;font-size:12px}
.profile-tabs button.active{color:#ffe193;border-color:var(--gold);background:#3c3b31}
.profile-summary{font-size:12px;color:#b9cbda;margin:8px 0 14px}
.profile-note,.profile-empty{font-size:11px;line-height:1.9;color:#9eb3c6}

/* ── واکنش‌گرا ── */
@media (min-height:760px){:root{--card-w:70px;--card-h:98px}}
@media (max-height:620px){:root{--card-w:56px;--card-h:79px}}
@media (min-width:520px){:root{--card-w:78px;--card-h:109px}}


/* ═══════════ استار گیم — Game Selector & Uno ═══════════ */
#gameSelect {
  background: radial-gradient(ellipse at 85% 85%, #0c454952, transparent 45%),
    linear-gradient(#070e1ce8, #0a142780), url('/static/shared/images/bg_pattern.webp') center/cover;
  align-items:center; overflow-y:auto;
  padding:calc(var(--safe-t) + 20px) 22px calc(var(--safe-b) + 24px);
  isolation:isolate;
}
#gameSelect::before {
  content:"";position:fixed;inset:0;pointer-events:none;z-index:-1;opacity:.7;
  background-image:radial-gradient(circle at 11% 16%,#fff 0,transparent 2px),radial-gradient(circle at 58% 9%,#fff 0,transparent 2px),radial-gradient(circle at 89% 21%,#fff 0,transparent 2px),radial-gradient(circle at 6% 67%,#fff 0,transparent 2px),radial-gradient(circle at 93% 58%,#fff 0,transparent 2px);
}
.hub-topbar{display:flex;align-items:center;gap:10px;direction:ltr;width:100%;max-width:440px;flex-shrink:0}
.hub-nav-button{width:34px;height:34px;border:1px solid #adb6c06b;border-radius:11px;background:linear-gradient(145deg,#ffffff40,#ffffff08);box-shadow:inset 0 1px 4px #fff5,0 3px 8px #0007;color:#e0e5ed;display:flex;align-items:center;justify-content:center;font-size:38px;line-height:1;padding:0 0 4px}
.hub-wordmark{font-family:'AhangBlack',sans-serif;font-size:21px;color:#e1e5ef}
.hub-menu-button{margin-left:auto;flex-direction:column;gap:4px;padding:0}
.hub-menu-button span{height:2px;width:16px;border-radius:2px;background:#dfe7ed}
.hub-menu-button span:last-child{width:10px;align-self:flex-start;margin-left:8px}
.select-header{text-align:center;margin:20px 0 29px;flex-shrink:0}
.sg-title{display:flex;align-items:center;justify-content:center;gap:4px;direction:ltr;font-family:'AhangBlack',sans-serif;font-size:36px;line-height:1.3;color:#f7d776;margin:0;text-shadow:0 2px 2px #a56827,0 0 17px #ffd45a50}
.sg-title span{font-family: sans-serif;font-size:27px}
.sg-subtitle{color:#afb6c8;font-size:15px;margin:10px 0 0}
.games-hub-grid{display:flex;flex-direction:column;gap:22px;width:100%;max-width:440px;flex-shrink:0}
.game-hub-card{position:relative;aspect-ratio:1.44;border:1.5px solid #d7b775;border-radius:24px;padding:14px;background:radial-gradient(ellipse at 96% 16%,#b6913caa,transparent 62%),linear-gradient(135deg,#1c3066,#131c37 75%);box-shadow:inset 0 0 16px #cda95725,0 8px 24px #0006;cursor:pointer}
.game-hub-card.uno{border-color:#3bb6b3;background:radial-gradient(ellipse at 85% 20%,#138f9170,transparent 68%),linear-gradient(145deg,#124951,#121b37 75%);box-shadow:inset 0 0 17px #24d7cb20,0 0 25px #20bcaf20,0 8px 24px #0006}
.hub-character{position:absolute;right:-10px;bottom:48px;width:53%;height:calc(100% - 28px);object-fit:contain;object-position:bottom;pointer-events:none;filter:drop-shadow(0 0 13px #ffe18e35)}
.uno .hub-character{right:-15px;width:54%;filter:drop-shadow(0 0 10px #13ccbe35)}
.hub-card-badge{position:absolute;top:12px;left:14px;font-size:11px;line-height:1.8;font-weight:900;padding:1px 7px;border:1px solid #e1c47f;border-radius:14px;background:linear-gradient(#4e527a,#323651);color:#ffe29a;box-shadow:inset 0 0 6px #ffe6a360,0 0 8px #fbd57950;z-index:2}
.uno .hub-card-badge{border-color:#65d8c6;background:linear-gradient(#177575,#17525e);box-shadow:inset 0 0 6px #9fffe760,0 0 8px #2ce9c350}
.hub-card-copy{position:absolute;left:9px;top:39px;width:57%;text-align:center;z-index:1}
.hub-card-icon{display:block;width:58px;height:58px;object-fit:contain;margin:0 auto 6px;filter:sepia(1) saturate(2) brightness(1.3) drop-shadow(0 0 10px #ffdf7455)}
.uno .hub-card-icon{width:110px;filter:none}
.game-hub-card h3{margin:0 0 5px;font-family:'AhangBlack',sans-serif;font-size:23px;line-height:1.25;color:#fff;white-space:nowrap}
.game-hub-card p{margin:0;font-size:10px;line-height:1.8;color:#b7bed2;white-space:nowrap}
.game-hub-card .btn.primary{position:absolute;bottom:14px;left:14px;width:calc(100% - 28px);min-height:46px;padding:5px 10px;justify-content:center;border:2px solid #f4d577;border-radius:30px;background:linear-gradient(#ffe998 0%,#efbe44 40%,#d89927 52%,#bc711c 90%,#e8b446);color:#58320a;font-family:'AhangBlack','IRANSans',sans-serif;font-size:25px;line-height:1.3;box-shadow:inset 0 2px 4px #fff9,inset 0 -3px 4px #8f491d80,0 4px 7px #0008,0 0 11px #eac65850;z-index:3}
.game-hub-card.uno .btn.primary{border-color:#21ba9d;background:linear-gradient(#44e4ba,#06b799 42%,#008775 55%,#006259 90%,#15958b);color:#fff;box-shadow:inset 0 2px 4px #8cffda80,inset 0 -3px 4px #003e4280,0 4px 7px #0008,0 0 11px #10d4b340}
.game-hub-card .btn:active{transform:translateY(2px)}
.hub-nav-button:focus-visible,.game-hub-card .btn:focus-visible{outline:2px solid #fff;outline-offset:4px}
@media(min-width:420px){.hub-card-copy{top:45px}.hub-card-icon{width:70px;height:70px}.uno .hub-card-icon{width:108px}.game-hub-card h3{font-size:28px}.game-hub-card p{font-size:12px}.hub-character{bottom:58px}.game-hub-card .btn.primary{min-height:54px;font-size:29px}.hub-card-badge{font-size:13px}}
@media(max-width:340px){#gameSelect{padding-left:16px;padding-right:16px}.hub-card-copy{top:35px}.hub-card-icon{width:48px;height:48px}.uno .hub-card-icon{width:75px}.game-hub-card h3{font-size:21px}.game-hub-card p{font-size:9px}.game-hub-card .btn.primary{min-height:42px;font-size:23px}.hub-character{bottom:46px}}
#btnFillAI{width:100%;font-size:15px;margin:8px 0}
/* Shared, opt-in room voice chat. */
.voice-badge { position:absolute; top:calc(var(--safe-t) + 52px); left:94px; z-index:55; display:flex; align-items:center; justify-content:center; gap:5px; min-height:32px; padding:5px 10px; border:1px solid #fff8; border-radius:20px; background:#e0d4beed; color:#293d35; font:700 12px 'IRANSans',sans-serif; cursor:pointer; box-shadow:0 3px 10px #0003; }
#unoTable .voice-badge { top:calc(var(--safe-t) + 59px); }
#lobby .voice-badge { position:static; width:100%; min-height:40px; background:#153a43; color:#e5f7ec; border-color:#46c9b580; }
#lobby .lobby-card { max-height:calc(100dvh - var(--safe-t) - var(--safe-b) - 32px); overflow-y:auto; flex-shrink:0; }
#lobby .seats.grid-2x2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
#lobby .seat-card { min-width:0; }
#lobby .seat-header { flex-wrap:wrap; }
.voice-badge.voice-active { background:#126c5e; color:#fff; border-color:#71edc3; }
.voice-badge.voice-muted { background:#775432; color:#fff; }
#lobby .voice-badge.voice-active { background:#126c5e; border-color:#71edc3; }
#lobby .voice-badge.voice-muted { background:#775432; border-color:#e8ba7c; }
.voice-badge svg { width:16px; height:16px; flex-shrink:0; }
.voice-badge span { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.voice-backdrop { position:fixed; inset:0; background:#020b12a6; backdrop-filter:blur(4px); z-index:80; }
.voice-panel { position:fixed; top:calc(var(--safe-t) + 65px); left:50%; transform:translateX(-50%); width:calc(100% - 28px); max-width:380px; max-height:calc(100dvh - var(--safe-t) - var(--safe-b) - 100px); overflow:auto; padding:18px; background:linear-gradient(145deg,#16333e,#0c1a26); border:1px solid #5ce4bd80; border-radius:24px; color:#eef8f6; box-shadow:0 18px 60px #0009; z-index:81; }
.voice-panel[hidden],.voice-backdrop[hidden],.voice-controls[hidden],#voiceJoin[hidden],#voicePlay[hidden] { display:none; }
.voice-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.voice-heading h2 { margin:0; font-size:20px; }
.voice-heading button { background:none; border:none; color:#d3eee8; font-size:30px; min-width:40px; min-height:40px; cursor:pointer; }
#voiceStatus { font-size:12px; color:#a7d5d0; margin:6px 0 14px; line-height:1.8; }
.voice-members { display:flex; flex-direction:column; gap:8px; max-height:36dvh; overflow:auto; margin-bottom:16px; }
.voice-member { display:flex; align-items:center; gap:9px; border:1px solid #ffffff14; border-radius:13px; padding:9px; background:#ffffff05; }
.voice-member-icon { width:32px; height:32px; display:grid; place-items:center; border-radius:50%; background:#26776d; font-weight:800; flex-shrink:0; }
.voice-member-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.voice-member-status { color:#9bdace; font-size:11px; }
.voice-member.is-muted .voice-member-status { color:#f0bb77; }
.voice-controls { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.voice-controls .btn { border:1px solid #ffffff24; background:#ffffff08; border-radius:14px; }
.voice-panel .btn { width:100%; min-height:44px; padding:9px; font-size:13px; }
.voice-controls .voice-leave { grid-column:1/-1; color:#ffb6b6; border-color:#dc7e7e60; background:#592c3533; }
#voicePlay { margin-top:10px; border-color:#e6bb61; color:#f1d28e; }
.voice-hint { font-size:11px; line-height:1.9; color:#9cb8bb; margin:14px 0 0; }
.voice-panel button:focus-visible,.voice-badge:focus-visible { outline:2px solid #ffd363; outline-offset:3px; }
.trick-collect-layer{position:fixed;inset:0;z-index:60;pointer-events:none}
.trick-collect-card{position:absolute;filter:drop-shadow(0 5px 10px #0008);transform-origin:center;will-change:transform,opacity}
.trick-collect-card svg{width:100%;height:100%;display:block;border-radius:7px}
.trick-collect-card.winning-card{filter:drop-shadow(0 0 8px #e9c45cb3)}
.won-tricks-stack.collecting .tr-card:last-child{opacity:0}
.won-tricks-stack.pile-arrival{animation:pileArrival .45s ease-out}
@keyframes pileArrival{50%{box-shadow:0 0 18px #ffe38c;filter:brightness(1.35)}}
.hcard.bank-new{outline:2px solid #ffe482;outline-offset:2px;border-radius:8px;filter:drop-shadow(0 0 8px #ffdc6a)}
.bank-new-label{position:absolute;top:-12px;right:0;padding:1px 6px;border-radius:7px;background:#ffe38b;color:#382813;font-size:10px;font-weight:900;line-height:18px;white-space:nowrap;pointer-events:none;box-shadow:0 2px 5px #0007}
.chat-bubble,.toast{direction:rtl;text-align:right;unicode-bidi:isolate;overflow-wrap:anywhere}
.chat-row.other{direction:rtl;flex-direction:row;justify-content:flex-start}
