:root {
  --texte: #1a1a2e;
  --muted: #5c5f66;
  --fond: #fafafa;
  --panneau: #ffffff;
  --bordure: #e2e2e8;
  --accent: #1e3a6e;
  --succes: #1f7a4d;
  --succes-fond: #e6f3ec;
  --haute: #b3261e;
  --moyenne: #a15c00;
  --basse: #5b6470;
  --police-titre: Georgia, "Times New Roman", "Liberation Serif", serif;
  --police-texte:
    -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}

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

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police-texte);
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: var(--police-titre);
  font-weight: 700;
}

.bandeau {
  background: var(--accent);
  color: #fff;
  padding: 1.5rem 1.5rem 1.25rem;
  text-align: center;
}
.bandeau h1 {
  margin: 0 0 0.3rem;
  font-size: 1.6rem;
}
.bandeau > p {
  margin: 0;
  opacity: 0.85;
  font-size: 0.95rem;
}
.bandeau .badge-poc {
  margin-top: 0.6rem;
  opacity: 1;
}

.bandeau .confidentialite {
  margin: 0.75rem auto 0;
  max-width: 480px;
  text-align: left;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}
.bandeau .confidentialite summary {
  color: #fff;
  text-align: center;
}
.bandeau .confidentialite p {
  color: rgba(255, 255, 255, 0.85);
}
.bandeau .confidentialite .modele {
  color: #ffe6a3;
  font-weight: 600;
  margin-bottom: 0.4rem;
  text-align: center;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
#app {
  max-width: 1400px;
}

.resultat-grille {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
.resultat-grille h3 {
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}
@media (max-width: 720px) {
  .resultat-grille {
    grid-template-columns: 1fr;
  }
}

.panneau {
  background: var(--panneau);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
}

.separateur {
  border: none;
  border-top: 1px solid var(--bordure);
  margin: 1.5rem 0;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 0.6rem;
}
.porte p {
  margin: 0 0 0.75rem;
}
.porte p:last-of-type {
  margin-bottom: 0;
}
.note {
  color: var(--muted);
  font-size: 0.85rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.champ {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  min-height: 44px;
  resize: vertical;
  background: var(--panneau);
  color: var(--texte);
}
.champ:focus,
.btn:focus,
a:focus,
input:focus {
  outline: 3px solid #7aa7ff;
  outline-offset: 1px;
}

.centre {
  text-align: center;
  margin: 1rem 0 0.5rem;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.7rem 1.4rem;
  min-height: 44px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

#form-code {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
#form-code .champ {
  flex: 1 1 220px;
}

.etat {
  min-height: 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.erreur {
  color: var(--haute);
  font-size: 0.88rem;
  min-height: 1.2rem;
  margin: 0.6rem 0 0;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}
.badge.sev-haute {
  background: var(--haute);
  color: #fff;
}
.badge.sev-moyenne {
  background: var(--moyenne);
  color: #fff;
}
.badge.sev-basse {
  background: var(--basse);
  color: #fff;
}
.badge-poc {
  background: rgba(255, 255, 255, 0.15);
  color: #ffe6a3;
}
.badge-succes {
  background: var(--succes-fond);
  color: var(--succes);
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.8rem;
}

.texte-surligne {
  white-space: pre-wrap;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.95rem;
  margin: 0.75rem 0 1.5rem;
}
mark {
  padding: 0.05rem 0.15rem;
  border-radius: 3px;
  position: relative;
  cursor: help;
}
mark.sev-haute {
  background: #fbdada;
}
mark.sev-moyenne {
  background: #fbe6c8;
}
mark.sev-basse {
  background: #e4e6ea;
}

mark:hover::after,
mark:focus-visible::after {
  content: attr(data-souci);
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 0.4rem;
  width: max-content;
  max-width: 280px;
  white-space: normal;
  background: var(--texte);
  color: var(--fond);
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  z-index: 10;
  pointer-events: none;
}
mark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.toggle summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}
.toggle summary::-webkit-details-marker {
  display: none;
}
.toggle summary::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  transition: transform 0.15s ease;
}
.toggle[open] summary::before {
  transform: rotate(90deg);
}

.confidentialite {
  margin-top: 0.75rem;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 0 0.85rem;
  background: var(--fond);
  text-align: center;
}
.confidentialite summary {
  padding: 0.65rem 0;
  font-size: 0.85rem;
}
.confidentialite p {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.extraits-toggle summary {
  font-size: 0.85rem;
  padding: 0.3rem 0;
}
.extraits-toggle .extraits {
  margin-top: 0.4rem;
}

.points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.points .vide {
  color: var(--muted);
  font-style: italic;
}

.point {
  border-left: 4px solid var(--basse);
  background: var(--fond);
  border-radius: 0 8px 8px 0;
  padding: 0.85rem 1rem;
}
.point.sev-haute {
  border-color: var(--haute);
}
.point.sev-moyenne {
  border-color: var(--moyenne);
}
.point.sev-basse {
  border-color: var(--basse);
}

.point h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-family: var(--police-texte);
  font-weight: 600;
}

.point .article {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--fond);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
}
.point .article .code {
  font-weight: 700;
  color: var(--accent);
}
.point .article a {
  margin-left: 0.4rem;
}
.point .article q {
  color: var(--muted);
}

.point .message {
  margin: 0 0 0.6rem;
}

.point .extraits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.point .extraits li {
  padding-left: 0.75rem;
  border-left: 2px solid var(--bordure);
  color: var(--texte);
  font-style: italic;
  font-size: 0.92rem;
}

.confiance {
  display: inline-block;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--bordure);
  color: var(--muted);
  white-space: nowrap;
}
.confiance-moyenne {
  color: var(--moyenne);
  border-color: var(--moyenne);
}
.confiance-faible {
  color: var(--haute);
  border-color: var(--haute);
}
p.confiance-seule {
  margin: 0;
}

.entete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.entete h2 {
  margin: 0;
}

.btn-secondaire {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-secondaire:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  filter: none;
}

.btn-texte {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  padding: 0.5rem;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}
.btn-texte:hover {
  color: var(--haute);
}

.historique-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.historique-liste {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.historique-item button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font: inherit;
  color: var(--texte);
  cursor: pointer;
  text-align: left;
}
.historique-item button:hover {
  border-color: var(--accent);
}
.historique-item .horodatage {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.historique-item .resume {
  font-weight: 600;
  font-size: 0.9rem;
}

.disclaimer {
  max-width: 900px;
  margin: 0 auto 2rem;
  padding: 1rem 1.5rem 0;
  border-top: 1px solid var(--bordure);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  :root {
    --texte: #eaeaf0;
    --muted: #9a9ca4;
    --fond: #14151a;
    --panneau: #1d1e24;
    --bordure: #2c2d34;
    --succes-fond: #163526;
  }
  mark.sev-haute {
    background: rgba(179, 38, 30, 0.35);
  }
  mark.sev-moyenne {
    background: rgba(161, 92, 0, 0.35);
  }
  mark.sev-basse {
    background: rgba(91, 100, 112, 0.35);
  }
}
