:root {
    --primary-color: #3b82f6;
    /* Blue like the French flag */
    --secondary-color: #ef4444;
    /* Red like the French flag */
    --accent-color: #ffffff;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --success-color: #10b981;
    --error-color: #f43f5e;
    --font-std: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-std);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(239, 68, 68, 0.15) 0%, transparent 20%);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.teacher-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #002654, #ED2939);
    /* French Tricolore Gradient roughly */
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Lang Switcher (Mini) */
.lang-toggles {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.lang-btn.active,
.lang-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Game Area */
.game-area {
    width: 100%;
    max-width: 600px;
    position: relative;
    perspective: 1000px;
}

.card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Start Screen */
.mode-select {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary-color), #2563eb);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

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

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.6);
}

/* Quiz Screen */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    width: 0%;
    transition: width 0.3s ease;
}

.word-display {
    margin-bottom: 2.5rem;
}

.word-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.target-word {
    font-size: 3rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-primary);
}

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

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Feedback States */
.option-btn.correct {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: var(--success-color) !important;
    color: #4ade80 !important;
}

.option-btn.wrong {
    background: rgba(244, 63, 94, 0.2) !important;
    border-color: var(--error-color) !important;
    color: #fda4af !important;
}

/* Result Screen */
.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 3px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
}

.score-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.wrong-list {
    text-align: left;
    margin: 1.5rem 0;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
}

.wrong-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.wrong-item:last-child {
    border-bottom: none;
}

.correct-answer {
    color: var(--success-color);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Mode */
.vocab-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    text-align: center;
    margin-bottom: 1rem;
    font-family: var(--font-std);
    outline: none;
    transition: all 0.3s;
}

.vocab-input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.15);
}

.vocab-input.error {
    border-color: var(--error-color);
    animation: shake 0.4s ease-in-out;
}

/* Accent Toolbar */
.accent-toolbar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.accent-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.accent-btn.action-btn {
    width: auto;
    padding: 0 1.5rem;
    background: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
}

/* Secondary Clue */
.secondary-clue {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: -2rem;
    margin-bottom: 2rem;
}

/* Feedback Message */
.feedback-msg {
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    min-height: 1.5em;
}

.feedback-msg.correct {
    color: var(--success-color);
}

.feedback-msg.wrong {
    color: var(--error-color);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.8rem;
    }

    .accent-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

.hidden {
    display: none !important;
}

/* Virtual Keyboard */
.virtual-keyboard {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    /* Larger padding container */
    border-radius: 16px;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    /* More space between rows */
    user-select: none;
    max-width: 800px;
    /* Allow it to be wider on tablets */
    margin-left: auto;
    margin-right: auto;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    /* More space between keys */
    flex-wrap: nowrap;
}

.key-btn {
    background: rgba(255, 255, 255, 0.12);
    /* Slightly lighter for visibility */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-family: var(--font-std);
    font-size: 1.35rem;
    /* Bigger font */
    border-radius: 8px;
    cursor: pointer;
    padding: 1.2rem 0.5rem;
    /* Taller keys */
    min-width: 44px;
    /* Wider minimum */
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    touch-action: manipulation;
    /* Eliminate 300ms delay on touch */
}

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

.key-btn:active {
    background: var(--primary-color);
    transform: translateY(1px);
}

/* Special Keys */
.key-enter {
    background: var(--success-color);
    border-color: var(--success-color);
    flex: 1.5;
    font-weight: 700;
}

.key-backspace {
    background: rgba(239, 68, 68, 0.5);
    border-color: rgba(239, 68, 68, 0.5);
    flex: 1.5;
}

.key-space {
    flex: 5;
}

.key-accent {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.4);
}

@media (max-width: 600px) {
    .key-btn {
        padding: 0.8rem 0.2rem;
        /* Slightly smaller on phones but still usable */
        font-size: 1.1rem;
        min-width: 28px;
    }

    .virtual-keyboard {
        padding: 0.8rem;
        gap: 0.5rem;
    }

    .keyboard-row {
        gap: 0.3rem;
    }
}