body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh; /* Vollständige Höhe des Viewports */
}

h1 {
    margin: 10px 0;
    font-size: 2rem;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Genau 4 Spalten */
    gap: 10px; /* Abstand zwischen den Karten */
    width: 90vw; /* 90% der Bildschirmbreite */
    height: 90vh; /* 90% der Bildschirmhöhe */
    max-width: 1200px; /* Maximale Breite */
    max-height: 800px; /* Maximale Höhe */
    justify-content: center; /* Zentriert das Grid horizontal */
    align-content: center; /* Zentriert das Grid vertikal */
}

.card {
    position: relative;
    width: 100%;
    height: calc((90vh - 50px) / 4); /* Dynamische Kartengröße basierend auf der Spielfeldhöhe */
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: linear-gradient(45deg, #4a90e2, #145af1); /* Kontrastreiche Rückseite */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    transition: transform 0.3s;
}

.card.flipped img {
    transform: rotateY(0deg);
}

.card.flipped {
    background: #fff;
}

#win-message {
    display: none;
    margin: 20px;
    padding: 20px;
    background-color: #d4edda;
    border: 2px solid #c3e6cb;
    border-radius: 10px;
    font-size: 1.5rem;
    text-align: center;
}

#win-message.hidden {
    display: none;
}

#restart-button {
    padding: 10px 20px;
    font-size: 16px;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

#restart-button:hover {
    background-color: #218838;
}
