/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 900px;
    width: 100%;
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 30px;
    text-align: center;
    color: white;
}

.header h1 {
    font-size: 3em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 10px;
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Score Board */
.score-board {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe8a1 100%);
    padding: 15px 20px;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: #856404;
    border-bottom: 3px solid #ffc107;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Topic Selector */
.topic-selector {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 16px 20px;
    text-align: center;
    border-bottom: 3px solid #0f3460;
}

.topic-label {
    color: #a0aec0;
    font-size: 0.85em;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.topic-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.topic-btn {
    background: rgba(255,255,255,0.08);
    color: #cbd5e0;
    border: 2px solid rgba(255,255,255,0.15);
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.topic-btn:hover {
    background: rgba(255,255,255,0.18);
    color: white;
    transform: translateY(-2px);
}

.topic-btn.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.5);
    transform: translateY(-2px);
}

/* Match word cards — smaller font for multi-word entries */
.match-word-card {
    font-size: 1em !important;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.3;
    padding: 18px 10px !important;
}

/* Quiz visual image container */
.quiz-image {
    margin: 0 auto 10px;
    max-width: 500px;
    overflow-x: auto;
}

/* Bilingual instructions */
.instr-pt {
    font-size: 0.78em;
    color: #764ba2;
    font-style: italic;
    font-weight: normal;
}

/* Quiz question Portuguese translation */
.quiz-question-pt {
    font-size: 0.75em;
    color: #546e8a;
    font-style: italic;
    font-weight: normal;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,0.15);
}

/* Complete sentence Portuguese translation */
.complete-sentence-pt {
    font-size: 0.88em;
    color: #546e8a;
    font-style: italic;
    margin-top: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.45);
    border-radius: 10px;
    line-height: 1.6;
}

/* Portuguese translation labels */
.card-pt {
    display: block;
    font-size: 0.65em;
    color: #764ba2;
    font-weight: normal;
    margin-top: 4px;
    font-style: italic;
}

.unscramble-pt {
    font-size: 1em;
    color: #764ba2;
    font-weight: bold;
    font-style: italic;
    margin-bottom: 8px;
    background: rgba(102,126,234,0.12);
    border-radius: 8px;
    padding: 4px 10px;
    display: inline-block;
}

.quiz-pt {
    font-size: 0.65em;
    font-weight: normal;
    font-style: italic;
    opacity: 0.9;
    display: block;
    margin-top: 2px;
}

.word-pt {
    font-size: 0.7em;
    font-weight: normal;
    font-style: italic;
    opacity: 0.85;
    display: block;
    margin-top: 2px;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 3px solid #dee2e6;
}

.tab {
    flex: 1;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: #e9ecef;
    border: none;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s;
    color: #495057;
}

.tab:hover {
    background: #dee2e6;
}

.tab.active {
    background: white;
    color: #f5576c;
    border-bottom: 4px solid #f5576c;
}

/* Game Container */
.game-container {
    padding: 40px;
    min-height: 500px;
}

.game-section {
    display: none;
}

.game-section.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Instructions */
.instructions {
    background: #e7f3ff;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    border-left: 5px solid #2196F3;
}

.instructions h3 {
    color: #1976D2;
    margin-bottom: 10px;
}

.emoji-icon {
    font-size: 1.5em;
    margin-right: 10px;
}

/* Match Game */
.match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.match-card {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    font-size: 1.3em;
    font-weight: bold;
}

.match-card:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.match-card.selected {
    border-color: #f5576c;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    transform: scale(1.08);
}

.match-card.correct {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    border-color: #28a745;
    animation: bounce 0.6s;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Quiz Game */
.quiz-question {
    background: linear-gradient(135deg, #cfd9df 0%, #e2ebf0 100%);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
    color: #2c3e50;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.quiz-option {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    padding: 30px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    border: 3px solid transparent;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.quiz-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.quiz-option.correct {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: pulse 0.5s;
}

.quiz-option.wrong {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    animation: shake 0.5s;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

/* Unscramble Game */
.unscramble-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-top: 30px;
}

.unscramble-item {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
}

.scrambled-word {
    font-size: 2em;
    font-weight: bold;
    color: #f5576c;
    margin-bottom: 15px;
    letter-spacing: 3px;
}

.unscramble-input {
    width: 100%;
    padding: 15px;
    font-size: 1.3em;
    border: 3px solid #dee2e6;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
}

.unscramble-input.correct {
    border-color: #28a745;
    background: #d4edda;
}

.unscramble-input.wrong {
    border-color: #dc3545;
    background: #f8d7da;
}

/* Complete Sentence Game */
.complete-exercise {
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 25px;
}

.complete-sentence {
    font-size: 1.4em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 20px;
    line-height: 1.8;
}

.complete-blank {
    display: inline-block;
    min-width: 150px;
    padding: 5px 15px;
    margin: 0 5px;
    background: white;
    border: 3px dashed #667eea;
    border-radius: 8px;
    font-weight: bold;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s;
}

.complete-blank:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.complete-blank.filled {
    background: #e7f3ff;
    border: 3px solid #2196F3;
    color: #1976D2;
}

.complete-blank.correct {
    background: #d4edda;
    border: 3px solid #28a745;
    color: #155724;
}

.complete-blank.wrong {
    background: #f8d7da;
    border: 3px solid #dc3545;
    color: #721c24;
    animation: shake 0.5s;
}

.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
    padding: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 15px;
}

.word-option {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.word-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.word-option.selected {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: scale(1.1);
}

.word-option.used {
    opacity: 0.3;
    pointer-events: none;
}

.check-answer-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.3em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.check-answer-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.check-answer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Progress Bar */
.progress-bar-container {
    background: #e9ecef;
    border-radius: 20px;
    height: 14px;
    margin: 10px 0 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-radius: 20px;
    transition: width 0.4s ease;
}

.progress-label {
    text-align: center;
    font-size: 0.95em;
    color: #6c757d;
    margin-bottom: 15px;
}

/* Feedback Modal */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: white;
    padding: 50px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    text-align: center;
    z-index: 1000;
    transition: all 0.3s;
}

.feedback.show {
    transform: translate(-50%, -50%) scale(1);
}

.feedback-emoji {
    font-size: 5em;
    margin-bottom: 20px;
}

.feedback-text {
    font-size: 2em;
    font-weight: bold;
    color: #2c3e50;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .match-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quiz-options {
        grid-template-columns: 1fr;
    }

    .unscramble-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        font-size: 0.9em;
        padding: 15px 10px;
    }

    .game-container {
        padding: 20px;
    }
}
