* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    width: 100%;
    touch-action: manipulation;
}

.container {
    max-width: 900px;
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    padding: 10px;
}

header {
    display: none;
}

h1 {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 60px;
}

.stat-label {
    color: #666;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: #333;
    font-size: 1.1rem;
    font-weight: bold;
}

.btn-restart {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    border: none;
    padding: 12px;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
    touch-action: manipulation;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.btn-restart:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    max-width: min(90vw, 600px);
    width: 100%;
    aspect-ratio: 1;
}

.card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.card:active {
    transform: scale(0.95);
}

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

.card.flipped:active {
    transform: rotateY(180deg) scale(0.95);
}

.card.matched {
    cursor: default;
    animation: matchAnimation 0.6s ease;
}

@keyframes matchAnimation {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

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

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: clamp(1.5rem, 8vw, 3rem);
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Modal de Vitória - oculto */
.modal {
    display: none !important;
}

/* Responsividade */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }

    .game-board {
        gap: 8px;
        padding: 12px;
    }

    .btn-restart {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 6px;
    }

    .game-board {
        gap: 6px;
        padding: 10px;
        border-radius: 15px;
    }

    .card {
        border-radius: 6px;
    }

    .card-front,
    .card-back {
        border-radius: 6px;
    }

    .btn-restart {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        top: 10px;
        right: 10px;
    }
}

