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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #fff;
    height: 100vh;
    overflow: hidden;
}

.app-layout {
    display: flex;
    height: 100vh;
}

.pdf-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #16213e;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 80vw;
}

.pdf-header {
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-input-wrapper {
    display: inline-block;
}

.file-input-wrapper label {
    margin: 0;
    display: inline-block;
    line-height: normal;
}

input[type="file"] {
    display: none;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #e8e8e8;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pdf-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #aaa;
    font-size: 13px;
    margin-left: 10px;
}

#pdfName {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

#zoomControls {
    display: none;
    gap: 6px;
}

.page-nav button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.page-nav button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.page-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-nav input {
    width: 60px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px;
    border-radius: 4px;
    text-align: center;
}

.pdf-page.dark-mode {
   filter: invert(1) hue-rotate(180deg);
}

.pdf-page.grayscale-mode {
   filter: grayscale(85%) invert(85%);
}

.pdf-viewer-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #0f1419;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    position: relative;
}

#pdfViewer {
    max-width: 100%;
    display: none;
}

#pdfViewer.active {
    display: block;
}

.pdf-page {
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.bookmarks-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
}

.bookmarks-header {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bookmarks-header h2 {
    margin: 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #888;
}

.keyboard-shortcuts {
    background: rgba(102, 126, 234, 0.1);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.5;
    color: #aaa;
}

.keyboard-shortcuts kbd {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    color: #fff;
    font-size: 11px;
}

.keyboard-shortcuts .level-1-text {
    color: #667eea;
}

.keyboard-shortcuts .level-2-text {
    color: #38ef7d;
}

.keyboard-shortcuts .level-3-text {
    color: #f39c12;
}

.bookmarks-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.bookmarks-list::-webkit-scrollbar {
    width: 8px;
}

.bookmarks-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.bookmarks-list::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.bookmark-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    transition: all 0.2s;
    min-width: 0;
    overflow: hidden;
}

.bookmark-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.bookmark-item.level-2 {
    border-left-color: #38ef7d;
    margin-left: 14px;
}

.bookmark-item.level-3 {
    border-left-color: #f39c12;
    margin-left: 28px;
}

.bookmark-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.bookmark-item textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px;
    border-radius: 4px;
    font-size: 12px;
    resize: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.4;
    overflow: hidden;
    display: block;
}

.bookmark-item textarea:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
}

.bookmark-page {
    background: rgba(102, 126, 234, 0.2);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.bookmark-page.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.bookmark-page.clickable:hover {
    background: rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.bookmark-page.clickable:active {
    transform: translateY(0);
}

.bookmark-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    transition: all 0.2s;
}

.bookmark-item input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
}

.bookmark-item input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px;
    border-radius: 4px;
    font-size: 12px;
}

.bookmark-actions {
    display: flex;
    gap: 6px;
}

.bookmark-actions .btn.btn-small {
    padding: 2px 6px;
    font-size: 11px;
}

.pdf-page {
    display: block;
}

.page-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
    padding: 10px 0;
    overflow: hidden;
}

.page-editor-modal.hidden {
    display: none;
}

.page-editor-content {
    background: #1a1a2e;
    border-radius: 12px;
    width: 95%;
    height: calc(100vh - 20px);
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.page-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.page-editor-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

#closeSearch {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

#closeSearch:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.toolbar-group {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-right: 15px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-label {
    font-size: 12px;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.page-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #0f1419;
}

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

.page-thumbnail {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.page-thumbnail:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.page-thumbnail.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.page-thumbnail.dragging {
    opacity: 0.5;
}

.page-thumbnail.drag-over {
    border-color: #38ef7d;
    background: rgba(56, 239, 125, 0.1);
}

.page-thumbnail-canvas {
    width: 100%;
    height: auto;
    border-radius: 4px;
    background: white;
    display: block;
}

.page-thumbnail-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 13px;
}

.page-number {
    color: #667eea;
    font-weight: 600;
}

.page-size {
    color: #888;
    font-size: 11px;
}

.page-checkbox {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
}

.page-thumbnail.deleted {
    pointer-events: none;
    opacity: 0.4;
    position: relative;
}

.page-thumbnail.deleted::before {
    content: '🗑️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    z-index: 100;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.page-thumbnail.deleted::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    z-index: 99;
    pointer-events: none;
}

.rotation-indicator {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.page-editor-actions {
    display: flex;
    gap: 12px;
    padding: 12px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
}

.page-editor-actions .btn {
   padding: 10px 16px;
   font-size: 14px;
   white-space: nowrap;
}

.selection-info {
    flex: 1;
    display: flex;
    align-items: center;
    color: #888;
    font-size: 13px;
    white-space: nowrap;
}

.selection-info strong {
    color: #667eea;
    margin: 0 4px;
}

.btn-icon {
    padding: 8px 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon-only {
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1;
    min-width: auto;
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-icon-only:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-icon-only:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-icon-header {
    background: transparent;
    border: 1px solid rgba(102, 126, 234, 0.4);
    color: #667eea;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    line-height: 1;
}

.btn-icon-header:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-1px);
}

.btn-icon-header:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}



.split-range-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    width: 200px;
}

.split-range-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
}

.split-range-input::placeholder {
    color: #666;
}

.title-diff {
    font-size: 12px;
    font-family: inherit;
    padding: 4px 6px;
    letter-spacing: normal;
    color: #ccc;
    background: rgba(56, 239, 125, 0.05);
    border-radius: 4px;
    border-left: 2px solid rgba(56, 239, 125, 0.3);
    display: none;
    margin-top: 4px;
}

.title-diff.visible {
    display: block;
}

.textLayer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0.4;
    line-height: 1;
    --scale-factor: 1.5;
}

.textLayer > span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}

.textLayer ::selection {
    background: rgba(255, 235, 59, 0.6);
    color: inherit;
}

.textLayer ::-moz-selection {
    background: rgba(255, 235, 59, 0.6);
    color: inherit;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-delete {
    background: transparent;
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.btn-delete:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.5);
}


.bookmarks-footer {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-buttons {
    display: flex;
    gap: 8px;
}

.footer-buttons .btn {
    flex: 1;
    font-size: 11px;
    padding: 8px 10px;
}

.footer-buttons label.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-success {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #e8e8e8;
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes highlight-pulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.7;
    }
}

.search-highlight-overlay {
    animation: highlight-pulse 1.5s ease-in-out infinite;
}

.modal-content {
    background: #1a1a2e;
    padding: 0;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.btn-close {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.modal-content > p {
    color: #aaa;
    margin: 0;
    padding: 15px 25px;
    font-size: 14px;
    background: rgba(102, 126, 234, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.merge-file-list {
    padding: 20px 25px;
    max-height: 400px;
    overflow-y: auto;
}

.merge-file-list::-webkit-scrollbar {
    width: 8px;
}

.merge-file-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.merge-file-list::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.merge-file-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: grab;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.merge-file-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.3);
}

.merge-file-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.merge-file-item.drag-over {
    border-color: rgba(102, 126, 234, 0.8);
    background: rgba(102, 126, 234, 0.1);
}

.drag-handle {
    color: #666;
    font-size: 20px;
    cursor: grab;
    user-select: none;
}

.merge-file-item.dragging .drag-handle {
    cursor: grabbing;
}

.file-order {
    background: rgba(102, 126, 234, 0.3);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-pages {
    font-size: 12px;
    color: #888;
}

.remove-file {
    background: transparent;
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.remove-file:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.5);
}

.modal-actions {
    display: flex;
    gap: 12px;
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-actions .btn {
    flex: 1;
    padding: 12px;
}

.empty-merge-list {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.pdf-search-section {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.search-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: #fff;
}

.search-result-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid #667eea;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(3px);
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
}

.search-result-page {
    color: #667eea;
    font-weight: 600;
}

.search-result-score {
    color: #888;
}

.search-result-text {
    font-size: 13px;
    line-height: 1.5;
    color: #ddd;
}

.search-result-text mark {
    background: #ffeb3b;
    color: #000;
    padding: 0;
    border-radius: 2px;
    font-weight: 600;
}

#pdfSearchBox:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.8);
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(102, 126, 234, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 10000; /* Increased z-index */
    max-width: 350px;
    word-wrap: break-word;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: rgba(231, 76, 60, 0.95);
}

.toast.success {
    background: rgba(17, 153, 142, 0.95);
}

.toast.info {
    background: rgba(102, 126, 234, 0.95);
}

@keyframes bookmark-highlight {
    0% {
        background: rgba(102, 126, 234, 0.4);
        transform: scale(1.02);
    }
    100% {
        background: rgba(255, 255, 255, 0.05);
        transform: scale(1);
    }
}

.bookmark-item.newly-added {
    animation: bookmark-highlight 0.6s ease-out;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #aaa;
    font-size: 18px;
    pointer-events: none;
}

.pdf-viewer-container.drop-active {
    outline: 3px dashed rgba(102, 126, 234, 0.9);
    outline-offset: -8px;
    background: #151b2b;
}

.loading.hidden {
    display: none;
}

@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
    }

    .bookmarks-panel {
        width: 300px;
        display: flex;
        flex-direction: column;
        background: #1a1a2e;
        height: 100vh;
        overflow: hidden;
    }

    .bookmarks-list {
        flex: 1;
        overflow-y: auto;
        padding: 15px;
        min-height: 0;
    }

    .github-link {
        color: #aaa;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        padding: 4px;
        border-radius: 4px;
    }

    .github-link:hover {
        color: #667eea;
        background: rgba(102, 126, 234, 0.1);
    }

    .github-link svg {
        display: block;
    }
}

/* Generate from: Headings | TOC */
.generate-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.generate-label {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}

.generate-row .btn {
    flex: 1;
    font-size: 11px;
    padding: 8px 10px;
}

/* TOC dialog */
.toc-modal {
    max-width: 680px;
    display: flex;
    flex-direction: column;
}

.toc-body {
    padding: 16px 25px;
    overflow-y: auto;
}

.toc-help {
    color: #aaa;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.toc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #ccc;
    flex-wrap: wrap;
}

.toc-input,
.toc-level {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.toc-num {
    width: 80px;
}

.toc-textarea {
    width: 100%;
    height: 150px;
    resize: vertical;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    white-space: pre;
}

.toc-check {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.toc-status {
    color: #888;
    font-size: 12px;
}

.toc-status-block {
    margin-bottom: 8px;
}

.toc-list {
    max-height: 260px;
    overflow-y: auto;
}

.toc-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 5px 8px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #667eea;
    border-radius: 4px;
    font-size: 12px;
}

.toc-item.level-2 {
    border-left-color: #38ef7d;
    margin-left: 14px;
}

.toc-item.level-3 {
    border-left-color: #f39c12;
    margin-left: 28px;
}

.toc-item.out-of-range {
    opacity: 0.45;
}

.toc-level {
    padding: 1px 2px;
    font-size: 11px;
}

.toc-page {
    color: #667eea;
    font-weight: 600;
    min-width: 46px;
}

.toc-title {
    flex: 1;
    word-break: break-word;
}

.toc-mark {
    width: 12px;
    font-weight: 700;
    text-align: center;
}

.toc-mark.found {
    color: #38ef7d;
}

.toc-mark.missing {
    color: #f39c12;
}
