@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&family=Roboto:wght@400;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}

/* --- VARIABLES & THEME --- */
:root {
    --vh: 100vh;
    --board-bg: #ddeedd;
    --center-bg: #2c3e50; /* Bleu nuit thème politique */
    --border-color: #1a252f;
    --shadow-color: rgba(0,0,0,0.4);
    
    /* Dimensions dynamiques : grille 9x9 -> centre 7x7 */
    --board-size: min(90vh, 90vw);
    --cell-size: calc(var(--board-size) / 9);
    
    --color-primary: #f1c40f;
    --color-danger: #e74c3c;
    --color-success: #27ae60;
    --color-dark: #2c3e50;
    --color-light: #ecf0f1;
}

body { 
    margin: 0; 
    background: #121212; 
    color: white; 
    font-family: 'Roboto', sans-serif; 
    overflow-x: hidden; 
}

/* --- LAYOUT PRINCIPAL --- */
.screen {
    width: 100vw;
}

.screen:not(.active) {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    user-select: none !important;
}

#screen-game {
    background: radial-gradient(circle at center, #34495e 0%, #0b0f14 100%);
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0;
}

.game-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 340px;
    background: rgba(18, 25, 35, 0.95);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: 15px;
    z-index: 100;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}

.sidebar h3 { 
    margin-top: -5px; 
    margin-bottom: 10px;
    border-bottom: 2px solid var(--color-success); 
    padding-bottom: 5px; 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: #bdc3c7;
    font-family: 'Oswald', sans-serif;
}

/* DASHBOARD JOUEURS */
#players-dashboard { 
    flex: 1; 
    overflow-y: auto; 
    padding-right: 5px; 
    margin-bottom: 10px; 
}

.player-card {
    background: #2c3e50; /* Fond sombre */
    border-radius: 8px;
    margin-bottom: 12px; /* Espace entre les joueurs */
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

/* Effet Joueur Actif (Bordure brillante) */
.player-card.active-turn { 
    background: #34495e; 
    border: 1px solid #f1c40f;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.15);
    transform: scale(1.02); /* Légèrement plus grand */
    z-index: 10;
}

/* LIGNE 1 : HEADER (Identité) */
.pc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.pc-identity {
    display: flex; 
    align-items: center; 
    gap: 8px;
    overflow: hidden;
}

.pc-avatar { font-size: 1.4em; }
.pc-name { 
    font-weight: bold; 
    color: white; 
    font-size: 1.1em;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
}

/* Bouton d'échange discret */
.btn-icon-trade {
    background: rgba(255,255,255,0.1);
    border: none; color: #3498db;
    width: 28px; height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.btn-icon-trade:hover { background: white; color: #2980b9; }


/* LIGNE 2 : ARGENT */
.pc-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.pc-money {
    font-family: 'Oswald', sans-serif;
    color: #2ecc71; /* Vert dollar */
    font-size: 1.3em;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* Badges (Prison/Mort) */
.pc-badges { display: flex; gap: 5px; }
.badge-jail { background: #e67e22; color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.7em; font-weight: bold; }
.badge-dead { background: #c0392b; color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.7em; font-weight: bold; }


/* LIGNE 3 : PROPRIÉTÉS (Grille aérée) */
.hand-container { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; /* Plus d'espace entre les cartes */
    background: rgba(0,0,0,0.2); /* Fond subtil pour la zone de cartes */
    padding: 8px;
    border-radius: 6px;
    min-height: 40px;
}

.empty-hand {
    width: 100%;
    text-align: center;
    color: rgba(255,255,255,0.2);
    font-style: italic;
    font-size: 0.8em;
    padding: 5px 0;
}

/* Style Éliminé (Grisé) */
.player-card.bankrupt-player {
    opacity: 0.5;
    filter: grayscale(1);
    background: #222;
}

.hand-container { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 6px; /* Espace entre les cartes */
    margin-top: 8px; 
    padding-top: 8px; 
    border-top: 1px solid rgba(255,255,255,0.1); 
}

/* La carte physique miniature */
.mini-deed {
    width: 42px; 
    height: 56px; 
    background: #fdfdfd; /* Effet papier blanc */
    border-radius: 3px;
    display: flex; 
    flex-direction: column;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, z-index 0.2s;
    cursor: help;
    border: 1px solid #999;
}

/* Effet au survol : la carte grossit pour être lisible */
.mini-deed:hover {
    transform: scale(1.5) translateY(-10px);
    z-index: 100;
    box-shadow: 0 10px 20px rgba(0,0,0,0.6);
}

/* Bandeau de couleur en haut */
.md-header { 
    height: 14px; 
    width: 100%; 
    border-bottom: 1px solid rgba(0,0,0,0.2);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.1);
}

/* Corps de la carte (Nom + Icônes) */
.md-body {
    flex: 1;
    display: flex; 
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

/* Texte (Initiale ou icône) */
.md-text {
    font-size: 9px;
    color: #333;
    font-weight: 700;
    text-align: center;
    font-family: 'Oswald', sans-serif;
    line-height: 1;
    margin-bottom: 2px;
}

/* Conteneur des maisons/hôtels */
.md-buildings {
    display: flex;
    gap: 1px;
    margin-top: auto;
    margin-bottom: 2px;
}

/* Les petites maisons (points verts) */
.md-house {
    width: 6px; height: 6px;
    background: #27ae60; /* Vert maison */
    border: 1px solid #1e8449;
    border-radius: 1px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

/* L'hôtel (Barre rouge) */
.md-hotel {
    width: 16px; height: 8px;
    background: #c0392b; /* Rouge hôtel */
    border: 1px solid #922b21;
    border-radius: 1px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

/* LOGS */
.logs-box {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px;
    overflow-y: auto;
    font-size: 0.85em;
    margin-bottom: 5px;
    display: flex; flex-direction: column; gap: 4px;
    max-height: 200px;
    height: 150px;
    font-family: 'Roboto', sans-serif;
}

.logs-box { height: 120px; color: #aaa; }

/* --- CHAT FLOTTANT (Bouton & Modal) --- */

/* Le bouton rond en bas à droite */
#chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    z-index: 5000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: transform 0.2s, background 0.2s;
    display: flex; align-items: center; justify-content: center;
}
#chat-toggle-btn:hover { transform: scale(1.1); background: #2980b9; }

/* Badge de notification (rouge) */
#chat-badge {
    position: absolute;
    top: -5px; right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #2c3e50;
}

/* La fenêtre de discussion */
.chat-float-modal {
    display: none; /* Caché par défaut */
    flex-direction: column;
    position: fixed;
    bottom: 90px; /* Juste au-dessus du bouton */
    right: 20px;
    width: 320px;
    height: 450px;
    background: #2c3e50;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 5000;
    overflow: hidden;
    animation: slideInChat 0.2s ease-out;
}

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

/* En-tête du chat */
.chat-header {
    background: #34495e;
    padding: 12px 15px;
    color: white;
    font-weight: bold;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.2);
}
.close-chat-btn {
    background: none; border: none; color: #bdc3c7; cursor: pointer; font-size: 1.2em;
}
.close-chat-btn:hover { color: white; }

/* Zone des messages */
.chat-box-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    display: flex; flex-direction: column; gap: 8px;
}

/* Zone de saisie */
.chat-input-area {
    padding: 10px;
    background: #22313f;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex; gap: 8px;
}
.chat-input-area input {
    flex: 1;
    padding: 8px;
    border-radius: 20px;
    border: 1px solid #444;
    background: #1a1a1a;
    color: white;
    outline: none;
}
.chat-input-area button {
    border-radius: 20px;
    padding: 0 15px;
}

/* Style des messages */
.chat-msg {
    font-size: 0.9em;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    word-wrap: break-word;
}
.chat-time { font-size: 0.75em; color: #7f8c8d; margin-right: 5px; }
.chat-name { color: #f1c40f; font-weight: bold; margin-right: 5px; }
.chat-txt { color: #ecf0f1; }

/* --- PLATEAU (BOARD) --- */
.board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1800px;
    overflow: hidden;
    position: relative;
    padding: 20px;
}

.view-toggle {
    position: absolute; top: 20px; right: 20px;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); color: white;
    padding: 8px 16px; border-radius: 30px; cursor: pointer; z-index: 500;
    transition: 0.3s; font-weight: bold; text-transform: uppercase; font-size: 0.75em; letter-spacing: 1px;
}
.view-toggle:hover { background: white; color: black; }

#polipoly-board {
    display: grid;
    grid-template-columns: repeat(9, var(--cell-size));
    grid-template-rows: repeat(9, var(--cell-size));
    width: calc(var(--cell-size) * 9);
    height: calc(var(--cell-size) * 9);
    background-color: #e6e6e6;
    
    border: 12px solid #1a252f;
    border-radius: 15px; /* Coins extérieurs arrondis */
    
    box-shadow: 0 50px 100px rgba(0,0,0,0.8); /* Grosse ombre au sol */
    
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-style: preserve-3d;
    gap: 0;
}

/* --- LES CASES (CELLULES) --- */
.cell {
    background: #fdfdfd;
    border: 1px solid #bdc3c7;
    display: flex; flex-direction: column;
    position: relative;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.03); /* Texture papier */
    backface-visibility: hidden;
    width: var(--cell-size);
    height: var(--cell-size);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Structure interne d'une case */
.cell-top {
    height: 35%;
    width: 100%;
    position: relative;
    border-bottom: 2px solid #2c3e50;
}
.cell-color-bar {
    width: 100%; height: 100%;
    /* Gradient subtil pour effet brillant */
    background-image: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.1) 100%);
}

.cell-body {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 2px 4px;
    text-align: center;
}
.cell-name {
    font-family: 'Oswald', sans-serif;
    font-size: 0.65em;
    line-height: 1.1;
    text-transform: uppercase;
    color: #2c3e50;
    font-weight: 700;
}

.cell-bottom {
    height: 15%;
    display: flex; justify-content: center; align-items: flex-start;
}
.cell-price {
    font-size: 0.6em;
    font-family: 'Roboto', sans-serif;
    color: #7f8c8d;
    font-weight: bold;
}

/* CASES COINS */
.corner {
    background: #ecf0f1;
    background-image: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.05) 100%);
}

/* CENTRE DU PLATEAU */
.center-box {
    grid-column: 2 / 9;
    grid-row: 2 / 9;
    background: var(--center-bg);
    /* Motif subtil */
    background-image: 
        radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    box-shadow: inset 0 0 80px rgba(0,0,0,0.6); /* Effet creusé profond */
    color: white;
    border: 4px solid #1a252f;
    position: relative;
}

.center-box h1 {
    font-family: 'Oswald', sans-serif;
    letter-spacing: 5px;
    font-size: 3em;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    background: -webkit-linear-gradient(#f1c40f, #bf953f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    opacity: 0.8;
}

/* INFO TOUR & DÉS (Textuels) */
#turn-indicator {
    font-size: 1.2em; color: #bdc3c7; margin-bottom: 10px; font-weight: 300;
}
#dice-display {
    font-size: 2em; font-weight: bold; color: white; margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(255,255,255,0.2);
}

/* BOUTONS D'ACTION */
.action-buttons {
    display: flex; gap: 12px; z-index: 10;
}
.btn-green, .btn-blue, .btn-buy, .btn-red {
    border: none; padding: 8px 24px; border-radius: 4px;
    font-family: 'Oswald', sans-serif; font-size: 1rem; letter-spacing: 1px;
    cursor: pointer; text-transform: uppercase;
    box-shadow: 0 4px 0 rgba(0,0,0,0.3), 0 5px 10px rgba(0,0,0,0.2);
    transition: all 0.1s;
    position: relative; top: 0;
}
.btn-green:active, .btn-buy:active { top: 4px; box-shadow: 0 0 0 rgba(0,0,0,0); }
.btn-green:disabled, .btn-blue:disabled { 
    background: #555; color: #888; cursor: not-allowed; box-shadow: none; 
}

.btn-green { background: var(--color-success); color: white; }
.btn-blue { background: #2980b9; color: white;}
.btn-red { background: var(--color-danger); color: white; }
.btn-buy { 
    background: #e67e22; color: white; 
    animation: pulse-btn 2s infinite;
}
@keyframes pulse-btn { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* --- CONTENEUR DES PIONS --- */
.tokens-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    
    /* Système de grille flexible pour éviter l'empilement moche */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    align-content: center; /* Centre verticalement le groupe */
    
    gap: 2px; /* Espacement minimum entre les pions */
    padding: 2px;
    z-index: 50; /* Au-dessus des maisons */
    pointer-events: none; /* Laisse passer les clics vers la case */
}

/* --- LE PION (Style Figurine) --- */
.token {
    /* Taille de base confortable */
    font-size: 32px;
    width: 32px; height: 32px;
    line-height: 32px;
    text-align: center;
    
    /* Réactive les clics sur le pion lui-même (pour le hover) */
    pointer-events: auto;
    cursor: help;
    
    position: relative;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Contour blanc pour détacher l'émoji du fond sombre/coloré */
    text-shadow: 
        0 0 0 rgba(0,0,0,0), /* Hack anti-aliasing */
        -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, /* Contour Blanc */
        0 2px 4px rgba(0,0,0,0.5); /* Ombre portée */
        
    /* SOCLE DE COULEUR (Lueur sous le pion) */
    filter: drop-shadow(0 0 5px var(--p-color));
}

/* Interaction : Zoom au survol pour voir qui c'est */
.token:hover {
    transform: scale(1.8) translateY(-10px);
    z-index: 1000;
    filter: drop-shadow(0 0 8px var(--p-color)) drop-shadow(0 5px 10px rgba(0,0,0,0.8));
}

/* Style Prison */
.token.in-jail {
    filter: grayscale(1);
    opacity: 0.8;
}
.token.in-jail::after {
    content: '⛓️';
    position: absolute;
    font-size: 14px;
    bottom: -2px; right: -5px;
}

/* MARQUEURS PROPRIÉTAIRE */
.owner-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    z-index: 5;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}
.owner-marker {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    z-index: 30;
    background-color: #555;
}

/* SURBRILLANCE CASE ARRIVÉE */
.cell-highlight {
    animation: highlightPulse 1s ease-out;
    z-index: 10;
    box-shadow: 0 0 20px var(--color-primary);
    border-color: var(--color-primary);
}
@keyframes highlightPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 40px var(--color-primary); }
    100% { transform: scale(1); }
}

/* --- DÉS 3D RÉALISTES --- */
#dice-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    display: flex; justify-content: center; align-items: center;
    gap: 60px; z-index: 500;
    perspective: 800px;
}

.die {
    width: 64px; height: 64px;
    position: relative;
    transform-style: preserve-3d;
    opacity: 0;
    transition: transform 1.5s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.3s ease-in;
}
.die.visible { opacity: 1; }

.face {
    position: absolute; width: 100%; height: 100%;
    background-color: #f6f6f6;
    background-image: radial-gradient(circle at center, #ffffff 0%, #dddddd 100%);
    border: 1px solid #aaa; border-radius: 12px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.15);
    display: flex; justify-content: center; align-items: center;
    backface-visibility: hidden;
}
.face::before { 
    content: ''; display: block; background: #2c3e50; border-radius: 50%;
    box-shadow: inset 1px 1px 2px rgba(255,255,255,0.3), 1px 1px 1px rgba(0,0,0,0.2);
}
.one::before { width: 16px; height: 16px; background: #e74c3c; }
.two::before { width: 12px; height: 12px; background: transparent; box-shadow: -18px -18px 0 #2c3e50, 18px 18px 0 #2c3e50; }
.three::before { width: 12px; height: 12px; box-shadow: -18px -18px 0 #2c3e50, 18px 18px 0 #2c3e50; }
.four::before { width: 12px; height: 12px; background: transparent; box-shadow: -18px -18px 0 #2c3e50, 18px -18px 0 #2c3e50, -18px 18px 0 #2c3e50, 18px 18px 0 #2c3e50; }
.five::before { width: 12px; height: 12px; box-shadow: -18px -18px 0 #2c3e50, 18px -18px 0 #2c3e50, -18px 18px 0 #2c3e50, 18px 18px 0 #2c3e50; }
.six::before { width: 12px; height: 12px; background: transparent; box-shadow: -18px -18px 0 #2c3e50, 18px -18px 0 #2c3e50, -18px 0 0 #2c3e50, 18px 0 0 #2c3e50, -18px 18px 0 #2c3e50, 18px 18px 0 #2c3e50; }

.face.one   { transform: rotateY(0deg) translateZ(32px); }
.face.six   { transform: rotateY(180deg) translateZ(32px); }
.face.two   { transform: rotateY(-90deg) translateZ(32px); }
.face.five  { transform: rotateY(90deg) translateZ(32px); }
.face.three { transform: rotateX(-90deg) translateZ(32px); }
.face.four  { transform: rotateX(90deg) translateZ(32px); }

/* --- MODALES --- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: none; place-items: center; justify-content: center;
}

#confirm-modal{
    z-index: 6000;
}

.modal-box, .trade-box, .asset-modal-box {
    background: #1e272e;
    color: #ecf0f1;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
    font-family: 'Roboto', sans-serif;
    border: 1px solid #34495e;
}

/* --- CARTES CHANCE & CAISSE --- */
.card-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85); /* Fond très sombre pour focus */
    backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 5000;
    perspective: 1000px; /* Pour l'effet 3D */
}

/* LA CARTE PHYSIQUE */
.game-card-physical {
    width: 340px; height: 500px;
    background-color: #fdfaf5; /* Blanc cassé / Parchemin */
    border-radius: 20px;
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.8),
        inset 0 0 30px rgba(0,0,0,0.05); /* Ombre interne */
    position: relative;
    display: flex; flex-direction: column;
    overflow: hidden;
    transform-style: preserve-3d;
    
    /* Animation d'entrée : Arrive du fond et se retourne */
    animation: dealCard 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: 8px solid white; /* Bordure blanche photo */
}

@keyframes dealCard {
    0% { transform: translateY(100vh) rotateX(60deg) scale(0.5); opacity: 0; }
    100% { transform: translateY(0) rotateX(0deg) scale(1); opacity: 1; }
}

/* HEADER DE LA CARTE */
.gc-header {
    height: 100px;
    display: flex; justify-content: center; align-items: center;
    position: relative;
    border-bottom: 2px solid rgba(0,0,0,0.1);
}
.gc-title {
    font-family: 'Oswald', sans-serif;
    font-size: 2.5em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 2;
}

/* CORPS DE LA CARTE */
.gc-body {
    flex: 1;
    padding: 20px;
    display: flex; flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #2c3e50;
    font-family: 'Times New Roman', serif;
    position: relative;
}

/* ICONE CENTRALE (Filigrane) */
.gc-icon-bg {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 150px;
    opacity: 0.07;
    pointer-events: none;
}

.gc-text {
    font-size: 1.4em;
    line-height: 1.4;
    font-weight: bold;
    margin-bottom: 20px;
    z-index: 10;
}

/* PIED DE CARTE (Action/Prix) */
.gc-footer {
    padding: 20px;
    border-top: 1px dashed rgba(0,0,0,0.2);
    display: flex; flex-direction: column; gap: 10px;
    align-items: center;
    background: rgba(0,0,0,0.02);
}

.gc-action-tag {
    font-family: 'Roboto', sans-serif;
    background: #2c3e50;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    text-transform: uppercase;
    font-weight: bold;
}

.gc-amount {
    font-size: 2em;
    font-weight: bold;
    color: #27ae60;
}
.gc-amount.negative { color: #c0392b; }

/* --- STYLE SPÉCIFIQUE : CHANCE (Orange) --- */
.game-card-physical.style-chance {
    border-color: #fff;
}
.game-card-physical.style-chance .gc-header {
    background: linear-gradient(135deg, #e67e22, #d35400);
}
.game-card-physical.style-chance .gc-icon-bg::after { content: '?'; color: #e67e22; }
.game-card-physical.style-chance .gc-btn {
    background: #e67e22; color: white; border: none; padding: 10px 30px; 
    border-radius: 5px; font-size: 1.2em; cursor: pointer; margin-top: 10px;
    font-family: 'Oswald', sans-serif; transition: 0.2s;
    box-shadow: 0 4px 0 #d35400;
}
.game-card-physical.style-chance .gc-btn:active { transform: translateY(4px); box-shadow: none; }


/* --- STYLE SPÉCIFIQUE : CAISSE (Bleu) --- */
.game-card-physical.style-coffre {
    border-color: #fff;
}
.game-card-physical.style-coffre .gc-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
}
.game-card-physical.style-coffre .gc-title { font-size: 1.8em; } /* Texte plus long */
.game-card-physical.style-coffre .gc-icon-bg::after { content: '📦'; filter: grayscale(1); }
.game-card-physical.style-coffre .gc-btn {
    background: #3498db; color: white; border: none; padding: 10px 30px; 
    border-radius: 5px; font-size: 1.2em; cursor: pointer; margin-top: 10px;
    font-family: 'Oswald', sans-serif; transition: 0.2s;
    box-shadow: 0 4px 0 #2980b9;
}
.game-card-physical.style-coffre .gc-btn:active { transform: translateY(4px); box-shadow: none; }

/* STYLE SPÉCIFIQUE : IMPOTS (Gris) */
.game-card-physical.style-taxe .gc-header { background: #7f8c8d; }
.game-card-physical.style-taxe .gc-icon-bg::after { content: '💸'; filter: grayscale(1); }
.game-card-physical.style-taxe .gc-btn { background: #2c3e50; color:white; border:none; padding:10px 30px; border-radius:5px; font-size:1.2em; cursor:pointer; box-shadow:0 4px 0 #000; }


/* Styles spécifiques pour cases spéciales (CSS Grid) */
.cell-special-depart { border-top: 4px solid #27ae60; }
.cell-special-prison { border-left: 4px solid #c0392b; background: rgba(192,57,43,0.05); }
.cell-special-allez_prison { border-right: 4px solid #c0392b; background: rgba(192,57,43,0.05); }
.cell-special-chance { background-image: radial-gradient(circle, rgba(241,196,15,0.1), transparent); }
.cell-special-impots, .cell-special-taxe { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.02), rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.05) 10px, rgba(0,0,0,0.05) 20px); }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 900px) {
    #screen-game { flex-direction: column-reverse; }
    .sidebar { width: 100%; height: 25vh; border-right: none; border-top: 1px solid #444; flex-direction: row; overflow-x: auto; }
    .sidebar h3, .logs-box, .chat-container { display: none; }
    .board-container { height: 75vh; }
    :root { --board-size: 95vw; }
    .cell-name { font-size: 0.5em; }
    .cell-price { font-size: 0.5em; }
}

/* --- STRUCTURE CASES SPÉCIALES (NON-PROPRIÉTÉS) --- */
/* On cible toutes les cases qui ne sont pas des propriétés classiques */
.cell[data-type="DEPART"], 
.cell[data-type="PRISON"], 
.cell[data-type="ALLEZ_PRISON"], 
.cell[data-type="PARC"], 
.cell[data-type="CHANCE"], 
.cell[data-type="COFFRE"], 
.cell[data-type="IMPOTS"], 
.cell[data-type="TAXE"] {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 5px;
}

/* On cache la barre de couleur et le bas pour ces cases */
.cell[data-type="DEPART"] .cell-top, .cell[data-type="DEPART"] .cell-bottom,
.cell[data-type="PRISON"] .cell-top, .cell[data-type="PRISON"] .cell-bottom,
.cell[data-type="ALLEZ_PRISON"] .cell-top, .cell[data-type="ALLEZ_PRISON"] .cell-bottom,
.cell[data-type="PARC"] .cell-top, .cell[data-type="PARC"] .cell-bottom,
.cell[data-type="CHANCE"] .cell-top, .cell[data-type="CHANCE"] .cell-bottom,
.cell[data-type="COFFRE"] .cell-top, .cell[data-type="COFFRE"] .cell-bottom,
.cell[data-type="IMPOTS"] .cell-top, .cell[data-type="IMPOTS"] .cell-bottom,
.cell[data-type="TAXE"] .cell-top, .cell[data-type="TAXE"] .cell-bottom {
    display: none;
}

/* Le corps prend toute la place */
.cell[data-type="DEPART"] .cell-body,
.cell[data-type="PRISON"] .cell-body,
.cell[data-type="ALLEZ_PRISON"] .cell-body,
.cell[data-type="PARC"] .cell-body,
.cell[data-type="CHANCE"] .cell-body,
.cell[data-type="COFFRE"] .cell-body,
.cell[data-type="IMPOTS"] .cell-body,
.cell[data-type="TAXE"] .cell-body {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2; /* Au dessus du background */
}

/* Style du texte pour ces cases */
.cell-special-text {
    font-size: 0.75em;
    font-weight: 900;
    text-transform: uppercase;
    color: #2c3e50;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
    transform: rotate(-45deg); /* Optionnel : pour styliser, sinon retirer */
}

/* --- DESIGN SPÉCIFIQUE DES CASES --- */

/* 1. PRISON (Barreaux verticaux) */
.cell-special-prison {
    background-color: #bdc3c7;
    /* Motif barreaux : Lignes noires verticales espacées */
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(44, 62, 80, 0.6) 10px,
        rgba(44, 62, 80, 0.6) 14px
    );
    border: 2px solid #7f8c8d;
}
/* Zone blanche pour que le texte reste lisible par dessus les barreaux */
.cell-special-prison .cell-body {
    background: rgba(255,255,255,0.8);
    border-radius: 4px;
    padding: 2px;
    max-height: 60%;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
.cell-special-prison::after { content: "⛓️"; font-size: 1.5em; position:absolute; bottom:5px; right:5px; opacity:0.5; }


/* 2. ALLEZ EN PRISON (Police / Sirène) */
.cell-special-allez_prison {
    background: repeating-linear-gradient(
        45deg,
        #3498db,
        #3498db 10px,
        #e74c3c 10px,
        #e74c3c 20px
    );
    color: white;
}
.cell-special-allez_prison .cell-body {
    background: #2c3e50;
    color: white;
    border-radius: 50%;
    width: 90%; height: 90%; /* Rond central */
    border: 3px solid white;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.cell-special-allez_prison .cell-name { color: white; font-size: 0.6em; }
.cell-special-allez_prison::after { content: "👮"; font-size: 1.8em; margin-top:5px; display:block; }


/* 3. DÉPART (Flèche / Vert) */
.cell-special-depart {
    background: #ecf0f1;
    border: 2px solid #27ae60;
}
/* Une grosse flèche verte en fond */
.cell-special-depart::before {
    content: '⇑';
    position: absolute;
    font-size: 4em;
    color: rgba(39, 174, 96, 0.2);
    z-index: 1;
    transform: rotate(0deg);
    top: 0;
}
.cell-special-depart .cell-name { color: #27ae60; font-weight: bold; }


/* 4. CHANCE (Points d'interrogation) */
.cell-special-chance {
    background-color: #ff9f43;
    background-image: radial-gradient(circle, rgba(255,255,255,0.3) 2px, transparent 2.5px);
    background-size: 10px 10px; /* Petit pois */
}
.cell-special-chance .cell-body {
    font-size: 3em;
    font-family: 'Times New Roman', serif;
    font-weight: bold;
    color: rgba(255,255,255,0.9);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}
/* On remplace le texte par un gros "?" */
.cell-special-chance .cell-name { display: none; } 
.cell-special-chance .cell-body::after { content: "?"; }


/* 5. COFFRE / CAISSE (Coffre bleu) */
.cell-special-coffre {
    background-color: #54a0ff;
    border: 2px dashed white;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}
.cell-special-coffre::after {
    content: "📦";
    font-size: 2.5em;
    filter: drop-shadow(0 4px 2px rgba(0,0,0,0.3));
}
.cell-special-coffre .cell-name { margin-bottom: -40px; color: white; font-weight: bold; text-shadow: 0 1px 2px black; z-index: 10;}


/* 6. TAXE / IMPOTS (Diamant / Papier) */
.cell-special-impots, .cell-special-taxe {
    background-color: #dfe6e9;
    /* Motif losange */
    background-image: linear-gradient(135deg, #b2bec3 25%, transparent 25%), linear-gradient(225deg, #b2bec3 25%, transparent 25%), linear-gradient(45deg, #b2bec3 25%, transparent 25%), linear-gradient(315deg, #b2bec3 25%, transparent 25%);
    background-position: 10px 0, 10px 0, 0 0, 0 0;
    background-size: 20px 20px;
    background-repeat: repeat;
}
.cell-special-impots .cell-body, .cell-special-taxe .cell-body {
    background: white;
    border: 1px solid #7f8c8d;
    transform: rotate(-5deg); /* Effet "ticket" posé */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    width: 80%; height: 60%;
}
.cell-special-impots .cell-name, .cell-special-taxe .cell-name { font-size: 0.6em; }


/* 7. PARC GRATUIT (Banc / Repos) */
.cell-special-parc {
    background: #f1c40f; /* Jaune standard polipoly */
}
.cell-special-parc::after {
    content: "🅿️";
    font-size: 3em;
}
.cell-special-parc .cell-name { display:none; } /* Juste l'icone */


/* --- AJUSTEMENT DES MEDIAS --- */
.cell[data-type="MEDIAS"] .cell-top {
    background: #2c3e50; /* Gris foncé locomotive */
    border-bottom: 2px dashed white; /* Rails */
}
.cell[data-type="MEDIAS"] .cell-color-bar { display: none; } /* Pas de couleur groupe */
.cell[data-type="MEDIAS"] .cell-name { font-size: 0.65em; font-weight: bold; margin-top: 5px; }
.cell[data-type="MEDIAS"]::after {
    content: "📺";
    font-size: 1.5em;
    opacity: 0.2;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 0;
}

/* --- AJUSTEMENT DES COMPAGNIES (Électricité / Eau) --- */
.cell[data-type="COMPAGNIE"] .cell-top {
    background: #7f8c8d;
}
.cell[data-type="COMPAGNIE"] .cell-color-bar { display: none; }
.cell[data-type="COMPAGNIE"]::after {
    content: "⚡";
    font-size: 2em;
    color: #f1c40f;
    opacity: 0.3;
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
}

/* Modal d'infos case */
.cell-info-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    padding: 20px;
}
.cell-info-box {
    width: min(420px, 90vw);
    background: linear-gradient(180deg,#1f2b34,#122027);
    border: 1px solid rgba(255,255,255,0.06);
    color: #e6f0e6;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.7);
    position: relative;
    font-family: 'Segoe UI', sans-serif;
}
.cell-info-box h3 { margin-top:0; color:#fff; font-size:1.1em; }
.cell-info-box .cell-info-close {
    position: absolute;
    right: 8px; top: 8px;
    background: transparent;
    border: none;
    color: #ddd;
    font-size: 18px;
    cursor: pointer;
}
.cell-info-box small { color: #bcd; }

.cell-info-box.special {
    width: min(520px, 92vw);
    max-width: 92vw;
    background: linear-gradient(180deg, rgba(18,25,35,0.96), rgba(30,40,50,0.96));
    border-left: 6px solid rgba(255,255,255,0.06);
    padding: 18px;
    border-radius: 12px;
    color: #eaf2f2;
    box-shadow: 0 18px 50px rgba(0,0,0,0.75);
    display: flex;
    gap: 14px;
    align-items: center;
    font-family: 'Roboto', sans-serif;
}

/* Structure interne */
.cell-info-box.special .cell-info-flex { display:flex; gap:16px; align-items:center; width:100%; }
.cell-info-box.special .cell-info-icon {
    width:96px; height:96px; border-radius:12px;
    display:flex; align-items:center; justify-content:center;
    font-size:44px; box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    flex-shrink:0;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.08));
    border: 1px solid rgba(255,255,255,0.03);
}
.cell-info-box.special .cell-info-main { flex:1; display:flex; flex-direction:column; gap:8px; }
.cell-info-box.special .cell-info-title { margin:0; font-size:1.25em; color:#fff; letter-spacing:0.6px; font-weight:800; }
.cell-info-box.special .cell-info-desc { margin:0; color:#cbd6d6; line-height:1.35; font-size:0.95em; }
.cell-info-box.special .cell-info-amount { margin-top:6px; font-weight:800; color:#f1c40f; font-size:1.05em; }

/* Accent couleurs par type */
.cell-info-box.special.type-depart { border-left-color: #27ae60; }
.cell-info-box.special.type-prison,
.cell-info-box.special.type-allez_prison { border-left-color: #c0392b; }
.cell-info-box.special.type-chance { border-left-color: #9b59b6; }
.cell-info-box.special.type-coffre { border-left-color: #54a0ff; }
.cell-info-box.special.type-impots,
.cell-info-box.special.type-taxe { border-left-color: #e74c3c; }
.cell-info-box.special.type-parc { border-left-color: #1abc9c; }

/* Icon background variations (subtle glass) */
.cell-info-box.special.type-depart .cell-info-icon { background: linear-gradient(180deg,#2ecc71, rgba(46,204,113,0.15)); color:#063; }
.cell-info-box.special.type-prison .cell-info-icon,
.cell-info-box.special.type-allez_prison .cell-info-icon { background: linear-gradient(180deg,#e74c3c, rgba(231,76,60,0.12)); color:#fff; }
.cell-info-box.special.type-chance .cell-info-icon { background: linear-gradient(180deg,#9b59b6, rgba(155,89,182,0.12)); color:#fff; }
.cell-info-box.special.type-coffre .cell-info-icon { background: linear-gradient(180deg,#54a0ff, rgba(84,160,255,0.12)); color:#fff; }
.cell-info-box.special.type-impots .cell-info-icon { background: linear-gradient(180deg,#e74c3c, rgba(231,76,60,0.12)); color:#fff; }
.cell-info-box.special.type-parc .cell-info-icon { background: linear-gradient(180deg,#f1c40f, rgba(241,196,15,0.12)); color:#222; }

/* Close button small and consistent */
.cell-info-box.special .cell-info-close {
    position: absolute; right: 12px; top: 10px; background: rgba(255,255,255,0.04);
    border: none; color: #ddd; border-radius:6px; cursor:pointer;
}

/* Responsive tweaks */
@media (max-width:600px) {
    .cell-info-box.special { padding:12px; gap:10px; }
    .cell-info-box.special .cell-info-icon { width:72px; height:72px; font-size:34px; }
    .cell-info-box.special .cell-info-title { font-size:1.05em; }
    .cell-info-box.special .cell-info-desc { font-size:0.9em; }
}

/* --- MODALE CARTE DE PROPRIÉTÉ DÉTAILLÉE --- */
.deed-modal-card {
    background: white;
    width: 320px;
    border: 1px solid #000;
    box-shadow: 0 0 0 10px rgba(255,255,255,0.1), 0 20px 50px rgba(0,0,0,0.8);
    color: black;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    margin: auto;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.dm-header {
    border: 2px solid #000;
    margin: 5px;
    padding: 15px 5px;
    text-align: center;
    text-transform: uppercase;
    font-weight: 900;
    font-size: 1.4em;
    letter-spacing: 1px;
    color: #000;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

.dm-body {
    padding: 10px 20px 20px;
    font-size: 0.9em;
    text-align: center;
    line-height: 1.5;
}

.dm-rent-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding: 2px 0;
}
.dm-rent-row.main { font-weight: bold; border-bottom: 2px solid #000; margin-bottom: 5px; }

.dm-house-cost {
    margin-top: 15px;
    font-style: italic;
    color: #555;
    border-top: 1px solid #ccc;
    padding-top: 5px;
}

.dm-mortgage {
    margin-top: 10px;
    font-size: 0.85em;
    color: #888;
}

.close-modal-btn {
    position: absolute;
    top: -15px; right: -15px;
    background: #c0392b; color: white;
    border: 2px solid white;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    z-index: 10;
    padding: unset;
}

/* --- BATIMENTS SUR LE PLATEAU --- */
.building-container {
    position: absolute;
    bottom: 3px;               
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    pointer-events: none;
    z-index: 20;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 90%;
}

.b-icon {
    font-size: 11px;
    line-height: 1;
    display: inline-block;
    transform: translateZ(1px);
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}

.lvl-1 { color: #555; font-size: 13px; } 
.lvl-2 { color: #d35400; font-size: 14px; } 
.lvl-3 { color: #c0392b; font-size: 16px; } 
.lvl-4 { 
    color: #f1c40f; 
    font-size: 20px; 
    filter: drop-shadow(0 3px 4px rgba(0,0,0,0.75));
    animation: floatCrown 2s infinite ease-in-out;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
    padding: 2px 4px;
    border-radius: 4px;
}

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

/* MODALE DE GESTION / AMÉLIORATION */
.upgrade-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: none; place-items: center;
    z-index: 3000;
}

.upgrade-box {
    background: #1e272e;
    width: min(500px, 95vw);
    border-radius: 12px;
    border: 1px solid #485460;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    overflow: hidden;
    color: white;
    font-family: 'Segoe UI', sans-serif;
    animation: slideUp 0.3s ease-out;
}

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

.up-header {
    background: #2c3e50;
    padding: 15px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 2px solid #000;
}
.up-header h2 { margin: 0; font-size: 1.2em; color: #f1c40f; text-transform: uppercase; }
.up-close { background: none; border: none; color: #aaa; font-size: 1.5em; cursor: pointer; }

.up-content {
    padding: 20px;
    display: flex; flex-direction: column; gap: 10px;
    max-height: 70vh; overflow-y: auto;
}

.up-row {
    display: grid;
    grid-template-columns: 50px 1fr 80px 100px;
    align-items: center;
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: 0.2s;
}

.up-icon { font-size: 1.5em; text-align: center; }
.up-info { display: flex; flex-direction: column; }
.up-name { font-weight: bold; font-size: 1em; }
.up-rent { font-size: 0.8em; color: #bdc3c7; }
.up-cost { font-weight: bold; color: #e74c3c; text-align: right; font-size: 0.9em; }

.up-btn {
    background: #27ae60; color: white;
    border: none; padding: 8px 12px;
    border-radius: 4px; cursor: pointer;
    font-weight: bold; font-size: 0.8em;
    margin-left: 10px;
}
.up-btn:disabled { background: #555; color: #888; cursor: not-allowed; }

.up-row.owned {
    background: rgba(39, 174, 96, 0.1);
    border-color: #27ae60;
}
.up-row.owned .up-cost { color: #2ecc71; content: "ACQUIS"; }

.up-row.next {
    background: rgba(241, 196, 15, 0.1);
    border-color: #f1c40f;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.2);
}

.up-row.locked { opacity: 0.5; filter: grayscale(1); }

.ministry-lock-msg {
    grid-column: 1 / -1;
    font-size: 0.8em; color: #e74c3c;
    text-align: center; margin-top: 5px; font-style: italic;
    background: rgba(231, 76, 60, 0.1); padding: 5px; border-radius: 4px;
}

/* BANNIÈRE DE DETTE */
#debt-banner {
    display: none; 
    position: fixed;
    top: 0; left: 0; width: 100%;
    background-color: rgba(192, 57, 43, 0.95);
    color: white;
    padding: 10px;
    text-align: center;
    z-index: 2500; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    font-weight: bold;
    font-size: 1.1em;
}

#debt-banner span { margin-right: 15px; }

#debt-banner button {
    padding: 5px 15px;
    font-size: 0.9em;
    background: #fff;
    color: #c0392b;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

/* --- GESTIONNAIRE DE PATRIMOINE (ASSET MANAGER) --- */
.asset-modal-box {
    width: 800px;
    max-width: 95vw;
    background: #2c3e50;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    font-family: 'Segoe UI', sans-serif;
}

.asset-header {
    background: #34495e;
    padding: 15px 20px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #1a252f;
    color: white;
}
.asset-header h2 { margin: 0; font-size: 1.3em; color: #f1c40f; text-transform: uppercase; }

.asset-body {
    padding: 20px;
    overflow-y: auto;
    background: #22313f;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.asset-section-title {
    color: #bdc3c7;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

/* GRILLE DES PROPRIÉTÉS */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

/* CARTE D'ACTIF */
.asset-card {
    background: #ecf0f1;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    height: 140px;
    display: flex; flex-direction: column;
}
.asset-card:hover { transform: translateY(-3px); }

.asset-card-color { height: 25px; width: 100%; border-bottom: 1px solid rgba(0,0,0,0.1); }

.asset-card-content {
    flex: 1;
    padding: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    text-align: center;
}

.asset-name { font-weight: bold; font-size: 0.85em; color: #2c3e50; line-height: 1.2; margin-bottom: 5px; }

.asset-action-indicator {
    background: #27ae60;
    color: white;
    padding: 6px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background 0.2s;
}

/* États spécifiques */
.asset-card.is-mortgaged {
    background: #95a5a6;
    filter: grayscale(0.8);
}
.asset-card.is-mortgaged .asset-action-indicator {
    background: #c0392b; 
}

.asset-card.has-buildings .asset-action-indicator {
    background: #e67e22; 
}

.asset-buildings-icon {
    margin-top: 5px;
    color: #2c3e50;
    font-size: 0.8em;
}

.asset-locked-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    display: flex; justify-content: center; align-items: center;
    text-align: center; font-size: 0.8em; padding: 10px;
    opacity: 0; transition: opacity 0.2s;
}
.asset-card:hover .asset-locked-overlay { opacity: 1; }

.empty-state { color: #7f8c8d; font-style: italic; text-align: center; padding: 10px; }

.info-card-modal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: 4000;
    padding: 20px;
}
.info-card-box {
    width: min(520px, 96vw);
    background: linear-gradient(180deg,#0f1720,#122227);
    border: 1px solid rgba(255,255,255,0.06);
    color: #e6f0e6;
    padding: 18px;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    font-family: 'Segoe UI', sans-serif;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.info-card-close {
    position: absolute;
    right: 10px; top: 8px;
    background: transparent;
    border: none;
    color: #bbb;
    font-size: 18px;
    cursor: pointer;
}
.info-card-header {
    display:flex; justify-content:space-between; align-items:center;
    gap:10px;
}
.info-player { font-weight:700; font-size:1.05em; color:#f1c40f; }
.info-case { font-size:0.95em; color:#bdc3c7; text-align:right; }
.info-card-body { background: rgba(255,255,255,0.02); padding: 12px; border-radius:6px; }
.info-txt { margin-bottom:8px; color:#e6f0e6; line-height:1.3; }
.info-amount { font-weight:800; color:#2ecc71; margin-top:6px; }
.info-move { color:#9b59b6; margin-top:6px; }
.info-jail { color:#e74c3c; margin-top:6px; font-weight:700; }
.info-details { color:#95a5a6; margin-top:6px; font-size:0.9em; }
.info-card-actions { display:flex; justify-content:flex-end; gap:8px; }
@media (max-width:600px) {
    .info-card-box { width: 96vw; padding: 12px; }
    .info-player { font-size:1em; }
}

/* --- ADVANCED TRADE UI --- */
.trade-container {
    display: flex;
    gap: 20px;
    height: 400px;
    user-select: none;
}

.trade-column {
    flex: 1;
    background: #1e272e;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    border: 2px solid #34495e;
}

.trade-header {
    text-align: center;
    font-weight: bold;
    color: #ecf0f1;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #555;
}

.trade-area {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 2px dashed #555;
    border-radius: 6px;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    transition: background 0.2s;
}

/* Improved trade visuals */
.trade-summary { display:flex; gap:10px; align-items:center; color:#1d1d1d; }
.trade-summary .trade-total { font-weight:800; color:#f1c40f; margin-left:6px; }
.trade-footer { border-top:1px solid rgba(255,255,255,0.04); padding-top:12px; }
.trade-area { min-height:120px; background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.03)); border:1px dashed rgba(255,255,255,0.04); padding:8px; border-radius:6px; display:flex; flex-wrap:wrap; gap:8px; align-content:flex-start; }
.trade-area.drag-over { box-shadow: 0 6px 18px rgba(41,128,185,0.18); border-color: rgba(46,204,113,0.5); transform: translateY(-4px); transition: all 0.18s ease; }
.trade-item { background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.06)); padding:8px 10px; border-radius:8px; display:flex; gap:8px; align-items:center; min-width:90px; cursor:grab; box-shadow: 0 6px 14px rgba(0,0,0,0.35); border:1px solid rgba(255,255,255,0.03); }
.trade-item .t-icon { width:28px; height:28px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:14px; color:#fff; }
.trade-item .t-desc { font-size:0.9em; color:#eef; font-weight:600; }
.trade-item.money .t-icon { background: #2ecc71; }
.trade-item.prop .t-icon { background: linear-gradient(180deg,#3498db,#2980b9); }
.trade-item.jail .t-icon { background: #e67e22; }
.trade-item .t-meta { font-size:0.8em; color:#bcd; margin-left:6px; }
.trade-actions { display:flex; gap:8px; align-items:center; }
.trade-inventory small { color:#9aa; }

/* Button state when ready */
#trade-send-btn:disabled { opacity:0.55; transform:none; }
#trade-send-btn.enabled { box-shadow: 0 8px 30px rgba(39,174,96,0.18); }


.trade-area.drag-over {
    background: rgba(46, 204, 113, 0.1);
    border-color: #2ecc71;
}

/* DRAGGABLE ITEMS */
.trade-item {
    background: #34495e;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: grab;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.trade-item:active { cursor: grabbing; }

.trade-item.prop { border-left: 4px solid #fff; } 
.trade-item.money { background: #27ae60; }
.trade-item.jail { background: #e67e22; }
.trade-item.immune { background: #9b59b6; }

/* INPUTS DANS LA COLONNE "BANK/INVENTORY" */
.trade-inventory {
    height: 150px;
    margin-top: 10px;
    padding: 10px;
    background: #111;
    border-radius: 4px;
    overflow-y: auto;
}

/* --- SÉLECTEUR D'AVATAR (LOBBY) --- */
.avatar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}
.avatar-btn {
    font-size: 24px;
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.avatar-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }
.avatar-btn.selected {
    background: var(--color-success);
    border-color: white;
    box-shadow: 0 0 10px var(--color-success);
}

/* --- ANIMATION ARGENT (MONEY TRANSFER) --- */
.flying-cash {
    position: fixed;
    z-index: 9999;
    color: #2ecc71; /* Vert billet */
    font-family: 'Oswald', sans-serif;
    font-weight: bold;
    font-size: 1.5rem;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    
    /* Transition fluide pour le mouvement */
    transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1), opacity 1s ease-in;
    opacity: 1;
}

.flying-cash.expense {
    color: #e74c3c; /* Rouge si on perd vers la banque */
}

.flying-cash i {
    font-style: normal;
    font-size: 1.2em;
}

.dm-actions {
    text-align: center;
}
.dm-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #95a5a6;
}
/* --- TIMER FIXE EN HAUT --- */
#fixed-timer {
    position: absolute;
    top: 5px;
    left: 50%;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1px 15px;
    border-radius: 30px;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    z-index: 1000; /* Au-dessus du plateau */
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border: 2px solid #34495e;
    transition: all 0.3s ease;
    pointer-events: none; /* Laisse cliquer au travers */
}

/* Animation d'urgence (moins de 10s) */
#fixed-timer.urgent {
    background: #c0392b;
    border-color: #e74c3c;
    animation: pulse-timer 1s infinite;
}

@keyframes pulse-timer {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); }
}

/* --- MONTANT JACKPOT (PARC) --- */
.jackpot-amount {
    position: absolute;
    top: 4px;
    left: 0;
    width: 100%;
    text-align: center;
    
    font-family: 'Oswald', sans-serif;
    font-size: 1.1em;
    font-weight: bold;
    color: #f1c40f; /* Or */
    
    text-shadow: 
        0 2px 0 #000, 
        0 0 10px rgba(241, 196, 15, 0.5); /* Lueur dorée */
    
    z-index: 20; /* Au-dessus de l'icône P */
    pointer-events: none;
    transition: transform 0.2s;
}

/* Petit effet quand il y a beaucoup d'argent */
.jackpot-amount.rich {
    color: #2ecc71; /* Vert dollar */
    transform: scale(1.1);
}

/* --- BANNIÈRE DES LOIS (Affichage écran) --- */
#law-banner {
    position: absolute;
    top: 15%; /* Positionné en haut du plateau */
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 500px;
    background: rgba(44, 62, 80, 0.95); /* Fond sombre par défaut */
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 150; /* Au-dessus du plateau mais sous les modales */
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    transition: all 0.5s ease;
    animation: slideDownLaw 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideDownLaw {
    from { top: -100px; opacity: 0; }
    to { top: 5%; opacity: 1; }
}

.law-icon-container {
    background: rgba(255,255,255,0.1);
    width: 50px; height: 50px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.2);
}

.law-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.law-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

#law-title {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    color: #f1c40f;
    font-size: 1.1em;
    font-weight: bold;
    letter-spacing: 1px;
}

.law-timer {
    background: #fff;
    color: #333;
    font-weight: bold;
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.law-desc {
    color: #ecf0f1;
    font-size: 0.9em;
    line-height: 1.2;
    font-family: 'Roboto', sans-serif;
}

/* VARIANTE : LOIS "NÉGATIVES" (Rouge) */
#law-banner.law-negative {
    background: linear-gradient(90deg, #c0392b, #8e44ad);
    border-color: #e74c3c;
}

/* VARIANTE : LOIS "POSITIVES" (Vert/Bleu) */
#law-banner.law-positive {
    background: linear-gradient(90deg, #27ae60, #2980b9);
    border-color: #2ecc71;
}

/* Bannière d'Annonce Globale */
#global-announce {
    position: fixed;
    top: 30%; /* Position un peu au-dessus du centre */
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    z-index: 5000;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Effet rebond */
    pointer-events: none; /* Permet de cliquer à travers si besoin */
    border: 2px solid white;
    min-width: 300px;
}

#global-announce.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Couleurs selon le type d'annonce */
.announce-box.type-success {
    border-color: #f1c40f;
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.95), rgba(46, 204, 113, 0.95));
    box-shadow: 0 0 20px #f1c40f;
}

.announce-box.type-warning {
    border-color: #e67e22;
    background: linear-gradient(135deg, rgba(211, 84, 0, 0.95), rgba(230, 126, 34, 0.95));
}

.announce-box.type-error {
    border-color: #c0392b;
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.95), rgba(231, 76, 60, 0.95));
    animation: shake 0.5s; /* Petit tremblement pour l'effet dramatique */
}

@keyframes shake {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  25% { transform: translate(-55%, -50%) rotate(-2deg); }
  75% { transform: translate(-45%, -50%) rotate(2deg); }
  100% { transform: translate(-50%, -50%) rotate(0deg); }
}

/* --- MOBILE & TABLETTE (Mode Portrait/Petit écran) --- */
@media (max-width: 900px) {
    /* 1. LAYOUT GLOBAL (Fixe et Plein Écran) */
    body, html {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        font-size: 16px; /* Base pour rem */
    }

    .game-wrapper {
        flex-direction: column;
        width: 100vw;
        height: 100vh;
    }

    /* 2. BARRE DES JOUEURS (EN HAUT) - Texte agrandi */
    .sidebar {
        width: 100%;
        height: 140px;      /* Un peu plus haut pour le confort */
        min-height: 140px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 2px solid #333;
        padding: 8px;
        background: #1e272e;
        gap: 10px;
        z-index: 200;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    }

    /* On cache l'inutile */
    .sidebar h3, .logs-box, .sidebar button { display: none !important; }
    
    #players-dashboard {
        display: flex;
        flex-direction: row;
        width: max-content;
        gap: 12px;
    }

    .player-card {
        width: 150px;      /* Carte plus large */
        height: 100%;
        margin: 0;
        flex-shrink: 0;
        /* Texte plus gros */
        font-size: 0.95rem; 
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .pc-name { font-size: 1.1em; margin-bottom: 4px; }
    .pc-money { font-size: 1.3em; color: #2ecc71; }
    .hand-container { display: none; } /* On cache les petites cartes */

    /* 3. LE PLATEAU (AU CENTRE) */
    .board-container {
        flex: 1;
        width: 100%;
        position: relative;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
        background: #121212;
        padding-bottom: 100px; /* Espace pour les gros boutons */
    }

    /* 4. BOUTONS D'ACTION (EN BAS) - Version XL Tactile */
    .action-buttons {
        position: absolute;
        bottom: 25px;
        left: 50%;
        transform: translateX(-50%);
        width: 95%;
        display: flex;
        justify-content: center;
        gap: 12px;
        z-index: 1000;
        flex-wrap: wrap;
    }

    .action-buttons button {
        flex: 1;
        min-width: 120px;
        padding: 18px 10px; /* Grosse zone de touche */
        font-size: 1.2rem;  /* Texte bien lisible */
        font-weight: bold;
        border-radius: 12px;
        box-shadow: 0 5px 20px rgba(0,0,0,0.6);
        text-transform: uppercase;
        letter-spacing: 1px;
    }
    
    /* Couleur spécifique pour bien distinguer */
    #btn-roll { background-color: #27ae60; font-size: 1.3rem; }
    #btn-buy { background-color: #e67e22; }
    #btn-end { background-color: #2980b9; }

    /* 5. MODALES (Infos cartes, échanges...) - Texte adapté */
    .modal-box, .trade-box, .asset-modal-box, .cell-info-box {
        width: 96vw !important;
        max-width: none;
        max-height: 85vh;
        bottom: 0;
        border-radius: 15px 15px 0 0; /* Arrondi haut seulement */
        font-size: 1.1rem; /* Texte global plus gros */
    }

    /* Carte de propriété (Popup) */
    .deed-modal-card {
        transform: scale(1); /* Pas de zoom arrière */
        width: 90vw;
        font-size: 1rem;
    }
    .dm-header { padding: 20px; font-size: 1.5rem; }
    .dm-rent-row { padding: 8px 0; font-size: 1.1rem; }
    .dm-actions button { padding: 15px; font-size: 1.1rem; }

    /* Modale d'échange */
    .trade-container { flex-direction: column; height: auto; max-height: 55vh; }
    .trade-area { min-height: 80px; padding: 10px; }
    .trade-item { padding: 12px; font-size: 1rem; } /* Items plus gros */
    
    /* Chat Flottant */
    .chat-float-modal {
        width: 92%;
        right: 4%;
        bottom: 100px;
        height: 50vh;
    }
    #chat-toggle-btn {
        width: 50px; height: 50px;
        bottom: 160px; /* Au dessus des boutons d'action */
        right: 15px;
        opacity: 0.8;
    }
}

/* --- TIMER GLOBAL (Compte à rebours partie) --- */
#global-game-timer {
    position: absolute;
    top: 70px; /* Juste en dessous du titre Polipoly */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 25, 35, 0.9);
    border: 2px solid #3498db; /* Bleu par défaut */
    padding: 8px 20px;
    border-radius: 30px;
    color: white;
    font-family: 'Oswald', sans-serif;
    font-size: 1.3em;
    font-weight: bold;
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    pointer-events: none; /* Permet de cliquer au travers si besoin */
}

/* Style dernière minute (Urgent) */
#global-game-timer.urgent {
    border-color: #e74c3c;
    color: #e74c3c;
    background: rgba(40, 10, 10, 0.9);
    animation: pulse-timer-global 1s infinite;
}

@keyframes pulse-timer-global {
    0% { transform: translateX(-50%) scale(1); box-shadow: 0 0 10px #e74c3c; }
    50% { transform: translateX(-50%) scale(1.05); box-shadow: 0 0 20px #e74c3c; }
    100% { transform: translateX(-50%) scale(1); box-shadow: 0 0 10px #e74c3c; }
}