/* Le Quinquennat — feuille autonome du jeu chiffrons.fr.
   Mêmes jetons que /equilibrer/ (fond clair, accent bleu, Geist / Geist Mono),
   plus les couleurs des quatre groupes parlementaires fictifs et le violet
   réservé à ce qui est SIMULÉ, pour qu'il ne se confonde jamais avec le chiffré. */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --sunk: #f1f0ed;
  --fg: #0c0a09;
  --muted: #52525b;
  --border: #e4e4e7;
  --accent: #1e40af;
  --accent-soft: #e3e9fb;
  --positif: #15803d;
  --negatif: #b91c1c;
  --attention: #a16207;
  --sim: #6d28d9;
  --sim-soft: #f1eafe;
  --or: #a16207;
  --b-gauche: #c2410c;
  --b-eco: #4d7c0f;
  --b-centre: #ca8a04;
  --b-droite: #1e3a8a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.modal-ouverte { overflow: hidden; }

a { color: var(--accent); }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
button { font: inherit; cursor: pointer; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lien { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }

.site-header { border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; background: var(--surface); }
.site-header nav {
  max-width: 1180px; margin: 0 auto; display: flex; gap: 1.25rem; align-items: center;
  font-family: 'Geist Mono', monospace; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.03em; flex-wrap: wrap;
}
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a.brand { color: var(--fg); font-weight: 600; margin-right: auto; }
.site-header nav a[aria-current] { color: var(--fg); }

main { max-width: 1180px; margin: 0 auto; padding: 1.5rem max(1rem, env(safe-area-inset-right, 0px)) 4rem max(1rem, env(safe-area-inset-left, 0px)); display: grid; gap: 18px; }

/* ---- En-tête du jeu ---- */
.top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; justify-content: space-between; }
.kicker { font-family: 'Geist Mono', monospace; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .4rem; }
.top h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
.chapo { margin: .4rem 0 0; color: var(--muted); max-width: 62ch; }
.top-droite { display: grid; gap: 8px; justify-items: end; }
.mode { font-size: 12.5px; color: var(--muted); text-align: right; }
.mode b { color: var(--fg); }
.calendar { display: flex; gap: 4px; flex-wrap: wrap; }
.yr { font-family: 'Geist Mono', monospace; font-size: 12px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); background: var(--surface); }
.yr.now { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 600; }
.yr.done { color: var(--fg); }
.legende { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; align-items: center; color: var(--muted); }
.tag { display: inline-flex; align-items: center; font-family: 'Geist Mono', monospace; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.tag.chiffre { background: var(--accent-soft); color: var(--accent); }
.tag.simule { background: var(--sim-soft); color: var(--sim); }
.tag.fictif { background: var(--sunk); color: var(--muted); }

/* ---- Défi reçu par lien ---- */
.defi { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; border: 2px solid var(--fg); border-radius: 12px; padding: 12px 16px; background: var(--surface); }
.defi p { margin: 0; }
.defi .btn { padding: 8px 14px; }
.defi-rappel { background: var(--sunk); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }

/* ---- Objectifs ---- */
.goals { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.goals .lbl { font-family: 'Geist Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.goal { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); }
.goal.ok { border-color: var(--positif); color: var(--positif); }
.goal .st { color: var(--muted); }
.goal.ok .st { color: var(--or); }
.goals-note { margin-left: auto; }

/* ---- Indicateurs ---- */
.gauges { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.gauge { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.gauge .lab { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; align-items: center; flex-wrap: wrap; }
.gauge .val { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.gauge .delta { font-size: 12px; color: var(--muted); }
.gauge.main { border-color: var(--fg); }
.up-bad { color: var(--negatif) !important; }
.up-good { color: var(--positif) !important; }
.bar { height: 6px; background: var(--sunk); border-radius: 3px; position: relative; margin-top: 6px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--fg); border-radius: 3px; transition: width .6s; }
.bar b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--positif); }

/* ---- Plateau ---- */
.board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.panel h2 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.panel .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.panel-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hemi svg { width: 100%; height: auto; display: block; }
.hemi-num { font-family: 'Geist Mono', monospace; font-size: 22px; font-weight: 600; fill: var(--fg); }
.hemi-lab { font-family: 'Geist Mono', monospace; font-size: 10px; fill: var(--muted); }
.blocs { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; }
.blocs span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.voteline { font-family: 'Geist Mono', monospace; font-size: 13px; min-height: 1.5em; text-align: center; }
.votebreak { display: grid; gap: 5px; font-size: 12.5px; }
.vb { display: grid; grid-template-columns: 120px minmax(0, 1fr) 64px; gap: 8px; align-items: center; }
.vb-n { display: inline-flex; gap: 6px; align-items: center; }
.vb-c { text-align: right; }
.vb .track { height: 8px; border-radius: 4px; background: #f3c7c7; overflow: hidden; }
.vb .track i { display: block; height: 100%; background: var(--positif); }
.vb .why { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin-top: -3px; }
.opinion { border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 10px; }
.groups { display: grid; gap: 8px; }
.grp { display: grid; grid-template-columns: 120px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 13px; }
.grp .bar { margin: 0; height: 8px; }
.grp .bar i { background: var(--accent); }
.grp .n { text-align: right; }
.seuil { font-size: 12px; color: var(--muted); }

/* ---- Cartes de réforme ---- */
.slots { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.slot { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--fg); }
.slot.used { background: var(--fg); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--fg); padding: 4px 10px; border-radius: 999px; font-size: 12.5px; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; max-height: 720px; overflow: auto; padding-right: 4px; }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; gap: 8px; background: var(--surface); align-content: start; }
.card:hover { border-color: var(--fg); }
.card .th { font-family: 'Geist Mono', monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card h3 { font-size: 15px; font-weight: 600; line-height: 1.3; }
.card .cost { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.card .cost .mono { font-weight: 600; }
.effects { display: flex; flex-wrap: wrap; gap: 4px; }
.eff { font-family: 'Geist Mono', monospace; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--sunk); }
.eff.p { color: var(--positif); }
.eff.n { color: var(--negatif); }
.card details { font-size: 12.5px; border-top: 1px dashed var(--border); padding-top: 6px; }
.card summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.card details p { margin: 6px 0 0; color: var(--muted); }
.card details p b { color: var(--fg); font-weight: 600; }
.card .act { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .act a { font-size: 12px; }
.card.adopted { background: var(--sunk); }
.btn { border: 1px solid var(--fg); background: var(--fg); color: var(--bg); padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.stamp { font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border: 1.5px solid currentColor; border-radius: 4px; transform: rotate(-3deg); }
.stamp.ok { color: var(--positif); }
.stamp.ko { color: var(--negatif); }

/* ---- Fin d'année ---- */
.endturn { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--fg); color: var(--bg); border-radius: 12px; padding: 14px 16px; }
.endturn p { margin: 0; font-size: 14px; max-width: 70ch; }
.endturn .btn { background: var(--bg); color: var(--fg); border-color: var(--bg); padding: 9px 16px; font-weight: 600; }

/* ---- Trajectoire et presse ---- */
.lower { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-family: 'Geist Mono', monospace; font-size: 11px; }
.chart .grid { stroke: var(--border); }
.chart .cible { stroke: var(--positif); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .cible-t { fill: var(--positif); }
.chart .aire { fill: var(--accent); opacity: .1; }
.chart .ligne { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .pt { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .val-t { fill: var(--fg); font-weight: 600; }
.press { display: grid; gap: 10px; max-height: 330px; overflow: auto; }
.news { border-top: 1px solid var(--border); padding-top: 9px; display: grid; gap: 2px; }
.news:first-child { border-top: 0; padding-top: 0; }
.news .when { font-size: 11px; color: var(--muted); }
.news .hl { font-weight: 650; font-size: 15.5px; line-height: 1.25; letter-spacing: -.01em; }
.news .tx { font-size: 13px; color: var(--muted); }

/* ---- Succès ---- */
.badgegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.badge { border: 1px dashed var(--border); border-radius: 10px; padding: 10px; display: grid; gap: 2px; font-size: 12.5px; color: var(--muted); }
.badge b { font-size: 13.5px; }
.badge.on { border-style: solid; border-color: var(--or); color: var(--fg); }
.badge.on b { color: var(--or); }
.autre-jeu { text-decoration: none; border-color: var(--border); }
.autre-jeu b { color: var(--fg) !important; }
.autre-jeu:hover { border-color: var(--fg); }

/* ---- Méthode ---- */
.methode { border-top: 1px solid var(--border); padding-top: 1.5rem; font-size: .9rem; color: var(--muted); max-width: 80ch; }
.methode h2 { font-size: 1.15rem; color: var(--fg); margin: 0 0 .75rem; }
.methode h3 { font-size: .95rem; color: var(--fg); margin: 1.25rem 0 .4rem; }
.methode ul { padding-left: 1.1rem; }
.methode li { margin: .3rem 0; }
.methode strong { color: var(--fg); }
.liste-reformes { columns: 2 18rem; }
.sansjs { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; background: var(--surface); }
.js .sansjs { display: none; }

/* ---- Fenêtres ---- */
.overlay { position: fixed; inset: 0; background: rgba(12, 10, 9, .5); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; max-width: 600px; width: 100%; padding: 22px; display: grid; gap: 14px; max-height: 92vh; overflow: auto; border: 1px solid var(--border); }
.modal h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.modal p { margin: 0; }
.choices { display: grid; gap: 8px; }
.choice { text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--fg); padding: 12px; border-radius: 10px; display: grid; gap: 3px; }
.choice:hover { border-color: var(--fg); }
.choice b { font-weight: 600; }
.choice span { font-size: 13px; color: var(--muted); }
.choice .best { font-size: 11.5px; color: var(--or); }
.choice .pointage { font-size: 12.5px; font-weight: 600; }
.choice.daily { border: 2px solid var(--fg); }
.choice.ghost { border-style: dashed; }
.recap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.recap div div { padding: 0; }
.recap > div { background: var(--sunk); border-radius: 8px; padding: 8px 10px; }
.recap .k { font-size: 12px; color: var(--muted); }
.recap .v { font-size: 18px; font-weight: 600; }
.verdict { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.025em; }
.archetype { display: grid; gap: 4px; background: var(--fg); color: var(--bg); border-radius: 12px; padding: 14px 16px; }
.archetype .k { font-family: 'Geist Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.archetype .n { font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.archetype .d { font-size: 13.5px; opacity: .85; }
.score { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.score .pts { font-size: 40px; font-weight: 600; letter-spacing: -.03em; }
.score .stars { font-size: 24px; color: var(--or); letter-spacing: 2px; }
.score .rec { font-size: 12.5px; color: var(--muted); }
.partage h3 { font-size: 15px; }
.partage { display: grid; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.partage-liens { display: flex; flex-wrap: wrap; gap: .4rem; }
.partage-liens a, .partage-liens button {
  font-family: 'Geist Mono', monospace; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  padding: .4rem .65rem; border-radius: .375rem; text-decoration: none;
}
.partage-liens a:hover, .partage-liens button:hover { border-color: var(--accent); color: var(--accent); }
#copymsg { overflow-wrap: anywhere; }
.newbadges { display: flex; flex-wrap: wrap; gap: 6px; }
.newbadges span { font-size: 12.5px; border: 1px solid var(--or); color: var(--or); border-radius: 999px; padding: 2px 10px; }
.wf { display: grid; gap: 6px; }
.wfr { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 13px; }
.wfr .tr { position: relative; height: 14px; }
.wfr .tr i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.wfr .num { text-align: right; }
.wfr.total { border-top: 1px solid var(--border); padding-top: 6px; font-weight: 600; }
.lessons { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lessons li { font-size: 13.5px; padding: 8px 10px; background: var(--sunk); border-radius: 8px; }
.lessons li b { font-weight: 600; }

@media (max-width: 900px) {
  .board, .lower { grid-template-columns: minmax(0, 1fr); }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gauge.main { grid-column: 1 / -1; }
  .cards { max-height: none; }
  .recap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vb { grid-template-columns: 100px minmax(0, 1fr) 56px; }
  .grp { grid-template-columns: 100px minmax(0, 1fr) 36px; }
  .wfr { grid-template-columns: minmax(0, 1fr) 80px 56px; }
  .top-droite { justify-items: start; }
  .mode { text-align: left; }
  .goals-note { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
