/* Musical Press — outils musicaux. Couleurs pilotées par les variables du thème (valeurs de repli = charte DARK STUDIO). */
.mpt {
	--mpt-bg: var(--mp-surface, #0d1520);
	--mpt-elev: var(--mp-elevated, #121d2b);
	--mpt-border: var(--mp-border, #243246);
	--mpt-text: var(--mp-text, #f6f8fd);
	--mpt-sub: var(--mp-sub, #a9b7c9);
	--mpt-muted: var(--mp-muted, #8190a5);
	--mpt-accent: var(--mp-accent, #3c96ff);
	--mpt-accent-hover: var(--mp-accent-hover, #69b3ff);
	--mpt-focus: var(--mp-focus, #a8d4ff);
	--mpt-ok: var(--mp-success, #66d6b1);
	--mpt-warn: var(--mp-warning, #ffd28a);
	position: relative;
	background: linear-gradient(160deg, var(--mpt-elev), var(--mpt-bg));
	border: 1px solid var(--mpt-border);
	border-radius: 14px;
	padding: clamp(18px, 3vw, 32px);
	color: var(--mpt-text);
	font-variant-numeric: tabular-nums;
}
.mpt [hidden] { display: none !important; }
.mpt:focus { outline: none; }
.mpt:focus-visible { outline: 3px solid var(--mpt-focus); outline-offset: 3px; }
.mpt *, .mpt *::before, .mpt *::after { box-sizing: border-box; }
.mpt__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.mpt__title { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #9fb9da; }
.mpt__badge { font-size: 11px; color: var(--mpt-muted); border: 1px solid var(--mpt-border); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.mpt__fallback { color: var(--mpt-warn); font-size: 14px; }
/* L'interface est rendue visible dès le premier affichage (pas de décalage de mise en page) ;
   sans JavaScript ou sans Web Audio, seul le message d'explication reste affiché. */
.mpc-js .mpt__fallback { display: none; }
html:not(.mpc-js) .mpt__ui { display: none; }
.mpt.is-unsupported .mpt__fallback { display: block; }
.mpt.is-unsupported .mpt__ui { display: none; }
.mpt__display { text-align: center; padding: 18px 0 10px; }
.mpt__big { margin: 0; display: flex; align-items: baseline; justify-content: center; gap: 10px; line-height: 1; }
.mpt__value { font-size: clamp(64px, 10vw, 104px); font-weight: 800; letter-spacing: -.04em; }
.mpt__unit { font-size: 13px; letter-spacing: .22em; color: #7f9abb; font-weight: 700; }
.mpt__sub { margin: 10px 0 0; color: var(--mpt-sub); font-size: 15px; min-height: 1.6em; }
.mpt__row { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.mpt__row input[type="range"] { flex: 1; }
.mpt input[type="range"] { accent-color: var(--mpt-accent); min-height: 44px; width: 100%; }
.mpt__icon-btn {
	flex: none; width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--mpt-border);
	background: #142034; color: var(--mpt-text); font-size: 24px; line-height: 1; cursor: pointer;
}
.mpt__icon-btn:hover { border-color: var(--mpt-accent); }
.mpt button:focus-visible, .mpt input:focus-visible, .mpt select:focus-visible, .mpt a:focus-visible { outline: 3px solid var(--mpt-focus); outline-offset: 2px; }
.mpt__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 18px; margin: 18px 0; align-items: end; }
.mpt__field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--mpt-sub); }
.mpt__field--inline { flex-direction: row; align-items: center; gap: 8px; }
.mpt__field input[type="number"], .mpt__field select {
	min-height: 44px; width: 100%; background: #0b1420; color: var(--mpt-text); border: 1px solid var(--mpt-border);
	border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 15px;
}
.mpt__field--inline input[type="number"] { width: 84px; }
.mpt__unit-sm { font-size: 11px; letter-spacing: .14em; color: var(--mpt-muted); }
.mpt__check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--mpt-sub); min-height: 44px; }
.mpt__check input { width: 18px; height: 18px; accent-color: var(--mpt-accent); }
.mpt__transport { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 16px 0 6px; }
.mpt__status { text-align: center; font-size: 14px; color: var(--mpt-sub); min-height: 1.5em; margin: 10px 0 0; }
.mpt__keys, .mpt__help { font-size: 13px; color: var(--mpt-muted); text-align: center; margin: 10px 0 0; }
.mpt kbd { font-family: inherit; font-size: 12px; border: 1px solid var(--mpt-border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--mpt-text); background: #0b1420; }
.mpt__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Boutons (repli si le thème ne les définit pas) */
.mpt .mp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 12px 22px; border-radius: 999px; font: inherit; font-weight: 650; font-size: 15px; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.mpt .mp-btn--primary { background: var(--mpt-accent); color: #04101d; }
.mpt .mp-btn--primary:hover { background: var(--mpt-accent-hover); }
.mpt .mp-btn--ghost { background: transparent; border-color: #3a4d66; color: var(--mpt-text); }
.mpt .mp-btn--ghost:hover { border-color: var(--mpt-accent); }
.mpt .mp-btn--text { background: none; border: 0; color: var(--mpt-accent-hover); padding-inline: 8px; }
.mpt .mp-btn[disabled] { opacity: .5; cursor: not-allowed; }
.mpt__toggle { min-width: 180px; }
.mpt.is-running .mpt__toggle { background: #f6f8fd; color: #05101c; }

/* Métronome : temps de la mesure */
.mpt__beats { display: flex; justify-content: center; gap: 12px; margin: 8px 0 4px; min-height: 22px; }
.mpt__dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #3a4d66; background: transparent; transition: background-color .06s linear, transform .06s linear; }
.mpt__dot.is-accent { border-color: var(--mpt-accent); }
.mpt__dot.is-secondary { border-color: #6a8ab3; }
.mpt__dot.is-on { background: var(--mpt-text); border-color: var(--mpt-text); transform: scale(1.15); }
.mpt__dot.is-accent.is-on { background: var(--mpt-accent); border-color: var(--mpt-accent); }

/* Tap BPM */
.mpt__pad {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
	width: 100%; min-height: 150px; border-radius: 14px; border: 1px solid #2c5f9a;
	background: radial-gradient(120% 140% at 50% 0%, #1b3657, #0e1b2c); color: var(--mpt-text);
	cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; font: inherit;
}
.mpt__pad-label { font-size: 18px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.mpt__pad-hint { font-size: 13px; color: var(--mpt-sub); }
.mpt__pad.is-hit { background: radial-gradient(120% 140% at 50% 0%, #2a5d97, #12243a); border-color: var(--mpt-accent); }

/* Boîte à rythmes */
.mpt__drum-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin: 10px 0 18px; }
.mpt__drum-top input[type="range"][data-ref="bpmRange"] { flex: 1 1 160px; width: auto; }
.mpt__drum-top .mpt__field--inline input[type="range"] { width: 120px; }
.mpt__seq { overflow-x: auto; padding-bottom: 6px; }
.mpt__seq-steps, .mpt__track { display: grid; grid-template-columns: 150px repeat(16, minmax(26px, 1fr)); gap: 6px; align-items: center; min-width: 640px; }
.mpt__seq-steps { font-size: 11px; color: var(--mpt-muted); text-align: center; margin-bottom: 6px; }
.mpt__seq-steps .is-beat { color: var(--mpt-sub); font-weight: 700; }
.mpt__track { margin-bottom: 8px; }
.mpt__track-head { display: flex; flex-direction: column; gap: 2px; }
.mpt__track-head input[type="range"] { min-height: 24px; }
.mpt__cells { display: contents; }
.mpt__mute { text-align: left; background: none; border: 0; color: var(--mpt-text); font: inherit; font-size: 13px; font-weight: 650; padding: 4px 0; cursor: pointer; }
.mpt__mute.is-muted { color: var(--mpt-muted); text-decoration: line-through; }
.mpt__cell {
	height: clamp(30px, 3.4vw, 46px); border-radius: 6px; border: 1px solid #34465d; background: #162234; cursor: pointer; padding: 0;
}
.mpt__cell.is-beat { border-color: #4a607d; background: #1a2840; }
.mpt__cell.is-on { background: var(--mpt-accent); border-color: var(--mpt-accent); }
.mpt__cell.is-playing { box-shadow: 0 0 0 2px #e7f4ff inset; }
.mpt__btns { display: flex; flex-wrap: wrap; gap: 10px; }
.mpt__grid--drum { grid-template-columns: minmax(200px, 280px) 1fr; }

/* Accordeur */
.mpt__strings { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 4px; }
.mpt__string {
	display: grid; justify-items: center; gap: 2px; min-width: 64px; min-height: 64px; padding: 6px 10px;
	border-radius: 12px; border: 1px solid var(--mpt-border); background: #0f1a29; color: var(--mpt-sub); cursor: pointer; font: inherit; font-size: 12px;
}
.mpt__string strong { font-size: 20px; color: var(--mpt-text); }
.mpt__string-n { font-size: 10px; color: var(--mpt-muted); }
.mpt__string.is-target { border-color: var(--mpt-accent); background: #12243b; }
.mpt__string.is-tuned { border-color: var(--mpt-ok); box-shadow: 0 0 0 1px var(--mpt-ok) inset; }
.mpt__tuner-display { text-align: center; margin: 8px auto 0; max-width: 520px; }
.mpt__gauge { width: 100%; max-width: 380px; height: auto; display: block; margin: 0 auto; }
.mpt__gauge-arc { stroke: #2a3a50; stroke-width: 10; stroke-linecap: round; }
.mpt__gauge-ok { stroke: var(--mpt-ok); stroke-width: 10; stroke-linecap: round; opacity: .55; }
.mpt__gauge-ticks line { stroke: #4a5d76; stroke-width: 1.5; }
.mpt__gauge-ticks line.is-major { stroke: #8aa0bd; stroke-width: 2; }
.mpt__gauge-label { fill: var(--mpt-muted); font-size: 11px; font-family: inherit; }
.mpt__needle { stroke: var(--mpt-text); stroke-width: 3; stroke-linecap: round; transition: transform .12s ease-out; }
.mpt__needle-hub { fill: var(--mpt-text); }
[data-state="tuned"] .mpt__needle, [data-state="tuned"] .mpt__needle-hub { stroke: var(--mpt-ok); fill: var(--mpt-ok); }
[data-state="tuned"] .mpt__note { color: var(--mpt-ok); }
[data-state="idle"] .mpt__needle, [data-state="denied"] .mpt__needle, [data-state="error"] .mpt__needle { opacity: .35; }
.mpt__note { margin: 2px 0 0; font-size: clamp(56px, 9vw, 84px); font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.mpt__note sub { font-size: .38em; font-weight: 700; color: var(--mpt-sub); vertical-align: baseline; margin-left: 2px; }
.mpt__value.is-empty, .mpt__note.is-empty { color: var(--mpt-muted); font-weight: 300; }
.mpt__freq { font-size: 13px; color: var(--mpt-muted); margin: 6px 0 0; min-height: 1.4em; }
.mpt__meters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; text-align: left; }
.mpt__meter span { display: block; font-size: 12px; color: var(--mpt-muted); margin-bottom: 6px; }
.mpt__bar { height: 8px; border-radius: 99px; background: #1a2638; overflow: hidden; }
.mpt__bar i { display: block; height: 100%; width: 0; background: var(--mpt-accent); border-radius: 99px; transition: width .08s linear; }
[data-state="denied"] .mpt__note, [data-state="error"] .mpt__note { color: var(--mpt-muted); }

/* Comparateur */
.mpt__compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mpt__source { border: 1px solid var(--mpt-border); border-radius: 12px; padding: 14px; }
.mpt__source-label { margin: 0; font-weight: 650; }
.mpt__seek { margin-top: 12px; }

/* Lecteurs tiers avec consentement */
.mp-embed { margin: 24px 0; border: 1px solid var(--mp-border, #243246); border-radius: 12px; background: var(--mp-surface, #0d1520); overflow: hidden; }
.mp-embed__consent { padding: 22px; display: grid; gap: 10px; justify-items: start; }
.mp-embed__provider { margin: 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #9fb9da; font-weight: 700; }
.mp-embed__text { margin: 0; font-size: 14px; color: var(--mp-sub, #a9b7c9); max-width: 60ch; }
.mp-embed__open { font-size: 14px; color: var(--mp-accent-hover, #69b3ff); }
.mp-embed iframe { display: block; width: 100%; border: 0; }
.mp-embed--video.is-loaded iframe { aspect-ratio: 16 / 9; height: auto; }

@media (max-width: 640px) {
	.mpt__grid--drum { grid-template-columns: 1fr; }
	.mpt__meters { grid-template-columns: 1fr; }
	.mpt__compare { grid-template-columns: 1fr; }
	.mpt__toggle { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.mpt *, .mpt *::before, .mpt *::after { transition: none !important; animation: none !important; }
}
