  /* Reset globalnych stylów */
  * {
    box-sizing: border-box;
}
body {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #f6d365, #fda085);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #333;
}
/* Przycisk powrotu do gier */
#back-link {
    position: absolute;
    top: 20px;
    left: 20px;
}
#back-link a {
    text-decoration: none;
    color: #fff;
    font-size: 1.2rem;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    transition: background 0.3s, transform 0.3s;
}
#back-link a:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.05);
}
h1 {
    margin-bottom: 20px;
    font-size: 2.5rem;
    font-weight: 600;
}
/* Ekran wyboru poziomu */
#level-select-screen,
#game-screen {
    background: rgba(255, 255, 255, 0.15);
    padding: 30px 40px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
    margin-top: 80px;
}
.level-select button,
#game-screen button {
    background-color: #fff;
    color: #333;
    border: none;
    padding: 10px 20px;
    margin: 10px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}
.level-select button:hover,
#game-screen button:hover {
    background-color: #f0f0f0;
    transform: scale(1.05);
}
.stats {
    margin: 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}
/* Plansza gry */
.game-board {
    display: grid;
    gap: 12px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    margin-bottom: 20px;
}
/* Karty */
.card {
    width: 80px;
    height: 80px;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
}
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.card.flipped .card-inner {
    transform: rotateY(180deg);
}
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 600;
    background-size: cover;
    background-position: center;
    padding: 10px;
}
.card-front {
    background: linear-gradient(135deg, rgba(255,154,158,0.9), rgba(250,208,196,0.9));
    display: flex;
    justify-content: center;
    align-items: center;
}
.card-front img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}
.card-back {
    background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
    color: #fff;
    transform: rotateY(180deg);
    display: flex;
    justify-content: center;
    align-items: center;
}
.card.matched .card-back {
    background: none;
}
/* Tło planszy po zakończeniu gry */
#game.full-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
        margin: 15px 0;
    }
    
    #level-select-screen,
    #game-screen {
        padding: 25px 30px;
        margin: 15px;
        width: 95%;
    }
    
    .game-board {
        gap: 12px;
        padding: 20px;
    }
    
    .card {
        width: 80px;
        height: 80px;
    }
    
    .level-select button,
    #game-screen button {
        padding: 12px 20px;
        margin: 10px;
        font-size: 1.1rem;
    }
    
    .stats {
        font-size: 1.3rem;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
        letter-spacing: 1px;
    }
    
    #back-link a {
        font-size: 1rem;
        padding: 8px 15px;
    }
    
    #level-select-screen,
    #game-screen {
        padding: 20px 15px;
        border-radius: 15px;
    }
    
    .game-board {
        gap: 8px;
        padding: 15px;
    }
    
    .card {
        width: 65px;
        height: 65px;
    }
    
    .card-front,
    .card-back {
        font-size: 1.8rem;
        border-radius: 8px;
    }
    
    .level-select button,
    #game-screen button {
        padding: 10px 15px;
        font-size: 1rem;
        margin: 8px;
        width: 100%;
        max-width: 200px;
    }
    
    .stats {
        font-size: 1.1rem;
    }
}

@media (max-width: 360px) {
    .card {
        width: 55px;
        height: 55px;
    }
    
    .game-board {
        gap: 6px;
        padding: 10px;
    }
    
    .card-front,
    .card-back {
        font-size: 1.5rem;
    }
}