:root {
  color-scheme: dark;
  --bg: #0c1420;
  --panel: #152338;
  --line: #2b425e;
  --text: #e6edf5;
  --muted: #9aadbf;
  --accent: #77c8bc;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.6 system-ui,
    -apple-system,
    sans-serif;
}
header {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 28px;
  background: #111e2f;
  border-bottom: 1px solid var(--line);
}
header > span:first-of-type {
  margin-right: auto;
  color: var(--muted);
}
.brand {
  font-weight: 850;
  letter-spacing: 2px;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
}
.brand small {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}
#connection-state {
  font-size: 11px;
  color: var(--muted);
}
#connection-state.connected {
  color: var(--accent);
}
.layout {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  max-width: 1600px;
  margin: auto;
}
aside {
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #101c2c;
}
aside h2 {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
}
#tracks {
  display: grid;
  gap: 5px;
}
#tracks button {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border-color: transparent;
  background: transparent;
  padding: 7px 10px;
}
#tracks button.active {
  background: #233d50;
  border-color: var(--accent);
}
#tracks b {
  color: var(--accent);
  font-size: 12px;
  width: 22px;
}
#tracks small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
main {
  padding: 28px 32px 130px;
  min-width: 0;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h2 {
  font-size: 17px;
  font-weight: 650;
}
h3 {
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.heading > span {
  color: var(--accent);
  font-size: 12px;
}
h1 {
  margin-bottom: 0;
}
h1 input {
  font-size: 28px;
  letter-spacing: 1px;
  font-weight: 650;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  width: min(300px, 100%);
  padding: 0 0 5px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 5px;
}
.card {
  margin-top: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 15px 24px;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.control label,
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}
.control label {
  display: block;
}
.control .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.control output {
  color: var(--text);
  font:
    12px ui-monospace,
    monospace;
}
.control input[type="range"] {
  width: 100%;
  padding: 0;
  border: 0;
  height: 24px;
  accent-color: var(--accent);
}
input,
select,
button {
  font: inherit;
  border: 1px solid var(--line);
  background: #0d1929;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  max-width: 100%;
  min-width: 0;
}
input:focus,
select:focus,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button {
  cursor: pointer;
  font-size: 12px;
  white-space: normal;
}
button:hover:not(:disabled) {
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b2927;
  font-weight: 700;
}
.full {
  width: 100%;
  margin: 16px 0;
}
.toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 20px;
}
.toolbar label {
  flex: 1;
  min-width: 140px;
}
.hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
  margin: 12px 0;
}
summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
details[open] > summary {
  margin-bottom: 20px;
}
aside details {
  margin-top: 25px;
}
aside select {
  width: 100%;
}
aside button {
  margin-top: 8px;
}
aside > label {
  margin-top: 12px;
}
#message {
  background: #142d34;
  border-left: 3px solid var(--accent);
  padding: 12px 15px;
  margin-top: 22px;
  font-size: 12px;
  border-radius: 5px;
  white-space: pre-wrap;
}
#message.error {
  border-color: #f29b82;
  background: #34252b;
}
canvas {
  display: block;
  background: #0c1828;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
  height: 125px;
  margin-top: 24px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.step {
  padding: 10px;
  background: #0d1929;
  border-radius: 7px;
}
.step strong {
  font-size: 11px;
  color: var(--accent);
}
.step input {
  width: 100%;
}
.step label {
  font-size: 10px;
}
.matrix-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 90px;
  gap: 10px;
  margin: 10px 0;
}
footer {
  color: var(--muted);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}
.actionbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  background: #17293e;
  border-top: 1px solid var(--line);
  z-index: 2;
}
.actionbar label {
  flex-direction: row;
  align-items: center;
  font-size: 10px;
}
.actionbar input[type="number"] {
  width: 58px;
}
.actionbar input[type="checkbox"] {
  accent-color: var(--accent);
}
#test-frequency {
  font:
    11px ui-monospace,
    monospace;
  color: var(--muted);
  min-width: 110px;
}
dialog {
  width: min(480px, 92vw);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
dialog::backdrop {
  background: #0009;
}
dialog label {
  margin: 18px 0;
}
dialog p {
  font-size: 12px;
  color: var(--muted);
}
dialog button {
  margin: 10px 8px 0 0;
}
pre {
  white-space: pre-wrap;
  font-size: 11px;
}
button.muted {
  opacity: 0.5;
}
button.dirty::after {
  content: " *";
  color: var(--accent);
}
@media (max-width: 900px) {
  header {
    padding: 12px 16px;
    gap: 12px;
    height: auto;
    flex-wrap: wrap;
  }
  header > span:first-of-type {
    display: none;
  }
  .layout {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  main {
    padding: 20px 18px 160px;
  }
  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .actionbar {
    flex-wrap: wrap;
    padding: 9px;
  }
  .heading {
    display: block;
  }
  .two {
    grid-template-columns: 1fr;
  }
  .matrix-row {
    grid-template-columns: 1fr 1fr;
  }
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .layout {
    display: block;
  }
  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }
  aside > h2,
  aside > .hint,
  aside > label {
    display: none;
  }
  #tracks {
    display: flex;
    overflow: auto;
    gap: 6px;
  }
  #tracks button {
    flex: 0 0 95px;
    padding: 5px;
  }
  aside .full {
    margin: 8px 0;
  }
  aside details {
    margin-top: 10px;
  }
  main {
    padding: 20px 12px 180px;
  }
  .card {
    padding: 16px;
  }
  .heading > span {
    font-size: 11px;
  }
  .actionbar {
    gap: 6px;
  }
  .actionbar button {
    padding: 7px 10px;
    font-size: 11px;
  }
  #test-frequency {
    min-width: 95px;
    font-size: 10px;
  }
  .controls {
    gap: 12px;
  }
  .toolbar {
    align-items: stretch;
  }
  .toolbar label {
    min-width: 120px;
  }
  .brand {
    font-size: 16px;
  }
}
