/* treestyles.css */
@import url('https://fonts.googleapis.com/css2?family=Dongle:wght@300&family=Gamja+Flower&family=Gowun+Dodum&display=swap');
/* 기본 스타일 */
body {
  font-family: "Gowun Dodum", sans-serif;
  text-align: center; /* 모든 텍스트를 가운데 정렬 */
  background-color: #e0f7fa;
  margin: 0;
  padding: 0;
}

.header {
  position: fixed;
  top: 0;
  right: 0;
  padding: 10px 20px;
  background-color: rgba(255, 255, 255, 0.8);
  border-bottom-left-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  z-index: 1000;
}

.container {
  padding: 80px 20px 20px 20px; /* 헤더 공간 확보 */
  display: flex;
  flex-direction: column;
  align-items: center; /* 자식 요소들을 가로 방향으로 가운데 정렬 */
}

h1 {
  margin-bottom: 10px;
}

.game-description {
  font-size: 18px;
  color: #333;
  margin: 10px 0 30px 0;
  max-width: 600px;
  line-height: 1.5;
  text-align: center;
  padding: 0 10px;
}

#tree-container {
  margin: 0 auto;
  width: 80%;
  max-width: 300px; /* 기본 최대 너비 */
  height: auto;
  position: relative;
}

#tree-image {
  width: 100%; /* 부모 컨테이너의 100% 너비 */
  height: auto; /* 비율 유지 */
  cursor: pointer;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#tree-image.growing {
  opacity: 0.7;
  transform: scale(1.05);
}

#tree-image.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

#save-button {
  margin-top: 20px;
  padding: 10px 20px;
  font-size: 16px;
  background-color: #ff9800;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#save-button:hover {
  background-color: #e68900;
}

.navigation-buttons {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.navigation-buttons button {
  padding: 8px 16px;
  font-size: 14px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.navigation-buttons button:hover {
  background-color: #45a049;
}

.navigation-buttons button:disabled {
  background-color: #a5d6a7;
  cursor: not-allowed;
  opacity: 0.6; /* 비활성화 상태 시 투명도 추가 */
}

#contributors {
  margin-top: 30px;
  width: 100%; /* 기여자 목록을 컨테이너 전체 너비로 설정 */
  max-width: 500px; /* 최대 너비 설정 */
  background-color: rgba(255, 255, 255, 0.9); /* 배경색 추가 (선택 사항) */
  padding: 20px; /* 패딩 추가 (선택 사항) */
  border-radius: 10px; /* 테두리 라운드 (선택 사항) */
}

#contributors h2 {
  text-align: center; /* 기여자 목록 제목을 가운데 정렬 */
}

#contributors-list {
  list-style-type: none;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center; /* 리스트 아이템들을 가운데 정렬 */
}

#contributors-list li {
  padding: 10px 0; /* 패딩 조정 */
  border-bottom: 1px solid #ccc;
  width: 100%; /* 리스트 아이템을 전체 너비로 확장 */
  text-align: left; /* 리스트 아이템 텍스트는 왼쪽 정렬 */
  max-width: 400px; /* 리스트 아이템의 최대 너비 설정 */
}

/* 플로팅 숫자 스타일 */
.floating-number {
  position: absolute;
  color: #ff5722;
  font-weight: bold;
  font-size: 20px;
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px);
  }
}

/* 총 터치 횟수 스타일 추가 */
#total-touches {
  font-size: 18px;
  font-weight: bold;
  color: #ff5722; /* 원하는 색상으로 변경 */
}

/* 반응형 디자인 */
@media (max-width: 600px) {
  .header {
    padding: 8px 16px;
    font-size: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .game-description {
    font-size: 16px;
    max-width: 90%;
  }

  #contributors h2 {
    font-size: 18px;
  }

  #contributors-list li {
    font-size: 14px;
    max-width: 300px; /* 모바일에서 리스트 아이템의 최대 너비 줄이기 */
  }

  #save-button {
    font-size: 14px;
    padding: 8px 16px;
  }

  .navigation-buttons button {
    font-size: 12px;
    padding: 6px 12px;
  }

  /* 모바일에서 이미지 크기 조정 */
  #tree-container {
    width: 90%;
    max-width: 250px; /* 모바일에서 최대 너비 줄이기 */
  }

  #tree-image {
    width: 100%;
    height: auto;
    max-height: 300px; /* 모바일에서 최대 높이 설정 */
  }
}

/* 추가적인 작은 화면을 위한 미디어 쿼리 */
@media (max-width: 400px) {
  #tree-container {
    width: 95%;
    max-width: 200px;
  }

  #tree-image {
    max-height: 250px;
  }

  .game-description {
    font-size: 14px;
    max-width: 95%;
  }

  .navigation-buttons button {
    font-size: 10px;
    padding: 5px 10px;
  }
}

/* 나무 이미지 애니메이션 */
#tree-image.growing {
  opacity: 0.7;
  transform: scale(1.05);
}

#tree-image.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* 스로틀링 피드백을 위한 클래스 */
#tree-image.throttled {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}
