/* =========================================================
   INIMATH APP - Design System
   ========================================================= */

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, "Times New Roman", serif;

  --bg: #FDF8F0;
  --bg-elevated: #FFFFFF;
  --bg-soft: #F5EDDC;
  --bg-softer: #FBF4E3;
  --ink: #0F172A;
  --ink-soft: #475569;
  --ink-mute: #94A3B8;
  --border: #E5E7EB;
  --border-soft: #F1F5F9;

  --brand: #6366F1;
  --brand-2: #A855F7;
  --brand-soft: #EEF2FF;

  --success: #10B981;
  --success-soft: #D1FAE5;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --danger: #EF4444;
  --danger-soft: #FEE2E2;

  --gold-1: #FCD34D;
  --gold-2: #F59E0B;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-2xl: 32px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 12px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .1), 0 4px 12px rgba(15, 23, 42, .06);

  --sidebar-w: 268px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;

  --speed: 220ms;
  --speed-slow: 360ms;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --cp-1: #FF6B9D;
  --cp-2: #FFB199;
  --ce1-1: #FB923C;
  --ce1-2: #FBBF24;
  --ce2-1: #34D399;
  --ce2-2: #6EE7B7;
  --cm1-1: #3B82F6;
  --cm1-2: #60A5FA;
  --cm2-1: #8B5CF6;
  --cm2-2: #A78BFA;

  --c1: var(--brand);
  --c2: var(--brand-2);
}

body[data-classe="cp"]  { --c1: #FFB1C4; --c2: #FFA89A; }
body[data-classe="ce1"] { --c1: #FDB97A; --c2: #FFD56C; }
body[data-classe="ce2"] { --c1: #88E5C2; --c2: #6EE7B7; }
body[data-classe="cm1"] { --c1: #97C5FF; --c2: #A6D7FF; }
body[data-classe="cm2"] { --c1: #C2B0F7; --c2: #B8A4F0; }

* { box-sizing: border-box; margin: 0; padding: 0; }
*:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; border-radius: 6px; }

html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button { font-family: inherit; }
a { color: inherit; }

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 30;
  transition: width var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.brand-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  min-width: 0;
}
.brand-mark { width: 32px; height: 32px; flex: 0 0 32px; }
.brand-name {
  font-weight: 800; font-size: 18px; color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: opacity var(--speed) var(--ease);
}
.sidebar.collapsed .brand-name { opacity: 0; pointer-events: none; }
.sidebar.collapsed .brand { padding: 18px 14px; justify-content: center; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar-toggle {
  width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--speed) var(--ease);
}
.sidebar-toggle:hover { background: var(--bg-soft); color: var(--ink); }
.sidebar-toggle svg { transition: transform var(--speed) var(--ease); }

/* nav */
.classes-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.classes-nav::-webkit-scrollbar { width: 6px; }
.classes-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.classe-card {
  --c1: var(--brand);
  --c2: var(--brand-2);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 12px;
  border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
  background: transparent;
  position: relative;
  transition: background var(--speed) var(--ease);
  min-height: 56px;
}
.classe-card[data-classe="cp"]  { --c1: var(--cp-1);  --c2: var(--cp-2); }
.classe-card[data-classe="ce1"] { --c1: var(--ce1-1); --c2: var(--ce1-2); }
.classe-card[data-classe="ce2"] { --c1: var(--ce2-1); --c2: var(--ce2-2); }
.classe-card[data-classe="cm1"] { --c1: var(--cm1-1); --c2: var(--cm1-2); }
.classe-card[data-classe="cm2"] { --c1: var(--cm2-1); --c2: var(--cm2-2); }

.classe-card:hover { background: var(--bg-soft); }
.classe-card.active {
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  box-shadow: var(--shadow);
}
.classe-card.active .classe-chip { background: rgba(255, 255, 255, .25); color: #fff; }
.classe-card.active .classe-age { color: rgba(255, 255, 255, .85); }
.classe-card.active .classe-progress { background: rgba(255, 255, 255, .25); }
.classe-card.active .progress-bar { background: #fff; }

.classe-chip {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 11px;
  background: var(--c1);
  border: 2px solid var(--ink-warm);
  color: var(--ink-warm);
  font-family: var(--font-display);
  font-weight: 900; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0.02em;
  box-shadow: 2px 2px 0 var(--ink-warm);
}
.classe-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  white-space: nowrap; overflow: hidden;
  transition: opacity var(--speed) var(--ease);
}
.classe-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.classe-age { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.classe-progress {
  position: absolute; left: 12px; right: 12px; bottom: 6px;
  height: 3px; background: var(--border-soft); border-radius: 99px; overflow: hidden;
}
.progress-bar {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  transition: width var(--speed-slow) var(--ease);
}

.sidebar.collapsed .classe-info,
.sidebar.collapsed .classe-progress { opacity: 0; pointer-events: none; }
.sidebar.collapsed .classe-card { justify-content: center; padding: 8px; }

/* Section title (Mini-jeux) */
.nav-section-title {
  margin: 14px 12px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar.collapsed .nav-section-title { display: none; }

/* Cartes spéciales sidebar (jeux / outils / ressources) */
.classe-card-game .game-chip       { background: linear-gradient(135deg, #10B981, #8B5CF6); font-size: 20px; }
.classe-card-tool .tool-chip       { background: linear-gradient(135deg, #FB923C, #EA580C); font-size: 20px; }
.classe-card-resource .resource-chip { background: linear-gradient(135deg, #06B6D4, #0891B2); font-size: 20px; }

.classe-card-game.active     { background: linear-gradient(135deg, #10B981, #8B5CF6); }
.classe-card-tool.active     { background: linear-gradient(135deg, #FB923C, #EA580C); }
.classe-card-resource.active { background: linear-gradient(135deg, #06B6D4, #0891B2); }

.classe-card-game .classe-progress,
.classe-card-tool .classe-progress,
.classe-card-resource .classe-progress { display: none; }

/* profile */
.profile {
  border-top: 1px solid var(--border);
  padding: 14px 12px;
}
.profile-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 4px;
  background: #FFF8E1;
  border: 2px solid var(--ink-warm);
  border-radius: 10px;
  box-shadow: 2px 2px 0 var(--ink-warm);
}
.stat-icon { font-size: 14px; line-height: 1; }
.stat-value {
  font-weight: 800; font-size: 16px; color: var(--ink);
  font-feature-settings: 'tnum';
  margin-top: 2px;
}
.stat-label {
  font-size: 10px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
}
.sidebar.collapsed .profile-stats { grid-template-columns: 1fr; }
.sidebar.collapsed .stat-label { display: none; }

.profile-reset {
  width: 100%; margin-top: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--ink-mute);
  padding: 8px; border-radius: 8px;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: all var(--speed) var(--ease);
}
.profile-reset:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }
.sidebar.collapsed .profile-reset { display: none; }

.profile-legal {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-mute);
  display: flex; gap: 6px; justify-content: center; align-items: center;
}
.profile-legal a {
  color: var(--ink-mute);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--speed) var(--ease);
}
.profile-legal a:hover { color: var(--ink); text-decoration: underline; }
.sidebar.collapsed .profile-legal { display: none; }

/* skip link accessibilité */
.skip-link {
  position: fixed;
  top: -40px; left: 8px;
  background: var(--brand);
  color: #fff; padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700; font-size: 13px;
  z-index: 100;
  transition: top 200ms var(--ease);
}
.skip-link:focus { top: 8px; }

/* bandeau d'information RGPD */
.info-banner {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 12px 12px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 720px;
  width: calc(100% - 32px);
  z-index: 60;
  pointer-events: auto;
  animation: bannerIn 380ms var(--ease) 400ms both;
}
.info-banner[hidden] { display: none !important; }
.info-banner-icon { font-size: 18px; flex-shrink: 0; }
.info-banner-text { flex: 1; line-height: 1.45; }
.info-banner-text strong { color: var(--ink); font-weight: 700; }
.info-banner-link {
  color: var(--brand); text-decoration: none; font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.info-banner-link:hover { text-decoration: underline; }
.info-banner-close {
  background: var(--bg-soft); border: 1.5px solid var(--border);
  width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; font-weight: 700;
  transition: all var(--speed) var(--ease);
  flex-shrink: 0;
  position: relative;
  z-index: 61;
}
.info-banner-close:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.info-banner-close:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

@keyframes bannerIn {
  from { transform: translate(-50%, -16px); opacity: 0; }
  to   { transform: translate(-50%, 0);     opacity: 1; }
}

@media (max-width: 768px) {
  .info-banner {
    top: 12px;
    font-size: 12.5px;
    padding: 10px 10px 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .info-banner-text { flex-basis: 100%; }
  .info-banner-close { width: 30px; height: 30px; font-size: 20px; }
}

/* backdrop mobile */
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 25;
  opacity: 0; pointer-events: none;
  transition: opacity var(--speed) var(--ease);
}
.sidebar.open ~ .sidebar-backdrop { opacity: 1; pointer-events: auto; }

/* ---------- Main / Topbar ---------- */

.main {
  margin-left: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--speed) var(--ease);
}
.sidebar.collapsed ~ .main { margin-left: var(--sidebar-w-collapsed); }

.topbar {
  position: sticky; top: 0; z-index: 10;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: rgba(253, 248, 240, 0.88);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 2px solid var(--ink-warm, #1F1B16);
}

.sidebar-toggle-mobile {
  display: none;
  background: transparent; border: 1px solid var(--border); border-radius: 10px;
  height: 36px; width: 36px;
  cursor: pointer;
  align-items: center; justify-content: center;
  color: var(--ink);
}

.breadcrumb {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--ink-soft);
  font-weight: 500;
  overflow: hidden; white-space: nowrap;
}
.breadcrumb a {
  color: inherit; text-decoration: none;
  transition: color var(--speed) var(--ease);
}
.breadcrumb a:hover { color: var(--ink); }
.crumb-sep { color: var(--ink-mute); }
.crumb-current { color: var(--ink); font-weight: 700; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border);
  height: 36px; width: 36px; border-radius: 10px;
  cursor: pointer; color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--speed) var(--ease);
  font-size: 16px;
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); }

/* ---------- View ---------- */

.view {
  flex: 1;
  min-height: 0;
  padding: 18px 28px 22px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===========================================================
   Welcome v4 — « Carnet de classe magique »
   Direction : neo-brutalisme × livre pour enfants
   Bordures épaisses, ombres dures décalées, stickers tiltés,
   typographie éditoriale Fraunces, fond papier crème.
   =========================================================== */

:root {
  --paper: #FDF8F0;
  --paper-warm: #F8F0DC;
  --ink-warm: #1F1B16;
  --ink-soft-warm: #4A453E;
  --brut-shadow:    5px 5px 0 var(--ink-warm);
  --brut-shadow-sm: 3px 3px 0 var(--ink-warm);
  --brut-shadow-lg: 8px 8px 0 var(--ink-warm);
  --brut-border: 2.5px solid var(--ink-warm);
}

body[data-route="home"] {
  background: var(--paper);
}
body[data-route="home"] .topbar {
  background: rgba(253, 248, 240, 0.88);
  border-bottom-color: rgba(31, 27, 22, 0.1);
}

.welcome {
  flex: 1;
  min-height: 0;
  display: flex; flex-direction: column; gap: 14px;
  position: relative;
  padding: 4px 8px 12px;
  isolation: isolate;
}

/* Symboles mathématiques décoratifs flottants (papier peint subtil) */
.welcome::before {
  content: '';
  position: absolute;
  inset: -10px -20px;
  background-image:
    radial-gradient(circle 320px at 88% 18%, rgba(255, 107, 157, 0.10), transparent 70%),
    radial-gradient(circle 280px at 8% 70%, rgba(52, 211, 153, 0.10), transparent 70%),
    radial-gradient(circle 240px at 70% 90%, rgba(139, 92, 246, 0.08), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.welcome::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
  opacity: 0.55;
  mix-blend-mode: multiply;
}

/* Symboles décoratifs positionnés autour */
.welcome-decor {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 0;
  font-family: var(--font-display);
  font-weight: 900;
  user-select: none;
}
.deco {
  position: absolute;
  font-size: clamp(40px, 4vw, 64px);
  letter-spacing: -0.04em;
  line-height: 1;
  animation: deco-float 8s ease-in-out infinite;
}
.deco-1 { top: 6%;  left: 4%;   color: #FF6B9D; transform: rotate(-12deg); animation-delay: 0s; }
.deco-2 { top: 4%;  right: 32%; color: #FB923C; transform: rotate(8deg);  animation-delay: -2s; font-size: clamp(32px, 3.4vw, 52px); }
.deco-3 { top: 40%; right: 3%;  color: #34D399; transform: rotate(-6deg); animation-delay: -4s; }
.deco-4 { bottom: 32%; left: 1%;  color: #3B82F6; transform: rotate(15deg); animation-delay: -1s; font-size: clamp(28px, 3vw, 44px); }
.deco-5 { bottom: 6%;  right: 22%; color: #8B5CF6; transform: rotate(-10deg); animation-delay: -3s; }
.deco-6 { top: 60%; left: 38%; color: #FCD34D; transform: rotate(20deg); animation-delay: -5s; font-size: clamp(36px, 3.2vw, 48px); }
@keyframes deco-float {
  0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  50%      { transform: translateY(-8px) rotate(calc(var(--r, 0deg) + 3deg)); }
}
.deco-1 { --r: -12deg; } .deco-2 { --r: 8deg; } .deco-3 { --r: -6deg; }
.deco-4 { --r: 15deg; } .deco-5 { --r: -10deg; } .deco-6 { --r: 20deg; }

/* ----- HERO ----- */
.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 18px 28px;
  background: transparent;
  border: 0;
  box-shadow: none;
  flex-shrink: 0;
  z-index: 1;
}

.hero-card .hc-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans);
  font-size: 12px; font-weight: 800;
  background: var(--ink-warm);
  color: var(--paper);
  padding: 6px 14px;
  border-radius: 99px;
  margin-bottom: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(-2deg);
}

.hero-card .hc-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 78px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.035em;
  color: var(--ink-warm);
  margin-bottom: 10px;
  -webkit-background-clip: initial;
  background: none;
  -webkit-text-fill-color: var(--ink-warm);
  filter: none;
}
.hc-title .accent {
  position: relative;
  display: inline-block;
  color: #E11D74;
  white-space: nowrap;
}
.hc-title .accent::after {
  content: '';
  position: absolute;
  left: -4px; right: -4px;
  bottom: -4px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 18' preserveAspectRatio='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 12 Q 50 2 100 10 T 197 8' stroke='%23FCD34D' stroke-width='6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  z-index: -1;
}

.hero-card .hc-sub {
  font-family: var(--font-sans);
  font-size: 16px; font-weight: 500;
  color: var(--ink-soft-warm);
  line-height: 1.5;
  margin-bottom: 14px;
  max-width: 520px;
}

.hero-card .hc-pills {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.hc-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  background: #fff;
  border: var(--brut-border);
  border-radius: 99px;
  font-size: 12px; font-weight: 700;
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
}
.hc-pill strong { font-weight: 800; }
.hc-pill:nth-child(1) { transform: rotate(-1deg); }
.hc-pill:nth-child(2) { transform: rotate(1deg); }
.hc-pill:nth-child(3) { transform: rotate(-0.5deg); }
.hc-pill:nth-child(4) { transform: rotate(0.5deg); }

/* ----- ZOUMA en hero ----- */
.hc-mascot {
  position: relative;
  width: 220px; height: 270px;
  display: flex; align-items: flex-end; justify-content: center;
  flex-shrink: 0;
  padding-top: 38px;
}
.mascot-inline {
  position: static;
  width: 200px; height: 240px;
  filter: drop-shadow(6px 6px 0 var(--ink-warm));
  pointer-events: none;
  animation: zouma-bob 4s ease-in-out infinite;
}
.mascot-inline .snowman { width: 100%; height: 100%; }
@keyframes zouma-bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

.hc-bubble {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  background: #fff;
  border: var(--brut-border);
  border-radius: 18px;
  padding: 9px 14px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
  white-space: nowrap;
  animation: bubblePop 600ms cubic-bezier(0.36, 0, 0.16, 1.4) 800ms backwards;
  z-index: 2;
}
.hc-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px; left: 50%;
  width: 14px; height: 14px;
  background: #fff;
  border-bottom: var(--brut-border);
  border-right: var(--brut-border);
  transform: translateX(-50%) rotate(45deg);
}
@keyframes bubblePop {
  from { opacity: 0; transform: translateX(-50%) rotate(-3deg) scale(0.6) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) rotate(-3deg) scale(1) translateY(0); }
}

/* ----- Bandeau de reprise (post-it) ----- */
.welcome-resume {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  padding: 12px 18px;
  background: #FFF8E1;
  border: var(--brut-border);
  border-radius: 14px;
  box-shadow: var(--brut-shadow);
  flex-shrink: 0;
  transform: rotate(-0.7deg);
}
.welcome-resume-stats { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.ws { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-warm); }
.ws-icon { font-size: 20px; line-height: 1; }
.ws strong {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 900;
  color: var(--ink-warm); font-feature-settings: 'tnum'; line-height: 1;
}
.welcome-resume-cta {
  background: var(--ink-warm);
  color: var(--paper);
  text-decoration: none;
  padding: 10px 20px; border-radius: 99px;
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 800;
  white-space: nowrap;
  border: var(--brut-border);
  box-shadow: var(--brut-shadow-sm);
  letter-spacing: 0.02em;
  transition: all 200ms cubic-bezier(0.36, 0, 0.16, 1.4);
}
.welcome-resume-cta:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink-warm); }

/* ----- Étiquette de section ----- */
.welcome-section-label {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft-warm);
  margin: 4px 4px 0;
  flex-shrink: 0;
}
.welcome-section-label::before,
.welcome-section-label::after {
  content: '';
  flex: 1; height: 2px;
  background: var(--ink-warm);
  opacity: 0.18;
}
.welcome-section-label-icon { font-size: 14px; }

/* ----- Cartes classes (stickers) ----- */
.welcome-classes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  flex-shrink: 0;
  padding: 10px 4px 14px;
}
.welcome-classe {
  --tilt: 0deg;
  background: var(--c-bg, #FF6B9D);
  color: var(--ink-warm);
  padding: 18px 16px 14px;
  border: var(--brut-border);
  border-radius: 22px;
  text-decoration: none;
  text-align: left;
  position: relative;
  display: flex; flex-direction: column;
  min-height: 170px;
  box-shadow: var(--brut-shadow);
  transform: rotate(var(--tilt));
  transition: transform 200ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 200ms cubic-bezier(0.36, 0, 0.16, 1.4);
  animation: classe-in 500ms cubic-bezier(0.36, 0, 0.16, 1.4) backwards;
}
.welcome-classe:nth-child(1) { --tilt: -2deg;  animation-delay: 0ms; }
.welcome-classe:nth-child(2) { --tilt:  1.5deg; animation-delay: 70ms; }
.welcome-classe:nth-child(3) { --tilt: -1deg;  animation-delay: 140ms; }
.welcome-classe:nth-child(4) { --tilt:  2deg;  animation-delay: 210ms; }
.welcome-classe:nth-child(5) { --tilt: -1.5deg; animation-delay: 280ms; }
@keyframes classe-in {
  from { opacity: 0; transform: rotate(var(--tilt)) translateY(20px); }
  to   { opacity: 1; transform: rotate(var(--tilt)) translateY(0); }
}
.welcome-classe:hover {
  transform: rotate(0) translate(-3px, -3px);
  box-shadow: 8px 8px 0 var(--ink-warm);
}
.welcome-classe[data-classe="cp"]  { --c-bg: #FFB1C4; }
.welcome-classe[data-classe="ce1"] { --c-bg: #FDB97A; }
.welcome-classe[data-classe="ce2"] { --c-bg: #88E5C2; }
.welcome-classe[data-classe="cm1"] { --c-bg: #97C5FF; }
.welcome-classe[data-classe="cm2"] { --c-bg: #C2B0F7; }

.welcome-classe-age {
  font-family: var(--font-sans);
  font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-warm);
  opacity: 0.75;
  margin-bottom: 2px;
}
.welcome-classe-name {
  font-family: var(--font-display);
  font-size: clamp(36px, 3.6vw, 48px);
  font-weight: 900;
  letter-spacing: -0.04em; line-height: 0.92;
  color: var(--ink-warm);
  margin-bottom: 6px;
}
.welcome-classe-desc {
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 700;
  color: var(--ink-warm);
  line-height: 1.3;
}
.welcome-classe-meta {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 800;
  color: var(--ink-warm);
  padding-top: 12px;
  gap: 6px;
  position: relative;
}
.welcome-classe-meta-bar {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 6px;
  background: rgba(31, 27, 22, 0.18);
  border-radius: 99px;
  overflow: hidden;
}
.welcome-classe-meta-bar > span {
  display: block; height: 100%;
  background: var(--ink-warm);
  transition: width 360ms cubic-bezier(0.36, 0, 0.16, 1);
}

/* ----- Cartes extras (Snake / Sudoku / Outils / Ressources) ----- */
.welcome-extras {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  flex-shrink: 0;
  padding: 6px 4px 4px;
}
.extra-card {
  --tilt: 0deg;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: var(--brut-border);
  border-radius: 18px;
  text-decoration: none;
  color: var(--ink-warm);
  background: var(--c-bg, #FFF);
  box-shadow: var(--brut-shadow);
  min-height: 92px;
  transform: rotate(var(--tilt));
  transition: transform 200ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 200ms cubic-bezier(0.36, 0, 0.16, 1.4);
  animation: classe-in 500ms cubic-bezier(0.36, 0, 0.16, 1.4) backwards;
}
.extra-card:hover {
  transform: rotate(0) translate(-3px, -3px);
  box-shadow: 8px 8px 0 var(--ink-warm);
}
.extra-card:nth-child(1) { --tilt: -1.5deg; animation-delay: 350ms; }
.extra-card:nth-child(2) { --tilt:  1deg;   animation-delay: 420ms; }
.extra-card:nth-child(3) { --tilt: -1deg;   animation-delay: 490ms; }
.extra-card:nth-child(4) { --tilt:  1.5deg; animation-delay: 560ms; }
.extra-snake     { --c-bg: #88E5C2; }
.extra-sudoku    { --c-bg: #C2B0F7; }
.extra-outils    { --c-bg: #FDB97A; }
.extra-ressources{ --c-bg: #9CDFEC; }

.extra-icon {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(2px 2px 0 var(--ink-warm));
}
.extra-text { flex: 1; min-width: 0; }
.extra-name {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 900;
  letter-spacing: -0.02em; line-height: 1.05;
  color: var(--ink-warm);
  margin-bottom: 3px;
}
.extra-desc {
  font-family: var(--font-sans);
  font-size: 12px; font-weight: 700;
  color: var(--ink-warm);
  opacity: 0.78;
  line-height: 1.3;
}

/* Mascotte fixe visible sur les exercices et le tableau de bord, masquée :
   - sur l'accueil (Zouma est en hero)
   - sur les jeux (Snake/Sudoku) : il bloquerait la grille / le serpent
   - sur les outils, le générateur et les ressources : pas de place et pas pertinent */
.mascot:not(.mascot-inline) { display: block; }
body[data-route="home"] .mascot:not(.mascot-inline),
body[data-route="home"] .mascot-bubble:not(.hc-bubble),
body[data-route="snake"] .mascot:not(.mascot-inline),
body[data-route="snake"] .mascot-bubble:not(.hc-bubble),
body[data-route="sudoku"] .mascot:not(.mascot-inline),
body[data-route="sudoku"] .mascot-bubble:not(.hc-bubble),
body[data-route="outils"] .mascot:not(.mascot-inline),
body[data-route="outils"] .mascot-bubble:not(.hc-bubble),
body[data-route="generateur"] .mascot:not(.mascot-inline),
body[data-route="generateur"] .mascot-bubble:not(.hc-bubble),
body[data-route="ressources"] .mascot:not(.mascot-inline),
body[data-route="ressources"] .mascot-bubble:not(.hc-bubble),
body[data-route="profs"] .mascot:not(.mascot-inline),
body[data-route="profs"] .mascot-bubble:not(.hc-bubble) {
  display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .welcome-classes { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .welcome-extras  { grid-template-columns: repeat(2, 1fr); }
  .hero-card { grid-template-columns: 1fr; gap: 14px; padding: 14px 18px; }
  .hc-mascot { width: 160px; height: 180px; margin: 0 auto; }
  .mascot-inline { width: 160px; height: 180px; }
  .hc-title { font-size: clamp(36px, 7vw, 56px); }
  .deco { display: none; }
  .hc-bubble {
    top: -36px; left: 50%; right: auto;
    transform: translateX(-50%) rotate(-3deg);
  }
  .hc-bubble::after {
    bottom: -10px; left: 32px; right: auto; top: auto;
    transform: rotate(45deg);
    border: 0;
    border-right: var(--brut-border);
    border-bottom: var(--brut-border);
    border-top: 0;
  }
}
@media (max-width: 580px) {
  .welcome-classes { grid-template-columns: repeat(2, 1fr); }
  .welcome-classe-name { font-size: 30px; }
  .welcome-extras { grid-template-columns: 1fr; }
}

/* ---------- Hero (classe / domain header) brutalist ---------- */

.hero {
  background: var(--c1, var(--paper-warm, #F5EDDC));
  color: var(--ink-warm);
  padding: 16px 24px;
  border: var(--brut-border);
  border-radius: 22px;
  margin-bottom: 14px;
  box-shadow: var(--brut-shadow);
  position: relative;
  flex-shrink: 0;
  transform: rotate(-0.4deg);
}
.hero::before, .hero::after { display: none; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;
  background: var(--ink-warm); color: var(--paper);
  padding: 4px 12px; border-radius: 99px;
  margin-bottom: 6px;
  box-shadow: var(--brut-shadow-sm);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 40px); font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--ink-warm);
}
.hero-sub {
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-warm); opacity: 0.78;
  max-width: 640px;
  line-height: 1.45;
}
.hero-meta {
  display: flex; gap: 18px; margin-top: 10px;
  font-size: 11.5px; font-weight: 700;
  color: var(--ink-warm); opacity: 0.85;
  flex-wrap: wrap;
}
.hero-meta div { display: flex; flex-direction: column; gap: 0; }
.hero-meta strong {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 900;
  color: var(--ink-warm);
  font-feature-settings: 'tnum';
  line-height: 1;
}

/* ---------- Domains grid ---------- */

.section-title {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.domains-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.domain-card {
  background: #fff;
  border: var(--brut-border);
  border-radius: 16px;
  padding: 12px 14px;
  text-decoration: none; color: var(--ink-warm);
  transition: transform 200ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 200ms cubic-bezier(0.36, 0, 0.16, 1.4);
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  min-height: 0;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(var(--tilt, 0deg));
}
.domain-card:nth-child(odd)  { --tilt: -0.6deg; }
.domain-card:nth-child(even) { --tilt:  0.6deg; }
.domain-card:hover:not(.locked) {
  transform: rotate(0) translate(-2px, -2px);
  box-shadow: var(--brut-shadow);
}
.domain-card.locked { opacity: 0.5; }

.domain-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--c1);
  color: var(--ink-warm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
  border: 2px solid var(--ink-warm);
  flex-shrink: 0;
}
.domain-title {
  font-family: var(--font-display);
  font-weight: 800; font-size: 15px;
  line-height: 1.15;
  color: var(--ink-warm);
}
.domain-desc {
  font-size: 12px;
  color: var(--ink-warm); opacity: 0.7;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.domain-progress {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--ink-warm); font-weight: 700;
  margin-top: auto;
}
.domain-progress-bar {
  flex: 1; height: 6px;
  background: var(--bg-soft);
  border: 1.5px solid var(--ink-warm);
  border-radius: 99px; overflow: hidden;
}
.domain-progress-bar > span {
  display: block; height: 100%; width: 0%;
  background: var(--c1);
  transition: width 360ms cubic-bezier(0.36, 0, 0.16, 1);
}
.domain-tag-soon {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 800;
  background: var(--ink-warm); color: var(--paper);
  padding: 3px 9px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 0.08em;
  border: 1.5px solid var(--ink-warm);
}

/* ---------- Level path ---------- */

.level-path {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.level-tile {
  position: relative;
  background: #fff;
  border: var(--brut-border);
  border-radius: 16px;
  padding: 10px 10px 12px;
  text-align: center; text-decoration: none; color: var(--ink-warm);
  transition: transform 200ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 200ms cubic-bezier(0.36, 0, 0.16, 1.4);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  justify-content: center;
  min-height: 0;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(var(--tilt, 0deg));
}
.level-tile:nth-child(odd)  { --tilt: -0.5deg; }
.level-tile:nth-child(even) { --tilt:  0.5deg; }
.level-tile:hover:not(.locked) {
  transform: rotate(0) translate(-2px, -2px);
  box-shadow: var(--brut-shadow);
}
.level-tile.locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.level-tile.completed {
  background: var(--c1);
}
.level-tile.perfect {
  background: #FCD34D;
}
.level-tile-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--c1, #FFB1C4);
  color: var(--ink-warm); font-weight: 900; font-size: 16px;
  font-family: var(--font-display);
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink-warm);
  flex-shrink: 0;
}
.level-tile.locked .level-tile-num {
  background: var(--bg-soft);
  color: var(--ink-warm);
  opacity: 0.7;
}
.level-tile.completed .level-tile-num,
.level-tile.perfect .level-tile-num {
  background: #fff;
}
.level-tile-label {
  font-size: 11px; font-weight: 800;
  color: var(--ink-warm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.level-tile-stars { display: flex; gap: 2px; height: 14px; }
.level-tile-stars .star { width: 14px; height: 14px; color: var(--ink-warm); opacity: 0.22; }
.level-tile-stars .star.filled { color: #F59E0B; opacity: 1; }

/* ---------- Exercise ---------- */

.exo {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  background: #fff;
  border: var(--brut-border);
  border-radius: 24px;
  padding: 18px 26px 20px;
  box-shadow: var(--brut-shadow-lg);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transform: rotate(-0.3deg);
}
.exo-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; gap: 16px;
  flex-shrink: 0;
}
#exoBody {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#exoBody > div {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.exo-progress { flex: 1; display: flex; gap: 5px; }
.exo-progress > span {
  flex: 1; height: 8px;
  background: var(--bg-soft);
  border: 2px solid var(--ink-warm);
  border-radius: 99px;
  transition: background var(--speed) var(--ease);
}
.exo-progress > span.done    { background: var(--c1, #FFB1C4); }
.exo-progress > span.current { background: var(--c1, #FFB1C4); opacity: 0.55; }
.exo-progress > span.failed  { background: var(--danger); }

.exo-timer {
  font-feature-settings: 'tnum';
  font-family: var(--font-display);
  font-weight: 800; font-size: 14px; color: var(--ink-warm);
  background: #fff;
  border: 2px solid var(--ink-warm);
  padding: 6px 12px; border-radius: 99px;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  box-shadow: var(--brut-shadow-sm);
}
.exo-timer.warn   { background: #FCD34D; }
.exo-timer.danger { background: #FFB1C4; animation: pulse 600ms ease-in-out infinite; }

.exo-prompt {
  font-family: var(--font-display);
  font-size: clamp(19px, 2.2vw, 24px); font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  line-height: 1.25;
  flex-shrink: 0;
}
.exo-visual {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.count-item {
  width: 48px; height: 48px;
  background: var(--c1, #FFB1C4);
  border: var(--brut-border);
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-warm); font-size: 26px;
  box-shadow: var(--brut-shadow-sm);
  animation: pop 320ms var(--ease) backwards;
}
.shape-svg {
  fill: none;
  stroke: var(--c1);
  stroke-width: 3;
  stroke-linejoin: round;
  color: var(--c1);
}
.shape-svg.filled { fill: var(--c1); fill-opacity: 0.18; }

.clock-svg { color: var(--c1); }
.clock-svg circle:first-of-type { fill: #fff; }

.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  font-size: 0.9em;
  line-height: 1;
  font-feature-settings: 'tnum';
  margin: 0 2px;
}
.frac > span:first-child {
  border-bottom: 2px solid currentColor;
  padding: 0 6px 3px;
  min-width: 1.2em; text-align: center;
}
.frac > span:last-child {
  padding: 3px 6px 0;
  min-width: 1.2em; text-align: center;
}

.frac-bar { color: var(--c1); border-radius: 4px; }

.input-unit {
  text-align: center;
  font-size: 13px; color: var(--ink-mute);
  margin-top: 8px;
  font-style: italic;
}

/* QCM choices brutalist */
.choices {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.choice {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  font-weight: 900; font-size: 22px;
  font-family: var(--font-display);
  color: var(--ink-warm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 150ms cubic-bezier(0.36, 0, 0.16, 1.4);
  user-select: none;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(var(--tilt, 0deg));
}
.choice:nth-child(odd)  { --tilt: -0.5deg; }
.choice:nth-child(even) { --tilt:  0.5deg; }
.choice:hover:not(:disabled) {
  transform: rotate(0) translate(-2px, -2px);
  box-shadow: var(--brut-shadow);
  background: #FFF8E1;
}
.choice:active { transform: rotate(0) translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink-warm); }
.choice.correct {
  background: #88E5C2;
  animation: pop 320ms var(--ease);
}
.choice.wrong {
  background: #FFB1C4;
  animation: shake 320ms var(--ease);
}
.choice:disabled { cursor: default; }

/* Input numpad */
.input-display {
  text-align: center;
  font-family: var(--font-display);
  font-size: 38px; font-weight: 900;
  background: #FCD34D;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 10px 14px;
  margin: 0 auto 10px;
  max-width: 280px;
  width: 100%;
  font-feature-settings: 'tnum';
  min-height: 60px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
}
.input-display.empty { color: var(--ink-warm); opacity: 0.4; }
.input-display.correct { background: #88E5C2; animation: pop 320ms var(--ease); }
.input-display.wrong   { background: #FFB1C4; animation: shake 320ms var(--ease); }

.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  max-width: 300px; margin: 0 auto;
  flex-shrink: 0;
  width: 100%;
}
.numpad button {
  height: 52px;
  border: var(--brut-border); background: #fff;
  border-radius: 12px;
  font-size: 22px; font-weight: 900;
  cursor: pointer; color: var(--ink-warm);
  transition: transform 120ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 120ms cubic-bezier(0.36, 0, 0.16, 1.4);
  font-family: var(--font-display);
  box-shadow: var(--brut-shadow-sm);
  font-feature-settings: 'tnum';
}
.numpad button:hover:not(:disabled) {
  background: #FFF8E1;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink-warm);
}
.numpad button:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink-warm);
}
.numpad button:hover:not(:disabled) { background: var(--bg-soft); }
.numpad button:active:not(:disabled) { transform: scale(0.94); }
.numpad button.act { background: #FCD34D; }
.numpad button.ok  { background: #88E5C2; color: var(--ink-warm); }
.numpad button:disabled { opacity: 0.5; cursor: default; }

/* Compare */
.compare-row {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.compare-num {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 56px); font-weight: 900;
  background: #FFF8E1;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 12px 22px;
  min-width: 120px; text-align: center;
  font-feature-settings: 'tnum';
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(-1deg);
}
.compare-num + .compare-q + .compare-num { transform: rotate(1deg); }
.compare-q {
  font-family: var(--font-display);
  font-size: 40px; color: var(--ink-warm); font-weight: 900;
  opacity: 0.4;
}
.compare-ops {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  max-width: 360px; margin: 0 auto;
}
.compare-op {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 18px; text-align: center; cursor: pointer;
  font-family: var(--font-display); font-weight: 900; font-size: 28px;
  color: var(--ink-warm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 150ms cubic-bezier(0.36, 0, 0.16, 1.4);
  box-shadow: var(--brut-shadow-sm);
}
.compare-op:hover:not(:disabled) {
  background: #FFF8E1;
  transform: translate(-2px, -2px);
  box-shadow: var(--brut-shadow);
}
.compare-op.correct { background: #88E5C2; }
.compare-op.wrong   { background: #FFB1C4; animation: shake 320ms var(--ease); }

/* True / False */
.tf-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  max-width: 460px; margin: 0 auto;
}
.tf-btn {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 22px; cursor: pointer;
  font-family: var(--font-display);
  font-weight: 900; font-size: 18px;
  color: var(--ink-warm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 150ms cubic-bezier(0.36, 0, 0.16, 1.4);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(var(--tilt, 0deg));
}
.tf-btn:nth-child(1) { --tilt: -1deg; }
.tf-btn:nth-child(2) { --tilt:  1deg; }
.tf-btn .tf-icon { font-size: 32px; }
.tf-btn:hover:not(:disabled) {
  background: #FFF8E1;
  transform: rotate(0) translate(-2px, -2px);
  box-shadow: var(--brut-shadow);
}
.tf-btn.correct { background: #88E5C2; animation: pop 320ms var(--ease); }
.tf-btn.wrong   { background: #FFB1C4; animation: shake 320ms var(--ease); }

/* Order */
.order-row {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
  min-height: 80px;
}
.order-pill {
  background: #fff; border: var(--brut-border);
  border-radius: 14px;
  padding: 12px 20px;
  font-family: var(--font-display); font-weight: 900; font-size: 22px;
  cursor: grab;
  user-select: none; touch-action: none;
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 150ms;
  font-feature-settings: 'tnum';
}
.order-pill:hover { background: #FFF8E1; }
.order-pill.selected { background: #FCD34D; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink-warm); }
.order-pill.dragging { opacity: 0.5; transform: rotate(-3deg); }
.order-pill.correct { background: #88E5C2; }
.order-pill.wrong   { background: #FFB1C4; animation: shake 320ms var(--ease); }
.order-hint {
  text-align: center; font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 10px;
}

/* Pair / Match */
.pair-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  max-width: 540px; margin: 0 auto;
}
.pair-col { display: flex; flex-direction: column; gap: 8px; }
.pair-card {
  background: #fff; border: var(--brut-border);
  border-radius: 14px;
  padding: 14px; cursor: pointer;
  text-align: center;
  font-family: var(--font-display); font-weight: 900; font-size: 18px;
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 150ms;
  min-height: 60px;
  display: flex; align-items: center; justify-content: center;
}
.pair-card:hover:not(.matched) { background: #FFF8E1; transform: translate(-2px, -2px); box-shadow: var(--brut-shadow); }
.pair-card.selected { background: #FCD34D; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink-warm); }
.pair-card.matched { background: #88E5C2; pointer-events: none; }
.pair-card.wrong { background: #FFB1C4; animation: shake 320ms var(--ease); }

/* Actions */
.exo-actions {
  display: flex; justify-content: center; gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.btn {
  background: var(--ink-warm);
  color: var(--paper);
  border: var(--brut-border); cursor: pointer;
  padding: 12px 24px; border-radius: 14px;
  font-weight: 800; font-size: 15px;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 150ms cubic-bezier(0.36, 0, 0.16, 1.4);
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: var(--brut-shadow-sm);
  text-decoration: none;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--brut-shadow); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink-warm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
  background: #fff; color: var(--ink-warm);
}
.btn-secondary:hover { background: #FFF8E1; }

/* Feedback inline */
.feedback {
  text-align: center;
  margin-top: auto; padding-top: 12px;
  font-size: 13.5px;
  color: var(--ink-soft);
  min-height: 20px;
  flex-shrink: 0;
}
.feedback.correct { color: var(--success); font-weight: 700; }
.feedback.wrong   { color: var(--danger); font-weight: 700; }

/* ---------- Result ---------- */

.result {
  text-align: center; padding: 28px 32px;
  max-width: 540px; width: 100%; margin: auto;
  background: #fff;
  border: var(--brut-border);
  border-radius: 22px;
  box-shadow: var(--brut-shadow-lg);
  flex-shrink: 0;
  transform: rotate(-0.5deg);
}
.result-stars {
  display: flex; gap: 12px; justify-content: center;
  margin-bottom: 18px;
}
.result-star {
  width: 64px; height: 64px;
  background: #fff;
  border: var(--brut-border);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-warm); font-size: 30px;
  transition: all 540ms var(--ease);
  transform: scale(0.5);
  opacity: 0.5;
  box-shadow: var(--brut-shadow-sm);
}
.result-star.filled {
  background: #FCD34D;
  color: var(--ink-warm);
  transform: scale(1.05);
  opacity: 1;
  box-shadow: var(--brut-shadow);
}
.result-star.show { transform: scale(1); opacity: 1; }
.result-title {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}
.result-sub {
  color: var(--ink-soft);
  font-size: 15px; margin-bottom: 22px;
}
.result-meta {
  display: flex; justify-content: center; gap: 24px;
  font-size: 13px; color: var(--ink-soft);
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.result-meta div { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.result-meta strong {
  color: var(--ink); font-size: 22px;
  font-family: var(--font-display); font-weight: 800;
  font-feature-settings: 'tnum';
}

/* Soon / placeholder */
.soon {
  text-align: center;
  padding: 40px 24px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius-2xl);
  max-width: 540px; width: 100%; margin: auto;
  flex-shrink: 0;
}
.soon-emoji { font-size: 56px; margin-bottom: 14px; }
.soon-title { font-family: var(--font-display); font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.soon-sub { color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; margin-bottom: 22px; }

/* Badge popup */
.badge-popup {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  display: flex; gap: 14px; align-items: center;
  box-shadow: var(--shadow-lg);
  animation: slideIn 360ms var(--ease), fadeOut 360ms 3.4s var(--ease) forwards;
  max-width: 320px;
}
.badge-emoji {
  font-size: 36px;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  width: 56px; height: 56px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 56px;
}
.badge-title { font-weight: 800; font-size: 14px; margin-bottom: 2px; }
.badge-desc  { font-size: 12px; color: var(--ink-soft); line-height: 1.4; }

/* Confetti canvas */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- Mini-jeux : layout commun ---------- */

.view-game {
  padding: 18px 24px 22px !important;
}
.game-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 24px;
  height: 100%;
}
.game-side {
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
  padding-right: 4px;
}
.game-back {
  display: inline-flex; align-items: center;
  color: var(--ink-soft); text-decoration: none; font-weight: 600;
  font-size: 13px; margin-bottom: 4px;
}
.game-back:hover { color: var(--ink); }
.game-h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.1;
  margin-bottom: 4px;
}
.game-sub { color: var(--ink-soft); font-size: 14px; }
.game-section-title {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700;
  margin-bottom: 10px; letter-spacing: -0.01em;
}
.diff-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.diff-btn {
  background: #fff; border: var(--brut-border);
  border-radius: 14px; padding: 12px 14px;
  cursor: pointer; text-align: left;
  display: grid; grid-template-columns: 32px 1fr; gap: 4px 14px;
  font-family: inherit; color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 150ms;
  transform: rotate(var(--tilt, 0deg));
}
.diff-btn:nth-child(1) { --tilt: -0.6deg; }
.diff-btn:nth-child(2) { --tilt:  0.6deg; }
.diff-btn:nth-child(3) { --tilt: -0.4deg; }
.diff-btn:hover { transform: rotate(0) translate(-2px, -2px); box-shadow: var(--brut-shadow); background: #FFF8E1; }
.diff-emoji { grid-row: 1 / span 3; font-size: 28px; align-self: center; }
.diff-name { font-family: var(--font-display); font-weight: 900; font-size: 17px; color: var(--ink-warm); }
.diff-info { font-size: 11px; color: var(--ink-warm); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; }
.diff-detail { font-size: 12px; color: var(--ink-warm); opacity: 0.78; line-height: 1.4; }

.game-rules {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--brut-shadow-sm);
}
.game-rules summary {
  font-weight: 700; font-size: 14px;
  cursor: pointer; user-select: none;
  padding: 4px 0;
}
.game-rules ol { margin: 12px 0 8px 22px; }
.game-rules ol li { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); margin-bottom: 4px; }
.game-rules ol li strong { color: var(--ink); font-weight: 700; }
.game-hint { font-size: 12.5px; color: var(--ink-mute); margin-top: 8px; }

.game-stats {
  display: flex; flex-direction: column; gap: 8px;
  background: #fff; border: var(--brut-border);
  border-radius: 14px; padding: 14px;
  box-shadow: var(--brut-shadow-sm);
}
.game-stat {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--ink-soft);
}
.game-stat .stat-icon { font-size: 18px; }
.game-stat strong { color: var(--ink); font-weight: 800; font-feature-settings: 'tnum'; }
.game-btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: 10px;
  font-weight: 700; font-size: 13.5px;
  font-family: inherit;
  transition: all var(--speed) var(--ease);
}
.game-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.game-btn-secondary {
  background: var(--bg-elevated); color: var(--ink);
  border: 1px solid var(--border);
}
.game-btn-secondary:hover { background: var(--bg-soft); }

.game-question {
  background: #FCD34D;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 14px 18px;
  text-align: center;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(-0.5deg);
}
.game-question-label {
  display: block;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-warm); margin-bottom: 4px;
  opacity: 0.7;
}
.game-question-prompt {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 900;
  color: var(--ink-warm); letter-spacing: -0.02em;
}

.game-canvas-wrap, .game-board-wrap {
  position: relative;
  background: #fff;
  border: var(--brut-border);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  min-height: 0;
  overflow: hidden;
  box-shadow: var(--brut-shadow);
}

.game-canvas-wrap canvas {
  display: block;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  max-width: 100%; max-height: 100%;
  background: #FAFAF7;
}

.game-overlay {
  position: absolute; inset: 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
}
.game-overlay[hidden] { display: none; }
.game-overlay-content {
  text-align: center;
  padding: 24px;
}
.game-overlay-emoji { font-size: 56px; margin-bottom: 10px; }
.game-overlay-text {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  color: var(--ink); margin-bottom: 8px;
}
.game-overlay-score {
  font-size: 18px; color: var(--ink-soft);
  margin-bottom: 4px;
}
.game-overlay-score strong { color: var(--brand); font-size: 24px; }
.game-overlay-best { font-size: 13.5px; color: var(--ink-mute); margin-bottom: 18px; }
.game-overlay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.game-touch-controls {
  display: none;
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  grid-template-columns: repeat(3, 50px);
  grid-template-rows: repeat(2, 50px);
  gap: 6px;
}
.touch-up    { grid-column: 2; grid-row: 1; }
.touch-left  { grid-column: 1; grid-row: 2; }
.touch-right { grid-column: 3; grid-row: 2; }
.touch-down  { grid-column: 2; grid-row: 2; }
.touch-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 18px; font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

/* ---------- Sudoku ---------- */
.sudoku-board {
  display: grid;
  gap: 0;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  width: min(78vh, 100%);
  max-width: 560px;
  aspect-ratio: 1 / 1;
}
.sudoku-cell {
  background: var(--bg-elevated);
  border: 1px solid #d4dae3;
  font-family: var(--font-display);
  font-size: clamp(16px, 4vw, 28px);
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  font-feature-settings: 'tnum';
}
.sudoku-cell.given { background: #f1f5f9; color: var(--ink-soft); cursor: default; }
.sudoku-cell.box-left   { border-left:   2.5px solid var(--ink); }
.sudoku-cell.box-top    { border-top:    2.5px solid var(--ink); }
.sudoku-cell.box-right  { border-right:  2.5px solid var(--ink); }
.sudoku-cell.box-bottom { border-bottom: 2.5px solid var(--ink); }
.sudoku-cell.highlight-row,
.sudoku-cell.highlight-col,
.sudoku-cell.highlight-box { background: #fef3c7; }
.sudoku-cell.highlight-same { background: #fde68a; }
.sudoku-cell.selected {
  background: var(--brand-soft) !important;
  outline: 3px solid var(--brand);
  outline-offset: -3px;
  z-index: 1;
}
.sudoku-cell.wrong  { color: var(--danger); animation: shake 320ms var(--ease); }
.sudoku-cell.right  { color: var(--success); }
.sudoku-board[data-size="4"] .sudoku-cell { font-size: clamp(28px, 6vw, 42px); }
.sudoku-board[data-size="6"] .sudoku-cell { font-size: clamp(22px, 5vw, 34px); }
.sudoku-board[data-size="9"] .sudoku-cell { font-size: clamp(16px, 3.6vw, 26px); }

.sudoku-numpad {
  position: absolute; right: 16px; bottom: 16px;
  display: grid; grid-template-columns: repeat(3, 44px); gap: 6px;
  background: rgba(255, 255, 255, 0.96);
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.sudoku-num {
  height: 44px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 18px; font-weight: 700;
  font-family: var(--font-display);
  color: var(--ink);
  cursor: pointer;
  transition: all var(--speed) var(--ease);
}
.sudoku-num:hover { background: var(--bg-soft); border-color: var(--brand); transform: translateY(-1px); }
.sudoku-num:active { transform: translateY(1px); }
.sudoku-num.sudoku-erase { background: var(--bg-soft); color: var(--ink-soft); }

@media (max-width: 900px) {
  .game-shell { grid-template-columns: 1fr; }
  .game-side { max-height: 40vh; }
  .game-canvas-wrap, .game-board-wrap { min-height: 360px; }
  .sudoku-numpad { right: 8px; bottom: 8px; grid-template-columns: repeat(5, 38px); }
  .sudoku-num { height: 38px; font-size: 16px; }
  .game-touch-controls { display: grid; }
}

/* ---------- Mini-jeux dans l'accueil (grandes cartes) ---------- */
.welcome-games-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex-shrink: 0;
}
.welcome-game-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
  box-shadow: var(--shadow);
}
.welcome-game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.welcome-game-card::before {
  content: '';
  position: absolute; right: -30px; bottom: -30px;
  width: 110px; height: 110px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}
.welcome-game-snake { background: linear-gradient(135deg, #10B981, #059669); }
.welcome-game-sudoku { background: linear-gradient(135deg, #8B5CF6, #6366F1); }

.welcome-game-card-icon {
  font-size: 44px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  position: relative;
  z-index: 1;
}
.welcome-game-card-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.welcome-game-card-name {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
  line-height: 1.1;
}
.welcome-game-card-desc {
  font-size: 12.5px;
  opacity: 0.92;
  line-height: 1.4;
}
.welcome-game-card-cta {
  font-size: 13px; font-weight: 700;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 8px 14px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: background var(--speed) var(--ease);
}
.welcome-game-card:hover .welcome-game-card-cta { background: rgba(255, 255, 255, 0.32); }

@media (max-width: 768px) {
  .welcome-games-grid { grid-template-columns: 1fr; gap: 10px; }
  .welcome-game-card { padding: 14px 18px; gap: 12px; }
  .welcome-game-card-icon { font-size: 36px; }
  .welcome-game-card-name { font-size: 18px; }
  .welcome-game-card-cta { padding: 6px 11px; font-size: 12px; }
}

/* ---------- Outils & calculatrices ---------- */

.view-tools {
  padding: 14px 22px 18px !important;
  overflow: hidden !important;
}
.tools-shell {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  overflow: hidden;
}
.tools-head { flex-shrink: 0; display: flex; align-items: center; gap: 14px; }
.tools-back {
  display: inline-flex; align-items: center;
  color: var(--ink-warm); text-decoration: none;
  font-weight: 700; font-size: 12.5px;
  background: #fff;
  border: var(--brut-border);
  padding: 5px 12px;
  border-radius: 99px;
  box-shadow: var(--brut-shadow-sm);
}
.tools-back:hover { transform: translate(-1px, -1px); box-shadow: var(--brut-shadow); }
.tools-h1 {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.6vh, 24px); font-weight: 900;
  letter-spacing: -0.02em; line-height: 1;
  margin: 0;
  color: var(--ink-warm);
}

.tools-tabs {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  flex-shrink: 0;
}
.tools-tab {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 8px 6px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  font-family: inherit; color: var(--ink-warm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 150ms;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(var(--tilt, 0deg));
}
.tools-tab:nth-child(2n)   { --tilt: 0.4deg; }
.tools-tab:nth-child(2n+1) { --tilt: -0.4deg; }
.tools-tab:hover { transform: rotate(0) translate(-2px, -2px); box-shadow: var(--brut-shadow); }
.tools-tab[aria-selected="true"] {
  background: #FDB97A;
  transform: rotate(0) translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink-warm);
}
.tools-tab-icon { font-size: 22px; line-height: 1; }
.tools-tab-name { font-size: 11.5px; font-weight: 800; text-align: center; line-height: 1.2; }
.tools-tab-desc { font-size: 10px; opacity: 0.75; text-align: center; line-height: 1.25; }

.tools-body {
  flex: 1; min-height: 0;
  overflow: hidden;
  background: #fff;
  border: var(--brut-border);
  border-radius: 22px;
  padding: clamp(12px, 1.8vh, 22px) clamp(14px, 2vw, 26px);
  box-shadow: var(--brut-shadow);
  display: flex; flex-direction: column;
}

.tool {
  display: flex; flex-direction: column;
  gap: clamp(6px, 1vh, 12px);
  flex: 1; min-height: 0;
  overflow: hidden;
}
.tool-h2 {
  font-family: var(--font-display);
  font-size: clamp(17px, 2.3vh, 21px);
  font-weight: 800;
  letter-spacing: -0.01em; margin: 0;
  color: var(--ink-warm);
  flex-shrink: 0;
}
.tool-help {
  font-size: clamp(11.5px, 1.4vh, 13px);
  color: var(--ink-warm); opacity: 0.78;
  line-height: 1.4;
  margin: 0;
  flex-shrink: 0;
}
.tool-help code { background: var(--bg-soft); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(8px, 1.4vh, 14px);
  flex: 1; min-height: 0;
  overflow-y: auto;
  align-content: start;
}
.tool-card {
  background: var(--bg-soft);
  border: var(--brut-border);
  border-radius: 14px;
  padding: clamp(10px, 1.6vh, 14px) 16px;
  display: flex; flex-direction: column; gap: clamp(6px, 1vh, 10px);
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(var(--tilt, 0deg));
}
.tool-card:nth-child(odd)  { --tilt: -0.4deg; }
.tool-card:nth-child(even) { --tilt:  0.4deg; }
.tool-card h3 {
  font-family: var(--font-display);
  font-size: clamp(13.5px, 1.8vh, 15px); font-weight: 700;
  margin: 0; letter-spacing: -0.005em;
}
.tc-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; font-size: clamp(13px, 1.6vh, 14px); color: var(--ink-soft);
}
.tc-row input, .tc-row select {
  font-family: var(--font-display); font-size: clamp(14px, 1.9vh, 16px); font-weight: 800;
  padding: clamp(5px, 0.9vh, 8px) 12px;
  border: var(--brut-border);
  border-radius: 10px; background: #fff;
  max-width: 110px; min-width: 70px;
  color: var(--ink-warm);
  box-shadow: 2px 2px 0 var(--ink-warm);
}
.tc-row input:focus, .tc-row select:focus {
  outline: none;
  background: #FFF8E1;
}
.tc-row strong {
  color: var(--ink-warm);
  background: #FCD34D;
  border: 2px solid var(--ink-warm);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: var(--font-display);
  font-weight: 900; font-size: 18px;
  font-feature-settings: 'tnum';
}
.tc-result {
  font-size: 14px; color: var(--ink-soft);
  padding-top: 4px;
}
.tc-result strong {
  color: var(--brand);
  font-family: var(--font-display);
  font-weight: 800; font-size: 17px;
  font-feature-settings: 'tnum';
}
.tc-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

/* Calculatrice brutalist (vraiment no-scroll, le pad remplit la hauteur dispo) */
.tool-calc {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  display: flex; flex-direction: column;
  gap: clamp(6px, 1vh, 10px);
  flex: 1; min-height: 0;
}
.calc-display {
  font-family: var(--font-display);
  font-size: clamp(20px, 3.2vh, 28px);
  font-weight: 900;
  text-align: right;
  background: #FCD34D;
  border: var(--brut-border);
  border-radius: 12px;
  padding: clamp(6px, 1.2vh, 12px) 16px;
  font-feature-settings: 'tnum';
  word-break: break-all;
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(-0.5deg);
  flex-shrink: 0;
}
.calc-result {
  text-align: right;
  font-family: var(--font-display);
  font-size: clamp(15px, 2.4vh, 20px);
  font-weight: 900;
  color: var(--ink-warm);
  background: #fff;
  border: var(--brut-border);
  border-radius: 12px;
  padding: clamp(3px, 0.7vh, 6px) 14px;
  font-feature-settings: 'tnum';
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(0.4deg);
  flex-shrink: 0;
}
.calc-pad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: clamp(4px, 0.8vh, 8px);
  flex: 1; min-height: 0;
}
.calc-key {
  min-height: 0;
  border: var(--brut-border);
  background: #fff;
  border-radius: 11px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: clamp(15px, 2.4vh, 20px);
  font-weight: 900;
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
  transition: transform 120ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 120ms cubic-bezier(0.36, 0, 0.16, 1.4);
  font-feature-settings: 'tnum';
  display: flex; align-items: center; justify-content: center;
}
.calc-key:hover {
  background: #FFF8E1;
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink-warm);
}
.calc-key:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink-warm);
}
/* opérateurs : jaune */
.calc-key[data-k="+"], .calc-key[data-k="-"], .calc-key[data-k="×"], .calc-key[data-k="÷"] {
  background: #FCD34D;
}
/* C : rouge */
.calc-key.calc-clear { background: #FFB1C4; }
/* ⌫ : orange */
.calc-key.calc-back { background: #FDB97A; }
/* parenthèses : violet pâle */
.calc-key.calc-paren { background: #C2B0F7; }

/* PGCD */
.pgcd-results {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.pgcd-card {
  background: #FDB97A;
  border: var(--brut-border);
  color: var(--ink-warm);
  border-radius: 14px;
  padding: 14px 18px; text-align: center;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(-1deg);
}
.pgcd-card:nth-child(2) {
  background: #C2B0F7;
  transform: rotate(1deg);
}
.pgcd-label { font-size: 11px; font-weight: 800; opacity: 0.8; letter-spacing: 0.06em; text-transform: uppercase; }
.pgcd-value {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 900;
  color: var(--ink-warm);
  font-feature-settings: 'tnum';
  margin-top: 4px;
  line-height: 1;
}
.pgcd-steps {
  margin: 8px 0 0 22px;
  font-family: var(--font-display);
  font-size: 14px; line-height: 1.6;
  color: var(--ink-soft);
  font-feature-settings: 'tnum';
}
.pgcd-steps li strong { color: var(--brand); }
.tool-details summary { font-weight: 700; font-size: 13.5px; cursor: pointer; }

/* Fractions */
.frac-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.frac-input {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-family: var(--font-display); font-size: 18px;
}
.frac-input input {
  width: 80px; text-align: center;
  font-family: var(--font-display); font-size: 24px; font-weight: 900;
  border: var(--brut-border); border-radius: 10px; padding: 6px;
  background: #FFF8E1; color: var(--ink-warm);
}
.frac-line { width: 70px; height: 3px; background: var(--ink-warm); }

/* Conversions */
.conv-tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.conv-tab {
  background: #fff; border: var(--brut-border);
  padding: 8px 16px; border-radius: 99px;
  cursor: pointer; font-family: var(--font-sans); font-weight: 800; font-size: 13px;
  color: var(--ink-warm);
  box-shadow: var(--brut-shadow-sm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 150ms;
}
.conv-tab:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink-warm); }
.conv-tab[aria-selected="true"] {
  background: #FDB97A;
}
.conv-select {
  font-family: var(--font-display); font-size: 16px; font-weight: 800;
  padding: 8px 14px;
  border: var(--brut-border);
  border-radius: 10px; background: #FFF8E1;
  color: var(--ink-warm);
  box-shadow: 2px 2px 0 var(--ink-warm);
}
.conv-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.conv-cell {
  background: #fff;
  border: var(--brut-border);
  border-radius: 12px; padding: 10px 12px;
  font-size: 12px; color: var(--ink-warm); font-weight: 700;
  text-align: center;
  font-feature-settings: 'tnum';
  box-shadow: 2px 2px 0 var(--ink-warm);
}
.conv-cell strong {
  color: var(--ink-warm); font-family: var(--font-display);
  font-weight: 900; font-size: 18px; display: block;
}
.conv-cell.is-src { background: #FCD34D; }

/* Aléatoire */
.random-results {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 8px; min-height: 40px;
}
.rnd-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; height: 52px; padding: 0 14px;
  background: #FDB97A;
  color: var(--ink-warm);
  border: var(--brut-border);
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 900; font-size: 22px;
  font-feature-settings: 'tnum';
  box-shadow: var(--brut-shadow-sm);
  animation: rndPop 360ms cubic-bezier(0.36, 0, 0.16, 1.4) backwards;
  transform: rotate(var(--tilt, 0deg));
}
.rnd-chip:nth-child(3n)   { --tilt: -2deg; }
.rnd-chip:nth-child(3n+1) { --tilt:  1.5deg; }
.rnd-chip:nth-child(3n+2) { --tilt: -1deg; }
@keyframes rndPop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.rnd-chip:nth-child(2) { animation-delay: 60ms; }
.rnd-chip:nth-child(3) { animation-delay: 120ms; }
.rnd-chip:nth-child(4) { animation-delay: 180ms; }
.rnd-chip:nth-child(5) { animation-delay: 240ms; }

/* ---------- Moyenne (deux colonnes adaptatives, no-scroll) ---------- */
.tool-mean { gap: clamp(6px, 1vh, 10px); }
.mean-layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(10px, 1.6vw, 16px);
  align-items: stretch;
}
.mean-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  gap: clamp(5px, 0.8vh, 9px);
  min-height: 0;
}
.mean-cell {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: var(--brut-border);
  border-radius: 10px;
  padding: 0 10px;
  box-shadow: 2px 2px 0 var(--ink-warm);
  min-height: 0;
}
.mean-cell-label {
  font-family: var(--font-display);
  font-size: clamp(11px, 1.4vh, 12.5px);
  font-weight: 800;
  color: var(--ink-warm);
  opacity: 0.65;
  letter-spacing: 0.02em;
  font-feature-settings: 'tnum';
}
.mean-val {
  font-family: var(--font-display);
  font-size: clamp(15px, 2.2vh, 19px);
  font-weight: 900;
  text-align: right;
  border: 0;
  background: transparent;
  color: var(--ink-warm);
  padding: clamp(6px, 1.2vh, 10px) 0;
  width: 100%;
  font-feature-settings: 'tnum';
}
.mean-val:focus { outline: none; }
.mean-cell:focus-within { background: #FFF8E1; }

.mean-results {
  display: grid;
  grid-template-rows: 1.6fr repeat(4, 1fr);
  gap: clamp(5px, 0.8vh, 9px);
  min-height: 0;
}
.mean-result {
  background: #FFF8E1;
  border: var(--brut-border);
  border-radius: 12px;
  padding: clamp(6px, 1vh, 10px) clamp(10px, 1.4vw, 14px);
  display: flex; flex-direction: column;
  justify-content: center;
  gap: 2px;
  box-shadow: var(--brut-shadow-sm);
  min-height: 0;
  overflow: hidden;
}
.mean-result span {
  font-family: var(--font-sans);
  font-size: clamp(10px, 1.3vh, 11.5px);
  font-weight: 800;
  color: var(--ink-warm);
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.mean-result strong {
  font-family: var(--font-display);
  font-size: clamp(17px, 2.6vh, 22px);
  font-weight: 900;
  color: var(--ink-warm);
  font-feature-settings: 'tnum';
  line-height: 1;
}
.mean-result-main {
  background: #FCD34D;
  transform: rotate(-0.6deg);
}
.mean-result-main span { opacity: 0.75; }
.mean-result-main strong {
  font-size: clamp(22px, 4vh, 36px);
}

@media (max-width: 1024px) {
  .tools-tabs { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 760px) {
  .mean-layout { grid-template-columns: 1fr; grid-auto-rows: minmax(0, auto); }
  .mean-inputs { grid-template-columns: repeat(2, 1fr); }
  .mean-results {
    grid-template-rows: none;
    grid-template-columns: repeat(5, 1fr);
  }
  .mean-result-main { grid-column: 1 / -1; }
}
@media (max-width: 580px) {
  .tools-tabs { grid-template-columns: repeat(2, 1fr); }
  .tools-tab-desc { display: none; }
  .frac-grid { grid-template-columns: 1fr; }
  .pgcd-results { grid-template-columns: 1fr; }
  .mean-results { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Générateur de nombres aléatoires ---------- */

.view-generator {
  padding: 18px 24px 22px !important;
  overflow: hidden !important;
}
.gen-shell {
  flex: 1; min-height: 0;
  max-width: 920px; width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px;
  overflow: hidden;
}
.gen-head { flex-shrink: 0; }
.gen-h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 900;
  letter-spacing: -0.02em; line-height: 1.05;
  color: var(--ink-warm);
  margin-bottom: 4px;
}
.gen-sub { font-size: 13.5px; color: var(--ink-warm); opacity: 0.78; }

.gen-stage {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  background: #FCD34D;
  border: var(--brut-border);
  border-radius: 22px;
  padding: 18px 26px;
  box-shadow: var(--brut-shadow);
  flex-shrink: 0;
  transform: rotate(-0.4deg);
}
.gen-display {
  font-family: var(--font-display);
  font-size: clamp(64px, 9vw, 110px);
  font-weight: 900;
  text-align: center;
  color: var(--ink-warm);
  letter-spacing: -0.03em;
  line-height: 1;
  font-feature-settings: 'tnum';
  word-break: break-all;
}
.gen-display.gen-pop { animation: gen-pop 540ms cubic-bezier(0.36, 0, 0.16, 1.4); }
@keyframes gen-pop {
  0%   { transform: scale(0.8) rotate(-4deg); }
  50%  { transform: scale(1.12) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

.gen-roll {
  background: var(--ink-warm);
  color: var(--paper);
  border: var(--brut-border);
  border-radius: 18px;
  padding: 22px 28px;
  cursor: pointer;
  font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: var(--brut-shadow);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4),
              box-shadow 150ms cubic-bezier(0.36, 0, 0.16, 1.4);
}
.gen-roll:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--ink-warm); }
.gen-roll:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink-warm); }
.gen-roll-icon { font-size: 36px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.2)); }
.gen-roll-label { font-family: var(--font-display); font-size: 18px; font-weight: 900; letter-spacing: 0.02em; }

.gen-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  flex-shrink: 0;
}
.gen-control {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: var(--brut-shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
}
.gen-control label {
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-warm); opacity: 0.7;
}
.gen-control input[type="number"] {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 900;
  border: 0; background: transparent;
  color: var(--ink-warm);
  width: 100%;
  font-feature-settings: 'tnum';
}
.gen-control input[type="number"]:focus { outline: none; background: #FFF8E1; border-radius: 6px; }
.gen-control-check {
  justify-content: center;
}
.gen-check {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 13px; font-weight: 700;
  color: var(--ink-warm);
}
.gen-check input { width: 18px; height: 18px; accent-color: var(--ink-warm); }

.gen-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  flex-shrink: 0;
}
.gen-preset {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 12px 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-warm);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: var(--brut-shadow-sm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 150ms;
  transform: rotate(var(--tilt, 0deg));
}
.gen-preset:nth-child(odd)  { --tilt: -0.6deg; }
.gen-preset:nth-child(even) { --tilt:  0.6deg; }
.gen-preset:hover { background: #FFF8E1; transform: rotate(0) translate(-2px, -2px); box-shadow: var(--brut-shadow); }
.gen-preset-emoji { font-size: 24px; line-height: 1; }
.gen-preset-label { font-family: var(--font-display); font-size: 12px; font-weight: 800; }

.gen-history {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--brut-shadow-sm);
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
  overflow: hidden;
}
.gen-history-head {
  display: flex; align-items: center; justify-content: space-between;
}
.gen-history-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 900;
  color: var(--ink-warm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.gen-history-clear {
  background: transparent; border: 2px solid var(--ink-warm);
  border-radius: 99px; padding: 4px 12px;
  font-size: 11px; font-weight: 800;
  color: var(--ink-warm);
  cursor: pointer;
  transition: background 150ms;
}
.gen-history-clear:hover { background: #FFB1C4; }
.gen-history-list {
  flex: 1;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.gen-history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  background: #FFF8E1;
  border: 2px solid var(--ink-warm);
  border-radius: 10px;
  font-size: 13px;
}
.gen-history-range {
  font-size: 11px; font-weight: 700;
  color: var(--ink-warm); opacity: 0.7;
  font-feature-settings: 'tnum';
}
.gen-history-vals {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  color: var(--ink-warm);
  font-feature-settings: 'tnum';
}
.gen-history-empty {
  text-align: center;
  font-size: 13px;
  color: var(--ink-warm); opacity: 0.6;
  padding: 14px;
}

@media (max-width: 768px) {
  .gen-stage { grid-template-columns: 1fr; gap: 14px; }
  .gen-display { font-size: 64px; }
  .gen-controls { grid-template-columns: repeat(2, 1fr); }
  .gen-presets  { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Ressources ---------- */

.view-resources {
  padding: 18px 24px 22px !important;
  overflow: hidden !important;
}
.view-resources .resources {
  flex: 1; min-height: 0;
  overflow-y: auto;
  background: #fff;
  border: var(--brut-border);
  border-radius: 22px;
  padding: 24px 32px 32px;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  line-height: 1.55;
  box-shadow: var(--brut-shadow);
}
.res-head { margin-bottom: 24px; }
.res-h1 {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.1;
  margin-bottom: 10px;
}
.res-sub { color: var(--ink-soft); font-size: 15px; line-height: 1.55; max-width: 700px; }

.res-toc {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 28px;
  padding: 12px 14px;
  background: #FFF8E1;
  border: var(--brut-border);
  border-radius: 14px;
  box-shadow: var(--brut-shadow-sm);
}
.res-toc a {
  color: var(--ink-warm); text-decoration: none; font-weight: 800;
  font-size: 12.5px;
  padding: 4px 12px; border-radius: 99px;
  background: #fff;
  border: 2px solid var(--ink-warm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4);
}
.res-toc a:hover { background: #FCD34D; transform: translateY(-1px); }

.res-section { margin-bottom: 32px; scroll-margin-top: 20px; }
.res-section h2 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.res-section p { color: var(--ink-soft); margin-bottom: 12px; font-size: 14.5px; }
.res-list { margin: 0 0 0 22px; color: var(--ink-soft); }
.res-list li { margin-bottom: 8px; font-size: 14.5px; line-height: 1.6; }
.res-list li strong { color: var(--ink); font-weight: 700; }

.res-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.res-card {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink-warm);
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 150ms;
  box-shadow: var(--brut-shadow-sm);
  transform: rotate(var(--tilt, 0deg));
}
.res-card:nth-child(odd)  { --tilt: -0.5deg; }
.res-card:nth-child(even) { --tilt:  0.5deg; }
.res-card:hover { transform: rotate(0) translate(-2px, -2px); box-shadow: var(--brut-shadow); background: #FFF8E1; }
.res-card-tag {
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-warm); margin-bottom: 4px;
  opacity: 0.7;
}
.res-card-name {
  font-family: var(--font-display);
  font-weight: 900; font-size: 16px;
  margin-bottom: 4px;
  color: var(--ink-warm);
}
.res-card-desc { font-size: 12.5px; color: var(--ink-warm); opacity: 0.78; line-height: 1.45; }

.res-cta-box {
  background: var(--warning-soft);
  border: 1px solid var(--warning);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--ink);
}

.res-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-mute);
}
.res-footer p { color: var(--ink-mute); }
.res-meta { font-style: italic; }

@media (max-width: 768px) {
  .view-resources .resources { padding: 22px 18px; border-radius: var(--radius-xl); }
  .res-h1 { font-size: 26px; }
}

/* ---------- Mascotte (bonhomme de neige) ---------- */

.mascot {
  position: fixed;
  bottom: 14px;
  right: 18px;
  width: 130px;
  height: 175px;
  z-index: 35;
  pointer-events: none;
  transition: transform 360ms var(--ease), opacity 360ms var(--ease);
  filter: drop-shadow(0 6px 16px rgba(15, 23, 42, 0.18));
}
.mascot.mascot-hidden { transform: translate(140px, 0) rotate(8deg); opacity: 0; pointer-events: none; }
.mascot .snowman { width: 100%; height: 100%; display: block; overflow: visible; }

.mascot-toggle {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 220ms var(--ease);
}
.mascot:hover .mascot-toggle { opacity: 1; }

/* mouches/yeux */
.snowman .sn-eyes-closed,
.snowman .sn-mouth-happy,
.snowman .sn-mouth-sad,
.snowman .sn-mouth-surprise,
.snowman .sn-sparkles { display: none; }

.mascot-happy .snowman .sn-mouth-default { display: none; }
.mascot-happy .snowman .sn-mouth-happy { display: block; }

.mascot-sad .snowman .sn-mouth-default { display: none; }
.mascot-sad .snowman .sn-mouth-sad { display: block; }
.mascot-sad .snowman .sn-eyes { display: none; }
.mascot-sad .snowman .sn-eyes-closed { display: block; }

.mascot-celebrate .snowman .sn-mouth-default { display: none; }
.mascot-celebrate .snowman .sn-mouth-happy { display: block; }
.mascot-celebrate .snowman .sn-sparkles { display: block; animation: sn-sparkle 1.6s ease-out infinite; }

.mascot-thinking .snowman .sn-mouth-default { display: none; }
.mascot-thinking .snowman .sn-mouth-surprise { display: block; }

.mascot-surprise .snowman .sn-mouth-default { display: none; }
.mascot-surprise .snowman .sn-mouth-surprise { display: block; }

/* animations corps entier */
.mascot-idle .snowman {
  animation: sn-breathe 3.4s ease-in-out infinite;
}
.mascot-happy .snowman {
  animation: sn-bounce 540ms cubic-bezier(0.36, 0, 0.16, 1.4);
}
.mascot-sad .snowman {
  animation: sn-droop 540ms ease-out forwards;
}
.mascot-celebrate .snowman {
  animation: sn-celebrate 900ms cubic-bezier(0.16, 0.85, 0.34, 1.4);
}
.mascot-thinking .snowman {
  animation: sn-think 1.4s ease-in-out infinite;
}

/* tête qui penche subtilement en idle */
.mascot-idle .sn-head {
  animation: sn-headSway 4.6s ease-in-out infinite;
  transform-origin: 100px 95px;
}

/* clignement automatique en idle */
.mascot-idle .sn-eyes {
  animation: sn-blink 5s ease-in-out infinite;
  transform-origin: 100px 86px;
}

/* bras qui bouge en celebrate */
.mascot-celebrate .sn-arm-right {
  animation: sn-armWave 360ms ease-in-out 3;
  transform-origin: 138px 138px;
}

/* flocons qui tombent doucement en idle */
.mascot-idle .sn-flakes circle {
  animation: sn-fall 5s linear infinite;
}
.mascot-idle .sn-flakes circle:nth-child(2) { animation-delay: -1.5s; }
.mascot-idle .sn-flakes circle:nth-child(3) { animation-delay: -3s; }
.mascot-idle .sn-flakes circle:nth-child(4) { animation-delay: -2.2s; }

@keyframes sn-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-1.5px) scale(1.012); }
}
@keyframes sn-bounce {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-14px) scale(1.06); }
  60%  { transform: translateY(2px) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes sn-droop {
  0%   { transform: translateY(0) scale(1); }
  100% { transform: translateY(4px) scale(0.96); }
}
@keyframes sn-celebrate {
  0%   { transform: translateY(0) rotate(0deg) scale(1); }
  35%  { transform: translateY(-22px) rotate(-6deg) scale(1.08); }
  55%  { transform: translateY(-22px) rotate(6deg)  scale(1.08); }
  85%  { transform: translateY(2px)  rotate(0deg) scale(0.98); }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}
@keyframes sn-think {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-3deg); }
}
@keyframes sn-headSway {
  0%, 100% { transform: rotate(-1.5deg); }
  50%      { transform: rotate(1.5deg); }
}
@keyframes sn-blink {
  0%, 92%, 96%, 100% { transform: scaleY(1); }
  94%                { transform: scaleY(0.1); }
}
@keyframes sn-armWave {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-22deg); }
}
@keyframes sn-fall {
  0%   { transform: translateY(-10px); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(40px); opacity: 0; }
}
@keyframes sn-sparkle {
  0%, 100% { opacity: 0; transform: scale(0.6); }
  50%      { opacity: 1; transform: scale(1.2); }
}

/* bulle de dialogue */
.mascot-bubble {
  position: fixed;
  bottom: 168px;
  right: 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  max-width: 230px;
  opacity: 0;
  transform: translateY(8px) scale(0.94);
  transition: opacity 280ms var(--ease), transform 280ms var(--ease);
  pointer-events: none;
  z-index: 36;
  line-height: 1.35;
}
.mascot-bubble.show { opacity: 1; transform: translateY(0) scale(1); }
.mascot-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px; right: 36px;
  width: 14px; height: 14px;
  background: #fff;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}

@media (max-width: 768px) {
  .mascot { width: 90px; height: 120px; bottom: 8px; right: 8px; }
  .mascot-bubble { bottom: 116px; right: 14px; max-width: 180px; font-size: 12.5px; padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot .snowman, .mascot-idle .sn-head, .mascot-idle .sn-eyes, .mascot-idle .sn-flakes circle {
    animation: none !important;
  }
}

/* Animations */
@keyframes pop {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(20px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fadein { animation: fadein 280ms var(--ease); }

/* ---------- Page « Pour les profs » (route SPA /app/profs) ---------- */
.view-profs {
  padding: 14px 22px 18px !important;
}
.profs-article {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  max-width: 820px; width: 100%; margin: 0 auto;
  background: #fff;
  border: var(--brut-border);
  border-radius: 22px;
  box-shadow: var(--brut-shadow);
  padding: 22px 28px 26px;
  overflow-y: auto;
  color: var(--ink-warm);
}
.profs-head { flex-shrink: 0; margin-bottom: 18px; }
.profs-head .tools-back {
  display: inline-flex; align-items: center;
  background: #FFF8E1;
  border: var(--brut-border);
  padding: 5px 14px;
  border-radius: 99px;
  text-decoration: none;
  color: var(--ink-warm);
  font-family: var(--font-sans);
  font-weight: 700; font-size: 12.5px;
  box-shadow: var(--brut-shadow-sm);
  margin-bottom: 12px;
}
.profs-head .tools-back:hover { transform: translate(-2px, -2px); box-shadow: var(--brut-shadow); }
.profs-tag {
  display: inline-block;
  background: #FDB97A;
  color: var(--ink-warm);
  padding: 3px 12px;
  border: 2px solid var(--ink-warm);
  border-radius: 99px;
  font-family: var(--font-sans);
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 10px;
  transform: rotate(-2deg);
  box-shadow: 2px 2px 0 var(--ink-warm);
}
.profs-h1 {
  font-family: var(--font-display);
  font-size: clamp(26px, 4.2vw, 40px);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin: 6px 0 8px;
  color: var(--ink-warm);
}
.profs-h1 .accent { color: #E11D74; }
.profs-meta {
  font-family: var(--font-sans);
  font-size: 12.5px;
  opacity: 0.72;
  margin: 0;
}
.profs-meta time { font-weight: 700; }

.profs-cover, .profs-image {
  border: var(--brut-border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--brut-shadow-sm);
  margin: 18px 0;
  transform: rotate(-0.3deg);
}
.profs-cover { transform: rotate(-0.4deg); box-shadow: var(--brut-shadow); }
.profs-image:nth-of-type(even) { transform: rotate(0.4deg); }
.profs-cover img, .profs-image img {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-bottom: var(--brut-border);
}
.profs-fallback {
  display: block;
  width: 100%;
  border-bottom: var(--brut-border);
  line-height: 0;
}
.profs-fallback svg { display: block; width: 100%; height: auto; }
.profs-cover figcaption, .profs-image figcaption {
  background: #FFF8E1;
  padding: 10px 16px;
  font-size: 12.5px; font-weight: 700;
  font-style: italic;
  color: var(--ink-warm); opacity: 0.78;
  text-align: center;
}

.profs-lede {
  font-size: 15.5px;
  line-height: 1.65;
  margin: 14px 0 18px;
}

.profs-toc {
  background: #FFF8E1;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 14px 18px;
  margin: 18px 0 24px;
  box-shadow: var(--brut-shadow-sm);
}
.profs-toc-title {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 900;
  color: var(--ink-warm);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.profs-toc ol {
  margin: 0; padding-left: 0; list-style: none;
  counter-reset: profstocnum;
  columns: 2; column-gap: 20px;
}
.profs-toc li {
  counter-increment: profstocnum;
  margin-bottom: 4px;
  break-inside: avoid;
}
.profs-toc li::before {
  content: counter(profstocnum) ". ";
  font-family: var(--font-display); font-weight: 900;
  margin-right: 4px;
}
.profs-toc a {
  color: var(--ink-warm); text-decoration: none;
  font-size: 13px; font-weight: 600;
}
.profs-toc a:hover { text-decoration: underline; }

.profs-section { margin-bottom: 30px; scroll-margin-top: 16px; }
.profs-section h2 {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink-warm);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--ink-warm);
}
.profs-section h3 {
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 800;
  color: var(--ink-warm);
  margin: 18px 0 8px;
}
.profs-section p {
  font-size: 15px; line-height: 1.65;
  margin-bottom: 12px;
}
.profs-section a {
  color: var(--ink-warm);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #FCD34D;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}
.profs-section a:hover { text-decoration-color: #E11D74; }
.profs-section ul, .profs-section ol {
  margin: 0 0 14px 22px;
  font-size: 15px; line-height: 1.65;
}
.profs-section li { margin-bottom: 6px; }
.profs-steps li { margin-bottom: 8px; }

.profs-callout {
  background: #FFF8E1;
  border: var(--brut-border);
  border-left: 8px solid #FCD34D;
  border-radius: 14px;
  padding: 14px 20px;
  margin: 18px 0;
  box-shadow: var(--brut-shadow-sm);
}
.profs-callout-label {
  font-family: var(--font-sans);
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0.72;
  margin-bottom: 4px;
}
.profs-callout p { margin-bottom: 0; }

.profs-faq details {
  background: #fff;
  border: var(--brut-border);
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: 9px;
  box-shadow: var(--brut-shadow-sm);
}
.profs-faq summary {
  cursor: pointer; user-select: none;
  font-family: var(--font-display);
  font-weight: 800; font-size: 15px;
  color: var(--ink-warm);
}
.profs-faq details[open] summary { margin-bottom: 6px; }
.profs-faq details p { margin-bottom: 0; line-height: 1.55; font-size: 14px; }

.profs-end-cta { margin: 30px 0 18px; }
.profs-end-cta h2 {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.6vw, 24px);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 14px;
}
.profs-end-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.profs-end-card {
  background: #fff;
  border: var(--brut-border);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: var(--brut-shadow-sm);
  text-decoration: none;
  color: var(--ink-warm);
  display: flex; align-items: flex-start; gap: 12px;
  transition: transform 150ms cubic-bezier(0.36, 0, 0.16, 1.4), box-shadow 150ms;
}
.profs-end-card:nth-child(1) { transform: rotate(-0.6deg); background: #FFF8E1; }
.profs-end-card:nth-child(2) { transform: rotate(0.4deg); background: #FDB97A; }
.profs-end-card:hover {
  transform: translate(-3px, -3px) rotate(0);
  box-shadow: var(--brut-shadow);
}
.profs-end-icon {
  font-size: 22px; line-height: 1;
  font-weight: 900;
  flex-shrink: 0;
}
.profs-end-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.profs-end-text strong {
  font-family: var(--font-display);
  font-size: 14.5px; font-weight: 900;
}
.profs-end-text span:not(strong) { font-size: 12px; opacity: 0.85; }

.profs-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px solid var(--ink-warm);
  font-size: 12.5px; opacity: 0.72;
}
.profs-footer a {
  color: var(--ink-warm);
  text-decoration: underline;
  text-decoration-color: #FCD34D;
}

@media (max-width: 720px) {
  .profs-toc ol { columns: 1; }
  .profs-end-grid { grid-template-columns: 1fr; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */
/* Tablet : autoriser le scroll si la hauteur disponible devient trop petite */
@media (max-height: 640px), (max-width: 768px) {
  html, body { overflow: auto; }
  .main { height: auto; min-height: 100vh; }
  .view { flex: none; height: auto; overflow: visible; padding: 16px 20px 20px; }
  .welcome { flex: none; height: auto; }
  .welcome-classes { flex: none; height: auto; }
  .welcome-classe { min-height: 130px; }
  .domains-grid {
    flex: none; height: auto;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    grid-template-rows: auto;
  }
  .level-path {
    flex: none; height: auto;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    grid-template-rows: auto;
  }
  .level-tile { min-height: 110px; }
  .exo { flex: none; height: auto; min-height: 0; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0 !important; }
  .sidebar.collapsed ~ .main { margin-left: 0 !important; }
  .sidebar-toggle-mobile { display: inline-flex; }
  .sidebar-toggle { display: none; }
  .topbar { padding: 0 16px; }
  .hero { padding: 18px 22px; border-radius: var(--radius-xl); }
  .welcome-title { font-size: 32px; }
  .welcome-sub { font-size: 14.5px; }
  .exo { padding: 18px; border-radius: var(--radius-xl); }
  .exo-prompt { font-size: 20px; }
  .compare-num { font-size: 40px; padding: 14px 20px; min-width: 100px; }
  .input-display { font-size: 36px; padding: 14px; min-height: 70px; }
  .compare-q { font-size: 32px; }
  .pair-grid { max-width: 100%; }
  .result-star { width: 50px; height: 50px; font-size: 24px; }
  .result-title { font-size: 26px; }
  .welcome-classes { grid-template-columns: repeat(2, 1fr); }
}
