/* CN-8 — a black performance desk with a colour per track role
   (pad violet, drone amber, motif teal, melody rose). */

.cn {
  --ink: #eceae6;
  --ink-dim: #8a8f97;
  --line: rgba(236, 234, 230, 0.45);
  --accent: #f2c14e;
  --pad: #b48cff;
  --drone: #f2a64a;
  --motif: #46d3c2;
  --melody: #ff7a9c;
  --well: rgba(255, 255, 255, 0.035);

  position: relative;
  width: max-content;
  padding: 14px 20px 18px;
  border-radius: 12px;
  border: 1px solid #050506;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #23252a 0%, #18191d 50%, #121316 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -3px 0 rgba(0, 0, 0, 0.4),
    0 26px 34px rgba(0, 0, 0, 0.55),
    0 5px 9px rgba(0, 0, 0, 0.45);
  color: var(--ink);
}

.cn .role-pad { --role: var(--pad); }
.cn .role-drone { --role: var(--drone); }
.cn .role-motif { --role: var(--motif); }
.cn .role-melody { --role: var(--melody); }

.cn-label {
  font: 700 8.5px var(--font);
  letter-spacing: 0.3em;
  color: var(--accent);
}

.cn-btn {
  height: 24px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, #3d4046, #26282d);
  box-shadow: 0 2px 0 #0b0b0d, inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font: 700 9px var(--font);
  letter-spacing: 0.14em;
  cursor: pointer;
}
.cn-btn:hover { background: linear-gradient(180deg, #4a4e55, #2d3035); }
.cn-btn:active { transform: translateY(2px); box-shadow: 0 0 0 #0b0b0d, inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.cn-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cn-btn.small { height: 20px; padding: 0 8px; font-size: 8px; }

/* ------------------------------------------------------------------ top */

.cn-top { display: flex; align-items: center; gap: 24px; margin-bottom: 12px; }
.cn-brand { display: flex; align-items: baseline; gap: 10px; }
.cn-logo {
  font: 700 26px/1 var(--logo-font);
  letter-spacing: 0.02em;
  color: #f6f4ef;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.cn-sub { font: 700 9px var(--font); letter-spacing: 0.36em; color: var(--accent); }
.cn .vfd { width: 280px; }
/* The jacks, on a strip along the top edge (so cables leave upwards, not
   across the panel): OUT 1–8 above their tracks, MIDI IN above MODULATION. */
.cn-io {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -14px -20px 12px;
  padding: 7px 20px 5px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #0f1012, #16171a);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06), 0 1px 0 #050506;
}
.cn-io-outs { display: flex; gap: 6px; }
.cn-io-out {
  --role: var(--motif);
  display: flex;
  justify-content: center;
  width: 118px;
  border-bottom: 2px solid var(--role);
}
.cn-io-out.off { opacity: 0.45; }
.cn-io-in { margin-left: auto; }

/* -------------------------------------------------------------- harmony */

.cn-harmony { display: flex; align-items: center; gap: 18px; }

.cn-display {
  display: flex;
  flex-direction: column;
  flex: none;
  width: 200px;
  height: 112px;
  padding: 9px 12px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 35%, #0a201c, var(--vfd-bg));
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.95), 0 0 0 2px #050506, 0 0 0 3px #3b3f45;
  color: var(--vfd);
  font-family: var(--mono);
  text-shadow: 0 0 7px rgba(125, 255, 224, 0.7);
}
.cn-state { display: flex; justify-content: space-between; gap: 6px; font-size: 10px; letter-spacing: 0.08em; white-space: nowrap; }
.cn-chord { display: flex; align-items: baseline; gap: 10px; margin: auto 0; white-space: nowrap; }
.cn-chord .js-chord { font-size: 32px; font-weight: 600; line-height: 1.1; }
.cn-numeral { font-size: 15px; opacity: 0.8; }
.cn-info { font-size: 10px; letter-spacing: 0.08em; opacity: 0.7; white-space: nowrap; }

.cn-knobs { display: flex; align-items: center; }
.cn-knobs ws-switch { margin-left: 8px; }

.cn-gen {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
  padding: 8px 12px 10px;
  border-radius: 8px;
  background: var(--well);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: opacity 0.15s;
}
.cn-gen-row { display: flex; align-items: center; gap: 4px; }
.cn-gen-btns { display: flex; flex-direction: column; gap: 8px; margin-left: 6px; }
.cn-phrase { display: flex; gap: 6px; }
.cn-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 52px;
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--mono);
  color: var(--ink-dim);
}
.cn-chip b { font-size: 12px; font-weight: 600; color: var(--ink); }
.cn-chip small { font-size: 9px; }
.cn-chip.playing { background: #173430; color: var(--vfd); box-shadow: inset 0 0 0 1px var(--vfd); }
.cn-chip.playing b { color: var(--vfd); text-shadow: 0 0 6px rgba(125, 255, 224, 0.7); }

.cn .inactive { opacity: 0.45; }
.cn .inactive:hover, .cn .inactive:focus-within { opacity: 0.8; }

/* ---------------------------------------------------------- progression */

.cn-prog {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--well);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: opacity 0.15s;
}
.cn-prog > .cn-label { writing-mode: vertical-rl; transform: rotate(180deg); }

.cn-csteps { display: flex; gap: 4px; }
.cn-cstep {
  display: grid;
  grid-template-rows: 12px 18px 12px 12px;
  justify-items: center;
  width: 50px;
  padding: 4px 0 5px;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(180deg, #2c2f34, #1e2024);
  box-shadow: 0 2px 0 #0b0b0d, inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: var(--ink-dim);
  font-family: var(--mono);
  cursor: pointer;
}
.cn-cstep:nth-child(4n + 1):not(:first-child) { margin-left: 6px; }
.cn-cstep:hover { background: linear-gradient(180deg, #363940, #24262b); }
.cn-cstep:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cs-num { font-size: 8px; }
.cs-numeral { font-size: 13px; font-weight: 600; color: var(--ink); }
.cs-name { font-size: 9px; }
.cs-bars { font-size: 8px; letter-spacing: 0.06em; }
.cs-bars::after { content: " BAR"; }
.cn-cstep.selected { box-shadow: 0 2px 0 #0b0b0d, inset 0 0 0 1.5px var(--accent); }
.cn-cstep.playing { background: linear-gradient(180deg, #1c403a, #12302b); }
.cn-cstep.playing .cs-numeral { color: var(--vfd); text-shadow: 0 0 6px rgba(125, 255, 224, 0.7); }
.cn-cstep.beyond { opacity: 0.32; }

.cn-cedits { display: flex; flex-direction: column; align-items: center; min-width: 216px; }
.cn-cedit { display: flex; }
.cn-cedit[hidden] { display: none; }
.cn-cedit-title { font: 700 8.5px var(--font); letter-spacing: 0.2em; color: var(--ink-dim); }

/* --------------------------------------------------------------- tracks */

.cn-mid { display: flex; gap: 14px; margin-top: 14px; }
.cn-tracks { display: flex; gap: 6px; }

.cn-track {
  --role: var(--motif);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 118px;
  padding: 0 4px 8px;
  border-radius: 8px;
  background: var(--well);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
  border-top: 3px solid var(--role);
}
.cn-track.selected { background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px var(--role); }
.cn-track.off .ct-knobs, .cn-track.off .ct-roles, .cn-track.off .ct-lock { opacity: 0.4; }

.ct-head { display: flex; align-items: center; gap: 5px; padding-top: 6px; }
.ct-on {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, #3d4046, #26282d);
  box-shadow: 0 2px 0 #0b0b0d;
  cursor: pointer;
}
.ct-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2a2024;
  box-shadow: 0 0 0 1px #000;
  transition: background 0.05s, box-shadow 0.05s;
}
.ct-on[aria-pressed="true"] .ct-led { background: color-mix(in srgb, var(--role) 45%, #000); }
.cn-track.hit .ct-on[aria-pressed="true"] .ct-led { background: var(--role); box-shadow: 0 0 0 1px #000, 0 0 8px 2px var(--role); }
.ct-on:focus-visible, .ct-sel:focus-visible, .ct-role:focus-visible, .ct-lock:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.ct-sel {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  height: 22px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  background: #060807;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.06);
  font: 600 9.5px var(--mono);
  color: var(--vfd);
  text-shadow: 0 0 5px var(--vfd-dim);
  cursor: pointer;
  white-space: nowrap;
}
.ct-num { font-weight: 700; color: var(--role); text-shadow: none; }
.ct-lcd { overflow: hidden; text-overflow: ellipsis; }

.ct-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.ct-role {
  height: 17px;
  border: 0;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--ink-dim);
  font: 700 7.5px var(--font);
  letter-spacing: 0.1em;
  cursor: pointer;
}
.ct-role:hover { color: var(--ink); }
.ct-role[aria-checked="true"] { background: var(--role); color: #141416; }

.ct-knobs { display: grid; grid-template-columns: 1fr 1fr; justify-items: center; row-gap: 2px; }
.ct-knobs ws-knob { width: 54px; }

.ct-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: auto; }
.ct-lock {
  height: 18px;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--ink-dim);
  font: 700 7.5px var(--font);
  letter-spacing: 0.16em;
  cursor: pointer;
}
.ct-lock[aria-pressed="true"] { background: var(--accent); color: #141416; }

/* ----------------------------------------------------------------- LFOs */

.cn-lfos {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--well);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
}
.cn-lfo { display: flex; align-items: center; }
.cn-lfo ws-knob { width: 56px; }
.cl-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 40px;
  font: 700 8.5px var(--font);
  letter-spacing: 0.1em;
  color: var(--ink-dim);
}
.cl-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px #000, 0 0 6px var(--accent);
  opacity: 0.25;
}

/* ------------------------------------------------------- pattern editor */

.cn-editor {
  margin-top: 14px;
  padding: 8px 12px 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, #0f1012, #0a0b0c);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.06);
}
.cn-editor-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; }
.ce-track { font: 700 10px var(--mono); letter-spacing: 0.08em; color: var(--role); }
.ce-hint { font: 9px var(--font); color: var(--ink-dim); }

.cn-pattern { --role: var(--motif); display: flex; flex-direction: column; gap: 8px; }
.cn-pattern[hidden] { display: none; }
.cp-row { display: flex; align-items: center; gap: 14px; }
.cp-lib { display: grid; grid-template-columns: auto 54px; grid-template-rows: auto auto auto; align-items: center; column-gap: 6px; width: 200px; }
.cp-lib .cp-label { grid-column: 1; font: 700 8.5px var(--font); letter-spacing: 0.2em; color: var(--ink-dim); }
.cp-lib .cp-stepper { grid-column: 1; }
.cp-lib .cn-btn { grid-column: 1; justify-self: start; }
.cp-lib ws-knob { grid-column: 2; grid-row: 1 / 4; }

.cp-stepper { display: flex; align-items: center; gap: 2px; margin: 3px 0 4px; }
.cp-arrow {
  width: 18px;
  height: 20px;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink-dim);
  font-size: 8px;
  cursor: pointer;
}
.cp-arrow:hover { color: var(--ink); }
.cp-arrow:focus-visible, .cp-bar:focus-visible, .cp-cell:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cp-name {
  width: 100px;
  height: 20px;
  padding: 0 6px;
  border-radius: 3px;
  background: #060807;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.9);
  font: 600 9.5px/20px var(--mono);
  color: var(--vfd);
  text-shadow: 0 0 5px var(--vfd-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-notes, .cp-rhythm { display: flex; gap: 4px; }
.cp-bar, .cp-cell { width: 40px; flex: none; }
.cp-bar:nth-child(4n + 1):not(:first-child), .cp-cell:nth-child(4n + 1):not(:first-child) { margin-left: 6px; }

.cp-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  cursor: ns-resize;
  touch-action: none;
  outline: none;
}
.cp-seg { height: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.07); pointer-events: none; }
.cp-seg.lit { background: color-mix(in srgb, var(--role) 70%, #000); }
.cp-bar.now .cp-seg.lit { background: var(--role); box-shadow: 0 0 6px var(--role); }
.cp-bar.now { background: rgba(255, 255, 255, 0.1); }
.cp-digit {
  position: absolute;
  inset: auto 0 -14px;
  font: 600 9px var(--mono);
  text-align: center;
  color: var(--ink-dim);
  pointer-events: none;
}
.cp-bar.rest .cp-digit { opacity: 0.5; }
.cp-bar.beyond, .cp-cell.beyond { opacity: 0.3; }
.cp-notes { margin-bottom: 14px; }

.cp-cell {
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}
.cp-cell[data-v="1"] { background: color-mix(in srgb, var(--role) 50%, #000); }
.cp-cell[data-v="2"] { background: var(--role); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); }
.cp-cell.now { outline: 2px solid var(--vfd); outline-offset: -2px; }
