/* MP3 to MIDI Converter — input, section picker, results with piano roll, settings.
   Colours come from the shared tokens, so the panel follows the light and dark themes; the canvases
   read the same tokens when they draw. */
.a2m {
  display: grid;
  gap: 1.25rem;
  padding: clamp(16px, 2.4vw, 32px);
  text-align: left;
  color: var(--ink);
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--shade);
}
.a2m *, .a2m *::before, .a2m *::after { box-sizing: border-box; }
.a2m [hidden] { display: none !important; }
.a2m h2 { margin: 0 0 .35rem; font-size: 1.45rem; letter-spacing: -.02em; }
.a2m h3 { margin: 0; font-size: 1.1rem; }
.a2m p { margin: 0; color: var(--ink-soft); }
.a2m-head p { max-width: 76ch; }
.a2m label { display: grid; gap: .3rem; min-width: 0; font-size: .85rem; font-weight: 650; }
.a2m-sub { display: block; font-size: .8rem; font-weight: 450; color: var(--ink-soft); }
.a2m input:not([type]), .a2m input[type="number"], .a2m select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: .45rem .6rem;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--border-soft);
  border-radius: 6px;
}
.a2m input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.a2m input[type="range"] { width: 100%; min-height: 32px; margin: 0; accent-color: var(--action); }
.a2m :is(input, select, button, summary, a, .a2m-roll):focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.a2m button {
  min-height: 42px;
  padding: .5rem .95rem;
  font: inherit;
  font-weight: 650;
  color: var(--ink);
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.a2m button:disabled { opacity: .5; cursor: default; }
.a2m .a2m-primary, .a2m .a2m-pick { color: var(--on-action); background: var(--action); box-shadow: 3px 3px 0 var(--shade); }
.a2m .a2m-primary:hover:not(:disabled), .a2m .a2m-pick:hover { background: var(--primary-dark); }
.a2m .a2m-check { display: flex; align-items: center; gap: .55rem; min-height: 42px; font-size: .92rem; font-weight: 500; }
.a2m .a2m-check input { flex: none; width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--action); }
.a2m output { font-weight: 700; color: var(--ink); }
.a2m a { color: var(--action-text); font-weight: 650; }

.a2m-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem); gap: 1.25rem; align-items: start; }
@media (max-width: 1020px) { .a2m-layout { grid-template-columns: minmax(0, 1fr); } }
.a2m-main { display: grid; gap: 1rem; min-width: 0; }

.a2m-drop { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: 1.4rem 1.2rem; background: var(--blue-tint); border: 2px dashed var(--line); border-radius: 10px; }
.a2m-drop p { flex: 1 1 18rem; font-size: .92rem; color: var(--ink); }
.a2m-drop.a2m-over { background: var(--action-tint); border-style: solid; }
.a2m .a2m-pick { position: relative; display: inline-flex; align-items: center; min-height: 42px; padding: .5rem 1rem; font-size: 1rem; border: 2px solid var(--line); border-radius: 8px; cursor: pointer; }
.a2m .a2m-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.a2m .a2m-pick:focus-within { outline: 3px solid var(--primary); outline-offset: 2px; }

.a2m-status { min-height: 1.4em; font-weight: 600; color: var(--ink) !important; }
.a2m-status[data-kind="error"] { padding: .55rem .8rem; background: var(--error-soft); border-left: 4px solid var(--error); border-radius: 6px; }
.a2m-progress { display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; }
.a2m-progress progress { width: 100%; height: 14px; accent-color: var(--action); }
.a2m-progress span { font-size: .88rem; font-weight: 600; color: var(--ink); }

.a2m-panel { display: grid; gap: .8rem; min-width: 0; padding: 1rem; background: var(--paper-3); border: 2px solid var(--line); border-radius: 10px; }
.a2m-file { overflow-wrap: anywhere; color: var(--ink) !important; }
.a2m-file span { color: var(--ink-soft); }
.a2m-wave { display: block; width: 100%; height: 88px; background: var(--field); border: 1.5px solid var(--border-soft); border-radius: 6px; cursor: crosshair; touch-action: none; }
.a2m-row { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem .9rem; }
.a2m-row > .a2m-time-field { flex: 1 1 8rem; max-width: 12rem; }
.a2m-time-field input { font-family: var(--font-mono); }
.a2m-hint { font-size: .9rem; color: var(--ink) !important; }
.a2m-error { padding: .5rem .75rem; font-weight: 600; color: var(--ink) !important; background: var(--error-soft); border-left: 4px solid var(--error); border-radius: 6px; }
.a2m-note { padding: .5rem .75rem; font-size: .9rem; color: var(--ink) !important; background: var(--warning-soft); border-left: 4px solid var(--warning); border-radius: 6px; }

.a2m-results { background: var(--bg-2); }
.a2m-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .5rem; margin: 0; }
.a2m-stats div { padding: .5rem .7rem; background: var(--paper-3); border: 1.5px solid var(--border-soft); border-radius: 8px; }
.a2m-stats dt { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.a2m-stats dd { margin: .15rem 0 0; font-weight: 650; overflow-wrap: anywhere; }

.a2m-player { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; }
.a2m .a2m-play { min-width: 6.5rem; }
.a2m-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; border: 0; }
.a2m-pills legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.a2m .a2m-pills label { position: relative; display: inline-flex; align-items: center; min-height: 42px; padding: .4rem .85rem; font-size: .9rem; background: var(--bg-2); border: 2px solid var(--line); border-radius: 999px; cursor: pointer; }
.a2m-pills input { position: absolute; opacity: 0; pointer-events: none; }
.a2m .a2m-pills label:has(input:checked) { color: var(--on-action); background: var(--action); box-shadow: 2px 2px 0 var(--shade); }
.a2m .a2m-pills label:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.a2m .a2m-volume { flex: 1 1 9rem; max-width: 14rem; }
.a2m-clock { min-width: 9ch; font-family: var(--font-mono); font-size: .92rem; }

.a2m-rolltools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; font-size: .85rem; font-weight: 650; }
.a2m-zoom { display: inline-flex; align-items: center; gap: .4rem; }
.a2m-zoom > span { margin-left: .3rem; color: var(--ink-soft); }
.a2m .a2m-rolltools button { min-width: 42px; padding: .35rem .7rem; }
.a2m-rolltools .a2m-check { margin-left: auto; }
.a2m-roll { position: relative; height: 340px; overflow: auto; background: var(--field); border: 2px solid var(--line); border-radius: 8px; overscroll-behavior: contain; }
@media (max-width: 600px) { .a2m-roll { height: 280px; } }
.a2m-roll-size { position: absolute; top: 0; left: 0; pointer-events: none; }
.a2m-roll-canvas { position: sticky; top: 0; left: 0; display: block; width: 100%; height: 100%; }

.a2m-downloads { align-items: center; }
.a2m-list { padding: .7rem .9rem; border: 1.5px solid var(--border-soft); border-radius: 10px; }
.a2m-list summary { font-weight: 700; cursor: pointer; }
.a2m-table-wrap { max-height: 22rem; margin-top: .6rem; overflow: auto; }
.a2m table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.a2m th, .a2m td { padding: .35rem .6rem; text-align: left; border-bottom: 1px solid var(--border-faint); white-space: nowrap; }
.a2m thead th { position: sticky; top: 0; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); background: var(--paper-3); }
.a2m td { font-family: var(--font-mono); }

.a2m-settings { display: grid; gap: .9rem; min-width: 0; padding: 1rem; background: var(--blue-tint); border: 2px solid var(--line); border-radius: 10px; }
.a2m-settings > .a2m-pills { gap: .35rem; }
.a2m .a2m-presets label { min-height: 38px; padding: .3rem .75rem; font-size: .85rem; }
.a2m-group { display: grid; gap: .55rem; min-width: 0; margin: 0; padding: .85rem; background: var(--bg-2); border: 1.5px solid var(--border-soft); border-radius: 8px; }
.a2m-group legend { padding: 0 .35rem; font-weight: 750; }
.a2m-group label { font-size: .88rem; }
.a2m-group .a2m-sub { margin-top: -.25rem; }
.a2m-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .55rem; }
.a2m-foot { font-size: .85rem; }
.a2m .a2m-presets legend { position: static; width: auto; height: auto; margin-bottom: .45rem; overflow: visible; clip: auto; font-weight: 750; }

/* Space the page holds for this view until it mounts (see .tool-view-placeholder in _workspace.css).
   Each height is a little under the space the view takes at that width, measured as how far the
   content below moves when the view replaces the placeholder, so nothing below it moves. Re-measure
   after changing the view's layout: node scripts/measure-tool-views.js --apply mp3-to-midi. */
.tool-view-placeholder[data-tool="mp3-to-midi"] { min-height: 1504px; }
@media (max-width: 788px) { .tool-view-placeholder[data-tool="mp3-to-midi"] { min-height: 1641px; } }
@media (max-width: 420px) { .tool-view-placeholder[data-tool="mp3-to-midi"] { min-height: 2105px; } }
