/* ============================================================
   Crazy Math — style.css
   Joyeux, arrondi, pastel vitaminé. Mobile-first, tactile d'abord.
   ============================================================ */

/* ---------- Fontes auto-hébergées ---------- */
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../assets/fonts/baloo2-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../assets/fonts/baloo2-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/fredoka-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/fredoka-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF;
}

/* ---------- Variables ---------- */
:root {
  --cream: #FFF8F0;
  --violet: #7C5CFC;
  --violet-deep: #5A3EE0;   /* liens & texte violet : contraste AA sur crème */
  --violet-soft: #EDE8FF;
  --coral: #FF8A5C;
  --coral-deep: #E05A28;
  --coral-soft: #FFE9DE;
  --mint: #4ECDC4;
  --mint-deep: #17958B;
  --mint-soft: #DFF7F5;
  --star: #FFD93D;
  --star-deep: #B98A00;
  --star-soft: #FFF4CC;
  --rose: #FF7EB6;
  --rose-deep: #D6407F;
  --rose-soft: #FFE4F0;
  --ink: #2D2A45;
  --ink-soft: #5E5A7D;
  --white: #FFFFFF;
  --accent: var(--violet);
  --accent-dark: var(--violet-deep);
  --charcoal: var(--white);  /* le cookie banner du gabarit global devient clair ici */

  --font-display: 'Baloo 2', 'Arial Rounded MT Bold', ui-rounded, sans-serif;
  --font-body: 'Fredoka', 'Trebuchet MS', ui-rounded, sans-serif;

  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow-card: 0 10px 30px rgba(45, 42, 69, 0.10);
}

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

/* L'attribut hidden doit toujours gagner, même sur les éléments en display:flex */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  /* Petits confettis pastel très discrets en fond */
  background-image:
    radial-gradient(circle 3px at 12% 20%, rgba(124, 92, 252, .14) 99%, transparent),
    radial-gradient(circle 4px at 82% 12%, rgba(255, 138, 92, .16) 99%, transparent),
    radial-gradient(circle 3px at 65% 45%, rgba(78, 205, 196, .18) 99%, transparent),
    radial-gradient(circle 4px at 28% 72%, rgba(255, 217, 61, .22) 99%, transparent),
    radial-gradient(circle 3px at 90% 68%, rgba(255, 126, 182, .16) 99%, transparent);
  background-size: 900px 900px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 .5em;
}

a { color: var(--violet-deep); }

button { font-family: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--white);
  padding: .75rem 1.25rem;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: 10000;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--violet-deep);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  max-width: 1100px;
  margin: 0 auto;
}

.header__logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.header__logo-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--violet);
  color: var(--white);
  border-radius: 14px;
  font-size: 1.3rem;
  transform: rotate(-6deg);
  box-shadow: 0 4px 0 var(--violet-deep);
}

.header__nav { display: flex; gap: .5rem; }

.header__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: .4rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--violet-soft);
  transition: transform .15s, border-color .15s;
}
.header__nav a:hover { transform: translateY(-2px); border-color: var(--violet); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: clamp(2rem, 6vw, 4rem) 1rem 1rem;
  max-width: 800px;
  margin: 0 auto;
  overflow: visible;
}

.hero__title {
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  font-weight: 800;
}

.hero__title-word {
  display: inline-block;
  color: var(--violet);
  transform: rotate(-2deg);
}
.hero__title-word--coral { color: var(--coral-deep); transform: rotate(2deg); }
.hero__title-word--mint { color: var(--mint-deep); transform: rotate(-1deg); }

.hero__greeting {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--ink-soft);
  font-weight: 500;
  margin: 0;
}

/* Symboles flottants décoratifs */
.hero__deco {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  opacity: .5;
  user-select: none;
  pointer-events: none;
  animation: floaty 6s ease-in-out infinite;
}
.hero__deco--1 { top: 8%; left: 2%; color: var(--coral); animation-delay: 0s; }
.hero__deco--2 { top: 20%; right: 4%; color: var(--mint); animation-delay: -1.5s; }
.hero__deco--3 { bottom: 10%; left: 8%; color: var(--star-deep); animation-delay: -3s; }
.hero__deco--4 { bottom: 24%; right: 10%; color: var(--rose); animation-delay: -4.5s; }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-14px) rotate(8deg); }
}

/* ---------- Sections ---------- */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2.5rem);
}

.section__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  display: flex;
  align-items: center;
  gap: .6rem;
}

.section__title::after {
  content: '';
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    -45deg,
    var(--violet-soft) 0 12px,
    transparent 12px 24px
  );
}

/* ---------- Avatar ---------- */
.avatar__intro { color: var(--ink-soft); margin-top: 0; }

.avatar__grid {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin: 1rem 0 1.5rem;
}

.avatar__choice {
  width: 72px;
  height: 72px;
  font-size: 2.2rem;
  border-radius: 50%;
  border: 3px solid transparent;
  background: var(--white);
  box-shadow: 0 4px 0 rgba(45, 42, 69, .08);
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.avatar__choice:hover { transform: translateY(-4px) rotate(-4deg); }
.avatar__choice--selected {
  border-color: var(--violet);
  background: var(--violet-soft);
  box-shadow: 0 4px 0 var(--violet);
}

.avatar__name { display: flex; flex-direction: column; gap: .35rem; max-width: 340px; }

.avatar__name label { font-weight: 600; }

.avatar__name input {
  font-family: inherit;
  font-size: 1.1rem;
  padding: .7rem 1rem;
  min-height: 48px;
  border: 2px solid var(--violet-soft);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--ink);
}
.avatar__name input:focus { border-color: var(--violet); outline: none; }

.avatar__name small { color: var(--ink-soft); }

/* ---------- Sélecteur d'opération ---------- */
.op-switch {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 0 0 1.25rem;
}

.op-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 48px;
  padding: .4rem 1.1rem;
  border-radius: 999px;
  border: 2px solid var(--violet-soft);
  background: var(--white);
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.op-switch__btn:hover { transform: translateY(-2px); border-color: var(--violet); }

.op-switch__symbol {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--violet-soft);
  color: var(--violet-deep);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}

.op-switch__btn--active {
  background: var(--violet);
  border-color: var(--violet);
  color: var(--white);
  box-shadow: 0 4px 0 var(--violet-deep);
}
.op-switch__btn--active .op-switch__symbol { background: rgba(255, 255, 255, .25); color: var(--white); }

/* ---------- Progression globale ---------- */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.progress-bar__track {
  flex: 1;
  height: 18px;
  background: var(--white);
  border: 2px solid var(--star-soft);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--star), var(--coral));
  transition: width .6s ease;
}

.progress-bar__label { font-weight: 600; white-space: nowrap; }

/* ---------- Carte des tables ---------- */
.map__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.map__item {
  animation: pop-in .45s ease backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(.85) translateY(12px); }
  to { opacity: 1; transform: none; }
}

.card {
  width: 100%;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow-card), 0 6px 0 var(--tone-deep, var(--violet));
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-5px) rotate(-1deg); }
.card:active { transform: translateY(2px); box-shadow: var(--shadow-card), 0 2px 0 var(--tone-deep, var(--violet)); }

.card--violet { --tone-deep: var(--violet); background: var(--violet-soft); }
.card--coral  { --tone-deep: var(--coral);  background: var(--coral-soft); }
.card--mint   { --tone-deep: var(--mint);   background: var(--mint-soft); }
.card--star   { --tone-deep: var(--star);   background: var(--star-soft); }
.card--rose   { --tone-deep: var(--rose);   background: var(--rose-soft); }

.card__num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.8rem; /* chiffres ≥ 40px */
  line-height: 1;
}

.card__label { font-weight: 600; }

.card__stars { display: flex; gap: .15rem; font-size: 1.15rem; }
.card__star { opacity: .45; }
.card__star--won { opacity: 1; }

.map__order-hint {
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

/* ---------- Dialogue des modes ---------- */
.mode-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  max-width: min(92vw, 440px);
  width: 100%;
  background: var(--cream);
  box-shadow: 0 24px 60px rgba(45, 42, 69, .3);
}
.mode-dialog::backdrop { background: rgba(45, 42, 69, .55); }

.mode-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mode-dialog__title { margin: 0; font-size: 1.8rem; color: var(--violet-deep); }

.mode-dialog__close {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--violet-soft);
  background: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.mode-dialog__close:hover { transform: rotate(90deg); border-color: var(--violet); }

.mode-dialog__list {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
  padding: .8rem 1.2rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 4px 0 var(--tone, var(--violet));
  font-weight: 600;
  font-size: 1.15rem;
  transition: transform .15s;
}
.mode-btn:hover { transform: translateY(-3px); }
.mode-btn__icon { font-size: 1.6rem; }
.mode-btn__sub { display: block; font-weight: 400; font-size: .85rem; color: var(--ink-soft); }
.mode-btn--decouvrir { --tone: var(--mint); }
.mode-btn--entrainement { --tone: var(--star); }
.mode-btn--defi { --tone: var(--coral); }

/* ---------- Mode Découvrir ---------- */
.discover__title {
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--violet-deep);
  margin-bottom: .25rem;
}

.discover__intro {
  margin-top: 0;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.discover {
  display: grid;
  grid-template-columns: minmax(230px, 320px) 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1.5rem;
}

.discover__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.discover__row { animation: pop-in .4s ease backwards; animation-delay: calc(var(--i, 0) * 45ms); }

.fact-btn {
  width: 100%;
  min-height: 52px;
  padding: .5rem 1.1rem;
  border: 2px solid var(--violet-soft);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  text-align: center;
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.fact-btn:hover { transform: translateX(4px); border-color: var(--violet); }
.fact-btn--active {
  background: var(--violet);
  border-color: var(--violet);
  color: var(--white);
  box-shadow: 0 4px 0 var(--violet-deep);
}

/* La « maison du nombre » (additions, CP/CE1) : un toit + un étage par décomposition */
.house .discover__list { gap: 0; }
.house .fact-btn { border-radius: 0; border-bottom-width: 1px; }
.house .discover__row:first-child .fact-btn { border-top-width: 2px; }
.house .discover__row:last-child .fact-btn { border-radius: 0 0 var(--radius-md) var(--radius-md); border-bottom-width: 2px; }

.house__roof {
  position: relative;
  height: 84px;
  display: grid;
  place-items: center;
  background: var(--coral);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.house__roof-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  color: var(--white);
  margin-top: 1.4rem;
}

/* Scène de visualisation */
.discover__viz {
  position: sticky;
  top: 1rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 2px solid var(--violet-soft);
  box-shadow: var(--shadow-card);
  padding: clamp(1.25rem, 3vw, 2rem);
  min-height: 320px;
}

.viz__equation {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 6vw, 3.2rem); /* chiffres ≥ 40px */
  text-align: center;
  color: var(--violet-deep);
  margin: 0 0 1rem;
}

.viz__scene {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .7rem;
}

.viz__group {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .2rem;
  max-width: 190px;
  padding: .5rem .6rem;
  background: var(--mint-soft);
  border: 2px dashed var(--mint);
  border-radius: var(--radius-md);
  animation: pop-in .35s ease backwards;
}
.viz__group--wide { max-width: 100%; background: var(--star-soft); border-color: var(--star); }

.viz__item { font-size: 1.5rem; line-height: 1.3; }

.viz__item--gone {
  position: relative;
  opacity: .35;
  filter: grayscale(.8);
}
.viz__item--gone::after {
  content: '✖';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--coral-deep);
  font-size: 1.1rem;
  opacity: .9;
}

.viz__plus {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.2rem;
  color: var(--coral-deep);
}

.viz__caption {
  text-align: center;
  font-weight: 600;
  font-size: 1.15rem;
  margin: 1.25rem 0 .5rem;
}

.viz__note {
  text-align: center;
  color: var(--ink-soft);
  background: var(--violet-soft);
  border-radius: var(--radius-md);
  padding: .7rem 1rem;
  margin: 0;
}

.discover__next {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}
.discover__next .mode-btn { flex: 1; min-width: 240px; }

@media (max-width: 700px) {
  .discover { grid-template-columns: 1fr; }
  .discover__viz { position: static; order: -1; }
}

/* ---------- Mode S'entraîner (quiz) ---------- */
.section--quiz { max-width: 700px; }

.pause-hint {
  background: var(--mint-soft);
  border: 2px solid var(--mint);
  border-radius: var(--radius-md);
  padding: .8rem 1.2rem;
  font-weight: 600;
  text-align: center;
}

.quiz__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.quiz__title {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  color: var(--violet-deep);
  margin: 0;
}

.quiz__sound {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--violet-soft);
  background: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.quiz__sound:hover { transform: scale(1.1); border-color: var(--violet); }

.quiz__dots {
  display: flex;
  gap: .45rem;
  margin: 1rem 0 1.25rem;
}

.quiz__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--violet-soft);
  transition: background .3s, transform .3s;
}
.quiz__dot--done { background: var(--star); border-color: var(--star); }
.quiz__dot--current { border-color: var(--violet); transform: scale(1.25); }

.quiz__card {
  position: relative;
  overflow: hidden;
  background: var(--white);
  border: 2px solid var(--violet-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}

.quiz__equation {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 3.6rem); /* chiffres ≥ 40px */
  color: var(--ink);
  margin: 0 0 1.5rem;
}

.quiz__choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .8rem;
}

.quiz__choice {
  min-height: 72px;
  border: 2px solid var(--violet-soft);
  border-radius: var(--radius-md);
  background: var(--cream);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--ink);
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .2s;
}
.quiz__choice:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--violet); }
.quiz__choice:disabled { cursor: default; }

.quiz__choice--correct {
  background: var(--mint-soft);
  border-color: var(--mint);
  color: var(--mint-deep);
  animation: hop .45s ease;
}

/* Erreur : orange doux + wobble, jamais de rouge agressif */
.quiz__choice--retry {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: var(--coral-deep);
  opacity: .7;
  animation: wobble .45s ease;
}

@keyframes hop {
  30% { transform: translateY(-8px) scale(1.06); }
  60% { transform: translateY(2px); }
}
@keyframes wobble {
  25% { transform: translateX(-6px) rotate(-2deg); }
  50% { transform: translateX(5px) rotate(2deg); }
  75% { transform: translateX(-3px); }
}

.quiz__feedback {
  min-height: 1.7em;
  font-weight: 700;
  font-size: 1.2rem;
  margin: 1.25rem 0 .25rem;
}
.quiz__feedback--ok { color: var(--mint-deep); }
.quiz__feedback--retry { color: var(--coral-deep); }
.quiz__feedback--info { color: var(--violet-deep); }

.quiz__hint-btn {
  margin-top: .5rem;
  min-height: 48px;
  padding: .5rem 1.25rem;
  border-radius: 999px;
  border: 2px dashed var(--star-deep);
  background: var(--star-soft);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  transition: transform .15s;
}
.quiz__hint-btn:hover { transform: scale(1.05); }

.quiz__hint {
  background: var(--star-soft);
  border-radius: var(--radius-md);
  padding: .7rem 1rem;
  font-weight: 600;
  margin: .75rem 0 0;
}

.quiz__escape {
  text-align: center;
  color: var(--ink-soft);
  margin-top: 1.5rem;
}

/* Confettis */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.confetti__piece {
  position: absolute;
  top: 40%;
  left: 50%;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  animation: confetti-fall var(--d, .9s) ease-out forwards;
}
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(calc(var(--x, 0) * 220px), 55vh) rotate(var(--r, 360deg)); opacity: 0; }
}

/* Chrono doux du Défi */
.quiz__tools { display: flex; align-items: center; gap: .6rem; }

.quiz__timer {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: .3rem .9rem;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid var(--violet-soft);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Étoiles de fin de Défi */
.end-stars {
  display: flex;
  justify-content: center;
  gap: .4rem;
  font-size: 3.2rem;
  min-height: 1.2em;
}
.end-star { opacity: .35; }
.end-star--won {
  opacity: 1;
  animation: star-pop .5s ease backwards;
  animation-delay: calc(var(--i, 1) * 250ms);
}
@keyframes star-pop {
  0% { transform: scale(0) rotate(-90deg); }
  70% { transform: scale(1.35) rotate(8deg); }
  100% { transform: scale(1); }
}

.quiz-end__unlock {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--mint-deep);
  background: var(--mint-soft);
  border-radius: var(--radius-md);
  padding: .7rem 1.2rem;
  display: inline-block;
}

/* Défi mélangé (accueil) */
.map__mixed {
  margin-top: 1.5rem;
  text-align: center;
}
.map__mixed .mode-btn { display: inline-flex; }

/* Fin de session */
.quiz-end { text-align: center; }
.quiz-end__emoji { font-size: 4rem; margin: 0; animation: hop .8s ease; }
.quiz-end__title { font-size: clamp(2rem, 6vw, 3rem); color: var(--violet-deep); margin: .25rem 0 .5rem; }
.quiz-end__message { font-size: 1.2rem; font-weight: 600; color: var(--ink-soft); max-width: 480px; margin: 0 auto 2rem; }
.quiz-end__actions { display: flex; flex-direction: column; gap: .8rem; max-width: 420px; margin: 0 auto; }

@media (max-width: 420px) {
  .quiz__choices { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .quiz__choice { min-height: 64px; font-size: 1.7rem; }
}

/* ---------- Page Récompenses ---------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.section--sub { margin-top: 2.5rem; }

.rank {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--white);
  border: 2px solid var(--violet-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: clamp(1.25rem, 3vw, 2rem);
  flex-wrap: wrap;
}

.rank__avatar {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  font-size: 3.2rem;
  background: var(--violet-soft);
  border: 3px solid var(--violet);
  border-radius: 50%;
  flex-shrink: 0;
}

.rank__info { flex: 1; min-width: 220px; }
.rank__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  color: var(--violet-deep);
  margin: 0 0 .25rem;
}
.rank__stars { font-weight: 700; margin: 0 0 .25rem; }
.rank__next { color: var(--ink-soft); margin: 0; }

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.op-card {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-card), 0 5px 0 var(--tone, var(--violet));
}
.op-card--violet { --tone: var(--violet); }
.op-card--coral  { --tone: var(--coral); }
.op-card--mint   { --tone: var(--mint); }
.op-card--star   { --tone: var(--star); }

.op-card__symbol {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  color: var(--tone);
}
.op-card__label { font-weight: 700; }
.op-card__track {
  height: 12px;
  background: var(--cream);
  border-radius: 999px;
  overflow: hidden;
}
.op-card__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--tone);
  transition: width .6s ease;
}
.op-card__detail { font-size: .9rem; color: var(--ink-soft); }

.badges-count { font-weight: 700; color: var(--violet-deep); }

.badges-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .3rem;
  background: var(--white);
  border: 2px dashed var(--violet-soft);
  border-radius: var(--radius-md);
  padding: 1.1rem .8rem;
  opacity: .75;
  animation: pop-in .4s ease backwards;
  animation-delay: calc(var(--i, 0) * 50ms);
}
.badge--won {
  opacity: 1;
  border-style: solid;
  border-color: var(--star);
  background: var(--star-soft);
  box-shadow: 0 4px 0 var(--star);
}
.badge__emoji { font-size: 2.2rem; line-height: 1.2; }
.badge__name { font-size: .95rem; }
.badge__how { font-size: .8rem; color: var(--ink-soft); }
.badge--won .badge__how { color: var(--star-deep); font-weight: 700; }

/* ---------- Page Parents : zone de réinitialisation ---------- */
.danger-zone {
  background: var(--coral-soft);
  border: 2px solid var(--coral);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .8rem;
}

.danger-btn {
  min-height: 48px;
  padding: .5rem 1.25rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--coral-deep);
  background: var(--white);
  color: var(--coral-deep);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform .15s, background .15s, color .15s;
}
.danger-btn:hover { background: var(--coral-deep); color: var(--white); }
.danger-btn--cancel { border-color: var(--ink-soft); color: var(--ink-soft); }
.danger-btn--cancel:hover { background: var(--ink-soft); }
.danger-zone__done { margin: 0; font-weight: 700; color: var(--mint-deep); }

/* ---------- Contenu texte (mentions légales…) ---------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 2rem; }
.prose li { margin-bottom: .5rem; }

/* ---------- Footer ---------- */
.footer {
  margin-top: clamp(2rem, 6vw, 4rem);
  background: var(--ink);
  color: var(--white);
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
}

.footer a { color: var(--star); }

.footer__note {
  max-width: 1100px;
  margin: 0 auto 1.5rem;
  text-align: center;
  font-size: .95rem;
  opacity: .85;
}

.footer__bottom {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, .15);
  padding-top: 1.25rem;
  font-size: .85rem;
}

.footer__copy { margin: 0; opacity: .7; }

.footer__legal a { color: var(--white); opacity: .7; }
.footer__legal a:hover { opacity: 1; }

.footer__made-by {
  display: flex; align-items: center; gap: .5rem;
  opacity: .55; font-size: .8rem;
  transition: opacity 0.25s; color: var(--white); white-space: nowrap;
  text-decoration: none;
}
.footer__made-by:hover { opacity: 1; }
.footer__made-by img { height: 22px; width: auto; display: inline-block; }

/* ---------- Cookie banner (gabarit global, couleurs adaptées) ---------- */
.cookie-banner {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(140%);
  z-index: 9999; width: min(calc(100% - 2rem), 560px);
  background: var(--white); border: 2px solid var(--violet-soft);
  border-radius: 12px; padding: 1.25rem 1.5rem;
  box-shadow: 0 12px 40px rgba(45, 42, 69, 0.25);
  transition: transform 0.45s ease;
}
.cookie-banner.visible { transform: translateX(-50%) translateY(0); }
.cookie-banner__inner { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.cookie-banner__icon { font-size: 1.5rem; flex-shrink: 0; }
.cookie-banner__text { flex: 1; min-width: 200px; }
.cookie-banner__text strong { display: block; font-weight: 700; margin-bottom: .35rem; color: var(--ink); font-size: .92rem; }
.cookie-banner__text p { font-size: .82rem; color: var(--ink-soft); line-height: 1.65; margin: 0; }
.cookie-banner__text a { color: var(--accent-dark); }
.cookie-banner__actions { display: flex; gap: .625rem; align-items: center; flex-shrink: 0; margin-left: auto; }
.cookie-btn { padding: .475rem 1rem; min-height: 48px; border-radius: 6px; font-size: .82rem; font-weight: 600; cursor: pointer; transition: all .2s; border: none; font-family: inherit; }
.cookie-btn--outline { background: transparent; border: 1.5px solid var(--violet-soft); color: var(--ink-soft); }
.cookie-btn--outline:hover { border-color: var(--ink); color: var(--ink); }
.cookie-btn--solid { background: var(--accent); color: #fff; }
.cookie-btn--solid:hover { background: var(--accent-dark); }
.cookie-fab {
  position: fixed; bottom: 1.5rem; left: 1.5rem; z-index: 9998;
  width: 48px; height: 48px; background: var(--white);
  border: 2px solid var(--violet-soft); border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; transition: all .2s;
  box-shadow: 0 4px 16px rgba(45, 42, 69, 0.2);
}
.cookie-fab.visible { display: flex; }
.cookie-fab:hover { border-color: var(--accent); transform: scale(1.1); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .cookie-banner__actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .footer__bottom { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .map__grid { grid-template-columns: repeat(2, 1fr); }
  .header { flex-direction: column; }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
