@font-face { font-family: 'Bravura'; src: url('../fonts/bravura.woff2') format('woff2'); font-display: block; }

:root {
  --bg: #f7f5f0; --panel: #ffffff; --ink: #1f1d1a; --muted: #6b665d; --line: #e3ded3;
  --accent: #8a3b2e; --accent-ink: #fff; --soft: #f1ece2;
  --ok: #2e7d4f; --ko: #c0392b; --ok-bg: #e5f3ea; --ko-bg: #fbe9e7;
  --st-acquis: #2e6fa8; --st-valide: #2e7d4f; --st-encours: #c58a1b; --st-avoir: #b9b3a7;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1916; --panel: #24221e; --ink: #ece7dd; --muted: #a39d92; --line: #3a3731;
    --accent: #d9826f; --accent-ink: #1a1916; --soft: #2d2a25;
    --ok: #5cc48a; --ko: #ef7a6c; --ok-bg: #1f3428; --ko-bg: #3b2320;
    --st-acquis: #6aa8e0; --st-valide: #5cc48a; --st-encours: #e2b048; --st-avoir: #6b665d;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1916; --panel: #24221e; --ink: #ece7dd; --muted: #a39d92; --line: #3a3731;
  --accent: #d9826f; --accent-ink: #1a1916; --soft: #2d2a25;
  --ok: #5cc48a; --ko: #ef7a6c; --ok-bg: #1f3428; --ko-bg: #3b2320;
  --st-acquis: #6aa8e0; --st-valide: #5cc48a; --st-encours: #e2b048; --st-avoir: #6b665d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2em 0 .4em; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 0; }
kbd { font: 11px/1 ui-monospace, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; color: var(--muted); background: var(--soft); }
.muted { color: var(--muted); }

/* --- structure --- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { white-space: nowrap; font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--ink); }
.brand span { color: var(--accent); font-weight: 600; }
.global { margin-left: auto; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 8px; min-width: 0; }
.global .bar { width: 120px; }
.menu-btn { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--ink); cursor: pointer; }
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 53px); }
.nav { border-right: 1px solid var(--line); padding: 12px 8px; background: var(--panel); position: sticky; top: 53px; height: calc(100vh - 53px); overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .95rem; }
.nav a small { margin-left: auto; color: var(--muted); }
.nav a:hover { background: var(--soft); }
.nav a.on { background: var(--soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }
.ic { display: inline-block; width: 1.4em; text-align: center; }
.ic.big { font-size: 1.6rem; width: auto; }
.main { padding: 20px 28px 60px; max-width: 980px; width: 100%; min-width: 0; }
.crumb { margin: 0; font-size: .85rem; color: var(--muted); }
.lead { color: var(--muted); max-width: 70ch; }

@media (max-width: 760px) {
  .menu-btn { display: block; }
  .layout { grid-template-columns: 1fr; }
  .nav { display: none; position: fixed; inset: 53px 0 0 0; z-index: 4; height: auto; }
  body.nav-open .nav { display: block; }
  .main { padding: 16px; }
  .global { font-size: .75rem; }
  .global .bar { width: 50px; }
}

/* --- éléments --- */
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; background: var(--st-valide); transition: width .3s; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .7; }
.btn.danger { color: var(--ko); }
.btn.good { background: var(--ok-bg); border-color: var(--ok); }
.btn.bad { background: var(--ko-bg); border-color: var(--ko); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.tag { font-size: .7rem; font-weight: 500; padding: 1px 7px; border-radius: 99px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; border-top: 4px solid var(--c); }
.stat b { display: block; font-size: 1.6rem; }
.stat span { font-size: .8rem; color: var(--muted); }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.st-acquis { --c: var(--st-acquis); } .st-valide { --c: var(--st-valide); } .st-encours { --c: var(--st-encours); } .st-avoir { --c: var(--st-avoir); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 10px; }
.card:hover { border-color: var(--accent); }
.card-h { display: flex; align-items: center; gap: 10px; }
.mini { list-style: none; margin: 0; padding: 0; font-size: .85rem; color: var(--muted); }
.mini li { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; transform: translateY(1px); }
.tools { margin-top: 30px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.tools summary { cursor: pointer; font-weight: 600; }

.comps { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.comp { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.comp-h { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.pill { font-size: .75rem; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--c); color: var(--c); white-space: nowrap; font-weight: 600; }
.exs { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.ex { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--soft); text-decoration: none; color: var(--ink); flex-wrap: wrap; }
.ex:hover { outline: 1px solid var(--accent); }
.ex > span:first-child { flex: 1; min-width: 180px; }
.ok-mark { color: var(--ok); font-weight: 700; }
.manual { font-size: .85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.meter { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.meter i { width: 6px; height: 12px; border-radius: 2px; background: var(--line); }
.meter i.g { background: var(--ok); } .meter i.r { background: var(--ko); }
.meter.big i { width: 8px; height: 16px; }

/* --- cours --- */
.lesson { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 22px 18px; line-height: 1.6; }
.lesson h3 { font-size: 1.2rem; margin: 1.3em 0 .4em; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.lesson h4 { margin: 1em 0 .3em; }
.lesson table { border-collapse: collapse; margin: 8px 0; font-size: .92rem; display: block; overflow-x: auto; max-width: 100%; }
.lesson th, .lesson td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; vertical-align: top; }
.lesson th { background: var(--soft); }
.lesson .tip, .lesson .warn { border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.lesson .tip { background: var(--ok-bg); border-left: 4px solid var(--ok); }
.lesson .warn { background: var(--ko-bg); border-left: 4px solid var(--ko); }
.lesson .tip::before { content: '💡 '; } .lesson .warn::before { content: '⚠️ '; }

/* --- exercices --- */
.ex-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ex-meta { display: flex; gap: 12px; align-items: center; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.sess { font-weight: 600; color: var(--ink); }
.help { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.q { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 10px; }
.prompt { font-size: 1.15rem; margin-bottom: 10px; }
.staff-wrap { overflow-x: auto; padding: 4px 0; color: var(--ink); }
.staff-wrap svg, .choice svg, .sol svg { display: block; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.choices.many { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.choices.wide { grid-template-columns: 1fr; }
.choice { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); font: inherit; cursor: pointer; text-align: left; min-height: 46px; }
.choice:hover { border-color: var(--accent); }
.choice span { flex: 1; min-width: 0; }
.choice.small { min-height: 38px; padding: 6px 10px; justify-content: center; }
.choice.right { background: var(--ok-bg); border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok) inset; }
.choice.wrong { background: var(--ko-bg); border-color: var(--ko); }
.feedback { margin-top: 12px; border-radius: 8px; }
.feedback.good, .feedback.bad { padding: 10px 14px; }
.feedback.good { background: var(--ok-bg); } .feedback.bad { background: var(--ko-bg); }
.feedback.good > b { color: var(--ok); } .feedback.bad > b { color: var(--ko); }
.explain { margin-top: 4px; }
.sol { margin-top: 6px; overflow-x: auto; }
.auto { font-size: .85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin-top: 10px; }
.seq-info { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.seq-info span { margin-right: auto; color: var(--muted); }
.tap-ctl { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 10px 0; font-size: .9rem; }
.tap-ctl input[type=range] { vertical-align: middle; }
.tap-pad { width: 100%; height: 120px; border-radius: 14px; border: 2px dashed var(--line); background: var(--soft); color: var(--muted); font: 700 1.6rem system-ui, sans-serif; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: manipulation; user-select: none; }
.tap-pad small { font-size: .8rem; font-weight: 400; }
.tap-pad:not(:disabled) { border-color: var(--accent); color: var(--ink); }
.tap-pad.hit { background: var(--accent); color: var(--accent-ink); }

/* --- micro / accordeur --- */
.mic-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; background: var(--soft); }
.or { text-align: center; font-size: .85rem; margin: 6px 0; }
.tuner { max-width: 420px; margin: 10px auto; text-align: center; }
.tn-note { font-size: 2.6rem; font-weight: 800; line-height: 1.1; min-height: 1.1em; }
.tuner.in-tune .tn-note { color: var(--ok); }
.tuner.near .tn-note { color: var(--st-encours); }
.tuner.idle .tn-note, .tuner.idle .tn-needle { opacity: .35; }
.tn-gauge { position: relative; height: 26px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); margin-top: 6px; overflow: hidden; }
.tn-zone { position: absolute; left: 35%; width: 30%; top: 0; bottom: 0; background: var(--ok-bg); }
.tn-center { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--ok); }
.tn-needle { position: absolute; left: 50%; top: 2px; bottom: 2px; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--accent); transition: left .08s linear; }
.tn-scale { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); }
.tn-info { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); margin-top: 2px; }
.tn-level { width: 80px; height: 6px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; flex: none; }
.tn-level i { display: block; height: 100%; width: 0; background: var(--ok); }

/* --- modes de travail --- */
.mode { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.mode button { display: flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); padding: 5px 10px; font: inherit; font-size: .85rem; cursor: pointer; }
.mode button + button { border-left: 1px solid var(--line); }
.mode button.on { background: var(--soft); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.ex.off { opacity: .55; }
.ex.off .tag { font-size: .75rem; }
.mode-note { font-size: .9rem; }
.sync-badge { text-decoration: none; }
.sync-form label { display: block; margin: 6px 0; }
.sync-form input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); width: min(100%, 280px); display: block; margin-top: 2px; }
/* pulsation visuelle de la lecture rythmique */
.beat { height: 56px; width: 56px; margin: 0 auto 10px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: var(--muted); transition: background .12s, color .12s; }
.beat.on { background: var(--soft); color: var(--ink); }
.beat.on.first { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.beat.count { border-style: dashed; }
@media (max-width: 760px) {
  .top { gap: 10px; padding: 8px 12px; }
  .mode button { padding: 5px 8px; }
  .mode button span { display: none; }
  .global .bar { display: none; }
}
