body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
}

.container {
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    color: #333;
}

#menu {
    margin: 20px 0;
}

#gameBoard {
    display: grid;
    gap: 6px;
    margin: 20px auto;
    justify-content: center;
}

.card {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0;
    color: white;
    cursor: pointer;
    position: relative;
    transition: transform 0.5s;
}

.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.5s;
    transform-style: preserve-3d;
    position: absolute;
    top: 0;
    left: 0;
}

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

.card-front, .card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
}

.card-front {
    background-color: #007bff;
}

.card-back {
    background-color: #28a745;
    font-size: 18px;
    transform: rotateY(180deg);
}

.card.matched .card-front, .card.matched .card-back {
    background-color: #6c757d;
}

.card.shuffle-highlight {
    border: 4px solid #800080;
    box-shadow: 0 0 15px #800080, 0 0 5px #ffffff inset;
    transform: scale(1.1);
    animation: blink 0.5s infinite alternate;
}

@keyframes blink {
    0% { opacity: 1; }
    100% { opacity: 0.7; }
}

#countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    color: #ff4500;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

#startOverlay, #matchOverlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-10deg);
    font-size: 80px;
    color: #ffd700;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7), -3px -3px 6px rgba(0, 0, 0, 0.7);
    font-weight: bold;
    z-index: 1000;
    animation: fadeOut 1s ease-out forwards;
}

#comboOverlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(15deg);
    font-size: 90px;
    color: #800080;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.8), -4px -4px 8px rgba(0, 0, 0, 0.8);
    font-weight: bold;
    z-index: 1000;
    animation: comboPulse 1s ease-out forwards;
}

#shuffleOverlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-5deg);
    font-size: 90px;
    color: #00ff00;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.8), -4px -4px 8px rgba(0, 0, 0, 0.8);
    font-weight: bold;
    z-index: 1000;
    animation: comboPulse 1s ease-out forwards;
}

#clearOverlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(10deg);
    font-size: 120px;
    color: #ff4500;
    text-shadow: 5px 5px 10px rgba(0, 0, 0, 0.9), -5px -5px 10px rgba(0, 0, 0, 0.9);
    font-weight: bold;
    z-index: 1000;
    animation: superPulse 2s ease-out forwards;
}

@keyframes fadeOut {
    0% { opacity: 1; transform: translate(-50%, -50%) rotate(-10deg) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(1.5); }
}

@keyframes comboPulse {
    0% { opacity: 1; transform: translate(-50%, -50%) rotate(15deg) scale(1); }
    50% { opacity: 0.7; transform: translate(-50%, -50%) rotate(15deg) scale(1.4); }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(15deg) scale(1.8); }
}

@keyframes superPulse {
    0% { opacity: 1; transform: translate(-50%, -50%) rotate(10deg) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) rotate(10deg) scale(1.5); }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(10deg) scale(2); }
}

#message {
    font-size: 18px;
    color: #333;
    margin: 10px 0;
}

#score, #highScore {
    font-size: 16px;
    color: #555;
    margin: 5px 0;
}

#startButton, #resetButton {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 5px;
}

#startButton:hover, #resetButton:hover {
    background-color: #c82333;
}

select {
    padding: 5px;
    font-size: 16px;
    margin-right: 10px;
}