/* English Learning Games Styles */
:root {
    --elg-primary: #4CAF50;
    --elg-secondary: #2196F3;
    --elg-success: #8BC34A;
    --elg-error: #f44336;
    --elg-warning: #FF9800;
    --elg-dark: #333;
    --elg-light: #f5f5f5;
    --elg-white: #fff;
    --elg-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --elg-radius: 12px;
}

/* Container */
.elg-game-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 30px;
    background: var(--elg-white);
    border-radius: var(--elg-radius);
    box-shadow: var(--elg-shadow);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.elg-game-title {
    text-align: center;
    color: var(--elg-dark);
    margin-bottom: 10px;
    font-size: 28px;
}

.elg-game-description {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 16px;
}

/* Score and Timer */
.elg-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--elg-primary), var(--elg-secondary));
    border-radius: var(--elg-radius);
    color: var(--elg-white);
}

.elg-score, .elg-timer {
    font-size: 18px;
    font-weight: bold;
}

.elg-score span, .elg-timer span {
    font-size: 24px;
}

/* Word Matching Game */
.elg-matching-container {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.elg-matching-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 200px;
}

.elg-matching-column h4 {
    text-align: center;
    color: var(--elg-dark);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--elg-primary);
}

.elg-word-card {
    padding: 15px 25px;
    background: var(--elg-light);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 16px;
    user-select: none;
}

.elg-word-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--elg-shadow);
}

.elg-word-card.selected {
    border-color: var(--elg-secondary);
    background: #e3f2fd;
}

.elg-word-card.matched {
    background: var(--elg-success);
    color: var(--elg-white);
    pointer-events: none;
}

.elg-word-card.wrong {
    animation: shake 0.5s ease;
    border-color: var(--elg-error);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Fill in the Blanks */
.elg-fill-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.elg-fill-item {
    padding: 20px;
    background: var(--elg-light);
    border-radius: var(--elg-radius);
    border-left: 4px solid var(--elg-primary);
}

.elg-fill-sentence {
    font-size: 18px;
    margin-bottom: 15px;
    line-height: 1.8;
}

.elg-fill-input {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    min-width: 150px;
    transition: border-color 0.3s;
}

.elg-fill-input:focus {
    outline: none;
    border-color: var(--elg-secondary);
}

.elg-fill-input.correct {
    border-color: var(--elg-success);
    background: #f1f8e9;
}

.elg-fill-input.incorrect {
    border-color: var(--elg-error);
    background: #ffebee;
}

.elg-fill-hint {
    display: block;
    margin-top: 10px;
    color: #666;
    font-style: italic;
}

/* Word Hunt Game */
.elg-hunt-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.elg-hunt-grid {
    display: grid;
    gap: 3px;
    background: var(--elg-dark);
    padding: 3px;
    border-radius: 8px;
}

.elg-hunt-cell {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--elg-white);
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.elg-hunt-cell:hover {
    background: #e3f2fd;
}

.elg-hunt-cell.selected {
    background: var(--elg-secondary);
    color: var(--elg-white);
}

.elg-hunt-cell.found {
    background: var(--elg-success);
    color: var(--elg-white);
}

.elg-hunt-words {
    min-width: 200px;
}

.elg-hunt-words h4 {
    margin-bottom: 15px;
    color: var(--elg-dark);
}

.elg-hunt-word-list {
    list-style: none;
    padding: 0;
}

.elg-hunt-word-list li {
    padding: 10px 15px;
    margin-bottom: 8px;
    background: var(--elg-light);
    border-radius: 6px;
    transition: all 0.3s;
}

.elg-hunt-word-list li.found {
    text-decoration: line-through;
    background: var(--elg-success);
    color: var(--elg-white);
}

/* Flashcards */
.elg-flashcard-container {
    perspective: 1000px;
    margin: 20px auto;
}

.elg-flashcard {
    width: 350px;
    height: 250px;
    margin: 0 auto;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

.elg-flashcard.flipped {
    transform: rotateY(180deg);
}

.elg-flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--elg-radius);
    box-shadow: var(--elg-shadow);
    padding: 20px;
    box-sizing: border-box;
}

.elg-flashcard-front {
    background: linear-gradient(135deg, var(--elg-primary), #66BB6A);
    color: var(--elg-white);
}

.elg-flashcard-back {
    background: linear-gradient(135deg, var(--elg-secondary), #42A5F5);
    color: var(--elg-white);
    transform: rotateY(180deg);
}

.elg-flashcard-word {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 10px;
}

.elg-flashcard-pronunciation {
    font-size: 16px;
    opacity: 0.9;
    font-style: italic;
}

.elg-flashcard-sentence {
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
    opacity: 0.9;
}

.elg-flashcard-hint {
    font-size: 14px;
    margin-top: 20px;
    opacity: 0.8;
}

.elg-flashcard-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.elg-flashcard-progress {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

/* Buttons */
.elg-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.elg-btn-primary {
    background: var(--elg-primary);
    color: var(--elg-white);
}

.elg-btn-primary:hover {
    background: #43A047;
    transform: translateY(-2px);
}

.elg-btn-secondary {
    background: var(--elg-secondary);
    color: var(--elg-white);
}

.elg-btn-secondary:hover {
    background: #1E88E5;
    transform: translateY(-2px);
}

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

/* Game Selection */
.elg-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.elg-game-card {
    background: var(--elg-white);
    border-radius: var(--elg-radius);
    padding: 30px;
    text-align: center;
    box-shadow: var(--elg-shadow);
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.elg-game-card:hover {
    transform: translateY(-5px);
    border-color: var(--elg-primary);
}

.elg-game-card-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.elg-game-card h3 {
    color: var(--elg-dark);
    margin-bottom: 10px;
}

.elg-game-card p {
    color: #666;
    font-size: 14px;
}

/* Results Modal */
.elg-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.elg-modal.active {
    display: flex;
}

.elg-modal-content {
    background: var(--elg-white);
    padding: 40px;
    border-radius: var(--elg-radius);
    text-align: center;
    max-width: 400px;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.elg-modal-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.elg-modal h2 {
    color: var(--elg-dark);
    margin-bottom: 10px;
}

.elg-modal-score {
    font-size: 48px;
    font-weight: bold;
    color: var(--elg-primary);
    margin: 20px 0;
}

.elg-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

/* Responsive */
@media (max-width: 768px) {
    .elg-game-container {
        padding: 15px;
        margin: 10px;
    }

    .elg-matching-container {
        flex-direction: column;
        gap: 20px;
    }

    .elg-hunt-container {
        flex-direction: column;
        align-items: center;
    }

    .elg-flashcard {
        width: 280px;
        height: 200px;
    }

    .elg-flashcard-word {
        font-size: 24px;
    }
}
