/* -------------------------------------------------------------------------- */
/* CSS Variables & Global Reset                                               */
/* -------------------------------------------------------------------------- */
:root {
    --color-bg: #fbfbfb;
    --color-surface: #ffffff;
    --color-text-main: #2b2b2b;
    --color-text-muted: #868686;
    --color-text-light: #c2c2c2;
    --color-border: #f0f0f0;
    --color-primary: #1c1c1c;
    --color-primary-hover: #000000;
    --color-primary-text: #ffffff;
    --color-accent: #f7f5f2; /* 차분하고 은은한 베이지 톤 */
    
    --color-header-bg: rgba(251, 251, 251, 0.85);
    --color-toolbar-bg: rgba(255, 255, 255, 0.95);
    --color-overlay-bg: rgba(251, 251, 251, 0.85);
    
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.08);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 24px;
    
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
    --color-bg: #121212;
    --color-surface: #1e1e1e;
    --color-text-main: #e0e0e0;
    --color-text-muted: #a0a0a0;
    --color-text-light: #666666;
    --color-border: #333333;
    --color-primary: #ffffff;
    --color-primary-hover: #e0e0e0;
    --color-primary-text: #1c1c1c;
    --color-accent: #2c2c2c;
    
    --color-header-bg: rgba(18, 18, 18, 0.85);
    --color-toolbar-bg: rgba(30, 30, 30, 0.95);
    --color-overlay-bg: rgba(18, 18, 18, 0.85);
}

[data-theme="dark"] .rank-1 {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(253, 230, 138, 0.2);
}
[data-theme="dark"] .rank-2 {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.15) 0%, rgba(156, 163, 175, 0.05) 100%);
    border-color: rgba(229, 231, 235, 0.2);
}
[data-theme="dark"] .rank-3 {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.15) 0%, rgba(217, 119, 6, 0.05) 100%);
    border-color: rgba(254, 215, 170, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-main);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    line-height: 1.7;
    letter-spacing: -0.02em; /* 미세한 자간 조절로 가독성 향상 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -------------------------------------------------------------------------- */
/* Typography                                                                 */
/* -------------------------------------------------------------------------- */
.font-sans {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

.font-serif {
    font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    line-height: 1.4;
    color: var(--color-primary);
    letter-spacing: -0.03em;
}

/* -------------------------------------------------------------------------- */
/* Utilities & Animations                                                     */
/* -------------------------------------------------------------------------- */
.hidden {
    display: none !important;
}

.mobile-only {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(12px); }
}

.view-section {
    animation: fadeIn var(--transition-smooth);
}

/* -------------------------------------------------------------------------- */
/* Buttons & Inputs                                                           */
/* -------------------------------------------------------------------------- */
button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-primary-text);
    padding: 0.7rem 1.6rem;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-outline {
    background-color: var(--color-surface);
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    padding: 0.7rem 1.6rem;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.btn-outline:hover {
    border-color: #d0d0d0;
    background-color: var(--color-bg);
}

.btn-text {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.btn-text:hover {
    color: var(--color-primary);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    padding: 0.5rem;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    color: var(--color-primary);
    background-color: var(--color-accent);
}

.admin-hidden-menu {
    display: none !important;
}

.full-width {
    width: 100%;
}

.form-group {
    margin-bottom: 2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.input-text, .input-textarea {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    background-color: var(--color-bg);
    color: var(--color-text-main);
    transition: all var(--transition-fast);
    line-height: 1.6;
}

.input-text::placeholder, .input-textarea::placeholder {
    color: var(--color-text-muted);
}

.input-text:focus, .input-textarea:focus {
    outline: none;
    border-color: var(--color-text-muted);
    background-color: var(--color-surface);
    box-shadow: 0 0 0 4px rgba(0,0,0,0.05);
}

/* -------------------------------------------------------------------------- */
/* Global Header                                                              */
/* -------------------------------------------------------------------------- */
#ranking-period-filters::-webkit-scrollbar,
#ranking-category-filters::-webkit-scrollbar {
    display: none;
}

.app-header {
    background-color: var(--color-header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    width: 100%;
    margin: 0 auto;
    padding: 1.2rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    letter-spacing: 0;
    color: var(--color-primary);
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

#admin-nav-links {
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

#admin-nav-links::-webkit-scrollbar {
    display: none;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-border);
    background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* -------------------------------------------------------------------------- */
/* Profile Dropdown                                                           */
/* -------------------------------------------------------------------------- */
.profile-dropdown-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.8rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 220px;
    z-index: 200;
    overflow: hidden;
    animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-header {
    padding: 1.2rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-accent);
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.9rem 1.2rem;
    font-size: 0.95rem;
    color: var(--color-text-main);
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    font-weight: 500;
}

.dropdown-item:hover {
    background-color: var(--color-bg);
    color: var(--color-primary);
}

/* -------------------------------------------------------------------------- */
/* Toggle Switch                                                              */
/* -------------------------------------------------------------------------- */
.toggle-switch input:checked + .toggle-slider {
    background-color: var(--color-primary);
}
.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--color-primary);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--color-primary-text);
    transition: .4s;
    border-radius: 50%;
}

/* -------------------------------------------------------------------------- */
/* Main Layout & Home View                                                    */
/* -------------------------------------------------------------------------- */
#app-root {
    min-height: calc(100vh - 75px);
}

.home-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 5rem 2.5rem;
}

.home-header {
    text-align: center;
    margin-bottom: 5rem;
}

.section-title {
    font-size: 2.4rem;
    margin-bottom: 0.8rem;
    color: var(--color-primary);
}

.section-subtitle {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    font-weight: 300;
}

/* -------------------------------------------------------------------------- */
/* Ranking Styles                                                             */
/* -------------------------------------------------------------------------- */
.ranking-item {
    display: flex;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    gap: 1.5rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.ranking-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: #d0d0d0;
}

.ranking-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-muted);
    min-width: 40px;
    text-align: center;
}

.rank-1 {
    background: linear-gradient(135deg, #fffbee 0%, #fff7e6 100%);
    border-color: #fde68a;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
}
.rank-1 .ranking-number {
    color: #f59e0b;
    font-size: 2rem;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.1);
}
.rank-1::before {
    content: "👑";
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-20px) rotate(-15deg);
    font-size: 1.5rem;
}

.rank-2 {
    background: linear-gradient(135deg, #f8fafc 0%, #f3f4f6 100%);
    border-color: #e5e7eb;
    box-shadow: 0 4px 15px rgba(156, 163, 175, 0.15);
}
.rank-2 .ranking-number {
    color: #9ca3af;
    font-size: 1.8rem;
}

.rank-3 {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-color: #fed7aa;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.1);
}
.rank-3 .ranking-number {
    color: #d97706;
    font-size: 1.6rem;
}

.ranking-cover {
    width: 60px;
    height: 80px;
    background: var(--color-accent);
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.ranking-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ranking-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.ranking-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.ranking-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-main);
}

/* -------------------------------------------------------------------------- */
/* Book Grid & Cards                                                          */
/* -------------------------------------------------------------------------- */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
}

.book-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-smooth);
    display: flex;
    flex-direction: column;
    min-height: 360px;
    box-shadow: var(--shadow-sm);
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: #e5e5e5;
}

.book-card-cover {
    height: 160px;
    background-color: var(--color-accent);
    /* 부드러운 그라데이션 커버 */
    background-image: linear-gradient(to top, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%);
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.book-card:hover .book-card-cover {
    opacity: 1;
}

.book-card-content {
    padding: 2.2rem 1.8rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.book-card-content h3 {
    font-size: 1.35rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.book-summary {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-status {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--color-text-light);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.create-card {
    background-color: transparent;
    border: 1px dashed #dcdcdc;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 3rem 2rem;
    box-shadow: none;
}

.create-card:hover {
    border-color: var(--color-text-muted);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.create-icon {
    font-size: 2.5rem;
    color: var(--color-text-light);
    margin-bottom: 1.2rem;
    font-weight: 200;
    transition: color var(--transition-fast);
}

.create-card:hover .create-icon {
    color: var(--color-primary);
}

.create-card h3 {
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

.create-card p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* -------------------------------------------------------------------------- */
/* Editor View Layout                                                         */
/* -------------------------------------------------------------------------- */
.editor-layout {
    display: flex;
    height: calc(100vh - 75px);
}

.editor-sidebar {
    width: 280px;
    background-color: var(--color-bg);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 2rem;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sidebar-title {
    font-size: 1.2rem;
    margin-bottom: 0;
    color: var(--color-primary);
    line-height: 1.4;
    transition: color var(--transition-fast);
}

.sidebar-title:hover {
    color: #666;
}

.mobile-sidebar-close, .mobile-sidebar-toggle {
    display: none;
}

.mobile-sidebar-overlay {
    display: none;
}

.sidebar-divider {
    height: 1px;
    background-color: var(--color-border);
    margin-bottom: 2rem;
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.toc-item {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.chapter-title-span {
    flex: 1;
    word-break: keep-all;
    white-space: normal;
    line-height: 1.4;
}

.btn-delete-chapter {
    color: var(--color-text-light);
    font-size: 1.2rem;
    line-height: 1;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    opacity: 0;
    transition: all var(--transition-fast);
}

.btn-delete-chapter:hover {
    background-color: rgba(255, 0, 0, 0.1);
    color: #ff4d4d;
}

.toc-item:hover .btn-delete-chapter {
    opacity: 1;
}

@media (max-width: 768px) {
    .btn-delete-chapter {
        opacity: 1;
    }
}

.toc-item:hover {
    background-color: var(--color-surface);
    color: var(--color-text-main);
    box-shadow: var(--shadow-sm);
}

.toc-item.active {
    background-color: var(--color-accent);
    color: var(--color-primary);
    font-weight: 600;
}

.highlight-ai-modified {
    background-color: rgba(99, 102, 241, 0.08) !important;
    color: #4f46e5 !important;
    border-left: 3px solid #6366f1;
    font-weight: 500;
}

.highlight-ai-modified.active {
    background-color: rgba(99, 102, 241, 0.15) !important;
    font-weight: 600;
}

.toc-item.drag-over {
    border-top: 2px solid var(--color-primary);
}

.toc-item.dragging {
    opacity: 0.5;
    background-color: var(--color-border);
}

.new-chapter {
    margin-top: 1.5rem;
    color: var(--color-text-light);
    border: 1px dashed var(--color-border);
    text-align: center;
    background-color: transparent;
}

.new-chapter:hover {
    border-color: #c0c0c0;
    color: var(--color-text-main);
}

/* -------------------------------------------------------------------------- */
/* Main Editor Area                                                           */
/* -------------------------------------------------------------------------- */
.editor-bottom-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 0.6rem;
    z-index: 50;
}

.btn-editor-nav {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    color: var(--color-primary);
    transition: all var(--transition-fast);
}

.btn-editor-nav:hover {
    background: var(--color-surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.btn-editor-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .editor-bottom-nav {
        bottom: 1.5rem;
        right: 1.2rem;
    }
    .btn-editor-nav {
        width: 48px;
        height: 48px;
    }
}

.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--color-surface);
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 4rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-toolbar-bg);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.toolbar-left {
    display: flex;
    align-items: center;
}

.current-section-label {
    font-size: 1.35rem;
    color: var(--color-primary);
    font-weight: 400;
}

.complexity-badge {
    background-color: var(--color-accent);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    color: var(--color-text-muted) !important;
    font-size: 0.75rem !important;
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    gap: 0.8rem;
}

.toolbar-right .btn-primary, 
.toolbar-right .btn-outline {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.editor-content-area {
    max-width: 760px; /* 글쓰기에 가장 편안한 너비 */
    width: 100%;
    margin: 0 auto;
    padding: 5rem 2rem 8rem 2rem;
    flex: 1;
}

/* -------------------------------------------------------------------------- */
/* Content Blocks & Editable Elements                                         */
/* -------------------------------------------------------------------------- */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 0 !important; /* editable-text의 min-height 충돌 방지 */
    max-height: calc(1.15rem * 1.85 * 3) !important; /* 3줄 높이를 초과하여 글자가 반토막 나는 현상 차단 */
}

.btn-read-more {
    display: block;
    margin: 0.8rem auto 0 auto;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 0.3rem 1rem;
    transition: all var(--transition-fast);
}

.btn-read-more:hover {
    background: var(--color-bg);
    color: var(--color-primary);
    border-color: #d0d0d0;
}

.content-block-container {
    margin-bottom: 4rem;
    position: relative;
}

.content-block-container:last-child {
    margin-bottom: 1rem; /* 마지막 요소의 과도한 하단 여백 제거 */
}

.block-label {
    font-size: 0.85rem;
    color: var(--color-text-light);
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.content-block {
    position: relative;
}

/* 읽기 편안한 에디터 타이포그래피 */
.editable-text {
    font-size: 1.15rem; /* 글씨를 큼직하게 */
    line-height: 1.85; /* 넉넉한 행간 */
    color: var(--color-text-main);
    outline: none;
    min-height: 150px;
    padding: 0;
    white-space: pre-wrap;
    word-break: break-all;
    text-align: justify;
    transition: color var(--transition-fast);
}

.editable-text:focus {
    color: var(--color-primary);
}

.editable-text[contenteditable="true"]:empty:before {
    content: "여기에 글을 작성하세요...";
    color: var(--color-text-light);
    pointer-events: none;
    display: block; 
}

/* Floating AI Button (글쓰기 방해 금지, 호버시 등장) */
.btn-floating-edit {
    position: absolute;
    bottom: -45px;
    right: 0;
    background-color: var(--color-surface);
    backdrop-filter: blur(4px);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    opacity: 0; /* 평소엔 숨김 */
    transform: translateY(10px);
    transition: all var(--transition-smooth);
    z-index: 5;
}

.content-block:hover .btn-floating-edit,
.editable-text:focus ~ .btn-floating-edit {
    opacity: 0.6;
    transform: translateY(0);
}

.btn-floating-edit:hover {
    opacity: 1 !important;
    color: var(--color-primary);
    border-color: #d0d0d0;
    box-shadow: var(--shadow-md);
    background-color: var(--color-surface);
}

/* -------------------------------------------------------------------------- */
/* Chatbot Panel                                                              */
/* -------------------------------------------------------------------------- */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 6px;
    height: 24px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--color-text-muted);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.chatbot-panel {
    position: fixed;
    bottom: 90px;
    right: 2rem;
    width: 360px;
    height: 500px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 99;
    overflow: hidden;
    transition: all var(--transition-smooth);
    transform-origin: bottom right;
}

.chatbot-panel.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    display: flex !important; /* Transition을 위해 display: none 무효화 */
}

.chatbot-header {
    padding: 1rem 1.2rem;
    background: var(--color-accent);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: var(--color-bg);
}

.chat-message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.chat-message.user-message {
    align-self: flex-end;
}

.chat-message.ai-message {
    align-self: flex-start;
}

.message-content {
    padding: 0.8rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.user-message .message-content {
    background: var(--color-primary);
    color: var(--color-primary-text);
    border-bottom-right-radius: 4px;
}

.ai-message .message-content {
    background: var(--color-surface);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.chatbot-input-area {
    padding: 1rem;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.5rem;
}

.chatbot-btn {
    background-color: var(--color-primary);
    color: var(--color-primary-text);
    border-color: var(--color-primary);
}
.chatbot-btn:hover {
    background-color: var(--color-primary-hover);
    color: var(--color-primary-text);
}

@media (max-width: 768px) {
    .chatbot-panel {
        top: 0;
        left: 0;
        bottom: auto; /* 키보드 대응을 위해 bottom auto 설정 */
        right: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
        z-index: 2000;
    }
    
    .chatbot-input-area input {
        font-size: 16px !important; /* iOS 인풋 포커스 시 자동 확대 방지 */
    }
}

.msg-action-btns {
    display: flex;
    gap: 0.5rem;
    margin-top: 6px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    transform: translateY(-4px);
}
.chat-message.active-actions .msg-action-btns,
.chat-message:hover .msg-action-btns {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.btn-msg-action {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-msg-action:hover {
    background: var(--color-border);
    color: var(--color-text-main);
}

/* -------------------------------------------------------------------------- */
/* Modals & Overlays                                                          */
/* -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-overlay-bg, rgba(0, 0, 0, 0.25)) !important; 
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 3rem 0;
    z-index: 1000;
    backdrop-filter: blur(6px);
    transition: opacity var(--transition-fast);
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background-color: var(--color-surface);
    padding: 3.5rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    position: relative;
    margin: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255,255,255,0.2);
}

#modal-create-book .modal-content {
    max-height: 85vh;
    overflow-y: auto;
}
#modal-create-book .modal-content::-webkit-scrollbar {
    width: 6px;
}
#modal-create-book .modal-content::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 4px;
}

.modal-content.small-modal {
    max-width: 440px;
    padding: 3rem;
}

.btn-close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.8rem;
    color: var(--color-text-light);
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-close-modal:hover {
    color: var(--color-text-main);
    background-color: var(--color-bg);
}

.modal-title {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    color: var(--color-primary);
}

.modal-desc {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.modal-actions {
    margin-top: 1.5rem;
}

.settings-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.settings-tabs::-webkit-scrollbar {
    display: none;
}

.settings-tab-btn {
    font-size: 1rem;
    color: var(--color-text-muted);
    font-weight: 500;
    padding: 0.5rem 0.5rem;
    position: relative;
    flex-shrink: 0;
}

.settings-tab-btn.active {
    color: var(--color-primary);
    font-weight: 600;
}

.settings-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.6rem;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-primary);
}

.settings-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-tab-content.active {
    display: block;
}

.admin-list {
    list-style: none;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.admin-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.admin-list-item:last-child {
    border-bottom: none;
}

.admin-list-item span {
    font-weight: 500;
}

.admin-list-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-list-actions button {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.admin-list-actions button:hover {
    background-color: var(--color-bg);
}

/* -------------------------------------------------------------------------- */
/* Loading Spinner                                                            */
/* -------------------------------------------------------------------------- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-overlay-bg, rgba(251, 251, 251, 0.9));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-text-main); /* 좀 더 차분한 스피너 색상 */
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin-bottom: 2rem;
}

.loading-text {
    color: var(--color-text-main);
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------- */
/* Responsive Adjustments                                                     */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    #app-root {
        min-height: auto; /* 모바일 하단 무한 스크롤 버그 방지 */
    }
    
    .header-container {
        padding: 1rem 1.2rem;
        gap: 0.5rem;
    }
    
    .logo {
        font-size: 1.2rem;
        flex-shrink: 0;
    }
    
    .nav-links {
        gap: 0.8rem;
        flex: 1;
        justify-content: flex-end;
        overflow: visible;
        min-width: 0;
    }
    
    #admin-nav-links {
        gap: 0.8rem !important;
        flex: 1;
        min-width: 0;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    
    #dynamic-nav-links {
        gap: 0.8rem !important;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        min-width: 0;
    }
    
    #dynamic-nav-links::-webkit-scrollbar {
        display: none;
    }

    /* 모바일 어드민 화면 필터 폼 및 라벨 깨짐(세로 늘어짐) 방지 */
    .settings-container div[style*="height: 36px"] {
        height: auto !important;
        flex-wrap: wrap !important;
        gap: 0.8rem !important;
        padding-top: 0.5rem;
    }
    
    .settings-container button[style*="height: 100%"] {
        height: 36px !important;
    }

    .settings-container label {
        white-space: nowrap !important;
    }
    
    .profile-dropdown-wrapper {
        flex-shrink: 0;
    }

    .admin-table-container table {
        min-width: max-content;
    }

    .admin-table-container th, 
    .admin-table-container td {
        white-space: nowrap;
    }

    .mobile-sidebar-close, .mobile-sidebar-toggle {
        display: flex;
    }

    .editor-layout {
        display: block; /* 모바일에서 flex 팽창으로 인한 여백 붕괴 해결 */
        height: auto;
        min-height: auto;
        background-color: var(--color-surface);
    }
    
    .editor-main {
        display: block; /* 모바일에서 flex 해제 */
        overflow-y: visible;
        height: auto;
        background-color: var(--color-surface);
    }

    #view-editor {
        background-color: var(--color-surface);
        min-height: auto;
    }
    
    .editor-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1001;
        background-color: var(--color-surface);
        border-right: 1px solid var(--color-border);
        border-bottom: none;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        padding: 1.5rem 1.2rem;
        box-shadow: var(--shadow-lg);
    }

    .editor-sidebar.open {
        transform: translateX(0);
        left: 0;
    }
    
    .mobile-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.4);
        z-index: 1000;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .mobile-sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
    
    .editor-content-area {
        padding: 1.5rem 1rem 8rem 1rem; /* 네비게이션 버튼 가림 방지 및 iOS 가상키보드 대비 여유 확보 */
    }
    
    .editor-toolbar {
        padding: 0.8rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        position: sticky;
        top: 59px; /* 모바일 헤더 높이에 맞춰 툴바 고정 */
        z-index: 90;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* 스크롤 시 구분을 위한 미세한 그림자 */
    }

    .toolbar-left {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 0.3rem;
        align-items: center;
    }
    
    #view-preview .toolbar-left {
        flex-wrap: nowrap;
        width: auto;
        flex: 1;
        overflow: hidden;
    }

    .current-section-label {
        font-size: 1.1rem;
        white-space: normal;
        word-break: keep-all;
        line-height: 1.3;
        flex: 1;
    }

    .complexity-badge {
        margin-left: 0 !important;
        font-size: 0.7rem !important;
    }

    .toolbar-right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 0.5rem;
        overflow-x: auto; /* 한 줄 가로 스크롤 활성화 */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* 파이어폭스 스크롤바 숨김 */
        padding-bottom: 2px; /* 가로 스크롤 시 그림자 짤림 방지 */
    }
    
    .toolbar-right::-webkit-scrollbar {
        display: none; /* 크롬, 사파리 스크롤바 숨김 */
    }

    .toolbar-right .btn-primary, 
    .toolbar-right .btn-outline {
        padding: 0.45rem 0.9rem;
        font-size: 0.85rem;
        flex-shrink: 0; /* 버튼이 찌그러지지 않도록 크기 고정 */
    }
    
    .home-container {
        padding: 2rem 1.2rem;
    }
    
    #ranking-period-filters,
    #ranking-category-filters {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    #ranking-period-filters::-webkit-scrollbar,
    #ranking-category-filters::-webkit-scrollbar {
        display: none;
    }
    #ranking-period-filters .btn-outline,
    #ranking-category-filters .btn-outline {
        flex-shrink: 0;
    }
    
    .modal-overlay {
        padding: 1.5rem 0;
    }

    .modal-content {
        padding: 2rem 1.2rem;
    }
}

/* -------------------------------------------------------------------------- */
/* Book Reader (Preview) Mode                                                 */
/* -------------------------------------------------------------------------- */
:root {
    --viewer-bg: #fdfcf9;
    --viewer-text: #2a2a2a;
    --viewer-font: 'Noto Serif KR', 'Nanum Myeongjo', serif;
    --viewer-font-size: 1.08rem;
    --viewer-line-height: 2.1;
    --viewer-letter-spacing: -0.04em;
    --viewer-binding: linear-gradient(to right, transparent 49.2%, rgba(0,0,0,0.02) 49.8%, rgba(0,0,0,0.06) 50%, rgba(0,0,0,0.02) 50.2%, transparent 50.8%);
}

.book-reader-wrapper {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
}

.book-reader-container {
    background-color: var(--viewer-bg);
    width: 100%;
    height: 85vh;
    box-shadow: 0 12px 48px rgba(0,0,0,0.06), inset 0 0 60px rgba(139, 126, 102, 0.03);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    /* 책의 접힌 부분(Binding)을 섬세하게 표현 */
    background-image: var(--viewer-binding);
    transition: background-color 0.3s ease;
}

.book-reader-content {
    column-count: 2;
    column-gap: 100px;
    column-fill: auto;
    height: calc(85vh - 100px);
    margin: 50px;
    font-size: var(--viewer-font-size);
    line-height: var(--viewer-line-height);
    letter-spacing: var(--viewer-letter-spacing);
    color: var(--viewer-text);
    font-family: var(--viewer-font);
    font-weight: 400;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    word-break: break-all;
    text-align: justify;
    transition: all 0.2s ease;
    scroll-behavior: smooth;
}

.book-reader-content::-webkit-scrollbar {
    display: none;
}
.book-reader-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.book-reader-content h2, .book-reader-content h3 {
    break-after: avoid;
    column-break-after: avoid;
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--viewer-text);
    letter-spacing: -0.05em;
}

.book-reader-content p {
    margin-bottom: 1.2em;
    text-indent: 1.2em; /* 한국어 소설 표준 들여쓰기 */
}

.book-reader-content section.preview-chapter {
    break-inside: auto; /* 다단에서 쪼개짐 허용하여 레이아웃 붕괴 방지 */
    page-break-inside: auto;
    margin-bottom: 3rem;
}

/* 뷰어 설정 패널 스타일 */
.viewer-settings-panel {
    position: absolute;
    top: 70px;
    right: 2rem;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    padding: 1.5rem;
    width: 320px;
    z-index: 100;
    border: 1px solid var(--color-border);
}

.setting-row {
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.setting-row:last-child { margin-bottom: 0; }
.setting-row label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
}
.setting-options {
    display: flex;
    gap: 0.5rem;
}
.setting-options button {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
}
.setting-options .theme-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    padding: 0;
    display: flex; justify-content: center; align-items: center;
    font-weight: bold;
}
.setting-options .theme-btn.active {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.setting-options .font-btn {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
}
.setting-options .font-btn.active {
    background: var(--color-primary);
    color: var(--color-primary-text);
    border-color: var(--color-primary);
}
.controls-group {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex; align-items: center;
}
.controls-group .control-btn {
    padding: 0.4rem 0.8rem;
    font-weight: bold;
    color: var(--color-text-main);
}
.controls-group .control-btn:hover { background: #eee; }
.val-display {
    padding: 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.preview-nav-container {
    position: absolute;
    bottom: 0.5rem;
    right: 4rem;
    display: flex;
    gap: 0.8rem;
    z-index: 20;
}

.btn-page-nav {
    background: var(--color-surface);
    backdrop-filter: blur(4px);
    border: 1px solid var(--color-border);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    color: var(--color-text-main);
    transition: all 0.3s ease;
}

.btn-page-nav:hover {
    background: var(--color-bg);
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

@media (max-width: 768px) {
    .preview-nav-container {
        display: none !important; /* 모바일에서 하단 네비게이션 버튼 숨김 */
    }
    
    #view-preview .editor-toolbar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 100;
        background-color: var(--viewer-bg, rgba(255, 255, 255, 0.95)) !important;
        padding: 1rem 1.2rem !important;
        transform: translateY(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }

    #view-preview .current-section-label {
        white-space: nowrap;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        text-overflow: clip;
        flex: 1;
        mask-image: linear-gradient(to right, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    }
    
    #view-preview .current-section-label::-webkit-scrollbar {
        display: none;
    }

    #view-preview .toolbar-right {
        width: auto;
        overflow: visible;
        justify-content: flex-end;
        gap: 0;
    }

    .preview-mobile-bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        padding: 1rem 1.2rem;
        background-color: var(--viewer-bg, rgba(255, 255, 255, 0.95));
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 100;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    #view-preview .editor-toolbar.show-mobile-toolbar ~ .preview-mobile-bottom-bar {
        transform: translateY(0);
    }
    
    #view-preview .editor-toolbar.show-mobile-toolbar {
        transform: translateY(0);
    }

    #view-preview:not(.hidden) {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
    }

    .book-reader-wrapper {
        padding: 0 !important;
        height: 100vh;
        height: 100dvh;
        display: block !important;
    }
    
    .book-reader-container {
        background-image: none;
        height: 100vh;
        height: 100dvh;
        width: 100vw;
        border-radius: 0;
        box-shadow: none;
        padding: 4.5rem 0 3.5rem 0; /* 다단 레이아웃 버그 방지를 위해 상하 여백을 상위 컨테이너로 이동 */
        box-sizing: border-box;
    }
    
    .book-reader-content {
        column-count: auto;
        column-width: 100vw; /* 뷰포트에 꽉 차게 설정하여 이동 오차 방지 */
        column-gap: 0; /* 갭을 없애고 내부 요소 여백으로 처리 */
        margin: 0;
        padding: 0; /* 다단 잘림 현상의 주 원인이므로 내부 패딩은 0으로 설정 */
        height: 100%; /* 부모 높이에 정확히 맞춤 */
        font-size: 1.05rem;
        line-height: 1.9;
        box-sizing: border-box;
        overflow-x: hidden !important; /* 좌우 스와이프 스크롤 방지 */
        scroll-snap-type: none !important; /* 스냅 충돌 방지 (2페이지 건너뜀 해결) */
        touch-action: none; /* 수직/수평 제스처 모두 차단하여 위아래 스크롤 및 바운스 현상 원천 차단 */
        scroll-behavior: smooth; /* 터치 이동 시 부드러운 페이지 전환 */
    }

    /* 화면 우측 잘림 방지를 위해 텍스트 요소에 좌우 패딩 할당 */
    .book-reader-content p, 
    .book-reader-content h2, 
    .book-reader-content h3 {
        padding-left: 1.2rem;
        padding-right: 1.2rem;
        box-sizing: border-box;
    }

    .viewer-settings-panel {
        position: fixed;
        top: 70px;
        right: 1rem;
        width: calc(100vw - 2rem);
        z-index: 101;
    }
}

/* -------------------------------------------------------------------------- */
/* Footer Styles                                                              */
/* -------------------------------------------------------------------------- */
.app-footer {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 3rem 2.5rem;
    margin-top: 5rem;
}

.footer-container {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 3rem;
}

.footer-left {
    max-width: 500px;
}

.footer-logo {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-company-info {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.footer-copyright {
    color: var(--color-text-light);
    font-size: 0.8rem;
}

.footer-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
}

@media (min-width: 768px) {
    .footer-right {
        align-items: flex-end;
        text-align: right;
    }
}

.footer-socials {
    display: flex;
    gap: 1.2rem;
}

.footer-social-link {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-social-link:hover {
    color: var(--color-primary);
}
```