/* ==========================================================================
   Atelier Numérique — feuille de style commune
   ========================================================================== */

:root {
  --bg: #fff7ee;
  --surface: #ffffff;
  --ink: #1e1b3a;
  --muted: #5c5878;

  --violet: #6d4aff;  --violet-soft: #ece6ff;
  --coral: #ff6b57;   --coral-soft: #ffe4de;
  --teal: #0fb3a2;    --teal-soft: #d4f5f0;
  --yellow: #ffc53d;  --yellow-soft: #fff1c9;
  --blue: #3a86ff;    --blue-soft: #dde9ff;
  --pink: #ff5ca8;    --pink-soft: #ffe0ef;
  --green: #1fae5b;   --green-soft: #d8f6e4;
  --red: #e5484d;     --red-soft: #ffe1e1;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);

  --font-title: "Fredoka", "Nunito", system-ui, sans-serif;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html { font-size: 100%; scroll-behavior: smooth; }
html[data-size="2"] { font-size: 112.5%; }
html[data-size="3"] { font-size: 125%; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(30, 27, 58, .08) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }

h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
a { color: var(--violet); }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--ink);
}
.site-header .inner { display: flex; align-items: center; gap: 12px; min-height: 70px; flex-wrap: wrap; }

.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-title); font-weight: 700; font-size: 1.3rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.logo b { color: var(--violet); font-weight: 700; }
.logo-mark { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 34px; height: 34px; transition: transform .3s; }
.logo-mark span { border: 2px solid var(--ink); border-radius: 6px; }
.logo-mark span:nth-child(1) { background: var(--coral); }
.logo-mark span:nth-child(2) { background: var(--yellow); }
.logo-mark span:nth-child(3) { background: var(--teal); }
.logo-mark span:nth-child(4) { background: var(--violet); border-radius: 50%; }
.logo:hover .logo-mark { transform: rotate(-12deg) scale(1.08); }

.main-nav { display: flex; gap: 4px; margin-left: auto; }
.main-nav a {
  padding: .45em .9em; border-radius: 999px; border: 2px solid transparent;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: .98rem; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.main-nav a:hover { background: var(--violet-soft); }
.main-nav a.active { background: var(--yellow); border-color: var(--ink); }

.tools { display: flex; gap: 6px; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  min-width: 44px; height: 44px; padding: 0 10px;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 12px;
  font-family: var(--font-title); font-weight: 600; cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.tool-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.tool-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.tool-btn .a-small { font-size: .8rem; }
.tool-btn .a-big { font-size: 1.25rem; }

@media (max-width: 860px) {
  .main-nav { order: 3; width: 100%; margin: 0 0 10px; overflow-x: auto; scrollbar-width: none; }
  .tools { margin-left: auto; }
}

/* --------------------------------------------------------------------------
   Pied de page
   -------------------------------------------------------------------------- */
.site-footer { margin-top: 64px; border-top: 2px solid var(--ink); background: var(--surface); padding: 28px 0; font-size: .95rem; }
.site-footer .inner { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; justify-content: space-between; }
.site-footer p { margin: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--violet); text-decoration: underline; cursor: pointer; font-weight: 700; }

/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */
.btn {
  --b: var(--surface); --c: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .75em 1.35em; min-height: 48px;
  background: var(--b); color: var(--c);
  border: 2px solid var(--ink); border-radius: 14px;
  font-family: var(--font-title); font-weight: 600; font-size: 1.05rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; user-select: none;
  box-shadow: var(--shadow);
  transition: transform .1s ease, box-shadow .1s ease, background .15s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }
.btn-primary { --b: var(--violet); --c: #fff; }
.btn-coral   { --b: var(--coral);  --c: #fff; }
.btn-teal    { --b: var(--teal);   --c: #fff; }
.btn-yellow  { --b: var(--yellow); }
.btn-green   { --b: var(--green);  --c: #fff; }
.btn-red     { --b: var(--red);    --c: #fff; }
.btn-sm { padding: .45em .9em; min-height: 40px; font-size: .95rem; border-radius: 11px; box-shadow: 3px 3px 0 var(--ink); }
.btn-lg { padding: .95em 1.7em; font-size: 1.2rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.btn-row.center { justify-content: center; }

/* --------------------------------------------------------------------------
   Cartes et panneaux
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 24px;
}
.panel {
  background: var(--surface); border: 2px solid var(--ink); border-radius: 24px;
  box-shadow: var(--shadow-lg); padding: clamp(18px, 3vw, 32px);
}

.tag {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .15em .7em; border-radius: 999px; border: 2px solid var(--ink);
  font-size: .8rem; font-weight: 800; background: var(--surface); white-space: nowrap;
}
.tag.debutant { background: var(--green-soft); }
.tag.moyen { background: var(--yellow-soft); }
.tag.avance { background: var(--coral-soft); }

/* --------------------------------------------------------------------------
   En-tête des pages d'activité
   -------------------------------------------------------------------------- */
.page-hero { padding: 36px 0 28px; }
.back-link {
  display: inline-flex; align-items: center; gap: .4em; margin-bottom: 18px;
  font-weight: 800; color: var(--ink); text-decoration: none;
  padding: .3em .8em; border-radius: 999px; background: var(--surface); border: 2px solid var(--ink);
}
.back-link:hover { background: var(--yellow-soft); }
.page-hero .title-row { display: flex; align-items: center; gap: 18px; }
.page-hero .emoji-badge {
  flex: none; display: grid; place-items: center;
  width: 76px; height: 76px; border-radius: 22px; border: 2px solid var(--ink);
  background: var(--c, var(--yellow)); box-shadow: var(--shadow); font-size: 2.4rem;
  transform: rotate(-6deg);
}
.page-hero h1 { margin: 0; }
.page-hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 720px; margin: 14px 0 0; }

/* --------------------------------------------------------------------------
   Étapes (stepper)
   -------------------------------------------------------------------------- */
.stepper { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.step-pill {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .35em .85em; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--surface); font-weight: 800; font-size: .92rem; cursor: pointer;
}
.step-pill .num {
  display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink); font-size: .8em;
}
.step-pill.current { background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); }
.step-pill.done { background: var(--green-soft); }
.step-pill.done .num { background: var(--green); color: #fff; }

/* --------------------------------------------------------------------------
   Messages de retour
   -------------------------------------------------------------------------- */
.feedback {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; border-radius: 16px; border: 2px solid var(--ink); margin-top: 18px;
  animation: pop-in .3s ease;
}
.feedback .fb-icon { font-size: 1.8rem; line-height: 1; }
.feedback h3 { margin: 0 0 .25em; }
.feedback p:last-child, .feedback ul:last-child { margin-bottom: 0; }
.feedback.ok { background: var(--green-soft); }
.feedback.ko { background: var(--red-soft); }
.feedback.info { background: var(--blue-soft); }
.feedback.tip { background: var(--yellow-soft); }

.instruction {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  font-size: 1.2rem; font-weight: 700;
}
.instruction .big-emoji { font-size: 2.2rem; }

/* Barre de progression */
.progress { height: 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--surface); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--teal); border-right: 2px solid var(--ink); transition: width .4s ease; }

/* Boutons de choix (quiz) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px 16px; min-height: 60px;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--ink); cursor: pointer; font-weight: 700; font-size: 1.05rem;
  transition: transform .1s, box-shadow .1s, background .15s;
}
.choice:hover:not(:disabled) { background: var(--violet-soft); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.choice .letter {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  border: 2px solid var(--ink); background: var(--bg); font-family: var(--font-title);
}
.choice:disabled { cursor: default; }
.choice.correct { background: var(--green-soft); }
.choice.correct .letter { background: var(--green); color: #fff; }
.choice.wrong { background: var(--red-soft); }
.choice.wrong .letter { background: var(--red); color: #fff; }
.choice.dim { opacity: .55; }

/* Statistiques */
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  display: flex; flex-direction: column; align-items: center; min-width: 96px;
  padding: 8px 14px; border: 2px solid var(--ink); border-radius: 14px; background: var(--surface);
}
.stat b { font-family: var(--font-title); font-size: 1.5rem; line-height: 1.1; }
.stat span { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Écran de victoire */
.win-screen { text-align: center; padding: 20px 0; }
.win-screen .trophy { font-size: 5rem; line-height: 1; display: inline-block; animation: bounce 1.2s ease infinite; }
.win-screen .stats { justify-content: center; margin: 20px 0 26px; }

/* --------------------------------------------------------------------------
   Fun : affiches de jeux (sur fond de nuit)
   -------------------------------------------------------------------------- */
.night {
  position: relative; color: #f0e6cf;
  background: radial-gradient(ellipse at 20% 0%, #2b2766 0, #12122e 55%, #0b0b1f 100%);
}
.night::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 62%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 47% 12%, #fff, transparent), radial-gradient(1px 1px at 63% 48%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 78% 22%, #fff, transparent), radial-gradient(1px 1px at 88% 70%, #fff, transparent),
    radial-gradient(1px 1px at 6% 82%, #fff, transparent), radial-gradient(1.5px 1.5px at 38% 88%, #fff, transparent),
    radial-gradient(1px 1px at 70% 90%, #fff, transparent), radial-gradient(1px 1px at 95% 40%, #fff, transparent);
}
.night > * { position: relative; }

.poster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 24px; }
.poster {
  display: grid; grid-template-columns: 150px 1fr; overflow: hidden; min-height: 230px;
  border: 2px solid #000; border-radius: 24px; background: var(--pbg, #1b1b3a); color: #f0e6cf; text-decoration: none;
  box-shadow: 6px 6px 0 #000; transition: transform .15s ease, box-shadow .15s ease;
}
a.poster:hover { transform: translate(-3px, -3px) rotate(-.4deg); box-shadow: 10px 10px 0 #000; }
a.poster:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 #000; }
.poster-art { display: grid; place-items: center; border-right: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); }
.art-emoji { font-size: 4rem; filter: drop-shadow(0 0 18px rgba(255, 255, 255, .25)); }
.art-moon {
  position: relative; width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8dc, #e8cf8a 60%, #c9a24a);
  box-shadow: 0 0 44px rgba(240, 214, 140, .6); animation: float 5s ease-in-out infinite;
}
.art-moon::after { content: "⛓️"; position: absolute; right: -14px; bottom: -8px; font-size: 2rem; transform: rotate(-20deg); }
.poster-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px 24px; }
.poster-kicker { padding: .12em .7em; border-radius: 999px; background: var(--pac, #f3d98b); color: #0c0e1f; font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.poster h3 { margin: 0; font-size: 1.7rem; color: var(--pac, #f3d98b); }
.poster p { margin: 0; color: #c9cbe6; font-size: 1rem; }
.poster-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.poster-chips span { padding: .1em .65em; border: 1.5px solid rgba(240, 230, 207, .4); border-radius: 999px; font-size: .8rem; font-weight: 700; }
.poster-play {
  margin-top: auto; padding: .55em 1.2em; border: 2px solid #000; border-radius: 12px; background: var(--pac, #f3d98b);
  color: #0c0e1f; font-family: var(--font-title); font-weight: 600; font-size: 1.05rem; box-shadow: 3px 3px 0 #000;
}
.poster-soon { --pbg: transparent; border-style: dashed; border-color: rgba(240, 230, 207, .35); box-shadow: none; }
.poster-soon h3 { color: #f0e6cf; }
.poster-soon .poster-kicker { background: rgba(240, 230, 207, .2); color: #f0e6cf; }
@media (max-width: 560px) {
  .poster { grid-template-columns: 1fr; }
  .poster-art { min-height: 130px; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes pop-in { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-10px) rotate(var(--r, 0deg)); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 197, 61, .9); } 50% { box-shadow: 0 0 0 8px rgba(255, 197, 61, 0); } }
.shake { animation: shake .4s ease; }

@media print {
  .site-header, .site-footer, .back-link, .btn, .btn-row { display: none !important; }
  body { background: #fff; }
  .panel, .card { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
