:root {
    --bg-lobby: #111827;
    --bg-night: #0f172a;
    --bg-day: #b45309; /* Couché de soleil sombre */
    --accent: #ef4444;
    --gold: #f59e0b;
    --glass: rgba(30, 41, 59, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --text: #f3f4f6;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', sans-serif; color: var(--text); height: 100vh; overflow: hidden; }

/* ANIMATED BG */
#ambient-bg { position: fixed; inset: 0; z-index: -1; transition: background 2s ease-in-out; background: var(--bg-lobby); }
.bg-night { background: linear-gradient(to bottom, #020617, #1e1b4b); }
.bg-day { background: linear-gradient(to bottom, #7c2d12, #ea580c); }

.container { display: flex; flex-direction: column; height: 100%; max-width: 600px; margin: 0 auto; padding: 10px; }
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.5s ease; }

.game-title { font-family: 'Cinzel', serif; font-size: 2.5rem; text-align: center; margin-bottom: 20px; text-shadow: 0 0 20px var(--accent); }

/* LOBBY */
.glass-panel { background: var(--glass); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: 16px; padding: 25px; text-align: center; }
.input-group input { width: 100%; padding: 15px; margin: 5px 0; border-radius: 8px; border: 1px solid var(--border); background: rgba(0,0,0,0.5); color: white; font-size: 1rem; }
.btn-primary { width: 100%; padding: 15px; background: var(--accent); color: white; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; margin-top: 10px; transition: 0.2s; }
.btn-primary:active { transform: scale(0.98); }
.btn-start { background: var(--gold); color: black; margin-top: 20px; padding: 15px; width: 100%; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }
.badge { display: inline-block; padding: 5px 10px; background: rgba(255,255,255,0.1); border-radius: 20px; margin: 3px; font-size: 0.9rem; }

/* JEU */
.game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.info-badge { background: rgba(0,0,0,0.5); padding: 5px 15px; border-radius: 20px; font-weight: bold; font-family: 'Cinzel', serif; }

.role-card-container { width: 50px; height: 70px; perspective: 1000px; cursor: pointer; }
.role-card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.6s; }
.role-card-container.flipped .role-card { transform: rotateY(180deg); }
.card-front, .card-back { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 6px; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 1px solid var(--gold); background: #111827; }
.card-back { transform: rotateY(180deg); background: #374151; font-size: 0.7rem; }
.role-img { font-size: 1.5rem; }

/* PLATEAU AVATARS */
.board-area { flex: 1; overflow-y: auto; position: relative; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; padding-bottom: 60px; }
.player-card { 
    background: rgba(0,0,0,0.3); border-radius: 12px; padding: 10px; text-align: center; 
    border: 2px solid transparent; transition: 0.2s; position: relative; 
}
.player-card.alive:hover { border-color: var(--gold); background: rgba(255,255,255,0.05); cursor: pointer; }
.player-card.dead { filter: grayscale(100%); opacity: 0.5; }
.player-card.mayor::after { content: "🎖️"; position: absolute; top: -5px; right: -5px; font-size: 1.2rem; }
.avatar-img { width: 60px; height: 60px; border-radius: 50%; background: #374151; }
.p-name { font-size: 0.85rem; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* TOAST */
.toast { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--gold); color: black; padding: 8px 20px; border-radius: 20px; font-weight: bold; animation: popDown 0.5s; z-index: 50; }

/* CHAT */
.chat-container { height: 35%; background: rgba(0,0,0,0.8); border-radius: 16px 16px 0 0; display: flex; flex-direction: column; }
#chat-messages { flex: 1; overflow-y: auto; padding: 15px; font-size: 0.9rem; }
.msg { margin-bottom: 6px; }
.msg.wolf { color: #f87171; font-style: italic; border-left: 2px solid #f87171; padding-left: 5px; }
.msg.system { color: var(--gold); text-align: center; margin: 10px 0; font-style: italic; }
.msg.love { color: #f472b6; font-weight: bold; }

.chat-input { display: flex; padding: 10px; border-top: 1px solid rgba(255,255,255,0.1); }
.chat-input input { flex: 1; background: transparent; border: none; color: white; outline: none; }
.chat-input button { background: var(--text); color: black; border: none; width: 40px; height: 40px; border-radius: 50%; font-weight: bold; cursor: pointer; }

/* ACTIONS PANEL */
.glass-panel-bottom { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.9); padding: 15px; border-radius: 12px; border: 1px solid var(--accent); z-index: 60; text-align: center; min-width: 300px; }
.action-btn { padding: 8px 15px; margin: 5px; border-radius: 5px; border: none; font-weight: bold; cursor: pointer; }

/* MODAL */
.modal-content { background: #111827; padding: 40px; border: 2px solid var(--gold); border-radius: 20px; text-align: center; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes popDown { from{transform:translate(-50%, -20px); opacity:0} to{transform:translate(-50%, 0); opacity:1} }