:root {
    --bg-color: #0d0914;
    --primary: #9d4edd;
    --secondary: #7b2cbf;
    --black: #000;
    --text: #f8f9fa;
    --border: 1px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 20px;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.back-btn {
    background: transparent;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: 10px 20px;
    border: var(--border) solid var(--primary);
    border-radius: 4px;
    transition: 0.2s;
}
.back-btn:hover {
    background: rgba(123, 44, 191, 0.2);
    color: var(--text);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hud {
    display: flex;
    gap: 40px;
    background: #110c1b;
    padding: 15px 30px;
    border: var(--border) solid var(--secondary);
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.2);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 40px;
    color: var(--text);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 120px);
    grid-template-rows: repeat(4, 120px);
    gap: 20px;
    perspective: 1000px;
}

.card {
    width: 120px;
    height: 120px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card:hover .front {
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.5);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    transform: rotateY(180deg) scale(0.85);
    opacity: 0.4;
    filter: grayscale(80%);
    pointer-events: none;
}

.card.matched .back {
    border-color: #00fa9a;
    background: rgba(0, 250, 154, 0.1);
}

.front, .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    border: var(--border) solid var(--secondary);
    border-radius: 4px;
}

.front {
    background: #110c1b;
    color: var(--text);
    z-index: 2;
    transform: rotateY(0deg);
    transition: 0.2s;
}
.front::after {
    content: "📄";
    font-size: 2.5rem;
}

.back {
    background: rgba(123, 44, 191, 0.1);
    transform: rotateY(180deg);
}

#win-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(13, 9, 20, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.win-box {
    background: #110c1b;
    border: var(--border) solid var(--secondary);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.4);
    padding: 50px;
    text-align: center;
}

.win-box h2 {
    font-size: 2.5rem;
    margin: 0 0 20px 0;
    color: var(--text);
    letter-spacing: 2px;
}

.win-box p {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 30px;
    color: var(--primary);
}

.btn {
    background: transparent;
    color: var(--primary);
    border: var(--border) solid var(--primary);
    border-radius: 4px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: 0.2s;
}

.btn:hover {
    background: rgba(123, 44, 191, 0.2);
    color: var(--text);
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(4, 80px);
        grid-template-rows: repeat(4, 80px);
        gap: 10px;
    }
    .card {
        width: 80px;
        height: 80px;
    }
    .front, .back {
        font-size: 2.5rem;
    }
    .front::after {
        font-size: 1.5rem;
    }
    .hud {
        gap: 20px;
        padding: 10px 20px;
        font-size: 1rem;
    }
}
