* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #E6D6F2 0%, #C8A2C8 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(127, 0, 255, 0.2);
    padding: 30px 20px;
    text-align: center;
}

.game-header {
    margin-bottom: 30px;
}

.game-header h1 {
    color: #7F00FF;
    font-size: 2.5em;
    margin-bottom: 15px;
    font-weight: bold;
}

.score-board {
    background: #E6D6F2;
    padding: 15px;
    border-radius: 10px;
    display: inline-block;
}

.score-board p {
    color: #7F00FF;
    font-size: 1.2em;
    font-weight: bold;
}

#moves {
    font-weight: bold;
    color: #7F00FF;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 30px 0;
    perspective: 1000px;
}

.card {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: scale(1.05);
}

.card.flipped {
    pointer-events: none;
}

.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;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 2.5em;
    font-weight: bold;
}

.card-front {
    background: linear-gradient(135deg, #C8A2C8, #7F00FF);
    color: white;
    border: 2px solid #7F00FF;
}

.card-front::after {
    content: '?';
    font-size: 2.5em;
}

.card-back {
    background: #FFFFFF;
    color: #333;
    border: 2px solid #C8A2C8;
    transform: rotateY(180deg);
}

.game-status {
    min-height: 60px;
    margin: 20px 0;
}

.win-message {
    background: #E6D6F2;
    padding: 20px;
    border-radius: 10px;
    animation: slideIn 0.5s ease;
}

.win-message h2 {
    color: #7F00FF;
    font-size: 1.8em;
    margin-bottom: 10px;
}

.win-message p {
    color: #C8A2C8;
    font-size: 1.1em;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.restart-btn {
    background: linear-gradient(135deg, #7F00FF, #C8A2C8);
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(127, 0, 255, 0.3);
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 0, 255, 0.4);
}

.restart-btn:active {
    transform: translateY(0);
}

/* Start Screen */
.start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 200px;
}

.start-text {
    font-size: 1.5em;
    color: #7F00FF;
    font-weight: bold;
}

.start-btn {
    background: linear-gradient(135deg, #7F00FF, #C8A2C8);
    color: white;
    border: none;
    padding: 15px 50px;
    font-size: 1.3em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(127, 0, 255, 0.3);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(127, 0, 255, 0.4);
}

.start-btn:active {
    transform: translateY(0);
}

/* Difficulty Section */
.difficulty-section {
    margin: 20px 0;
}

.difficulty-section p {
    color: #7F00FF;
    font-size: 1em;
    font-weight: bold;
    margin-bottom: 10px;
}

.difficulty-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.diff-btn {
    background: #E6D6F2;
    color: #7F00FF;
    border: 2px solid #C8A2C8;
    padding: 8px 15px;
    font-size: 0.95em;
    font-weight: bold;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.diff-btn:hover {
    background: #C8A2C8;
    color: white;
    transform: translateY(-2px);
}

.diff-btn.active {
    background: #7F00FF;
    color: white;
    border-color: #7F00FF;
}

/* Stats Board */
.stats-board {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.score-board,
.timer-board,
.best-score-board {
    background: #E6D6F2;
    padding: 12px 20px;
    border-radius: 10px;
    display: inline-block;
    min-width: 100px;
}

.score-board p,
.timer-board p,
.best-score-board p {
    color: #7F00FF;
    font-size: 1em;
    font-weight: bold;
    margin: 0;
}

#moves,
#timer,
#bestScore {
    font-weight: bold;
    color: #7F00FF;
}

/* Win Details */
#winDetails {
    color: #C8A2C8;
    font-size: 1.1em;
    margin-top: 10px;
}

#winDetails p {
    margin: 5px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 20px 15px;
    }

    .game-header h1 {
        font-size: 2em;
    }

    .difficulty-buttons {
        gap: 6px;
    }

    .diff-btn {
        padding: 7px 12px;
        font-size: 0.85em;
    }

    .stats-board {
        gap: 8px;
    }

    .score-board,
    .timer-board,
    .best-score-board {
        padding: 10px 15px;
        font-size: 0.95em;
    }

    .game-board {
        gap: 12px;
    }

    .card-front::after,
    .card-back {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px 10px;
    }

    .game-header h1 {
        font-size: 1.6em;
        margin-bottom: 10px;
    }

    .difficulty-section p {
        font-size: 0.9em;
        margin-bottom: 8px;
    }

    .difficulty-buttons {
        gap: 5px;
    }

    .diff-btn {
        padding: 6px 10px;
        font-size: 0.75em;
    }

    .stats-board {
        gap: 6px;
        margin-top: 10px;
    }

    .score-board,
    .timer-board,
    .best-score-board {
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .score-board p,
    .timer-board p,
    .best-score-board p {
        font-size: 0.9em;
    }

    .game-board {
        gap: 10px;
        margin: 20px 0;
    }

    .card-front::after,
    .card-back {
        font-size: 1.5em;
    }

    .restart-btn {
        padding: 10px 30px;
        font-size: 1em;
    }

    .win-message h2 {
        font-size: 1.4em;
    }

    #winDetails {
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    .start-text {
        font-size: 1.2em;
    }

    .start-btn {
        padding: 12px 40px;
        font-size: 1.1em;
    }
}

@media (max-width: 360px) {
    .game-header h1 {
        font-size: 1.4em;
    }

    .card-front::after,
    .card-back {
        font-size: 1.2em;
    }

    .start-text {
        font-size: 1.1em;
    }

    .start-btn {
        padding: 10px 30px;
        font-size: 1em;
    }
}
