/* MK-1 — a modular MIDI keyboard: a charcoal controller case with orange
   accents. The keys keep one size and shape whatever their number (--whites
   white keys of --key-w): the smallest keyboard is as wide as the name and
   preset bar above it. */

.mk {
  --ink: #eceef0;
  --ink-dim: #8f979e;
  --accent: #ff8a2a;
  --accent-glow: rgba(255, 138, 42, 0.65);
  --key-w: 46px;

  display: flex;
  flex-direction: column;
  gap: 10px;
  width: max-content;
  padding: 12px 16px 0;
  border-radius: 10px;
  border: 1px solid #0d0e10;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #2c2f33, #1d1f22 60%, #18191b);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 26px 34px rgba(0, 0, 0, 0.55),
    0 5px 9px rgba(0, 0, 0, 0.42);
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}
.mk [hidden] { display: none !important; }

/* Rows that wrap inside the case: as wide as the keys (or knobs, pads), not wider. */
.mk-bar, .mk-modules { width: 0; min-width: 100%; }

/* ------------------------------------------------------------------ head */

.mk-head { display: flex; align-items: center; gap: 18px; white-space: nowrap; }
.mk-brand { display: flex; align-items: baseline; gap: 10px; }
.mk-logo { font: 800 24px/1 var(--logo-font); letter-spacing: 0.04em; color: #f4f5f6; }
.mk-sub { font: 700 8px var(--font); letter-spacing: 0.32em; color: var(--accent); }
.mk .preset-bar { margin-left: auto; }
.mk .vfd { width: 230px; }

/* ------------------------------------------------------------------- bar */

.mk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px 16px;
  padding: 10px 0 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
}
.mk-group { display: flex; flex-direction: column; gap: 5px; }
.mk-settings { display: flex; flex-direction: column; gap: 8px; }
/* MIDI IN, OUTS and the outputs at the right edge. */
.mk-io { margin-left: auto; align-items: flex-end; }
.mk-label { font: 700 8px/1 var(--font); letter-spacing: 0.18em; color: var(--ink-dim); white-space: nowrap; }
.mk-row { display: flex; align-items: center; gap: 6px; }
.mk-io .mk-row { align-items: flex-start; gap: 10px; }
.mk-outs { display: flex; flex-direction: column; align-items: center; gap: 5px; padding-top: 2px; }
.mk-jack { display: flex; }
.mk .jack-label { font-size: 7.5px; }
.mk .jack-socket { width: 32px; height: 32px; }

.mk-stepper { display: flex; align-items: center; gap: 3px; }
.mk-btn, .mk-toggle, .mk-chip {
  height: 24px;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, #474b51, #2b2e32);
  box-shadow: 0 2px 0 #0b0c0d, inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font: 700 9px var(--font);
  letter-spacing: 0.1em;
  white-space: nowrap;
  cursor: pointer;
}
.mk-btn { width: 24px; padding: 0; font-size: 13px; letter-spacing: 0; }
.mk-btn:active, .mk-toggle:active, .mk-addmenu:active, .mk-chip:active { transform: translateY(1px); box-shadow: 0 1px 0 #0b0c0d, inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.mk-btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.mk-btn:focus-visible, .mk-toggle:focus-visible, .mk-addmenu:focus-visible, .mk-chip:focus-visible,
.mk-tag:focus-visible, .mk-pad:focus-visible, .mk-step:focus-visible, .mk-zone:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.mk-lcd {
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  border-radius: 3px;
  background: radial-gradient(ellipse at 50% 40%, #0a201c, var(--vfd-bg));
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.55), 0 1px 0 1px rgba(255, 255, 255, 0.06);
  color: var(--vfd);
  font: 600 11px/22px var(--mono);
  text-align: center;
  text-shadow: 0 0 6px var(--vfd-dim);
  white-space: nowrap;
}

.mk-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 0 9px 0 7px; }
.mk-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b2412;
  box-shadow: 0 0 0 1px #000;
}
.mk-toggle[aria-pressed="true"] .mk-led { background: var(--accent); box-shadow: 0 0 0 1px #000, 0 0 7px 2px var(--accent-glow); }
.mk-toggle.mk-rec[aria-pressed="true"] .mk-led { background: #ff3b30; box-shadow: 0 0 0 1px #000, 0 0 7px 2px rgba(255, 59, 48, 0.7); }

/* ADD: as tall as the KEYS and VELOCITY beside it; opens the list of what can be added. */
.mk-addmenu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 78px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #4a4e54, #2b2e32);
  box-shadow: 0 2px 0 #0b0c0d, inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font: 800 11px/1 var(--font);
  letter-spacing: 0.2em;
  cursor: pointer;
}
.mk-addmenu:hover { filter: brightness(1.12); }
.mk-addmenu-plus { font: 300 30px/0.8 var(--font); letter-spacing: 0; color: var(--accent); }
.mk-addmenu-caret { font-size: 9px; letter-spacing: 0; color: var(--ink-dim); }
.mk .js-fixed.is-off { visibility: hidden; }

.mk ws-knob.size-xs { --k: 36px; }
.mk ws-knob .ctl-label { min-height: 12px; font-size: 7.5px; color: var(--ink-dim); }

/* ---------------------------------------------------------------- strips */

.mk-modules { display: flex; flex-direction: column; gap: 6px; }
.mk-strip {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 8px;
  padding: 6px 34px 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
}
.mk-strip > .mk-toggle { margin-bottom: 4px; }
/* × in the corner: takes the module off (after asking). */
.mk-strip-remove {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  color: var(--ink-dim);
  font: 400 15px/20px var(--font);
  cursor: pointer;
}
.mk-strip-remove:hover { background: #4a2020; color: #ffd6d0; box-shadow: none; }
.mk-strip-remove:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
/* The grip to drag a strip up or down among the others. */
.mk-grip {
  align-self: stretch;
  width: 12px;
  margin: -2px 0 0 -4px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 1px, transparent 1.5px) 0 0 / 6px 6px;
  cursor: grab;
  touch-action: none;
}
.mk-grip:hover { background-color: rgba(255, 255, 255, 0.06); }
.mk-grip:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.mk-strip.dragging { box-shadow: inset 0 0 0 1px var(--accent), 0 6px 14px rgba(0, 0, 0, 0.5); }
.mk-strip.dragging .mk-grip { cursor: grabbing; }
.mk-strip-head { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.mk-strip-name { font: 800 11px/1 var(--logo-font); letter-spacing: 0.14em; color: var(--accent); }
.mk-strip-head .mk-lcd { width: 70px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.mk-lcd.dim { opacity: 0.45; }
.mk-route { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.mk-strip.is-cut .mk-route { color: #ff8a73; }
.mk-chipbox { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 4px; }
.mk-chip { min-width: 44px; padding: 0 7px; font-family: var(--mono); font-weight: 600; letter-spacing: 0.04em; }

.mk-steps { display: flex; gap: 3px; margin-bottom: 4px; }
.mk-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 26px;
  height: 34px;
  padding: 3px 0 2px;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, #3a3d42, #25272b);
  box-shadow: 0 2px 0 #0b0c0d, inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: var(--ink-dim);
  cursor: pointer;
}
.mk-step-num { font: 700 7px/1 var(--font); }
.mk-step-note { font: 600 7.5px/1 var(--mono); color: var(--ink); white-space: nowrap; }
.mk-step[aria-pressed="true"] { background: linear-gradient(180deg, #5b4330, #3a2a1d); }
.mk-step.beyond { opacity: 0.3; }
.mk-step.cursor { box-shadow: 0 2px 0 #0b0c0d, inset 0 0 0 2px #ff3b30; }
.mk-step.playing { background: linear-gradient(180deg, #ffb066, var(--accent)); color: #2a1606; }
.mk-step.playing .mk-step-note { color: #2a1606; }

/* -------------------------------------------------------- knobs and pads */

.mk-knobs, .mk-pad-row { display: flex; align-items: flex-end; gap: 6px; }
.mk-knobs { padding: 0 2px; }
.mk-knob, .mk-wheel, .mk-pad-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; }

/* The button under a knob, pad or wheel that opens its settings. */
.mk .mk-tag {
  height: 15px;
  min-width: 38px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font: 600 8px/15px var(--mono);
  letter-spacing: 0.02em;
}
.mk .mk-tag:hover { color: var(--accent); filter: none; }

.mk-pads { display: flex; flex-direction: column; gap: 6px; }
.mk-pad {
  position: relative;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(180deg, #4b4f55, #2d3034);
  box-shadow: 0 3px 0 #0b0c0d, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  cursor: pointer;
  touch-action: none;
}
.mk-pad-led {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b2412;
  box-shadow: 0 0 0 1px #000;
}
.mk-pad.hit {
  transform: translateY(2px);
  background: linear-gradient(180deg, #ffb066, var(--accent));
  box-shadow: 0 1px 0 #0b0c0d, 0 0 12px 2px var(--accent-glow);
}
.mk-pad.hit .mk-pad-led { background: #fff4e8; }
.mk .mk-plus {
  align-self: center;
  height: 24px;
  min-width: 24px;
  margin-bottom: 18px;
  padding: 0 6px;
  border-radius: 4px;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  color: var(--ink-dim);
  font: 700 11px/24px var(--font);
  letter-spacing: 0.06em;
}
.mk .mk-plus-row { font-size: 8px; }
.mk .mk-plus:hover { color: var(--accent); filter: none; }

/* ---------------------------------------------------------------- keybed */

.mk-keybed {
  display: flex;
  gap: 14px;
  margin: 0 -16px;
  padding: 10px 16px 0;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(180deg, #050505, #111 30%, #0c0c0c);
  box-shadow: inset 0 8px 14px rgba(0, 0, 0, 0.9);
}
/* OCTAVE and HOLD above the wheels; extra width (many knobs or pads) goes here, not into the keys. */
.mk-left { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 12px; flex: 1 0 auto; padding-bottom: 12px; }
.mk-perf { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.mk-octave { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.mk-hold { justify-content: center; }
.mk-wheels { display: flex; gap: 10px; align-items: flex-end; }
.mk ws-wheel .wheel-slot { height: calc(var(--key-w) * 3.2); }

.mk-keys { display: flex; flex-direction: column; flex: none; gap: 4px; width: calc(var(--whites) * var(--key-w)); }
.mk-zones { position: relative; height: 18px; }
.mk-zone {
  position: absolute;
  top: 0;
  height: 18px;
  padding: 0 6px;
  overflow: hidden;
  border: 0;
  border-left: 2px solid var(--accent);
  border-radius: 0 3px 3px 0;
  background: rgba(255, 138, 42, 0.12);
  color: var(--ink);
  font: 600 8.5px/18px var(--mono);
  letter-spacing: 0.04em;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.mk-zone:nth-child(2) { background: rgba(125, 211, 255, 0.12); border-left-color: #7dd3ff; }
.mk-zone:nth-child(3) { background: rgba(160, 230, 120, 0.12); border-left-color: #a0e678; }
.mk-zone:nth-child(4) { background: rgba(230, 140, 230, 0.12); border-left-color: #e68ce6; }
.mk-zone:hover { filter: brightness(1.35); }
.mk-keyboard { display: flex; }
.mk ws-keyboard { flex: 1; height: calc(var(--key-w) * 6.25); border-top: 3px solid #3a2a1d; }
