/* Socle commun : polices système, grandes zones tactiles, barre de borne, fenêtres modales. */

:root {
  --encre: #1d2433;
  --encre-douce: #4a5368;
  --fond: #f6f1e6;
  --carton: #fffdf8;
  --trait: #e2d8c3;
  --accent: #e0662b;
  --accent-fonce: #b84b16;
  --rouge: #d62839;
  --bleu: #1f5fd6;
  --vert: #138a4b;
  --rayon: 18px;
  --ombre: 0 10px 30px rgba(40, 30, 10, 0.12);
  --tactile: 56px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  color: var(--encre);
  background: var(--fond);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; }
body.defilable { overflow: auto; }

.app {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cadre-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
}

.entete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.4rem 0.5rem;
}
.entete h1 { margin: 0; font-size: clamp(1.35rem, 2.4vw, 2.3rem); letter-spacing: -0.01em; }
.progression { font-weight: 700; color: var(--encre-douce); font-size: clamp(1rem, 1.4vw, 1.3rem); white-space: nowrap; }

.contenu { overflow: auto; min-height: 0; }

.barre {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--trait);
  background: rgba(255, 253, 248, 0.85);
}

.btn {
  font: inherit;
  font-weight: 700;
  min-height: var(--tactile);
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: clamp(1rem, 1.3vw, 1.25rem);
  transition: transform 0.08s ease, background 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; cursor: default; transform: none; }
.btn-principal { background: var(--accent); color: #fff; box-shadow: 0 4px 0 var(--accent-fonce); }
.btn-principal:active { box-shadow: 0 1px 0 var(--accent-fonce); }
.btn-secondaire { background: var(--carton); color: var(--encre); border-color: var(--encre); }
.btn-grand { min-height: 68px; padding: 0.9rem 2rem; font-size: clamp(1.1rem, 1.6vw, 1.5rem); }
.btn-barre { background: transparent; color: var(--encre); border-color: var(--trait); min-height: 48px; font-size: 1rem; }
.btn-lien { margin-left: auto; }
.btn:focus-visible, .pave-touche:focus-visible { outline: 3px solid var(--bleu); outline-offset: 3px; }

/* Fenêtres modales (pop-up) */
.modale-fond {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 30, 0.55);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 50;
  animation: apparition 0.15s ease;
}
.modale {
  position: relative;
  background: var(--carton);
  color: var(--encre);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 1.6rem 1.6rem 1.4rem;
  width: min(560px, 100%);
  max-height: calc(100dvh - 2rem);
  overflow: auto;
}
.modale-large .modale { width: min(1200px, 100%); }
.modale h2 { margin: 0 2.5rem 0.8rem 0; font-size: clamp(1.3rem, 2vw, 1.9rem); }
.modale-fermer {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: var(--tactile);
  height: var(--tactile);
  border-radius: 50%;
  border: 2px solid var(--trait);
  background: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--encre);
}
@keyframes apparition { from { opacity: 0; } to { opacity: 1; } }

.inactivite { text-align: center; }
.inactivite .compte { font-size: 1.6em; color: var(--accent-fonce); }

/* Pavé numérique du code médiation */
.mediation { text-align: center; }
.pave-ecran {
  font-size: 2.2rem;
  letter-spacing: 0.4em;
  min-height: 3.2rem;
  border: 2px solid var(--trait);
  border-radius: 12px;
  margin: 0.5rem auto 1rem;
  max-width: 280px;
  padding: 0.3rem;
}
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; max-width: 320px; margin: 0 auto; }
.pave-touche {
  font: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  min-height: 64px;
  border-radius: 14px;
  border: 2px solid var(--trait);
  background: #fff;
  color: var(--encre);
  cursor: pointer;
}
.pave-ok { background: var(--encre); color: #fff; border-color: var(--encre); }
.pave-message { min-height: 1.5em; font-weight: 700; color: var(--accent-fonce); }
.mediation-actions { display: grid; gap: 0.8rem; margin-top: 1rem; }

@media (max-width: 700px) {
  .entete { padding: 0.7rem 0.9rem 0.3rem; }
  .barre { gap: 0.4rem; padding: 0.45rem 0.6rem calc(0.45rem + env(safe-area-inset-bottom)); }
  .btn-barre { min-height: 44px; padding: 0.4rem 0.8rem; font-size: 0.92rem; }
  .btn-plein-ecran { display: none; }
}
