/* Основные стили */
body {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    background: #0A0F14;
    color: #E0E0E0;
    overflow-x: hidden;
}

/* Фон и частицы */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0A0F14, #1F2525);
    z-index: -2;
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><circle cx="5" cy="5" r="2" fill="%23FFD700" opacity="0.5"/></svg>');
    animation: particleFlow 20s linear infinite;
    opacity: 0.15;
}

@keyframes particleFlow {
    0% { transform: translateY(-100vh) translateX(-10vw); }
    100% { transform: translateY(100vh) translateX(10vw); }
}

/* Three.js контейнер */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.5;
    filter: drop-shadow(0 0 20px rgba(0, 87, 183, 0.7));
}

/* Шапка */
header {
    padding: clamp(1rem, 3vw, 3rem);
    text-align: center;
    position: relative;
    z-index: 10;
}

.site-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2rem, 4.5vw, 5rem);
    color: #0057B7;
    text-shadow: 0 0 15px rgba(0, 87, 183, 0.8), 0 0 30px rgba(255, 215, 0, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
    margin: 0;
}

.neon-line {
    width: clamp(10rem, 20vw, 25rem);
    height: 2px;
    background: linear-gradient(90deg, #0057B7, #FFD700);
    margin: 1rem auto;
    box-shadow: 0 0 10px rgba(0, 87, 183, 0.8);
    animation: pulse 1.5s infinite;
}

/* Сетка предметов */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(22vw, 25rem), 1fr));
    gap: clamp(1rem, 3vw, 3rem);
    padding: clamp(2rem, 6vw, 6rem);
    position: relative;
    z-index: 10;
}

/* Карточки предметов */
.subject-card {
    background: linear-gradient(135deg, rgba(43, 47, 60, 0.9), rgba(20, 25, 35, 0.7));
    padding: clamp(1rem, 2.5vw, 3rem);
    border-radius: 1.5vw;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1rem, 1.6vw, 2rem);
    text-align: center;
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    background-image: linear-gradient(45deg, #FFD700, #0057B7);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    animation: cardFadeIn 0.8s ease forwards;
    border: 1px solid rgba(0, 87, 183, 0.3);
}

.subject-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 87, 183, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.subject-card:hover {
    transform: translateY(-0.5rem) rotateX(10deg) rotateY(10deg);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.7), 0 0 60px rgba(0, 87, 183, 0.5);
    background-image: linear-gradient(45deg, #0057B7, #FFD700);
}

.subject-card:hover::before {
    opacity: 1;
}

.subject-card.inactive {
    background: linear-gradient(135deg, rgba(80, 80, 80, 0.8), rgba(50, 50, 50, 0.6));
    color: #999;
    background-clip: border-box;
    -webkit-background-clip: border-box;
    cursor: not-allowed;
    pointer-events: none;
}

/* Модальное окно */
.topics-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.3s ease forwards;
}

.topics-content {
    background: linear-gradient(135deg, #2B2F3C, #141923);
    padding: clamp(1.5rem, 3vw, 3rem);
    border-radius: 1rem;
    width: min(60vw, 40rem);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 20px rgba(0, 87, 183, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.topic {
    padding: clamp(0.5rem, 1.2vw, 1.5rem);
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.9rem, 1.4vw, 1.8rem);
    color: #FFD700;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.topic:hover {
    color: #0057B7;
    transform: translateX(0.5rem);
}

.topic::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #0057B7;
    transition: width 0.3s ease;
}

.topic:hover::after {
    width: 100%;
}

/* Подвал */
.footer {
    position: fixed;
    bottom: clamp(0.5rem, 2vh, 2rem);
    width: 100%;
    text-align: center;
    z-index: 10;
}

.footer-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.2rem, 2.2vw, 2.5rem);
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    animation: footerGlow 3s ease infinite alternate;
}

/* Анимации */
@keyframes glow {
    from { text-shadow: 0 0 10px rgba(0, 87, 183, 0.6), 0 0 20px rgba(255, 215, 0, 0.4); }
    to { text-shadow: 0 0 20px rgba(0, 87, 183, 1), 0 0 40px rgba(255, 215, 0, 0.8); }
}

@keyframes pulse {
    0% { transform: scaleX(1); }
    50% { transform: scaleX(1.1); }
    100% { transform: scaleX(1); }
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(3rem); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes footerGlow {
    from { text-shadow: 0 0 5px rgba(255, 215, 0, 0.4); }
    to { text-shadow: 0 0 15px rgba(255, 215, 0, 0.8); }
}

/* Адаптив */
@media (max-width: 768px) {
    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .subject-card {
        border-radius: 1rem;
    }
}