:root {
  --bg-color: #0c0f14;
  --card-bg: #15181e;
  --inner-card-bg: #1c2028;
  --text-main: #ffffff;
  --text-muted: #8b949e;
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --border-radius: 16px;
  /* حذف CDN و اضافه کردن فونت‌های اموجی برای جلوگیری از بهم ریختگی */
  --font-family: Tahoma, Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --nav-height: 70px;
  --header-height: 60px;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: var(--font-family);
    line-height: 1.4;
}

body { background-color: var(--bg-color); color: var(--text-main); direction: rtl; padding: 0 !important; }

/* --- FIX HEADER & AVATAR --- */
.app-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    background: var(--bg-color);
    z-index: 100;
}
.avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #3b82f6;
    background: #1c2028;
}

/* --- SPA LAYOUT STYLES --- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: var(--nav-height); }
.top-header { height: var(--header-height); display: flex; justify-content: space-between; align-items: center; padding: 0 16px; position: sticky; top: 0; background: var(--bg-color); z-index: 100; }
.logo-text { color: #fff; font-weight: 900; font-size: 24px; }
.header-avatar { cursor: pointer; }
.header-avatar img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #3b82f6; }
.page-content { padding: 0 16px; flex: 1; }

/* Bottom Nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height); background: #1c2028; display: flex; justify-content: space-around; align-items: center; border-top: 1px solid #2a2e38; z-index: 1000; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 50px; height: 50px; cursor: pointer; color: #8b949e; }
.nav-item svg { width: 24px; height: 24px; fill: currentColor; }
.nav-item.active { color: #3b82f6; }

/* Home Page */
.home-tabs { display: flex; justify-content: space-between; margin-bottom: 16px; border-bottom: 1px solid #2a2e38; }
.tab { flex: 1; text-align: center; padding: 12px 0; color: #8b949e; font-weight: 600; cursor: pointer; }
.tab.active { color: #fff; border-bottom: 2px solid #3b82f6; }
.section-title { font-size: 14px; color: #8b949e; margin: 16px 0 10px; }
.online-slider { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.online-slider::-webkit-scrollbar { display: none; }
.online-card { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 60px; }
.online-avatar { width: 60px; height: 60px; border-radius: 50%; background: #333; border: 2px solid #3b82f6; padding: 2px; }
.online-avatar img { width: 100%; height: 100%; border-radius: 50%; }
.online-name { font-size: 12px; color: #fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; width: 60px; text-align: center; }
.games-slider { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.games-slider::-webkit-scrollbar { display: none; }
.game-card { min-width: 200px; background: #1c2028; border-radius: 12px; overflow: hidden; position: relative; }
.game-bg { height: 120px; width: 100%; }
.game-info { padding: 10px; display: flex; justify-content: space-between; align-items: center; }
.play-btn { background: #3b82f6; color: #fff; border: none; padding: 6px 16px; border-radius: 20px; font-weight: bold; }

/* Daily Reward */
.daily-reward-section { background: #1c2028; border-radius: 12px; padding: 16px; margin-top: 16px; }
.reward-header { display: flex; justify-content: space-between; color: #8b949e; font-size: 12px; margin-bottom: 12px; }
.reward-title { font-size: 16px; font-weight: bold; margin-bottom: 16px; }
.quest-item { display: flex; align-items: center; gap: 12px; background: #15181e; padding: 12px; border-radius: 8px; }
.quest-icon { width: 36px; height: 36px; background: #a855f7; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; color: #fff; }
.quest-info { flex: 1; font-size: 14px; }
.progress-bar { height: 6px; background: #2a2e38; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: #3b82f6; }

/* Games Page */
.page-header { display: flex; justify-content: space-between; align-items: center; }
.games-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; scrollbar-width: none; }
.games-tabs::-webkit-scrollbar { display: none; }
.gtab { padding: 8px 16px; background: #1c2028; border-radius: 20px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.gtab.active { background: #3b82f6; color: #fff; }
.games-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-grid-card { background: #1c2028; border-radius: 12px; overflow: hidden; }
.grid-game-bg { height: 100px; width: 100%; }
.grid-game-name { padding: 10px; font-size: 14px; font-weight: bold; text-align: center; }

/* Profile Card */
.container { max-width: 480px; margin: 0 auto; padding: 16px; }
.profile-card { background-color: var(--card-bg); border-radius: var(--border-radius); overflow: hidden; margin-bottom: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.4); position: relative; padding-top: 40px; }
.top-bar { position: absolute; top: 0; left: 0; width: 100%; display: flex; justify-content: space-between; padding: 10px 15px; z-index: 30; background: transparent; }
.icon-btn { background: none; border: none; cursor: pointer; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); line-height: 1; padding: 5px; }
.banner { height: 120px; width: 100%; position: relative; background-size: cover !important; background-position: center !important; }
.banner-plus { position: absolute; bottom: 10px; left: 15px; }
.avatar-container { position: absolute; top: 130px; left: 50%; transform: translateX(-50%); z-index: 10; }
.avatar { width: 100px; height: 100px; border-radius: 50%; background-color: #1a1f3a; border: 4px solid var(--card-bg); display: flex; align-items: center; justify-content: center; font-size: 50px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-plus { position: absolute; bottom: 0; right: 0; width: 24px; height: 24px; }
.plus-badge { background: #3b82f6; border: 2px solid var(--card-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 25; box-shadow: 0 0 10px rgba(59, 130, 246, 0.5); padding: 0; }
.profile-info { text-align: center; padding: 60px 20px 20px; }
.name { font-size: 22px; font-weight: 800; color: #c084fc; }
.username { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.bio-wrapper { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; background-color: var(--inner-card-bg); padding: 6px 14px; border-radius: 20px; }
.bio { font-size: 14px; color: var(--text-main); }
.pencil-btn { background: none; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.main-stats { display: flex; justify-content: space-around; padding: 15px 0; border-bottom: 1px solid var(--inner-card-bg); margin: 0 20px; }
.stat-box { flex: 1; text-align: center; border-left: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stat-box:last-child { border-left: none; }
.stat-value { font-size: 18px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.action-buttons { display: flex; justify-content: center; gap: 12px; padding: 20px; border-bottom: 1px solid var(--inner-card-bg); }
.btn-square-small { padding: 8px 16px; border-radius: 8px; background: linear-gradient(135deg, #2a2e38, #1c2028); border: 1px solid rgba(255,255,255,0.05); color: var(--text-main); font-size: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.btn-square-small.green { background: linear-gradient(135deg, #22c55e, #16a34a); border: none; }
.game-stats-card { background-color: var(--card-bg); border-radius: var(--border-radius); padding: 16px; margin-bottom: 20px; }

/* Modals */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background-color: var(--card-bg); padding: 20px; border-radius: 16px; width: 90%; max-width: 400px; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 15px 0; }
.avatar-option { width: 100%; aspect-ratio: 1; border-radius: 50%; cursor: pointer; border: 2px solid transparent; background-color: #1a1f3a; padding: 2px; }
.avatar-option:hover, .avatar-option.selected { border-color: var(--accent-purple); }
.banner-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 15px 0; }
.banner-option { width: 100%; aspect-ratio: 16/9; border-radius: 8px; cursor: pointer; border: 2px solid transparent; background-size: cover !important; background-position: center !important; }
.banner-option:hover { border-color: var(--accent-blue); }
.modal textarea { width: 100%; height: 80px; background: var(--inner-card-bg); border: 1px solid #333; border-radius: 8px; color: white; padding: 10px; margin-bottom: 15px; resize: none; font-family: inherit; }
.modal-btn { width: 100%; padding: 12px; border-radius: 8px; border: none; cursor: pointer; margin-bottom: 8px; font-weight: bold; font-size: 14px; }
.modal-btn.save { background: var(--accent-blue); color: white; }
.modal-btn.close { background: transparent; color: var(--text-muted); }

/* Settings List */
.settings-list { list-style: none; padding: 0; margin: 0; border-radius: 12px; overflow: hidden; background: var(--inner-card-bg); }
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--card-bg); cursor: pointer; color: var(--text-main); font-size: 15px; font-weight: 500; }
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background-color: #2a2e38; }
.settings-icon { font-size: 20px; }
