/* ==========================================================================
   Basse Studio — système visuel
   Thème clair par défaut, thème sombre « studio » selon le système ou le réglage.
   Les couleurs des notes (--note-0 à --note-6, de Do à Si) viennent du compte.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Outfit';
  src: url('/fonts/outfit.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --note-0: #e947d9; --note-1: #7030a0; --note-2: #ff0000; --note-3: #203864;
  --note-4: #5b9bd5; --note-5: #ffc000; --note-6: #70ad47;
  --spectrum: linear-gradient(90deg, var(--note-0), var(--note-1), var(--note-2), var(--note-5), var(--note-6), var(--note-4), var(--note-3));

  --bg: #f5f3ef;
  --bg-glow-1: rgba(233, 71, 217, 0.10);
  --bg-glow-2: rgba(91, 155, 213, 0.12);
  --surface: #ffffff;
  --surface-2: #f2efea;
  --surface-3: #e8e4dd;
  --glass: rgba(255, 255, 255, 0.78);
  --border: rgba(23, 26, 33, 0.09);
  --border-strong: rgba(23, 26, 33, 0.16);
  --text: #171a21;
  --text-2: #3a404c;
  --muted: #6a7180;
  --accent: #e2531f;
  --accent-2: #f07a2e;
  --accent-soft: rgba(226, 83, 31, 0.10);
  --on-accent: #ffffff;
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.12);
  --bad: #dc2626;
  --warn-soft: #fff4e0;
  --shadow-sm: 0 1px 2px rgba(23, 26, 33, 0.06);
  --shadow: 0 1px 2px rgba(23, 26, 33, 0.05), 0 8px 24px -12px rgba(23, 26, 33, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(23, 26, 33, 0.35);

  --wood: #5a3d27;
  --fret: #cbbfae;
  --nut: #f3ece0;
  --string: #e6e0d6;
  --inlay: #efe3cd;
  --marker: #26221e;
  --on-marker: #ffffff;
  --hit-hover: rgba(255, 255, 255, 0.14);

  --radius-s: 10px;
  --radius: 16px;
  --radius-l: 24px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Outfit', 'Inter', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --topbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0c0e13;
    --bg-glow-1: rgba(233, 71, 217, 0.14);
    --bg-glow-2: rgba(91, 155, 213, 0.12);
    --surface: #151821;
    --surface-2: #1c202b;
    --surface-3: #252a37;
    --glass: rgba(18, 21, 29, 0.72);
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #eef1f7;
    --text-2: #c9cfdb;
    --muted: #8e97a9;
    --accent: #ff7a3d;
    --accent-2: #ffa24a;
    --accent-soft: rgba(255, 122, 61, 0.14);
    --on-accent: #1b0d03;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.14);
    --bad: #f87171;
    --warn-soft: rgba(255, 170, 60, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.85);
    --wood: #2e2118;
    --fret: #7c7468;
    --nut: #d8d0c2;
    --string: #cfc8bc;
    --inlay: #6f5e4b;
    --marker: #eef1f7;
    --on-marker: #12151c;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0c0e13;
  --bg-glow-1: rgba(233, 71, 217, 0.14);
  --bg-glow-2: rgba(91, 155, 213, 0.12);
  --surface: #151821;
  --surface-2: #1c202b;
  --surface-3: #252a37;
  --glass: rgba(18, 21, 29, 0.72);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef1f7;
  --text-2: #c9cfdb;
  --muted: #8e97a9;
  --accent: #ff7a3d;
  --accent-2: #ffa24a;
  --accent-soft: rgba(255, 122, 61, 0.14);
  --on-accent: #1b0d03;
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.14);
  --bad: #f87171;
  --warn-soft: rgba(255, 170, 60, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.85);
  --wood: #2e2118;
  --fret: #7c7468;
  --nut: #d8d0c2;
  --string: #cfc8bc;
  --inlay: #6f5e4b;
  --marker: #eef1f7;
  --on-marker: #12151c;
  color-scheme: dark;
}

/* --- Base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 8% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15.5px/1.6 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.15; margin: 0; color: var(--text); }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
strong { font-weight: 650; }
sup { font-size: 0.55em; vertical-align: super; margin-left: 0.04em; font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.block { display: block; }
.center-text { text-align: center; }
.error { color: var(--bad); min-height: 1.3em; margin: 0; font-size: 0.92rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.icon { flex: none; }
[hidden] { display: none !important; }

/* --- Barre du haut et navigation ------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 max(20px, env(safe-area-inset-left));
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em; }
.brand-mark { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; }
.brand-mark i { display: block; width: 4px; border-radius: 2px; }
.brand-mark i:nth-child(1) { height: 45%; background: var(--note-0); }
.brand-mark i:nth-child(2) { height: 70%; background: var(--note-1); }
.brand-mark i:nth-child(3) { height: 100%; background: var(--note-2); }
.brand-mark i:nth-child(4) { height: 60%; background: var(--note-3); }
.brand-mark i:nth-child(5) { height: 82%; background: var(--note-4); }
.brand-mark i:nth-child(6) { height: 92%; background: var(--note-5); }
.brand-mark i:nth-child(7) { height: 52%; background: var(--note-6); }
.brand.big .brand-mark { height: 30px; gap: 3px; }
.brand.big .brand-mark i { width: 6px; border-radius: 3px; }
.brand.big .brand-name { font-size: 1.35rem; }

.mainnav { display: flex; gap: 4px; margin: 0 auto; padding: 4px; background: var(--surface-2); border-radius: 999px; border: 1px solid var(--border); }
.mainnav a {
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 550;
  font-size: 0.94rem;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}
.mainnav a:hover { color: var(--text); }
.mainnav a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.account { position: relative; display: flex; align-items: center; gap: 8px; }
.settings-link {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.2s, background 0.2s, transform 0.4s var(--ease);
}
.settings-link:hover { color: var(--text); background: var(--surface-2); transform: rotate(45deg); }
.settings-link.active { color: var(--accent); background: var(--accent-soft); }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--spectrum) border-box;
  color: var(--text);
  font: 700 0.95rem var(--display);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 0.2s var(--ease);
}
.avatar:hover, .avatar.active { transform: scale(1.06); }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 210px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s var(--ease);
  z-index: 50;
}
.menu-user { margin: 0; padding: 8px 12px 10px; font-weight: 650; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu a, .menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-s);
  background: none;
  color: var(--text-2);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); }

.tabbar { display: none; }

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px max(20px, env(safe-area-inset-left)) 96px;
}
main.enter > * { animation: rise 0.45s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: 0.04s; }
main.enter > *:nth-child(3) { animation-delay: 0.08s; }
main.enter > *:nth-child(4) { animation-delay: 0.12s; }
main.enter > *:nth-child(n + 5) { animation-delay: 0.16s; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }

/* --- Composants ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-title { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin-bottom: 14px; }
.card-title .icon { color: var(--accent); }
.card-title.sub { margin-top: 26px; font-size: 1.02rem; }
.empty { text-align: center; padding: 48px 24px; }

.page-head { margin-bottom: 22px; max-width: 760px; }
.page-head h1 { margin-bottom: 8px; }
.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.lead { font-size: 1.08rem; color: var(--text-2); margin: 0; line-height: 1.55; }
.section-label { font-size: 1.05rem; margin: 36px 0 14px; color: var(--text-2); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.center { justify-content: center; }

/* Boutons */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 600 0.95rem var(--font);
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  box-shadow: 0 8px 20px -10px var(--accent);
}
.btn-primary:hover { box-shadow: 0 12px 26px -10px var(--accent); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.btn-lg { min-height: 48px; padding: 11px 22px; font-size: 1rem; }
.btn-xl { min-height: 56px; padding: 14px 28px; font-size: 1.05rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
  font-weight: 650;
  font-size: 0.88rem;
}
.icon-btn:hover { border-color: var(--accent); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.lg { width: 46px; height: 46px; }
.icon-btn.toggle[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px 8px 14px;
  border-radius: 999px;
  border: none;
  background: var(--text);
  color: var(--surface);
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.play-btn:hover { transform: translateY(-1px); }
.play-btn.playing { background: var(--accent); color: var(--on-accent); }

.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; }

/* Contrôle segmenté */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 16px;
  min-height: 36px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented.wide { display: flex; }
.segmented.wide button { flex: 1; }

/* Sous-navigation (Harmonie, Outils) */
.subnav { display: flex; gap: 8px; margin: -6px 0 22px; overflow-x: auto; scrollbar-width: none; }
.subnav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s;
}
.subnav a:hover { color: var(--text); border-color: var(--border-strong); }
.subnav a.active { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }

/* Champs */
.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; color: var(--text-2); }
.field.compact { flex-direction: row; align-items: center; gap: 10px; }
input:not([type]), input[type='text'], input[type='password'], select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 44px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 16px; }
.toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; font-weight: 550; }

/* Interrupteur */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; color: var(--text-2); font-size: 0.92rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); transition: background 0.2s; flex: none; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform 0.25s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Puces de choix */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
}
.chip strong { font-family: var(--display); font-size: 1rem; color: var(--text); }
.chip span { font-size: 0.82rem; color: var(--muted); }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--text); border-color: var(--text); }
.chip.active strong, .chip.active span { color: var(--surface); }

.pill { display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 700 0.7rem var(--font); letter-spacing: 0.04em; text-transform: uppercase; vertical-align: middle; }

/* Pastilles de couleur de note */
.note-swatch, .note-dot, .tone-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.35);
  flex: none;
}
.note-swatch.square { border-radius: 4px; width: 18px; }
.note-dot.lg { width: 30px; height: 30px; }

/* Anneau de progression */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring circle { fill: none; }
.ring-track { stroke: var(--surface-3); }
.ring-value { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring-label { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.ring-label strong { font: 700 1.6rem var(--display); }
.ring-label small { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

/* Spectre (signature visuelle) */
.spectrum { display: flex; height: 5px; border-radius: 999px; overflow: hidden; }
.spectrum i { flex: 1; }
.spectrum i:nth-child(1) { background: var(--note-0); }
.spectrum i:nth-child(2) { background: var(--note-1); }
.spectrum i:nth-child(3) { background: var(--note-2); }
.spectrum i:nth-child(4) { background: var(--note-3); }
.spectrum i:nth-child(5) { background: var(--note-4); }
.spectrum i:nth-child(6) { background: var(--note-5); }
.spectrum i:nth-child(7) { background: var(--note-6); }

.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-soft); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 18px; color: var(--text-2); }
.notice .icon { color: var(--accent); margin-top: 2px; }

/* --- Connexion ------------------------------------------------------------- */

body:not(.signed-in) main { max-width: 1080px; padding-top: 48px; }
.login { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; min-height: calc(100vh - 140px); }
.login-hero h1 { font-size: clamp(2.3rem, 5.5vw, 3.6rem); margin: 28px 0 16px; line-height: 1.05; }
.gradient-text { background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero .lead { max-width: 30em; }
.login-neck { width: 100%; max-width: 440px; margin-top: 34px; filter: drop-shadow(0 20px 30px rgba(0,0,0,.25)); }
.neck-wood { fill: var(--wood); }
.neck-fret { stroke: var(--fret); stroke-width: 2.5; }
.neck-string { stroke: var(--string); }
.login-neck circle { stroke: rgba(0,0,0,.35); stroke-width: 1.5; animation: glow 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes glow { 0%, 100% { opacity: 0.55; transform: scale(0.92); } 50% { opacity: 1; transform: scale(1.08); } }
.login-card { position: relative; padding: 30px; overflow: hidden; }
.login-card .spectrum.top { position: absolute; top: 0; left: 0; right: 0; border-radius: 0; height: 4px; }
.login-card .segmented { margin: 6px 0 22px; }

/* --- Accueil --------------------------------------------------------------- */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 36px;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: auto -10% -60% 40%;
  height: 120%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  pointer-events: none;
}
.hero::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--spectrum); }
.hero-text { position: relative; max-width: 620px; }
.hero h1 { margin-bottom: 12px; }
.hero .lead { margin-bottom: 22px; }
.hero-progress { position: relative; }
.hero-progress .ring-label strong { font-size: 2.1rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  text-decoration: none !important;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, border-color 0.25s;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.tile-art { display: block; height: 112px; background: var(--surface-2); position: relative; overflow: hidden; }
.tile-art svg { width: 100%; height: 100%; padding: 10px; }
.tile-body { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px 18px; }
.tile-body strong { font: 650 1.08rem var(--display); }
.tile-body span { color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
.tile-go { position: absolute; right: 14px; bottom: 16px; color: var(--muted); transition: transform 0.25s var(--ease), color 0.2s; }
.tile:hover .tile-go { transform: translateX(4px); color: var(--accent); }
.art-wood { fill: var(--wood); }
.art-fret { stroke: var(--fret); stroke-width: 2; }
.art-nut { stroke: var(--nut); stroke-width: 4; }
.art-string { stroke: var(--string); stroke-width: 1.4; }
.tile-art circle { stroke: rgba(0,0,0,.3); stroke-width: 1.2; }
.art-ring { fill: none; stroke: var(--border-strong); stroke-width: 2; }
.art-wedge { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1; stroke-opacity: 0.4; }
.art-beat { fill: var(--surface-3); stroke: none !important; animation: beat 2s infinite; }
.art-beat.first { animation-name: beat-first; }
@keyframes beat { 0%, 20% { fill: var(--text); } 30%, 100% { fill: var(--surface-3); } }
@keyframes beat-first { 0%, 20% { fill: var(--accent); } 30%, 100% { fill: var(--surface-3); } }
.art-arc { fill: none; stroke: var(--surface-3); stroke-width: 8; stroke-linecap: round; }
.art-arc-ok { fill: none; stroke: var(--ok); stroke-width: 8; stroke-linecap: round; }
.art-needle { stroke: var(--text); stroke-width: 3; stroke-linecap: round; animation: wobble 3s ease-in-out infinite; transform-origin: 80px 76px; }
.art-pivot { fill: var(--text); stroke: none !important; }
@keyframes wobble { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(4deg); } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 20px; }
.stat strong { font: 700 1.6rem var(--display); }
.stat span:last-child { color: var(--muted); font-size: 0.88rem; }
.stat-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }

/* --- Parcours des leçons --------------------------------------------------- */

.journey { display: flex; align-items: center; gap: 24px; margin-bottom: 36px; }
.journey-text { flex: 1; min-width: 0; }
.journey-text h2 { margin-bottom: 4px; }
.journey-text p:last-child { margin: 0; }

.level { --level-color: var(--accent); margin-bottom: 40px; }
.level-head { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin-bottom: 16px; }
.level-head h2 { font-size: 1.5rem; }
.level-head p { margin: 2px 0 0; }
.level-badge {
  align-self: start;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--level-color) 16%, transparent);
  color: color-mix(in srgb, var(--level-color) 75%, var(--text));
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}
.level-progress { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.level-progress .bar { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.level-progress .bar span { display: block; height: 100%; background: var(--level-color); border-radius: inherit; transition: width 0.8s var(--ease); }
.level-progress small { color: var(--muted); font-weight: 600; }

.path { list-style: none; margin: 0; padding: 0; position: relative; }
.path::before { content: ''; position: absolute; left: 23px; top: 24px; bottom: 24px; width: 2px; background: linear-gradient(var(--level-color), color-mix(in srgb, var(--level-color) 15%, transparent)); border-radius: 2px; }
.path-item { position: relative; padding: 6px 0; }
.path-item > a { display: flex; align-items: center; gap: 18px; color: var(--text); text-decoration: none !important; }
.path-node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  font: 700 1.05rem var(--display);
  color: var(--muted);
  transition: transform 0.25s var(--ease);
}
.path-item.done .path-node { background: var(--level-color); border-color: var(--level-color); color: #fff; }
.path-item.next .path-node { border-color: var(--level-color); color: var(--text); box-shadow: 0 0 0 6px color-mix(in srgb, var(--level-color) 18%, transparent); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--level-color) 6%, transparent); } }
.path-card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s, border-color 0.25s;
}
.path-item > a:hover .path-card { transform: translateX(4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--level-color) 45%, transparent); }
.path-item > a:hover .path-node { transform: scale(1.08); }
.path-item.next .path-card { border-color: color-mix(in srgb, var(--level-color) 50%, transparent); }
.path-title { font: 650 1.05rem var(--display); }
.path-summary { color: var(--muted); font-size: 0.9rem; }
.path-meta { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.path-go { color: var(--muted); }

/* --- Page de leçon --------------------------------------------------------- */

.reading-progress { position: fixed; top: var(--topbar-h); left: 0; right: 0; height: 3px; z-index: 39; pointer-events: none; }
.reading-progress span { display: block; height: 100%; background: var(--spectrum); transform-origin: left; transform: scaleX(0); transition: transform 0.1s linear; }

.lesson-page { --level-color: var(--accent); max-width: 780px; margin: 0 auto; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; margin-bottom: 18px; text-decoration: none !important; }
.back:hover { color: var(--text); }
.lesson-hero { position: relative; padding: 4px 0 26px; margin-bottom: 26px; border-bottom: 1px solid var(--border); }
.lesson-tags { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 0.88rem; }
.level-chip { padding: 4px 12px; border-radius: 999px; background: color-mix(in srgb, var(--level-color) 16%, transparent); color: color-mix(in srgb, var(--level-color) 75%, var(--text)); font-weight: 700; font-size: 0.8rem; }
.lesson-hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 12px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; color: var(--muted); font-size: 0.9rem; }
.meta-row span { display: inline-flex; align-items: center; gap: 6px; }
.done-flag { color: var(--ok) !important; font-weight: 650; }

.prose { font-size: 1.06rem; line-height: 1.75; color: var(--text-2); }
.prose p { margin: 0 0 1.15em; }
.prose strong { color: var(--text); }
.prose h2 { font-size: 1.45rem; margin: 1.8em 0 0.6em; color: var(--text); }
.prose h2::before { content: ''; display: inline-block; width: 18px; height: 4px; border-radius: 2px; background: var(--level-color); vertical-align: middle; margin-right: 12px; }
ul.dots { list-style: none; padding: 0; margin: 0 0 1.3em; }
ul.dots li { position: relative; padding-left: 28px; margin-bottom: 0.55em; }
ul.dots li::before { content: ''; position: absolute; left: 4px; top: 0.6em; width: 10px; height: 10px; border-radius: 50%; background: var(--note-0); box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.25); }
ul.dots li:nth-child(7n + 2)::before { background: var(--note-1); }
ul.dots li:nth-child(7n + 3)::before { background: var(--note-2); }
ul.dots li:nth-child(7n + 4)::before { background: var(--note-3); }
ul.dots li:nth-child(7n + 5)::before { background: var(--note-4); }
ul.dots li:nth-child(7n + 6)::before { background: var(--note-5); }
ul.dots li:nth-child(7n + 7)::before { background: var(--note-6); }

.callout {
  display: flex;
  gap: 14px;
  margin: 1.6em 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  font-size: 1rem;
}
.callout-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--accent); color: var(--on-accent); }
.callout strong { display: block; color: var(--text); margin-bottom: 2px; font-family: var(--display); }
.callout p { margin: 0; }

/* Tablature */
.tab-card {
  --tab-note: var(--marker);
  margin: 1.8em 0;
  border-radius: var(--radius-l);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tab-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tab-title { font: 650 1rem var(--display); color: var(--text); }
.tab-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab-bpm { font-size: 0.82rem; color: var(--muted); min-width: 70px; text-align: center; }
.tab-bpm strong { font: 700 1.05rem var(--display); color: var(--text); }
.tab-controls .play-btn { margin-left: 6px; }
.tab-scroll { overflow-x: auto; padding: 14px 10px 10px; }
.tab-svg { display: block; margin: 0 auto; font-family: var(--font); }
.tab-string { stroke: var(--border-strong); stroke-width: 1.4; }
.tab-bar { stroke: var(--muted); stroke-width: 1.4; opacity: 0.6; }
.tab-bar-edge { stroke-width: 3; opacity: 0.8; }
.tab-string-name { fill: var(--muted); font-size: 12px; font-weight: 650; text-anchor: middle; dominant-baseline: central; }
.tab-note circle, .tab-note path { stroke: rgba(0, 0, 0, 0.45); stroke-width: 1.2; transition: transform 0.15s var(--ease); }
.tab-note .tab-outline { fill: none; }
.tab-note text { fill: #fff; stroke: rgba(0, 0, 0, 0.7); stroke-width: 2.4px; paint-order: stroke; font-size: 12px; font-weight: 750; text-anchor: middle; dominant-baseline: central; }
.tab-note { transform-box: fill-box; transform-origin: center; transition: transform 0.15s var(--ease); }
.tab-note.active { transform: scale(1.3); }
.tab-muted circle { fill: var(--surface-3); stroke: var(--border-strong); }
.tab-muted text { fill: var(--muted); stroke: none; font-size: 14px; }
.tab-hint { fill: var(--muted); font-size: 12px; font-weight: 600; text-anchor: middle; }
.tab-playhead { fill: var(--accent-soft); opacity: 0; transition: x 0.08s linear, opacity 0.2s; }
.tab-playhead.on { opacity: 1; }

.practice h2 { font-size: 1.25rem; margin: 2.2em 0 14px; }
.practice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.practice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none !important;
  border-radius: var(--radius);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.practice-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.practice-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.practice-card .go { margin-left: auto; color: var(--muted); }

.complete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin: 40px 0 20px; transition: border-color 0.3s, background 0.3s; }
.complete.is-done { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: linear-gradient(135deg, var(--ok-soft), transparent 70%), var(--surface); }
.complete-text { display: flex; align-items: center; gap: 16px; }
.complete-text h2 { font-size: 1.2rem; margin-bottom: 2px; }
.complete-text p { margin: 0; }
.complete-badge { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--ok); color: #fff; flex: none; animation: pop 0.4s var(--ease); }
.complete-badge.todo { background: var(--accent-soft); color: var(--accent); }

.confetti { position: fixed; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; z-index: 100; animation: burst 0.9s var(--ease) forwards; }
@keyframes burst { from { transform: translate(-50%, -50%) scale(1); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.4); opacity: 0; } }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; color: var(--text); text-decoration: none !important; border-radius: var(--radius); transition: border-color 0.2s, transform 0.2s var(--ease); }
.pager a:hover { border-color: var(--accent); transform: translateY(-2px); }
.pager a.next { text-align: right; align-items: flex-end; }
.pager small { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.pager span { font: 600 1rem var(--display); }

/* --- Manche ---------------------------------------------------------------- */

.fb-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 16px; }
.fb-top .toolbar { margin: 0; }
.fb-card { padding: 20px; }
.fb-info { margin: 14px 2px 0; font-size: 0.9rem; }
.fretboard-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--surface-2); padding: 14px 8px 8px; }
.fretboard { display: block; margin: 0 auto; }
.fb-wood { fill: var(--wood); }
.fb-fret { stroke: var(--fret); stroke-width: 2; }
.fb-nut { stroke: var(--nut); stroke-width: 6; }
.fb-string { stroke: var(--string); }
.fb-inlay { fill: var(--inlay); opacity: 0.85; }
.fb-num { fill: var(--muted); font-size: 11px; text-anchor: middle; font-family: var(--font); }
.fb-num-strong { font-weight: 700; fill: var(--text); }
.fretboard.vertical .fb-num { dominant-baseline: central; }
.fb-hit { fill: transparent; cursor: pointer; transition: fill 0.15s; }
.fb-hit:hover { fill: var(--hit-hover); }
.fb-marker { pointer-events: none; animation: marker-in 0.35s var(--ease) both; transform-box: fill-box; transform-origin: center; }
@keyframes marker-in { from { opacity: 0; transform: scale(0.4); } }
.fb-marker circle { fill: var(--marker); stroke: var(--surface); stroke-width: 1.5; }
.fb-marker text { fill: var(--on-marker); font-family: var(--font); }
.fb-root circle, .fb-target circle { fill: var(--accent); }
.fb-root text, .fb-target text { fill: var(--on-accent); font-weight: 700; }
.fb-correct circle { fill: var(--ok); }
.fb-wrong circle { fill: var(--bad); }
.fb-correct text, .fb-wrong text { fill: #fff; font-weight: 700; }
.fb-colored circle, .fb-colored path { stroke: rgba(0, 0, 0, 0.55); stroke-width: 1.4; }
.fb-colored .fb-outline { fill: none; }
.fb-colored text { fill: #fff; stroke: rgba(0, 0, 0, 0.75); stroke-width: 2.5px; paint-order: stroke; font-weight: 700; }
.fb-marker .fb-ring { fill: none; stroke: var(--text); stroke-width: 2.5; }
.fb-colored.fb-correct .fb-ring { stroke: var(--ok); stroke-width: 3.5; }
.fb-colored.fb-wrong .fb-ring { stroke: var(--bad); stroke-width: 3.5; }
.fb-label { font-size: 12px; font-weight: 650; text-anchor: middle; dominant-baseline: central; }
.fb-label-small { font-size: 9.5px; }
.fretboard.compact .fb-label { font-size: 10px; }
.fretboard.compact .fb-label-small { font-size: 8px; }
.fretboard.compact .fb-num { font-size: 9px; }

.legend { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; font-size: 0.88rem; }
.legend > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }

.answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin: 14px 0 18px; }
.answers button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.2s, background 0.2s;
}
.answers button:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.answers button:disabled { cursor: default; opacity: 0.6; }
.answers button.correct { background: var(--ok); border-color: var(--ok); color: #fff; opacity: 1; animation: pop 0.3s var(--ease); }
.answers button.wrong { background: var(--bad); border-color: var(--bad); color: #fff; opacity: 1; }
.quiz-feedback { font: 650 1.15rem var(--display); margin: 8px 0; }
.quiz-feedback.ok { color: var(--ok); }
.quiz-feedback.bad { color: var(--bad); }
.quiz-result { text-align: center; margin-bottom: 16px; box-shadow: none; background: var(--surface-2); }
.quiz-result h2 { font-size: 2rem; margin-bottom: 4px; }
.quiz-result .toolbar { justify-content: center; margin-top: 12px; }
.quiz-result button { min-height: 42px; padding: 9px 20px; border-radius: 999px; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); font-weight: 650; cursor: pointer; }

/* --- Accords ---------------------------------------------------------------- */

.picker { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.picker-row { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; }
.picker-label { font-weight: 650; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.note-picker { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.note-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 2px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 650;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.note-btn .note-dot { width: 22px; height: 22px; }
.note-btn:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.note-btn.active { border-color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--text); }

.chord-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.chord-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chord-name { font-size: 3rem; line-height: 1; }
.chord-name sup { font-size: 0.5em; color: var(--accent); }
.chord-head p { margin: 6px 0 0; }
.chord-options { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.chord-diagram { display: flex; justify-content: center; padding: 10px 0; border-radius: var(--radius); background: var(--surface-2); }
.chord-info h3 { margin: 0 0 10px; }
.chord-info h3:not(:first-child) { margin-top: 22px; }
.chord-info p { margin: 0; }
.chord-info .actions { margin-top: 18px; }
.tone-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tone { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.tone .tone-dot { width: 24px; height: 24px; }
.tone strong { font-family: var(--display); }
.tone small { color: var(--muted); font-weight: 650; font-size: 0.78rem; }

.chord-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.gallery-item:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.gallery-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.gallery-name { font: 700 1.2rem var(--display); }
.gallery-name sup { color: var(--accent); }

/* --- Tonalités -------------------------------------------------------------- */

.keys-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.circle-card { padding: 16px; }
.circle-svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.k-track { fill: none; stroke: var(--border); stroke-width: 1.5; }
.k-wedge { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 40%, transparent); stroke-width: 1.5; transform-origin: 330px 330px; transition: transform 0.6s var(--ease); }
.k-fifth { fill: none; stroke: #e5484d; stroke-width: 2; }
.k-fifth-head { fill: #e5484d; }
.k-fourth { fill: none; stroke: var(--text-2); stroke-width: 1.6; opacity: 0.6; }
.k-fourth-head { fill: var(--text-2); }
.k-signature { fill: var(--muted); font-size: 15px; font-weight: 650; text-anchor: middle; dominant-baseline: central; }
.k-node { cursor: pointer; transform-box: fill-box; transform-origin: center; transition: transform 0.3s var(--ease), opacity 0.3s; outline: none; }
.k-node:hover, .k-node:focus-visible { transform: scale(1.1); }
.k-node .k-outline { fill: none; stroke: rgba(0, 0, 0, 0.45); stroke-width: 1.5; }
.k-node.selected { transform: scale(1.18); }
.k-node.selected .k-outline { stroke: var(--text); stroke-width: 4; }
.k-label { fill: #fff; stroke: rgba(0, 0, 0, 0.75); stroke-width: 3px; paint-order: stroke; font-size: 16px; font-weight: 750; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.k-label-alt { font-size: 12px; font-weight: 650; }
.k-label-minor { font-size: 13px; }
.k-center-bg { fill: var(--surface-2); stroke: var(--border); }
.k-center-name { fill: var(--text); font: 700 38px var(--display); text-anchor: middle; dominant-baseline: central; }
.k-center-mode { fill: var(--muted); font-size: 15px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.k-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.84rem; color: var(--text-2); justify-content: center; }
.k-legend li { display: inline-flex; align-items: center; gap: 8px; }
.k-legend span { display: inline-block; flex: none; }
.lg-fifth { width: 22px; height: 2px; background: #e5484d; }
.lg-fourth { width: 22px; height: 2px; background: var(--text-2); opacity: 0.6; }
.lg-major { width: 16px; height: 16px; border-radius: 50%; background: var(--note-4); box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.4); }
.lg-minor { width: 12px; height: 12px; border-radius: 50%; background: var(--note-4); box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.4); }
.lg-wedge { width: 18px; height: 14px; border-radius: 3px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }

.key-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.key-title h2 { font-size: 2.2rem; }
.key-title h2 span { color: var(--muted); font-weight: 500; font-size: 0.6em; }
.facts { display: grid; gap: 10px; margin: 0 0 22px; }
.facts > div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.facts dt { color: var(--muted); font-weight: 650; font-size: 0.85rem; }
.facts dd { margin: 0; font-weight: 550; }
.key-info h3 { margin: 18px 0 10px; }
.degree-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-bottom: 18px; }
.degree { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 14px; color: var(--text); text-decoration: none !important; box-shadow: none; transition: transform 0.2s var(--ease), border-color 0.2s; }
.degree:hover { transform: translateY(-2px); border-color: var(--accent); }
.degree small { color: var(--accent); font-weight: 700; font-size: 0.78rem; }
.degree strong { font-family: var(--display); font-size: 1.05rem; }

.build { margin-top: 18px; }
.build-head h2 { margin-bottom: 4px; }
.build-scroll { overflow-x: auto; padding: 14px 4px 4px; }
.build-strip { --cell: 64px; min-width: calc(var(--cell) * 13); position: relative; }
.build-cells { display: grid; grid-template-columns: repeat(13, var(--cell)); }
.build-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.build-dot { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; color: #fff; font: 700 0.86rem var(--font); text-shadow: 0 0 3px rgba(0,0,0,.8), 0 0 1px rgba(0,0,0,.9); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4); }
.build-cell:not(.in) .build-dot { width: 34px; height: 34px; margin: 8px 0; opacity: 0.35; font-size: 0.66rem; filter: grayscale(0.4); }
.build-cell small { font-weight: 700; color: var(--muted); min-height: 1.2em; }
.build-gaps { position: relative; height: 34px; margin-top: 4px; }
.gap {
  position: absolute;
  left: calc(var(--cell) * (var(--from) + 0.5));
  width: calc(var(--cell) * var(--size));
  top: 0;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-top: none;
  border-radius: 0 0 14px 14px;
  display: flex;
  justify-content: center;
  padding-top: 26px;
  line-height: 1;
  font: 700 0.82rem var(--display);
  color: var(--text-2);
}
.gap.half { border-color: var(--accent); color: var(--accent); }

/* --- Métronome ------------------------------------------------------------- */

.metronome { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 32px 24px; }
.dial {
  position: relative;
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 0 0 10px var(--surface-2);
}
.dial::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--text); opacity: 0; }
.dial.pulse::after { animation: ripple 0.45s var(--ease); }
.dial.pulse.accent::after { border-color: var(--accent); }
@keyframes ripple { from { opacity: 0.8; transform: scale(0.96); } to { opacity: 0; transform: scale(1.12); } }
.dial-core { display: flex; flex-direction: column; align-items: center; }
.bpm { font: 700 4.6rem/1 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.dial-core small { color: var(--muted); font-weight: 600; margin-top: 6px; }
.beats { display: flex; justify-content: center; gap: 14px; }
.beat { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); transition: background 0.06s, transform 0.12s var(--ease); }
.beat.first { box-shadow: 0 0 0 2px var(--accent); }
.beat.on { background: var(--text); transform: scale(1.35); }
.beat.first.on { background: var(--accent); }
.bpm-row { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 620px; }
.bpm-row input[type='range'] { flex: 1; }
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--surface-3) var(--fill, 50%));
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: var(--shadow); }
input[type='range']::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.metro-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; padding-top: 18px; border-top: 1px solid var(--border); width: 100%; }
.btn.playing { background: var(--text); color: var(--surface); box-shadow: none; }

/* --- Accordeur ------------------------------------------------------------- */

.tuner { margin-bottom: 18px; }
.tuner-display { display: flex; flex-direction: column; align-items: center; }
.gauge { width: 100%; max-width: 420px; }
.g-arc { fill: none; stroke: var(--surface-3); stroke-width: 14; stroke-linecap: round; }
.g-ok { fill: none; stroke: var(--ok); stroke-width: 14; opacity: 0.35; transition: opacity 0.3s; }
.g-tick { stroke: var(--muted); stroke-width: 2; opacity: 0.5; }
.g-tick.zero { stroke: var(--text); opacity: 1; stroke-width: 3; }
.g-label { fill: var(--muted); font-size: 12px; font-weight: 600; text-anchor: middle; }
.g-needle line { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
.g-needle { transition: transform 0.12s linear; }
.g-pivot { fill: var(--text); }
.tuner-readout { text-align: center; margin-top: -26px; }
.tuner-note { font: 700 4rem/1.1 var(--display); letter-spacing: -0.03em; min-height: 4.4rem; transition: color 0.2s; }
.in-tune .tuner-note, .in-tune .g-needle line { color: var(--ok); stroke: var(--ok); }
.in-tune .g-ok { opacity: 1; }
.in-tune .g-pivot { fill: var(--ok); }
.tuner .actions { margin-top: 10px; }
.string-refs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.string-ref {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.string-ref:hover { transform: translateY(-2px); border-color: var(--accent); }
.string-ref strong { font: 700 1.2rem var(--display); }
.string-ref small { color: var(--muted); font-size: 0.78rem; }

/* --- Réglages -------------------------------------------------------------- */

.settings-block { margin-bottom: 18px; }
.notation-choice, .color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.2s;
}
.color-row:hover { border-color: var(--border-strong); }
.color-row:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.color-row input[type='color'] { flex: none; width: 46px; height: 34px; padding: 0; border: none; border-radius: 10px; background: none; cursor: pointer; }
.color-row input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type='color']::-webkit-color-swatch { border: 1px solid rgba(0,0,0,.25); border-radius: 10px; }
.color-row input[type='radio'] { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.settings-actions { margin-top: 20px; }
#s-notes { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* --- Bibliothèque ---------------------------------------------------------- */

.icon.rot45 { transform: rotate(45deg); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.book-card {
  --book-color: var(--accent);
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 18px;
  color: var(--text);
  text-decoration: none !important;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.book-cover {
  flex: none;
  width: 92px;
  height: 124px;
  border-radius: 6px 12px 12px 6px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(160deg, var(--book-color), color-mix(in srgb, var(--book-color) 55%, #000));
  color: #fff;
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, 0.18), 0 10px 22px -12px rgba(0, 0, 0, 0.6);
  font: 700 0.86rem/1.15 var(--display);
}
.book-cover small { font: 600 0.66rem var(--font); opacity: 0.85; }
.book-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.book-body strong { font: 650 1.15rem var(--display); }
.book-meta { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.library-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.library-head .section-label { margin-bottom: 6px; }
.search { display: flex; align-items: center; gap: 10px; padding: 0 16px; margin-bottom: 16px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { flex: 1; border: none !important; box-shadow: none !important; background: transparent; padding: 12px 0; min-height: 46px; font: inherit; color: var(--text); outline: none; }
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.collection { display: flex; flex-direction: column; gap: 6px; padding: 18px; color: var(--text); text-decoration: none !important; transition: transform 0.2s var(--ease), border-color 0.2s; }
.collection:hover { transform: translateY(-2px); border-color: var(--accent); }
.collection strong { font: 650 1rem var(--display); }
.collection-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; flex: none; }
.book-banner { --book-color: var(--accent); display: flex; align-items: center; gap: 14px; margin-bottom: 16px; color: var(--text); text-decoration: none !important; border-color: color-mix(in srgb, var(--book-color) 40%, transparent); }
.book-banner:hover { border-color: var(--book-color); }
.book-banner > span:nth-child(2) { flex: 1; }

details.section { padding: 0; margin-bottom: 12px; overflow: hidden; }
details.section summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none; }
details.section summary::-webkit-details-marker { display: none; }
details.section summary > span:first-child { display: inline-flex; align-items: center; gap: 10px; }
details.section .chev { transition: transform 0.2s; transform: rotate(-90deg); color: var(--muted); }
details.section[open] .chev { transform: none; }
details.section .file-list { padding: 0 12px 12px; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.search-results { margin-bottom: 16px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none !important;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.file-row:hover { border-color: var(--border-strong); }
.file-row.current { border-color: var(--accent); background: var(--accent-soft); }
.file-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--surface); color: var(--muted); flex: none; }
.file-row.audio .file-icon { color: var(--note-4); }
.file-row.video .file-icon { color: var(--note-0); }
.file-row.pdf .file-icon { color: var(--accent); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; font-weight: 550; }
.file-play { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: var(--surface); flex: none; }
.empty-row { padding: 12px; }

/* --- Lecteur ancré -------------------------------------------------------- */

.player-dock {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 24px));
  z-index: 45;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-lg);
  animation: dock-in 0.35s var(--ease);
  overflow: hidden;
}
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 20px); } }
.player-dock::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--spectrum); opacity: 0.8; }
.player-inner { display: flex; flex-direction: column; }
.player-video { width: 100%; max-height: 52vh; background: #000; display: block; }
.player-main { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.player-head { display: flex; align-items: center; gap: 12px; }
.player-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.74rem; flex: none; }
.player-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.player-titles strong { font: 650 0.98rem var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-titles small { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar { display: flex; align-items: center; gap: 12px; }
.play-round { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); cursor: pointer; flex: none; box-shadow: 0 8px 18px -10px var(--accent); }
.player-dock.playing .play-round { background: var(--text); color: var(--surface); box-shadow: none; }
.time { font-variant-numeric: tabular-nums; font-size: 0.8rem; color: var(--muted); min-width: 36px; text-align: center; }
.seek { position: relative; flex: 1; height: 26px; cursor: pointer; touch-action: none; }
.seek::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 999px; background: var(--surface-3); }
.seek-fill { position: absolute; left: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 999px; background: var(--accent); }
.seek-loop { position: absolute; top: 50%; height: 14px; margin-top: -7px; border-radius: 6px; background: color-mix(in srgb, var(--note-4) 35%, transparent); border: 1.5px solid var(--note-4); }
.seek-thumb { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: var(--shadow-sm); }
.player-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.speed, .ab { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.speed button, .ab button { border: none; background: transparent; color: var(--muted); font-weight: 650; font-size: 0.8rem; min-height: 30px; min-width: 38px; padding: 4px 9px; border-radius: 999px; cursor: pointer; display: inline-grid; place-items: center; }
.speed button.active, .ab button.active, .ab button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.ab button.active { color: var(--note-4); }
body.has-player main { padding-bottom: 260px; }
/* Vidéo : vignette dans le coin, pour garder la page visible */
.player-dock.video { left: auto; right: 20px; transform: none; width: min(440px, calc(100% - 24px)); animation-name: dock-in-side; }
@keyframes dock-in-side { from { opacity: 0; transform: translateY(20px); } }
.player-dock.video .player-video { max-height: 34vh; }

/* --- Liseuse --------------------------------------------------------------- */

.reader-head { margin-bottom: 16px; }
.reader-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin-bottom: 4px; }
.reader-toolbar { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 30; display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 14px; flex-wrap: wrap; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.page-input { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.page-input input { width: 64px; min-height: 36px; padding: 6px 8px; text-align: center; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; }
.chapter-select { min-height: 36px; padding: 6px 34px 6px 12px; max-width: 260px; }
.toolbar-spacer { flex: 1; }
.reader-layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.reader.with-panel .reader-layout { grid-template-columns: minmax(0, 1fr) 320px; }
.reader-stage { padding: 0; overflow: auto; display: flex; justify-content: center; min-height: 60vh; background: var(--surface-2); }
.reader-canvas { display: block; background: #fff; box-shadow: var(--shadow); }
.reader-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 50vh; color: var(--muted); }
.reader-panel { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--topbar-h) + 84px); }
.panel-block { padding: 18px; }
.panel-block h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-block h4 { margin: 16px 0 8px; font: 650 0.9rem var(--display); color: var(--text-2); }
.media-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.media-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; font-size: 0.85rem; transition: transform 0.15s var(--ease), border-color 0.2s; }
.media-chip:hover { transform: translateY(-2px); border-color: var(--accent); }
.media-chip strong { font-family: var(--display); }
.media-chip span { color: var(--muted); font-size: 0.78rem; }
.media-chip.video .icon { color: var(--note-0); }
.media-chip.audio .icon { color: var(--note-4); }
.guide-block ul.dots { font-size: 0.92rem; line-height: 1.55; color: var(--text-2); }
.vocab { display: grid; gap: 6px; margin: 0; font-size: 0.88rem; }
.vocab > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); }
.vocab dt { font-style: italic; color: var(--muted); }
.vocab dd { margin: 0; font-weight: 600; }

/* --- Guide de lecture des tablatures ---------------------------------------- */

.guide-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.guide-toc { position: sticky; top: calc(var(--topbar-h) + 16px); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.guide-toc a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-weight: 550; font-size: 0.9rem; text-decoration: none !important; }
.guide-toc a:hover { background: var(--surface-2); color: var(--text); }
.guide-toc a span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); font-size: 0.75rem; font-weight: 700; flex: none; }
.guide-section { margin-bottom: 44px; scroll-margin-top: calc(var(--topbar-h) + 20px); }
.guide-section > h2 { display: flex; align-items: center; gap: 12px; font-size: 1.6rem; margin-bottom: 8px; }
.guide-num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); font-size: 1rem; flex: none; }
.guide-section > .lead { margin-bottom: 18px; max-width: 760px; }
.guide-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.guide-item { padding: 18px 20px; }
.guide-item h3 { font-size: 1.08rem; margin-bottom: 6px; }
.guide-item p { margin: 0; color: var(--text-2); }
.guide-item .tab-card { margin: 14px 0 0; box-shadow: none; }
.figure-table { padding: 8px 12px; margin-bottom: 14px; }
.figure-row { display: grid; grid-template-columns: 1.3fr 1fr 1.4fr 1fr; align-items: center; gap: 10px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.figure-row:last-child { border-bottom: none; }
.figure-row.head { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.figure-row > span { display: inline-flex; align-items: center; gap: 8px; }
.figure-row small { color: var(--muted); font-size: 0.8rem; }
.glyph { width: 34px; height: 44px; flex: none; }
.g-ink { fill: var(--text); }
.g-hollow { fill: none; stroke: var(--text); stroke-width: 2.4; }
.g-stem, .g-flag { fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; }
.g-line { stroke: var(--muted); stroke-width: 1.4; }
.ascii-tab { font-family: var(--mono); background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; margin: 0 0 14px; font-size: 0.95rem; line-height: 1.4; }
.tab-link { fill: none; stroke: var(--text-2); stroke-width: 1.6; }
.tab-link-label { fill: var(--text-2); font-size: 11px; font-weight: 700; text-anchor: middle; font-style: italic; }
.tab-slide { stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; }
.tab-vibrato { fill: none; stroke: var(--text-2); stroke-width: 1.6; }
.tab-ghost circle, .tab-ghost path { opacity: 0.45; stroke-dasharray: 3 2; }
.tab-ghost text { font-size: 10px !important; }
.tab-harmonic path { stroke: rgba(0, 0, 0, 0.5); stroke-width: 1.2; }

/* --- Accords : familles de types ------------------------------------------ */

.chip-groups { display: flex; flex-direction: column; gap: 10px; }
.chip-group { display: flex; flex-direction: column; gap: 6px; }
.chip-group-label { font-size: 0.76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* --- Progressions ----------------------------------------------------------- */

.prog-list { display: flex; flex-wrap: wrap; gap: 8px; }
.prog-list .chip strong { font-size: 0.9rem; }
.prog-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.prog-head h2 { margin-bottom: 4px; }
.prog-head p { margin: 0; }
.prog-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.prog-controls .tab-bpm { display: inline-flex; align-items: center; gap: 6px; }
.bars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.bar-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none !important;
  overflow: hidden;
  transition: transform 0.15s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.bar-card:hover { border-color: var(--border-strong); }
.bar-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transform: translateY(-3px); }
.bar-card small { color: var(--muted); font-weight: 650; font-size: 0.72rem; }
.bar-roman { font: 700 0.95rem var(--display); color: var(--accent); }
.bar-card strong { font: 700 1.5rem var(--display); }
.bar-tones { color: var(--muted); font-size: 0.82rem; }
.bar-color { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; }

/* --- Intervalles ------------------------------------------------------------ */

.interval-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 18px; }
.interval { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.interval header { display: flex; align-items: center; gap: 12px; }
.interval header p { margin: 2px 0 0; }
.interval-label { display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font: 700 1rem var(--display); flex: none; }
.interval-diagram { display: flex; justify-content: center; padding: 8px 0; border-radius: var(--radius); background: var(--surface-2); }
.interval-hint { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text-2); font-size: 0.88rem; }
.interval .actions .btn { min-height: 36px; padding: 6px 14px; font-size: 0.85rem; }

@media (max-width: 860px) {
  .reader.with-panel .reader-layout { grid-template-columns: 1fr; }
  .reader-panel { position: static; }
  .guide-layout { grid-template-columns: minmax(0, 1fr); }
  .prog-controls { width: 100%; }
  .prog-controls .segmented { flex: 1 1 100%; min-width: 0; }
  .guide-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .guide-toc .eyebrow { width: 100%; }
  .bars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-dock, .player-dock.video { bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; right: 12px; width: auto; transform: none; animation-name: dock-in-side; }
  .player-dock.video .player-video { max-height: 30vh; }
  body.has-player main { padding-bottom: 340px; }
}

@media (max-width: 600px) {
  .book-grid { grid-template-columns: 1fr; }
  .book-cover { width: 72px; height: 98px; font-size: 0.74rem; }
  .file-list { grid-template-columns: 1fr; }
  .figure-row { grid-template-columns: 1fr 0.8fr 1.3fr; }
  .figure-row > :last-child { grid-column: 1 / -1; padding-left: 2px; }
  .figure-row.head > :last-child { display: none; }
  .reader-toolbar { top: calc(var(--topbar-h) + 4px); }
  .chapter-select { max-width: 100%; flex: 1 1 100%; order: 5; }
  .speed button { min-width: 34px; padding: 4px 6px; }
}

/* --- Blocs de leçon ----------------------------------------------------------- */

.lesson-toc { padding: 16px 20px; margin-bottom: 24px; }
.lesson-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; }
.lesson-toc li { margin: 3px 0; break-inside: avoid; color: var(--muted); }
.lesson-toc a { color: var(--text-2); font-weight: 550; }
.lesson-toc a:hover { color: var(--accent); }

.objectives { padding: 18px 22px; margin: 0 0 1.6em; border-left: 4px solid var(--level-color); }
.objectives h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin: 0 0 10px; color: var(--text); }
.objectives h2 .icon { color: var(--level-color); }
.objectives h2::before { display: none; }
.objectives ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.objectives li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.98rem; line-height: 1.5; }
.objectives li .icon { color: var(--ok); margin-top: 4px; }

.lesson-h { scroll-margin-top: calc(var(--topbar-h) + 20px); }
.lesson-h3 { font-size: 1.12rem; margin: 1.4em 0 0.5em; color: var(--text); }

ol.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 1.3em; display: grid; gap: 8px; }
ol.steps li { counter-increment: step; position: relative; padding: 10px 14px 10px 50px; border-radius: 12px; background: var(--surface-2); }
ol.steps li::before { content: counter(step); position: absolute; left: 12px; top: 9px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--level-color); color: #fff; font: 700 0.85rem var(--display); }

.callout > div > strong:first-child { display: block; }
.callout p strong { display: inline; margin: 0; font-family: inherit; }
.callout.warn { background: linear-gradient(135deg, color-mix(in srgb, var(--bad) 10%, transparent), transparent 70%), var(--surface); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.callout.warn .callout-icon { background: var(--bad); color: #fff; }
.callout.theory { background: linear-gradient(135deg, color-mix(in srgb, var(--note-4) 14%, transparent), transparent 70%), var(--surface); border-color: color-mix(in srgb, var(--note-4) 35%, transparent); }
.callout.theory .callout-icon { background: var(--note-4); color: #fff; }

.table-wrap { overflow-x: auto; margin: 1.2em 0 1.5em; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.lesson-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; line-height: 1.45; }
.lesson-table caption { text-align: left; padding: 12px 16px 4px; font: 650 0.95rem var(--display); color: var(--text); }
.lesson-table th { text-align: left; padding: 10px 14px; background: var(--surface-2); color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.lesson-table td { padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.lesson-table td:first-child { font-weight: 600; color: var(--text); }
.lesson-table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

.embed { margin: 1.5em 0; padding: 14px; }
.embed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font: 650 0.98rem var(--display); color: var(--text); }
.embed-head > span { display: inline-flex; align-items: center; gap: 8px; }
.embed-link { display: inline-flex; align-items: center; gap: 4px; font: 600 0.85rem var(--font); }
.embed-caption { margin: 10px 2px 0 !important; color: var(--muted); font-size: 0.9rem; }
.chord-embed { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.chord-embed-diagram { padding: 6px; border-radius: var(--radius); background: var(--surface-2); }
.chord-embed-text { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; }
.chord-embed-text h4 { margin: 0; font: 700 1.5rem var(--display); color: var(--text); }
.chord-embed-text h4 small { font: 500 0.9rem var(--font); color: var(--muted); margin-left: 6px; }
.staff-scroll { overflow-x: auto; }
.staff-svg { display: block; }
.staff-line { stroke: var(--text-2); stroke-width: 1.2; }
.staff-clef { fill: none; stroke: var(--text); stroke-width: 3.2; stroke-linecap: round; }
.staff-clef-dot { fill: var(--text); }
.staff-head { stroke: rgba(0, 0, 0, 0.55); stroke-width: 1.2; }
.staff-stem { stroke: var(--text); stroke-width: 1.6; }
.staff-acc { fill: var(--text); font-size: 17px; text-anchor: middle; dominant-baseline: central; }
.staff-label { fill: var(--muted); font-size: 11px; font-weight: 650; text-anchor: middle; }
.staff-note { cursor: pointer; }
.staff-note:hover .staff-head { stroke: var(--accent); stroke-width: 2.4; }

.exercise, .quiz-card { margin: 1.8em 0; padding: 20px; border-top: 4px solid var(--level-color); }
.exercise-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.exercise-head h3 { font-size: 1.15rem; color: var(--text); }
.exercise-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--level-color) 16%, transparent); color: color-mix(in srgb, var(--level-color) 70%, var(--text)); font: 700 0.74rem var(--font); letter-spacing: 0.05em; text-transform: uppercase; }
.exercise-badge.quiz { background: var(--accent-soft); color: var(--accent); }
.exercise-text { font-size: 0.98rem; color: var(--text-2); }
.exercise-text p { margin: 0 0 0.6em; }
.exercise .tab-card { margin: 14px 0 0; box-shadow: none; }
.ladder { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.ladder-label { font: 700 0.78rem var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ladder-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ladder-arrow { color: var(--muted); font-size: 1.2rem; }
.ladder-step { display: inline-flex; align-items: stretch; border-radius: 12px; border: 1px solid var(--border-strong); overflow: hidden; background: var(--surface); transition: border-color 0.2s; }
.ladder-step button { border: none; background: transparent; cursor: pointer; color: var(--text); }
.ladder-play { display: flex; align-items: baseline; gap: 3px; padding: 8px 12px; font: 700 1rem var(--display); }
.ladder-play small { font: 600 0.7rem var(--font); color: var(--muted); }
.ladder-play:hover { background: var(--surface-2); }
.ladder-check { display: grid; place-items: center; width: 38px; border-left: 1px solid var(--border) !important; color: var(--muted) !important; }
.ladder-step.done { border-color: var(--ok); }
.ladder-step.done .ladder-check { background: var(--ok); color: #fff !important; }
.ladder small.muted { font-size: 0.82rem; }

.quiz-list { list-style: none; counter-reset: q; margin: 0 0 14px; padding: 0; display: grid; gap: 14px; }
.quiz-q { counter-increment: q; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid transparent; }
.quiz-q.ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.quiz-q.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.quiz-question { margin: 0 0 10px !important; font-weight: 650; color: var(--text); }
.quiz-question::before { content: counter(q) '. '; color: var(--accent); }
.quiz-choices { display: grid; gap: 6px; }
.quiz-choice { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; font-size: 0.95rem; line-height: 1.4; }
.quiz-choice:hover { border-color: var(--border-strong); }
.quiz-choice input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.quiz-choice.right { border-color: var(--ok); background: var(--ok-soft); }
.quiz-explain { margin: 10px 2px 0 !important; font-size: 0.92rem; color: var(--text-2); }
.quiz-q.ok .quiz-explain::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.quiz-q.bad .quiz-explain::before { content: '✗ '; color: var(--bad); font-weight: 700; }
.quiz-score { font-weight: 650; }

.more { margin: 2.4em 0 1em; }
.more h2 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin: 0 0 14px; color: var(--text); }
.more h2::before { display: none; }
.more h2 .icon { color: var(--accent); }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.more-card { --book-color: var(--accent); display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--radius); font-size: 0.95rem; line-height: 1.4; }
.more-card strong { color: var(--text); font-weight: 650; }
.more-card small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.more-book { display: flex; gap: 12px; align-items: center; color: var(--text); text-decoration: none !important; }
.more-cover { flex: none; width: 44px; height: 58px; border-radius: 3px 7px 7px 3px; padding: 5px; display: flex; align-items: flex-end; background: linear-gradient(160deg, var(--book-color), color-mix(in srgb, var(--book-color) 55%, #000)); color: #fff; font: 700 0.5rem/1.1 var(--display); box-shadow: inset 3px 0 0 rgba(0,0,0,.2); overflow: hidden; }
.more-book:hover strong { color: var(--accent); }
.more-files-head { display: flex; gap: 12px; align-items: center; }
.more-link { flex-direction: row; align-items: center; color: var(--text); text-decoration: none !important; transition: border-color 0.2s, transform 0.2s var(--ease); }
.more-link > span:nth-child(2) { flex: 1; }
.more-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.more-link > .icon:last-child { color: var(--muted); }
.more .media-chip { padding: 6px 10px; }
.tab-staccato { fill: var(--text); }

@media (max-width: 600px) {
  .lesson-toc ol { columns: 1; }
  .exercise, .quiz-card { padding: 16px; }
  .more-grid { grid-template-columns: minmax(0, 1fr); }
  .more-card { min-width: 0; overflow-wrap: anywhere; }
}

/* --- Barre d'onglets mobile ------------------------------------------------- */

@media (max-width: 860px) {
  .mainnav { display: none; }
  .topbar { justify-content: space-between; height: 58px; --topbar-h: 58px; }
  :root { --topbar-h: 58px; }
  .tabbar:not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--glass);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 650;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
  }
  .tabbar a.active { color: var(--accent); background: var(--accent-soft); }
  main { padding-bottom: calc(110px + env(safe-area-inset-bottom)); padding-top: 22px; }

  .login { grid-template-columns: 1fr; gap: 28px; min-height: 0; }
  .login-hero h1 { margin-top: 18px; }
  .login-neck { display: none; }
  .hero { flex-direction: column-reverse; align-items: flex-start; padding: 26px; }
  .hero-progress { align-self: center; }
  .chord-layout, .keys-layout { grid-template-columns: 1fr; }
  .note-picker { grid-template-columns: repeat(6, 1fr); }
  .picker-row { grid-template-columns: 1fr; gap: 8px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 15px; }
  .card { padding: 18px; border-radius: 20px; }
  .journey { flex-wrap: wrap; }
  .journey .btn { width: 100%; }
  .level-head { grid-template-columns: 1fr; gap: 8px; }
  .level-badge { justify-self: start; }
  .path::before { left: 19px; }
  .path-node { width: 40px; height: 40px; font-size: 0.95rem; }
  .path-item > a { gap: 12px; }
  .path-card { padding: 13px 14px; }
  .path-go { display: none; }
  .prose { font-size: 1rem; }
  .tab-head { padding: 12px 14px; }
  .stats { grid-template-columns: 1fr; }
  .stat { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; }
  .stat-icon { margin: 0; }
  .stat strong { font-size: 1.25rem; }
  .pager { grid-template-columns: 1fr; }
  .complete { flex-direction: column; align-items: stretch; }
  .complete .btn { width: 100%; }
  .chord-name { font-size: 2.4rem; }
  .bpm { font-size: 3.8rem; }
  .dial { width: 190px; height: 190px; }
  .string-refs { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile-art { height: 84px; }
  .tile-body { padding: 12px 14px 14px; }
  .tile-body span { display: none; }
  .tile-go { display: none; }
  .build-strip { --cell: 52px; }
  .build-dot { width: 42px; height: 42px; font-size: 0.75rem; }
  .k-legend { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* --- Théorie musicale ---------------------------------------------------------- */

.theory-search { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 0 0 28px; cursor: text; }
.theory-search .icon { color: var(--muted); flex: none; }
.theory-search input { flex: 1; min-width: 0; border: none; background: transparent; font: inherit; font-size: 1.02rem; color: var(--text); outline: none; }
.theory-count { flex: none; font-size: 0.85rem; }
.theory-parts { display: grid; gap: 34px; }
.theory-part-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.theory-part-head h2 { margin: 0 0 4px; font-size: 1.35rem; }
.theory-part-head p { margin: 0; max-width: 70ch; }
.theory-part-num { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--part-color); color: #fff; font: 700 1.1rem var(--display); box-shadow: 0 6px 16px color-mix(in srgb, var(--part-color) 35%, transparent); }
.theory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.theory-card { display: flex; gap: 14px; padding: 16px; color: var(--text); text-decoration: none !important; border-left: 4px solid var(--part-color); transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s; }
.theory-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, var(--shadow-sm)); }
.theory-card[hidden] { display: none; }
.theory-card-num { flex: none; font: 700 0.85rem var(--display); color: color-mix(in srgb, var(--part-color) 75%, var(--text)); min-width: 22px; padding-top: 2px; }
.theory-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.theory-card-body strong { font: 650 1.02rem var(--display); }
.theory-card-body small { color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
.theory-card-meta { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 0.8rem; color: var(--muted); }
@media (max-width: 600px) {
  .theory-part-head { gap: 12px; }
  .theory-part-num { width: 34px; height: 34px; font-size: 1rem; }
}

/* --- Sécurité et famille (réglages) ------------------------------------------- */

.security-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 24px; flex-wrap: wrap; padding: 16px 0; border-top: 1px solid var(--border); }
.security-row:first-of-type { border-top: none; padding-top: 4px; }
.security-row > div:first-child { flex: 1 1 320px; min-width: 0; }
.security-row h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 4px; font-size: 1.02rem; }
.security-row p { margin: 0; }
.security-row .toolbar { margin: 0; }
.security-panel:empty { display: none; }
.security-panel { --level-color: var(--accent); padding: 16px; margin: 0 0 12px; border-radius: var(--radius); background: var(--surface-2); }
.security-panel .steps li { background: var(--surface); }
.sec-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font: 700 0.72rem var(--font); letter-spacing: 0.03em; text-transform: uppercase; vertical-align: middle; }
.sec-badge.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.qr-box { width: 200px; max-width: 100%; margin: 12px 0 8px; padding: 10px; border-radius: 12px; background: #fff; }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-box svg rect[fill="white"], .qr-box svg path { shape-rendering: crispEdges; }
code.secret, .invite-code { font: 700 0.95rem ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text); word-break: break-all; }
.invite-code.big { display: inline-block; margin: 6px 0; font-size: 1.35rem; padding: 6px 14px; }
.invite-code.used { opacity: 0.6; text-decoration: line-through; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.inline-form input { flex: 1 1 200px; min-width: 0; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; }
.code-input { font: 700 1.3rem ui-monospace, SFMono-Regular, Consolas, monospace !important; letter-spacing: 0.25em; text-align: center; max-width: 220px; }
.confirm-pwd { display: grid; gap: 10px; max-width: 420px; }
.confirm-pwd .toolbar, .stack.narrow .toolbar { margin: 0; }
.stack.narrow { max-width: 420px; }
.recovery p { margin: 0 0 10px; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 16px; margin: 0 0 14px; padding-left: 22px; }
.recovery-codes code { font: 700 1rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.invite-card { padding: 16px; margin: 0 0 16px; border-radius: var(--radius); border: 1px dashed var(--accent); background: var(--accent-soft); }
.invite-card p { margin: 0; }
.invite-card .toolbar { margin: 10px 0 0; }
.break { word-break: break-all; }
.admin-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.admin-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); }
.admin-list li > span:first-child { min-width: 0; }
.admin-list .toolbar { margin: 0; gap: 6px; }
.btn-sm { padding: 6px 12px !important; font-size: 0.85rem !important; min-height: 0 !important; }
.btn.danger { color: var(--bad) !important; }
.btn.danger:hover { border-color: var(--bad) !important; }

/* --- Notes jouées (bouton Écouter) -------------------------------------------- */

.np { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.np[hidden] { display: none; }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.np-title { display: inline-flex; align-items: center; gap: 7px; font: 700 0.78rem var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.np-speed { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.np-speed button { border: none; background: transparent; padding: 4px 12px; border-radius: 999px; font: 600 0.8rem var(--font); color: var(--muted); cursor: pointer; }
.np-speed button.active { background: var(--text); color: var(--surface); }
.np-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.np-note { display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 10px; border-radius: 12px; border: 2px solid transparent; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; transition: transform 0.15s var(--ease), border-color 0.15s, box-shadow 0.15s; }
.np-note:hover { border-color: var(--border-strong); }
.np-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.np-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.np-line { display: flex; align-items: center; gap: 6px; }
.np-line strong { font: 700 1.05rem var(--display); line-height: 1.1; }
.np-role { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); font: 700 0.72rem var(--font); color: var(--muted); white-space: nowrap; }
.np-note small { font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.np-note.active { border-color: var(--accent); transform: translateY(-3px) scale(1.06); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent); }
.np-note.active .np-role { background: var(--accent); color: #fff; }
.np-board { margin-top: 12px; overflow-x: auto; }
.np-hint { margin: 10px 0 0; font-size: 0.82rem; color: var(--muted); }
.np-linked .fb-marker, .np-board .fb-marker { pointer-events: auto; cursor: pointer; }
/* L'animation d'apparition (marker-in) reste en première position pour ne pas être rejouée quand la note s'éteint ;
   l'agrandissement de la note jouée s'ajoute par-dessus. */
.fb-marker.fb-playing { animation: marker-in 0.35s var(--ease) both, np-pop 0.18s var(--ease) both; filter: drop-shadow(0 0 6px var(--accent)); }
@keyframes np-pop { from { transform: scale(1); } to { transform: scale(1.35); } }
.fb-marker.fb-playing circle:first-of-type, .fb-marker.fb-playing .fb-outline { stroke: var(--accent); stroke-width: 3px; }
@media (prefers-reduced-motion: reduce) {
  .np-note.active { transform: none; }
  .fb-marker.fb-playing { transform: none; }
}
.diagram-extend { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text-2); font-size: 0.86rem; line-height: 1.45; }
.diagram-extend .icon { flex: none; margin-top: 2px; color: var(--accent); }
.diagram-extend[hidden] { display: none; }
