body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    user-select: none;
    padding: 20px;
}

.container {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 25px;
    background: linear-gradient(
        325deg,
        #6e45e2 0%,
        #88d3ce 50%,
        #fad0c4 100%
    );
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 500px;
    border: 5px solid #ff9a9e;
}

h2 {
    font-size: 2.2em;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    text-shadow: 2px 2px 0 #ff6b6b, 4px 4px 0 rgba(0,0,0,0.15);
    margin-bottom: 10px;
}

.reset {
    padding: 14px 18px;
    width: 100%;
    color: white;
    background-color: #ff6b6b;
    border: none;
    font-size: 1.2em;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    font-weight: 700;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 0 #ff4757;
}

.reset:hover {
    background-color: #ff8e8e;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #ff4757;
}

.reset:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #ff4757;
}

.reset:focus {
    color: #fff;
    background-color: #ff5252;
}

.game {
    text-decoration: none;
    width: 100%;
    max-width: 430px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    transform-style: preserve-3d;
    perspective: 500px;
    justify-content: center;
}

.item {
    position: relative;
    width: calc(25% - 10px);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffd166;
    font-size: 2.2em;
    transform: rotateY(180deg);
    transition: 0.4s;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #06d6a0;
    background-image: radial-gradient(circle, #06d6a0 20%, #04a57a 80%);
    transition: 0.4s;
    transform: rotateY(0deg);
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.item.boxOpen {
    transform: rotateY(0deg);
    background-color: #ff9e6b;
}

.boxOpen::after,
.boxMatch::after {
    transform: rotateY(180deg);
}

.item.boxMatch {
    background-color: #118ab2;
    box-shadow: 0 0 15px #06d6a0;
}

.win-message {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 99; /* Reduzido para não cobrir o botão */
    color: #118ab2;
    text-align: center;
}

.win-content {
    background: rgba(255, 214, 102, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    backdrop-filter: blur(5px);
    border: 3px solid #ff6b6b;
}

.win-message h2 {
    color: #ef476f;
    font-size: 2.5em;
    margin-bottom: 20px;
}

.win-message p {
    color: #073b4c;
    font-size: 1.2em;
    margin-top: 10px;
}

.win-message.show {
    display: flex;
    animation: fadeIn 0.5s ease;
}


@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confetti {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: #f5a623;
    opacity: 0.7;
    border-radius: 0;
    animation: confetti-fall 5s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Media Queries para responsividade */
@media screen and (max-width: 500px) {
    body {
        padding: 15px;
        align-items: flex-start;
        padding-top: 30px;
    }
    
    .container {
        padding: 20px 15px;
        gap: 20px;
        border-width: 3px;
    }

    h2 {
        font-size: 1.8em;
        text-shadow: 2px 2px 0 #ff6b6b;
    }
    
    .reset {
        padding: 12px 16px;
        font-size: 1.1em;
    }
    
    .game {
        gap: 8px;
    }
    
    .item {
        width: calc(25% - 8px);
        font-size: 1.8em;
        border-radius: 10px;
    }
    
    .win-message h2 {
        font-size: 2em;
    }
    
    .win-message p {
        font-size: 1em;
    }
}

@media screen and (max-width: 380px) {
    h2 {
        font-size: 1.5em;
    }
    
    .reset {
        font-size: 1em;
        padding: 10px 14px;
    }
    
    .item {
        font-size: 1.5em;
    }
}

@media screen and (max-width: 320px) {
    .container {
        padding: 15px 10px;
    }
    
    h2 {
        font-size: 1.3em;
    }
    
    .game {
        gap: 6px;
    }
    
    .item {
        width: calc(25% - 6px);
        font-size: 1.3em;
    }
}

/* Animações extras */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-20px);}
    60% {transform: translateY(-10px);}
}

.bounce {
    animation: bounce 1s;
}
.footer {
    width: 100%;
    margin-top: 20px;
    text-align: center;
    font-size: 1.5em;
    color: #fff;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.footer a {
    color: #ffd166;
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    color: #ff6b6b;
    text-decoration: underline;
}
