@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');

body {
    font-family: 'Montserrat', sans-serif;
    background: #0f172a;
    color: #f8fafc;
    touch-action: manipulation;
    transition: background-color 0.8s ease, box-shadow 0.8s ease;
    overflow-x: hidden;
    min-height: 100vh;
}

body.success-flash { background-color: #064e3b; }
body.glow-3 { box-shadow: inset 0 0 60px rgba(139, 92, 246, 0.3); }
body.glow-5 { box-shadow: inset 0 0 100px rgba(139, 92, 246, 0.5), inset 0 0 40px rgba(59, 130, 246, 0.2); }
body.glow-7 { 
    box-shadow: inset 0 0 150px rgba(139, 92, 246, 0.6), inset 0 0 80px rgba(245, 158, 11, 0.2); 
    background-color: #1e1b4b;
}

.card { perspective: 1000px; cursor: pointer; height: 70px; }
.card-inner {
    position: relative; width: 100%; height: 100%;
    text-align: center; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}
.card.is-flipped .card-inner { transform: rotateY(180deg); }
.card-front, .card-back {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden; display: flex; align-items: center;
    justify-content: center; padding: 8px; border-radius: 12px;
    font-weight: 600; font-size: 0.85rem; transition: all 0.4s ease;
    word-break: break-word;
}

.card-lang-ru .card-back { background: #1e293b; border: 2px solid #334155; color: #94a3b8; }
.card-lang-ru .card-front { background: #3b82f6; color: white; transform: rotateY(180deg); }
.card-lang-ru.active-selection .card-front { ring: 3px solid #fbbf24; box-shadow: 0 0 20px rgba(251, 191, 36, 0.4); }

.card-lang-el .card-back { background: #1e293b; border: 2px solid #334155; color: #94a3b8; }
.card-lang-el .card-front { background: #6366f1; color: white; transform: rotateY(180deg); }

.card.matched .card-front { background: #10b981 !important; box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
.card.wrong .card-front { background: #ef4444 !important; box-shadow: 0 0 15px rgba(239, 68, 68, 0.6); }

/* Preview state (before start) */
.preview-mode .card-inner { transform: rotateY(180deg) !important; }

#game-board-container { transition: opacity 0.5s ease; }
.is-locked #game-board-container { opacity: 0.7; }

.mode-toggle {
    display: flex; background: #1e293b; padding: 4px; border-radius: 12px; border: 1px solid #334155;
}
.mode-btn {
    padding: 6px 16px; border-radius: 8px; font-size: 0.75rem; font-weight: 700;
    transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 0.05em;
}
.mode-btn.active { background: #3b82f6; color: white; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }
.mode-btn:not(.active) { color: #64748b; }

@media (max-width: 640px) {
    #game-controls {
        flex-direction: column;
        align-items: stretch;
    }

    #game-controls > div {
        width: 100%;
        justify-content: space-between;
    }

    .card {
        height: auto;
        min-height: 72px;
    }

    .card-front, .card-back {
        font-size: 0.8rem;
        padding: 6px;
    }
}