@font-face { font-family: "Fredoka"; font-weight: 400; font-display: swap; src: url("fonts/fredoka-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 500 600; font-display: swap; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); }

/* ============================================================
   Crack Class — charte graphique
   Bleu marine #132a88 · Rouge #f1362d · Cyan #01c2ea · Jaune #fed001
   ============================================================ */
:root {
  --marine: #132a88;
  --marine-fonce: #0c1c5e;
  --rouge: #f1362d;
  --cyan: #01c2ea;
  --jaune: #fed001;
  --blanc: #ffffff;
  --gris: #5d6690;
  --bord: #dfe3f2;
  --rayon: 22px;
  --ombre: 0 10px 30px rgba(8, 18, 70, .28);
  --police: "Fredoka", "Nunito", "Segoe UI Rounded", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--police);
  background: var(--marine);
  color: var(--marine);
  line-height: 1.4;
}
a { color: var(--rouge); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Boutons ---------- */
button, .primary, .ghost, .danger {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 999px; border: 2px solid transparent;
  transition: transform .1s, filter .15s, background .15s;
}
button:active, .primary:active { transform: scale(.96); }
.primary { background: var(--rouge); color: var(--blanc); box-shadow: 0 4px 0 #b3211a; }
.primary:hover { filter: brightness(1.07); }
.ghost { background: var(--blanc); color: var(--marine); border-color: var(--bord); }
.ghost:hover { border-color: var(--marine); }
.danger { background: var(--blanc); color: var(--rouge); border-color: #f6c3c0; }
.small { padding: 6px 14px; font-size: .92rem; }
.wide { width: 100%; margin-top: 8px; }

/* ============================================================
   PAGE DE TITRE (index.php) — l'image entière, cliquable
   ============================================================ */
body.page-titre { background: var(--marine); overflow: hidden; }
.ecran-titre {
  position: fixed; inset: 0; display: block; cursor: pointer;
  background: var(--marine) url("titre.jpg") center / cover no-repeat;
  animation: apparition .8s ease-out;
}
@keyframes apparition { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
@media (max-aspect-ratio: 4/3) {   /* écran plutôt vertical : on montre l'image entière */
  .ecran-titre { background-size: contain; }
}

/* ============================================================
   FOND PAYSAGE (thématiques, jeu, admin)
   ============================================================ */
body.page-themes, body.page-jeu, body.page-admin {
  background: var(--marine) url("fond.jpg") center / cover no-repeat fixed;
}
.top-themes { max-width: 1150px; margin: 0 auto; }

/* ============================================================
   CHOIX DES THÉMATIQUES
   ============================================================ */
.accueil { max-width: 1150px; margin: 0 auto; padding: 6px 20px 60px; }
.intro {
  color: var(--blanc); text-shadow: 0 2px 10px rgba(8,18,70,.55); text-align: center; font-weight: 600;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem); margin: 0 0 26px;
}
.groupe { margin-bottom: 34px; }
.groupe-titre {
  display: inline-block; margin: 0 0 14px;
  color: var(--marine); background: var(--jaune);
  padding: 4px 18px; border-radius: 999px;
  font-size: 1.25rem; font-weight: 700; transform: rotate(-1.5deg);
}
.famille { font-size: .8rem; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .04em; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.tuile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 22px 20px; min-height: 150px;
  background: var(--blanc); color: var(--marine); text-decoration: none;
  border-radius: var(--rayon); box-shadow: var(--ombre);
  transition: transform .18s, box-shadow .18s;
}
.tuile::before {               /* pastille de couleur façon illustration */
  content: ""; position: absolute; right: -34px; bottom: -34px;
  width: 88px; height: 88px; border-radius: 50%; background: var(--c);
}
.tuile:hover { transform: translateY(-5px) rotate(-.6deg); box-shadow: 0 16px 36px rgba(8,18,70,.4); }
.tuile-nom { font-size: 1.4rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.tuile-desc { color: var(--gris); font-size: .98rem; }
.tuile-nb {
  margin-top: auto; align-self: flex-start;
  background: var(--marine); color: var(--blanc);
  padding: 4px 14px; border-radius: 999px; font-size: .88rem; font-weight: 600;
}
.vide { color: var(--blanc); text-align: center; }
.vide a { color: var(--jaune); }

/* ============================================================
   ÉCRAN DE JEU
   ============================================================ */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
}
.top h1 { margin: 0; text-align: center; }
.top form { margin: 0; }
.pastille-theme {
  background: var(--accent); padding: 8px 28px; border-radius: 999px;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem); font-weight: 700;
  box-shadow: var(--ombre); border: 3px solid var(--blanc);
}

.jeu {
  display: grid; grid-template-columns: 1fr 330px; gap: 22px;
  max-width: 1400px; margin: 0 auto; padding: 8px 22px 22px;
}
.carte-question {
  background: var(--blanc); border-radius: 28px; box-shadow: var(--ombre);
  padding: 26px 34px;
  display: flex; flex-direction: column; min-height: 72vh;
  position: relative; overflow: hidden;
}
.carte-question::after {       /* couronne jaune en filigrane */
  content: ""; position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  width: 70px; height: 44px; opacity: .9;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 70 44'%3E%3Cpath d='M8 14 L20 30 L35 8 L50 30 L62 14 L58 40 Q35 32 12 40 Z' fill='%23fed001'/%3E%3Ccircle cx='8' cy='12' r='5' fill='%23fed001'/%3E%3Ccircle cx='35' cy='6' r='5' fill='%23fed001'/%3E%3Ccircle cx='62' cy='12' r='5' fill='%23fed001'/%3E%3C/svg%3E") center / contain no-repeat;
}
.compteur {
  align-self: flex-start;
  background: var(--cyan); color: var(--marine);
  padding: 4px 14px; border-radius: 999px;
  font-weight: 700; font-size: .95rem; letter-spacing: .02em;
}
.question {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: clamp(2.2rem, 5.2vw, 4.6rem); font-weight: 700; line-height: 1.1;
  color: var(--marine); padding: 24px 0;
}
.question.entree { animation: entree .4s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes entree { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.nav { display: flex; justify-content: space-between; gap: 12px; }
.nav .primary { font-size: 1.25rem; padding: 14px 30px; }
.aide { text-align: center; color: var(--gris); font-size: .82rem; margin: 14px 0 0; }

.outils { display: flex; flex-direction: column; gap: 16px; }
.bloc {
  background: var(--blanc); border-radius: var(--rayon); padding: 18px;
  box-shadow: var(--ombre);
}
.bloc h2 {
  margin: 0 0 10px; font-size: 1rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--marine);
}
.bloc .ligne { flex-wrap: nowrap; }
.bloc .ligne select { flex: 1; min-width: 96px; }
.bloc .ligne button { padding-left: 16px; padding-right: 16px; }
.chrono {
  font-size: 3.4rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums;
  margin-bottom: 12px; padding: 6px 0;
  background: var(--marine); color: var(--jaune); border-radius: 16px;
}
.chrono.urgent { background: var(--rouge); color: var(--blanc); animation: pulse 1s infinite; }
.chrono.fini { background: var(--rouge); color: var(--blanc); }
@keyframes pulse { 50% { transform: scale(1.04); } }
.lettres { display: flex; flex-wrap: wrap; gap: 6px; min-height: 48px; margin-bottom: 10px; }
.lettre {
  width: 40px; height: 46px; display: grid; place-items: center;
  background: var(--jaune); color: var(--marine);
  border-radius: 10px; box-shadow: 0 4px 0 #c9a400;
  font-weight: 700; font-size: 1.45rem;
}
.muet { color: var(--gris); font-size: .88rem; }
.liste {
  grid-column: 1 / -1; background: var(--blanc); border-radius: var(--rayon);
  padding: 22px 34px; box-shadow: var(--ombre);
}
.liste[hidden] { display: none; }
.liste h2 { margin-top: 0; }
.liste ol { columns: 2; column-gap: 40px; font-size: 1.2rem; }
.liste li { margin-bottom: 6px; break-inside: avoid; }
.liste li::marker { color: var(--rouge); font-weight: 700; }

/* Plein écran (vidéoprojecteur) */
:fullscreen .question { font-size: clamp(2.6rem, 6.2vw, 6rem); }

/* ============================================================
   FORMULAIRES / ADMIN
   ============================================================ */
body.page-admin .top { background: var(--marine); color: var(--blanc); border-bottom: 6px solid var(--rouge); }
body.page-admin .top h1 { font-size: 1.4rem; flex: 1; }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.check { display: flex; align-items: center; gap: 6px; font-size: .95rem; margin-top: 8px; font-weight: 400; }
select, input[type=text], input[type=password], input[type=number], textarea {
  font: inherit; padding: 9px 12px; border: 2px solid var(--bord); border-radius: 12px;
  background: var(--blanc); color: var(--marine);
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--cyan); }
textarea { width: 100%; resize: vertical; }
label { display: block; font-weight: 600; margin-bottom: 14px; }
label input[type=text], label input[type=password], label textarea { display: block; width: 100%; margin-top: 6px; font-weight: 400; }
.admin { max-width: 1000px; margin: 0 auto; padding: 26px 20px; }
.carte { background: var(--blanc); border-radius: var(--rayon); padding: 26px; box-shadow: 0 4px 16px rgba(19,42,136,.1); }
.carte h2 { margin-top: 0; }
.etroite { max-width: 420px; margin: 40px auto; }
.entete { justify-content: space-between; margin-bottom: 14px; }
.entete h2 { margin: 0; color: var(--blanc); background: var(--marine); padding: 4px 18px; border-radius: 999px; }
.tableau {
  width: 100%; border-collapse: collapse; background: var(--blanc);
  border-radius: var(--rayon); overflow: hidden; box-shadow: 0 4px 16px rgba(19,42,136,.1);
}
.tableau th, .tableau td { padding: 12px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: middle; }
.tableau th { background: var(--marine); color: var(--blanc); font-size: .88rem; font-weight: 600; }
.tableau small { color: var(--gris); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions form { margin: 0; }
.pastille { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--bord); }
.choix-couleur { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.choix-couleur .lbl { font-weight: 600; margin-right: 4px; }
.swatch { margin: 0; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span {
  display: block; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--blanc); box-shadow: 0 0 0 2px var(--bord);
}
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--marine); }
.swatch input:focus-visible + span { box-shadow: 0 0 0 3px var(--cyan); }
.alerte { background: #fdecea; color: #b3211a; padding: 10px 14px; border-radius: 12px; }
.succes { background: #e3f8fd; color: var(--marine); padding: 10px 14px; border-radius: 12px; }
code { background: #eef1fa; padding: 1px 6px; border-radius: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .jeu { grid-template-columns: 1fr; padding: 8px 12px 16px; }
  .carte-question { min-height: 55vh; padding: 22px; }
  .liste ol { columns: 1; }
  .top { padding: 10px 12px; }
  .pastille-theme { padding: 6px 16px; }
  body.page-jeu { background-attachment: scroll; background-position: left top; }
  #btnFs, .aide, .carte-question::after { display: none; }
  .top-jeu .ghost { white-space: nowrap; }
  .nav button { white-space: nowrap; padding-left: 16px; padding-right: 16px; }
  .nav .primary { font-size: 1.05rem; padding: 12px 18px; }
}
