* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #e0f7fa, #4fc3f7);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

h1 {
    color: #0277bd;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    font-size: 2.5rem;
    text-align: center;
}

.game-container {
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    background: url('backgame.png') no-repeat center center;
    background-size: cover;
}

.stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 1px 1px 4px #0008;
}

.memory-game {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 600px;
    perspective: 1000px;
}

.memory-card {
    height: 120px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.memory-card.flip {
    transform: rotateY(180deg);
}

.front-face, .back-face {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 12px;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.front-face {
    background-color: #ffffff;
    transform: rotateY(180deg);
    border: 4px solid #29b6f6;
}

.front-face img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.back-face {
    background-color: #0288d1;
    border: 4px solid #4fc3f7;
}

.back-face img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

button {
    background-color: #0288d1;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background-color 0.3s;
}

button:hover {
    background-color: #0277bd;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(1px);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #e1f5fe, #b3e5fc);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 80%;
    animation: pop 0.5s;
}

@keyframes pop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal h2 {
    color: #01579b;
    margin-bottom: 15px;
    font-size: 2rem;
}

.modal button {
    margin-top: 20px;
    font-size: 1.2rem;
    padding: 12px 25px;
}

.card-flip {
    animation: flip 0.6s ease-out;
}

@keyframes flip {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(180deg); }
}

.card-shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

@keyframes sparkle {
    0% { box-shadow: 0 0 0 rgba(66, 165, 245, 0.7); }
    50% { box-shadow: 0 0 20px rgba(66, 165, 245, 0.9); }
    100% { box-shadow: 0 0 0 rgba(66, 165, 245, 0.7); }
}

.match-found {
    animation: sparkle 1s infinite;
}

.match-glow {
    box-shadow: 0 0 30px 10px #00ff00, 0 0 10px 2px #00ff00 inset !important;
    border-color: #00ff00 !important;
    transition: box-shadow 0.3s, border-color 0.3s;
}

.gold-glow {
    background: linear-gradient(135deg, #fffde4 0%, #ffd700 100%) !important;
    box-shadow: 0 0 40px 10px #ffd700, 0 0 10px 2px #ffd700 inset !important;
    border-color: #ffd700 !important;
    transition: background 0.5s, box-shadow 0.5s, border-color 0.5s;
}

.hide-card {
    visibility: hidden !important;
    opacity: 0 !important;
    transition: opacity 0.5s, visibility 0.5s;
}

/* מותאם למסכים קטנים */
@media (max-width: 600px) {
    .memory-game {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .memory-card {
        height: 100px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
}

/* מותאם למסכים קטנים מאוד */
@media (max-width: 400px) {
    .memory-game {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .memory-card {
        height: 90px;
    }
    
    .stats {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* כפתור מושתק / לא מושתק */
.mute-button {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.mute-button:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.mute-icon, .unmute-icon {
    width: 24px;
    height: 24px;
}

.unmute-icon {
    display: none;
}

/* קלף מוסתר - נעלם באנימציה */
.card-hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
} 