/* ============================================
   تنظیمات پایه و حذف اسکرول
   ============================================ */
* {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%; height: 100dvh; height: 100vh;
    overflow: hidden;
    font-family: 'Vazirmatn', system-ui, sans-serif;
    background: linear-gradient(135deg, #1a0b2e 0%, #0d2833 100%);
    color: #f8fafc;
    user-select: none; -webkit-user-select: none;
    position: fixed; top: 0; left: 0;
    touch-action: none; /* جلوگیری از زوم و اسکرول در موبایل */
}

/* ============================================
   لایه‌بندی
   ============================================ */
#game-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
}
#game-container canvas { display: block; }

#ui-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; display: flex; justify-content: center; align-items: center;
    pointer-events: none; padding: 16px;
}

.screen {
    display: none; width: 100%; height: 100%;
    justify-content: center; align-items: center;
    pointer-events: auto;
}
.screen.active {
    display: flex;
    animation: screenFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes screenFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================
   پنل شیشه‌ای (Glassmorphism)
   ============================================ */
.glass-panel {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(251, 191, 36, 0.1) inset;
    text-align: center;
    width: 100%; max-width: 480px;
    position: relative; overflow: hidden;
    max-height: 90vh;
    overflow-y: auto; /* اسکرول داخلی فقط در صورت نیاز */
}
.glass-panel::-webkit-scrollbar { width: 4px; }
.glass-panel::-webkit-scrollbar-thumb { background: rgba(251, 191, 36, 0.3); border-radius: 4px; }

/* ============================================
   تایپوگرافی و لوگو
   ============================================ */
.game-title {
    font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 900;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px; position: relative;
}
.title-glow {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 80%; height: 80%;
    background: radial-gradient(ellipse at center, rgba(251, 191, 36, 0.4) 0%, transparent 70%);
    filter: blur(20px); z-index: -1;
}
.logo-subtitle {
    display: flex; justify-content: center; align-items: center; gap: 10px;
    margin-bottom: 20px; font-size: 0.9rem; color: #94a3b8;
}
.q-dot-s {
    font-weight: 800; font-size: 1rem; color: #fbbf24;
    background: rgba(251, 191, 36, 0.1); padding: 4px 10px;
    border-radius: 6px; border: 1px solid rgba(251, 191, 36, 0.3);
    font-family: monospace;
}

/* ============================================
   دکمه‌ها
   ============================================ */
.btn {
    position: relative; width: 100%; padding: 16px;
    border-radius: 14px; font-family: 'Vazirmatn', sans-serif;
    font-size: 1.05rem; font-weight: 700; cursor: pointer;
    transition: all 0.2s ease; border: none; outline: none;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 12px; overflow: hidden;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1a0b2e;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(251, 191, 36, 0.6); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.06); color: #e2e8f0;
    border: 1px solid rgba(251, 191, 36, 0.2);
}
.btn-secondary:hover { background: rgba(251, 191, 36, 0.1); }

.btn-shine {
    position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shine 3s infinite;
}
@keyframes shine { 0% { left: -100%; } 50%, 100% { left: 100%; } }

/* ============================================
   المان‌های خاص بازی
   ============================================ */
/* انتخاب رنگ بازیکن */
.color-picker {
    display: flex; gap: 12px; justify-content: center; margin: 16px 0;
}
.color-option {
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
    border: 3px solid transparent; transition: transform 0.2s;
}
.color-option.selected { border-color: #fbbf24; transform: scale(1.15); }

/* شبکه دسته‌بندی‌ها */
.category-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
    margin: 16px 0; max-height: 40vh; overflow-y: auto;
}
.cat-chip {
    padding: 12px; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer; transition: all 0.2s;
}
.cat-chip.selected {
    background: rgba(251, 191, 36, 0.2); border-color: #fbbf24; color: #fbbf24;
}

/* صفحه مزایده */
.bid-display {
    font-size: 3rem; font-weight: 900; color: #fbbf24; margin: 20px 0;
}
.bid-controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.bid-btn {
    width: 60px; height: 60px; border-radius: 50%; font-size: 1.5rem; font-weight: bold;
    background: rgba(255,255,255,0.1); border: 2px solid #fbbf24; color: #fbbf24;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* صفحه پاسخ‌دهی */
.timer-bar {
    width: 100%; height: 8px; background: rgba(255,255,255,0.1);
    border-radius: 4px; overflow: hidden; margin-bottom: 20px;
}
.timer-fill {
    height: 100%; background: linear-gradient(90deg, #10b981, #fbbf24, #ef4444);
    width: 100%; transition: width 1s linear;
}
.counter-btn {
    width: 100%; height: 120px; border-radius: 20px; font-size: 1.5rem; font-weight: 900;
    background: linear-gradient(135deg, #10b981, #059669); color: white;
    border: none; cursor: pointer; box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.counter-btn:active { transform: scale(0.98); }
.counter-value { font-size: 3rem; line-height: 1; }

/* صفحه برنده */
.winner-trophy { font-size: 5rem; margin-bottom: 16px; animation: bounce 1s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.winner-name { font-size: 2rem; font-weight: 900; color: #fbbf24; margin-bottom: 8px; }
.winner-score { font-size: 1.2rem; color: #94a3b8; margin-bottom: 24px; }

/* اسکوربرد بالای صفحه (همیشه نمایش داده می‌شود) */
.scoreboard {
    position: fixed; top: 0; left: 0; width: 100%;
    padding: 12px 16px; display: flex; justify-content: space-between;
    background: rgba(26, 11, 46, 0.8); backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(251, 191, 36, 0.2); z-index: 20;
    transform: translateY(-100%); transition: transform 0.3s;
}
.scoreboard.visible { transform: translateY(0); }
.player-score {
    display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem;
}
.score-dot { width: 12px; height: 12px; border-radius: 50%; }
.score-val { color: #fbbf24; font-size: 1.1rem; }