  :root {
    --bg: #0d0f14;
    --bg2: #13161e;
    --bg3: #1a1e29;
    --surface: #1f2433;
    --border: #2a3045;
    --text: #e8eaf2;
    --muted: #8892aa;
    --accent: #4f8ef7;
    --accent2: #7c6af7;
    --accent3: #f76a8f;
    --accent4: #6af7c0;
    --accent5: #f7c06a;
    --accent6: #f76a6a;

    --cat1: #4f8ef7;
    --cat2: #7c6af7;
    --cat3: #f76a8f;
    --cat4: #6af7c0;
    --cat5: #f7c06a;
    --cat6: #f76a6a;
    --cat7: #6af7f7;
    --cat8: #c06af7;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  html { scroll-behavior: smooth; }

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* ─── Noise overlay ─── */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1000;
    opacity: .4;
  }

  /* ─── Nav ─── */
  nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(13,15,20,.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    cursor: pointer;
  }

  .logo-icon {
    position: relative;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #13131f;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    /* Léger dégradé de bordure pour garder l'aspect badge */
    box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 40%, transparent);
  }
  .logo-icon::before {
    content: '';
    position: absolute; inset: -1.5px;
    border-radius: 9.5px;
    background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
    z-index: -1;
    opacity: .7;
  }

  .logo-letter {
    font-family: 'Syne', sans-serif;
    font-size: 20px; font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Alignement visuel avec le wordmark */
    margin-bottom: -1px;
  }

  .logo-px {
    position: absolute;
    border-radius: 2px;
  }
  .logo-px1 { width:4px; height:4px; background:var(--accent3); top:4px; right:4px; }
  .logo-px2 { width:2px; height:2px; background:var(--accent2); top:4px; right:10px; }
  .logo-px3 { width:2px; height:2px; background:var(--accent);  top:10px; right:4px; }

  .logo-text {
    display: flex; flex-direction: column; gap: 1px;
  }

  .logo-wordmark {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    line-height: 1;
    letter-spacing: -.02em;
  }
  .lw-white { color: var(--text); -webkit-text-fill-color: var(--text); }
  .lw-grad {
    background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent3));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .logo-tagline {
    font-size: .6rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    -webkit-text-fill-color: var(--muted);
    padding-left: 2px;
  }

  .nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
  }

  .nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: color .2s;
  }

  .nav-links a:hover { color: var(--text); }

  .nav-cta {
    background: var(--accent);
    color: #fff !important;
    padding: .5rem 1.2rem;
    border-radius: 999px;
    transition: background .2s, transform .2s !important;
  }

  .nav-cta:hover { background: var(--accent2) !important; transform: translateY(-1px); }

  /* ─── Hero ─── */
  .hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 6rem 2rem 4rem;
    position: relative;
    overflow: hidden;
  }

  .hero-bg {
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 60% 60% at 70% 40%, rgba(79,142,247,.12) 0%, transparent 70%),
      radial-gradient(ellipse 40% 40% at 20% 70%, rgba(124,106,247,.1) 0%, transparent 60%),
      radial-gradient(ellipse 30% 30% at 80% 80%, rgba(106,247,192,.07) 0%, transparent 60%);
  }

  .hero-grid {
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(rgba(79,142,247,.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(79,142,247,.04) 1px, transparent 1px);
    background-size: 60px 60px;
  }

  .hero-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
  }

  .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: rgba(79,142,247,.12);
    border: 1px solid rgba(79,142,247,.25);
    padding: .4rem 1rem;
    border-radius: 999px;
    font-size: .8rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 1.5rem;
    animation: fadeUp .6s ease forwards;
  }

  .hero-badge::before { content: '✦'; }

  h1 {
    font-family: 'Syne', sans-serif;
    font-size: clamp(2.8rem, 7vw, 6rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.03em;
    margin-bottom: 1.5rem;
    animation: fadeUp .6s .1s ease forwards;
  }

  h1 em {
    font-style: normal;
    background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .hero-sub {
    font-size: 1.2rem;
    color: var(--muted);
    max-width: 600px;
    line-height: 1.7;
    margin-bottom: 2.5rem;
    font-weight: 300;
    animation: fadeUp .6s .2s ease forwards;
  }

  .hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    animation: fadeUp .6s .3s ease forwards;
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    padding: .8rem 2rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 4px 20px rgba(79,142,247,.3);
  }

  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(79,142,247,.45);
  }

  .btn-secondary {
    background: transparent;
    color: var(--text);
    padding: .8rem 2rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    border: 1px solid var(--border);
    transition: border-color .2s, background .2s;
  }

  .btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(79,142,247,.06);
  }

  .hero-stats {
    display: flex;
    gap: 3rem;
    margin-top: 4rem;
    animation: fadeUp .6s .4s ease forwards;
  }

  .stat-num {
    font-family: 'Syne', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
  }

  .stat-label {
    font-size: .8rem;
    color: var(--muted);
    margin-top: .2rem;
  }

  /* ─── Search ─── */
  .search-section {
    padding: 2rem 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 200;
  }

  .search-wrap {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
  }

  .search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 1.05rem;
    pointer-events: none;
    z-index: 1;
  }

  #searchInput {
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    padding: 1rem 3.2rem 1rem 3.2rem;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
  }

  #searchInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,142,247,.15);
  }

  #searchInput::placeholder { color: var(--muted); }

  /* ─── Clear button ─── */
  .search-clear {
    position: absolute;
    right: .9rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg3);
    border: none;
    border-radius: 50%;
    width: 1.6rem;
    height: 1.6rem;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.1rem;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background .15s, color .15s;
    z-index: 1;
  }
  .search-clear.visible { display: flex; }
  .search-clear:hover { background: var(--border); color: var(--text); }

  /* ─── Filter chips (à l'intérieur du dropdown) ─── */
  .search-filters {
    display: none;
    gap: .35rem;
    flex-wrap: wrap;
    padding: .6rem .8rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
  }
  .search-filters.visible { display: flex; }

  .sf-chip {
    padding: .28rem .85rem;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: 'DM Sans', sans-serif;
  }
  .sf-chip:hover { border-color: var(--accent); color: var(--accent); }
  .sf-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .sf-chip .sf-count { opacity: .7; margin-left: .2rem; font-size: .7rem; }

  /* ─── Categories section ─── */
  .categories-section {
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    isolation: isolate;
    overflow: hidden;
  }

  .section-header {
    text-align: center;
    margin-bottom: 3rem;
  }

  .section-label {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .75rem;
  }

  .section-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .75rem;
  }

  .section-desc {
    color: var(--muted);
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.7;
  }

  /* ─── Category grid ─── */
  .cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
  }

  .cat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    cursor: pointer;
    transition: transform .4s cubic-bezier(.22,1,.36,1), box-shadow .4s cubic-bezier(.22,1,.36,1), border-color .3s ease, background .3s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
    opacity: 1;
    animation: fadeUp .5s ease forwards;
  }

  /* Ligne accent en bas, glisse de gauche avec éasing naturel */
  .cat-card::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--card-color, var(--accent)) 0%, transparent 100%);
    opacity: 0;
    transition: opacity .35s ease;
  }

  .cat-card:hover::before { opacity: 1; }

  /* Glow ambiant en bas-droite, fade simple sans scale */
  .cat-card::after {
    content: '';
    position: absolute;
    bottom: -30px; right: -30px;
    width: 150px; height: 150px;
    border-radius: 50%;
    background: var(--card-color, var(--accent));
    opacity: 0;
    transition: opacity .4s ease;
    filter: blur(55px);
  }

  .cat-card:hover::after {
    opacity: .14;
  }

  .cat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 38px rgba(0,0,0,.38);
    border-color: color-mix(in srgb, var(--card-color, var(--accent)) 35%, transparent);
    background: var(--bg3);
  }

  .cat-icon {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    display: block;
    line-height: 1;
  }

  .cat-name {
    font-family: 'Syne', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: .5rem;
    letter-spacing: -.01em;
  }

  .cat-desc {
    font-size: .85rem;
    color: var(--muted);
    line-height: 1.6;
  }

  .cat-count {
    display: inline-flex;
    align-items: center;
    margin-top: 1rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--card-color, var(--accent));
    gap: .3rem;
  }

  .cat-count::before { content: '→'; }

  /* Barre de progression sur les cartes */
  .cat-progress-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin-top: .6rem;
    overflow: hidden;
  }

  .cat-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .5s ease;
  }

  .cat-progress-label {
    font-size: .75rem;
  }

  /* ─── Fullpage view ─── */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s;
    overflow-y: auto;
  }

  .modal-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  .modal {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    transform: translateY(30px);
    transition: transform .35s cubic-bezier(.22,1,.36,1);
  }

  .modal-overlay.active .modal {
    transform: translateY(0);
  }

  /* Hero-like header for the fullpage view */
  .modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(13,15,20,.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
  }

  .modal-header-back {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: .5rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: .85rem;
    font-family: inherit;
    font-weight: 500;
    transition: background .2s, color .2s, border-color .2s;
    flex-shrink: 0;
  }

  .modal-header-back:hover {
    background: var(--bg3);
    color: var(--text);
    border-color: var(--accent);
  }

  .modal-header-back::before { content: '←'; font-size: 1rem; }

  .modal-header-info {
    display: flex;
    align-items: center;
    gap: .85rem;
    flex: 1;
    min-width: 0;
  }

  .modal-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 48px; height: 48px;
    background: rgba(255,255,255,.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.06);
  }

  .modal-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .modal-subtitle {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* replaces modal-close — kept for JS compat */
  .modal-close {
    display: none;
  }

  /* Page hero banner */
  .modal-hero {
    padding: 3.5rem 2rem 2.5rem;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
  }

  .modal-hero-bg {
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 60% 80% at 80% 50%, var(--modal-hero-glow, rgba(79,142,247,.13)) 0%, transparent 70%),
      radial-gradient(ellipse 30% 50% at 10% 80%, rgba(124,106,247,.07) 0%, transparent 60%);
  }

  .modal-hero-grid {
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(rgba(79,142,247,.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(79,142,247,.035) 1px, transparent 1px);
    background-size: 60px 60px;
  }

  .modal-hero-inner {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
  }

  .modal-hero-icon {
    font-size: 4rem;
    flex-shrink: 0;
    width: 88px; height: 88px;
    background: rgba(255,255,255,.04);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.07);
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
  }

  .modal-hero-text {}

  .modal-hero-tag {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(79,142,247,.1);
    border: 1px solid rgba(79,142,247,.2);
    color: var(--accent);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .3rem .85rem;
    border-radius: 999px;
    margin-bottom: .85rem;
  }

  .modal-hero-tag::before { content: '✦'; }

  .modal-hero-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin-bottom: .6rem;
  }

  .modal-hero-title em {
    font-style: normal;
    background: linear-gradient(135deg, var(--modal-color, var(--accent)), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .modal-hero-desc {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
    font-weight: 300;
    max-width: 550px;
  }

  .modal-body {
    flex: 1;
    padding: 2.5rem 2rem;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .lessons-grid {
    display: grid;
    gap: .75rem;
  }

  .lesson-item {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    text-decoration: none;
  }

  .lesson-item:hover {
    border-color: var(--modal-color, var(--accent));
    background: var(--surface);
  }

  .lesson-num {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: var(--modal-color, var(--accent));
    flex-shrink: 0;
    font-family: 'Syne', sans-serif;
  }

  .lesson-info { flex: 1; }

  .lesson-title {
    font-weight: 500;
    font-size: .95rem;
    color: var(--text);
    margin-bottom: .2rem;
  }

  .lesson-meta {
    font-size: .78rem;
    color: var(--muted);
  }

  .lesson-arrow {
    color: var(--muted);
    font-size: .9rem;
    transition: transform .2s, color .2s;
  }

  .lesson-item:hover .lesson-arrow {
    transform: translateX(4px);
    color: var(--modal-color, var(--accent));
  }

  /* Titre séparateur dans les listes de leçons */
  .lesson-separator {
    background: color-mix(in srgb, var(--modal-color, var(--accent)) 12%, var(--bg3));
    border-color: color-mix(in srgb, var(--modal-color, var(--accent)) 30%, transparent);
    cursor: default;
    pointer-events: none;
  }
  .lesson-separator .lesson-title {
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--modal-color, var(--accent));
  }
  .lesson-separator .lesson-num {
    background: color-mix(in srgb, var(--modal-color, var(--accent)) 20%, transparent);
    color: var(--modal-color, var(--accent));
  }

  /* Leçon terminée */
  .lesson-done {
    opacity: .75;
  }

  .lesson-done .lesson-num {
    background: color-mix(in srgb, var(--modal-color, var(--accent)) 18%, transparent);
  }

  .lesson-check {
    font-size: 1rem;
    font-weight: 900;
  }

  .lesson-done .lesson-title {
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent);
  }

  /* ─── Leçons interactives ─── */
  .lesson-interactive {
    border-color: color-mix(in srgb, var(--modal-color, var(--accent)) 35%, var(--border));
  }
  .lesson-interactive:hover {
    border-color: var(--modal-color, var(--accent));
    background: color-mix(in srgb, var(--modal-color, var(--accent)) 8%, var(--surface));
  }
  .badge-interactive {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--modal-color, var(--accent));
    background: color-mix(in srgb, var(--modal-color, var(--accent)) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--modal-color, var(--accent)) 30%, transparent);
    border-radius: 6px;
    padding: .15rem .5rem;
    margin-left: .5rem;
    vertical-align: middle;
  }

  /* ─── Exercices ─── */
  .lesson-exercise {
    border-color: color-mix(in srgb, #f59e0b 35%, var(--border));
    background: color-mix(in srgb, #f59e0b 5%, var(--bg3));
  }
  .lesson-exercise:hover {
    border-color: #f59e0b;
    background: color-mix(in srgb, #f59e0b 10%, var(--surface));
  }
  .lesson-exercise .lesson-num {
    background: color-mix(in srgb, #f59e0b 18%, transparent);
    color: #f59e0b !important;
    font-size: 1rem;
  }
  .badge-exercise {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #f59e0b;
    background: color-mix(in srgb, #f59e0b 15%, transparent);
    border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
    border-radius: 6px;
    padding: .15rem .5rem;
    margin-left: .5rem;
    vertical-align: middle;
  }

  /* ─── Résultats de recherche ─── */
  /* ─── Fiche Viewer ─── */
  .fv-wrap {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg3);
  }
  .fv-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .3rem .5rem 0;
    overflow-x: auto;
  }
  .fv-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: .55rem .85rem;
    font-family: 'DM Sans', sans-serif;
    font-size: .78rem;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
    border-radius: 6px 6px 0 0;
    margin-bottom: -1px;
  }
  .fv-tab:hover { color: var(--text); background: var(--bg3); }
  .fv-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; background: var(--bg3); }
  .fv-panels { background: var(--bg3); }
  .fv-panel { }
  .fv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-wrap: wrap;
    gap: .5rem;
  }
  .fv-label { font-weight: 600; font-size: .85rem; }
  .fv-dl {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    padding: .35rem .8rem;
    border: 1px solid currentColor;
    border-radius: 8px;
    transition: background .15s;
  }
  .fv-dl:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
  .fv-embed {
    display: block;
    width: 100%;
    height: 680px;
    border: none;
  }

  .search-results {
    display: none;
    position: absolute;
    top: calc(100% - .4rem);
    left: 50%;
    transform: translateX(-50%);
    width: min(700px, calc(100vw - 4rem));
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    max-height: min(540px, 68vh);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    z-index: 1000;
  }
  .search-results::-webkit-scrollbar { width: 5px; }
  .search-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

  .search-results.open { display: block; }

  /* Header with result count */
  .sr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem 1.1rem .5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
    font-size: .73rem;
    color: var(--muted);
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .sr-header-count { font-weight: 700; color: var(--text); }

  /* Group label between sections */
  .sr-group-label {
    padding: .45rem 1.1rem .3rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 2.15rem;
    z-index: 1;
  }

  .sr-item {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .82rem 1.1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .13s;
  }
  .sr-item:last-child { border-bottom: none; }
  .sr-item:hover,
  .sr-item.focused { background: var(--bg3); }
  .sr-item.focused { outline: 2px solid var(--accent); outline-offset: -2px; }
  .sr-item:hover .sr-arrow { transform: translateX(4px); color: var(--sr-color, var(--accent)); }

  .sr-cat-icon { font-size: 1.3rem; flex-shrink: 0; }

  .sr-info { flex: 1; min-width: 0; }

  .sr-title {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sr-meta { font-size: .74rem; color: var(--muted); margin-top: .18rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

  .sr-arrow { color: var(--muted); font-size: .9rem; transition: transform .15s, color .15s; flex-shrink: 0; }

  .sr-empty { padding: 1.5rem; text-align: center; color: var(--muted); font-size: .9rem; }

  .sr-type-badge {
    display: inline-block;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: .12rem .42rem;
    border-radius: 999px;
    background: rgba(79,142,247,.13);
    color: var(--accent);
    vertical-align: middle;
    margin-left: .3rem;
  }

  /* Level badges */
  .sr-level-badge {
    display: inline-block;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .1rem .4rem;
    border-radius: 999px;
  }
  .sr-level-badge.debutant   { background: rgba(34,197,94,.15);  color: #22c55e; }
  .sr-level-badge.intermediaire { background: rgba(251,146,60,.15); color: #fb923c; }
  .sr-level-badge.avance     { background: rgba(239,68,68,.15);  color: #ef4444; }

  /* Interactive dot */
  .sr-interactive-dot {
    display: inline-block;
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-right: .1rem;
  }

  /* Text highlight */
  mark.sr-hl {
    background: rgba(79,142,247,.22);
    color: var(--text);
    border-radius: 3px;
    padding: 0 .1em;
    font-weight: 700;
  }

  /* subcategory buttons inside modal */
  .subcat-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
  }

  .subcat-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: .4rem .8rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
  }

  .subcat-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border-color: transparent;
  }

  /* ─── Breadcrumb navigation ─── */
  .modal-breadcrumb {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: .8rem;
    color: var(--muted);
    flex-wrap: wrap;
    min-height: 2.5rem;
  }

  .modal-breadcrumb.hidden { display: none; }

  .breadcrumb-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
    color: var(--muted);
    transition: color .2s;
    background: none;
    border: none;
    font-size: .8rem;
    font-family: inherit;
    padding: 0;
  }

  .breadcrumb-item:hover { color: var(--text); }

  .breadcrumb-item.active {
    color: var(--modal-color, var(--accent));
    font-weight: 600;
    cursor: default;
  }

  .breadcrumb-sep { color: var(--border); font-size: .75rem; user-select: none; }

  /* ─── Subcategory grid (level 1) ─── */
  .subcat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .75rem;
    margin-bottom: .25rem;
  }

  .subcat-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem .85rem;
    cursor: pointer;
    text-align: center;
    transition: border-color .2s, background .2s, transform .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    font-family: inherit;
    color: var(--text);
    width: 100%;
  }

  .subcat-card:hover {
    border-color: var(--modal-color, var(--accent));
    background: var(--surface);
    transform: translateY(-2px);
  }

  .subcat-card.active {
    border-color: var(--modal-color, var(--accent));
    background: rgba(255,255,255,.04);
  }

  .subcat-card-icon { font-size: 1.6rem; line-height: 1; }

  .subcat-card-name {
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
  }

  .subcat-card-count {
    font-size: .68rem;
    color: var(--modal-color, var(--accent));
    font-weight: 500;
  }

  /* ─── Subcategory tab row (level 1) ─── */
  .subcat-tab-row {
    background: var(--bg2);
    border-radius: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
    padding-bottom: 1rem;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border);
  }

  .subcat-tab-row::-webkit-scrollbar { display: none; }

  .subcat-tab-row .theme-pill {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ─── Theme pills (level 2) ─── */
  .theme-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
  }

  .theme-pill {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: .45rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 500;
    font-size: .82rem;
    font-family: inherit;
    transition: border-color .2s, color .2s, background .2s;
    display: flex;
    align-items: center;
    gap: .35rem;
  }

  .theme-pill::before { content: '◆'; font-size: .5rem; opacity: .4; }

  .theme-pill:hover {
    border-color: var(--modal-color, var(--accent));
    color: var(--text);
  }

  .theme-pill.active {
    background: rgba(255,255,255,.05);
    border-color: var(--modal-color, var(--accent));
    color: var(--modal-color, var(--accent));
    font-weight: 600;
  }

  .theme-pill.active::before { opacity: 1; }

  /* ─── Rangée logiciels (2e niveau de pills) ─── */
  .software-row {
    margin-top: -.5rem;
    padding-top: .75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .25rem;
  }

  .soft-pill {
    font-size: .78rem;
    padding: .35rem .85rem;
    background: var(--bg2);
  }

  .soft-pill::before { content: none; }

  .soft-pill.active {
    background: color-mix(in srgb, var(--modal-color, var(--accent)) 12%, transparent);
  }

  /* ─── Rangée OS (3e niveau de pills : Windows / macOS / Linux) ─── */
  .os-row {
    margin-top: -.5rem;
    padding-top: .75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .25rem;
  }

  .os-pill {
    font-size: .82rem;
    padding: .4rem 1.1rem;
    background: var(--bg2);
    font-weight: 600;
    letter-spacing: .01em;
  }

  .os-pill::before { content: none; }

  .os-pill.active {
    background: color-mix(in srgb, var(--modal-color, var(--accent)) 15%, transparent);
    border-color: var(--modal-color, var(--accent));
    color: var(--modal-color, var(--accent));
  }

  /* ─── Accordéon thèmes logiciel (ex. Excel) ─── */
  .themed-accordion-wrap {
    display: flex;
    flex-direction: column;
    gap: .45rem;
  }

  .themed-accordion {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color .2s;
  }

  .themed-accordion[open] {
    border-color: var(--acc-color, var(--accent));
  }

  .themed-accordion-header {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .85rem 1.1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background .2s;
  }

  .themed-accordion-header::-webkit-details-marker { display: none; }
  .themed-accordion-header::marker { content: ''; }

  .themed-accordion-header:hover {
    background: var(--surface);
  }

  .themed-accordion[open] .themed-accordion-header {
    background: color-mix(in srgb, var(--acc-color, var(--accent)) 8%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--acc-color, var(--accent)) 25%, transparent);
  }

  .themed-accordion-icon {
    font-size: .75rem;
    color: var(--acc-color, var(--accent));
    transition: transform .2s;
    flex-shrink: 0;
  }

  .themed-accordion[open] .themed-accordion-icon {
    transform: rotate(90deg);
  }

  .themed-accordion-name {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: .9rem;
    color: var(--text);
    flex: 1;
  }

  .themed-accordion[open] .themed-accordion-name {
    color: var(--acc-color, var(--accent));
  }

  .themed-accordion-count {
    font-size: .72rem;
    color: var(--muted);
    font-weight: 500;
    background: var(--bg2);
    border: 1px solid var(--border);
    padding: .15rem .55rem;
    border-radius: 999px;
    flex-shrink: 0;
  }

  .themed-accordion-body {
    display: flex;
    flex-direction: column;
    padding: .9rem;
  }

  /* ─── Sous-sections dans un accordéon (ex. Interface utilisateur Blender) ─── */
  .themed-subsection {
    border-top: 1px solid var(--border);
  }
  .themed-subsection:first-child {
    border-top: none;
  }
  .themed-subsection-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem 1rem .35rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--acc-color, var(--accent));
    background: color-mix(in srgb, var(--acc-color, var(--accent)) 6%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--acc-color, var(--accent)) 15%, transparent);
  }
  .themed-subsection-title::before {
    content: '';
    display: inline-block;
    width: .25rem;
    height: .85em;
    border-radius: 2px;
    background: var(--acc-color, var(--accent));
    flex-shrink: 0;
  }
  .themed-subsection .cc-grid {
    padding: .8rem;
  }
  .themed-accordion-body--nested {
    padding: 0;
  }

  /* ─── Bouton Ressources niveau catégorie ─── */
  .cat-resources-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: .6rem;
  }

  .cat-resources-btn {
    background: transparent;
    border: 1px solid rgba(246,173,85,.4);
    color: #f6ad55;
    padding: .28rem .85rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: .73rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: .01em;
    transition: background .15s, border-color .15s;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
  }

  .cat-resources-btn:hover {
    background: rgba(246,173,85,.1);
    border-color: #f6ad55;
  }

  .cat-resources-btn.active {
    background: rgba(246,173,85,.15);
    border-color: #f6ad55;
  }

  .cat-resources-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: .95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background .15s, color .15s, border-color .15s;
    flex-shrink: 0;
  }

  .cat-resources-close:hover {
    background: rgba(255,255,255,.08);
    color: var(--text);
    border-color: var(--text);
  }

  /* ─── Onglet Ressources ─── */
  .resources-pill {
    border-color: rgba(246,173,85,.35);
    color: #f6ad55;
  }

  .resources-pill.active {
    background: rgba(246,173,85,.12);
    border-color: #f6ad55;
    color: #f6ad55;
  }

  /* ─── Filtre par type ─── */
  .resources-type-row {
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
  }

  .resources-type-pill {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: .35rem .9rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: .3rem;
    transition: border-color .2s, color .2s, background .2s;
  }

  .resources-type-pill:hover {
    border-color: var(--res-color, var(--accent));
    color: var(--text);
  }

  .resources-type-pill.active {
    background: color-mix(in srgb, var(--res-color, var(--accent)) 12%, transparent);
    border-color: var(--res-color, var(--accent));
    color: var(--res-color, var(--accent));
    font-weight: 600;
  }

  /* ─── Grille de ressources ─── */
  .resources-grid {
    display: grid;
    gap: .65rem;
  }

  .resource-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .95rem 1.1rem;
    display: flex;
    align-items: center;
    gap: .9rem;
    cursor: pointer;
    text-decoration: none;
    transition: border-color .2s, background .2s;
  }

  .resource-card:hover {
    border-color: var(--res-color, var(--accent));
    background: var(--surface);
  }

  .resource-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.04);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.06);
  }

  .resource-card-body { flex: 1; min-width: 0; }

  .resource-card-type {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: .2rem;
  }

  .resource-card-title {
    font-size: .92rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .resource-card-meta {
    font-size: .75rem;
    color: var(--muted);
    margin-top: .15rem;
  }

  .resource-card-arrow {
    color: var(--muted);
    font-size: .9rem;
    transition: transform .2s, color .2s;
    flex-shrink: 0;
  }

  .resource-card:hover .resource-card-arrow {
    transform: translateX(4px);
    color: var(--res-color, var(--accent));
  }

  /* ─── État vide ─── */
  .resources-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
  }

  .resources-empty span { font-size: 2.5rem; display: block; margin-bottom: .75rem; }
  .resources-empty p { font-size: .9rem; line-height: 1.6; }

  /* ─── Lessons section title ─── */
  .lessons-section-title {
    font-family: 'Syne', sans-serif;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .75rem;
  }

  .lessons-section-title--with-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
  }

  .exercise-mode-toggle {
    font-family: inherit;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: none;
    color: #f59e0b;
    background: color-mix(in srgb, #f59e0b 10%, transparent);
    border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
    border-radius: 999px;
    padding: .35rem .8rem;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
    white-space: nowrap;
  }

  .exercise-mode-toggle:hover {
    background: color-mix(in srgb, #f59e0b 18%, transparent);
    border-color: #f59e0b;
  }

  .exercise-mode-toggle.active {
    color: #fff;
    background: #f59e0b;
    border-color: #f59e0b;
  }

  .difficulty {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .7rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 999px;
    margin-left: .5rem;
  }

  .diff-debutant { background: rgba(106,247,192,.12); color: var(--accent4); }
  .diff-intermediaire { background: rgba(247,192,106,.12); color: var(--accent5); }
  .diff-avance { background: rgba(247,106,143,.12); color: var(--accent3); }

  /* ─── Settings button ─── */
  .settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s, transform .35s ease;
    flex-shrink: 0;
  }

  .settings-btn:hover {
    color: var(--text);
    border-color: var(--accent);
    background: var(--bg3);
  }

  .settings-btn.active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(79,142,247,.1);
    transform: rotate(65deg);
  }

  /* ─── Settings overlay ─── */
  /* ═══ Ancien overlay settings — désactivé, remplacé par .profile-overlay ═══ */
  .settings-overlay { display: none; }

  .settings-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  /* ─── Settings panel ─── */
  .settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 100vw;
    z-index: 300;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.22,1,.36,1);
    overflow: hidden;
  }

  .settings-panel.active {
    transform: translateX(0);
  }

  .settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
    flex-shrink: 0;
  }

  .settings-panel-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
  }

  .settings-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s, border-color .2s;
  }

  .settings-close:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--accent);
  }

  .settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .settings-group {
    display: flex;
    flex-direction: column;
    gap: .75rem;
  }

  .settings-group-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
  }

  .settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 44px;
  }

  .settings-row-info { flex: 1; min-width: 0; }

  .settings-row-title {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
  }

  .settings-row-desc {
    font-size: .75rem;
    color: var(--muted);
    margin-top: .15rem;
    line-height: 1.4;
  }

  /* ─── Theme buttons ─── */
  .settings-theme-btns {
    display: flex;
    gap: .4rem;
    flex-shrink: 0;
  }

  .theme-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .45rem .55rem;
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: .68rem;
    font-weight: 600;
    color: var(--muted);
    font-family: inherit;
    transition: border-color .2s, color .2s, background .2s;
    min-width: 52px;
  }

  .theme-opt span:first-child { font-size: 1.1rem; }

  .theme-opt:hover {
    border-color: var(--accent);
    color: var(--text);
  }

  .theme-opt.active {
    border-color: var(--accent);
    background: rgba(79,142,247,.12);
    color: var(--accent);
  }

  /* ─── Font size buttons ─── */
  .settings-font-btns {
    display: flex;
    gap: .35rem;
    flex-shrink: 0;
  }

  .font-opt {
    width: 38px;
    height: 38px;
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: var(--muted);
    font-size: .95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .2s, color .2s, background .2s;
  }

  .font-opt:hover {
    border-color: var(--accent);
    color: var(--text);
  }

  .font-opt.active {
    border-color: var(--accent);
    background: rgba(79,142,247,.12);
    color: var(--accent);
  }

  /* ─── Toggle switch ─── */
  .settings-toggle {
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
  }

  .settings-toggle input { display: none; }

  .toggle-track {
    width: 44px;
    height: 24px;
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    position: relative;
    transition: background .25s, border-color .25s;
  }

  .toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform .25s cubic-bezier(.22,1,.36,1), background .25s;
  }

  .settings-toggle input:checked + .toggle-track {
    background: rgba(79,142,247,.2);
    border-color: var(--accent);
  }

  .settings-toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
    background: var(--accent);
  }

  /* ─── Language grid ─── */
  .settings-lang-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
  }

  .lang-opt {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: .6rem .8rem;
    cursor: pointer;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 500;
    color: var(--muted);
    text-align: left;
    transition: border-color .2s, color .2s, background .2s;
  }

  .lang-opt:hover {
    border-color: var(--accent);
    color: var(--text);
  }

  .lang-opt.active {
    border-color: var(--accent);
    background: rgba(79,142,247,.1);
    color: var(--accent);
    font-weight: 600;
  }

  /* ─── Reset button ─── */
  .settings-reset {
    width: 100%;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: .7rem 1rem;
    color: var(--muted);
    font-family: inherit;
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
    text-align: center;
  }

  .settings-reset:hover {
    border-color: var(--accent3);
    color: var(--accent3);
    background: rgba(247,106,143,.06);
  }

  /* ─── Light mode ─── */
  body.light-mode {
    --bg: #f5f6fa;
    --bg2: #ffffff;
    --bg3: #eef0f6;
    --surface: #e8eaf2;
    --border: #d0d5e8;
    --text: #1a1d2e;
    --muted: #5c6480;
  }

  body.light-mode nav {
    background: rgba(245,246,250,.9);
  }

  body.light-mode .modal-header {
    background: rgba(245,246,250,.95);
  }

  body.light-mode .settings-panel {
    background: #ffffff;
  }

  body.light-mode .settings-panel-header {
    background: #f5f6fa;
  }

  /* ─── High contrast ─── */
  body.high-contrast {
    --border: #6a7aaa;
    --muted: #a0aac8;
  }

  body.high-contrast .cat-card,
  body.high-contrast .lesson-item,
  body.high-contrast .subcat-card {
    border-width: 2px;
  }

  /* ─── Font sizes ─── */
  body.font-sm { font-size: 14px; }
  body.font-md { font-size: 16px; }
  body.font-lg { font-size: 18px; }
  body.font-xl { font-size: 21px; }

  /* ─── Reduced motion ─── */
  body.no-anim *,
  body.no-anim *::before,
  body.no-anim *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  /* ─── Letter spacing ─── */
  body.wide-spacing { letter-spacing: .04em; }
  body.wide-spacing .hero-badge,
  body.wide-spacing .section-label { letter-spacing: .16em; }

  /* ══════════════════════════════════════════
     Document Viewer
  ══════════════════════════════════════════ */
  .docview-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(8, 9, 14, .96);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: stretch;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }

  .docview-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  .docview-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    transform: translateY(16px);
    transition: transform .3s cubic-bezier(.22,1,.36,1);
  }

  .docview-overlay.active .docview-panel {
    transform: translateY(0);
  }

  /* ── Toolbar ── */
  .docview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1.5rem;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
  }

  .docview-info {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    flex: 1;
  }

  .docview-badge {
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: .2rem .6rem;
    border-radius: 6px;
    background: rgba(79,142,247,.15);
    color: var(--accent);
    border: 1px solid rgba(79,142,247,.3);
    flex-shrink: 0;
  }

  .docview-badge.badge-image { background: rgba(106,247,192,.12); color: var(--accent4); border-color: rgba(106,247,192,.3); }
  .docview-badge.badge-texte { background: rgba(247,192,106,.12); color: var(--accent5); border-color: rgba(247,192,106,.3); }

  .docview-filename {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .docview-pagination {
    display: flex;
    align-items: center;
    gap: .5rem;
  }

  .docview-pager {
    font-size: .82rem;
    color: var(--muted);
    font-weight: 500;
    min-width: 60px;
    text-align: center;
  }

  .docview-tools {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
  }

  .docview-zoom-label {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 600;
    min-width: 44px;
    text-align: center;
  }

  /* Toolbar buttons */
  .docview-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--muted);
    width: 34px; height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none;
  }

  .docview-btn:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--accent);
  }

  .docview-btn:disabled {
    opacity: .35;
    cursor: default;
  }

  .docview-btn-dl { font-size: .9rem; }

  .docview-btn-close {
    background: rgba(247,106,106,.08);
    border-color: rgba(247,106,106,.25);
    color: var(--accent6);
    font-size: .85rem;
  }

  .docview-btn-close:hover {
    background: rgba(247,106,106,.18);
    border-color: var(--accent6);
    color: var(--accent6);
  }

  /* ── Body ── */
  .docview-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    position: relative;
  }

  /* ── States ── */
  .docview-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .9rem;
    color: var(--muted);
    font-size: .9rem;
    text-align: center;
    height: 100%;
    position: absolute;
    inset: 0;
  }

  .docview-error span { font-size: 2.8rem; }

  .docview-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
  }

  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── PDF canvas ── */
  .docview-pdf-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .docview-pdf-wrap canvas {
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
  }

  /* ── Image ── */
  .docview-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
  }

  .docview-img-wrap img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    transition: transform .2s;
  }

  /* ── Texte ── */
  .docview-text-wrap {
    max-width: 800px;
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
  }

  .docview-text-wrap pre {
    font-family: 'DM Sans', sans-serif;
    font-size: .9rem;
    color: var(--text);
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
  }

  /* ── Resource card — viewer badge ── */
  .resource-card-viewable .resource-card-arrow::before {
    content: 'Lire ';
    font-size: .7rem;
    font-weight: 600;
    color: inherit;
  }

  /* ── Responsive viewer ── */
  @media (max-width: 640px) {
    .docview-toolbar { padding: .6rem 1rem; }
    .docview-info { flex: 1 1 100%; order: -1; }
    .docview-body { padding: 1rem .5rem; }
  }

  /* ─── Footer ─── */
  footer {
    border-top: 1px solid var(--border);
    padding: 3rem 2rem;
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
  }

  footer strong {
    font-family: 'Syne', sans-serif;
    color: var(--text);
  }

  /* ─── Animations ─── */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Fallback: ensure animated elements are visible if animation fails */
  .cat-card, .hero-badge, h1, .hero-sub, .hero-actions, .hero-stats {
    animation-fill-mode: forwards;
  }

  /* ─── Particules thématiques du modal hero & page principale ─── */
  .modal-particles,
  .main-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
  }

  /* Particules dans les sections de la page (derrière le contenu) */
  .page-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
  }
  .mp {
    position: absolute;
    line-height: 1;
    user-select: none;
    font-style: normal;
    font-family: 'DM Sans', sans-serif;
    --mp-op: 0.2;
    --mp-rot: 15deg;
    --mp-dist: 90px;
    --mp-vert: -10px;
  }
  .mp.anim-fall  { animation: mp-fall  linear infinite; }
  .mp.anim-rise  { animation: mp-rise  ease-in-out infinite; }
  .mp.anim-drift { animation: mp-drift ease-in-out infinite; }
  .mp.anim-pulse { animation: mp-pulse ease-in-out infinite; }

  @keyframes mp-fall {
    0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
    8%   { opacity: var(--mp-op); }
    92%  { opacity: var(--mp-op); }
    100% { opacity: 0; transform: translateY(var(--mp-dist)) rotate(var(--mp-rot)); }
  }
  @keyframes mp-rise {
    0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
    8%   { opacity: var(--mp-op); }
    92%  { opacity: var(--mp-op); }
    100% { opacity: 0; transform: translateY(calc(var(--mp-dist) * -1)) rotate(var(--mp-rot)); }
  }
  @keyframes mp-drift {
    0%   { opacity: 0; transform: translateX(0) translateY(0); }
    8%   { opacity: var(--mp-op); }
    92%  { opacity: var(--mp-op); }
    100% { opacity: 0; transform: translateX(var(--mp-dist)) translateY(var(--mp-vert)); }
  }
  @keyframes mp-pulse {
    0%   { opacity: 0; transform: scale(0.5); }
    25%  { opacity: var(--mp-op); transform: scale(1); }
    75%  { opacity: var(--mp-op); transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
  }

  body.no-anim .modal-particles,
  body.no-anim .main-particles,
  body.no-anim .page-particles { display: none; }
  @media (prefers-reduced-motion: reduce) {
    .modal-particles, .main-particles, .page-particles { display: none; }
  }

  /* ─── Responsive ─── */
  @media (max-width: 640px) {
    nav { padding: 1rem; }
    .nav-links { display: none; }
    .hero { padding: 5rem 1.2rem 3rem; }
    .categories-section { padding: 2rem 1rem; }
    .hero-stats { gap: 1.5rem; flex-wrap: wrap; }
    .modal-header { flex-wrap: wrap; padding: .75rem 1rem; }
    .modal-hero { padding: 2rem 1rem 1.5rem; }
    .modal-hero-icon { width: 60px; height: 60px; font-size: 2.6rem; border-radius: 14px; }
    .modal-hero-inner { gap: 1rem; }
    .modal-body { padding: 1.5rem 1rem; }
  }

  /* hidden for search */
  .cat-card.hidden { display: none !important; }

  /* scrollbar */
  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: var(--bg); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   ⌨️  KEYBOARD TRAINER
   ═══════════════════════════════════════════════════════════ */

#ktOverlay {
  position: fixed; inset: 0; z-index: 600;
  background: var(--bg); overflow-y: auto;
  padding-top: 64px;
  animation: fadeInUp .25s ease;
}
.kt-container { display: flex; flex-direction: column; min-height: 100%; }

/* ── Header ── */
.kt-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 610;
  background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; height: 54px; box-sizing: border-box;
}
.kt-back {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 14px; cursor: pointer; color: var(--text2); font-size: .9rem;
  white-space: nowrap; transition: all .15s;
}
.kt-back:hover { border-color: var(--accent); color: var(--accent); }
.kt-close {
  margin-left: auto; background: none; border: 1.5px solid var(--border);
  border-radius: 50%; width: 32px; height: 32px; cursor: pointer;
  color: var(--text2); font-size: 1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
}
.kt-close:hover { background: #ef444420; border-color: #ef4444; color: #ef4444; }
.kt-header-title { font-weight: 700; font-size: 1.05rem; color: var(--text); flex: 1; white-space: nowrap; }
.kt-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.kt-tab {
  background: none; border: 1px solid transparent; border-radius: 8px;
  padding: 6px 14px; cursor: pointer; color: var(--text2); font-size: .85rem;
  transition: all .15s;
}
.kt-tab:hover { background: var(--bg2); color: var(--text); }
.kt-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* ── Body ── */
.kt-body { flex: 1; padding: 24px 20px; max-width: 1100px; width: 100%; margin: 0 auto; }
.kt-section-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 24px 0 14px; }

/* ── Buttons ── */
.kt-btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: 10px 24px; cursor: pointer; font-size: .95rem; font-weight: 600;
  transition: opacity .15s, transform .1s;
}
.kt-btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.kt-btn-secondary {
  background: var(--bg2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 18px; cursor: pointer; font-size: .9rem;
  transition: all .15s;
}
.kt-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.kt-btn-danger {
  background: none; color: #ef4444; border: 1px solid #ef444444; border-radius: 10px;
  padding: 8px 18px; cursor: pointer; font-size: .85rem; transition: all .15s;
}
.kt-btn-danger:hover { background: #ef444418; }

/* ── HOME ── */
.kt-home-hero {
  background: linear-gradient(135deg, var(--accent)15, var(--bg2));
  border: 1px solid var(--accent)33; border-radius: 16px;
  padding: 32px; text-align: center; margin-bottom: 24px;
}
.kt-home-icon { font-size: 3.5rem; margin-bottom: 12px; }
.kt-home-hero h2 { font-size: 1.6rem; margin: 0 0 10px; color: var(--text); }
.kt-home-hero p { color: var(--text2); margin: 0 0 20px; max-width: 480px; margin-left: auto; margin-right: auto; }
.kt-home-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.kt-hs-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-align: center;
}
.kt-hs-val { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.kt-hs-label { font-size: .8rem; color: var(--text2); margin-top: 4px; }

/* Levels grid */
.kt-levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kt-level-card {
  background: var(--bg2); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 16px; cursor: pointer; transition: all .18s;
}
.kt-level-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px #0002; }
.kt-lc-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 10px; }
.kt-lc-title { font-weight: 700; font-size: .95rem; margin-bottom: 6px; color: var(--text); }
.kt-lc-desc { font-size: .8rem; color: var(--text2); margin-bottom: 10px; line-height: 1.4; }
.kt-lc-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; background: var(--bg3); color: var(--text2); }
.kt-lc-new { background: var(--accent)15 !important; color: var(--accent) !important; }

/* ── TRAINING ── */
.kt-training { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.kt-level-sidebar { display: flex; flex-direction: column; gap: 4px; }
.kt-sidebar-sep {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text2); padding: 10px 12px 4px;
  opacity: .7;
}
.kt-pair-keys {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 2px;
}
.kt-pair-key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  background: var(--bg); border: 2px solid var(--border);
  border-radius: 8px; border-bottom-width: 3px;
  font-family: 'Courier New', monospace; font-size: .95rem; font-weight: 700;
  color: var(--text); box-shadow: 0 2px 0 var(--border);
}
.kt-pair-divider {
  color: var(--text2); font-weight: 700; font-size: 1.1rem; margin: 0 2px;
}
.kt-level-btn {
  background: none; border: 1.5px solid transparent; border-radius: 10px;
  padding: 8px 12px; cursor: pointer; color: var(--text2); font-size: .85rem;
  text-align: left; display: flex; align-items: center; gap: 8px;
  transition: all .15s;
}
.kt-level-btn:hover { background: var(--bg2); color: var(--text); }
.kt-level-btn.active { font-weight: 600; }
.kt-training-main { min-width: 0; }
.kt-level-intro {
  background: var(--bg2); border-left: 4px solid var(--accent);
  border-radius: 14px; padding: 28px; display: flex;
  flex-direction: column; gap: 12px; align-items: flex-start;
}
.kt-level-intro h3 { margin: 0; font-size: 1.3rem; }
.kt-level-intro p { margin: 0; color: var(--text2); }

/* ── EXERCISE ── */
.kt-exercise { display: flex; flex-direction: column; gap: 14px; }
.kt-stats-bar {
  display: flex; gap: 8px; background: var(--bg2);
  border-radius: 12px; padding: 12px 16px;
}
.kt-stat { flex: 1; text-align: center; }
.kt-stat-val { display: block; font-size: 1.5rem; font-weight: 800; color: var(--text); }
.kt-stat-label { font-size: .75rem; color: var(--text2); }
.kt-text-wrap {
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 20px 24px; min-height: 80px;
  overflow: hidden; width: 100%; box-sizing: border-box;
}
.kt-text { font-size: 1.15rem; line-height: 2.2; font-family: 'Courier New', monospace; letter-spacing: .04em; word-break: break-word; overflow-wrap: break-word; white-space: normal; }
.kt-char { color: var(--text2); position: relative; }
.kt-char.kt-ok { color: #22c55e; }
.kt-char.kt-cursor {
  color: var(--text);
  border-bottom: 3px solid var(--accent);
  animation: ktBlink 1s step-end infinite;
}
@keyframes ktBlink { 0%,100%{border-color:var(--accent);} 50%{border-color:transparent;} }
.kt-shake { animation: ktShake .3s ease !important; }
@keyframes ktShake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-6px);} 75%{transform:translateX(6px);} }

/* ── Finger hint ── */
.kt-finger-hint {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 20px; border: 1.5px solid;
  font-size: .85rem; font-weight: 500;
}
.kt-fh-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Virtual keyboard ── */
.kt-kb-wrap { overflow-x: auto; padding-bottom: 4px; }
.kt-kb { display: flex; flex-direction: column; gap: 4px; min-width: 680px; }
.kt-kb-row { display: flex; gap: 4px; }
.kt-kb-key {
  height: 44px; border-radius: 8px; border: 1.5px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 500; cursor: default;
  background: var(--bg2); transition: all .12s; user-select: none;
  min-width: 0;
}

/* ── RESULT ── */
/* Session bar */
.kt-session-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 10px 16px; margin-bottom: 14px;
}
.kt-sb-left { display: flex; align-items: center; gap: 6px; }
.kt-sb-icon { font-size: 1.1rem; }
.kt-sb-time { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.kt-sb-label { font-size: .78rem; color: var(--text2); }
.kt-sb-mid { font-size: .85rem; color: var(--text2); display: flex; align-items: center; gap: 5px; }
.kt-sb-val { font-weight: 700; color: var(--text); }
.kt-sb-sep { opacity: .4; }
#ktSessContent { min-height: 80px; }

.kt-result { text-align: center; padding: 32px 20px; }
.kt-result-icon { font-size: 3.5rem; margin-bottom: 12px; }
.kt-result h3 { font-size: 1.5rem; margin: 0 0 20px; }
.kt-result-stats { display: flex; gap: 20px; justify-content: center; margin-bottom: 16px; }
.kt-rs-item { text-align: center; }
.kt-rs-val { font-size: 2rem; font-weight: 800; color: var(--text); }
.kt-rs-label { font-size: .8rem; color: var(--text2); }
.kt-result-msg { color: var(--text2); margin-bottom: 20px; font-size: .95rem; }
.kt-result-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── GAMES ── */
.kt-games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.kt-game-card {
  background: var(--bg2); border: 1.5px solid var(--border); border-radius: 16px;
  padding: 24px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center;
  transition: transform .18s;
}
.kt-game-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px #0003; }
.kt-gc-icon { font-size: 3rem; }
.kt-game-card h4 { margin: 0; font-size: 1.1rem; color: var(--text); }
.kt-game-card p { margin: 0; color: var(--text2); font-size: .88rem; line-height: 1.5; }

/* Cascade arena */
.kt-game-hud {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg2); border-radius: 12px; padding: 10px 16px;
  margin-bottom: 10px; font-size: .9rem; color: var(--text2);
}
.kt-game-hud strong { color: var(--text); }
.kt-cascade-arena {
  background: var(--bg2); border-radius: 14px; border: 1.5px solid var(--border);
  position: relative; overflow: hidden; margin-bottom: 10px;
}
.kt-falling-word {
  background: var(--accent); color: #fff; border-radius: 20px;
  padding: 4px 14px; font-size: .9rem; font-weight: 600;
  white-space: nowrap; display: inline-block; position: absolute;
  box-shadow: 0 2px 8px #0003;
}
.kt-cascade-input {
  width: 100%; box-sizing: border-box;
  padding: 12px 16px; border-radius: 12px;
  border: 2px solid var(--accent); background: var(--bg);
  color: var(--text); font-size: 1rem; outline: none;
}

/* Perfect info */
.kt-perfect-info { color: #f97316; font-size: .88rem; margin: 0; }

/* ── STATS PAGE ── */
.kt-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.kt-sp-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 20px; text-align: center; }
.kt-sp-val { font-size: 2rem; font-weight: 800; }
.kt-sp-label { font-size: .82rem; color: var(--text2); margin-top: 4px; }

/* Progress bars */
.kt-levels-progress { display: flex; flex-direction: column; gap: 10px; }
.kt-lp-row { display: grid; grid-template-columns: 180px 1fr 80px; align-items: center; gap: 12px; }
.kt-lp-name { font-size: .88rem; color: var(--text); }
.kt-lp-bar-wrap { height: 8px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.kt-lp-bar { height: 100%; border-radius: 4px; transition: width .6s ease; }
.kt-lp-score { font-size: .85rem; font-weight: 700; text-align: right; }

/* ── Responsive ── */
@media (max-width: 700px) {
  .kt-training { grid-template-columns: 1fr; }
  .kt-level-sidebar { flex-direction: row; flex-wrap: wrap; }
  .kt-home-stats, .kt-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .kt-lp-row { grid-template-columns: 130px 1fr 60px; }
  .kt-header { padding: 8px 12px; }
}

/* ═══════════════════════════════════════════════════════════════
   NUMÉRIQ'TILS — Outils
═══════════════════════════════════════════════════════════════ */

.outils-section {
  padding: 5rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.outils-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-top: 2.5rem;
}

/* ── Vue outils d'une catégorie ── */
.outils-tools-view {
  margin-top: 2.5rem;
}

.outils-tools-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.outils-back-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s, color .18s;
}

.outils-back-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.outils-cat-breadcrumb {
  font-family: 'Syne', sans-serif;
  font-size: .95rem;
  font-weight: 700;
}

.outils-tools-view .outils-grid {
  margin-top: 0;
}

.outil-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.6rem 1.4rem 1.4rem;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
}

.outil-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--tool-color, var(--accent)) 0%, transparent 60%);
  opacity: .06;
  transition: opacity .2s;
}

.outil-card:hover {
  border-color: var(--tool-color, var(--accent));
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}

.outil-card:hover::before { opacity: .12; }

.outil-card-icon {
  font-size: 2.2rem;
  margin-bottom: .9rem;
  display: block;
  line-height: 1;
}

.outil-card-icon-img {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  border-radius: 8px;
}

.outil-card-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: .35rem;
}

.outil-card-desc {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.45;
}

.outil-card-tag {
  display: inline-block;
  margin-top: .8rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--tool-color, var(--accent));
  background: color-mix(in srgb, var(--tool-color, var(--accent)) 12%, transparent);
  padding: .2rem .65rem;
  border-radius: 999px;
  letter-spacing: .04em;
}

/* ── Métronome beat ── */
.metro-beat {
  font-size: 4rem;
  color: var(--muted);
  transition: transform .08s, color .08s;
  margin-bottom: .4rem;
  display: inline-block;
  line-height: 1;
}

/* ── Outil Overlay ── */
.outil-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: none;
  overflow-y: auto;
}

.outil-overlay.open { display: block; }

.outil-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.outil-panel-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 2rem;
  background: rgba(13,15,20,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.outil-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: .85rem;
  transition: color .2s, border-color .2s;
}

.outil-back:hover { color: var(--text); border-color: var(--text); }

.outil-panel-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.outil-panel-body {
  flex: 1;
  padding: 2.5rem 2rem;
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
}

/* ── Shared tool UI ── */
.tool-hero {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.tool-hero-icon {
  font-size: 3rem;
  line-height: 1;
}

.tool-hero h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: .25rem;
}

.tool-hero p {
  color: var(--muted);
  font-size: .9rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.8rem;
  margin-bottom: 1.5rem;
}

.tool-card h3 {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.tool-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}

.tool-dropzone:hover,
.tool-dropzone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.tool-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.tool-dropzone-icon { font-size: 2rem; margin-bottom: .5rem; }
.tool-dropzone p { color: var(--muted); font-size: .9rem; margin-top: .3rem; }
.tool-dropzone strong { color: var(--text); }

.tool-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .8rem;
  flex-wrap: wrap;
}

.tool-label {
  font-size: .88rem;
  color: var(--muted);
  min-width: 120px;
}

.tool-select,
.tool-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem .9rem;
  border-radius: 8px;
  font-size: .88rem;
  font-family: inherit;
  transition: border-color .2s;
}

.tool-select:focus,
.tool-input:focus {
  outline: none;
  border-color: var(--accent);
}

.tool-input { width: 90px; }

.tool-range {
  -webkit-appearance: none;
  appearance: none;
  width: 180px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.tool-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.tool-range-val {
  font-size: .85rem;
  color: var(--accent);
  font-weight: 700;
  min-width: 36px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .65rem 1.5rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, transform .15s;
}

.tool-btn:hover { background: var(--accent2); transform: translateY(-1px); }
.tool-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.tool-btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.tool-btn-secondary:hover { background: var(--bg3); border-color: var(--accent); }

.tool-preview-wrap {
  margin-top: 1.2rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  text-align: center;
  background: var(--bg2);
  padding: 1rem;
}

.tool-preview-wrap img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 6px;
  object-fit: contain;
}

.tool-result {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.tool-result-info { font-size: .88rem; color: var(--muted); }
.tool-result-info strong { color: var(--text); }

.tool-checkbox-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
  cursor: pointer;
}

.tool-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.tool-checkbox-row span { font-size: .88rem; color: var(--text); }

.tool-password-display {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  color: var(--accent4);
  letter-spacing: .06em;
  word-break: break-all;
  margin-bottom: 1rem;
  min-height: 3rem;
}

.tool-pdf-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .8rem;
}

.tool-pdf-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .6rem 1rem;
  font-size: .85rem;
}

.tool-pdf-item-name { flex: 1; color: var(--text); }
.tool-pdf-item-size { color: var(--muted); font-size: .78rem; }
.tool-pdf-item-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: .1rem .3rem;
  transition: color .15s;
}
.tool-pdf-item-del:hover { color: var(--accent3); }

.tool-info-box {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  font-size: .83rem;
  color: var(--muted);
  margin-top: 1rem;
}

.tool-info-box strong { color: var(--accent); }

.tool-stats-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: .6rem;
}
.tool-stat { font-size: .82rem; color: var(--muted); }
.tool-stat strong { color: var(--text); }

/* ── Onglets mot de passe ── */
.pw-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.2rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .35rem;
}

.pw-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: .55rem .8rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, color .2s;
  white-space: nowrap;
}

.pw-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.pw-tab:not(.active):hover { color: var(--text); }

/* Boutons de mode (mot / phrase) */
.pw-mode-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .45rem 1rem;
  border-radius: 8px;
  font-size: .83rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}

.pw-mode-btn.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}

.pw-mode-btn:not(.active):hover { color: var(--text); border-color: var(--text); }

/* Variantes */
.pw-variant {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.pw-variant:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent4);
}

/* Responsive */
@media (max-width: 700px) {
  .outils-grid { grid-template-columns: repeat(2, 1fr); }
  .outil-panel-body { padding: 1.5rem 1rem; }
  .tool-row { flex-direction: column; align-items: flex-start; }
  .pw-tabs { flex-direction: column; }
  .stem-tracks-grid { grid-template-columns: 1fr 1fr; }
  .stem-result-item { flex-direction: column; align-items: flex-start; }
  .stem-dl-btn { align-self: flex-end; }
}

/* ── Bouton secondaire compact ───────────────────────────────── */
.tool-btn-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .4rem .9rem;
  border-radius: 8px;
  font-size: .82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.tool-btn-sm:hover {
  background: var(--bg3);
  border-color: var(--accent);
}

/* ── Canvas signature pad ────────────────────────────────────── */
#psignCanvas {
  background: #fff;
  border-radius: 0;
  display: block;
}

/* ── OCR / Traduction : textarea résultat ────────────────────── */
#pocrText, #ptransText {
  font-family: 'JetBrains Mono', monospace;
}

/* ── Séparateur de pistes (mixeur) ───────────────────────────── */

/* File bar */
.stem-filebar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.stem-filebar-left { display: flex; align-items: center; gap: .65rem; min-width: 0; flex-shrink: 0; }
.stem-filebar-emoji { font-size: 1.4rem; flex-shrink: 0; }
.stem-filebar-meta { min-width: 0; }
.stem-filebar-name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.stem-filebar-dur  { font-size: .74rem; color: var(--muted); margin-top: .1rem; }
.stem-master-wave  { flex: 1; min-width: 80px; border-radius: 6px; }
.stem-analyze-btn  { flex-shrink: 0; }

/* Progress */
.stem-prog-header { display: flex; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.stem-prog-anim {
  font-size: 1.7rem;
  display: block;
  animation: stemSpin 1.8s linear infinite;
  flex-shrink: 0;
}
@keyframes stemSpin { to { transform: rotate(360deg); } }
.stem-prog-title { font-weight: 600; font-size: .92rem; }
.stem-prog-sub   { font-size: .78rem; color: var(--muted); margin-top: .12rem; }

.stem-progress-wrap {
  height: 8px;
  background: var(--bg3);
  border-radius: 999px;
  overflow: hidden;
  margin: .6rem 0 .8rem;
}
.stem-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #a855f7, #6366f1);
  border-radius: 999px;
  transition: width .35s ease;
}

.stem-prog-steps { display: flex; flex-direction: column; gap: .3rem; }
.stem-prog-step {
  font-size: .77rem;
  color: var(--muted);
  padding-left: 1.3rem;
  position: relative;
  transition: color .2s;
}
.stem-prog-step::before { content: "○"; position: absolute; left: 0; font-size: .7rem; }
.stem-prog-step.done { color: var(--text); }
.stem-prog-step.done::before { content: "✓"; color: #10b981; }

/* Transport */
.stem-transport {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1.1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: .65rem;
}
.stem-transport-play {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  border: none; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, opacity .15s;
}
.stem-transport-play:hover { transform: scale(1.08); opacity: .9; }
.stem-transport-center {
  display: flex; align-items: center; gap: .55rem; flex: 1; min-width: 0;
}
.stem-transport-time { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.stem-seekbar {
  flex: 1; height: 5px; background: var(--bg3);
  border-radius: 999px; position: relative; cursor: pointer;
}
.stem-seekbar-fill {
  height: 100%;
  background: linear-gradient(90deg, #a855f7, #6366f1);
  border-radius: 999px;
  pointer-events: none;
  width: 0%;
}
.stem-seekbar-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: #a855f7; border: 2px solid var(--bg);
  position: absolute; top: 50%; left: 0%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: left .05s linear;
}
.stem-zip-btn { flex-shrink: 0; font-size: .8rem; padding: .45rem .9rem; }

/* Track list */
.stem-tracks-list { display: flex; flex-direction: column; gap: .55rem; margin-bottom: .65rem; }

.stem-track-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  overflow: hidden;
  transition: border-color .2s;
}
.stem-track-card:hover { border-color: var(--tc, #a855f7); }

.stem-track-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem .55rem;
  gap: .75rem;
}
.stem-track-id { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.stem-track-badge {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: color-mix(in srgb, var(--tc, #a855f7) 16%, transparent);
  color: var(--tc, #a855f7);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.stem-track-name { font-weight: 600; font-size: .86rem; }
.stem-track-desc { font-size: .73rem; color: var(--muted); margin-top: .08rem; }

.stem-track-ctrl { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }

.stem-mute-btn, .stem-solo-btn {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  transition: background .15s, border-color .15s, color .15s;
}
.stem-mute-btn:hover { border-color: var(--tc, #a855f7); color: var(--tc, #a855f7); }
.stem-solo-btn:hover { border-color: var(--tc, #a855f7); color: var(--tc, #a855f7); }
.stem-mute-btn.muted  { background: color-mix(in srgb, #ef4444 15%, transparent); border-color: #ef4444; color: #ef4444; }
.stem-solo-btn.active { background: color-mix(in srgb, var(--tc, #a855f7) 20%, transparent); border-color: var(--tc, #a855f7); color: var(--tc, #a855f7); }

.stem-vol {
  width: 76px;
  -webkit-appearance: none;
  height: 4px;
  background: var(--bg3);
  border-radius: 999px;
  cursor: pointer;
  outline: none;
  accent-color: var(--tc, #a855f7);
}
.stem-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--tc, #a855f7); cursor: pointer;
}
.stem-vol::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--tc, #a855f7); cursor: pointer; border: none;
}

.stem-dl-track {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.stem-dl-track:hover { border-color: var(--tc, #a855f7); color: var(--tc, #a855f7); }

.stem-track-wave {
  display: block; width: 100%;
  background: color-mix(in srgb, var(--tc, #a855f7) 5%, var(--bg2));
  border-top: 1px solid var(--border);
}

.stem-mixer-footer { padding: .3rem 0 .5rem; }
.stem-reset-btn { background: transparent !important; border: 1px solid var(--border) !important; color: var(--text) !important; }
.stem-reset-btn:hover { background: var(--bg2) !important; }

@media (max-width: 600px) {
  .stem-filebar { gap: .6rem; }
  .stem-master-wave { width: 100%; order: 3; }
  .stem-analyze-btn { order: 4; width: 100%; }
  .stem-transport { flex-wrap: wrap; gap: .6rem; }
  .stem-transport-center { order: 2; width: 100%; }
  .stem-zip-btn { order: 3; }
  .stem-vol { width: 55px; }
  .stem-track-ctrl { gap: .3rem; }
}

/* ═══════════════════════════════════════════════════════════════
   NQ AUTH — Bouton nav + Modale connexion
   ═══════════════════════════════════════════════════════════════ */

/* ─── Bouton auth dans la nav ─── */
.nq-auth-btn {
  position: relative;
}
.nq-auth-avatar {
  display: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nq-auth-icon {
  display: block;
}
.nq-auth-btn.logged-in .nq-auth-avatar { display: flex; }
.nq-auth-btn.logged-in .nq-auth-icon   { display: none; }
.nq-auth-btn.logged-in {
  border-color: var(--accent);
  background: rgba(79,142,247,.12);
  color: var(--accent);
}
.nq-auth-btn.logged-in:hover {
  background: rgba(79,142,247,.2);
}

/* ─── Overlay sombre ─── */
.nq-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  padding: 1rem;
}
.nq-auth-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ─── Carte modale ─── */
.nq-auth-modal {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  width: 400px;
  max-width: 100%;
  transform: scale(.94) translateY(10px);
  transition: transform .28s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 32px 80px rgba(0,0,0,.55);
}
.nq-auth-overlay.active .nq-auth-modal {
  transform: scale(1) translateY(0);
}

/* ─── Bouton fermer ─── */
.nq-auth-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: .95rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  transition: color .2s, background .2s;
}
.nq-auth-close:hover {
  color: var(--text);
  background: var(--surface);
}

/* ─── En-tête logo ─── */
.nq-auth-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.6rem;
}
.nq-auth-site-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

/* ─── Onglets ─── */
.nq-auth-tabs {
  display: flex;
  gap: .3rem;
  background: var(--bg3);
  border-radius: 10px;
  padding: .25rem;
  margin-bottom: 1.5rem;
}
.nq-tab {
  flex: 1;
  padding: .48rem .6rem;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: background .2s, color .2s;
}
.nq-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.nq-tab:hover:not(.active) { color: var(--text); }

/* ─── Formulaires ─── */
.nq-auth-form { display: none; }
.nq-auth-form.active { display: block; }

.nq-auth-desc {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.6;
  margin-bottom: 1.3rem;
}

/* ─── Champs ─── */
.nq-field { margin-bottom: 1rem; }
.nq-field label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: .4rem;
  letter-spacing: .025em;
  text-transform: uppercase;
}
.nq-field input {
  width: 100%;
  padding: .72rem 1rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: .9rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color .2s, background .2s, box-shadow .2s;
  outline: none;
}
.nq-field input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79,142,247,.15);
}

/* ─── Messages erreur / succès ─── */
.nq-msg {
  font-size: .825rem;
  padding: .55rem .8rem;
  border-radius: 9px;
  margin-bottom: .9rem;
  line-height: 1.5;
  display: none;
}
.nq-msg:not(:empty) { display: block; }
.nq-error {
  background: rgba(247,106,143,.1);
  color: var(--accent3);
  border: 1px solid rgba(247,106,143,.2);
}
.nq-success {
  background: rgba(106,247,192,.1);
  color: var(--accent4);
  border: 1px solid rgba(106,247,192,.2);
}

/* ─── Bouton principal ─── */
.nq-submit {
  display: block;
  width: 100%;
  padding: .82rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 11px;
  font-size: .9rem;
  font-weight: 600;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  transition: background .2s, transform .15s, opacity .2s;
  margin-top: .5rem;
}
.nq-submit:hover:not(:disabled) {
  background: #6da0f8;
  transform: translateY(-1px);
}
.nq-submit:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Variante déconnexion */
.nq-submit.nq-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-top: 1.2rem;
  font-weight: 500;
}
.nq-submit.nq-logout:hover:not(:disabled) {
  border-color: var(--accent3);
  color: var(--accent3);
  background: rgba(247,106,143,.08);
  transform: none;
}

/* ─── Lien texte ─── */
.nq-text-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--muted);
  font-size: .825rem;
  cursor: pointer;
  padding: .6rem;
  margin-top: .3rem;
  transition: color .2s;
  font-family: 'DM Sans', sans-serif;
  text-align: center;
}
.nq-text-btn:hover { color: var(--accent); }

/* ─── Vue utilisateur connecté ─── */
.nq-user-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 1.45rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 20px rgba(79,142,247,.35);
}
.nq-user-email {
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
  margin-bottom: 1.3rem;
  word-break: break-all;
}

/* ─── Indicateur de sync ─── */
.nq-sync-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem .9rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .825rem;
  color: var(--muted);
}
.nq-sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nq-sync-dot.ok      { background: var(--accent4); }
.nq-sync-dot.syncing { background: var(--accent5); animation: nq-blink 1s ease-in-out infinite; }
.nq-sync-dot.error   { background: var(--accent3); }

@keyframes nq-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .25; }
}

/* ─── Écran mot de passe oublié ─── */
.nq-reset-icon {
  text-align: center;
  font-size: 2.8rem;
  margin: .5rem 0 1rem;
}

/* ─── Light mode ─── */
body.light-mode .nq-auth-modal {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 24px 80px rgba(0,0,0,.12);
}
body.light-mode .nq-auth-tabs   { background: #f1f5f9; }
body.light-mode .nq-tab.active  { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
body.light-mode .nq-field input { background: #f8fafc; border-color: #e2e8f0; color: #1a202c; }
body.light-mode .nq-field input:focus { background: #fff; }
body.light-mode .nq-sync-row    { background: #f8fafc; border-color: #e2e8f0; }

/* ═══════════════════════════════════════════════════════════════
   Menu utilisateur connecté
   ═══════════════════════════════════════════════════════════════ */
.user-menu {
  position: fixed;
  z-index: 500;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  min-width: 220px;
  overflow: hidden;
  animation: um-in .18s cubic-bezier(.22,1,.36,1);
}
@keyframes um-in {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.user-menu-info {
  padding: .85rem 1rem .75rem;
  border-bottom: 1px solid var(--border);
}
.user-menu-name  { font-weight: 600; font-size: .9rem; color: var(--text); }
.user-menu-email { font-size: .78rem; color: var(--muted); margin-top: .15rem; word-break: break-all; }
.user-menu-sep   { height: 0; }
.user-menu-item  {
  display: block; width: 100%;
  padding: .7rem 1rem;
  background: none; border: none;
  color: var(--text); font-size: .875rem;
  font-family: 'DM Sans', sans-serif;
  text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.user-menu-item:hover        { background: var(--surface); }
.user-menu-danger            { color: var(--accent3) !important; }
.user-menu-danger:hover      { background: rgba(247,106,143,.08) !important; }

/* ═══════════════════════════════════════════════════════════════
   Modale de progression
   ═══════════════════════════════════════════════════════════════ */
.pm-overlay {
  position: fixed; inset: 0; z-index: 450;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: pm-in .22s ease;
}
@keyframes pm-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.pm-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 460px; max-width: 100%;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,.55);
  animation: pm-slide .25s cubic-bezier(.22,1,.36,1);
}
@keyframes pm-slide {
  from { transform: scale(.95) translateY(12px); }
  to   { transform: scale(1) translateY(0); }
}
.pm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pm-title { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; }
.pm-body  { padding: 1.5rem; overflow-y: auto; }

.pm-global { text-align: center; margin-bottom: 1.8rem; }
.pm-global-num {
  font-family: 'Syne', sans-serif; font-size: 2.8rem; font-weight: 800;
  color: var(--accent);
}
.pm-global-num span { font-size: 1.4rem; color: var(--muted); font-weight: 400; }
.pm-global-label { color: var(--muted); font-size: .875rem; margin-bottom: 1rem; }
.pm-bar-big {
  height: 8px; background: var(--bg3); border-radius: 99px;
  overflow: hidden; margin-bottom: .5rem;
}
.pm-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width .6s ease;
}
.pm-pct { font-size: .82rem; color: var(--muted); }

.pm-cats     { display: flex; flex-direction: column; gap: .55rem; }
.pm-cat-row  { display: flex; align-items: center; gap: .75rem; }
.pm-cat-icon { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }
.pm-cat-info { flex: 1; min-width: 0; }
.pm-cat-name { font-size: .82rem; color: var(--text); margin-bottom: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-cat-bar  { height: 4px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.pm-cat-fill { height: 100%; border-radius: 99px; }
.pm-cat-count{ font-size: .78rem; font-weight: 600; flex-shrink: 0; }
.pm-empty    { color: var(--muted); font-size: .875rem; text-align: center; padding: 1rem 0; }
body.light-mode .nq-submit.nq-logout { border-color: #e2e8f0; }

/* ═══════════════════════════════════════════════════════════════
   PROFILE BUTTON — Bouton unique dans la nav
   ═══════════════════════════════════════════════════════════════ */
.profile-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s, background .2s, color .2s, box-shadow .2s;
  flex-shrink: 0;
  position: relative;
}
.profile-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(79,142,247,.12);
}
.profile-btn.active {
  border-color: var(--accent);
  background: rgba(79,142,247,.12);
  color: var(--accent);
}
.profile-btn.logged-in {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px rgba(79,142,247,.4);
}
.profile-btn.logged-in:hover {
  box-shadow: 0 4px 18px rgba(79,142,247,.55);
}
.profile-initials {
  display: none;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .01em;
}
.profile-icon { display: block; }
.profile-btn.logged-in .profile-initials { display: block; }
.profile-btn.logged-in .profile-icon     { display: none; }
.profile-avatar-img {
  display: none;
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: absolute; inset: 0;
}
.profile-btn.has-avatar .profile-avatar-img  { display: block; }
.profile-btn.has-avatar .profile-initials    { display: none; }
.profile-btn.has-avatar .profile-icon        { display: none; }

/* ═══════════════════════════════════════════════════════════════
   PROFILE OVERLAY — Fond semi-transparent
   ═══════════════════════════════════════════════════════════════ */
.profile-overlay {
  position: fixed; inset: 0; z-index: 290;
  background: rgba(0,0,0,.4);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.profile-overlay.active { opacity: 1; pointer-events: all; }

/* ═══════════════════════════════════════════════════════════════
   PROFILE MENU — Dropdown unifié
   ═══════════════════════════════════════════════════════════════ */
.profile-menu {
  position: fixed;
  top: 68px; right: 1.5rem;
  z-index: 300;
  width: 310px;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 80px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.04) inset;
  overflow-y: auto; overflow-x: hidden;
  opacity: 0;
  transform: translateY(-10px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.22,1,.36,1);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.profile-menu.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Barre titre ── */
.pm-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem .65rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  border-radius: 18px 18px 0 0;
}
.pm-topbar-title {
  font-size: .7rem; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.pm-topbar-close {
  background: none; border: none; color: var(--muted);
  font-size: .85rem; cursor: pointer;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: color .2s, background .2s;
}
.pm-topbar-close:hover { color: var(--text); background: var(--surface); }

/* ── Section compte ── */
.pm-account-wrap { padding: 1rem; }

/* État non connecté */
.pm-guest { text-align: center; }
.pm-guest-icon {
  font-size: 2.2rem; margin-bottom: .6rem; opacity: .5;
  background: var(--surface); border-radius: 50%;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .75rem;
}
.pm-guest-title {
  font-family: 'Syne', sans-serif; font-size: .95rem; font-weight: 700;
  color: var(--text); margin-bottom: .35rem;
}
.pm-guest-desc {
  font-size: .78rem; color: var(--muted); line-height: 1.55;
  margin-bottom: 1rem;
}
.pm-guest-btns { display: flex; flex-direction: column; gap: .5rem; }
.pm-btn-login {
  padding: .65rem; border-radius: 10px;
  background: var(--accent); color: #fff; border: none;
  font-size: .875rem; font-weight: 600; font-family: 'Syne', sans-serif;
  cursor: pointer; transition: background .2s, transform .12s;
}
.pm-btn-login:hover { background: #6da0f8; transform: translateY(-1px); }
.pm-btn-signup {
  padding: .65rem; border-radius: 10px;
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  font-size: .875rem; font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: border-color .2s, color .2s;
}
.pm-btn-signup:hover { border-color: var(--accent); color: var(--text); }

/* État connecté */
.pm-user-card {
  display: flex; align-items: center; gap: .85rem;
  margin-bottom: .85rem;
}
.pm-user-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 1rem; font-weight: 700;
  font-family: 'Syne', sans-serif;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(79,142,247,.4);
  position: relative; cursor: pointer; overflow: hidden;
}
.pm-user-avatar img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%; display: block;
}
.pm-avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .18s;
  font-size: .55rem; color: #fff; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase;
}
.pm-user-avatar:hover .pm-avatar-overlay { opacity: 1; }
.pm-user-name  { font-weight: 600; font-size: .9rem; color: var(--text); }
.pm-user-email { font-size: .72rem; color: var(--muted); margin-top: .1rem; word-break: break-all; }
.pm-user-actions { display: flex; flex-direction: column; gap: .35rem; }
.pm-action-btn {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem .75rem;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font-size: .82rem; font-family: 'DM Sans', sans-serif;
  cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s, color .15s;
}
.pm-action-btn:hover { border-color: var(--accent); background: rgba(79,142,247,.06); }
.pm-action-danger { color: var(--accent3) !important; }
.pm-action-danger:hover { border-color: var(--accent3) !important; background: rgba(247,106,143,.06) !important; }

/* ── Séparateur ── */
.pm-divider { height: 1px; background: var(--border); }

/* ── Sections ── */
.pm-section { padding: .85rem 1rem; }
.pm-section-label {
  font-size: .68rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: .65rem;
}

/* ── Ligne label + contrôles ── */
.pm-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .55rem;
}
.pm-row:last-child { margin-bottom: 0; }
.pm-row-label { font-size: .825rem; color: var(--text); }

/* ── Groupes de boutons (thème, taille) ── */
.pm-btn-group { display: flex; gap: .3rem; }
.theme-opt, .font-opt {
  padding: .3rem .55rem;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--muted);
  border-radius: 8px; font-size: .8rem;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: border-color .15s, background .15s, color .15s;
  min-width: 32px; text-align: center;
}
.theme-opt:hover, .font-opt:hover { color: var(--text); border-color: var(--accent); }
.theme-opt.active, .font-opt.active {
  border-color: var(--accent);
  background: rgba(79,142,247,.15);
  color: var(--accent);
}

/* ── Grille de langues ── */
.pm-lang-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: .35rem; }
.lang-opt {
  padding: .42rem .3rem;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); border-radius: 8px; font-size: .76rem;
  cursor: pointer; font-family: 'DM Sans', sans-serif; text-align: center;
  transition: border-color .15s, background .15s, color .15s;
}
.lang-opt:hover { color: var(--text); border-color: var(--accent); }
.lang-opt.active {
  border-color: var(--accent); background: rgba(79,142,247,.15); color: var(--accent);
}

/* ── Ligne toggle ── */
.pm-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .38rem 0; font-size: .82rem; color: var(--text);
}
.pm-toggle-label { flex: 1; }

/* ── Footer / reset ── */
.pm-footer { padding: .6rem 1rem .85rem; }
.pm-reset-btn {
  display: block; width: 100%; padding: .6rem;
  background: none; border: none; color: var(--muted);
  font-size: .78rem; font-family: 'DM Sans', sans-serif;
  cursor: pointer; text-align: center; border-radius: 8px;
  transition: color .2s, background .2s;
}
.pm-reset-btn:hover { color: var(--accent3); background: rgba(247,106,143,.06); }

/* ── Light mode ── */
body.light-mode .profile-btn {
  background: #f1f5f9; border-color: #e2e8f0; color: #64748b;
}
body.light-mode .profile-btn:hover { border-color: var(--accent); }
body.light-mode .profile-btn.logged-in { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
body.light-mode .profile-menu { background: #fff; border-color: #e2e8f0; box-shadow: 0 20px 60px rgba(0,0,0,.12); }
body.light-mode .pm-topbar    { background: #f8fafc; border-color: #e2e8f0; }
body.light-mode .pm-divider   { background: #e2e8f0; }
body.light-mode .theme-opt, body.light-mode .font-opt, body.light-mode .lang-opt {
  background: #f1f5f9; border-color: #e2e8f0; color: #64748b;
}
body.light-mode .pm-action-btn { background: #f8fafc; border-color: #e2e8f0; color: #1a202c; }

/* ── Mobile ── */
@media (max-width: 500px) {
  .profile-menu { top: 60px; right: .75rem; width: calc(100vw - 1.5rem); border-radius: 14px; }
}

/* ═══════════════════════════════════════════════════════════════
   MODALE PROGRESSION — pgm-*
   ═══════════════════════════════════════════════════════════════ */
.pgm-overlay {
  position: fixed; inset: 0; z-index: 450;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: pgm-fade .2s ease;
}
@keyframes pgm-fade { from { opacity: 0; } to { opacity: 1; } }

.pgm-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 520px; max-width: 100%;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,.55);
  animation: pgm-slide .25s cubic-bezier(.22,1,.36,1);
  overflow: hidden;
}
@keyframes pgm-slide {
  from { transform: scale(.95) translateY(14px); }
  to   { transform: scale(1) translateY(0); }
}

/* Header */
.pgm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg3);
  border-radius: 20px 20px 0 0;
}
.pgm-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem; font-weight: 700;
  color: var(--text);
}

/* Bloc global — donut + stats */
.pgm-global {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 1.4rem 1.4rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pgm-donut-wrap {
  position: relative; flex-shrink: 0;
  width: 80px; height: 80px;
}
.pgm-donut { width: 80px; height: 80px; transform: rotate(-90deg); }
.pgm-donut-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.pgm-donut-pct {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem; font-weight: 800;
  color: var(--accent); line-height: 1;
}
.pgm-donut-sub { font-size: .58rem; color: var(--muted); }

.pgm-global-stats { display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.pgm-stat { display: flex; align-items: baseline; gap: .45rem; }
.pgm-stat-num {
  font-family: 'Syne', sans-serif;
  font-size: 1.3rem; font-weight: 800; line-height: 1;
}
.pgm-stat-label { font-size: .78rem; color: var(--muted); }

/* Label de section */
.pgm-section-label {
  padding: .8rem 1.4rem .4rem;
  font-size: .68rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  flex-shrink: 0;
}

/* Liste scrollable des catégories */
.pgm-cats {
  flex: 1; overflow-y: auto;
  padding: .2rem .9rem .8rem;
  display: flex; flex-direction: column; gap: .35rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Ligne catégorie */
.pgm-cat-row {
  padding: .65rem .8rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .15s;
}
.pgm-cat-row:hover { border-color: var(--accent); }

.pgm-cat-head {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: .45rem;
}
.pgm-cat-icon { font-size: 1rem; flex-shrink: 0; width: 22px; text-align: center; }
.pgm-cat-name { flex: 1; font-size: .84rem; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Badges état */
.pgm-badge {
  font-size: .68rem; font-weight: 600; padding: .18rem .5rem;
  border-radius: 99px; border: 1px solid; flex-shrink: 0;
  font-family: 'Syne', sans-serif;
}
.pgm-badge-done { color: var(--accent4); border-color: rgba(106,247,192,.3); background: rgba(106,247,192,.08); }
.pgm-badge-wip  { background: transparent; }
.pgm-badge-todo { color: var(--muted); border-color: var(--border); background: transparent; }
.pgm-cert-btn {
  font-size: .68rem; font-weight: 600; padding: .18rem .55rem;
  border-radius: 99px; border: 1px solid; flex-shrink: 0;
  font-family: 'Syne', sans-serif; cursor: pointer;
  background: transparent; transition: opacity .15s, background .15s;
}
.pgm-cert-btn:hover { opacity: .8; background: rgba(255,255,255,.04); }

/* Barre de progression + compteur */
.pgm-cat-foot { display: flex; align-items: center; gap: .7rem; }
.pgm-cat-bar {
  flex: 1; height: 5px;
  background: var(--bg);
  border-radius: 99px; overflow: hidden;
}
.pgm-cat-fill {
  height: 100%; border-radius: 99px;
  transition: width .6s ease;
}
.pgm-cat-count { font-size: .72rem; color: var(--muted); flex-shrink: 0; min-width: 44px; text-align: right; }

/* Footer */
.pgm-footer { padding: .8rem 1.4rem 1rem; border-top: 1px solid var(--border); flex-shrink: 0; }
.pgm-reset-btn {
  display: block; width: 100%; padding: .6rem;
  background: none; border: 1px solid var(--border);
  color: var(--muted); border-radius: 9px;
  font-size: .8rem; font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: border-color .2s, color .2s, background .2s;
}
.pgm-reset-btn:hover { border-color: var(--accent6); color: var(--accent6); background: rgba(247,106,106,.05); }

/* Mobile */
@media (max-width: 540px) {
  .pgm-panel  { border-radius: 16px; }
  .pgm-global { gap: 1rem; padding: 1rem; }
  .pgm-cats   { padding: .2rem .6rem .6rem; }
}

/* ═══════════════════════════════════════════════════════════════
   BADGE NOTIFICATION POPUP
   ═══════════════════════════════════════════════════════════════ */
.badge-notif {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; align-items: center; gap: .85rem;
  padding: .9rem 1.1rem;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35), 0 0 0 1px rgba(79,142,247,.15);
  max-width: 300px;
  opacity: 0; transform: translateY(12px) scale(.97);
  transition: opacity .35s, transform .35s;
  pointer-events: auto;
}
.badge-notif.badge-notif-in { opacity: 1; transform: translateY(0) scale(1); }
.badge-notif-icon { font-size: 2rem; flex-shrink: 0; }
.badge-notif-body { flex: 1; }
.badge-notif-label { font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin-bottom: .15rem; }
.badge-notif-name  { font-size: .95rem; font-weight: 700; font-family: 'Syne', sans-serif; color: var(--text); }
.badge-notif-desc  { font-size: .75rem; color: var(--muted); margin-top: .1rem; }
.badge-notif-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: .85rem; align-self: flex-start;
  padding: 0; line-height: 1; flex-shrink: 0;
  transition: color .15s;
}
.badge-notif-close:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   BADGES PANEL
   ═══════════════════════════════════════════════════════════════ */
.bdg-list { padding: .4rem .9rem 1rem; display: flex; flex-direction: column; gap: .45rem; overflow-y: auto; }
.bdg-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem .9rem; border-radius: 11px;
  border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.bdg-unlocked { background: var(--surface); border-color: var(--accent); }
.bdg-locked   { background: var(--bg3); opacity: .5; }
.bdg-icon     { font-size: 1.4rem; flex-shrink: 0; width: 2rem; text-align: center; }
.bdg-info     { flex: 1; }
.bdg-name     { font-size: .88rem; font-weight: 600; color: var(--text); }
.bdg-desc     { font-size: .73rem; color: var(--muted); margin-top: .1rem; }
.bdg-check    { color: var(--accent4); font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.bdg-lock     { font-size: .85rem; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   RANGS PAR LOGICIEL (badge façon Bronze/Argent/Or/.../Grand Champion)
   ═══════════════════════════════════════════════════════════════ */

/* Mini badge accroché aux pills "logiciel" */
.rank-mini { display: inline-flex; align-items: center; vertical-align: middle; margin-left: .3rem; line-height: 0; }
.rank-mini svg { display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }

/* Carte de rang affichée en tête de la liste de leçons d'un logiciel */
.rank-card {
  display: flex; align-items: center; gap: 1rem;
  padding: .9rem 1.1rem;
  margin: -.2rem 0 1.1rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--rc1) 14%, var(--bg2)), var(--bg2));
  border: 1px solid color-mix(in srgb, var(--rc1) 45%, var(--border));
  border-radius: 14px;
}
.rank-card-badge { flex-shrink: 0; line-height: 0; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.rank-card-info { flex: 1; min-width: 0; }
.rank-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
  margin-bottom: .4rem; flex-wrap: wrap;
}
.rank-card-tier {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: .95rem;
  background: linear-gradient(90deg, var(--rc2), var(--rc1));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rank-card-stats { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.rank-card-bar { height: 6px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.rank-card-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--rc1), var(--rc2));
  transition: width .6s ease;
}
.rank-card-sub { font-size: .72rem; color: var(--muted); margin-top: .35rem; }

/* Grille de cartes quand un logiciel a plusieurs domaines de compétence */
.rank-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: .7rem;
  margin: -.2rem 0 1.1rem;
}
.rank-card-grid .rank-card { margin: 0; padding: .75rem .9rem; }

/* Panneau "Mes rangs" */
.rank-panel-intro { padding: .6rem 1.4rem .2rem; font-size: .8rem; color: var(--muted); }
.rank-list { padding: .6rem .9rem 1rem; display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; }
.rank-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem .8rem; border-radius: 12px;
  background: var(--bg3); border: 1px solid var(--border);
}
.rank-row-badge { flex-shrink: 0; line-height: 0; }
.rank-row-info { width: 9.5rem; flex-shrink: 0; min-width: 0; }
.rank-row-name {
  font-size: .82rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-row-tier { font-size: .72rem; font-weight: 700; margin-top: .1rem; }
.rank-row-bar { flex: 1; height: 5px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.rank-row-fill { height: 100%; border-radius: 99px; transition: width .6s ease; }
.rank-row-count { font-size: .72rem; color: var(--muted); flex-shrink: 0; min-width: 40px; text-align: right; }

/* Groupe "logiciel à plusieurs domaines" dans le panneau Mes rangs */
.rank-group {
  display: flex; flex-direction: column; gap: .4rem;
  padding: .55rem .6rem .6rem; border-radius: 14px;
  background: color-mix(in srgb, var(--bg3) 70%, transparent);
  border: 1px solid var(--border);
}
.rank-group-head {
  font-size: .8rem; font-weight: 700; color: var(--text);
  padding: 0 .2rem .2rem;
}
.rank-group .rank-row { background: var(--bg2); }
.rank-row-sub .rank-row-info { width: 11.5rem; }
.rank-row-sub .rank-row-name { font-size: .76rem; font-weight: 500; color: var(--muted); }
.rank-row-sub .rank-row-tier { font-size: .68rem; }

/* Notification de montée de rang (réutilise .badge-notif) */
.rank-up-notif { border-color: #e0652a; box-shadow: 0 8px 32px rgba(0,0,0,.35), 0 0 0 1px rgba(224,101,42,.2); }

/* Rang en direct dans l'en-tête d'un cours */
.rank-live {
  display: flex; align-items: center; gap: .55rem;
  padding: .35rem .7rem .35rem .45rem; flex-shrink: 0; width: 230px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--rc1, #4a4f5e) 16%, var(--bg2)), var(--bg2));
  border: 1px solid color-mix(in srgb, var(--rc1, #4a4f5e) 45%, var(--border));
  border-radius: 12px;
}
.rank-live:empty { display: none; }
.rank-live-badge { line-height: 0; flex-shrink: 0; filter: drop-shadow(0 1px 3px rgba(0,0,0,.35)); }
.rank-live-info { flex: 1; min-width: 0; }
.rank-live-head { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; }
.rank-live-tier {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: .78rem;
  background: linear-gradient(90deg, var(--rc2), var(--rc1));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rank-live-score { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.rank-live-num { color: var(--text); font-variant-numeric: tabular-nums; }
.rank-live-delta { font-weight: 700; }
.rank-live-delta.up { color: #6af7c0; }
.rank-live-delta.down { color: #f76a6a; }
.rank-live-bar { height: 4px; border-radius: 99px; background: var(--bg); overflow: hidden; margin: .25rem 0 .2rem; }
.rank-live-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--rc1), var(--rc2));
  transition: width .6s ease;
}
.rank-live-sub { font-size: .64rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-live-pulse { animation: rankLivePulse .9s ease; }
@keyframes rankLivePulse {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--rc2) 60%, transparent); }
  40%  { transform: scale(1.05); }
  100% { transform: scale(1); box-shadow: 0 0 0 14px transparent; }
}

/* Résumé du rang sur l'écran "Cours terminé" */
.rank-done {
  margin: 1rem auto 0; padding: .6rem 1rem; max-width: 440px;
  font-size: .85rem; color: var(--text);
  border-radius: 12px; border: 1px solid color-mix(in srgb, var(--rc1, #4a4f5e) 45%, var(--border));
  background: color-mix(in srgb, var(--rc1, #4a4f5e) 12%, var(--bg2));
}
.rank-done-tier { font-weight: 800; color: var(--rc2, var(--text)); }

/* Note "Comment sont calculés les rangs ?" du panneau Mes rangs */
.rank-howto { margin: .5rem 1.4rem .2rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg3); }
.rank-howto summary { cursor: pointer; padding: .55rem .8rem; font-size: .8rem; font-weight: 600; color: var(--text); }
.rank-howto-body { padding: 0 .9rem .8rem; font-size: .78rem; line-height: 1.55; color: var(--muted); }
.rank-howto-body p { margin: .45rem 0; }
.rank-howto-body ul { margin: .3rem 0; padding-left: 1.1rem; }
.rank-howto-body li { margin: .25rem 0; }
.rank-howto-body strong { color: var(--text); }
.rank-howto-ex { padding: .45rem .65rem; border-radius: 8px; background: var(--bg2); }
.rank-howto-tiers { display: flex; flex-wrap: wrap; gap: .35rem .7rem; margin: .5rem 0; }
.rank-howto-tier { display: inline-flex; align-items: center; gap: .25rem; color: var(--text); font-size: .74rem; }
.rank-howto-tier em { font-style: normal; color: var(--muted); }
.rank-howto-note { font-size: .72rem; }

@media (max-width: 768px) {
  .crs-header-body { flex-wrap: wrap; }
  .rank-live { width: 100%; }
}

@media (max-width: 540px) {
  .rank-card { flex-wrap: wrap; }
  .rank-row-info { width: 7rem; }
  .rank-row-sub .rank-row-info { width: 7rem; }
}

/* ═══════════════════════════════════════════════════════════════
   LESSON FAV BUTTON
   ═══════════════════════════════════════════════════════════════ */
.lesson-end {
  display: flex; align-items: center; gap: .4rem; flex-shrink: 0;
}
.lesson-fav-btn {
  background: none; border: none; cursor: pointer;
  font-size: .95rem; color: var(--border);
  padding: .2rem .25rem; line-height: 1;
  transition: color .2s, transform .15s;
  flex-shrink: 0;
}
.lesson-fav-btn:hover  { color: var(--accent3); transform: scale(1.2); }
.lesson-fav-btn.is-fav { color: var(--accent3); }

/* ═══════════════════════════════════════════════════════════════
   CARTES DE COURS (grille façon catalogue)
   ═══════════════════════════════════════════════════════════════ */
.cc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.cc-sep {
  grid-column: 1 / -1;
  font-family: 'Syne', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .9rem .2rem .3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .2rem;
}

.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s ease, border-color .3s ease, background .3s ease;
}
.course-card.lesson-exercise { border-color: color-mix(in srgb, #f59e0b 35%, var(--border)); }
.course-card::after {
  content: '';
  position: absolute;
  bottom: -30px; right: -30px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: var(--cc, var(--accent));
  opacity: 0;
  transition: opacity .35s ease;
  filter: blur(50px);
  pointer-events: none;
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
  border-color: color-mix(in srgb, var(--cc, var(--accent)) 35%, transparent);
  background: var(--surface);
}
.course-card:hover::after { opacity: .14; }

.cc-banner {
  position: relative;
  height: 84px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, color-mix(in srgb, var(--cc, var(--accent)) 20%, var(--bg2)) 0%, var(--bg2) 100%);
  border-bottom: 1px solid var(--border);
}
.cc-icon { font-size: 2.4rem; line-height: 1; }
.cc-done-badge {
  position: absolute; top: 9px; left: 9px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent4);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
}
.cc-done-badge svg { width: 12px; height: 12px; color: #0d0f14; display: block; }

.cc-banner .lesson-fav-btn {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(13,15,20,.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
}
.cc-banner .lesson-fav-btn.is-fav { color: var(--accent3); }

.cc-body {
  padding: .85rem .95rem 1rem;
  display: flex; flex-direction: column; gap: .55rem; flex: 1;
  position: relative; z-index: 1;
}
.cc-title {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: .9rem;
  line-height: 1.35; color: var(--text);
}
.cc-meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.cc-meta-chip { font-size: .72rem; color: var(--muted); }

.cc-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: .3rem; }
.cc-status { font-size: .72rem; color: var(--muted); }
.cc-status.done { color: var(--accent4); font-weight: 600; }
.cc-cta {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: .74rem;
  padding: .42rem .85rem; border-radius: 999px; white-space: nowrap; margin-left: auto;
}
.cc-cta svg { width: 11px; height: 11px; }
.cc-cta.primary { background: var(--cc, var(--accent)); color: #0d0f14; }
.cc-cta.ghost { background: none; border: 1.5px solid var(--border); color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   PROFIL — STREAK, BADGE COUNT, EDIT INLINE
   ═══════════════════════════════════════════════════════════════ */
.pm-user-info       { flex: 1; min-width: 0; }
.pm-user-name-row   { display: flex; align-items: center; gap: .4rem; }
.pm-edit-inline-btn {
  background: none; border: none; cursor: pointer;
  font-size: .78rem; padding: 0; color: var(--muted);
  transition: color .15s; line-height: 1;
}
.pm-edit-inline-btn:hover { color: var(--accent); }
.pm-streak {
  font-size: .72rem; color: var(--accent5);
  font-weight: 600; margin-top: .2rem;
}
.pm-badge-count {
  display: inline-block; margin-left: auto;
  background: var(--bg3); border-radius: 20px;
  padding: .1rem .45rem; font-size: .7rem; color: var(--muted);
}
.pm-edit-name-form {
  flex-direction: column; gap: .4rem;
  padding: .5rem .9rem .65rem;
  background: var(--bg3); border-radius: 10px;
  margin: 0 0 .5rem;
}
.pm-edit-input {
  width: 100%; padding: .5rem .7rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-size: .85rem; font-family: 'DM Sans', sans-serif;
  box-sizing: border-box;
  transition: border-color .15s;
}
.pm-edit-input:focus { outline: none; border-color: var(--accent); }
.pm-edit-btns   { display: flex; gap: .4rem; }
.pm-edit-save   {
  flex: 1; padding: .45rem;
  background: var(--accent); border: none; border-radius: 8px;
  color: #fff; font-size: .8rem; font-weight: 600;
  font-family: 'DM Sans', sans-serif; cursor: pointer;
  transition: opacity .15s;
}
.pm-edit-save:hover { opacity: .85; }
.pm-edit-cancel {
  flex: 1; padding: .45rem;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); font-size: .8rem;
  font-family: 'DM Sans', sans-serif; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.pm-edit-cancel:hover { border-color: var(--accent3); color: var(--accent3); }
.pm-edit-msg { font-size: .75rem; min-height: 1em; }

/* ── Quiz schema preview thumbnail ───────────────────────────── */
.quiz-schema-preview {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0.5rem 0 0.8rem 2.6rem;
  cursor: pointer;
}
.quiz-schema-thumb {
  width: 160px;
  height: 98px;
  overflow: hidden;
  border-radius: 8px;
  border: 2px solid var(--border);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.quiz-schema-preview:hover .quiz-schema-thumb {
  border-color: var(--accent4);
  box-shadow: 0 0 0 3px rgba(106,247,192,.18);
}
.quiz-schema-thumb-inner {
  position: absolute;
  top: 0; left: 0;
  transform: scale(0.2778);
  transform-origin: top left;
  width: 576px;
  pointer-events: none;
}
.quiz-schema-hint {
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0.12rem 0.5rem;
  background: var(--bg3);
  border-radius: 99px;
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.quiz-schema-preview:hover .quiz-schema-hint {
  color: var(--accent4);
  border-color: var(--accent4);
}

/* ── Schema lightbox ──────────────────────────────────────────── */
.schema-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: pgm-fade .15s ease;
}
.schema-lightbox-panel {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: min(95vw, 720px);
  max-height: 88vh;
  overflow: auto;
  padding: 2.5rem 1.5rem 1.5rem;
}
.schema-lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
  z-index: 1;
}
.schema-lightbox-close:hover {
  background: rgba(247,106,106,.12);
  border-color: var(--accent6);
  color: var(--accent6);
}
.schema-lightbox-content { overflow-x: auto; }

/* ── Objets flottants des cours (images libres, lignes, flèches, formes) ──
   Insérés par l'éditeur avancé (nœud nqFloat dans script.js) au début d'un
   paragraphe : ce paragraphe devient leur repère, et left / width /
   margin-top sont exprimés en % de sa largeur. */
:is(p, h2, h3):has([data-nq-float]) { position: relative; }
[data-nq-float] { position: absolute; z-index: 2; line-height: 0; pointer-events: none; }
[data-nq-float] > img {
  display: block; width: 100% !important; height: auto !important; max-width: none !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
}
[data-nq-float="image"] > img { border-radius: 8px !important; }

/* Tableaux insérés par l'éditeur avancé (cellules contenant des <p>) */
:where(table):has(> tbody > tr > :is(td, th) > p) { border-collapse: collapse; width: 100%; margin: .8em 0; table-layout: fixed; }
:where(table):has(> tbody > tr > :is(td, th) > p) :is(td, th) { border: 1px solid var(--border, #ccc); padding: .4em .6em; vertical-align: top; }
:where(table):has(> tbody > tr > :is(td, th) > p) th { background: rgba(127, 127, 127, .12); text-align: left; font-weight: 600; }
:where(table):has(> tbody > tr > :is(td, th) > p) :is(td, th) > p { margin: 0; }

/* Icônes personnalisées (catégories, outils, cours) : image de la
   bibliothèque média affichée exactement à la taille d'un emoji (1em). */
img.nq-icon-img { width: 1em; height: 1em; object-fit: contain; display: inline-block; vertical-align: -0.12em; border-radius: .18em; }

/* ── Exercices interactifs NumériDoc / NumériCalc (parties Word / Excel) ── */
.nqexo-block { margin: .4rem 0 1.4rem; border: 1px solid rgba(79,142,247,.35); border-radius: 14px; background: linear-gradient(135deg, rgba(79,142,247,.08), rgba(106,247,192,.05)); padding: .2rem 1.1rem; }
.nqexo-block[open] { padding-bottom: 1.1rem; }
.nqexo-block summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .8rem 0; }
.nqexo-block summary::-webkit-details-marker { display: none; }
.nqexo-block summary::before { content: '▸'; color: var(--accent); transition: transform .2s; }
.nqexo-block[open] summary::before { transform: rotate(90deg); }
.nqexo-sum-title { font-family: 'Syne', sans-serif; font-weight: 700; color: var(--text); }
.nqexo-sum-meta { font-size: .78rem; color: var(--muted); }
.nqexo-help { font-size: .84rem; color: var(--muted); line-height: 1.55; margin: 0 0 1rem; }
.nqexo-help b { color: var(--text); }
.nqexo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; }
.nqexo-card { position: relative; }
.nqexo-link { display: flex; flex-direction: column; gap: .35rem; height: 100%; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg2); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.nqexo-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.nqexo-link b { font-size: .88rem; line-height: 1.3; }
.nqexo-meta { font-size: .72rem; color: var(--muted); }
.nqexo-med { position: absolute; right: .7rem; top: .65rem; font-size: .8rem; }
.nqexo-lvl { align-self: flex-start; font-size: .66rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; border: 1px solid; }
.nqexo-lvl-Débutant { color: #7fd18a; border-color: #2e6b3a; }
.nqexo-lvl-Intermédiaire { color: #f7c06a; border-color: #7a5a22; }
.nqexo-lvl-Avancé { color: #f76a6a; border-color: #7a2a2a; }
.nqexo-edit { position: absolute; right: .55rem; bottom: .55rem; text-decoration: none; font-size: .85rem; padding: .15rem .35rem; border-radius: 6px; background: var(--bg3); border: 1px solid var(--border); }
.nqexo-foot { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.nqexo-btn { display: inline-block; padding: .5rem .95rem; border-radius: 9px; border: 1px solid var(--accent); color: var(--accent); text-decoration: none; font-size: .82rem; font-weight: 600; }
.nqexo-btn:hover { background: rgba(79,142,247,.12); }
.nqexo-btn-admin { border-color: #6af7c0; color: #6af7c0; }

/* ── Ressources ajoutées par les admins (script.js : nqRenderResources) ── */
.nqres-item { position: relative; }
.nqres-item .resource-card { padding-right: 5.5rem; }
.nqres-admin { position: absolute; top: 50%; right: 3.4rem; transform: translateY(-50%); display: flex; gap: .3rem; opacity: 0; transition: opacity .15s; }
.nqres-item:hover .nqres-admin, .nqres-admin:focus-within { opacity: 1; }
.nqres-admin button { appearance: none; border: 1px solid var(--border); background: var(--bg2); color: var(--text); border-radius: 8px; width: 2rem; height: 2rem; cursor: pointer; font-size: .85rem; }
.nqres-admin button:hover { border-color: var(--accent); }
@media (hover: none) { .nqres-admin { opacity: 1; } }
.nqres-new { display: inline-block; margin-left: .35rem; padding: 0 .4rem; border-radius: 99px; background: color-mix(in srgb, var(--res-color, var(--accent)) 15%, transparent); font-size: .6rem; letter-spacing: .04em; }
.resource-card-icon.has-thumb { overflow: hidden; padding: 0; }
.resource-card-icon.has-thumb img { width: 100%; height: 100%; object-fit: cover; }
.nqres-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; padding: .7rem .8rem; border: 1px dashed var(--border); border-radius: 12px; }
.nqres-toolbar button { appearance: none; border: 1px solid var(--border); background: var(--bg3); color: var(--text); border-radius: 999px; padding: .45rem 1rem; font: inherit; font-size: .82rem; cursor: pointer; }
.nqres-toolbar .nqres-add { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.nqres-toolbar button:hover { filter: brightness(1.1); }
.nqres-hint { font-size: .74rem; color: var(--muted); }
.nqres-modal { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.nqres-dlg { width: min(560px, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 1.4rem 1.5rem; color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.nqres-dlg h3 { margin: 0 0 .6rem; font-family: 'Syne', sans-serif; }
.nqres-dlg label { display: block; font-size: .78rem; color: var(--muted); margin: .8rem 0 .3rem; }
.nqres-dlg input[type=url], .nqres-dlg input:not([type]), .nqres-dlg select { width: 100%; box-sizing: border-box; border: 1px solid var(--border); background: var(--bg3); color: var(--text); border-radius: 8px; padding: .55rem .7rem; font: inherit; font-size: .88rem; }
.nqres-dlg input:focus, .nqres-dlg select:focus { outline: none; border-color: var(--accent); }
.nqres-types { display: flex; flex-wrap: wrap; gap: .35rem; }
.nqres-types button { appearance: none; border: 1px solid var(--border); background: var(--bg3); color: var(--text); border-radius: 999px; padding: .35rem .75rem; font: inherit; font-size: .8rem; cursor: pointer; }
.nqres-types button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); font-weight: 600; }
.nqres-src { display: flex; flex-wrap: wrap; gap: 1rem; margin: .9rem 0 .5rem; }
.nqres-dlg .nqres-radio { display: flex; align-items: center; gap: .4rem; margin: 0; color: var(--text); font-size: .85rem; cursor: pointer; }
.nqres-drop { border: 2px dashed var(--border); border-radius: 12px; padding: 1.1rem; text-align: center; font-size: .85rem; color: var(--muted); }
.nqres-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.nqres-drop button { appearance: none; border: none; background: none; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.nqres-prog { height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin-top: .6rem; }
.nqres-prog span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.nqres-filed { font-size: .8rem; margin-top: .45rem; color: var(--muted); overflow-wrap: anywhere; }
.nqres-help { display: block; font-size: .74rem; color: var(--muted); margin-top: .3rem; }
.nqres-err { color: #ff8a80; font-size: .82rem; min-height: 1em; margin: .7rem 0 0; }
.nqres-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .9rem; }
.nqres-actions button { appearance: none; border: 1px solid var(--border); background: var(--bg3); color: var(--text); border-radius: 8px; padding: .55rem 1.1rem; font: inherit; font-size: .85rem; cursor: pointer; }
.nqres-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.nqres-actions button:disabled { opacity: .5; cursor: default; }
.nqres-dlg [hidden] { display: none !important; }
.docview-media { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.docview-media iframe { width: min(960px, 100%); aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: #000; }
.docview-media video { max-width: 100%; max-height: 75vh; border-radius: 10px; background: #000; }
.docview-media audio { width: min(520px, 100%); }
.docview-audio-ic { font-size: 4rem; }
