* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
    scroll-behavior: smooth;
}

.dark body {
    background: #0a0a0a;
}

body {
    background: #ffffff;
}

.dark ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

.dark ::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #444;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark .prose {
    color: #e5e5e5;
}

.dark .prose h1 {
    color: #fff;
}

.dark .prose h2 {
    color: #fff;
    border-color: #262626;
}

.dark .prose h3,
.dark .prose h4 {
    color: #fafafa;
}

.dark .prose p,
.dark .prose li {
    color: #a3a3a3;
}

.dark .prose a {
    color: #10b981;
}

.dark .prose a:hover {
    color: #34d399;
}

.dark .prose strong {
    color: #fafafa;
}

.dark .prose code:not(pre code) {
    background: #262626;
    color: #10b981;
}

.dark .prose pre {
    background: #171717;
    border-color: #262626;
}

.dark .prose pre code {
    color: #d4d4d4;
}

.dark .prose blockquote {
    background: #171717;
    border-color: #10b981;
}

.dark .prose blockquote p {
    color: #a3a3a3;
}

.dark .prose th {
    color: #fafafa;
    background: #171717;
}

.dark .prose td {
    color: #a3a3a3;
}

.dark .prose th,
.dark .prose td {
    border-color: #262626;
}

.dark .prose tr:hover td {
    background: #171717;
}

.dark .prose img {
    border-color: #262626;
}

.dark .prose hr {
    border-color: #262626;
}

.dark .prose li::marker {
    color: #525252;
}

.prose {
    max-width: none;
    color: #374151;
}

.prose h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: #111827;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.prose h2 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #1f2937;
    letter-spacing: -0.02em;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.prose h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

.prose h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.375rem;
    color: #4b5563;
}

@media (min-width: 768px) {
    .prose h1 {
        font-size: 2.5rem;
        margin-bottom: 1.5rem;
    }

    .prose h2 {
        font-size: 1.75rem;
        margin-top: 3rem;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .prose h3 {
        font-size: 1.25rem;
        margin-top: 2rem;
        margin-bottom: 0.75rem;
    }

    .prose h4 {
        font-size: 1.125rem;
        margin-top: 1.5rem;
        margin-bottom: 0.5rem;
    }
}

.prose p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    font-size: 0.9375rem;
}

.prose ul,
.prose ol {
    margin-bottom: 1.25rem;
    padding-left: 1.25rem;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
    font-size: 0.9375rem;
}

.prose li::marker {
    color: #9ca3af;
}

.prose a {
    color: #059669;
    text-decoration: none;
    transition: color 0.15s;
}

.prose a:hover {
    color: #10b981;
}

.prose strong {
    color: #111827;
    font-weight: 600;
}

.prose code:not(pre code) {
    background: #f3f4f6;
    color: #059669;
    padding: 0.2rem 0.4rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.prose pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.875rem;
    overflow-x: auto;
    margin: 1rem 0;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .prose pre {
        border-radius: 0.75rem;
        padding: 1.25rem;
        margin: 1.5rem 0;
    }
}

.prose pre code {
    background: transparent;
    padding: 0;
    color: #334155;
    font-size: 0.875rem;
    line-height: 1.7;
}

.prose blockquote {
    border-left: 3px solid #10b981;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    background: #f0fdf4;
    border-radius: 0 0.5rem 0.5rem 0;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.8125rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .prose table {
        display: table;
        margin: 1.5rem 0;
        font-size: 0.9375rem;
    }
}

.prose th,
.prose td {
    padding: 0.5rem 0.625rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

@media (min-width: 768px) {

    .prose th,
    .prose td {
        padding: 0.875rem 1rem;
        white-space: normal;
    }
}

.prose th {
    color: #111827;
    font-weight: 600;
    background: #f9fafb;
}

.prose td {
    color: #4b5563;
}

.prose tr:hover td {
    background: #f9fafb;
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
    border: 1px solid #e5e7eb;
}

.prose hr {
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 2.5rem 0;
}

.sidebar-group {
    margin-top: 1.5rem;
}

.sidebar-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 0.65rem 0.75rem 0.35rem;
    margin-top: 1.2rem;
    color: #0f172a;
}

.sidebar-level-1 .sidebar-title {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: none;
    color: #475569;
}

.sidebar-level-2 .sidebar-title {
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    text-transform: none;
    color: #94a3b8;
}

.sidebar-children {
    font-size: 0.72rem;
}

.sidebar-title:first-child {
    margin-top: 0;
}

.dark .sidebar-title {
    color: #d4d4d8;
}

.dark .sidebar-level-1 .sidebar-title {
    color: #a5b4fc;
}

.dark .sidebar-level-2 .sidebar-title {
    color: #94a3b8;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    transition: all 0.15s;
    margin-bottom: 2px;
    font-weight: 500;
    color: #4b4b4bff;
}

.sidebar-level-1 .sidebar-link {
    font-size: 0.8rem;
    color: #334155;
    font-weight: 500;
}

.sidebar-level-2 .sidebar-link {
    font-size: 0.75rem;
    color: #475569;
    font-weight: 500;
}

.dark .sidebar-link {
    color: #cbd5f5;
}

.dark .sidebar-level-1 .sidebar-link {
    color: #e0e7ff;
}

.dark .sidebar-level-2 .sidebar-link {
    color: #bac1d7;
}

.dark .sidebar-link:hover {
    background: #1a1a1a;
    color: #e5e5e5;
}

.sidebar-link:hover {
    background: #f1f5f9;
    color: #172033;
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    color: #0f9f6e;
    font-weight: 600;
}

.dark .sidebar-link.active {
    color: #34d399;
}

.dark .search-box {
    background: #171717;
    border-color: #262626;
}

.search-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.search-box:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.toc-link {
    display: block;
    padding: 0.25rem 0;
    font-size: 0.8125rem;
    transition: color 0.15s;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    margin-left: -2px;
}

.dark .toc-link {
    color: #737373;
}

.toc-link {
    color: #64748b;
}

.dark .toc-link:hover {
    color: #e5e5e5;
}

.toc-link:hover {
    color: #1e293b;
}

.toc-link.active {
    color: #10b981;
    border-color: #10b981;
}

.toc-link.toc-h3 {
    padding-left: 1.5rem;
}

.back-to-top {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

@media (min-width: 768px) {
    .back-to-top {
        bottom: 2rem;
        right: 2rem;
    }
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1024px) {
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 40;
    }

    .dark .sidebar-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
}

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

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

.animate-fade-in {
    animation: fadeIn 0.2s ease-out;
}

/* Code block copy button styles */
.prose pre {
    position: relative;
}

.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem;
    border-radius: 0.375rem;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prose pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e5e5e5;
}

.code-copy-btn.copied {
    color: #10b981;
    opacity: 1;
}

.dark .code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.code-copy-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.dark .code-copy-btn:hover {
    color: #e5e5e5;
}