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

:root {
  --root-note-color: #8d28007f;
  --secondary-note-color: #49140099;
  --highlight-color: coral;
  /* This will be adjusted when computing canvas dimensions */
  --surface-height: 100vh;
  /* Modified programatically when needed */
  --knob-transition: none;
  /* anti-zoom -> */
  touch-action: pan-x pan-y;
  height: 100%;
  /* <- anti-zoom */

  /* Computed with canvas dimensions */
  --header-height: unset;
  --header-btn-height: 46px;
  --header-bg: #222;
  --button-bg: #00000097;
}

html,
body {
  font-family: 'Courier New', Courier, monospace;
  height: 100%;
  overflow-y: hidden;
  /* Prevent pull-to-refresh on mobile browsers */
  overscroll-behavior: none !important;
  /* Esto antes no estaba. (En teoría para iOS): Prevent pull-to-refresh on mobile browsers */
  position: fixed;
}

body {
  background-color: #222;
  color: #ccc;
  user-select: none;
}

h1 {
  font-size: 3rem;
}

span.highlight {
  color: coral;
}

.togglers {
  width: 100%;
}

.toggler-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 8px;
  background-color: #222;
  margin-bottom: 2px;
  border-radius: 4px;
}

.toggler-container label {
  font-size: 24px;
  text-align: left;
  color: #bdbdbd;
}

.toggler {
  padding: 2px;
}

.toggler-track {
  width: 56px;
  height: 29px;
  padding: 3px;
  border-radius: 14px;
  background-color: rgb(87 87 87);
  ;
}

.toggler-handle {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  transition: margin 150ms ease-out;
  background-color: white
}

.toggler[data-status="ON"] .toggler-track {
  background-color: rgb(0, 209, 0);
}

.toggler[data-status="ON"] .toggler-handle {
  margin-left: 26px;
}

#showClonedKnobTogglerContainer .toggler {
  height: var(--header-btn-height);
  display: flex;
  justify-content: center;
  align-items: center;
}

#updateBanner {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 12px 6px;
  display: flex;
  align-items: center;
  flex-direction: column;
  z-index: 1001;
  background-color: white;
  color: black;
  transition: all 500ms ease-out;
}

#updateBanner.folded {
  transform: translateY(110%);
}

#updateBanner p {
  text-align: center;
  font-size: 22px;
  margin-bottom: 8px;
}

#updateBanner #updateRefreshBtn {
  padding: 24px 12px;
  border: none;
  outline: none;
  font-size: 18px;
  border-radius: 6px;
  background: #009b1b;
  color: #ffffff;
}

/* HEADER */

#mainHeader {
  position: relative;
  z-index: 100;
  /* z-index: 30; */
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100vw;
  max-width: 100vw;
  background-color: var(--header-bg);
  padding: 4px;
  height: calc(var(--header-btn-height) + 8px);
  border: 1px solid transparent;
  border-radius: 6px;
}

#app.recording .header-controls {
  border-color: #ff3f00fc;
}

#app.recording #toggleRecord {
  border-color: #ff3f00fc;
}

.header-btn,
.gear-btn {
  font-size: 20px;
  border: 1px solid #6e6e6e;
  border-radius: 5px;
  background-color: var(--button-bg);
  height: var(--header-btn-height);
  line-height: var(--header-btn-height);
  text-align: center;
  color: #ccc;
}

.project-btn {
  width: 50px;
}

.header-btn {
  min-width: 45px;
}

.highlighted {
  border-color: white !important;
}

#showTracks {
  padding: 0 3px;
  color: white;
}

#showTracks.active {
  background-color: #024d02;
}

#currentInstrument {
  border-color: #007d00;
}

/* GEAR MENU */

.gear-wrapper {
  position: relative;
}

#gearDropdownBtn {
  font-size: 28px;
}

#gearMenu {
  position: absolute;
  bottom: -2px;
  right: -5px;
  z-index: 150;
  transform: translateY(calc(100% + 6px));
  background-color: #111;
  padding: 0px 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100vw;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid #959595;
}

#gearMenu #gearBackdrop {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: #0000009e;
  z-index: 1;
}

#gearMenu .heading {
  font-size: 22px;
  font-weight: normal;
}

/* Section */
#gearMenu section {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 4px;
  background-color: #000;
  width: 100%;
}

#gearMenu .section-items {
  display: flex;
  width: 100%;
  padding: 8px;
}

#gearMenu section.folded .section-items {
  display: none;
}

section .item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  font-size: 16px;
  width: 100%;
}

.gear-btn {
  width: 100%;
}

#gearMenu .section-heading {
  width: 100%;
  padding: 11px 16px;
  background-color: #222;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-heading .arrow {
  font-size: 30px;
}

section.project .section-items {
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-evenly;
}

section.sistema .item,
section.project .item {
  width: unset;
  align-items: center;
  text-align: center;
  background-color: #54165a;
  border-radius: 12px;
  gap: 0;
  padding: 0;
  width: 30%;
}

section.sistema .item svg,
section.project .item svg {
  width: 45px;
}

section.project .gear-btn {
  padding: 0 8px;
}

.item.click-level {
  align-items: center;
}

.item.click-level #clickLevelKnob {
  border-color: transparent;
}


section.project .section-items,
section.sistema .section-items {
  gap: 1rem;
  justify-content: space-evenly;
  align-items: stretch;
}

section.sistema .item {
  background-color: #3c0542;
}

#gearMenu section.controls .section-items,
#gearMenu section.playback .section-items {
  justify-content: space-around;
}

#gearMenu section.controls .item,
#gearMenu section.playback .item {
  width: unset;
  align-items: center;
  text-align: center;
}



/* Top section */
#gearMenu section.top {
  background-color: #000;
}

#gearMenu section.top .item {
  width: 50%;
}

section.top .gear-btn {
  height: unset;
  line-height: 40px;
  padding: 6px;
}

.gear-btn#showInsertInstrumentMenu {
  background-color: #231100;
  border-color: #d46700;
  color: #d46700;
}

.gear-btn#showInsertEffectMenu {
  background-color: #003737;
  border-color: #00d5d5;
  color: #00d5d5;
}

#initialize {
  font-family: Arial, Helvetica, sans-serif;
  position: fixed;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  display: flex;
  gap: 2rem;
  flex-direction: column;
  text-align: center;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  cursor: pointer;
  background-color: black;
  padding: 0.5rem;
}

#initialize p {
  color: #bbb;
}

#loadingScreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

#headerBackdrop {
  background-color: #000000ab;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 100;
}

.backdrop-x {
  font-size: 28px;
  position: absolute;
  top: 10px;
  right: 16px;
  background-color: black;
  font-weight: bold;
  padding: 2px;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background-color: '#222';
  border-radius: 4px;
}

#canvasContainer {
  width: 100%;
  height: var(--surface-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* justify-content: center; */
  background-color: #111;
  gap: 0;
}

#base_canvas {
  position: relative;
  z-index: 1;
  background-color: #222;
}

#grid_canvas {
  position: fixed;
  z-index: 2;
  background-color: transparent;
}

#notes_canvas,
#sampler_canvas,
#drums_canvas {
  position: fixed;
  background-color: transparent;
  z-index: 5;
}

#clonedKnobContainer {
  position: absolute;
  top: -77px;
  left: 7px;
  background-color: #000;
}

#faderContainer {
  position: absolute;
  top: -160px;
  left: 7px;
  background-color: #000;
}

/* TRACKS OVERVIEW */
#tracksOverview {
  position: fixed;
  z-index: 100;
  top: var(--header-height);
  left: 0;
  width: 100%;
  background-color: #000000b8;
  padding: 6px 4px 60px;
}

.tracks-header {
  padding: 4px;
  margin-bottom: 4px;
  background-color: #151515;
  display: flex;
  justify-content: space-between;
}

#showInsertInstrumentMenuFromTracksOverview {
  padding: 2px 12px;
  font-size: 26px;
  color: coral;
  font-weight: bold;
  background-color: #252525;
}

.tracks-list {}

.overview-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 6px 6px 8px;
  border: 1px solid transparent;
}

.overview-line.current {
  border-color: #00a700;
  background-color: #033e03 !important;
}

.overview-line:nth-child(odd) {
  background-color: #2d2d2b;
}

.overview-line:nth-child(even) {
  background-color: #151515;
}

.overview-line .svg-btn {
  background-color: black;
  width: 34px;
  border: 1px solid transparent;
  padding: 6px 4px;
}

.overview-line .svg-btn.highlighted {
  border-color: white;
}

.left-panel {
  width: 100%;
  padding: 2px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.left-panel .instrument-name {
  min-width: 120px;
  padding: 12px 0px;
}

.right-panel {
  display: flex;
  align-items: center;
  gap: 16px;
}

.spectrum-container {
  width: 100%;
  display: flex;
  align-items: center;
}

.track-spectrum {
  background-color: white;
  width: 100%;
  height: 40px;
}

#logger {
  background-color: #111;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100%;
  z-index: 1000;
  overflow-y: auto;
  padding-bottom: 52px;
  user-select: text;
}

#close-logs {
  padding: 1rem;
  font-size: 20px;
  text-align: right;
  background-color: #222;
  position: fixed;
  top: 2px;
  right: 2px;
  user-select: none;
  border: 1px solid #aaa;
}

#logs {
  margin-top: 64px;
}

.log-entry {
  background-color: #333;
  font-size: 20px;
  padding: 4px;
  margin-bottom: 4px;
  /* font-weight: bold; */
}

.log-entry.type-info {
  background-color: #005600;
  color: white;
}

.log-entry.type-debug {
  background-color: #000f4e;
  color: white;
}

.log-entry.type-warn {
  background-color: #7c4f00;
  color: white;
}

.log-entry.type-error {
  background-color: #890000;
  color: white;
}

/* Utility classes */

.hidden {
  visibility: hidden !important;
}

.display-none {
  display: none !important;
}

.padding-none {
  padding: 0 !important;
}

.margin-0 {
  margin: 0 !important;
}

.flex-relative {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gap-0 {
  gap: 0 !important;
}

.align-center {
  align-items: center;
}
