/* -----------------------------------------------------------
   [1. 전역 레이아웃 및 컨테이너]
   ----------------------------------------------------------- */
* { box-sizing: border-box; }

.manse-container { 
    max-width: 650px; 
    margin: 20px auto; 
    background: white; 
    padding: 25px; /* 가변 패딩에서 고정값 25px로 변경하여 팽창 방지 */
    border-radius: 12px; 
    border: 1px solid #ddd; 
}

/* -----------------------------------------------------------
   [2. 입력 폼 및 버튼 스타일]
   ----------------------------------------------------------- */
.row { margin-bottom: 15px; display: flex; align-items: center; flex-wrap: wrap; }
.row label { width: 80px; font-weight: bold; color: #333; }
.row input, .row select { flex: 1; min-width: 150px; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 16px; }

#btnCalc { 
    width: 100%; padding: 15px; background: #333; color: white; border: none; 
    border-radius: 6px; font-size: 18px; cursor: pointer; transition: background 0.3s; 
}
#btnCalc:hover {
    background-color: #d94925 !important; /* 화(火) 색상 호버 복구 */
}

/* -----------------------------------------------------------
   [3. 결과창 헤더]
   ----------------------------------------------------------- */
#result { margin-top: 30px; display: none; border-top: 2px solid #333; padding-top: 20px; }
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center; /* flex-start에서 center로 변경하여 세로 중앙 정렬 */
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}
.user-info { font-size: clamp(1.2rem, 4vw, 1.6rem); font-weight: bold; color: #111; }
.input-details { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 0.85rem; }

.gender-label { padding: 2px 6px; border-radius: 4px; font-weight: bold; font-size: 0.8rem; }
.gender-label.male { background-color: #e0f2fe; color: #0369a1; }
.gender-label.female { background-color: #fce7f3; color: #be185d; }

/* -----------------------------------------------------------
   [4. 사주 명조 그리드 (기둥 간격 밀착)]
   ----------------------------------------------------------- */
.saju-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 5px; /* 기둥 사이의 간격 축소 */
    width: 100%;
    max-width: 440px; /* 전체 너비 제한으로 중앙 집결 */
    margin: 25px auto;
}

.saju-column {
    display: flex; flex-direction: column; align-items: center; min-width: 0; 
}

/* -----------------------------------------------------------
   [5. 오행 박스 (크기 및 비율 조정)]
   ----------------------------------------------------------- */
.kan-box {
    width: 100%;
    max-width: 90px;
    aspect-ratio: 1 / 1.35; /* 세로 공간 확보 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 10px; /* 지지 한자 숨통 트이기 */
    border-radius: 4px;
    margin: 2px 0;
}

.wood  { background-color: #1e40af !important; color: #ffffff !important; }
.fire  { background-color: #d94925 !important; color: #ffffff !important; }
.earth { background-color: #eab308 !important; color: #ffffff !important; }
.metal { background-color: #9ca3af !important; color: #ffffff !important; }
.water { background-color: #111827 !important; color: #ffffff !important; }

/* -----------------------------------------------------------
   [6. 텍스트 크기 및 위계 질서 확립]
   ----------------------------------------------------------- */
.column-label { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: bold; margin-bottom: 5px; }
.sipsin-top, .sipsin-bottom { font-size: clamp(1rem, 2.5vw, 1.2rem); height: 1.8rem; color: #555; }

.hanja { font-size: clamp(1.2rem, 7vw, 2.2rem); font-weight: bold; line-height: 1; }
.hangul { font-size: clamp(1.0rem, 2.5vw, 1.2rem); opacity: 0.9; margin-top: 2px; }

/* 지장간 대원칙: 굵게 금지, 중앙 정렬 */
.jijangan { 
    font-size: clamp(0.8rem, 2vw, 1rem); 
    font-weight: normal !important; 
    margin-top: 5px; 
    border-top: 1px solid rgba(255,255,255,0.4); 
    width: 85%; 
    text-align: center; 
    padding-top: 3px;
    white-space: nowrap; 
}

/* -----------------------------------------------------------
   [7. 디버그 및 기타]
   ----------------------------------------------------------- */
#debugMsg { font-size: 11px; color: #555; background: #f4f4f4; padding: 12px; margin-top: 30px; border-radius: 6px; }