:root {
  --fond: #06070f;
  --surface: #0e1120;
  --texte: #f1f5f9;
  --discret: #94a3b8;
  --bord: rgba(255, 255, 255, 0.08);
  --accent: #00e5ff;
  --rouge: #00e5ff;
  --bleu: #7c4dff;
  --erreur: #ff5d73;
}


* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Lato', system-ui, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.55;
  padding: 0 16px 48px;
}

header, main {
  max-width: 1100px;
  margin: 0 auto;
}

header { padding: 40px 0 24px; text-align: center; }
header .sous-titre { max-width: 65ch; margin: 8px auto 0; }

h1, h2, h3 { font-family: 'Exo 2', sans-serif; text-transform: uppercase; letter-spacing: 1px; }
h1 { margin: 0 0 4px; font-size: 2rem; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 24px 0 6px; color: var(--accent); }

.sous-titre { margin: 0; color: var(--discret); }

h2, h3 { text-align: center; }

.panneau {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

form, .bloc, .explication {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: 16px;
  padding: 20px;
}

.champ { margin-bottom: 14px; }

.champ label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.champ input {
  width: 100%;
  padding: 8px 10px;
  font-size: 1rem;
  border: 1px solid var(--bord);
  border-radius: 6px;
  font-family: inherit;
  background: var(--fond);
  color: var(--texte);
}

.champ input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.boutons { display: flex; gap: 10px; }

button {
  flex: 1;
  padding: 10px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #06070f;
  cursor: pointer;
}

button.secondaire { background: rgba(255, 255, 255, 0.08); color: var(--texte); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.progression {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  margin-top: 14px;
  overflow: hidden;
}

#barre { height: 100%; width: 0; background: var(--accent); transition: width 0.1s; }

.etat { font-size: 0.85rem; color: var(--discret); margin: 8px 0 0; }
.erreur { color: var(--erreur); font-size: 0.9rem; margin: 0 0 12px; }

.resultats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-content: start;
}

.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.etiquette { font-size: 0.8rem; color: var(--discret); }
.valeur { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.visuel {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  background: var(--fond);
}

.legende { font-size: 0.85rem; color: var(--discret); margin: 10px 0 0; }

.pastille {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 2px;
  vertical-align: middle;
  margin: 0 4px 0 10px;
}

.pastille:first-child { margin-left: 0; }
.pastille.rouge { background: var(--rouge); }
.pastille.bleue { background: var(--bleu); }

.tableau-conteneur { max-height: 320px; overflow: auto; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--bord); }
th { position: sticky; top: 0; background: var(--surface); font-size: 0.85rem; }
th:first-child, td:first-child { text-align: left; }

section.bloc { margin-bottom: 20px; }

.explication p, .explication li { max-width: 75ch; }

.formule {
  font-family: "Cambria Math", Georgia, serif;
  font-size: 1.15rem;
  background: rgba(0, 229, 255, 0.06);
  border-left: 3px solid var(--accent);
  padding: 10px 16px;
  border-radius: 4px;
  overflow-x: auto;
}

@media (max-width: 760px) {
  .panneau { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
}

/* Centrage et agencement */


.bloc, .explication { text-align: center; }
.legende { text-align: center; }
.bloc canvas { margin: 0 auto; }
.tableau-conteneur { text-align: left; }
th, td, th:first-child, td:first-child { text-align: center; }

.explication p, .explication ul { margin-left: auto; margin-right: auto; }
.explication ul { display: table; text-align: left; padding-left: 20px; }
.formule { text-align: center; border-left: none; border-top: 2px solid var(--accent); max-width: 75ch; margin-left: auto; margin-right: auto; }
.explication { max-width: 860px; margin: 0 auto 20px; }

/* Mise en page du panneau de contrôle */
.panneau {
  grid-template-columns: 1fr;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

#form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 20px;
  align-items: end;
}

#form .champ { margin-bottom: 14px; }
#form .champ label { text-align: center; }
#form .champ input { text-align: center; }

#form .erreur,
#form .boutons,
#form .progression,
#form .etat { grid-column: 1 / -1; }

#form .boutons { justify-content: center; margin-top: 6px; }
#form .boutons button { flex: 0 1 200px; }
#form .etat { text-align: center; }

.resultats {
  grid-template-columns: repeat(3, 1fr);
}

.carte { align-items: center; text-align: center; justify-content: center; padding: 16px; }
.carte .valeur { margin-top: 4px; color: var(--accent); }

@media (max-width: 760px) {
  #form { grid-template-columns: 1fr; }
  .resultats { grid-template-columns: repeat(2, 1fr); }
}

.champ.case label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.champ.case input { width: auto; margin: 0; }
