:root {
    /* --- Layout Variables --- */
    --sidebar-width: 320px;
    --content-width: 800px;
    --font-size: 16px;

    /* --- Theme Colors --- */
    --light-bg: #ffffff;
    --light-text: #333333;
    --light-sidebar-bg: #f8f9fa;
    --light-border: #dee2e6;
    --light-code-bg: #f1f3f5;


    --dark-bg: #1a1a1a;
    --dark-text: #e0e0e0;
    --dark-sidebar-bg: #2d2d2d;
    --dark-border: #495057;
    --dark-code-bg: #0d1117;

    /* --- Accent Colors --- */
    --primary-accent: #08478a;
    --primary-accent-hover: #ffffff;
    --dark-primary-accent: #5298d1;
    --dark-primary-accent-hover: #1a1a1a;
}





* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--font-size);
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
}

#markdown-reader-container {
    display: flex;
    height: 100%;
}

/* --- Scrollbar Styles --- */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border-radius: 6px;
}

body.light ::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border: 3px solid var(--light-bg);
}

body.light ::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

body.dark ::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    border: 3px solid transparent;
}

body.dark ::-webkit-scrollbar-thumb:hover {
    background-color: #6b7280;
}

#toc-index::-webkit-scrollbar-thumb,
.favorites-index::-webkit-scrollbar-thumb,
.recent-index::-webkit-scrollbar-thumb,
.search-index::-webkit-scrollbar-thumb {
    border-color: transparent;
}

/* --- Theme Application --- */
body.light {
    background-color: transparent !important;
    color: var(--light-text);
}

body.dark {
    background-color: transparent !important;
    color: var(--dark-text);
}

body.light .main-content {
    background-color: var(--light-bg);
}

body.dark .main-content {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

.open-sidebar-btn {
    position: fixed;
    left: 10px;
    top: calc(var(--docs-browser-bar-height, 0px) + 10px);
    z-index: 1000;
    border: 1px solid;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

body.light .open-sidebar-btn {
    background: var(--light-bg);
    border-color: var(--light-border);
}

body.dark .open-sidebar-btn {
    background: var(--dark-sidebar-bg);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.sidebar-collapsed .open-sidebar-btn {
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: 380px;
    max-width: 600px;
    border-right: 1px solid;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease, width 0.3s ease;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
}

.sidebar.collapsed {
    min-width: 0px;
    margin-left: calc(-1 * var(--sidebar-width));
}

body.light .sidebar {
    background-color: rgba(248, 249, 250, 0.4);
    border-color: var(--light-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

body.dark .sidebar {
    background-color: rgba(15, 23, 42, 0.92);
    border-color: var(--dark-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid;
    flex-shrink: 0;
    position: relative;
}

body.light .sidebar-header {
    border-color: var(--light-border);
}

body.dark .sidebar-header {
    border-color: var(--dark-border);
    background-color: rgba(15, 23, 42, 0.95);
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 28px;
}

body.dark .sidebar-content {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(17, 24, 39, 0.98) 100%);
}

.main-content {
    flex: 1;
    overflow-y: auto;
    height: 100vh;
    padding: 40px;
    scroll-behavior: smooth;
}

.main-content.is-loading {
    visibility: hidden;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sidebar-toggle:hover {
    opacity: 1;
}

body.light .sidebar-toggle {
    color: var(--light-text);
}

body.dark .sidebar-toggle {
    color: var(--dark-text);
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.control-button {
    background: none;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 6px;
    display: block;
    transition: all 0.2s;
    font-size: 13px;
    text-align: center;
    border: 1px solid;
}

body.light .control-button {
    border-color: var(--primary-accent);
    color: var(--primary-accent);
}

body.dark .control-button {
    border-color: var(--dark-primary-accent);
    color: var(--dark-primary-accent);
}

.control-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.light .control-button:hover {
    background-color: var(--primary-accent);
    color: var(--primary-accent-hover);
}

body.dark .control-button:hover {
    background-color: var(--dark-primary-accent);
    color: var(--dark-primary-accent-hover);
}

.settings-panel {
    position: absolute;
    top: 100%;
    right: 20px;
    border: 1px solid;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1010;
    width: 280px;
    display: none;
    max-height: min(70vh, 560px);
    overflow-y: auto;
}

body.light .settings-panel {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--light-border);
    backdrop-filter: blur(10px);
}

body.dark .settings-panel {
    background: rgba(45, 45, 45, 0.85);
    border-color: var(--dark-border);
    backdrop-filter: blur(10px);
}

.settings-panel.visible {
    display: block;
}

.settings-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

.setting {
    margin-bottom: 15px;
}

.setting label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    line-height: 1.35;
}

.control-button i,
.sidebar-toggle i,
.open-sidebar-btn i,
.back-to-top i {
    pointer-events: none;
}

.setting-checkbox {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.setting-checkbox label {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.setting-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary-accent);
}

.setting input[type="range"],
.setting select {
    width: 100%;
}

#language-select {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 13px;
}

body.light #language-select {
    border-color: var(--light-border);
    background-color: #ffffff;
    color: var(--light-text);
}

body.dark #language-select {
    border-color: var(--dark-border);
    background-color: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
}

.settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.close-settings {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-settings:hover {
    opacity: 1;
}

body.light .close-settings {
    color: var(--light-text);
}

body.dark .close-settings {
    color: var(--dark-text);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-info strong,
.file-info .breadcrumb {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info strong {
    font-size: 16px;
    margin-bottom: 4px;
}

.file-info .breadcrumb {
    font-size: 12px;
    opacity: 0.7;
}

.quick-links {
    margin-bottom: 20px;
    flex-shrink: 0;
    width: 100%;
}

.quick-links h3 {
    margin-bottom: 10px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.quick-links-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    width: 100%;
    flex-wrap: nowrap;
}

#doc-sort-select {
    border: 1px solid;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    max-width: 150px;
    opacity: 0.45;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

body.light #doc-sort-select {
    border-color: var(--light-border);
    background-color: rgba(255, 255, 255, 0.35);
    color: var(--light-text);
}

body.dark #doc-sort-select {
    border-color: var(--dark-border);
    background-color: rgba(15, 23, 42, 0.45);
    color: #cbd5e1;
}

#doc-sort-select:hover,
#doc-sort-select:focus {
    opacity: 1;
}

body.light #doc-sort-select:hover,
body.light #doc-sort-select:focus {
    background-color: rgba(255, 255, 255, 0.92);
}

body.dark #doc-sort-select:hover,
body.dark #doc-sort-select:focus {
    background-color: rgba(15, 23, 42, 0.95);
}

body.dark .quick-links h3,
body.dark .toc h3,
body.dark .file-info strong,
body.dark .setting label,
body.dark .settings-panel h4 {
    color: #f8fafc;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.quick-link-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-link-detail {
    margin-left: 8px;
    font-size: 11px;
    opacity: 0.72;
    line-height: 1.2;
}

.refresh-btn {
    border: 1px solid;
    border-radius: 6px;
    padding: 4px 8px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}

body.light .refresh-btn {
    color: var(--primary-accent);
    border-color: var(--primary-accent);
}

body.dark .refresh-btn {
    color: var(--dark-primary-accent);
    border-color: var(--dark-primary-accent);
}

.quick-link {
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    display: block;
    transition: all 0.2s;
    font-size: 13px;
    text-align: center;
    border: 1px solid;
}

body.light .quick-link {
    color: var(--light-text);
    border-color: var(--light-border);
    background-color: rgba(255, 255, 255, 0.5);
}

body.dark .quick-link {
    color: var(--dark-text);
    border-color: var(--dark-border);
    background-color: rgba(30, 41, 59, 0.9);
}

body.light .quick-link:hover {
    background-color: #e9ecef;
}

body.dark .quick-link:hover {
    background-color: rgba(51, 65, 85, 0.95);
}

body.light .quick-link.active {
    background-color: #e3f2fd;
    color: var(--primary-accent);
    border-color: var(--primary-accent);
    font-weight: bold;
}

body.dark .quick-link.active {
    background-color: #1d4ed8;
    color: #eff6ff;
    border-color: var(--dark-primary-accent);
    font-weight: bold;
}

.toc {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.toc-index {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.favorites-index {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.recent-index {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.search-index {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.index-view-toggle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.index-view-btn {
    border: 1px solid;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sidebar .index-view-btn span {
    display: none;
}

.sidebar.tabs-with-labels .index-view-btn span {
    display: inline;
}

.sidebar.compact-tabs .index-view-btn span {
    display: none;
}

.sidebar.compact-tabs .index-view-btn {
    padding: 6px 7px;
    min-width: 32px;
}

body.light .index-view-btn {
    border-color: var(--light-border);
    color: var(--light-text);
}

body.dark .index-view-btn {
    border-color: var(--dark-border);
    color: #cbd5e1;
}

body.light .index-view-btn.active {
    background-color: #e3f2fd;
    border-color: var(--primary-accent);
    color: var(--primary-accent);
}

body.dark .index-view-btn.active {
    background-color: rgba(30, 41, 59, 0.95);
    border-color: var(--dark-primary-accent);
    color: #7cc4ff;
}

.document-links {
    margin-top: 20px;
    flex-shrink: 0;
}

.external-links {
    margin-top: 20px;
    flex-shrink: 0;
}

.toc h3 {
    margin-bottom: 15px;
    font-size: 14px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.document-links h3 {
    margin-bottom: 12px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.external-links h3 {
    margin-bottom: 12px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#toc-search {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid;
    font-size: 13px;
    flex-shrink: 0;
}

body.light #toc-search {
    border-color: var(--light-border);
    background-color: rgba(255, 255, 255, 0.5);
    color: var(--light-text);
}

body.dark #toc-search {
    border-color: var(--dark-border);
    background-color: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
}

body.dark #toc-search::placeholder {
    color: #94a3b8;
}

#global-search-input {
    width: 100%;
    padding: 8px;
    margin-bottom: 12px;
    border-radius: 4px;
    border: 1px solid;
    font-size: 13px;
}

body.light #global-search-input {
    border-color: var(--light-border);
    background-color: rgba(255, 255, 255, 0.5);
    color: var(--light-text);
}

body.dark #global-search-input {
    border-color: var(--dark-border);
    background-color: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
}

#global-search-results {
    list-style: none;
}

#global-search-doc-results,
#search-indexed-docs {
    list-style: none;
}

.search-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    margin-bottom: 10px;
    opacity: 0.85;
}

.search-group {
    margin-bottom: 12px;
}

.search-group h4 {
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.search-group-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
}

.search-group-toggle i {
    transition: transform 0.2s ease;
}

.search-cached-group.is-collapsed .search-group-toggle i {
    transform: rotate(0deg);
}

.search-cached-group:not(.is-collapsed) .search-group-toggle i {
    transform: rotate(90deg);
}

#toc-list {
    list-style: none;
}

#document-links-list {
    list-style: none;
}

#external-links-list {
    list-style: none;
}

#favorite-headings-list,
#favorite-documents-list,
#favorite-links-list,
#recent-documents-list,
#recent-headings-list {
    list-style: none;
}

.toc li {
    margin-bottom: 4px;
}

.document-links li {
    margin-bottom: 6px;
}

.external-links li {
    margin-bottom: 6px;
}

.favorite-group {
    margin-bottom: 18px;
}

.favorite-group h4 {
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sidebar-footer {
    border-top: 1px solid;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

body.light .sidebar-footer {
    border-color: var(--light-border);
    background-color: rgba(255, 255, 255, 0.45);
}

body.dark .sidebar-footer {
    border-color: var(--dark-border);
    background-color: rgba(15, 23, 42, 0.85);
}

.powered-by {
    font-size: 12px;
    opacity: 0.85;
}

.footer-brand-link {
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

body.light .footer-brand-link {
    color: var(--primary-accent);
}

body.dark .footer-brand-link {
    color: var(--dark-primary-accent);
}

.item-subtitle {
    margin: 2px 10px 0 34px;
    font-size: 11px;
    opacity: 0.7;
    line-height: 1.35;
}

.item-meta {
    margin: 2px 10px 0 34px;
    font-size: 11px;
    opacity: 0.75;
}

.search-snippet {
    margin: 4px 10px 0 34px;
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.4;
}

.search-line {
    margin-bottom: 2px;
}

.search-line:last-child {
    margin-bottom: 0;
}

.search-index mark,
.search-line mark {
    background-color: #ffe96a;
    color: #111827;
    border-radius: 2px;
    padding: 0 2px;
}

.search-target {
    outline: 2px solid #ffe96a;
    border-radius: 4px;
    transition: outline-color 0.2s ease;
}

.search-hit-count {
    margin-left: auto;
    font-size: 10px;
    border: 1px solid;
    border-radius: 999px;
    padding: 1px 7px;
    opacity: 0.75;
}

body.light .search-hit-count {
    border-color: var(--light-border);
    color: var(--primary-accent);
}

body.dark .search-hit-count {
    border-color: var(--dark-border);
    color: #7cc4ff;
}

body.dark .favorite-group h4 {
    color: #94a3b8;
}

body.dark .search-group h4 {
    color: #94a3b8;
}

body.light .search-group-toggle {
    color: #334155;
}

body.dark .search-group-toggle {
    color: #94a3b8;
}

.toc a {
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    display: block;
    transition: all 0.2s;
    font-size: 13px;
    border-left: 3px solid transparent;
}

.document-links a {
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    display: block;
    transition: all 0.2s;
    font-size: 13px;
    word-break: break-word;
}

.external-links a {
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    display: block;
    transition: all 0.2s;
    font-size: 13px;
    word-break: break-word;
}

.favorites-index a {
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    display: block;
    transition: all 0.2s;
    font-size: 13px;
    word-break: break-word;
}

.recent-index a {
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    display: block;
    transition: all 0.2s;
    font-size: 13px;
    word-break: break-word;
}

.search-index a {
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    display: block;
    transition: all 0.2s;
    font-size: 13px;
    word-break: break-word;
}

.index-item {
    width: 100%;
}

.index-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.index-item-row > a {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.favorite-toggle {
    width: 24px;
    height: 24px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.favorite-toggle.active {
    color: #f59e0b;
    opacity: 1;
    pointer-events: auto;
}

body.dark .favorite-toggle {
    color: #64748b;
}

body.dark .favorite-toggle.active {
    color: #fbbf24;
}

.favorite-toggle:hover {
    border-color: rgba(148, 163, 184, 0.35);
}

.index-item-row:hover .favorite-toggle,
.index-item-row:focus-within .favorite-toggle,
.index-item:focus-within .favorite-toggle {
    opacity: 1;
    pointer-events: auto;
}

.doc-progress {
    margin: 4px 10px 0 34px;
    height: 4px;
    border-radius: 999px;
    overflow: hidden;
    background-color: rgba(148, 163, 184, 0.2);
}

.doc-progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    background-color: var(--primary-accent);
}

body.dark .doc-progress-fill {
    background-color: var(--dark-primary-accent);
}

body.light .toc a {
    color: var(--light-text);
}

body.light .document-links a {
    color: var(--light-text);
}

body.light .external-links a {
    color: var(--light-text);
}

body.light .favorites-index a {
    color: var(--light-text);
}

body.light .recent-index a {
    color: var(--light-text);
}

body.light .search-index a {
    color: var(--light-text);
}

body.dark .toc a {
    color: #cbd5e1;
}

body.dark .document-links a {
    color: #cbd5e1;
    background-color: transparent;
}

body.dark .external-links a {
    color: #cbd5e1;
    background-color: transparent;
}

body.dark .favorites-index a {
    color: #cbd5e1;
    background-color: transparent;
}

body.dark .recent-index a {
    color: #cbd5e1;
    background-color: transparent;
}

body.dark .search-index a {
    color: #cbd5e1;
    background-color: transparent;
}

body.light .toc a.active,
body.light .toc a:hover {
    background-color: #e3f2fd;
    color: var(--primary-accent);
    border-left-color: var(--primary-accent);
}

body.light .document-links a:hover {
    background-color: #e3f2fd;
    color: var(--primary-accent);
}

body.light .external-links a:hover {
    background-color: #e3f2fd;
    color: var(--primary-accent);
}

body.light .favorites-index a:hover {
    background-color: #e3f2fd;
    color: var(--primary-accent);
}

body.light .recent-index a:hover {
    background-color: #e3f2fd;
    color: var(--primary-accent);
}

body.light .search-index a:hover {
    background-color: #e3f2fd;
    color: var(--primary-accent);
}

body.dark .toc a.active,
body.dark .toc a:hover {
    background-color: rgba(30, 41, 59, 0.95);
    color: #7cc4ff;
    border-left-color: var(--dark-primary-accent);
}

body.dark .document-links a:hover {
    background-color: rgba(30, 41, 59, 0.95);
    color: #7cc4ff;
}

body.dark .external-links a:hover {
    background-color: rgba(30, 41, 59, 0.95);
    color: #7cc4ff;
}

body.dark .favorites-index a:hover {
    background-color: rgba(30, 41, 59, 0.95);
    color: #7cc4ff;
}

body.dark .recent-index a:hover {
    background-color: rgba(30, 41, 59, 0.95);
    color: #7cc4ff;
}

body.dark .search-index a:hover {
    background-color: rgba(30, 41, 59, 0.95);
    color: #7cc4ff;
}

body.dark .file-info .breadcrumb {
    color: #94a3b8;
}

body.dark .settings-panel {
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
}

.toc .h1 {
    padding-left: 10px;
    font-weight: 600;
}

.toc .h2 {
    padding-left: 20px;
}

.toc .h3 {
    padding-left: 30px;
}

.toc .h4 {
    padding-left: 40px;
}

.toc .h5 {
    padding-left: 50px;
}

.toc .h6 {
    padding-left: 60px;
}

.markdown-content {
    max-width: var(--content-width);
    margin: 0 auto;
    transition: max-width 0.3s ease-in-out;
}

body.light .markdown-content {
    color: var(--light-text);
}

body.dark .markdown-content {
    color: var(--dark-text);
}

.main-content.welcome-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-container {
    text-align: center;
    max-width: 500px;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid;
}

body.light .loading-container {
    background-color: var(--light-sidebar-bg);
    border-color: var(--light-border);
}

body.dark .loading-container {
    background-color: var(--dark-sidebar-bg);
    border-color: var(--dark-border);
}

.loading-container p {
    margin-bottom: 1.2em;
    line-height: 1.6;
}

.loading-container a {
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dashed;
}

body.light .loading-container a {
    color: var(--primary-accent);
}

body.dark .loading-container a {
    color: var(--dark-primary-accent);
}

.loading-container a:hover {
    text-decoration: none;
    border-bottom-style: solid;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content pre {
    margin-bottom: 1.5em;
}

body.dark .markdown-content p,
body.dark .markdown-content ul,
body.dark .markdown-content ol,
body.dark .markdown-content li,
body.dark .markdown-content blockquote,
body.dark .markdown-content table,
body.dark .markdown-content td,
body.dark .markdown-content th {
    color: var(--dark-text);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    scroll-margin-top: 20px;
    margin-bottom: 0.8em;
}

.markdown-content h1 {
    margin-top: 0;
}

.markdown-content h2 {
    margin-top: 2.5em;
}

.markdown-content h3 {
    margin-top: 2em;
}

.sidebar-resizer {
    position: absolute;
    right: -2.5px;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: ew-resize;
    z-index: 10;
}

.drop-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: rgba(0, 123, 255, 0.1);
    border: 3px dashed var(--primary-accent);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary-accent);
}

.drop-zone.visible {
    display: flex;
}

@media (max-width: 768px) {
    #markdown-reader-container {
        flex-direction: column;
    }

    .main-content {
        width: 100%;
    }

    .sidebar-toggle {
        display: flex !important;
    }

    .sidebar {
        position: fixed;
        z-index: 999;
        width: 90% !important;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.collapsed {
        margin-left: -90%;
    }

    #setting-content-width,
    #setting-sidebar-width {
        display: none;
    }

    .favorite-toggle {
        opacity: 1;
        pointer-events: auto;
    }

}

.markdown-content h1 {
    font-size: 2.5em;
    border-bottom: 1px solid;
    padding-bottom: 0.3em;
}

body.light .markdown-content h1 {
    border-color: var(--light-border);
}

body.dark .markdown-content h1 {
    border-color: var(--dark-border);
}

.markdown-content h2 {
    font-size: 2em;
    border-bottom: 1px solid;
    padding-bottom: 0.3em;
}

body.light .markdown-content h2 {
    border-color: var(--light-border);
}

body.dark .markdown-content h2 {
    border-color: var(--dark-border);
}

.markdown-content h3 {
    font-size: 1.5em;
}

body.dark .markdown-content h1,
body.dark .markdown-content h2,
body.dark .markdown-content h3,
body.dark .markdown-content h4,
body.dark .markdown-content h5,
body.dark .markdown-content h6 {
    color: #f8fafc;
}

.markdown-content pre {
    position: relative;
    padding: 1em;
    border-radius: 6px;
}

body.light .markdown-content pre {
    background-color: var(--light-code-bg);
}

body.dark .markdown-content pre {
    background-color: var(--dark-code-bg);
}

.markdown-content a {
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

body.dark .markdown-content a {
    color: #7cc4ff;
}

body.dark .markdown-content a:hover {
    color: #a5d8ff;
}

.markdown-content blockquote {
    padding-left: 1rem;
    border-left: 4px solid;
}

body.light .markdown-content blockquote {
    border-left-color: var(--light-border);
}

body.dark .markdown-content blockquote {
    border-left-color: var(--dark-border);
    color: #cbd5e1;
}

.markdown-content :not(pre) > code {
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.92em;
}

body.light .markdown-content :not(pre) > code {
    background-color: var(--light-code-bg);
    color: #1f2937;
}

body.dark .markdown-content :not(pre) > code {
    background-color: rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
}


.copy-code-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.markdown-content pre:hover .copy-code-button {
    opacity: 1;
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    transition: opacity 0.3s, visibility 0.3s;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

body.light .back-to-top {
    background-color: var(--primary-accent);
    color: var(--primary-accent-hover);
}

body.dark .back-to-top {
    background-color: var(--dark-primary-accent);
    color: var(--dark-primary-accent-hover);
}

.progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-accent);
    z-index: 1001;
}

body.dark .progress-indicator {
    background: var(--dark-primary-accent);
}

/* v3.2.0 immersive reader controls */
.reader-fullscreen-toggle {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    right: 18px;
    z-index: 1001;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    transition: opacity .2s, transform .2s, background-color .2s;
}

body.light .reader-fullscreen-toggle {
    background: rgba(255, 255, 255, .94);
    border-color: var(--light-border);
    color: var(--primary-accent);
    box-shadow: 0 5px 18px rgba(15, 23, 42, .12);
}

body.dark .reader-fullscreen-toggle {
    background: rgba(45, 45, 45, .94);
    border-color: var(--dark-border);
    color: var(--dark-primary-accent);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .24);
}

.reader-fullscreen-toggle:hover,
.reader-fullscreen-toggle:focus-visible,
.reader-fullscreen-toggle.active {
    transform: translateY(-1px);
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

body.reader-fullscreen .sidebar,
body.reader-fullscreen .open-sidebar-btn {
    display: none !important;
}

body.reader-fullscreen .main-content {
    width: 100% !important;
    padding: clamp(40px, 7vw, 96px) clamp(20px, 8vw, 140px);
}

@media (max-width: 768px) {
    .reader-fullscreen-toggle {
        top: max(12px, env(safe-area-inset-top));
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .main-content {
        padding: 28px 18px 48px;
    }

    body.reader-fullscreen .main-content {
        padding: 48px 18px 56px;
    }
}

/* --- HR Spacing and Style --- */
.markdown-content hr {
    border: 0;
    height: 1px;
    margin: 3.5em 0;
}

body.light .markdown-content hr {
    background-color: var(--light-border);
}

body.dark .markdown-content hr {
    background-color: var(--dark-border);
}




pre code.hljs {
    display: block;
    overflow-x: auto;
    padding: 1em
}

code.hljs {
    padding: 3px 5px
}

/*!
  Theme: GitHub
  Description: Light theme as seen on github.com
  Author: github.com
  Maintainer: @Hirse
  Updated: 2021-05-15

  Outdated base version: https://github.com/primer/github-syntax-light
  Current colors taken from GitHub's CSS
*/
.hljs {
    color: #24292e;
    background: #fff
}

.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
    color: #d73a49
}

.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
    color: #6f42c1
}

.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id,
.hljs-variable {
    color: #005cc5
}

.hljs-meta .hljs-string,
.hljs-regexp,
.hljs-string {
    color: #032f62
}

.hljs-built_in,
.hljs-symbol {
    color: #e36209
}

.hljs-code,
.hljs-comment,
.hljs-formula {
    color: #6a737d
}

.hljs-name,
.hljs-quote,
.hljs-selector-pseudo,
.hljs-selector-tag {
    color: #22863a
}

.hljs-subst {
    color: #24292e
}

.hljs-section {
    color: #005cc5;
    font-weight: 700
}

.hljs-bullet {
    color: #735c0f
}

.hljs-emphasis {
    color: #24292e;
    font-style: italic
}

.hljs-strong {
    color: #24292e;
    font-weight: 700
}

.hljs-addition {
    color: #22863a;
    background-color: #f0fff4
}

.hljs-deletion {
    color: #b31d28;
    background-color: #ffeef0
}

/* Auto-detection specific styles */
.quick-links h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.file-count {
    font-size: 11px;
    opacity: 0.7;
    margin-left: 5px;
}

.refresh-btn {
    background: none;
    border: 1px solid;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    margin-left: 10px;
}

body.light .refresh-btn {
    border-color: #007bff;
    color: #007bff;
}

body.dark .refresh-btn {
    border-color: #4dabf7;
    color: #4dabf7;
}

.refresh-btn:hover {
    transform: rotate(90deg);
}

.welcome-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

.welcome-container p {
    margin-bottom: 1.5em;
    line-height: 1.7;
}

.welcome-container code {
    background-color: rgba(0, 123, 255, 0.1);
    color: #007bff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

body.dark .welcome-container code {
    background-color: rgba(77, 171, 247, 0.2);
    color: #4dabf7;
}
