/* Космический стиль для всех страниц */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Segoe UI", Roboto, sans-serif;
    background: #0a0e27;
    color: #fff;
    overflow-x: hidden;
    position: relative;
}

/* Звездное небо */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Планеты */
.planet {
    position: fixed;
    border-radius: 50%;
    filter: blur(1px);
    animation: float 20s infinite ease-in-out;
    pointer-events: none;
}

.planet-1 {
    width: 150px;
    height: 150px;
    background: radial-gradient(circle at 30% 30%, #ff6b9d, #c44569);
    top: 10%;
    right: 10%;
    animation-delay: 0s;
    z-index: 0;
}

.planet-2 {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at 30% 30%, #4facfe, #00f2fe);
    bottom: 20%;
    left: 5%;
    animation-delay: 5s;
    z-index: 0;
}

.planet-3 {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #feca57, #ff9ff3);
    top: 50%;
    right: 5%;
    animation-delay: 10s;
    z-index: 0;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) translateX(0px); }
    25% { transform: translateY(-20px) translateX(10px); }
    50% { transform: translateY(-30px) translateX(-10px); }
    75% { transform: translateY(-20px) translateX(10px); }
}

/* Контент */
.content {
    position: relative;
    z-index: 1;
}

/* Навигация */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(10, 14, 39, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-nav:hover {
    background: rgba(10, 14, 39, 0.95);
    border-bottom-color: rgba(102, 126, 234, 0.5);
}

.logo {
    font-size: 1.8em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.4s ease;
    cursor: pointer;
}

.logo:hover {
    filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.8));
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 25px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
    transition: left 0.6s ease;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.6);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

/* Контейнер */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Карточки */
.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.05) 0%, transparent 70%);
    animation: rotate 15s linear infinite;
    pointer-events: none;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}

/* Заголовки */
h1, h2, h3 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 2.5em;
    animation: fadeInDown 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

h2 {
    font-size: 2em;
}

h3 {
    font-size: 1.5em;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Кнопки */
.button, .btn, button[type="submit"], input[type="submit"] {
    display: inline-block;
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-weight: bold;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    font-size: 1em;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.button::before, .btn::before, button[type="submit"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
    z-index: -1;
}

.button:hover::before, .btn:hover::before, button[type="submit"]:hover::before {
    left: 100%;
}

.button:hover, .btn:hover, button[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.button:active, .btn:active, button[type="submit"]:active {
    transform: translateY(-1px);
}

/* Формы */
.form-group {
    margin-bottom: 25px;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    transition: color 0.3s ease;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    font-size: 1em;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Таблицы */
table {
    width: 100%;
    border-collapse: collapse;
    position: relative;
    z-index: 1;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

th {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    font-weight: bold;
}

tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

tr:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.01);
}

/* Футер */
footer {
    text-align: center;
    padding: 40px;
    background: rgba(10, 14, 39, 0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(102, 126, 234, 0.3);
    margin-top: 80px;
    position: relative;
    z-index: 1;
}

footer p {
    color: rgba(255, 255, 255, 0.6);
    margin: 10px 0;
    transition: color 0.3s ease;
}

footer a {
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s ease;
}

footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(10, 14, 39, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2em;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: white;
    transform: rotate(90deg);
}

/* Адаптивность */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-link {
        text-align: center;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.5em;
    }

    .card {
        padding: 25px;
    }

    .container {
        padding: 20px 15px;
    }
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 14, 39, 0.5);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Анимация появления элементов */
.fade-in {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Загрузка */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
/* Фикс для мобильных инструкций */
@media screen and (max-width: 768px) {
    /* 1. Делаем контент видимым, если он случайно скрыт */
    .instruction-section, .content, main, article {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 999 !important; /* Поднимаем над звездами */
        padding: 15px !important;
        margin-top: 60px !important; /* Отступ от шапки */
    }

    /* 2. Убираем фиксированную высоту, если она есть */
    section {
        height: auto !important;
        min-height: 100vh;
    }

    /* 3. Убеждаемся, что текст белый (не сливается с фоном) */
    h1, h2, h3, p, li, span {
        color: #ffffff !important;
        font-size: 16px !important; /* Чтобы было читабельно */
    }
}
