/* ==========================================================================
   Cap au port ! — styles du module (scopés sous .bscap)
   ========================================================================== */

.bscap {
    --bscap-btn: #1e6fbf;
    --bscap-btn-text: #ffffff;
    --bscap-title: #17306b;
    --bscap-ink: #16233a;
    --bscap-muted: #5b6b7d;
    --bscap-paper: #ffffff;
    --bscap-line: #d7e3ec;
    --bscap-radius: 14px;
    --bscap-shadow: 0 6px 24px rgba(15, 35, 60, .10);
    position: relative;
    isolation: isolate;
    z-index: 0;
    box-sizing: border-box;
    max-width: 1040px;
    margin: 0 auto;
    padding: 24px 16px 40px;
    color: var(--bscap-ink);
    font-family: "Helvetica Neue", Arial, system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
}
.bscap *, .bscap *::before, .bscap *::after { box-sizing: border-box; }
.bscap h1, .bscap h2, .bscap h3 { color: var(--bscap-title); line-height: 1.25; margin: .4em 0; text-shadow: none; }
.bscap h1 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); }
.bscap h2 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
.bscap h3 { font-size: 1.1rem; }
.bscap p { margin: .4em 0; }
.bscap a { color: var(--bscap-btn); }
.bscap-hidden { display: none !important; }

/* Bandeau mode test */
.bscap-test-banner {
    margin: 0 auto 16px;
    padding: 8px 14px;
    max-width: 640px;
    border-radius: 999px;
    background: #fff4d6;
    color: #7a4b00;
    font-weight: 600;
    border: 1px solid #f0c75e;
}

/* Cartes */
.bscap-card {
    background: var(--bscap-paper);
    border: 1px solid var(--bscap-line);
    border-radius: var(--bscap-radius);
    box-shadow: var(--bscap-shadow);
    padding: 24px;
    max-width: 560px;
    margin: 0 auto 16px;
    text-align: left;
}
.bscap-card h1, .bscap-card h2 { text-align: center; }
.bscap-period-logo { display: block; max-height: 250px; max-width: 70%; margin: 0 auto 12px; object-fit: contain; }
.bscap-intro { white-space: normal; color: var(--bscap-ink); }
.bscap-note { font-size: .9rem; color: var(--bscap-muted); text-align: center; }
.bscap-error { color: #b00020; font-weight: 600; text-align: center; }
.bscap-small { font-size: .9rem; color: var(--bscap-muted); }

/* Formulaires */
.bscap-form { display: flex; flex-direction: column; gap: 6px; }
.bscap-form label { font-weight: 600; margin-top: 8px; }
.bscap-form input[type=email] {
    width: 100%; padding: 11px 12px; font-size: 1rem;
    border: 1px solid var(--bscap-line); border-radius: 10px; background: #fbfdff;
}
.bscap-form input[type=email]:focus { outline: 2px solid var(--bscap-btn); outline-offset: 1px; }
.bscap-form .bscap-consent { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--bscap-muted); font-size: .92rem; }
.bscap-form .bscap-consent input { margin-top: 4px; }
/* Case anti-robots : hors écran, indépendamment de la feuille de style du thème */
.bscap-hp { position: absolute !important; left: -10000px !important; top: auto !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

/* Boutons */
.bscap-btn {
    display: inline-block;
    width: 100%;
    max-width: 360px;
    margin: 8px auto;
    padding: 12px 18px;
    border: 1px solid var(--bscap-line);
    border-radius: 10px;
    background: #f4f8fb;
    color: var(--bscap-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.bscap-btn:hover { box-shadow: 0 4px 14px rgba(15, 35, 60, .12); text-decoration: none; }
.bscap-btn:active { transform: translateY(1px); }
.bscap-btn-main { background: var(--bscap-btn); border-color: var(--bscap-btn); color: var(--bscap-btn-text); }
.bscap-btn-small { width: auto; max-width: none; padding: 7px 14px; font-size: .9rem; margin: 6px 0 0; }
.bscap-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ==========================================================================
   Zone de jeu : le canevas occupe la place, les écrans se superposent
   proprement par-dessus, sans débordement.
   ========================================================================== */
.bscap-game { margin: 0 auto; }
.bscap-stage { position: relative; width: 100%; height: 100%; margin: 0 auto; border-radius: var(--bscap-radius); overflow: hidden; background: #2a8bbf; box-shadow: var(--bscap-shadow); }
#bscap-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; user-select: none; -webkit-user-select: none; }

.bscap-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    overflow-y: auto;
    background: rgba(8, 30, 52, .78);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.bscap-overlay > * { max-width: 100%; }
.bscap-overlay h1 { color: #fff; font-size: clamp(1.3rem, 4vw, 1.9rem); margin: 0; text-shadow: 0 2px 6px rgba(0,0,0,.35); }
.bscap-overlay .bscap-card { max-width: 100%; width: min(100%, 360px); margin: 0; padding: 16px 18px; }
.bscap-overlay .bscap-card h2 { font-size: 1.3rem; margin: 0 0 6px; }
.bscap-logo { max-height: 44px; max-width: 58%; width: auto; height: auto; object-fit: contain; background: #fff; padding: 5px 10px; border-radius: 8px; }
.bscap-lead { color: #fff; margin: 0; font-size: .98rem; text-shadow: 0 1px 4px rgba(0,0,0,.35); }
.bscap-overlay > .bscap-small { color: #dbeaf5; margin: 0; font-size: .85rem; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
/* Dans la carte blanche (score, message d'enregistrement) : texte foncé, sans ombre */
.bscap-overlay .bscap-card .bscap-small { color: var(--bscap-ink); margin: 6px 0; font-size: .92rem; font-weight: 600; text-shadow: none; }
.bscap-ports { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.bscap-port { padding: 6px 12px; border: 1px solid #fff; border-radius: 999px; background: rgba(255,255,255,.9); color: var(--bscap-ink); font: inherit; font-size: .85rem; cursor: pointer; }
.bscap-port.sel { background: #ffd166; border-color: #ffd166; font-weight: 600; }
.bscap-overlay .bscap-btn { width: auto; min-width: 180px; margin: 4px 0; }
.bscap-score-l { font-size: .75rem; letter-spacing: .08em; color: var(--bscap-muted); margin: 6px 0 0; }
.bscap-score-v { font-size: 1.8rem; font-weight: 700; color: var(--bscap-btn); margin: 0; }
.bscap-promo { background: #fff4d6; border: 1px dashed #d9a441; border-radius: 10px; padding: 8px 10px; margin: 6px 0; color: var(--bscap-ink); }

/* HUD et bulles, en bandeau sous le haut de la zone de jeu */
#bscap-hud {
    position: absolute; left: 0; right: 0; top: 0; z-index: 4;
    display: flex; justify-content: space-between; align-items: center;
    height: 36px; padding: 0 12px;
    background: linear-gradient(rgba(6, 26, 43, .55), rgba(6, 26, 43, 0));
    color: #fff; font-weight: 700; font-size: .95rem;
    pointer-events: none;
}
#bscap-tip {
    position: absolute; left: 10px; right: 10px; top: 44px; z-index: 4;
    padding: 8px 12px; border-radius: 10px;
    background: rgba(255, 255, 255, .96); color: var(--bscap-ink);
    font-size: .88rem; line-height: 1.35; text-align: left;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    pointer-events: none;
}
#bscap-tip b { display: block; color: var(--bscap-btn); font-size: .72rem; letter-spacing: .06em; margin-bottom: 2px; }
#bscap-tip a { pointer-events: auto; color: var(--bscap-btn); font-weight: 700; }
#bscap-toast {
    position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 6;
    background: rgba(6, 26, 43, .9); color: #fff; padding: 6px 14px; border-radius: 999px;
    white-space: nowrap; font-size: .85rem;
}
#bscap-mute {
    position: absolute; right: 8px; bottom: 8px; z-index: 6;
    padding: 4px 9px; border: 1px solid rgba(255,255,255,.5); border-radius: 999px;
    background: rgba(6, 26, 43, .7); color: #fff; font: inherit; font-size: .75rem; cursor: pointer;
}

/* ==========================================================================
   Quiz
   ========================================================================== */
.bscap-quiz { max-width: 620px; margin: 0 auto; }
.bscap-quiz .bscap-quiz-box { text-align: center; }
.bscap-q { font-size: clamp(1.1rem, 2.6vw, 1.35rem); margin: 10px 0; }
.bscap-q-small { font-weight: 700; margin: 0 0 4px; text-align: left; }
.bscap-answer { font-weight: 500; text-transform: none; text-align: left; }
.bscap-result { border: 1px solid var(--bscap-line); border-left: 5px solid var(--bscap-line); border-radius: 10px; padding: 12px; margin: 10px 0; text-align: left; background: #fff; }
.bscap-ok { border-left-color: #2e7d32; }
.bscap-ko { border-left-color: #b00020; }

/* ==========================================================================
   Simulateur
   ========================================================================== */
.bscap-sim { max-width: 640px; margin: 0 auto; }
.bscap-sim .bscap-sim-box { text-align: left; }
.bscap-cat { font-size: 1rem; margin: 18px 0 6px; color: var(--bscap-title); border-bottom: 1px solid var(--bscap-line); padding-bottom: 4px; }
.bscap-item { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 0; cursor: pointer; }
.bscap-item input { width: 18px; height: 18px; }

/* ==========================================================================
   Calendrier de l'Avent
   ========================================================================== */
.bscap-cal-card { max-width: 760px; }
.bscap-cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 14px; }
.bscap-cal-door {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 92px; padding: 10px 6px; text-align: center;
    border: 1px solid var(--bscap-line); border-radius: 12px; background: #fff; color: var(--bscap-ink);
}
.bscap-cal-num { font-size: 1.5rem; font-weight: 800; color: var(--bscap-title); line-height: 1; }
.bscap-cal-date { font-size: .72rem; color: var(--bscap-muted); }
.bscap-cal-txt { font-size: .8rem; }
.bscap-cal-code { font-size: .78rem; word-break: break-all; color: #2e7d32; }
.bscap-cal-today { border-color: var(--bscap-btn); box-shadow: 0 0 0 2px rgba(30,111,191,.25); }
.bscap-cal-missed, .bscap-cal-future { opacity: .55; background: #f7fafc; }
.bscap-cal-opened { background: #eef7ea; border-color: #bfe0b3; }

/* ==========================================================================
   Liste des jeux
   ========================================================================== */
.bscap-list h1 { margin-bottom: 14px; }
.bscap-list h2 { text-align: left; margin-top: 22px; }
.bscap-cards { display: inline-block; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 12px; }
.bscap-gamecard { display: flex; flex-direction: column; margin: 0; }
.bscap-gamecard h3 { margin: 6px 0; }
.bscap-gamecard .bscap-btn { margin-top: auto; max-width: 100%; }

/* Petits écrans */
@media (max-width: 560px) {
    .bscap { padding: 16px 10px 32px; }
    .bscap-card { padding: 18px; }
    .bscap-btn-small { width: 100%; }
    .bscap-cal-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

/* ==========================================================================
   Correctifs 1.9.0 : contraste des boutons, navigation de fin, commandes tactiles
   ========================================================================== */

/* Les liens du thème (bleu) ne doivent jamais rendre un bouton illisible */
.bscap a.bscap-btn { color: var(--bscap-ink); }
.bscap a.bscap-btn.bscap-btn-main { color: var(--bscap-btn-text); }
.bscap a.bscap-btn:hover { color: var(--bscap-ink); }
.bscap a.bscap-btn.bscap-btn-main:hover { color: var(--bscap-btn-text); }

/* Navigation de fin de jeu : retour à nos jeux, calendrier de l'Avent */
.bscap-nav { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; margin-top: 6px; }
.bscap-nav .bscap-btn { width: 100%; max-width: 320px; margin: 0; }

/* Commandes tactiles sous le jeu (gauche / droite) */
.bscap-touch { display: flex; justify-content: space-between; gap: 12px; max-width: 560px; margin: 12px auto 0; }
.bscap-touch-btn {
    flex: 1;
    height: 64px;
    border: 1px solid var(--bscap-line);
    border-radius: 16px;
    background: #ffffff;
    color: var(--bscap-ink);
    font-size: 1.5rem;
    box-shadow: var(--bscap-shadow);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.bscap-touch-btn:active { background: var(--bscap-btn); border-color: var(--bscap-btn); color: var(--bscap-btn-text); }

/* La zone de jeu ne doit jamais faire défiler la page sur mobile */
.bscap-stage { touch-action: none; }

/* ===== 1.12.0 : calendrier — gain détaillé, partage, effets ===== */
.bscap-gain{margin:12px 0;padding:14px 16px;border-radius:10px;background:#fff8e6;border:1px solid #f0d58a;color:#2b2b2b;text-align:left}
.bscap-gain-label{margin:0 0 6px;font-size:1.15em;font-weight:700}
.bscap-gain-code{margin:6px 0;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.bscap-gain-cond{margin:6px 0 0 18px;padding:0;font-size:.92em}
.bscap-share{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:16px}
.bscap-share-title{font-weight:700;margin-right:4px}
.bscap-share-btn{display:inline-block;padding:6px 12px;border-radius:8px;border:1px solid #888;background:#fff;color:#222;font-size:.9em;text-decoration:none;cursor:pointer}
.bscap-share-btn:hover{background:#f2f2f2;color:#000}
.bscap-fx-layer{position:fixed;left:0;top:0;right:0;bottom:0;pointer-events:none;overflow:hidden;z-index:9999}
.bscap-fx-item{position:absolute;top:-40px;animation-name:bscap-fall;animation-timing-function:linear;animation-fill-mode:forwards;opacity:.9}
@keyframes bscap-fall{0%{transform:translateY(0) rotate(0)}100%{transform:translateY(110vh) rotate(360deg)}}
@media (prefers-reduced-motion: reduce){.bscap-fx-layer{display:none}}

.bscap-fx-static{text-align:center;font-size:1.6rem;letter-spacing:.3em;margin:0 0 10px;}
