:root {
  --bg: #0d1428; --card: #151e38; --card2: #1c2747; --line: #2a3760;
  --txt: #eef1fa; --muted: #93a0c4; --gold: #e8c46a; --blue: #2f5bd3; --red: #e0474c;
  --pos: #4cc38a; --neg: #ef6b6b;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at top, #1a2550, var(--bg) 60%) fixed; color: var(--txt);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 520px; margin: 0 auto; padding: 12px 16px 48px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 22px; } h3 { font-size: 17px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
.muted { color: var(--muted); } .small { font-size: 12px; margin-top: 6px; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; min-height: 32px; }
.tokens { background: var(--card2); border: 1px solid var(--line); color: var(--gold); padding: 4px 10px; border-radius: 99px; font-weight: 600; font-size: 13px; }
.ghost { background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 10px; border: 1px solid transparent; transition: color .15s, background .15s, border-color .15s; }
.ghost:hover { color: var(--gold); background: var(--card2); border-color: var(--line); }
.primary, .secondary { display: block; width: 100%; padding: 14px; border-radius: 14px; font-weight: 700; margin: 10px 0; }
.primary { background: linear-gradient(135deg, var(--gold), #c99a35); color: #1b1405; transition: filter .15s, transform .08s, box-shadow .15s; }
.primary:hover { filter: brightness(1.08); box-shadow: 0 4px 18px rgba(232, 196, 106, .25); }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible, [tabindex="-1"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.primary:active, .secondary:active, .tile:active, .seg button:active { transform: scale(.985); }
.secondary { background: var(--card2); border: 1px solid var(--line); transition: border-color .15s, background .15s, transform .08s; }
.secondary:hover { border-color: var(--gold); background: #22305a; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

.hero { text-align: center; padding: 28px 0 18px; }
.hero h1 { font-size: 34px; letter-spacing: -0.5px; }
.hero h1 span { color: var(--gold); }
.hero p { color: var(--muted); margin: 0; }
.flag { display: inline-flex; width: 54px; height: 6px; border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.flag i { flex: 1; } .flag i:nth-child(1) { background: var(--blue); } .flag i:nth-child(2) { background: #fff; } .flag i:nth-child(3) { background: var(--red); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; }
.quest { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); gap: 8px; }
.quest:last-child { border: 0; }
.quest b { color: var(--gold); white-space: nowrap; }
.quest.done span { text-decoration: line-through; color: var(--muted); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 8px; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, background .15s, transform .08s; }
.tile small { color: var(--muted); font-size: 12px; }
.tile:hover { border-color: var(--gold); background: var(--card2); }

.progress { display: flex; gap: 4px; margin-bottom: 16px; }
.progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.progress i.on { background: var(--gold); }
.field { display: block; color: var(--muted); font-size: 13px; margin: 12px 0; }
.field input { display: block; width: 100%; margin-top: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--txt); font: inherit; font-size: 16px; }
.name-row { display: flex; gap: 8px; margin-top: 6px; }
.name-row input { margin-top: 0; flex: 1; min-width: 0; }
.dice { flex: none; width: 52px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); font-size: 22px; transition: transform .25s; }
.dice:hover { border-color: var(--gold); } .dice:active { transform: rotate(180deg) scale(.9); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { flex: 1 1 0; min-width: max-content; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); transition: border-color .15s, background .15s; }
.seg button:hover { border-color: var(--gold); background: var(--card2); }
.seg .sel { border-color: var(--gold); color: var(--gold); }

.options { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.option { text-align: left; background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; transition: transform .08s, border-color .15s; position: relative; }
button.option:hover { border-color: var(--gold); }
button.option:active { transform: scale(.985); }
.option.sel { border-color: var(--gold); }
.option.locked { opacity: .45; }
.opt-t { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.opt-t small { color: var(--muted); font-weight: 400; }
.opt-d { color: var(--muted); font-size: 13px; margin-top: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--gold)); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: #26325a; color: var(--muted); }
.chip.pos { background: rgba(76, 195, 138, .15); color: var(--pos); }
.chip.neg { background: rgba(239, 107, 107, .15); color: var(--neg); }
button.chip { border: 1px solid transparent; font: inherit; font-size: 11.5px; cursor: pointer; }
button.chip.sel { border-color: var(--gold); color: var(--gold); }
.filters { margin: 10px 0 4px; justify-content: center; }
.chip.risk { background: rgba(232, 196, 106, .15); color: var(--gold); }
.buy { margin-top: 8px; background: var(--gold); color: #1b1405; padding: 6px 12px; border-radius: 10px; font-weight: 700; }
.buy:hover:not(:disabled) { filter: brightness(1.1); }
.buy:disabled { opacity: .4; cursor: not-allowed; }

.profile { background: linear-gradient(135deg, color-mix(in srgb, var(--c) 28%, var(--card)), var(--card)); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 16px; padding: 14px 16px; }
.profile h2 { margin: 0; }
.office { font-size: 18px; font-weight: 700; color: var(--gold); margin: 8px 0; }
.office small { display: block; font-size: 13px; color: var(--txt); font-weight: 400; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 99px; color: #fff; }
.tag.outline { border: 1px solid var(--line); color: var(--muted); }
.tag.bad { background: rgba(239, 107, 107, .2); color: var(--neg); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 14px 2px; }
.stat-h { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.stat-h b { color: var(--txt); }
.bar { height: 6px; background: var(--card2); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--gold); }
.bar .popularite { background: #f59e42; } .bar .reseau { background: #5b8def; } .bar .charisme { background: #c774e8; }
.bar .competence { background: #3fbfb0; } .bar .integrite { background: #4cc38a; } .bar .tresor { background: var(--gold); }

.play { padding-top: 14px; }
.result { background: var(--card2); border-left: 3px solid var(--pos); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.result.bad { border-color: var(--neg); }
.result p { margin: 6px 0 2px; color: #cdd4ea; line-height: 1.45; }
.intro { color: #cdd4ea; font-style: italic; line-height: 1.5; margin: 0 0 12px; }
.bio { text-align: left; line-height: 1.55; color: #cdd4ea; margin: 0 0 14px; }
.event p { color: #cdd4ea; margin: 0 0 4px; }
.rubrique { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.une { background: #f3ecdc; color: #1b1b1b; border-radius: 6px; padding: 10px 12px; margin: 0 0 14px; font-family: Georgia, 'Times New Roman', serif; }
.une .journal { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; border-bottom: 1px solid #1b1b1b; padding-bottom: 4px; margin-bottom: 6px; }
.une .manchette { font-size: 19px; font-weight: 700; line-height: 1.25; }
.log-une { font-size: 12px; color: #cdd4ea; font-style: italic; margin: 2px 0 4px; }
.event a, .event a:visited { color: var(--gold); }
.election h3 { color: var(--gold); }
.lines { margin: 6px 0; padding-left: 18px; }
.lines li { margin: 4px 0; font-size: 14px; }

.modal { position: fixed; inset: 0; background: rgba(5, 8, 18, .75); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { background: var(--card); width: 100%; max-width: 520px; max-height: 85vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px; }
.modal.center { align-items: center; padding: 16px; }
.dialog { background: var(--card); border: 1px solid var(--line); width: 100%; max-width: 400px; border-radius: 18px; padding: 20px 18px; text-align: center; animation: pop .15s ease-out; }
.dialog h3 { margin: 0 0 8px; }
.dialog-btns { display: flex; gap: 10px; margin-top: 16px; }
.dialog-btns button { flex: 1; margin: 0; }
.danger { display: block; padding: 14px; border-radius: 14px; font-weight: 700; background: var(--red); color: #fff; transition: filter .15s; }
.danger:hover { filter: brightness(1.1); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.resume-wrap { position: relative; }
.resume-wrap .primary { padding-right: 60px; padding-left: 60px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(27, 20, 5, .12); color: #1b1405; transition: background .15s, color .15s; }
.trash:hover { background: var(--red); color: #fff; }
.year { border-bottom: 1px solid var(--line); padding: 8px 0; }
.yh { display: flex; justify-content: space-between; } .yh span { color: var(--muted); font-size: 13px; }

.end { text-align: center; border-top: 4px solid var(--c); }
.grade { font-size: 24px; font-weight: 800; color: var(--gold); margin: 4px 0 14px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kpis div { background: var(--card2); border-radius: 12px; padding: 10px 6px; }
.kpis b { display: block; font-size: 14px; } .kpis small { color: var(--muted); font-size: 11px; }
.gain { color: var(--gold); font-weight: 700; font-size: 18px; }
.end .chips { justify-content: center; }
.portrait { border-left: 4px solid var(--c); }
.portrait .bio { margin: 8px 0 0; font-size: 14px; }
.portrait .ghost { margin-top: 6px; padding-left: 0; }

.mt { margin-top: 12px; }
.tree { list-style: none; margin: 4px 0 0; padding-left: 18px; border-left: 1px dashed var(--line); }
.tree.root { padding-left: 0; border: 0; }
.tree li { margin: 6px 0; }
.tree .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.opt-d.cause { margin-top: 6px; color: var(--gold); }
.share-card { white-space: pre-wrap; word-break: break-all; text-align: left; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--card2); border-radius: 12px; padding: 10px 12px; margin: 12px 0 0; }
.version { text-align: center; color: var(--muted); font-size: 11px; opacity: .6; margin: 24px 0 0; }
.story-btn { border-color: var(--gold); color: var(--gold); }
/* Accueil : tout tient sur un écran de téléphone, sans défiler. */
main:has(.home) { padding-bottom: 12px; }
.home .topbar { margin-bottom: 0; }
.home .hero { padding: 0 0 8px; }
.home .flag { margin-bottom: 8px; }
.home .hero h1 { font-size: 30px; margin-bottom: 4px; }
.home .hero p { font-size: 14px; }
.home .primary, .home .secondary { padding-top: 11px; padding-bottom: 11px; margin: 7px 0; }
.home .card { padding: 10px 14px; margin: 8px 0; }
.home .card h3 { margin-bottom: 2px; }
.home .quest { padding: 5px 0; }
.home .tile { padding: 9px 6px; gap: 2px; }
.home .topbar .ghost { padding: 6px 4px; font-size: 13px; }
.home .version { margin-top: 6px; }
details.card summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.poll { margin: 10px 0; }
.poll-row { display: grid; grid-template-columns: 118px 1fr 52px 34px; align-items: center; gap: 8px; font-size: 13px; padding: 4px 6px; border-radius: 8px; }
.poll-row.me { background: rgba(232, 196, 106, .1); font-weight: 700; }
.poll-row.hl .poll-n { color: var(--gold); }
.poll-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poll-bar { height: 8px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.poll-bar i { display: block; height: 100%; border-radius: 4px; }
.poll-row b { text-align: right; }
.poll-row small { font-size: 11px; } .up { color: var(--pos); } .down { color: var(--neg); }
.end-story { text-align: center; }
.duel { display: flex; height: 34px; border-radius: 10px; overflow: hidden; margin-top: 12px; font-weight: 700; font-size: 13px; }
.duel div { display: flex; align-items: center; justify-content: center; color: #fff; min-width: 50px; }
.duel-n { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 4px; }
.daily-btn small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 3px; }
.ton { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px; margin-bottom: 6px; }
.objectif { background: #1f2a4d; border-left: 3px solid var(--gold); border-radius: 6px; padding: 8px 10px; margin: 0 0 12px; font-size: 14px; }
.objectif small { display: block; color: var(--muted); margin-top: 2px; }
.barometre { background: #1f2a4d; border-radius: 6px; padding: 8px 10px; margin: 0 0 12px; font-size: 14px; }
.breve { font-size: 13.5px; color: #cdd4ea; background: #1a2342; border-radius: 6px; padding: 8px 10px; font-style: italic; }
/* Jauge qui a bougé : elle glisse depuis --from, chiffre et barre flashent vert ou rouge. */
.stat.up .bar i, .stat.down .bar i { animation: slide .9s cubic-bezier(.33, 1, .68, 1) both; }
@keyframes slide { from { width: var(--from); } }
.stat.up b { animation: flash-up 1.4s ease-out; } .stat.down b { animation: flash-down 1.4s ease-out; }
.stat.up .bar { animation: glow-up 1.4s ease-out; } .stat.down .bar { animation: glow-down 1.4s ease-out; }
@keyframes flash-up { from, 30% { color: var(--pos); text-shadow: 0 0 8px rgba(76, 195, 138, .7); } }
@keyframes flash-down { from, 30% { color: var(--neg); text-shadow: 0 0 8px rgba(239, 107, 107, .7); } }
@keyframes glow-up { from, 30% { box-shadow: 0 0 0 1px var(--pos), 0 0 10px rgba(76, 195, 138, .6); } }
@keyframes glow-down { from, 30% { box-shadow: 0 0 0 1px var(--neg), 0 0 10px rgba(239, 107, 107, .6); } }
/* Soir de scrutin : les barres poussent au rythme du compteur (même courbe que countUp). */
.reveal .poll-bar i, .duel.reveal div { animation: grow 1.2s cubic-bezier(.33, 1, .68, 1) both; }
@keyframes grow { from { width: 0; } }
/* La une sort de la rotative, puis l'encre de la manchette prend. */
.une { animation: print .6s cubic-bezier(.2, .8, .2, 1) both; }
.une .manchette { animation: ink .8s .3s ease-out both; }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-8px); } }
@keyframes ink { from { opacity: 0; filter: blur(3px); letter-spacing: .03em; } }
.calm .une, .calm .une .manchette, .calm .reveal .poll-bar i, .calm .duel.reveal div { animation: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
