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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
}

/* Общие стили для кнопок */
.sidebar-open-btn,
.sidebar-close-btn {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-open-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    padding: 10px;
    width: 40px;
    height: 40px;
}

.sidebar-open-btn:hover {
    background: #1c2128;
    border-color: #58a6ff;
}

.sidebar-close-btn {
    background: rgba(101, 109, 118, 0.1);
    border-color: rgba(101, 109, 118, 0.3);
    color: #8b949e;
    padding: 6px;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar-close-btn:hover {
    background: rgba(101, 109, 118, 0.2);
    border-color: rgba(101, 109, 118, 0.5);
    color: #c9d1d9;
}

/* Хамбургер меню */
.hamburger {
    display: flex;
    flex-direction: column;
    width: 20px;
    height: 16px;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #c9d1d9;
    border-radius: 1px;
    transition: all 0.3s ease;
}

/* Основной контейнер и сайдбар */
.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 350px;
    background: #161b22;
    border-right: 1px solid #30363d;
    padding: 20px;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

/* Заголовок сайдбара */
.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid #30363d;
    padding-bottom: 16px;
    margin-bottom: 10px;
    gap: 15px;
}

.header-content {
    flex: 1;
    min-width: 0;
}

/* Контент и разметка */
.content {
    flex: 1;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.markdown-body {
    background-color: #0d1117;
    color: #c9d1d9;
    box-sizing: border-box;
    min-width: 200px;
    margin: 0 auto;
    padding: 45px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Древовидное меню */
.file-tree {
    list-style: none;
    margin-top: 15px;
    flex: 1;
    overflow-y: auto;
}

.file-tree ul {
    list-style: none;
    padding-left: 10px;
}

.tree-item {
    padding: 4px 3px;
    margin: 2px 0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    color: #c9d1d9;
    user-select: none;
}

.tree-item:hover {
    background-color: #1c2128;
}

.tree-item.active {
    background-color: #1c6b48;
    color: white;
}

.tree-item.folder {
    font-weight: 600;
}

.tree-children {
    margin-left: 11px;
    border-left: 1px solid #30363d;
    padding-left: 8px;
}

/* Состояния и утилиты */
.loading {
    color: #8b949e;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

.error {
    color: #f85149;
    padding: 16px;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.4);
    border-radius: 6px;
    margin: 16px 0;
}

#repoTitle {
    font-size: 1.5em;
    margin-bottom: 5px;
    word-wrap: break-word;
}

#repoSubtitle {
    color: #8b949e;
    font-size: 14px;
    line-height: 1.4;
}

/* Блок контактов */
.contacts-section {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #30363d;
}

.contacts-header {
    font-size: 14px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contacts-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-button {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.contact-button:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.contact-button.telegram {
    background: rgba(0, 136, 204, 0.1);
    border-color: rgba(0, 136, 204, 0.3);
    color: #58a6ff;
}

.contact-button.telegram:hover {
    background: rgba(0, 136, 204, 0.2);
    border-color: rgba(0, 136, 204, 0.5);
}

.contact-button.github {
    background: rgba(101, 109, 118, 0.1);
    border-color: rgba(101, 109, 118, 0.3);
    color: #c9d1d9;
}

.contact-button.github:hover {
    background: rgba(101, 109, 118, 0.2);
    border-color: rgba(101, 109, 118, 0.5);
}

.contact-icon {
    font-size: 16px;
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.contact-text {
    flex: 1;
}

/* Оверлей */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Ссылки и индикаторы */
.md-link {
    color: #58a6ff;
    text-decoration: none;
    cursor: pointer;
}

.md-link:hover {
    text-decoration: underline;
}

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #8b949e;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alert-блоки */
.markdown-alert {
    padding: 12px 16px;
    margin: 1em 0;
    border-left: 4px solid;
    font-size: 14px;
    line-height: 1.5;
}

.markdown-alert-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    gap: 6px;
    margin-bottom: 8px;
}

.markdown-alert-title svg {
    fill: currentColor;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Типы alert-блоков */
.markdown-alert-note {
    border-left-color: #0078ff;
    background-color: rgba(0, 120, 255, 0.1);
}
.markdown-alert-note .markdown-alert-title {
    color: #0078ff;
}

.markdown-alert-tip {
    border-left-color: #00a23a;
    background-color: rgba(0, 162, 58, 0.1);
}
.markdown-alert-tip .markdown-alert-title {
    color: #00a23a;
}

.markdown-alert-important {
    border-left-color: #b04bff;
    background-color: rgba(176, 75, 255, 0.1);
}
.markdown-alert-important .markdown-alert-title {
    color: #b04bff;
}

.markdown-alert-warning {
    border-left-color: #d29922;
    background-color: rgba(210, 153, 34, 0.1);
}
.markdown-alert-warning .markdown-alert-title {
    color: #d29922;
}

.markdown-alert-caution {
    border-left-color: #da3633;
    background-color: rgba(218, 54, 51, 0.1);
}
.markdown-alert-caution .markdown-alert-title {
    color: #da3633;
}

/* Убираем стандартный блок quote для alert-блоков */
.markdown-body blockquote:has(.markdown-alert) {
    border-left: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    background: transparent !important;
}

.markdown-alert p {
    margin: 8px 0;
    line-height: 1.5;
}

.markdown-alert p:first-child {
    margin-top: 0;
}

.markdown-alert p:last-child {
    margin-bottom: 0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar-open-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        transform: translateX(-100%);
        width: 300px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar:not(.hidden) {
        transform: translateX(0);
    }

    .markdown-body {
        padding: 60px 20px 20px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-close-btn {
        display: flex;
    }
}

@media (min-width: 1000px) {
    .sidebar-open-btn {
        display: none;
    }

    .sidebar-close-btn {
        display: flex;
    }
    
    .markdown-body {
        max-width: 1200px;
        padding: 45px 100px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .sidebar:not(.hidden) + .content .markdown-body {
        transform: translateX(0);
    }
    
    .sidebar.hidden + .content .markdown-body {
        transform: translateX(-100px);
    }
    
    .sidebar.hidden + .content .sidebar-open-btn {
        display: flex;
        animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(-10px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

html {
	scroll-behavior: smooth;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    position: relative;
}

.anchor-link {
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    opacity: 0;
    cursor: pointer;
    fill: #8b949e;
    transition: opacity 0.2s ease, fill 0.2s ease;
}

.markdown-body h1:hover .anchor-link,
.markdown-body h2:hover .anchor-link,
.markdown-body h3:hover .anchor-link,
.markdown-body h4:hover .anchor-link,
.markdown-body h5:hover .anchor-link,
.markdown-body h6:hover .anchor-link {
    opacity: 1;
}

.anchor-link.copied {
    fill: #58a6ff;
}

/* Супер-компактная версия */
.snowflakes {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 44;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    color: white;
    font-size: 1.5em;
    top: -50px;
    text-shadow: 0 0 5px white;
    animation: snowfall linear infinite;
}

@keyframes snowfall {
    0% {
        transform: translateY(-50px) translateX(0px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    100% {
        transform: 
            translateY(100vh) 
            translateX(calc(50px * sin(360deg)))
            rotate(360deg);
        opacity: 0;
    }
}