:root {
  --bg: #0f1115;
  --panel: #181c22;
  --hi: #232933;
  --border: #2c3340;
  --text: #e6e9ef;
  --muted: #8a94a6;
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.32);
  --red: #ef4444;
  --green: #22c55e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.unit {
  width: 100%;
  max-width: 640px;
  max-height: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

.name {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.ver {
  font-size: 9.5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--hi);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
}

.btn-play.playing {
  background: var(--amber);
  border-color: var(--amber);
  color: #111;
  box-shadow: 0 0 8px var(--amber-glow);
}

.btn-bypass.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.seg-group {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.seg {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 7px;
  cursor: pointer;
}

.seg + .seg {
  border-left: 1px solid var(--border);
}

.seg.active {
  background: var(--hi);
  color: var(--amber);
}

.preset {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 6px;
  cursor: pointer;
}

.subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.speed-wrap,
.meters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meters {
  flex: 1;
  max-width: 260px;
}

.lbl {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.meter {
  flex: 1;
  height: 6px;
  background: #171a20;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green) 0%, var(--amber) 72%, var(--red) 96%);
  transition: width 40ms linear;
}

.knobs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 5px;
}

.knob-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 3px 4px;
}

.knob-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1px;
}

.knob-svg {
  width: clamp(40px, 12.5dvh, 54px);
  height: clamp(40px, 12.5dvh, 54px);
  cursor: ns-resize;
  touch-action: none;
  display: block;
}

.knob-val {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 1px;
}

@media (max-height: 400px) {
  .unit {
    padding: 6px;
    gap: 4px;
  }
  .knob-cell {
    padding: 3px 2px;
  }
  .knob-svg {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 560px) and (orientation: portrait) {
  html, body {
    overflow-y: auto;
    align-items: flex-start;
  }
  .bar {
    flex-wrap: wrap;
  }
  .knobs {
    grid-template-columns: repeat(2, 1fr);
  }
}
