:root {
    --bg-color: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-hover: rgba(255, 255, 255, 0.15);
    --text-color: #f8fafc;
    --accent-color: #38bdf8;
    --correct-color: #4ade80;
    --wrong-color: #f87171;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-color);
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 900px;
    width: 95%;
    margin: 2rem auto 1rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@media (min-width: 768px) {
    .container {
        flex-direction: row;
        align-items: stretch;
        padding: 3rem;
    }
}

.game-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #38bdf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -1px;
}

.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 420px;
    margin-bottom: 2rem;
}

.card {
    aspect-ratio: 1;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    font-size: clamp(2rem, 8vw, 3rem);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    color: transparent;
}

.card:hover:not(:disabled) {
    background: var(--card-hover);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.card:disabled {
    cursor: default;
    background: rgba(255, 255, 255, 0.1);
    color: white; /* Make content visible */
}

.card.matched {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.4);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.2);
}

.emoji-reveal {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.stats-section {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .stats-section {
        flex-direction: column;
        width: 220px;
        justify-content: center;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        padding-left: 3rem;
        margin-left: 1rem;
    }
}

.stat-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.2rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 110px;
    flex: 1;
    transition: transform 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 0.85rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-color);
    text-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.reset-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    font-family: inherit;
}

.reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5);
    background: linear-gradient(135deg, #7dd3fc, #3b82f6);
}

footer {
    padding: 1rem;
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 1rem;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #7dd3fc;
    text-decoration: underline;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

.wrong {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    background: rgba(248, 113, 113, 0.15) !important;
    border-color: rgba(248, 113, 113, 0.4) !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.victory-text {
    animation: pulse 2s infinite ease-in-out;
    color: #4ade80 !important;
    text-shadow: 0 0 15px rgba(74, 222, 128, 0.5) !important;
}