/*
 * Mateen Labs: styles for the Music tools (Batch N). Builds on file-tool.css, audio.css, audio-extras.css and the site tokens
 * (light and dark follow the site). Mobile first: nothing may be wider than 320px. Meaning is never carried by colour alone.
 * Motion is reduced when the visitor asks for it.
 */

.mu-app { display: grid; gap: 16px; margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
@media (min-width: 600px) { .mu-app { padding: 20px; } }
.mu-app[hidden], .mu-app [hidden] { display: none !important; }
.mu-app h2 { margin: 0; font-size: 17px; }
.mu-app select, .mu-app input[type="number"], .mu-app input[type="text"], .mu-app textarea { min-height: 44px; max-width: 100%; }
.mu-app button { min-height: 44px; }
/* An outline, not a box-shadow: Safari draws native selects and number fields without box-shadow, so a shadow ring would be invisible there. */
.mu-app input:focus-visible, .mu-app select:focus-visible, .mu-app textarea:focus-visible, .mu-app button:focus-visible, .mu-app canvas:focus-visible, .mu-chords:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: none; }
.mu-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.mu-field { display: grid; gap: 4px; min-width: 0; }
.mu-field label, .mu-field .mu-label { font-weight: 650; font-size: 14px; }
.mu-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.mu-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mu-readout { margin: 0; font-size: 34px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mu-readout small { font-size: 14px; font-weight: 650; color: var(--muted); }
.mu-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mu-warn { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-text); font-size: 14px; }
.mu-warn::before { content: "! "; font-weight: 800; }

/* metronome */
.mu-beats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mu-beat { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--panel); color: var(--text); }
.mu-beat[data-accent="true"] { border-width: 4px; }
.mu-beat.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.mu-beat.is-on[data-accent="true"] { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.mu-big { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mu-big button { min-width: 44px; padding: 8px 14px; }
.mu-big input[type="number"] { width: 6em; font-size: 22px; font-weight: 800; text-align: center; }
.mu-range { width: 100%; accent-color: var(--accent); }

/* tuner */
.mu-meter { position: relative; height: 56px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--panel); overflow: hidden; }
.mu-meter-zone { position: absolute; top: 0; bottom: 0; left: 45%; width: 10%; background: var(--accent-soft); border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.mu-needle { position: absolute; top: 4px; bottom: 4px; left: 50%; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--text); transition: left .12s linear; }
.mu-meter[data-state="in-tune"] .mu-needle { background: var(--accent); }
.mu-ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.mu-state { margin: 0; font-weight: 800; font-size: 16px; }
@media (prefers-reduced-motion: reduce) { .mu-needle { transition: none; } }

/* practice player */
.mu-wave { display: block; width: 100%; height: 120px; border-radius: var(--radius-sm); background: var(--panel); touch-action: none; cursor: pointer; }
.mu-times { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; }
.mu-times .mu-field { flex: 1 1 8em; }
.mu-kbd { display: grid; gap: 4px 12px; grid-template-columns: max-content 1fr; margin: 0; font-size: 14px; }
.mu-kbd dt { font-weight: 800; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mu-kbd dd { margin: 0; color: var(--muted); }

/* key finder and tables */
.mu-bars { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mu-bar { display: grid; gap: 4px; }
.mu-bar-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; flex-wrap: wrap; }
.mu-bar-track { height: 12px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.mu-bar-fill { display: block; height: 100%; background: var(--accent); }
.mu-table-wrap { overflow-x: auto; max-width: 100%; }
.mu-table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.mu-table th, .mu-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.mu-table th { color: var(--muted); font-weight: 700; }
.mu-table tr.is-hit td { background: var(--accent-soft); font-weight: 800; }
.mu-chords { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.5; white-space: pre; overflow-x: auto; max-width: 100%; min-height: 8em; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); margin: 0; }
.mu-textarea { width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.5; resize: vertical; min-height: 10em; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }

/* tuner strings */
.mu-strings { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mu-strings li { min-width: 44px; padding: 8px 10px; text-align: center; border: 2px solid var(--line-strong); border-radius: 10px; font-weight: 800; background: var(--panel); }
.mu-strings li.is-target { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); text-decoration: underline; }

/* definition rows (note-frequency) */
.mu-row { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mu-row dt { flex: 0 0 11em; color: var(--muted); font-weight: 650; }
.mu-row dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
dl.mu-kbd#result { display: block; }
