:root {
  --cream: #ddd9cc;
  --brown: #794a38;
  --navy: #151a3d;
  --ice: #bdd1df;
  --wine: #3d1022
}

* {
  box-sizing: border-box
}

html,body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--cream)
}

body {
  font-family: 'Courier New',monospace;
  color: var(--navy)
}

button,input {
  font: inherit
}

button {
  cursor: pointer
}

button,input {
  -webkit-tap-highlight-color: transparent
}

button:focus-visible,input:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px
}

button {
  border-radius: 0
}

input[type=range] {
  width: 100%;
  margin: 6px 0;
  accent-color: currentColor;
  cursor: ew-resize;
  height: 16px;
  background: transparent
}

input[type=range]:focus-visible {
  border-radius: 2px
}

.synth {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  max-width: 2000px;
  margin: auto
}

.panel {
  min-width: 0;
  padding: 0 5.5% 22px;
  background: var(--cream);
  color: var(--navy)
}

.panel--brown {
  background: var(--brown);
  color: var(--ice)
}

.artwork {
  position: relative;
  height: clamp(280px,29vw,490px);
  margin: 0 -6.2%;
  overflow: hidden
}

.art {
  position: absolute;
  object-fit: contain;
  pointer-events: none
}

.art--logo {
  width: 38%;
  left: 6%;
  top: 5%
}

.art--scribble {
  width: 17%;
  right: 7%;
  top: 5%
}

.art--figure {
  height: 67%;
  width: 53%;
  left: 26%;
  top: 26%
}

.art--star {
  width: 12%;
  left: 8%;
  bottom: 10%
}

.art--dots {
  width: 12%;
  left: 8%;
  top: 8%
}

.art--flower {
  height: 70%;
  width: 57%;
  left: 20%;
  top: 8%
}

.art--petal-left {
  width: 17%;
  left: 9%;
  top: 48%
}

.art--petal-right {
  width: 12%;
  right: 12%;
  top: 22%
}

.art--japanese {
  width: 39%;
  right: 4%;
  bottom: 5%
}

.voice-caption {
  position: absolute;
  bottom: 2%;
  left: 6%;
  font-size: 10px;
  letter-spacing: .12em;
  font-weight: bold
}

.voice-caption span {
  opacity: .65
}

.voice-controls {
  position: relative
}

.voice-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid currentColor;
  padding: 10px 0;
  font-size: 10px;
  letter-spacing: .12em
}

.activity {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 50%
}

.is-sounding .activity {
  background: currentColor
}

.voice-settings {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 18px;
  max-width: calc(100% - 165px);
  min-height: 104px
}

.panel--brown .voice-settings {
  margin-left: 165px
}

.wave-switch {
  display: flex;
  gap: 5px;
  align-items: flex-start
}

.wave-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 50%;
  padding: 8px 3px;
  color: inherit;
  background: none;
  border: 1px solid transparent;
  opacity: .45;
  font-size: 8px
}

.wave-option svg {
  width: 40px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2
}

.wave-option.is-selected {
  opacity: 1;
  border-color: currentColor
}

.voice-sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px
}

.control {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px
}

.control>span,.tempo>span,.master-control>span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 9px;
  letter-spacing: .03em
}

.control output {
  opacity: .7;
  white-space: nowrap
}

.control input {
  margin: 0
}

.keys {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 18px;
  margin-top: 14px
}

.key {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  min-height: 78px;
  padding: 12px;
  border: 0;
  background: var(--navy);
  color: var(--cream);
  touch-action: none;
  transition: transform .08s,filter .08s
}

.panel--brown .key {
  background: var(--ice);
  color: var(--brown)
}

.key span {
  font-size: 20px;
  font-weight: bold
}

.key small {
  font-size: 10px;
  opacity: .6
}

.key.is-active {
  transform: translateY(4px);
  filter: brightness(1.35)
}

.key:hover {
  filter: brightness(1.12)
}

.perspective {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: clamp(317px,calc(29vw + 37px),527px);
  transform: translateX(-50%);
  width: 286px;
  background: var(--cream);
  color: var(--wine);
  padding: 12px 15px 8px;
  border: 1px solid var(--wine)
}

.perspective-title {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .1em
}

.perspective-title output {
  font-size: 9px;
  letter-spacing: 0
}

.perspective #tone {
  appearance: none;
  -webkit-appearance: none;
  height: 28px;
  margin: 9px 0 3px;
  background: transparent
}

.perspective #tone::-webkit-slider-runnable-track {
  height: 14px;
  border-radius: 20px;
  background: var(--wine)
}

.perspective #tone::-moz-range-track {
  height: 14px;
  border-radius: 20px;
  background: var(--wine)
}

.perspective #tone::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -7px;
  border: 4px solid var(--cream);
  outline: 1px solid var(--wine);
  border-radius: 50%;
  background: var(--wine)
}

.perspective #tone::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 4px solid var(--cream);
  border-radius: 50%;
  background: var(--wine)
}

.perspective-hints {
  display: flex;
  justify-content: space-between;
  font-size: 7px
}

.effect-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 16px;
  margin-top: 13px
}

.effect-caption {
  text-align: center;
  font-size: 6px;
  letter-spacing: .09em;
  margin: 6px 0 0
}

.effect-controls .control>span {
  font-size: 8px
}

.rhythm {
  grid-column: 1/-1;
  padding: 20px 2.75% 12px;
  border-top: 2px solid var(--brown);
  background: var(--cream);
  color: var(--brown)
}

.rhythm-header {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 14px
}

.rhythm-title {
  margin-right: auto
}

.rhythm h1 {
  font-size: 20px;
  letter-spacing: .09em;
  margin: 0;
  font-weight: normal
}

.rhythm h1 span {
  font-size: 12px;
  letter-spacing: 0
}

.rhythm-title p {
  font-size: 8px;
  letter-spacing: .12em;
  margin: 5px 0 0
}

.transport {
  display: flex;
  gap: 7px
}

.transport button {
  color: var(--brown);
  border: 1px solid var(--brown);
  background: transparent;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: bold
}

.transport button.is-playing {
  background: var(--wine);
  color: var(--cream);
  border-color: var(--wine)
}

.tempo {
  width: 155px
}

.master-control {
  width: 125px
}

.rhythm-body {
  display: grid;
  grid-template-columns: 1fr 175px;
  gap: 30px
}

.sequencer-scroll {
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 5px
}

.sequencer {
  display: grid;
  grid-template-columns: 82px repeat(16,minmax(18px,1fr));
  gap: 6px;
  min-width: 620px;
  align-items: center
}

.step-number {
  font-size: 8px;
  text-align: center;
  opacity: .6
}

.drum-pad {
  text-align: left;
  min-height: 26px;
  background: none;
  border: 1px solid var(--brown);
  color: var(--brown);
  font-size: 10px;
  padding: 5px 8px
}

.drum-pad.is-hit {
  background: var(--wine);
  color: var(--cream)
}

.step {
  height: 26px;
  border: 1px solid #794a3860;
  background: transparent;
  position: relative;
  padding: 0
}

.step:nth-child(4n+2) {
  border-left: 2px solid var(--brown)
}

.step.is-on {
  background: var(--navy);
  border-color: var(--navy)
}

.step[data-row='2'].is-on,.step[data-row='3'].is-on {
  background: var(--ice);
  border-color: var(--brown)
}

.step.is-current {
  outline: 2px solid var(--brown);
  outline-offset: 1px
}

.step.is-current:after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: calc(50% - 2px);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brown)
}

.step.is-on.is-current:after {
  background: var(--cream)
}

.output {
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-left: 1px solid #794a3860;
  padding-left: 20px;
  font-size: 8px;
  letter-spacing: .04em
}

.output>span {
  margin-bottom: 5px
}

.output label {
  display: grid;
  grid-template-columns: 35px 1fr;
  align-items: center
}

.output meter {
  width: 100%;
  height: 12px;
  accent-color: var(--navy)
}

.output meter::-webkit-meter-bar {
  background: #794a3820;
  border: 0;
  border-radius: 0
}

.output meter::-webkit-meter-optimum-value {
  background: var(--navy)
}

.output p {
  font-size: 8px;
  line-height: 1.5;
  margin: 6px 0 0
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #794a3850;
  margin-top: 13px;
  padding-top: 10px;
  font-size: 7px;
  letter-spacing: .08em
}

.is-sounding .art--figure {
  animation: breathe .7s ease-in-out infinite alternate
}

.is-sounding .art--flower {
  animation: breathe .65s ease-in-out infinite alternate-reverse
}

@keyframes breathe {
  to {
    transform: translateY(-2px) rotate(.6deg)
  }
}

@media(min-width:1600px) {
  .voice-settings {
    grid-template-columns: 135px 1fr;
    gap: 24px;
    max-width: calc(100% - 180px)
  }
  .panel--brown .voice-settings {
    margin-left: 180px
  }
  .wave-option svg {
    width: 50px
  }
  .control>span {
    font-size: 10px
  }
  .key {
    min-height: 100px
  }
  .perspective {
    width: 320px
  }
  .artwork {
    height: 490px
  }
  .perspective {
    top: 527px
  }
}

@media(max-width:1100px) {
  .voice-settings {
    max-width: calc(100% - 145px);
    grid-template-columns: 1fr;
    gap: 4px;
    min-height: 150px
  }
  .panel--brown .voice-settings {
    margin-left: 145px
  }
  .wave-switch {
    width: 125px
  }
  .wave-option {
    padding: 3px
  }
  .wave-option svg {
    height: 15px
  }
  .perspective {
    width: 260px;
    top: clamp(317px,calc(29vw + 37px),527px)
  }
  .voice-sliders {
    gap: 7px 10px
  }
  .keys {
    gap: 10px
  }
  .rhythm-header {
    gap: 14px
  }
  .rhythm-body {
    grid-template-columns: 1fr 130px;
    gap: 15px
  }
  .output {
    padding-left: 10px
  }
  .rhythm h1 span {
    display: none
  }
  footer span:last-child {
    display: none
  }
}

@media(max-width:700px) {
  .synth {
    grid-template-columns: 1fr
  }
  .panel {
    padding: 0 6% 24px
  }
  .artwork {
    height: 320px
  }
  .art--figure {
    left: 33%;
    width: 55%
  }
  .art--logo {
    width: 43%
  }
  .art--japanese {
    width: 38%
  }
  .voice-settings,.panel--brown .voice-settings {
    margin: 0;
    max-width: none;
    grid-template-columns: 110px 1fr;
    min-height: 92px;
    gap: 12px
  }
  .wave-switch {
    width: auto
  }
  .keys {
    margin-top: 12px;
    gap: 12px
  }
  .key {
    min-height: 82px
  }
  .perspective {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    grid-row: 3;
    margin: 0;
    border-width: 1px 0;
    padding: 20px 6%
  }
  .perspective-hints {
    font-size: 8px
  }
  .effect-controls {
    grid-template-columns: repeat(4,1fr);
    gap: 15px
  }
  .effect-controls .control>span {
    flex-direction: column;
    gap: 4px
  }
  .effect-caption {
    font-size: 8px;
    margin-top: 12px
  }
  .rhythm {
    grid-row: 4;
    padding: 22px 6% 14px
  }
  .rhythm-header {
    flex-wrap: wrap;
    gap: 16px
  }
  .rhythm-title {
    flex: 1 0 40%
  }
  .tempo,.master-control {
    width: calc(50% - 8px)
  }
  .rhythm-body {
    grid-template-columns: 1fr
  }
  .output {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    border: 0;
    border-top: 1px solid #794a3850;
    padding: 12px 0 0
  }
  .output>span,.output p {
    grid-column: 1/-1;
    margin: 0
  }
  footer {
    flex-wrap: wrap;
    line-height: 1.5
  }
  .transport button {
    padding: 10px
  }
  .voice-caption {
    font-size: 9px
  }
}

@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after {
    animation: none!important;
    transition: none!important
  }
}

/* Reserve the full height of the central controls so every note stays reachable. */
@media(min-width:701px) {
  .voice-settings {
    min-height: 184px
  }
}

input {
  color: inherit
}

input[type=range] {
  appearance: none;
  -webkit-appearance: none
}

input[type=range]::-webkit-slider-runnable-track {
  height: 2px;
  background: currentColor;
  opacity: .8
}

input[type=range]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--cream)
}

.panel--brown input[type=range]::-webkit-slider-thumb {
  background: var(--brown)
}

input[type=range]::-moz-range-track {
  height: 2px;
  background: currentColor
}

input[type=range]::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--cream)
}

.panel--brown input[type=range]::-moz-range-thumb {
  background: var(--brown)
}

.voice-sliders {
  align-content: start;
  gap: 15px 14px
}

.control>span {
  font-size: 10px
}

.voice-sliders .control {
  gap: 5px
}

.effect-controls .control>span {
  font-size: 9px
}

.perspective-hints {
  font-size: 8px
}

.effect-caption {
  font-size: 7px
}

@media(max-width:700px) {
  .voice-sliders {
    gap: 12px 14px
  }
  .voice-sliders .control>span {
    font-size: 9px
  }
  .effect-controls .control>span {
    font-size: 8px
  }
}
