:root {
    --bg-color: #F7F8FC; --card-bg-color: #FFFFFF; --border-color: #E2E8F0;
    --text-primary-color: #2D3748; --text-secondary-color: #718096;
    --grad-xp: linear-gradient(90deg, #fbbf24, #f97316); --grad-force: linear-gradient(90deg, #fb7185, #f43f5e);
    --grad-clarte: linear-gradient(90deg, #7dd3fc, #38bdf8); --grad-progres: linear-gradient(90deg, #86efac, #4ade80);
    --grad-main-action: linear-gradient(90deg, #a78bfa, #8b5cf6);
    --font-family: 'Poppins', sans-serif; --font-mono: 'Roboto Mono', monospace;
    --card-radius: 16px; --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--bg-color); color: var(--text-primary-color); font-family: var(--font-family); padding: 15px; }
.container { max-width: 500px; margin: auto; display: flex; flex-direction: column; gap: 25px; }
.hidden { display: none !important; }

/* --- LOADER --- */
.app-loader { display: flex; justify-content: center; align-items: center; height: 80vh; }
.spinner { width: 50px; height: 50px; border: 5px solid var(--border-color); border-top-color: #8b5cf6; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- CARTES PRINCIPALES --- */
.main-progress-card, .stat-card { background-color: var(--card-bg-color); border-radius: var(--card-radius); padding: 15px; box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
h2 { font-size: 1em; font-weight: 600; color: var(--text-primary-color); }
.user-controls { display: flex; align-items: center; gap: 10px; }
#logout-btn { background: none; border: 1px solid var(--border-color); color: var(--text-secondary-color); font-size: 0.8em; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.level-badge { font-family: var(--font-mono); font-size: 0.9em; color: var(--text-secondary-color); }
.level-badge span { color: var(--text-primary-color); font-weight: 700; }
.stat-value { font-family: var(--font-mono); font-size: 1.8em; font-weight: 700; transition: transform 0.3s ease, color 0.3s ease; }
.card-footer { display: flex; justify-content: space-between; font-size: 0.8em; color: var(--text-secondary-color); margin-top: 8px; }
.stat-value.stat-up { transform: scale(1.2); color: #8b5cf6; }
.progress-bar-wrapper { height: 10px; background-color: #EDF2F7; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; width: 0%; transition: width 0.5s ease; }
#xp-bar { background: var(--grad-xp); } #physique-bar { background: var(--grad-force); } #mental-bar { background: var(--grad-clarte); } #projets-bar { background: var(--grad-progres); }
.attributes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.attributes-grid .stat-card { padding: 12px; } .attributes-grid h2 { font-size: 0.9em; }

/* --- SECTIONS (Missions & Objectifs) --- */
main section h3 { font-size: 1.2em; margin-bottom: 15px; }
.tabs-header { display: flex; justify-content: space-between; align-items: center; }
.header-button { background: var(--grad-main-action); border: none; color: white; width: 36px; height: 36px; border-radius: 12px; font-size: 1.8em; cursor: pointer; box-shadow: var(--shadow); }
.mission-tabs { display: flex; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.tab-btn { flex-grow: 1; background: none; border: none; color: var(--text-secondary-color); padding: 10px; cursor: pointer; font-family: var(--font-family); font-weight: 600; font-size: 0.9em; transition: all 0.2s; border-bottom: 3px solid transparent; }
.tab-btn.active { color: #8b5cf6; border-bottom-color: #8b5cf6; }
.mission-panels .mission-panel { display: none; flex-direction: column; gap: 10px; }
.mission-panels .mission-panel.active { display: flex; }
.quest-button { background-color: var(--bg-color); border: 1px solid var(--border-color); padding: 15px; color: var(--text-primary-color); text-align: left; cursor: pointer; border-radius: 12px; transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.quest-button:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.quest-rewards { font-size: 0.8em; color: var(--text-secondary-color); margin-top: 5px; }
#milestones-container { display: flex; flex-direction: column; gap: 5px; }
.accordion { background-color: var(--card-bg-color); border: 1px solid var(--border-color); box-shadow: var(--shadow); padding: 12px 15px; color: var(--text-primary-color); cursor: pointer; border-radius: 12px; font-weight: 600; }
.panel { padding: 0 15px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.milestone { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-color); font-size: 0.9em; }
.milestone:last-child { border-bottom: none; }
.milestone input[type="checkbox"] { margin-right: 12px; transform: scale(1.2); accent-color: #8b5cf6; }
.milestone label.achieved { text-decoration: line-through; opacity: 0.6; }

/* --- MODALES --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(247, 248, 252, 0.7); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: var(--card-bg-color); border-radius: var(--card-radius); padding: 25px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); width: 90%; max-width: 400px; }
.modal-content h3 { text-align: center; margin-bottom: 20px; color: var(--text-primary-color); }
.modal-content input { width: 100%; background: var(--bg-color); border: 1px solid var(--border-color); color: var(--text-primary-color); padding: 12px; margin-bottom: 15px; font-family: var(--font-family); border-radius: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.cta-button { width: 100%; padding: 12px; background: var(--grad-main-action); border: none; color: white; font-weight: 700; font-size: 1.1em; border-radius: 10px; cursor: pointer; }
.auth-buttons { display: flex; gap: 10px; margin-top: 15px; }
.auth-buttons .cta-button.secondary { background: none; color: var(--text-primary-color); border: 1px solid var(--border-color); }
.auth-error { color: #f43f5e; text-align: center; margin-top: 10px; font-size: 0.9em; min-height: 1.2em; }
footer { text-align: center; margin-top: 30px; }
#reset-button { background: none; border: none; color: var(--text-secondary-color); cursor: pointer; text-decoration: underline; font-size: 0.9em; }