/* =========================================================
   PROGAMES - MINIMAL GAMING DASHBOARD
   ========================================================= */

:root {
  --bg: #0a0d18;
  --surface: #141929;
  --surface-2: #1c2335;
  --text: #f0f2f8;
  --muted: #9aa3b5;
  --muted-2: #6b7a90;

  --primary: #8b5cf6;
  --primary-dark: #6d28d9;
  --primary-light: #a78bfa;
  --blue: #38bdf8;
  --pink: #ec4899;
  --gold: #fbbf24;
  --green: #10b981;
  --danger: #ef4444;

  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(139, 92, 246, 0.25);

  --shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 6px 15px rgba(0, 0, 0, 0.15);

  --radius: 16px;
  --radius-sm: 10px;
  --header-height: 70px;
  --nav-height: 70px;
}

body {
    user-select: none;
}

body.light {
  --bg: #f2f4f9;
  --surface: #ffffff;
  --surface-2: #f0f3fa;
  --text: #1a1e2e;
  --muted: #5a6b82;
  --muted-2: #8a9bb0;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(109, 40, 217, 0.25);
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + 25px);
  transition: background 0.3s, color 0.3s;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* ===== Header ===== */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  width: min(1200px, 95%);
  height: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 20px;
}

.logo-main {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  transform: scaleX(1.25);
  transform-origin: right center;
  display: inline-block;
}

.logo-main span {
  color: var(--primary-light);
}

.logo-text small {
  display: block;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--muted-2);
  direction: ltr;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s;
}

.icon-btn:hover {
  color: var(--primary-light);
  border-color: var(--border-strong);
}

/* ===== Main ===== */
main {
  width: min(1200px, 95%);
  margin: 0 auto;
}

.section {
  animation: sectionEnter 0.35s ease;
}

@keyframes sectionEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Section Header ===== */
.section-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-label {
  display: inline-block;
  color: var(--primary-light);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  direction: ltr;
}

h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 28px;
  font-weight: 900;
}

.title-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  font-size: 18px;
}

.section-description {
  color: var(--muted);
  font-size: 13px;
}

.online-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.online-dot.small {
  width: 6px;
  height: 6px;
}

/* ===== Featured Game (Simplified) ===== */
.featured-game {
  display: flex;
  align-items: center;
  gap: 25px;
  background: linear-gradient(120deg, #171c30, #1a1f38);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 35px;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
}

.featured-content {
  flex: 1;
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(251, 191, 36, 0.1);
  color: var(--gold);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.featured-kicker {
  display: block;
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 1.5px;
  direction: ltr;
}

.featured-content h2 {
  margin-top: 4px;
  font-size: 52px;
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.featured-description {
  margin-top: 8px;
  color: #b0b9d0;
  font-size: 13px;
  line-height: 1.8;
  max-width: 500px;
}

.featured-stats {
  display: flex;
  gap: 15px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.featured-stats span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.featured-stats i {
  color: var(--primary-light);
}

.featured-play {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: 0.25s;
  box-shadow: 0 8px 20px rgba(109, 40, 217, 0.3);
}

.featured-play:hover {
  transform: translateY(-2px);
}

.hokm-visual {
  width: 200px;
  height: 150px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px dashed rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  font-size: 28px;
}

/* ===== Game Grid ===== */
.games-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.games-heading h2 {
  font-size: 22px;
  font-weight: 900;
}

.coming-soon {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 15px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.25s;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.game-card-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
}

.game-status > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.game-favorite {
  color: var(--muted-2);
  font-size: 14px;
  cursor: pointer;
}

.game-icon-wrapper {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0 12px;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  font-size: 28px;
}

.purple-icon { background: rgba(139, 92, 246, 0.1); color: #c4b5fd; }
.blue-icon { background: rgba(56, 189, 248, 0.1); color: #7dd3fc; }
.gold-icon { background: rgba(251, 191, 36, 0.1); color: #fcd34d; }
.pink-icon { background: rgba(236, 72, 153, 0.1); color: #f9a8d4; }

.game-info h3 {
  font-size: 18px;
  font-weight: 900;
}

.game-info p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.game-meta {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 10px;
}

.game-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.game-meta i {
  color: var(--primary-light);
  font-size: 10px;
}

.btn-play {
  width: 100%;
  margin-top: auto;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 5px;
}

.btn-play:hover {
  box-shadow: 0 6px 15px rgba(109, 40, 217, 0.3);
}

.btn-play.disabled {
  background: var(--surface-2);
  color: var(--muted-2);
  cursor: not-allowed;
}

.locked-game {
  filter: saturate(0.7);
}

.locked-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(0,0,0,0.4);
  color: var(--muted-2);
  font-size: 9px;
}

/* ===== Chat ===== */
.chat-container {
  display: flex;
  height: 550px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.chat-list-panel {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  overflow-y: auto;
}

.chat-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  border-bottom: 1px solid var(--border);
}

.mini-label {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 1px;
  direction: ltr;
}

.chat-list-header h3 {
  margin-top: 3px;
  font-size: 15px;
}

.chat-search-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.chat-list {
  list-style: none;
}

.chat-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.chat-list-item:hover {
  background: rgba(139, 92, 246, 0.05);
}

.chat-list-item.active {
  background: rgba(139, 92, 246, 0.08);
  border-right: 3px solid var(--primary);
}

.chat-item-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  font-size: 16px;
  flex-shrink: 0;
}

.chat-item-info {
  min-width: 0;
}

.chat-item-name {
  font-size: 12px;
  font-weight: 800;
}

.chat-item-preview {
  font-size: 10px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conversation-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-conversation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.back-btn {
  display: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.conversation-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.conversation-title-wrapper span {
  font-size: 13px;
  font-weight: 800;
}

.conversation-title-wrapper small {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  gap: 2px;
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}

.message {
  display: flex;
  flex-direction: column;
  position: relative;
}

.message.mine {
  align-items: flex-start; 
}

.message.theirs {
  align-items: flex-end; 
}

.message .bubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 12px;
  line-height: 1.7;
  word-break: break-word;
  position: relative;
  transition: transform 0.3s ease;
}

.message.theirs .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  color: var(--text);
}

.message.mine .bubble {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: white;
}

.message .sender-name {
  font-size: 10px;
  font-weight: 800;
  color: var(--primary-light);
  margin-bottom: 3px;
  cursor: pointer;
}

.reply-preview-inline {
  cursor: pointer;
  transition: background 0.2s;
  background: rgba(139, 92, 246, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 10px;
}

.reply-preview-inline:hover {
  background: rgba(139, 92, 246, 0.2);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-badge {
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
}

/* ===== منوی زیر پیام ===== */
.message-actions {
  display: none;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.message-actions.active {
  display: flex;
  animation: actionsIn 0.2s ease;
}

@keyframes actionsIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  color: var(--text);
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.message-actions button:hover {
  transform: scale(1.2);
}

.message-actions .action-reply {
  font-size: 12px;
  color: var(--primary-light);
  border-right: 1px solid var(--border);
  padding-right: 8px;
  margin-right: 4px;
}

/* ===== هایلایت پیام ===== */
.highlight-message {
  animation: highlightFade 2s ease;
}

@keyframes highlightFade {
  0% { background-color: rgba(139, 92, 246, 0.4); }
  100% { background-color: transparent; }
}

/* ===== پیش‌نمایش ریپلای ===== */
.reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 10px;
  color: var(--muted);
}

.reply-preview span {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reply-preview button {
  border: none;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  font-size: 12px;
}

.chat-input input:focus {
  border-color: var(--border-strong);
}

.chat-action-btn,
.send-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-action-btn {
  background: var(--surface-2);
  color: var(--muted);
}

.send-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

/* ===== Friends ===== */
.add-friend,
.friends-list,
.friend-requests {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 15px;
}

.card-heading,
.list-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.heading-icon,
.list-title-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
}

.list-title-icon.green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
}

.list-title-icon.orange {
  background: rgba(249, 115, 22, 0.1);
  color: #fdba74;
}

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-input-wrapper > i {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted-2);
}

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 35px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.search-box button {
  min-width: 100px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  cursor: pointer;
}

.search-results,
.friends-list ul,
.friend-requests ul {
  list-style: none;
}

.search-results li,
.friends-list li,
.friend-requests li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: 0.2s;
}

.search-results li:hover,
.friends-list li:hover,
.friend-requests li:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: var(--border-strong);
}

.friends-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.friend-actions {
  display: flex;
  gap: 4px;
}

.friend-actions button,
.search-results li button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.friend-actions button:hover,
.search-results li button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.btn-chat { color: var(--blue); }
.btn-delete, .btn-reject { color: var(--danger); }
.btn-accept { color: var(--green); }
.btn-add { color: var(--primary-light); }

/* ===== Profile ===== */
.profile-card {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 25px;
}

.profile-avatar {
  width: 90px;
  height: 90px;
  margin: 0 auto 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #312e81, var(--primary));
  color: white;
  font-size: 35px;
}

.player-tag {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
}

.profile-card h2 {
  margin-top: 8px;
  font-size: 22px;
}

.profile-card > p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.profile-stats div {
  padding: 12px;
  border-left: 1px solid var(--border);
}

.profile-stats div:last-child {
  border-left: none;
}

.profile-stats i {
  display: block;
  margin-bottom: 4px;
  color: var(--primary-light);
  font-size: 14px;
}

.profile-stats strong {
  font-size: 16px;
}

.profile-stats span {
  font-size: 9px;
  color: var(--muted);
}

.xp-section {
  margin-top: 18px;
  text-align: right;
}

.xp-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

.xp-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-top: 6px;
  overflow: hidden;
}

.xp-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
}

.btn-danger {
  width: 100%;
  margin-top: 18px;
  padding: 10px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: white;
  cursor: pointer;
  transition: 0.2s;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ===== Settings ===== */
.settings-card {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 15px;
}

.settings-icon {
  width: 45px;
  height: 45px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  font-size: 20px;
}

.settings-title {
  flex: 1;
}

.settings-title h3 {
  font-size: 16px;
}

.settings-title p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.theme-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  color: var(--text);
  transition: 0.2s;
}

.theme-btn.active {
  border-color: var(--border-strong);
  background: rgba(139, 92, 246, 0.08);
}

.theme-preview {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.light-preview {
  background: #fff7ed;
  color: #f59e0b;
}

.dark-preview {
  background: #1e1b4b;
  color: #a78bfa;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.modal-x {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}

.auth-header {
  text-align: center;
}

.eyebrow {
  color: var(--primary-light);
  font-size: 9px;
  letter-spacing: 2px;
  direction: ltr;
}

.auth-header h2 {
  margin-top: 6px;
  font-size: 22px;
}

.auth-header p {
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 20px 0;
  padding: 4px;
  background: var(--bg);
  border-radius: 8px;
}

.auth-tabs button {
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.auth-tabs button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.auth-form {
  text-align: right;
}

.auth-form label {
  display: block;
  margin: 10px 0 5px;
  font-size: 11px;
  color: var(--muted);
}

.input-wrapper {
  position: relative;
}

.input-wrapper > i {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted-2);
}

.modal-content input {
  width: 100%;
  height: 40px;
  padding: 0 35px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  font-size: 12px;
}

.btn-primary {
  width: 100%;
  margin-top: 15px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.error-message {
  min-height: 20px;
  margin-top: 10px;
  color: #fb7185;
  font-size: 10px;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  width: min(600px, 95%);
  height: 65px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 3000;
  padding: 5px;
}

.nav-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: transparent;
  z-index: 0;
}

.bottom-nav button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: 0.2s;
}

.nav-icon {
  font-size: 16px;
}

.bottom-nav button.active {
  color: var(--primary-light);
}

.bottom-nav button.active .nav-icon {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  padding: 5px 12px;
}

/* نشان آبی بالای دکمه */
.nav-badge {
  position: absolute;
  top: -2px;
  right: 5px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.5);
}

/* نشان تعداد پیام‌های خوانده‌نشده در لیست چت */
.chat-item-unread {
  background: var(--blue);
  color: white;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
}

/* ===== Toast ===== */
#toast-container {
  position: fixed;
  z-index: 6000;
  right: 15px;
  bottom: 95px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  min-width: 220px;
  padding: 10px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 3px solid var(--primary);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  box-shadow: var(--shadow-sm);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 10px;
}

/* ===== Responsive ===== */
@media (max-width: 800px) {
  .header-inner,
  main {
    width: calc(100% - 20px);
  }

  .logo-main {
    font-size: 24px;
    letter-spacing: 2px;
    transform: scaleX(1.1);
  }

  .logo-text small {
    display: none;
  }

  .featured-game {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }

  .hokm-visual {
    width: 100%;
    height: 120px;
    margin-top: 15px;
  }

  .friends-container {
    grid-template-columns: 1fr;
  }

  .chat-container {
    height: calc(100vh - 170px);
  }
}

@media (max-width: 600px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .game-card {
    padding: 15px;
    border-radius: 12px;
  }

  .game-icon-wrapper {
    width: 55px;
    height: 55px;
    font-size: 22px;
    border-radius: 12px;
  }

  .chat-list-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .chat-conversation-panel {
    position: fixed;
    inset: 64px 0 80px 0;
    display: none;
  }

  .chat-conversation-panel.active {
    display: flex;
  }

  .chat-list-panel.hidden {
    display: none;
  }

  .back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .bottom-nav {
    bottom: 8px;
    width: calc(100% - 10px);
    height: 62px;
    border-radius: 14px;
  }

  .bottom-nav button {
    font-size: 11px;
  }

  .nav-icon {
    font-size: 14px;
  }
}

/* بهبود کنتراست دکمه خروج از حساب در حالت روشن */
body.light .btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

body.light .btn-danger:hover {
  background: #fecaca;
}

body.light .locked-overlay {
  background: rgba(0, 0, 0, 0.6);
  color: #f0f2f8;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

body.light .coming-soon {
  background: #fff7ed;
  color: #92400e;
  border-color: #fdba74;
}

/* جلوگیری از انتخاب متن هنگام کشیدن */
.message {
  user-select: none;
  -webkit-user-select: none;
}

/* ===== بهبود نمایش نشان‌ها و تعداد ری‌اکشن در حالت روشن ===== */
body.light .reaction-badge {
  background: #e2e8f0;
  color: #1a1e2e;
}

/* زمان پیام */
.message-time {
  font-size: 10px;
  opacity: 0.7;
  margin-right: 6px;
  display: inline-block;
}

/* =========================================================
   PROGAMES - MINIMAL GAMING DASHBOARD
   ========================================================= */

:root {
  --bg: #0a0d18;
  --surface: #141929;
  --surface-2: #1c2335;
  --text: #f0f2f8;
  --muted: #9aa3b5;
  --muted-2: #6b7a90;

  --primary: #8b5cf6;
  --primary-dark: #6d28d9;
  --primary-light: #a78bfa;
  --blue: #38bdf8;
  --pink: #ec4899;
  --gold: #fbbf24;
  --green: #10b981;
  --danger: #ef4444;

  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(139, 92, 246, 0.25);

  --shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 6px 15px rgba(0, 0, 0, 0.15);

  --radius: 16px;
  --radius-sm: 10px;
  --header-height: 70px;
  --nav-height: 70px;
}

body.light {
  --bg: #f2f4f9;
  --surface: #ffffff;
  --surface-2: #f0f3fa;
  --text: #1a1e2e;
  --muted: #5a6b82;
  --muted-2: #8a9bb0;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(109, 40, 217, 0.25);
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + 25px);
  transition: background 0.3s, color 0.3s;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* ===== Header ===== */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  width: min(1200px, 95%);
  height: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 20px;
}

.logo-main {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  transform: scaleX(1.25);
  transform-origin: right center;
  display: inline-block;
}

.logo-main span {
  color: var(--primary-light);
}

.logo-text small {
  display: block;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--muted-2);
  direction: ltr;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s;
}

.icon-btn:hover {
  color: var(--primary-light);
  border-color: var(--border-strong);
}

/* ===== Main ===== */
main {
  width: min(1200px, 95%);
  margin: 0 auto;
  padding: 10px 0 60px;
}

.section {
  animation: sectionEnter 0.35s ease;
}

@keyframes sectionEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Section Header ===== */
.section-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-label {
  display: inline-block;
  color: var(--primary-light);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  direction: ltr;
}

h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 28px;
  font-weight: 900;
}

.title-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  font-size: 18px;
}

.section-description {
  color: var(--muted);
  font-size: 13px;
}

.online-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.online-dot.small {
  width: 6px;
  height: 6px;
}

/* ===== Featured Game (Simplified) ===== */
.featured-game {
  display: flex;
  align-items: center;
  gap: 25px;
  background: linear-gradient(120deg, #171c30, #1a1f38);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 35px;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
}

.featured-content {
  flex: 1;
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(251, 191, 36, 0.1);
  color: var(--gold);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.featured-kicker {
  display: block;
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 1.5px;
  direction: ltr;
}

.featured-content h2 {
  margin-top: 4px;
  font-size: 52px;
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.featured-description {
  margin-top: 8px;
  color: #b0b9d0;
  font-size: 13px;
  line-height: 1.8;
  max-width: 500px;
}

.featured-stats {
  display: flex;
  gap: 15px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.featured-stats span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.featured-stats i {
  color: var(--primary-light);
}

.featured-play {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: 0.25s;
  box-shadow: 0 8px 20px rgba(109, 40, 217, 0.3);
}

.featured-play:hover {
  transform: translateY(-2px);
}

.hokm-visual {
  width: 200px;
  height: 150px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px dashed rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  font-size: 28px;
}

/* ===== Game Grid ===== */
.games-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.games-heading h2 {
  font-size: 22px;
  font-weight: 900;
}

.coming-soon {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 15px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.25s;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.game-card-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
}

.game-status > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.game-favorite {
  color: var(--muted-2);
  font-size: 14px;
  cursor: pointer;
}

.game-icon-wrapper {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0 12px;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  font-size: 28px;
}

.purple-icon { background: rgba(139, 92, 246, 0.1); color: #c4b5fd; }
.blue-icon { background: rgba(56, 189, 248, 0.1); color: #7dd3fc; }
.gold-icon { background: rgba(251, 191, 36, 0.1); color: #fcd34d; }
.pink-icon { background: rgba(236, 72, 153, 0.1); color: #f9a8d4; }

.game-info h3 {
  font-size: 18px;
  font-weight: 900;
}

.game-info p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.game-meta {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 10px;
}

.game-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.game-meta i {
  color: var(--primary-light);
  font-size: 10px;
}

.btn-play {
  width: 100%;
  margin-top: auto;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 5px;
}

.btn-play:hover {
  box-shadow: 0 6px 15px rgba(109, 40, 217, 0.3);
}

.btn-play.disabled {
  background: var(--surface-2);
  color: var(--muted-2);
  cursor: not-allowed;
}

.locked-game {
  filter: saturate(0.7);
}

.locked-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(0,0,0,0.4);
  color: var(--muted-2);
  font-size: 9px;
}

/* ===== Chat ===== */
.chat-container {
  display: flex;
  height: 550px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.chat-list-panel {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  overflow-y: auto;
}

.chat-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  border-bottom: 1px solid var(--border);
}

.mini-label {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 1px;
  direction: ltr;
}

.chat-list-header h3 {
  margin-top: 3px;
  font-size: 15px;
}

.chat-search-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.chat-list {
  list-style: none;
}

.chat-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.chat-list-item:hover {
  background: rgba(139, 92, 246, 0.05);
}

.chat-list-item.active {
  background: rgba(139, 92, 246, 0.08);
  border-right: 3px solid var(--primary);
}

.chat-item-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  font-size: 16px;
  flex-shrink: 0;
}

.chat-item-info {
  min-width: 0;
}

.chat-item-name {
  font-size: 12px;
  font-weight: 800;
}

.chat-item-preview {
  font-size: 10px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conversation-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-conversation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  margin-top: 5px;
}

.back-btn {
  display: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.conversation-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.conversation-title-wrapper span {
  font-size: 13px;
  font-weight: 800;
}

.conversation-title-wrapper small {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  gap: 2px;
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}

.message {
  display: flex;
  flex-direction: column;
  position: relative;
}

.message.mine {
  align-items: flex-start; 
}

.message.theirs {
  align-items: flex-end; 
}

.message .bubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 12px;
  line-height: 1.7;
  word-break: break-word;
  position: relative;
  transition: transform 0.3s ease;
}

.message.theirs .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  color: var(--text);
}

.message.mine .bubble {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: white;
}

.message .sender-name {
  font-size: 10px;
  font-weight: 800;
  color: var(--primary-light);
  margin-bottom: 3px;
  cursor: pointer;
}

.reply-preview-inline {
  cursor: pointer;
  transition: background 0.2s;
  background: rgba(139, 92, 246, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 10px;
}

.reply-preview-inline:hover {
  background: rgba(139, 92, 246, 0.2);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-badge {
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
}

/* ===== منوی زیر پیام ===== */
.message-actions {
  display: none;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.message-actions.active {
  display: flex;
  animation: actionsIn 0.2s ease;
}

@keyframes actionsIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  color: var(--text);
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.message-actions button:hover {
  transform: scale(1.2);
}

.message-actions .action-reply {
  font-size: 12px;
  color: var(--primary-light);
  border-right: 1px solid var(--border);
  padding-right: 8px;
  margin-right: 4px;
}

/* ===== هایلایت پیام ===== */
.highlight-message {
  animation: highlightFade 2s ease;
}

@keyframes highlightFade {
  0% { background-color: rgba(139, 92, 246, 0.4); }
  100% { background-color: transparent; }
}

/* ===== پیش‌نمایش ریپلای ===== */
.reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 10px;
  color: var(--muted);
}

.reply-preview span {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reply-preview button {
  border: none;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  font-size: 12px;
}

.chat-input input:focus {
  border-color: var(--border-strong);
}

.chat-action-btn,
.send-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-action-btn {
  background: var(--surface-2);
  color: var(--muted);
}

.send-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

/* ===== Friends ===== */
.add-friend,
.friends-list,
.friend-requests {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 15px;
}

.card-heading,
.list-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.heading-icon,
.list-title-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
}

.list-title-icon.green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
}

.list-title-icon.orange {
  background: rgba(249, 115, 22, 0.1);
  color: #fdba74;
}

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-input-wrapper > i {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted-2);
}

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 35px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.search-box button {
  min-width: 100px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  cursor: pointer;
}

.search-results,
.friends-list ul,
.friend-requests ul {
  list-style: none;
}

.search-results li,
.friends-list li,
.friend-requests li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: 0.2s;
}

.search-results li:hover,
.friends-list li:hover,
.friend-requests li:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: var(--border-strong);
}

.friends-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.friend-actions {
  display: flex;
  gap: 4px;
}

.friend-actions button,
.search-results li button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.friend-actions button:hover,
.search-results li button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.btn-chat { color: var(--blue); }
.btn-delete, .btn-reject { color: var(--danger); }
.btn-accept { color: var(--green); }
.btn-add { color: var(--primary-light); }

/* ===== Profile ===== */
.profile-card {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 25px;
}

.profile-avatar {
  width: 90px;
  height: 90px;
  margin: 0 auto 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #312e81, var(--primary));
  color: white;
  font-size: 35px;
}

.player-tag {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
}

.profile-card h2 {
  margin-top: 8px;
  font-size: 22px;
}

.profile-card > p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.profile-stats div {
  padding: 12px;
  border-left: 1px solid var(--border);
}

.profile-stats div:last-child {
  border-left: none;
}

.profile-stats i {
  display: block;
  margin-bottom: 4px;
  color: var(--primary-light);
  font-size: 14px;
}

.profile-stats strong {
  font-size: 16px;
}

.profile-stats span {
  font-size: 9px;
  color: var(--muted);
}

.xp-section {
  margin-top: 18px;
  text-align: right;
}

.xp-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

.xp-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-top: 6px;
  overflow: hidden;
}

.xp-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
}

.btn-danger {
  width: 100%;
  margin-top: 18px;
  padding: 10px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: white;
  cursor: pointer;
  transition: 0.2s;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ===== Settings ===== */
.settings-card {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 15px;
}

.settings-icon {
  width: 45px;
  height: 45px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-light);
  font-size: 20px;
}

.settings-title {
  flex: 1;
}

.settings-title h3 {
  font-size: 16px;
}

.settings-title p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.theme-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  color: var(--text);
  transition: 0.2s;
}

.theme-btn.active {
  border-color: var(--border-strong);
  background: rgba(139, 92, 246, 0.08);
}

.theme-preview {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.light-preview {
  background: #fff7ed;
  color: #f59e0b;
}

.dark-preview {
  background: #1e1b4b;
  color: #a78bfa;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.modal-x {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}

.auth-header {
  text-align: center;
}

.eyebrow {
  color: var(--primary-light);
  font-size: 9px;
  letter-spacing: 2px;
  direction: ltr;
}

.auth-header h2 {
  margin-top: 6px;
  font-size: 22px;
}

.auth-header p {
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 20px 0;
  padding: 4px;
  background: var(--bg);
  border-radius: 8px;
}

.auth-tabs button {
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.auth-tabs button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.auth-form {
  text-align: right;
}

.auth-form label {
  display: block;
  margin: 10px 0 5px;
  font-size: 11px;
  color: var(--muted);
}

.input-wrapper {
  position: relative;
}

.input-wrapper > i {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted-2);
}

.modal-content input {
  width: 100%;
  height: 40px;
  padding: 0 35px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  font-size: 12px;
}

.btn-primary {
  width: 100%;
  margin-top: 15px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.error-message {
  min-height: 20px;
  margin-top: 10px;
  color: #fb7185;
  font-size: 10px;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  width: min(600px, 95%);
  height: 65px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 9000;
  padding: 5px;
}

.nav-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: transparent;
  z-index: 0;
}

.bottom-nav button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: 0.2s;
}

.nav-icon {
  font-size: 16px;
}

.bottom-nav button.active {
  color: var(--primary-light);
}

.bottom-nav button.active .nav-icon {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  padding: 5px 12px;
}

/* نشان آبی بالای دکمه */
.nav-badge {
  position: absolute;
  top: -2px;
  right: 5px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.5);
}

/* نشان تعداد پیام‌های خوانده‌نشده در لیست چت */
.chat-item-unread {
  background: var(--blue);
  color: white;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
}

/* ===== Toast ===== */
#toast-container {
  position: fixed;
  z-index: 6000;
  left: 15px;
  bottom: 95px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  min-width: 220px;
  padding: 10px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 3px solid var(--primary);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  box-shadow: var(--shadow-sm);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 10px;
}

/* ===== Responsive ===== */
@media (max-width: 800px) {
  .header-inner,
  main {
    width: calc(100% - 20px);
  }

  .logo-main {
    font-size: 24px;
    letter-spacing: 2px;
    transform: scaleX(1.1);
  }

  .logo-text small {
    display: none;
  }

  .featured-game {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }

  .hokm-visual {
    width: 100%;
    height: 120px;
    margin-top: 15px;
  }

  .friends-container {
    grid-template-columns: 1fr;
  }

  .chat-container {
    height: calc(100vh - 170px);
  }
}

@media (max-width: 600px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .game-card {
    padding: 15px;
    border-radius: 12px;
  }

  .game-icon-wrapper {
    width: 55px;
    height: 55px;
    font-size: 22px;
    border-radius: 12px;
  }

  .chat-list-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .chat-conversation-panel {
    position: fixed;
    inset: 64px 0 80px 0;
    display: none;
  }

  .chat-conversation-panel.active {
    display: flex;
  }

  .chat-list-panel.hidden {
    display: none;
  }

  .back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .bottom-nav {
    bottom: 8px;
    width: calc(100% - 10px);
    height: 62px;
    border-radius: 14px;
  }

  .bottom-nav button {
    font-size: 11px;
  }

  .nav-icon {
    font-size: 14px;
  }
}

/* بهبود کنتراست دکمه خروج از حساب در حالت روشن */
body.light .btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

body.light .btn-danger:hover {
  background: #fecaca;
}

body.light .locked-overlay {
  background: rgba(0, 0, 0, 0.6);
  color: #f0f2f8;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

body.light .coming-soon {
  background: #fff7ed;
  color: #92400e;
  border-color: #fdba74;
}

/* جلوگیری از انتخاب متن هنگام کشیدن */
.message {
  user-select: none;
  -webkit-user-select: none;
}

/* ===== بهبود نمایش نشان‌ها و تعداد ری‌اکشن در حالت روشن ===== */
body.light .reaction-badge {
  background: #e2e8f0;
  color: #1a1e2e;
}

/* زمان پیام */
.message-time {
  font-size: 10px;
  opacity: 0.7;
  margin-right: 6px;
  display: inline-block;
}

.chat-title-clickable {
  cursor: pointer;
  transition: color 0.2s;
}
.chat-title-clickable:hover {
  color: var(--primary-light);
}

/* ===== استایل دکمه‌های پروفایل کاربر ===== */
.user-profile-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-profile-actions .btn-primary,
.user-profile-actions .btn-secondary,
.user-profile-actions .btn-danger {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  transition: 0.2s;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  border-color: var(--border-strong);
}

.user-profile-actions .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
  transform: translateY(-1px);
}

.user-profile-actions .btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ===== نام قابل کلیک در هدر چت ===== */
.chat-title-clickable {
  cursor: pointer;
  transition: color 0.2s;
}
.chat-title-clickable:hover {
  color: var(--primary-light);
}

/* نقطه آفلاین */
.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: none;
}

.offline-dot.small {
  width: 6px;
  height: 6px;
}

/* ===== لایه ثابت iframe بازی ===== */
.game-iframe-wrapper {
  position: fixed;
  top: var(--header-height);
  bottom: calc(var(--nav-height) + 15px);
  left: 0;
  right: 0;
  z-index: 8000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s, visibility 0.3s;
}

.game-iframe-wrapper.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.game-iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.close-game-iframe {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.close-game-iframe:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.1);
}

.game-iframe-wrapper {
  position: fixed;
  top: var(--header-height);
  bottom: var(--nav-height);
  left: 0;
  right: 0;
  z-index: 8000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== تنظیمات ===== */
.settings-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
}

.setting-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
}

.setting-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}

.radio-option input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--toggle-bg, #ccc);
  transition: 0.2s;
  border-radius: 999px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  top: 2px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.btn-primary {
  margin-top: 10px;
}

header.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
}

.bottom-nav.footer-hidden {
  transform: translateX(-50%) translateY(100%);
  opacity: 0;
}

.game-iframe-wrapper.fullscreen {
  top: 0 !important;
  bottom: 0 !important;
}

/* ===== کارت بازی غیرفعال (به زودی) ===== */
.game-card.disabled-game {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none; /* جلوگیری از هرگونه کلیک */
}

.game-card.disabled-game:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.game-card.disabled-game .game-status.coming-soon {
  color: #ffaa00; /* رنگ زرد/نارنجی */
}

.game-card.disabled-game .game-status.coming-soon > span {
  background: transparent; /* حذف نقطه سبز */
  box-shadow: none;
}

.game-card.disabled-game .btn-play {
  background: var(--surface-2);
  color: var(--muted-2);
  cursor: not-allowed;
}

.game-card.disabled-game .btn-play:hover {
  box-shadow: none;
}

.game-invite-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #4f46e5;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.2s;
}

.game-invite-btn:hover {
  background: #4338ca;
}

#online-count {
    font-size: 10px !important;
    font-weight: 500 !important;
}

#global-chat-item {
  position: relative;
}

/* برای موبایل */
@media (max-width: 600px) {
    .chat-input input,
    .search-box input,
    .modal-content input {
        font-size: 16px; /* جلوگیری از زوم خودکار iOS */
        height: 40px;    /* کمی بلندتر برای فونت بزرگ‌تر */
        padding-top: 0;
        padding-bottom: 0;
    }
}

.theme-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}