@import url("https://fonts.googleapis.com/css2?family=Creepster&family=MedievalSharp&family=Cinzel:wght@500;700&display=swap");

:root {
    --bg: #1a0e1f;
    --bg-alt: #251532;
    --card: #2e1a3f;
    --card-alt: #3a2451;
    --border: #4a2f66;
    --text: #f0e8f5;
    --muted: #9a8aa8;
    --accent: #d97a4f;
    --accent-light: #ffaa80;
    --danger: #e54f4f;
    --success: #5fc88c;
    --loups: #c43d3d;
    --village: #4a90d9;
    --solo: #d6b34a;
    --ambigus: #9a5fd4;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
}

body {
    background: linear-gradient(160deg, var(--bg) 0%, #0e0815 100%);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.brand {
    color: var(--accent-light);
    font-weight: 400;
    font-size: 1.6rem;
    font-family: "Creepster", cursive;
    letter-spacing: 0.05em;
    text-decoration: none;
    text-shadow: 0 2px 8px rgba(217, 122, 79, 0.4);
}

h1, h2, h3, h4 {
    font-family: "MedievalSharp", "Cinzel", serif;
    letter-spacing: 0.02em;
}

.hero h1 {
    font-family: "Creepster", cursive;
    font-weight: 400;
    letter-spacing: 0.04em;
}

.script-text {
    font-family: "MedievalSharp", "Cinzel", serif;
}

.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
}
.topbar nav a:hover { color: var(--text); }

.mobile-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 4px 8px;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
}
.mobile-toggle:hover { color: var(--accent-light); border-color: var(--accent); background: transparent; }
.mobile-toggle.active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(217, 122, 79, 0.12);
}

/* Mode "rendu mobile sur PC" : cadre 420px centré avec ombre */
@media (min-width: 600px) {
    body.mobile-frame {
        background: #0a0612;
    }
    body.mobile-frame .topbar {
        max-width: 420px;
        margin: 0 auto;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
    body.mobile-frame main {
        max-width: 420px;
        margin: 0 auto;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        background: linear-gradient(160deg, var(--bg) 0%, #0e0815 100%);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
        min-height: 100vh;
    }
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 18px;
    padding-bottom: 80px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card h1, .card h2, .card h3 { margin-top: 0; }

.hero h1 {
    font-size: 1.8rem;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lead { color: var(--muted); font-size: 1rem; }

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.9rem; min-height: 1.2em; }
.success { color: var(--success); }

label {
    display: block;
    margin: 12px 0;
    font-size: 0.9rem;
    color: var(--muted);
}

input, select, textarea {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

button {
    display: inline-block;
    padding: 12px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}
button:hover { background: var(--accent-light); color: var(--bg); }
button:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }

button.secondary { background: var(--card-alt); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover { background: var(--border); }
button.danger { background: var(--danger); }
button.success { background: var(--success); color: #0a2515; }
button.small { padding: 6px 10px; font-size: 0.85rem; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

.code-display {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 2.2rem;
    letter-spacing: 0.3em;
    text-align: center;
    color: var(--accent-light);
    padding: 16px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
}

/* --- Liste joueurs --- */
.player-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.player-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-alt);
    margin-bottom: 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.player-list .pseudo { font-weight: 600; }
.player-list .dead { opacity: 0.45; text-decoration: line-through; }
.player-list .meta { font-size: 0.85rem; color: var(--muted); }

/* --- Carte rôle (joueur) --- */
.role-reveal {
    text-align: center;
    padding: 24px 16px;
    background: linear-gradient(160deg, var(--card-alt), var(--card));
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
}
.role-reveal.hidden .icon { font-size: 5rem; }
.role-reveal.hidden .reveal-prompt { color: var(--muted); margin-top: 12px; }
.role-reveal.shown .icon { font-size: 5rem; margin-bottom: 8px; }
.role-reveal .card-image {
    width: 100%;
    max-width: 280px;
    margin: 0 auto 12px;
    display: block;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.role-reveal h2 { font-size: 1.6rem; margin: 8px 0; color: var(--accent-light); }
.role-reveal .team-badge { display: inline-block; }
.role-reveal p { color: var(--text); margin-top: 12px; }

.team-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.team-loups, .team-loups .team-badge { background: var(--loups); color: #fff; }
.team-village, .team-village .team-badge { background: var(--village); color: #fff; }
.team-solo, .team-solo .team-badge { background: var(--solo); color: #2a1f00; }
.team-ambigus, .team-ambigus .team-badge { background: var(--ambigus); color: #fff; }
.team-amoureux, .team-amoureux .team-badge {
    background: linear-gradient(135deg, #e85a8b, #d97a4f);
    color: #fff;
    font-weight: 700;
}

/* --- Sessions en cours sur la home (reprise après kill de l'app) --- */
#ongoing-sessions .player-list li {
    flex-direction: row;
    gap: 8px;
}
#ongoing-sessions .player-list li > div:first-child { flex: 1; min-width: 0; }
#ongoing-sessions .player-list li > div:last-child { display: flex; gap: 4px; flex-shrink: 0; }
#ongoing-sessions .meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* Sur les role-card du panneau Règles, le team-badge est intégré */
.role-card .team-badge {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

/* --- Grille des rôles (page Règles + sélection conteur) --- */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.role-card {
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    border-left: 5px solid var(--border);
}
.role-card.team-loups { border-left-color: var(--loups); }
.role-card.team-village { border-left-color: var(--village); }
.role-card.team-solo { border-left-color: var(--solo); }
.role-card.team-ambigus { border-left-color: var(--ambigus); }

.role-card .role-img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    object-position: center;
    background: var(--bg-alt);
    border-radius: 6px;
    margin-bottom: 8px;
}

.role-card .mandatory {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-light);
    background: rgba(217, 122, 79, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.role-card header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.role-card .icon { font-size: 1.6rem; }
.role-card h3 { font-size: 1rem; margin: 0; flex: 1; }
.role-card p { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; }

/* --- Sélecteur de rôles (conteur) --- */
.role-selector .role-card {
    display: flex;
    flex-direction: column;
    cursor: default;
}
.role-selector .qty {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.role-selector .qty button {
    width: 32px;
    padding: 4px 0;
    font-size: 1rem;
    line-height: 1;
}
.role-selector .qty input {
    width: 50px;
    text-align: center;
    margin: 0;
    padding: 6px;
}

.expansion-section { margin-bottom: 16px; }
.expansion-section h3 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-light);
    margin: 8px 0 10px;
}

/* --- Tableau de bord conteur --- */
.host-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.host-summary .stat {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}
.host-summary .stat .num { font-size: 1.6rem; font-weight: 700; color: var(--accent-light); }
.host-summary .stat .lbl { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }

.phase-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.phase-bar button { flex: 1; min-width: 90px; }
.phase-bar button.active { background: var(--accent-light); color: var(--bg); }

.host-player-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 10px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
}
.host-player-row.dead { opacity: 0.5; }
.host-player-row .role-tag {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--card);
    border: 1px solid var(--border);
}
.host-player-row .actions { display: flex; gap: 4px; }
.host-player-row .actions button { padding: 4px 8px; font-size: 0.8rem; }
.host-player-row .pseudo { font-weight: 600; }
.host-player-row .badges { font-size: 0.85rem; color: var(--muted); }

.night-order {
    list-style: none;
    counter-reset: step;
    padding: 0;
}
.night-order li {
    background: var(--bg-alt);
    margin-bottom: 6px;
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    font-size: 0.9rem;
}

/* --- Toggles qty (rôles uniques ou à qté fixe) --- */
.qty-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 8px;
    background: var(--bg-alt);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.qty-toggle input[type=checkbox] {
    width: auto; margin: 0;
}
.role-card.selected {
    box-shadow: 0 0 0 2px var(--accent);
}

/* --- Toggle Capitaine en préparation --- */
.captain-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    margin: 12px 0;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}
.captain-toggle input[type=checkbox] { width: auto; margin: 4px 0 0; }
.captain-toggle small { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

/* --- Panneau Capitaine en jeu --- */
.captain-panel {
    border-left: 4px solid #d6b34a;
    background: linear-gradient(160deg, var(--card), #2a1d1a);
}

/* --- Choix de mode (accueil) + niveau (préparation) --- */
.mode-choice, .level-choice {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 12px 0;
    background: var(--bg-alt);
}
.mode-choice legend, .level-choice legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 0.85rem;
}
.mode-option, .level-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    margin: 0;
    cursor: pointer;
}
.mode-option:last-child, .level-option:last-child { border-bottom: none; }
.mode-option input[type=radio], .level-option input[type=radio] {
    width: auto;
    margin: 4px 0 0;
}
.mode-label, .level-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mode-label small, .level-text small {
    color: var(--muted);
    font-size: 0.85rem;
}

.prep-form input[type=number] { max-width: 160px; }

/* --- Presets --- */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}
.preset-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
}
.preset-card h3 { margin: 0 0 4px; color: var(--accent-light); font-size: 1rem; }
.preset-roles {
    list-style: none;
    padding: 0;
    margin: 6px 0;
    font-size: 0.85rem;
    color: var(--text);
}
.preset-roles li { padding: 1px 0; }
.preset-card .small { font-size: 0.8rem; }
.preset-card button { margin-top: auto; }

/* --- Discours guidé (mode conteur) --- */
.script-panel { background: linear-gradient(160deg, var(--card), #1a0d2a); }
.script-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 0.85rem;
}
.script-progress .progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-alt);
    border-radius: 3px;
    overflow: hidden;
}
.script-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    transition: width 0.2s;
}
.script-step {
    text-align: center;
    padding: 24px 16px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}
.script-icon { font-size: 3rem; margin-bottom: 8px; }
.script-text {
    font-size: 1.15rem;
    line-height: 1.5;
    color: var(--text);
    margin: 0;
}
.script-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.script-controls button { flex: 1; }

/* --- Cartes cliquables + Modal fiche --- */
.role-card.clickable { cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.role-card.clickable:hover { transform: translateY(-2px); border-color: var(--accent); }
.role-card .small { margin-top: 8px; align-self: flex-start; }

body.modal-open { overflow: hidden; }

.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
.modal-panel {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.modal-close {
    position: absolute; top: 8px; right: 10px;
    background: transparent; color: var(--muted);
    border: none; font-size: 1.6rem; cursor: pointer;
    padding: 4px 10px; line-height: 1;
}
.modal-close:hover { color: var(--text); background: transparent; }

.sheet-header {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.sheet-header h2 { margin: 8px 0 4px; color: var(--accent-light); }
.sheet-img {
    max-width: 200px;
    width: 100%;
    margin: 0 auto 8px;
    display: block;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.sheet-section { margin-bottom: 14px; }
.sheet-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin: 0 0 6px;
}
.sheet-section p {
    margin: 0;
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.55;
}

/* --- Pré-nuit : panneau d'assignation des rôles clés (mode local 1ʳᵉ nuit) --- */
.pre-night-panel {
    margin-top: 12px;
    padding: 12px;
    background: rgba(154, 95, 212, 0.08);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.pre-night-row {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 0.95rem;
}
.pre-night-row.done {
    border-left-color: var(--success);
    color: var(--muted);
}
.pre-night-wolves {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--loups);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}
.pre-night-wolves h4 { margin: 0 0 6px; color: var(--accent-light); }
.pre-night-wolves .done { color: var(--success); }
.pre-night-wolf-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}
.pre-night-wolf-row select { flex: 1; margin: 0; }

/* --- Bouton permanent "Assigner un rôle" pendant la nuit --- */
.assign-anytime {
    margin: 8px 0 12px;
    text-align: right;
}

/* --- Liste des cartes dans la modal de confirmation lobby --- */
.cards-confirm-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}
.cards-confirm-list li {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 10px 14px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 1rem;
}

/* --- Bannière de victoire détectée en cours de partie --- */
.winner-banner {
    background: linear-gradient(135deg, rgba(95, 200, 140, 0.18), rgba(217, 122, 79, 0.20));
    border: 2px solid var(--success);
    text-align: center;
}
.winner-banner h2 { color: var(--success); }

/* --- Bloc d'élimination par vote du village --- */
.vote-block {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--danger);
    border-radius: 10px;
}
.vote-block p { margin: 0 0 10px; }
.vote-block select { flex: 1; margin: 0; }

/* --- Bannière Capitaine/Maire (élection initiale ou successeur) --- */
.captain-election-banner {
    margin-top: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(217, 122, 79, 0.12), rgba(154, 95, 212, 0.10));
    border: 1px solid var(--accent);
    border-radius: 10px;
}
.captain-election-banner p { margin: 0 0 10px; }

/* --- Bilan des morts au lever du jour --- */
.night-deaths {
    color: var(--accent-light);
    font-weight: 600;
    margin-bottom: 4px;
}
.night-deaths.none { color: var(--success); }
.night-deaths-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 12px;
}
.night-deaths-list li {
    background: var(--bg-alt);
    border-left: 3px solid var(--danger);
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    font-size: 0.95rem;
}
.night-deaths-list li strong { color: var(--accent-light); }

/* --- Mini-formulaire d'attribution inline (mode local 1ʳᵉ nuit) --- */
.inline-attribution {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.inline-attribution p { margin: 0 0 8px; font-size: 0.95rem; }
.inline-attribution select { margin-bottom: 0; }

/* --- Bloc Voyante + Gitane (purement UI) --- */
.voyante-block, .gitane-block {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.voyante-block { border-left: 3px solid #c184d1; }
.gitane-block { border-left: 3px solid var(--solo); }
.voyante-reveal {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    min-height: 1.4em;
}
.voyante-reveal.done {
    background: rgba(193, 132, 209, 0.18);
    color: var(--text);
}
.gitane-reply {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    min-height: 1.4em;
}
.gitane-reply.yes { background: rgba(95, 200, 140, 0.15); color: var(--success); }
.gitane-reply.no { background: rgba(196, 61, 61, 0.18); color: #ffb3b3; }
.gitane-reply.mystery { background: rgba(154, 138, 168, 0.18); color: var(--muted); }

/* --- Bloc Renard + Corbeau --- */
.renard-block, .corbeau-block {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.renard-block { border-left: 3px solid var(--accent); }
.corbeau-block { border-left: 3px solid #6c4978; }
.renard-verdict {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
}
.renard-verdict.wolf { background: rgba(196, 61, 61, 0.18); color: #ffb3b3; }
.renard-verdict.safe { background: rgba(95, 200, 140, 0.15); color: var(--success); }
.corbeau-status { color: var(--accent-light); margin: 0 0 8px; }
.corbeau-vote-warning {
    background: rgba(108, 73, 120, 0.25);
    border-left: 3px solid var(--accent);
    padding: 10px 12px;
    border-radius: 6px;
    margin: 10px 0;
}

/* --- Bloc Salvateur + Loups (désignation guidée) --- */
.salvateur-block, .wolves-block {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.salvateur-block { border-left: 3px solid #5fa6e8; }
.wolves-block { border-left: 3px solid var(--loups); }
.salvateur-status { color: var(--success); margin: 0 0 8px; }
.salvateur-block select, .wolves-block select { flex: 1; margin: 0; }

/* --- Bloc actions Comédien (3 cartes pouvoir) --- */
.comedian-actions {
    margin-top: 12px;
    padding: 12px;
    background: rgba(217, 122, 79, 0.08);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.comedian-status {
    margin: 0 0 12px;
    font-size: 0.95rem;
}
.comedian-actions select { margin-bottom: 8px; }

/* --- Bloc actions Sorcière (potions vie/mort) --- */
.witch-actions {
    margin-top: 12px;
    padding: 12px;
    background: rgba(154, 95, 212, 0.10);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.witch-status {
    margin: 0 0 12px;
    font-size: 0.95rem;
}
.witch-status .potion { color: var(--accent-light); font-weight: 600; }
.witch-status .potion.gone { color: var(--muted); text-decoration: line-through; }
.witch-q {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.witch-q p { margin: 0 0 8px; font-size: 0.95rem; }
.witch-q .row.answered-no button { opacity: 0.5; pointer-events: none; }

/* --- Pool personnalisable pour la pioche aléatoire du Voleur --- */
.voleur-pool {
    margin: 12px 0;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.voleur-pool summary {
    cursor: pointer;
    color: var(--accent-light);
    font-size: 0.95rem;
    padding: 4px 0;
}
.voleur-pool[open] summary { margin-bottom: 8px; }
.voleur-pool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 4px 12px;
    margin: 6px 0 10px;
}
.voleur-pool-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 0;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}
.voleur-pool-item input { width: auto; margin: 0; }

/* --- Bouton + Modal de swap du Voleur (1ʳᵉ nuit) --- */
.voleur-swap-btn {
    margin-top: 10px;
    width: 100%;
    background: var(--ambigus);
    color: #fff;
}
.voleur-swap-btn:hover { background: var(--accent-light); color: var(--bg); }

.voleur-swap-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.voleur-swap-choices button {
    padding: 14px;
    text-align: left;
    font-size: 1rem;
}

/* --- Sélecteur de rôle par joueur (mode local, 1ʳᵉ nuit) --- */
.offline-role-select select {
    margin-top: 4px;
    padding: 6px 8px;
    font-size: 0.85rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    width: 100%;
}
.offline-role-select select:focus {
    outline: 2px solid var(--accent);
    border-color: var(--accent);
}

/* --- Aperçu plein écran d'une carte (page /cartes) --- */
.card-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #0e0815 0%, var(--bg) 100%);
    z-index: 100;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow-y: auto;
}
.card-overlay[hidden] { display: none; }

.overlay-inner {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 56px 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
}

.overlay-close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 110;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: var(--text);
    font-size: 1.6rem;
    line-height: 1;
    border: 1px solid var(--border);
    cursor: pointer;
}
.overlay-close:hover { background: var(--card); color: var(--accent-light); }

.overlay-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 64px;
    padding: 0;
    background: rgba(0, 0, 0, 0.45);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 2rem;
    line-height: 1;
    z-index: 110;
    cursor: pointer;
}
.overlay-nav:hover { background: var(--card); color: var(--accent-light); }
.overlay-nav.prev { left: 8px; }
.overlay-nav.next { right: 8px; }

.overlay-card {
    text-align: center;
    padding: 20px 16px;
    background: linear-gradient(160deg, var(--card-alt), var(--card));
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.overlay-card.team-loups { border-color: var(--loups); }
.overlay-card.team-village { border-color: var(--village); }
.overlay-card.team-solo { border-color: var(--solo); }
.overlay-card.team-ambigus { border-color: var(--ambigus); }

.overlay-img {
    width: 100%;
    max-width: 320px;
    margin: 0 auto 14px;
    display: block;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.overlay-icon {
    font-size: 6rem;
    line-height: 1;
    margin-bottom: 8px;
}
.overlay-card h2 {
    font-size: 1.7rem;
    margin: 8px 0 10px;
    color: var(--accent-light);
}

.toggle-instructions {
    width: 100%;
    background: var(--card-alt);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 14px;
    font-size: 1rem;
    border-radius: 10px;
}
.toggle-instructions.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.overlay-instructions {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.overlay-instructions[hidden] { display: none; }
.overlay-description {
    margin: 0 0 12px;
    font-size: 1rem;
    line-height: 1.5;
}
.overlay-sheet-section { margin-bottom: 14px; }
.overlay-sheet-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin: 0 0 6px;
}
.overlay-sheet-section p {
    margin: 0;
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.55;
}

@media (max-width: 380px) {
    .overlay-nav { width: 36px; height: 52px; font-size: 1.5rem; }
    .overlay-card h2 { font-size: 1.4rem; }
    .overlay-icon { font-size: 4.5rem; }
}

@media (max-width: 480px) {
    main { padding: 12px; }
    .card { padding: 14px; }
    .hero h1 { font-size: 1.5rem; }
    .code-display { font-size: 1.8rem; letter-spacing: 0.2em; }
}
