/* ===== المتغيرات الأساسية (الوضع الداكن الافتراضي) ===== */
:root {
    --primary-color: #3B82F6;
    /* أزرق احترافي */
    --secondary-color: #2563EB;
    /* الأزرار عند التمرير */
    --accent-color: #F59E0B;
    /* برتقالي ذهبي */
    --success-color: #10B981;
    /* Keep existing green */
    --warning-color: #F59E0B;
    /* Keep existing orange */
    --danger-color: #EF4444;
    /* Keep existing red */
    --dark-bg: #121212;
    /* الخلفية الرئيسية */
    --dark-surface: #1E1E1E;
    /* الخلفية الثانوية */
    --dark-card: #1E1E1E;
    /* Assuming card matches secondary background */
    --text-primary: #FFFFFF;
    /* النص الأساسي */
    --text-secondary: #B0B0B0;
    /* النص الثانوي */
    --border-color: #2A2A2A;
    /* الحدود / الفواصل */
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --space-gradient-color1: rgba(59, 130, 246, 0.1);
    --space-gradient-color2: rgba(30, 30, 30, 0.8);
    --space-gradient-color3: rgba(18, 18, 18, 1);
    --star-color: white;
    --particle-color: rgba(139, 92, 246, 0.6);
}

/* ===== متغيرات الوضع الفاتح ===== */
html[data-theme="light"] {
    --primary-color: #4F46E5;
    /* A slightly softer blue for primary actions */
    --secondary-color: #6366F1;
    /* A slightly lighter indigo for hover */
    --accent-color: #F59E0B;
    /* Revert to original accent color */
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #F44336;

    --dark-bg: #F9FAFB;
    /* الخلفية الرئيسية */
    --dark-surface: #FFFFFF;
    /* الخلفية الثانوية */
    --dark-card: #FFFFFF;
    /* Assuming card matches secondary background */
    --text-primary: #111827;
    /* النص الأساسي */
    --text-secondary: #4B5563;
    /* النص الثانوي */
    --border-color: #E5E7EB;
    /* الحدود / الفواصل */
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    /* Lighter shadow */
    --space-gradient-color1: rgba(37, 99, 235, 0.05);
    --space-gradient-color2: rgba(255, 255, 255, 0.8);
    --space-gradient-color3: rgba(249, 250, 251, 1);
    --star-color: black;
    --particle-color: rgba(0, 0, 0, 0.4);
}

/* ===== الإعدادات العامة ===== */


/* ===== متغيرات الوضع الفاتح ===== */
html[data-theme="light"] {
    --primary-color: #6200EE;
    /* A vibrant purple for light mode */
    --secondary-color: #03DAC6;
    /* Teal accent */
    --accent-color: #FFC107;
    /* Amber for highlights */
    --success-color: #4CAF50;
    /* Green */
    --warning-color: #FF9800;
    /* Orange */
    --danger-color: #F44336;
    /* Red */

    --dark-bg: #F0F2F5;
    /* Light background */
    --dark-surface: #FFFFFF;
    /* White surface */
    --dark-card: #E0E0E0;
    /* Light grey card */
    --text-primary: #212121;
    /* Dark text */
    --text-secondary: #757575;
    /* Medium grey text */
    --border-color: #BDBDBD;
    /* Light grey border */
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    /* Lighter shadow */
}

/* ===== الإعدادات العامة ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--dark-bg);
}

/* Custom Scrollbar for Webkit */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 5px;
    border: 2px solid var(--dark-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}


body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    line-height: 1.6;
    direction: rtl;
    overflow: hidden;
    position: relative;
}

/* ===== الخلفية الفضائية التفاعلية ===== */
.space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%,
            var(--space-gradient-color1) 0%,
            var(--space-gradient-color2) 50%,
            var(--space-gradient-color3) 100%);
    z-index: -1;
    transition: background 0.3s ease;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--star-color);
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.particle {
    position: absolute;
    width: 1px;
    height: 1px;
    background: var(--particle-color);
    border-radius: 50%;
    animation: float 20s linear infinite;
}

@keyframes float {
    from {
        transform: translateY(100vh) translateX(0);
    }

    to {
        transform: translateY(-100px) translateX(100px);
    }
}

/* ===== شاشة البداية ===== */
.splash-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    background: transparent;
}

.splash-container {
    text-align: center;
    z-index: 10;
    position: relative;
    padding: 40px;
    width: 100%;
    max-width: 1200px;
}

/* الكوكب المتحرك */
.planet-container {
    position: relative;
    margin-bottom: 50px;
    display: inline-block;
}

.planet {
    font-size: 150px;
    display: inline-block;
    animation: planetRotate 30s linear infinite, planetFloat 6s ease-in-out infinite;
    filter: drop-shadow(0 0 50px var(--primary-color));
    cursor: pointer;
    transition: transform 0.3s ease;
}

.planet:hover {
    transform: scale(1.1);
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: orbitPulse 4s ease-in-out infinite;
}

.satellite {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 30px;
    animation: satelliteOrbit 20s linear infinite;
}

@keyframes planetRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes planetFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-30px);
    }
}

@keyframes orbitPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

@keyframes satelliteOrbit {
    from {
        transform: rotate(0deg) translateX(150px) rotate(0deg);
    }

    to {
        transform: rotate(360deg) translateX(150px) rotate(-360deg);
    }
}

.game-title {
    font-size: 5rem;
    font-weight: 900;
    background: linear-gradient(135deg,
            var(--primary-color) 0%,
            var(--secondary-color) 25%,
            var(--accent-color) 50%,
            var(--primary-color) 75%,
            var(--secondary-color) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 60px;
    animation: titleGlow 3s ease-in-out infinite, titleGradient 8s ease infinite;
    text-shadow: 0 0 50px var(--primary-color);
}

@keyframes titleGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 20px var(--primary-color));
    }

    50% {
        filter: drop-shadow(0 0 40px var(--secondary-color));
    }
}

@keyframes titleGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* المربعات المتحركة */
.feature-cards {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 60px;
    flex-wrap: wrap;
}

.feature-card {
    background: var(--dark-card);
    backdrop-filter: blur(20px);
    border: 2px solid var(--primary-color);
    border-radius: 25px;
    padding: 30px;
    min-width: 200px;
    text-align: center;
    transition: var(--transition);
    animation: cardSlideUp 0.8s ease-out;
    animation-fill-mode: both;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

html[data-theme="light"] .feature-card {
    border-color: var(--border-color);
    box-shadow: var(--shadow);
}

html[data-theme="light"] .feature-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    transition: left 0.6s ease;
}

.feature-card:hover::before {
    left: 100%;
}

.feature-card:nth-child(1) {
    animation-delay: 0.1s;
}

.feature-card:nth-child(2) {
    animation-delay: 0.2s;
}

.feature-card:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes cardSlideUp {
    from {
        transform: translateY(80px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.feature-card:hover {
    transform: translateY(-15px) scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 20px 40px var(--primary-color);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
    animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.feature-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* زر البدء - إصلاح التوسيط */
.start-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.leaderboard-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    /* بدل 48px */
    height: 60px;
    /* بدل 48px */
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    border: none;
    font-size: 2rem;
    /* بدل 1.8rem */
    cursor: pointer;
    z-index: 2010;
}

.leaderboard-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.2rem !important;
}

.leaderboard-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
}

.leaderboard-modal.hidden {
    display: none;
}

.leaderboard-content {
    position: relative;
    background: var(--dark-surface);
    padding: 20px;
    border-radius: 12px;
    color: var(--text-primary);
}

.leaderboard-body {
    max-height: 70vh;
    overflow: auto;
}

/* Sidebar variant */
.leaderboard-content.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 550px;
    border-radius: 0 0 0 0;
    padding: 20px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
}

.leaderboard-overlay {
    display: none;
}

.leaderboard-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
}

.back-leaderboard {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.back-leaderboard:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* leaderboard table styling */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--dark-card);
    border-radius: 12px;
    overflow: hidden;
    table-layout: fixed;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-flag {
    font-size: 1.8rem;
    vertical-align: middle;
    margin-left: 5px;
}

.leaderboard-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
}

.leaderboard-table tr:hover td {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-color);
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

/* New Leaderboard Styles */
.leaderboard-table th:nth-child(1),
.leaderboard-table td:nth-child(1) {
    width: 8%;
    text-align: center;
}

.leaderboard-table th:nth-child(2),
.leaderboard-table td:nth-child(2) {
    width: 60%;
    /* Player - Maximized */
}

.leaderboard-table th:nth-child(3),
.leaderboard-table td:nth-child(3) {
    width: 15%;
    /* Country - Minimized */
}

.leaderboard-table th:nth-child(4),
.leaderboard-table td:nth-child(4) {
    width: 17%;
    /* Score - Compact */
}

.cell-content {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.player-cell,
.country-cell {
    justify-content: flex-start;
}

.score-cell {
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    line-height: 1.2;
}

.player-flag,
.country-flag {
    font-size: 1.8rem;
    line-height: 1;
}

.player-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.country-name {
    font-weight: 600;
    font-size: 0.9rem;
    /* Smaller font for country */
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-attempts {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.95rem;
}

.score-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.tiny-icon {
    font-size: 0.7em;
    opacity: 0.7;
    margin-right: 4px;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leaderboard-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.start-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 25px 60px;
    font-size: 1.4rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 25px 50px var(--primary-color);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
    justify-content: center;
}

.start-btn:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 25px 50px var(--primary-color);
}

.start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.start-btn:hover::before {
    left: 100%;
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-icon {
    font-size: 1.5rem;
    animation: rocketLaunch 2s ease-in-out infinite;
}

@keyframes rocketLaunch {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(15deg);
    }
}

/* ===== شاشة اللعبة ===== */
.game-screen {
    position: fixed;
    inset: 0;
    background: var(--dark-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.game-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    padding: 8px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    z-index: 3000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    min-height: 50px;
}

/* Header Actions Container */
.header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* زر الرجوع للقائمة الرئيسية - في مجموعة البحث */
.search-wrapper .back-to-menu-btn {
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid rgba(139, 92, 246, 0.3);
    color: var(--primary-color);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    backdrop-filter: blur(10px);
    font-weight: 600;
}

.search-wrapper .back-to-menu-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.search-wrapper .back-to-menu-btn:active {
    transform: translateY(0);
}

.back-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.game-title-container {
    position: absolute;
    /* تحديد الموقع المطلق */
    right: 15px;
    /* على اليمين */
    top: 50%;
    /* في المنتصف عمودياً */
    transform: translateY(-50%);
    /* تعديل الموقع للتمركز التام */
    flex-shrink: 0;
}

.game-title-header {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.search-section {
    flex: 1;
    max-width: 700px;
    margin: 0 auto;
    position: static;
}

.search-wrapper {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 5px;
    direction: rtl;
    /* لجعل الزر يظهر على اليمين */
}

.search-wrapper>* {
    direction: ltr;
    /* إعادة تعيين الاتجاه للعناصر الفرعية */
}

.search-input-container {
    flex: 1;
    max-width: 500px;
    position: relative;
    z-index: 3100;
    margin: 0;
    display: inline-block;
    direction: ltr;
    /* تأكيد الاتجاه الصحيح لحقل البحث */
}

.search-input {
    width: 100%;
    background: var(--dark-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 15px 50px 15px 20px;
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 3100;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.3);
    background: rgba(30, 41, 59, 1);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.7;
}

.action-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    position: relative;
    overflow: hidden;
}

.action-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
}

.settings-btn {
    /* Reset absolute positioning as it's now handled by header-actions */
    position: relative;
    left: auto;
    top: auto;
    transform: none;

    background: rgba(139, 92, 246, 0.2);
    border: 2px solid var(--primary-color);
    padding: 12px;
    min-width: auto;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0;
}

.settings-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* زر التلميحات - عائم في الأسفل */
.hints-btn {
    position: fixed;
    bottom: 80px;
    left: 50px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #f0c330;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(240, 195, 48, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Revert to absolute if inside header-actions is not desired, but user image showed it isolated */
    /* Wait, the user image shows it isolated. Let's make it fixed/floating again */
}

.hints-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(240, 195, 48, 0.6);
    background-color: #f1c940;
}

.hints-btn i {
    font-size: 1.5rem;
}

/* .header-actions stays as is, hints-btn is now fixed positioned so it ignores this container's layout context */
.header-actions {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 3200;
}

/* على اليسار، بجانب زر الإعدادات */
.suggestions-btn {
    position: relative;
    left: auto;
    top: auto;
    right: auto;
    bottom: auto;
    transform: none;
    /* لون أخضر فاتح */
    border: 2px solid var(--success-color);
    padding: 12px;
    min-width: auto;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: var(--success-color);
    /* لون الأيقونة */
}

.suggestions-btn:hover {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.settings-icon {
    font-size: 1.5rem;
    animation: settingsSpin 4s linear infinite;
}

@keyframes settingsSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* قائمة الاقتراحات */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    width: 250px;
    max-width: 90vw;
    background: rgba(30, 41, 59, 0.98);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 2000;
    display: none;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.autocomplete-dropdown.show {
    display: block;
}

.suggestion-item {
    padding: 14px 18px;
    cursor: pointer;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(16, 185, 129, 0.15));
    transform: translateX(5px);
    border-left: 3px solid var(--primary-color);
}

.suggestion-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.suggestion-icon {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
}

.suggestion-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.suggestion-type {
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.8;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-weight: 500;
}

/* رسالة عدم وجود نتائج */
.no-results-hint {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    margin: 8px;
}

.no-results-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.7;
}

.no-results-text strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 8px;
}

.no-results-text small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    opacity: 0.8;
    line-height: 1.4;
}

/* حاوية الخريطة */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    z-index: 1000;
}

.map-container .hints-btn {
    position: absolute;
    bottom: 20px;
    /* Adjust as needed */
    left: 20px;
    /* Adjust as needed */
    z-index: 1001;
    /* Ensure it's above the map */
    background: rgba(110, 231, 183, 0.2);
    /* light green */
    border: 2px solid var(--success-color);
    padding: 12px;
    min-width: auto;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: var(--success-color);
    /* icon color */
}

.map-container .hints-btn:hover {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    z-index: 1000;
}

/* كود الخريطة الإضافي */
.leaflet-proxy {
    position: absolute !important;
    pointer-events: none !important;
    transform-origin: top left !important;
}

.leaflet-zoom-animated {
    will-change: transform !important;
}

/* لوحة السجل الثابتة - تعديل z-index */
.history-panel {
    position: fixed !important;
    top: 120px !important;
    right: 20px !important;
    left: auto !important;
    width: 380px !important;
    max-height: calc(100vh - 140px) !important;
    background: rgba(30, 41, 59, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 25px !important;
    overflow: hidden !important;
    z-index: 2001 !important;
    /* أعلى من كل العناصر الأخرى */
    box-shadow: var(--shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
}

/* منع أي تأثيرات على اللوحة */
.history-panel * {
    transition: none !important;
}

.panel-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
}

.attempt-counter {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.counter-label {
    opacity: 0.9;
}

.counter-value {
    font-weight: 700;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.panel-content::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.attempts-table-container {
    width: 100%;
}

.attempts-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
}

.attempts-table th,
.attempts-table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.attempts-table th {
    background: rgba(51, 65, 85, 0.5);
    color: var(--text-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
}

.attempts-table td {
    color: var(--text-secondary);
    font-weight: 500;
}

.attempts-table tr:hover td {
    background: rgba(139, 92, 246, 0.1);
}

/* ===== لوحة الإعدادات - إصلاح مهم ===== */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-modal.hidden {
    display: none;
}

.settings-modal.show {
    display: flex;
}

.settings-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.settings-content {
    position: relative;
    background: var(--dark-surface);
    border-radius: 30px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: modalZoomIn 0.4s ease-out;
    margin: auto;
    display: flex;
    flex-direction: column;
}

@keyframes modalZoomIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.settings-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 30px;
    border-radius: 30px 30px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h2 {
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 15px;
}

.close-settings {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.close-settings:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ===== نافذة الاقتراحات ===== */
.suggestions-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    /* Same as settings modal */
    display: flex;
    align-items: center;
    justify-content: center;
}

.suggestions-modal.hidden {
    display: none;
}

.suggestions-modal.show {
    display: flex;
}

.suggestions-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.suggestions-content {
    position: relative;
    background: var(--dark-surface);
    border-radius: 30px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: modalZoomIn 0.4s ease-out;
    /* Re-use existing animation */
    margin: auto;
    display: flex;
    flex-direction: column;
}

.suggestions-header {
    background: linear-gradient(135deg, var(--success-color), var(--primary-color));
    /* Greenish gradient */
    color: white;
    padding: 30px;
    border-radius: 30px 30px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestions-header h2 {
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 15px;
}

.close-suggestions {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.close-suggestions:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.suggestions-body {
    padding: 40px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.suggestions-body p {
    font-size: 1.2rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.settings-grid {
    display: grid;
    gap: 25px;
    padding: 40px;
    flex: 1;
    overflow-y: auto;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-item label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-item label i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.setting-item select {
    background: var(--dark-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 15px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.setting-item select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.settings-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 30px 40px 40px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 0 0 30px 30px;
}

.btn-primary,
.btn-secondary {
    padding: 15px 35px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    min-width: 150px;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
    background: var(--dark-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-3px);
}

/* ===== نافذة الفوز ===== */
.win-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4000;
    display: none;
}

.win-modal.show {
    display: flex;
}

.win-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.win-content {
    position: relative;
    background: var(--dark-surface);
    border-radius: 40px;
    padding: 50px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    animation: winBounceIn 0.8s ease-out;
    margin: auto;
    overflow: hidden;
}

@keyframes winBounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.win-animation {
    position: relative;
    margin-bottom: 30px;
}

.trophy {
    font-size: 8rem;
    animation: trophySpin 3s ease-in-out infinite;
}

/* Leaderboard Styles */
.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 10px;
    table-layout: fixed;
}

.leaderboard-table thead th {
    text-align: right;
    padding: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.leaderboard-table tbody tr {
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.01);
}

.leaderboard-table td {
    padding: 12px;
    font-size: 0.95rem;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Specific Column Widths */
.leaderboard-table th:nth-child(1),
.leaderboard-table td:nth-child(1) {
    width: 50px;
    text-align: center;
}

/* Rank */

.leaderboard-table th:nth-child(2),
.leaderboard-table td:nth-child(2) {
    width: 30%;
}

/* Country */

.leaderboard-table th:nth-child(3),
.leaderboard-table td:nth-child(3) {
    width: 30%;
}

/* Player */

.leaderboard-table th:nth-child(4),
.leaderboard-table td:nth-child(4) {
    width: 15%;
    text-align: center;
}

/* Time */

.leaderboard-table th:nth-child(5),
.leaderboard-table td:nth-child(5) {
    width: 15%;
    text-align: center;
}

/* Attempts */


.leaderboard-table td:first-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    font-weight: bold;
    color: var(--neon-blue);
}

.leaderboard-table td:last-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

/* Rank Colors */
.leaderboard-table tr:nth-child(1) td:first-child {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.leaderboard-table tr:nth-child(2) td:first-child {
    color: #C0C0C0;
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}

.leaderboard-table tr:nth-child(3) td:first-child {
    color: #CD7F32;
    text-shadow: 0 0 10px rgba(205, 127, 50, 0.5);
}

.player-info {
    display: flex;
    align-items: center;
    max-width: 100%;
}

.player-flag {
    font-size: 1.1rem;
    padding-left: 20px;
    flex-shrink: 0;
}

.player-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-name {
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
}

.time-val,
.attempts-val {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--neon-green);
    direction: ltr;
    /* Ensure numbers don't flip in RTL */
}



@keyframes trophySpin {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

.confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.confetti::before,
.confetti::after {
    content: '🎉';
    position: absolute;
    font-size: 2rem;
    animation: confettiFall 3s linear infinite;
}

.confetti::before {
    left: 20%;
    animation-delay: 0s;
}

.confetti::after {
    right: 20%;
    animation-delay: 1s;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100px) rotate(720deg);
        opacity: 0;
    }
}

.win-content h2 {
    color: var(--text-primary);
    margin-bottom: 30px;
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.win-details {
    margin-bottom: 40px;
}

.win-details p {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.win-details .highlight {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.4rem;
}

.save-score-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.save-score-clarification {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.player-name-input {
    flex: 1;
    background: var(--dark-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 15px 20px;
    color: var(--text-primary);
    font-size: 1rem;
}

.player-name-input {
    flex: 1;
    background: var(--dark-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 15px 20px;
    color: var(--text-primary);
    font-size: 1rem;
}

.player-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.win-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ===== الإشعارات ===== */
.toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 5000;
    max-width: 400px;
}

.toast {
    background: var(--dark-surface);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 20px 25px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: toastSlideIn 0.5s ease-out;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-right: 5px solid var(--success-color);
}

.toast.error {
    border-right: 5px solid var(--danger-color);
}

.toast.warning {
    border-right: 5px solid var(--warning-color);
}

.toast.info {
    border-right: 5px solid var(--primary-color);
    background: linear-gradient(135deg, var(--dark-surface), rgba(59, 130, 246, 0.1));
}

.toast.info i {
    color: var(--primary-color);
}

/* ===== الفئات المساعدة ===== */
.hidden {
    display: none !important;
}

/* ===== تحسينات للأجهزة المحمولة ===== */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
        position: relative;
        min-height: 50px;
    }

    .header-actions {
        position: static;
        transform: none;
        justify-content: center;
        order: 1;
        /* يظهر بعد البحث */
        margin-top: 10px;
    }

    .search-wrapper .back-to-menu-btn {
        padding: 10px 12px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 10px;
    }

    .back-icon {
        font-size: 1rem;
    }

    .game-title-container {
        position: static;
        /* إعادة الموقع للوضع الطبيعي */
        transform: none;
        right: auto;
        top: auto;
    }

    .search-section {
        width: 100%;
        margin: 0;
    }

    .search-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .search-input-container {
        width: 100%;
        max-width: none;
    }

    .settings-btn {
        position: static;
        /* إعادة الموقع للوضع الطبيعي */
        transform: none;
        left: auto;
        top: auto;
        margin-top: 10px;
    }

    .game-title-header {
        font-size: 1.5rem;
    }

    /* تعديلات قائمة الاقتراحات للموبايل */
    .search-section {
        margin: 0 15px;
    }

    .search-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .search-input-container {
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .autocomplete-dropdown {
        position: absolute !important;
        top: calc(100% - 8px) !important;
        left: 0 !important;
        width: 100% !important;
        border-radius: 0 0 12px 12px !important;
        margin: 0 !important;
    }

    .history-panel {
        width: calc(100% - 40px) !important;
        right: 20px !important;
        left: 20px !important;
        top: auto !important;
        bottom: 20px !important;
        max-height: 40vh !important;
        border-radius: 25px 25px 0 0 !important;
    }

    .feature-cards {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .game-title {
        font-size: 3.5rem;
    }

    .planet {
        font-size: 100px;
    }

    .start-btn {
        padding: 20px 40px;
        font-size: 1.2rem;
    }

    .settings-content {
        width: 95%;
        margin: 20px;
    }

    .win-content {
        padding: 30px;
    }

    .win-content h2 {
        font-size: 2rem;
    }

    .trophy {
        font-size: 5rem;
    }
}

/* ===== تحسينات للوصول ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

button:focus,
input:focus,
select:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== تحسينات الأداء ===== */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ===== إصلاحات إضافية ===== */
/* منع التمرير من إخفاء لوحة المحاولات */
body {
    overflow-x: hidden;
}

.game-screen {
    overflow: hidden;
}

.map-container {
    overflow: hidden;
}

/* تحسين أداء التمرير */
.panel-content {
    scroll-behavior: smooth;
}

/* تحسين أداء الرسوم المتحركة */
.history-panel,
.settings-content,
.win-content,
.autocomplete-dropdown {
    will-change: transform;
    transform: translateZ(0);
}

/* Warning Modal Styles */
.warning-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    /* Ensure it's on top of everything */
}

.warning-content {
    background-color: var(--dark-surface);
    color: var(--text-primary);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    animation: fadeInScale 0.3s ease-out;
}

.warning-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--accent-color);
    /* Use accent color for warning title */
}

.warning-content p {
    font-size: 1.1rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.dismiss-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

.dismiss-btn:hover {
    background-color: var(--secondary-color);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
    .warning-content {
        margin: 20px;
        padding: 20px;
    }

    .warning-title {
        font-size: 1.5rem;
    }

    .warning-content p {
        font-size: 1rem;
    }

    .dismiss-btn {
        padding: 10px 25px;
        font-size: 1rem;
    }
}

.game-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-top: -50px;
    /* Adjust as needed to position it correctly */
    margin-bottom: 30px;
    opacity: 0.8;
    animation: fadeIn 1s ease-out 0.5s forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* Site Footer Styles */
.site-footer {
    text-align: center;
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 10px;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: var(--dark-bg);
    margin: 0;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

/* #hintsBtn ID style removed to prevent conflict with class styles in header */
/* The button is now handled by .hints-btn class in the header actions */

@media (max-width: 768px) {
    .site-footer {
        font-size: 0.8rem;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .site-footer {
        font-size: 0.7rem;
        padding: 5px;
    }
}


/* ===== تحسينات للأجهزة المحمولة ===== */

/* قواعد عامة للشاشات الصغيرة (أقل من 768 بكسل) */
@media (max-width: 768px) {
    body {
        font-size: 13px;
        /* تقليل حجم الخط الأساسي لجميع العناصر */
        overflow-x: hidden;
        /* منع التمرير الأفقي */
    }

    /* شاشة البداية */
    .splash-container {
        padding: 10px;
    }

    .planet-container {
        margin-bottom: 15px;
    }

    .planet {
        font-size: 60px;
        /* تصغير حجم الكوكب أكثر */
        margin-top: 10px;
    }

    .orbit-ring {
        width: 140px;
        height: 140px;
        border-width: 1px;
    }

    @keyframes satelliteOrbit {
        from {
            transform: rotate(0deg) translateX(70px) rotate(0deg);
        }

        to {
            transform: rotate(360deg) translateX(70px) rotate(-360deg);
        }
    }

    .game-title {
        font-size: 2.2rem;
        /* تصغير حجم العنوان أكثر */
        margin-bottom: 20px;
    }

    .game-subtitle {
        font-size: 1rem;
        margin-top: -10px;
        margin-bottom: 10px;
    }

    .feature-cards {
        gap: 1px;
        margin-bottom: 1px;
    }

    .feature-card {
        width: 9%;
        /* جعل البطاقات تأخذ عرضاً أكبر */
        max-width: 250px;
        padding: 15px;
        border-radius: 10px;
    }

    .card-icon {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .feature-card h3 {
        font-size: 1rem;
    }

    .feature-card p {
        font-size: 0.8rem;
    }

    .start-btn {
        padding: 12px 25px;
        font-size: 0.9rem;
        min-width: 160px;
    }

    .btn-icon {
        font-size: 1rem;
    }

    .leaderboard-btn {
        top: 8px;
        right: 8px;
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    /* لوحة المتصدرين (Sidebar) */
    .leaderboard-content.sidebar {
        width: 100%;
        /* تأخذ عرض الشاشة بالكامل */
        border-radius: 0;
        box-shadow: none;
        padding: 15px;
        /* زيادة الحشوة */
        top: 0;
        /* تأكد من أنها تبدأ من الأعلى */
        height: 100vh;
        /* تأكد من أنها تملأ الارتفاع بالكامل */
        overflow-y: auto;
        /* تمكين التمرير إذا كان المحتوى أكبر من الشاشة */
    }

    .leaderboard-header {
        padding: 10px 0;
        /* حشوة للرأس */
        font-size: 1.1rem;
    }

    .leaderboard-controls {
        margin-top: 10px;
        /* مسافة من الأعلى */
    }

    .back-leaderboard {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .leaderboard-body {
        max-height: calc(100vh - 120px);
        /* ضبط الارتفاع الأقصى للجسم */
        overflow-y: auto;
        padding: 10px 0;
    }

    .leaderboard-table {
        width: 100%;
        min-width: 300px;
        /* لضمان التمرير الأفقي إذا لزم الأمر */
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 10px;
        /* زيادة الحشوة */
        font-size: 0.8rem;
        /* زيادة حجم الخط */
    }

    /* شاشة اللعبة - تحسين شامل */
    .game-header {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 10px 12px !important;
        gap: 10px !important;
        position: relative !important;
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95)) !important;
        backdrop-filter: blur(20px) !important;
        border-bottom: 2px solid rgba(59, 130, 246, 0.4) !important;
        min-height: 75px !important;
    }

    .header-actions {
        position: static !important;
        transform: none !important;
        justify-content: center !important;
        order: 1 !important;
        margin-top: 8px !important;
    }

    .search-wrapper .back-to-menu-btn {
        padding: 8px 10px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        border-radius: 8px !important;
    }

    .back-icon {
        font-size: 0.9rem !important;
    }

    .game-title-container {
        position: static !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
        width: auto !important;
        text-align: center !important;
        left: auto !important;
        padding: 6px 15px !important;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(16, 185, 129, 0.15)) !important;
        border-radius: 20px !important;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2) !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
        backdrop-filter: blur(10px) !important;
    }

    .game-title-header {
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
        margin: 0 !important;
        letter-spacing: 0.5px !important;
        background: linear-gradient(135deg, #3B82F6, #10B981) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
    }

    /* Specific Mobile Styling for Hint Button */
    .hints-btn {
        position: fixed !important;
        bottom: 20px !important;
        left: 20px !important;
        top: auto !important;
        right: auto !important;
        width: 100px !important;
        height: 50px !important;
        padding: 0 !important;
        border-radius: 25px !important;
        box-shadow: 0 4px 15px rgba(240, 195, 48, 0.5) !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .hints-btn i {
        font-size: 1.2rem !important;
    }

    .game-title-header {
        font-size: 1.2rem;
        /* تصغير حجم عنوان اللعبة في الهيدر أكثر */
        font-weight: bold;
        color: #fff;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
        margin-bottom: 0;
    }

    .search-section {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        flex: none !important;
        order: 2 !important;
    }

    .search-wrapper {
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 350px !important;
        margin: 0 auto !important;
        background: rgba(30, 41, 59, 0.8) !important;
        border-radius: 15px !important;
        padding: 8px !important;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2) !important;
        border: 1px solid rgba(59, 130, 246, 0.2) !important;
    }

    .search-input-container {
        flex: 1 !important;
        max-width: none !important;
        margin: 0 !important;
        position: relative !important;
    }

    .search-input {
        padding: 12px 40px 12px 15px !important;
        font-size: 0.9rem !important;
        border-radius: 12px !important;
        background: rgba(51, 65, 85, 0.9) !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
        color: white !important;
        width: 100% !important;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    }

    .search-input:focus {
        border-color: rgba(59, 130, 246, 0.6) !important;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
        outline: none !important;
    }

    .search-input::placeholder {
        color: rgba(255, 255, 255, 0.6) !important;
        font-size: 0.85rem !important;
    }

    .search-icon {
        left: 12px !important;
        font-size: 0.9rem !important;
        color: rgba(59, 130, 246, 0.8) !important;
    }

    .action-btn {
        padding: 10px 16px !important;
        font-size: 0.8rem !important;
        min-width: auto !important;
        border-radius: 10px !important;
        background: linear-gradient(135deg, #3B82F6, #1D4ED8) !important;
        border: none !important;
        color: white !important;
        font-weight: 600 !important;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
        transition: all 0.3s ease !important;
    }

    .action-btn:hover,
    .action-btn:active {
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
    }

    .settings-btn {
        position: absolute !important;
        top: 12px !important;
        left: 12px !important;
        transform: none !important;
        width: 40px !important;
        height: 40px !important;
        padding: 8px !important;
        margin: 0 !important;
        border-radius: 12px !important;
        background: rgba(51, 65, 85, 0.9) !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
        color: rgba(59, 130, 246, 0.9) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
        backdrop-filter: blur(10px) !important;
    }

    .settings-btn:hover,
    .settings-btn:active {
        background: rgba(59, 130, 246, 0.2) !important;
        transform: scale(1.05) !important;
        box-shadow: 0 3px 12px rgba(59, 130, 246, 0.3) !important;
    }

    /* تحسين زر التلميحات في الهيدر للهواتف */
    .hints-btn {
        left: 62px !important;
        /* بجانب زر الإعدادات (12px + 40px + 10px) */
        top: 12px !important;
        /* نفس ارتفاع زر الإعدادات */
        transform: none !important;
        /* إزالة translateY */
        width: 40px !important;
        /* نفس حجم زر الإعدادات */
        height: 40px !important;
        /* نفس حجم زر الإعدادات */
        padding: 8px !important;
        font-size: 16px !important;
        border-radius: 12px !important;
        /* نفس شكل زر الإعدادات */
        background: rgba(16, 185, 129, 0.2) !important;
        border: 1px solid rgba(16, 185, 129, 0.4) !important;
        color: rgba(16, 185, 129, 1) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
        backdrop-filter: blur(10px) !important;
    }

    .hints-btn:hover,
    .hints-btn:active,
    .hints-btn:focus {
        background: rgba(16, 185, 129, 0.3) !important;
        transform: scale(1.05) !important;
        /* تكبير بدون translateY */
        box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4) !important;
        outline: none !important;
    }

    .hints-btn i {
        font-size: 16px !important;
        color: rgba(16, 185, 129, 1) !important;
    }

    .settings-icon {
        font-size: 1.1rem;
    }

    /* قائمة الاقتراحات - محسنة */
    .autocomplete-dropdown {
        top: calc(100% + 2px) !important;
        border-radius: 0 0 15px 15px !important;
        background: rgba(30, 41, 59, 0.98) !important;
        border: 2px solid rgba(59, 130, 246, 0.3) !important;
        border-top: none !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
        backdrop-filter: blur(15px) !important;
        max-height: 200px !important;
        overflow-y: auto !important;
    }

    .suggestion-item {
        padding: 10px 12px !important;
        font-size: 0.8rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        transition: all 0.3s ease !important;
    }

    .suggestion-item:hover,
    .suggestion-item.active {
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(16, 185, 129, 0.2)) !important;
        transform: translateX(2px) !important;
        border-left: 2px solid var(--primary-color) !important;
    }

    .suggestion-main {
        gap: 8px !important;
    }

    .suggestion-icon {
        font-size: 0.9rem !important;
        min-width: 18px !important;
    }

    .suggestion-name {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
    }

    .suggestion-type {
        font-size: 0.65rem !important;
        padding: 2px 6px !important;
        border-radius: 8px !important;
        background: rgba(59, 130, 246, 0.25) !important;
        border: 1px solid rgba(59, 130, 246, 0.4) !important;
    }

    /* زر التلميحات */
    .map-container .hints-btn {
        bottom: 15px !important;
        left: 15px !important;
        width: 45px !important;
        height: 45px !important;
        padding: 10px !important;
        font-size: 18px !important;
        border-width: 2px !important;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
        backdrop-filter: blur(10px) !important;
    }

    .map-container .hints-btn:hover,
    .map-container .hints-btn:active,
    .map-container .hints-btn:focus {
        transform: scale(1.1) !important;
        box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
        outline: none !important;
    }

    /* تحسين اللمس للهواتف */
    .map-container .hints-btn {
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
    }

    .map-container .hints-btn i {
        font-size: 18px !important;
    }

    /* لوحة السجل */
    .history-panel {
        width: 100% !important;
        /* عرض كامل */
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        /* السماح لها بالارتفاع من الأسفل */
        max-height: 40vh !important;
        /* تحديد ارتفاع أقصى */
        z-index: 2002 !important;
        /* فوق زر التلميحات */
    }

    .panel-content {
        max-height: calc(40vh - 60px) !important;
        overflow-y: auto !important;
    }

    /* لوحة الإعدادات */
    .settings-content {
        width: 98%;
        max-width: 98%;
        margin: 5px;
        border-radius: 10px;
    }

    .settings-header {
        padding: 10px;
        border-radius: 10px 10px 0 0;
    }

    .settings-header h2 {
        font-size: 1.1rem;
        gap: 6px;
    }

    .close-settings {
        width: 25px;
        height: 25px;
        font-size: 0.8rem;
    }

    .settings-grid {
        padding: 15px;
        gap: 10px;
    }

    .setting-item label {
        font-size: 0.8rem;
        gap: 6px;
    }

    .setting-item select {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .settings-actions {
        gap: 8px;
        padding: 10px 15px;
        border-radius: 0 0 10px 10px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 8px 15px;
        font-size: 0.75rem;
    }

    /* نافذة الفوز */
    .win-content {
        padding: 20px;
        /* زيادة الحشوة */
        border-radius: 25px;
        /* زيادة نصف قطر الحدود */
        width: 98%;
        max-width: 98%;
        margin: 5px;
    }

    .win-animation {
        margin-bottom: 15px;
        /* زيادة الهامش السفلي */
    }

    .trophy {
        font-size: 4rem;
        /* زيادة حجم الكأس */
    }

    .win-content h2 {
        font-size: 1.8rem;
        /* زيادة حجم العنوان */
        margin-bottom: 15px;
        /* زيادة الهامش السفلي */
    }

    .win-details p {
        font-size: 1rem;
        /* زيادة حجم النص */
        margin-bottom: 10px;
        /* زيادة الهامش السفلي */
    }

    .win-details .highlight {
        font-size: 1.1rem;
        /* زيادة حجم النص المميز */
    }

    .player-name-input {
        padding: 10px 12px;
        /* زيادة الحشوة */
        font-size: 0.9rem;
        /* زيادة حجم الخط */
    }

    .btn-primary,
    .btn-secondary {
        padding: 12px 25px;
        /* زيادة الحشوة */
        font-size: 0.9rem;
        /* زيادة حجم الخط */
    }

    /* الإشعارات */
    .toast-container {
        top: 8px;
        right: 8px;
        left: 8px;
        max-width: calc(100% - 16px);
        z-index: 6000;
    }

    .toast {
        padding: 12px 15px;
        border-radius: 10px;
        font-size: 0.85rem;
        max-width: 100%;
        word-wrap: break-word;
        line-height: 1.4;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .toast.info {
        background: linear-gradient(135deg, #1E1E1E, rgba(59, 130, 246, 0.2));
        border-right-width: 4px;
        border-color: #3B82F6;
    }

    .toast i {
        font-size: 16px;
        min-width: 18px;
        color: #3B82F6;
    }

    .toast span {
        flex: 1;
        margin-right: 8px;
    }

    /* تحذير المودال */
    .warning-content {
        margin: 10px;
        padding: 100px;
    }

    .warning-title {
        font-size: 2.1rem;
    }

    .warning-content p {
        font-size: 1.8rem;
    }

    .dismiss-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* قواعد للشاشات الصغيرة جداً (أقل من 480 بكسل) */
@media (max-width: 480px) {
    body {
        font-size: 11px;
        /* تقليل حجم الخط الأساسي أكثر */
    }

    /* شاشة البداية */
    .splash-container {
        padding: 8px;
    }

    .planet {
        font-size: 45px;
    }

    .orbit-ring {
        width: 110px;
        height: 110px;
    }

    @keyframes satelliteOrbit {
        from {
            transform: rotate(0deg) translateX(55px) rotate(0deg);
        }

        to {
            transform: rotate(360deg) translateX(55px) rotate(-360deg);
        }
    }

    .game-title {
        font-size: 1.8rem;
        margin-bottom: 12px;
    }

    .game-subtitle {
        font-size: 0.8rem;
        margin-top: -8px;
        margin-bottom: 8px;
    }

    .feature-card {
        padding: 12px;
    }

    .card-icon {
        font-size: 1.8rem;
    }

    .feature-card h3 {
        font-size: 0.9rem;
    }

    .feature-card p {
        font-size: 0.7rem;
    }

    .start-btn {
        padding: 10px 20px;
        font-size: 0.8rem;
        min-width: 140px;
    }

    .btn-icon {
        font-size: 0.9rem;
    }

    .leaderboard-btn {
        width: 25px;
        height: 25px;
        font-size: 0.7rem;
    }

    /* شاشة اللعبة - الشاشات الصغيرة جداً */
    .game-header {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 8px 10px !important;
        gap: 8px !important;
        position: relative !important;
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98)) !important;
        backdrop-filter: blur(20px) !important;
        border-bottom: 1px solid rgba(59, 130, 246, 0.4) !important;
        min-height: 70px !important;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3) !important;
    }

    .header-actions {
        position: static !important;
        transform: none !important;
        justify-content: center !important;
        order: 1 !important;
        margin-top: 6px !important;
        gap: 8px !important;
    }

    .search-wrapper .back-to-menu-btn {
        padding: 6px 8px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        border-radius: 6px !important;
    }

    .back-icon {
        font-size: 0.8rem !important;
    }

    .game-title-container {
        position: static !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
        width: auto !important;
        text-align: center !important;
        left: auto !important;
        padding: 4px 12px !important;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.12)) !important;
        border-radius: 15px !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
        border: 1px solid rgba(59, 130, 246, 0.25) !important;
        backdrop-filter: blur(8px) !important;
    }

    .game-title-header {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
        margin: 0 !important;
        letter-spacing: 0.3px !important;
        background: linear-gradient(135deg, #3B82F6, #10B981) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
    }

    .search-section {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        flex: none !important;
        order: 2 !important;
    }

    .search-wrapper {
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
        background: rgba(30, 41, 59, 0.9) !important;
        border-radius: 12px !important;
        padding: 6px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
        border: 1px solid rgba(59, 130, 246, 0.2) !important;
    }

    .search-input-container {
        flex: 1 !important;
        max-width: none !important;
        margin: 0 !important;
        position: relative !important;
    }

    .search-input {
        padding: 8px 35px 8px 10px !important;
        font-size: 0.8rem !important;
        border-radius: 10px !important;
        background: rgba(51, 65, 85, 0.9) !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
        color: white !important;
        width: 100% !important;
    }

    .search-icon {
        left: 8px !important;
        font-size: 0.8rem !important;
        color: rgba(59, 130, 246, 0.7) !important;
    }

    .action-btn {
        padding: 8px 12px !important;
        font-size: 0.7rem !important;
        min-width: auto !important;
        border-radius: 8px !important;
        background: linear-gradient(135deg, #3B82F6, #1D4ED8) !important;
        border: none !important;
        color: white !important;
        font-weight: 600 !important;
        box-shadow: 0 1px 6px rgba(59, 130, 246, 0.3) !important;
    }

    .settings-btn {
        position: absolute;
        /* تحديد الموقع المطلق */
        top: 50%;
        left: 8px;
        /* أقصى اليسار */
        transform: translateY(-50%);
        /* توسيط عمودي */
        width: 30px;
        height: 30px;
        padding: 5px;
    }

    .settings-icon {
        font-size: 1rem;
    }

    .autocomplete-dropdown {
        top: calc(100% + 1px) !important;
        border-radius: 0 0 12px 12px !important;
        background: rgba(30, 41, 59, 0.98) !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
        border-top: none !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
        backdrop-filter: blur(12px) !important;
        max-height: 180px !important;
        overflow-y: auto !important;
    }

    .suggestion-item {
        padding: 8px 10px !important;
        font-size: 0.7rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    }

    .suggestion-item:hover,
    .suggestion-item.active {
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(16, 185, 129, 0.18)) !important;
        transform: translateX(1px) !important;
        border-left: 2px solid var(--primary-color) !important;
    }

    .suggestion-main {
        gap: 6px !important;
    }

    .suggestion-icon {
        font-size: 0.8rem !important;
        min-width: 16px !important;
    }

    .suggestion-name {
        font-size: 0.7rem !important;
        font-weight: 600 !important;
    }

    .suggestion-type {
        font-size: 0.6rem !important;
        padding: 1px 5px !important;
        border-radius: 6px !important;
        background: rgba(59, 130, 246, 0.2) !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
    }

    /* لوحة السجل */
    .history-panel {
        width: 100% !important;
        /* عرض كامل */
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        /* السماح لها بالارتفاع من الأسفل */
    }

    /* لوحة الإعدادات */
    .settings-content {
        width: 99%;
        max-width: 99%;
        margin: 4px;
        border-radius: 8px;
    }

    .settings-header {
        padding: 8px;
        border-radius: 8px 8px 0 0;
    }

    .settings-header h2 {
        font-size: 1rem;
    }

    .close-settings {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }

    .settings-grid {
        padding: 12px;
        gap: 8px;
    }

    .setting-item label {
        font-size: 0.7rem;
    }

    .setting-item select {
        padding: 6px 8px;
        font-size: 0.65rem;
    }

    .settings-actions {
        gap: 6px;
        padding: 8px 12px;
        border-radius: 0 0 8px 8px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 6px 12px;
        font-size: 0.65rem;
    }

    /* نافذة الفوز */
    .win-content {
        padding: 15px;
        /* زيادة الحشوة */
        border-radius: 20px;
        /* زيادة نصف قطر الحدود */
        width: 98%;
        max-width: 98%;
        margin: 4px;
    }

    .win-animation {
        margin-bottom: 10px;
        /* زيادة الهامش السفلي */
    }

    .trophy {
        font-size: 3.5rem;
        /* زيادة حجم الكأس */
    }

    .win-content h2 {
        font-size: 1.6rem;
        /* زيادة حجم العنوان */
        margin-bottom: 15px;
        /* زيادة الهامش السفلي */
    }

    .win-details p {
        font-size: 0.9rem;
        /* زيادة حجم النص */
        margin-bottom: 8px;
        /* زيادة الهامش السفلي */
    }

    .win-details .highlight {
        font-size: 1rem;
        /* زيادة حجم النص المميز */
    }

    .player-name-input {
        padding: 10px 12px;
        /* زيادة الحشوة */
        font-size: 0.85rem;
        /* زيادة حجم الخط */
    }

    .btn-primary,
    .btn-secondary {
        padding: 12px 25px;
        /* زيادة الحشوة */
        font-size: 0.9rem;
        /* زيادة حجم الخط */
    }

    /* الإشعارات */
    .toast-container {
        top: 6px;
        right: 6px;
        max-width: calc(100% - 12px);
    }

    .toast {
        padding: 6px 8px;
        border-radius: 6px;
        font-size: 0.75rem;
    }

    /* تحسين زر التلميحات للشاشات الصغيرة جداً */
    .hints-btn {
        left: 50px !important;
        /* بجانب زر الإعدادات (10px + 35px + 5px) */
        top: 10px !important;
        /* نفس ارتفاع زر الإعدادات */
        transform: none !important;
        /* إزالة translateY */
        width: 35px !important;
        /* نفس حجم زر الإعدادات */
        height: 35px !important;
        /* نفس حجم زر الإعدادات */
        padding: 6px !important;
        font-size: 14px !important;
        scale: 0.99 !important;
        border-radius: 10px !important;
        /* نفس شكل زر الإعدادات */
        background: rgba(16, 185, 129, 0.25) !important;
        border: 1px solid rgba(16, 185, 129, 0.4) !important;
        color: rgba(16, 185, 129, 1) !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
        backdrop-filter: blur(8px) !important;
    }


    .hints-btn:hover,
    .hints-btn:active {
        background: rgba(16, 185, 129, 0.4) !important;
        transform: scale(1.05) !important;
        /* تكبير بدون translateY */
        box-shadow: 0 3px 10px rgba(16, 185, 129, 0.4) !important;
    }

    .hints-btn i {
        font-size: 14px !important;
    }

    /* تحسين زر الإعدادات للتناسق */
    .settings-btn {
        top: 10px !important;
        left: 10px !important;
        width: 35px !important;
        height: 35px !important;
        padding: 6px !important;
        border-radius: 10px !important;
    }

    /* تحسين زر الإعدادات للشاشات الصغيرة جداً */
    .settings-btn {
        top: 10px !important;
        left: 10px !important;
        width: 35px !important;
        height: 35px !important;
        padding: 6px !important;
        border-radius: 10px !important;
    }

    /* تحذير المودال */
    .warning-content {
        margin: 6px;
        padding: 8px;
    }

    .warning-title {
        font-size: 0.9rem;
    }

    .warning-content p {
        font-size: 0.7rem;
    }

    .dismiss-btn {
        padding: 5px 10px;
        font-size: 0.7rem;
    }

    /* تحسينات إضافية للتلميحات على الهواتف */
    .toast.info {
        animation: slideInMobile 0.5s ease-out;
        border-right-width: 3px !important;
    }

    @keyframes slideInMobile {
        from {
            transform: translateX(100%);
            opacity: 0;
        }

        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    /* تحسينات إضافية للهيدر */
    .game-header {
        transition: all 0.3s ease !important;

    }

    .game-title-container {
        transition: all 0.3s ease !important;
    }

    .game-title-container:hover {
        transform: scale(1.02) !important;
        box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2) !important;
    }

    /* تحسين الاستجابة للمس */
    .search-input,
    .action-btn,
    .settings-btn {
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
    }
}

.social-icons {
    position: fixed;
    /* تفضل ثابتة حتى مع التمرير */
    top: 5px;
    /* قريبة من الأعلى */
    left: 20px;
    /* قريبة من اليسار */
    display: flex;
    gap: 15px;
    z-index: 2010;
}


.social-icon {
    font-size: 2rem;
    color: var(--text-primary);
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-icon:hover {
    transform: scale(1.1);
}

.social-icon .fa-youtube:hover {
    color: #FF0000;
}

.social-icon .fa-discord:hover {
    color: #7289DA;
}

/* Game Selection Screen */
.game-selection-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    background: linear-gradient(135deg,
            rgba(15, 23, 42, 0.95) 0%,
            rgba(30, 41, 59, 0.95) 50%,
            rgba(15, 23, 42, 0.95) 100%);
    backdrop-filter: blur(10px);
    padding: 20px;
    overflow-y: auto;
}

.game-selection-container {
    text-align: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Allow wider container on large screens for 5-column layout */
@media (min-width: 1100px) {
    .game-selection-container {
        max-width: 98% !important;
    }
}

/* Header Section */
.selection-header {
    margin-bottom: 50px;
    animation: fadeInUp 0.8s ease-out;
}

.selection-header .header-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.selection-header h2 {
    font-size: 3.5rem;
    margin-bottom: 15px;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.selection-header .header-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    opacity: 0.8;
}

/* Game Cards Container */
.game-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 1600px;
    padding: 0 20px;
}

/* Force 5 columns on large screens */
@media (min-width: 1200px) {
    .game-cards-container {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Game Card Base Styles - Portal Style */
.game-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    /* Rounder corners */
    padding: 30px 20px;
    /* Vertical padding */
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center everything */
    text-align: center;
    /* Center text */
    min-height: 500px;
    /* Tall portal look */
    justify-content: space-between;
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 30px;
    padding: 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.game-card:hover {
    transform: translateY(-20px);
    background: rgba(30, 41, 59, 0.85);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    border-color: rgba(139, 92, 246, 0.6);
}

.game-card:hover::after {
    opacity: 1;
}

/* Top Glow */
.game-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

/* Active Game Card */
.game-card.active-game {
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.1);
}

.game-card.active-game::before {
    opacity: 1;
}

/* Coming Soon Cards */
.game-card.coming-soon {
    opacity: 0.7;
}

.game-card.coming-soon:hover {
    opacity: 0.9;
    transform: translateY(-8px) scale(1.01);
}

/* Card Header - Centered Stack */
.card-header {
    display: flex;
    flex-direction: column;
    /* Stack vertical */
    align-items: center;
    gap: 15px;
    padding: 0;
    margin-bottom: 20px;
    width: 100%;
}

.game-icon {
    font-size: 3.5rem;
    /* Large Icon */
    margin: 10px 0;
    filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.5));
    animation: float 4s ease-in-out infinite;
}

.game-status {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ... status colors unchanged ... */
.game-status.available {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.game-status.coming-soon {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

/* Card Content - Centered */
.card-content {
    padding: 0;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    /* Fill space */
}

.card-content h3 {
    font-size: 2rem;
    /* Big Title */
    color: #fff;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.game-description {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 25px;
    max-width: 90%;
}

.game-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
}

.feature {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.feature:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

/* Card Footer - Compacted */
.card-footer {
    padding: 15px;
    /* Reduced padding */
    margin-top: auto;
    /* Push to bottom if flex column */
}

.play-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 10px 15px;
    /* Compact button */
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.play-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.play-btn:hover::before {
    left: 100%;
}

.play-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.play-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.play-btn.disabled {
    background: rgba(75, 85, 99, 0.5);
    color: rgba(156, 163, 175, 0.7);
    cursor: not-allowed;
    box-shadow: none;
}

.play-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.play-btn.disabled::before {
    display: none;
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-text {
    font-weight: 600;
}

/* Selection Footer */
.selection-footer {
    margin-top: 40px;
    animation: fadeInUp 1s ease-out 0.3s both;
}

.back-btn {
    background: rgba(75, 85, 99, 0.3);
    color: var(--text-secondary);
    border: 2px solid rgba(75, 85, 99, 0.5);
    border-radius: 16px;
    padding: 12px 24px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.back-btn:hover {
    background: rgba(75, 85, 99, 0.5);
    border-color: rgba(75, 85, 99, 0.7);
    transform: translateY(-2px);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* 
   --------------------------------------------------------------
   COMPREHENSIVE RESPONSIVE DESIGN SYSTEM (FINAL FIX)
   --------------------------------------------------------------
*/

/* 1. Large Laptops/Desktops (1200px - 1500px) */
@media (max-width: 1500px) {
    .game-cards-container {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px;
    }
}

/* 2. Tablets & Small Laptops (768px - 1200px) */
@media (max-width: 1200px) {
    .game-cards-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
        padding: 0 15px;
        max-width: 900px;
        /* Center it nicely */
    }

    .game-card {
        min-height: 450px;
    }
}

/* 3. Mobile Devices (< 768px) */
@media (max-width: 768px) {
    .game-selection-screen {
        padding: 10px;
        align-items: flex-start;
        padding-top: 10px;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .game-selection-container {
        max-width: 100%;
        width: 100%;
        margin-top: 0;
        padding: 0;
    }

    .selection-header {
        margin-bottom: 20px;
        margin-top: 10px;
    }

    .selection-header h2 {
        font-size: 1.8rem;
    }

    .selection-header .header-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }

    /* FORCE 1 COLUMN VERTICAL STACK */
    .game-cards-container {
        display: flex;
        /* Flex might be safer than grid for pure vertical stack */
        flex-direction: column;
        gap: 15px;
        margin-bottom: 40px;
        padding: 0 10px;
        width: 100%;
        box-sizing: border-box;
    }

    /* CARD RESET - NO FIXED HEIGHT */
    .game-card {
        min-height: 0;
        /* REMOVE FIXED HEIGHT */
        height: auto;
        padding: 20px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
        align-items: center;
    }

    /* COMPACT CONTENT */
    .card-header {
        padding: 0;
        margin-bottom: 10px;
        gap: 5px;
    }

    .game-icon {
        font-size: 2.5rem;
        margin: 5px 0;
    }

    .card-content {
        padding: 0;
        text-align: center;
        margin-bottom: 15px;
    }

    .card-content h3 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    .game-description {
        font-size: 0.9rem;
        margin-bottom: 10px;
        line-height: 1.3;
    }

    .game-features {
        gap: 5px;
        margin-bottom: 15px;
    }

    .feature {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .card-footer {
        padding: 0;
        width: 100%;
    }

    .play-btn {
        padding: 12px;
        font-size: 1rem;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .game-selection-screen {
        padding: 8px;
        padding-top: 15px;
    }

    .selection-header {
        margin-bottom: 20px;
    }

    .selection-header .header-icon {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .selection-header h2 {
        font-size: 1.6rem;
        margin-bottom: 6px;
        padding: 0 5px;
    }

    .selection-header .header-subtitle {
        font-size: 0.8rem;
        padding: 0 15px;
    }

    .game-cards-container {
        gap: 12px;
        margin-bottom: 20px;
    }

    .game-card {
        margin: 0 2px;
        border-radius: 14px;
    }

    .card-header {
        padding: 12px 12px 0 12px;
        margin-bottom: 8px;
    }

    .game-icon {
        font-size: 1.8rem;
    }

    .game-status {
        padding: 3px 6px;
        font-size: 0.65rem;
    }

    .card-content {
        padding: 0 12px;
    }

    .card-content h3 {
        font-size: 1.2rem;
        margin-bottom: 6px;
    }

    .game-description {
        font-size: 0.8rem;
        margin-bottom: 10px;
        line-height: 1.3;
    }

    .game-features {
        margin-bottom: 12px;
        gap: 4px;
        flex-wrap: wrap;
    }

    .feature {
        font-size: 0.65rem;
        padding: 3px 6px;
        border-radius: 10px;
        flex: 0 0 auto;
    }

    .card-footer {
        padding: 12px;
    }

    .play-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
        border-radius: 10px;
        gap: 6px;
    }

    .btn-icon {
        font-size: 0.9rem;
    }

    .selection-footer {
        margin-top: 20px;
    }

    .back-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        border-radius: 10px;
        gap: 6px;
    }
}

/* تحسينات إضافية للشاشات الصغيرة جداً */
@media (max-width: 360px) {
    .game-selection-screen {
        padding: 5px;
        padding-top: 10px;
    }

    .selection-header h2 {
        font-size: 1.4rem;
    }

    .selection-header .header-subtitle {
        font-size: 0.75rem;
    }

    .card-content h3 {
        font-size: 1.1rem;
    }

    .game-description {
        font-size: 0.75rem;
    }

    .feature {
        font-size: 0.6rem;
        padding: 2px 5px;
    }

    .play-btn {
        font-size: 0.8rem;
        padding: 9px 12px;
    }
}

.time-val,
.attempts-val {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--neon-green);
    direction: ltr;
}