* {
    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;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #333;
    font-size: 2em;
    margin-bottom: 8px;
}

.footer {
    text-align: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.footer .dedication {
    color: #000;
    font-size: 0.85em;
    margin: 5px 0;
    font-weight: 500;
}


.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.score-item {
    text-align: center;
}

.score-label {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.score-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

.quiz-area {
    margin-bottom: 20px;
}

.flash-card {
    perspective: 1000px;
    height: 250px;
    margin-bottom: 20px;
}

.card-content {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flash-card.flipped .card-content {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.card-front {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.card-back {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    transform: rotateY(180deg);
}

.card-front h2, .card-back h2 {
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

.timer {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    font-weight: bold;
    color: white;
    border: 3px solid white;
}

.timer.warning {
    animation: pulse 1s infinite;
}

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

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 30px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

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

.btn-secondary {
    background: #48bb78;
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 0;
    background: rgba(0, 0, 0, 0.1);
    transition: width 5s linear;
}

.btn-secondary.auto-progress::before {
    width: 100%;
}

.btn-success {
    background: #38a169;
    color: white;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-reset {
    background: #718096;
    color: white;
    margin-top: 20px;
    width: 100%;
}

.answer-buttons {
    display: flex;
    gap: 15px;
}

.progress {
    height: 8px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.timer-option {
    padding: 6px 15px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timer-option:hover {
    background: #f0f4ff;
}

.timer-option.active {
    background: #667eea;
    color: white;
}

.start-screen {
    text-align: center;
    padding: 30px 15px;
}

.start-screen h2 {
    color: #333;
    font-size: 1.8em;
    margin-bottom: 15px;
}

.start-screen p {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.quiz-info {
    color: #667eea !important;
    font-weight: 600;
    font-size: 1.1em !important;
    margin-bottom: 30px !important;
}

.btn-large {
    padding: 12px 35px;
    font-size: 1.2em;
    margin-top: 25px;
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.6em;
    }
    
    .card-front h2, .card-back h2 {
        font-size: 1.8em;
        white-space: nowrap;
        padding: 0 5px;
    }
    
    .flash-card {
        height: 200px;
    }
    
    .score-board {
        gap: 15px;
    }
}

/* Question Count Selection */
.question-count-selection {
    margin: 15px 0;
}

.question-count-selection h3 {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 10px;
    font-weight: 600;
}

.question-count-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 0;
}

.question-count-btn {
    padding: 8px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.question-count-btn:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
}

.question-count-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Timer Speed Selection */
.timer-speed-selection {
    margin: 15px 0;
}

.timer-speed-selection h3 {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 10px;
    font-weight: 600;
}

.timer-speed-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

/* Mode Selection */
.mode-selection {
    margin: 15px 0;
}

.mode-selection h3 {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 600;
}

.mode-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 20px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: 160px;
    pointer-events: auto;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

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

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transform: scale(1.05);
}

.mode-btn.active .mode-name,
.mode-btn.active .mode-desc {
    color: white;
}

.mode-icon {
    font-size: 2em;
    margin-bottom: 8px;
    pointer-events: none;
    filter: grayscale(0.3);
    transition: all 0.3s ease;
}

.mode-btn.active .mode-icon {
    filter: grayscale(0);
    transform: scale(1.1);
}

.mode-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
    pointer-events: none;
    transition: color 0.3s ease;
}

.mode-desc {
    font-size: 0.85em;
    color: #666;
    pointer-events: none;
    transition: color 0.3s ease;
}

/* Multiple Choice Mode */
.question-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 30px 70px 30px 30px;
    color: white;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-card h2 {
    font-size: 1.8em;
    margin: 0;
    max-width: 90%;
}

.question-card #mc-country {
    font-weight: bold;
    color: #ffd700;
    white-space: nowrap;
}

#mc-timer {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    font-weight: bold;
    color: white;
    border: 3px solid white;
}

#mc-timer.warning {
    animation: pulse 1s infinite;
}

.choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.choice-btn {
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    font-weight: 500;
}

.choice-btn:hover:not(:disabled) {
    background: #f0f4ff;
    border-color: #667eea;
    transform: translateY(-2px);
}

.choice-btn:disabled {
    cursor: not-allowed;
}

.choice-btn.correct {
    background: #c6f6d5;
    border-color: #38a169;
    color: #22543d;
}

.choice-btn.wrong {
    background: #fed7d7;
    border-color: #e53e3e;
    color: #742a2a;
}

#mc-next {
    display: block;
    margin: 20px auto 0;
}

/* Results Screen */
.results-screen {
    position: relative;
    text-align: center;
    padding: 20px;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1000;
}

.results-content {
    position: relative;
    z-index: 2;
}

.results-screen h2 {
    color: #333;
    font-size: 2em;
    margin-bottom: 20px;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 1em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
}

.stat-item.correct .stat-value {
    color: #38a169;
}

.stat-item.wrong .stat-value {
    color: #e53e3e;
}

.results-percentage {
    font-size: 4em;
    font-weight: bold;
    margin: 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.results-message {
    font-size: 1.3em;
    color: #333;
    margin: 15px 0 25px;
    font-weight: 500;
}

@media (max-width: 600px) {
    .mode-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .mode-btn {
        width: 100%;
        max-width: 220px;
        padding: 12px 15px;
    }
    
    .question-count-buttons {
        gap: 8px;
    }
    
    .question-count-btn {
        padding: 6px 15px;
        font-size: 0.9em;
    }
    
    .timer-speed-buttons {
        gap: 6px;
    }
    
    .timer-option {
        padding: 5px 12px;
        font-size: 0.8em;
    }
    
    .question-card {
        padding: 30px 70px 30px 30px;
        min-height: 100px;
    }
    
    .question-card h2 {
        font-size: 1.5em;
    }
    
    #mc-timer {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
        top: 15px;
        right: 15px;
    }
    
    .choices-grid {
        grid-template-columns: 1fr;
    }
    
    .results-screen h2 {
        font-size: 1.6em;
    }
    
    .results-stats {
        gap: 20px;
    }
    
    .stat-label {
        font-size: 0.9em;
    }
    
    .stat-value {
        font-size: 2em;
    }
    
    .results-percentage {
        font-size: 3em;
    }
    
    .results-message {
        font-size: 1.1em;
    }
}