/* --- VARIABLES --- */
:root {
    --primary: #427E53;         /* Ton vert Mandango */
    --primary-dark: #2d5a3a;
    --accent: #fbc02d;          /* Jaune pour les énigmes */
    --bg-light: #f4f7f6;
    --white: #ffffff;
    --text-dark: #333333;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* --- RESET & BASE --- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--primary);
    background-image: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
}

.container {
    width: 100%;
    max-width: 450px;
    margin: auto;
    text-align: center;
}

/* --- HEADER --- */
header h1 {
    color: var(--white);
    font-size: 1.8rem;
    margin: 15px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.logo-container {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    background: var(--white);
    border: 4px solid var(--white);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    overflow: hidden;
    /* Strictement carré comme demandé */
}

.logo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#chrono {
    font-family: 'Courier New', Courier, monospace;
    font-size: 3rem;
    background: var(--white);
    color: var(--primary);
    padding: 10px 30px;
    border-radius: 60px;
    display: inline-block;
    margin: 20px 0;
    font-weight: bold;
    box-shadow: var(--shadow);
    border: 3px solid rgba(255,255,255,0.2);
}

#status {
    color: var(--white);
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

/* --- CARTES & SECTIONS --- */
.card {
    background: var(--white);
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.enigme-box {
    background: #fffde7;
    padding: 20px;
    border-left: 6px solid var(--accent);
    border-radius: 12px;
    text-align: left;
    font-style: italic;
    line-height: 1.6;
    margin: 20px 0;
    color: #555;
    font-size: 1.05rem;
}

/* --- FORMULAIRES & INPUTS --- */
input[type="text"] {
    width: 100%;
    padding: 16px;
    font-size: 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    margin-bottom: 15px;
    text-align: center;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(66, 126, 83, 0.15);
}

/* --- BOUTONS --- */
button {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Bouton principal (Valider / Enregistrer) */
button#validate-btn, button#send-score-btn {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 6px 20px rgba(66, 126, 83, 0.3);
}

button#validate-btn:hover, button#send-score-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 126, 83, 0.4);
}

button#validate-btn:active, button#send-score-btn:active {
    transform: translateY(0);
}

/* Bouton Démarrer */
#start-btn {
    background: var(--white);
    color: var(--primary);
    font-size: 1.3rem;
    height: 80px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Bouton Abandonner */
.btn-secondary {
    background: transparent !important;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: underline;
    font-size: 0.9rem;
    font-weight: 400;
    margin-top: 40px;
    box-shadow: none !important;
}

.btn-secondary:hover {
    color: var(--white);
}

/* --- CLASSEMENT & RÉSULTATS --- */
.result-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.result-list li {
    background: #f8fcf9;
    padding: 15px;
    margin-bottom: 8px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #eee;
}

.result-list li strong {
    color: var(--primary);
    font-family: monospace;
    font-size: 1.1rem;
}

#leaderboard h3 {
    margin-top: 30px;
    color: var(--primary);
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

/* Animation de secousse pour erreur */
.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@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); }
}

/* Style pendant le succès (géré par JS) */
#code-input {
    transition: all 0.3s ease;
}