/* ================================================================
   EOS — Terminal de création de personnage
   Direction artistique : terminal officiel des Nations Unies façon
   "The Expanse" — holographie bleu/glace sur fond bleu nuit profond,
   lignes fines type HUD, emblème institutionnel, sobriété
   gouvernementale plutôt que néon cyberpunk.
   ================================================================ */


* { box-sizing: border-box; }

/* Garantit que l'attribut HTML `hidden` masque toujours l'élément, même
   lorsque celui-ci (ou sa classe) définit par ailleurs un `display` fixe
   (flex/grid). Sans cette règle, une déclaration `display` d'auteur peut
   silencieusement neutraliser `hidden`. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: var(--bg-void);
    color: var(--text-primary);
    font-family: var(--font-body);
}


::selection { background: var(--accent-un-blue); color: #14181d; }

button, input, select, textarea { font-family: inherit; }

:focus-visible {
    outline: 2px solid var(--accent-ice);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------
   Effets d'interface holographique (façon codex / création de
   personnage Mass Effect) : grille technologique ambiante, faisceau
   de scan persistant, apparition "amorçage système" des cadres et
   des titres à chaque affichage d'écran.
   --------------------------------------------------------------- */


/* Amorçage des cadres HUD : ils se "dessinent" à l'apparition de
   chaque écran ou popup plutôt que d'apparaître brutalement. */
.corner {
    animation: corner-power-on 420ms ease both;
}
.corner--tl { animation-delay: 0ms; }
.corner--tr { animation-delay: 70ms; }
.corner--bl { animation-delay: 140ms; }
.corner--br { animation-delay: 210ms; }
@keyframes corner-power-on {
    from { opacity: 0; transform: scale(0.55); }
    to   { opacity: 0.7; transform: scale(1); }
}

/* Matérialisation des titres et des libellés à l'affichage d'un écran */
.eyebrow { animation: holo-fade-up 380ms ease both; }
.accueil-title, .form-title {
    animation: holo-materialize 640ms ease both;
}
@keyframes holo-fade-up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes holo-materialize {
    0%   { opacity: 0; filter: blur(5px); letter-spacing: 0.25em; }
    60%  { opacity: 1; filter: blur(0); }
    100% { opacity: 1; letter-spacing: 0.02em; }
}

/* Verrouillage de cible sur les champs actifs */
input:focus, select:focus {
    border-color: var(--accent-ice);
    animation: focus-lock-pulse 1.6s ease-in-out infinite;
}
@keyframes focus-lock-pulse {
    0%, 100% { box-shadow: 0 0 0 1px var(--accent-ice), 0 0 8px rgba(143, 217, 232, 0.25); }
    50%      { box-shadow: 0 0 0 1px var(--accent-ice), 0 0 16px rgba(143, 217, 232, 0.5); }
}

/* Reflet lumineux qui balaie les boutons principaux au survol */
.btn-primary, .btn-info { position: relative; overflow: hidden; }
.btn-primary::after, .btn-info::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 550ms ease;
    pointer-events: none;
}
.btn-primary:hover::after, .btn-info:hover::after { left: 130%; }

@media (prefers-reduced-motion: reduce) {
    .corner, .eyebrow,
    .accueil-title, .form-title, input:focus, select:focus,
    .btn-primary::after, .btn-info::after { animation: none !important; }
}

/* ---------------------------------------------------------------
   Overlay de scanlines ambiant
   --------------------------------------------------------------- */

/* ---------------------------------------------------------------
   Cadre du terminal — base console persistante (héberge la fiche
   d'état civil puis, plus tard, les autres écrans/panneaux du
   parcours narratif). Verrouillée à la hauteur de l'écran et
   surélevée au-dessus de la grille et du faisceau de scan ambiants
   (qui continuent de défiler tout autour, dans les marges visibles).
   --------------------------------------------------------------- */

/* Filigrane institutionnel : logo ONU en fond, très discret, mêlé
   au panneau par soustraction (le fond blanc de l'image disparaît). */



/* Bouton de sortie vers l'accueil du projet, présent sur toutes les étapes
   (le header est hors de <main class="screens">, donc jamais démonté). */









/* ---------------------------------------------------------------
   Corner brackets (cadre HUD)
   --------------------------------------------------------------- */
.corner-brackets { position: absolute; inset: 0; pointer-events: none; }
.corner {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-hairline-bright);
    opacity: 0.7;
}
.corner--tl { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.corner--tr { top: 14px; right: 14px; border-left: none; border-bottom: none; }
.corner--bl { bottom: 14px; left: 14px; border-right: none; border-top: none; }
.corner--br { bottom: 14px; right: 14px; border-left: none; border-top: none; }

/* ---------------------------------------------------------------
   Écrans + transitions "carte badgeuse"
   La base (terminal-frame) ne défile jamais elle-même : seul le
   panneau de contenu actif (ex. .form-panel) gère son propre
   défilement interne s'il dépasse l'espace disponible.
   --------------------------------------------------------------- */
.screens {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    padding: 40px 48px;
    overflow: hidden;
}

.screen--active { display: flex; }

/* Corps défilant + pied fixe pour l'écran d'accueil (le bouton "Créer
   personnage" reste toujours visible, même si le texte au-dessus défile). */
.screen-scroll {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.screen-scroll::-webkit-scrollbar { width: 8px; }
.screen-scroll::-webkit-scrollbar-track { background: transparent; }
.screen-scroll::-webkit-scrollbar-thumb { background: var(--border-hairline-bright); border-radius: 4px; }
.screen-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent-ice); }

.screen-footer {
    flex-shrink: 0;
    padding-top: 20px;
    margin-top: 12px;
    border-top: 1px solid var(--border-hairline);
}

.footer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}
.footer-row .campagne-row { flex: 1 1 auto; min-width: 170px; }
.footer-row .btn-cta { flex-shrink: 0; padding: 15px 24px; }

@media (max-width: 640px) {
    /* Un écran de 375 px ne laissait que 279 px utiles : les 48 px de marge
       latérale, calibrés pour le bureau, en mangeaient le quart. */
    .screen { padding: 26px 20px; }

    /* La sélection de campagne et le bouton d'appel ne tiennent pas côte à
       côte : 170 px de largeur minimale pour la première, un bouton qui
       refuse de rétrécir, et la rangée débordait du cadre par la droite de
       73 px — le bouton « Créer personnage » sortait de l'écran. Ils passent
       donc l'un sous l'autre. */
    .footer-row { flex-wrap: wrap; }
    .footer-row .campagne-row { flex: 1 1 100%; min-width: 0; }
    .footer-row .btn-cta { width: 100%; padding: 14px 20px; }
}

.accueil-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 4px;
}
.accueil-title-row .accueil-title { margin: 0; }

.popup-section + .popup-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-hairline);
}
.popup-section-title {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-ice);
    margin: 0 0 8px;
}
.popup-section-text {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-muted);
    white-space: pre-line;
}

.screen--exit-left {
    display: flex;
    animation: screen-exit-left var(--transition-screen) ease forwards;
}
.screen--enter-right {
    display: flex;
    animation: screen-enter-right var(--transition-screen) ease forwards;
}

@keyframes screen-exit-left {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(-6%); opacity: 0; }
}
@keyframes screen-enter-right {
    from { transform: translateX(6%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* Flash de scan lors du passage d'écran, façon badge lu par un lecteur */
.scan-flash {
    position: fixed;
    inset: 0;
    z-index: 600;
    pointer-events: none;
    background: linear-gradient(90deg, transparent 0%, rgba(143, 217, 232, 0.35) 50%, transparent 100%);
    transform: translateX(-100%);
}
.scan-flash.run { animation: scan-sweep 480ms ease; }
@keyframes scan-sweep {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ---------------------------------------------------------------
   Écran d'accueil
   --------------------------------------------------------------- */
.banner-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1821 / 864;
    overflow: hidden;
    border: 1px solid var(--border-hairline);
    margin-bottom: 28px;
    background: var(--panel-steel);
}
.banner-img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.9) contrast(1.05); }
.banner-scan {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0,0,0,0.15) 3px);
    mix-blend-mode: multiply;
    pointer-events: none;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-ice);
    margin: 0 0 10px;
}

.eyebrow--with-info { display: flex; align-items: center; gap: 8px; }

.accueil-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 42px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0 0 22px;
    color: var(--text-primary);
}

.accueil-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-muted);
    margin: 0 0 16px;
}

/* Respecte les retours à la ligne de creaperso_text.Text (paragraphes
   \n\n) pour les éléments qui affichent du contenu venant de la base —
   contrairement au paragraphe d'accueil (texte statique, mis en forme sur
   plusieurs lignes dans le HTML uniquement pour la lisibilité du code :
   ces retours à la ligne-là ne doivent PAS s'afficher, d'où l'exclusion
   volontaire de .accueil-text elle-même). */
#tutoriel-texte, #questionnaire-description {
    white-space: pre-line;
}

.accueil-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 26px 0 34px;
}

.accueil-content--centered { align-items: center; text-align: center; margin: auto; }
.accueil-content--centered .accueil-text { max-width: 560px; }

/* ---------------------------------------------------------------
   Boutons
   --------------------------------------------------------------- */
.btn-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-hairline-bright);
    color: var(--text-muted);
    font-size: 13px;
    padding: 9px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.btn-info:hover { border-color: var(--accent-ice); color: var(--accent-ice); }
.btn-info__icon {
    width: 16px; height: 16px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-family: var(--font-mono);
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--accent-un-blue);
    color: #061019;
    border: none;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 15px 34px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    align-self: flex-start;
    box-shadow: 0 0 0 1px rgba(76, 143, 209, 0.4);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(76, 143, 209, 0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: var(--text-faint); color: var(--bg-void); cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    background: transparent;
    border: 1px dashed var(--border-hairline-bright);
    color: var(--accent-ice);
    font-size: 13px;
    padding: 9px 14px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin-top: 8px;
}
.btn-secondary:hover { border-color: var(--accent-ice); background: rgba(143, 217, 232, 0.06); }

/* ---------------------------------------------------------------
   Formulaire
   Le panneau lui-même ne défile jamais : seule sa zone de contenu
   (.form-scroll) défile si besoin, verticalement uniquement. Le
   pied (.form-footer, bouton d'enregistrement) reste toujours
   visible, épinglé en bas du panneau.
   --------------------------------------------------------------- */
.form-panel {
    max-width: 780px;
    width: 100%;
    position: relative;
    z-index: 2; /* au-dessus du filigrane du cadre de base (-1) */
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    background: linear-gradient(180deg, #131c27 0%, #0e1620 100%);
    border: 1px solid var(--border-hairline-bright);
    border-radius: 3px;
    box-shadow:
        0 0 0 1px rgba(76, 143, 209, 0.08),
        0 24px 60px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.form-scroll {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 34px 38px 20px;
}
.form-scroll::-webkit-scrollbar { width: 8px; }
.form-scroll::-webkit-scrollbar-track { background: transparent; }
.form-scroll::-webkit-scrollbar-thumb { background: var(--border-hairline-bright); border-radius: 4px; }
.form-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent-ice); }

.form-title {
    font-family: var(--font-display);
    font-size: 30px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0 0 28px;
}

.form-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 28px;
}
.form-title-row .form-title { margin: 0; }

.joueur-attention {
    font-size: 13px;
    line-height: 1.5;
    color: var(--accent-alert);
    border: 1px solid var(--accent-alert);
    border-radius: var(--radius-sm);
    background: rgba(226, 87, 76, 0.08);
    padding: 12px 16px;
    margin: 0 0 24px;
}

.form-section {
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    padding: 22px 24px 8px;
    margin-bottom: 22px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.012), transparent);
}
.form-section legend {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-un-blue);
    padding: 0 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 16px;
}
.form-row--3 { grid-template-columns: 1fr 1fr auto; }
@media (max-width: 640px) {
    .form-row, .form-row--3 { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { margin-bottom: 16px; }
.field-label, label {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

input[type="text"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    min-width: 0;
    background: var(--input-bg);
    border: 1px solid var(--border-hairline-bright);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}
input:disabled { color: var(--text-faint); background: rgba(255,255,255,0.02); }
input:read-only { color: var(--text-faint); background: rgba(255,255,255,0.02); cursor: default; }

textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.legend-with-info { display: flex; align-items: center; gap: 8px; }

#notes-compteur { align-self: flex-end; }
input::placeholder { color: var(--text-faint); }

select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--accent-ice) 50%), linear-gradient(135deg, var(--accent-ice) 50%, transparent 50%); background-position: calc(100% - 18px) center, calc(100% - 13px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

.field-hint { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }

.origin-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.origin-row select { flex: 1; min-width: 0; }

.inline-field-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.inline-field-row input[type="date"] { flex: 1; min-width: 0; }

.inline-readout {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-shrink: 0;
    border-left: 2px solid var(--accent-un-blue-dim);
    padding-left: 10px;
    white-space: nowrap;
}
.inline-readout__label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); }
.inline-readout__value { font-family: var(--font-mono); font-size: 15px; color: var(--accent-un-blue); }

.btn-round-info {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--accent-ice);
    background: transparent;
    color: var(--accent-ice);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-round-info:hover {
    background: rgba(143, 217, 232, 0.12);
    box-shadow: 0 0 10px rgba(143, 217, 232, 0.45);
}

.radio-group { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.radio-pill {
    display: flex; align-items: center; gap: 5px;
    border: 1px solid var(--border-hairline-bright);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text-muted);
}
.radio-pill:has(input:checked) { border-color: var(--accent-ice); color: var(--accent-ice); background: rgba(143, 217, 232, 0.06); }

.checkbox-line { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-muted); margin-top: 4px; cursor: pointer; }
.checkbox-line--strong { color: var(--accent-alert); font-size: 13px; }

.field--with-check { position: relative; }

.adoption-block {
    border-top: 1px dashed var(--border-hairline-bright);
    margin-top: 6px;
    padding-top: 14px;
}

.fratrie-liste { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.fratrie-row { display: grid; grid-template-columns: 100px 1fr 140px 32px; gap: 8px; }
.fratrie-row select, .fratrie-row input { padding: 8px 10px; font-size: 13px; }
.fratrie-supprimer {
    background: transparent; border: 1px solid var(--border-hairline-bright); color: var(--accent-alert);
    cursor: pointer; border-radius: var(--radius-sm); font-size: 12px;
}
.fratrie-supprimer:hover { background: rgba(226, 87, 76, 0.1); }

.contact-liste, #ssp-contact-liste { display: flex; flex-direction: column; gap: 12px; margin: 6px 0; }
.contact-row {
    display: flex; flex-direction: column; gap: 8px;
    padding: 10px; border: 1px solid var(--border-hairline); border-radius: var(--radius-sm);
}
.contact-row-header { display: grid; grid-template-columns: 1fr 32px; gap: 8px; }
.contact-description { min-height: 50px; }

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-shrink: 0;
    padding: 16px 38px 26px;
    border-top: 1px solid var(--border-hairline);
}
.form-footer__status { font-family: var(--font-mono); font-size: 12px; color: var(--accent-alert); }

/* ---------------------------------------------------------------
   Popup d'information
   --------------------------------------------------------------- */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 9, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 700;
    animation: fade-in var(--transition-fast) ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.popup-panel {
    position: relative;
    background: var(--panel-steel);
    border: 1px solid var(--border-hairline-bright);
    max-width: 560px;
    width: 90%;
    max-height: 78vh;
    overflow-y: auto;
    padding: 34px 36px;
    border-radius: var(--radius-sm);
}

.popup-close {
    position: absolute;
    top: 14px; right: 14px;
    background: transparent;
    border: 1px solid var(--border-hairline-bright);
    color: var(--text-muted);
    width: 26px; height: 26px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.popup-close:hover { border-color: var(--accent-alert); color: var(--accent-alert); }

.cf-logo-field { align-items: stretch; justify-content: center; display: flex; }
.cf-logo-screen {
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(180deg, #1e2b3a 0%, #182330 100%);
    border: 1px solid var(--border-hairline-bright);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 24px rgba(143, 217, 232, 0.06);
}
.cf-corpo-logo {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
}

.popup-flag {
    display: block;
    width: 64px;
    height: 42px;
    object-fit: cover;
    border: 1px solid var(--border-hairline-bright);
    border-radius: 2px;
    margin-bottom: 16px;
    box-shadow: 0 0 10px rgba(76, 143, 209, 0.3);
}

.popup-texte {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-muted);
    white-space: pre-line;
}

.popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-hairline);
}
.popup-demo-btn { flex: 1; min-width: 140px; }

/* Popup de résultat de conséquence : titre verdict + dé d10 avec le
   résultat du jet incrusté dans la face supérieure (claire) du SVG. */
.consequence-verdict {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 18px;
}
.consequence-verdict--reussite { color: var(--accent-success); }
.consequence-verdict--echec { color: var(--accent-alert); }

.finalisation-citizen-code {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 0.12em;
    text-align: center;
    color: var(--accent-ice);
    text-shadow: 0 0 14px rgba(143, 217, 232, 0.55);
    margin: 10px 0 18px;
}

.consequence-body {
    display: flex;
    align-items: center;
    gap: 18px;
}
.consequence-body .popup-texte { flex: 1; }

.consequence-die {
    position: relative;
    width: 92px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.consequence-die-img { width: 100%; height: auto; display: block; }
.consequence-die-num {
    position: absolute;
    top: 23%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 26px;
    color: #003d5c;
    line-height: 1;
    pointer-events: none;
}

/* ---------------------------------------------------------------
   Infobulles (boutons "Télécharger en PDF" / "Vivre votre
   première aventure")
   --------------------------------------------------------------- */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip-bubble {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    width: 230px;
    padding: 9px 13px;
    background: var(--panel-steel-light);
    border: 1px solid var(--border-hairline-bright);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
    z-index: 20;
}
.tooltip-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-hairline-bright);
}
.tooltip-wrap:hover .tooltip-bubble,
.tooltip-wrap:focus-within .tooltip-bubble {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------------------------------------------------------------
   Écran 3 — Extrait d'état civil (document imprimable, format A4)
   Le document lui-même reste volontairement sobre (fond clair,
   texte noir, grisés discrets) pour rester "print-friendly" :
   aucun aplat de couleur qui alourdirait une impression.
   --------------------------------------------------------------- */
.doc-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
/* Écrans intermédiaires sans "Télécharger en PDF" (retiré le 2026-08-24,
   réservé aux documents du menu final) : un seul bouton, aligné à droite
   plutôt que poussé à gauche par le space-between. */
.doc-actions--single { justify-content: flex-end; }

.document-viewport {
    display: flex;
    justify-content: center;
    padding: 4px 0 32px;
}

.document-a4 {
    width: 210mm;
    max-width: 100%;
    min-height: 297mm;
    padding: 16mm 15mm;
    background: #fbfaf7;
    color: #1a1a1a;
    font-family: 'Georgia', 'Times New Roman', serif;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    position: relative;
}

.doc-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 12px;
    margin-bottom: 20px;
}
.doc-emblem { flex-shrink: 0; width: 58px; height: 58px; object-fit: contain; border-radius: 50%; }
.doc-emblem--corpo { width: 70px; height: 70px; }
.doc-header__titles { flex: 1; text-align: center; }
.doc-org-name { margin: 0; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: #444; }
.doc-title { margin: 4px 0 0; font-size: 20px; text-transform: uppercase; letter-spacing: 0.05em; }
.doc-subtitle { margin: 4px 0 0; font-size: 11px; color: #444; font-style: italic; }
.doc-header__ref {
    flex-shrink: 0;
    text-align: right;
    font-family: 'Cascadia Mono', Consolas, monospace;
    font-size: 10px;
    color: #333;
    white-space: nowrap;
}

.doc-section { margin-bottom: 20px; }
.doc-section__title {
    margin: 0 0 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid #1a1a1a;
    padding-bottom: 4px;
}

.doc-section__title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #1a1a1a;
    padding-bottom: 4px;
    margin-bottom: 10px;
}
.doc-section__title-row .doc-section__title { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.doc-citizen-code {
    flex-shrink: 0;
    font-family: 'Cascadia Mono', Consolas, monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
    background: #eeece5;
    white-space: nowrap;
}

/* Code mis en évidence avec un intitulé visible (Matricule/N° de badge,
   CLAUDE.md section 35) : même badge que .doc-citizen-code, avec un
   libellé au-dessus — contrairement à ID_citizen qui n'a jamais de libellé
   explicite (son sens vient du titre "Identification" à côté). */
.doc-highlight-code {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 28px;
}
.doc-field { display: flex; flex-direction: column; gap: 2px; }
.doc-field--full { grid-column: 1 / -1; }
.doc-field__label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: #555; }
.doc-field__value {
    font-size: 14px;
    font-weight: 600;
    padding-bottom: 3px;
    border-bottom: 1px dotted #999;
    display: flex;
    align-items: center;
}

.doc-flag { width: 18px; height: auto; margin-right: 7px; border: 1px solid #999; }

.doc-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
.doc-table th, .doc-table td { border: 1px solid #999; padding: 5px 9px; text-align: left; }
.doc-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; background: #eeece5; }
.doc-empty-note { margin: 12px 0 0; font-size: 12px; font-style: italic; color: #555; }
.doc-notes-texte { margin: 0; font-size: 12px; line-height: 1.6; white-space: pre-line; }
.doc-liste { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.7; }
.doc-liste li { margin-bottom: 4px; }

/* Séparateur par questionnaire dans "Mon histoire" (document Mémoire,
   CLAUDE.md section 33) : distingue chaque groupe sans avoir le poids
   visuel d'un .doc-section__title (déjà utilisé pour "Mon histoire"
   elle-même, un cran au-dessus). */
.doc-subsection-title {
    margin: 18px 0 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #555;
    border-top: 1px solid #ccc;
    padding-top: 8px;
}
.doc-subsection-title:first-child { margin-top: 0; border-top: none; padding-top: 0; }

/* Menu des documents (écran affiché après la finalisation, CLAUDE.md
   section 32) : mêmes boutons que .questionnaire-reponse (bordure/survol/
   état désactivé déjà définis), réagencés en carte deux lignes alignée à
   gauche plutôt qu'en bouton centré. */
.doc-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 28px;
}
.doc-menu-card {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 6px;
    min-height: 84px;
}
.doc-menu-card__titre { font-weight: 700; font-size: 13px; }
.doc-menu-card__desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.doc-menu-card:disabled .doc-menu-card__desc::after {
    content: ' — non applicable à ce personnage.';
    font-style: italic;
}
@media (max-width: 640px) {
    .doc-menu-grid { grid-template-columns: 1fr; }
}

.doc-lettre-corps {
    font-size: 13px;
    line-height: 1.9;
    text-align: justify;
    white-space: pre-line;
}
.doc-lettre-corps p { margin: 0 0 16px; }

.doc-footer {
    margin-top: 48px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.doc-signature-block { display: flex; flex-direction: column; align-items: center; }
.doc-signature-lieu { margin: 0 0 10px; font-size: 12px; font-style: italic; color: #333; }
.doc-signature-script {
    margin: 0 0 2px;
    font-family: 'Segoe Script', 'Brush Script MT', 'Lucida Handwriting', cursive;
    font-size: 26px;
    color: #1a1a3a;
    transform: rotate(-2deg);
}
.doc-signature-line {
    display: flex;
    flex-direction: column;
    width: 200px;
    padding-top: 4px;
    border-top: 1px solid #1a1a1a;
    text-align: center;
}
.doc-signature-name { font-size: 10px; font-weight: 600; }
.doc-signature-role { font-size: 9px; color: #444; }
.doc-signature-note { margin: 5px 0 0; font-size: 8px; font-style: italic; color: #777; }
.doc-stamp {
    width: 92px;
    height: 92px;
    border: 2px solid #444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 8.5px;
    line-height: 1.3;
    text-transform: uppercase;
    color: #444;
    opacity: 0.75;
    transform: rotate(-9deg);
}
.doc-fineprint {
    margin: 22px 0 0;
    font-size: 8.5px;
    color: #777;
    text-align: center;
    font-family: var(--font-body);
}

/* ---------------------------------------------------------------
   Impression : seul le document A4 est envoyé au format PDF/papier,
   toute la chrome du terminal (holo, cadres, boutons) disparaît.
   --------------------------------------------------------------- */
@media print {
    body * { visibility: hidden; }
    .document-a4, .document-a4 * { visibility: visible; }
    .document-a4 {
        position: fixed;
        top: 0;
        left: 0;
        margin: 0;
        box-shadow: none;
        width: 210mm;
        min-height: 297mm;
    }
    @page { size: A4; margin: 12mm; }
}

/* ---------------------------------------------------------------
   Écran 4 — Mise en situation (questionnaire narratif)
   --------------------------------------------------------------- */
/* Image d'ambiance du questionnaire : bannière pleine largeur (même ratio
   que Banniere_1.png, 1821x864) sur l'écran d'intro ; réduite en fine
   bande pendant les questions pour laisser la place aux réponses. */
.questionnaire-image-wrap {
    width: 100%;
    aspect-ratio: 1821 / 864;
    margin-bottom: 20px;
    border: 1px solid var(--border-hairline);
    background: var(--panel-steel);
    overflow: hidden;
    transition: aspect-ratio var(--transition-screen) ease;
}
.questionnaire-image-wrap--compact { aspect-ratio: 1821 / 300; }
/* Format intermédiaire pour les intersections narratives : réduit par
   rapport à l'intro, mais nettement plus haut que la bande des questions. */
.questionnaire-image-wrap--intersection { aspect-ratio: 1821 / 560; }
.questionnaire-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.9) contrast(1.05);
}

#questionnaire-intro .btn-cta { margin-top: 24px; }

.questionnaire-situation-titre {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-ice);
    margin: 0 0 8px;
}

/* Texte de la question / de l'intersection : un peu plus petit que le
   .form-title générique (utilisé tel quel pour le titre du formulaire
   d'état civil, qu'on ne veut pas réduire ici). */
#screen-aventure .form-title { font-size: 24px; }

.questionnaire-progress {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 24px;
}

.questionnaire-reponses {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 28px;
}
/* Si le nombre de réponses est impair, la dernière occupe toute la largeur
   plutôt que de laisser une case vide à côté d'elle. */
.questionnaire-reponses > .questionnaire-reponse:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.questionnaire-reponse {
    width: 100%;
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.4;
    font-size: 12px;
    padding: 14px 16px;
}
.questionnaire-reponse:disabled { opacity: 0.45; cursor: not-allowed; }

/* Réponse à conséquence (Test_<lettre> = 1, questionnaire "à conséquence")
   : liseré animé pour signaler au joueur que ce choix peut avoir des
   suites (voir CLAUDE.md section 10). Jamais d'autre indice affiché (pas
   de message, pas de caractéristique) — seule la présence du risque.
   Effet : dégradé glace/bleu (mêmes teintes que le reste du thème, pas de
   couleur d'alerte) qui défile le long du contour — pas une simple
   pulsation de couleur. Technique : anneau en ::before (padding = épaisseur
   du trait) découpé au mask-composite pour ne garder que le contour, avec
   un fond dégradé animé via background-position.  */
.questionnaire-reponse--consequence {
    position: relative;
    border-color: rgba(143, 217, 232, 0.35);
}
.questionnaire-reponse--consequence::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--accent-un-blue) 20%,
        var(--accent-ice) 50%,
        var(--accent-un-blue) 80%,
        transparent 100%
    );
    background-size: 250% 100%;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: consequence-border-sweep 3.2s linear infinite;
    pointer-events: none;
}
@keyframes consequence-border-sweep {
    0%   { background-position: 150% 0; }
    100% { background-position: -100% 0; }
}

/* Survol d'une réponse à conséquence : le liseré (::before) reste
   inchangé, qu'il y ait survol ou non. L'effet de survol se joue à
   l'intérieur du cadre (::after, en retrait de 1px pour rester dans le
   contour), pas sur la bordure : un reflet dégradé glace/bleu qui balaie
   l'intérieur, mêmes teintes que le liseré pour rester cohérent. */
.questionnaire-reponse--consequence::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(143, 217, 232, 0.35) 50%,
        transparent 70%
    );
    background-size: 250% 250%;
    background-position: 150% 150%;
    mix-blend-mode: screen;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.questionnaire-reponse--consequence:hover::after {
    opacity: 1;
    animation: consequence-fill-sweep 1.2s ease-in-out;
}
@keyframes consequence-fill-sweep {
    from { background-position: 150% 150%; }
    to   { background-position: -50% -50%; }
}

/* Réponse à action héroïque (TestH_<lettre> non NULL) : même mécanique
   exactement que .questionnaire-reponse--consequence (liseré en ::before,
   reflet intérieur en ::after au survol), simplement en teintes dorées
   plutôt que glace/bleu, pour la distinguer visuellement d'une réponse à
   conséquence classique (voir CLAUDE.md section 14). */
.questionnaire-reponse--action-heroique {
    position: relative;
    border-color: rgba(205, 164, 73, 0.35);
}
.questionnaire-reponse--action-heroique::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--accent-gold) 20%,
        var(--accent-gold-bright) 50%,
        var(--accent-gold) 80%,
        transparent 100%
    );
    background-size: 250% 100%;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: consequence-border-sweep 3.2s linear infinite;
    pointer-events: none;
}
.questionnaire-reponse--action-heroique::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(205, 164, 73, 0.35) 50%,
        transparent 70%
    );
    background-size: 250% 250%;
    background-position: 150% 150%;
    mix-blend-mode: screen;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.questionnaire-reponse--action-heroique:hover::after {
    opacity: 1;
    animation: consequence-fill-sweep 1.2s ease-in-out;
}

@media (max-width: 640px) {
    .questionnaire-reponses { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------
   Réduction de mouvement
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .screen--exit-left, .screen--enter-right, .scan-flash.run, .terminal-header__dot { animation: none !important; }
}
