:root {
    --primary-color: #4facfe;
    --primary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --secondary-bg: #f3f4f6;
    --card-bg: #ffffff;
    --text-dark: #2d3436;
    --text-light: #636e72;
    --success: #00b894;
    --error: #ff7675;
    --shadow: 0 10px 20px rgba(0,0,0,0.08);
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--secondary-bg);
    background-image: radial-gradient(#dfe6e9 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 600px; 
    padding: 20px;
    flex: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#game-selector {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.logo-area h1 {
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.tagline { color: var(--text-light); margin-bottom: 25px; }

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.btn-mode {
    background: white;
    border: 2px solid #edf2f7;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-dark);
}

.btn-mode:hover {
    border-color: #4facfe;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.2);
}

.btn-mode .icon { font-size: 1.5rem; margin-bottom: 5px; }
.btn-mode .text { font-size: 0.9rem; line-height: 1.3; }

.seo-content {
    text-align: left;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
}
.seo-content h2 { font-size: 1rem; color: var(--text-dark); margin-bottom: 8px; }
.seo-content ul { padding-left: 20px; margin-top: 8px; }

#game {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    width: 100%;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-quit {
    background: none;
    border: none;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    margin-bottom: 15px;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.question-card {
    margin: 20px 0;
}

#label-question {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-light);
}

#valeur-question {
    font-size: 2.5rem;
    color: var(--text-dark);
    margin: 10px 0;
}

.input-wrapper { position: relative; margin-bottom: 15px; }

input {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    outline: none;
    font-family: inherit;
    transition: border 0.3s;
}

input:focus { border-color: #4facfe; }

.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; border-color: var(--error) !important; }

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

#results-list {
    position: absolute;
    top: 105%;
    left: 0; right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    border: 1px solid #eee;
}

.result-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    text-align: left;
}
.result-item:hover { background: #f9f9f9; color: #4facfe; }

#feedback-message { min-height: 25px; margin-bottom: 15px; font-weight: 600; font-size: 0.95rem; }
.msg-success { color: var(--success); }
.msg-error { color: var(--error); }
.msg-info { color: #e17055; }

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
}

.btn-secondary {
    background: transparent;
    color: var(--text-light);
    border: 2px solid #e0e0e0;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}
.btn-secondary:hover { background: #f0f0f0; }

#end-screen {
    background: white;
    padding: 40px 30px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}
.final-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}
.big-score { display: block; font-size: 3.5rem; font-weight: 700; color: #4facfe; line-height: 1; }
.label { font-size: 0.9rem; text-transform: uppercase; color: var(--text-light); }

footer {
    margin-top: auto;
    padding: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: #b2bec3;
}

@media (max-width: 480px) {
    .menu-grid { grid-template-columns: 1fr;}
    
    .app-container { padding: 10px; }
    
    #game-selector, #game { padding: 20px; }
    
    #valeur-question { font-size: 2rem; }
    
    .btn-mode { flex-direction: row; justify-content: start; text-align: left; }
    .btn-mode .icon { margin-right: 15px; margin-bottom: 0; }
}

.fade-in { animation: fadeIn 0.5s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }