/**
 * Overrides - Quiz World Cup 2026
 */

:root {
    --wc-background: url('../images/wc-background.jpg');
    --wc-map-scale: 1.5;
    /* Taille de base (avant scale) pour que 150 % tienne dans l'écran */
    --wc-map-base-w: min(42vw, 420px, calc((100vw - 48px) / var(--wc-map-scale)));
    --wc-map-base-h: min(59vh, 620px, calc((100dvh - 140px) / var(--wc-map-scale)));
}

/* Fond photo sur tous les écrans */
.screen,
#start-screen,
#stages-screen,
#quiz-screen,
#stage-complete-screen,
#final-screen {
    background-image: var(--wc-background) !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

#start-screen,
#stages-screen,
#quiz-screen,
#stage-complete-screen,
#final-screen {
    background: linear-gradient(135deg, rgba(1, 8, 30, 0.55) 0%, rgba(3, 26, 74, 0.65) 100%),
        var(--wc-background) center/cover no-repeat !important;
}

.screen::before {
    background: linear-gradient(135deg, rgba(1, 8, 30, 0.40) 0%, rgba(3, 26, 74, 0.30) 100%) !important;
}

/* Halos bleu marine + rouge WC sur le fond */
.game-container::before {
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0, 71, 187, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(227, 24, 55, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.06) 0%, transparent 50%);
}

/* Bouton switch langue (intégré dans .header-right) */
.btn-lang-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    background: #ffdd00;
    color: var(--color-blue);
    border: 2px solid #ffdd00;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(255, 221, 0, 0.4);
    transition: all var(--transition-normal);
    -webkit-appearance: none;
    appearance: none;
}

.btn-lang-switch:hover {
    box-shadow: 0 6px 22px rgba(255, 221, 0, 0.6);
    transform: translateY(-1px);
}

/* Bouton langue sur la HP : positionné en haut à droite dans le start-screen */
.btn-lang-hp {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
}

@media (max-width: 768px) {
    .btn-lang-switch {
        padding: 6px 14px;
        font-size: 11px;
    }
    .btn-lang-hp {
        top: 10px;
        right: 10px;
    }
}

/* ==================== THÈME BLANC : titres, score, fullscreen, CTA ==================== */

/* Titre du parcours (carte) */
.stages-header h1 {
    color: #FFFFFF !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

/* Titre des étapes pendant le quiz */
.quiz-header h1,
#stage-title {
    color: #FFFFFF !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

/* Encart Score Total */
.total-score {
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.10) !important;
    border: 2px solid #FFFFFF !important;
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.2);
}

.total-score span {
    color: #FFFFFF !important;
}

/* Bouton plein écran */
.btn-fullscreen {
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.10) !important;
    border: 2px solid #FFFFFF !important;
}

.btn-fullscreen:hover {
    background: #FFFFFF !important;
    color: var(--color-blue) !important;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.45) !important;
}

/* CTA "Pays suivant" sur la carte */
.btn-next-stage-map {
    background: #ffdd00 !important;
    color: var(--color-blue) !important;
    border: 2px solid #ffdd00 !important;
    box-shadow: 0 4px 16px rgba(255, 221, 0, 0.35) !important;
    animation: wcYellowCtaPulse 2.2s ease infinite !important;
}

.btn-next-stage-map:hover {
    background: #ffdd00 !important;
    color: var(--color-blue) !important;
    box-shadow: 0 6px 26px rgba(255, 221, 0, 0.55) !important;
    transform: translateY(-2px) scale(1.04) !important;
}

.btn-next-stage-map:disabled {
    background: rgba(255, 221, 0, 0.35) !important;
    color: rgba(1, 15, 46, 0.5) !important;
    border-color: rgba(255, 221, 0, 0.35) !important;
    box-shadow: none !important;
    animation: none !important;
}

@keyframes wcYellowCtaPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(255, 221, 0, 0.35); }
    50%      { box-shadow: 0 4px 24px rgba(255, 221, 0, 0.65); }
}

/* CTA "Voir la carte" / "Étape suivante" sur l'écran de fin d'étape */
.btn-map,
.btn-next-stage,
.btn-restart {
    background: #ffdd00 !important;
    color: var(--color-blue) !important;
    border: 2px solid #ffdd00 !important;
    box-shadow: 0 4px 16px rgba(255, 221, 0, 0.35) !important;
}

.btn-map:hover,
.btn-next-stage:hover,
.btn-restart:hover {
    background: #ffdd00 !important;
    color: var(--color-blue) !important;
    box-shadow: 0 6px 26px rgba(255, 221, 0, 0.55) !important;
}

/* ==================== MODALE INTERNE (Quitter) ==================== */
.wc-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.wc-modal.is-open {
    opacity: 1;
}

.wc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 8, 30, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.wc-modal-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    padding: 36px 32px 28px;
    background: linear-gradient(135deg, #052066 0%, #010F2E 100%);
    border: 2px solid #FFFFFF;
    border-radius: 18px;
    text-align: center;
    color: #FFFFFF;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 22px rgba(255, 255, 255, 0.15);
    transform: translateY(14px) scale(0.96);
    transition: transform 0.25s cubic-bezier(.22,1,.36,1);
}

.wc-modal.is-open .wc-modal-box {
    transform: translateY(0) scale(1);
}

.wc-modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
    line-height: 1;
}

.wc-modal-box h2 {
    margin: 0 0 12px;
    font-size: 22px;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.wc-modal-box p {
    margin: 0 0 26px;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

.wc-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.wc-modal-btn {
    flex: 1 1 140px;
    padding: 13px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-normal);
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid transparent;
}

.wc-modal-cancel {
    background: #ffdd00;
    color: var(--color-blue);
    border-color: #ffdd00;
}

.wc-modal-cancel:hover {
    box-shadow: 0 6px 22px rgba(255, 221, 0, 0.55);
    transform: translateY(-1px);
}

.wc-modal-confirm {
    background: var(--color-red);
    color: #FFFFFF;
    border-color: var(--color-red);
}

.wc-modal-confirm:hover {
    background: var(--color-red-dark);
    border-color: var(--color-red-dark);
    box-shadow: 0 6px 22px rgba(227, 24, 55, 0.6);
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .wc-modal-box {
        padding: 28px 22px 22px;
    }
    .wc-modal-box h2 { font-size: 18px; }
    .wc-modal-box p  { font-size: 13px; margin-bottom: 22px; }
    .wc-modal-btn    { padding: 12px 16px; font-size: 12px; }
}

/* ==================== ÉCRAN QUIZ : tout en blanc ==================== */

/* Header quiz : faire de la place pour le bouton Quitter */
#quiz-screen .quiz-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
}

#quiz-screen .quiz-header h1 {
    flex: 1 1 auto;
    text-align: center;
    margin: 0 8px;
}

/* Bouton Quitter */
.btn-quit-quiz {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #ffdd00;
    color: var(--color-blue);
    border: 2px solid #ffdd00;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-normal);
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
}

.btn-quit-quiz:hover {
    background: #ffdd00;
    border-color: #ffdd00;
    color: var(--color-blue);
    box-shadow: 0 0 16px rgba(255, 221, 0, 0.55);
    transform: translateY(-1px);
}

.btn-quit-quiz:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .btn-quit-quiz {
        padding: 6px 12px;
        font-size: 11px;
    }
}


/* Cadre principal de la question : bordure rouge WC */
#quiz-screen .question-box {
    border-color: var(--color-red) !important;
    box-shadow: 0 0 18px rgba(227, 24, 55, 0.35) !important;
}

#quiz-screen #question-text {
    color: #FFFFFF !important;
}

/* Compteur Q 1/10 */
#quiz-screen #question-counter {
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.10) !important;
    border: 2px solid #FFFFFF !important;
}

/* Boutons de réponse A / B / C / D */
#quiz-screen .answers-container.answers-vf {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

#quiz-screen .answer-btn {
    border-color: rgba(255, 255, 255, 0.5) !important;
}

#quiz-screen .answer-btn:hover:not(:disabled) {
    border-color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

#quiz-screen .answer-btn .answer-letter {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #FFFFFF !important;
    border: 2px solid #FFFFFF !important;
}

#quiz-screen .answer-btn .answer-text {
    color: #FFFFFF !important;
}

/* Bonne réponse : vert */
#quiz-screen .answer-btn.correct {
    background: rgba(0, 196, 91, 0.22) !important;
    border-color: var(--color-success) !important;
    box-shadow: 0 0 16px rgba(0, 196, 91, 0.45) !important;
}

#quiz-screen .answer-btn.correct .answer-letter {
    background: var(--color-success) !important;
    border-color: var(--color-success) !important;
    color: #FFFFFF !important;
}

#quiz-screen .answer-btn.correct .answer-text {
    color: #FFFFFF !important;
}

/* Mauvaise réponse : rouge */
#quiz-screen .answer-btn.incorrect {
    background: rgba(227, 24, 55, 0.22) !important;
    border-color: var(--color-red) !important;
    box-shadow: 0 0 16px rgba(227, 24, 55, 0.45) !important;
}

#quiz-screen .answer-btn.incorrect .answer-letter {
    background: var(--color-red) !important;
    border-color: var(--color-red) !important;
    color: #FFFFFF !important;
}

#quiz-screen .answer-btn.incorrect .answer-text {
    color: #FFFFFF !important;
}

/* Timer + score footer */
#quiz-screen #timer {
    color: #FFFFFF !important;
    border-color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.10) !important;
}

#quiz-screen #timer.warning {
    color: #FFFFFF !important;
    border-color: #FFFFFF !important;
    background: rgba(227, 24, 55, 0.55) !important;
}

#quiz-screen #score {
    color: #FFFFFF !important;
    border-color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.10) !important;
}

#quiz-screen #score::before {
    color: #FFFFFF !important;
}

/* ==================== ÉCRANS RÉSULTAT : tout en blanc ==================== */

#stage-complete-screen .stage-complete-content,
#final-screen .final-content {
    border-color: #FFFFFF !important;
    box-shadow: var(--shadow-card), 0 0 24px rgba(255, 255, 255, 0.18) !important;
}

/* Logo WC en haut des écrans résultat */
.wc-result-logo {
    display: block;
    width: clamp(110px, 16vw, 200px);
    max-height: 18vh;
    height: auto;
    margin: 0 auto 14px;
    object-fit: contain;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
    animation: float 3s ease-in-out infinite;
}

/* Écrans résultats : conteneur scrollable et adaptatif */
#stage-complete-screen,
#final-screen {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#stage-complete-screen .stage-complete-content,
#final-screen .final-content {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    box-sizing: border-box;
}

/* Mode paysage / faible hauteur : tout compacter */
@media (max-height: 600px) {
    .wc-result-logo {
        width: clamp(72px, 14vh, 120px) !important;
        max-height: 14vh !important;
        margin: 0 auto 6px !important;
    }

    #stage-complete-screen .stage-complete-content,
    #final-screen .final-content {
        padding: 16px 22px !important;
        max-width: min(560px, 92vw) !important;
        max-height: calc(100dvh - 16px) !important;
    }

    #stage-complete-screen h1,
    #final-screen h1 {
        font-size: clamp(18px, 4vh, 24px) !important;
        margin: 4px 0 6px !important;
    }

    #stage-complete-screen h2,
    #final-screen h2 {
        font-size: clamp(13px, 2.6vh, 16px) !important;
        margin: 0 0 6px !important;
    }

    #stage-complete-screen .stars,
    #final-screen .stars {
        margin: 4px 0 8px !important;
    }

    #stage-complete-screen .star,
    #final-screen .star {
        font-size: clamp(20px, 4vh, 28px) !important;
    }

    #stage-complete-screen .stage-score {
        margin: 6px auto 10px !important;
        padding: 8px 14px !important;
    }

    #stage-complete-screen .stage-score p,
    #stage-complete-screen #stage-score {
        font-size: clamp(13px, 2.4vh, 16px) !important;
        margin: 2px 0 !important;
    }

    #stage-complete-screen .stage-complete-buttons,
    #final-screen .final-stats {
        margin-top: 8px !important;
        gap: 10px !important;
    }

    #stage-complete-screen .btn-map,
    #stage-complete-screen .btn-next-stage,
    #final-screen .btn-restart {
        padding: 10px 18px !important;
        font-size: 12px !important;
    }

    #final-screen .stat-value {
        font-size: clamp(20px, 4vh, 30px) !important;
    }

    #final-screen .stat-label {
        font-size: clamp(10px, 1.8vh, 12px) !important;
    }
}

@media (max-height: 420px) {
    .wc-result-logo {
        display: none !important;
    }
}

#stage-complete-screen h1,
#final-screen h1 {
    color: #FFFFFF !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: #FFFFFF !important;
    background-clip: initial !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#stage-complete-screen h2,
#final-screen h2 {
    color: #FFFFFF !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

#stage-complete-screen .stage-score {
    border-color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

#stage-complete-screen .stage-score p,
#stage-complete-screen #stage-score,
#stage-complete-screen #stage-accuracy {
    color: #FFFFFF !important;
}

#final-screen .stat-value {
    color: #FFFFFF !important;
}

#final-screen .stat-label {
    color: #FFFFFF !important;
}

/* ==================== ÉCRAN D'ACCUEIL : LOGO + JOUEURS ==================== */
/* Pas de !important sur display pour laisser le JS masquer l'écran */
#start-screen {
    padding: 0;
    align-items: center;
    justify-content: center;
}

#start-screen .wc-hero {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 3vw, 64px);
    width: 100%;
    max-width: 1600px;
    height: 100%;
    padding: clamp(12px, 3vh, 40px) clamp(16px, 4vw, 60px);
    box-sizing: border-box;
}

#start-screen .wc-hero-left {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(16px, 3vh, 36px);
    min-width: 0;
}

#start-screen .wc-hero-right {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

#start-screen .wc-hero-logo {
    display: block;
    width: 100%;
    max-width: min(48vw, 640px);
    max-height: 75vh;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.45));
    animation: wcHeroFadeUp 0.8s ease both;
}

#start-screen .wc-hero-cta {
    display: inline-block;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    line-height: 0;
    transition: transform var(--transition-normal);
    animation: wcHeroFadeUp 0.9s 0.15s ease both;
}

#start-screen .wc-hero-cta:hover {
    transform: scale(1.05);
}

#start-screen .wc-hero-cta:active {
    transform: scale(0.97);
}

#start-screen .wc-hero-cta-img {
    display: block;
    width: 100%;
    max-width: min(36vw, 360px);
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

#start-screen .wc-hero-players {
    display: block;
    width: 100%;
    max-width: min(52vw, 820px);
    max-height: 88vh;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 14px 36px rgba(0, 0, 0, 0.55));
    animation: wcHeroFadeUp 0.9s 0.1s ease both;
}

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

/* Tablette / mobile portrait : empiler logo (+ CTA) au-dessus des joueurs */
@media (max-width: 768px), (orientation: portrait) and (max-width: 900px) {
    #start-screen .wc-hero {
        flex-direction: column;
        gap: clamp(8px, 2vh, 20px);
        padding: clamp(10px, 2vh, 24px);
    }

    #start-screen .wc-hero-left,
    #start-screen .wc-hero-right {
        flex: 0 0 auto;
        width: 100%;
    }

    #start-screen .wc-hero-logo {
        max-width: min(78vw, 480px);
        max-height: 38vh;
    }

    #start-screen .wc-hero-cta-img {
        max-width: min(60vw, 280px);
    }

    #start-screen .wc-hero-players {
        max-width: min(92vw, 600px);
        max-height: 46vh;
    }
}

/* Écrans larges : laisser les images grandir davantage */
@media (min-width: 1400px) {
    #start-screen .wc-hero-logo {
        max-width: min(46vw, 760px);
    }

    #start-screen .wc-hero-cta-img {
        max-width: min(32vw, 420px);
    }

    #start-screen .wc-hero-players {
        max-width: min(50vw, 980px);
    }
}

.game-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Carte SVG : centrée, ×150 %, entièrement visible (desktop + mobile) */
#stages-screen .stages-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#stages-screen .wc-stages-map.civ-map {
    position: absolute;
    left: 50%;
    top: 50%;
    margin: 0 !important;
    width: var(--wc-map-base-w) !important;
    height: var(--wc-map-base-h) !important;
    max-width: calc((100vw - 32px) / var(--wc-map-scale)) !important;
    max-height: calc((100dvh - 120px) / var(--wc-map-scale)) !important;
    aspect-ratio: 1006 / 899 !important;
    transform: translate(-50%, -50%) scale(var(--wc-map-scale));
    transform-origin: center center;
}

#stages-screen .wc-stages-map .map-svg-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    filter: drop-shadow(0 0 28px rgba(255, 215, 0, 0.35));
}

#stages-screen .wc-map-inner {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#stages-screen .wc-map-inner .map-svg-img {
    z-index: 1;
}

#stages-screen .wc-map-inner .stage-lines {
    z-index: 6 !important;
}

#stages-screen .wc-map-inner .stages-points {
    z-index: 10 !important;
}

/* Trait de parcours bien visible (contour blanc + doré) */
#stages-screen .stage-route-outline {
    vector-effect: non-scaling-stroke;
}

#stages-screen .stage-route {
    vector-effect: non-scaling-stroke;
    opacity: 1 !important;
}

/* Piques PNG uniquement — fond transparent (PNG + CSS) */
#stages-screen .wc-location-pin.stage-point {
    top: var(--map-y) !important;
    left: var(--map-x) !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    opacity: 1 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    transform: translate(-50%, -100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0;
    cursor: not-allowed;
}

#stages-screen .wc-location-pin.stage-point::before,
#stages-screen .wc-location-pin.stage-point::after {
    display: none !important;
    content: none !important;
}

#stages-screen .wc-location-pin .pin-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    background: transparent !important;
    border: none;
    box-shadow: none;
    overflow: visible;
    transform: translateY(0);
    will-change: transform;
}

#stages-screen .wc-location-pin .location-pin-img {
    display: block;
    width: clamp(52px, 6vh, 80px);
    height: auto;
    max-width: none;
    object-fit: contain;
    background: transparent !important;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
    transition: filter var(--transition-normal), transform var(--transition-normal);
}

#stages-screen .wc-location-pin .stage-number {
    position: absolute;
    top: 2px;
    right: 0;
    margin: 0;
    font-size: 9px;
    font-weight: 800;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    padding: 1px 4px;
    border-radius: 50%;
    min-width: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 2;
    line-height: 1.2;
    pointer-events: none;
    box-shadow: none;
}

#stages-screen .wc-location-pin .stage-name {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    margin-top: 2px;
    font-size: 8px;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    color: #fff !important;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    text-shadow:
        0 0 6px rgba(0, 0, 0, 0.95),
        0 1px 3px rgba(0, 0, 0, 1),
        0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Pays actif : rebond haut-bas sur la pique (pas sur le bouton — évite conflit transform !important) */
#stages-screen .wc-location-pin.stage-point.available {
    cursor: pointer;
    opacity: 1 !important;
    animation: none !important;
}

#stages-screen .wc-location-pin.available .pin-wrap {
    animation: wcPinBounceInner 0.85s ease-in-out infinite;
}

#stages-screen .wc-location-pin.available .location-pin-img {
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 10px rgba(227, 24, 55, 0.4));
}

#stages-screen .wc-location-pin.available .stage-number {
    background: linear-gradient(135deg, var(--color-gold-dark), var(--color-gold));
    border-color: var(--color-gold-light);
}

#stages-screen .wc-location-pin.available .stage-name {
    color: var(--color-gold) !important;
    text-shadow:
        0 0 8px rgba(255, 215, 0, 0.9),
        0 1px 3px rgba(0, 0, 0, 1);
}

#stages-screen .wc-location-pin.completed {
    cursor: pointer;
    opacity: 1 !important;
}

#stages-screen .wc-location-pin.completed .location-pin-img {
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 12px rgba(0, 166, 81, 0.5));
}

#stages-screen .wc-location-pin.completed:hover {
    transform: translate(-50%, -100%) scale(1.08);
}

#stages-screen .wc-location-pin.completed .stage-number {
    background: var(--color-accent-dark);
    border-color: var(--color-accent-light);
}

#stages-screen .wc-location-pin.completed .stage-number::after {
    display: none !important;
}

#stages-screen .wc-location-pin.completed .stage-name {
    color: var(--color-accent-light) !important;
    text-shadow:
        0 0 8px rgba(0, 196, 91, 0.8),
        0 1px 3px rgba(0, 0, 0, 1);
}

#stages-screen .wc-location-pin:not(.available):not(.completed) .location-pin-img {
    filter: grayscale(0.2) brightness(0.9) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

/* Lueur rouge sur le trait de route */
#stages-screen .stage-route {
    stroke: #FFD700 !important;
}

@keyframes wcPinBounceInner {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-14px);
    }
}

/* Traits : version desktop par défaut */
.stage-routes-mobile {
    display: none;
}

/* ========== MOBILE UNIQUEMENT (≤768px) ========== */
@media (max-width: 768px) {
    .stage-routes-desktop {
        display: none;
    }

    .stage-routes-mobile {
        display: block;
    }

    #stages-screen {
        overflow-y: auto;
    }

    /* Centrage vertical : la carte + légende + CTA occupent toute la hauteur disponible */
    #stages-screen .stages-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
        width: 100% !important;
        height: calc(100dvh - 70px) !important;
        min-height: 0 !important;
        padding: 10px 10px !important;
        overflow: visible !important;
        box-sizing: border-box;
    }

    /* Carte en flux, taille contrainte pour que tout tienne avec légende + CTA */
    #stages-screen .wc-stages-map.civ-map {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        order: 0 !important;
        flex-shrink: 1;
        width: 92vw !important;
        max-width: 400px !important;
        height: auto !important;
        max-height: calc(100dvh - 200px) !important;
        aspect-ratio: 1006 / 899 !important;
        margin: 0 auto !important;
        transform: none !important;
    }

    #stages-screen .wc-map-inner .map-svg-img {
        object-fit: contain !important;
    }

    #stages-screen .stage-route-outline {
        stroke-width: 4px;
    }

    #stages-screen .stage-route {
        stroke-width: 2.5px;
    }

    /* Positions des piques — calibrées mobile */
    #stages-screen .wc-location-pin[data-country="canada"] {
        --map-x: 31% !important;
        --map-y: 27% !important;
    }

    #stages-screen .wc-location-pin[data-country="usa"] {
        --map-x: 63% !important;
        --map-y: 56% !important;
    }

    #stages-screen .wc-location-pin[data-country="mexico"] {
        --map-x: 32% !important;
        --map-y: 74% !important;
    }

    #stages-screen .wc-location-pin .location-pin-img {
        width: clamp(40px, 11vw, 54px);
    }

    #stages-screen .wc-location-pin .stage-name {
        font-size: 7px;
        margin-top: 1px;
    }

    /* Légende : sous la carte */
    #stages-screen .stages-legend {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        order: 1 !important;
        z-index: 25;
        width: 92% !important;
        max-width: 360px !important;
        margin: 16px auto 0 !important;
        padding: 12px 20px !important;
        flex-direction: row !important;
        justify-content: center !important;
        gap: 18px !important;
        background: rgba(0, 0, 0, 0.9) !important;
        border-radius: 22px !important;
    }

    #stages-screen .stages-legend h4 {
        display: none;
    }

    /* CTA : sous la légende, grand espace entre les deux */
    #stages-screen .next-stage-container {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        top: auto !important;
        transform: none !important;
        order: 2 !important;
        z-index: 25;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        margin-top: 20px !important;
        margin-bottom: 8px !important;
        padding: 0 !important;
    }

    #stages-screen .btn-next-stage-map {
        display: inline-block !important;
        margin: 0 auto !important;
        padding: 14px 32px !important;
        font-size: 14px !important;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --wc-map-base-w: min(32vh, calc((100vw - 200px) / var(--wc-map-scale)));
        --wc-map-base-h: min(calc((100dvh - 80px) / var(--wc-map-scale)), 72vh);
    }
}

