* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%; width: 100%; overflow: hidden; 
    overscroll-behavior: none; background-color: #1a1a1a;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    transition: all 0.5s ease;
}

body::before {
    content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('batisseurs.png');
    background-size: cover; background-position: center; background-repeat: no-repeat;
    z-index: 0; 
}

.scroll-wrapper {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    z-index: 1; display: flex; flex-direction: column; padding: 20px;
}

.container {
    max-width: 650px; width: 100%; background: transparent;
    border-radius: 20px; overflow: visible; position: relative; margin: auto; 
}

.header {
    background: rgba(26, 26, 26, 0.95); color: white; padding: 20px;
    text-align: center; border-bottom: 2px solid #3a3a3a;
    border-radius: 20px 20px 0 0; border: 1px solid #3a3a3a;
    transition: all 0.5s ease;
}
.header h1 { font-size: 24px; margin-bottom: 3px; }
.header p { opacity: 0.7; font-size: 12px; }
.content {
    padding: 20px; background: rgba(42, 42, 42, 0.95);
    border: 1px solid #3a3a3a; border-top: none;
    border-radius: 0 0 20px 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transition: all 0.5s ease;
}
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 6px; font-weight: 600; color: #e0e0e0; font-size: 13px; }

select, input {
    width: 100%; padding: 10px 12px; border: 2px solid #3a3a3a;
    border-radius: 10px; font-size: 15px; transition: all 0.3s;
    background-color: #1a1a1a; color: #e0e0e0;
}
select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 15px center; background-size: 16px; padding-right: 40px;
}
select:focus, input:focus { outline: none; border-color: #4a4a4a; box-shadow: 0 0 0 3px rgba(74, 74, 74, 0.3); }
input[type="number"] { appearance: auto; }

.btn {
    width: 100%; padding: 12px;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    color: white; border: 2px solid #3a3a3a; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.3s;
}
.btn:hover {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border-color: #4a4a4a; transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

/* NOUVEAUX STYLES BOUTONS */
.btn-add {
    background: linear-gradient(135deg, #1b5e20 0%, #0d3d10 100%);
    border-color: #2e7d32;
}
.btn-remove {
    background: linear-gradient(135deg, #b71c1c 0%, #7f0000 100%);
    border-color: #c62828;
}
.btn-cancel {
    background: transparent;
    border: 1px solid #555;
    color: #aaa;
    margin-top: 5px;
}

.stats { display: none; margin-top: 20px; padding-top: 20px; border-top: 2px solid #3a3a3a; }
.stats.show { display: block; animation: fadeIn 0.5s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.stat-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    padding: 15px; border-radius: 15px; margin-bottom: 12px; border: 1px solid #3a3a3a;
    transition: all 0.5s ease;
}
.stat-card h3 { font-size: 11px; color: #888; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; color: #e0e0e0; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat-item { background: #2a2a2a; padding: 12px; border-radius: 10px; text-align: center; border: 1px solid #3a3a3a; transition: all 0.5s ease; }
.stat-item-label { font-size: 11px; color: #888; margin-bottom: 4px; }
.stat-item-value { font-size: 18px; font-weight: 700; color: #c0c0c0; }

.success-message {
    background: #2a2a2a; color: #4caf50; padding: 12px; border-radius: 10px;
    margin-bottom: 15px; display: none; animation: slideIn 0.3s ease-out;
    border: 1px solid #4caf50; font-size: 13px;
}
.success-message.show { display: block; }
@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.role-badge { display: inline-block; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; margin-top: 8px; }
.role-patron { background: #3a3a3a; color: #ffd700; border: 1px solid #ffd700; }
.role-co-patron { background: #3a3a3a; color: #ff8c42; border: 1px solid #ff8c42; }
.role-contremaître { background: #3a3a3a; color: #ff6b6b; border: 1px solid #ff6b6b; }
.role-bâtisseur { background: #3a3a3a; color: #8b5a3c; border: 1px solid #8b5a3c; }
.role-ex { background: #3a3a3a; color: #666; border: 1px solid #666; }

.rank-badge {
    display: inline-block; padding: 8px 12px; border-radius: 15px; font-size: 14px; font-weight: 700;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%); border: 2px solid #ffd700; color: #ffd700; text-align: center; white-space: nowrap;
}
.rank-badge.first {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%); color: #000; border-color: #ffd700;
    animation: glow 2s ease-in-out infinite; font-size: 15px; padding: 10px 14px;
}
@keyframes glow { 0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); } 50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); } }

.progress-container { margin-top: 12px; padding: 12px; background: #1a1a1a; border-radius: 10px; border: 1px solid #3a3a3a; }
.progress-labels { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 11px; color: #888; }
.progress-bar-bg { width: 100%; height: 20px; background: #2a2a2a; border-radius: 10px; overflow: hidden; position: relative; border: 1px solid #3a3a3a; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #ffd700 0%, #ffed4e 100%); transition: width 0.5s ease; position: relative; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
.progress-marker { position: absolute; top: 0; right: 0; width: 3px; height: 100%; background: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.8); }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.info-box { background: #1a1a1a; padding: 8px 12px; border-radius: 10px; text-align: center; border: 1px solid #3a3a3a; }
.info-label { font-size: 11px; color: #888; margin-bottom: 3px; }
.info-value { font-size: 14px; font-weight: 600; color: #e0e0e0; }
.info-value-highlight { color: #ffd700; }

/* --- THEME VIP / GOLD --- */
.vip-theme .stat-card {
    border-color: #d4af37; 
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.15); 
}
.vip-theme .stat-card h3 {
    color: #d4af37;
}
.vip-theme #addBtn {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    color: #d4af37;
    border: 1px solid #d4af37;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.1);
}
.vip-theme #addBtn:hover {
     background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
     box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
     transform: translateY(-2px);
}
#vipBadge {
    color: #d4af37 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.vip-theme .stat-value,
.vip-theme .stat-item-value {
    color: #e0e0e0;
    text-shadow: none;
}
.vip-theme .container .header,
.vip-theme .container .content,
.vip-theme .info-box,
.vip-theme .stat-item {
    border-color: #3a3a3a;
    box-shadow: none;
}

/* --- BOUTON ANNULER --- */
.undo-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}
.undo-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}
.undo-btn:active {
    transform: translateY(0);
}
.undo-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}