@charset "utf-8";
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

/* =========================================================
   [Moonlit Fairy Theme - Integrated]
   Based on Scenario Board Style
   ========================================================= */

:root {
    --bg-dark: #0f1623;
    --bg-card: rgba(13, 17, 23, 0.95);
    --line: rgba(255, 255, 255, 0.15); /* 중요: 변수명 통일 */
    --accent: #64ffda;      /* 민트 */
    --accent-gold: #ffecb3; /* 골드 */
    --text-muted: #94a3b8;
    --text-primary: #e2e8f0;
}

#bookWrap {
    width: 100%;
    max-width: 1280px; /* 룰북 게시판 폭 제한 유지 */
    margin: 0 auto;
    font-family: "Pretendard Variable", "Pretendard", sans-serif;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
   text-decoration: none;
}

/* 1. 통합 래퍼 (탭 디자인 호환용) */
.unified-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 10px 40px -5px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    overflow: hidden; 
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 2. 게시판 헤더 */
.sc-header {
    background: rgba(20, 30, 40, 0.6);
    border-top: 1px solid var(--line); /* 중요: 탭과 이어지는 라인 */
    border-bottom: 1px solid var(--line);
    padding: 15px 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.sc-header h2 {
    margin: 0; font-size: 16px; font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: 8px;
}

/* 3. 버튼 스타일 (시나리오 게시판 스타일) */
.btn_write, .btn_action {
    background: rgba(100, 255, 218, 0.1); color: var(--accent) !important;
    border: 1px solid var(--accent); padding: 6px 14px; border-radius: 6px;
    font-weight: 600; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
}
.btn_write:hover, .btn_action:hover { background: var(--accent); color: #000 !important; }

/* 관리자용/취소 버튼 */
.btn_admin, .btn_cancel {
    background: transparent; border: 1px solid rgba(255,255,255,0.2); 
    color: var(--text-muted) !important; padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn_admin:hover, .btn_cancel:hover { border-color: #fff; color: #fff !important; }

/* 4. 테이블 스크롤 영역 */
.table-wrapper {
    width: 100%;
    max-height: 650px;
    overflow-y: auto;
    background: rgba(0,0,0,0.2);
    border-top: none; /* 헤더와 중복 라인 제거 */
}
/* 스크롤바 디자인 */
.table-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.table-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* 5. 테이블 공통 스타일 */
.sc-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 800px; }

.sc-table thead th {
    position: sticky; top: 0; z-index: 10;
    background: #0d1117; 
    color: var(--text-muted); font-weight: 600; padding: 12px;
    border-bottom: 1px solid var(--line); text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.sc-table td {
    padding: 12px; 
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: middle; color: #e2e8f0;
}

/* --- [Rulebook Specific Styles] --- */
/* 룰북 계층 구조 및 순서 편집 */

/* 메인 룰북 행 */
.rb-parent { background: transparent; transition: background 0.2s; }
.rb-parent:hover { background: rgba(100, 255, 218, 0.02); }
.rb-parent.is-primary td.rb-subject-cell { color: var(--accent-gold); font-weight: 700; }
.rb-parent.is-primary { background: linear-gradient(90deg, rgba(255, 236, 179, 0.05), transparent); }

/* 서플리먼트(자식) 행 */
.rb-child { background: rgba(0, 0, 0, 0.3); display: none; } /* 기본 숨김 */
.rb-child:hover { background: rgba(0, 0, 0, 0.2); }
.rb-child td { color: var(--text-muted) !important; font-size: 0.95em; }

/* 제목 셀 및 트리 아이콘 */
.rb-subject-cell { text-align: left !important; padding-left: 15px !important; position: relative; }
.rb-subject-link { display: flex; align-items: center; }
.rb-child .rb-subject-link { padding-left: 20px; }
.rb-child .rb-subject-link::before { 
    content: '└'; margin-right: 8px; color: var(--text-muted); opacity: 0.5; 
}

/* 토글 버튼 */
.rb-toggle {
    background: transparent; border: 1px solid rgba(255,255,255,0.2); color: var(--text-muted);
    width: 20px; height: 20px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; cursor: pointer; margin-right: 8px; transition: 0.2s;
}
.rb-toggle:hover { border-color: var(--accent); color: var(--accent); }
.rb-toggle[aria-expanded="true"] { transform: rotate(90deg); border-color: var(--accent); color: var(--accent); }

/* 배지 스타일 (시나리오 게시판과 통일) */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-right: 2px; }
.badge-type { border: 1px solid var(--line); color: var(--text-muted); }
.badge-primary { border: 1px solid var(--accent-gold); color: var(--accent-gold); background: rgba(255, 236, 179, 0.05); }
.badge-rule {  border: 1px solid var(--line); color: var(--text-muted);  }
.badge-supp {  border: 1px solid var(--line); color: var(--text-muted); }

/* 숙지도 배지 */
.lv-skilled { border: 1px solid var(--accent); color: var(--accent); background: rgba(100, 255, 218, 0.05); }
.lv-unskilled { border: 1px solid var(--text-muted); color: var(--text-muted); background: rgba(255,255,255,0.05); }
.lv-wish { border: 1px solid #f472b6; color: #f472b6; background: rgba(244, 114, 182, 0.05); }

/* 입력 폼 스타일 (쓰기 페이지용 - 시나리오 게시판 스타일 적용) */
.sc-write-table { width: 100%; border-collapse: collapse; }
.sc-write-table th { width: 130px; text-align: left; color: var(--accent); padding: 15px 5px; font-weight: 600; }
.sc-write-table td { padding: 10px 5px; border-bottom: 1px solid rgba(255,255,255,0.05); }

.sc-input, .sc-select, .form-control {
    background: #090c10; border: 1px solid var(--line); color: #fff;
    padding: 10px; border-radius: 6px; width: 100%; outline: none; box-sizing: border-box;
}
.sc-input:focus, .sc-select:focus { border-color: var(--accent); }

/* 모바일 카드 뷰 (룰북 전용) */
.mobile-view-area { display: none; padding: 15px; }
.pc-view-area { display: block; }
@media (max-width: 768px) {
    .pc-view-area { display: none !important; }
    .mobile-view-area { display: block; }
    .sc-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    
    .mo-card { background: rgba(20,30,40,0.5); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
    .mo-head { padding: 12px; background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
    .mo-body { padding: 12px; }
    .mo-supp-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); color: var(--text-muted); font-size: 13px; }
    .mo-supp-list li:last-child { border-bottom: none; }
}

/* 모달 (팝업) 스타일 */
/* 모달 (팝업) 스타일 */
@keyframes modalPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ts-modal {    
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center; align-items: center;
}

.ts-modal.active { display: flex; }

.ts-card {    
    background: var(--bg-card); /* 전체 배경색 사용 */
    border: 1px solid var(--accent); /* 민트색 테두리 */
    box-shadow: 0 0 30px rgba(100, 255, 218, 0.15); /* 민트색 발광 */
    width: 90%; max-width: 500px;
    border-radius: 12px;
    position: relative;
    display: flex; flex-direction: column;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ts-card .head { 
    padding: 15px 20px; 
    border-bottom: 1px solid var(--line); 
    background: transparent; /* [수정] 배경색 투명화 */
    display: flex; justify-content: space-between; align-items: center;
    color: var(--accent); font-weight: 700; font-size: 16px;
}

.ts-card .body { padding: 20px; overflow-y: auto; max-height: 80vh; }

.ts-card .foot { 
    border-top: 1px solid var(--line); 
    background: transparent; 
    display: flex; justify-content: space-between; 
    align-items: center;
    gap: 8px; 
}

/* [추가] 모달 전용 버튼 (시나리오 스타일) */
.btn-del { 
    background: transparent; border: 1px solid #f472b6; color: #f472b6; 
    padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 13px;
    transition: 0.2s;
}
.btn-del:hover { background: #f472b6; color: #000; }

.btn-save { 
    background: var(--accent); border: 1px solid var(--accent); color: #000; 
    padding: 8px 20px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 13px;
    transition: 0.2s;
}
.btn-save:hover { background: #fff; border-color: #fff; }

/* 순서 편집용 */
.col-order { display: none; width: 60px; text-align: center; color: var(--text-muted); cursor: grab; }
.edit-mode .col-order { display: table-cell !important; }