:root {
  --bg: #070b12;
  --panel: #101820;
  --line: rgba(34, 211, 238, 0.28);
  --text: #f4fbff;
  --muted: #93a4b5;
  --cyan: #22d3ee;
  --coral: #ff5a36;
  --black: 34px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(70% 40% at 50% -10%, rgba(34, 211, 238, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, "Segoe UI", sans-serif;
}
button, input, select, a { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
button, .file { cursor: pointer; }
button:disabled, select:disabled, input:disabled { cursor: default; opacity: 0.55; }

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.92);
  position: sticky;
  top: 0;
  z-index: 4;
}
.home { color: var(--cyan); text-decoration: none; }
.home:hover { text-decoration: underline; }
.brand { margin: 0; font-weight: 560; letter-spacing: 0.04em; }
.brand strong { color: var(--cyan); font-weight: 750; }
.lede { margin: 0; color: var(--muted); flex: 1 1 180px; }
#status { margin: 0; min-width: 12rem; color: var(--text); }
.voices { color: var(--muted); }
.top button, .file {
  background: #16202b;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.top button.on, .strip.is-solo [data-solo] {
  border-color: var(--coral);
  color: #ffd2c6;
}
.master { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.master input { width: 110px; accent-color: var(--cyan); }

.layers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}
.strip {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top: 3px solid var(--cyan);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
}
.strip:nth-child(2) { border-top-color: #7dd3fc; }
.strip:nth-child(3) { border-top-color: var(--coral); }
.strip:nth-child(4) { border-top-color: #fbbf24; }
.strip.is-drop { outline: 2px dashed var(--cyan); }
.strip.is-mute { opacity: 0.72; }
.strip-head { display: flex; gap: 8px; align-items: center; }
.idx {
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.14);
  color: var(--cyan);
  font-weight: 700;
}
.strip-head strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.strip-head button, .toggles button, .step button, .range button, .oct button {
  background: #0c141d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px 8px;
}
.err { min-height: 1.2em; margin: 8px 0 0; color: #ffb4a4; font-size: 13px; }
.bar { height: 4px; margin-top: 8px; background: #0c141d; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--cyan); }
.file { display: inline-block; margin-top: 10px; }
select {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: #0c141d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px;
}
.mix { display: flex; gap: 12px; margin-top: 12px; align-items: stretch; }
.fader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.fader input {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 28px;
  height: 140px;
  accent-color: var(--cyan);
}
.mix-side { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mix-side label, .step, .range, .oct {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.mix-side input[type="range"] { flex: 1; accent-color: var(--cyan); }
.toggles { display: flex; gap: 6px; }
.toggles button { flex: 1; }
.strip.is-mute [data-mute] { background: #2c3a4a; border-color: #d5e2ee; color: var(--text); }
.range { margin-top: 12px; flex-wrap: wrap; }
.range b, .step b { color: var(--text); min-width: 1.6rem; text-align: center; }

.board {
  margin: 0 16px 16px;
  padding: 12px;
  background: #0c121a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.oct { margin-bottom: 10px; }
.oct span { margin-left: auto; }
.keybed { position: relative; height: 168px; touch-action: none; user-select: none; }
.whites, .blacks { position: absolute; inset: 0; display: flex; }
.blacks { pointer-events: none; }
.white, .black {
  position: relative;
  border: 0;
  padding: 0 0 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
}
.white {
  flex: 1;
  margin: 0 1px;
  background: linear-gradient(#fff, #d7dee6);
  color: #1b2833;
  border-radius: 0 0 6px 6px;
  pointer-events: auto;
}
.black {
  pointer-events: auto;
  position: absolute;
  top: 0;
  width: var(--black);
  height: 62%;
  background: linear-gradient(#2b3540, #0d1218);
  color: #d5dee8;
  border-radius: 0 0 4px 4px;
  z-index: 1;
}
.white.is-down { background: #9be7f5; }
.black.is-down { background: var(--cyan); color: #042026; }
.white span, .black span { font-size: 11px; opacity: 0.7; }
.white small { font-size: 10px; }

.help { margin: 0 16px 20px; color: var(--muted); }

@media (max-width: 1100px) {
  .layers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .layers { grid-template-columns: 1fr; }
  .keybed { height: 132px; }
  .oct span { flex-basis: 100%; margin-left: 0; }
  :root { --black: 22px; }
}
