.notes-layout {
    display: flex;
    gap: 0;
    margin: 0 auto;
    transition: all 0.3s ease;
    justify-content: center;
    flex-direction: column;
    align-items: flex-start;
}

.notes-layout.split-view {
    justify-content: flex-start;
    max-width: none;
    width: 100%;
    padding: 0 12px;
    box-sizing: border-box;
    flex-direction: row;
    gap: 24px;
    align-items: flex-start; /* 確保子元素從頂部對齊 */
    min-height: 100vh; /* 確保有足夠高度讓 sticky 工作 */
}

.notes-container {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 24px 80px 24px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    overflow-x: hidden;
}

@media (max-width: 480px) {
    .notes-container {
        padding: 0 10px;
        width: calc(100% - 20px);
    }
}

.split-view .notes-container {
    max-width: 320px;
    min-width: 280px;
    width: 320px;
    margin: 0;
    padding: 40px 0 80px 24px;
    box-sizing: border-box;
    flex: 0 0 320px;
}

.notes-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 32px;
    align-items: stretch;
}

.note-category {
    margin-bottom: 0;
    transition: none;
    position: relative;
    width: 100%;
    max-width: 100%;
}

.note-category:hover {
    transform: none;
}

.category-header {
    border: none;
    position: relative;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    padding: 0;
    margin-bottom: 8px;
}


.category-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary) !important;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0;
    transition: background 0.2s ease;
    letter-spacing: 0.01em;
}

.category-title:hover {
    background: var(--note-item-hover-bg);
}

.category-chevron {
    transition: transform 0.3s ease;
    opacity: 0.6;
    filter: var(--current-icon-filter);
}

.note-category.expanded .category-chevron {
    transform: rotate(90deg);
}

.note-list {
    padding: 0 0 0 8px;
    margin: 0;
    list-style: none;
    overflow: hidden;
    border-radius: 0;
    border-left: 1px solid var(--card-border);
    max-height: 1000px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.note-category:not(.expanded) .note-list {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin-top: -8px;
}

.note-item {
    padding: 6px 12px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    margin: 2px 0;
    border-radius: 4px;
    border-left: 2px solid transparent;
}

.note-item:hover {
    background: var(--note-item-hover-bg);
}

.note-item.active {
    background: var(--note-item-hover-bg);
}

.note-item.active .note-title {
    color: var(--accent-color);
    font-weight: 600;
}

.note-title {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-color);
    line-height: 1.5;
}

.note-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 400;
    padding-left: 0;
    margin-top: 2px;
    display: block;
}

.dark-theme {
    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.55);
    --link-color: #66d9a6;
    --accent-color: #66d9a6;
    --accent-color-bright: #7ee6b3;
    --accent-gradient-start: #66d9a6;
    --accent-gradient-end: #4ade80;
    --category-bg: rgba(255, 255, 255, 0.03);
    --note-list-bg: rgba(255, 255, 255, 0.04);
    --note-item-hover-bg: rgba(102, 217, 166, 0.08);
    --subtle-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --inner-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    --current-icon-filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(55%) contrast(100%);
}

.dark-theme .modal-content {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
}

.dark-theme .modal-header {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .modal-title {
    color: rgba(255, 255, 255, 0.9);
}

.dark-theme .modal-close {
    color: rgba(255, 255, 255, 0.6);
}

.dark-theme .modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dark-theme .modal-body {
    color: rgba(255, 255, 255, 0.7);
}

.dark-theme .note-info {
    color: rgba(255, 255, 255, 0.5) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {

    .modal-overlay {
        z-index: 99999;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(8px);
    }

    .modal-content {
        z-index: 100000;
        position: fixed;
    }

    .modal-header {
        z-index: 100001;
        position: fixed;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .note-list {
        padding: 8px 16px;
    }

    .note-item {
        padding: 6px 8px 6px 16px;
    }
}

.note-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.note-modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.note-modal.hiding {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    backdrop-filter: none;
    isolation: isolate;
    position: absolute;
    top: 80px;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: #ffffff;
    border-radius: 0 0 16px 16px;
    width: 100%;
    max-width: 800px;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-top: none;
    z-index: 100000;
    box-sizing: border-box;
}

.modal-header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    padding: 16px 20px;
    border: 1px solid var(--card-border);
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100001;
    box-sizing: border-box;
    text-align: center;
}

.modal-header .icon-img {
    filter: var(--current-icon-filter);
    margin-right: 8px;
}

.modal-title {
    color: var(--text-color);
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

.modal-close {
    position: absolute;
    right: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--tertiary-color);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-color);
    background: var(--card-border);
}

.modal-body {
    padding: 24px;
    color: var(--text-color);
    line-height: 1.6;
}

.modal-body p {
    margin-bottom: 16px;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 16px;
}

.modal-body li {
    margin-bottom: 8px;
}

.note-info {
    font-size: 0.9rem;
    color: #999999 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 16px;
    margin-top: 24px;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 40px 20px;
}

.note-content {
    background: var(--note-list-bg);
    border-radius: 8px;
    margin: 0;
}

.error-message {
    text-align: center;
    padding: 40px 20px;
}

.error-message p {
    margin: 8px 0;
    color: var(--text-secondary);
}

.error-detail {
    font-size: 0.85rem;
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.05);
    padding: 8px 12px;
    border-radius: 4px;
    margin: 12px 0;
}

.note-placeholder {
    font-style: italic;
    color: var(--text-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 16px;
    margin-top: 16px;
}

.dark-theme .error-detail {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.dark-theme .note-placeholder {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.note-viewer {
    display: none;
    flex: 1;
    min-width: 0;
    border: none;
    border-radius: 0;
    margin: 40px 24px 80px 0;
    overflow: visible; /* 改為 visible 讓 sticky 可以工作 */
    flex-direction: column;
    box-sizing: border-box;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    height: fit-content;
}

.split-view .note-viewer {
    display: flex !important;
    transform: translateX(0);
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-link {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: var(--accent-color-bright);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-secondary);
    opacity: 0.5;
}

.breadcrumb-current {
    color: var(--text-secondary);
}

.note-viewer-header {
    padding: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 24px;
}

.note-viewer-header .icon-img {
    filter: var(--current-icon-filter);
    opacity: 0.6;
}

.note-viewer-title {
    flex: 1;
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    /* 文字截斷設置 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* 確保 flex 項目可以收縮 */
}

.note-footer {
    display: flex;
    padding: 32px 0 16px 0;
    margin-top: 20px;
    border-top: 1px solid var(--card-border);
}

.note-footer .last-updated-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--card-bg);
    border-radius: 4px;
    letter-spacing: 0;
    white-space: nowrap;
}

.note-viewer-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--tertiary-color);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.note-viewer-close:hover {
    color: aliceblue;
    background: var(--card-border);
}

.note-viewer-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Table of Contents Container */
.note-viewer-content-wrapper {
    display: flex;
    gap: 32px;
    flex: 1;
    overflow: visible;
    position: relative;
    align-items: flex-start; /* 讓子元素從頂部對齊 */
}

/* 桌面版的 note-viewer-body 設置 */
@media (min-width: 769px) {
    .note-viewer-body {
        overflow-y: visible; /* 桌面版不在這裡滾動，讓整個頁面滾動 */
        min-width: 0; /* 防止內容溢出 */
    }
}

/* Table of Contents Sidebar */
.note-toc {
    display: none; /* Hidden by default, shown only on desktop */
    flex-direction: column;
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 16px 12px;
    background: var(--category-bg);
    border-left: none;
    border-radius: 10px;
    box-shadow: var(--subtle-shadow);
}

/* Show TOC only on desktop screens (split view) */
@media (min-width: 1200px) {
    .split-view .note-toc {
        display: flex;
    }
}


.note-toc-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: 0.01em;
    padding-left: 6px;
}

.note-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.note-toc-list li {
    margin: 0;
    padding: 0;
    border-bottom: none;
}

.note-toc-list li:last-child {
    border-bottom: none;
}

.note-toc-item {
    display: block;
    padding: 8px 10px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    line-height: 1.5;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.note-toc-item:hover {
    color: var(--text-primary);
}

/* Custom scrollbar for TOC */
.note-toc::-webkit-scrollbar {
    width: 4px;
}

.note-toc::-webkit-scrollbar-track {
    background: transparent;
}

.note-toc::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 2px;
}

.note-toc::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.note-viewer-body .loading {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 60px 20px;
}

.note-viewer-body .markdown-content {
    padding: 0;
    animation: noteFadeIn 0.2s ease-out;
}

.note-viewer-body .error-message {
    padding: 40px 20px;
}

@keyframes noteFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.markdown-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin: 0;
    box-sizing: border-box;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    color: var(--text-primary);
    margin: 32px 0 16px 0;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    position: relative;
    padding-left: 1.1em; /* space for the left-side section marker */
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
    margin-top: 0;
}

.markdown-content h2::after {
    display: none;
}

.markdown-content h1::before,
.markdown-content h2::before,
.markdown-content h3::before {
    content: "#";
    position: absolute;
    left: 0;
    top: 0.01em;
    color: var(--accent-color);
    opacity: 0.65;
    font-weight: 700;
    line-height: 1;
}

.markdown-content h1::before {
    font-size: 1.0em;
}

.markdown-content h2::before {
    content: "▌";
    font-size: 0.95em;
    opacity: 0.85;
    font-weight: 900;
}

.markdown-content h3::before {
    font-size: 0.9em;
}

.markdown-content h1 {
    font-size: 2rem;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 20px;
}

.markdown-content h2 {
    font-size: 1.5rem;
    border-bottom: none;
    padding-bottom: 8px;
    margin-top: 40px;
    margin-bottom: 16px;
    scroll-margin-top: 20px; /* Offset for smooth scroll navigation */
}

.markdown-content h3 {
    font-size: 1.25rem;
    margin-top: 28px;
    margin-bottom: 12px;
}

.markdown-content p {
    margin: 16px 0;
    line-height: 1.7;
    color: var(--text-primary);
    text-align: left;
    font-size: 1rem;
}

.markdown-content ul,
.markdown-content ol {
    margin: 16px 0;
    padding-left: 28px;
}

.markdown-content ul {
    list-style-type: disc;
    list-style-position: outside;
}

.markdown-content ol {
    list-style-type: decimal;
    list-style-position: outside;
}

.markdown-content li {
    margin: 8px 0;
    line-height: 1.7;
    color: var(--text-primary);
    display: list-item;
}

/* 嵌套列表支援 */
.markdown-content ul ul {
    list-style-type: circle;
    margin: 6px 0;
    padding-left: 20px;
}

.markdown-content ul ul ul {
    list-style-type: square;
}

.markdown-content ol ol {
    list-style-type: lower-alpha;
    margin: 6px 0;
    padding-left: 20px;
}

.markdown-content ol ol ol {
    list-style-type: lower-roman;
}

/* 列表項目內容樣式 */
.markdown-content li > p {
    margin: 0;
    display: inline;
}

.markdown-content li > p:not(:last-child) {
    margin-bottom: 6px;
    display: block;
}

.markdown-content code {
    background: #f6f8fa;
    padding: 3px 6px;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Consolas', 'Liberation Mono', monospace;
    font-size: 0.85em;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.markdown-content pre {
    background: #f6f8fa;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
    line-height: 1.6;
    max-width: 860px;
    width: 100%;
    box-sizing: border-box;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: inherit;
    border: none;
}

/* Plain text code blocks should follow site text color (not highlight theme token colors). */
.markdown-content pre > code.language-text,
.markdown-content pre > code.language-txt,
.note-viewer-body pre > code.language-text,
.note-viewer-body pre > code.language-txt {
    color: var(--text-primary) !important;
}

/* Even in dark theme, keep plain language-text readable */
.dark-theme .markdown-content pre > code.language-text,
.dark-theme .markdown-content pre > code.language-txt,
.dark-theme .note-viewer-body pre > code.language-text,
.dark-theme .note-viewer-body pre > code.language-txt {
    color: var(--text-primary) !important;
}

/* If highlight.js adds .hljs, ensure language-text still uses our text color */
.markdown-content pre > code.language-text.hljs,
.markdown-content pre > code.language-txt.hljs,
.note-viewer-body pre > code.language-text.hljs,
.note-viewer-body pre > code.language-txt.hljs {
    color: var(--text-primary) !important;
}
/* highlight.js adds .hljs to code blocks; keep layout/overflow but let github(.dark).css handle colors */
.markdown-content pre code.hljs {
    display: block;
    padding: 0;
    background: transparent;
}

.plain-codeblock {
    font-family: Consolas, Monaco, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text-primary);
    background: #f6f8fa;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
    box-sizing: border-box;
    width: 100%;
    max-width: 860px;
}

.dark-theme .plain-codeblock {
    background: rgba(110, 118, 129, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #abb2bf;
}

.plain-codeblock p {
    margin: 0;
    white-space: pre;
    font: inherit;
}

.markdown-content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.markdown-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.markdown-content em {
    font-style: italic;
    color: var(--text-primary);
}

.markdown-content hr {
    border: none;
    height: 1px;
    background: var(--card-border);
    margin: 32px 0;
    opacity: 1;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    font-size: 0.9375rem;
}

.markdown-content th,
.markdown-content td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.markdown-content th {
    background: #f6f8fa;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--card-border);
}

.markdown-content tr:last-child td {
    border-bottom: none;
}

.markdown-content blockquote {
    margin: 20px 0;
    padding: 16px 20px;
    background: #f6f8fa;
    border-left: 4px solid var(--accent-color);
    border-radius: 0 4px 4px 0;
    font-style: normal;
    color: var(--text-primary);
}

/* Dark theme: keep subtle backgrounds for inline/pre (colors still come from github-dark.css) */
.dark-theme .markdown-content code {
    background: rgba(110, 118, 129, 0.2);
    border-color: rgba(255, 255, 255, 0.12);
}

.dark-theme .markdown-content pre {
    background: rgba(110, 118, 129, 0.15);
    border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 768px) {
    .notes-layout {
        flex-direction: column !important;
        padding: 0 16px !important;
    }

    .notes-layout.split-view {
        position: relative;
        flex-direction: column !important;
    }

    .split-view .notes-container {
        max-width: 100%;
        display: none;
        padding: 16px 0 50px 0;
    }

    /* Hide TOC on mobile */
    .note-toc {
        display: none !important;
    }

    /* Make note-viewer-body take full width on mobile */
    .note-viewer-content-wrapper {
        flex-direction: column;
    }

    .split-view .note-viewer {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        border-radius: 0;
        z-index: 10000;
        background: var(--background-color);
        display: flex;
        flex-direction: column;
        height: 100vh;
        padding: 16px;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* --- Mobile long-reading typography (smaller, comfortable) --- */
    .split-view .note-viewer {
        padding: 14px;
    }

    .split-view .note-viewer-header {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .note-viewer-close {
        position: absolute;
        top: 0;
        right: 0;
        width: 40px;
        height: 40px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
    }

    .split-view .note-viewer-body {
        padding: 0 2px;
    }

    .split-view .note-viewer-body .markdown-content {
        font-size: 0.92rem;
        line-height: 1.7;
        letter-spacing: 0;
    }

    .split-view .note-viewer-body .markdown-content p,
    .split-view .note-viewer-body .markdown-content li {
        font-size: 0.92rem;
        line-height: 1.75;
        margin: 10px 0;
    }

    .split-view .note-viewer-body .markdown-content h1 {
        font-size: 1.25rem;
        margin: 14px 0 10px 0;
    }

    .split-view .note-viewer-body .markdown-content h2 {
        font-size: 1.08rem;
        margin: 16px 0 10px 0;
        scroll-margin-top: 10px;
    }

    .split-view .note-viewer-body .markdown-content h3 {
        font-size: 1.0rem;
        margin: 14px 0 8px 0;
    }

    /* Inline code: smaller and less visually heavy on mobile */
    .split-view .note-viewer-body .markdown-content code {
        font-size: 0.86em;
        padding: 2px 5px;
        border-radius: 4px;
    }

    /* Code blocks: smaller, with comfortable padding; horizontal scroll enabled */
    .split-view .note-viewer-body .markdown-content pre,
    .split-view .note-viewer-body .plain-codeblock {
        padding: 12px;
        margin: 12px 0;
        border-radius: 10px;
        max-width: 100%;
    }

    .split-view .note-viewer-body .markdown-content pre code,
    .split-view .note-viewer-body .markdown-content pre code.hljs {
        font-size: 0.78rem;
        line-height: 1.55;
    }

    /* Tables: make them scroll instead of forcing tiny font */
    .split-view .note-viewer-body .markdown-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .split-view .note-viewer-body .markdown-content th,
    .split-view .note-viewer-body .markdown-content td {
        padding: 8px 12px;
        font-size: 0.88rem;
        white-space: nowrap;
    }

    .breadcrumb-nav {
        font-size: 0.8rem;
        margin-bottom: 16px;
    }

    .split-view .note-viewer-header {
        flex-shrink: 0;
        position: relative;
        z-index: 10001;
        margin-bottom: 16px;
    }

    .note-viewer-title {
        font-size: 1rem !important;
        /* 手機版也需要文字截斷 */
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        min-width: 0 !important;
    }

    .split-view .note-viewer-body {
        flex: 1;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        height: calc(100vh - 120px);
        max-height: calc(100vh - 120px);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        scroll-behavior: auto; /* 強制即時滾動，不要平滑動畫 */
        overscroll-behavior: none; /* 防止彈性滾動干擾 */
        position: relative; /* 確保定位正確 */
    }

    body.split-view-active {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100vh;
        touch-action: none;
    }

    body.split-view-active .menu {
        display: none !important;
    }

    body.split-view-active .blogTitle {
        display: none !important;
    }

    body.split-view-active .sidebar-overlay {
        display: none !important;
    }

    .split-view .note-viewer-body .markdown-content {
        min-height: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
        word-wrap: break-word;
        max-width: 100%;
        width: 100%;
    }

    .split-view .note-viewer-body .markdown-content pre {
        overflow-x: auto;
        white-space: pre;
        word-wrap: normal;
        max-width: 100%;
        box-sizing: border-box;
    }

    .split-view .note-viewer-body {
        -webkit-overflow-scrolling: touch !important;
        overflow-y: auto !important;
        transform: translateZ(0);
    }

    .note-modal {
        z-index: 99998;
    }


    .modal-content {
        z-index: 100000;
        position: fixed;
    }

    .modal-header {
        z-index: 100001;
        position: fixed;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .note-list {
        padding: 8px 16px;
    }

    .note-item {
        padding: 6px 8px 6px 16px;
    }
}

.notes-layout.split-view {
    outline: 2px solid transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    transition: all 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

.dark-theme ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.dark-theme .modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.dark-theme .modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.note-list::-webkit-scrollbar {
    width: 4px;
}

.note-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.note-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.dark-theme .note-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
}

.dark-theme .note-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Note Viewer Body 滾動條隱藏 */
.note-viewer-body::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

.note-viewer-body::-webkit-scrollbar-track {
    background: transparent;
}

.note-viewer-body::-webkit-scrollbar-thumb {
    background: transparent;
}

.note-viewer-body::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* 確保 Firefox 也隱藏滾動條 */
.note-viewer-body {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Note Navigation Buttons */
.note-navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 32px;
}

.note-nav-button {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 48%;
}

.note-nav-button:hover {
    background: var(--note-item-hover-bg);
    .note-nav-title {
        font-weight: 500;
    }
}

.note-nav-prev {
    justify-content: flex-start;
}

.note-nav-next {
    justify-content: flex-end;
    margin-left: auto;
}

.note-complete {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--category-bg);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    flex: 1;
    max-width: 48%;
    margin-left: auto;
}

.note-nav-arrow {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    filter: var(--current-icon-filter);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.note-nav-button:hover .note-nav-arrow {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(133deg) brightness(95%) contrast(101%);
}

.note-nav-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.note-nav-next .note-nav-content {
    text-align: right;
}

.note-nav-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.note-nav-title {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* 手機版樣式 */
@media (max-width: 768px) {
    .note-navigation {
        flex-direction: column;
        margin-bottom: 3rem;
        gap: 12px;
    }

    .note-nav-button {
        max-width: 100%;
    }

    .note-nav-next {
        margin-left: 0;
    }

    .note-complete {
        max-width: 100%;
        margin-left: 0;
    }

    /* 手機版 note-viewer-body 滾動條隱藏 */
    .split-view .note-viewer-body::-webkit-scrollbar {
        width: 0;
        background: transparent;
    }

    .split-view .note-viewer-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .split-view .note-viewer-body::-webkit-scrollbar-thumb {
        background: transparent;
    }

    .split-view .note-viewer-body::-webkit-scrollbar-thumb:hover {
        background: transparent;
    }

    .dark-theme .split-view .note-viewer-body::-webkit-scrollbar-thumb {
        background: transparent;
    }

    .dark-theme .split-view .note-viewer-body::-webkit-scrollbar-thumb:hover {
        background: transparent;
    }
}

