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

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --border: #30363d;
    --code-bg: #161b22;
    --sidebar-width: 280px;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eaeef2;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --border: #d0d7de;
    --code-bg: #f6f8fa;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-links {
    margin-left: auto;
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-right: 2rem;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.header-link:hover {
    background: var(--bg-primary);
    color: var(--accent);
    border-color: var(--accent);
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.theme-toggle, .load-btn, .mobile-menu-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.theme-toggle:hover, .load-btn:hover, .mobile-menu-btn:hover {
    background: var(--bg-primary);
}

.container {
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

.sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    width: var(--sidebar-width);
    height: calc(100vh - 60px);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 2rem 0;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav ul li a {
    display: block;
    padding: 0.5rem 2rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar nav ul li a:hover {
    color: var(--accent);
    background: var(--bg-tertiary);
}

.sidebar nav ul li a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--bg-tertiary);
}

.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 3rem;
    max-width: 900px;
}

.content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.content h2 {
    font-size: 2rem;
    margin: 3rem 0 1.5rem 0;
    color: var(--text-primary);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.content h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem 0;
    color: var(--text-primary);
}

.content h4 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
}

.content p {
    margin: 1rem 0;
    color: var(--text-secondary);
}

.content ul, .content ol {
    margin: 1rem 0 1rem 2rem;
    color: var(--text-secondary);
}

.content li {
    margin: 0.5rem 0;
}

.content a {
    color: var(--accent);
    text-decoration: none;
}

.content a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.content code {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: var(--text-primary);
}

.content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    position: relative;
}

.content pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.content th, .content td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.content th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.content td {
    color: var(--text-secondary);
}

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

.content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.code-wrapper {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    z-index: 10;
}

.copy-btn:hover {
    background: var(--accent-hover);
}

.copy-btn.copied {
    background: #3fb950;
}

.mobile-menu-btn {
    display: none;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    margin: 2rem 0;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.upload-area.dragover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

#fileInput {
    display: none;
}

.url-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    z-index: 2000;
    min-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.url-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
}

.url-dialog h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.url-dialog input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.url-dialog-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.url-dialog button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.url-dialog .load-url-btn {
    background: var(--accent);
    color: white;
}

.url-dialog .load-url-btn:hover {
    background: var(--accent-hover);
}

.url-dialog .cancel-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.url-dialog .cancel-btn:hover {
    background: var(--bg-primary);
}

@media (max-width: 768px) {
    .url-dialog {
        min-width: 90%;
        padding: 1.5rem;
    }
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.scroll-top.visible {
    opacity: 1;
}

.scroll-top:hover {
    background: var(--accent-hover);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 999;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .header {
        padding: 0 1rem;
    }

    .header-links {
        display: none;
    }

    .header-links.mobile-show {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 1rem;
        margin: 0;
        z-index: 998;
    }
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}