/* 구글 폰트 불러오기: 영문 영웅 폰트(Cinzel)와 한글 명조체(Noto Serif KR) */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600&family=Noto+Serif+KR:wght@400;700&display=swap');

:root {
    /* 테마 색상 설정 */
    --bg-color: #f4eadd; /* 양피지 느낌의 밝은 베이지 */
    --text-main: #2b1d0e; /* 오래된 잉크 느낌의 짙은 갈색 */
    --text-accent: #8b0000; /* 강조용 짙은 핏빛 붉은색 */
    --border-color: #5c4033; /* 낡은 가죽/나무 느낌의 선 색상 */
    
    /* 은은한 종이 질감 패턴 (투명한 이미지 사용) */
    --paper-texture: url('https://www.transparenttextures.com/patterns/old-mathematics.png');
    
    /* 폰트 설정 */
    --font-title: 'Cinzel', 'Noto Serif KR', serif;
    --font-body: 'Noto Serif KR', serif;
}

body {
    background-color: #3e332a; /* 시트 바깥쪽 나무 탁자 느낌의 배경 */
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0;
    padding: 30px;
    display: flex;
    justify-content: center;
}

/* 캐릭터 시트 본체 (양피지) */
.sheet-container {
    background-color: var(--bg-color);
    background-image: var(--paper-texture);
    max-width: 800px;
    width: 100%;
    min-height: 1130px; /* A4 비율과 유사하게 설정 */
    padding: 40px;
    border: 3px solid var(--border-color);
    border-radius: 5px; /* 모서리를 아주 살짝 둥글게 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7); /* 그림자로 입체감 부여 */
}

/* 상단 헤더 (이름 부분) */
.sheet-header {
    text-align: center;
    border-bottom: 2px double var(--border-color); /* 두 줄 선으로 클래식함 강조 */
    padding-bottom: 20px;
    margin-bottom: 30px;
}

h1 {
    font-family: var(--font-title);
    color: var(--text-accent);
    margin: 0;
    font-size: 2.8rem;
}

.subtitle {
    font-style: italic;
    color: var(--text-main);
    margin-top: 10px;
    font-size: 1.1rem;
}
/* --- 입력창 공통 스타일 (양피지에 어울리게) --- */
input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-title);
}
input:focus {
    outline: none;
}

/* --- 성별 및 재산 (기본 정보) --- */
.basic-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.info-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.info-group label {
    font-weight: bold;
    color: var(--text-accent);
}

.info-group input {
    border-bottom: 1px dashed var(--border-color); /* 밑줄만 표시 */
    font-size: 1.1rem;
    padding: 5px;
    text-align: center;
    width: 120px;
}

.info-group input:focus {
    border-bottom: 1px solid var(--text-accent);
}

.wealth-input {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wealth-input span {
    font-weight: bold;
}

/* --- 능력치 (Stats) 영역 --- */
.stats-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 110px;
    border: 2px solid var(--border-color);
    border-radius: 8px; /* 모서리를 둥글게 */
    background-color: rgba(255, 255, 255, 0.3); /* 양피지 위에서 살짝 도드라지게 */
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

.stat-box label {
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-box input {
    font-size: 2.2rem;
    font-weight: bold;
    text-align: center;
    width: 100%;
}

/* 브라우저 기본 숫자 증감 버튼(스피너) 숨기기 (선택사항) */
.stat-box input::-webkit-outer-spin-button,
.stat-box input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.stat-box input[type=number] {
    -moz-appearance: textfield;
}
/* --- 공통 섹션 제목 (앞으로 장비, 설정 등에도 쓰일 제목 스타일) --- */
.section-title {
    font-family: var(--font-title);
    color: var(--text-accent);
    font-size: 1.8rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 15px;
    padding-bottom: 5px;
}

/* --- 스킬 영역 (모험가 길드 장부 느낌) --- */
.skills-section {
    margin-bottom: 40px;
}

.skills-list {
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.2); /* 양피지 배경과 어우러지게 살짝 투명하게 */
}

.skill-header {
    display: flex;
    font-weight: bold;
    font-family: var(--font-title);
    background-color: rgba(92, 64, 51, 0.1); /* 제목줄 배경색 */
    border-bottom: 2px solid var(--border-color);
    padding: 10px;
    text-align: center;
}

.skill-row {
    display: flex;
    border-bottom: 1px dashed var(--border-color); /* 점선으로 구분 */
    padding: 5px 10px;
}

.skill-row:last-child {
    border-bottom: none; /* 마지막 줄은 점선 제거 */
}

/* 스킬 칸 비율 설정 */
.col-name {
    width: 25%;
}
.col-level {
    width: 15%;
    text-align: center;
}
.col-desc {
    width: 60%;
}

/* 스킬 입력창 스타일 다듬기 */
.skill-row input {
    padding: 8px 5px;
    font-size: 1rem;
    font-family: var(--font-body); /* 본문 폰트 사용 */
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.skill-row input:focus {
    border-bottom: 1px solid var(--text-accent); /* 입력 중일 때 붉은색 밑줄 */
}
/* --- 인벤토리 영역 --- */
.inventory-section {
    margin-bottom: 40px;
}

/* 장착 장비 */
.equipped-gear {
    display: flex;
    flex-wrap: wrap; /* 화면이 좁아지면 아래로 내려가도록 설정 */
    gap: 15px;
    margin-bottom: 25px;
}

.gear-slot {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.4); /* 밝은 음영으로 장착 슬롯 강조 */
    border-radius: 4px;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.1); /* 안쪽 그림자로 파인 듯한 느낌 */
}

.gear-slot label {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--text-accent);
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: bold;
}

.gear-slot input {
    width: 100%;
    font-size: 1.1rem;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 3px;
}

.gear-slot input:focus {
    border-bottom: 1px solid var(--text-accent);
}

/* 배낭 서브 타이틀 */
.subsection-title {
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 10px;
    font-weight: bold;
}

/* 배낭 리스트 (스킬 리스트와 유사한 장부 형태) */
.inventory-list {
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.2);
}

.inventory-header {
    display: flex;
    font-weight: bold;
    font-family: var(--font-title);
    background-color: rgba(92, 64, 51, 0.1);
    border-bottom: 2px solid var(--border-color);
    padding: 10px;
    text-align: center;
}

.inventory-row {
    display: flex;
    border-bottom: 1px dashed var(--border-color);
    padding: 5px 10px;
}

.inventory-row:last-child {
    border-bottom: none;
}

/* 인벤토리 칸 비율 설정 */
.col-item-name { width: 35%; }
.col-item-qty { width: 15%; text-align: center; }
.col-item-desc { width: 50%; }

.inventory-row input {
    padding: 8px 5px;
    font-size: 1rem;
    font-family: var(--font-body);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.inventory-row input:focus {
    border-bottom: 1px solid var(--text-accent);
}
/* --- 상단 헤더 (이름 부분) --- */
.sheet-header {
    text-align: center;
    border-bottom: 2px double var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 캐릭터 이름 입력창 */
.name-input {
    font-family: var(--font-title);
    color: var(--text-accent);
    font-size: 2.8rem;
    text-align: center;
    width: 80%;
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent; /* 평소엔 밑줄 없음 */
    transition: border-color 0.3s;
}

/* 클래스 및 종족 입력창 */
.subtitle-input {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--text-main);
    font-size: 1.1rem;
    text-align: center;
    width: 60%;
    margin-top: 10px;
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent; /* 평소엔 밑줄 없음 */
    transition: border-color 0.3s;
}

/* 입력창을 클릭(포커스)했을 때만 얇은 점선 밑줄이 보이도록 설정 */
.name-input:focus,
.subtitle-input:focus {
    outline: none;
    border-bottom: 1px dashed var(--border-color);
}
/* --- 상단 레이아웃 (초상화 + 헤더/기본정보) --- */
.top-section {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    align-items: center; /* 세로 중앙 정렬 */
}

/* 초상화 영역 */
.portrait-container {
    flex: 0 0 180px; /* 초상화 너비 고정 */
}

.portrait-box {
    width: 180px;
    height: 220px;
    border: 3px double var(--border-color);
    background-color: rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.1);
}

.portrait-box:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.portrait-placeholder {
    color: var(--border-color);
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.9rem;
    pointer-events: none; /* 클릭 이벤트가 부모(박스)로 넘어가게 함 */
}

#portrait-preview {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 이미지가 꽉 차게 비율 조정 */
}

/* 헤더 및 기본정보 묶음 */
.header-info-container {
    flex: 1; /* 남은 공간 모두 차지 */
    display: flex;
    flex-direction: column;
}

/* 기존 헤더 스타일 수정 (아래 여백과 선 조정) */
.sheet-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 2px double var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

/* 기존 기본 정보 스타일 수정 (가운데 정렬) */
.basic-info {
    display: flex;
    justify-content: space-evenly;
    gap: 20px;
}

/* --- 능력치 (Stats) 영역 수정 --- */
/* (기존 .stat-box 스타일은 유지) */

.stat-input-group {
    display: flex;
    align-items: baseline;
    justify-content: center;
    width: 100%;
}

.stat-input-group input {
    font-size: 2.2rem;
    font-weight: bold;
    text-align: right; /* 숫자와 최대치가 자연스럽게 붙도록 오른쪽 정렬 */
    width: 50px;
    padding: 0;
}

.stat-max {
    font-size: 1rem;
    color: var(--text-main);
    opacity: 0.7; /* 약간 흐리게 표시 */
    margin-left: 5px;
    font-weight: normal;
}
