/* style.css - asosiy dizayn */

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(145deg, #f9f0c1 0%, #fadadd 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 12px 40px;
}

.container {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6ec4, #7873f5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    text-shadow: 4px 4px 10px rgba(0,0,0,0.1);
}

.logo span {
    font-size: 1rem;
    font-weight: 400;
    color: #ff4d6d;
    display: block;
    line-height: 1.2;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(2px);
    padding: 2px 8px;
    border-radius: 30px;
    margin-top: 4px;
}

.menu-icon {
    background-color: #ffbd00;
    padding: 12px 16px;
    border-radius: 40px;
    font-weight: 600;
    color: #2b2b2b;
    box-shadow: 0 8px 0 #d48c00;
    transition: 0.1s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.menu-icon:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 #d48c00;
}

/* Qidiruv */
.search-section {
    margin: 20px 0 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 60px;
    padding: 8px 20px;
    box-shadow: 0 15px 25px rgba(255, 105, 180, 0.3), 0 5px 10px rgba(0,0,0,0.1);
    border: 2px solid #ffb3c6;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    padding: 12px 8px;
    background: transparent;
}

.search-box button {
    background: #ff4d6d;
    border: none;
    color: white;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 40px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 6px 0 #b3002d;
    transition: 0.1s;
    border: 1px solid white;
}

.search-box button:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b3002d;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.tag {
    background: white;
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    box-shadow: 0 5px 0 #cccccc;
    transition: 0.1s;
    border: 1px solid #ffb347;
    cursor: pointer;
}

.tag:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #aaaaaa;
}

.tag.hot {
    background: #ffb703;
    color: #000;
    box-shadow: 0 5px 0 #d48c00;
}

/* O'yinlar grid */
.games-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 20px 0 30px;
}

@media (min-width: 600px) {
    .container {
        max-width: 800px;
    }
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .container {
        max-width: 1100px;
    }
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* O'yin kartochkasi */
.game-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 36px;
    padding: 22px 18px;
    box-shadow: 0 30px 30px -10px rgba(255, 105, 180, 0.4),
                0 10px 0 #ffb6c1,
                inset 0 -3px 0 rgba(0,0,0,0.05);
    border: 2px solid white;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.game-card:active {
    transform: scale(0.98);
    box-shadow: 0 15px 20px -5px rgba(255, 105, 180, 0.4), 0 5px 0 #ffb6c1;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.game-icon {
    font-size: 3rem;
    background: #ffd966;
    width: 70px;
    height: 70px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 0 #d4a500, 0 5px 15px rgba(0,0,0,0.2);
    border: 2px solid white;
}

.game-title h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #222;
    line-height: 1.2;
}

.game-title p {
    font-size: 0.8rem;
    color: #ff4d6d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-description {
    font-size: 0.95rem;
    color: #333;
    margin: 12px 0 18px;
    font-weight: 400;
    line-height: 1.4;
    flex: 1;
}

.play-button {
    background: #5cb85c;
    border: none;
    color: white;
    font-weight: 800;
    font-size: 1.2rem;
    padding: 16px 10px;
    border-radius: 60px;
    box-shadow: 0 10px 0 #2d6a4d;
    transition: 0.08s linear;
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border: 2px solid white;
    margin-top: 6px;
}

.play-button:active {
    transform: translateY(6px);
    box-shadow: 0 4px 0 #2d6a4d;
}

/* Statistika */
.stats {
    display: flex;
    justify-content: space-between;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(4px);
    padding: 14px 20px;
    border-radius: 70px;
    margin: 16px 0 10px;
    border: 1px solid #ffe5b4;
    font-weight: 600;
    color: #3a0ca3;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

/* Footer */
.footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.9rem;
    color: #a56070;
    background: rgba(255,255,255,0.6);
    padding: 18px;
    border-radius: 50px;
    width: 100%;
    backdrop-filter: blur(3px);
    font-weight: 500;
}

/* Loading animatsiyasi */
.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 5px solid #ffc8dd;
    border-top-color: #ff4d6d;
    border-radius: 50%;
    animation: spin 1s infinite;
}

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

/* Modal stillari (Snake uchun) */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2d1b3c;
    padding: 20px;
    border-radius: 50px;
    max-width: 500px;
    width: 95%;
    border: 5px solid #ffb703;
    box-shadow: 0 30px 30px #ff4d6d80;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: white;
    font-weight: 800;
    font-size: 1.8rem;
}

.close-btn {
    background: #ff4d6d;
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 7px 0 #b3002d;
    transition: 0.05s;
}

.close-btn:active {
    transform: translateY(5px);
    box-shadow: 0 2px 0 #b3002d;
}

#gameCanvas {
    display: block;
    margin: 0 auto;
    background: #111;
    border-radius: 30px;
    border: 4px solid #ffb703;
    width: 100%;
    height: auto;
    max-width: 400px;
    aspect-ratio: 1/1;
}

.mobile-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.control-row {
    display: flex;
    gap: 25px;
    justify-content: center;
}

.ctrl-btn {
    background: #ffbd00;
    border: none;
    width: 70px;
    height: 70px;
    border-radius: 50px;
    font-size: 2rem;
    font-weight: 800;
    box-shadow: 0 8px 0 #d48c00;
    transition: 0.05s;
    cursor: pointer;
    color: #2b2b2b;
}

.ctrl-btn:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 #d48c00;
}

.score-box {
    text-align: center;
    color: white;
    font-size: 1.5rem;
    margin: 10px 0;
    font-weight: 600;
}

/* Rangli ikonkalar (ixtiyoriy) */
.game-card[data-game="snake"] .game-icon { background: #ffb3c6; }
.game-card[data-game="2048"] .game-icon { background: #b8f2e6; }
.game-card[data-game="dart"] .game-icon { background: #ffcc99; }
.game-card[data-game="memory"] .game-icon { background: #c5a3ff; }
.game-card[data-game="pong"] .game-icon { background: #a3e4d7; }
.game-card[data-game="dice"] .game-icon { background: #fdffb3; }
/* Memory */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px;
    background: #2d1b3c;
    border-radius: 30px;
    margin: 15px 0;
}
.memory-card {
    aspect-ratio: 1/1;
    background: #ffb703;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 0 #d48c00;
    transition: 0.1s;
}
.memory-card.flipped {
    background: #4caf50;
    box-shadow: 0 4px 0 #2d6a4d;
    transform: translateY(4px);
}
.memory-card.matched {
    background: #8bc34a;
    opacity: 0.7;
    cursor: default;
    box-shadow: 0 4px 0 #558b2f;
}
.restart-btn {
    background: #ff4d6d;
    border: none;
    color: white;
    font-weight: 800;
    padding: 15px 30px;
    border-radius: 60px;
    font-size: 1.2rem;
    box-shadow: 0 8px 0 #b3002d;
    cursor: pointer;
    margin-top: 15px;
    width: 100%;
}
.restart-btn:active {
    transform: translateY(5px);
    box-shadow: 0 3px 0 #b3002d;
}

/* Pong */
#pongCanvas {
    background: #111;
    border-radius: 30px;
    border: 4px solid #ffb703;
    width: 100%;
    height: auto;
    max-width: 600px;
    aspect-ratio: 600/400;
}

/* Dart */
#dartCanvas {
    background: #2d1b3c;
    border-radius: 50%;
    border: 4px solid #ffb703;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1/1;
    touch-action: none; /* mobil skrolni oldini olish */
}

/* Dice */
.dice-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
}
.dice {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    box-shadow: 0 10px 0 #ccc;
    color: #333;
}
.controls-info {
    color: #aaa;
    text-align: center;
    margin: 10px 0;
    font-size: 0.9rem;
}
/* Mobil moslashuvni yaxshilash */
body {
    overflow-x: hidden; /* gorizontal skrolni oldini olish */
    width: 100%;
}

.container {
    padding-left: 0;
    padding-right: 0;
}

/* Kichik ekranlarda (320px gacha) kartochkalarni yaxshilash */
@media (max-width: 320px) {
    .game-icon {
        width: 50px;
        height: 50px;
        font-size: 2.5rem;
    }
    .game-title h3 {
        font-size: 1.1rem;
    }
    .ctrl-btn {
        width: 50px;
        height: 50px;
        font-size: 1.7rem;
    }
}