/* =========================================================================
   비밀노트 뷰어 전용 프리미엄 CSS 스타일시트 (secret_notes.css)
   ========================================================================= */

:root {
    --bg-color-light: #f8fafc;
    --paper-color-light: #ffffff;
    --text-color-light: #0f172a;
    
    --bg-color-ivory: #f4efe2;
    --paper-color-ivory: #faf6eb;
    --text-color-ivory: #2d241e;
    
    --bg-color-dark: #0f172a;
    --paper-color-dark: #1e293b;
    --text-color-dark: #f8fafc;
    
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --border-color: rgba(148, 163, 184, 0.15);
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color-light);
    color: var(--text-color-light);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden; /* 모바일 가로 스크롤 절대 방어 */
}

body.skin-ivory {
    background-color: var(--bg-color-ivory);
    color: var(--text-color-ivory);
}

body.skin-dark {
    background-color: var(--bg-color-dark);
    color: var(--text-color-dark);
    --primary-color: #60a5fa; /* 다크모드에 잘 보이는 밝은 하늘색 계열 파랑 */
    --border-color: rgba(248, 250, 252, 0.1);
}

/* 💡 [강력 보완] 다크모드 선택 시 본문, 툴바, 제목, 햄버거 등 전체 어두운 글자색 강제 덮어쓰기 */
body.skin-dark,
body.skin-dark .toolbar,
body.skin-dark .toolbar *,
body.skin-dark .sidebar,
body.skin-dark .sidebar *,
body.skin-dark .reader-header,
body.skin-dark .reader-header *,
body.skin-dark .reader-body,
body.skin-dark .reader-body *,
body.skin-dark .chapter-title,
body.skin-dark .menu-toggle-btn,
body.skin-dark .menu-toggle-btn i,
body.skin-dark .menu-toggle-btn svg {
    color: #f8fafc !important;
}

body.skin-dark a {
    color: #60a5fa !important;
}

body.skin-dark .option-btn {
    color: #94a3b8 !important; /* 다크모드 비활성 메뉴 글자색 보정 */
}

body.skin-dark .option-btn.active {
    background-color: var(--primary-color) !important;
    color: #0f172a !important; /* 밝은 파랑 배경 위에 어두운 글씨로 시인성 극대화 */
}

/* 복사 방지 스타일 */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 워터마크 컨테이너 */
#watermark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.7;
}

/* 전체 레이아웃 구조 */
.wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden; /* 레이아웃 이탈 방어 */
}

/* 1. 사이드바 (챕터 목차) */
.sidebar {
    width: 320px;
    background-color: var(--paper-color-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 999;
    transition: transform 0.3s ease, background-color 0.3s;
}

body.skin-ivory .sidebar {
    background-color: var(--paper-color-ivory);
}

body.skin-dark .sidebar {
    background-color: var(--paper-color-dark);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

/* 💡 [추가] 모바일 전용 사이드바 닫기 버튼 */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 24px;
    right: 20px;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
}

.book-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 8px;
    border-radius: 9999px;
    margin-bottom: 8px;
}

.book-title-sidebar {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    line-height: 1.4;
    padding-right: 30px; /* 닫기버튼 공간 확보 */
}

.chapter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.chapter-item a {
    display: block;
    padding: 16px 24px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.chapter-item a:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

.chapter-item.active a {
    background-color: rgba(37, 99, 235, 0.1);
    border-left: 4px solid var(--primary-color);
    font-weight: 700;
}

/* 💡 [추가] 모바일 사이드바 뒷배경 딤드 레이어 */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 2. 메인 콘텐츠 컨테이너 */
.main-content {
    flex: 1;
    margin-left: 320px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 60px;
    position: relative;
    width: calc(100% - 320px);
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* 3. 상단 툴바 */
.toolbar {
    height: 64px;
    background-color: var(--paper-color-light);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
    transition: background-color 0.3s;
}

body.skin-ivory .toolbar {
    background-color: var(--paper-color-ivory);
}

body.skin-dark .toolbar {
    background-color: var(--paper-color-dark);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0; /* 말줄임 방지 */
}

.menu-toggle-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.menu-toggle-btn:hover {
    background-color: rgba(148, 163, 184, 0.15);
}

body.skin-dark .menu-toggle-btn:hover {
    background-color: rgba(248, 250, 252, 0.1);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 도서 뷰어 커스텀 옵션 세트 */
.viewer-options {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-btn-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.option-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.option-btn:hover {
    background-color: rgba(148, 163, 184, 0.1);
}

.option-btn.active {
    background-color: var(--primary-color);
    color: #ffffff !important;
}

/* 4. 뷰어 본문 레이아웃 */
.viewer-container {
    max-width: 780px;
    margin: 0 auto;
    padding: 48px 24px;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
}

.book-reader-card {
    background-color: var(--paper-color-light);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -2px rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    padding: 56px 48px;
    transition: background-color 0.3s;
    position: relative;
    word-break: break-word; /* 모바일 넘침 방지 */
}

body.skin-ivory .book-reader-card {
    background-color: var(--paper-color-ivory);
    box-shadow: none;
}

body.skin-dark .book-reader-card {
    background-color: var(--paper-color-dark);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
}

.reader-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 24px;
    margin-bottom: 32px;
}

.chapter-number {
    font-size: 13px;
    font-weight: 800;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.chapter-title {
    font-family: 'Noto Serif KR', Georgia, serif;
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.chapter-subtitle {
    font-size: 16px;
    opacity: 0.7;
    margin: 0;
}

/* 가변 폰트 크기 및 서체 대응 */
.reader-body {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.8;
    letter-spacing: -0.2px;
    word-break: break-word; /* 넘침 절대 방지 */
}

body.font-serif .reader-body {
    font-family: 'Noto Serif KR', Georgia, serif;
}

.reader-body p {
    margin-bottom: 24px;
    text-indent: 4px;
}

/* 본문 내 이미지 렌더링 */
.note-image-container {
    margin: 28px 0;
    text-align: center;
    width: 100%;
}

.note-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    cursor: zoom-in;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

body.skin-dark .note-image-wrapper {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

.note-image-wrapper:hover {
    transform: scale(1.015);
}

.note-image-el {
    display: block;
    max-width: 100%;
    max-height: 480px;
    height: auto;
    object-fit: contain;
}

/* 5. 독서 진행바 */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background-color: rgba(148, 163, 184, 0.1);
    position: sticky;
    top: 64px;
    z-index: 39;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s;
}

/* 6. AI 1:1 진단 챗봇 컴포넌트 */
.ai-chat-section {
    margin-top: 48px;
    border-top: 2px dashed var(--border-color);
    padding-top: 48px;
}

.ai-chat-card {
    background-color: var(--paper-color-light);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.02);
    transition: background-color 0.3s;
}

body.skin-ivory .ai-chat-card {
    background-color: var(--paper-color-ivory);
}

body.skin-dark .ai-chat-card {
    background-color: var(--paper-color-dark);
}

.ai-chat-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 다크모드 강제 텍스트 오염 방지 */
body.skin-dark .ai-chat-header,
body.skin-dark .ai-chat-header * {
    color: #ffffff !important;
}

.ai-title {
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-body {
    height: 320px;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: rgba(248, 250, 252, 0.3);
}

body.skin-dark .ai-chat-body {
    background-color: rgba(15, 23, 42, 0.3);
}

.chat-bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.chat-bubble.bot {
    background-color: var(--paper-color-light);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

body.skin-dark .chat-bubble.bot {
    background-color: rgba(30, 41, 59, 0.8);
}

.chat-bubble.user {
    background-color: var(--primary-color);
    color: #ffffff !important;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* 인풋 영역 */
.ai-chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    background-color: var(--paper-color-light);
    color: inherit;
    outline: none;
    transition: border-color 0.2s;
}

body.skin-dark .chat-input {
    background-color: rgba(15, 23, 42, 0.5);
}

.chat-send-btn {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 0 20px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 7. 내 서재 슬라이드 바닥 레이어 */
.library-section {
    margin-top: 48px;
    border-top: 1px solid var(--border-color);
    padding-top: 48px;
}

.library-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 24px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.book-card {
    background-color: var(--paper-color-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

body.skin-ivory .book-card {
    background-color: var(--paper-color-ivory);
}

body.skin-dark .book-card {
    background-color: var(--paper-color-dark);
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05);
}

.book-card-title {
    font-size: 15px;
    font-weight: 800;
    margin: 0 0 8px 0;
}

.book-card-desc {
    font-size: 12px;
    opacity: 0.7;
    margin: 0;
    line-height: 1.5;
}

/* 비회원용 하단 고정형 플로팅 퀵 배너 스타일 */
.guest-welcome-banner {
    display: none; /* 하단 퀵 플로팅 배너 도입에 따라 기존 배너 제거(선택적) 또는 유지. */
}

/* 💡 [신규] 하단 퀵메뉴 위에 조화롭게 정렬되는 플로팅 퀵 배너 */
.aqm-guest-floating-banner {
    position: fixed;
    bottom: 80px; /* 모바일 하단 퀵 바 위에 위치 */
    left: 50%;
    transform: translate(-50%, 20px); /* 3D/2D 좌표 변환 충돌 방지 및 슬라이드업 효과 */
    width: calc(100% - 32px);
    max-width: 480px;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px solid #FEE500;
    border-radius: 20px;
    padding: 20px 24px 20px 24px;
    box-sizing: border-box;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    text-align: left;
}

body.skin-dark .aqm-guest-floating-banner {
    background: rgba(30, 41, 59, 0.95);
    border: 1.5px solid rgba(254, 229, 0, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.aqm-guest-floating-banner.active {
    opacity: 1;
    transform: translate(-50%, 0);
}

.floating-banner-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.floating-banner-close:hover {
    background-color: rgba(148, 163, 184, 0.1);
}

.floating-banner-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #FEE500;
    color: #191919;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 50px;
    margin-bottom: 8px;
}

body.skin-dark .floating-banner-badge * {
    color: #191919 !important;
}

.floating-banner-title {
    font-size: 15px;
    font-weight: 800;
    margin: 0 0 6px 0;
    color: #0f172a;
    line-height: 1.4;
}

body.skin-dark .floating-banner-title {
    color: #f8fafc;
}

.floating-banner-desc {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 14px 0;
    line-height: 1.5;
}

body.skin-dark .floating-banner-desc {
    color: #94a3b8;
}

.floating-banner-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-kakao-signup-floating {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #FEE500;
    color: #191919;
    font-size: 13px;
    font-weight: 800;
    padding: 10px 0;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-kakao-signup-floating:hover {
    background-color: #fada0a;
}

body.skin-dark .btn-kakao-signup-floating * {
    color: #191919 !important;
}

.btn-regular-signup-floating {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(148, 163, 184, 0.1);
    color: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid rgba(148, 163, 184, 0.15);
    transition: background-color 0.2s;
}

.btn-regular-signup-floating:hover {
    background-color: rgba(148, 163, 184, 0.2);
}

/* =========================================================================
   반응형 미디어 쿼리 (Responsive Media Queries)
   ========================================================================= */

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* 모바일에서 오버레이 뒷배경 노출 */
    .sidebar-overlay.active {
        visibility: visible;
        opacity: 1;
    }

    .sidebar-close-btn {
        display: block; /* 모바일에서만 닫기 버튼 노출 */
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .menu-toggle-btn {
        display: block; /* 모바일에서 햄버거 노출 */
    }
}

@media (max-width: 768px) {
    .toolbar {
        padding: 0 8px; /* 모바일 양옆 여백 줄임 */
        height: 56px; /* 모바일에서 툴바 높이 소폭 축소 */
    }
    
    .toolbar-left {
        gap: 6px;
    }

    /* 모바일 가로폭 확보를 위해 툴바 내 책 제목 숨김 */
    .toolbar-book-title {
        display: none !important;
    }

    /* 모바일에서는 '서재 목록' 글자를 숨겨 콤팩트하게 아이콘만 표시 */
    .back-to-library-btn {
        padding: 6px 8px;
        margin-right: 4px;
    }
    .back-to-library-btn span {
        display: none !important;
    }
    
    .viewer-options {
        gap: 4px;
    }
    
    .option-btn {
        padding: 4px 6px;
        font-size: 11px;
    }

    .viewer-container {
        padding: 24px 12px;
    }

    .book-reader-card {
        padding: 32px 20px;
        border-radius: 12px;
    }

    .chapter-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .floating-banner-actions {
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }
    
    .btn-kakao-signup-floating,
    .btn-regular-signup-floating {
        width: 100%;
        box-sizing: border-box;
    }
    
    .aqm-guest-floating-banner {
        bottom: 80px; /* 모바일 좁은 화면 최적화 */
        padding: 16px;
    }
}

/* =========================================================================
   💡 [추가] 모달 내부 다크모드 글자색 보정 및 모바일 가로 스크롤 격리 규칙
   ========================================================================= */
body.skin-dark .aqm-modal-content,
body.skin-dark .aqm-modal-content * {
    color: #0f172a !important; /* 모달 내부는 항상 고정된 밝은 배경에 검은 글자 */
}
body.skin-dark .aqm-modal-content input,
body.skin-dark .aqm-modal-content select {
    background-color: #f9fafb !important;
    border-color: #e5e7eb !important;
    color: #0f172a !important;
}
/* 약관 모달 헤더 등 어두운 배경 영역 예외 */
body.skin-dark #aqm-doc-modal .bg-gray-900 * {
    color: #ffffff !important;
}
/* 모바일 화면 밖으로 삐져나가는 레이아웃 강제 교정 및 가로 스크롤 완전 격리 */
html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
}
.wrapper, .main-content, .viewer-container {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* =========================================================================
   💡 [추가] 퀵 좌우 챕터 이동 플로팅 버튼, 하단 가이드 바 및 사이드바 탈출 스타일
   ========================================================================= */

/* 1. 사이드바 하단 서재 목록 나가기 고정 영역 */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--paper-color-light);
    transition: background-color 0.3s;
}
body.skin-ivory .sidebar-footer {
    background-color: var(--paper-color-ivory);
}
body.skin-dark .sidebar-footer {
    background-color: var(--paper-color-dark);
}
.sidebar-library-exit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: rgba(148, 163, 184, 0.1);
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    padding: 12px;
    border-radius: 10px;
    transition: background-color 0.2s;
    white-space: nowrap;
}
.sidebar-library-exit-btn:hover {
    background-color: rgba(148, 163, 184, 0.2);
}
body.skin-dark .sidebar-library-exit-btn {
    background-color: rgba(248, 250, 252, 0.08) !important;
}

/* 2. 퀵 좌우 챕터 이동 fixed 버튼 */
.aqm-viewer-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
    transition: all 0.2s ease;
    text-decoration: none;
    opacity: 0.45; /* 평소 투명도 최소화로 본문 방해 차단 */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.aqm-viewer-nav-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
    background: #ffffff;
    color: var(--primary-color) !important;
}
body.skin-dark .aqm-viewer-nav-btn {
    background: rgba(30, 41, 59, 0.7);
    color: #cbd5e1;
    border-color: rgba(248, 250, 252, 0.1);
}
body.skin-dark .aqm-viewer-nav-btn:hover {
    background: #1e293b;
    color: var(--primary-color) !important;
}
.aqm-viewer-nav-btn.prev {
    left: 16px;
}
.aqm-viewer-nav-btn.next {
    right: 16px;
}
@media (max-width: 768px) {
    .aqm-viewer-nav-btn {
        width: 38px;
        height: 38px;
        opacity: 0.4;
    }
    .aqm-viewer-nav-btn.prev {
        left: 4px;
    }
    .aqm-viewer-nav-btn.next {
        right: 4px;
    }
}

/* 3. 본문 카드 최하단 챕터 네비게이션 가이드 바 */
.aqm-reader-footer-nav {
    display: flex;
    gap: 16px;
    margin-top: 48px;
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
}
.nav-prev-link-wrap, .nav-next-link-wrap {
    flex: 1;
    min-width: 0;
}
.footer-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    background-color: var(--paper-color-light);
}
body.skin-ivory .footer-nav-link {
    background-color: var(--paper-color-ivory);
}
body.skin-dark .footer-nav-link {
    background-color: var(--paper-color-dark);
}
.footer-nav-link:hover:not(.disabled) {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}
body.skin-dark .footer-nav-link:hover:not(.disabled) {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.footer-nav-link.disabled {
    opacity: 0.5;
    cursor: default;
    justify-content: center;
    background-color: transparent !important;
    border-style: dashed;
}
.footer-nav-link.next {
    justify-content: space-between;
    text-align: right;
}
.nav-text-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.nav-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.footer-nav-link.disabled .nav-label {
    color: inherit;
}
.nav-title {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 480px) {
    .aqm-reader-footer-nav {
        flex-direction: column;
        gap: 12px;
    }
}

/* 4. 모바일 툴바 서재 이동 제거 오작동 방지 */
@media (max-width: 768px) {
    .back-to-library-btn {
        display: none !important; /* 모바일에서는 오타 이탈 방지를 위해 상단 툴바에서 아예 제거 */
    }
}

/* 💡 [신규] 서재 목록 이동 버튼 스타일 */
.back-to-library-btn {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    background: rgba(148, 163, 184, 0.1);
    padding: 6px 12px;
    border-radius: 8px;
    margin-right: 8px;
    transition: background-color 0.2s;
    white-space: nowrap;
}
.back-to-library-btn:hover {
    background-color: rgba(148, 163, 184, 0.2);
}
body.skin-dark .back-to-library-btn {
    background: rgba(248, 250, 252, 0.1) !important;
}

/* 💡 [신규] 툴바 책 제목 스타일 */
.toolbar-book-title {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* PC 화면(993px 이상)에서 사이드바를 접었을 때의 스타일 정의 */
@media (min-width: 993px) {
    .sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }
    .sidebar-collapsed .main-content {
        margin-left: 0;
        width: 100%;
    }
}
