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

html, body {
    height: 100%;
    background: #fff;
    font-family: 'Courier New', Courier, monospace;
    user-select: none;
    overflow: hidden;
}

/* ════════════════════════════════
   INTRO LAYER
════════════════════════════════ */
#intro-layer {
    position: fixed;
    inset: 0;
    cursor: pointer;
    transition: opacity 0.8s ease;
}
#intro-layer.fade-out { opacity: 0; pointer-events: none; }

/* ── Bannière défilante ── */
#intro-banner {
    position: fixed;
    top: 16px; left: 0; right: 0;
    height: 54px;
    background: linear-gradient(90deg, #0a1f13 0%, #1a4d3a 40%, #0d2b1e 100%);
    overflow: hidden;
    z-index: 10;
    border-top: 2px solid rgba(247,201,72,0.5);
    border-bottom: 2px solid rgba(247,201,72,0.5);
    display: none;
    align-items: center;
    box-shadow: 0 4px 24px rgba(247,201,72,0.2);
}
#intro-banner.visible { display: flex; }

#intro-banner-2 {
    position: fixed;
    top: 78px; left: 0; right: 0;
    height: 54px;
    background: linear-gradient(90deg, #0d2b1e 0%, #1a4d3a 60%, #0a1f13 100%);
    overflow: hidden;
    z-index: 10;
    border-bottom: 2px solid rgba(247,201,72,0.5);
    display: none;
    align-items: center;
    box-shadow: 0 4px 24px rgba(247,201,72,0.15);
}
#intro-banner-2.visible { display: flex; }
.banner-track-reverse {
    display: flex;
    white-space: nowrap;
    animation: banner-scroll-reverse 22s linear infinite;
    will-change: transform;
}
@keyframes banner-scroll-reverse {
    0%   { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}
.banner-track {
    display: flex;
    white-space: nowrap;
    animation: banner-scroll 18s linear infinite;
    will-change: transform;
}
.banner-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 32px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #f7c948, #fff7c0, #f7c948, #ffe066, #fff, #f7c948);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: banner-shine 3s linear infinite;
    position: relative;
}
.banner-sep {
    color: #f7c948;
    -webkit-text-fill-color: #f7c948;
    font-size: 1.1rem;
    animation: banner-twinkle 1.2s ease-in-out infinite;
}
@keyframes banner-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
@keyframes banner-shine {
    0%   { background-position: 0% center; }
    100% { background-position: 300% center; }
}
@keyframes banner-twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(1.4); }
}

#character-intro {
    position: fixed;
    bottom: 148px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    pointer-events: none;
    z-index: 1;
}
#character-intro img { width: 100%; display: block; }

#textbox {
    position: fixed;
    bottom: 10px; left: 0; right: 0;
    background: rgba(0,0,0,0.82);
    border-top: 3px solid rgba(255,255,255,0.15);
    padding: 28px 36px 32px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 2;
}
#textbox-text {
    color: #fff;
    font-size: 1.2rem;
    line-height: 1.8;
    letter-spacing: 0.02em;
    min-height: 2.5em;
}
#textbox-arrow {
    position: absolute;
    bottom: 14px; right: 24px;
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem;
    opacity: 0;
    animation: blink-arrow 0.8s ease-in-out infinite;
}
#textbox-arrow.visible { opacity: 1; }
@keyframes blink-arrow {
    0%,100% { opacity:0.2; transform:translateY(0); }
    50%      { opacity:1;   transform:translateY(4px); }
}

/* ════════════════════════════════
   QUIZ LAYER
════════════════════════════════ */
#quiz-layer {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    overflow: hidden;
}
#quiz-layer.active { opacity: 1; pointer-events: auto; }

/* Barre de progression */
#quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: #1a4d3a;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    gap: 16px;
    flex-shrink: 0;
}
#progress-wrap {
    flex: 1;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}
#progress-fill {
    height: 100%;
    background: #f7c948;
    border-radius: 20px;
    transition: width 0.4s ease;
    width: 0%;
}
#score-display { white-space: nowrap; }
#diff-badge {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    white-space: nowrap;
}
.diff-F { background: #25d366; color: #fff; }
.diff-I { background: #f7c948; color: #1a1a1a; }
.diff-D { background: #e74c3c; color: #fff; }

/* Zone principale */
#quiz-main {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow: hidden;
    min-height: 0;
}

/* Personnage gauche */
#quiz-char-zone {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px 10px;
    position: relative;
}
#quiz-char-zone img {
    width: 200px;
    object-fit: contain;
}

/* Zone question + réponses */
#quiz-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 32px 24px 16px;
    gap: 20px;
    overflow-y: auto;
    min-height: 0;
}

#question-area {
    background: #f8f8f8;
    border-radius: 16px;
    padding: 22px 26px;
    border-left: 5px solid #1a4d3a;
    min-height: 90px;
}
#question-label {
    font-size: 0.72rem;
    color: #999;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
}
#question-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.5;
    min-height: 1.5em;
}

/* Grille réponses */
#answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    /* transition seulement à l'apparition */
}
#answers-grid.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.answer-btn {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.4;
}
.answer-btn:hover:not(:disabled) {
    border-color: #1a4d3a;
    background: #f0faf5;
    transform: translateY(-1px);
}
.answer-letter {
    font-weight: 800;
    color: #1a4d3a;
    min-width: 18px;
}
.answer-btn.correct {
    border-color: #25d366;
    background: #e8faf0;
    color: #1a4d3a;
}
.answer-btn.wrong {
    border-color: #e74c3c;
    background: #fdf0ef;
    color: #c0392b;
}
.answer-btn.dimmed {
    opacity: 0.4;
}
.answer-btn:disabled { cursor: default; }

/* Réaction (textbox quiz) */
#reaction-box {
    position: relative;
    background: rgba(0,0,0,0.82);
    border-top: 3px solid rgba(255,255,255,0.15);
    padding: 20px 32px 24px;
    min-height: 90px;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
    cursor: pointer;
}
#reaction-box.visible { opacity: 1; }
#reaction-text {
    color: #fff;
    font-size: 1.05rem;
    line-height: 1.7;
    flex: 1;
}
#reaction-arrow {
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem;
    margin-left: 16px;
    opacity: 0;
    animation: blink-arrow 0.8s ease-in-out infinite;
}
#reaction-arrow.visible { opacity: 1; }

/* ════════════════════════════════
   END SCREEN
════════════════════════════════ */
#end-layer {
    position: fixed;
    inset: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    padding: 32px 32px 40px;
    text-align: center;
    overflow-y: auto;
}
#end-layer.active { opacity: 1; pointer-events: auto; }
#end-char { width: 160px; margin-bottom: 8px; }
#end-score-big {
    font-family: 'Inter', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    color: #1a4d3a;
}
#end-score-label {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #888;
}
#end-message {
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
    max-width: 420px;
}
#end-replay {
    margin-top: 8px;
    background: #1a4d3a;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 36px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(26,77,58,0.3);
}
#end-replay:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(26,77,58,0.4); }

#end-share {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #25d366;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 36px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(37,211,102,0.4);
}
#end-share:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(37,211,102,0.55); }
#end-share i { font-size: 1.1rem; }
.end-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.end-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 50px;
    padding: 14px 28px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, background 0.15s;
}
.end-back-btn:hover { background: #e0e0e0; transform: translateY(-2px); }

/* ════════════════════════════════
   RESPONSIVE
════════════════════════════════ */
@media (max-width: 640px) {
    #character-intro { width: 300px; bottom: -300px; }
    #textbox { padding: 20px 20px 28px; min-height: 120px; }
    #textbox-text { font-size: 1rem; }

    #quiz-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
    #quiz-char-zone { padding: 6px 10px; align-items: center; }
    #quiz-char-zone img { width: 80px; }
    #quiz-right { padding: 10px 14px; gap: 10px; justify-content: flex-start; }
    #question-area { padding: 14px 16px; }
    #question-text { font-size: 0.9rem; }
    .answer-btn { font-size: 0.8rem; padding: 10px 11px; }
    #answers-grid { gap: 8px; }
    #reaction-box { padding: 14px 18px 18px; }
    #reaction-text { font-size: 0.9rem; }
    #end-layer { padding: 24px 20px 40px; gap: 14px; }
    #end-char { width: 110px; }
    #end-score-big { font-size: 2.2rem; }
}

/* ══ Écran sélection de langue ══ */
/* ══ Bouton toggle langue ══ */
#lang-toggle {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 99999;
    background: #1a4d3a;
    border: 2px solid rgba(247,201,72,0.8);
    border-radius: 50px;
    padding: 7px 16px;
    cursor: pointer;
    color: #fff;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    transition: background 0.2s, transform 0.15s;
}
#lang-toggle.visible { display: flex; }
#lang-toggle:hover { background: rgba(247,201,72,0.25); transform: scale(1.05); }
