/* ==========================================================
   Les mathématiques pour les jeunes : le style des activités.
   Celui des leçons (Physics-for-kids/lesson.css, Mathematics/multiples/lcm.html)
   et de la salle d'entraînement : Inter pour le texte, Source Serif 4 pour les
   titres et les grands nombres, filets fins, couleurs atténuées, boutons plats.
   En haut, le lien de retour et la langue ; puis un bandeau sombre, la première
   diapositive des leçons, sur l'illustration de l'activité (son image de fond est
   donnée par la page : style="background-image: url(../cards/….jpg)").
   Les noms des couleurs (--sky, --blue, --sticker…) restent ceux d'avant : les
   styles propres à chaque page s'en servent.
   ========================================================== */
:root {
  --ink: #1a2232;
  --muted: #5d6779;
  --line: #dde3ec;
  --bg: #eef1f5;
  --paper: #ffffff;
  --sky: #f5f7fa;          /* les panneaux clairs dans une carte */
  --accent: #2552a3;
  --red: #b3362b;
  --blue: #2552a3;
  --purple: #6a4fa8;
  --orange: #b4531f;
  --green: #1f7a55;
  --sticker: #efd58f;      /* l'or des leçons : ce qui est choisi, ce qui est commun */
  --mint: #e4f1ea;
  --rose: #fbeceb;
  --lilac: #ece8f6;
  --note: #fbf1d6;
  --space: #0a0f1d;
  --bar: var(--accent);
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
/* hidden cache toujours, même un élément dont la classe fixe display. */
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
/* Les deux langues sont dans la page ; on cache celle qui n'est pas choisie. */
html[lang="en"] [lang="fr"], html[lang="fr"] [lang="en"] { display: none !important; }
a { color: var(--accent); font-weight: 600; }
b, strong { font-weight: 650; }

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) clamp(12px, 3vw, 28px) max(28px, env(safe-area-inset-bottom));
}

/* En haut : le retour aux mathématiques, et la langue. */
header.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 12px; }
.back { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; }
.back:hover, .back:focus-visible { color: var(--ink); text-decoration: underline; }
.settings { display: flex; gap: 8px; margin-left: auto; align-items: center; }

/* Le bandeau du titre, sur l'illustration de l'activité, à droite. La page donne l'image
   (style="background-image: …") ; le bandeau ne la peint pas lui-même (taille 0) : ::after la
   reprend (inherit) dans un cadre de 42 % à droite, recadrée, et ::before la fond dans le sombre.
   Ainsi un titre sur deux lignes garde toujours la partie sombre. */
.hero {
  position: relative; isolation: isolate; overflow: hidden; margin: 14px 0 20px; padding: clamp(22px, 3.2vw, 36px);
  color: #f3f5f9; background-color: var(--space); background-repeat: no-repeat; background-size: 0 0;
  border: 1px solid #1c2337; border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 14px 34px -12px rgba(16, 24, 40, .25);
}
.hero::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 42%; z-index: -2;
  background-image: inherit; background-repeat: no-repeat; background-size: cover; background-position: center;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(8, 12, 24, 1) 0%, rgba(8, 12, 24, 1) 58%, rgba(8, 12, 24, .55) 66%, rgba(8, 12, 24, .1) 80%, rgba(8, 12, 24, 0) 100%);
}
.kicker { margin: 0 0 10px; font-size: 13px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: #9fb6e6; }
.hero h1 { margin: 0; max-width: 56%; font-family: var(--serif); font-size: clamp(32px, 4.8vw, 50px); line-height: 1.05; font-weight: 600; letter-spacing: -.015em; color: #fff; }
.hero .sub { margin: 10px 0 0; max-width: 56%; font-family: var(--serif); font-style: italic; font-size: clamp(17px, 1.9vw, 21px); line-height: 1.35; color: #f0c27a; }

/* Boutons plats, filet fin, comme dans les leçons. */
button, input, select { font: inherit; color: inherit; }
.chunky {
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink);
  padding: 6px 14px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, background .12s;
  touch-action: manipulation;
}
.chunky:hover:not(:disabled) { border-color: #b8c3d4; background: var(--sky); }
.chunky:focus-visible, .num-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chunky[aria-pressed="true"] { background: #e8eefa; border-color: var(--accent); color: var(--accent); }
.chunky:disabled { opacity: .45; cursor: not-allowed; }
.chunky.go { background: var(--ink); border-color: var(--ink); color: #fff; }
.chunky.go:hover:not(:disabled) { background: #2a3550; border-color: #2a3550; }
.lang { min-width: 46px; padding: 6px 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.center { justify-content: center; }
.label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Les cartes blanches. */
.card {
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 12px 28px -16px rgba(16, 24, 40, .14);
  padding: clamp(16px, 2.6vw, 28px);
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 26px; line-height: 1.2; font-weight: 600; }
.card h3 { margin: 18px 0 4px; font-size: 18px; font-weight: 650; }
.card p { margin: 6px 0; }
.card ul, .card ol { margin: 6px 0; padding-left: 1.3em; }
.card a, .note a { color: var(--accent); font-weight: 600; }
.center { text-align: center; }

/* Les nombres : chiffres de même largeur ; les grands en Source Serif. */
.big { font-family: var(--serif); font-size: clamp(36px, 7vw, 56px); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hl { padding: 0 .3em; border-radius: 5px; background: var(--note); font-weight: 650; white-space: nowrap; }
.num-input {
  width: 4.2em; height: 1.9em; text-align: center;
  font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: #fff; border: 1px solid #b8c3d4; border-radius: 8px;
  -moz-appearance: textfield; appearance: textfield;
}
.num-input:focus { border-color: var(--accent); }
.num-input::-webkit-outer-spin-button, .num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-input.small { width: 3.4em; height: 1.7em; font-size: 22px; }
.num-input:disabled { background: var(--sky); }

/* Réponses : juste, pas encore, conseil. */
.feedback { min-height: 1.6em; margin: 12px 0 0; font-weight: 650; text-align: center; }
.good { color: var(--green); }
.bad { color: var(--red); }
.info { color: var(--ink); }

/* Le pense-bête : un panneau clair, un filet à gauche, comme les notes des leçons. */
.note {
  margin-bottom: 18px; padding: 14px 18px 16px;
  background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0;
}
.note h2 { margin: 0 0 6px; font-size: 13px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.note p, .note ul { margin: 4px 0; }
.note ul { padding-left: 1.2em; }
.note li { margin-bottom: 3px; }

footer { margin-top: 28px; font-size: 14px; color: var(--muted); }
footer p { margin: 8px 0 0; }
footer a { color: var(--accent); }

@media (max-width: 720px) {
  body { font-size: 16px; }
  /* Sur un téléphone, l'illustration en haut du bandeau, le texte dessous. */
  .hero { padding-top: 46vw; }
  .hero::after { left: 0; width: auto; bottom: auto; height: 56vw; }
  .hero::before { background: linear-gradient(180deg, rgba(8, 12, 24, 0) 0%, rgba(8, 12, 24, .15) 24vw, rgba(8, 12, 24, .92) 46vw, rgba(8, 12, 24, 1) 56vw); }
  .hero h1, .hero .sub { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chunky { transition: none; }
}
