/**
 * Piano Key — Styles partagés
 * ════════════════════════════════════════════════════════════
 * Fichier CSS unique pour toutes les pages HTML
 */

/* ── Polices auto-hébergées (PK-S1) : Bricolage Grotesque (titres, chiffres), Plus Jakarta Sans (texte), DM Mono (compteurs) ── */
/* Polices chargées par <link> dans le head de chaque page + preload (audit 4.8) : plus d'import CSS en cascade */

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Variables CSS ── */
:root {
  /* PK-UX1-b : familles de couleur des compétences (icône, pastille, barre) — Oreille mélodique en bleus,
     Harmonie en roses, Rythme et Voix en cyans ; jamais pour un texte ni un bouton (le violet reste l'action). */
  --skill-blue: #6AAEFF;
  --skill-blue-bg: rgba(106, 174, 255, 0.14);
  --skill-rose: #F07AB4;
  --skill-rose-bg: rgba(240, 122, 180, 0.14);
  --skill-cyan: #3CCFDD;
  --skill-cyan-bg: rgba(60, 207, 221, 0.13);
  --skill-neutral: #ADA493;
  --skill-neutral-bg: #24201C;
  /* Revue C11 : or et orange utilisés comme TEXTE (le thème clair les assombrit pour l'AA) */
  --gold-ink: var(--gold);
  --orange-ink: var(--orange);
  --pill-other-bg: rgba(155, 130, 240, 0.5);
  --pill-other-ink: #fff;
  /* ── Palette V4 « conçue pour la rétention » (31/10). Les anciens noms pointent vers les nouvelles valeurs. ── */
  --bg0: #12100E;          /* fond */
  --bg1: #161310;
  --bg2: #1C1916;          /* surface */
  --bg3: #24201C;
  --bg4: #2C2722;
  --nav-bg: #0F0D0B;
  --topbar-bg: rgba(18, 16, 14, 0.88);  /* en-tête translucide (PK-T1 : token) */
  --scrim-bg: rgba(18, 16, 14, 0.94);   /* écran plein (paliers) */
  --v:   #9B82F0;          /* ACTION violet */
  --on-v: #12100E;         /* texte sur violet */
  --v-shadow: #5E47B8;     /* ombre « bouton 3D » */
  --v-surface: #241D33;
  --v-border: #433670;
  --key-white: #F4EEE2;
  --key-black: #12100E;
  --logo-key-line: var(--bg4);   /* séparation des touches blanches du logo */
  --logo-key-ring: transparent;  /* contour du logo (visible en thème clair) */
  --avatar-eye: var(--bg0);      /* yeux de l'avatar sur son visage clair */
  --v2:  #B7A3F7;          /* texte violet */
  --v3:  #D3C7FA;
  --vg:  rgba(155, 130, 240, 0.12);
  --vb:  rgba(155, 130, 240, 0.28);
  --text1: #F2EDE3;
  --text2: #ADA493;
  --text3: #989080;        /* texte tertiaire, AA sur fond et surfaces */
  --border1:  #332D26;
  --borderv:  #433670;
  --border2:  #433670;
  --green: #3DD68C;        /* succès */
  --ok-bg: #10261C;
  --ok-text: #9DF0C5;
  --red:   #FF8A4C;        /* erreur d'élève = orange, jamais de rouge */
  --err-bg: #2A170D;
  --ok-edge: #1F9A5F;
  --err-edge: #B85A2A;
  --flame: #FF9A3C;        /* série */
  --flame-bg: #2A1E12;
  --flame-text: #FFB25B;
  --frost: #CFE3EC;        /* gel */
  --flame-ink: #3A1F06;
  --flame-edge: #C96E1E;
  --frost-ink: #1D3440;
  --frost-edge: #95B4C2;
  --key-dim: #8F887C;      /* touche « à venir » */
  --v-track: #3A2F55;
  --v-text-soft: #CFC6EA;
  --gold-bg: #2B2310;      /* OR = récompenses uniquement */
  --gold-light: #F7D27A;
  --gold-soft: #D9CBA6;    /* sous-texte sur fond or */
  --medal-ink: #F7D27A;    /* chiffre sur la médaille (fond sombre de l'illustration, les deux thèmes) */
  /* PK-FIX1 I10 : en appli installée (viewport-fit=cover), la barre du haut descend sous l'horloge / l'encoche */
  --topbar-h: calc(46px + env(safe-area-inset-top, 0px));
  --sidebar-w: 220px;
  --radius: 14px;
  --radius-sm: 8px;
  --trans: 0.18s ease;
  --gap-sm: 8px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --font-display: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  --font-text: 'Plus Jakarta Sans', 'Jakarta Fallback', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Mono Fallback', monospace;
  /* Motion (lot M) */
  --t-fast: 120ms;
  --t-mid: 220ms;
  --t-slow: 480ms;
  --ease-out: cubic-bezier(.2,.8,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

/* ── Base ── */
html, body {
  height: 100%;
  max-width: 100%;
}
/* PK-FIX1 I11 : clip (et plus hidden) : c'est la page qui défile, pas le <body> (tap sur la barre d'état iOS,
   barre d'adresse qui se replie, position restaurée au retour, window.scrollTo) */
html { overflow-x: clip; }

/* ── Mobile overflow guard ────────────────────────────────
   Empêche les enfants flex/grid de déborder (min-width:auto par défaut)
   et borne images/médias à la largeur du conteneur.
   Ne touche PAS au desktop. */
@media (max-width: 768px) {
  body { width: 100%; max-width: 100%; }
  *, *::before, *::after { min-width: 0; }
  img, video, canvas { max-width: 100%; height: auto; }
}

body {
  background: var(--bg0);
  color: var(--text1);
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }

/* ── Fond : texture grain très légère ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── Fond : halo violet doux en haut au centre ── */
body::after {
  content: '';
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  max-width: 100vw;
  height: 300px;
  background: radial-gradient(ellipse, rgba(155, 130, 240,0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: haloPulse 12s ease-in-out infinite alternate;
}

@keyframes haloPulse {
  0%   { opacity: 0.6; transform: translateX(-50%) scaleX(1);   }
  100% { opacity: 1;   transform: translateX(-50%) scaleX(1.1); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

@keyframes skeleton {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.7; }
}

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

@keyframes bgShift {
  0%   { opacity: 0.6; transform: scale(1) translateY(0px); }
  50%  { opacity: 1;   transform: scale(1.05) translateY(-8px); }
  100% { opacity: 0.7; transform: scale(1) translateY(4px); }
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg1);
  border-bottom: 1px solid var(--border1);
  display: flex;
  align-items: center;
  /* PK-FIX1 I10 : zone de l'encoche en haut, bords arrondis / paysage à gauche et à droite */
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  gap: 12px;
  z-index: 100;
}

.topbar-logo {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-size: 17px;
  color: var(--text1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.piano-logo {
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  display: block;
}

.logo-text {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-size: 17px;
  color: var(--text1);
  letter-spacing: 0.01em;
}

.logo-text em {
  font-style: italic;
  color: var(--v2);
}

.topbar-spacer { flex: 1; }

/* ── Layout ── */
.layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg1);
  border-right: 1px solid var(--border1);
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}

.sidebar-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 10px 4px;
  margin-top: 8px;
}

.nv {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
}

.nv:hover {
  background: var(--bg3);
  color: var(--text1);
}

.nv.act {
  background: var(--vg);
  color: var(--v2);
  border: 1px solid var(--borderv);
}

.nv .nv-icon {
  font-size: 15px;
  opacity: 0.8;
  min-width: 18px;
  text-align: center;
}

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  max-width: 1100px;
  position: relative;
  z-index: 1;
}

/* ── Page Sections ── */
.page { display: none; }
.page.act {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ── Page Header ── */
.ph {
  margin-bottom: 24px;
}

/* ── Titre principal de page (unifié) ── */
.pt-hero, .pt, .ph-title {
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.2;
  color: var(--text1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.pt       { margin-bottom: 8px; }
.ph-title { margin-bottom: 6px; }
.pt-hero  { margin-bottom: 6px; }

/* Sous-titre descriptif */
.pd {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text3);
  letter-spacing: 0.01em;
  max-width: 560px;
}


.ph-desc {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  max-width: 560px;
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border1);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--trans);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: radial-gradient(ellipse at 50% -20%, rgba(155, 130, 240, 0.07) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--trans);
  pointer-events: none;
}

.card:hover {
  border-color: var(--borderv);
}

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

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text1);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

/* ── Grilles ── */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

.b-live {
  background: rgba(61, 214, 140, 0.12);
  color: var(--green);
  border: 1px solid rgba(61, 214, 140, 0.25);
}

.b-plan {
  background: var(--vg);
  color: var(--v2);
  border: 1px solid var(--borderv);
}

.b-adm {
  background: rgba(255, 138, 76, 0.1);
  color: var(--red);
  border: 1px solid rgba(255, 138, 76, 0.22);
}

.b-ok {
  background: rgba(61, 214, 140, 0.1);
  color: var(--green);
  border: 1px solid rgba(61, 214, 140, 0.22);
}

/* ── Tonalités ── */
#ton-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ton {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 12px;
  padding: 5px 10px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--trans);
  user-select: none;
}

.ton:hover {
  background: var(--bg4);
  color: var(--text1);
  border-color: var(--borderv);
}

.ton.sel {
  background: var(--vg);
  border-color: var(--v);
  color: var(--v2);
}

/* ── Chips de style ── */
.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}

.chip {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--trans);
  user-select: none;
}

.chip:hover {
  background: var(--bg4);
  color: var(--text1);
  border-color: var(--borderv);
}

.chip.sel {
  background: var(--vg);
  border-color: var(--v);
  color: var(--v2);
}

/* ── Bouton générer ── */
.gen-btn {
  width: 100%;
  padding: 11px 20px;
  background: var(--v);
  color: var(--on-v);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--trans), transform var(--trans), box-shadow var(--trans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gen-btn:hover {
  background: var(--v2);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(155, 130, 240, 0.35);
}

.gen-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.gen-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Accords ── */
.chord-cell {
  background: var(--bg3);
  border: 1px solid var(--border1);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  transition: border-color var(--trans);
}

.chord-cell.root {
  border-color: var(--v);
  background: var(--vg);
}

.chord-name {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 18px;
  font-weight: 500;
  color: var(--text1);
  margin-bottom: 4px;
}

.chord-degree {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 11px;
  color: var(--v2);
  margin-bottom: 4px;
}

.chord-label {
  font-size: 11px;
  color: var(--text2);
}

/* Skeleton loading */
.chord-skeleton {
  background: var(--bg3);
  border: 1px solid var(--border1);
  border-radius: 10px;
  padding: 14px 12px;
  animation: skeleton 1.2s ease-in-out infinite;
}

.chord-skeleton .skel-line {
  height: 10px;
  border-radius: 5px;
  background: var(--bg4);
  margin-bottom: 8px;
}

.chord-skeleton .skel-line:last-child { margin-bottom: 0; }
.chord-skeleton .skel-line.lg { width: 70%; margin: 0 auto 8px; }
.chord-skeleton .skel-line.sm { width: 40%; margin: 0 auto; }

/* ── Sliders ── */
.sl-row {
  margin-bottom: 16px;
}

.sl-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 6px;
}

.sl-label span {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  color: var(--v3);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--bg4);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--v2);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--v2);
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(155, 130, 240, 0.6);
}

input[type="range"]:hover::-moz-range-thumb {
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(155, 130, 240, 0.6);
}

/* ── Loop rows ── */
.loop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--trans);
  cursor: pointer;
  border: 1px solid transparent;
}

.loop-row:hover {
  background: var(--bg3);
  border-color: var(--border1);
}

.loop-row.playing {
  background: var(--vg);
  border-color: var(--borderv);
}

/* Bouton play dans les loop-rows (loops.html) */
.loop-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg4);
  border: 1px solid var(--border1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text2);
  transition: all var(--trans);
}

.loop-row:hover .loop-play-btn,
.loop-row.playing .loop-play-btn {
  background: var(--v);
  border-color: var(--v);
  color: #fff;
}

/* Bouton play dans admin (triangle SVG-like) */
.play-ic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg4);
  border: 1px solid var(--border1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--trans);
}

.loop-row:hover .play-ic,
.loop-row.playing .play-ic {
  background: var(--v);
  border-color: var(--v);
}

.tri-ic {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--text2);
  margin-left: 2px;
  transition: border-left-color var(--trans);
}

.loop-row:hover .tri-ic,
.loop-row.playing .tri-ic {
  border-left-color: #fff;
}

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

.loop-name {
  font-size: 13.5px;
  color: var(--text1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loop-cat {
  font-size: 11px;
  color: var(--text2);
  margin-top: 1px;
}

.loop-duration {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 12px;
  color: var(--text3);
  flex-shrink: 0;
}

.loop-vol {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Filtres catégorie ── */
.cat-btns,
.cat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.cat-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--trans);
  user-select: none;
}

.cat-btn:hover {
  color: var(--text1);
  border-color: var(--borderv);
}

/* Classes de sélection (sel = loops.html, s = admin) */
.cat-btn.sel,
.cat-btn.s {
  background: var(--vg);
  border-color: var(--v);
  color: var(--v2);
}

/* ── Bouton primaire général ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--v);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--trans), transform var(--trans), box-shadow var(--trans);
}

.btn-primary:hover {
  background: var(--v2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(155, 130, 240, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg4);
  color: var(--text2);
  border: 1px solid var(--border1);
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans);
}

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

/* ── Note ── */
.note {
  font-size: 12px;
  color: var(--text3);
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--bg3);
  border-radius: 6px;
  border-left: 2px solid var(--border2);
}

/* ── Error message ── */
.error-msg {
  font-size: 13px;
  color: var(--red);
  padding: 12px;
  background: rgba(255, 138, 76, 0.08);
  border: 1px solid rgba(255, 138, 76, 0.2);
  border-radius: var(--radius-sm);
  text-align: center;
}

/* ── Séparateur ── */
.sep {
  height: 1px;
  background: var(--border1);
  margin: 8px 0;
}

/* ── Utilitaires ── */
.cl { color: var(--text2); }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.bold { font-weight: 600; }
.mono { font-family: 'DM Mono', 'Mono Fallback', monospace; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.w100 { width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Quiz ── */

/* Cartes de niveau (écran démarrage) */
.level-card {
  background: var(--bg3);
  border: 1px solid var(--border1);
  border-radius: 12px;
  padding: 1.1rem .75rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
}
.level-card:hover {
  border-color: var(--borderv);
  background: var(--vg);
  transform: translateY(-2px);
}
.level-card.selected {
  border-color: var(--v);
  background: var(--vg);
  box-shadow: 0 0 20px rgba(155, 130, 240,.2);
}
.level-icon  { font-size: 24px; margin-bottom: .5rem; }
.level-name  { font-size: 14px; font-weight: 500; color: var(--text1); margin-bottom: .25rem; }
.level-desc  { font-size: 12px; color: var(--v2); font-family: 'DM Mono', 'Mono Fallback', monospace; margin-bottom: .2rem; }
.level-detail{ font-size: 11px; color: var(--text3); }

/* Bouton "Écouter la note" */
.listen-btn {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: 13px; border-radius: 10px;
  border: 1px solid var(--borderv); background: var(--vg);
  color: var(--v2); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .2s;
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif; margin-bottom: 1.1rem;
}
.listen-btn:hover { background: rgba(155, 130, 240,.2); transform: translateY(-1px); }
.listen-btn.playing { opacity: .6; pointer-events: none; }
.listen-btn:disabled { opacity: .4; cursor: default; transform: none; }

/* Boutons de réponse */
.note-btn {
  padding: 12px 4px; border-radius: 9px;
  border: 1px solid var(--border1); background: var(--bg3);
  color: var(--text1); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .18s;
  font-family: 'DM Mono', 'Mono Fallback', monospace; text-align: center;
}
.note-btn:hover:not(:disabled) {
  border-color: var(--v); color: var(--v2);
  background: var(--vg); transform: translateY(-1px);
}
.note-btn.correct {
  background: rgba(61,214,140,0.12);
  border-color: rgba(61,214,140,0.3);
  color: var(--green);
}
.note-btn.wrong {
  background: rgba(255, 138, 76,0.12);
  border-color: rgba(255, 138, 76,0.3);
  color: var(--red);
}
.note-btn:disabled { cursor: default; }

/* Bouton "Question suivante" */
.next-btn {
  width: 100%; padding: 10px; border-radius: 9px;
  border: none; background: var(--v); color: #fff;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .2s; font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  margin-top: .9rem; display: none;
}
.next-btn:hover { background: var(--v2); transform: translateY(-1px); }
.next-btn.show  { display: block; }

/* Feedback correct / wrong */
.feedback {
  border-radius: 8px; padding: .55rem; text-align: center;
  font-size: 13px; font-weight: 500; margin-bottom: .9rem;
}
.feedback.correct {
  background: rgba(61,214,140,0.12);
  color: var(--green);
  border: 1px solid rgba(61,214,140,0.3);
}
.feedback.wrong {
  background: rgba(255, 138, 76,0.12);
  color: var(--red);
  border: 1px solid rgba(255, 138, 76,0.3);
}
.feedback.hidden { display: none; }

/* Barre de progression */
.progress-bar {
  height: 3px; background: var(--bg4);
  border-radius: 2px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--v);
  border-radius: 2px; transition: width .3s ease;
}

/* Grille de boutons de réponse (colonnes dynamiques via JS) */
.note-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

/* ── Quiz — conteneur 2 colonnes (zone quiz + panneau notes) ── */
.quiz-layout {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 14px;
  align-items: start;
}

/* Cercle score final */
.score-circle {
  width: 110px; height: 110px; border-radius: 50%;
  border: 2px solid var(--v); margin: 0 auto 1.25rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--vg); box-shadow: 0 0 30px rgba(155, 130, 240,.2);
}
.score-num   { font-family:'DM Mono', 'Mono Fallback', monospace; font-size:38px; font-weight:300; color:var(--v2); line-height:1; }
.score-denom { font-size:11px; color:var(--text3); margin-top:2px; }

/* Stats finales (cartes 3 colonnes) */
.score-stat  { background:var(--bg3); border-radius:8px; padding:.6rem .4rem; text-align:center; border:1px solid var(--border1); }
.stat-num    { font-family:'DM Mono', 'Mono Fallback', monospace; font-size:18px; color:var(--v2); }
.stat-lbl    { font-size:9px; color:var(--text3); margin-top:2px; text-transform:uppercase; letter-spacing:.06em; }

/* Panneau notes toggleables (colonne droite) */
.option-note {
  display: flex; align-items: center; justify-content: space-between;
  padding: .45rem .7rem; border-radius: 7px;
  background: var(--bg3); border: 1px solid var(--border1);
  margin-bottom: 4px; cursor: pointer; transition: all .15s;
}
.option-note:hover { border-color: var(--borderv); }
.option-note.on    { background: var(--vg); border-color: var(--v); }
.option-name { font-size:12px; font-family:'DM Mono', 'Mono Fallback', monospace; color:var(--text1); }
.option-dot  {
  width:12px; height:12px; border-radius:50%;
  border:1.5px solid var(--border1); transition:all .15s; flex-shrink:0;
}
.option-note.on .option-dot { background:var(--v); border-color:var(--v); }

/* ── Drums ── */
.drum-card-title {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text1);
  margin-bottom: 4px;
}

.time-tag {
  display: inline-block;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 11px;
  padding: 2px 7px;
  background: var(--bg4);
  border: 1px solid var(--border1);
  border-radius: 4px;
  color: var(--text2);
  margin-bottom: 16px;
}

.bpm-display {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 42px;
  font-weight: 500;
  color: var(--v2);
  text-align: center;
  line-height: 1;
  margin-bottom: 2px;
}

.bpm-unit {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  margin-bottom: 14px;
}

.drum-btns {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-play, .btn-stop {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn-play {
  background: var(--v);
  color: #fff;
}

.btn-play:hover {
  background: var(--v2);
  transform: translateY(-1px);
  box-shadow: 0 3px 14px rgba(155, 130, 240, 0.35);
}

.btn-play.playing {
  background: rgba(61, 214, 140, 0.15);
  color: var(--green);
  border: 1px solid rgba(61, 214, 140, 0.3);
}

.btn-stop {
  background: var(--bg4);
  color: var(--text2);
  border: 1px solid var(--border1);
}

.btn-stop:hover {
  background: var(--bg3);
  color: var(--text1);
}

/* ── Player card avec waveform ── */
.player-card {
  background: var(--bg2);
  border: 1px solid var(--border1);
  border-radius: 14px;
  padding: 1.1rem;
  margin-bottom: 10px;
  transition: border-color .2s;
}
.player-card:hover { border-color: var(--borderv); }
.player-card.active { border-color: var(--borderv); }

.player-top {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .9rem;
}

.play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--v);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .18s;
}
.play-btn:hover { background: var(--v2); transform: scale(1.07); }

.wf-container {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: .75rem;
  background: var(--bg3);
  cursor: pointer;
}

.track-time {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
}

.empty-msg {
  padding: 1.5rem;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  line-height: 1.6;
}

/* ── Backing Track ── */

.status-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .9rem; background: var(--bg3);
  border-radius: 8px; margin-bottom: 1rem;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text3); flex-shrink: 0;
}
.status-dot.playing {
  background: var(--green);
  box-shadow: 0 0 8px rgba(61,214,140,.6);
  animation: statusPulse 1s infinite;
}
@keyframes statusPulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.status-txt  { font-size: 12px; color: var(--text2); }
.bar-counter { margin-left: auto; font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 11px; color: var(--v2); }

.backing-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 200px;
  gap: 10px;
  margin-bottom: 12px;
}
.ctrl-card {
  background: var(--bg2); border: 1px solid var(--border1);
  border-radius: 14px; padding: 1rem;
  transition: border-color .2s;
}
.ctrl-card:hover { border-color: var(--borderv); }

/* Chips backing (classe propre pour éviter conflit avec .chips-wrap harmony) */
.backing-chips-wrap {
  display: flex; flex-wrap: wrap; gap: 4px;
  max-height: 120px; overflow-y: auto;
}
.backing-chips-wrap::-webkit-scrollbar { width: 2px; }
.backing-chips-wrap::-webkit-scrollbar-thumb { background: var(--bg4); }

/* Chip sélectionnable (backing) */
.sel-chip {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 11px; padding: 3px 8px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 5px; color: var(--text2);
  cursor: pointer; transition: all var(--trans); user-select: none;
}
.sel-chip:hover  { border-color: var(--borderv); color: var(--text1); }
.sel-chip.s      { background: var(--vg); border-color: var(--v); color: var(--v2); }

.bpm-big {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 36px; font-weight: 300;
  color: var(--v2); line-height: 1;
}
.bpm-sub {
  font-size: 9px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: .5rem;
}

/* Grille 4 accords */
.chord-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin: .75rem 0 1rem;
}
.chord-cell {
  background: var(--bg3); border: 1px solid var(--border1);
  border-radius: 10px; padding: 1rem .4rem;
  text-align: center; transition: all .2s;
  position: relative; overflow: hidden;
}
.chord-cell::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 2px;
  background: var(--v); opacity: 0; transition: opacity .2s;
}
.chord-cell.active          { background: var(--vg); border-color: var(--v); box-shadow: 0 0 24px rgba(155, 130, 240,.2); }
.chord-cell.active::after   { opacity: 1; }
.chord-cell.placeholder     { opacity: .35; }
.chord-name                 { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 16px; color: var(--text1); }
.chord-cell.active .chord-name { color: var(--v2); }
.chord-deg                  { font-size: 9px; color: var(--text3); margin-top: 4px; }
.chord-cell.active .chord-deg  { color: rgba(164,143,240,.5); }
.beat-indicator  { display: flex; justify-content: center; gap: 3px; margin-top: 7px; }
.beat-dot        { width: 5px; height: 5px; border-radius: 50%; background: var(--bg4); transition: background .08s; }
.beat-dot.lit    { background: var(--v2); }

/* Transport */
.transport-row { display: flex; gap: 8px; }
.transport-row .gen-btn { flex: 1; width: auto; }

.play-backing-btn {
  padding: 10px 18px; border-radius: 9px;
  border: none; background: var(--green);
  color: #000; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .2s;
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
}
.play-backing-btn:hover    { opacity: .85; transform: translateY(-1px); }
.play-backing-btn:disabled { opacity: .3; cursor: default; transform: none; }

.stop-backing-btn {
  padding: 10px 14px; border-radius: 9px;
  border: 1px solid var(--border1); background: transparent;
  color: var(--text2); font-size: 13px; cursor: pointer;
  transition: all .18s; font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
}
.stop-backing-btn:hover { border-color: var(--text2); color: var(--text1); }

/* Mixer */
.mixer-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.mix-channel {
  background: var(--bg3); border: 1px solid var(--border1);
  border-radius: 10px; padding: .75rem .5rem; text-align: center;
}
.mix-label {
  font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: .4rem;
}
.mix-vol-display {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 13px; color: var(--v2); margin-bottom: .4rem;
}
.mix-slider {
  width: 100%; -webkit-appearance: none;
  height: 2px; background: var(--bg4);
  border-radius: 2px; outline: none; cursor: pointer;
}
.mix-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px;
  border-radius: 50%; background: var(--v2);
  border: 2px solid var(--bg0); transition: transform .15s;
}
.mix-slider::-webkit-slider-thumb:hover { transform: scale(1.3); }


/* ── Toggle notation A / Do ── */
.notation-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  border: 1px solid var(--border1);
  background: var(--bg3);
  transition: border-color .15s;
  user-select: none;
}
.notation-toggle:hover { border-color: var(--borderv); }

.nt-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  transition: color .15s;
  width: 16px;
  text-align: center;
}
.nt-label.active { color: var(--v2); }

.nt-switch {
  width: 28px;
  height: 14px;
  border-radius: 7px;
  background: var(--bg4);
  position: relative;
  border: 1px solid var(--border2);
}
.nt-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--v2);
  transition: transform .2s ease;
}
.nt-thumb.right { transform: translateX(14px); }

/* ── Select wrapper (arrow custom) ── */
.sel-wrap {
  position: relative;
  margin-top: 4px;
}
.sel-wrap::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text3);
  pointer-events: none;
}
.sel-wrap select {
  width: 100%;
  padding: 7px 28px 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text1);
  font-size: 13px;
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  transition: border-color .15s;
  cursor: pointer;
}
.sel-wrap select:hover { border-color: var(--borderv); }
.sel-wrap select:focus { border-color: var(--v); box-shadow: 0 0 0 3px rgba(155, 130, 240,.1); }

/* ── Logo compact ── */
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-name {
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text1);
  letter-spacing: -.04em;
}

.logo-name span {
  color: var(--v2);
}

/* ── Chord keyboard & hints ── */
.chord-hint {
  font-size: 10px;
  color: var(--text3);
  margin-top: .4rem;
}

.chord-cell.selected-chord {
  border-color: var(--v);
  cursor: pointer;
}

.chord-cell.selected-chord .chord-name {
  color: var(--v2);
}

.chord-cell:not(.selected-chord) {
  cursor: pointer;
}

.active-chord {
  background: var(--vg) !important;
  border-color: var(--v) !important;
}

.active-chord .chord-name {
  color: var(--v2) !important;
}

/* ── Select stylé ── */
.sel-full {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text1);
  font-size: 13px;
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  transition: border-color .15s;
  cursor: pointer;
  margin-bottom: 0;
}

.sel-full:hover { border-color: var(--borderv); }
.sel-full:focus { border-color: var(--v); box-shadow: 0 0 0 3px rgba(155, 130, 240,.1); }

/* ── Responsive : hamburger caché sur desktop ── */
.hamburger  { display: none; }
.sb-overlay { display: none; }

/* ── Responsive 768px : drawer sidebar + grilles ── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 220px;
    transform: translateX(-100%); transition: transform 0.25s ease;
    z-index: 200; background: var(--bg1);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,0.6); }

  .sb-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 199; }
  .sb-overlay.open { display: block; }

  .hamburger {
    display: flex; flex-direction: column; gap: 5px;
    cursor: pointer; padding: 8px; border: none; background: none;
    border-radius: 6px; order: -1;
  }
  .hamburger span {
    display: block; width: 20px; height: 2px;
    background: var(--text1); border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }
  .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .main          { margin-left: 0; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); }
  .grid2         { grid-template-columns: 1fr; }
  .grid4         { grid-template-columns: repeat(2, 1fr); }
  .chord-grid-4  { grid-template-columns: repeat(2, 1fr); }
  .note-grid     { grid-template-columns: repeat(2, 1fr); }
  .quiz-layout   { grid-template-columns: 1fr; }
  .mixer-grid    { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .backing-controls { grid-template-columns: 1fr; }

  .pt-hero, .pt, .ph-title { font-size: 20px; }
  .bpm-display { font-size: 28px; }
  .bpm-big     { font-size: 26px; }
  .score-num   { font-size: 28px; }
}

/* ── Responsive 480px : petits écrans ── */
@media (max-width: 480px) {
  .main    { padding: 14px max(12px, env(safe-area-inset-right, 0px)) 14px max(12px, env(safe-area-inset-left, 0px)); }
  .card    { padding: 14px; }
  .mixer-grid { grid-template-columns: 1fr; }
  .topbar  { padding: 0 10px; gap: 8px; }
}

/* ── Admin — Gestionnaire de boucles ── */

/* Bouton "Nouvelle catégorie" dans la cat-bar */
.cat-add-btn {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px dashed var(--border2);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  transition: all .15s;
  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', sans-serif;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cat-add-btn:hover {
  border-color: var(--v);
  color: var(--v2);
}

/* Carte de loop (player + waveform + volume) */
.loop-card {
  background: var(--bg2);
  border: 1px solid var(--border1);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 8px;
  transition: border-color .2s;
}

.loop-card:hover   { border-color: var(--border2); }
.loop-card.playing { border-color: var(--borderv); }

/* Rangée volume (flex horizontale) dans .loop-card */
.sl-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════
   METRONOME
   ═══════════════════════════════════════════════════════════ */

.metro-card { max-width: 480px; margin: 0 auto; }

.metro-bpm-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.metro-bpm-center { text-align: center; min-width: 90px; }

.metro-bpm-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text2);
  margin-top: -6px;
}

.metro-step {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border1);
  background: var(--bg2);
  color: var(--text1);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.15s;
}
.metro-step:hover { background: var(--bg3); }

.metro-slider-full {
  width: 100%;
  accent-color: var(--v);
  cursor: pointer;
  margin-bottom: 18px;
  display: block;
}

.metro-selects-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.metro-select-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border1);
  border-radius: 8px;
  padding: 8px 12px;
}

.metro-select-icon { font-size: 1rem; color: var(--text2); flex-shrink: 0; }

.metro-select {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text1);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
.metro-select option { background: var(--bg1); }

.metro-pendulum-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 16px;
}

.metro-beats-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.metro-beat-box {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 2px solid var(--border1);
  background: var(--bg2);
  transition: background 0.06s ease, box-shadow 0.06s ease, border-color 0.06s ease;
}
.metro-beat-box.accent { border-color: var(--v); }
.metro-beat-box.active {
  background: var(--v);
  box-shadow: 0 0 14px var(--v);
  border-color: var(--v);
}
.metro-beat-box.accent.active {
  box-shadow: 0 0 22px var(--v), 0 0 6px rgba(255,255,255,0.2);
}

.metro-actions {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.metro-tap-btn {
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--v);
  background: var(--vg);
  color: var(--v2);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s;
  flex-shrink: 0;
}
.metro-tap-btn:hover { background: var(--vb); }

.metro-start-btn { flex: 1; }
.metro-start-btn.is-stop {
  background: var(--bg2) !important;
  color: var(--text2) !important;
  border: 1px solid var(--border1) !important;
  box-shadow: none !important;
}

@media (max-width: 768px) {
  .metro-card         { max-width: 100%; }
  .metro-beat-box     { width: 44px; height: 44px; }
  .metro-selects-row  { flex-direction: column; }
}

/* === CHORDS === */

/* Sélecteurs */
.chords-selectors-card {
  margin-bottom: 12px;
}

.chords-selectors-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chords-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
}

.chords-select {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border1);
  border-radius: 8px;
  color: var(--text1);
  padding: 10px 36px 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a82a0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s;
}
.chords-select:focus { border-color: var(--v); }
.chords-select option { background: var(--bg1); color: var(--text1); }

/* Résultat */
.chords-result-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Grand nom d'accord */
/* Grand nom d'accord */
.chord-name-display {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 16px 0 8px;
}
#chord-name-main {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--text1, var(--text1));
  line-height: 1;
}
#chord-name-latin {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 1rem;
  color: var(--text3);
}

/* Toggle notation chords page */
.notation-toggle {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  margin: 12px 0;
}
.notif-btn {
  padding: 6px 14px;
  border-radius: 4px;
  border: none;
  background: var(--bg3);
  color: var(--text2);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.notif-btn.active {
  background: var(--v);
  color: var(--on-v);
}
.notif-help {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border1);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 0.85rem;
}

/* Badges intervalles */
.intervals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.interval-badge {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(155, 130, 240,0.12);
  border: 1px solid rgba(155, 130, 240,0.3);
  color: var(--v, var(--v));
}
.interval-badge.root {
  background: rgba(155, 130, 240,0.3);
  border-color: var(--v);
  color: var(--text1);
}

/* Notes row */
.chords-notes-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.chords-note-pill {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg3);
  border: 1px solid var(--border1);
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
}
.chords-note-pill.root {
  background: var(--vg);
  border-color: var(--v);
  color: var(--v2);
}

/* Keyboard navigation (octave buttons + wrapper) */
.keyboard-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
}
.keyboard-wrapper {
  flex: 1;
  overflow-x: auto;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 0 16px;
}
.octave-btn {
  background: var(--bg3);
  border: 1px solid var(--border1);
  color: var(--text1);
  border-radius: 6px;
  width: 32px;
  height: 48px;
  cursor: pointer;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: background 0.15s;
}
.octave-btn:hover { background: rgba(155, 130, 240,0.2); }
.octave-btn:disabled { opacity: 0.25; cursor: default; }

/* Grand clavier */
.grand-keyboard {
  position: relative;
  display: flex;
  justify-content: center;
}
.kb-white {
  width: 48px;
  height: 180px;
  background: var(--key-white);
  border: 1px solid #bbb;
  border-radius: 0 0 6px 6px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .1s;
}
.kb-white:hover { background: #ececec; }
.kb-black {
  width: 30px;
  height: 110px;
  background: var(--bg2);
  border-radius: 0 0 4px 4px;
  position: absolute;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  cursor: pointer;
  transition: background .1s;
}
.kb-black:hover { background: #2a2a3a; }
.note-pill {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--v);
  color: var(--on-v);
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  text-align: center;
}
.note-pill.root-pill { background: var(--v); }
.note-pill.other-pill { background: var(--pill-other-bg); color: var(--pill-other-ink); }
.kb-black .note-pill {
  width: 26px; height: 26px;
  font-size: 0.55rem;
}

/* Volume */
.chords-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.chords-vol-icon  { font-size: 1rem; flex-shrink: 0; }
.chords-vol-slider { flex: 1; accent-color: var(--v); cursor: pointer; }
.chords-vol-num {
  font-size: 0.82rem;
  color: var(--text2);
  min-width: 36px;
  text-align: right;
}

/* Bouton jouer */
.chords-play-btn {
  align-self: center;
}
.chords-play-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  #chord-name-main { font-size: 2.2rem; }
  .kb-white { width: 38px; height: 150px; }
  .kb-black { width: 24px; height: 90px; }
  .note-pill { width: 28px; height: 28px; font-size: 0.55rem; }
  .kb-black .note-pill { width: 22px; height: 22px; font-size: 0.5rem; }
}

@media (max-width: 480px) {
  .chords-selectors-row { grid-template-columns: 1fr; }
  #chord-name-main { font-size: 1.8rem; }
  .kb-white { width: 32px; height: 130px; }
  .kb-black { width: 20px; height: 78px; }
  .note-pill { width: 24px; height: 24px; font-size: 0.5rem; }
  .kb-black .note-pill { width: 18px; height: 18px; font-size: 0.45rem; }
  .notation-toggle { flex-wrap: wrap; }
}

/* === BOTTOM NAV === */
.bottom-nav { display: none; }
@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(76px + env(safe-area-inset-bottom));
    background: var(--nav-bg);
    border-top: 1px solid var(--border1);
    z-index: 300;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text2);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .bn-item:hover { color: var(--text1); }
  .bn-item.act { color: var(--v2); font-weight: 700; }
  .bn-item svg {
    width: 24px; height: 24px;
    flex-shrink: 0;
  }
  .bn-item span {
    display: block;
    line-height: 1;
  }
  .main {
    padding-bottom: calc(76px + env(safe-area-inset-bottom) + 20px) !important;
  }
  .hamburger { display: none !important; }
  .sidebar   { display: none !important; }
}

/* === QUIZ === */
.quiz-tabs {
  display: flex;
  border-bottom: 1px solid var(--border1);
  margin-bottom: 16px;
  gap: 0;
}
.quiz-tab {
  padding: 10px 22px;
  border: none; background: none;
  color: var(--text2); font-size: .9rem;
  font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.quiz-tab:hover { color: var(--text1); }
.quiz-tab.active { color: var(--v); border-bottom-color: var(--v); }
.quiz-tab-content { display: block; }
.quiz-tab-content.hidden { display: none; }
.quiz-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  align-items: start;
}
.quiz-main-col { display: flex; flex-direction: column; gap: 16px; }
.quiz-side-col { position: sticky; top: calc(var(--nav-h, 46px) + 16px); }
.quiz-piano-status {
  font-size: .875rem; color: var(--v);
  margin-bottom: 16px;
}
.quiz-level-label {
  font-size: .72rem; font-weight: 600;
  letter-spacing: .08em; color: var(--text2);
  margin-bottom: 10px;
}
.quiz-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.level-card {
  display: flex; flex-direction: column;
  align-items: center; padding: 16px 8px;
  border-radius: 10px;
  border: 1px solid var(--border1);
  background: var(--bg2); cursor: pointer;
  transition: border-color .15s, background .15s;
  gap: 4px;
}
.level-card:hover { border-color: var(--v); }
.level-card.selected {
  border-color: var(--v);
  background: var(--vg);
}
.level-icon { font-size: 1.3rem; }
.level-name { font-size: .875rem; font-weight: 600; color: var(--text1); }
.level-info { font-size: .78rem; color: var(--v); }
.quiz-hud {
  display: flex; align-items: center;
  gap: 16px; margin-bottom: 16px;
}
.quiz-score-circle {
  width: 58px; height: 58px; border-radius: 50%;
  border: 2px solid var(--v);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.quiz-score-circle .score-num {
  font-size: 1.2rem; font-weight: 600;
  color: var(--v); line-height: 1;
}
.quiz-score-circle .score-den {
  font-size: .72rem; color: var(--text2); line-height: 1;
}
.quiz-progress-bar {
  flex: 1; height: 4px;
  background: var(--bg2); border-radius: 99px; overflow: hidden;
}
.quiz-progress-fill {
  height: 100%; background: var(--v);
  border-radius: 99px; transition: width .3s ease;
}
.quiz-listen-btn {
  width: 100%; padding: 13px;
  border-radius: 10px;
  border: 1px solid var(--v);
  background: var(--vg);
  color: var(--v); font-size: 1rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  margin-bottom: 14px; display: block;
  transition: background .15s;
}
.quiz-listen-btn:hover { background: var(--vb); }
.quiz-listen-btn:disabled { opacity: .4; cursor: not-allowed; }
.quiz-screen.hidden { display: none; }

/* Shared intervals/chords */
.iv-toggle-group { display: flex; gap: 6px; flex-wrap: wrap; }
.iv-toggle {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border1);
  background: var(--bg2);
  color: var(--text2);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.iv-toggle.active {
  background: var(--vg);
  border-color: var(--v);
  color: var(--v);
}
.iv-intervals-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.iv-interval-toggle {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border1);
  background: var(--bg2);
  color: var(--text2);
  font-size: .78rem;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.iv-interval-toggle.active {
  background: var(--vg);
  border-color: var(--v);
  color: var(--v);
}
.iv-direction-badge {
  font-size: .8rem;
  color: var(--text2);
  font-weight: 600;
}
.iv-feedback {
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 14px;
}
.iv-feedback.hidden { display: none; }
.iv-correct-msg {
  background: rgba(61, 214, 140, 0.12);
  border: 1px solid rgba(61, 214, 140, 0.3);
  color: var(--green);
}
.iv-wrong-msg {
  background: rgba(255, 138, 76, 0.12);
  border: 1px solid rgba(255, 138, 76, 0.3);
  color: var(--red);
}
.iv-choices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.iv-choice-btn {
  padding: 12px;
  background: var(--bg2);
  border: 1px solid var(--border1);
  border-radius: 10px;
  color: var(--text1);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  text-align: center;
}
.iv-choice-btn:hover:not(:disabled) {
  background: var(--bg3);
  border-color: var(--v);
}
.iv-choice-btn.iv-correct {
  background: rgba(61, 214, 140, 0.15);
  border-color: var(--green);
  color: var(--green);
}
.iv-choice-btn.iv-wrong {
  background: rgba(255, 138, 76, 0.15);
  border-color: var(--red);
  color: var(--red);
}
.iv-choice-btn:disabled { cursor: default; }

@media (max-width: 768px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-side-col { position: static; order: -1; }
  .quiz-levels { grid-template-columns: 1fr; }
  .quiz-tabs { overflow-x: auto; }
  .quiz-tab { padding: 10px 14px; font-size: .82rem; }
}

/* === LOGIN === */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--gap-lg);
  background: var(--bg0);
  background-image: radial-gradient(
    ellipse 60% 40% at 50% 0%,
    rgba(155, 130, 240, 0.08) 0%,
    transparent 70%
  );
}
.login-wrap {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-lg);
}
.login-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(155, 130, 240, 0.3);
  box-shadow: 0 0 32px rgba(155, 130, 240, 0.15);
  margin-bottom: 4px;
}
.login-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.login-logo {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.login-logo img {
  border-radius: 16px;
  margin-bottom: var(--gap-md);
}
.login-title {
  font-family: var(--font-display, serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text1);
  letter-spacing: -0.01em;
  margin: 0;
}
.login-subtitle {
  color: var(--text2);
  font-size: 0.9rem;
  margin: 0;
}
#clerk-sign-in {
  width: 100%;
}
.login-card {
  width: 100%;
}
.login-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text2);
  opacity: 0.6;
}

/* ════════════════════════════════════════════════════════════
 * DASHBOARD ARCADE — Phase 1  (index.html)
 * Toutes les classes préfixées .pk- pour éviter les collisions
 * avec les classes partagées des autres pages.
 * Vars existantes JAMAIS écrasées : on ajoute des vars arcade +
 * un jeu de vars pk-scopées pour les nuances spécifiques au mockup.
 * ════════════════════════════════════════════════════════════ */

:root {
  /* Accents (V4) */
  --gold:       #F2B93B;
  --gold-deep:  #C8921E;
  --cyan:       #B7A3F7;
  --orange:     #FF9A3C;
  --magenta:    #D3C7FA;
  --red-arcade: #FF8A4C;

  /* Déclinaisons violet */
  --v-light:    #B7A3F7;
  --v-deep:     #5E47B8;
  --v-glow:     rgba(155, 130, 240, 0.4);

  /* Nuances bg/border du dashboard */
  --pk-bg1:     #161310;
  --pk-bg2:     #1C1916;
  --pk-bg3:     #24201C;
  --pk-border:  #332D26;
  --pk-border2: #433A30;
}

/* ─── Fond de page (scopé au dashboard uniquement) ─── */
body.pk-dashboard {
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg0);
  min-height: 100vh;
}
body.pk-dashboard::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0, rgba(255,255,255,0.012) 1px, transparent 1px, transparent 3px);
}

.pk-app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px 60px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── TOP BAR ─── */
.pk-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(20,20,34,0.85), rgba(18, 16, 14,0.85));
  border: 1px solid var(--pk-border);
  border-radius: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 12px;
  z-index: 10;
}
.pk-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text1);
  flex-shrink: 0;
}
.pk-key-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--v), var(--v-deep));
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 4px 12px var(--v-glow);
  position: relative;
}
.pk-key-icon::before, .pk-key-icon::after {
  content: '';
  position: absolute;
  background: var(--bg0);
  border-radius: 1px;
  width: 2px;
  height: 10px;
  top: 8px;
}
.pk-key-icon::before { left: 9px; }
.pk-key-icon::after  { right: 9px; }

.pk-player-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.pk-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text1);
}
.pk-stat.pk-streak {
  background: linear-gradient(135deg, rgba(255, 154, 60, 0.18), rgba(255, 138, 76, 0.18));
  border: 1px solid rgba(255, 154, 60, 0.35);
  padding: 6px 12px;
  border-radius: 10px;
  color: var(--orange-ink);
}
.pk-stat.pk-streak .pk-flame { font-size: 14px; filter: drop-shadow(0 0 4px var(--orange)); }
.pk-stat.pk-lives { display: inline-flex; gap: 2px; }
.pk-heart { width: 16px; height: 16px; position: relative; }
.pk-heart::before, .pk-heart::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 12px;
  background: var(--red-arcade);
  border-radius: 50% 50% 0 0;
  top: 2px;
  filter: drop-shadow(0 0 3px rgba(255, 138, 76, 0.6));
}
.pk-heart::before { left: 0; transform: rotate(-45deg); transform-origin: bottom right; }
.pk-heart::after  { right: 0; transform: rotate(45deg); transform-origin: bottom left; }
.pk-heart.pk-empty::before, .pk-heart.pk-empty::after {
  background: var(--pk-bg3);
  filter: none;
  opacity: 0.7;
}
.pk-stat.pk-xp { display: flex; flex-direction: column; gap: 3px; min-width: 130px; }
.pk-stat.pk-xp .pk-xp-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text2);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.pk-stat.pk-xp .pk-xp-label .pk-level { color: var(--gold-ink); font-weight: 800; }
.pk-stat.pk-xp .pk-bar {
  width: 100%;
  height: 6px;
  background: var(--pk-bg3);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.pk-stat.pk-xp .pk-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(242, 185, 59, 0.5);
}

.pk-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--v), var(--v-deep));
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid var(--v-light);
  box-shadow: 0 4px 14px var(--v-glow);
  transition: transform 0.15s;
}
.pk-avatar-btn:hover { transform: translateY(-2px); }
.pk-avatar-face {
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  place-items: center;
}
.pk-avatar-eye { width: 4px; height: 4px; background: var(--avatar-eye); border-radius: 1px; margin-top: 4px; }

/* ─── HERO ─── */
.pk-hero {
  position: relative;
  background: linear-gradient(135deg, rgba(155, 130, 240, 0.12), rgba(211, 199, 250, 0.06) 60%, transparent);
  border: 1px solid var(--pk-border);
  border-radius: 24px;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  align-items: center;
  overflow: hidden;
}
.pk-hero::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, var(--v-glow), transparent 70%);
  pointer-events: none;
}
.pk-character-wrap { display: grid; place-items: center; position: relative; z-index: 1; }
.pk-character { width: 120px; height: 120px; position: relative; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.pk-char-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--v-light), var(--v));
  border-radius: 18px;
  box-shadow:
    inset 0 -8px 16px var(--v-deep),
    inset 0 8px 16px rgba(255,255,255,0.15),
    0 12px 24px var(--v-glow),
    0 0 0 3px rgba(255,255,255,0.06);
}
.pk-char-face {
  position: absolute;
  inset: 18% 14% 26% 14%;
  background: #f4f0fa;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 18px 8px 0;
  align-items: start;
}
.pk-char-eye {
  width: 14px;
  height: 14px;
  background: var(--bg0);
  border-radius: 4px;
  position: relative;
  justify-self: center;
}
.pk-char-eye::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 1px;
}
.pk-mouth {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 6px;
  background: var(--bg0);
  border-radius: 0 0 6px 6px;
}
.pk-headphones {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 14px;
  border: 4px solid var(--gold);
  border-bottom: none;
  border-radius: 50px 50px 0 0;
  filter: drop-shadow(0 0 6px var(--gold));
}
.pk-headphones::before, .pk-headphones::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 18px;
  background: var(--gold);
  border-radius: 4px;
  top: 10px;
  filter: drop-shadow(0 0 6px var(--gold));
}
.pk-headphones::before { left: -10px; }
.pk-headphones::after  { right: -10px; }

.pk-hero-content { position: relative; z-index: 1; }
.pk-hero-tag {
  display: inline-block;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--v-light);
  background: rgba(155, 130, 240, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(155, 130, 240, 0.3);
  margin-bottom: 12px;
}
.pk-hero-content h1 {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-weight: 800;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.pk-hero-content h1 .pk-hero-name {
  background: linear-gradient(90deg, var(--v-light), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pk-hero-content p { color: var(--text2); font-size: 14px; margin-bottom: 18px; max-width: 380px; }
.pk-hero-content p strong { color: var(--gold-ink); font-weight: 700; }

.pk-cta-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: var(--gold-bg);
  border: none;
  padding: 14px 24px;
  border-radius: 14px;
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 6px 0 var(--gold-deep),
    0 12px 24px rgba(242, 185, 59, 0.35),
    inset 0 2px 0 rgba(255,255,255,0.5);
  transition: all 0.12s;
}
.pk-cta-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--gold-deep), 0 16px 32px rgba(242, 185, 59, 0.5), inset 0 2px 0 rgba(255,255,255,0.5);
}
.pk-cta-main:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--gold-deep), 0 6px 12px rgba(242, 185, 59, 0.3), inset 0 2px 0 rgba(255,255,255,0.5);
}
.pk-play-tri {
  width: 0; height: 0;
  border-left: 9px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* ─── DAILY CHALLENGE ─── */
.pk-daily-challenge {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(155, 130, 240, 0.1), rgba(155, 130, 240, 0.02));
  border: 1px solid rgba(155, 130, 240, 0.3);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}
.pk-daily-challenge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(155, 130, 240, 0.05), transparent);
  animation: shimmer 4s linear infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.pk-bolt-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border-radius: 12px;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(155, 130, 240, 0.4);
  z-index: 1;
}
.pk-dc-content { z-index: 1; }
.pk-dc-label {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  font-weight: 700;
  text-transform: uppercase;
}
.pk-dc-title {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text1);
}
.pk-dc-reward { display: flex; flex-direction: column; align-items: flex-end; z-index: 1; }
.pk-dc-num { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 22px; color: var(--gold-ink); line-height: 1; }
.pk-dc-lbl { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 9px; letter-spacing: 0.2em; color: var(--text3); font-weight: 700; }
.pk-dc-go {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--cyan);
  color: var(--bg0);
  border: none;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
  z-index: 1;
  transition: all 0.15s;
  box-shadow: 0 4px 0 var(--green);
}
.pk-dc-go:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--green); }
.pk-dc-go:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--green); }

/* ─── SECTION TITLES ─── */
.pk-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pk-section-title .pk-dot { width: 8px; height: 8px; background: var(--v); border-radius: 2px; box-shadow: 0 0 8px var(--v-glow); }
.pk-section-title h2 {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
}

/* ─── FEATURES GRID ─── */
.pk-features-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.pk-feature {
  grid-column: span 2;
  background: var(--pk-bg1);
  border: 1px solid var(--pk-border);
  border-radius: 18px;
  padding: 18px 16px;
  text-decoration: none;
  color: var(--text1);
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  min-height: 170px;
}
.pk-feature:hover { transform: translateY(-3px); border-color: var(--pk-border2); }
.pk-feature .pk-top-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--v); }
.pk-feature.pk-hero-feat {
  grid-column: span 6;
  background:
    radial-gradient(ellipse 60% 100% at 90% 50%, rgba(211, 199, 250, 0.15), transparent 70%),
    linear-gradient(135deg, rgba(155, 130, 240, 0.18), rgba(211, 199, 250, 0.08));
  border: 1px solid rgba(155, 130, 240, 0.4);
  min-height: 160px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.pk-feature.pk-hero-feat:hover { border-color: var(--v-light); box-shadow: 0 8px 30px var(--v-glow); }
.pk-feature.pk-hero-feat .pk-top-bar { background: linear-gradient(90deg, var(--v), var(--magenta)); }

.pk-ficon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  position: relative;
  border: 1px solid var(--pk-border);
}
.pk-ficon svg { width: 28px; height: 28px; }
.pk-feature.pk-hero-feat .pk-ficon {
  width: 96px;
  height: 96px;
  margin: 0;
  background: linear-gradient(135deg, var(--v), var(--magenta));
  border: 3px solid rgba(255,255,255,0.1);
  box-shadow: 0 0 30px rgba(211, 199, 250, 0.4);
  grid-row: 1 / 3;
  grid-column: 2;
}
.pk-feature.pk-hero-feat .pk-ficon svg { width: 52px; height: 52px; color: white; }

.pk-ftitle { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.pk-feature.pk-hero-feat .pk-ftitle {
  font-size: 26px;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--text1), var(--v-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pk-fdesc { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.pk-feature.pk-hero-feat .pk-fdesc { font-size: 13px; max-width: 280px; }
.pk-fmeta { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.pk-fprog { flex: 1; height: 4px; background: var(--pk-bg2); border-radius: 2px; overflow: hidden; }
.pk-fprog .pk-ff { height: 100%; background: var(--v); border-radius: 2px; box-shadow: 0 0 4px var(--v-glow); }
.pk-fnum { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 10px; font-weight: 700; color: var(--text2); letter-spacing: 0.05em; }

.pk-feature.pk-transitional { opacity: 0.7; }
.pk-feature.pk-transitional .pk-top-bar { background: var(--text3); }
.pk-badge-transit {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--text3);
  background: var(--pk-bg2);
  border: 1px solid var(--pk-border);
  padding: 3px 7px;
  border-radius: 5px;
  text-transform: uppercase;
  font-weight: 700;
}

.pk-feature.pk-fc-cyan .pk-top-bar { background: var(--cyan); }
.pk-feature.pk-fc-cyan .pk-ficon   { background: rgba(155, 130, 240, 0.12); }
.pk-feature.pk-fc-orange .pk-top-bar { background: var(--orange); }
.pk-feature.pk-fc-orange .pk-ficon   { background: rgba(255, 154, 60, 0.12); }
.pk-feature.pk-fc-green .pk-top-bar { background: var(--green); }
.pk-feature.pk-fc-green .pk-ficon   { background: rgba(61, 214, 140, 0.12); }
.pk-feature.pk-fc-magenta .pk-top-bar { background: var(--magenta); }
.pk-feature.pk-fc-magenta .pk-ficon   { background: rgba(211, 199, 250, 0.12); }

/* ─── BOTTOM ROW : LIGUE + SUCCÈS ─── */
.pk-bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pk-widget { background: var(--pk-bg1); border: 1px solid var(--pk-border); border-radius: 18px; padding: 20px; }

.pk-league .pk-lhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pk-lname { display: flex; align-items: center; gap: 8px; }
.pk-crown {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border-radius: 10px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 14px rgba(155, 130, 240, 0.4);
}
.pk-crown svg { width: 22px; height: 22px; color: white; }
.pk-ltitle { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.pk-ltime {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--orange-ink);
  background: rgba(255, 154, 60, 0.12);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 154, 60, 0.3);
}
.pk-podium { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pk-podium-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--pk-bg2);
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.pk-podium-row.pk-you {
  background: linear-gradient(90deg, rgba(155, 130, 240, 0.15), rgba(155, 130, 240, 0.05));
  border-color: var(--v);
  box-shadow: 0 0 14px var(--v-glow);
}
.pk-podium-row .pk-pos { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 18px; color: var(--text2); text-align: center; }
.pk-podium-row.pk-you .pk-pos { color: var(--v-light); }
.pk-podium-row .pk-pname { font-weight: 700; font-size: 14px; }
.pk-podium-row.pk-you .pk-pname { color: var(--v-light); }
.pk-podium-row .pk-pxp { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 12px; font-weight: 700; color: var(--gold-ink); }

.pk-see-all {
  display: block;
  text-align: center;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--v-light);
  text-decoration: none;
  padding: 8px;
  border-top: 1px solid var(--pk-border);
  margin: 14px -20px -20px;
  border-radius: 0 0 18px 18px;
  transition: background 0.15s;
}
.pk-see-all:hover { background: rgba(155, 130, 240, 0.08); }

.pk-ach-list { display: flex; flex-direction: column; gap: 10px; }
.pk-ach {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--pk-bg2);
  border: 1px solid var(--pk-border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.pk-ach.pk-unlocked {
  background: linear-gradient(90deg, rgba(242, 185, 59, 0.08), var(--pk-bg2));
  border-color: rgba(242, 185, 59, 0.25);
}
.pk-ach-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  box-shadow: 0 0 12px rgba(242, 185, 59, 0.4);
}
.pk-ach.pk-locked .pk-ach-icon { background: var(--pk-bg3); color: var(--text2); box-shadow: none; }
.pk-ach.pk-unlocked .pk-ach-icon { color: var(--gold-bg); }
.pk-ach-info h3, .pk-ach-info h4 { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 700; font-size: 14px; line-height: 1.2; margin-bottom: 2px; }
.pk-ach-info p { font-size: 11px; color: var(--text2); font-family: 'DM Mono', 'Mono Fallback', monospace; }
.pk-ach.pk-locked .pk-ach-info h3, .pk-ach.pk-locked .pk-ach-info h4 { color: var(--text2); }
.pk-ach-xp {
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-weight: 700;
  font-size: 12px;
  color: var(--gold-ink);
  background: rgba(242, 185, 59, 0.12);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(242, 185, 59, 0.3);
}
.pk-ach.pk-locked .pk-ach-xp { color: var(--text3); background: var(--pk-bg3); border-color: var(--pk-border); }

/* ─── ENTRY ANIMATIONS ─── */
.pk-fade-up {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.pk-fade-up:nth-child(1) { animation-delay: 0.0s; }
.pk-fade-up:nth-child(2) { animation-delay: 0.06s; }
.pk-fade-up:nth-child(3) { animation-delay: 0.12s; }
.pk-fade-up:nth-child(4) { animation-delay: 0.18s; }
.pk-fade-up:nth-child(5) { animation-delay: 0.24s; }
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Pulse générique (réservé hero/jeu — Phase 2+) */
@keyframes chordPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.85; }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 720px) {
  .pk-app { padding: 12px 12px 60px; gap: 18px; }
  .pk-topbar { padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
  .pk-logo { font-size: 16px; }
  .pk-player-stats { gap: 8px; }
  .pk-stat.pk-xp { min-width: 100px; }
  .pk-stat.pk-xp .pk-xp-label { font-size: 9px; }
  .pk-stat.pk-streak { padding: 4px 8px; font-size: 12px; }

  .pk-hero { padding: 22px 18px; grid-template-columns: 1fr; text-align: center; gap: 14px; }
  .pk-hero-content h1 { font-size: 28px; }
  .pk-hero-content p { margin: 0 auto 16px; }
  .pk-character { width: 100px; height: 100px; }

  .pk-daily-challenge { padding: 14px; gap: 12px; }
  .pk-bolt-icon { width: 38px; height: 38px; font-size: 18px; }
  .pk-dc-title { font-size: 14px; }
  .pk-dc-num { font-size: 18px; }
  .pk-dc-go { width: 38px; height: 38px; }

  .pk-features-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pk-feature { grid-column: span 1; padding: 14px; min-height: 150px; }
  .pk-feature.pk-hero-feat {
    grid-column: span 2;
    grid-template-columns: 1fr;
    text-align: left;
    padding: 18px;
    min-height: 0;
  }
  .pk-feature.pk-hero-feat .pk-ficon { grid-column: 1; grid-row: 1; width: 56px; height: 56px; margin-bottom: 10px; }
  .pk-feature.pk-hero-feat .pk-ficon svg { width: 32px; height: 32px; }
  .pk-feature.pk-hero-feat .pk-ftitle { font-size: 22px; }
  .pk-feature .pk-ficon { width: 40px; height: 40px; }
  .pk-feature .pk-ficon svg { width: 22px; height: 22px; }
  .pk-feature .pk-ftitle { font-size: 14px; }
  .pk-feature .pk-fdesc { font-size: 11px; }

  .pk-bottom-row { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
 * PK-UX — Navigation élève, tiroirs, mini-progression,
 * alignement des pages outils sur le langage du dashboard.
 * Pages outils : <body class="pk-tool">.
 * ════════════════════════════════════════════════════════════ */

/* ─── Topbar : logo cliquable + mini-progression ─── */
a.logo-wrap { text-decoration: none; color: inherit; min-height: 44px; }
.pk-mini-progress {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 4px;
  text-decoration: none;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text1);
}
.pk-mini-streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 10px;
  color: var(--orange-ink);
  background: linear-gradient(135deg, rgba(255, 154, 60, 0.18), rgba(255, 138, 76, 0.18));
  border: 1px solid rgba(255, 154, 60, 0.35);
}
.pk-mini-level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--v2);
}
.pk-mini-bar {
  width: 44px;
  height: 6px;
  border-radius: 3px;
  background: var(--pk-bg3);
  overflow: hidden;
}
.pk-mini-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--orange));
}

/* ─── Bottom nav : boutons sans style navigateur ─── */
.bn-item {
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
@media (max-width: 768px) {
  .bn-item { min-height: 44px; min-width: 44px; font-size: 12px; }
  body.pk-dashboard .pk-app { padding-bottom: calc(76px + env(safe-area-inset-bottom) + 24px); }
}

/* ─── Tiroirs (Outils, Admin) au-dessus de la bottom nav ─── */
.pk-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(60px + env(safe-area-inset-bottom));
  z-index: 295;
  padding: 6px 0 12px;
  background: var(--pk-bg1);
  border: 1px solid var(--pk-border);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  transform: translateY(110%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.22s ease, opacity 0.22s ease, visibility 0s linear 0.22s;
  max-height: 70vh;
  overflow-y: auto;
}
.pk-sheet.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.pk-sheet-handle {
  width: 36px;
  height: 4px;
  margin: 8px auto 12px;
  border-radius: 2px;
  background: var(--pk-border2);
}
.pk-sheet-title {
  padding: 0 20px 8px;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text2);
}
.pk-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 8px 20px;
  color: var(--text1);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}
.pk-sheet-item:active, .pk-sheet-item:hover { background: var(--vg); }
.pk-sheet-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--vg);
  color: var(--v-light);
  font-size: 18px;
}
.pk-sheet-text { display: flex; flex-direction: column; gap: 2px; }
.pk-sheet-text small { font-size: 0.78rem; font-weight: 500; color: var(--text2); }
.pk-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 290;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.pk-sheet-overlay.open { opacity: 1; visibility: visible; transition: opacity 0.2s ease; }
@media (min-width: 769px) {
  .pk-sheet, .pk-sheet-overlay { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pk-sheet, .pk-sheet.open, .pk-sheet-overlay, .pk-sheet-overlay.open { transition: none; }
}

/* ─── Pages outils : même fond, cartes et boutons que le dashboard ─── */
body.pk-tool {
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(155, 130, 240, 0.18), transparent 70%),
    radial-gradient(ellipse 80% 40% at 80% 80%, rgba(242, 185, 59, 0.04), transparent 70%),
    var(--bg0);
  background-attachment: fixed;
}
body.pk-tool .topbar {
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--pk-border);
}
body.pk-tool .pt-hero {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
}
body.pk-tool .card {
  background: var(--pk-bg1);
  border: 1px solid var(--pk-border);
  border-radius: 18px;
}
body.pk-tool .card:hover { border-color: var(--pk-border2); }

/* CTA principal doré (= .pk-cta-main du dashboard) */
body.pk-tool .gen-btn,
body.pk-dashboard .gen-btn {
  min-height: 52px;
  background: var(--v);
  color: var(--on-v);
  border-radius: 18px;
  font-family: var(--font-text);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 0 5px 0 var(--v-shadow);
  margin-bottom: 5px;
}
body.pk-tool .gen-btn:hover,
body.pk-dashboard .gen-btn:hover {
  background: var(--v2);
  transform: translateY(-1px);
  box-shadow: 0 6px 0 var(--v-shadow);
}
body.pk-tool .gen-btn:active,
body.pk-dashboard .gen-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--v-shadow);
}
body.pk-tool .gen-btn:disabled {
  opacity: 0.5;
  transform: none;
}

/* Secondaires en --v, zones tactiles ≥ 44 px */
body.pk-tool .quiz-listen-btn,
body.pk-tool .metro-tap-btn,
body.pk-tool .octave-btn,
body.pk-tool .notif-btn,
body.pk-tool .metro-step,
body.pk-tool .quiz-tab,
body.pk-tool .note-btn,
body.pk-tool .iv-choice-btn { min-height: 44px; }
body.pk-tool .quiz-listen-btn,
body.pk-tool .metro-tap-btn {
  border-radius: 14px;
  border-color: var(--v);
  background: var(--vg);
  color: var(--v-light);
}
body.pk-tool .metro-step {
  border-radius: 12px;
  border-color: var(--pk-border);
  background: var(--pk-bg2);
}
body.pk-tool .octave-btn { min-width: 44px; border-radius: 12px; }
body.pk-tool .notif-btn { border-radius: 10px; }
body.pk-tool .level-card { border-radius: 14px; }
body.pk-tool .quiz-tab { display: inline-flex; align-items: center; text-decoration: none; }

/* Accueil entraînement (quiz.html) : cartes du dashboard */
body.pk-tool .quiz-home-card {
  position: relative;
  overflow: hidden;
  background: var(--pk-bg1);
  border: 1px solid var(--pk-border);
  border-radius: 18px;
}
body.pk-tool .quiz-home-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cyan);
}
body.pk-tool .quiz-home-card:nth-child(2)::before { background: var(--v); }
body.pk-tool .quiz-home-card:nth-child(3)::before { background: var(--orange); }
body.pk-tool .quiz-home-card:hover { border-color: var(--pk-border2); background: var(--pk-bg2); }
body.pk-tool .quiz-home-title { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 1.15rem; }

@media (max-width: 768px) {
  body.pk-tool .topbar { gap: 8px; padding: 0 12px; }
  body.pk-tool .logo-name { display: none; }
}
@media (max-width: 720px) {
  .pk-feature.pk-wide-mobile { grid-column: span 2; min-height: 0; }
}

/* ─── Dictionnaire : renversements + bouton Jouer fixe sur mobile ─── */
.chords-inv-row {
  display: flex;
  gap: 6px;
  margin: 14px 0 10px;
  padding: 4px;
  border-radius: 14px;
  background: var(--pk-bg2);
  border: 1px solid var(--pk-border);
}
.chords-inv-btn {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text2);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.chords-inv-btn.active { background: var(--v); color: #fff; }
.chords-inv-play {
  width: 100%;
  min-height: 44px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid var(--v);
  background: var(--vg);
  color: var(--v-light);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.chords-inv-play:disabled { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 768px) {
  /* Revue C18 : bouton dans le flux, sous le clavier (le bouton fixe recouvrait le clavier) */
  body.pk-tool .chords-play-btn { width: 100%; margin-top: 12px; }
  .keyboard-wrapper { padding: 0 8px; }
}
/* Étiquette XP : « Niveau N » et « x / y » séparés (pk-stat centre ses enfants) */
.pk-stat.pk-xp { align-items: stretch; }
.pk-stat.pk-xp .pk-xp-label { gap: 8px; }
@media (max-width: 720px) {
  .pk-stat.pk-xp { min-width: 132px; }
}
.grand-keyboard { margin: 0 auto; }

/* ════════════════════════════════════════════════════════════
 * PK-6 — Entraînement (train-ui.js)
 * ════════════════════════════════════════════════════════════ */
.train-app[hidden], #free-mode[hidden] { display: none; }
.train-home {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.train-home-single { grid-template-columns: minmax(0, 560px); }
.train-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 18px 18px;
  background: var(--pk-bg1);
  border: 1px solid var(--pk-border);
  border-radius: 18px;
}
.train-card-top { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--v); }
.train-card-notes .train-card-top { background: var(--cyan); }
.train-card-intervals .train-card-top { background: var(--v); }
.train-card-chords .train-card-top { background: var(--orange); }
.train-card-degrees .train-card-top { background: linear-gradient(90deg, var(--v), var(--magenta)); }
.train-card-head { display: flex; align-items: center; gap: 10px; }
.train-card-title {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text1);
}
.train-badge {
  padding: 3px 8px;
  border-radius: 8px;
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gold-ink);
  background: rgba(242, 185, 59, 0.12);
  border: 1px solid rgba(242, 185, 59, 0.3);
}
.train-card-desc { color: var(--text2); font-size: 0.88rem; }
.train-card-level { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.78rem; font-weight: 700; color: var(--v2); }
.train-mastery {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--pk-bg3);
  overflow: hidden;
}
.train-mastery-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan)); }
.train-mastery-goal { position: absolute; top: 0; bottom: 0; left: 80%; width: 2px; background: var(--gold); }
.train-mastery-label { font-size: 0.75rem; color: var(--text2); margin-bottom: 6px; }
.train-card .gen-btn, .train-card .train-btn-secondary { margin-top: auto; }

.train-btn-secondary {
  width: 100%;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid var(--v);
  background: var(--vg);
  color: var(--v-light);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}
.train-btn-secondary:hover { background: var(--vb); }
.train-btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 16px;
  padding: 8px 16px;
  border: 0;
  background: none;
  color: var(--text2);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  list-style: none;
}
.train-btn-ghost::-webkit-details-marker { display: none; }
.train-free-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.train-free-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text1);
  font-weight: 600;
}

/* Question */
.train-q, .train-end { max-width: 720px; }
.train-q-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.train-q-count { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.8rem; font-weight: 700; color: var(--text2); }
.train-quit {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text2);
  font-size: 1rem;
  cursor: pointer;
}
.train-progress { height: 6px; margin: 10px 0 18px; border-radius: 3px; background: var(--pk-bg3); overflow: hidden; }
.train-progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); transition: width 0.25s ease; }
.train-prompt {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text1);
  margin-bottom: 12px;
}
.train-loading, .train-midi-hint { font-size: 0.82rem; color: var(--text2); margin-bottom: 10px; }
.train-replay {
  width: 100%;
  min-height: 64px;
  margin-bottom: 16px;
  border-radius: 16px;
  border: 1px solid var(--v);
  background: var(--vg);
  color: var(--v-light);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
.train-replay:hover { background: var(--vb); }
.train-answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.train-answers-degrees, .train-answers-notes { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.train-answer {
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text1);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.train-answers-degrees .train-answer { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 1.2rem; }
.train-answer:hover:not(:disabled) { border-color: var(--v); background: var(--vg); }
.train-answer:disabled { cursor: default; opacity: 0.55; }
.train-answer.is-correct { opacity: 1; border-color: var(--green); background: rgba(61, 214, 140, 0.14); color: var(--green); }
.train-answer.is-wrong { opacity: 1; border-color: var(--red); background: rgba(255, 138, 76, 0.14); color: var(--red); }
.train-feedback { margin-top: 16px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--pk-border); }
.train-feedback.is-ok { border-color: rgba(61, 214, 140, 0.4); background: rgba(61, 214, 140, 0.08); }
.train-feedback.is-ko { border-color: rgba(255, 138, 76, 0.4); background: rgba(255, 138, 76, 0.08); }
.train-feedback-title { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 1.05rem; margin-bottom: 4px; }
.train-feedback.is-ok .train-feedback-title { color: var(--green); }
.train-feedback.is-ko .train-feedback-title { color: var(--red); }
.train-feedback p { color: var(--text1); font-size: 0.9rem; line-height: 1.5; }
.train-feedback-actions { display: flex; gap: 10px; margin-top: 12px; }
.train-feedback-actions > * { flex: 1; }
.train-levelup { color: var(--gold-ink); font-weight: 700; margin-top: 6px; }

/* Fin de série */
.train-end { text-align: center; }
.train-end-score { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 3rem; color: var(--text1); }
.train-end-xp { font-family: 'DM Mono', 'Mono Fallback', monospace; font-weight: 700; color: var(--gold-ink); margin-bottom: 8px; }
.train-end-sub { margin: 18px 0 8px; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text2); }
.train-end-perfect { color: var(--green); font-weight: 600; }
.train-missed { list-style: none; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.train-missed li { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 12px; background: var(--pk-bg2); }
.train-missed li[hidden] { display: none; }
.train-missed small { color: var(--text2); }
.train-missed-play {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid var(--v);
  background: var(--vg);
  color: var(--v-light);
  cursor: pointer;
}
.train-end-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }

@media (max-width: 768px) {
  .train-home { grid-template-columns: minmax(0, 1fr); }
  .train-feedback-actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .train-progress-fill { transition: none; }
}

/* ════════════════════════════════════════════════════════════
 * PK-UX2 — En-tête unique, dashboard, zone du pouce, mini-clavier
 * ════════════════════════════════════════════════════════════ */

/* En-tête : même topbar (nav.js) sur le dashboard et les pages outils */
body.pk-dashboard .topbar {
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--pk-border);
}
body.pk-dashboard .pk-app { padding-top: calc(var(--topbar-h) + 16px); }
.pk-topbar-avatar { width: 34px; height: 34px; border-radius: 10px; cursor: default; }
.pk-topbar-avatar:hover { transform: none; }
.pk-topbar-avatar .pk-avatar-face { width: 20px; height: 20px; }
@media (max-width: 768px) {
  body.pk-dashboard .topbar { gap: 8px; padding: 0 12px; }
  body.pk-dashboard .logo-name { display: none; }
}

/* Dashboard : Succès seul sur sa rangée */
.pk-bottom-row.pk-bottom-single { grid-template-columns: 1fr; }
.pk-feature.pk-train-feat .pk-ftitle { margin-bottom: 4px; }

/* Question : réponses dans la zone du pouce sur mobile */
.train-q-tools { display: inline-flex; gap: 8px; }
.train-settings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--pk-bg2);
  border: 1px solid var(--pk-border);
}
.train-settings[hidden] { display: none; }
.train-settings-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 0.88rem;
  color: var(--text1);
  cursor: pointer;
}
.train-settings-opt input { width: 18px; height: 18px; accent-color: var(--v); flex-shrink: 0; }
.train-feedback { margin: 0 0 16px; }
.train-mini-kb { display: block; width: 100%; max-width: 220px; height: auto; margin: 8px auto 10px; }
.train-mini-kb .mk-white { fill: var(--key-white); stroke: #9a9aa6; stroke-width: 1; }
.train-mini-kb .mk-black { fill: var(--key-black); } /* revue C11 : sombre dans les deux thèmes */
.train-mini-kb .is-good { fill: var(--green); }
.train-mini-kb .is-bad { fill: var(--red); }
.train-missed-count { color: var(--orange-ink); font-family: 'DM Mono', 'Mono Fallback', monospace; }
#train-missed-all { margin-top: 10px; min-height: 44px; background: none; border: 0; }

@media (max-width: 768px) {
  body.train-in-session #section-quiz > .ph { display: none; }
  body.train-in-session .train-q {
    display: flex;
    flex-direction: column;
    /* topbar + padding haut de .main (14) + bottom nav (60) + marge (8) */
    min-height: calc(100dvh - var(--topbar-h) - 14px - 60px - env(safe-area-inset-bottom) - 8px);
    padding-bottom: 12px;
  }
  body.train-in-session .main { padding-top: 14px; padding-bottom: calc(60px + env(safe-area-inset-bottom) + 8px) !important; }
  .train-q-bottom { margin-top: auto; padding-top: 12px; }
  .train-replay { min-height: 56px; margin-bottom: 12px; }
}

/* ════════════════════════════════════════════════════════════
 * PK-3 — Défi du jour (progression réelle), succès, XP de la semaine
 * ════════════════════════════════════════════════════════════ */
.pk-dc-progress { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 11px; font-weight: 700; color: var(--text2); }
.pk-dc-bar { flex: 1; max-width: 180px; height: 5px; border-radius: 3px; background: var(--pk-bg3); overflow: hidden; }
.pk-dc-fill { height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
.pk-daily-challenge.pk-completed .pk-dc-title { color: var(--green); }
.pk-daily-challenge.pk-completed .pk-dc-fill { background: var(--green); }
.pk-dc-go { min-width: 44px; min-height: 44px; }
.pk-week-xp { margin-left: auto; font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 11px; color: var(--text2); }
.pk-week-xp strong { color: var(--gold-ink); }
.pk-ach.pk-unlocked .pk-ach-icon { filter: none; opacity: 1; }

/* ════════════════════════════════════════════════════════════
 * PK-7 — Progressions, session du jour, quêtes
 * ════════════════════════════════════════════════════════════ */
.train-q-track { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 4px; }
.train-answers-progressions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.train-answers-progressions .train-answer { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 1.15rem; }
.train-slots { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.train-slot {
  flex: 1;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px dashed var(--pk-border2);
  background: var(--pk-bg2);
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text3);
  text-align: center;
}
.train-slot.is-filled { border-style: solid; border-color: var(--v); color: var(--text1); }
.train-slot.is-correct { border-color: var(--green); color: var(--green); background: rgba(61, 214, 140, 0.12); }
.train-slot.is-wrong { border-color: var(--red); color: var(--red); background: rgba(255, 138, 76, 0.12); font-size: 0.8rem; }
.train-erase {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text2);
  font-size: 1.1rem;
  cursor: pointer;
}
.train-erase:disabled { opacity: 0.4; cursor: default; }

/* Fin de la session du jour : la flamme de série s'allume */
.train-flame { font-size: 64px; line-height: 1; margin-bottom: 6px; animation: pk-flame-pop 300ms ease-out both; filter: drop-shadow(0 0 14px rgba(255, 154, 60, 0.6)); }
.train-end-title { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 1.4rem; color: var(--text1); }
.train-flame-count { font-family: 'DM Mono', 'Mono Fallback', monospace; font-weight: 700; color: var(--orange-ink); min-height: 1.4em; margin-bottom: 10px; }
@keyframes pk-flame-pop {
  from { opacity: 0; transform: scale(0.4) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .train-flame { animation: none; }
}

/* Dashboard : quêtes du jour */
.pk-quests { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 18px; background: var(--pk-bg1); border: 1px solid var(--pk-border); }
.pk-quests-head { display: flex; align-items: center; justify-content: space-between; font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text2); }
.pk-quest { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; min-height: 44px; }
.pk-quest-check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--pk-border2); display: grid; place-items: center; font-size: 13px; color: var(--bg0); }
.pk-quest.is-done .pk-quest-check { background: var(--green); border-color: var(--green); }
.pk-quest-title { font-size: 13px; font-weight: 600; color: var(--text1); }
.pk-quest.is-done .pk-quest-title { color: var(--text2); text-decoration: line-through; }
.pk-quest-meta { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 11px; font-weight: 700; color: var(--text2); white-space: nowrap; }
.pk-quest.is-done .pk-quest-meta { color: var(--gold-ink); }

/* ════════════════════════════════════════════════════════════
 * PK-A1 — Onboarding, objectif du jour (anneau), page Progrès
 * ════════════════════════════════════════════════════════════ */
/* Onboarding : plein écran, une question, gros boutons */
body.train-onboarding-on #section-quiz > .ph { display: none; }
.train-onboarding {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100dvh - var(--topbar-h) - 120px);
  animation: pk-onb-in 200ms ease-out both;
}
.train-onboarding-head { display: flex; align-items: center; justify-content: space-between; }
.train-onboarding-skip { margin-top: 0; }
.train-onboarding-q {
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  color: var(--text1);
}
.train-onboarding-options { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.train-onboarding-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text1);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.train-onboarding-opt:hover, .train-onboarding-opt:focus-visible { border-color: var(--v); background: var(--vg); }
.train-onboarding-opt small { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.75rem; color: var(--gold-ink); }
@keyframes pk-onb-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Niveaux déjà débloqués : rejouables */
.train-level-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.train-level-chip {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text2);
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-weight: 700;
  cursor: pointer;
}
.train-level-chip.is-current { border-color: var(--gold); color: var(--gold-ink); background: rgba(242, 185, 59, 0.1); }

/* Anneau de l'objectif du jour (en-tête, dashboard) */
.pk-avatar-link { position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; text-decoration: none; }
.pk-avatar-link .pk-topbar-avatar { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border-width: 1px; }
.pk-avatar-link .pk-avatar-face { width: 18px; height: 18px; }
.pk-goal-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.pk-goal-ring-bg { fill: none; stroke: var(--pk-bg3); stroke-width: 3; }
.pk-goal-ring-fill { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray 0.3s ease; }
.pk-goal-ring-fill.is-reached { stroke: var(--green); }
.pk-goal {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 14px;
  text-decoration: none;
  color: var(--text1);
}
.pk-goal-ring-lg { position: relative; inset: auto; width: 40px; height: 40px; flex-shrink: 0; }
.pk-goal-text { display: flex; flex-direction: column; line-height: 1.25; }
.pk-goal-label { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text2); }
.pk-goal-text strong { font-size: 14px; color: var(--gold-ink); }
.pk-goal.is-reached .pk-goal-text strong { color: var(--green); }

/* Fin de série : objectif du jour */
.train-goal-done { color: var(--green); font-weight: 700; margin-bottom: 8px; }
.train-goal-count { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.8rem; color: var(--text2); margin-bottom: 6px; }

/* Page Progrès */
.progres-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.progres-card { display: flex; flex-direction: column; gap: 12px; }
.progres-title { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text2); }
.progres-big { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 2.2rem; color: var(--orange-ink); }
.progres-sub { color: var(--text2); font-size: 0.88rem; }
.progres-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.progres-kpis > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--pk-bg2); border: 1px solid var(--pk-border); }
.progres-kpis strong { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 1.2rem; color: var(--gold-ink); }
.progres-kpis span { font-size: 0.75rem; color: var(--text2); }
/* PK-UX1-c : Premiers pas, rang, précision colorée par famille, cartes venues de l'accueil */
.progres-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.progres-step { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 12px; background: var(--bg3); color: var(--text1); font-weight: 600; font-size: 0.95rem; }
.progres-step-check { width: 26px; height: 26px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid var(--border2); color: var(--bg0); }
.progres-step.is-done .progres-step-check { background: var(--green); border-color: var(--green); }
.progres-step.is-done { color: var(--text2); }
.progres-first-go { text-decoration: none; min-height: 52px; }
.progres-rank-row { display: flex; flex-direction: column; gap: 2px; }
.progres-rank-level { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: var(--text1); }
.progres-acc[data-family] .train-mastery-fill { background: var(--skill); }
.progres-grid > .td-card { min-width: 0; }
.progres-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.progres-cal-head { text-align: center; font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.7rem; color: var(--text3); }
.progres-cal-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--pk-bg2);
  border: 1px solid var(--pk-border);
  font-family: 'DM Mono', 'Mono Fallback', monospace;
  font-size: 0.72rem;
  color: var(--text3);
}
.progres-cal-day.is-active { background: rgba(255, 154, 60, 0.2); border-color: var(--orange); color: var(--text1); }
.progres-cal-day.is-frozen { background: rgba(155, 130, 240, 0.12); border-color: var(--cyan); color: var(--cyan); }
.progres-cal-day.is-today { box-shadow: 0 0 0 2px var(--gold); }
.progres-cal-day.is-future { opacity: 0.35; }
.progres-legend { display: flex; gap: 16px; font-size: 0.75rem; color: var(--text2); }
.progres-legend span { display: inline-flex; align-items: center; gap: 6px; }
.progres-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1px solid; }
.progres-dot.is-active { background: rgba(255, 154, 60, 0.2); border-color: var(--orange); }
.progres-dot.is-frozen { background: rgba(155, 130, 240, 0.12); border-color: var(--cyan); }
.progres-acc { display: flex; flex-direction: column; gap: 6px; }
.progres-acc-head { display: flex; justify-content: space-between; font-size: 0.88rem; color: var(--text1); }
.progres-acc-head small { color: var(--text2); font-family: 'DM Mono', 'Mono Fallback', monospace; }
.progres-acc-head strong { font-family: 'DM Mono', 'Mono Fallback', monospace; color: var(--gold-ink); }
.progres-weak { display: flex; flex-direction: column; gap: 8px; padding-left: 20px; color: var(--text1); }
.progres-weak li { font-size: 0.9rem; }
.progres-weak li span { display: block; }
.progres-weak small { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.72rem; color: var(--red); }
.progres-empty { color: var(--text2); font-size: 0.88rem; }
.progres-review { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.progres-setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 0.9rem; color: var(--text1); }
.progres-chips { display: flex; gap: 6px; }
.progres-chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text2);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.progres-chip.is-on { border-color: var(--v); background: var(--vg); color: var(--v-light); }
.progres-onboarding { display: flex; align-items: center; justify-content: center; text-decoration: none; }
@media (max-width: 768px) {
  .progres-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .train-onboarding { animation: none; }
  .pk-goal-ring-fill { transition: none; }
}

/* ════════════════════════════════════════════════════════════
 * PK-A2 — Étoiles par niveau, cartes de théorie
 * ════════════════════════════════════════════════════════════ */
.train-card-stars { display: flex; align-items: center; gap: 10px; }
.train-stars { display: inline-flex; gap: 2px; font-size: 1.1rem; line-height: 1; }
.train-star { color: var(--pk-bg3); }
.train-star.is-on { color: var(--gold-ink); text-shadow: 0 0 8px rgba(242, 185, 59, 0.45); }
.train-stars-hint { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.7rem; color: var(--text2); }
.train-end-stars { display: flex; justify-content: center; margin: 4px 0 2px; }
.train-end-stars .train-stars { font-size: 2.6rem; gap: 6px; }
.train-stars.is-animated .train-star.is-on { animation: pk-star-pop 260ms ease-out both; animation-delay: calc(var(--i) * 180ms); }
@keyframes pk-star-pop {
  from { opacity: 0; transform: scale(0.3); }
  to   { opacity: 1; transform: scale(1); }
}
.train-stars-new { color: var(--gold-ink); font-weight: 700; }
.train-stars-best { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.75rem; color: var(--text2); margin-bottom: 6px; }
.train-theory-btn {
  margin-left: auto;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text2);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.train-theory-btn:hover { border-color: var(--v); color: var(--v-light); }
.train-theory {
  position: relative;
  overflow: hidden;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: pk-onb-in 200ms ease-out both;
}
.train-theory-title { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; color: var(--text1); }
.train-theory-text { color: var(--text1); font-size: 1rem; line-height: 1.55; }
.train-theory-listen { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
  .train-stars.is-animated .train-star.is-on, .train-theory { animation: none; }
}

/* ════════════════════════════════════════════════════════════
 * PK-A3 — Défi chrono, carte de résultat partageable
 * ════════════════════════════════════════════════════════════ */
.train-challenge { margin-top: 14px; }
.train-challenge .train-card-top { background: linear-gradient(90deg, var(--gold), var(--orange)); }
.train-challenge-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.train-challenge-record { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.8rem; font-weight: 700; color: var(--gold-ink); }
.train-challenge-chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--pk-border);
  background: var(--pk-bg2);
  color: var(--text2);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.train-challenge-chip.is-current { border-color: var(--gold); color: var(--gold-ink); background: rgba(242, 185, 59, 0.1); }
.train-challenge-live { font-family: 'DM Mono', 'Mono Fallback', monospace; color: var(--gold-ink); }
.train-q-challenge .train-progress-fill { background: linear-gradient(90deg, var(--orange), var(--gold)); transition: width 0.2s linear; }
.train-challenge-sub { color: var(--text2); margin-bottom: 6px; }
.train-share { display: flex; align-items: center; justify-content: center; }
@media (prefers-reduced-motion: reduce) {
  .train-q-challenge .train-progress-fill { transition: none; }
}

/* ════════════════════════════════════════════════════════════
 * PK-8 — Compte optionnel : menu de l'avatar, page de connexion
 * ════════════════════════════════════════════════════════════ */
.pk-avatar-wrap { position: relative; flex-shrink: 0; }
button.pk-avatar-link { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; border-radius: 50%; }
button.pk-avatar-link:focus-visible { outline: 2px solid var(--v); outline-offset: 2px; }
.pk-avatar-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 300;
  width: 260px; max-width: calc(100vw - 24px);
  background: var(--bg2); border: 1px solid var(--borderv); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.pk-avatar-menu[hidden] { display: none; }
.pk-account-block { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border1); padding-top: 4px; margin-top: 2px; }
.pk-account-block:empty { display: none; }
.pk-account-item {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 44px; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text1); text-decoration: none; text-align: left;
  background: none; border: 0; font: inherit; font-size: 0.92rem; cursor: pointer; width: 100%;
}
.pk-account-item small { color: var(--text2); font-size: 0.78rem; }
.pk-account-item:hover, .pk-account-item:focus-visible { background: var(--vg); outline: none; }
.pk-account-save span { color: var(--gold-ink); font-weight: 600; }
.pk-account-state { display: flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--green); font-size: 0.92rem; font-weight: 600; }
.pk-account-state.is-error { color: var(--text2); font-weight: 500; }

.login-perks { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.login-perks li { display: flex; gap: 10px; align-items: flex-start; color: var(--text2); font-size: 0.9rem; line-height: 1.45; }
.login-perks li::before { content: '✓'; color: var(--green); font-weight: 700; }
.login-degraded { text-align: center; padding: var(--gap-lg); border: 1px solid var(--borderv); border-radius: var(--radius); background: var(--bg2); }
.login-degraded p { margin: 0 0 8px; color: var(--text2); line-height: 1.5; font-size: 0.9rem; }
.login-degraded p:first-child { color: var(--text1); font-weight: 600; font-size: 1rem; }
.login-back {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-sm); color: var(--v2); text-decoration: none; font-weight: 600; font-size: 0.92rem;
}
.login-back:hover, .login-back:focus-visible { background: var(--vg); outline: none; }
.login-footer a { color: var(--text2); }
.account-delete { margin-top: 12px; }
.account-delete-btn {
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-weight: 600;
  background: none; color: var(--red); border: 1px solid var(--red);
}
.account-delete-btn:disabled { opacity: 0.5; cursor: default; }
.account-delete-msg { color: var(--text2); font-size: 0.88rem; margin-top: 8px; }

/* ════════════════════════════════════════════════════════════
 * PK-B1 — Parcours Gammes, progressions avec 7e
 * ════════════════════════════════════════════════════════════ */
.train-card-scales .train-card-top { background: linear-gradient(90deg, var(--green), var(--cyan)); }
.train-card-progressions .train-card-top { background: linear-gradient(90deg, var(--gold), var(--orange)); }
.train-answers-scales .train-answer { font-size: 0.95rem; }

/* ════════════════════════════════════════════════════════════
 * PK-B2 — Accordeur + parcours Voix (aiguille de justesse)
 * ════════════════════════════════════════════════════════════ */
.train-card-voice .train-card-top { background: linear-gradient(90deg, var(--magenta), var(--v)); }
/* Cadran ±50 cents : arc, zone juste (verte), aiguille pivotant en bas au centre */
.pk-meter { position: relative; width: 220px; height: 112px; margin: 8px auto 4px; overflow: hidden; }
.pk-meter-lg { width: 280px; height: 146px; }
.pk-meter-arc { position: absolute; inset: 0 0 -100% 0; border-radius: 50%; border: 2px solid var(--pk-border); border-bottom-color: transparent; }
.pk-meter-zone { position: absolute; left: 50%; bottom: 0; width: 64px; height: 100%; transform: translateX(-50%); background: linear-gradient(180deg, rgba(61, 214, 140, 0.22), rgba(61, 214, 140, 0)); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.pk-meter-zone-tight { width: 36px; }
.pk-meter-needle { position: absolute; left: 50%; bottom: 0; width: 3px; height: 92%; border-radius: 3px; background: var(--text2); transform: translateX(-50%) rotate(0deg); transform-origin: 50% 100%; transition: transform 0.12s ease-out, background 0.15s ease; }
.pk-meter-tick { position: absolute; bottom: 2px; font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 0.72rem; color: var(--text2); }
.pk-meter-tick-l { left: 4px; } .pk-meter-tick-r { right: 4px; }
.pk-meter-tick-c { left: 50%; top: 4px; bottom: auto; transform: translateX(-50%); }
.is-in .pk-meter-needle { background: var(--green); }
.is-off .pk-meter-needle { background: var(--gold); }
/* Écran question Voix */
.train-sing { margin-top: 12px; text-align: center; }
.train-sing-note { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 1.6rem; color: var(--text1); min-height: 2rem; }
.train-sing.is-in .train-sing-note { color: var(--green); }
.train-sing-hold { height: 8px; max-width: 220px; margin: 6px auto 0; border-radius: 4px; background: var(--pk-bg2); overflow: hidden; }
.train-sing-hold-fill { height: 100%; background: var(--green); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.1s linear; }
.train-sing-msg { margin-top: 8px; color: var(--text2); font-size: 0.92rem; min-height: 1.4em; }
.train-sing.is-error .train-sing-msg { color: var(--red); }
.train-sing.is-error .pk-meter, .train-sing.is-error .train-sing-hold { opacity: 0.35; }
.train-answers-voice { grid-template-columns: 1fr; }
/* Page Accordeur */
.tuner-card { max-width: 480px; margin: 0 auto; text-align: center; padding: 24px 20px; }
.tuner-readout { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.tuner-note { font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif; font-weight: 800; font-size: 3.4rem; line-height: 1; color: var(--text1); }
.tuner-octave { font-family: 'DM Mono', 'Mono Fallback', monospace; color: var(--text2); font-size: 1.1rem; }
.tuner-card.is-in .tuner-note { color: var(--green); }
.tuner-details { font-family: 'DM Mono', 'Mono Fallback', monospace; color: var(--text2); font-size: 0.9rem; margin-top: 4px; }
.tuner-msg { color: var(--text1); margin: 14px 0 16px; min-height: 2.8em; line-height: 1.4; }
.tuner-card.is-error .tuner-msg { color: var(--red); }
.tuner-card:not(.is-on) .tuner-note, .tuner-card:not(.is-on) .tuner-octave, .tuner-card:not(.is-on) .tuner-details { opacity: 0.45; }
.tuner-btn { width: 100%; min-height: 52px; }
@media (prefers-reduced-motion: reduce) {
  .pk-meter-needle, .train-sing-hold-fill { transition: none; }
}

/* ════════════════════════════════════════════════════════════
 * PK-B3 — Rythme au tap, dictée mélodique
 * ════════════════════════════════════════════════════════════ */
.train-card-rhythm .train-card-top { background: linear-gradient(90deg, var(--orange), var(--gold)); }
.train-card-melody .train-card-top { background: linear-gradient(90deg, var(--cyan), var(--v)); }
.train-answers-melody { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
.train-answers-melody .train-answer { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 1.15rem; }
.train-rhythm { margin-top: 12px; text-align: center; }
.train-beats { display: flex; justify-content: center; gap: 14px; }
.train-beats span { width: 12px; height: 12px; border-radius: 50%; background: var(--pk-border); }
/* Gros bouton de tap : zone du pouce */
.train-tap {
  width: 100%;
  min-height: 132px;
  border-radius: 20px;
  border: 1px solid var(--v);
  background: var(--vg);
  color: var(--text1);
  font: inherit;
  font-family: 'Bricolage Grotesque', 'Bricolage Fallback', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.train-tap:disabled { opacity: 0.5; cursor: default; }
.train-tap.is-armed { border-color: var(--gold); background: rgba(242, 185, 59, 0.12); }
.train-tap.is-hit { animation: train-tap-hit 0.15s ease-out; }
@keyframes train-tap-hit { from { transform: scale(0.97); } to { transform: scale(1); } }
.train-calib .train-tap { margin: 12px 0; }
.train-rhythm-grid { display: block; width: 100%; max-width: 360px; margin: 8px auto 4px; }
.rg-line { stroke: var(--pk-border); stroke-width: 1; }
.rg-line.is-beat { stroke: var(--text3); stroke-width: 1.5; }
.rg-expected { fill: var(--v); }
.rg-expected.is-missing { fill: none; stroke: var(--red); stroke-width: 2; }
.rg-tap.is-good { fill: var(--green); }
.rg-tap.is-bad { fill: var(--red); }
.train-rhythm-avg { text-align: center; color: var(--text2); font-size: 0.85rem; }
@media (prefers-reduced-motion: reduce) {
  .train-tap.is-hit { animation: none; }
}
.train-beats span.is-on { background: var(--gold); }

/* ════════════════════════════════════════════════════════════
 * PK-B4 — Mode Morceaux
 * ════════════════════════════════════════════════════════════ */
.train-card-songs .train-card-top { background: linear-gradient(90deg, var(--gold), var(--magenta)); }
.train-card.is-locked { opacity: 0.7; }
.train-answers-songs { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.train-answers-songs .train-answer { font-family: 'DM Mono', 'Mono Fallback', monospace; font-size: 1rem; }
.train-slots.is-long { flex-wrap: wrap; }
.train-slots.is-long .train-slot { flex: 1 0 calc(25% - 8px); }
.train-song { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--pk-border); }
.train-feedback .train-song-title { font-weight: 700; color: var(--gold-ink); }
.train-feedback .train-song-same { color: var(--text2); font-size: 0.85rem; }

/* ════════════════════════════════════════════════════════════
 * PK-D1 — Navigation V4 (logo, sidebar, déconnexion)
 * ════════════════════════════════════════════════════════════ */
.logo-keys {
  position: relative;
  display: flex;
  width: 30px;
  height: 18px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--key-white) 0 5px, var(--logo-key-line) 5px 6px);
  /* PK-REC1 point 1 : touches blanches lisibles sur l'en-tête clair */
  box-shadow: inset 0 0 0 1px var(--logo-key-ring);
}
.logo-keys i {
  position: absolute;
  top: 0;
  width: 4px;
  height: 11px;
  border-radius: 0 0 2px 2px;
  background: var(--key-black);
}
.logo-keys i:nth-child(1) { left: 4px; }
.logo-keys i:nth-child(2) { left: 10px; }
.logo-keys i:nth-child(3) { left: 22px; }
.sidebar-section-gap { margin-top: 12px; }
.sidebar-sep { margin: 12px 8px; }
.nav-logout-item { margin-top: auto; padding: 16px 12px 8px; list-style: none; }
.nav-logout { color: var(--text2); font-size: 0.82rem; }
.nv .nv-icon { display: inline-flex; align-items: center; justify-content: center; color: var(--text2); }
.nv.act .nv-icon { color: var(--v2); }
.pk-mini-streak svg { color: var(--flame); }

/* ════════════════════════════════════════════════════════════
 * PK-D1 — Écran « Aujourd'hui » (index.html)
 * ════════════════════════════════════════════════════════════ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.td-app { max-width: 560px; gap: 14px; padding-top: 16px; }
.td-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.td-title { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1.15; color: var(--text1); }
.td-pills { display: flex; gap: 8px; flex-shrink: 0; }
.td-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 12px; border-radius: 999px; font-family: var(--font-mono); font-size: 15px; }
.td-pill-flame { background: var(--flame-bg); color: var(--flame-text); }
.td-pill-flame svg { color: var(--flame); }
.td-pill-xp { background: var(--gold-bg); color: var(--gold-light); }
.td-card { padding: 16px; border-radius: 22px; background: var(--bg2); border: 1px solid var(--border1); display: flex; flex-direction: column; gap: 10px; }
.td-card-title { font-family: var(--font-text); font-weight: 700; font-size: 15px; color: var(--text1); }
.td-week-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.td-muted { font-size: 13px; color: var(--text2); }
.td-keys { position: relative; height: 92px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.td-key {
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
  border-radius: 0 0 8px 8px; font-family: var(--font-mono); font-size: 11px;
  background: var(--key-white); color: var(--key-black);
}
.td-key.is-on { background: var(--flame); color: var(--flame-ink); box-shadow: inset 0 -4px 0 var(--flame-edge); }
.td-key.is-frozen { background: var(--frost); color: var(--frost-ink); box-shadow: inset 0 -4px 0 var(--frost-edge); }
.td-key.is-future, .td-key.is-off { background: var(--key-dim); color: var(--key-black); }
.td-key.is-today { outline: 3px solid var(--v); outline-offset: -3px; font-weight: 700; }
.td-key.is-today:not(.is-on):not(.is-frozen) { background: var(--key-white); }
.td-black { position: absolute; top: 0; left: calc((100% + 3px) / 7 * (var(--i) + 1) - 3.75%); width: 7.5%; height: 50px; border-radius: 0 0 5px 5px; background: var(--key-black); pointer-events: none; }
.td-week-note strong { color: var(--text1); }
.td-session { padding: 18px; border-radius: 24px; background: var(--v-surface); border: 1px solid var(--v-border); display: flex; flex-direction: column; gap: 14px; }
.td-session-top { display: flex; align-items: center; gap: 14px; }
.td-ring { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.td-ring-bg { fill: none; stroke: var(--v-track); stroke-width: 8; }
.td-ring-fill { fill: none; stroke: var(--v); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray 0.3s ease; }
.td-session.is-done .td-ring-fill { stroke: var(--green); }
.td-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; line-height: 1.05; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--text1); }
.td-session-text { display: flex; flex-direction: column; gap: 3px; }
.td-session-title { font-family: var(--font-display); font-weight: 800; font-size: 21px; color: var(--text1); }
.td-session-sub { font-size: 14px; color: var(--v-text-soft); }
.td-session .gen-btn { min-height: 58px; font-size: 17px; text-decoration: none; margin-bottom: 5px; }
.td-session .pk-cta-more { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.td-session [hidden] { display: none !important; }
.td-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 14px; border-radius: 16px; background: var(--bg2); border: 1px solid var(--border1); color: var(--text1); text-decoration: none; }
.td-row[hidden] { display: none; }
.td-row:hover { border-color: var(--v-border); }
.td-row-icon { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.td-row-icon-err { background: var(--err-bg); color: var(--red); }
.td-row-text { flex-grow: 1; display: flex; flex-direction: column; }
.td-row-text strong { font-size: 14px; font-weight: 600; }
.td-row-text small { font-size: 13px; color: var(--text2); }
.td-chevron { color: var(--text2); flex-shrink: 0; }
.td-quests { padding: 14px 16px; gap: 4px; }
.td-quests .pk-quest { text-decoration: none; }
.td-quests .pk-quest-title small { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text2); }
.td-quests .pk-quest-check { color: var(--on-v); }
.td-quests .pk-quest.is-done .pk-quest-title { text-decoration: none; }
.td-ach .pk-ach-list { display: flex; flex-direction: column; gap: 8px; }
@media (prefers-reduced-motion: reduce) {
  .td-ring-fill { transition: none; }
}
.td-main { padding: 0 16px; }
.td-main .td-app { padding-left: 0; padding-right: 0; }
.td-quests .pk-daily-challenge { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; padding: 0; background: none; border: 0; border-radius: 0; overflow: visible; color: inherit; }
.td-quests .pk-daily-challenge::before { content: none; }
@media (max-width: 768px) { .td-main { margin-left: 0; } }
body.pk-dashboard .layout { padding-top: 0; }
.progres-tools { display: flex; flex-direction: column; gap: 8px; }
.progres-tool-icon { background: var(--v-surface); color: var(--v2); }
.progres-flame { color: var(--flame); display: inline-flex; vertical-align: middle; }
.progres-flame svg { width: 1em; height: 1em; }

/* Revue Cowork PK-D1 : série unique sur Aujourd'hui, or seulement pour un gain réel */
body.pk-dashboard .topbar .pk-mini-streak { display: none; }
.td-pill-xp.is-zero { background: var(--bg2); color: var(--text2); border: 1px solid var(--border1); }

/* ════════════════════════════════════════════════════════════
 * PK-D2 — Onglet Parcours : grille 3 colonnes, niveaux, cartes larges
 * ════════════════════════════════════════════════════════════ */
.path-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.path-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 132px; padding: 14px 8px 12px; border-radius: 18px;
  background: var(--bg2); border: 1px solid var(--border1); color: var(--text1);
  font: inherit; text-align: center; cursor: pointer;
  transition: border-color var(--trans), transform var(--trans);
}
.path-tile:hover { border-color: var(--v-border); }
.path-tile:active { transform: scale(0.98); }
.path-tile:focus-visible, .path-wide:focus-visible, .path-level-row:focus-visible { outline: 3px solid var(--v); outline-offset: 2px; }
.path-tile-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--v-surface); color: var(--v2); flex-shrink: 0; }
.path-tile-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.path-tile-level { font-family: var(--font-mono); font-size: 12px; color: var(--v2); }
.path-tile-stars .train-star, .path-level-stars .train-star { font-size: 13px; color: var(--text3); }
.path-tile-stars .train-star.is-on, .path-level-stars .train-star.is-on { color: var(--gold-ink); }
.path-tile-bar { width: 80%; height: 4px; border-radius: 2px; background: var(--bg4); overflow: hidden; }
.path-tile-bar span { display: block; height: 100%; background: var(--v); border-radius: 2px; }
.path-wides { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.path-wide {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 14px 16px;
  border-radius: 18px; background: var(--bg2); border: 1px solid var(--border1); color: var(--text1);
  font: inherit; text-align: left; cursor: pointer;
}
.path-wide:hover { border-color: var(--v-border); }
.path-wide.is-locked { cursor: default; border-style: dashed; }
.path-wide.is-locked .path-wide-icon { background: var(--bg3); color: var(--text2); }
.path-wide-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--v-surface); color: var(--v2); flex-shrink: 0; }
.path-wide-text { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; }
.path-wide-text strong { font-size: 15px; }
.path-wide-text small { font-size: 13px; color: var(--text2); }
.path-wide-chevron { color: var(--text2); display: flex; }
.path-wides .train-challenge { margin: 0; }
.train-challenge-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.train-challenge-head .train-card-title { flex-grow: 1; }
.path-detail { display: flex; flex-direction: column; gap: 14px; }
.path-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 4px; border: 0; background: none; color: var(--v2); font: inherit; font-weight: 700; cursor: pointer; }
.path-detail-head { display: flex; align-items: center; gap: 14px; }
.path-detail-head .path-tile-icon { width: 56px; height: 56px; }
.path-detail-title { font-family: var(--font-display); font-weight: 800; font-size: 24px; color: var(--text1); }
.path-detail-desc { font-size: 14px; color: var(--text2); }
.path-theory { align-self: flex-start; min-height: 44px; padding: 0 18px; }
.path-levels { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; }
.path-level { border-radius: 16px; background: var(--bg2); border: 1px solid var(--border1); }
.path-level-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 14px; border: 0; background: none; color: var(--text1); font: inherit; text-align: left; }
button.path-level-row { cursor: pointer; border-radius: 16px; }
.path-level-text { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; }
.path-level-text strong { font-size: 14px; }
.path-level-text small { font-size: 13px; color: var(--text2); }
.path-level.is-current { background: var(--v-surface); border-color: var(--v-border); padding-bottom: 14px; }
.path-level.is-current .path-level-stars { display: block; padding: 0 14px 10px; }
.path-level.is-current .path-play { width: calc(100% - 28px); margin: 0 14px 5px; text-decoration: none; }
.path-level.is-current .path-play svg { width: 18px; height: 18px; }
.path-level-tag { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 8px; border-radius: 999px; background: var(--v); color: var(--on-v); }
.path-level.is-locked { border-style: dashed; }
.path-level.is-locked .path-level-text strong, .path-level.is-locked .path-level-text small { color: var(--text2); }
.path-level-lock { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: var(--text2); text-align: right; }
.path-level-lock small { font-size: 11px; max-width: 110px; }
@media (min-width: 769px) {
  .path-grid { grid-template-columns: repeat(3, minmax(0, 220px)); }
  .path-wides, .path-detail { max-width: 690px; }
}
.path-theory.train-btn-secondary { width: auto; }
.train-challenge-record.is-zero { color: var(--text2); }

/* ════════════════════════════════════════════════════════════
 * PK-D3 — Écran question : en-tête, combo, onde, réponses 2×2, feuille de retour
 * ════════════════════════════════════════════════════════════ */
.train-q-head { justify-content: flex-start; gap: 12px; }
.train-q-head .train-quit { width: 44px; height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--text2); }
.train-q-head .train-progress { flex: 1; height: 14px; margin: 0; border-radius: 7px; background: var(--bg4); }
.train-progress-fill { position: relative; height: 100%; border-radius: 7px; background: var(--green); transition: width 0.25s ease; }
.train-progress-fill::after { content: ''; position: absolute; left: 6px; right: 6px; top: 3px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); }
.train-q-challenge .train-progress-fill { background: var(--flame); }
.train-q-count { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 14px; color: var(--text2); white-space: nowrap; }
.train-q-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 6px; min-height: 32px; }
.train-q-meta .train-q-track { margin: 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--v2); }
.train-combo { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--green); background: var(--ok-bg); color: var(--ok-text); font-family: var(--font-mono); font-size: 13px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.train-combo[hidden] { display: none; }
.train-combo.is-pop { animation: combo-pop 0.25s ease; }
@keyframes combo-pop { 0% { transform: scale(0.8); opacity: 0.4; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.train-prompt { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1.15; color: var(--text1); }
/* PK-UX1-d : titre court + sous-titre gris, pastille de famille, correction contrastée, bouton de théorie en bas */
.train-prompt-title { margin: 0; font: inherit; color: inherit; }
.train-prompt-sub { margin: 4px 0 0; font-family: var(--font-body, inherit); font-weight: 500; font-size: 15px; line-height: 1.35; color: var(--text2); }
.train-q-track[data-family]::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--skill); vertical-align: 1px; }
.train-fb-contrast { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.train-fb-listen { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--border2); background: var(--bg2); color: var(--text1); font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; }
.train-fb-listen svg { flex-shrink: 0; }
.train-fb-listen.is-given { border-color: var(--orange); }
.train-fb-listen.is-given svg { color: var(--orange-ink); }
.train-fb-listen.is-good { border-color: var(--green); }
.train-fb-listen.is-good svg { color: var(--green); }
.train-fb-listen:focus-visible { outline: 3px solid var(--v); outline-offset: 2px; }
.train-fb-character { font-weight: 600; color: var(--text1); }
@media (max-width: 768px) {
  .train-theory { min-height: calc(100dvh - var(--topbar-h) - 76px - 48px); }
  .train-theory #train-theory-go { margin-top: auto; }
}
.train-wave { display: flex; align-items: center; justify-content: center; gap: 5px; height: 96px; margin: 18px 0 8px; }
.train-wave span { width: 6px; height: 22px; border-radius: 3px; background: var(--green); opacity: 0.85; transform-origin: center; }
.train-wave span:nth-child(3n) { height: 40px; }
.train-wave span:nth-child(4n+1) { height: 58px; }
.train-wave span:nth-child(5n+2) { height: 74px; }
.train-wave.is-playing span { animation: wave-bar 0.7s ease-in-out infinite alternate; }
.train-wave.is-playing span:nth-child(2n) { animation-delay: 0.15s; }
.train-wave.is-playing span:nth-child(3n) { animation-delay: 0.3s; }
@keyframes wave-bar { from { transform: scaleY(0.4); } to { transform: scaleY(1.1); } }
.train-q .train-replay { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 auto 14px; min-height: 48px; }
.train-answers.is-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.train-answers.is-grid2 .train-answer { min-height: 64px; border-radius: 16px; font-size: 16px; }
.train-answer.is-correct { border-color: var(--green); background: var(--ok-bg); color: var(--ok-text); }
.train-answer.is-wrong { border-color: var(--red); background: var(--err-bg); color: var(--text1); }
/* Feuille de retour : glisse depuis le bas */
.train-feedback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 400; margin: 0;
  max-height: 70vh; overflow-y: auto;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0; border: 0; border-top: 1.5px solid var(--border1);
  animation: sheet-up 0.2s ease-out;
}
.train-feedback[hidden] { display: none; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.train-feedback.is-ok { background: var(--ok-bg); border-color: var(--green); }
.train-feedback.is-ko { background: var(--err-bg); border-color: var(--red); }
.train-fb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.train-fb-icon { width: 36px; height: 36px; border-radius: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.train-feedback.is-ok .train-fb-icon { background: var(--green); color: var(--ok-bg); }
.train-feedback.is-ko .train-fb-icon { background: var(--red); color: var(--err-bg); }
.train-fb-head .train-feedback-title { flex-grow: 1; margin: 0; font-size: 22px; }
.train-feedback.is-ok .train-feedback-title { color: var(--ok-text); }
.train-feedback.is-ko .train-feedback-title { color: var(--red); }
.train-fb-xp { font-family: var(--font-mono); font-weight: 700; color: var(--gold-ink); }
.train-fb-answer { font-weight: 700; font-size: 1rem !important; }
.train-continue {
  min-height: 56px; border: 0; border-radius: 18px; font: inherit; font-weight: 800; font-size: 16px;
  letter-spacing: 0.02em; text-transform: uppercase; cursor: pointer; color: var(--on-v);
}
.train-feedback.is-ok .train-continue { background: var(--green); box-shadow: 0 5px 0 var(--ok-edge); }
.train-feedback.is-ko .train-continue { background: var(--red); box-shadow: 0 5px 0 var(--err-edge); }
.train-feedback-actions { margin-bottom: 5px; }
.train-feedback .train-song-title { color: var(--text1); }
@media (min-width: 769px) {
  .train-feedback { left: calc(var(--sidebar-w) + 32px); right: auto; width: min(640px, calc(100vw - var(--sidebar-w) - 64px)); }
}
body.train-in-session .train-q { padding-bottom: 24px; }
body.path-detail-on #section-quiz > .ph { display: none; }
.train-challenge .train-challenge-record.is-zero { color: var(--text2); }
@media (prefers-reduced-motion: reduce) {
  .train-feedback { animation: sheet-fade 0.2s ease-out; }
  .train-combo.is-pop, .train-wave.is-playing span { animation: none; }
  .train-progress-fill { transition: none; }
}
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }
/* Pendant une série : pas de barre du bas (mode concentration, maquette Question4) ; la feuille de retour est au-dessus de tout */
body.train-in-session .bottom-nav { display: none; }
@media (max-width: 768px) { body.train-in-session .main { padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important; } body.train-in-session .train-q { min-height: calc(100dvh - var(--topbar-h) - 14px - 24px - env(safe-area-inset-bottom)); } }
.train-feedback .train-mini-kb { max-height: 110px; }

/* ════════════════════════════════════════════════════════════
 * Revue PK-D3 (faite en tête de PK-D4)
 * ════════════════════════════════════════════════════════════ */
/* Pendant une série : seule la tête de série (fermer + barre + compteur) reste */
body.train-in-session .topbar { display: none; }
body.train-in-session .layout { padding-top: env(safe-area-inset-top, 0px); } /* PK-FIX1 I10 : sans barre du haut, sous l'encoche */
body.train-in-session .sidebar { top: 0; }
.train-fb-theory { color: var(--ok-text) !important; }
.train-fb-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; font-size: 0.85rem !important; color: var(--text2) !important; }
.train-fb-legend .is-given { color: var(--red); font-weight: 700; }
.train-fb-legend .is-good { color: var(--green); font-weight: 700; }

/* ════════════════════════════════════════════════════════════
 * PK-D4 — Fin de série (XP, précision, série, record) et coffre du jour
 * ════════════════════════════════════════════════════════════ */
.train-end .train-flame svg { width: 56px; height: 56px; color: var(--flame); }
.train-end-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 10px; }
.train-end-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 16px; background: var(--bg2); border: 1px solid var(--border1); text-align: center; }
.train-end-stat strong { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 800; font-size: 24px; color: var(--text1); line-height: 1.1; }
.train-end-stat > span { font-size: 12px; color: var(--text2); }
.train-end-stat.is-xp strong { color: var(--gold-ink); }
.train-end-stat.is-streak strong { color: var(--flame-text); }
.train-end-flame { display: inline-flex; width: 20px; height: 20px; color: var(--flame); }
.train-end-flame svg { width: 100%; height: 100%; }
.train-end-record { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 12px; padding: 12px 14px; border-radius: 16px; background: var(--flame-bg); border: 1px solid var(--flame); }
.train-end-record[hidden] { display: none; }
.train-end-record strong { display: block; color: var(--flame-text); font-family: var(--font-display); font-weight: 800; }
.train-end-record small { color: var(--text2); font-size: 12px; }
.train-end-secondary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.train-end-secondary > * { min-height: 48px; }
.train-end-actions [hidden] { display: none !important; }
/* Coffre du jour (maquette Recompense4) */
#train-chest[hidden] { display: none; }
.train-chest { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 6px 0 14px; padding: 18px 16px; border-radius: 22px; background: var(--bg2); border: 1px solid var(--border1); }
.train-chest-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-ink); }
.train-chest-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 180px; height: 150px; border-radius: 50%; background: var(--gold-bg); }
.train-chest-svg { width: 120px; height: 96px; overflow: visible; }
.train-chest-base, .train-chest-top { fill: var(--gold); }
.train-chest-band { fill: var(--gold-deep); }
.train-chest-lock { fill: var(--gold-light); }
.train-chest-lid { transform-origin: 14px 46px; transition: transform 0.3s ease; }
.train-chest.is-shaking .train-chest-svg { animation: chest-shake 0.4s ease-in-out; }
@keyframes chest-shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-6deg); } 40% { transform: rotate(6deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(4deg); } }
.train-chest.is-open .train-chest-lid { transform: rotate(-28deg) translateY(-6px); }
.train-chest-reward { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; text-align: center; opacity: 0; pointer-events: none; white-space: nowrap; }
.train-chest.is-open .train-chest-reward { animation: chest-rise 0.45s ease-out forwards; }
.train-chest.is-open-still .train-chest-reward { animation: sheet-fade 0.2s ease-out forwards; }
@keyframes chest-rise { from { opacity: 0; transform: translate(-50%, 40px); } to { opacity: 1; transform: translate(-50%, 0); } }
.train-chest-reward strong { font-family: var(--font-display); font-weight: 800; font-size: 28px; color: var(--gold-ink); text-shadow: 0 2px 0 var(--bg0); }
.train-chest-reward strong.is-freeze { color: var(--frost); }
.train-chest-reward small { font-size: 12px; color: var(--text1); background: var(--bg2); padding: 2px 8px; border-radius: 999px; }
.train-chest .gen-btn { width: 100%; }
@media (prefers-reduced-motion: reduce) {
  .train-chest-lid { transition: none; }
  .train-chest.is-shaking .train-chest-svg { animation: none; }
  .train-chest.is-open .train-chest-reward { animation: sheet-fade 0.2s ease-out forwards; transform: translate(-50%, 0); }
}
/* Récompense sous le coffre (lisible, ne chevauche pas le couvercle) */
.train-chest-stage { height: auto; min-height: 150px; padding: 18px 0 14px; gap: 8px; border-radius: 28px; width: 100%; max-width: 260px; }
.train-chest-reward { position: static; transform: none; }
.train-chest-reward[aria-live]:empty { display: none; }
@keyframes chest-rise-flow { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.train-chest.is-open .train-chest-reward { animation: chest-rise-flow 0.45s ease-out forwards; }
/* PK-FIX1 I4 : coffre expiré (ouvert après minuit) : texte neutre sur plusieurs lignes, pas d'or */
.train-chest.is-expired .train-chest-reward { white-space: normal; max-width: 100%; }
.train-chest-reward strong.is-expired { color: var(--text1); font-size: 22px; }
.train-chest.is-expired .train-chest-reward small { border-radius: 12px; }
.train-chest.is-expired .train-chest-rays { display: none; }
@media (prefers-reduced-motion: reduce) { .train-chest.is-open .train-chest-reward { animation: sheet-fade 0.2s ease-out forwards; transform: none; } }
@media (max-width: 768px) { body.train-in-session .train-q { min-height: calc(100dvh - 14px - 24px - env(safe-area-inset-bottom)); } }

/* PK-D5 : récompense du coffre pleinement lisible à la fin de l'animation (texte or clair sur #2B2310) */
.train-chest.is-open .train-chest-reward, .train-chest.is-open-still .train-chest-reward { opacity: 1; }
.train-chest-reward strong, .train-chest-reward strong.is-freeze { color: var(--gold-light); text-shadow: none; }
.train-chest-reward small { color: var(--gold-soft); background: none; padding: 0; font-size: 13px; }
.train-end-actions { margin-top: 16px; }
.train-end-actions + .train-end-sub { margin-top: 24px; }
.train-missed-play svg { display: block; }

/* ════════════════════════════════════════════════════════════
 * PK-L1 — Pages légales (confidentialité, mentions légales, CGU)
 * ════════════════════════════════════════════════════════════ */
.privacy { max-width: 720px; }
.privacy .card { margin-bottom: 16px; }
.privacy h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--text1); margin-bottom: 8px; }
.privacy p, .privacy li { color: var(--text2); font-size: 0.92rem; line-height: 1.6; }
.privacy p + p { margin-top: 8px; }
.privacy ul { padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; }
.privacy strong { color: var(--text1); }
.privacy a { color: var(--v2); text-decoration: underline; text-underline-offset: 2px; }
.privacy-erase { margin-top: 12px; }
.privacy-done { color: var(--green); font-weight: 600; margin-top: 10px; }
.legal-toggle { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; cursor: pointer; color: var(--text1); font-size: 0.92rem; }
.legal-toggle input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--v); flex-shrink: 0; }
.legal-toggle small { display: block; margin-top: 2px; color: var(--text2); font-size: 0.82rem; }
.legal-links { margin: 8px 0 24px; text-align: center; font-size: 0.85rem; color: var(--text2); }
.legal-links a { color: var(--text2); text-decoration: underline; display: inline-block; padding: 12px 4px; }
.sidebar-legal { margin-top: auto; padding: 16px 12px 4px; font-size: 0.75rem; line-height: 1.8; color: var(--text2); }
.sidebar-legal a { color: var(--text2); }
.sidebar-legal + .nav-logout-item { margin-top: 0; }

/* ════════════════════════════════════════════════════════════
 * PK-M1 — Motion : la boucle (#1 à #5), valeurs de _notes/design/motion/pk-motion-demo.html
 * ════════════════════════════════════════════════════════════ */
/* #1 Boutons 3D : enfoncés de 5 px, ombre à 0 */
body.pk-tool .gen-btn, body.pk-dashboard .gen-btn, .train-continue, .train-answer { transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out); }
body.pk-tool .gen-btn:active, body.pk-dashboard .gen-btn:active, .train-continue:active { transform: translateY(5px); box-shadow: 0 0 0 transparent; }
.train-answer { box-shadow: 0 5px 0 var(--border1); margin-bottom: 5px; }
.train-answer:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 0 0 transparent; }
.kb-white, .kb-black { transition: transform var(--t-fast) var(--ease-out); }
.kb-white:active, .kb-black:active { transform: translateY(3px); }
/* #2 Coche dessinée dans la bonne réponse */
.train-answer { position: relative; }
.train-answer-check { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.train-answer-check path { stroke-dasharray: 1; stroke-dashoffset: 1; }
/* Feuille de retour : monte avec un léger rebond (260 ms) */
.train-feedback { animation: sheet-up 260ms cubic-bezier(.34,1.3,.64,1); }
/* #4 Barre : remplissage spring + reflet qui traverse */
.train-q-head { position: relative; }
.train-q-head .train-progress { position: relative; overflow: hidden; }
.train-q-head .train-progress-fill { transition: width var(--t-slow) var(--ease-spring); }
.train-progress-shine { position: absolute; top: 0; bottom: 0; left: 0; width: 40px; border-radius: 7px; pointer-events: none; opacity: 0.9;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent); transform: translateX(-40px); }
/* Étincelles (PKMotion.burst) */
.pk-spark { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; border-radius: 3px; pointer-events: none; z-index: 2; }
/* #5 Combo : chiffre qui roule, anneau */
.train-combo { position: relative; }
.train-combo-n { display: inline-flex; flex-direction: column; height: 1.2em; line-height: 1.2em; overflow: hidden; vertical-align: bottom; }
.train-combo-n span { display: block; height: 1.2em; }
.train-combo-ring { position: absolute; inset: -4px; border-radius: 999px; border: 2px solid var(--green); opacity: 0; pointer-events: none; }
.pk-confetti { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .train-feedback { animation: sheet-fade 0.14s ease-out; }
  .train-q-head .train-progress-fill { transition: none; }
  body.pk-tool .gen-btn, .train-continue, .train-answer, .kb-white, .kb-black { transition: none; }
}

/* ════════════════════════════════════════════════════════════
 * PK-M2 — Motion : les récompenses (#6 à #10)
 * ════════════════════════════════════════════════════════════ */
/* #6 Étoiles animées en WAAPI (train-ui.js) : pas d'animation CSS en double */
.train-stars.is-motion .train-star.is-on { animation: none; }
/* #9 Coffre : couvercle spring, rayons coniques qui tournent (14 s/tour), gel = bleu glacier */
.train-chest-lid { transition: transform 320ms var(--ease-spring); }
.train-chest.is-open .train-chest-lid { transform: rotate(-38deg) translate(-4px, -10px); }
.train-chest-stage { position: relative; overflow: hidden; }
.train-chest-rays { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(rgba(242, 185, 59, 0.28) 0 10deg, transparent 10deg 30deg); transition: opacity 300ms ease-out; }
.train-chest-svg, .train-chest-reward { position: relative; z-index: 1; }
.train-chest.is-open .train-chest-rays, .train-chest.is-open-still .train-chest-rays { opacity: 1; }
.train-chest.is-freeze .train-chest-rays { background: repeating-conic-gradient(rgba(207, 227, 236, 0.3) 0 10deg, transparent 10deg 30deg); }
.train-chest.is-freeze .train-chest-stage { box-shadow: inset 0 0 0 2px var(--frost); }
/* #7 Touche du jour : remplissage orange et onde */
.td-key { position: relative; overflow: hidden; }
.td-key-fill { position: absolute; inset: 0; background: var(--flame); transform-origin: bottom; transform: scaleY(0); }
.td-key-wave { position: absolute; inset: -6px; border-radius: 0 0 12px 12px; background: radial-gradient(circle, rgba(255, 178, 91, 0.7), transparent 70%); opacity: 0; pointer-events: none; }
[data-pk-bind="streak"] { display: inline-flex; flex-direction: column; height: 1.2em; line-height: 1.2em; overflow: hidden; vertical-align: bottom; }
[data-pk-bind="streak"] span { display: block; height: 1.2em; }
/* #8 Palier de série : écran plein */
.pk-milestone { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--scrim-bg); }
.pk-ms-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.pk-ms-tag { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-ink); }
.pk-ms-medal { position: relative; width: 120px; height: 128px; }
.pk-ms-medal img { display: block; width: 100%; height: 100%; }
.pk-ms-medal strong { position: absolute; left: 0; right: 0; top: 58px; font-family: var(--font-display); font-weight: 800; font-size: 34px; color: var(--medal-ink); }
.pk-ms-title { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--text1); }
.pk-ms-text { color: var(--text2); font-size: 15px; }
.pk-ms-keys { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; width: 100%; height: 70px; margin: 6px 0 10px; }
.pk-ms-key { border-radius: 0 0 6px 6px; background: var(--key-white); opacity: 0.55; transition: background var(--t-fast), opacity var(--t-fast); }
.pk-ms-key.is-on { background: var(--gold); opacity: 1; }
.pk-ms-go { width: 100%; }
/* #10 Niveau débloqué : cadenas qui s'envole, onde */
.path-level.is-current { position: relative; }
.path-unlock-lock { position: absolute; right: 14px; top: 16px; z-index: 2; color: var(--text2); }
.path-unlock-lock svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.path-unlock-shackle { transform-box: fill-box; transform-origin: right bottom; }
.path-unlock-wave { position: absolute; inset: 0; border-radius: 16px; border: 2px solid var(--v); opacity: 0; pointer-events: none; }
.path-play { transform-origin: top; }
@media (prefers-reduced-motion: reduce) {
  .train-chest-lid, .train-chest-rays, .pk-ms-key { transition: none; }
}
.train-chest-svg, .train-chest-reward { left: auto; transform: none; }
.pk-milestone { background: var(--bg0); }

/* ════════════════════════════════════════════════════════════
 * PK-M3 — Navigation : View Transitions entre pages (#11), squelettes de chargement (#12)
 * ════════════════════════════════════════════════════════════ */
@view-transition { navigation: auto; }
/* Onglets : glissement horizontal 220 ms dans le sens de l'onglet (types posés par nav.js au pageswap) */
@keyframes pk-vt-out-left { to { transform: translateX(-30%); opacity: 0; } }
@keyframes pk-vt-in-right { from { transform: translateX(30%); opacity: 0; } }
@keyframes pk-vt-out-right { to { transform: translateX(30%); opacity: 0; } }
@keyframes pk-vt-in-left { from { transform: translateX(-30%); opacity: 0; } }
html:active-view-transition-type(pk-tab-forward)::view-transition-old(root) { animation: pk-vt-out-left 220ms cubic-bezier(.2,.8,.2,1) both; }
html:active-view-transition-type(pk-tab-forward)::view-transition-new(root) { animation: pk-vt-in-right 220ms cubic-bezier(.2,.8,.2,1) both; }
html:active-view-transition-type(pk-tab-back)::view-transition-old(root) { animation: pk-vt-out-right 220ms cubic-bezier(.2,.8,.2,1) both; }
html:active-view-transition-type(pk-tab-back)::view-transition-new(root) { animation: pk-vt-in-left 220ms cubic-bezier(.2,.8,.2,1) both; }
/* Barres de navigation fixes : hors du glissement */
.topbar { view-transition-name: pk-topbar; }
.bottom-nav { view-transition-name: pk-bottom-nav; }
/* Carte « Séance du jour » → écran question : la carte s'agrandit */
.td-session { view-transition-name: pk-session; }
body.train-in-session .train-q { view-transition-name: pk-session; }
::view-transition-group(pk-session) { animation-duration: 340ms; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
/* Squelettes qui scintillent (1,1 s) : transform seulement */
.pk-skeleton { position: relative; display: block; overflow: hidden; border-radius: 8px; background: var(--bg3); }
.pk-skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent); animation: pk-shimmer 1.1s linear infinite; }
@keyframes pk-shimmer { to { transform: translateX(100%); } }
.pk-skeleton-line { height: 12px; width: 60%; margin: 6px 0; }
.pk-skeleton-btn { height: 18px; width: 70%; margin: 0 auto; background: var(--v-shadow); }
.pk-fade-in { animation: pk-fade-in 220ms ease-out both; }
@keyframes pk-fade-in { from { opacity: 0; } }
@keyframes pk-fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*) { animation-duration: 120ms !important; }
  ::view-transition-old(*) { animation: pk-fade-out 120ms ease-out both !important; }
  ::view-transition-new(*) { animation: pk-fade-in 120ms ease-out both !important; }
  .pk-skeleton::after { animation: none; }
}

/* Audit 4.12 : en reduced-motion, aucune animation CSS en boucle (halo, étoiles, pulsations, rotation, spinners) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-iteration-count: 1 !important; }
}

/* Audit 4.8 : onboarding prévu dès le head (pk-vt.js) → barre du haut masquée avant le 1er rendu, pas de saut */
html.pk-onb-pending .topbar { display: none; }
html.pk-onb-pending .layout { padding-top: env(safe-area-inset-top, 0px); }

/* ─── Signaler un problème / une idée (PK-F1, pk-feedback.js) ─── */
.pk-feedback-row { margin: 16px 0 0; text-align: center; }
.pk-feedback-link {
  min-height: 44px; padding: 10px 14px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 0.88rem; color: var(--text2); text-decoration: underline; text-underline-offset: 3px;
  border-radius: var(--radius-sm);
}
.pk-feedback-link:hover, .pk-feedback-link:focus-visible { color: var(--text1); background: var(--vg); outline: none; }
html.pk-fb-open { overflow: hidden; }
.pk-fb {
  width: 100%; max-width: 480px; max-height: 92vh; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 1px solid var(--borderv); border-bottom: 0; border-radius: 18px 18px 0 0;
  background: var(--bg2); color: var(--text1); overflow-y: auto;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}
.pk-fb[open] { animation: sheet-up 0.24s ease-out; }
.pk-fb::backdrop { background: rgba(0, 0, 0, 0.6); }
@media (min-width: 769px) {
  .pk-fb { margin: auto; border-bottom: 1px solid var(--borderv); border-radius: var(--radius); }
  .pk-fb[open] { animation: pk-fade-in 0.2s ease-out; }
  .pk-fb-handle { display: none; }
}
@media (prefers-reduced-motion: reduce) { .pk-fb[open] { animation: pk-fade-in 0.15s ease-out; } }
.pk-fb-form { display: flex; flex-direction: column; padding: 4px 20px calc(20px + env(safe-area-inset-bottom)); }
.pk-fb-handle { width: 36px; height: 4px; margin: 8px auto 4px; border-radius: 2px; background: var(--border2); }
.pk-fb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.pk-fb-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; line-height: 1.25; }
.pk-fb-close {
  flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: var(--bg3); color: var(--text2); cursor: pointer;
}
.pk-fb-close:hover, .pk-fb-close:focus-visible { color: var(--text1); outline: 2px solid var(--v); outline-offset: 2px; }
.pk-fb-body { display: flex; flex-direction: column; }
.pk-fb-body[hidden], .pk-fb-actions[hidden], .pk-fb-done[hidden] { display: none; }
.pk-fb-label { display: block; margin: 12px 0 6px; padding: 0; font-size: 0.85rem; font-weight: 700; color: var(--text1); }
.pk-fb-label small { font-weight: 500; color: var(--text2); }
.pk-fb-types { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; }
.pk-fb-types legend { margin-top: 0; }
.pk-fb-type {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--border1); border-radius: var(--radius-sm); background: var(--bg1);
}
.pk-fb-type input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--v); }
.pk-fb-type span { display: flex; flex-direction: column; gap: 1px; }
.pk-fb-type strong { font-size: 0.95rem; }
.pk-fb-type small { font-size: 0.78rem; color: var(--text2); }
.pk-fb-type:has(input:checked) { border-color: var(--v); background: var(--vg); }
.pk-fb-type:has(input:focus-visible) { outline: 2px solid var(--v); outline-offset: 2px; }
.pk-fb-input {
  width: 100%; box-sizing: border-box; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--text1); background: var(--bg0); border: 1px solid var(--border2); border-radius: var(--radius-sm);
}
.pk-fb-input::placeholder { color: var(--text3); }
.pk-fb-input:focus { outline: 2px solid var(--v); outline-offset: 1px; border-color: var(--v); }
.pk-fb-msg { min-height: 120px; resize: vertical; line-height: 1.45; }
.pk-fb-count { margin-top: 4px; text-align: right; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text2); }
.pk-fb-count.is-near { color: var(--flame-text); }
.pk-fb-note { margin: 14px 0 0; font-size: 0.8rem; line-height: 1.45; color: var(--text2); }
.pk-fb-note a { color: var(--v2); display: inline-block; padding: 4px 0; }
.pk-fb-status { min-height: 1.2em; margin: 8px 0 0; font-size: 0.88rem; color: var(--text2); }
.pk-fb-status.is-error { color: var(--red); }
.pk-fb-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.pk-fb-actions .gen-btn, .pk-fb-done .gen-btn { min-height: 48px; font-size: 16px; }
.pk-fb-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 12px 0 4px; color: var(--green); }
.pk-fb-done-title { margin: 4px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--text1); outline: none; }
.pk-fb-done-sub { margin: 0 0 8px; font-size: 0.9rem; color: var(--text2); }
.pk-fb-done .gen-btn { width: 100%; }
.pk-fb-done-sub[hidden] { display: none; }
.pk-fb-ref { font-family: var(--font-mono); color: var(--text1); }
/* PK-FB1 : carte « Ton signalement FB-0142 est corrigé, merci ! » (une fois, en tête de page) */
.card.pk-fb-fixed { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 8px 8px 8px 16px; border-color: var(--green); }
.pk-fb-fixed-icon { display: flex; color: var(--green); flex-shrink: 0; }
.pk-fb-fixed-text { flex: 1; margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--text1); }
.pk-fb-fixed-close { flex-shrink: 0; }

/* ═══ PK-FIX1 lot C : mobile et accessibilité ═══ */
/* I12 : métronome — selects lisibles, 16 px (pas de zoom iOS), 44 px, flèche SVG, focus visible */
.metro-select-wrap { padding: 0 12px; min-height: 44px; }
.metro-select-wrap:focus-within { outline: 2px solid var(--v); outline-offset: 2px; }
.metro-select {
  font-size: 16px; min-height: 44px; -webkit-appearance: none; appearance: none; color: var(--text1);
  padding-right: 26px; background: transparent no-repeat right 2px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a82a0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.metro-select:focus-visible { outline: none; }
.metro-select option { background: var(--bg1); color: var(--text1); }
.metro-select-icon { display: inline-flex; }
/* C7 : boutons du métronome dans la police de l'app */
.metro-step, .metro-tap-btn, .metro-start-btn { font-family: inherit; }
.metro-step { min-height: 44px; min-width: 44px; }
.metro-start-btn, .metro-tap-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
/* I13 : dictionnaire — aide 44×44, selects 44 px, clavier atteignable au clavier */
.notif-help { width: 44px; height: 44px; min-width: 44px; }
.chords-select { min-height: 44px; font-size: 16px; }
.keyboard-wrapper:focus-visible { outline: 2px solid var(--v); outline-offset: 4px; border-radius: 8px; }
.octave-btn { display: inline-flex; align-items: center; justify-content: center; }
.chords-inv-play { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.chords-vol-icon { display: inline-flex; color: var(--text2); }
/* C13 : curseurs range lisibles et faciles à attraper (zone 44 px, rail 6 px, pouce 24 px) */
input[type="range"] { height: 44px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--bg4); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--bg4); }
input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -9px; }
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; }
input[type="range"]:focus-visible { outline: 2px solid var(--v); outline-offset: 2px; border-radius: 8px; }
/* C8 : logo de l'en-tête 44 × 44 au moins ; pastille de progression vide masquée (lien sans contenu) */
a.logo-wrap { min-width: 44px; }
.pk-mini-progress:empty { display: none; }
.pk-mini-progress { min-width: 44px; }
/* C10 : liens du pied (Mentions légales · Confidentialité · CGU) : cibles de 44 px */
.legal-links a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 6px; }

/* PK-FIX1 I9 : son indisponible (pas de Web Audio) — message discret, la page reste utilisable */
.pk-no-audio { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg2); border: 1px solid var(--border1); color: var(--text1); font-size: 14px; line-height: 1.4; }

/* ════════════════════════════════════════════════════════════
 * PK-T1 — Thème clair en option ([data-theme="light"] sur <html>, posé par pk-theme.js avant le rendu).
 * Mêmes noms de tokens : seules les valeurs changent. Action #6F52D9 texte blanc (ombre #4B35A6),
 * or des récompenses #B9800F, flamme #F07A1C, gel #CFE3EC. Les teintes de texte sont assombries
 * là où l'AA l'exige (axe-core, tools/test-design.mjs).
 * ════════════════════════════════════════════════════════════ */
:root[data-theme="light"] {
  color-scheme: light;
  --skill-blue: #2464C8;
  --skill-blue-bg: #E4EEFC;
  --skill-rose: #B83A78;
  --skill-rose-bg: #FBE6F0;
  --skill-cyan: #0B7F8C;
  --skill-cyan-bg: #DDF3F5;
  --skill-neutral: #6E665A;
  --skill-neutral-bg: #F1ECE3;
  --bg0: #F7F3EC;
  --bg1: #F1EBE0;
  --bg2: #FFFFFF;
  --bg3: #F3EEE5;
  --bg4: #EAE3D6;
  --nav-bg: #FFFFFF;
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --scrim-bg: rgba(247, 243, 236, 0.96);
  --v: #6F52D9;
  --on-v: #FFFFFF;
  --v-shadow: #4B35A6;
  --v-surface: #EFEAFD;
  --v-border: #D6CCF7;
  --key-white: #FFFFFF;
  --key-black: #1E1A16;
  --logo-key-line: #8C8273;
  --logo-key-ring: #8C8273;
  --avatar-eye: #1E1A16;
  --v2: #5B3FC4;
  --v3: #4B35A6;
  --vg: rgba(111, 82, 217, 0.10);
  --vb: rgba(111, 82, 217, 0.24);
  --text1: #1E1A16;
  --text2: #6E665A;
  --text3: #675F53;
  --border1: #E4DCCD;
  --borderv: #D6CCF7;
  --border2: #D6CCF7;
  --green: #18804D;
  --ok-bg: #E2F5EA;
  --ok-text: #0F6A3E;
  --red: #B04A0A;
  --err-bg: #FDEDE2;
  --ok-edge: #1F9A5F;
  --err-edge: #B85A2A;
  --flame: #F07A1C;
  --flame-bg: #FFE8D3;
  --flame-text: #A8480A;
  --frost: #CFE3EC;
  --flame-ink: #3A1F06;
  --flame-edge: #C96E1E;
  --frost-ink: #1D3440;
  --frost-edge: #95B4C2;
  --key-dim: #E2DACB;
  --v-track: #DDD5F5;
  --v-text-soft: #4F4766;
  --gold-bg: #FBF1D9;
  --gold-light: #7A5306;
  --gold-soft: #6B5A33;
  --gold: #B9800F;
  --gold-deep: #8F6208;
  --cyan: #5B3FC4;
  --orange: #F07A1C;
  --magenta: #4B35A6;
  --red-arcade: #B04A0A;
  --v-light: #5B3FC4;
  --v-deep: #4B35A6;
  --v-glow: rgba(111, 82, 217, 0.3);
  --pk-bg1: #F1EBE0;
  --pk-bg2: #FFFFFF;
  --pk-bg3: #F3EEE5;
  --pk-border: #E4DCCD;
  --pk-border2: #D8CFBD;
  /* Revue C11 : or et orange en texte ≥ 4,5:1 sur les fonds clairs, pastilles de notes lisibles */
  --gold-ink: #8A5C00;
  --orange-ink: #A8480A;
  --pill-other-bg: #DDD5F5;
  --pill-other-ink: #3F2C99;
}

/* En-tête du dashboard : dégradé sombre d'origine remplacé par une surface claire */
:root[data-theme="light"] .pk-topbar { background: var(--topbar-bg); }

/* PK-T1 — Illustrations animées (assets/illustrations/*.svg : animations internes, coupées en reduced-motion) */
.pk-illus { display: block; max-width: 100%; height: auto; pointer-events: none; user-select: none; }
.pk-empty { display: flex; flex-direction: column; align-items: center; gap: var(--gap-sm); text-align: center; padding: var(--gap-sm) 0; }
.pk-empty-illus { width: 120px; }
.path-wide-illus { width: 84px; flex-shrink: 0; }
/* Revue C15 : feuille « Quitter la série ? » (réutilise .pk-fb) */
.train-quit-dlg .pk-fb-form { gap: 10px; }
.train-quit-text { margin: 0 0 8px; color: var(--text2); }
.train-quit-dlg .gen-btn, .train-quit-dlg .train-btn-ghost { width: 100%; min-height: 48px; }

/* Revue C11 — thème clair : étoiles vides bien distinctes des étoiles gagnées */
:root[data-theme="light"] .train-star:not(.is-on),
:root[data-theme="light"] .path-tile-stars .train-star:not(.is-on),
:root[data-theme="light"] .path-level-stars .train-star:not(.is-on) { color: var(--pk-border2); }

/* Revue C12 : titres équilibrés (plus de mot seul sur la dernière ligne) */
h1, h2, h3, .onb-title, .td-title, .train-end-title, .pk-fb-title { text-wrap: balance; }

/* Revue C9 : détail des XP de la fin de série */
.train-end-xp-detail { margin: 4px 0 0; text-align: center; font-family: var(--font-mono); font-size: 13px; color: var(--text2); }
/* Revue C10 : unité de l'anneau de la séance du jour */
.td-ring-unit { font-family: var(--font-text); font-weight: 600; font-size: 11px; color: var(--text2); }
.td-pill-sub { font-family: var(--font-text); font-size: 11px; font-weight: 600; }
.progres-chip-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text2); }
/* Revue C17 : CONTINUER de la fin de série jamais sous la barre du bas (76 px) */
#train-back { scroll-margin-bottom: 96px; }

/* PK-ROB1 — Carte « Sauvegarde ta progression » (Aujourd'hui) */
.pk-backup[hidden], .pk-backup [hidden] { display: none; }
.pk-backup-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pk-backup-close { min-width: 44px; min-height: 44px; margin: -12px -12px -12px 0; display: grid; place-items: center; border: 0; background: none; color: var(--text2); cursor: pointer; border-radius: 12px; }
.pk-backup-text { margin: 0; color: var(--text2); font-size: 0.92rem; line-height: 1.45; }
.pk-backup-save { display: inline-flex; align-items: center; min-height: 44px; align-self: flex-start; color: var(--v2); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* PK-JEU0 — éléments du jeu masqués (data-pk-game) */
[data-pk-game][hidden] { display: none !important; }

/* PK-DEP1 — bandeau « Nouvelle version prête » (Aujourd'hui / Progrès) */
.pk-update { position: fixed; left: 16px; right: 16px; bottom: calc(76px + 12px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 16px; background: var(--bg2); border: 1px solid var(--border1); color: var(--text1); font-size: 0.92rem; }
.pk-update-btn { min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: none; color: var(--v2); font: inherit; font-weight: 700; cursor: pointer; }
@media (min-width: 900px) { .pk-update { left: auto; right: 24px; bottom: 24px; max-width: 360px; } }

/* ── PK-UX1-a : navigation 4 onglets, pages Outils et Réglages ─────────── */
h1.pt-hero { margin-top: 0; }
/* ── PK-UX1-b : accueil « Apprendre » — séance du jour + grille des compétences ── */
.td-session-plan { margin: -4px 0 0; font-size: 14px; line-height: 1.4; color: var(--text1); }
.td-session-meta { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: -6px; font-size: 13px; color: var(--text2); text-decoration: none; }
.td-session-meta:hover, .td-session-meta:focus-visible { color: var(--text1); text-decoration: underline; }
[data-family="blue"] { --skill: var(--skill-blue); --skill-bg: var(--skill-blue-bg); }
[data-family="rose"] { --skill: var(--skill-rose); --skill-bg: var(--skill-rose-bg); }
[data-family="cyan"] { --skill: var(--skill-cyan); --skill-bg: var(--skill-cyan-bg); }
[data-family="neutral"] { --skill: var(--skill-neutral); --skill-bg: var(--skill-neutral-bg); }
.sk-section { display: flex; flex-direction: column; gap: 10px; }
.sk-title { margin: 6px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--text1); }
.sk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sk-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 148px; padding: 14px;
  border-radius: 18px; background: var(--bg2); border: 1px solid var(--border1); color: var(--text1); text-decoration: none;
  transition: border-color var(--trans), transform var(--trans);
}
.sk-tile:hover { border-color: var(--skill); }
.sk-tile:active { transform: scale(0.98); }
.sk-tile:focus-visible, .sk-wide:focus-visible { outline: 3px solid var(--v); outline-offset: 2px; }
.sk-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--skill-bg); color: var(--skill); margin-bottom: 4px; }
.sk-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sk-sub { font-size: 13px; line-height: 1.3; color: var(--text2); }
.sk-level { margin-top: auto; padding-top: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--text2); }
.sk-bar { width: 100%; height: 5px; border-radius: 3px; background: var(--bg4); overflow: hidden; }
.sk-bar span { display: block; height: 100%; min-width: 0; background: var(--skill); border-radius: 3px; }
.sk-wides { display: flex; flex-direction: column; gap: 10px; }
.sk-wide { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 14px; border-radius: 18px; background: var(--bg2); border: 1px solid var(--border1); color: var(--text1); text-decoration: none; }
.sk-wide:hover { border-color: var(--v-border); }
.sk-wide .sk-icon { margin-bottom: 0; }
.sk-wide-text { display: flex; flex-direction: column; gap: 2px; }
.sk-wide-text strong { font-size: 15px; }
.sk-wide-text small { font-size: 13px; color: var(--text2); }
/* Grille des parcours (quiz.html) et page d'un parcours : même couleur de famille */
.path-tile[data-family] .path-tile-icon, .path-detail-head[data-family] .path-tile-icon { background: var(--skill-bg); color: var(--skill); }
.path-tile[data-family] .path-tile-bar span { background: var(--skill); }
.pk-all-skills { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; color: var(--v-light); font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.pk-all-skills:hover, .pk-all-skills:focus-visible { text-decoration: underline; }
.outils-list { display: flex; flex-direction: column; gap: 10px; }
.outils-list [hidden] { display: none; }
.outils-icon { background: var(--v-surface); color: var(--v2); }
.reglages-app { display: flex; flex-direction: column; gap: 14px; }
.reglages-group h2 { font-family: 'DM Mono', monospace; font-size: 0.78rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text2); margin: 0 0 6px; }
.reglages-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--border1); }
.reglages-group h2 + .reglages-option { border-top: 0; padding-top: 4px; }
.reglages-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 180px; }
.reglages-label { color: var(--text1); font-weight: 600; font-size: 0.95rem; }
.reglages-desc { color: var(--text2); font-size: 0.82rem; overflow-wrap: anywhere; }
.reglages-control { display: flex; }
.reglages-link { min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; }
.reglages-legal { margin: 12px 0 0; font-size: 0.82rem; color: var(--text2); }
.reglages-legal a { color: var(--text2); }
.reglages-account .pk-account-item { display: flex; flex-direction: column; gap: 2px; min-height: 44px; justify-content: center; color: var(--v-light); text-decoration: none; font-weight: 600; }
.reglages-account .pk-account-item small { color: var(--text2); font-weight: 400; }
.reglages-account .pk-account-state { padding: 0; }
.reglages-delete .reglages-option { border-top: 1px solid var(--border1); margin-top: 8px; }
.reglages-msg { margin: 6px 0 0; font-size: 0.85rem; color: var(--text2); }
.reglages-msg:empty { display: none; }
.pk-account-signout { min-height: 44px; margin-top: 8px; }
