/* Base Styles */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f8ff;
    margin: 0;
    padding: 0;
    color: #000;
}

header {
    background-color: #ffffff;
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

nav h1 {
    font-size: 2em;
    color: #ff4500;
    text-shadow: 1px 1px 0 #ffa07a;
    margin: 0;
}

.nav-right {
    display: flex;
    align-items: center;
}

.nav-right p {
    margin: 0;
    margin-right: 15px;
}

.nav-right a {
    color: #007BFF;
    text-decoration: none;
}

.nav-right a:hover {
    text-decoration: underline;
}

/* Dark Mode Toggle Button Styles */
#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    padding: 5px;
    margin-left: 10px;
    color: #ff4500;
    transition: color 0.3s;
}

#theme-toggle .icon {
    display: inline-block;
    transition: transform 0.3s;
}

#theme-toggle:hover .icon {
    transform: rotate(20deg);
}

/* Main Content Styles */
main {
    padding: 20px;
    text-align: center;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(4, 100px);
    grid-gap: 15px;
    justify-content: center;
    margin: 20px auto;
}

.card {
    width: 100px;
    height: 100px;
    background-color: #7fffd4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    cursor: pointer;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    transition: transform 0.2s, background-color 0.2s;
}

.card:hover {
    transform: scale(1.05);
}

.card.flipped, .card.matched {
    background-color: #fff;
    transform: scale(1.05);
}

h2 {
    margin-top: 30px;
}

#candy-salad {
    margin-top: 20px;
    min-height: 50px;
    border: 2px dashed #ff4500;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    background-color: #fafad2;
    border-radius: 10px;
}

#candy-salad span {
    font-size: 2em;
    margin: 5px;
    transition: transform 0.3s;
}

#candy-salad span:hover {
    transform: rotate(20deg);
}

#win-message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    background-color: #ffebcd;
    border: 2px solid #ff4500;
    border-radius: 10px;
    z-index: 1000;
}

#win-message p {
    font-size: 1.5em;
    color: #ff4500;
    margin-bottom: 10px;
}

#win-message button {
    padding: 10px 20px;
    font-size: 1.2em;
    color: #fff;
    background-color: #ff4500;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin: 5px;
}

#win-message button:hover {
    background-color: #e14000;
}

#total-games {
    margin-top: 20px;
    font-size: 1.2em;
    color: #ff4500;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #121212;
    color: #ffffff;
}

body.dark-mode header {
    background-color: #1e1e1e;
    box-shadow: none;
}

body.dark-mode nav h1 {
    color: #ff8c00;
    text-shadow: 1px 1px 0 #ffa07a;
}

body.dark-mode .nav-right a {
    color: #80bfff;
}

body.dark-mode .nav-right a:hover {
    color: #b3d9ff;
}

body.dark-mode #theme-toggle {
    color: #ff8c00;
}

body.dark-mode #game-board .card {
    background-color: #1e1e1e;
    color: #ffffff;
}

body.dark-mode .card.flipped, body.dark-mode .card.matched {
    background-color: #333333;
}

body.dark-mode h2 {
    color: #ffffff;
}

body.dark-mode #candy-salad {
    background-color: #1e1e1e;
    border-color: #ff8c00;
}

body.dark-mode #win-message {
    background-color: #2e2e2e;
    border-color: #ff8c00;
}

body.dark-mode #win-message p {
    color: #ff8c00;
}

body.dark-mode #win-message button {
    background-color: #ff8c00;
}

body.dark-mode #win-message button:hover {
    background-color: #e07b00;
}

body.dark-mode #total-games {
    color: #ff8c00;
}

@media (max-width: 600px) {
    #game-board {
        grid-template-columns: repeat(4, 80px);
    }

    .card {
        width: 80px;
        height: 80px;
    }

    #candy-salad span {
        font-size: 1.5em;
    }

    nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-right {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }

    .nav-right p {
        margin-right: 0;
    }
}
