/* Couleurs : celles de l'app (lib/theme.dart), contrastes vérifiés par outils/contraste.py. */
:root {
  color-scheme: light dark;
  --papier: #FAF7F2;
  --carte: #FFFFFF;
  --creux: #F1EBE3;
  --encre: #2B211B;
  --encre2: #5B4B41;
  --encre3: #6F5F55;
  --trait: #E4DBD1;
  --accent: #A3472A;
  --accent-pale: #F7E6DE;
  --sur-accent: #FFFFFF;
  --alerte: #B3261E;
  --rayon: 14px;
  --texte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #17130F;
    --carte: #211B16;
    --creux: #2B241E;
    --encre: #F2EAE3;
    --encre2: #CDBFB4;
    --encre3: #A8998D;
    --trait: #3A3029;
    --accent: #F0A58A;
    --accent-pale: #3E2A21;
    --sur-accent: #17130F;
    --alerte: #F28B82;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 17px/1.5 var(--texte);
  overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.bloc { max-width: 46rem; margin: 0 auto; padding: 0 16px; }

.lien-evitement {
  position: absolute; left: -9999px; top: 0;
  background: var(--carte); padding: 8px 12px; z-index: 2;
}
.lien-evitement:focus { left: 16px; top: 8px; }

/* En-tête : marque et langues sur une ligne, outils sur la suivante. */
.entete { border-bottom: 1px solid var(--trait); background: var(--papier); }
.entete-haut { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.marque { font-weight: 800; font-size: 1.15rem; color: var(--encre); text-decoration: none; }
.langues { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.langues a {
  display: inline-block; min-width: 44px; min-height: 44px; line-height: 44px; text-align: center;
  border-radius: 10px; text-decoration: none; color: var(--encre2); font-weight: 600; font-size: 0.95rem;
}
.langues a[aria-current="true"] { background: var(--creux); color: var(--encre); }
.outils { display: flex; flex-wrap: wrap; gap: 0 14px; margin: 0; padding: 4px 0 8px; list-style: none; }
.outils a {
  display: inline-block; min-height: 44px; line-height: 44px;
  color: var(--encre2); text-decoration: none; font-weight: 600; font-size: 0.94rem;
}
.outils a[aria-current="page"] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }

main { padding-top: 8px; padding-bottom: 32px; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 20px 0 8px; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 32px 0 8px; }
.chapeau { color: var(--encre2); font-size: 1.05rem; margin-top: 0; }
.discret { color: var(--encre3); font-size: 0.92rem; }

.cartes { display: grid; gap: 12px; margin: 20px 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .cartes { grid-template-columns: repeat(3, 1fr); } }
.carte {
  display: block; height: 100%; padding: 16px; border: 1px solid var(--trait); border-radius: 18px;
  background: var(--carte); color: var(--encre); text-decoration: none;
}
.carte strong { display: block; font-size: 1.1rem; color: var(--accent); margin-bottom: 4px; }
.carte span { color: var(--encre2); }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 24px;
  border: 0; border-radius: var(--rayon); background: var(--accent); color: var(--sur-accent);
  font: 700 1rem/1.2 var(--texte); text-decoration: none; cursor: pointer;
}
.bouton-second {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px;
  border: 1.5px solid var(--accent); border-radius: var(--rayon); background: transparent; color: var(--accent);
  font: 600 1rem/1.2 var(--texte); cursor: pointer;
}

.appel { margin: 32px 0 8px; padding: 20px 16px; border-radius: 18px; background: var(--accent-pale); }
.appel h2 { margin-top: 0; }
.appel p { margin: 0 0 16px; }

/* Compteur : gros chiffres et gros boutons, utilisables d'une main, aiguilles en main. */
.compteur { margin: 16px 0; padding: 20px 16px; border: 1px solid var(--trait); border-radius: 18px; background: var(--carte); text-align: center; }
.compteur-nom { margin: 0; color: var(--encre2); font-weight: 600; }
.compteur-valeur {
  display: block; margin: 4px 0 16px; font-size: clamp(5rem, 28vw, 9rem); line-height: 1; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.compteur-boutons { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.compteur-boutons button {
  min-height: 112px; border-radius: 18px; font: 700 2.2rem/1 var(--texte);
  cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.plus { border: 0; background: var(--accent); color: var(--sur-accent); }
.moins { border: 1.5px solid var(--accent); background: transparent; color: var(--accent); }
.moins:disabled { border-color: var(--trait); color: var(--encre3); cursor: default; }
.compteur-remise { margin-top: 16px; }
.confirmation { margin-top: 16px; padding: 12px; border-radius: var(--rayon); background: var(--creux); }
.confirmation p { margin: 0 0 12px; font-weight: 600; }
.confirmation .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.etat { margin: 12px 0 0; color: var(--encre3); font-size: 0.92rem; }

/* Tableaux : jamais plus larges que l'écran, les cellules passent à la ligne. */
.tableau { width: 100%; border-collapse: collapse; margin: 8px 0 16px; background: var(--carte); border-radius: 12px; overflow: hidden; }
.tableau caption { text-align: left; font-weight: 700; padding: 8px 0; }
.tableau th, .tableau td {
  padding: 10px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait);
  overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto;
}
@media (max-width: 360px) { .tableau th, .tableau td { padding: 10px 5px; overflow-wrap: anywhere; } }
.tableau thead th { color: var(--encre2); font-size: 0.9rem; background: var(--creux); -webkit-hyphens: manual; hyphens: manual; }
.tableau td:first-child { font-weight: 700; white-space: nowrap; }
.tableau .terme { display: block; font-weight: 400; color: var(--encre2); white-space: normal; }
.tableau tr.choisi td { background: var(--accent-pale); }
.chiffres td { font-variant-numeric: tabular-nums; }

.choix { display: flex; gap: 4px; padding: 4px; border: 0; min-width: 0; border-radius: var(--rayon); background: var(--creux); margin: 16px 0; }
.choix label { flex: 1; }
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix span {
  display: block; min-height: 44px; line-height: 44px; text-align: center; border-radius: 10px;
  font-weight: 600; color: var(--encre2); cursor: pointer;
}
.choix input:checked + span { background: var(--carte); color: var(--encre); box-shadow: 0 0 0 1px var(--trait); }
.choix input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.convertir { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.convertir label { display: block; font-weight: 600; color: var(--encre2); font-size: 0.92rem; }
.convertir select {
  width: 100%; min-height: 48px; margin-top: 4px; padding: 0 12px; border: 1px solid var(--encre3); border-radius: 12px;
  background: var(--carte); color: var(--encre); font: 1.05rem var(--texte);
}
.resultat { margin: 16px 0; padding: 16px; border-radius: 18px; background: var(--accent-pale); font-size: 1.15rem; }
.resultat p { margin: 0; }
.resultat p + p { margin-top: 6px; }
.resultat strong { font-variant-numeric: tabular-nums; }

.sources { padding-left: 1.2em; color: var(--encre2); font-size: 0.95rem; }
.sources li { margin-bottom: 6px; }

.adresse { font-style: normal; }

.pied { border-top: 1px solid var(--trait); padding: 16px 0 32px; color: var(--encre3); font-size: 0.92rem; }
.pied ul { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; padding: 0; list-style: none; }
.pied a { display: inline-block; min-height: 44px; line-height: 44px; color: var(--encre2); }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

[hidden] { display: none !important; }
