:root {
    --bg: #0d1117;
    --panel: #161b22;
    --line: #2a313c;
    --text: #e6edf3;
    --muted: #9aa6b2;
    --accent: #d97757;
    --bad: #e5534b;
    --good: #3fb950;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, "Segoe UI", sans-serif;
    line-height: 1.5;
}

.app-main { max-width: 720px; margin: 0 auto; padding: 16px; }

h1 { font-size: 1.8rem; }
h2 { font-size: 1.3rem; }
.subtitle, .muted, .instructions { color: var(--muted); }

.field {
    display: block; width: 100%; margin: 10px 0;
    padding: 12px; font-size: 1rem;
    background: var(--panel); color: var(--text);
    border: 1px solid var(--line); border-radius: 8px;
}

button {
    cursor: pointer; font-size: 1rem; padding: 12px 16px;
    border-radius: 8px; border: 1px solid var(--line);
    background: var(--panel); color: var(--text);
}
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--accent); border-color: var(--accent); color: #11151a; font-weight: 600; width: 100%; margin: 10px 0; }
.secondary { white-space: nowrap; }
.join-row { display: flex; gap: 8px; }
.join-row .field { margin: 0; }

.error { color: var(--bad); }

.qr-join { text-align: center; margin: 14px 0; }
.qr-join .qr { width: 180px; height: 180px; image-rendering: pixelated; border-radius: 8px; background: #fff; padding: 8px; }
.qr-join p { margin: 6px 0 0; }

.roster { list-style: none; padding: 0; }
.roster li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; background: var(--panel); }

.tag { font-size: .75rem; padding: 1px 6px; border-radius: 6px; background: var(--line); margin-left: 6px; }
.tag.bad { background: var(--bad); color: #fff; }

.frame {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 14px; margin-bottom: 12px;
}
.frame .phase { font-weight: 600; display: block; }
.frame-right { text-align: right; }
.gauge { display: inline-block; margin-left: 12px; }
.timer { display: inline-block; margin-left: 12px; font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 8px 12px; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #11151a; font-weight: 600; }

.decision { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; }
.prompt { font-weight: 600; margin: 0 0 8px; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice.selected { background: var(--accent); border-color: var(--accent); color: #11151a; font-weight: 600; }
.rest { color: var(--muted); font-style: italic; }

.logs { display: flex; flex-direction: column; gap: 4px; }
.log { padding: 6px 10px; border-radius: 6px; background: var(--panel); border-left: 3px solid var(--line); }
.log-faction { border-left-color: var(--accent); }
.log-private { border-left-color: var(--good); }

.finished .result { font-size: 1.2rem; }
.fiche p { margin: 6px 0; }
.fiche h4 { margin: 14px 0 6px; }

/* ---- Barre d'actions (pause / quitter) ---- */
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ghost { background: transparent; border-color: var(--line); color: var(--muted); padding: 8px 12px; }
.danger { background: var(--bad); border-color: var(--bad); color: #fff; padding: 8px 12px; }
.confirm { color: var(--muted); }
.timer.paused { color: var(--muted); }
.paused-banner {
    background: rgba(217, 119, 87, .14); border: 1px solid var(--accent); color: var(--text);
    border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-weight: 500;
}

/* ---- Slider de durée (antichambre) ---- */
.duration { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.duration label { display: block; margin-bottom: 8px; }
.duration input[type=range] { width: 100%; accent-color: var(--accent); }
.small { font-size: .85rem; margin: 6px 0 0; }

/* ---- Onglets repliables + animation d'ouverture/fermeture ---- */
.panels { margin-bottom: 12px; }
.panel {
    max-height: 0; opacity: 0; overflow: hidden; padding: 0 14px;
    background: var(--panel); border-radius: 10px;
    transition: max-height .35s ease, opacity .25s ease, padding .35s ease, margin .35s ease;
}
.panel.open {
    max-height: 3000px; opacity: 1; padding: 14px;
    border: 1px solid var(--line); margin-bottom: 10px;
}

/* ---- Allié coloré (camp alien / Old Friend) ---- */
.roster li.ally { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.tag.ally-tag { background: var(--accent); color: #11151a; font-weight: 600; }
.ally-names { color: var(--accent); font-weight: 600; }

/* ---- Mutations (Fiche) & catalogue (Références) ---- */
.powers { list-style: none; padding: 0; }
.powers li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; }
.catalog { padding-left: 18px; }
.catalog li { margin: 5px 0; }

/* ---- Sous-navigation des Références ---- */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sub { padding: 6px 10px; font-size: .9rem; }
.sub.active { background: var(--accent); border-color: var(--accent); color: #11151a; font-weight: 600; }
.ref-body h3 { margin-top: 16px; }
.ref-body h3:first-child { margin-top: 0; }

/* ---- Bascule de langue (globale, coin haut-droit) ---- */
.lang-toggle { position: fixed; top: 8px; right: 8px; display: flex; gap: 4px; z-index: 20; }
.lang-toggle .lang { padding: 4px 9px; font-size: .8rem; border-radius: 6px; opacity: .65; }
.lang-toggle .lang.on { background: var(--accent); border-color: var(--accent); color: #11151a; font-weight: 700; opacity: 1; }

/* ---- Carte des déplacements (A2) ---- */
.frame .self-room { display: block; font-size: .85rem; color: var(--accent); font-weight: 600; margin-top: 2px; }
.tag.room-tag { background: rgba(217, 119, 87, .18); color: var(--accent); }

/* ---- Renseignements secrets (A1 : carte de contamination, Traque, Sangsue, Mastermind) ---- */
.intel {
    background: rgba(217, 119, 87, .10); border: 1px solid var(--accent);
    border-radius: 10px; padding: 10px 14px; margin: 0 0 12px;
}
.intel h4 { margin: 0 0 8px; color: var(--accent); font-size: .95rem; }
.intel p { margin: 4px 0; font-size: .9rem; }
.intel strong { color: var(--text); }

/* État des salles : événement actif + récap du dernier tour */
.rooms-status { margin: 0 0 12px; }
.rooms-status h4 { margin: 0 0 8px; color: var(--accent); font-size: .95rem; }
.rooms { list-style: none; margin: 0; padding: 0; }
.rooms li {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px;
    padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem;
}
.rooms li:last-child { border-bottom: none; }
.room-name { font-weight: 600; min-width: 9rem; }
.room-recap { font-size: .85rem; }
.tag.bounty { background: rgba(63, 185, 80, .18); color: var(--good); }
.outcome-Success { color: var(--good); }
.outcome-Failure { color: var(--bad); }

#blazor-error-ui { display: none; }

/* ---- Termes cliquables (rôles, salles, mutations, états) ---- */
.term {
    position: relative; cursor: pointer;
    border-bottom: 1px dotted var(--accent); color: inherit;
}
.term.term-open { color: var(--accent); }
.term-pop {
    position: absolute; left: 0; top: 1.5em; z-index: 30;
    width: max(220px, 100%); max-width: 320px;
    background: var(--panel); border: 1px solid var(--accent); border-radius: 8px;
    padding: 8px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.45);
    cursor: default; white-space: normal;
}
.term-pop-name { display: block; color: var(--accent); margin-bottom: 4px; }
.term-pop-desc { display: block; font-size: .85rem; color: var(--text); }

/* ---- Co-présence (vue partie) ---- */
.copresence {
    background: rgba(217, 119, 87, .10); border: 1px solid var(--accent);
    border-radius: 10px; padding: 10px 14px; margin: 0 0 12px;
}
.copresence h4 { margin: 0 0 6px; color: var(--accent); font-size: .95rem; }
.copresence p { margin: 0; }
.copresence-hidden { margin: 0 0 12px; }

/* ---- Information secrète (fiche méchant) ---- */
.hidden-info {
    background: rgba(229, 83, 75, .10); border: 1px solid var(--bad);
    border-radius: 10px; padding: 10px 14px; margin: 12px 0;
}
.hidden-info h4 { margin: 0 0 6px; color: var(--bad); font-size: .95rem; }
.hidden-info p { margin: 4px 0; }

/* ---- Choix enrichis : salle (détails + étoile) et draft de mutation ---- */
.choices-rich { display: flex; flex-direction: column; gap: 8px; }
.rich-choice {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
    text-align: left; width: 100%;
}
.rich-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rich-name { font-weight: 600; }
.rich-desc { font-size: .82rem; color: var(--muted); }
.rich-why { font-size: .82rem; color: var(--good); }
.star { color: var(--accent); }

/* ---- Vote de fin de phase (prêt) ---- */
.ready-count { font-size: .8rem; opacity: .85; margin-left: 4px; }
.ready-hint { margin: 6px 0 0; }
.resolving-banner {
    margin: 8px 0; padding: 8px 12px; border-radius: 8px; text-align: center;
    background: rgba(217, 119, 87, .15); border: 1px solid var(--accent); color: var(--accent);
}
.timer.resolving { color: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* ---- Références hors partie ---- */
.refs-link { display: inline-block; margin-top: 14px; color: var(--accent); }
.refs-page-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.refs-page-bar h2 { margin: 0; }
.small { font-size: .82rem; }
