/* The original double q palette and square, bevelled controls. */
.update-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr); gap: 20px; max-width: 1150px; }
.update-card { background: var(--panel); border: 1px solid var(--stroke); box-shadow: var(--bevel); min-width: 0; }
.update-card-body { padding: 24px; }
.update-card-body h2 { margin-top: 0; font-size: 18px; }
.update-card-body p { line-height: 1.65; }
.update-versions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 4px 0 26px; }
.update-versions strong { display: block; font-size: clamp(18px, 2vw, 26px); font-weight: 600; margin-top: 8px; }
.update-arrow { font-size: 28px; color: var(--blue); }
.update-note { color: var(--muted); font-size: 12px; }
.update-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 20px 0; }
.update-message { min-height: 40px; overflow-wrap: anywhere; }
.update-progress-label { display: flex; justify-content: space-between; margin: 24px 0 10px; }
.update-progress-area progress { width: 100%; height: 9px; accent-color: var(--yellow); border: 0; background: var(--bg); }
.update-progress-area progress::-webkit-progress-bar { background: var(--bg); }
.update-progress-area progress::-webkit-progress-value { background: var(--yellow); }
.update-flow { counter-reset: update; list-style: none; padding: 24px; margin: 0; }
.update-flow li { position: relative; padding: 0 0 22px 34px; }
.update-flow li:last-child { padding-bottom: 0; }
.update-flow li::before { counter-increment: update; content: counter(update); position: absolute; left: 0; color: var(--yellow); font-family: var(--mono); }
.update-flow strong, .update-flow span { display: block; }
.update-flow span { color: var(--muted); margin-top: 5px; font-size: 12px; }
.update-support { margin-top: 22px; color: var(--muted); font-size: 12px; }
.update-support summary { color: var(--blue); cursor: pointer; }
@media (max-width: 1000px) { .update-layout { grid-template-columns: 1fr; } }
@media (max-width: 500px) { .update-card-body, .update-flow { padding: 18px; } .update-versions { gap: 8px; } }
:root {
  color-scheme: dark;
  --bg: #111015;
  --panel: #1f1e25;
  --panel2: #24232c;
  --stroke: #3a3942;
  --border-light: #5f5d68;
  --border-dark: #05040a;
  --text: #f4f3f8;
  --muted: #b8b6c3;
  --yellow: #ffd95a;
  --blue: #6ea4ff;
  --yellow-soft: #4b3e14;
  --blue-soft: #324368;
  --pink: #eea9b4;
  --font:
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Lucida Grande",
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --bevel: inset 1px 1px 0 #ffffff09;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background: linear-gradient(
    90deg,
    #14141a 0,
    #14141a 1px,
    #17171f 1px,
    #17171f 2px
  );
  background-size: 4px 4px;
  color: var(--text);
  font: 13px/1.5 var(--font);
}
[hidden] {
  display: none !important;
}
button,
input,
select {
  font: inherit;
  color: inherit;
  border-radius: 0;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
button,
input,
select {
  border: 1px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark)
    var(--border-light);
}
button {
  background: #2b2a35;
  padding: 5px 9px;
  box-shadow: var(--bevel);
  font-size: 11px;
}
button:hover:not(:disabled) {
  background: #343340;
}
input,
select {
  background: #111015;
  padding: 5px 7px;
  font-size: 12px;
  min-width: 0;
}
select {
  background: #181720;
  min-height: 29px;
}
.app {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1760px;
  margin: 0 auto;
  border-left: 1px solid var(--stroke);
  border-right: 1px solid var(--stroke);
}
.sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 16px 10px 10px;
  background: #191821;
  border-right: 1px solid var(--border-dark);
  box-shadow: 1px 0 0 var(--border-light);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand {
  display: flex;
  color: var(--yellow);
  font-size: 17px;
  letter-spacing: 0.12em;
  font-weight: 700;
  padding: 0 7px 15px;
  flex-shrink: 0;
  text-shadow: 0 1px 2px #000;
}
.brand:hover {
  text-decoration: none;
}
.brand small {
  display: block;
  color: var(--muted);
  font: 10px var(--mono);
  letter-spacing: 0.1em;
  margin-top: 3px;
}
.navigation {
  display: grid;
  gap: 4px;
  margin: 7px 0 25px;
  flex-shrink: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 7px 8px;
  font-size: 10px;
  color: var(--muted);
}
.nav-item > span:first-child {
  width: 16px;
  font-size: 15px;
}
.nav-item.active {
  background: #111015;
  color: var(--yellow);
  border-color: #05040a #5f5d68 #5f5d68 #05040a;
}
.nav-count {
  margin-left: auto;
  font: 11px var(--mono);
}
.section-label,
.eyebrow,
.tab-label,
.breadcrumbs,
.readout-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 9px;
}
.eyebrow {
  color: var(--yellow);
  margin-bottom: 5px;
  display: block;
}
.icon-button {
  min-width: 24px;
  padding: 1px 5px;
  font-size: 17px;
}
.slot-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 10px;
  scrollbar-width: thin;
}
.slot-list {
  display: grid;
  gap: 5px;
}
.slot {
  display: flex;
  width: 100%;
  padding: 8px 6px;
  gap: 8px;
  text-align: left;
  align-items: center;
  background: #22212a;
  min-width: 0;
}
.slot.selected {
  background: #302c1d;
  border-top-color: #9c8950;
  border-left-color: #9c8950;
}
.slot-number {
  font: 11px var(--mono);
  color: var(--muted);
  background: #131218;
  border: 1px solid var(--stroke);
  padding: 3px 5px;
  flex-shrink: 0;
}
.slot.selected .slot-number {
  color: var(--yellow);
  border-color: #665b33;
}
.slot-info {
  min-width: 0;
}
.slot-info strong {
  font-size: 12px;
  font-weight: 500;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 119px;
}
.slot-info small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.slot-dirty {
  color: var(--yellow);
  margin-left: auto;
  font-size: 16px;
}
.sidebar-note {
  font-size: 10px;
  color: var(--muted);
  margin: 12px 3px;
  line-height: 1.6;
}
.sidebar-bottom {
  flex-shrink: 0;
  border-top: 1px solid var(--stroke);
  padding: 11px 4px 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 11px;
}
.sidebar-bottom small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin: 3px 0;
}
.connect-button {
  padding: 4px 10px;
  margin: 2px 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tiny-led,
.line-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: #77737f;
  flex-shrink: 0;
}
.tiny-led.online,
.line-dot {
  background: var(--yellow);
}
.main-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #17161cc7;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 15px;
  min-height: 41px;
  background: linear-gradient(180deg, #262530, #181720);
  border-bottom: 1px solid var(--border-dark);
  box-shadow: 0 1px 0 var(--border-light);
  gap: 12px;
}
.breadcrumbs span {
  margin-left: 12px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.subtle-badge {
  font: 10px var(--mono);
  padding: 3px 6px;
  color: var(--muted);
  border: 1px solid var(--stroke);
  background: #15141b;
  white-space: nowrap;
}
.panic {
  font-size: 10px;
  color: var(--pink);
  text-transform: uppercase;
  display: flex;
  gap: 6px;
  align-items: center;
}
main {
  flex: 1;
  min-width: 0;
  padding: 20px 17px 30px;
}
.view {
  min-width: 0;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.page-heading > div:first-child {
  min-width: 0;
}
.page-heading p {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}
h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}
h1,
.title-input {
  font: 600 25px/1.3 var(--font);
  letter-spacing: -0.5px;
  margin: 0;
}
.title-input {
  width: min(100%, 460px);
  background: transparent;
  padding: 0 2px;
  border: 1px solid transparent;
  box-shadow: none;
}
.title-input:hover {
  border-color: var(--stroke);
}
.heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 29px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 6px 10px;
}
.button.primary {
  background: var(--yellow-soft);
  color: #fffbe0;
  border-color: #c6ad68 #2d2510 #2d2510 #c6ad68;
}
.button.primary:hover:not(:disabled) {
  background: #5c4a19;
}
.button.secondary {
  background: #25242f;
}
.button.small {
  padding: 4px 8px;
  min-height: 25px;
}
.save-state {
  font-size: 10px;
  color: var(--muted);
}
.target-profile {
  min-width: 137px !important;
  margin: 0 !important;
}
.target-profile > span {
  font-size: 9px !important;
}
.target-profile select {
  font-size: 11px;
  min-height: 27px;
}
.mapping-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 15px;
  align-items: start;
}
.mapping-main {
  min-width: 0;
}
.mapping-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 9px;
  gap: 10px;
}
.tab-label span {
  font-size: 10px;
  margin-left: 10px;
  color: #9693a3;
  letter-spacing: 0;
  text-transform: none;
}
.route-list {
  display: grid;
  gap: 5px;
}
.route-card {
  display: grid;
  grid-template-columns: 23px minmax(75px, 1fr) 13px minmax(90px, 1fr) 21px;
  gap: 9px;
  align-items: center;
  background: var(--panel);
  border: 1px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark)
    var(--border-light);
  padding: 10px;
  position: relative;
  cursor: pointer;
  box-shadow: var(--bevel);
}
.route-card.selected {
  background: #252b3b;
  border-top-color: var(--blue);
  border-left-color: var(--blue);
}
.route-card.disabled {
  opacity: 0.55;
}
.route-card strong {
  font-size: 12px;
  line-height: 1.4;
  display: block;
  font-weight: 500;
}
.route-card small {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-top: 3px;
}
.route-icon {
  font-size: 16px;
  color: var(--yellow);
  text-align: center;
  font-family: var(--mono);
}
.route-card[data-kind="3"] .route-icon {
  color: var(--blue);
}
.route-arrow {
  color: #9794a2;
}
.route-toggle {
  appearance: auto;
  accent-color: var(--yellow);
  width: 15px;
  height: 15px;
  padding: 0;
  min-width: 0;
  margin: 0;
}
.route-signal {
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 2px;
}
.route-signal i {
  display: block;
  height: 2px;
  background: var(--blue);
  opacity: 0.6;
  width: 0;
}
.routing-foot {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  padding: 11px 1px;
  font-size: 10px;
  color: var(--muted);
}
.routing-foot .text-button {
  margin-left: auto;
}
.text-button {
  border: 0;
  box-shadow: none;
  background: none;
  padding: 2px 0;
  color: var(--blue);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
.text-button:hover:not(:disabled) {
  background: none;
  color: #a9c8ff;
  text-decoration: underline;
}
.route-editor,
.monitor-card,
.performance-readout,
.template-detail,
.device-contents {
  border: 1px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark)
    var(--border-light);
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--stroke);
}
.route-editor {
  overflow: hidden;
  min-width: 0;
}
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  background: #2a2933;
  border-bottom: 1px solid var(--border-dark);
}
.editor-header span {
  font: 10px var(--mono);
  color: var(--muted);
}
.editor-header strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}
.editor-section {
  padding: 12px;
  border-bottom: 1px solid var(--stroke);
}
.editor-section h3 {
  font-size: 10px;
  color: var(--yellow);
  font-weight: 500;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
}
.field {
  display: block;
  min-width: 0;
  margin: 0 0 10px;
}
.field:last-child {
  margin-bottom: 0;
}
.field > span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.field input,
.field select {
  width: 100%;
  font-size: 11px;
  min-height: 28px;
}
.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
}
.field-pair .field {
  margin-bottom: 0;
}
.field-help {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin: 7px 0 0;
}
.source-reference {
  font: 9px/1.6 var(--mono);
  color: var(--blue);
  margin: -3px 0 11px;
}
.source-warning {
  color: var(--yellow);
}
.response-plot {
  display: block;
  width: 100%;
  height: 77px;
  background: #111015;
  border: 1px solid var(--stroke);
  margin: 9px 0 11px;
}
.range-actions {
  display: flex;
  gap: 13px;
  margin-top: 6px;
}
.range-actions .text-button {
  font-size: 10px;
}
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}
.danger-text {
  color: var(--pink);
}
.editor-placeholder {
  padding: 26px 18px;
  color: var(--muted);
  font-size: 12px;
}
.invalid {
  border-color: var(--pink) !important;
}
.empty-state {
  padding: 32px 18px;
  text-align: center;
  border: 1px dashed var(--border-light);
  background: var(--panel);
}
.empty-symbol {
  font-size: 25px;
  color: var(--yellow);
}
.empty-state h2 {
  font-size: 18px;
  font-weight: 500;
  margin: 7px 0;
}
.empty-state p {
  font-size: 12px;
  color: var(--muted);
  margin: 10px auto 20px;
  max-width: 360px;
}
.empty-state .text-button {
  display: block;
  margin: 12px auto 0;
}
.monitor-card {
  margin-top: 18px;
  overflow: hidden;
}
.monitor-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #24232c;
  border-bottom: 1px solid var(--stroke);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.monitor-body {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 150px;
  gap: 10px;
  padding: 8px 12px;
  align-items: center;
}
#handCanvas {
  display: block;
  width: 100%;
  height: 165px;
}
.monitor-readout {
  padding-left: 12px;
  border-left: 1px solid var(--stroke);
}
.monitor-readout strong {
  font: 20px var(--mono);
  display: block;
  margin: 4px 0 12px;
}
.readout-label {
  font-size: 9px;
}
.axis-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 10px var(--mono);
  margin: 9px 0;
}
.axis-row > span:last-child {
  width: 30px;
  text-align: right;
}
.meter {
  height: 3px;
  background: #3a3942;
  flex: 1;
}
.meter i {
  display: block;
  height: 3px;
  background: var(--blue);
  width: 0;
}
.monitor-readout .text-button {
  margin-top: 9px;
  font-size: 10px;
}
.monitor-hint {
  font-size: 10px;
  color: var(--muted);
  padding: 0 12px 11px;
  margin: 0;
}
.notice {
  margin: 13px 17px 0;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-size: 12px;
  background: #34301e;
  border: 1px solid #887443;
}
.notice.error {
  background: #35262e;
  border-color: #805863;
  color: #f4c8d3;
}
.notice button {
  border: 0;
  background: none;
  box-shadow: none;
  font-size: 16px;
}
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 33px;
  padding: 5px 15px;
  border-top: 1px solid var(--stroke);
  font: 9px var(--mono);
  color: #a4a0b1;
  background: #1c1b24;
}
.statusbar > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.statusbar .text-button {
  font-size: 10px;
  white-space: nowrap;
}
.statusbar #footerDetail {
  margin-right: auto;
}
.performance-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 245px;
  gap: 15px;
}
.play-pad {
  height: 355px;
  position: relative;
  overflow: hidden;
  border: 1px solid #68637a;
  background: radial-gradient(#57526766 1px, transparent 1px), #171620;
  background-size: 20px 20px;
  touch-action: none;
  cursor: crosshair;
}
.pad-top {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  position: relative;
  font: 10px var(--mono);
  color: var(--yellow);
}
.pad-top span:last-child {
  border: 1px solid #685d3b;
  padding: 1px 5px;
}
.pad-cross {
  position: absolute;
  background: #6ea4ff33;
}
.pad-cross.horizontal {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}
.pad-cross.vertical {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}
.pad-cursor {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 29px;
  height: 29px;
  border: 1px solid #ffd95a80;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.pad-cursor i {
  width: 5px;
  height: 5px;
  background: var(--yellow);
}
.pad-instruction {
  position: absolute;
  left: 15px;
  bottom: 17px;
  font-size: 14px;
  pointer-events: none;
}
.pad-instruction span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.pad-axis {
  position: absolute;
  right: 15px;
  bottom: 17px;
  font: 11px var(--mono);
  color: var(--muted);
}
.preview-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 9px 0 14px;
}
.preview-controls > span {
  font-size: 10px;
  color: var(--muted);
  margin-right: auto;
}
.seg {
  font-size: 10px;
  padding: 3px 7px;
}
.seg.active {
  background: var(--yellow-soft);
  color: var(--yellow);
}
.keyboard {
  display: flex;
  gap: 2px;
  height: 76px;
  padding: 7px;
  background: #101015;
  border: 1px solid var(--stroke);
  overflow: hidden;
}
.key {
  flex: 1;
  min-width: 6px;
  background: #d1cfd7;
  color: #302d3c;
  font: 9px var(--mono);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
}
.key.black {
  flex: 0.6;
  margin: 0 -1.1%;
  height: 65%;
  z-index: 1;
  background: #373341;
  box-shadow: 0 2px 0 #05040a;
}
.key.playing {
  background: var(--yellow);
}
.key.black.playing {
  background: #bc9f42;
}
.performance-readout {
  padding: 14px;
}
.performance-readout .section-label {
  margin: 0 0 10px;
}
.output-row {
  padding: 10px 0;
  border-top: 1px solid var(--stroke);
}
.output-row strong {
  font-size: 12px;
  display: block;
  font-weight: 500;
}
.output-row small {
  font-size: 10px;
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.output-row b {
  font: 23px var(--mono);
  color: var(--yellow);
  display: block;
  margin: 6px 0;
}
.play-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
  border-top: 1px solid var(--stroke);
  padding-top: 12px;
  margin-top: 9px;
}
.template-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0 13px;
}
.template-tab {
  text-align: left;
  padding: 8px 11px;
  font-size: 12px;
  flex: 1 1 145px;
}
.template-tab.active {
  color: var(--yellow);
  background: #302c1d;
  border-top-color: #a68f50;
  border-left-color: #a68f50;
}
.template-tab small {
  display: block;
  font: 9px var(--mono);
  color: var(--muted);
  margin-top: 4px;
}
.template-detail {
  min-width: 0;
}
.template-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  background: #292832;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-dark);
}
.template-heading h2 {
  font-size: 21px;
  line-height: 1.3;
  margin: 0;
  font-weight: 600;
}
.template-heading p {
  font-size: 12px;
  margin: 5px 0 0;
  color: var(--muted);
}
.template-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 15px;
  background: #24232c;
  border-bottom: 1px solid var(--stroke);
  flex-wrap: wrap;
}
.template-controls .field {
  margin: 0;
  min-width: 100px;
}
.template-controls .field:first-child {
  min-width: 180px;
}
.template-controls .field-help {
  font-size: 10px;
  max-width: 220px;
  margin: 0;
  align-self: center;
}
.template-table-wrap,
.reference-table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
}
.template-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  min-width: 540px;
}
.template-table th {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  background: #17161e;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-light);
}
.template-table th:nth-child(1) {
  width: 24%;
}
.template-table th:nth-child(2) {
  width: 16%;
}
.template-table th:nth-child(3) {
  width: 25%;
}
.template-table th:nth-child(4) {
  width: 16%;
}
.template-table th:nth-child(5) {
  width: 19%;
}
.template-table td {
  padding: 10px 11px;
  vertical-align: top;
  border-right: 1px solid #35333f;
  overflow-wrap: anywhere;
}
.template-table td:last-child {
  border-right: 0;
}
.template-table td strong {
  font-weight: 500;
  color: var(--text);
}
.template-table small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 4px;
  line-height: 1.5;
}
.template-explanation td {
  background: #1a1922;
  border-bottom: 1px solid var(--stroke);
  font-size: 10px;
  color: var(--muted);
  padding-top: 7px;
  padding-bottom: 9px;
}
.template-explanation b {
  color: var(--yellow);
  margin-right: 4px;
}
.template-guidance {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 15px;
  font-size: 11px;
  color: var(--muted);
}
.template-guidance h3 {
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  font-weight: 500;
  margin: 0 0 8px;
}
.template-guidance ul,
.template-guidance ol {
  padding-left: 17px;
  margin: 0;
}
.template-guidance li + li {
  margin-top: 7px;
}
.template-sources {
  display: grid;
  gap: 7px;
  font-size: 10px;
  margin: 12px 0 0;
}
.reference-table-wrap .template-table {
  min-width: 360px;
}
.reference-table-wrap .template-table td {
  border-bottom: 1px solid var(--stroke);
}
.library-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 26px 0 11px;
}
.library-heading h2 {
  font-size: 17px;
  font-weight: 500;
  margin: 0;
}
.library-heading span {
  font-size: 10px;
  color: var(--muted);
}
.local-library,
.device-library {
  display: grid;
  gap: 7px;
}
.library-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  background: var(--panel);
}
.library-row strong {
  font-size: 12px;
  font-weight: 500;
}
.library-row small {
  font-size: 10px;
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.library-row .text-button {
  margin-left: auto;
}
.library-empty {
  padding: 18px;
  border: 1px dashed var(--stroke);
  font-size: 11px;
  color: var(--muted);
  background: #1b1a22;
}
.device-contents {
  padding: 10px 12px;
}
.device-contents summary {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 12px;
}
.device-contents summary span {
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
}
.saved-mapping {
  font-size: 11px;
  line-height: 1.65;
  color: var(--muted);
  border-top: 1px solid var(--stroke);
  margin-top: 10px;
  padding-top: 10px;
}
.saved-mapping strong {
  font-weight: 500;
  color: var(--text);
}
.saved-actions {
  display: flex;
  gap: 17px;
  margin-top: 12px;
  flex-wrap: wrap;
}
dialog {
  width: calc(100% - 30px);
  max-width: 640px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 23px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark)
    var(--border-light);
  box-shadow:
    0 0 0 1px var(--stroke),
    0 15px 70px #000b;
  border-radius: 0;
}
dialog::backdrop {
  background: #08070ca8;
}
.dialog-close {
  position: absolute;
  right: 7px;
  top: 7px;
}
dialog h2 {
  font-size: 21px;
  margin: 0 18px 15px 0;
  font-weight: 500;
}
dialog p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
dialog .button {
  margin-top: 12px;
}
.mobile-slot {
  display: none;
}
@media (min-width: 1450px) {
  main {
    padding: 25px;
  }
  .mapping-workspace {
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 20px;
  }
  .route-card {
    padding: 14px;
  }
  .monitor-body {
    grid-template-columns: 1fr 185px;
  }
  #handCanvas {
    height: 205px;
  }
}
@media (max-width: 1100px) {
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .heading-actions {
    justify-content: flex-start;
  }
  .save-state {
    display: none;
  }
  .mapping-workspace {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 11px;
  }
  .route-card {
    grid-template-columns: 18px minmax(60px, 1fr) 10px minmax(75px, 1fr) 17px;
    gap: 6px;
    padding: 8px;
  }
  .monitor-body {
    grid-template-columns: 1fr 125px;
    padding: 6px 9px;
  }
  .monitor-readout {
    padding-left: 9px;
  }
  .performance-layout {
    grid-template-columns: minmax(220px, 1fr) 210px;
  }
  .template-guidance {
    gap: 15px;
  }
}
@media (max-width: 930px) {
  .app {
    grid-template-columns: 165px minmax(0, 1fr);
  }
  .sidebar {
    padding: 14px 8px 9px;
  }
  .brand {
    font-size: 16px;
  }
  .slot-info strong {
    max-width: 101px;
  }
  .mapping-workspace {
    grid-template-columns: 1fr;
  }
  .route-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .editor-header,
  .editor-actions,
  .editor-section:nth-child(4) {
    grid-column: 1/-1;
  }
  .editor-section:nth-child(2) {
    border-right: 1px solid var(--stroke);
  }
  .performance-layout {
    grid-template-columns: 1fr;
  }
  .statusbar #footerDetail {
    display: none;
  }
  .statusbar {
    gap: 7px;
  }
  .template-guidance {
    grid-template-columns: 1fr;
  }
  main {
    padding: 17px 12px 25px;
  }
  .topbar {
    padding: 8px 12px;
  }
  .top-actions {
    gap: 6px;
  }
  .route-card {
    grid-template-columns: 22px minmax(70px, 1fr) 13px minmax(90px, 1fr) 21px;
    gap: 8px;
    padding: 10px;
  }
  .notice {
    margin: 12px 12px 0;
  }
}
@media (max-width: 620px) {
  .app {
    display: block;
    border: 0;
  }
  .sidebar {
    height: auto;
    position: static;
    border: 0;
    border-bottom: 1px solid var(--border-light);
    padding: 12px;
    display: block;
  }
  .brand {
    padding: 0 0 11px;
    font-size: 16px;
  }
  .brand small {
    font-size: 9px;
  }
  .navigation {
    display: flex;
    gap: 5px;
    margin: 3px 0 0;
  }
  .nav-item {
    flex: 1;
    justify-content: center;
    font-size: 9px;
    gap: 5px;
    padding: 7px 5px;
  }
  .nav-item > span:first-child {
    display: none;
  }
  .slot-panel {
    display: none;
  }
  .sidebar-bottom {
    position: absolute;
    right: 12px;
    top: 13px;
    border: 0;
    padding: 0;
  }
  .sidebar-bottom > div {
    display: none;
  }
  .connect-button {
    margin: 0;
  }
  .topbar {
    min-height: 36px;
  }
  .top-actions .subtle-badge {
    display: none;
  }
  main {
    padding: 16px 12px 25px;
  }
  .page-heading > div:first-child {
    width: 100%;
  }
  .title-input,
  h1 {
    font-size: 23px;
  }
  .heading-actions {
    gap: 6px;
  }
  .target-profile {
    min-width: 130px !important;
  }
  .mobile-slot {
    display: block;
    margin-bottom: 13px;
  }
  .mobile-slot select {
    max-width: 300px;
  }
  .route-editor {
    display: block;
  }
  .editor-section:nth-child(2) {
    border-right: 0;
  }
  .route-card {
    gap: 6px;
    padding: 9px;
    grid-template-columns: 17px minmax(72px, 1fr) 10px minmax(90px, 1fr) 17px;
  }
  .route-card strong {
    font-size: 11px;
  }
  .route-card small {
    font-size: 9px;
  }
  .monitor-body {
    grid-template-columns: 1fr 125px;
  }
  #handCanvas {
    height: 150px;
  }
  .play-pad {
    height: 300px;
  }
  .template-tab {
    flex-basis: 125px;
    padding: 7px 9px;
  }
  .template-heading {
    padding: 12px;
  }
  .template-heading h2 {
    font-size: 19px;
  }
  .template-controls {
    padding: 10px 12px;
    gap: 8px;
  }
  .template-controls .field:first-child {
    min-width: 165px;
    flex: 1;
  }
  .template-controls .field-help {
    max-width: none;
    width: 100%;
  }
  .template-guidance {
    padding: 12px;
  }
  .library-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
  .library-row {
    gap: 8px;
    padding: 9px;
  }
  .device-contents summary {
    flex-wrap: wrap;
  }
  .device-contents summary span {
    width: 100%;
    margin-left: 36px;
  }
  .statusbar {
    padding: 6px 12px;
  }
  .statusbar > span:first-child {
    font-size: 8px;
  }
  .statusbar .text-button {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Instrument libraries retain the original compact, bevelled control style. */
.midi-mode-status { display:flex; gap:9px; align-items:center; margin:0 0 16px; color:var(--muted); font-size:12px; }
.midi-mode-status small { display:block; margin-top:3px; font-size:11px; }
.mode-dot { width:9px; height:9px; border-radius:50%; background:#36343e; border:1px solid #605b67; flex:none; }
.mode-dot.cc, .mode-dot.mixed { background:#ffd95a; box-shadow:0 0 7px #ffd95a55; }
.mode-dot.mixed { animation:mode-blink 1s step-end infinite; }
@keyframes mode-blink { 50% { background:#36343e; box-shadow:none; } }
@media (prefers-reduced-motion:reduce) { .mode-dot.mixed { animation:none; } }
.template-section { max-width:340px; margin:16px 0; }
.parameter-library { border-top:1px solid #3a3742; padding-top:22px; margin-top:20px; }
.parameter-filters { display:grid; grid-template-columns:2fr 1fr 1fr; gap:10px; margin:14px 0; }
.parameter-results { max-height:540px; overflow:auto; border:1px solid #3a3742; }
.parameter-results thead { position:sticky; top:0; background:#24232c; z-index:1; }
.parameter-results .template-table { min-width:480px; }
.parameter-results td:last-child { white-space:nowrap; }
@media (max-width:760px) { .parameter-filters { grid-template-columns:1fr 1fr; } .parameter-filters .field:first-child { grid-column:1/-1; } }

.prepared-mappings > summary { cursor:pointer; padding:13px; background:#1f1e25; border-block:1px solid #3a3742; font-size:12px; }

.input-mode { display: flex; gap: 6px; margin-bottom: 16px; }
.input-mode .seg { flex: 1; padding: 9px 6px; }
.preview-controls { flex-wrap: wrap; }

.field-pair > .field-help:only-child { grid-column: 1 / -1; }
