/* Reset global */
* { box-sizing: border-box; }

/* Fonts */
@font-face {
    font-family: 'PublicaPlay';
    src: url('fonts/PublicaPlay.otf') format('opentype');
    font-weight: normal; font-style: normal;
}
@font-face {
    font-family: 'OctinPrison';
    src: url('fonts/OctinPrison.otf') format('opentype');
    font-weight: normal; font-style: normal;
}
@font-face {
    font-family: 'OpenSans';
    src: url('fonts/OpenSans.ttf') format('truetype');
    font-weight: normal; font-style: normal;
}

/* Layout */
body {
    font-family: 'OpenSans', sans-serif;
    background-color: #222;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px 0;
}

/* ── Écrans ── */
.screen { display: none; width: 100%; flex-direction: column; align-items: center; }
.screen.active { display: flex; }

.game-container {
    text-align: center;
    width: 90%;
    max-width: 600px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.game-container--wide { max-width: 700px; }

/* ── Sélecteur de langue ── */
.lang-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 12px;
}
.lang-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #aaa;
    font-family: 'OpenSans', sans-serif;
    font-size: 0.78rem;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    letter-spacing: 0.5px;
}
.lang-btn:hover { background: rgba(255,255,255,0.15); color: white; }
.lang-btn.lang-active {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
    color: white;
}

/* ── Titre ── */
h1 {
    margin-bottom: 20px;
    font-size: 42px;
    letter-spacing: 1px;
    line-height: 1.2;
}
.font-crous        { font-family: 'PublicaPlay', sans-serif; color: #3498db; text-transform: uppercase; }
.font-prison-title { font-family: 'OctinPrison', sans-serif; color: #e74c3c; text-transform: uppercase; font-size: 1.1em; }
.font-normal       { font-family: 'OpenSans', sans-serif; font-weight: bold; color: #ccc; font-size: 0.6em; vertical-align: middle; padding: 0 10px; }
.font-or           { font-family: 'OpenSans', sans-serif; font-weight: bold; color: #ccc; font-size: 0.6em; vertical-align: middle; padding: 0 10px; }
.font-question     { font-family: 'OpenSans', sans-serif; font-weight: bold; color: white; font-size: 1em; vertical-align: baseline; margin-left: 5px; }

/* ── Sélection de mode ── */
.mode-intro {
    font-family: 'OpenSans', sans-serif;
    color: #aaa;
    font-size: 1rem;
    margin-bottom: 18px;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.mode-cards { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.mode-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    text-align: left;
}
.mode-card:hover  { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); transform: translateY(-2px); }
.mode-card:active { transform: scale(0.98); }

.mode-icon { font-size: 1.7rem; flex-shrink: 0; }
.mode-info { flex: 1; }
.mode-name { font-family: 'OpenSans', sans-serif; font-weight: bold; font-size: 1rem; color: white; }
.mode-desc { font-family: 'OpenSans', sans-serif; font-size: 0.8rem; color: #aaa; margin-top: 2px; line-height: 1.4; }
.mode-record { font-size: 0.75rem; color: #f1c40f; margin-top: 3px; }

.btn-mode {
    flex-shrink: 0;
    padding: 9px 16px;
    font-size: 0.82rem;
    font-family: 'OpenSans', sans-serif;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: filter 0.2s;
}
.btn-mode:hover   { filter: brightness(1.2); }
.btn-mode-crous   { background: #3498db; }
.btn-mode-chrono  { background: #e67e22; }
.btn-mode-survie  { background: #e74c3c; }
.btn-mode-quiz    { background: #8e44ad; }

/* ── Topbar in-game ── */
.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.btn-back-mode {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #aaa;
    font-family: 'OpenSans', sans-serif;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.btn-back-mode:hover { color: white; border-color: white; }
.mode-badge { font-family: 'OpenSans', sans-serif; font-size: 0.85rem; font-weight: bold; color: #aaa; }

/* ── Scoreboard ── */
.score-board {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.95rem;
    font-family: 'OpenSans', sans-serif;
}
.score-item span { color: #f1c40f; }

/* ── Barre chrono ── */
.timer-bar-container {
    width: 100%; height: 14px;
    background: rgba(255,255,255,0.1);
    border-radius: 50px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}
.timer-bar {
    height: 100%; border-radius: 50px;
    background: #2ecc71; width: 100%;
    transition: width 0.1s linear, background 0.3s;
}
.timer-label {
    position: absolute; right: 8px; top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem; font-weight: bold; color: white;
    font-family: 'OpenSans', sans-serif;
}

/* ── Image & Overlay ── */
.image-wrapper {
    position: relative; width: 100%; height: 370px;
    margin: 10px 0 18px; border-radius: 12px; overflow: hidden;
    background-color: #333; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
#game-image { width: 100%; height: 100%; object-fit: cover; display: block; }

.overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center;
    align-items: center; gap: 20px;
    opacity: 0; transition: opacity 0.3s ease;
    pointer-events: none; padding: 20px; z-index: 10;
}
.overlay.visible { opacity: 1; pointer-events: auto; }

#overlay-text {
    font-family: 'OpenSans', sans-serif;
    font-size: 21px; font-weight: bold; color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    text-align: center; line-height: 1.4;
}

.btn-retry {
    padding: 12px 28px;
    background: transparent; color: white;
    border: 2px solid white;
    font-family: 'OpenSans', sans-serif;
    font-size: 17px; font-weight: bold;
    cursor: pointer; border-radius: 50px;
    transition: all 0.2s;
    text-transform: uppercase; letter-spacing: 1px;
}
.btn-retry:hover { background: white; color: #c0392b; }

/* ── Boutons jeu ── */
.buttons-container { display: flex; gap: 20px; justify-content: center; }
.btn {
    padding: 15px 0; width: 140px; font-size: 18px;
    cursor: pointer; border: none; border-radius: 8px; color: white;
    transition: transform 0.1s, filter 0.2s;
}
.btn:hover  { filter: brightness(1.1); }
.btn:active { transform: scale(0.95); }
.btn-crous  { background-color: #3498db; font-family: 'PublicaPlay', sans-serif; }
.btn-prison { background-color: #e74c3c; font-family: 'OctinPrison', sans-serif; font-size: 1.2rem; letter-spacing: 1px; }

/* ── Quiz grille ── */
.quiz-instruction {
    font-family: 'OpenSans', sans-serif;
    font-size: 1.05rem; font-weight: bold;
    color: #f1c40f;
    margin: 6px 0 14px;
    min-height: 1.5em;
    transition: color 0.3s;
}
.quiz-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px; width: 100%; margin-bottom: 14px;
}
.quiz-cell {
    position: relative; border-radius: 10px; overflow: hidden;
    cursor: pointer; aspect-ratio: 4/3; background: #333;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
}
.quiz-cell:hover { transform: scale(1.02); border-color: rgba(255,255,255,0.3); }
.quiz-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }

.quiz-cell.quiz-correct { border-color: #2ecc71; box-shadow: 0 0 16px rgba(46,204,113,0.6); }
.quiz-cell.quiz-wrong   { border-color: #e74c3c; box-shadow: 0 0 16px rgba(231,76,60,0.6); opacity: 0.7; }
.quiz-cell.quiz-correct::after {
    content: '✓'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    font-size: 3rem; font-weight: bold; color: #2ecc71;
    text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}
.quiz-cell.quiz-wrong::after {
    content: '✗'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    font-size: 3rem; font-weight: bold; color: #e74c3c;
    text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}
.quiz-next-container { display: flex; justify-content: center; margin-top: 8px; }

/* ── Utilitaires ── */
.hidden { display: none !important; }

/* ── Footer ── */
footer {
    width: 100%; text-align: center;
    font-size: 0.85rem; font-family: 'OpenSans', sans-serif;
    margin-top: 28px; color: #777;
}
footer a { color: #aaa !important; text-decoration: none; transition: color 0.2s; }
footer a:hover { color: white !important; text-decoration: underline; }
.copyright { opacity: 0.5; font-size: 0.9em; display: inline-block; margin-top: 5px; }

/* ── Mentions Légales ── */
body.legal-page { display: block; padding: 40px 20px; height: auto; }
.legal-container {
    max-width: 800px; margin: 0 auto;
    background: rgba(255,255,255,0.05);
    padding: 40px; border-radius: 10px; text-align: left;
}
.legal-container h1 { text-align: center; font-family: 'PublicaPlay', sans-serif; color: #3498db; margin-bottom: 30px; }
.legal-container h2 { font-family: 'OpenSans', sans-serif; color: #e74c3c; border-bottom: 1px solid #444; padding-bottom: 10px; margin-top: 30px; }
.legal-container p  { font-family: 'OpenSans', sans-serif; line-height: 1.6; color: #ddd; }
.legal-container a  { color: #3498db; text-decoration: none; }
.btn-back { display: inline-block; margin-bottom: 20px; color: #aaa; font-family: 'OpenSans', sans-serif; font-weight: bold; text-decoration: none; }
.btn-back:hover { color: white; }

/* ── Responsive ── */
@media (max-width: 480px) {
    h1 { font-size: 26px; }
    .image-wrapper { height: 240px; }
    .btn { width: 120px; font-size: 16px; }
    #overlay-text { font-size: 17px; }
    .mode-card { flex-wrap: wrap; }
    .btn-mode { width: 100%; margin-top: 8px; text-align: center; }
    .quiz-grid { gap: 7px; }
    .quiz-cell.quiz-correct::after,
    .quiz-cell.quiz-wrong::after { font-size: 2rem; }
}
