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

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

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    text-align: center;
}

header {
    margin-bottom: 2rem;
}

header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 1rem;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 4px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 10;
}

.mode-btn {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: none;
    background: transparent;
    color: #666;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 20;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-btn.active {
    background: #667eea;
    color: white;
}

.mode-btn:hover:not(.active) {
    background: #e0e0e0;
}

.mode-btn:active {
    transform: scale(0.98);
}

@media (hover: none) {
    .mode-btn:hover:not(.active) {
        background: transparent;
    }
}

.score-board {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 10px;
    font-weight: bold;
    color: #666;
}

.flag-container {
    margin: 2rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    transition: all 0.3s ease;
}

.flag-container.hidden {
    display: none;
}

#flag-image {
    max-width: 300px;
    max-height: 200px;
    border: 3px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.question h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-btn {
    padding: 1rem;
    border: 2px solid #ddd;
    background: white;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.option-btn:hover {
    background: #f0f0f0;
    border-color: #667eea;
    transform: translateY(-2px);
}

.option-btn.correct {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.option-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-btn.flag-option {
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.option-btn.flag-option img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
}

.feedback {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 1rem 0;
    min-height: 30px;
}

.feedback.correct {
    color: #4CAF50;
}

.feedback.incorrect {
    color: #f44336;
}

.next-btn, #restart-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.next-btn:hover, #restart-btn:hover {
    background: #5a6fd8;
}

.game-over {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 15px;
    margin-top: 2rem;
}

.game-over h2 {
    color: #333;
    margin-bottom: 1rem;
}

.game-over p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #666;
}

.learn-content {
    text-align: left;
}

.country-info {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
}

.country-info h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.flag-meaning {
    margin-top: 1.5rem;
}

.flag-meaning h3 {
    color: #667eea;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.flag-meaning p {
    color: #555;
    line-height: 1.6;
    font-size: 1.1rem;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .options {
        grid-template-columns: 1fr;
    }
    
    #flag-image {
        max-width: 250px;
        max-height: 150px;
    }
}