/* Piano virtuel Musiclic - module autonome */

.mlp-page-intro {
  margin-bottom: 18px;
}

.mlp-after-piano-title {
  margin-top: 30px;
}

.mlp-credit {
  color: #666;
  font-size: 13px;
}

.mlp {
  --mlp-blue: #2f6fb5;
  --mlp-blue-soft: #eef5fb;
  --mlp-border: #d7dce1;
  --mlp-text: #202428;
  --mlp-muted: #687078;
  --mlp-panel: #f7f8f9;
  --mlp-dark: #24282d;
  margin: 22px 0 10px;
  color: var(--mlp-text);
  font-size: 15px;
}

.mlp *,
.mlp *::before,
.mlp *::after {
  box-sizing: border-box;
}

.mlp button,
.mlp select,
.mlp input {
  font: inherit;
}

.mlp button,
.mlp select {
  min-height: 38px;
}

.mlp button {
  cursor: pointer;
}

.mlp button:disabled {
  cursor: default;
  opacity: .45;
}

.mlp button:focus-visible,
.mlp select:focus-visible,
.mlp input:focus-visible {
  outline: 2px solid var(--mlp-blue);
  outline-offset: 2px;
}

.mlp-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border: 1px solid var(--mlp-border);
  background: #fff;
}

.mlp-audio-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 170px;
  color: var(--mlp-muted);
  white-space: nowrap;
}

.mlp-state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a8afb6;
}

.mlp-audio-state.is-ready .mlp-state-dot {
  background: #4f8a60;
}

.mlp-audio-state.is-error .mlp-state-dot {
  background: #b24a4a;
}

.mlp-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 16px;
}

.mlp-field-inline,
.mlp-volume,
.mlp-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.mlp-field-inline span,
.mlp-volume span {
  color: #50575e;
  font-size: 13px;
}

.mlp-field-inline select {
  min-width: 120px;
  padding: 5px 8px;
  border: 1px solid #cfd5db;
  background: #fff;
  color: #202428;
}

.mlp-check {
  min-height: 38px;
  cursor: pointer;
  color: #343a40;
  font-size: 13px;
}

.mlp-check input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.mlp-volume input[type="range"] {
  width: 105px;
}

.mlp-teacher {
  margin-top: 12px;
  border: 1px solid var(--mlp-border);
  background: #fff;
}

.mlp-teacher-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px 0;
}

.mlp-teacher h3 {
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 1.25;
  color: #23282d;
}

.mlp-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mlp-mode-tab {
  padding: 7px 12px;
  border: 1px solid #ccd2d8;
  background: #fff;
  color: #333a40;
}

.mlp-mode-tab.is-active {
  border-color: var(--mlp-blue);
  background: var(--mlp-blue-soft);
  color: #245b95;
  font-weight: 600;
}

.mlp-teacher-screen {
  margin: 14px 16px 0;
  min-height: 78px;
  padding: 15px 16px;
  border-left: 4px solid var(--mlp-blue);
  background: #f5f7f9;
}

.mlp-teacher-main {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.mlp-teacher-sub {
  margin-top: 5px;
  color: #5f6770;
  line-height: 1.45;
}

.mlp-teacher-screen.is-success {
  border-left-color: #4f8a60;
  background: #f3f8f4;
}

.mlp-teacher-screen.is-error {
  border-left-color: #b24a4a;
  background: #fbf4f4;
}

.mlp-mode-panel {
  padding: 12px 16px 15px;
}

.mlp-panel-note {
  margin: 0;
  color: #69717a;
  font-size: 13px;
}

.mlp-exercise-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mlp-exercise-row-wrap {
  flex-wrap: wrap;
}

.mlp-exercise-row label {
  margin: 0;
  color: #444b52;
  font-size: 13px;
  font-weight: 600;
}

.mlp-exercise-row select {
  padding: 5px 9px;
  border: 1px solid #cfd5db;
  background: #fff;
}

.mlp-primary-btn {
  padding: 7px 14px;
  border: 1px solid var(--mlp-blue);
  background: var(--mlp-blue);
  color: #fff;
  font-weight: 600;
}

.mlp-primary-btn:hover {
  background: #285f9b;
}

.mlp-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.mlp-progress-step {
  min-width: 30px;
  padding: 5px 8px;
  border: 1px solid #d5dae0;
  background: #fff;
  color: #69717a;
  text-align: center;
  font-size: 12px;
}

.mlp-progress-step.is-done {
  border-color: #87a993;
  background: #f1f7f3;
  color: #326441;
  font-weight: 600;
}

.mlp-progress-step.is-current {
  border-color: var(--mlp-blue);
  color: #245b95;
  font-weight: 600;
}

.mlp-recorder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--mlp-border);
  background: #fff;
}

.mlp-recorder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mlp-recorder button {
  padding: 7px 12px;
  border: 1px solid #cbd1d6;
  background: #fff;
  color: #2f353a;
}

.mlp-recorder button:not(:disabled):hover {
  background: #f3f5f6;
}

.mlp-record-btn.is-recording {
  border-color: #b54a4a;
  background: #fff7f7;
  color: #973b3b;
}

.mlp-record-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: #b54747;
  vertical-align: 1px;
}

.mlp-recorder-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #626a72;
  font-size: 13px;
  white-space: nowrap;
}

#mlp-record-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #333a40;
}

.mlp-sequence {
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--mlp-border);
  border-top: 0;
  background: #fafbfb;
  color: #555d64;
}

.mlp-sequence-label {
  font-weight: 600;
  color: #343a40;
}

.mlp-sequence-note {
  display: inline-block;
  margin: 1px 3px 1px 0;
  padding: 2px 5px;
  border: 1px solid #d3d8dd;
  background: #fff;
  color: #30363b;
}

.mlp-keyboard-shell {
  margin-top: 12px;
  border: 1px solid #bec4ca;
  background: var(--mlp-dark);
}

.mlp-keyboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 13px;
  color: #f5f6f7;
}

.mlp-keyboard-heading > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

#mlp-keyboard-range {
  color: #bfc5ca;
  font-size: 12px;
}

.mlp-pc-octave {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d3d7db;
  font-size: 12px;
}

.mlp-pc-octave button {
  min-width: 31px;
  min-height: 31px;
  padding: 2px 8px;
  border: 1px solid #5d646b;
  background: #30353a;
  color: #fff;
}

.mlp-pc-octave strong {
  min-width: 61px;
  text-align: center;
  color: #fff;
  font-weight: 600;
}

.mlp-keyboard-wrap {
  padding: 0 10px 10px;
}

.mlp-keyboard {
  position: relative;
  height: 235px;
  overflow: hidden;
  border: 1px solid #121416;
  background: #111417;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mlp-key {
  position: absolute;
  top: 0;
  margin: 0;
  padding: 0;
  border-radius: 0;
  font-family: Arial, Helvetica, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mlp-key-white {
  z-index: 1;
  height: 100%;
  border: 1px solid #999fa5;
  border-top: 0;
  background: #fafafa;
  color: #252a2f;
}

.mlp-key-white:hover {
  background: #f1f3f4;
}

.mlp-key-black {
  z-index: 3;
  height: 62%;
  border: 1px solid #0f1113;
  border-top: 0;
  background: #22262a;
  color: #f8f8f8;
}

.mlp-key-black:hover {
  background: #171a1d;
}

.mlp-key.is-active.mlp-key-white,
.mlp-key.is-playback.mlp-key-white,
.mlp-key.is-guide.mlp-key-white {
  background: #dceaf7;
}

.mlp-key.is-active.mlp-key-black,
.mlp-key.is-playback.mlp-key-black,
.mlp-key.is-guide.mlp-key-black {
  background: #315f8c;
}

.mlp-key.is-error.mlp-key-white {
  background: #f5dddd;
}

.mlp-key.is-error.mlp-key-black {
  background: #7e3434;
}

.mlp-key-label,
.mlp-key-shortcut {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
}

.mlp-key-white .mlp-key-label {
  bottom: 10px;
  color: #4a5157;
  font-size: 11px;
}

.mlp-key-black .mlp-key-label {
  bottom: 8px;
  color: #e7eaed;
  font-size: 10px;
}

.mlp-key-shortcut {
  display: none;
}

.mlp.show-shortcuts .mlp-key-shortcut {
  display: block;
}

.mlp-key-white .mlp-key-shortcut {
  bottom: 32px;
  color: #7a8188;
  font-size: 10px;
  font-weight: 700;
}

.mlp-key-black .mlp-key-shortcut {
  bottom: 27px;
  color: #c5cbd0;
  font-size: 9px;
  font-weight: 700;
}

.mlp.hide-note-labels .mlp-key-label {
  display: none;
}

.mlp-keyboard-help {
  padding: 8px 12px 10px;
  color: #bec4ca;
  font-size: 11px;
  line-height: 1.4;
}

.mlp-notice {
  margin-top: 9px;
  color: #6b737b;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .mlp-topline,
  .mlp-teacher-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .mlp-settings {
    justify-content: flex-start;
  }

  .mlp-mode-tabs {
    width: 100%;
  }

  .mlp-mode-tab {
    flex: 1 1 auto;
  }

  .mlp-keyboard {
    height: 220px;
  }
}

@media (max-width: 640px) {
  .mlp {
    font-size: 14px;
  }

  .mlp-topline,
  .mlp-teacher-head,
  .mlp-mode-panel,
  .mlp-recorder,
  .mlp-sequence {
    padding-left: 10px;
    padding-right: 10px;
  }

  .mlp-settings {
    width: 100%;
    gap: 8px 12px;
  }

  .mlp-field-inline,
  .mlp-volume {
    flex: 1 1 150px;
    justify-content: space-between;
  }

  .mlp-field-inline select {
    min-width: 108px;
  }

  .mlp-volume input[type="range"] {
    width: 92px;
  }

  .mlp-teacher-screen {
    margin-left: 10px;
    margin-right: 10px;
    min-height: 92px;
    padding: 12px;
  }

  .mlp-teacher-main {
    font-size: 16px;
  }

  .mlp-exercise-row {
    align-items: stretch;
    flex-direction: column;
  }

  .mlp-exercise-row select,
  .mlp-exercise-row button {
    width: 100%;
  }

  .mlp-recorder {
    align-items: stretch;
    flex-direction: column;
  }

  .mlp-recorder-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mlp-recorder-actions button {
    width: 100%;
  }

  .mlp-recorder-info {
    justify-content: space-between;
  }

  .mlp-keyboard-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .mlp-pc-octave {
    width: 100%;
    justify-content: flex-end;
  }

  .mlp-keyboard-wrap {
    padding-left: 5px;
    padding-right: 5px;
  }

  .mlp-keyboard {
    height: 190px;
  }

  .mlp-key-white .mlp-key-label {
    bottom: 7px;
    font-size: 9px;
  }

  .mlp-key-black .mlp-key-label {
    bottom: 6px;
    font-size: 8px;
  }

  .mlp-keyboard-help {
    display: none;
  }
}

@media (max-width: 420px) {
  .mlp-mode-tab {
    flex-basis: 45%;
  }

  .mlp-keyboard {
    height: 176px;
  }

  .mlp-pc-octave span {
    margin-right: auto;
  }
}

/* V1.2 - double nom des touches noires : bémol puis dièse, empilés en bas */
.mlp-key-black .mlp-key-label-flat {
  top: auto;
  bottom: 22px;
  color: #f2f4f5;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
}

.mlp-key-black .mlp-key-label-sharp {
  top: auto;
  bottom: 8px;
  color: #e7eaed;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
}

/* Le raccourci clavier reste au-dessus des deux noms de note. */
.mlp-key-black .mlp-key-shortcut {
  bottom: 42px;
}

.mlp-export-status {
  max-width: 220px;
  color: #5f6770;
  white-space: normal;
  line-height: 1.3;
}

@media (max-width: 640px) {
  .mlp-key-black .mlp-key-label-flat {
    top: auto;
    bottom: 18px;
    font-size: 7px;
  }

  .mlp-key-black .mlp-key-label-sharp {
    bottom: 6px;
    font-size: 7px;
  }

  .mlp-key-black .mlp-key-shortcut {
    bottom: 34px;
  }

  .mlp-export-status {
    grid-column: 1 / -1;
    max-width: none;
  }
}

/* V1.3 - interface stable : les messages du mode libre ne déplacent plus le piano. */
.mlp-teacher-screen {
  height: 108px;
  min-height: 108px;
  overflow-y: auto;
}

/* La synthèse de l'enregistrement ne doit pas non plus repousser le clavier. */
.mlp-sequence {
  height: 46px;
  min-height: 46px;
  overflow-y: auto;
}

/* Couche MIDI */
.mlp-midi-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mlp-midi-button {
  min-height: 34px !important;
  padding: 5px 10px;
  border: 1px solid #cfd5db;
  background: #fff;
  color: #343a40;
}

.mlp-midi-button:not(:disabled):hover {
  background: #f3f5f6;
}

.mlp-midi-button.is-connected {
  border-color: #6f9d7c;
  background: #f2f7f3;
  color: #326441;
  font-weight: 600;
}

.mlp-midi-input {
  max-width: 190px;
  min-height: 34px !important;
  padding: 4px 7px;
  border: 1px solid #cfd5db;
  background: #fff;
}

.mlp-midi-status {
  max-width: 180px;
  overflow: hidden;
  color: #626a72;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .mlp-teacher-screen {
    height: 126px;
    min-height: 126px;
  }
}

@media (max-width: 640px) {
  .mlp-teacher-screen {
    height: 152px;
    min-height: 152px;
  }

  .mlp-sequence {
    height: 58px;
    min-height: 58px;
  }

  .mlp-midi-control {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .mlp-midi-status {
    max-width: 220px;
  }
}

@media (max-width: 420px) {
  .mlp-teacher-screen {
    height: 170px;
    min-height: 170px;
  }

  .mlp-midi-input {
    max-width: 170px;
  }
}

/* V1.4 - portée VexFlow intégrée au mode pédagogique */
.mlp-teacher-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 14px;
  padding: 14px 16px 16px;
}

.mlp-teacher-content {
  min-width: 0;
}

.mlp-teacher-body .mlp-teacher-screen {
  margin: 0;
}

.mlp-teacher-body .mlp-mode-panel {
  min-height: 58px;
  padding: 12px 0 0;
}

.mlp-score-panel {
  min-width: 0;
  border: 1px solid #cfd5db;
  background: #fbfcfd;
}

.mlp-score-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px 4px;
  border-bottom: 1px solid #e2e6ea;
  color: #343a40;
}

.mlp-score-head > strong {
  font-size: 13px;
  font-weight: 600;
}

.mlp-score-spelling {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #687078;
  font-size: 11px;
}

.mlp-score-spelling button {
  min-width: 27px;
  min-height: 27px;
  padding: 2px 6px;
  border: 1px solid #c8ced4;
  background: #fff;
  color: #343a40;
  font-weight: 600;
}

.mlp-score-spelling button.is-active {
  border-color: var(--mlp-blue);
  background: var(--mlp-blue-soft);
  color: #245b95;
}

.mlp-score {
  width: 100%;
  height: 142px;
  overflow: hidden;
  background: #fff;
}

.mlp-score svg {
  display: block;
  max-width: 100%;
}

.mlp-score-caption {
  min-height: 28px;
  padding: 4px 8px 6px;
  border-top: 1px solid #edf0f2;
  color: #4e565d;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.mlp-score-unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 10px;
  color: #7a8188;
  text-align: center;
  font-size: 12px;
}

@media (max-width: 900px) {
  .mlp-teacher-body {
    grid-template-columns: 1fr;
  }

  .mlp-score-panel {
    width: 100%;
  }

  .mlp-score {
    height: 142px;
  }
}

@media (max-width: 640px) {
  .mlp-teacher-body {
    gap: 10px;
    padding: 10px;
  }

  .mlp-teacher-body .mlp-mode-panel {
    padding-left: 0;
    padding-right: 0;
  }

  .mlp-score-head {
    flex-wrap: wrap;
  }
}

/* V1.5 - priorité au piano : barre supérieure compacte et mode pédagogique sous l'instrument. */
@media (min-width: 901px) {
  .mlp-topline {
    gap: 10px;
    padding: 8px 12px;
  }

  .mlp-audio-state {
    min-width: 112px;
    font-size: 13px;
  }

  .mlp-settings {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px 10px;
    min-width: 0;
  }

  .mlp-field-inline,
  .mlp-volume,
  .mlp-check,
  .mlp-midi-control {
    flex: 0 0 auto;
  }

  .mlp-field-inline select {
    min-width: 108px;
  }

  .mlp-volume input[type="range"] {
    width: 82px;
  }

  .mlp-midi-control {
    gap: 5px;
  }

  .mlp-midi-status {
    max-width: 112px;
  }
}

/* Le mode pédagogique vient après le piano : séparation un peu plus marquée. */
.mlp-keyboard-shell + .mlp-notice {
  margin-bottom: 12px;
}

.mlp-notice + .mlp-teacher {
  margin-top: 12px;
}


/* V1.6 - métronome simple : pulsation régulière de charleston, sans accent de mesure. */
.mlp-metronome {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-left: 4px;
  padding-left: 11px;
  border-left: 1px solid #dde1e5;
}

.mlp-metronome-toggle {
  white-space: nowrap;
}

.mlp-metronome-toggle.is-active {
  border-color: #7b9fc4;
  background: #eef5fb;
  color: #245b95;
  font-weight: 600;
}

.mlp-metronome-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #a8afb6;
  vertical-align: 1px;
}

.mlp-metronome-toggle.is-active .mlp-metronome-dot {
  background: #4f8a60;
}

.mlp-metronome-bpm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #4f575e;
  font-size: 12px;
  white-space: nowrap;
}

.mlp-metronome-bpm span {
  min-width: 49px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mlp-metronome-bpm input[type="range"] {
  width: 112px;
  margin: 0;
}

@media (max-width: 900px) {
  .mlp-metronome {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .mlp-metronome {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .mlp-metronome-bpm {
    justify-content: flex-end;
    min-height: 38px;
  }

  .mlp-metronome-bpm input[type="range"] {
    width: min(150px, 48vw);
  }
}

/* V1.7 - barre d'enregistrement compacte sur une seule ligne sur ordinateur. */
@media (min-width: 901px) {
  .mlp-recorder {
    gap: 10px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .mlp-recorder-actions {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }

  .mlp-recorder-actions > button {
    flex: 0 0 auto;
    padding-left: 10px;
    padding-right: 10px;
    white-space: nowrap;
  }

  .mlp-metronome {
    flex: 0 0 auto;
    gap: 6px;
    margin-left: 1px;
    padding-left: 7px;
  }

  .mlp-metronome-toggle {
    padding-left: 9px !important;
    padding-right: 9px !important;
  }

  .mlp-metronome-bpm {
    gap: 5px;
  }

  .mlp-metronome-bpm span {
    min-width: 46px;
  }

  .mlp-metronome-bpm input[type="range"] {
    width: 76px;
  }

  .mlp-recorder-info {
    flex: 0 0 auto;
    gap: 9px;
  }
}

/* Version finale - contenu explicatif sous le piano. */
.mlp-guide {
  margin: 0 0 28px;
  color: #2d3338;
  line-height: 1.65;
}

.mlp-guide-lead {
  margin: 0 0 22px;
  font-size: 16px;
  line-height: 1.65;
}

.mlp-guide h3 {
  margin: 24px 0 8px;
  padding: 0;
  color: #23282d;
  font-size: 20px;
  line-height: 1.35;
}

.mlp-guide h4 {
  margin: 18px 0 6px;
  padding: 0;
  color: #30363b;
  font-size: 17px;
  line-height: 1.4;
}

.mlp-guide p {
  margin-top: 0;
  margin-bottom: 12px;
}

.mlp-guide-summary {
  margin: 22px 0 18px;
  padding: 13px 15px;
  border-left: 4px solid #2f6fb5;
  background: #f5f7f9;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .mlp-guide-lead {
    font-size: 15px;
  }

  .mlp-guide h3 {
    font-size: 19px;
  }
}

/* V1.10 - mode découverte visiteurs : Do, Fa et Sol restent accessibles. */
.mlp-visitor-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 3px solid #9aa5ae;
  background: #f7f8f9;
  color: #626a72;
  font-size: 12px;
  line-height: 1.4;
}

.mlp select option:disabled {
  color: #8c939a;
}
