:root {
            --primary: #0f172a;
            --accent-blue: #38bdf8;
            --accent-green: #4ade80;
            --accent-red: #f87171;
            --text-light: #f8fafc;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

       body2 {
            background-color: var(--primary);
            color: var(--text-light);
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
            padding: 15px;
        }

        header2 {
            text-align: center;
            margin-bottom: 20px;
        }

        h1 {
            color: var(--accent-blue);
            font-size: 2rem;
            margin-bottom: 5px;
        }

        .game-layout {
            display: flex;
            flex-direction: column;
            width: 100%;
            max-width: 900px; /* Retour à la dimension d'origine */
            gap: 20px;
        }

        @media (min-width: 768px) {
            .game-layout {
                flex-direction: row;
                align-items: flex-start;
            }
        }

        .game-container {
            position: relative;
            flex: 2; 
            background: #1e293b;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
            text-align: center;
            /* Suppression de height: auto et ajout d'un overflow propre */
            min-height: 400px; 
            overflow: hidden; 
        }

        .sidebar-scores {
            flex: 1;
            background: #1e293b;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
        }

        .sidebar-scores h3 {
            color: var(--accent-blue);
            margin-bottom: 15px;
            border-bottom: 2px solid #334155;
            padding-bottom: 5px;
            text-align: center;
        }

        .player-score-card {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #334155;
            padding: 10px 15px;
            border-radius: 6px;
            margin-bottom: 10px;
            border-left: 4px solid #64748b;
            transition: all 0.3s ease;
        }
        .player-score-card.active-turn {
            border-left-color: var(--accent-blue);
            background: #475569;
            box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
        }

        .player-score-card.eliminated {
            border-left-color: var(--accent-red);
            opacity: 0.5;
            background: #0f172a;
        }

        .canvas-container {
            width: 100%;
            margin-bottom: 20px;
        }

        canvas {
            width: 100%;
            max-width: 100%;
            background: #0f172a;
            border-radius: 8px;
            display: block;
        }

        .turn-indicator {
            background: #0f172a;
            color: var(--accent-blue);
            font-weight: bold;
            padding: 8px;
            border-radius: 6px;
            margin-bottom: 15px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        /* --- FORCE LA COULEUR DU TEXTE DANS LES CARTES DU JEU --- */
        .card {
            background: #334155;
            border-left: 5px solid var(--accent-blue);
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 25px;
            min-height: 150px;
            display: flex;
            flex-direction: column;
            justify-content: center;
    
            /* AJOUTS ICI : On force le texte et ses enfants en blanc */
            color: #ffffff !important; 
        }

        .card.menace { border-left-color: var(--accent-red); }
        .card.defense { border-left-color: var(--accent-green); }

        /* Sécurité pour s'assurer que le titre et le texte de la carte suivent aussi */
        .card-title {
            font-size: 1.25rem;
            font-weight: bold;
            margin-bottom: 10px;
            color: #ffffff !important;
        }

        .card-text {
            font-size: 1rem;
            line-height: 1.5;
            margin-bottom: 15px;
            color: #ffffff !important;
        }

        .actions {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
        }

        button {
            background: var(--accent-blue);
            color: var(--primary);
            border: none;
            padding: 14px 20px;
            font-size: 1rem;
            font-weight: bold;
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.2s ease, transform 0.1s ease;
        }

        button:hover {
            background: #7dd3fc;
            transform: translateY(-2px);
        }

        .custom-popup {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 95%;
            max-width: 500px;
            background: #1e293b;
            border: 2px solid var(--accent-blue);
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
            z-index: 10;
            text-align: left;
            display: none;
        }

        .popup-title {
            font-size: 1.2rem;
            font-weight: bold;
            margin-bottom: 12px;
            border-bottom: 1px solid #475569;
            padding-bottom: 6px;
        }

        .popup-tip {
            margin-top: 15px;
            padding: 10px;
            background: #0f172a;
            border-radius: 6px;
            font-size: 0.9rem;
            border-left: 3px solid var(--accent-blue);
        }

        .popup-effect {
            margin-top: 15px;
            font-weight: bold;
            text-align: right;
        }

        .popup-btn {
            margin-top: 15px;
            width: 100%;
        }

        .welcome-overlay {
            /* REMPLACEMENT de position: absolute par un affichage dans le flux */
            position: relative; 
            width: 100%;
            background: #1e293b;
            border-radius: 12px;
            padding: 10px 0; /* Réduction des paddings superflus */
            z-index: 20;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            text-align: left;
            box-sizing: border-box;
        }

        .welcome-overlay h2 {
            color: var(--accent-blue);
            font-size: 1.5rem;
            margin-bottom: 10px;
            text-align: center;
        }

        .rules-list {
            margin-bottom: 15px;
            font-size: 0.9rem;
            line-height: 1.5;
        }

        .rules-list li {
            margin-bottom: 6px;
            list-style-type: none;
            padding-left: 20px;
            position: relative;
        }

        .rules-list li::before {
            content: "🛡️";
            position: absolute;
            left: 0;
            top: 0;
        }

        .setup-section {
            background: #334155;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 15px;
        }

        .setup-section label {
            display: block;
            font-weight: bold;
            margin-bottom: 8px;
            color: var(--accent-blue);
        }

        .setup-section select {
            width: 100%;
            padding: 8px;
            background: #0f172a;
            color: white;
            border: 1px solid #475569;
            border-radius: 4px;
            margin-bottom: 12px;
            outline: none;
        }

        /* --- OPTIMISATION DE LA GRILLE DES JOUEURS POUR BOOTSTRAP --- */
        .player-inputs-grid {
            display: grid;
            /* Ajustement de la taille des inputs pour éviter l'étirement excessif */
            grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); 
            gap: 10px;
            margin-top: 10px;
            max-height: 250px; /* Sécurité : ajoute une barre de défilement interne si trop de joueurs */
            overflow-y: auto; 
            padding-right: 5px;
        }

        .player-inputs-grid input {
            padding: 8px;
            background: #0f172a;
            color: white;
            border: 1px solid #475569;
            border-radius: 4px;
            width: 100%;
            outline: none;
        }

        .welcome-btn {
            width: 100%;
            margin-top: 5px;
        }

        .hidden { display: none !important; }
        .screen-end h2 { font-size: 2rem; margin-bottom: 15px; }

        /* Style Rétro/Pixel pour le bouton de redirection */
        .retro-link-container {
            margin-top: 10px;
            display: flex;
            justify-content: center;
        }
        .btn-retro-arcade {
            display: inline-block;
            background: #121214;
            color: #00ff66;
            border: 2px solid #00ff66;
            padding: 10px 15px;
            font-family: monospace;
            font-size: 13px;
            font-weight: bold;
            text-decoration: none;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-radius: 4px;
            box-shadow: 0 0 8px rgba(0, 255, 102, 0.2);
            transition: all 0.2s ease;
            text-align: center;
            width: 100%;
            box-sizing: border-box;
        }
        .btn-retro-arcade:hover {
            background: #00ff66;
            color: #121214;
            box-shadow: 0 0 15px #00ff66;
            transform: scale(1.02);
            cursor: pointer;
        }

        .logo-jeu {
            width: 150px; /* Ajustez la taille selon vos besoins */
            height: auto;
            border-radius: 50%; /* Conserve la forme circulaire */
            border: 3px solid #00ffcc; /* Bordure néon cyan */
    
            /* Effet d'effet de halo lumineux (Glow effect) */
            box-shadow: 0 0 15px #00ffcc, inset 0 0 15px #00ffcc;
    
            /* Filtre pour augmenter les contrastes et adoucir les pixels */
            filter: contrast(1.2) brightness(1.1);
            transition: transform 0.3s ease;
        }

        /* Petit effet interactif lorsque le joueur passe la souris dessus */
        .logo-jeu:hover, .logo-du-jeu.clignote {
            transform: scale(1.05);
            box-shadow: 0 0 25px #ff00ff, inset 0 0 25px #ff00ff; /* Devient rose néon au survol */
            border-color: #ff00ff;
        }


        /* Conteneur et style du logo dans les crédits */
        #logoContainer {
            display: flex; justify-content: center; align-items: center;
            margin: 5px 0 10px 0; background: #121214; padding: 10px;
            border-radius: 6px; border: 1px dashed #333; min-height: 60px;
        }
        .game-logo {
            max-width: 100%; max-height: 80px; object-fit: contain;
            filter: drop-shadow(0px 0px 4px #00ff66);
        }
        .credit-item { font-size: 13px; color: #ccc; margin-bottom: 4px; }
        .credit-item b { color: #00ecff; }