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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 500px;
}

/* Écrans */
.screen {
    display: none;
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* Titres */
h1 {
    font-size: 3rem;
    color: #1e3a8a;
    text-align: center;
    margin-bottom: 10px;
}

h2 {
    font-size: 1.8rem;
    color: #1e3a8a;
    text-align: center;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.3rem;
    color: #333;
    text-align: center;
    line-height: 1.5;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

input[type="text"], select {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: border-color 0.3s;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Boutons */
.btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    color: white;
}

.btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.4);
}

.btn.primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn.secondary {
    background: #f0f0f0;
    color: #333;
}

.btn.secondary:hover {
    background: #e0e0e0;
}

/* Thèmes */
.themes-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

/* Catégories */
.category {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: #f8fafc;
    cursor: pointer;
    transition: background 0.3s;
}

.category-header:hover {
    background: #f0f7ff;
}

.category-header h4 {
    flex: 1;
    margin: 0;
    font-size: 1.1rem;
}

.category-icon {
    font-size: 1.5rem;
}

.category-toggle {
    transition: transform 0.3s;
    color: #666;
}

.category.expanded .category-toggle {
    transform: rotate(180deg);
}

.category-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid #ccc;
    border-radius: 6px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.category-checkbox:hover {
    border-color: #3b82f6;
}

.category-checkbox.checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.category-checkbox.checked::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.category-checkbox.partial {
    background: #3b82f6;
    border-color: #3b82f6;
}

.category-checkbox.partial::after {
    content: '';
    width: 10px;
    height: 3px;
    background: white;
    border-radius: 1px;
}

.category-themes {
    display: none;
    padding: 10px;
    background: white;
}

.category.expanded .category-themes {
    display: grid;
    gap: 10px;
}

.theme-card {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-card:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
}

.theme-card.selected {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
}

.theme-card .checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 5px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.theme-card.selected .checkbox {
    background: white;
    border-color: white;
}

.theme-card .checkbox::after {
    content: '';
    display: none;
    width: 5px;
    height: 10px;
    border: solid #3b82f6;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.theme-card.selected .checkbox::after {
    display: block;
}

.theme-card h4 {
    margin: 0;
    font-size: 1rem;
    flex: 1;
}

.theme-card span {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Quiz */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.progress {
    font-size: 1.1rem;
    color: #666;
}

.timer {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: bold;
}

.timer.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.timer.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse 0.5s infinite;
}

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

.score {
    font-size: 1.1rem;
    color: #666;
}

.question-container {
    margin-bottom: 20px;
}

.question-container h3 {
    margin-bottom: 25px;
}

.answer-container {
    display: flex;
    gap: 10px;
}

.answer-container input {
    flex: 1;
}

.answer-container .btn {
    width: auto;
    margin-top: 0;
    padding: 15px 25px;
}

/* Feedback */
.feedback {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    display: none;
}

.feedback.correct {
    display: block;
    background: #d1fae5;
    color: #065f46;
}

.feedback.incorrect {
    display: block;
    background: #fee2e2;
    color: #991b1b;
}

/* Résultats */
.result-box {
    text-align: center;
    padding: 30px;
    background: #f8fafc;
    border-radius: 15px;
    margin-bottom: 25px;
}

.final-score {
    font-size: 3rem;
    font-weight: bold;
    color: #1e3a8a;
    margin-bottom: 10px;
}

#result-message {
    color: #666;
    font-size: 1.1rem;
}

.recap {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.recap-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.recap-item.correct {
    background: #f0fdf4;
}

.recap-item.incorrect {
    background: #fef2f2;
}

.recap-item .icon {
    margin-right: 10px;
    font-size: 1.2rem;
}

.recap-item .question {
    flex: 1;
    color: #555;
}

.recap-item .answer {
    font-weight: 600;
    color: #333;
}

.result-buttons {
    display: grid;
    gap: 10px;
}

/* Carte des départements */
#map-container {
    width: 100%;
    max-width: 450px;
    margin: 20px auto;
    background: #f8fafc;
    border-radius: 15px;
    padding: 10px;
}

#map-container svg {
    width: 100%;
    height: auto;
}

.map-question-container {
    text-align: center;
}

.map-question-container h3 {
    margin-bottom: 10px;
}

/* Styles des départements dans le SVG */
#map-container .departement {
    fill: #e0e7ff;
    stroke: #1e3a8a;
    stroke-width: 0.5;
    cursor: pointer;
    transition: fill 0.2s ease;
}

#map-container .departement:hover {
    fill: #a5b4fc;
}

#map-container .departement.correct {
    fill: #22c55e !important;
    stroke: #16a34a;
    stroke-width: 2;
}

#map-container .departement.incorrect {
    fill: #ef4444 !important;
    stroke: #dc2626;
    stroke-width: 2;
}

#map-container .departement.highlight {
    fill: #fbbf24 !important;
}

/* ============================================
   STYLES MULTIJOUEUR
   ============================================ */

/* Écran choix de mode */
.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-card:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
    transform: translateY(-2px);
}

.mode-icon {
    font-size: 2rem;
    font-weight: bold;
    color: #3b82f6;
    margin-bottom: 10px;
}

.mode-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 5px;
}

.mode-desc {
    font-size: 0.9rem;
    color: #666;
}

/* Menu multijoueur */
.multi-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.multi-option {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-radius: 15px;
}

.multi-option h3 {
    margin-bottom: 10px;
    color: #1e3a8a;
}

.multi-option p {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.multi-divider {
    text-align: center;
    color: #999;
    font-weight: 600;
    position: relative;
}

.multi-divider::before,
.multi-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #ddd;
}

.multi-divider::before {
    left: 0;
}

.multi-divider::after {
    right: 0;
}

.room-code-input input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    font-weight: bold;
}

/* Lobby */
.room-code-display {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 15px;
}

.room-code-display span {
    display: block;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.code-box {
    font-size: 2.5rem;
    font-weight: bold;
    color: #1e3a8a;
    letter-spacing: 8px;
    margin-bottom: 10px;
}

.btn-icon {
    padding: 8px 20px;
    font-size: 0.9rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-icon:hover {
    background: #1e3a8a;
}

.lobby-settings,
.lobby-settings-readonly {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
}

.lobby-settings h3,
.lobby-settings-readonly h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #1e3a8a;
}

.lobby-settings-readonly p {
    margin: 8px 0;
    color: #555;
}

.themes-grid.compact {
    gap: 8px;
    margin-bottom: 15px;
}

.themes-grid.compact .theme-card {
    padding: 10px 12px;
}

.themes-grid.compact .theme-card h4 {
    font-size: 0.9rem;
}

.players-list-container {
    margin-bottom: 20px;
}

.players-list-container h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    text-align: left;
}

.players-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.player-item.host {
    background: #f0f7ff;
    border: 2px solid #3b82f6;
}

.player-name {
    font-weight: 500;
}

.host-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    background: #3b82f6;
    color: white;
    border-radius: 10px;
}

.lobby-actions {
    display: grid;
    gap: 10px;
}

/* Quiz multijoueur */
.rank {
    color: #3b82f6;
    font-weight: bold;
}

.answered-indicator {
    text-align: center;
    padding: 10px;
    background: #f0f7ff;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #3b82f6;
    font-weight: 500;
}

.live-rankings {
    margin-top: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
}

.live-rankings h4 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    text-align: center;
}

.live-rankings ol {
    list-style: none;
    padding: 0;
}

.live-rankings li {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 5px;
    margin-bottom: 5px;
    background: white;
}

.live-rankings li:first-child {
    background: #fef3c7;
    font-weight: bold;
}

.live-rankings li.current-player {
    border: 2px solid #3b82f6;
}

.live-rankings .player-rank {
    width: 25px;
    color: #666;
}

.live-rankings .player-name {
    flex: 1;
}

.live-rankings .player-score {
    font-weight: 600;
    color: #1e3a8a;
}

/* Résultats multijoueur */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 25px;
    padding: 20px 0;
}

.podium-place {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    min-width: 90px;
}

.podium-place.first {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    transform: scale(1.1);
    order: 2;
}

.podium-place.second {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
    order: 1;
}

.podium-place.third {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: white;
    order: 3;
}

.podium-rank {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.podium-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.podium-score {
    font-size: 1.1rem;
    font-weight: bold;
}

.full-rankings {
    margin-bottom: 20px;
}

.full-rankings h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    text-align: left;
}

.full-rankings ol {
    list-style: none;
    padding: 0;
}

.full-rankings li {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.full-rankings li:nth-child(1) {
    background: #fef3c7;
}

.full-rankings li:nth-child(2) {
    background: #f3f4f6;
}

.full-rankings li:nth-child(3) {
    background: #fed7aa;
}

/* Section détail des réponses (hôte) */
.host-details {
    margin-top: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
}

.host-details h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    text-align: left;
}

.player-filter {
    margin-bottom: 15px;
}

.player-filter label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #666;
}

.player-filter select {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.answers-table-container {
    max-height: 250px;
    overflow-y: auto;
}

.answers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.answers-table th,
.answers-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.answers-table th {
    background: #e0e7ff;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.answers-table tr.correct {
    background: #d1fae5;
}

.answers-table tr.incorrect {
    background: #fee2e2;
}

/* Countdown */
.countdown-number {
    font-size: 8rem;
    font-weight: bold;
    color: #1e3a8a;
    text-align: center;
    animation: countdown-pulse 1s infinite;
}

@keyframes countdown-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Responsive */
@media (max-width: 480px) {
    .screen {
        padding: 30px 20px;
    }

    h1 {
        font-size: 2.5rem;
    }

    .answer-container {
        flex-direction: column;
    }

    .answer-container .btn {
        width: 100%;
    }

    .podium {
        gap: 5px;
    }

    .podium-place {
        min-width: 70px;
        padding: 10px;
    }

    .code-box {
        font-size: 2rem;
        letter-spacing: 5px;
    }

    .answers-table {
        font-size: 0.75rem;
    }

    .answers-table th,
    .answers-table td {
        padding: 5px;
    }
}
