/* Shared layout for the phase 2 calculators: pitch bend, SysEx checksum, MIDI ticks, message decoder, chord identifier, synth demo. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; margin: .5rem 0 1rem; }
.calc-grid fieldset, .calc-panel { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: .6rem; padding: .75rem 1rem; }
.calc-grid legend, .calc-panel > h3 { font-weight: 700; padding: 0 .35rem; margin: 0 0 .25rem; font-size: 1rem; }
.calc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .6rem; align-items: end; }
.calc-row label, .calc-panel label { font-weight: 600; margin-bottom: .2rem; display: block; }
.calc-row input, .calc-row select, .calc-panel input, .calc-panel select, .calc-panel textarea { width: 100%; margin: 0; }
.calc-panel textarea { font-family: var(--mono-font, ui-monospace, monospace); min-height: 6rem; }
.calc-out { color: var(--ink); font-weight: 600; display: block; margin: .5rem 0 0; overflow-wrap: anywhere; }
.calc-out code, .hexline { font-family: var(--mono-font, ui-monospace, monospace); }
.hexline { display: block; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: .5rem; overflow-x: auto; white-space: nowrap; margin: .35rem 0; }
.calc-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.calc-actions button { margin: 0; }
.calc-ok { color: #7ee2a8; }
.calc-bad { color: #ff9b9b; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #ff8a8a; }
.table-scroll { position: relative; overflow-x: auto; max-width: 100%; margin: .75rem 0; border: 1px solid var(--line); border-radius: .6rem; }
.table-scroll:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.table-scroll table { margin: 0; width: 100%; border-collapse: collapse; }
.num td, .num th { font-variant-numeric: tabular-nums; }
.num td { text-align: end; white-space: nowrap; }
.decoder-table td:nth-child(2) { font-family: var(--mono-font, ui-monospace, monospace); text-align: start; white-space: nowrap; }
.decoder-table .rs-flag { display: block; width: max-content; margin-top: .2rem; }
.decoder-table td:last-child { text-align: start; white-space: normal; min-width: 11rem; }
.table-scroll caption { text-align: start; padding: .5rem .6rem; }
.rs-flag { font-size: .8rem; border: 1px solid var(--line); border-radius: .3rem; padding: 0 .3rem; margin-left: .3rem; white-space: nowrap; }
/* Two-octave piano (14 white keys) used by the chord identifier and the synth demo. */
.piano .bk-1 { left: calc(100% / 14 * 1); } .piano .bk-2 { left: calc(100% / 14 * 2); } .piano .bk-3 { left: calc(100% / 14 * 3); } .piano .bk-4 { left: calc(100% / 14 * 4); } .piano .bk-5 { left: calc(100% / 14 * 5); } .piano .bk-6 { left: calc(100% / 14 * 6); } .piano .bk-7 { left: calc(100% / 14 * 7); } .piano .bk-8 { left: calc(100% / 14 * 8); } .piano .bk-9 { left: calc(100% / 14 * 9); } .piano .bk-10 { left: calc(100% / 14 * 10); } .piano .bk-11 { left: calc(100% / 14 * 11); } .piano .bk-12 { left: calc(100% / 14 * 12); } .piano .bk-13 { left: calc(100% / 14 * 13); }
.piano { position: relative; display: flex; height: 9rem; margin: .75rem 0; user-select: none; touch-action: manipulation; max-width: 100%; }
.piano button { margin: 0; padding: 0; border-radius: 0 0 .35rem .35rem; min-width: 0; }
.piano .white { flex: 1 1 0; height: 100%; background: #f4f1ea; color: #222; border: 1px solid #555; display: flex; align-items: flex-end; justify-content: center; font-size: .7rem; padding-bottom: .3rem; }
.piano .black { position: absolute; top: 0; height: 58%; width: calc(100% / 14 * .62); transform: translateX(-50%); background: #1d1d1d; color: #ddd; border: 1px solid #000; z-index: 1; font-size: 0; }
.piano [aria-pressed="true"].white, .piano .white.on { background: #8fd3ff; }
.piano [aria-pressed="true"].black, .piano .black.on { background: #2f7fb5; }
.piano button:focus-visible { outline: 3px solid #ffbf47; outline-offset: -3px; z-index: 2; }
.chord-results li { margin: .35rem 0; }
.chord-results strong { font-size: 1.15rem; }
.synth-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .6rem 1rem; }
.synth-controls label { font-weight: 600; display: block; }
.synth-controls input, .synth-controls select { width: 100%; margin: 0; }
@media (max-width: 650px) {
  .table-scroll th, .table-scroll td { padding: .4rem .5rem; }
  .piano { height: 7rem; }
}
.note-chart tr.mark td { font-weight: 700; }
.synth-controls input[type="range"] { background: transparent; border: 0; padding: 0; min-height: 44px; cursor: pointer; }
.synth-controls input[type="range"]::-webkit-slider-runnable-track { height: .45rem; border-radius: 1rem; background: var(--line); }
.synth-controls input[type="range"]::-moz-range-track { height: .45rem; border-radius: 1rem; background: var(--line); }
.synth-controls input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 1.5rem; height: 1.5rem; margin-top: -.53rem; border-radius: 50%; background: var(--accent); border: 2px solid var(--paper); }
.synth-controls input[type="range"]::-moz-range-thumb { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent); border: 2px solid var(--paper); }
.calc-check { display: flex; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; }
.calc-check input { flex: none; width: 1.35rem; height: 1.35rem; min-height: 0; padding: 0; margin: 0; accent-color: var(--accent); }
