body {
    background-color: rgb(0, 0, 0);
    color: white;
    margin-top: 32px;
    font-family: 'MyCustomFont', sans-serif;
    position: relative;
}

/* Анимированный гиф-фон */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('spaceanime.gif');
    background-size: 304px auto;
    background-repeat: repeat;
    background-position: 0 0;
    animation: backgroundScroll 20s linear infinite;
    z-index: -1;
}

@keyframes backgroundScroll {
    from { background-position: 0 0; }
    to { background-position: -608px 0; }
}

img {
    display: block;
    margin: 0 auto;
}

.button {
    color: white;
    text-decoration: none;
    margin: 0 5px;
}

p, h1 {
    text-align: center;
}

.linkbar {
    text-align: center;
    display: block;
    position: relative;
}

.button-collection {
    margin: 20px 0;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.button-collection::-webkit-scrollbar {
    display: none;
}

.button-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0;
    padding: 0;
    margin: 5px;
}

.button-row img {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    height: 32px;
    width: auto;
    transition: transform 0.2s;
    image-rendering: crisp-edges;
}

.button-row img:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 3px white);
}

/* ===== СТИЛИ БОКОВОЙ НАВИГАЦИИ (БЕЗ ТАБЛИЦ) ===== */
.side-nav-retro {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 220px;
    background-color: #111111;
    padding: 20px 15px;
    box-sizing: border-box;
    font-family: 'PixeloidMono', monospace, sans-serif;
    overflow-y: auto;
    z-index: 1000;
}

.side-nav-retro .section-title {
    color: #ffffff;
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 6px;
}

/* Списки навигации */
.side-nav-retro .nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.side-nav-retro .nav-list li {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    font-size: 14px;
}

.side-nav-retro .symbol {
    width: 18px;
    color: #ffffff;
    font-weight: bold;
    display: inline-block;
}

.side-nav-retro a {
    color: #c800ff;
    text-decoration: none;
}

.side-nav-retro a:hover {
    color: #9900ff;
    text-decoration: underline;
}

.side-nav-retro .section-divider {
    border-bottom: 1px dotted #444444;
    margin: 12px 0;
}

@font-face {
    font-family: 'MyCustomFont';
    src: url('PixeloidMono.woff2') format('woff2'),
         url('PixeloidMono.woff') format('woff');
}

/* ===== СТИЛИ ДЛЯ MARKDOWN КОНТЕНТА ===== */
#content {
    margin-left: 240px; /* Отступ под левую навигацию nav.js */
    padding: 20px 40px;
    box-sizing: border-box;
}

/* Единый контейнер для Markdown, который стоит по центру рабочей области */
.md-wrapper {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

/* Безопасная очистка обтекания строго в конце контейнера */
.md-wrapper::after {
    content: "";
    display: table;
    clear: both;
}

/* Выравнивание текста и блоков внутри обертки */
.md-wrapper p,
.md-wrapper h1,
.md-wrapper h2,
.md-wrapper h3,
.md-wrapper h4,
.md-wrapper h5,
.md-wrapper h6 {
    text-align: left !important;
    margin-top: 0;
    clear: none !important; /* Разрешает заголовкам быть рядом с картинкой */
}

.md-wrapper ul,
.md-wrapper ol {
    padding-left: 20px;
}

/* Картинка-аватар прижимается к правому краю ТЕКСТОВОЙ КОЛОНКИ (800px) */
.md-wrapper img[align="right"] {
    float: right;
    margin: 0 0 15px 20px;
    display: block;
}

/* Горизонтальная линия НЕ сбрасывает обтекание аватарки */
.md-wrapper hr {
    clear: none !important;
    border: none;
    border-bottom: 1px dotted #444;
    margin: 15px 0;
}

.md-wrapper a {
    color: #c800ff;
    text-decoration: none;
}

.md-wrapper a:hover {
    color: #9900ff;
    text-decoration: underline;
}

.md-wrapper strong {
    color: #ffffff;
    font-weight: bold;
}

/* Таблицы в Markdown (на странице cd.html) */
.md-wrapper table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    clear: both; /* Таблицы всегда спускаются ниже аватарки */
}

.md-wrapper th, 
.md-wrapper td {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.md-wrapper th {
    background-color: rgba(255, 255, 255, 0.1);
}

.md-wrapper table thead {
    display: none;
}

.md-wrapper table img {
    width: 120px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.md-wrapper table td:first-child,
.md-wrapper table th:first-child {
    width: 130px;
    text-align: center;
}

/* ===== СПЕЦИАЛЬНЫЙ КЛАСС ДЛЯ ГЛАВНОЙ СТРАНИЦЫ (INDEX) ===== */
#content.is-index {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100%;
    text-align: center !important;
}

#content.is-index p, 
#content.is-index h1 {
    text-align: center !important;
}

/* Выравнивание кнопки снизу слева */
.side-nav-retro .nav-button {
    margin-top: 15px;
    text-align: left;
}

.side-nav-retro .nav-button img {
    display: block;
    margin-left: -5px; /* Регулируйте число, чтобы сдвинуть еще левее */
    width: 88px;
    height: 31px;
    image-rendering: pixelated;
}