@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@600;800&display=swap');

:root {
    --primary-blue: #6366f1;
    --primary-red: #ff5a5f;
    --primary-green: #5cb85c;
    --bg: #f8fafc;
}

html, body {
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Remove horizontal scroll */
    background: var(--bg);
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    flex-direction: column;
}

/* NAVBAR & SEARCH LOGIC */
.navbar {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    height: 70px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.logo { font-weight: 800; font-size: 1.5rem; color: #1e293b; white-space: nowrap; }
.logo span { color: var(--primary-blue); }

.search-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    transition: all 0.3s ease;
}

.search-toggle {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 10px;
    z-index: 10;
}

.search-input-container {
    width: 250px;
    overflow: hidden;
    transition: width 0.3s ease;
}

#gameSearch {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
}

/* MOBILE SEARCH OVERRIDE */
@media (max-width: 800px) {
    body { overflow-y: auto; height: auto; }
    
    .search-input-container {
        width: 0px; /* Hidden by default on mobile */
    }
    
    .search-wrapper.active {
        position: absolute;
        right: 5%;
        left: 5%;
        background: white;
        justify-content: space-between;
    }
    
    .search-wrapper.active .search-input-container {
        width: 100%;
        margin-left: 10px;
    }

    .game-container {
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto !important;
        padding: 15px !important;
        width: 100%;
        box-sizing: border-box;
    }
}

/* GRID LAYOUT */
.game-container {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px;
    padding: 20px 5%;
    box-sizing: border-box;
}

.game-card {
    background: #fff;
    border-radius: 20px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.game-emoji { font-size: 3rem; margin-bottom: 5px; }
.grayscale { filter: grayscale(100%); opacity: 0.4; }
.price-pill { background: #fef3c7; color: #92400e; font-size: 0.65rem; padding: 4px 10px; border-radius: 20px; margin: 8px 0; }

.play-btn, .unlock-btn { width: 100%; padding: 12px; border-radius: 14px; border: none; font-weight: 800; cursor: pointer; }
.play-btn { background: var(--primary-green); color: white; }
.unlock-btn { background: var(--primary-red); color: white; }

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 30px;
    max-width: 90%;
    width: 400px;
    text-align: center;
}

.modal-footer { display: flex; flex-direction: column; gap: 10px; margin-top: 25px; }
.btn-primary { background: var(--primary-red); color: white; padding: 15px; border-radius: 15px; border: none; font-weight: 800; cursor: pointer; }
.btn-secondary { background: #f1f5f9; color: #64748b; padding: 15px; border-radius: 15px; border: none; font-weight: 800; cursor: pointer; }