body {
    font-family: Arial;
    background: #f4f4ff;
    margin: 0;
    padding: 20px;
    text-align: center;
}

#back-home {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #4a90e2;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 20px;
    z-index: 999;
}

#title {
    margin-top: 50px;
    font-size: 28px;
}

#grid {
    margin: 30px auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 400px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 18px 8px;
    border: 2px solid #ccc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    user-select: none;
}

.card.selected {
    border-color: #4a90e2;
    background: #e7efff;
}

.card.correct {
    background: #c6ffcc !important;
    border-color: #22c55e !important;
    cursor: default;
}

.card.wrong {
    background: #ffd5d5 !important;
    border-color: #ff4a4a !important;
}

.hidden {
    display: none;
}

.btn {
    display: inline-block;
    padding: 12px 18px;
    background: #4a90e2;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    margin-top: 10px;
}

/* Timer + Score Row */
#top-row {
    display: flex;
    justify-content: space-between;
    margin: 15px auto;
    max-width: 400px;
    font-size: 20px;
    font-weight: bold;
}

/* tap scale animation */
.card.tap {
    transform: scale(1.06);
}

/* correct — smooth green fade */
.card.correct {
    animation: correctAnim 0.4s forwards;
}

@keyframes correctAnim {
    0% { background: #e0ffe4; }
    100% { background: #c6ffcc; border-color: #22c55e; }
}

/* wrong — shake animation */
.card.wrong {
    animation: shake 0.3s ease;
    background: #ffd5d5;
    border-color: #ff4a4a;
}

@keyframes shake {
    0% { transform: translateX(0px); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0px); }
}
