.bc { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.bc [hidden] { display: none !important; }

/* Reading panel with the metronome */
.bc-meter { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; padding: 16px 16px 24px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.bc-meter-top { align-self: stretch; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bc-source { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--muted); }
.bc-click { flex: none; height: 44px; padding: 0 16px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--card); color: var(--ink); font: 600 14px/1 var(--font-body); cursor: pointer; }
.bc-click[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.bc-metro { width: 120px; height: 140px; }
.bc-metro-body { fill: var(--accent); }
.bc-metro-face { fill: var(--card); }
.bc-metro-ticks { stroke: var(--muted); stroke-width: 2; stroke-linecap: round; fill: none; }
.bc-arm { transform-box: view-box; transform-origin: 60px 112px; }
.bc-arm-rod { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.bc-arm-weight { fill: var(--gold); stroke: var(--ink); stroke-width: 2; }
.bc-metro-pivot, .bc-metro-base { fill: var(--ink); }
.is-live .bc-arm { animation: bc-swing var(--beat, .5s) ease-in-out infinite alternate; }
@keyframes bc-swing { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }
@media (prefers-reduced-motion: reduce) { .is-live .bc-arm { animation: none; } }
.bc-readout { margin: 0; display: flex; align-items: baseline; gap: 8px; line-height: 1.2; }
.bc-num { min-width: 3ch; text-align: center; color: var(--ink); font: 700 48px/1.2 var(--font-head); font-variant-numeric: tabular-nums; }
.bc-unit { color: var(--muted); font: 600 18px/1 var(--font-body); }
.bc-note { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.bc-facts { align-self: stretch; margin: 8px 0 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.bc-facts > div { grid-column: span 2; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.bc-facts > .bc-wide { grid-column: span 3; }
.bc-facts dt { font-size: 12px; color: var(--muted); }
.bc-facts dd { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Inputs: tap pad on top, file drop below */
.bc-inputs { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bc-pad { flex: 1; min-height: 176px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font-family: var(--font-body); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: background-color .15s; }
.bc-pad:hover { background: var(--accent-deep); }
.bc-pad:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.bc-pad-main { font: 700 36px/1.2 var(--font-head); }
.bc-pad-sub { font-size: 14px; }
.bc-pad.is-hit { animation: bc-hit .2s ease-out; }
@keyframes bc-hit { from { box-shadow: 0 0 0 0 var(--gold); } to { box-shadow: 0 0 0 12px rgba(224, 160, 58, 0); } }
.bc-tapbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bc-tapinfo { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.bc-btn { height: 44px; padding: 0 16px; border: 1px solid var(--ink); border-radius: var(--radius); background: transparent; color: var(--ink); font: 600 14px/1 var(--font-body); cursor: pointer; }
.bc-btn:hover:not(:disabled) { background: var(--ink); color: var(--card); }
.bc-btn:disabled, .bc-click:disabled { opacity: .5; cursor: not-allowed; }
.bc-btn:focus-visible, .bc-click:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.bc-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 112px; padding: 16px; border: 2px dashed var(--muted); border-radius: var(--radius); background: var(--bg); text-align: center; cursor: pointer; }
.bc-drop:hover, .bc-drop.is-over { border-color: var(--accent); background: var(--card); }
.bc-drop:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.bc-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.bc-drop-main { font-size: 16px; }
.bc-link { color: var(--accent-deep); font-weight: 600; text-decoration: underline; }
.bc-drop-sub { font-size: 14px; color: var(--muted); }
/* File-only mode (data-mode="file" on the tool root): no tap pad, the drop zone takes its place */
[data-mode="file"] .bc-pad, [data-mode="file"] .bc-tapbar { display: none; }
[data-mode="file"] .bc-drop { flex: 1; min-height: 176px; }
[data-mode="file"] .bc-drop-main { font-size: 18px; }

/* Batch results */
.bc-results { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--line); }
.bc-results-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bc-progress { margin: 0; font-weight: 600; }
.bc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bc-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.bc-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.bc-table th, .bc-table td { padding: 8px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.bc-table th { background: var(--bg); color: var(--muted); font-weight: 600; }
.bc-table tbody tr { cursor: pointer; }
.bc-table tbody tr:hover, .bc-table tbody tr.is-current { background: var(--tint); }
.bc-table tbody tr:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.bc-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.bc-strong { font-weight: 600; }
.bc-wait { color: var(--muted); }
.bc-err { color: var(--accent-deep); white-space: normal; }

@media (max-width: 760px) {
  .bc { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
  /* Compact reading panel so the tap pad stays on the first screen of a phone */
  .bc-meter { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "top top" "metro read" "metro note" "facts facts"; column-gap: 12px; row-gap: 4px; align-items: center; padding: 12px; }
  .bc-meter-top { grid-area: top; }
  .bc-metro { grid-area: metro; width: 64px; height: 75px; }
  .bc-readout { grid-area: read; }
  .bc-note { grid-area: note; text-align: left; }
  .bc-num { min-width: 0; text-align: left; }
  .bc-facts { grid-area: facts; margin-top: 4px; }
  .bc-facts > div { padding: 4px 8px; }
  .bc-click { height: 40px; }
  .bc-pad { min-height: 112px; }
  .bc-pad-main { font-size: 28px; }
  .bc-name { max-width: 160px; }
}
