/* MemoRatou — style fun et coloré */

:root {
  --violet: #7c3aed;
  --violet-dark: #5b21b6;
  --turquoise: #06b6d4;
  --orange: #fb923c;
  --pink: #ec4899;
  --yellow: #fbbf24;
  --green: #22c55e;
  --red: #ef4444;
  --ink: #1f2937;
  --ink-light: #6b7280;
  --bg: #f7f6fc;
  --card-bg: #ffffff;
  --border: rgba(124, 58, 237, .08);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(76, 29, 149, .10);
  --shadow-sm: 0 2px 8px rgba(31, 41, 55, .06);
  --shadow-lg: 0 16px 40px rgba(76, 29, 149, .16);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  background:
    radial-gradient(circle at 8% 8%, #ede9fe 0%, transparent 38%),
    radial-gradient(circle at 92% 18%, #cffafe 0%, transparent 38%),
    radial-gradient(circle at 50% 105%, #ffedd5 0%, transparent 42%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3, .brand {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.25;
}
h1 { font-size: 1.85rem; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 0 0 4px; }
h3 { font-size: 1.1rem; margin: 0 0 4px; }

a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
.tile, .brand, .topnav a, .btn, .btn-back, .subnav-item { text-decoration: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar::before { content: ''; display: block; height: 4px; background: linear-gradient(90deg, var(--violet), var(--pink), var(--orange)); }
.topbar-in { max-width: 1480px; margin: 0 auto; padding: 0 24px; height: 62px; display: flex; align-items: center; gap: 24px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink) !important;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.brand-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.topbar-menu { display: flex; align-items: center; gap: 16px; flex: 1; justify-content: space-between; min-width: 0; }
.topnav { display: flex; gap: 2px; flex-wrap: nowrap; }
.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-light);
  padding: 8px 12px;
  border-radius: 9px;
  font-weight: 500;
  font-size: .92rem;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.topnav a .i { width: 18px; height: 18px; }
.topnav a:hover { background: #f5f3fb; color: var(--ink); }
.topnav a.active { background: #f3effe; color: var(--violet-dark); font-weight: 600; }
.topnav a.active .i { color: var(--pink); }
.topuser { display: flex; align-items: center; gap: 10px; color: var(--ink-light); font-weight: 500; font-size: .9rem; white-space: nowrap; }
.topuser-link { display: inline-flex; align-items: center; gap: 10px; padding: 3px; border-radius: 999px; color: inherit; transition: background .15s ease; }
.topuser-link:hover, .topuser-link.active { background: #f5f3fb; color: var(--ink); text-decoration: none; }
.topuser-name { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #f3effe; color: var(--violet-dark); display: grid; place-items: center; font-weight: 600; font-size: .85rem; }

/* Bouton hamburger, caché en desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle-bar { width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.page { max-width: 1100px; width: 100%; margin: 0 auto; padding: 32px 20px 40px; flex: 1 0 auto; }

/* ---------- Footer ---------- */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(100deg, var(--violet), #a855c7 55%, var(--pink));
}
.footer-tagline { font-weight: 700; color: #fff; margin: 0 0 4px; }
.footer-credit { font-size: .85rem; color: rgba(255,255,255,.85); margin: 0; }
.footer-credit strong { color: #fff; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  padding: 12px 22px;
  border-radius: 999px;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-primary { background: linear-gradient(90deg, var(--violet), var(--pink)); color: #fff; }
.btn-success { background: linear-gradient(90deg, #22c55e, #16a34a); color: #fff; }
.btn-danger { background: linear-gradient(90deg, #ef4444, #b91c1c); color: #fff; }
.btn-warn { background: linear-gradient(90deg, var(--orange), var(--yellow)); color: #4a2c00; }
.btn-secondary { background: #f1edfc; color: var(--violet-dark); }
.btn-secondary:hover { background: #e6ddfa; }
.btn-ghost { background: rgba(255,255,255,.18); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--violet-dark);
  background: #fff;
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-back:hover { background: #f1edfc; transform: translateX(-3px); box-shadow: var(--shadow); text-decoration: none; }

/* ---------- Cartes / tuiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 24px; }
.tile {
  display: block;
  padding: 24px 22px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
  overflow: hidden;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.tile .emoji {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  background: rgba(255,255,255,.28);
  border-radius: 14px;
  margin-bottom: 14px;
}
.tile.c1 { background: linear-gradient(135deg, var(--violet), #a78bfa); }
.tile.c2 { background: linear-gradient(135deg, var(--turquoise), #67e8f9); }
.tile.c3 { background: linear-gradient(135deg, var(--pink), #be185d); }
.tile.c4 { background: linear-gradient(135deg, var(--orange), #ea580c); }
.tile .sub { display:block; font-size: .82rem; font-weight: 600; opacity: .9; margin-top: 5px; }

.card-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 22px;
}
.card-panel h2:first-child, .card-panel h3:first-child { margin-top: 0; }

.section-title {
  margin: 40px 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  font-size: 1.25rem;
}
.section-title:first-of-type { margin-top: 20px; }

/* ---------- Accordéon (ex. Résultats admin : une zone ouverte à la fois) ---------- */
.accordion { display: flex; flex-direction: column; gap: 14px; margin: 20px 0; }
.accordion-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.accordion-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-align: left;
}
.accordion-toggle:hover { background: #faf9ff; }
.accordion-arrow { color: var(--violet); font-size: 1.3rem; transition: transform .2s ease; flex-shrink: 0; }
.accordion-toggle[aria-expanded="true"] .accordion-arrow { transform: rotate(180deg); }
.accordion-panel { padding: 4px 24px 24px; border-top: 1px solid var(--border); }
.accordion-panel .card-panel:last-child { margin-bottom: 0; }

/* ---------- Bannières / flash messages ---------- */
.banner {
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 700;
  margin-bottom: 18px;
}
.banner-info { background: #e0f2fe; color: #075985; }
.banner-success { background: #dcfce7; color: #166534; }
.banner-error { background: #fee2e2; color: #991b1b; }

/* ---------- Formulaires ---------- */
label { font-weight: 700; display: block; margin-bottom: 6px; font-size: .95rem; }
input[type=text], input[type=password], input[type=url], input[type=file], textarea, select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid #e7e5ef;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 16px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .14);
}
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 200px; }
code {
  background: #f1edfc;
  color: var(--violet-dark);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: .9em;
}

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; flex: 1; }
.page:has(> .login-wrap) { display: flex; flex-direction: column; padding-top: 20px; padding-bottom: 20px; }
.login-card {
  background: var(--card-bg);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.login-card h1 { font-size: 1.6rem; margin-bottom: 2px; }
.login-card .tagline { color: var(--ink-light); margin: 0 0 18px; font-weight: 500; }
.login-card input { margin-bottom: 12px; }
.login-card label { text-align: left; }

/* ---------- Flashcards ---------- */
.study-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.study-progress { font-weight: 800; color: var(--violet-dark); }
.flash-stage { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 20px 0 40px; }

.flip-card {
  width: min(520px, 92vw);
  height: 320px;
  perspective: 1400px;
  cursor: pointer;
}
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform .5s cubic-bezier(.4,.2,.2,1);
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow);
  font-weight: 700;
}
.flip-front {
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
  font-size: 1.7rem;
}
.flip-back {
  background: linear-gradient(135deg, var(--turquoise), #a7f3d0);
  color: #063a3a;
  transform: rotateY(180deg);
  font-size: 1.25rem;
  flex-direction: column;
  gap: 14px;
}
.flip-hint { font-size: .85rem; opacity: .85; font-weight: 600; margin-top: 14px; }
.flip-face img { max-width: 100%; max-height: 65%; border-radius: 16px; object-fit: cover; }
.flip-face .mystery-name { font-size: 1.6rem; }
.flip-face .mystery-desc { font-size: 1rem; font-weight: 500; opacity: .9; }

.answer-buttons { display: flex; gap: 16px; width: 100%; max-width: 380px; }
.answer-buttons .btn { flex: 1 1 0; justify-content: center; font-size: 1.05rem; padding: 14px 18px; }

.study-done { text-align: center; padding: 60px 20px; }
.study-done .big-emoji { font-size: 4rem; display: block; margin-bottom: 10px; }

/* ---------- Géographie ---------- */
.geo-starting-info {
  width: min(520px, 92vw);
  padding: 26px 30px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.geo-starting-info .geo-text { font-size: 1.9rem; font-weight: 800; }
.geo-starting-info .geo-photo { max-height: 220px; }
.geo-starting-info .geo-map-widget { width: 100%; }

.geo-cards-grid {
  width: min(920px, 96vw);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}
.flip-card-mini {
  width: min(240px, 44vw);
  height: 230px;
}
.flip-card-mini .flip-front { font-size: 1.1rem; padding: 16px; }
.flip-card-mini .flip-back { font-size: 1rem; padding: 14px; gap: 8px; }
.flip-card-mini .geo-text { font-size: 1.25rem; }
.flip-card-mini .answer-buttons { gap: 8px; }
.flip-card-mini .answer-buttons .btn { font-size: .68rem; padding: 6px 4px; }
.flip-card-mini.answered { opacity: .55; pointer-events: none; }
.flip-card-mini .geo-map-widget { width: 100%; }
.geo-card-label { font-weight: 800; }

.geo-photo { max-width: 100%; max-height: 100%; border-radius: 16px; object-fit: cover; }

/* Carte vierge (face "question" des cartes Localisation) : simple aperçu
   statique. L'image remplit toute la face (comme .flip-front est en
   position:absolute;inset:0, sa hauteur est définie) et object-fit:contain
   la centre proprement dans cette boîte — plus fiable que de compter sur le
   centrage flex du parent avec un dimensionnement intrinsèque. */
.geo-map-blank { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; border-radius: 12px; background: #eef2ff; user-select: none; }

.geo-map-empty { padding: 20px; text-align: center; font-weight: 700; color: var(--ink-light); background: #f1f0f6; border-radius: 12px; }

/* Widget carte interactive (zoom + déplacement), partagé par les cartes
   d'étude (lecture seule) et le sélecteur de localisation en admin
   (interactive) — voir assets/js/geo-map.js. La hauteur (ratio 2:1) est
   fixée en JS d'après la largeur réelle mesurée dès que le widget s'initialise
   (fiable quel que soit le contexte flex parent, contrairement à
   aspect-ratio/padding-bottom% seuls) ; `aspect-ratio` ci-dessous n'est
   qu'un filet de sécurité CSS pur si jamais le JS n'a pas encore tourné, il
   est systématiquement écrasé par la hauteur en pixels posée en JS. */
.geo-map-widget {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  /* Ne jamais laisser flexbox comprimer sa hauteur pour faire de la place à
     un voisin (les boutons Connu/Pas connu, dans une mini carte) — ça
     déformerait le ratio 2:1 et décalerait la puce par rapport à l'image.
     Si jamais l'espace manque, la carte déborde légèrement plutôt que de
     rendre une position fausse. */
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #eef2ff;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.geo-map-widget:active { cursor: grabbing; }
.geo-map-widget.geo-map-interactive { cursor: crosshair; border: 2px dashed var(--violet); }
.geo-map-canvas {
  position: absolute;
  top: 0;
  left: 0;
  /* largeur/hauteur fixées en JS (assets/js/geo-map.js) selon le zoom, pour
     que l'image SVG soit re-rasterisée nette à chaque niveau plutôt que
     grossie au pixel près via un transform:scale (flou). */
  will-change: transform;
}
.geo-map-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  /* Annule .flip-face img (règle générique pour les photos Mystères) qui
     s'applique aussi ici puisque ce <img> vit dans .flip-face : sans ce
     reset, max-height:65% recadrait la carte et object-fit:cover la
     rognerait, désynchronisant l'image affichée de la puce (correctement
     positionnée, elle, en % du canevas). */
  max-width: none;
  max-height: none;
  object-fit: fill;
  border-radius: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.geo-map-controls {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.geo-map-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(31,41,55,.72);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.geo-map-btn:hover { background: rgba(31,41,55,.9); }
.geo-map-btn:active { transform: scale(.92); }
.flip-card-mini .geo-map-controls { right: 4px; bottom: 4px; gap: 4px; }
.flip-card-mini .geo-map-btn { width: 22px; height: 22px; font-size: .75rem; border-radius: 6px; }

.geo-pin {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Sélecteur de localisation en admin : plus grand pour viser précisément. */
.geo-map-widget-lg.geo-map-widget { max-width: 640px; }

/* ---------- Synthèse (boules + tableau) ---------- */
.balls { display: inline-flex; gap: 5px; vertical-align: middle; }
.ball {
  width: 15px; height: 15px; border-radius: 50%;
  background: #e5e7eb;
  border: 2px solid #d1d5db;
  display: inline-block;
}
.ball.ball-green, .ball.filled { background: var(--green); border-color: #16a34a; }
.ball.ball-red { background: var(--red); border-color: #b91c1c; }

/* ---------- Sous-menu (onglets) ---------- */
.subnav {
  display: flex;
  gap: 8px;
  margin: 18px 0;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.subnav-item {
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
  color: var(--ink-light);
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.subnav-item:hover { background: #f1edfc; color: var(--violet-dark); }
.subnav-item.active { background: linear-gradient(90deg, var(--violet), var(--pink)); color: #fff; }

table.synth {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}
table.synth th { text-align: left; color: var(--ink-light); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; padding: 0 14px; }
table.synth td { background: #fff; padding: 14px; vertical-align: middle; box-shadow: var(--shadow-sm); }
table.synth tr.row-known td:first-child { border-left: 6px solid var(--green); }
table.synth tr.row-unknown td:first-child { border-left: 6px solid #e5e7eb; }
table.synth td:first-child { border-radius: 14px 0 0 14px; }
table.synth td:last-child { border-radius: 0 14px 14px 0; }
.badge { display: inline-block; padding: 5px 14px; border-radius: 999px; font-weight: 800; font-size: .8rem; white-space: nowrap; }
.badge-known { background: #dcfce7; color: #166534; }
.badge-unknown { background: #fef3c7; color: #92400e; }

/* Conteneur "carte" commun aux listes (synthèse + tableaux admin), pour
   qu'elles ressortent nettement du fond dégradé de la page. */
.table-wrap {
  overflow-x: auto;
  background: linear-gradient(160deg, #f3f0ff, #eef9fb);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
table.admin { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
table.admin th, table.admin td { padding: 13px 14px; text-align: left; }
table.admin th { color: var(--ink-light); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; background: #faf9ff; border-bottom: 2px solid #ede9fe; }
table.admin tbody tr { border-bottom: 1px solid #f1f0f6; transition: background .12s ease; }
table.admin tbody tr:last-child { border-bottom: none; }
table.admin tbody tr:nth-child(even) { background: #faf9ff; }
table.admin tbody tr:hover { background: #f3effe; }

/* ---------- Modale de confirmation ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(31,41,55,.55); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius); padding: 28px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg); text-align: center;
}
.modal-box p { margin-top: 0; font-weight: 600; }
.modal-box .modal-actions { display: flex; gap: 14px; justify-content: center; margin-top: 20px; }

/* ---------- Dictée ---------- */
.dictee-word-box { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.speak-btn {
  width: 110px; height: 110px; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--turquoise));
  color: #fff; font-size: 2.6rem; border: none; cursor: pointer; box-shadow: var(--shadow);
}
.speak-btn { transition: transform .15s ease, box-shadow .15s ease; }
.speak-btn:hover { transform: scale(1.05); box-shadow: var(--shadow-lg); }
.dictee-input { max-width: 380px; text-align: center; font-size: 1.3rem; }
.typed-prompt { font-size: 1.6rem; font-weight: 800; color: var(--violet-dark); text-align: center; margin: 0; }
.result-ok { color: #166534; font-weight: 800; }
.result-ko { color: #991b1b; font-weight: 800; }
.word-review-list { list-style: none; padding: 0; margin: 18px 0 0; }
.word-review-list li { padding: 10px 14px; border-radius: 12px; margin-bottom: 8px; font-weight: 700; }
.word-review-list li.ok { background: #dcfce7; color: #166534; }
.word-review-list li.ko { background: #fee2e2; color: #991b1b; }

/* ---------- Categories mystères ---------- */
.cat-header { display:flex; align-items:center; gap:14px; margin-bottom: 10px; }
.cat-header .emoji { font-size: 2.2rem; }

/* ---------- Utilitaires ---------- */
.text-center { text-align: center; }
.mt-lg { margin-top: 28px; }
.muted { color: var(--ink-light); }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; }

/* ---------- Icônes en ligne ---------- */
.i { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; }
.tile-ico {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
  background: var(--acc, linear-gradient(135deg, var(--violet), var(--pink)));
}
.cat-header .tile-ico { width: 48px; height: 48px; }
.cat-header .tile-ico svg { width: 24px; height: 24px; }

/* ---------- Fiches à retourner ---------- */
.flip-face {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.flip-face::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--orange));
}
.flip-face::after {
  content: 'Question'; position: absolute; top: 18px; left: 20px;
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--violet);
}
.flip-front { font-size: 1.7rem; font-weight: 650; letter-spacing: -.02em; }
.flip-back {
  background: linear-gradient(160deg, #faf9ff, #ecfafd);
  font-size: 1.25rem; font-weight: 600;
}
.flip-back::before { background: linear-gradient(90deg, var(--turquoise), var(--violet)); }
.flip-back::after { content: 'Réponse'; color: #0e7490; }
.flip-card-mini .flip-face::after { display: none; }
.geo-card-label { color: var(--violet-dark); font-weight: 650; }
.flip-hint { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink-light); font-size: .9rem; font-weight: 500; opacity: 1; }
.flip-hint .i { width: 16px; height: 16px; }
.geo-starting-info {
  position: relative; overflow: hidden;
  background: #fff; color: var(--ink);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
.geo-starting-info::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--orange));
}
.geo-starting-info .geo-text { color: var(--violet-dark); font-weight: 650; letter-spacing: -.02em; }

/* Exercices à écrire (réponse au clavier) : même visuel qu'une fiche avant retournement */
.study-card {
  position: relative; overflow: hidden;
  width: min(520px, 92vw); min-height: 320px;
  padding: 46px 30px 30px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  text-align: center;
}
.study-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--orange));
}
.study-card::after {
  content: attr(data-label); position: absolute; top: 18px; left: 20px;
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--violet);
}
.study-card .typed-prompt { font-size: 1.7rem; font-weight: 650; letter-spacing: -.02em; color: var(--ink); }
.study-card .dictee-input { width: 100%; max-width: 360px; margin: 0; }
.study-card .muted { margin: 0; }
.study-card-img { max-width: 100%; max-height: 170px; object-fit: contain; border-radius: 8px; box-shadow: 0 2px 10px rgba(31,41,55,.18); }
.study-card .btn-primary { min-width: 200px; min-height: 44px; justify-content: center; }
.study-card .btn .i { width: 18px; height: 18px; }
.thumb-flag { width: 72px; height: 48px; object-fit: contain; background: #f3f4f6; border: 1px solid var(--border); border-radius: 6px; }

.tile.tile-outline.c1 { border: 1.5px solid rgba(124, 58, 237, .45); }
.tile.tile-outline.c2 { border: 1.5px solid rgba(6, 182, 212, .55); }
.tile.tile-outline.c3 { border: 1.5px solid rgba(236, 72, 153, .45); }
.tile.tile-outline.c4 { border: 1.5px solid rgba(251, 146, 60, .65); }

/* Boutons de réponse : Valider / Connu / Pas connu */
.answer-buttons { gap: 12px; }
.answer-buttons .btn { min-height: 46px; font-size: .98rem; font-weight: 600; justify-content: center; }
.answer-buttons .btn .i, .study-done .btn .i { width: 18px; height: 18px; }
.answer-buttons .btn-success { background: linear-gradient(90deg, var(--violet), var(--pink)); color: #fff; }
.answer-buttons .btn-success:hover { filter: brightness(.92); }
.answer-buttons .btn-danger { background: #fff4e8; color: #c2410c; border-color: #fdba74; }
.answer-buttons .btn-danger:hover { background: #ffe9d2; border-color: #fb923c; }
/* Boutons de réponse ancrés en bas de la fiche (le contenu reste centré au-dessus) */
.flip-back .answer-buttons { position: absolute; left: 50%; transform: translateX(-50%); bottom: 20px; width: calc(100% - 40px); }
.flip-card:not(.flip-card-mini) .flip-back { padding-bottom: 78px; }
.flip-card:not(.flip-card-mini) .answer-buttons { flex-direction: row; }
.flip-card-mini .flip-back { padding-bottom: 52px; }
.flip-card-mini .flip-back .answer-buttons { bottom: 10px; width: calc(100% - 20px); }
/* Fiches classiques : boutons plus compacts (les mini-cartes de « Notre monde » gardent leurs propres tailles) */
.flip-card:not(.flip-card-mini) .answer-buttons { max-width: 300px; gap: 10px; }
.flip-card:not(.flip-card-mini) .answer-buttons .btn { min-height: 38px; padding: 8px 14px; font-size: .9rem; }
.flip-card:not(.flip-card-mini) .answer-buttons .btn .i { width: 16px; height: 16px; }
.flip-card-mini .answer-buttons .btn { min-height: 32px; }
.flip-card-mini .answer-buttons .btn .i { width: 12px; height: 12px; }
.dictee-word-box .btn-secondary { min-height: 44px; }
.speak-btn svg { width: 44px; height: 44px; }
#typedFeedback, #feedback { display: flex; flex-direction: column; align-items: center; }
.result-ok, .result-ko { display: flex; align-items: center; justify-content: center; gap: 8px; }
.result-ok .i, .result-ko .i { width: 20px; height: 20px; }
.word-review-list li { display: flex; align-items: center; gap: 8px; }
.word-review-list li .i { width: 18px; height: 18px; }
.study-progress { font-weight: 600; color: var(--violet-dark); background: #f3effe; padding: 5px 14px; border-radius: 999px; font-size: .88rem; }

/* ---------- Refonte : base plus sobre (polices, formes, cartes) ---------- */
:root {
  --border: #e8e5f3;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 4px 14px rgba(76, 29, 149, .08);
  --shadow-sm: 0 1px 2px rgba(31, 41, 55, .05);
  --shadow-lg: 0 10px 28px rgba(76, 29, 149, .12);
}
body {
  background:
    radial-gradient(circle at 6% 4%, #ede9fe 0%, transparent 36%),
    radial-gradient(circle at 94% 14%, #cffafe 0%, transparent 34%),
    radial-gradient(circle at 50% 108%, #ffedd5 0%, transparent 40%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { letter-spacing: -.02em; }
h1 { font-size: 1.75rem; letter-spacing: -.025em; }
h2 { font-weight: 650; font-size: 1.2rem; }
h3 { font-weight: 650; font-size: 1.05rem; }

/* Boutons : rectangles arrondis, plus discrets */
.btn { border: 1px solid transparent; border-radius: 10px; font-weight: 600; font-size: .92rem; padding: 10px 18px; min-height: 40px; box-shadow: none; }
.btn:hover { transform: none; box-shadow: var(--shadow-sm); }
.btn-primary { background: linear-gradient(90deg, var(--violet), var(--pink)); }
.btn-primary:hover { filter: brightness(.94); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: #faf9ff; border-color: #d4cdee; }
.btn-ghost { background: #fff; color: var(--ink-light); border-color: var(--border); }
.btn-ghost:hover { background: #faf9ff; color: var(--ink); }
.btn-danger { background: #fff; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.modal-box .btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-success { background: #16a34a; }
.btn-warn { background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.btn-sm { padding: 7px 14px; font-size: .85rem; min-height: 34px; }
.btn-back { border-radius: 10px; font-weight: 600; font-size: .92rem; padding: 9px 16px; border: 1px solid var(--border); }
.btn-back:hover { transform: none; }

/* Tuiles : cartes blanches + pastille colorée */
.tiles { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile, .tile.c1, .tile.c2, .tile.c3, .tile.c4 {
  --acc: linear-gradient(135deg, var(--violet), var(--pink));
  --tint: #f3effe;
  background: var(--card-bg);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -.01em;
}
.tile.c1 { --acc: linear-gradient(135deg, #7c3aed, #a78bfa); --tint: #f3effe; }
.tile.c2 { --acc: linear-gradient(135deg, #06b6d4, #67e8f9); --tint: #e0f7fb; }
.tile.c3 { --acc: linear-gradient(135deg, #ec4899, #f472b6); --tint: #fdeaf4; }
.tile.c4 { --acc: linear-gradient(135deg, #fb923c, #fdba74); --tint: #fff1e3; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d9d0f5; }
.tile::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--acc); opacity: 0; transition: opacity .18s ease; }
.tile:hover::after { opacity: 1; }
.tile .emoji, .tile .tile-ico {
  width: 44px; height: 44px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; font-size: 1.4rem;
}
.tile .emoji { background: var(--tint); }
.tile .tile-ico { background: var(--acc); color: #fff; }
.tile .tile-ico svg { width: 22px; height: 22px; }
.tile .sub { color: var(--ink-light); font-weight: 400; font-size: .88rem; opacity: 1; margin-top: 4px; letter-spacing: 0; }

.card-panel { border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; }
.accordion-item { box-shadow: var(--shadow-sm); }
.banner { border-radius: 10px; font-weight: 600; }

/* Formulaires */
input[type=text], input[type=password], input[type=url], input[type=file], textarea, select {
  border: 1px solid #dcd8ec;
  border-radius: 10px;
  padding: 10px 13px;
}
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
label { font-weight: 600; }

/* Sous-menu (onglets segmentés) */
.subnav { border-radius: 10px; padding: 4px; gap: 4px; box-shadow: none; background: #f1eefb; border-color: transparent; }
.subnav-item { border-radius: 7px; font-weight: 500; padding: 8px 16px; }
.subnav-item.active { background: #fff; color: var(--violet-dark); box-shadow: var(--shadow-sm); font-weight: 600; }
.subnav-item:hover { background: rgba(255,255,255,.6); }

/* Tableaux : lignes séparées par un filet, plus de cartes flottantes */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 0; }
table.synth { border-collapse: collapse; border-spacing: 0; }
table.synth th { background: #faf9ff; border-bottom: 1px solid var(--border); padding: 11px 14px; font-weight: 600; font-size: .75rem; }
table.synth td { background: none; box-shadow: none; border-bottom: 1px solid #f0edf8; padding: 13px 14px; }
table.synth tr:last-child td { border-bottom: none; }
table.synth td:first-child, table.synth td:last-child { border-radius: 0; }
table.synth tr.row-known td:first-child { border-left: 3px solid var(--green); }
table.synth tr.row-unknown td:first-child { border-left: 3px solid transparent; }
table.admin { box-shadow: none; border-radius: 0; }
.badge { font-weight: 600; padding: 4px 12px; }

/* Connexion et pied de page */
.login-card { border-radius: 20px; }
.footer { background: #fff; border-top: 4px solid transparent; border-image: linear-gradient(90deg, var(--violet), var(--pink), var(--orange)) 1; padding: 22px 20px; }
.footer-tagline { color: var(--ink); font-weight: 600; }
.footer-credit { color: var(--ink-light); }
.footer-credit strong { color: var(--violet-dark); }
.modal-box { border-radius: 16px; }

/* ---------- Responsive : tablette / mobile ---------- */
@media (max-width: 1500px) {
  .topnav a .i { display: none; }
}

@media (max-width: 1240px) {
  .nav-toggle { display: flex; }
  .topbar-in { gap: 12px; }
  .topbar-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 16px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .topbar-menu.open { display: flex; }
  .topnav { flex-direction: column; gap: 2px; }
  .topnav a { padding: 13px 12px; font-size: 1rem; }
  .topnav a .i { display: block; }
  .topuser { justify-content: space-between; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
  .topuser-link { margin-right: auto; padding-right: 12px; }
  .topuser-name { display: inline; }
}

@media (max-width: 640px) {
  html { font-size: 15px; }
  .page { padding: 22px 14px 32px; }
  .topbar-in { padding: 0 16px; height: 58px; }
  .brand-logo { width: 32px; height: 32px; }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.15rem; }

  .card-panel { padding: 18px; }
  .tiles { grid-template-columns: 1fr; gap: 14px; }
  .tile { padding: 20px 18px; }

  .field-row { flex-direction: column; gap: 0; }
  .field-row > * { min-width: 0; }

  .login-card { padding: 34px 24px; }

  .flip-card { height: 380px; }
  .answer-buttons { flex-direction: column; width: 100%; max-width: none; }
  .answer-buttons .btn { width: 100%; justify-content: center; }

  /* Largeur plafonnée (pas juste 100%) : sur les écrans proches de 640px de
     large, une carte à 100% serait ~600px, et sa carte-widget (ratio 2:1)
     ferait ~300px de haut — bien plus que ce que la hauteur fixe de la carte
     peut accueillir avec les boutons, ce qui forçait flexbox à la
     comprimer et déformait la position de la puce. En plafonnant la
     largeur, la hauteur nécessaire pour la carte reste toujours prévisible
     et tient dans les 300px ci-dessous. */
  .flip-card-mini { width: min(100%, 340px); height: 300px; }
  .flip-card-mini .answer-buttons { flex-direction: row; }
  .flip-card-mini .answer-buttons .btn { width: auto; }
  .geo-starting-info { padding: 20px; }
  .geo-starting-info .geo-text { font-size: 1.4rem; }

  .study-topbar h1 { font-size: 1.25rem; }

  .subnav { width: 100%; }
  .subnav-item { flex: 1; text-align: center; padding: 10px 12px; font-size: .88rem; }

  .table-wrap { padding: 12px; }

  /* Tableaux "synthèse" en cartes empilées plutôt qu'en lignes qui débordent */
  table.synth thead { display: none; }
  table.synth, table.synth tbody, table.synth tr, table.synth td { display: block; width: 100%; }
  table.synth tr {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 10px;
    padding: 6px 4px;
    border-left: 6px solid #e5e7eb;
  }
  table.synth tr.row-known { border-left-color: var(--green); }
  table.synth td {
    background: none;
    box-shadow: none;
    border-bottom: none;
    border-radius: 0 !important;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  table.synth td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--ink-light);
    flex-shrink: 0;
  }
  table.synth td:last-child { justify-content: flex-end; }
  table.synth tr.row-known td:first-child, table.synth tr.row-unknown td:first-child { border-left: none; }

  .modal-box { padding: 22px; }
  .speak-btn { width: 92px; height: 92px; font-size: 2.2rem; }
}

/* ---------- Résultats (admin) : tableau de bord, navigation, filtres ---------- */
.res-userbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 18px; }
.res-userbar label { margin: 0; font-weight: 700; }
.res-userbar select { flex: 1; min-width: 200px; max-width: 420px; margin: 0; }

.res-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 18px 0; }
.res-tile {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none !important;
  transition: transform .15s ease, box-shadow .15s ease;
}
.res-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.res-tile-ico { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.res-tile-ico svg { width: 22px; height: 22px; }
.res-tile-title { font-family: 'Inter', system-ui, sans-serif; font-weight: 700; font-size: 1.2rem; }
.res-tile-stat { font-size: .95rem; }
.res-tile-last { font-size: .8rem; color: var(--ink-light); }

.res-bar { display: block; height: 10px; border-radius: 999px; background: #ede9fe; overflow: hidden; margin: 6px 0 4px; }
.res-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--pink)); border-radius: 999px; }
.res-count { margin: 6px 0 0; }

.res-back { margin: 6px 0 4px; }
/* Parties : onglets soulignés */
.res-chips { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 8px 0 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.res-chips::-webkit-scrollbar { display: none; }
.res-chip {
  position: relative; flex-shrink: 0; white-space: nowrap; padding: 12px 14px; min-height: 44px;
  display: inline-flex; align-items: center;
  font-weight: 500; font-size: .92rem; color: var(--ink-light); text-decoration: none !important;
}
.res-chip:hover { color: var(--ink); }
.res-chip.active { color: var(--violet-dark); font-weight: 600; }
.res-chip.active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--violet), var(--pink)); }
/* Onglets de la partie : plus petits, fond clair sur l'actif */
.res-chips-tabs { border-bottom: none; gap: 2px; margin-top: 8px; }
.res-chips-tabs .res-chip { padding: 6px 12px; min-height: 36px; font-size: .88rem; border-radius: 8px; }
.res-chips-tabs .res-chip:hover { background: #f5f3fb; }
.res-chips-tabs .res-chip.active { background: #f3effe; }
.res-chips-tabs .res-chip.active::after { display: none; }
/* Sens : sélecteur segmenté */
.res-chips.res-seg { display: inline-flex; overflow: visible; padding: 3px; gap: 0; background: #f1eefb; border: none; border-radius: 8px; margin: 12px 0 4px; max-width: 100%; }
.res-seg .res-chip { padding: 8px 14px; min-height: 36px; font-size: .85rem; border-radius: 6px; }
/* 3e niveau (exercices d'un sujet) : onglets discrets, décalés sous le niveau précédent */
.res-chips-sub { border-bottom: none; gap: 2px; margin: 2px 0 6px 14px; padding-left: 10px; border-left: 2px solid #ede9fe; }
.res-chips-sub .res-chip { padding: 5px 12px; min-height: 34px; font-size: .84rem; border-radius: 6px; }
.res-chips-sub .res-chip:hover { background: #f5f3fb; }
.res-chips-sub .res-chip.active { color: var(--violet-dark); background: #fff; border: 1px solid #ddd6fe; font-weight: 600; }
.res-chips-sub .res-chip.active::after { display: none; }
.res-seg .res-chip:hover { background: rgba(255,255,255,.6); }
.res-seg .res-chip.active { background: #fff; color: var(--violet-dark); box-shadow: var(--shadow-sm); }

.res-section { margin-bottom: 20px; }
.res-actions summary { list-style: none; cursor: pointer; }
.res-actions summary::-webkit-details-marker { display: none; }
.res-actions[open] { text-align: right; }
.res-actions form { margin-top: 8px; }

.res-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.res-filter { display: inline-flex; padding: 3px; background: #f1eefb; border-radius: 8px; }
.res-filter-btn {
  border: none; background: none; cursor: pointer; padding: 8px 14px; min-height: 36px;
  border-radius: 6px; font-family: inherit; font-weight: 500; font-size: .85rem; color: var(--ink-light); white-space: nowrap;
}
.res-filter-btn.active { background: #fff; color: var(--violet-dark); box-shadow: var(--shadow-sm); font-weight: 600; }
.res-search { flex: 1; min-width: 180px; max-width: 320px; margin: 0; }
.res-hidden { display: none !important; }

@media (max-width: 640px) {
  .res-userbar select { max-width: none; width: 100%; flex-basis: 100%; }
  .res-tiles { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .res-tile { padding: 14px; gap: 6px; }
  .res-tile-title { font-size: 1.05rem; }
  .res-tile-stat { font-size: .85rem; }
  .res-tools { flex-direction: column; align-items: stretch; }
  .res-filter { width: 100%; }
  .res-filter-btn { flex: 1; padding: 9px 6px; font-size: .8rem; }
  .res-search { max-width: none; width: 100%; }
  .res-actions { width: 100%; }
  .res-actions summary { width: 100%; justify-content: center; text-align: center; }
  .res-actions[open] { text-align: center; }
  .res-section .flex-between h2 { margin: 0; }
}

/* ---------- Mon tableau de bord (utilisateur) ---------- */
.profile-hero { display: flex; align-items: center; gap: 28px; margin-top: 18px; }
.profile-score { font-size: 3.2rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; color: var(--violet-dark); flex-shrink: 0; min-width: 110px; }
.profile-score span { font-size: 1.4rem; color: var(--pink); }
.profile-hero-text { flex: 1; min-width: 0; }
.profile-hero-text .res-bar { height: 12px; margin: 10px 0; }
.profile-hero-text p { margin: 0; }
.profile-title { margin: 26px 0 0; }
@media (max-width: 640px) {
  .profile-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .profile-score { font-size: 2.6rem; }
  .profile-hero-text { width: 100%; }
}

/* ---------- Synthèses sur smartphone : une carte compacte par ligne ---------- */
@media (max-width: 640px) {
  .table-wrap { background: none; border: none; box-shadow: none; padding: 0; overflow: visible; }
  table.synth, table.synth tbody { display: block; }
  table.synth tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px;
    margin: 0 0 10px; padding: 12px 14px;
    background: #fff; border: 1px solid var(--border); border-left: 4px solid #e5e7eb;
    border-radius: 12px; box-shadow: var(--shadow-sm);
  }
  table.synth tr.row-known { border-left-color: var(--green); }
  table.synth td { display: flex; align-items: center; width: auto; min-width: 0; padding: 0; border: none; gap: 10px; }

  /* Ligne 1 : nom (à gauche) + boules de progression (à droite) */
  table.synth td:first-child { order: 1; grid-column: 1; font-size: 1.02rem; justify-content: flex-start; }
  table.synth td[data-label="Progression"] { order: 2; grid-column: 2; justify-content: flex-end; }
  /* Infos complémentaires (définition, capitale…) : lignes discrètes */
  table.synth td:not(:first-child):not([data-label="Progression"]):not([data-label="État"]):not([data-label=""]) {
    order: 3; grid-column: 1 / -1; justify-content: space-between; font-size: .9rem; color: var(--ink-light); text-align: right;
  }
  /* Dernière ligne : état (à gauche) + bouton Réinitialiser (à droite) */
  table.synth td[data-label="État"] { order: 4; grid-column: 1; justify-content: flex-start; }
  table.synth td[data-label=""] { order: 5; grid-column: 2; justify-content: flex-end; }
  table.synth td:first-child::before, table.synth td[data-label="Progression"]::before, table.synth td[data-label="État"]::before { content: none !important; }
  table.synth td[data-label]:not([data-label=""])::before { color: var(--ink-light); }
  table.synth .btn-sm { padding: 6px 12px; min-height: 32px; font-size: .8rem; }

  /* En-têtes de synthèse et sous-menus */
  .flex-between > .btn { width: 100%; justify-content: center; }
  .subnav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .subnav::-webkit-scrollbar { display: none; }
  .subnav-item { flex: 1 0 auto; white-space: nowrap; }
}

/* ---------- Sciences : images à compléter ---------- */
.study-card-wide { width: min(920px, 96vw); }
.zone-stage { position: relative; display: block; width: 100%; line-height: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.zone-stage img { display: block; width: 100%; height: auto; user-select: none; }
.zone-done, input.zone-input {
  position: absolute; transform: translate(-50%, -50%);
  min-height: 0; margin: 0; padding: 3px 6px; line-height: 1.25;
  font-family: inherit; font-size: clamp(.62rem, 1.35vw, .92rem); font-weight: 600; text-align: center;
  border-radius: 6px; box-sizing: border-box;
}
input.zone-input { background: rgba(255,255,255,.95); border: 2px solid var(--violet); color: var(--ink); box-shadow: 0 1px 6px rgba(76,29,149,.25); }
input.zone-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(124,58,237,.25); }
.zone-done { background: rgba(220,252,231,.95); border: 2px solid #86efac; color: #166534; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-input.ok, .zone-input-list.ok { border-color: #22c55e; background: #dcfce7; color: #166534; }
.zone-input.ko, .zone-input-list.ko { border-color: #ef4444; background: #fee2e2; color: #991b1b; }
.zone-pin { position: absolute; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--violet); color: #fff; font-size: .78rem; font-weight: 700; line-height: 1; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.35); }
.zone-pin.ok { background: #16a34a; }
.zone-pin.ko { background: #dc2626; }
.zone-list { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.zone-list li { display: flex; align-items: center; gap: 10px; }
.zone-list .zone-input-list { flex: 1; margin: 0; }
.zone-corrections { list-style: none; margin: 4px 0 0; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.zone-corrections li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zone-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--violet); color: #fff; font-size: .74rem; font-weight: 600; flex-shrink: 0; }

/* Éditeur de zones (administration) */
.zone-editor { position: relative; display: block; width: 100%; max-width: 900px; line-height: 0; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.zone-editor img { display: block; width: 100%; height: auto; pointer-events: none; }
.zone-layer { position: absolute; inset: 0; }
.zone-box {
  position: absolute; transform: translate(-50%, -50%); min-height: 28px; box-sizing: border-box;
  display: flex; align-items: center; gap: 6px; padding: 2px 6px; overflow: hidden;
  background: rgba(255,255,255,.92); border: 2px dashed var(--violet); border-radius: 8px;
  font-size: .8rem; line-height: 1.2; cursor: grab; touch-action: none;
}
.zone-box:active { cursor: grabbing; }
.zone-box.zone-box-pin { width: 28px; height: 28px; min-height: 0; padding: 0; justify-content: center; border-radius: 50%; border: 2px solid #fff; background: var(--violet); box-shadow: 0 1px 5px rgba(0,0,0,.35); }
.zone-box.zone-box-pin .zone-num { width: auto; height: auto; background: none; font-size: .85rem; }
.zone-list li.done .zone-done-text { flex: 1; padding: 8px 12px; border-radius: 10px; background: #dcfce7; border: 2px solid #86efac; color: #166534; font-weight: 600; text-align: left; }
.zone-box .zone-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.zone-rows { margin: 4px 0 16px; }
.zone-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.zone-row .zone-answer { flex: 1; min-width: 200px; margin: 0; }
.zone-w { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; white-space: nowrap; }
.zone-w input { width: 72px; margin: 0; }
@media (max-width: 640px) {
  .study-card-wide { padding: 44px 14px 20px; }
}

/* ---------- Résultats (admin) sur smartphone : menus défilables latéralement, une seule ligne par niveau ---------- */
@media (max-width: 640px) {
  .res-chips, .res-chips.res-seg, .res-chips-sub {
    display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 6px;
    border: none; background: none; padding: 2px 0 4px; margin: 8px 0 0; max-width: 100%;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; scroll-snap-type: x proximity;
  }
  .res-chips::-webkit-scrollbar { display: none; }
  .res-chips-sub { margin: 6px 0 10px 8px; padding-left: 10px; border-left: 2px solid #ede9fe; }
  .res-chip, .res-chips-tabs .res-chip, .res-chips-sub .res-chip, .res-seg .res-chip {
    flex: 0 0 auto; white-space: nowrap; scroll-snap-align: center;
    min-height: 38px; padding: 8px 14px; font-size: .88rem;
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
  }
  .res-chip.active, .res-chips-tabs .res-chip.active, .res-chips-sub .res-chip.active {
    background: #f3effe; color: var(--violet-dark); border-color: #ddd6fe; font-weight: 600;
  }
  .res-chip.active::after, .res-chips-tabs .res-chip.active::after { display: none; }
  /* Menu principal : un cran au-dessus, en violet plein */
  nav.res-chips[aria-label="Menu principal"] .res-chip.active {
    background: linear-gradient(90deg, var(--violet), var(--pink)); color: #fff; border-color: transparent;
  }
  /* Dégradé sur le bord où il reste des choix cachés (classes posées par app.js) */
  .res-chips.fade-right, .subnav.fade-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); }
  .res-chips.fade-left, .subnav.fade-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 30px), transparent); }
  .res-chips.fade-left.fade-right, .subnav.fade-left.fade-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 30px, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to right, transparent, #000 30px, #000 calc(100% - 30px), transparent); }
}

/* ---------- Résultats (admin) : synthèse d'un utilisateur ---------- */
.res-hero { display: flex; flex-direction: column; gap: 18px; margin-top: 14px; }
.res-hero-user { display: flex; align-items: center; gap: 14px; }
.res-hero-user h2 { margin: 0; }
.res-hero-user p { margin: 2px 0 0; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; flex-shrink: 0; }
.res-hero-score { display: flex; align-items: center; gap: 24px; }
.res-hero-bar { flex: 1; min-width: 0; }
.res-hero-bar .res-bar { height: 12px; margin: 0 0 8px; }
.res-hero-bar p { margin: 0; }
.res-hero-hints { display: flex; gap: 10px; flex-wrap: wrap; }
.res-hint { padding: 6px 12px; border-radius: 8px; font-size: .88rem; }
.res-hint-good { background: #dcfce7; color: #166534; }
.res-hint-todo { background: #fff4e8; color: #c2410c; }
.res-group-title { margin: 26px 0 0; font-size: 1.05rem; color: var(--ink-light); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.res-group-title + .res-tiles { margin-top: 10px; }
@media (max-width: 640px) {
  .res-hero-score { flex-direction: column; align-items: flex-start; gap: 10px; }
  .res-hero-bar { width: 100%; }
}

/* Fait à retenir (monument / personnalité) sous son nom, au verso de la carte */
.geo-fact { margin-top: 8px; max-width: 100%; max-height: 120px; overflow-y: auto; font-size: .8rem; font-weight: 500; line-height: 1.35; color: var(--ink-light); text-align: center; }
.flip-card-mini.flip-card-tall { height: 320px; }
.flip-card-mini .flip-back .geo-fact { flex-shrink: 1; min-height: 0; }

/* Carte « Fait à retenir » (texte plus long qu'une simple info) */
.geo-fact-text { max-width: 100%; max-height: 210px; overflow-y: auto; font-size: .92rem; font-weight: 600; line-height: 1.4; text-align: center; color: var(--ink); }
