/* ==========================================================================
   BATTLEPOOL — SPIRIT FIGHT
   DESIGN SYSTEM : NEO-STREET FIGHTER / URBAN ANIME POP-CYBER
   Direction artistique validée — portail + jeux = 1 seule identité.
   Compatible avec la logique app.js (classes & variables legacy conservées).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;800;900&family=Rajdhani:wght@500;600;700&display=swap');

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
    /* --- Palette officielle Neo-Street Fighter --- */
    --bg-night-violet: #0F0C1B;   /* Night Violet — fond global */
    --bg-cyber-dark:   #181824;   /* Cyber Dark — fond cartes/arènes */
    --panel-dark:      #1F1B2E;   /* Panel Dark — cartes NFT, modales */
    --panel-light:     #2A243D;   /* Panel Light — headers, hover */
    --gold-primary:    #FFC700;   /* Electric Gold — CTA primaires */
    --gold-hover:      #FF9100;   /* Warning Orange — gradient CTA */
    --purple-neon:     #7B2CBF;   /* Neon Purple — marque secondaire */
    --cyan-spark:      #00E5FF;   /* Cyan Spark — Web3, badges, sélection */
    --magenta-vivid:   #FF0055;   /* Vivid Magenta — notifications, HOT */
    --success-green:   #00E676;   /* Success — solde validé, PV max */
    --error-red:       #FF1744;   /* Error — match perdu, erreur tx */
    --text-white:      #FFFFFF;
    --text-muted:      #A099B8;
    --font-heading:    'Orbitron', sans-serif;
    --font-body:       'Rajdhani', sans-serif;

    /* --- Variables LEGACY (référencées par le HTML injecté de app.js) ---
       Mappées vers la nouvelle palette pour que le JS garde un rendu cohérent. */
    --color-orange:      #FF9100;
    --color-blue:        #00E5FF;
    --color-red:         #FF1744;
    --color-purple:      #7B2CBF;
    --color-yellow:      #FFC700;
    --color-green:       #00E676;
    --accent-blue:       #00E5FF;
    --text-gray-400:     #A099B8;
    --border-gray:       #2A243D;
    --border-gray-700:   #2A243D;
    --bg-gray-800:       #1F1B2E;
    --bg-gray-900:       #181824;
    --bg-gray-950:       #0F0C1B;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    /* Le user-select:none global a été retiré : il gênait la copie
       des adresses wallet et des codes d'invitation. */
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-night-violet);
    font-family: var(--font-body);
    color: var(--text-white);
    /* iOS Safari : overflow:hidden seul est IGNORÉ au toucher — toute la page
       rubber-bandait et un tirage vers le bas déclenchait le pull-to-refresh
       (spinner + rechargement complet). overscroll-behavior:none bloque le
       rebond et le pull-to-refresh (iOS 16+) ; body en position:fixed est le
       verrou classique pour les iOS plus anciens. */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    position: fixed;
    inset: 0;
    /* manipulation autorise encore le pan → l'UI glissait dans tous les sens.
       none = le toucher ne déclenche AUCUN geste natif de déplacement du body.
       Les zones internes scrollables ré-autorisent le pan-y ci-dessous. */
    touch-action: none;
}

/* ==========================================================================
   2. COUCHE GODOT (z-index 0)
   ========================================================================== */
#godot-layer {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
    background: radial-gradient(1200px 800px at 50% 15%, #2A243D 0%, #0F0C1B 60%);
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==========================================================================
   2ter. COUCHE ANIMATION 2D LIGHT (Preloader Combat 2D -> 3D)
   ========================================================================== */
.anim2d-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: #000;
    overflow: hidden;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
}

.anim2d-layer.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#anim2d-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#anim2d-hud {
    position: relative;
    z-index: 2;
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(10, 12, 22, 0.85);
    border: 1px solid rgba(0, 229, 255, 0.4);
    padding: 10px 22px;
    border-radius: 8px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.25);
}

.anim2d-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    color: #00E5FF;
}

.anim2d-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 229, 255, 0.3);
    border-top-color: #00E5FF;
    border-radius: 50%;
    animation: anim2d-spin 0.8s linear infinite;
}

@keyframes anim2d-spin {
    to { transform: rotate(360deg); }
}

.anim2d-progress-bar {
    width: 220px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

#anim2d-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00E5FF, #FFD700);
    transition: width 0.2s ease;
}

/* ==========================================================================
   2bis. FOND D'ÉCRAN DYNAMIQUE (z-index 5) — rotation aléatoire (app.js)
   Deux couches superposées : l'une active (opacity 1), l'autre en attente
   (opacity 0). Le JS alterne l'opacité pour un crossfade fluide.
   ========================================================================== */
.ui-bg {
    position: fixed;
    inset: 0;
    z-index: 5;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.2s ease;
    will-change: opacity, background-image;
    pointer-events: none;
}
/* Couche active : opacité pilotée en JS mais le sélecteur d'id sert
   d'état initial (premier fond affiché immédiatement au chargement). */
#ui-bg { opacity: 1; }

/* Combat : quand l'overlay est masqué (.hidden), le décor s'éteint pour
   laisser la place au canvas Godot (arène 3D). Le !important est INDISPENSABLE :
   il bat à la fois le sélecteur d'id #ui-bg (opacity:1) et les styles inline
   du crossfade JS, sinon l'image resterait visible pendant le combat. */
.ui-overlay.hidden ~ .ui-bg { opacity: 0 !important; }

/* ==========================================================================
   3. COUCHE UI OVERLAY (z-index 10)
   ========================================================================== */
.ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Voile global : nettement plus opaque (lisibilité), PAS de blur
       pour que l'image de fond reste parfaitement NETTE. */
    background: linear-gradient(180deg, rgba(15,12,27,0.55) 0%, rgba(24,24,36,0.68) 100%);
    transition: opacity 0.4s ease, visibility 0.4s ease;
    /* iOS : sans ça, Safari pan le conteneur fixe plein écran au doigt
       (l'UI entière glissait gauche/droite/haut/bas). Les éléments
       scrollables internes ré-autorisent le pan-y individuellement. */
    touch-action: none;
    overscroll-behavior: none;
}

.ui-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.ui-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 900px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ==========================================================================
   4. ÉCRANS & CARTES
   ========================================================================== */
.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.screen.active { display: block; }

.screen-card {
    /* Boîte très opaque : le fond reste net derrière, le contenu est lisible. */
    background: rgba(31,27,46,0.85);
    border: 1.5px solid var(--purple-neon);
    padding: 24px 20px;
    box-shadow: 0 0 25px rgba(0,0,0,0.8), inset 0 0 15px rgba(123,44,191,0.15);
    clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
    position: relative;
}

/* Salon battle : contenu variable (liste joueurs, QR 256px+padding) qui peut
   dépasser le viewport → scroll interne à la carte au lieu de scrollbars
   parasites sur toute la page (V+H constatées en mode Battle). */
.screen-card {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.nav-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

/* Bouton retour / nav en haut d'écran (legacy .header-nav conservé) */
.header-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--panel-light);
    border: 1px solid var(--purple-neon);
    color: var(--cyan-spark);
    padding: 8px 14px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 1px;
    cursor: pointer;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    transition: all 0.15s ease;
}
.header-nav:hover {
    border-color: var(--cyan-spark);
    box-shadow: 0 0 12px rgba(0,229,255,0.35);
}
.header-nav.danger {
    color: var(--error-red);
    border-color: var(--error-red);
}
.header-nav.danger:hover { box-shadow: 0 0 12px rgba(255,23,68,0.4); }

.btn-back {
    background: var(--panel-light);
    border: 1px solid var(--purple-neon);
    color: var(--cyan-spark);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.btn-back.danger {
    color: var(--error-red);
    border-color: var(--error-red);
    width: auto;
    padding: 0 12px;
    gap: 6px;
}

.screen-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--text-white);
    letter-spacing: 1px;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Lisibilité sur image de fond claire (panneaux très translucides) */
    text-shadow: 0 2px 10px rgba(0,0,0,0.9);
}

.screen-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-shadow: 0 1px 6px rgba(0,0,0,0.8);
}

/* ==========================================================================
   5. BOUTONS
   ========================================================================== */
.btn-cyber {
    width: 100%;
    padding: 14px 20px;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    font-style: italic;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-primary-gold {
    background: linear-gradient(90deg, var(--gold-primary) 0%, var(--gold-hover) 100%);
    color: #000;
    box-shadow: 0 0 15px rgba(255,199,0,0.4);
}
.btn-primary-gold:hover { transform: scale(1.02); filter: brightness(1.1); box-shadow: 0 0 25px rgba(255,199,0,0.7); }
.btn-cyan   { background: var(--cyan-spark); color: #000; }
.btn-success{ background: var(--success-green); color: #000; }
.btn-danger { background: var(--error-red); color: #FFF; }

.btn-cyber.disabled, .btn-cyber:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
    transform: none !important;
}

/* Legacy .btn (utilisé par le HTML injecté de app.js) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1.5px solid var(--purple-neon);
    background: var(--panel-light);
    color: var(--text-white);
    cursor: pointer;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    transition: all 0.15s ease;
}
.btn:hover { border-color: var(--cyan-spark); box-shadow: 0 0 12px rgba(0,229,255,0.3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-challenge {
    background: linear-gradient(90deg, var(--gold-primary), var(--gold-hover));
    color: #000;
    border-color: #fff;
}
.btn-challenge:hover { box-shadow: 0 0 16px rgba(255,199,0,0.7); }
.btn-waiting {
    background: var(--panel-light);
    color: var(--text-muted);
    border-color: var(--panel-light);
}
.btn-accepted {
    background: var(--success-green);
    color: #000;
    border-color: #fff;
}
.btn-join {
    background: linear-gradient(90deg, var(--gold-primary), var(--gold-hover));
    color: #000;
    border-color: #fff;
    width: 100%;
}
.btn-join.full {
    background: var(--panel-light);
    color: var(--text-muted);
    border-color: var(--panel-light);
}

/* ==========================================================================
   6. HEADER / PLAYER BADGE
   ========================================================================== */
.player-badge {
    position: absolute;
    top: 20px; left: 20px; right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(31,27,46,0.85);
    border: 1.5px solid var(--purple-neon);
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
    padding: 10px 15px;
    z-index: 15;
    box-shadow: 0 0 15px rgba(123,44,191,0.3);
}
.player-badge .char-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--gold-primary);
}
.player-badge-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.player-badge-name {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-badge-balance {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--gold-primary);
}

.pending-box, .pending-funds-card {
    background: rgba(0,230,118,0.1);
    border: 1px solid var(--success-green);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 6px;
    font-size: 0.8rem;
}
.pending-label { color: #86EFAC; }
.btn-claim {
    background: var(--gold-primary);
    border: none;
    padding: 5px 12px;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

/* ==========================================================================
   7. ÉCRAN 0 : SPLASH
   ========================================================================== */
.splash-container { text-align: center; }
.logo-wrapper { position: relative; display: inline-block; margin-bottom: 40px; }
.game-logo {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 900;
    font-style: italic;
    color: var(--gold-primary);
    text-shadow: 0 0 20px rgba(255,199,0,0.6);
    letter-spacing: 2px;
}
.logo-sub {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--cyan-spark);
    letter-spacing: 6px;
    display: block;
}
.katana-slash {
    position: absolute;
    top: 50%;
    left: -10%;
    width: 120%;
    height: 4px;
    background: var(--cyan-spark);
    box-shadow: 0 0 15px var(--cyan-spark);
    transform: rotate(-12deg);
    animation: slashAnim 0.6s cubic-bezier(0.23,1,0.32,1) forwards;
}
.splash-loader {
    width: 80%;
    height: 6px;
    background: var(--panel-light);
    margin: 0 auto;
    overflow: hidden;
    clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}
.energy-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan-spark), var(--gold-primary));
    animation: energyFill 2.5s ease-in-out forwards;
}

/* ==========================================================================
   8. ÉCRAN 1 : LANGUE
   ========================================================================== */
.language-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.lang-card {
    background: var(--panel-light);
    border: 1.5px solid var(--purple-neon);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: var(--font-heading);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.2s ease;
    background: var(--panel-light);
    color: var(--text-white);
    font-size: 0.95rem;
    font-weight: 700;
}
.lang-card:hover {
    border-color: var(--gold-primary);
    transform: translateY(-3px);
    box-shadow: 0 0 15px rgba(255,199,0,0.3);
}
.lang-card .flag { font-size: 2.5rem; }
.lang-card .lang-name { font-family: var(--font-heading); font-size: 1rem; color: #FFF; }

/* ==========================================================================
   9. ÉCRAN 2 : CONNEXION
   ========================================================================== */
.cyber-shield-icon {
    width: 70px; height: 70px;
    background: rgba(123,44,191,0.2);
    border: 2px solid var(--cyan-spark);
    margin: 0 auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan-spark);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.cyber-shield-icon i { width: 32px; height: 32px; }
.wallet-status-box {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0,230,118,0.08);
    border: 1px solid rgba(0,230,118,0.4);
    color: var(--success-green);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.wallet-addr-display {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-top: 4px;
}

/* ---- 9bis. ÉCRAN 2 : CONNEXION — enrichissement UX (itération 1) ----
   Nouvelles classes uniquement : aucun sélecteur existant modifié.
   Tous les ids/handlers du contrat app.js sont conservés en l'état. */
.connect-card { overflow: hidden; }

/* Lueur d'arrière-plan discrète derrière le bouclier */
.connect-card::before {
    content: "";
    position: absolute;
    top: -70px; left: 50%;
    width: 300px; height: 300px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(0,229,255,0.16) 0%, rgba(123,44,191,0.10) 45%, transparent 70%);
    pointer-events: none;
}

.cyber-shield-icon {
    position: relative;
    box-shadow: 0 0 22px rgba(0,229,255,0.28), inset 0 0 14px rgba(0,229,255,0.10);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.connect-card:hover .cyber-shield-icon {
    box-shadow: 0 0 34px rgba(0,229,255,0.45), inset 0 0 18px rgba(0,229,255,0.16);
    transform: translateY(-2px);
}

/* Anneau pulsant autour du bouclier (décoratif) */
.cyber-shield-icon .shield-pulse {
    position: absolute;
    inset: -8px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 1.5px solid rgba(0,229,255,0.5);
    animation: shieldPulse 2.4s ease-out infinite;
    pointer-events: none;
}
@keyframes shieldPulse {
    0%   { transform: scale(1);    opacity: 0.8; }
    70%  { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .cyber-shield-icon .shield-pulse { animation: none; opacity: 0; }
}

.connect-subtitle { text-align: center; }

/* Liste des bénéfices de la connexion */
.connect-perks {
    list-style: none;
    margin: 0 0 20px 0;
    padding: 12px 14px;
    background: rgba(24,24,36,0.6);
    border: 1px solid rgba(123,44,191,0.35);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.connect-perks li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-white);
    letter-spacing: 0.3px;
}
.connect-perks li i,
.connect-perks li svg {
    width: 16px; height: 16px;
    flex: 0 0 16px;
    color: var(--cyan-spark);
}

/* CTA principal : accentuation sans toucher à .btn-primary-gold */
.connect-cta {
    position: relative;
    font-size: 1.05rem;
    padding: 16px 20px;
    min-height: 52px; /* cible tactile confortable */
}
.connect-cta:focus-visible {
    outline: 2px solid var(--cyan-spark);
    outline-offset: 3px;
}

/* Mention rassurante sous le CTA */
.connect-hint {
    margin-top: 10px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Badge de statut : label avec icône (l'ID .wallet-status-box est inchangé) */
.wallet-status-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.wallet-status-label i,
.wallet-status-label svg { width: 16px; height: 16px; }

/* ---- 9ter. Connexion par clé de démo (mobile/dev) ----
   Nouvelles classes uniquement : aucun sélecteur existant modifié. */
.connect-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 1px;
}
.connect-divider::before,
.connect-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(160,153,184,0.25);
}
.connect-demo { background: var(--panel-light); color: var(--cyan-spark); border: 1px solid var(--cyan-spark); }
.connect-demo:hover { box-shadow: 0 0 15px rgba(0,229,255,0.4); filter: brightness(1.1); }

.demo-key-box {
    margin-top: 10px;
    padding: 12px;
    background: rgba(24,24,36,0.7);
    border: 1px solid rgba(123,44,191,0.4);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.demo-key-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
}
.demo-quick-row { display: flex; gap: 6px; }
.demo-quick-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 4px;
    background: rgba(0,229,255,0.08);
    border: 1px solid rgba(0,229,255,0.35);
    color: var(--cyan-spark);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.62rem;
    cursor: pointer;
    clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
    transition: background 0.15s ease;
}
.demo-quick-btn:hover { background: rgba(0,229,255,0.2); }
.demo-quick-addr { font-family: monospace; font-size: 0.68rem; }
.demo-quick-label { color: var(--text-muted); }
.demo-key-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15,12,27,0.8);
    border: 1px solid rgba(0,229,255,0.35);
    color: var(--text-white);
    font-family: monospace;
    font-size: 0.85rem;
}
.demo-key-input:focus { outline: 1px solid var(--cyan-spark); }
.demo-key-go { padding: 10px 16px; }

/* ==========================================================================
   10. ÉCRAN 3 : MODE
   ========================================================================== */
.mode-grid { display: flex; flex-direction: column; gap: 12px; }
.mode-card {
    background: var(--panel-light);
    border: 1px solid rgba(123,44,191,0.5);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.2s ease;
}
.mode-card:hover {
    border-color: var(--gold-primary);
    background: rgba(42,36,61,0.9);
    transform: translateX(4px);
    box-shadow: 0 0 15px rgba(255,199,0,0.2);
}
.mode-icon {
    width: 48px; height: 48px;
    background: var(--purple-neon);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-primary);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.mode-details h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--gold-primary);
    margin-bottom: 2px;
}
.mode-details p { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.mode-card.spirit-card { border-color: var(--cyan-spark); }
.mode-card.spirit-card .mode-icon { background: var(--cyan-spark); color: #000; }

/* --- Écran SPIRIT FIGHT (portail BATTLEPOOL / App 1) --- */
.spirit-hero { text-align: center; padding: 20px 0 10px 0; }
.spirit-logo {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 900;
    font-style: italic;
    color: var(--gold-primary);
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-shadow: 0 0 25px rgba(255,199,0,0.55);
}
.spirit-logo span { color: var(--cyan-spark); text-shadow: 0 0 25px rgba(0,229,255,0.55); }
.spirit-hero .screen-subtitle { margin-bottom: 25px; margin-top: 4px; }
.spirit-hero .btn-cyber { max-width: 320px; margin: 0 auto; }

/* ==========================================================================
   11. ÉCRAN 4 : PERSONNAGE (classes legacy .char-card conservées)
   ========================================================================== */
.character-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.char-card {
    background: var(--panel-light);
    border: 1.5px solid var(--panel-light);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    transition: all 0.2s ease;
}
.char-card:hover, .char-card.selected {
    border-color: var(--gold-primary);
    box-shadow: 0 0 15px rgba(255,199,0,0.4);
    background: rgba(123,44,191,0.2);
}
.char-avatar {
    width: 100%;
    height: 90px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
.char-avatar i { color: rgba(255,255,255,0.85) !important; }
.char-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-rendering: auto;
}
.char-card h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: #FFF;
    margin: 0;
}
.pseudo-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.pseudo-field label {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.pseudo-field input {
    width: 100%;
    background: var(--bg-cyber-dark, rgba(10,12,22,0.9));
    border: 1px solid rgba(0,229,255,0.35);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    padding: 10px 12px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.3s;
}
.pseudo-field input:focus { border-color: var(--cyan-spark); box-shadow: 0 0 10px rgba(0,229,255,0.25); }
.pseudo-field input::placeholder { color: var(--text-muted); font-weight: 400; }

.volume-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.volume-field label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
}
.volume-field input[type="range"] {
    flex: 1;
    accent-color: var(--cyan-spark, #00E5FF);
    height: 4px;
    cursor: pointer;
}
#volume-value {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cyan-spark, #00E5FF);
    min-width: 36px;
    text-align: right;
}

.rematch-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, rgba(0,229,255,0.12), rgba(123,44,191,0.18));
    border: 1px solid rgba(0,229,255,0.45);
    border-left: 4px solid var(--cyan-spark);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    animation: fadeIn 0.3s forwards;
}
.rematch-info {
    flex: 1;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-white, #fff);
}
.rematch-banner .btn { padding: 6px 14px; font-size: 0.75rem; white-space: nowrap; }

/* ==========================================================================
   12. ÉCRANS 5 : LOBBIES & LISTES
   ========================================================================== */
.search-bar-wrapper { display: flex; gap: 10px; margin-bottom: 16px; }
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; }

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-cyber-dark);
    border: 1px solid var(--purple-neon);
    padding: 10px 12px;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.search-input-wrapper i { color: var(--text-muted); flex-shrink: 0; }
.search-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
}
.search-input-wrapper input::placeholder { color: var(--text-muted); }
.search-input-wrapper input:focus + i, .search-input-wrapper:focus-within { border-color: var(--cyan-spark); }

.join-private-box {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}
.join-private-box input, .search-bar-wrapper input, .form-group input, .form-group select, .search-input-wrapper input {
    background: var(--bg-cyber-dark);
    border: 1px solid var(--purple-neon);
    padding: 12px;
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.join-private-box input { flex: 1; }
/* Mobile : input + REJOINDRE + QR débordent sur petits écrans (le bouton QR
   passait hors champ). Le wrap empile proprement au lieu de déborder. */
@media (max-width: 480px) {
    .join-private-box {
        flex-wrap: wrap;
    }
    .join-private-box input {
        flex: 1 1 100%;
    }
}
input:focus, select:focus { border-color: var(--cyan-spark) !important; box-shadow: 0 0 10px rgba(0,229,255,0.2); }

.btn-icon-qr, .qr-btn {
    background: var(--purple-neon);
    border: none;
    color: var(--gold-primary);
    width: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    transition: box-shadow 0.15s ease;
}
.btn-icon-qr:hover, .qr-btn:hover { box-shadow: 0 0 14px rgba(123,44,191,0.7); }

.section-label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--cyan-spark);
    letter-spacing: 1.5px;
    margin: 15px 0 10px 0;
    text-transform: uppercase;
}

.list-container, .players-list, .br-list {
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}
.list-container::-webkit-scrollbar, .players-list::-webkit-scrollbar, .br-list::-webkit-scrollbar { width: 4px; }
.list-container::-webkit-scrollbar-thumb, .players-list::-webkit-scrollbar-thumb, .br-list::-webkit-scrollbar-thumb { background: var(--purple-neon); border-radius: 4px; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 24px 0;
    font-weight: 600;
}

.player-card, .player-item {
    background: var(--panel-light);
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    transition: all 0.15s ease;
}
.player-card:hover, .player-item:hover { border: 1px solid rgba(0,229,255,0.4); background: #2b2542; }
.player-info { flex: 1; min-width: 0; }
.player-info h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-white);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-info p { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; font-weight: 600; }

.action-row { margin-bottom: 15px; }

/* ==========================================================================
   13. BATTLE ROYALE : CARTES SALONS (legacy)
   ========================================================================== */
.br-card {
    background: var(--panel-light);
    padding: 14px;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.br-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.br-tag {
    display: inline-block;
    background: var(--purple-neon);
    color: var(--gold-primary);
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 10px;
    margin-top: 4px;
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
.br-players {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1rem;
    color: var(--gold-primary);
}
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--bg-cyber-dark);
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}
.progress-bar-fill {
    height: 100%;
    background: repeating-linear-gradient(135deg, var(--cyan-spark) 0 10px, rgba(0,229,255,0.6) 10px 14px);
    box-shadow: 0 0 10px rgba(0,229,255,0.5);
    transition: width 0.4s ease;
}

/* ==========================================================================
   14. SALON DE POULE
   ========================================================================== */
.pool-status-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.status-badge {
    background: var(--purple-neon);
    padding: 4px 10px;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--text-white);
}
.count-badge {
    color: var(--gold-primary);
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}
.invite-share-box {
    background: rgba(0,229,255,0.06);
    border: 1px solid rgba(0,229,255,0.35);
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 6px;
    text-align: center;
}
.invite-share-box p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.invite-share-box input {
    width: 100%;
    background: var(--bg-cyber-dark);
    color: var(--gold-primary);
    border: 1px solid var(--border-gray-700);
    padding: 8px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
}

/* ==========================================================================
   15. ÉCRAN 6 : COMBAT LOADING
   ========================================================================== */
.combat-loader-card { text-align: center; padding: 30px; }
.pulse { animation: pulseAnim 1.5s infinite; }
.cyber-progress-container {
    width: 100%;
    height: 12px;
    background: var(--bg-cyber-dark);
    border: 1px solid var(--cyan-spark);
    margin: 20px 0 10px 0;
    padding: 2px;
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
.cyber-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan-spark), var(--gold-primary));
    transition: width 0.3s ease;
}
.loading-subtext { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }

/* ==========================================================================
   16. TIMER VISIBLE (par-dessus Godot)
   ========================================================================== */
.turn-timer-badge {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    pointer-events: none;
}
.timer-inner {
    background: rgba(0,0,0,0.85);
    border: 2px solid var(--gold-primary);
    border-radius: 30px;
    padding: 6px 18px;
    color: var(--text-white);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 0 15px rgba(255,199,0,0.5);
    display: flex;
    align-items: center;
    gap: 8px;
}
.timer-icon { color: var(--gold-primary); }
.timer-urgent .timer-inner {
    border-color: var(--error-red);
    box-shadow: 0 0 18px rgba(255,23,68,0.6);
    animation: pulseAnim 0.8s infinite;
}

/* ==========================================================================
   17. MODALES
   ========================================================================== */
.overlay-modal, .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,12,27,0.6);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.overlay-modal[style*="flex"], .modal-overlay[style*="flex"] { display: flex; }

.modal-card {
    background: rgba(31,27,46,0.88);
    border: 2px solid var(--gold-primary);
    width: 100%;
    max-width: 420px;
    padding: 20px;
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
    box-shadow: 0 0 30px rgba(255,199,0,0.3);
    max-height: 85vh;
    overflow-y: auto;
}

/* Scanner QR : le flux vidéo remplit la carte, sans débordement.
   Analyse de la frame entière. Sur mobile, modale élargie pour maximiser la résolution de décodage. */
#qr-modal .modal-card {
    max-width: 460px;
    padding: 16px;
}
@media (max-width: 768px) {
    #qr-modal {
        padding: 8px;
    }
    #qr-modal .modal-card {
        width: 100%;
        max-width: 100%;
        padding: 12px;
    }
}

/* Zones internes scrollables : le scroll tactile reste CONFINÉ à l'élément
   (pas de remontée vers body = pas de rubber-band ni pull-to-refresh).
   touch-action:pan-y ré-autorise le geste vertical UNIQUEMENT ici —
   le reste de l'UI (body, overlay, couches fixes) reste immobile.
   Étendu à tout ce qui peut scroller : inputs, textareas, listes, cartes. */
.list-container,
.screen-card,
.modal-card,
.anim2d-log,
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
textarea { touch-action: pan-y; }
#reader {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

#reader video {
    width: 100% !important;
    height: auto !important;
    display: block;
    object-fit: cover;
}

/* QR Code d'invitation au salon (pool-room) */
#pool-invite-qr {
    display: none;
    margin-top: 14px;
    text-align: center;
}
/* Limite de taille : QR 256px + padding 28px = 284px, avec le reste du
   contenu du salon ça dépassait le viewport (scrollbars parasites).
   200px reste scannable à ~30cm. */
#pool-invite-qr canvas,
#pool-invite-qr img {
    display: block;
    margin: 0 auto;
    border-radius: 6px;
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.modal-header h3 {
    font-family: var(--font-heading);
    color: var(--gold-primary);
    font-size: 1.05rem;
}
.btn-close, .btn-close-modal {
    background: none;
    border: 1px solid var(--panel-light);
    color: var(--text-muted);
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
}
.btn-close:hover, .btn-close-modal:hover { color: var(--magenta-vivid); border-color: var(--magenta-vivid); }

.form-group { margin-bottom: 15px; display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.form-group.checkbox-group { flex-direction: row; align-items: center; }
.form-group.checkbox-group input { width: 20px; height: 20px; accent-color: var(--cyan-spark); cursor: pointer; }
.modal-actions-row { display: flex; flex-direction: column; gap: 8px; margin-top: 15px; }
.modal-body-text { color: var(--text-muted); font-size: 0.9rem; }
.glow-title { text-shadow: 0 0 15px rgba(255,199,0,0.6); }
.challenge-received { border-color: var(--error-red); box-shadow: 0 0 30px rgba(255,23,68,0.25); }
.bet-stats-box { text-align: left; }

/* --- Modale de pari (legacy .bet-card) --- */
.bet-card {
    text-align: center;
}
.bet-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-cyber-dark);
    border: 1px solid var(--purple-neon);
    padding: 10px 14px;
    margin: 12px 0;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.bet-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-white);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.3rem;
    text-align: center;
}
.bet-currency {
    color: var(--gold-primary);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.9rem;
}
.bet-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.btn-preset {
    flex: 1;
    padding: 8px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.8rem;
    background: var(--bg-cyber-dark);
    color: var(--cyan-spark);
    border: 1px solid var(--border-gray-700);
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-preset:hover { border-color: var(--cyan-spark); box-shadow: 0 0 10px rgba(0,229,255,0.25); }
.btn-bet-confirm {
    width: 100%;
    background: linear-gradient(90deg, var(--gold-primary), var(--gold-hover));
    color: #000;
    border: 1.5px solid #fff;
}

/* ==========================================================================
   18. TOASTS
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel-dark);
    border-left: 4px solid var(--cyan-spark);
    color: var(--text-white);
    padding: 12px 18px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
    animation: slideInRight 0.3s forwards;
    max-width: 320px;
}
.toast.success { border-left-color: var(--success-green); }
.toast.error   { border-left-color: var(--error-red); }
.toast.info    { border-left-color: var(--cyan-spark); }

/* ==========================================================================
   19. ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slashAnim {
    0%   { width: 0%; opacity: 0; }
    50%  { opacity: 1; }
    100% { width: 120%; opacity: 1; }
}
@keyframes energyFill {
    0%   { width: 0%; }
    100% { width: 100%; }
}
@keyframes pulseAnim {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-10px); }
}

/* ==========================================================================
   20. DIVERS / RESPONSIVE
   ========================================================================== */
.hidden { display: none !important; }

body::-webkit-scrollbar { width: 0; }

/* ==========================================================================
   21. OVERLAY PORTAIL BATTLEPOOL (App 1) — iframe + barre de retour
   ========================================================================== */
.portal-overlay {
    position: fixed;
    inset: 0;
    z-index: 30; /* au-dessus de la UI (10) et du timer (20), sous les modales (100) */
    background: #05060c;
    display: flex;
    flex-direction: column;
}
.portal-overlay.hidden { display: none; }

.portal-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: linear-gradient(90deg, rgba(7,9,18,0.98), rgba(18,10,40,0.98));
    border-bottom: 1px solid rgba(0,229,255,0.25);
    min-height: 44px;
}
.portal-title {
    flex: 1;
    text-align: center;
    font-family: var(--font-heading, 'Orbitron', sans-serif);
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--text-muted, #8a8fa3);
    text-transform: uppercase;
}
.portal-spacer { width: 120px; }

#portal-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--cyan-spark, #00E5FF);
    color: var(--cyan-spark, #00E5FF);
    padding: 6px 14px;
    font-family: var(--font-body, sans-serif);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
}
#portal-back-btn:hover {
    background: rgba(0,229,255,0.15);
    box-shadow: 0 0 12px rgba(0,229,255,0.3);
}

#portal-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

/* Loader affiché pendant le chargement de l'iframe du portail */
.portal-loading {
    position: absolute;
    inset: 44px 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #05060c;
    z-index: 1;
}
.portal-loading p {
    font-family: var(--font-body, sans-serif);
    font-size: 0.85rem;
    color: var(--text-muted, #8a8fa3);
    letter-spacing: 1px;
}
.portal-loader-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(0,229,255,0.2);
    border-top-color: var(--cyan-spark, #00E5FF);
    border-radius: 50%;
    animation: spinPortal 0.8s linear infinite;
}
@keyframes spinPortal {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .ui-content { padding: 16px; }
    .game-logo { font-size: 2.4rem; }
    .screen-card { padding: 18px 14px; }
}

/* ==========================================================================
   18. BARRE DE CHOIX DU COUP — MODE 2D (préloader anim2d)
   ========================================================================== */
.anim2d-move-bar {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 21; /* au-dessus du layer 2D, sous les modales (100) */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.anim2d-move-bar.hidden { display: none; }

/* Instruction : Rajdhani 1.1rem, uppercase, cyan avec glow */
.move-bar-instruction {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #00E5FF;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
    margin-bottom: 8px;
    text-align: center;
}

.anim2d-move-buttons { display: flex; gap: 14px; }

/* Boutons cyber biseautés : fond sombre, accent lumineux distinct par coup */
.anim2d-move-btn {
    min-width: 112px;
    padding: 13px 18px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-white);
    background: #1F1B2E;
    border: 1.5px solid var(--cyan-spark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    box-shadow: 0 0 12px rgba(0,229,255,0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease, background 0.15s ease;
}
/* Icônes Lucide dans les boutons */
.anim2d-move-btn i,
.anim2d-move-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* Accents distincts : Pierre cyan / Feuille violet / Ciseaux or */
.move-rock    { border-color: var(--cyan-spark);    box-shadow: 0 0 12px rgba(0,229,255,0.35); }
.move-paper   { border-color: var(--purple-neon);   box-shadow: 0 0 12px rgba(123,44,191,0.45); }
.move-scissors{ border-color: var(--gold-primary);  box-shadow: 0 0 12px rgba(255,199,0,0.35); }
.move-rock svg    { color: var(--cyan-spark); }
.move-paper svg   { color: var(--purple-neon); filter: brightness(1.6) saturate(1.2); }
.move-scissors svg{ color: var(--gold-primary); }

/* Hover : glow renforcé + translation */
.anim2d-move-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.15);
}
.move-rock:hover:not(:disabled)     { box-shadow: 0 0 20px rgba(0,229,255,0.65); }
.move-paper:hover:not(:disabled)    { box-shadow: 0 0 20px rgba(123,44,191,0.75); }
.move-scissors:hover:not(:disabled) { box-shadow: 0 0 20px rgba(255,199,0,0.65); }

/* Active : compression tactile */
.anim2d-move-btn:active:not(:disabled) { transform: scale(0.95); }

.anim2d-move-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: grayscale(0.8);
}

/* Responsive mobile-first : barre ancrée en bas, instruction au-dessus des boutons */
@media (max-width: 768px) {
    .anim2d-move-bar {
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 95%;
        z-index: 21; /* au-dessus du layer 2D, sous les modales (100) — inchangé */
        gap: 6px;
        padding: 0 4px;
    }
    .move-bar-instruction {
        font-size: 0.85rem;
        margin-bottom: 6px;
        overflow: visible;
        white-space: nowrap; /* jamais de chevauchement : texte sur une ligne au-dessus des boutons */
    }
    .anim2d-move-buttons { gap: 8px; }
    .anim2d-move-btn {
        min-width: 0;
        flex: 1 1 0;
        max-width: 130px;
        padding: 11px 8px;
        font-size: 0.82rem;
        clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    }
    .anim2d-move-btn i,
    .anim2d-move-btn svg { width: 15px; height: 15px; flex: 0 0 15px; }
}
@media (max-width: 360px) {
    .anim2d-move-btn { padding: 10px 4px; font-size: 0.75rem; letter-spacing: 0.5px; }
    .anim2d-move-btn i,
    .anim2d-move-btn svg { width: 13px; height: 13px; flex: 0 0 13px; }
}

/* ---- 18bis. FEEDBACK DU COUP CHOISI (Itération 4B) ---- */

/* Bouton sélectionné dans la barre de choix : brillance + élévation + bordure épaisse */
.anim2d-move-btn.selected {
    transform: translateY(-4px);
    border-width: 2.5px;
    filter: brightness(1.25);
    background: #2A243D;
}
.move-rock.selected     { box-shadow: 0 0 18px rgba(0,229,255,0.8); }
.move-paper.selected    { box-shadow: 0 0 18px rgba(123,44,191,0.85); }
.move-scissors.selected { box-shadow: 0 0 18px rgba(255,199,0,0.8); }
.anim2d-move-btn.selected:active { transform: translateY(-4px) scale(0.95); }

/* Badge du coup retenu, à côté de la barre de vie du joueur (HUD) */
.selected-move-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-top: 8px;
    background: rgba(31, 27, 46, 0.9);
    border: 2px solid var(--cyan-spark);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    box-shadow: 0 0 15px #00E5FF, inset 0 0 8px rgba(0,229,255,0.35);
    color: var(--cyan-spark);
    pointer-events: none;
}
.selected-move-badge i,
.selected-move-badge svg { width: 22px; height: 22px; }

.selected-move-badge.hidden { display: none; }

/* Animation d'apparition */
.selected-move-badge.pop-in { animation: popIn 0.3s ease-out; }
@keyframes popIn {
    0%   { transform: scale(0.4); opacity: 0; }
    70%  { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .selected-move-badge.pop-in { animation: none; }
}

/* Mobile : badge plus compact sous la barre de vie */
@media (max-width: 768px) {
    .selected-move-badge { width: 36px; height: 36px; margin-top: 6px; }
    .selected-move-badge i,
    .selected-move-badge svg { width: 18px; height: 18px; }
}

/* ==========================================================================
   22. HUD COMBAT (Itération 3) — superposition écran de combat
   Positions absolues DANS #screen-combat ; les barres de vie sont mises
   à jour par app.js (largeur %) et les noms par anim2d.js (textContent).
   ========================================================================== */
#combat-hud-layer {
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    z-index: 15; /* au-dessus des fonds (5) et de la barre 2D (21 ? NON : sous la barre) */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none; /* ne bloque aucun clic sur l'arène/boutons */
}

.combat-hud-side { flex: 1 1 0; min-width: 0; }
.combat-hud-right { text-align: right; }

/* Pseudo + wallet partiel */
.hud-player-info { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.combat-hud-right .hud-player-info { align-items: flex-end; }

.hud-player-name {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-white);
    text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 6px rgba(0,229,255,0.35);
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.hud-player-wallet {
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* Barres de vie : biseau symétrique, fond sombre translucide, bordure fine */
.hud-health-bar-container {
    height: 20px;
    width: 100%;
    max-width: 300px;
    background: rgba(31, 27, 46, 0.75);
    border: 1px solid rgba(160, 153, 184, 0.35);
    box-shadow: 0 2px 10px rgba(0,0,0,0.55), inset 0 0 8px rgba(0,0,0,0.5);
    padding: 2px;
}
.combat-hud-left  .hud-health-bar-container { margin-right: auto;  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); }
.combat-hud-right .hud-health-bar-container { margin-left: auto;   clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%); }

/* Remplissage */
.hud-health-bar-fill {
    height: 100%;
    width: 100%; /* état initial plein ; app.js pilote la largeur (%) */
    background: var(--cyan-spark);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.7);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.hud-health-right .hud-health-bar-fill {
    float: right;
    background: var(--error-red);
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.7);
    /* Remplissage ancré à droite : la perte de vie "se vide" vers la gauche */
}

/* Responsive : HUD compact en mobile, sous le timer (z20, top 25px) */
@media (max-width: 768px) {
    #combat-hud-layer {
        top: 50px; /* sous le badge timer, jamais recouvert */
        left: 12px;
        right: 12px;
        z-index: 15; /* inchangé : sous timer (20) et barre 2D (21) */
    }
    .combat-hud-side { max-width: 46%; }
    .hud-health-bar-container {
        max-width: 120px;   /* barres de vie compactes */
        width: 100%;
        height: 16px;
        padding: 1.5px;
    }
    .hud-player-name { font-size: 0.75rem; }
    .hud-player-wallet { font-size: 0.6rem; }
}

/* ==========================================================================
   19. SÉLECTEUR DE LANGUE MULTILINGUE (i18n)
   ========================================================================== */
.quick-lang-selector {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 99;
    display: flex;
    gap: 6px;
    background: rgba(14, 18, 36, 0.88);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 20px;
    padding: 3px 8px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}
.quick-lang-btn {
    background: transparent;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    opacity: 0.7;
}
.quick-lang-btn:hover {
    transform: scale(1.25);
    opacity: 1;
}
.quick-lang-btn.active {
    opacity: 1;
    filter: drop-shadow(0 0 5px var(--cyan-spark));
}
.lang-card.active-lang {
    border-color: var(--cyan-spark) !important;
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.6) !important;
    background: rgba(0, 229, 255, 0.08) !important;
}

