/* Общие стили сайта: фон, шрифт, мягкие пятна, футер */

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #F2F3F5;
    color: #16161D;
    overflow-x: hidden;
}

/* Мягкие цветные пятна на фоне: сквозь стеклянные плашки они дают нежный оттенок */
body::before, body::after {
    content: "";
    position: fixed;
    z-index: -1;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}
body::before { top: 22%; left: 18%; background: rgba(198, 19, 243, .30); }
body::after  { top: 34%; right: 16%; background: rgba(0, 118, 255, .28); }

main {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

h1 { line-height: 1.2; }

/* Шапка: «назад» слева и вкладки справа в одну строку; на телефоне вкладки сверху, «назад» под ними */
.topbar {
    width: 100%;
    max-width: 760px;
    margin: 0 auto 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
}
.back {
    order: -1;
    font-size: 15px;
    color: #6B3DF5;
    text-decoration: none;
}
.back:hover { color: #C613F3; text-decoration: underline; text-underline-offset: 3px; }

.topnav {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.topnav a, .topnav .active {
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background .15s, color .15s, box-shadow .15s;
}
.topnav a { color: #4B2FC4; background: rgba(103, 80, 245, .10); }
.topnav a:hover { color: #3F25B8; background: rgba(103, 80, 245, .20); }
.topnav .active {
    color: #fff;
    font-weight: 700;
    background: #6750F5;
    box-shadow: 0 6px 16px rgba(103, 80, 245, .35);
}

footer {
    padding-top: 24px;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(22, 22, 29, .65);
}
footer a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
footer a:hover { color: #000; }
footer .sep { margin: 0 8px; opacity: .6; }

/* Мобильный вид: каждая ссылка футера с новой строки */
@media (max-width: 640px) {
    /* На телефоне вкладки встают друг под другом на всю ширину */
    .topnav { width: 100%; flex-direction: column; gap: 8px; }
    .topnav { margin-left: 0; }
    .topbar { flex-direction: column; align-items: stretch; }
    .back { order: 1; }
    .topnav a, .topnav .active { display: block; padding: 12px 18px; text-align: center; }
    footer .links { display: flex; flex-direction: column; align-items: center; gap: 6px; }
    footer .sep { display: none; }
}
