/* style.css 파일의 전체 내용을 아래 코드로 교체하세요. */

/* ▼▼▼ RisuAI 테마 색상 변수 ▼▼▼ */
:root {
    --risu-dark-background: #36393f;
    --risu-card-background: #2f3136;
    --risu-input-background: #202225;
    --risu-text-primary: #ffffff;
    --risu-text-secondary: #b9bbbe;
    --risu-text-muted: #72767d;
    --risu-border-color: #40444b;
    --risu-interactive-hover: #3a3d42;
    --risu-accent-color: #5865F2; /* Risu/Discord 스타일의 강조색 */
    --risu-success-color: #43b581;
    --risu-error-color: #f04747;
}


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    display: flex; 
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: var(--risu-dark-background); /* 변경: 배경색 */
    color: var(--risu-text-secondary); /* 변경: 기본 글자색 */
}
.container { width: 90%; max-width: 1200px; }

.card {
    background-color: var(--risu-card-background); /* 변경: 카드 배경색 */
    padding: 20px; border-radius: 8px;
    box-shadow: none; /* 변경: 그림자 제거 */
    border: 1px solid var(--risu-border-color); /* 추가: 은은한 테두리 */
    display: flex; flex-direction: column;
}
.tabs { 
    margin-bottom: 20px; 
    border-bottom: 2px solid var(--risu-border-color); /* 변경: 테두리색 */
}
.tab-btn {
    background: transparent; border: none; padding: 10px 20px;
    cursor: pointer; font-size: 16px; 
    color: var(--risu-text-muted); /* 변경: 글자색 */
    border-bottom: 3px solid transparent; border-radius: 0; margin-right: 0;
    transition: color 0.2s, border-bottom-color 0.2s; /* 추가: 부드러운 전환 효과 */
}
.tab-btn:hover { 
    background-color: transparent; /* 변경: 호버 시 배경색 없음 */
    color: var(--risu-text-primary); /* 변경: 호버 시 글자색 */
}
.tab-btn.active-tab { 
    color: var(--risu-text-primary); /* 변경: 활성 탭 글자색 */
    border-bottom: 3px solid var(--risu-accent-color); /* 변경: 활성 탭 강조색 */
    font-weight: bold; 
}
.tab-pane { display: none; }
.tab-pane.active-pane { display: block; }

#editor-ai-tab { display: none; flex-direction: column; gap: 20px; }
#editor-ai-tab.active-pane { display: flex; }

.preview-card { min-height: 200px; }
.panels-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

h2 { 
    margin-top: 0; 
    border-bottom: 2px solid var(--risu-border-color); /* 변경: 테두리색 */
    padding-bottom: 10px; 
    color: var(--risu-text-primary); /* 변경: 제목 글자색 */
}

/* Textarea 전용 스타일 */
textarea {
    width: 100%; box-sizing: border-box; padding: 10px; 
    border: 1px solid var(--risu-input-background);
    border-radius: 4px; 
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px; 
    resize: vertical; 
    min-height: 120px; /* textarea에만 높이 지정 */
    background-color: var(--risu-input-background);
    color: var(--risu-text-primary);
}

/* Select 박스 전용 스타일 */
.settings-select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--risu-input-background);
    border-radius: 4px;
    font-size: 14px;
    background-color: var(--risu-input-background);
    color: var(--risu-text-primary);
    -webkit-appearance: none; /* 브라우저 기본 스타일 제거 */
    -moz-appearance: none;
    appearance: none;
    /* 커스텀 드롭다운 화살표 추가 (어두운 테마용) */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23b9bbbe' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.8em top 50%;
    background-size: 0.7em;
	color-scheme: dark;
}

/* Select 박스 내부 옵션 스타일 */
.settings-select option {
    background-color: var(--risu-card-background); /* 옵션 배경색 지정 */
    color: var(--risu-text-primary);           /* 옵션 글자색 지정 */
    padding: 10px; /* 가독성을 위한 패딩 추가 (일부 브라우저 미적용 가능) */
}

#api-key-input {
    width: 100%; box-sizing: border-box; padding: 8px;
    border: 1px solid var(--risu-input-background);
    border-radius: 4px;
    background-color: var(--risu-input-background);
    color: var(--risu-text-primary);
}

textarea::placeholder, input::placeholder {
    color: var(--risu-text-muted); /* 추가: 플레이스홀더 글자색 */
}

label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold; 
    color: var(--risu-text-secondary); /* 변경: 라벨 글자색 */
}
.input-group { margin-bottom: 15px; }

button {
    padding: 10px 15px; border: none; 
    background-color: var(--risu-accent-color); /* 변경: 버튼색 */
    color: white; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 16px;
    font-weight: bold; /* 추가: 글자 두께 */
    transition: background-color 0.3s; 
    margin-right: 10px; 
    margin-bottom: 5px;
}
button:hover { 
    background-color: #4752c4; /* 변경: 호버 시 버튼색 */
}
button.secondary { 
    background-color: var(--risu-error-color); /* 변경: 보조 버튼색 */
}
button.secondary:hover { 
    background-color: #d83c3e; /* 변경: 호버 시 보조 버튼색 */
}

#preview-output, #ai-log {
    border: 1px dashed var(--risu-border-color); /* 변경: 테두리색 */
    padding: 15px; 
    background-color: var(--risu-input-background); /* 변경: 배경색 */
    flex-grow: 1; 
    min-height: 150px;
    color: var(--risu-text-secondary); /* 추가: 내부 글자색 */
}

.note { font-size: 12px; color: var(--risu-text-muted); margin-top: 5px; } /* 변경: 글자색 */
hr { width: 100%; border: none; border-top: 1px solid var(--risu-border-color); margin: 20px 0; } /* 변경: 구분선색 */

#image-preview {
    border: 1px dashed var(--risu-border-color); /* 변경: 테두리색 */
    padding: 10px; margin-top: 10px;
    min-height: 50px; display: flex; justify-content: center;
    align-items: center; border-radius: 4px;
    background-color: var(--risu-input-background); /* 변경: 배경색 */
}
#image-preview img { max-width: 100%; max-height: 150px; border-radius: 4px; }

/* ▼▼▼ 예시 이미지 업로드 UI 스타일 ▼▼▼ */
.asset-upload-area {
    margin-top: 15px; padding-top: 15px;
    border-top: 1px solid var(--risu-border-color); /* 변경: 테두리색 */
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap; 
}
.upload-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--risu-text-secondary); /* 변경: 글자색 */
}
.upload-item { display: flex; align-items: center; gap: 5px; }
.asset-upload-label {
    background-color: var(--risu-border-color); /* 변경: 배경색 */
    color: var(--risu-text-primary); /* 변경: 글자색 */
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}
.asset-upload-label:hover { background-color: var(--risu-interactive-hover); }
.asset-upload-input { display: none; }
.upload-status {
    font-size: 12px;
    color: var(--risu-success-color); /* 변경: 성공 아이콘색 */
}
.preview-btn {
    margin-top: 15px;
    width: 100%;
}

/* ▼▼▼ 정규식 디버그 UI 스타일 ▼▼▼ */
.label-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
.label-with-button label {
    margin-bottom: 0;
}
.debug-btn {
    padding: 4px 8px;
    font-size: 12px;
    background-color: var(--risu-success-color); /* 변경: 디버그 버튼색 */
    margin: 0;
}
.debug-btn:hover {
    background-color: #3aa171; /* 변경: 호버 시 디버그 버튼색 */
}
#regex-debug-output {
    margin-top: 10px; padding: 10px;
    background-color: #2d3436; /* 어두운 배경 유지 */
    color: #dfe6e9;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px; max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--risu-border-color); /* 변경: 테두리색 */
}
#regex-debug-output .match-block {
	min-height: 1.6em; 
    line-height: 1.6;
    margin-bottom: 2px;
    padding: 8px;
    border-bottom: 1px solid var(--risu-border-color); /* 변경: 구분선색 */
}
#regex-debug-output .match-block:last-child {
    border-bottom: none;
}
#regex-debug-output .full-match {
    background-color: #f1c40f; 
    color: #333;
    padding: 2px 4px;
    border-radius: 3px;
}
#regex-debug-output .capture-group {
	display: inline-block; 
    background-color: #3498db; 
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
}
#regex-debug-output .error {
    color: var(--risu-error-color); /* 변경: 에러 글자색 */
}
#regex-debug-output .no-match {
    color: var(--risu-text-muted); /* 변경: 글자색 */
}

/* ▼▼▼ 헤더 및 버전 정보 스타일 ▼▼▼ */
.header-container {
    width: 90%;
    max-width: 1200px;
    position: relative;
    height: 30px; 
}
#version-link {
    position: absolute; top: 0; right: 0;
    font-size: 14px;
    color: var(--risu-text-secondary); /* 변경: 글자색 */
    text-decoration: none; padding: 5px 10px;
    background-color: var(--risu-card-background); /* 변경: 배경색 */
    border-radius: 5px;
    transition: background-color 0.2s;
}
#version-link:hover {
    background-color: var(--risu-interactive-hover);
}

/* ▼▼▼ 푸터 스타일 ▼▼▼ */
.footer {
    width: 100%;
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    font-size: 14px;
    color: var(--risu-text-muted); /* 변경: 글자색 */
}
.footer a {
    color: var(--risu-accent-color); /* 변경: 링크색 */
    text-decoration: none;
}
.footer a:hover {
    text-decoration: underline;
}

/* ▼▼▼ 모달 창 스타일 ▼▼▼ */
.modal {
    display: none; 
    position: fixed; z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7); /* 변경: 배경 어둡게 */
}
.modal-content {
    background-color: var(--risu-card-background); /* 변경: 모달 배경색 */
    margin: 10% auto; padding: 20px;
    border: 1px solid var(--risu-border-color); /* 변경: 테두리색 */
    width: 80%; max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}
.modal-close-btn {
    color: var(--risu-text-muted); /* 변경: 닫기 버튼색 */
    position: absolute; top: 10px; right: 20px;
    font-size: 28px; font-weight: bold;
    cursor: pointer;
}
.modal-close-btn:hover,
.modal-close-btn:focus {
    color: var(--risu-text-primary); /* 변경: 호버 시 닫기 버튼색 */
}
#changelog-content {
    margin-top: 15px;
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.6;
}
#changelog-content h3 { margin-top: 20px; border-bottom: 1px solid var(--risu-border-color); padding-bottom: 5px; }
#changelog-content code { background-color: var(--risu-input-background); padding: 2px 4px; border-radius: 3px; font-family: monospace; }
#changelog-content ul { padding-left: 20px; }

/* ▼▼▼ 헤더 로고 스타일 추가 ▼▼▼ */
.main-logo {
    font-family: 'Orbit', sans-serif;
    position: absolute; top: -5px; left: 0;
    font-size: 24px;
    color: var(--risu-text-primary); /* 변경: 로고색 */
    margin: 0;
    font-weight: 400; 
}

/* ▼▼▼ 캐릭터 시트 UI 스타일 추가 ▼▼▼ */
#character-sheet-tab {
    display: none; 
    flex-direction: column;
    gap: 20px;
}
#character-sheet-tab.active-pane {
    display: flex;
}

#character-sheet-preview, #lore-generator-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    min-height: 300px;
}

.korean-output, .english-output {
    border: 1px dashed var(--risu-border-color); /* 변경: 테두리색 */
    padding: 15px;
    background-color: var(--risu-input-background); /* 변경: 배경색 */
    display: flex;
    flex-direction: column;
}

.korean-output h3, .english-output h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--risu-border-color); /* 변경: 테두리색 */
}

.output-content {
    flex-grow: 1; 
    white-space: pre-wrap; 
    word-break: break-all; 
    font-family: 'Malgun Gothic', sans-serif;
    line-height: 1.7;
}

.checkbox-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
}

.checkbox-group .note {
    width: 100%;
    margin-left: 26px;
    margin-top: 2px;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.ai-log-small {
    font-size: 13px;
    color: var(--risu-text-muted);
    margin-top: 15px;
    min-height: 20px;
    padding-left: 5px;
}

/* ▼▼▼ 서브 탭 UI 스타일 ▼▼▼ */
.sub-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--risu-border-color);
}
.sub-tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 15px;
    color: var(--risu-text-muted);
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-bottom-color 0.2s;
}
.sub-tab-btn:hover {
    color: var(--risu-text-primary);
}
.sub-tab-btn.active-sub-tab {
    color: var(--risu-text-primary);
    border-bottom-color: var(--risu-accent-color);
}
.sub-tab-pane {
    display: none;
}
.sub-tab-pane.active-sub-pane {
    display: block;
}

/* ▼▼▼ 프롬프트 에디터 textarea 스타일 ▼▼▼ */
.prompt-editor {
    min-height: 250px; /* 더 넓은 편집 공간 */
    font-size: 13px;
    line-height: 1.6;
}