body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    color: #121213;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

header {
    width: 100%;
    max-width: 500px;
    border-bottom: 1px solid #3a3a3c;
    padding: 12px 0;
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 0.2rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

.stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #555;
    font-weight: 600;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: 100%;
    perspective: 1000px;
}

.card {
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.4s ease;
}

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

.card.matched .card-front {
    background-color: #538d4e;
    color: white;
}

.card.free-space .card-front {
    background-color: #bcbcbc;
    color: #2f2f2f;
}

.card.free-space {
    cursor: default;
    pointer-events: none;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.card-front {
    background-color: #fff;
    transform: rotateY(180deg);
}

.card-back {
    background-color: #eee;
}

.restart-button {
    margin-top: 24px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.restart-button:hover {
    background-color: #27ae60;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.restart-button:active {
    transform: translateY(1px);
}

.restart-button:focus-visible {
    outline: 3px solid rgba(46, 204, 113, 0.35);
    outline-offset: 2px;
}

.message {
    position: fixed;
    top: 20px;
    background-color: #333;
    color: #ffffff;
    padding: 16px 32px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
    text-align: center;
}

.message.show {
    opacity: 1;
}

.message.win {
    background-color: #538d4e;
    color: #ffffff;
}

/* Sidenav alignment with other pages */
#current-page {
    color: #246daf;
}

.sidenav {
    width: 200px;
    position: fixed;
    z-index: 1;
    top: 20px;
    left: 20px;
    background: #eee;
    overflow-x: hidden;
    padding: 8px 0;
}

.sidenav a {
    padding: 6px 8px 6px 16px;
    text-decoration: none;
    font-size: 19px;
    color: #2196F3;
    display: block;
}

.sidenav a:hover {
    color: #064579;
}
