:root {
    --bg-0: #0a0a0a;
    --bg-1: #141414;
    --bg-2: #1a1a1a;
    --bg-3: #222222;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f2f2f2;
    --text-muted: #999999;
    --text-dark: #cccccc;
    --accent: #333333;
    --accent-hover: #444444;
    --radius: 16px;
    --shadow: rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial;
    color: var(--text);
    background: var(--bg-0);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: #fff;
    text-decoration: none
}

a:hover {
    opacity: .8
}

/* ===== ЗВЕЗДНЫЙ ФОН ===== */
#stars-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== HEADER ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 60;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    background: rgba(10, 10, 10, 0.85);
    border-bottom: 1px solid var(--border);
}

/* ===== БЕЛАЯ НЕОНОВАЯ ЛИНИЯ ===== */
.header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.8) 20%, 
        #ffffff 50%, 
        rgba(255, 255, 255, 0.8) 80%, 
        rgba(255, 255, 255, 0) 100%
    );
    box-shadow: 
        0 0 20px rgba(255, 255, 255, 0.5),
        0 0 60px rgba(255, 255, 255, 0.2),
        0 0 100px rgba(255, 255, 255, 0.1);
}

/* ===== НЕОНОВОЕ СВЕЧЕНИЕ ПОД ЛИНИЕЙ ===== */
.header::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -20px;
    height: 40px;
    background: radial-gradient(ellipse at center, 
        rgba(255, 255, 255, 0.15) 0%, 
        rgba(255, 255, 255, 0.05) 40%,
        rgba(255, 255, 255, 0) 70%
    );
    filter: blur(10px);
    pointer-events: none;
}

.header .container {
    width: min(1280px, 96vw);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* ===== ЛОГОТИП ПО ЦЕНТРУ — СВЕТЯЩИЙСЯ ТЕКСТ ===== */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: .4px;
}

.brand a {
    font-size: clamp(16px, 2.5vw, 38px);
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #ffffff 0%, #aaaaaa 50%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 
        0 0 30px rgba(255,255,255,0.3),
        0 0 60px rgba(255,255,255,0.15),
        0 0 100px rgba(255,255,255,0.08);
    animation: brandGlow 3s ease-in-out infinite alternate;
}

@keyframes brandGlow {
    0% {
        text-shadow: 
            0 0 30px rgba(255,255,255,0.3),
            0 0 60px rgba(255,255,255,0.15),
            0 0 100px rgba(255,255,255,0.08);
    }
    100% {
        text-shadow: 
            0 0 40px rgba(255,255,255,0.5),
            0 0 80px rgba(255,255,255,0.25),
            0 0 120px rgba(255,255,255,0.12);
    }
}

.brand .highlight {
    color: #fff;
    -webkit-text-fill-color: #fff;
    background: none;
}

.brand img {
    display: none;
}

/* ===== КНОПКА БУРГЕР ===== */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    cursor: pointer;
    padding: 7px 8px;
    z-index: 100;
    transition: all 0.3s ease;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    width: 100%;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    width: 100%;
}

/* ===== LAYOUT ===== */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    width: min(1280px, 96vw);
    margin: 24px auto;
    position: relative;
    z-index: 1;
}

/* ============================================================
   САЙДБАР — СО СТРЕЛКАМИ И ПОДМЕНЮ
   ============================================================ */
.sidebar {
    position: sticky;
    top: 88px;
    align-self: start;
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: transform 0.3s ease;
}

.side-title {
    font-weight: 800;
    font-size: 14px;
    opacity: .9;
    margin: 4px 0 8px
}

.side-group {
    margin: 4px 0;
}

/* ===== ОСНОВНЫЕ ПУНКТЫ ===== */
.side-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #ddd;
    border: 1px solid transparent;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    font-size: 14px;
}

.side-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
    color: #fff;
}

.side-item.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
}

/* ===== СТРЕЛКА ДЛЯ ПУНКТОВ С ПОДМЕНЮ ===== */
.side-item.has-sub {
    cursor: pointer;
    user-select: none;
}

.side-item.has-sub::after {
    content: "▸";
    position: absolute;
    right: 14px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.25);
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.side-item.has-sub:hover::after {
    color: rgba(255, 255, 255, 0.5);
}

.side-item.has-sub.open::after {
    transform: rotate(90deg);
    color: rgba(255, 255, 255, 0.7);
}

/* ===== ПОДМЕНЮ (сворачиваемое) ===== */
.sub-items {
    margin-left: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1), 
                opacity 0.35s ease, 
                margin 0.3s ease;
    margin-top: 0;
}

.sub-items.open {
    max-height: 500px;
    opacity: 1;
    margin-top: 6px;
}

.sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 16px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    border-left: 2px solid transparent;
    transition: all 0.25s ease;
    cursor: pointer;
}

.sub-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #ddd;
    border-left-color: rgba(255, 255, 255, 0.12);
    padding-left: 20px;
}

.sub-item.active {
    color: #fff;
    border-left-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.04);
}

/* ===== CONTENT ===== */
.content {
    min-height: 60vh
}

.card {
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 16px;
}

.card > img {
    display: block;
    max-width: 420px;
}

@media (max-width: 480px) {
    .card > img {
        width: 100%;
        max-width: 320px;
    }
}

.card > p {
    width: 100%;
    text-align: left;
    margin: 0;
    color: var(--text-muted);
}

.card > ol,
.card > ul {
    align-self: flex-start;
    color: var(--text-muted);
    padding-left: 0;
}

.card hr {
    width: 50%;
    margin: 30px auto;
    border: none;
    font-size: 2px;
    text-align: right;
    overflow: visible;
}

.card hr:after {
    content: '';
    display: block;
    border-top: 1px solid #444;
    margin: 0 3px;
    position: relative;
    top: 1px;
}

.card blockquote {
    font-family: CustomSerif, Georgia, Cambria, 'Times New Roman', serif;
    margin: 12px 21px 0 0;
    padding-left: 15px;
    position: relative;
    font-style: italic;
    word-wrap: break-word;
    border-left: 3px solid #666;
    align-self: flex-start;
    color: var(--text-muted);
}

a.bordered-link {
    color: inherit;
    -webkit-tap-highlight-color: rgba(0, 0, 0, .44);
    text-decoration: none;
    border-bottom: .1em solid rgba(255, 255, 255, 0.3);
}

.bread {
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

h1 {
    margin: 6px 0 12px;
    color: #fff;
}

@media (max-width: 480px) {
    h1 {
        font-size: 20px;
    }
}

h2 {
    margin: 22px 0 8px;
    color: #eee;
}

@media (max-width: 480px) {
    h2 {
        font-size: 18px;
    }
}

p {
    color: var(--text-muted);
    line-height: 1.7;
}

.figure {
    margin: 14px 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    width: 100%;
}

.figure img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block
}

.figcap {
    font-size: 13px;
    color: #888;
    margin-top: 6px
}

/* ===== КНОПКИ ===== */
.nav-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.nav-btn {
    background: #fff;
    color: #000;
    padding: 12px 28px;
    border: 1px solid #333;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #ddd;
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ===== FOOTER ===== */
footer {
    padding: 24px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    text-align: center;
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.container {
    width: min(1280px, 96vw);
    margin: 0 auto;
}

.greyed-text {
    font-size: 15px;
    color: #79828B;
    padding: 12px 21px 0;
    line-height: 18px;
    vertical-align: top;
    text-align: center;
}

/* ===== СПИСКИ ===== */
ul, ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

li {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.5em;
    line-height: 1.4;
    color: var(--text-muted);
}

ul li::before {
    content: "•";
    color: #888;
    font-size: 1.2em;
}

ol {
    counter-reset: item;
}

ol li::before {
    counter-increment: item;
    content: counter(item) ".";
    font-weight: bold;
    color: #888;
}

/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ============================================================ */
@media (max-width: 820px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 16px;
        margin: 16px auto;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        z-index: 60;
        background: linear-gradient(180deg, #0d0d0d 0%, #0a0a0a 100%);
        border-radius: 0;
        border-right: 1px solid rgba(255, 255, 255, 0.06);
        transform: translateX(-110%);
        overflow-y: auto;
        padding: 24px 16px 40px;
        transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.6);
    }

    .sidebar::-webkit-scrollbar {
        width: 3px;
    }
    .sidebar::-webkit-scrollbar-track {
        background: transparent;
    }
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 10px;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar::before {
        content: "📂 Меню";
        display: block;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: rgba(255, 255, 255, 0.25);
        padding: 0 12px 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        margin-bottom: 8px;
    }

    .side-item {
        padding: 12px 14px;
        font-size: 15px;
    }

    .sub-item {
        padding: 10px 12px 10px 18px;
        font-size: 14px;
    }

    .side-group {
        margin: 4px 0;
    }

    .sub-items {
        margin-left: 16px;
    }

    .sidebar.mobile-open .side-item {
        animation: slideIn 0.4s ease forwards;
        opacity: 0;
    }

    .sidebar.mobile-open .side-group:nth-child(1) .side-item { animation-delay: 0.05s; }
    .sidebar.mobile-open .side-group:nth-child(2) .side-item { animation-delay: 0.10s; }
    .sidebar.mobile-open .side-group:nth-child(3) .side-item { animation-delay: 0.15s; }
    .sidebar.mobile-open .side-group:nth-child(4) .side-item { animation-delay: 0.20s; }
    .sidebar.mobile-open .side-group:nth-child(5) .side-item { animation-delay: 0.25s; }
    .sidebar.mobile-open .side-group:nth-child(6) .side-item { animation-delay: 0.30s; }

    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(-20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    .brand a {
        font-size: clamp(14px, 3.5vw, 20px);
        letter-spacing: 1px;
    }

    .brand .highlight {
        font-size: clamp(14px, 3.5vw, 20px);
    }

    .header {
        height: 60px;
    }
}

/* ===== ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ ===== */
@media (max-width: 400px) {
    .sidebar {
        width: 280px;
        padding: 16px 12px 30px;
    }
    .side-item {
        font-size: 14px;
        padding: 10px 12px;
    }
    .sub-item {
        font-size: 13px;
        padding: 8px 12px 8px 16px;
    }
    h1 {
        font-size: 20px;
    }
    h2 {
        font-size: 17px;
    }
    .brand a {
        font-size: 12px;
    }
    .brand .highlight {
        font-size: 12px;
    }
}