:root {
  color-scheme: light;
  --tool-bg: #f5f1e9;
  --tool-card: #fffdf8;
  --tool-panel: #f1ece3;
  --tool-text: #1f2933;
  --tool-muted: #6b7280;
  --tool-border: #d8d0c4;
  --tool-accent: #2f6b5d;
  --tool-accent-soft: #dfeee9;
  --tool-danger: #9b4a45;
  --tool-focus: #194f9b;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--tool-bg); }
body {
  min-height: 100%; margin: 0; background: var(--tool-bg); color: var(--tool-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, select, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--tool-focus) 62%, transparent);
  outline-offset: 3px;
}

.tool-wrap { width: min(860px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0 42px; }
.tool-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tool-brand { display: block; width: auto; height: 26px; object-fit: contain; }
.tool-kind { color: var(--tool-muted); font-size: .75rem; font-weight: 750; text-align: right; }
.tool-card { min-width: 0; padding: 18px; overflow: hidden; border: 1px solid var(--tool-border); border-top: 4px solid var(--tool-accent); border-radius: 24px; background: var(--tool-card); box-shadow: 0 12px 32px rgba(31,41,51,.08); }
.tool-intro { margin: 0 0 16px; color: var(--tool-muted); font-size: .86rem; line-height: 1.5; }
.tool-footer { margin-top: 12px; color: var(--tool-muted); font-size: .75rem; line-height: 1.45; text-align: center; }
.tool-error { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #fff0ee; color: #7b3734; font-size: .82rem; line-height: 1.45; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Accordeur */
.tuner-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.tuner-mode button, .tool-choice {
  min-height: 52px; border: 1px solid var(--tool-border); border-radius: 15px; background: #fff; color: var(--tool-text); font-weight: 900;
}
.tuner-mode button.on, .tool-choice.on { border-color: var(--tool-accent); background: var(--tool-accent); color: #fff; }
.tool-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tool-field { display: grid; gap: 6px; }
.tool-field label { color: var(--tool-muted); font-size: .75rem; font-weight: 900; }
.tool-field select { width: 100%; min-height: 49px; padding: 0 10px; border: 1px solid var(--tool-border); border-radius: 14px; background: #fff; color: var(--tool-text); }
.tool-info { margin-bottom: 12px; padding: 10px 12px; border-radius: 14px; background: #f3eee6; color: var(--tool-muted); font-size: .8rem; line-height: 1.45; }
.tuner-panel { min-height: 300px; display: grid; align-content: center; justify-items: center; padding: 22px 14px; border: 2px solid var(--tool-border); border-radius: 30px; background: var(--tool-panel); text-align: center; transition: background .1s, border-color .1s; }
.tuner-panel.low { background: #dce8f1; }
.tuner-panel.high { background: #f3e2c6; }
.tuner-panel.ok { border-color: var(--tool-accent); background: #dceee5; }
.tuner-kicker { min-height: 20px; color: var(--tool-muted); font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.tuner-note-line { min-height: 118px; display: flex; align-items: flex-start; justify-content: center; gap: 4px; }
.tuner-note { font-size: clamp(5rem, 22vw, 8.5rem); font-weight: 950; line-height: .88; letter-spacing: -.05em; }
.tuner-octave { margin-top: 8px; color: var(--tool-muted); font-size: clamp(1.5rem, 7vw, 2.2rem); font-weight: 900; }
.tuner-status { min-height: 40px; margin-top: 8px; font-size: clamp(1.25rem, 5vw, 1.9rem); font-weight: 900; }
.tuner-concert { min-height: 21px; color: var(--tool-muted); font-size: .8rem; font-weight: 750; }
.tuner-gauge { position: relative; max-width: 660px; height: 82px; margin: 14px auto 0; }
.tuner-track { position: absolute; inset: 35px 0 auto; height: 16px; border: 1px solid var(--tool-border); border-radius: 999px; background: linear-gradient(90deg, #cbdbe7 0%, #e9e2d7 38%, #acd5c1 47%, #acd5c1 53%, #e9e2d7 62%, #ecd4ae 100%); }
.tuner-center { position: absolute; top: 25px; left: 50%; width: 4px; height: 36px; border-radius: 99px; background: var(--tool-accent); transform: translateX(-50%); }
.tuner-needle { position: absolute; top: 15px; left: 50%; width: 34px; height: 34px; border: 5px solid #fff; border-radius: 50%; background: var(--tool-text); box-shadow: 0 2px 9px rgba(0,0,0,.15); transform: translateX(-50%); transition: left .07s linear; }
.tuner-labels { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; color: var(--tool-muted); font-size: .72rem; font-weight: 800; }
.tuner-cents { min-height: 26px; text-align: center; font-weight: 900; }
.tool-primary { width: 100%; min-height: 62px; margin-top: 12px; border: 0; border-radius: 18px; background: var(--tool-accent); color: #fff; font-size: 1.12rem; font-weight: 900; }
.tool-primary.running { background: var(--tool-danger); }
.guided { margin-top: 15px; padding: 14px; border: 1px solid var(--tool-border); border-radius: 18px; background: #fff; }
.guided-title { margin-bottom: 9px; color: var(--tool-muted); font-size: .8rem; font-weight: 900; }
.strings { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.string-button { min-width: 64px; min-height: 54px; border: 1px solid var(--tool-border); border-radius: 15px; background: #fff; font-weight: 900; }
.string-button.on { border-color: var(--tool-accent); background: var(--tool-accent); color: #fff; }
.guided-target { min-height: 22px; margin-top: 10px; color: var(--tool-muted); font-weight: 850; text-align: center; }
.reference-control { display: grid; grid-template-columns: 68px 1fr 68px; gap: 8px; margin-top: 16px; }
.reference-control button, .reference-control output { min-height: 50px; display: grid; place-items: center; border: 1px solid var(--tool-border); border-radius: 14px; background: #fff; font-weight: 900; }
.reference-control button { font-size: 1.5rem; }
.precision { margin-top: 10px; text-align: center; }
.precision button { border: 0; background: transparent; color: var(--tool-muted); font-weight: 800; text-decoration: underline; }

/* Métronome */
.tempo-panel { padding: 24px 16px 20px; border: 2px solid var(--tool-border); border-radius: 30px; background: var(--tool-panel); text-align: center; transition: background .08s; }
.tempo-panel.first { border-color: #d8b45a; background: #d8b45a; }
.tempo-panel.pulse { border-color: #91b7a8; background: #91b7a8; }
.tempo-name { font-size: clamp(2rem, 8vw, 3.5rem); font-weight: 900; }
.tempo-line { display: flex; align-items: flex-end; justify-content: center; gap: .45rem; margin-top: .55rem; }
.tempo-unit { padding-bottom: .28rem; font-size: clamp(2rem, 8vw, 3.2rem); font-weight: 900; }
.tempo-bpm { font-size: clamp(4.3rem, 17vw, 7rem); font-weight: 900; line-height: .88; }
.pulse-now { margin-top: .65rem; font-weight: 900; letter-spacing: .08em; }
.pulse-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 16px; }
.pulse-box { min-width: 56px; min-height: 56px; display: grid; place-items: center; border: 2px solid var(--tool-border); border-radius: 17px; background: var(--tool-card); font-size: 1.2rem; font-weight: 900; }
.pulse-box.active { border-color: var(--tool-accent); background: var(--tool-accent-soft); transform: scale(1.08); }
.pulse-box.firstmark { border-color: #d8b45a; }
.pulse-box.groupmark { border-color: #91b7a8; }
.sub-wrap { display: grid; gap: 4px; padding: 7px; }
.sub-row { min-height: 14px; display: flex; justify-content: center; gap: 7px; margin-top: 8px; }
.subdot { width: 10px; height: 10px; border-radius: 50%; background: var(--tool-border); }
.subdot.active { background: var(--tool-accent); transform: scale(1.5); }
.tempo-hint { margin-top: 8px; color: var(--tool-muted); font-size: .82rem; font-weight: 750; text-align: center; }
.tempo-slider { width: 100%; height: 72px; margin-top: 12px; accent-color: var(--tool-accent); }
.tempo-controls { display: grid; grid-template-columns: 82px 1fr 82px; gap: 8px; }
.tempo-button { min-height: 68px; border: 1px solid var(--tool-border); border-radius: 20px; background: var(--tool-card); font-size: 2rem; font-weight: 900; }
.tempo-button.play { background: var(--tool-accent); color: #fff; }
.tap-button { width: 100%; min-height: 52px; margin-top: 8px; border: 1px solid var(--tool-border); border-radius: 16px; background: var(--tool-card); font-weight: 900; }
.tool-section { margin-top: 18px; }
.tool-label { margin-bottom: 8px; color: var(--tool-muted); font-size: .8rem; font-weight: 900; }
.meter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.tool-choice { padding: .55rem .7rem; font-size: 1.02rem; }
.tool-flex { display: flex; flex-wrap: wrap; gap: 8px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--tool-border); }
.switch-button { min-width: 108px; min-height: 50px; border: 1px solid var(--tool-border); border-radius: 15px; background: var(--tool-card); font-weight: 900; }
.switch-button.on { border-color: var(--tool-accent); background: var(--tool-accent-soft); }
.small { color: var(--tool-muted); font-size: .8rem; }

/* Répertoire des doigtés : choix visuel, portée cliquable, résultat immédiat. */
.instrument-chooser, .fingering-workspace { scroll-margin-top: 12px; }
.instrument-chooser { padding: 16px; border: 1px solid var(--tool-border); border-radius: 20px; background: var(--tool-panel); }
.fingering-step-head { display: flex; align-items: center; gap: 11px; }
.fingering-step-head > span { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--tool-accent); color: #fff; font-weight: 950; }
.fingering-step-head h1, .fingering-step-head h2 { margin: 0; color: var(--tool-text); font-size: 1.12rem; line-height: 1.2; }
.fingering-step-head p { margin: 2px 0 0; color: var(--tool-muted); font-size: .76rem; line-height: 1.35; }
.fingering-step-head.compact > span { width: 29px; height: 29px; font-size: .78rem; }
.fingering-step-head.compact h2 { font-size: .96rem; }
.family-choices { display: flex; gap: 7px; margin-top: 14px; padding-bottom: 3px; overflow-x: auto; scrollbar-width: thin; }
.family-choice { flex: 0 0 auto; min-height: 46px; display: flex; align-items: center; gap: 7px; padding: 0 13px; border: 1px solid var(--tool-border); border-radius: 999px; background: #fff; color: var(--tool-text); }
.family-choice > span { color: var(--tool-accent); font-size: 1.05rem; }
.family-choice strong { font-size: .8rem; }
.family-choice.is-active { border-color: var(--tool-accent); background: var(--tool-accent); color: #fff; }
.family-choice.is-active > span { color: #fff; }
.instrument-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.instrument-choice { min-width: 0; min-height: 66px; display: grid; grid-template-columns: 40px minmax(0,1fr) 18px; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--tool-border); border-radius: 15px; background: #fff; color: var(--tool-text); text-align: left; }
.instrument-choice:hover { border-color: var(--tool-accent); background: var(--tool-accent-soft); }
.instrument-choice-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--tool-accent-soft); color: var(--tool-accent); font-size: 1.1rem; font-weight: 900; }
.instrument-choice strong, .instrument-choice small { display: block; }
.instrument-choice strong { font-size: .86rem; line-height: 1.2; }
.instrument-choice small { margin-top: 3px; overflow: hidden; color: var(--tool-muted); font-size: .68rem; line-height: 1.25; text-overflow: ellipsis; }
.instrument-choice b { color: var(--tool-accent); font-size: 1rem; }
.fingering-workspace { width: 100%; min-width: 0; display: grid; gap: 12px; }
.selected-instrument { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 15px; border-radius: 18px; background: var(--tool-accent); color: #fff; }
.selected-instrument span { font-size: .66rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; opacity: .82; }
.selected-instrument h1 { margin: 2px 0 0; font-size: clamp(1.25rem,4vw,1.65rem); }
.selected-instrument p { margin: 3px 0 0; font-size: .75rem; opacity: .86; }
.selected-instrument button { min-height: 42px; padding: 0 12px; border: 1px solid rgba(255,255,255,.55); border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; font-size: .75rem; font-weight: 850; }
.level-picker { min-width: 0; padding: 12px; overflow: hidden; border: 1px solid var(--tool-border); border-radius: 17px; background: var(--tool-panel); }
.level-choices { display: flex; gap: 7px; margin-top: 10px; padding: 2px 1px 4px; overflow-x: auto; scrollbar-width: thin; }
.level-choice { flex: 0 0 auto; min-height: 42px; padding: 0 12px; border: 1px solid var(--tool-border); border-radius: 12px; background: #fff; color: var(--tool-text); font-size: .74rem; font-weight: 850; }
.level-choice.is-active { border-color: var(--tool-accent); background: var(--tool-accent-soft); color: var(--tool-accent); box-shadow: inset 0 0 0 1px var(--tool-accent); }
.fingering-stage { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; align-items: stretch; }
.note-picker, .fingering-result { min-width: 0; padding: 13px; border: 1px solid var(--tool-border); border-radius: 18px; background: var(--tool-panel); }
.interactive-staff { position: relative; min-height: 190px; margin-top: 10px; overflow: hidden; border: 1px solid var(--tool-border); border-radius: 14px; background: #fff; }
.note-staff { width: 100%; min-height: 190px; overflow: hidden; pointer-events: none; }
.note-staff svg { display: block; width: 100%; max-width: 100%; height: 100%; }
.note-choices { position: absolute; inset: 0; }
.staff-note-choice { position: absolute; top: 0; bottom: 0; width: clamp(46px,12%,82px); padding: 0; border: 0; border-radius: 12px; background: transparent; transform: translateX(-50%); }
.staff-note-choice:hover { background: color-mix(in srgb,var(--tool-accent) 9%,transparent); }
.staff-note-choice.is-active { background: color-mix(in srgb,var(--tool-accent) 12%,transparent); }
.staff-note-choice span { position: absolute; left: 50%; bottom: 7px; min-width: 42px; padding: 3px 6px; border: 1px solid var(--tool-border); border-radius: 999px; background: #fff; color: var(--tool-muted); font-size: .65rem; font-weight: 900; white-space: nowrap; transform: translateX(-50%); }
.staff-note-choice.is-active span { border-color: var(--tool-accent); background: var(--tool-accent); color: #fff; }
.note-pager { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-top: 8px; }
.note-pager button { min-height: 40px; padding: 0 10px; border: 1px solid var(--tool-border); border-radius: 11px; background: #fff; color: var(--tool-text); font-size: .7rem; font-weight: 850; }
.note-pager button:disabled { opacity: .42; cursor: default; }
.note-pager span { color: var(--tool-muted); font-size: .7rem; font-weight: 800; text-align: center; }
.fingering-result { display: flex; flex-direction: column; }
.fingering-result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fingering-result-head span { color: var(--tool-muted); font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.fingering-result-head strong { color: var(--tool-accent); font-size: .98rem; }
.fingering-answer { min-width: 0; min-height: 154px; display: grid; align-content: center; justify-items: center; gap: 14px; margin-top: 8px; padding: 18px; overflow: hidden; border: 1px solid var(--tool-border); border-radius: 18px; background: #fff; text-align: center; }
.fingering-answer > :first-child { max-width: 100%; }
.fingering-answer .flute-fingering,
.fingering-answer .oboe-fingering,
.fingering-answer .clarinet-fingering,
.fingering-answer .saxophone-fingering,
.fingering-answer .recorder-fingering { width: min(720px, 100%); }
/* Le hautbois est présenté comme l'instrumentiste le tient : main gauche en haut,
   main droite en bas, de l'embouchure vers le pavillon. */
.fingering-answer .oboe-fingering {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: 176px;
  height: 360px;
  max-height: none;
  gap: 4px;
  padding: 20px 0 30px;
}
.fingering-answer .oboe-fingering::before {
  top: 9px;
  right: auto;
  bottom: 18px;
  left: 50%;
  width: 12px;
  height: auto;
  transform: translateX(-50%);
  border-radius: 55% 55% 35% 35%;
  background: linear-gradient(90deg,#c89132,#f4cf77 48%,#b77b22);
}
.fingering-answer .oboe-fingering::after {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: 4px;
  left: 50%;
  width: 38px;
  height: 28px;
  transform: translateX(-50%);
  border: 1px solid #72552a;
  border-radius: 45% 45% 70% 70%;
  background: linear-gradient(90deg,#b77b22,#f4cf77 48%,#9c641b);
  clip-path: polygon(33% 0,67% 0,100% 100%,0 100%);
}
.fingering-answer .oboe-hand {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 42px;
  gap: 3px;
  padding: 5px 6px;
}
.fingering-answer .oboe-hand-left { margin-top: 34px; }
.fingering-answer .oboe-hand > b {
  position: absolute;
  top: 50%;
  right: -31px;
  left: auto;
  width: auto;
  height: auto;
  overflow: visible;
  transform: translateY(-50%);
  clip: auto;
  color: #527087;
  font-size: 9px;
}
.fingering-answer .oboe-octave {
  position: absolute;
  top: 25px;
  left: calc(50% - 48px);
  padding: 2px;
}
.fingering-answer .oboe-joint {
  width: 28px;
  height: 8px;
  border-radius: 4px;
}
.fingering-answer .oboe-hand-left .oboe-pinky {
  position: absolute;
  top: 42px;
  right: calc(100% + 5px);
}
.fingering-answer .oboe-hand-right .oboe-f-key {
  position: absolute;
  top: 18px;
  left: calc(100% + 5px);
}
.fingering-answer .oboe-hand-right .oboe-pinky {
  position: absolute;
  right: calc(100% + 5px);
  bottom: 8px;
}
@media (min-width: 760px) {
  .fingering-workspace:is([data-instrument="flute"],[data-instrument="hautbois"],[data-instrument="clarinette"],[data-instrument="saxophone"],[data-instrument="flute_a_bec"]) {
    --fingering-panel-width: 292px;
  }
  .fingering-workspace[data-instrument="flute"] { --fingering-panel-width: 356px; }
  .fingering-workspace:is([data-instrument="flute"],[data-instrument="hautbois"],[data-instrument="clarinette"],[data-instrument="saxophone"],[data-instrument="flute_a_bec"]) .fingering-stage {
    grid-template-columns: minmax(0, 1fr) var(--fingering-panel-width);
    align-items: start;
  }
  .fingering-workspace:is([data-instrument="flute"],[data-instrument="hautbois"],[data-instrument="clarinette"],[data-instrument="saxophone"],[data-instrument="flute_a_bec"]) .fingering-result { grid-column: 2; grid-row: 1; }
  .fingering-workspace:is([data-instrument="flute"],[data-instrument="hautbois"],[data-instrument="clarinette"],[data-instrument="saxophone"],[data-instrument="flute_a_bec"]) .note-picker { grid-column: 1; grid-row: 1; }
  .fingering-workspace:is([data-instrument="flute"],[data-instrument="hautbois"],[data-instrument="clarinette"],[data-instrument="saxophone"],[data-instrument="flute_a_bec"]) .fingering-answer {
    flex: 1;
    min-height: 0;
    padding: 9px;
  }
  .fingering-workspace[data-instrument="hautbois"] .oboe-fingering {
    width: 164px;
    height: 310px;
    padding-top: 16px;
    padding-bottom: 27px;
  }
  .fingering-workspace[data-instrument="hautbois"] .oboe-hand-left { margin-top: 25px; }
  .fingering-workspace:is([data-instrument="flute"],[data-instrument="hautbois"],[data-instrument="clarinette"],[data-instrument="saxophone"],[data-instrument="flute_a_bec"]) .fingering-text { display: none; }
}

/* Clarinette tenue devant soi : pouce à gauche, main gauche au-dessus de la droite. */
.fingering-answer .clarinet-fingering {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: 186px;
  height: 368px;
  gap: 0;
}
.fingering-answer .clarinet-body {
  flex-direction: column;
  width: 58px;
  gap: 3px;
  padding: 12px 6px;
  border-radius: 20px;
}
.fingering-answer .clarinet-hand { flex-direction: column; gap: 3px; padding: 4px; }
.fingering-answer .clarinet-hand > b {
  position: absolute;
  top: 50%;
  right: -31px;
  width: auto;
  height: auto;
  overflow: visible;
  transform: translateY(-50%);
  clip: auto;
}
.fingering-answer .clarinet-rear {
  position: absolute;
  z-index: 3;
  top: 38px;
  left: 9px;
  flex-direction: column;
}
.fingering-answer .clarinet-mouthpiece {
  width: 24px;
  height: 30px;
  margin: -29px 0 0;
  border-radius: 70% 70% 24% 24%;
}
.fingering-answer .clarinet-joint { width: 30px; height: 7px; }
.fingering-answer .clarinet-bell {
  width: 38px;
  height: 30px;
  margin: 0 0 -28px;
  border-radius: 30% 30% 80% 80%;
  clip-path: polygon(34% 0,66% 0,100% 100%,0 100%);
}

/* Saxophone porté devant soi, avec une légère inclinaison et les deux mains superposées. */
.fingering-answer .saxophone-fingering {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: 194px;
  height: 374px;
}
.fingering-answer .saxophone-body {
  flex-direction: column;
  width: 64px;
  gap: 3px;
  padding: 13px 6px;
  transform: rotate(-2deg);
  border-radius: 22px;
}
.fingering-answer .saxophone-hand { flex-direction: column; gap: 3px; padding: 4px; }
.fingering-answer .saxophone-hand > strong {
  position: absolute;
  top: 50%;
  right: -31px;
  width: auto;
  height: auto;
  overflow: visible;
  transform: translateY(-50%);
  clip: auto;
}
.fingering-answer .saxophone-octave {
  position: absolute;
  z-index: 3;
  top: 30px;
  left: 5px;
}
.fingering-answer .saxophone-neck {
  width: 27px;
  height: 25px;
  margin: -30px 0 0;
  border-width: 6px;
  border-right: 0;
  border-bottom: 0;
}
.fingering-answer .saxophone-joint { width: 30px; height: 7px; }
.fingering-answer .saxophone-bell {
  width: 43px;
  height: 34px;
  margin: 0 0 -31px;
  border-radius: 28% 28% 85% 85%;
  clip-path: polygon(34% 0,66% 0,100% 100%,0 100%);
}

/* Flûte à bec dans l'axe du corps, vue par l'élève. */
.fingering-answer .recorder-fingering {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: 158px;
  height: 352px;
  gap: 0;
}
.fingering-answer .recorder-face {
  position: relative;
  flex-direction: column;
  gap: 3px;
  padding: 18px 7px 12px;
}
.fingering-answer .recorder-face::before {
  top: 4px;
  right: auto;
  bottom: 4px;
  left: 50%;
  width: 12px;
  height: auto;
  transform: translateX(-50%);
  border-radius: 10px;
  background: linear-gradient(90deg,#bd7f28,#e8bb68 50%,#a96b1d);
}
.fingering-answer .recorder-face > strong {
  position: absolute;
  top: -18px;
  right: -22px;
}
.fingering-answer .recorder-rear {
  position: absolute;
  z-index: 3;
  top: 34px;
  left: -4px;
  flex-direction: column;
}

/* La flûte traversière reste horizontale ; le dessin est simplement compacté dans sa fenêtre. */
.fingering-workspace[data-instrument="flute"] .flute-fingering { gap: 2px; }
.fingering-workspace[data-instrument="flute"] .flute-hand,
.fingering-workspace[data-instrument="flute"] .flute-foot { gap: 2px; padding: 2px; }
.fingering-workspace[data-instrument="flute"] .flute-hand > b { display: none; }
.fingering-workspace[data-instrument="flute"] .flute-key { width: 20px; height: 20px; font-size: 7px; }
.fingering-workspace[data-instrument="flute"] .flute-pinky { width: 23px; }
.fingering-workspace[data-instrument="flute"] .flute-foot-key { width: 25px; }
.fingering-answer-empty { flex: 1; border-style: dashed; color: var(--tool-muted); }
.fingering-text { max-width: 100%; margin: 0; overflow-wrap: anywhere; font-size: 1rem; font-weight: 850; line-height: 1.45; }
.diagram { min-height: 72px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.diagram .key, .diagram .valve, .diagram .hole { min-width: 28px; min-height: 38px; display: grid; place-items: center; padding: 4px 6px; border: 2px solid var(--tool-muted); border-radius: 8px; background: #fff; color: var(--tool-muted); font-size: .65rem; font-style: normal; font-weight: 900; }
.diagram .key.on, .diagram .valve.on, .diagram .hole.on { border-color: var(--tool-accent); background: var(--tool-accent); color: #fff; }
.diagram .hole { width: 24px; height: 24px; border-radius: 50%; }
.diagram .hole.half { background: linear-gradient(90deg, var(--tool-accent) 50%, #fff 50%); color: transparent; }
.string-diagram { position: relative; width: min(100%, 280px); height: 84px; display: grid; grid-template-columns: repeat(var(--string-count, 4), 1fr); gap: 18px; padding: 8px 22px; }
.string-line { position: relative; display: block; border-left: 3px solid #9a8f82; }
.string-line.active { border-color: var(--tool-accent); }
.string-line.active::after { content: attr(data-marker); position: absolute; top: 23px; left: -16px; width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: var(--tool-accent); color: #fff; font-size: .75rem; font-style: normal; font-weight: 900; }
.slide-diagram { width: min(100%, 330px); display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.slide-position { min-height: 40px; display: grid; place-items: center; border: 1px solid var(--tool-border); border-radius: 8px; background: #fff; color: var(--tool-muted); font-style: normal; font-weight: 850; }
.slide-position.on { border-color: var(--tool-accent); background: var(--tool-accent); color: #fff; }
.keyboard-diagram { max-width: 100%; display: flex; align-items: flex-start; height: 76px; overflow: hidden; }
.piano-key { width: 34px; height: 72px; display: grid; align-items: end; justify-items: center; padding-bottom: 5px; border: 1px solid #6f6a63; background: #fff; color: var(--tool-muted); font-size: .65rem; font-style: normal; }
.piano-key.black { width: 24px; height: 46px; margin: 0 -12px; z-index: 2; background: #2b3037; color: #fff; }
.piano-key.on { outline: 4px solid #dc765c; outline-offset: -4px; }
.fingering-notice { margin: 12px 0 0; padding: 11px 12px; border-radius: 12px; background: #fff3d8; color: #664c16; font-size: .82rem; line-height: 1.45; }
.source-note { margin: 14px 0 0; color: var(--tool-muted); font-size: .74rem; line-height: 1.45; }

/* Le métronome réutilise le panneau de volumes commun, sans importer le bandeau NOTALYR. */
.notalyr-audio-settings, .notalyr-audio-settings * { box-sizing: border-box; }
.notalyr-audio-toggle { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 118; width: 44px; height: 44px; padding: 0; border: 1px solid var(--tool-border); border-radius: 50%; background: var(--tool-card); color: var(--tool-accent); box-shadow: 0 6px 20px rgba(31,41,51,.14); font-size: 1.1rem; cursor: pointer; }
.notalyr-audio-panel { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(64px, calc(env(safe-area-inset-bottom) + 58px)); z-index: 119; width: min(292px, calc(100vw - 24px)); padding: 14px; border: 1px solid var(--tool-border); border-radius: 18px; background: var(--tool-card); color: var(--tool-text); box-shadow: 0 12px 32px rgba(31,41,51,.2); }
.notalyr-audio-panel[hidden] { display: none !important; }
.notalyr-audio-panel header, .notalyr-audio-panel label { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notalyr-audio-panel header { margin-bottom: 12px; }
.notalyr-audio-panel label { margin-top: 10px; font-size: .82rem; font-weight: 800; }
.notalyr-audio-panel output { color: var(--tool-muted); font-variant-numeric: tabular-nums; }
.notalyr-audio-panel input[type="range"] { width: 100%; min-height: 36px; accent-color: var(--tool-accent); cursor: pointer; }
.notalyr-audio-close { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.4rem; }
.notalyr-audio-reset { width: 100%; min-height: 40px; margin-top: 10px; border: 1px solid var(--tool-border); border-radius: 12px; background: var(--tool-panel); color: var(--tool-text); font-weight: 800; }

@media (max-width: 620px) {
  .tool-card { padding: 13px; }
  .tool-pickers { grid-template-columns: 1fr; }
  .tuner-panel { min-height: 280px; }
  .meter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .instrument-chooser { padding: 12px; }
  .instrument-choices { grid-template-columns: 1fr; }
  .selected-instrument { align-items: flex-start; }
  .selected-instrument button { min-height: 46px; }
  .fingering-stage { grid-template-columns: 1fr; }
  .interactive-staff, .note-staff { min-height: 180px; }
  .staff-note-choice { width: clamp(44px,15%,64px); }
}

@media (max-width: 620px) {
  .fingering-answer .oboe-fingering { width: 158px; height: 326px; padding-top: 17px; }
  .fingering-answer .oboe-hand-left { margin-top: 29px; }
}
@media (max-width: 420px) {
  .tempo-controls { grid-template-columns: 72px 1fr 72px; }
  .tool-wrap { width: min(100% - 16px, 860px); padding-top: 10px; }
  .tool-header { margin-inline: 4px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .tool-wrap { width: min(1060px, calc(100% - 18px)); padding: 8px 0 18px; }
  .tool-header { margin-bottom: 7px; }
  .tool-card { padding: 11px; }
  .tuner-panel { min-height: 210px; }
  .fingering-stage { grid-template-columns: minmax(0,1fr); }
  .interactive-staff, .note-staff { min-height: 170px; }
  .fingering-answer { min-height: 118px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
