/* Match Game Styles */

.game-ui {
    position: absolute;
    top: 1vh;
    right: 1vw;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 2%;
    border-radius: 3%;
    font-family: Arial, sans-serif;
    width: 18vw;
    height: 50vh;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1vw;
    box-sizing: border-box;
    cursor: move;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.score-display {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5%;
    padding-bottom: 4%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex: 0 0 auto;
}

.matches-score, .moves-score {
    text-align: center;
    flex: 1;
}

.score-display .label {
    display: block;
    font-size: 0.8em;
    color: #ccc;
    margin-bottom: 2%;
}

.score-display .score {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: #4CAF50;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 3%;
    margin-bottom: 5%;
    flex: 1;
}

.game-btn {
    padding: 4% 6%;
    border: none;
    border-radius: 3%;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
    min-height: 8%;
}

.game-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-btn:active:not(:disabled) {
    transform: translateY(0);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#start-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

#start-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049, #3d8b40);
}

#shuffle-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

#shuffle-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1976D2, #1565C0);
}

#hint-btn {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

#hint-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #F57C00, #EF6C00);
}

#new-game-btn {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    color: white;
}

#new-game-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #7B1FA2, #6A1B9A);
}

.game-status {
    background: rgba(255, 255, 255, 0.1);
    padding: 4%;
    border-radius: 3%;
    text-align: center;
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 5%;
    min-height: 15%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex: 0 0 auto;
}

.timer-display {
    text-align: center;
    padding: 3%;
    background: rgba(0, 150, 255, 0.1);
    border-radius: 3%;
    border: 1px solid rgba(0, 150, 255, 0.3);
    flex: 0 0 auto;
}

.timer-display .label {
    font-size: 0.7em;
    color: #87CEEB;
}

#timer {
    font-size: 1em;
    font-weight: bold;
    color: #87CEEB;
}

/* Match Game Grid */
.match-grid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

/* Card animations for match game */
.card.matched {
    animation: matchSuccess 0.8s ease;
    pointer-events: none;
}

.card.wrong-match {
    animation: wrongMatch 0.6s ease;
}

.card.flipping {
    pointer-events: none;
}

@keyframes matchSuccess {
    0% { transform: scale(1); }
    50% { 
        transform: scale(1.2);
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
        border: 3px solid #4CAF50;
    }
    100% { 
        transform: scale(1.1);
        opacity: 0.7;
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
    }
}

@keyframes wrongMatch {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

/* Responsive design */
@media (max-width: 768px) {
    .game-ui {
        position: fixed;
        top: auto;
        bottom: 2vh;
        right: 2vw;
        left: 2vw;
        width: auto;
        height: 22vh;
    }

    .score-display {
        flex-direction: column;
        gap: 3%;
    }

    .game-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2%;
    }

    .game-btn {
        flex: 1;
        min-width: 20%;
        padding: 3% 4%;
        font-size: 1em;
    }

    .match-grid {
        gap: 10px;
        padding: 15px;
    }
}

/* Game state specific styling */
.game-won .game-status {
    background: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.4);
    color: #ccffcc;
    animation: pulse 2s infinite;
}

.game-active .game-status {
    background: rgba(0, 150, 255, 0.2);
    border-color: rgba(0, 150, 255, 0.4);
    color: #cceeff;
}

/* Loading state */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
