/* 기존 CSS 유지 */
body {
  margin: 0;
  font-family: 'Noto Sans KR', sans-serif;
  background-color: white !important;
  /* overflow: hidden; /* 전체 페이지 스크롤 방지가 필요하다면 */
}

#main-background-video {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  z-index: -2; /* 모든 콘텐츠보다 뒤에 위치 */
  object-fit: cover;
}

#nameConnect {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* 콘텐츠를 상단으로 정렬 */
  min-height: 100vh;
  text-align: center;
   /* 패딩을 구체적으로 설정하여 상단 위치 조정 */
  padding-top: 10vh; /* 상단에서 뷰포트 높이의 10%만큼 떨어진 곳에서 시작 (이 값을 조절하여 높이 변경) */
  padding-left: 20px;   /* 기존 좌우 패딩 유지 */
  padding-right: 20px;  /* 기존 좌우 패딩 유지 */
  padding-bottom: 20px; /* 기존 하단 패딩 유지 (또는 필요에 따라 조절) */
  position: relative;
  z-index: 1; /* 메인 배경 비디오 위에 위치 */
  box-sizing: border-box;
  background-color: #FBF9F8;
  /* 기존 background-color 는 주석처리하거나 반투명으로 하여 비디오가 보이도록 함 */
  /* background-color: #fdfbff; */
}

#nameConnect input,
#nameConnect button {
  position: relative;
  z-index: 10; /* 춤추는 비디오보다도 위에 보이도록 */
}

#nameConnect input {
  font-size: 20px;
  padding: 10px 15px;
  margin: 10px;
  width: 220px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  background-color: rgba(255, 255, 255, 0.8); /* 비디오 위에 잘보이게 */
}

#nameConnect button {
  font-size: 18px;
  padding: 10px 30px;
  background-color: #9c27b0;
  color: white;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-top: 15px;
}

#nameConnect button:hover {
  background-color: #7b1fa2;
}

#input-names {
  font-size: 36px;
  font-weight: bold;
  margin-top: 30px;
  color: #070707;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  position: relative; /* 다른 요소들과의 z-index 관계 명확화 */
  z-index: 2;
}

#animation-area {
  margin-top: 10px;
  min-height: 80px;
  position: relative; /* 다른 요소들과의 z-index 관계 명확화 */
  z-index: 2;
}


/*
  만약 춤추는 비디오를 final-result의 양 옆에 고정시키고 싶다면,
  #result-container 에 position: relative; 를 주고
  .dance-video 에 position: absolute; 를 사용할 수 있습니다.
  아래는 그 예시입니다. (위의 .dance-video 스타일 대신 사용)

.dance-video {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 150px;
  height: auto;
  object-fit: contain;
  z-index: 0;  결과 텍스트보다는 뒤, 메인 배경보다는 위 
}

#left-dance-video {
  left: -160px;  결과 텍스트 왼쪽으로 150px(비디오너비) + 10px(간격) 
}

#right-dance-video {
  right: -160px; 결과 텍스트 오른쪽으로 150px(비디오너비) + 10px(간격) 
}

#final-result {
   position: relative;
   z-index: 1; 춤추는 비디오보다 위에 
}

*/


/* 결과 및 춤추는 비디오 컨테이너 */
#result-container {
  display: flex; 
  align-items: center; 
  justify-content: space-between; /* 비디오를 양 끝으로 보내고, final-result는 중앙에 absolute로 위치하도록 변경 */
  position: relative; 
  /*margin-top: 10px; */
  z-index: 1; 
  width: 100%; /* 컨테이너 너비를 부모 너비에 맞춤 */
  /* height: 150px; */ /* 최소 높이를 설정하여 final-result가 표시될 공간을 확보해 줄 수 있습니다. (비디오 높이 고려) */
                      /* 또는 final-result의 높이만큼 padding을 줄 수도 있습니다. */
  padding-left: 280px; /* 좌우 비디오가 너무 화면 끝에 붙지 않도록 패딩 (조절 가능) */
  padding-right: 250px;/* 좌우 비디오가 너무 화면 끝에 붙지 않도록 패딩 (조절 가능) */
  box-sizing: border-box; /* 패딩이 너비에 포함되도록 */
}

.dance-video {
  width: 350px; 
  height: auto; 
  object-fit: contain; 
  margin: 0 20px;
  /* margin: 0 10px; */ /* justify-content: space-between 사용 시 margin은 필요에 따라 조절하거나 제거 */
  /* z-index: 0; */ /* final-result 보다 뒤에 오도록 설정할 수 있습니다. */
  /* position: relative; */ /* z-index를 적용하려면 position 필요 */
}


/* === #left-dance-video 와 #right-dance-video 를 좀 더 바깥으로 이동시키기 위한 조정 === */
/* #result-container의 justify-content: space-between; 으로 기본적인 간격은 확보됩니다. */
/* 더 미세한 조정이 필요하다면 아래와 같이 각 비디오에 margin을 사용할 수 있습니다. */
/* 예를 들어, 왼쪽 비디오를 더 왼쪽으로, 오른쪽 비디오를 더 오른쪽으로 밀고 싶다면: */

#left-dance-video {
  margin-right: auto;  
  margin-left: -30px; 
  margin-top: -110px;
}

#right-dance-video {
   margin-top: -110px;
  margin-left: auto; 
  margin-right: -20px; 
}

/* 위 방식 대신, #result-container의 padding을 조절하거나, 
   각 .dance-video에 transform: translateX()를 사용하는 방법도 있습니다. 
   가장 간단한 것은 #result-container의 justify-content와 padding을 활용하는 것입니다.
   여기서는 justify-content: space-between; 을 사용하였으므로, 비디오는 양 끝으로 정렬됩니다.
   만약 #final-result 공간 때문에 중앙 공간이 부족하면, #final-result의 min-width를 조절해야 합니다.
*/


#final-result {
  font-size: 36px; 
  font-weight: bold;
  color: #ff3b3b; 
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  border-radius: 5px;

  /* 중앙 정렬 및 레이아웃 분리 */
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); 
  transform-origin: center center; 
  white-space: nowrap; 
  /* min-width: 150px; */ /* 이 값을 조절하여 텍스트가 차지하는 최소 너비 확보, 너무 크면 비디오 공간 침범 */
  /* max-width: 80%; */ /* #result-container 너비의 80%를 넘지 않도록 (선택 사항) */
  text-align: center; 
  z-index: 1; /* .dance-video와 z-index가 같다면 DOM 순서에 따르거나, 명시적으로 더 높게 설정 가능 */
             /* .dance-video에 z-index: 0; 을 주고, #final-result에 z-index: 1; 을 주면 확실히 위에 옵니다. */
}
/* nameConnect-style.css 파일 맨 아래 등에 추가 */

.action-buttons-container {
  display: flex;
  /* 버튼들을 가로로 배치 */
  justify-content: center;
  /* 버튼들을 중앙에 정렬 */
  gap: 15px;
  /* 버튼 사이의 간격 */
  margin-top: 20px;
  /* 위 요소와의 간격 */
}


/* ===== 모바일 ===== */

@media (max-width: 600px) {
  /* ===== 기본 #nameConnect 컨테이너 조정 ===== */
  #nameConnect {
    padding-top: 5vh; /* 상단 패딩을 줄여 모바일 화면에 더 많은 내용 표시 */
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 15px;
  }

  /* ===== 입력 필드 및 버튼 스타일 조정 ===== */
  #nameConnect input {
    font-size: 16px; /* 모바일 가독성을 위한 폰트 크기 */
    padding: 12px 15px; /* 터치 영역 확보 */
    width: 100%; /* 너비를 부모 요소에 맞춤 */
    max-width: 300px; /* 최대 너비 설정 (선택 사항) */
    margin: 8px 0; /* 상하 마진 조정 */
    box-sizing: border-box; /* 패딩, 테두리 포함 너비 계산 */
  }

  #nameConnect button {
    font-size: 16px; /* 버튼 폰트 크기 */
    padding: 12px 25px; /* 버튼 패딩 조정 */
    margin-top: 20px; /* 버튼 상단 마진 */
    width: 100%; /* 버튼 너비 전체 사용 */
    max-width: 300px; /* 최대 너비 설정 */
    box-sizing: border-box;
  }

  /* ===== 입력된 이름 표시 영역 조정 ===== */
  #input-names {
    font-size: 24px; /* 폰트 크기 축소 */
    margin-top: 20px; /* 상단 마진 조정 */
  }

  /* ===== 애니메이션 및 결과 표시 영역 조정 ===== */
  #animation-area {
    margin-top: 15px;
    min-height: 50px; /* 최소 높이 조정 */
  }

  /* ===== #result-container 내부 요소 세로 배치 ===== */
  #result-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* 자식 요소들 (결과 포함) 수평 중앙 정렬 */
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
    margin-top: 10px;
    box-sizing: border-box;
  }

  /* ===== 최종 결과(#final-result) 스타일 조정 ===== */
  #final-result {
    /* === 위치 및 정렬 === */
    position: relative !important; /* 데스크톱의 absolute 덮어쓰기 */
    left: auto !important;         /* ★★★ 데스크톱의 left: 50% 초기화 ★★★ */
    top: auto !important;          /* ★★★ 데스크톱의 top: 50% 초기화 ★★★ */
    /* transform: none !important; <-- JavaScript에서 scale만 사용하도록 수정했다면 이 줄은 제거 또는 주석 처리! */
    
    width: 100%; /* 부모 너비에 맞춤 (또는 width: auto; margin-left: auto; margin-right: auto; 사용 가능) */
    text-align: center; /* 내부 텍스트 중앙 정렬 */
    order: 1; /* 비디오보다 먼저 표시 */

    /* === 폰트 및 모양 === */
    font-size: 38px; /* 요청대로 글자 크기를 이전 36px에서 좀 더 크게 */
    font-weight: bold;
    color: #ff3b3b;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    line-height: 1.3;
    margin-bottom: 20px; /* 비디오와의 간격 */
    padding: 5px 0; 
    box-sizing: border-box;
  }

  /* ===== 춤추는 비디오(.dance-video) 스타일 조정 ===== */
  .dance-video {
    width: 70%; /* 비디오 너비 조정 */
    max-width: 220px; /* 최대 너비 설정 */
    height: auto;
    margin: 10px 0; /* 각 비디오의 상하 마진으로 간격 설정 */
    object-fit: contain;
    z-index: 1;
    /* 기존의 #left-dance-video, #right-dance-video 특정 마진값 초기화 */
  }

  #left-dance-video {
    margin: 0; /* 초기화 */
    margin-bottom: 10px; /* final-result 아래, right-dance-video 위에 위치할 때의 하단 마진 */
    order: 2; /* flex 아이템 순서: 두 번째로 표시 */
  }

  #right-dance-video {
    margin: 0; /* 초기화 */
    order: 3; /* flex 아이템 순서: 세 번째로 표시 */
  }

  /* 메인 배경 비디오 숨기기 (선택 사항: 모바일에서 성능/데이터 절약) */
  /*
  #main-background-video {
    display: none;
  }
  #nameConnect {
    background-color: #FBF9F8 !important;    
  */
}