:root {
    --bg-main: #05070d;
    --bg-secondary: #0b1020;
    --accent-primary: #2f6bff;
    --accent-secondary: #00f2fe;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --glass-bg: rgba(11, 16, 32, 0.7);
    --glass-border: rgba(47, 107, 255, 0.2);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Cairo', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* الخلفيات التجميلية والشبكة التقنية */
.tech-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, rgba(47, 107, 255, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(47, 107, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -2;
}

.glow-orb {
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

.glow-1 {
    top: -100px;
    right: -100px;
    background: var(--accent-primary);
}

.glow-2 {
    bottom: -100px;
    left: -100px;
    background: var(--accent-secondary);
}

/* تنسيق الحاويات والعناصر الزجاجية */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--card-shadow);
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    box-shadow: 0 12px 40px 0 rgba(47, 107, 255, 0.2);
}

/* شريط التنقل */
.site-header {
    position: sticky;
    top: 0;
    width: 100%;
    background: rgba(5, 7, 13, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 900;
    font-size: 1.25rem;
    letter-spacing: 2px;
}

.logo-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px var(--accent-primary));
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
    transition: var(--transition);
    position: relative;
    padding: 5px 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-main);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-main);
    border-radius: 3px;
    transition: var(--transition);
}

/* الأزرار والتدرجات */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #1a4bc8);
    color: var(--text-main);
    box-shadow: 0 4px 20px rgba(47, 107, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(47, 107, 255, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(47, 107, 255, 0.1);
    border-color: var(--accent-primary);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 0.85rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-secondary);
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.btn-text:hover {
    color: var(--text-main);
    letter-spacing: 1px;
}

/* قسم الـ Hero */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 40px;
    padding: 80px 0;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(47, 107, 255, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-secondary);
    margin-bottom: 20px;
    font-weight: 600;
}

.glitch-title {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.hero-actions {
    display: flex;
    gap: 15px;
}

.hero-visual {
    display: flex;
    justify-content: center;
    position: relative;
}

.floating-card {
    padding: 30px;
    width: 100%;
    max-width: 380px;
    position: relative;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.game-tag {
    font-size: 0.75rem;
    color: var(--accent-secondary);
    background: rgba(0, 242, 254, 0.1);
    padding: 4px 10px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 10px;
}

.floating-card h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.floating-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.card-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    padding-top: 15px;
}

/* الشبكات العامة والأقسام */
.featured-section {
    padding: 60px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.section-header p {
    color: var(--text-muted);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.card-image-wrapper {
    height: 180px;
    position: relative;
    overflow: hidden;
}

.img-placeholder {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: var(--transition);
}

.glass-card:hover .img-placeholder {
    transform: scale(1.05);
}

.game-1 { background: linear-gradient(135deg, #1a1c29, #0d1b2a); }
.game-2 { background: linear-gradient(135deg, #2b1055, #7597de); }
.game-3 { background: linear-gradient(135deg, #050505, #1e3a8a); }

.badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(5, 7, 13, 0.8);
    backdrop-filter: blur(4px);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    border: 1px solid var(--glass-border);
}

.card-body {
    padding: 25px;
}

.card-body h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.card-body p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 15px;
}

.genre {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* إحصائيات */
.stats-section {
    padding: 40px 0 80px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    padding: 40px;
    text-align: center;
    gap: 30px;
}

.stat-item h3 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent-secondary);
    margin-bottom: 5px;
}

.stat-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* صفحات إضافية (مكتبة ومجتمع) */
.page-content {
    padding: 40px 0 80px;
    flex: 1;
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.page-header p {
    color: var(--text-muted);
}

.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    background: rgba(5, 7, 13, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: 'Cairo', sans-serif;
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--accent-primary);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(5, 7, 13, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--accent-primary);
    color: var(--text-main);
    border-color: var(--accent-primary);
}

/* صفحة المجتمع */
.community-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

.leaderboard-panel {
    padding: 25px;
    height: fit-content;
}

.leaderboard-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.leaderboard-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.leaderboard-list li {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: rgba(5, 7, 13, 0.4);
    border-radius: 8px;
}

.rank {
    width: 28px;
    height: 28px;
    background: var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.rank.gold { background: #d97706; color: white; }
.rank.silver { background: #64748b; color: white; }
.rank.bronze { background: #b45309; color: white; }

.player-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

.score {
    font-size: 0.85rem;
    color: var(--accent-secondary);
}

.discussions-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.new-post-box {
    padding: 25px;
}

.new-post-box h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.new-post-box textarea {
    width: 100%;
    height: 100px;
    background: rgba(5, 7, 13, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 15px;
    color: var(--text-main);
    font-family: 'Cairo', sans-serif;
    resize: none;
    outline: none;
    margin-bottom: 15px;
}

.new-post-box textarea:focus {
    border-color: var(--accent-primary);
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    padding: 25px;
}

.post-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.post-header .author {
    font-weight: 700;
}

.post-header .time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.post-text {
    margin-bottom: 20px;
    line-height: 1.6;
}

.post-footer {
    display: flex;
    gap: 20px;
    border-top: 1px solid var(--glass-border);
    padding-top: 15px;
}

.post-footer button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    transition: var(--transition);
}

.post-footer button:hover {
    color: var(--accent-secondary);
}

/* Modal النافذة المنبثقة */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 13, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    padding: 30px;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--text-main);
}

.modal-header h2 {
    margin-bottom: 20px;
}

.game-screen-mock {
    height: 300px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    border: 1px solid var(--glass-border);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* التذييل */
.site-footer {
    background: rgba(5, 7, 13, 0.95);
    border-top: 1px solid var(--glass-border);
    padding: 60px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.footer-col p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 15px;
    font-size: 0.95rem;
}

.footer-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-col ul a {
    text-decoration: none;
    color: var(--text-muted);
    transition: var(--transition);
    font-size: 0.95rem;
}

.footer-col ul a:hover {
    color: var(--accent-secondary);
    padding-right: 5px;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* تصميم متجاوب (Responsive) */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 40px 0;
    }

    .hero-actions {
        justify-content: center;
    }

    .community-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        width: 100%;
        background: rgba(5, 7, 13, 0.95);
        backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 20px;
        text-align: center;
        border-bottom: 1px solid var(--glass-border);
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .glitch-title {
        font-size: 2.2rem;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* احترام تفضيلات تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}