/* ===== Космическая тема ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #8b5cf6;
    --primary-dark: #6d28d9;
    --accent: #22d3ee;
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(139, 92, 246, 0.15);
    --shadow-hover: 0 12px 32px rgba(139, 92, 246, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    background: var(--bg);
    color: var(--text);
    position: relative;
    overflow-x: hidden;
}

/* Звёздное небо (фон) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, #fff, transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 160px 120px, #fff, transparent),
        radial-gradient(1px 1px at 230px 80px, #fff, transparent),
        radial-gradient(2px 2px at 300px 150px, #fff, transparent);
    background-size: 350px 350px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

/* ===== Анимации появления ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }
}

/* Применяем анимацию ко всем секциям */
section,
.hero,
.admin-section,
.login-form,
.quiz {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* ===== Шапка ===== */
header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #0e7490 100%);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--accent);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: inline-block;
}

nav a:hover {
    background: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
}

/* ===== Основной контент ===== */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
}

/* ===== Hero (космический) ===== */
.hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #4c1d95 50%, #0e7490 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
    border-radius: var(--radius);
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.hero::before {
    content: '🪐';
    position: absolute;
    top: 10%;
    right: 5%;
    font-size: 4rem;
    animation: float 4s ease-in-out infinite;
    opacity: 0.7;
}

.hero::after {
    content: '⭐';
    position: absolute;
    bottom: 15%;
    left: 8%;
    font-size: 2rem;
    animation: twinkle 2s ease-in-out infinite;
}

.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 1rem;
    position: relative;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    opacity: 0.9;
    position: relative;
}

/* ===== Секции ===== */
section {
    margin-bottom: 2.5rem;
}

section h2 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    color: var(--accent);
    margin-bottom: 1.5rem;
    position: relative;
    padding-left: 1rem;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

section h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.2rem;
    width: 5px;
    height: 80%;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 3px;
    box-shadow: 0 0 10px var(--primary);
}

/* ===== Карточки ===== */
.topic-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.topic-item {
    background: var(--card);
    padding: 1.8rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid rgba(139, 92, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.topic-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.topic-item:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.topic-item h3 {
    color: var(--accent);
    margin-bottom: 0.6rem;
    font-size: 1.15rem;
}

.topic-item p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ===== Кнопки ===== */
.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 0.7rem 1.8rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.btn-delete {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5);
}

.btn-edit {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 0.5rem;
    margin-right: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.5);
}

/* ===== Формы ===== */
.admin-section,
.login-form,
.quiz {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.admin-section h2,
.login-form h2,
.quiz h2 {
    color: var(--accent);
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.7rem 1rem;
    margin-bottom: 1rem;
    border: 2px solid #334155;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #0f172a;
    color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== Новости ===== */
.news article,
.news-item {
    background: var(--card);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
    transition: all 0.3s ease;
}

.news article:hover,
.news-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-hover);
}

.news h3,
.news-item h3 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

time,
small {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ===== Вопросы теста ===== */
.question {
    background: rgba(139, 92, 246, 0.05);
    padding: 1.2rem;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    border-left: 4px solid var(--primary);
}

.question h3 {
    color: var(--accent);
    margin-bottom: 0.7rem;
}

.question label {
    display: block;
    padding: 0.5rem;
    margin-bottom: 0.3rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: normal;
}

.question label:hover {
    background: rgba(139, 92, 246, 0.15);
}

/* ===== Редактор вопросов ===== */
.question-edit {
    background: rgba(34, 197, 94, 0.05);
    padding: 1.2rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border-left: 4px solid #22c55e;
}

/* ===== Таблица результатов ===== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

th {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 0.8rem;
    text-align: left;
}

td {
    padding: 0.8rem;
    border-bottom: 1px solid #334155;
}

tr:hover td {
    background: rgba(139, 92, 246, 0.1);
}

/* ===== Превью картинки ===== */
#image-preview img {
    max-width: 300px;
    border-radius: 12px;
    margin-top: 0.5rem;
    box-shadow: var(--shadow);
}

/* ===== Подвал ===== */
footer {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    color: white;
    margin-top: 3rem;
    border-top: 2px solid var(--primary);
}

/* ===== Адаптивность ===== */
@media (max-width: 768px) {
    header {
        padding: 0.8rem 1rem;
    }

    nav ul {
        gap: 0.3rem;
    }

    nav a {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .hero {
        padding: 2.5rem 1.5rem;
    }

    .hero::before {
        font-size: 2.5rem;
    }

    .topic-list {
        grid-template-columns: 1fr;
    }

    main {
        padding: 0 1rem;
    }

    .admin-section,
    .login-form,
    .quiz {
        padding: 1.5rem;
    }
}

/* Уважение к настройкам пользователя */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ===== Космические элементы ===== */
.space-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Луна */
.moon {
    position: absolute;
    top: 8%;
    right: 6%;
    font-size: 4rem;
    animation: float 6s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
    z-index: 0;
}

/* Земля */
.earth {
    position: absolute;
    bottom: 10%;
    left: 4%;
    font-size: 3.5rem;
    animation: float 8s ease-in-out infinite;
    filter: drop-shadow(0 0 25px rgba(34, 211, 238, 0.6));
    z-index: 0;
}

/* Падающие звёзды */
.shooting-star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 4px;
    width: 150px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 1), transparent);
    transform: translateY(-50%);
}

@keyframes shoot {
    0% {
        transform: rotate(-45deg) translateX(0);
        opacity: 1;
    }

    100% {
        transform: rotate(-45deg) translateX(-1200px);
        opacity: 0;
    }
}

.s1 {
    top: 15%;
    right: 0;
    animation: shoot 4s linear infinite;
    animation-delay: 0s;
}

.s2 {
    top: 35%;
    right: 150px;
    animation: shoot 5s linear infinite;
    animation-delay: 1.5s;
}

.s3 {
    top: 55%;
    right: 300px;
    animation: shoot 3.5s linear infinite;
    animation-delay: 3s;
}

/* Анимация полёта (для луны и земли) */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* ===== Юпитер (реалистичный) ===== */
.jupiter {
    position: absolute;
    top: 20%;
    left: 12%;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    /* Полосы Юпитера */
    background: linear-gradient(to bottom,
            #c9a227 0%,
            #e8d5a3 8%,
            #b8860b 16%,
            #f4e4c1 24%,
            #a0522d 32%,
            #f5deb3 40%,
            #8b4513 48%,
            #f4e7d3 56%,
            #b36d32 64%,
            #fde8c8 72%,
            #7c2d12 80%,
            #d4a373 88%,
            #5c3a1e 100%);
    /* Тень для объёма */
    box-shadow:
        inset -20px -10px 30px rgba(0, 0, 0, 0.6),
        inset 10px 10px 20px rgba(255, 255, 255, 0.2),
        0 0 30px rgba(255, 200, 100, 0.3);
    animation: jupiterFloat 10s ease-in-out infinite;
    z-index: 0;
}

/* Большое красное пятно */
.jupiter::after {
    content: '';
    position: absolute;
    top: 55%;
    left: 60%;
    width: 35px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(ellipse, #dc2626 0%, #b91c1c 60%, transparent 100%);
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

/* ===== Юпитер (реалистичный, слева) ===== */
.jupiter {
    position: absolute;
    top: 25%;
    left: 5%;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(to bottom,
            #c9a227 0%,
            #e8d5a3 8%,
            #b8860b 16%,
            #f4e4c1 24%,
            #a0522d 32%,
            #f5deb3 40%,
            #8b4513 48%,
            #f4e7d3 56%,
            #b36d32 64%,
            #fde8c8 72%,
            #7c2d12 80%,
            #d4a373 88%,
            #5c3a1e 100%);
    box-shadow:
        inset -20px -10px 30px rgba(0, 0, 0, 0.6),
        inset 10px 10px 20px rgba(255, 255, 255, 0.2),
        0 0 30px rgba(255, 200, 100, 0.3);
    animation: jupiterFloat 10s ease-in-out infinite, jupiterSpin 30s linear infinite;
    z-index: 0;
}

/* Большое красное пятно */
.jupiter::after {
    content: '';
    position: absolute;
    top: 55%;
    left: 60%;
    width: 35px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(ellipse, #dc2626 0%, #b91c1c 60%, transparent 100%);
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

/* Блик для объёма */
.jupiter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.25) 0%, transparent 50%);
}

/* Плавное вращение Юпитера вокруг оси */
@keyframes jupiterSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes jupiterFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-12px) rotate(180deg);
    }

    100% {
        transform: translateY(0) rotate(360deg);
    }
}

: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.25) 0%, transparent 50%);

/* Анимация медленного вращения полос */
@keyframes jupiterSpin {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 200px 0;
    }
}

@keyframes jupiterFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

.jupiter {
    animation: jupiterFloat 10s ease-in-out infinite;
}