* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*:focus {
  outline: none;
}

// @vw: 1920px;
// @vh: 1080px;
// @zoom: 1;

@vw: 540px;
// @vh: 960px;
@vh: 720px;
@zoom: 0.9;

// @vw: 540px;
// @vh: 675px;

// @vw: 100vw;
// @vh: 100vh;

@import "timeline.less";

@sample-bg-0: hsl(96, 100%, 50%);
@sample-bg-1: hsl(0, 100%, 50%);
@sample-bg-2: hsl(216, 100%, 50%);
@sample-bg-3: hsl(269, 100%, 50%);
@sample-bg-4: hsl(48, 100%, 50%);
@sample-bg-5: hsl(163, 100%, 50%);
@sample-bg-6: hsl(262, 100%, 33%);
@sample-bg-7: hsl(297, 100%, 50%);
@sample-bg-8: hsl(49, 18%, 76%);
@sample-fill-black-amount: 60%;
@sample-fill-0: mix(#000, @sample-bg-0, @sample-fill-black-amount);
@sample-fill-1: mix(#000, @sample-bg-1, @sample-fill-black-amount);
@sample-fill-2: mix(#000, @sample-bg-2, @sample-fill-black-amount);
@sample-fill-3: mix(#000, @sample-bg-3, @sample-fill-black-amount);
@sample-fill-4: mix(#000, @sample-bg-4, @sample-fill-black-amount);
@sample-fill-5: mix(#000, @sample-bg-5, @sample-fill-black-amount);
@sample-fill-6: mix(#000, @sample-bg-6, @sample-fill-black-amount);
@sample-fill-7: mix(#000, @sample-bg-7, @sample-fill-black-amount);
@sample-fill-8: mix(#000, @sample-bg-8, @sample-fill-black-amount);

html,
body {
  width: 100%;
  height: 100%;
}

html {
  background-color: #222;
  body {
		height: @vh;
    width: @vw;
    margin: 0 auto;
    position: relative;
  }
}

#container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
	zoom: @zoom;
}

html[data-rendering-mode="true"] {
  body {
    cursor: none;
    &:not(.ready) {
      display: none;
    }
  }
}

body {
  font-family: monospace;
  background: #000;
  color: #fff;
  background-size: cover;
  background-position: center;
  font-size: 14px;
  line-height: 1.7em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: bold;
}

main {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.controls {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  padding: 50px;
  display: flex;
  justify-content: center;
  transition: opacity ~"calc(0.2s * var(--render-speed, 1))" ease-in-out;
  #audio {
    width: 400px;
    height: 32px;
  }
}
body.ready .controls {
  opacity: 0;
  &:hover {
    opacity: 1;
  }
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #fff;
  font-size: 24px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

#samples {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
  line-height: 0;
  &[data-stretch-samples-height="true"] {
    .window {
      height: 100%;
    }
  }
  &.intro {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: row !important;
  }
}
body[data-chapter="9"] #samples {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transform: scale(1.7) !important; // scale(3)
  padding: 0 !important;
  .window {
    height: auto !important;
		&.files, &.sliders-horizontal, &.sliders, &.notification {
			aspect-ratio: auto !important;
		}
  }
}
body[data-chapter="6"] #container {
  zoom: @zoom * 0.81 !important;
}

.window {
  line-height: 1.5em;
  min-width: 80px;
  max-height: (@vh * 0.4);
	min-height: fit-content;
  z-index: 1;
}

.window.sample {
  position: relative;
  display: inline-block;
  min-height: 80px;
	min-width: 150px;
  transition: opacity ~"calc(0.35s * var(--render-speed, 1))" ease-in-out ~"calc(0.05s * var(--render-speed, 1))";
  width: fit-content;
}

.window .value-text {
  display: none;
}

.window .header {
  position: absolute;
  z-index: 4;
  left: 0;
  top: 0;
  padding: 0 5px 0 5.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #ffffff;
  color: #000;
  // pointer-events: none;
  white-space: nowrap;
}

.sample.with-canvas {
  padding-bottom: 5px;
  .progress-width {
    bottom: 5px;
    top: 0;
    height: auto;
  }
  .value-width {
    position: absolute;
    display: block !important;
    bottom: 0;
    right: 0;
    height: 5px;
    transition: width ~"calc(0.1s * var(--render-speed, 1))" linear;
  }
}

.sample:not(.value-only) .value-width {
  display: none;
}

.sample:not(.value-only) .value-width {
  display: none;
}

.sample:not(.opacity-only) .value-opacity {
  display: none;
}

.sample:not(.knob-only) .value-knob {
  display: none;
}

.value-text {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
	font-size: 150%;
  letter-spacing: 2px;
	margin-top: 5px;
	margin-left: 2px;
}

.sample.value-only {
  min-height: 80px;
  .value-width {
    position: absolute;
    height: 100%;
    right: 0;
    top: 0;
    transition: width ~"calc(0.1s * var(--render-speed, 1))" linear;
  }
  .value-text {
    display: block;
  }
  .progress-width {
    display: none;
  }
}

.sample.opacity-only {
  min-height: 80px;
  .value-opacity {
    position: absolute;
    inset: 0;
    // z-index: 0;
    opacity: 0;
    transition: opacity ~"calc(0.1s * var(--render-speed, 1))" linear;
    background-color: #000;
  }
  .value-text {
    display: block;
  }
  .progress-width {
    display: none;
  }
}

.sample.knob-only {
  .value-knob {
    position: absolute;
    inset: 10%;
    margin: auto;
    max-height: 85%;
    max-width: 85%;
    aspect-ratio: 1;
    border-radius: 50%;
    background-color: #fff;
    z-index: 3;
  }
  .value-knob-line {
    position: absolute;
    width: 2%;
    height: 42%;
    background: #000;
    left: 50%;
    top: 50%;
    transform-origin: 50% 0;
    transform: rotate(45deg);
    transition: transform ~"calc(0.1s * var(--render-speed, 1))" linear;
  }
  &[data-style="1"],
  &[data-style="2"],
  &[data-style="3"],
  &[data-style="6"],
  &[data-style="7"] {
    .value-knob {
      background: #000;
    }
    .value-knob-line {
      background: #fff;
    }
  }

  .progress-width {
    display: none;
  }
}

.window .progress-width {
  position: absolute;
  height: 100%;
  background-color: hsl(0, 0%, 40%);
  right: 0;
  top: 0;
  z-index: 1;
  // transition: width 0.1s linear;
}

.window .sample-border-after {
  position: absolute;
  z-index: 5;
  // pointer-events: none;
}

.window .sample-border-after[data-position="left"] {
  left: 0;
	margin-left: -1px;
  top: 50%;
  width: 1px;
  height: (@vh * 20);
  transform: translateY(-50%);
}

.window .sample-border-after[data-position="right"] {
  right: 0;
	margin-right: -1px;
  top: 50%;
  width: 1px;
  height: (@vh * 20);
  transform: translateY(-50%);
}

.window .sample-border-after[data-position="top"] {
  left: 50%;
  top: 0;
	margin-top: -1px;
  width: (@vw * 20);
  height: 1px;
  transform: translateX(-50%);
}

.window .sample-border-after[data-position="bottom"] {
  left: 50%;
  bottom: 0;
	margin-bottom: -1px;
  width: (@vw * 20);
  height: 1px;
  transform: translateX(-50%);
}

[data-style="0"] {
  background: @sample-bg-0;
  .value-width,
  .progress-width {
    background: @sample-fill-0;
  }
}

[data-style="1"] {
  background: @sample-bg-1;
  .value-width,
  .progress-width {
    background: @sample-fill-1;
  }
}

[data-style="2"] {
  background: @sample-bg-2;
  .value-width,
  .progress-width {
    background: @sample-fill-2;
  }
}

[data-style="3"] {
  background: @sample-bg-3;
  .value-width,
  .progress-width {
    background: @sample-fill-3;
  }
}

[data-style="4"] {
  background: @sample-bg-4;
  .value-width,
  .progress-width {
    background: @sample-fill-4;
  }
}

[data-style="5"] {
  background: @sample-bg-5;
  .value-width,
  .progress-width {
    background: @sample-fill-5;
  }
}

[data-style="6"] {
  background: @sample-bg-6;
  .value-width,
  .progress-width {
    background: @sample-fill-6;
  }
}

[data-style="7"] {
  background: @sample-bg-7;
  .value-width,
  .progress-width {
    background: @sample-fill-7;
  }
}

[data-style="8"] {
  background: @sample-bg-8;
  .value-width,
  .progress-width {
    background: @sample-fill-8;
  }
}

.window.finished {
  opacity: 0;
  // width: 0;
}

.window.notification {
  position: relative;
  display: inline-block;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  text-align: center;
  min-width: fit-content;
  min-height: 110px;
  width: 0;
	.content {
		&:before, &:after {
			display: block;
			content: "";
			width: 100%;
		}
		&:before {
			height: 30px;
		}
		&:after {
			height: 20px;
		}
	}
  p {
    text-wrap: balance;
    width: 90%;
    margin: 0 auto;
    line-height: 1.3em;
  }
  &.credits {
    font-size: (@vh * 0.02);
    min-width: 340px;
    p {
      width: 100%;
    }
  }
  .buttons {
    margin-top: 5px;
		white-space: nowrap;
    padding: 0 15px;
    span {
      display: inline-block;
      background-color: #fff;
      color: #000;
      padding: 0 5px 0 6px;
      margin: 3px 6px;
    }
  }
  &[data-style="1"],
  &[data-style="2"],
  &[data-style="3"],
  &[data-style="6"],
  &[data-style="7"] {
    color: #fff;
  }
}

#samples[data-disable-nofitications-aspect-ratio="true"] .window.notification {
  aspect-ratio: auto !important;
}

.window.terminal {
  position: relative;
  padding-top: 16px;
  color: #000;
	min-height: 80px;
  .content {
    position: absolute;
    z-index: 4;
    inset: 21px 3px 3px 3px;
    overflow: hidden;
    white-space: nowrap;
    line-height: 1.3;
    background: #000;
    color: #aaa;
    text-align: left;
    padding: 3px 3px 3px 7px;
  }
}

.window.menu {
  position: relative;
  color: #000;
  padding-top: 21px;
  overflow: hidden;
  min-height: fit-content;
  width: 0;
  .content {
    text-align: left;
		overflow: hidden;
		max-height: 100%;
    ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }
    li {
      padding: 4px 5px 2px;
      line-height: 1.25;
      border-bottom: 1px solid rgba(0, 0, 0, 0.5);
      &:last-child {
        border-bottom: none;
      }
    }
    li.active {
      background: rgba(0, 0, 0, 0.5);
      color: #fff;
      border-bottom-color: transparent;
    }
  }
  &[data-style="1"],
  &[data-style="2"],
  &[data-style="3"],
  &[data-style="6"],
  &[data-style="7"] {
    color: #fff;
  }
}

.window.equalizer {
  position: relative;
  color: #000;
  .content {
		height: 100%;
    padding: 23px 2px 2px;
  }
  .eq-bars {
    width: 100%;
    height: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
  }
  .eq-bar {
    background: fade(#000, 80%);
    height: var(--h, 50%);
    transition: height ~"calc(0.1s * var(--render-speed, 1))" linear;
  }
  &.is-bottom .eq-bars {
    align-items: end;
  }
  &.is-center .eq-bars {
    align-items: center;
  }
}

.window.sliders {
  position: relative;
  color: #000;
  padding-top: 21px;
  .content {
		padding: 10px;
    height: 100%;
    overflow: hidden;
  }
  .sliders-grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
  }
  .slider-col {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 3px;
    min-width: 0;
  }
  .slider-title {
    text-align: center;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .slider-track {
    position: relative;
    border: 2px solid #000;
    min-height: 40px;
  }
  .slider-handle {
    position: absolute;
    left: 0;
    top: var(--pos, 50%);
    width: 100%;
    height: 20%;
    background: #000;
    transition: top ~"calc(0.1s * var(--render-speed, 1))" linear;
  }
  &[data-style="1"],
  &[data-style="2"],
  &[data-style="3"],
  &[data-style="6"],
  &[data-style="7"] {
    color: #fff;
    .slider-track {
      border-color: #fff;
    }
    .slider-handle {
      background: #fff;
    }
  }
}

.window.sliders-horizontal {
  position: relative;
  color: #000;
  padding-top: 21px;
  .content {
    padding: 10px;
		height: 100%;
    overflow: hidden;
  }
  .hsliders-grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-auto-flow: row;
    grid-auto-rows: 1fr;
    gap: 4px;
  }
  .hslider-row {
    display: grid;
    grid-template-columns: 65px 1fr;
    align-items: center;
    gap: 5px;
    min-height: 14px;
  }
  .hslider-title {
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
  }
  .hslider-track {
    position: relative;
    border: 2px solid #000;
    height: 100%;
    min-height: 14px;
    min-width: 30px;
  }
  .hslider-handle {
    position: absolute;
    top: 0;
    left: var(--pos, 50%);
    width: 20%;
    height: 100%;
    background: #000;
    transition: left ~"calc(0.1s * var(--render-speed, 1))" linear;
  }
  &[data-style="1"],
  &[data-style="2"],
  &[data-style="3"],
  &[data-style="6"],
  &[data-style="7"] {
    color: #fff;
    .hslider-track {
      border-color: #fff;
    }
    .hslider-handle {
      background: #fff;
    }
  }
}

#samples:not([data-compact-timeline-full="true"]) .window.compact-timeline {
  .ct-sample {
    background: #000;
  }
  .ct-track {
    border-top: 1px solid #000;
    &:first-child {
      border-top: none;
    }
  }
  .ct-sample.active {
    background: #fff !important;
  }
}

.window.compact-timeline {
  position: relative;
  z-index: 4;
  color: #000;
  padding: 25px 4px 4px;
	min-height:	auto !important;
  .content {
		height: 100%;
		position: relative;
		overflow: hidden;
  }
  .ct-timer {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #000;
    z-index: 4;
    transform: translateX(-50%);
  }
  .ct-tracks {
    position: absolute;
    inset: 0;
    display: grid;
    grid-auto-rows: 1fr;
  }
  .ct-track {
    position: relative;
    min-height: 6px;
  }
  .ct-track-lane {
    position: absolute;
    inset: 0;
  }
  .ct-sample {
    position: absolute;
    top: 1px;
    bottom: 1px;
  }
}

#samples[data-compact-timeline-full="true"] {
  .window.compact-timeline {
    position: absolute;
    inset: 0;
    width: auto !important;
    height: auto !important;
    aspect-ratio: auto !important;
    z-index: -1;
    background: #000;
    padding: 0;
    border: 2px solid #333;
    max-height: none !important;
    .content {
      inset: 0 0 0 0;
    }
    .header {
      display: none;
    }
    .ct-sample {
      border-top: 8px solid #fff;
      top: 0;
      bottom: 0;
      &:not(.active) {
        background: #333;
        // border: 1px solid #666;
        // background: #000;
        border-top: 8px solid #555;
      }
    }
    .ct-track {
      border-color: #333;
    }
    .ct-timer {
      background: #fff;
    }
    .sample-border-after {
      display: none !important;
    }
  }
}

.window.files {
  position: relative;
  color: #000;
  padding-top: 21px;
  z-index: 1;
	min-width: 128px;
  .content {
    padding: 2px 6px 5px;
    text-align: left;
    height: 100%;
		overflow: hidden;
  }
  .file-item {
    display: inline-block;
    vertical-align: top;
    width: 54px;
    margin: 2px;
    text-align: center;
    line-height: 1.1;
    &.active {
      filter: invert(1);
    }
    img {
      width: 40px;
      height: 40px;
      display: block;
      margin: 0 auto 2px;
      object-fit: contain;
    }
    .name {
      display: block;
      font-size: 9px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}

canvas {
  image-rendering: pixelated;
  display: block;
  opacity: 0.9;
  height: ~"calc(100% - 21px)" !important;
  margin-top: 21px;
  width: 100% !important;
  max-height: ((@vh * 0.4) - 26px);
}

#chapter {
  position: fixed;
  right: 0;
  top: 0;
  color: #888;
  padding: 10px;
  z-index: 999;
  display: none;
}

#floating-windows {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
	overflow: hidden;
  & > div {
    position: absolute;
  }
  .floating-notification-group {
    position: absolute;
  }
  .floating-notification {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    // pointer-events: none;
    width: 300px;
  }
}

#notifications {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  & > div {
    position: absolute;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .tr {
    right: 0;
    top: 0;
    align-items: flex-end;
  }
  .tl {
    left: 0;
    top: 0;
  }
  .bl {
    left: 0;
    bottom: 0;
  }
  .br {
    right: 0;
    bottom: 0;
    align-items: flex-end;
  }
}

body[data-chapter="5"] {
  // background: #000 !important;
  // #timeline {
  // 	display: none;
  // }
  // #floating-windows {
  // 	display: none;
  // }
}

body[data-chapter="0"],
body[data-chapter="3"] {
  #kicks > div {
    background-color: red !important;
  }
}

#kicks {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  & > div {
    height: 100%;
    width: 25%;
    background-color: #000;
    &.active {
      background-color: #fff;
    }
  }
  .kick-front {
    position: absolute;
    left: 0;
    top: 0;
  }
  .kick-back {
    position: absolute;
    left: 25%;
    top: 0;
  }
  .kick-left {
    position: absolute;
    left: 50%;
    top: 0;
  }
  .kick-right {
    position: absolute;
    left: 75%;
    top: 0;
  }
}

body[data-special-effect="true"]:not([data-chapter="9"]):not([data-chapter="11"]) #container,
body[data-manual-special-effect="true"]:not([data-chapter="9"]):not([data-chapter="11"]) #container {
	zoom: @zoom * 4 !important;
  #floating-windows, #notifications {
    display: none;
  }
  #samples {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
    gap: 0 !important;
    .window {
      width: 100% !important;
      height: 100% !important;
      min-height: auto !important;
      max-height: none !important;
    }
    .window:not(.sample) {
      display: none !important;
    }
  }
}

body[data-chapter="7"] #container,
body[data-chapter="8"] #container {
  zoom: @zoom * 0.5 !important;
}

body[data-chapter="0"] #container,
body[data-chapter="11"] #container {
  zoom: 1 !important;
}