*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f0f8ff;
  /* 연한 하늘색 배경 */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

.calculator-container {
  background-color: #ffffff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 1100px;
}

h1 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 30px;
}

/* 공통 입력 영역 (하얀색 박스) */
.common-inputs,
.contract-inputs-container {
  padding: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: #f9f9f9;
  margin-bottom: 20px;
}

/* 공통 수익 조건 입력 필드 컨테이너 설정 */
.common-inputs-wrapper {
  display: flex;
  justify-content: center;
  /* 하얀색 박스를 화면 중앙에 배치 */
  margin-bottom: 20px;
}

.common-inputs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  width: 100%;
  max-width: 600px;
  /* 하얀색 박스 최대 너비 제한 */
}

.common-inputs h2 {
  width: 100%;
  margin-top: 0;
  color: #87ceeb;
  /* 파스텔 하늘색 계열 */
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 10px;
  margin-bottom: 15px;
  text-align: center;
}

/* 유료수익 입력 칸의 오른쪽 여백을 크게 줘서 가로 간격만 벌림 */
.common-inputs .gap-adjust {
  flex: 0 0 270px;
}

/* 일반 계약 입력 영역 (선차감/후차감 조건) */
.contract-inputs-container {
  display: flex;
  gap: 20px;
}

.contract-input-box {
  flex: 1;
  padding: 15px;
  border: 1px dashed #bdc3c7;
  border-radius: 8px;
}

.contract-input-box h2 {
  margin-top: 0;
  font-size: 1.1em;
  color: #e74c3c;
  text-align: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

/* 입력 그룹 및 라벨 스타일 */
.input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  text-align: center;
  align-items: center;
  /* 라벨 텍스트 중앙 정렬 */
}

label {
  margin-bottom: 5px;
  font-weight: bold;
  color: #34495e;
  font-size: 0.9em;
  display: block;
}

input[type="number"] {
  padding: 10px;
  border: 1px solid #bdc3c7;
  border-radius: 5px;
  font-size: 16px;
  width: 92%;
  text-align: center;
}

/* 액션 패널 (버튼) 스타일 */
.action-panel-single {
  margin-bottom: 30px;
  text-align: center;
}

.action-panel-single button {
  background-color: #87ceeb;
  /* 파스텔 하늘색 */
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  transition: background-color 0.3s;
  width: 50%;
  margin: 0 auto;
  display: block;
}

.action-panel-single button:hover {
  background-color: #6aabcf;
  /* 버튼 호버 색상 */
}

/* 결과 출력 영역 스타일 */
.results-container {
  display: flex;
  gap: 30px;
  margin-top: 20px;
}

.result-box {
  flex: 1;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 계약 1 (선차감) 색상 */
.contract1 {
  background-color: #e3f2fd;
  border-left: 5px solid #87ceeb;
  border: 1px solid #e0e0e0;
}

/* 계약 2 (후차감) 색상 */
.contract2 {
  background-color: #e3f2fd;
  border-left: 5px solid #6495ed;
  border: 1px solid #e0e0e0;
}

.result-box h2 {
  margin-top: 0;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 16px;
}


/* 최종 수익 강조 스타일 */
.total {
  font-size: 1.2em;
  padding: 15px 0 !important;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 5px;
  padding: 10px;
}

.total .label {
  font-weight: bold;
  color: #4682b4;
}

.total .value {
  font-size: 1.3em;
  color: #20b2aa;
}

/* 안내 문구 스타일 */
.disclaimer-text {
  margin-top: 20px;
  padding: 15px;
  text-align: center;
  font-size: 0.9em;
  color: #5c7083;
  background-color: #ffffff;
  border: 1px solid #add8e6;
  border-radius: 5px;
  display: none;
}

/* 모바일 반응형 (화면 900px 이하) */
@media (max-width: 900px) {

  .contract-inputs-container,
  .results-container {
    flex-direction: column;
    gap: 20px;
  }

  /* 공통 입력 필드: 가로 -> 세로로 전환하고 너비 100% 사용 */
  .common-inputs {
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    justify-content: center;
    /* 세로 정렬 시 왼쪽 정렬 */
    align-items: flex-start;
    /**/
  }

  .action-panel-single button {
    width: 100%;
  }

  /* gap-adjust */
  .common-inputs .gap-adjust {
    width: 100%;
    margin-right: 0;
    flex-shrink: 1;
    margin-bottom: 10px;
    justify-content: space-between;
  }

  .input-group {
    /* 모바일에서는 너비를 꽉 채우도록 설정 */
    width: 100%;
    margin-bottom: 10px;
    height: auto;
    flex: 0 0 auto;

    /* 나머지 모바일 스타일 유지 */
    .action-panel-single button {
      width: 100%;
    }

    .common-inputs-wrapper {
      padding: 0 10px;

    }
  }
}