/* -----------------------------------------------------------
   [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 {
    display: block;
    width: auto;
    min-width: 180px;
    height: 50px;
    margin: 6px auto 0;
    padding: 0 30px;
    background: linear-gradient(135deg, #d94925, #e8693c);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s, background .18s;
    box-shadow: 0 12px 22px rgba(217,73,37,.25);
}
#btnCalc:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #b8371c, #d94925);
    box-shadow: 0 14px 24px rgba(217,73,37,.30);
}

/* -----------------------------------------------------------
   [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; }

/* -----------------------------------------------------------
   [선택식 만세력 입력 UI]
   - 기존 만세력 결과 스타일은 유지하고 입력 양식만 오늘의 운세와 통일
   ----------------------------------------------------------- */
.newmanse-container {
    max-width: 820px;
    border: 1px solid #eaded8;
    border-radius: 22px;
    box-shadow: 0 14px 36px rgba(68, 40, 28, .08);
}

.newmanse-form-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #f0e5df;
}

.newmanse-form-head h3 {
    margin: 0 0 8px;
    font-size: 1.35rem;
    letter-spacing: -.04em;
    color: #2b201c;
}

.newmanse-form-head p {
    margin: 0;
    color: #7b655d;
    line-height: 1.65;
    font-size: .95rem;
}

.newmanse-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff1eb;
    color: #d94925;
    font-size: .86rem;
    font-weight: 900;
    white-space: nowrap;
}

.newmanse-input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.newmanse-field {
    padding: 16px;
    border: 1px solid #eaded8;
    border-radius: 18px;
    background: #fffaf7;
}

.newmanse-field.full { grid-column: 1 / -1; }

.newmanse-field label,
.newmanse-field .field-label {
    display: block;
    margin-bottom: 10px;
    color: #3b2d27;
    font-weight: 900;
    font-size: .94rem;
}

.newmanse-field input[type="text"],
.newmanse-field select {
    width: 100%;
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid #ddcfc8;
    border-radius: 14px;
    background: #fff;
    color: #2b201c;
    font-size: 1rem;
    outline: none;
}

.newmanse-field input[type="text"]:focus,
.newmanse-field select:focus {
    border-color: #d94925;
    box-shadow: 0 0 0 3px rgba(217, 73, 37, .12);
}

.select-row {
    display: grid;
    gap: 10px;
}

.birth-select-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.time-select-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.location-select-row { grid-template-columns: 1fr; }
.location-select-row select { width: 100%; }

.radio-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.radio-pill {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    margin: 0 !important;
    padding: 12px 10px;
    border: 1px solid #ddcfc8;
    border-radius: 14px;
    background: #fff;
    color: #5e4a42 !important;
    font-weight: 900 !important;
    cursor: pointer;
}

.radio-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-pill:has(input:checked) {
    border-color: #d94925;
    background: #fff1eb;
    color: #d94925 !important;
}

@supports not selector(:has(*)) {
    .radio-pill input { position: static; opacity: 1; margin-right: 6px; }
}

@media (max-width: 720px) {
    .newmanse-container { padding: 20px 16px; border-radius: 18px; }
    .newmanse-form-head { flex-direction: column; gap: 10px; }
    .newmanse-input-grid { grid-template-columns: 1fr; gap: 12px; }
    .select-row { gap: 7px; }
    .birth-select-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .time-select-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .location-select-row { grid-template-columns: 1fr; }
    .newmanse-field { padding: 14px; }
}

@media (max-width: 420px) {
    .birth-select-row { grid-template-columns: 1fr; }
    .time-select-row { grid-template-columns: 1fr; }
    .location-select-row { grid-template-columns: 1fr; }
    .radio-row { grid-template-columns: 1fr 1fr; }
}
