* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #090d1a;
  color: #f8fafc;
  font-family: Vazirmatn, Tahoma, system-ui, sans-serif;
  touch-action: none;
}

#cityCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* HUD بالا */
.hud-top {
  position: fixed;
  top: 8px;
  right: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 25;
  pointer-events: none;
}

.hud-actions {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: auto;
}

.stat-pill, .icon-btn, .vip-pill-btn {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  padding: 5px 9px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.rubi-pill strong { color: #fbbf24; }
.bank-pill strong { color: #38bdf8; }
.online-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: blinkDot 1.6s infinite;
}

@keyframes blinkDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.vip-pill-btn {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  border: 1px solid #fde68a;
  color: #fff;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  animation: vipGlow 2.2s infinite;
}

.vip-pill-btn.is-active {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.65);
}

@keyframes vipGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
  50% { box-shadow: 0 0 18px rgba(251, 191, 36, 0.85); }
}

.icon-btn {
  cursor: pointer;
  color: #fff;
  font-size: 15px;
  padding: 5px 8px;
}

/* مینی‌مپ بالا-چپ */
.minimap-wrap {
  position: fixed;
  top: 52px;
  left: 8px;
  z-index: 18;
  background: rgba(9, 13, 26, 0.88);
  border: 2px solid rgba(251, 191, 36, 0.6);
  border-radius: 13px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

#minimapCanvas { display: block; }

.zone-tag {
  font-size: 10px;
  text-align: center;
  padding: 3px 5px;
  background: rgba(0, 0, 0, 0.65);
  color: #fde68a;
  font-weight: bold;
}

/* بنر صندوقچه گنج زنده */
.drop-banner {
  position: fixed;
  top: 52px;
  right: 8px;
  max-width: calc(100vw - 142px);
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.94), rgba(180, 83, 9, 0.94));
  border: 1.5px solid #fde047;
  border-radius: 13px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: bold;
  z-index: 24;
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.45);
  animation: pulseBtn 1.5s infinite;
}

/* چت زنده شهر */
.chat-wrap {
  position: fixed;
  bottom: 146px;
  right: 10px;
  width: min(265px, calc(100vw - 20px));
  background: rgba(15, 23, 42, 0.84);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  z-index: 22;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: max-height 0.2s ease;
}

.chat-wrap.collapsed .chat-messages,
.chat-wrap.collapsed .chat-input-row {
  display: none;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(2, 6, 23, 0.6);
  gap: 6px;
}

.chat-toggle {
  background: none;
  border: none;
  color: #fde68a;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.emote-bar {
  display: flex;
  gap: 3px;
}

.emote-bar button {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  width: 24px;
  height: 24px;
  font-size: 13px;
  cursor: pointer;
}

.chat-messages {
  max-height: 110px;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.chat-line {
  line-height: 1.5;
  color: #e2e8f0;
  word-break: break-word;
}

.chat-line.vip-msg {
  background: rgba(245, 158, 11, 0.14);
  border-right: 2px solid #fbbf24;
  padding: 2px 6px;
  border-radius: 6px;
}

.chat-line strong { color: #38bdf8; }
.chat-line.vip-msg strong { color: #fbbf24; }

.chat-input-row {
  display: flex;
  gap: 5px;
  padding: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-row input {
  flex: 1;
  min-width: 0;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  padding: 6px 8px;
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  user-select: text;
  -webkit-user-select: text;
}

/* کنترل‌های لمسی پایین */
.controls-layer {
  position: fixed;
  bottom: 16px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20;
  direction: ltr;
}

.joystick-base {
  pointer-events: auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.56);
  border: 2px solid rgba(251, 191, 36, 0.38);
  position: relative;
  backdrop-filter: blur(5px);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.45);
}

.joystick-knob {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fde047, #ea580c);
  border: 2px solid #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.55);
}

.action-buttons {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: 15px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  direction: rtl;
  transition: transform 0.12s;
}

.action-btn:active { transform: scale(0.95); }

.action-btn.interact {
  background: linear-gradient(135deg, #10b981, #059669);
  border: 2px solid #a7f3d0;
  animation: pulseBtn 1.3s infinite;
}

.action-btn.nitro-btn {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border: 2px solid #93c5fd;
}

.action-btn.nitro-btn.boosting {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-color: #fef08a;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.85);
}

.action-btn.car-btn {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border: 2px solid #fed7aa;
}

.lock-chip {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #fde047;
  color: #fde047;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
}

@keyframes pulseBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* مودال کشویی */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 45;
}

.modal-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 84vh;
  background: #131c31;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 2px solid #f59e0b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.22s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(45px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: #0b1120;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h2 {
  font-size: 15px;
  color: #fbbf24;
}

.close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
}

.modal-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card.vip-card {
  background: linear-gradient(145deg, rgba(120, 53, 15, 0.35), rgba(15, 23, 42, 0.92));
  border: 1.5px solid rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.16);
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.input-box {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0b1120;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  user-select: text;
  -webkit-user-select: text;
}

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); }
.btn-warn { background: linear-gradient(135deg, #f59e0b, #d97706); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-vip {
  background: linear-gradient(135deg, #fbbf24, #d97706, #b45309);
  border: 1.5px solid #fef08a;
  color: #0f172a;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45);
}
.btn-locked {
  background: rgba(51, 65, 85, 0.85);
  border: 1px dashed #fbbf24;
  color: #fde68a;
}

.btn-sm {
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 11px;
  border: none;
  color: #fff;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
}

.vip-badge {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #0f172a;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 6px;
}

.perk-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #e2e8f0;
}

.color-dots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}
.color-dot.active { border-color: #fff; transform: scale(1.18); box-shadow: 0 0 10px rgba(255,255,255,0.6); }

/* پیام شناور و بنر دوئل */
.toast {
  position: fixed;
  top: 102px;
  right: 10px;
  max-width: 240px;
  background: rgba(15, 23, 42, 0.96);
  border-right: 4px solid #fbbf24;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.6;
  z-index: 65;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
}

.duel-banner {
  position: fixed;
  top: 158px;
  right: 10px;
  left: 10px;
  background: linear-gradient(135deg, #7e22ce, #4c1d95);
  border: 2px solid #e9d5ff;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  z-index: 38;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(126, 34, 206, 0.5);
}

.duel-btns { display: flex; gap: 6px; }
.hidden { display: none !important; }