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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Sarabun', 'Thonburi';
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

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

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

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

.stat {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

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

.stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
}

.category-selector {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.category-selector label {
    font-weight: bold;
    margin-right: 10px;
    font-size: 1.1em;
}

.category-selector select {
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    background: white;
    min-width: 200px;
}

.game-area {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.game-area.celebrate {
    animation: celebrate 0.6s ease;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.05) rotate(2deg); }
    75% { transform: scale(1.05) rotate(-2deg); }
}

.fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: explode 1s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y));
        opacity: 0;
    }
}

.streak-badge {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 30px 50px;
    border-radius: 20px;
    font-size: 2em;
    font-weight: bold;
    box-shadow: 0 10px 40px rgba(245, 87, 108, 0.5);
    z-index: 10000;
    animation: badge-pop 4s ease forwards;
    pointer-events: none;
}

@keyframes badge-pop {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-180deg); opacity: 0; }
    15% { transform: translate(-50%, -50%) scale(1.2) rotate(10deg); opacity: 1; }
    20% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
    90% { transform: translate(-50%, -50%) scale(1.1) rotate(360deg); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(0.5) rotate(720deg); opacity: 0; }
}

.flashcard {
    perspective: 1000px;
    margin-bottom: 30px;
    height: 350px;
}

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

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

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4), 
                0 4px 16px rgba(118, 75, 162, 0.3),
                inset 0 -2px 8px rgba(255, 255, 255, 0.2);
}

.card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    transform: rotateY(180deg);
    box-shadow: 0 8px 32px rgba(240, 147, 251, 0.4), 
                0 4px 16px rgba(245, 87, 108, 0.3),
                inset 0 -2px 8px rgba(255, 255, 255, 0.2);
}

.card-header {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 20px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.card-content {
    font-size: 3em;
    font-weight: bold;
    text-align: center;
    word-wrap: break-word;
}

.card-image-container {
    width: 100%;
    max-height: 150px;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
                0 2px 6px rgba(0, 0, 0, 0.2),
                inset 0 1px 2px rgba(255, 255, 255, 0.3),
                inset 0 -1px 2px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.image-loader {
    padding: 10px;
    font-size: 0.9em;
    opacity: 0.8;
}

.hint {
    margin-top: 20px;
    font-size: 1.1em;
    font-style: italic;
    opacity: 0.8;
}

.pronunciation {
    margin-top: 20px;
    font-size: 1.3em;
    opacity: 0.9;
    font-style: italic;
}

.controls {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.answer-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.game-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

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

.btn:active {
    transform: translateY(0);
}

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

.btn-flip:hover {
    background: #5568d3;
}

.btn-hint {
    background: #f59e0b;
    color: white;
}

.btn-hint:hover {
    background: #d97706;
}

.btn-correct {
    background: #10b981;
    color: white;
}

.btn-correct:hover {
    background: #059669;
}

.btn-wrong {
    background: #ef4444;
    color: white;
}

.btn-wrong:hover {
    background: #dc2626;
}

.btn-start {
    background: #8b5cf6;
    color: white;
}

.btn-start:hover {
    background: #7c3aed;
}

.btn-reset {
    background: #f59e0b;
    color: white;
}

.btn-reset:hover {
    background: #d97706;
}

.instructions {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.instructions h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.instructions ol {
    margin-left: 20px;
    line-height: 1.8;
}

.instructions li {
    margin-bottom: 10px;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
}

.mode-btn {
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border: 3px solid white;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Canada Section */
.canada-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.canada-slideshow,
.canada-trivia {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.canada-slideshow h2,
.canada-trivia h2 {
    color: #667eea;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.slideshow-container {
    margin-top: 20px;
}

.slide-image-container {
    width: 100%;
    height: 400px;
    border-radius: 15px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.slideshow-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
                inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.slide-loader {
    padding: 20px;
    text-align: center;
    color: #666;
}

.slide-caption {
    text-align: center;
    font-size: 1.2em;
    color: #333;
    margin-bottom: 15px;
    min-height: 30px;
    font-weight: bold;
}

.slide-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.trivia-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.trivia-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 15px;
    min-height: 300px;
    margin-bottom: 20px;
}

.trivia-question {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
    line-height: 1.6;
}

.trivia-options {
    display: grid;
    gap: 15px;
}

.trivia-option {
    padding: 15px 20px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 10px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.trivia-option:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

.trivia-option.correct {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.trivia-option.wrong {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.trivia-option.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.trivia-feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1em;
    text-align: center;
    font-weight: bold;
}

.trivia-feedback.correct {
    background: #d1fae5;
    color: #065f46;
}

.trivia-feedback.wrong {
    background: #fee2e2;
    color: #991b1b;
}

.trivia-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

@media (max-width: 1024px) {
    .canada-container {
        grid-template-columns: 1fr;
    }
    
    .slide-image-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .mode-selector {
        flex-direction: column;
    }
    
    .mode-btn {
        width: 100%;
    }
}

.instructions ol {
    margin-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
    line-height: 1.6;
    font-size: 1.05em;
}

.hidden {
    display: none;
}


/* Responsive Design */

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    .card-content {
        font-size: 2em;
    }
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .btn {
        padding: 12px 20px;
        font-size: 1em;
    }
}


/* Animation for correct/wrong answers */

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

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.flashcard.correct {
    animation: bounce 0.5s ease;
}

.flashcard.wrong {
    animation: shake 0.5s ease;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    color: white;
    font-size: 1.1em;
}

.footer a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-bottom: 2px solid white;
    transition: all 0.3s ease;
}

.footer a:hover {
    color: #f093fb;
    border-bottom-color: #f093fb;
    transform: translateY(-2px);
}