* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    direction: rtl;
}

/* نوار بالا */
.top-bar {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid #00dbde;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: bold;
}

.logo-img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid #00dbde;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: #ddd;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.nav-links a:hover {
    background: linear-gradient(45deg, #00dbde, #fc00ff);
    color: #fff;
    transform: translateY(-2px);
}

/* کانتینر اصلی */
.games-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.header-section {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #00dbde, #fc00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(0, 219, 222, 0.3);
}

.stat i {
    color: #00dbde;
    font-size: 1.2rem;
}

/* شبکه بازی‌ها */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.game-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-10px);
    border-color: #00dbde;
    box-shadow: 0 10px 30px rgba(0, 219, 222, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00dbde, #fc00ff);
}

.game-icon {
    font-size: 3rem;
    color: #00dbde;
    margin-bottom: 1rem;
}

.game-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

.game-card p {
    opacity: 0.8;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.game-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.game-meta span {
    background: rgba(0, 219, 222, 0.1);
    padding: 5px 10px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.play-btn {
    background: linear-gradient(45deg, #00dbde, #fc00ff);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 219, 222, 0.4);
}

/* محیط بازی */
.game-area {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.game-header {
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #00dbde;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.game-stats {
    display: flex;
    gap: 2rem;
}

.game-stats > div {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.game-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

#gameContainer {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 2rem;
    border: 2px solid #00dbde;
    max-width: 800px;
    width: 100%;
    min-height: 400px;
}

.game-controls {
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    border-top: 2px solid #fc00ff;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.control-btn:hover {
    background: linear-gradient(45deg, #00dbde, #fc00ff);
    transform: translateY(-3px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1002;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 2rem;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    border: 2px solid #00dbde;
}

.modal-content h3 {
    color: #00dbde;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: linear-gradient(45deg, #ff416c, #ff4b2b);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 1rem;
    width: 100%;
    font-weight: bold;
}

/* استایل‌های اختصاصی بازی‌ها */
.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

.tic-tac-toe-cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #00dbde;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tic-tac-toe-cell:hover {
    background: rgba(0, 219, 222, 0.2);
}

.tic-tac-toe-cell.x {
    color: #ff416c;
}

.tic-tac-toe-cell.o {
    color: #4facfe;
}

.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(45deg, #00dbde, #fc00ff);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.memory-card.flipped {
    transform: rotateY(180deg);
    background: #fff;
    color: #1a1a2e;
}

.snake-game {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #00dbde;
}

.snake-segment {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #00dbde;
    border-radius: 3px;
}

.snake-food {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ff416c;
    border-radius: 50%;
}

.pong-game {
    position: relative;
    width: 600px;
    height: 400px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #00dbde;
}

.pong-paddle {
    position: absolute;
    width: 20px;
    height: 100px;
    background: #00dbde;
}

.pong-ball {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
}

.game-2048-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
}

.tile {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.tile-2 { background: #00dbde; color: #000; }
.tile-4 { background: #4facfe; color: #000; }
.tile-8 { background: #43e97b; color: #000; }
.tile-16 { background: #38f9d7; color: #000; }
.tile-32 { background: #fa709a; color: #000; }
.tile-64 { background: #ff416c; color: #fff; }
.tile-128 { background: #ff4b2b; color: #fff; }
.tile-256 { background: #fc00ff; color: #fff; }
.tile-512 { background: #9d50bb; color: #fff; }
.tile-1024 { background: #6a3093; color: #fff; }
.tile-2048 { background: #a044ff; color: #fff; }

/* ریسپانسیو */
@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .games-container {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .game-controls {
        flex-wrap: wrap;
    }
    
    .tic-tac-toe-board,
    .memory-board,
    .snake-game,
    .pong-game,
    .game-2048-board {
        width: 100%;
        max-width: 300px;
    }
    
    .pong-game {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .game-card {
        padding: 1.5rem;
    }
    
    .game-icon {
        font-size: 2.5rem;
    }
    
    .game-card h3 {
        font-size: 1.3rem;
    }
    
    .stats-bar {
        flex-direction: column;
        align-items: center;
    }
}