/* Mise en page : une colonne mobile (max 520 px), cartes grises sans bordure ni ombre — design system Philéas, noir et blanc.
   Seule couleur : le vert des gains, demandé pour les propositions. */
:root {
  --ink: #0a0a0a; --ink-2: #404040; --ink-muted: #6b6b6b; --on-ink: #ffffff;
  --surface: #ffffff; --surface-card: #f5f5f5; --surface-pressed: #ececec; --surface-hover: #e6e6e6;
  --track: #e8e8e8; --rule: #e4e4e4; --data-3: #a3a3a3; --data-4: #d4d4d4;
  --gain: #15803d;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 6px; --r-md: 8px; --r-lg: 10px; --r-xl: 14px; --r-2xl: 18px; --r-full: 999px;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { background: var(--surface); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 48px; -webkit-font-smoothing: antialiased; }
.app { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
header.top { display: flex; align-items: center; gap: 12px; padding-block: 4px 8px; }
.logo { width: 34px; height: 34px; border-radius: var(--r-md); background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: -0.02em; flex: none; }
.top h1 { font-size: 22px; line-height: 1.15; font-weight: 700; letter-spacing: -0.03em; margin: 0; }
.top p { margin: 0; font-size: 12px; color: var(--ink-muted); }
.card { background: var(--surface-card); border-radius: var(--r-2xl); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card h2 { font-size: 16px; font-weight: 600; margin: 0; display: flex; align-items: baseline; gap: 8px; }
.card h2 .n { font-size: 11px; font-weight: 600; color: var(--ink-muted); letter-spacing: 0.04em; }
.lbl { font-size: 13px; font-weight: 600; margin: 0 0 8px; display: flex; justify-content: space-between; gap: 8px; }
.lbl small { font-size: 12px; font-weight: 400; color: var(--ink-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 13px; font-weight: 500; border: 0; background: var(--surface); color: var(--ink);
  border-radius: var(--r-full); padding: 8px 14px; cursor: pointer; transition: background .12s; min-height: 36px;
  display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--surface-hover); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.chip:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
svg.ic { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
textarea { width: 100%; min-height: 200px; resize: vertical; border: 0; border-radius: var(--r-xl); background: var(--surface);
  padding: 14px 16px; font: inherit; font-size: 15px; line-height: 1.6; color: var(--ink); }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-muted); flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; border-radius: var(--r-sm); padding: 2px 8px; background: var(--surface-pressed); color: var(--ink-2); }
.btn { font: inherit; font-size: 14px; font-weight: 600; border: 0; border-radius: var(--r-md); padding: 10px 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; transition: background .12s; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: #262626; }
.btn-ghost { background: var(--surface); color: var(--ink); }
.btn-ghost:hover { background: #f0f0f0; }
.btn[disabled] { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
/* résultat */
.res-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.res-l { display: flex; flex-direction: column; gap: 8px; }
.res-i { background: var(--surface); border-radius: var(--r-xl); padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: baseline; }
.res-i .net { font-size: 13px; font-weight: 600; }
.res-i .niv { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; text-align: right; }
.res-i .ec { font-size: 12px; color: var(--ink-muted); grid-column: 1 / -1; }
.res-i.seul .niv { font-size: 28px; }
.gauge { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gauge div { height: 6px; border-radius: var(--r-full); background: var(--data-4); }
.gauge div.on { background: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--surface); border-radius: var(--r-xl); padding: 10px 12px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--ink-muted); line-height: 1.3; }
.tile .v { font-size: 14px; font-weight: 600; line-height: 1.3; }
.tile.sel { outline: 2px solid var(--ink); outline-offset: -2px; }
.fiab { font-size: 12px; color: var(--ink-muted); margin: 0; }
/* propositions : une ligne chacune */
.props { display: flex; flex-direction: column; gap: 6px; }
.prop { background: var(--surface); border-radius: var(--r-xl); min-width: 0; }
.prop-b { font: inherit; color: inherit; background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; min-height: 46px; border-radius: var(--r-xl); }
.prop-b:hover { background: #f0f0f0; }
.prop-b .t { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-b .pre { font-weight: 400; color: var(--ink-muted); }
.prop-d p.fiche { color: var(--ink-muted); font-size: 12px; }
.sans { margin: 2px 4px 0; font-size: 12px; color: var(--ink-muted); }
.gain { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; font-weight: 600; color: var(--gain); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gain svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gain.nul { color: var(--ink-muted); font-weight: 500; font-size: 13px; }
.prop-d { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.prop-d p { margin: 0; font-size: 13px; color: var(--ink-2); }
.diff { font-size: 14px; line-height: 1.65; background: var(--surface-card); border-radius: var(--r-lg); padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff ins { text-decoration: none; background: var(--ink); color: var(--on-ink); border-radius: 3px; padding: 0 2px; }
.diff del { color: var(--data-3); }
.etat { font-size: 13px; color: var(--ink-muted); background: var(--surface); border-radius: var(--r-xl); padding: 14px 16px; margin: 0; }
/* posts comparables */
.comp { display: flex; flex-direction: column; }
.comp-i { display: flex; flex-direction: column; gap: 4px; padding-block: 12px; border-top: 1px solid var(--rule); min-width: 0; }
.comp-i:first-child { border-top: 0; padding-top: 0; }
.comp-i .m { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-muted); }
.comp-i .m b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.comp-i .t { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
footer { font-size: 12px; color: var(--ink-muted); text-align: center; padding-top: 8px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--on-ink);
  border-radius: var(--r-full); padding: 10px 18px; font-size: 13px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* panneau du code d'accès et état de chargement */
.code { display: flex; flex-direction: column; gap: 10px; }
.card .aide { margin: 0; font-size: 13px; color: var(--ink-2); }
.card .msg { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink); }
.code input { font: inherit; font-size: 15px; width: 100%; border: 0; border-radius: var(--r-md); background: var(--surface); color: var(--ink); padding: 10px 12px; min-height: 40px; }
.code input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.chargement { max-width: 520px; margin: 0 auto; }
[hidden] { display: none !important; }
.pied-code { margin: 0; text-align: center; }
.lien { font: inherit; font-size: 12px; color: var(--ink-muted); background: none; border: 0; padding: 8px; cursor: pointer; text-decoration: underline; }
.lien:hover { color: var(--ink); }
.lien:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* iOS zoome sur un champ dont le texte fait moins de 16 px : on reste à 16 px pour éviter le décalage latéral */
textarea, .code input { font-size: 16px; }
html, body { overflow-x: hidden; max-width: 100%; }
.resultats { display: flex; flex-direction: column; gap: 16px; }
.resultats[hidden] { display: none; }
.meta .lien { padding: 4px 0; }
.plie { background: var(--surface); border-radius: var(--r-xl); }
.plie summary { cursor: pointer; padding: 12px 14px; font-size: 13px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.plie summary::-webkit-details-marker { display: none; }
.plie summary::after { content: "+"; color: var(--ink-muted); font-weight: 500; }
.plie[open] summary::after { content: "−"; }
.plie .comp { padding: 0 14px 12px; }
/* rien ne doit dépasser la largeur de l'écran */
.app, .card, .card > * { min-width: 0; max-width: 100%; }
.card { overflow-wrap: anywhere; }
.res-i .niv { font-variant-numeric: tabular-nums; }
/* écrans tactiles : pas d'état de survol, un seul toucher suffit */
@media (hover: none) {
  .chip:hover { background: var(--surface); }
  .prop-b:hover { background: transparent; }
  .chip[aria-pressed="true"]:hover { background: var(--ink); }
  .btn-ghost:hover { background: var(--surface); }
}
.prop-b { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* carrés 2 × 2 : libellé à gauche, chiffre à droite */
.tile > div { flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tile .v { font-variant-numeric: tabular-nums; white-space: nowrap; }
