/* =============================================
   СТРАНИЦА АНИМЕ – ДЕТАЛИ, ПЛЕЕР, ПЕРСОНАЖИ (фиолетовый неон)
   ============================================= */
:root {
    --bg-primary: #0a0c14;
    --bg-secondary: #111827;
    --bg-tertiary: #1e2a3a;
    --text-primary: #e2e8ff;
    --text-secondary: #9aa9c7;
    --border: #2d3a4f;
    --neon-purple: #a64dff;
    --neon-pink: #ff66e6;
}

.anime-detail-container { padding: 2rem 0; }
.back-link {
    margin-bottom: 1.5rem;
    display: inline-block;
}
.anime-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    background: rgba(30, 35, 55, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(170, 0, 255, 0.3);
    animation: glassFadeIn 0.5s ease-out;
}
.anime-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background-image: var(--banner-image, linear-gradient(135deg, #1a1a2e, #16213e));
    background-size: cover;
    background-position: center 20%;
    filter: blur(15px) brightness(0.55);
}
.anime-header::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background: rgba(10, 12, 20, 0.3);
    backdrop-filter: blur(2px);
}

.anime-poster-large {
    width: 300px;
    border-radius: 12px;
    border: 2px solid #aa00ff;
    box-shadow: 0 0 20px rgba(170, 0, 255, 0.3), 0 0 40px rgba(170, 0, 255, 0.2);
    transition: box-shadow 0.3s, border-color 0.3s;
    animation: posterGlowPulse 2s ease-in-out infinite alternate;
}
@keyframes posterGlowPulse {
    0% { box-shadow: 0 0 20px rgba(170, 0, 255, 0.3), 0 0 40px rgba(170, 0, 255, 0.2); }
    100% { box-shadow: 0 0 35px rgba(170, 0, 255, 0.6), 0 0 70px rgba(170, 0, 255, 0.4); }
}
.anime-poster-large:hover {
    box-shadow: 0 0 40px rgba(170, 0, 255, 0.6), 0 0 80px rgba(170, 0, 255, 0.4);
    border-color: #d4a5ff;
}
.anime-info { flex: 1; min-width: 300px; }
.anime-info .anime-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    text-shadow: 0 0 15px rgba(170, 0, 255, 0.2);
}
.anime-title-english {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(170, 0, 255, 0.15);
}
.anime-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}
.meta-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 0 10px rgba(170, 0, 255, 0.05);
    transition: box-shadow 0.3s;
}
.meta-item:hover {
    box-shadow: 0 0 20px rgba(170, 0, 255, 0.15);
}
.meta-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.3rem; text-shadow: 0 0 5px rgba(170, 0, 255, 0.1); }
.meta-value { font-size: 1.1rem; font-weight: 600; color: #d4a5ff; text-shadow: 0 0 15px rgba(170, 0, 255, 0.3); }
.genres-container { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0; }
.genre-tag {
    padding: 0.4rem 1rem;
    background: rgba(170, 0, 255, 0.1);
    border: 1px solid rgba(170, 0, 255, 0.3);
    border-radius: 20px;
    color: #d4a5ff;
    font-size: 0.9rem;
    text-shadow: 0 0 8px rgba(170, 0, 255, 0.2);
    transition: box-shadow 0.3s, border-color 0.3s;
}
.genre-tag:hover {
    border-color: #d4a5ff;
    box-shadow: 0 0 15px rgba(170, 0, 255, 0.3);
}
.description-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    margin: 2rem 0;
    border: 1px solid var(--border);
}
.section-title {
    font-size: 1.5rem;
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #aa00ff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: 0 0 20px rgba(170, 0, 255, 0.3);
}

/* Плеер – фиолетовое свечение */
#player-container iframe { width: 100%; height: 400px; border-radius: 12px; border: 2px solid #aa00ff; box-shadow: 0 0 20px #b266ff; margin-bottom: 1rem; }
#player-frame-container {
    position: relative;
    margin: 2rem 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 30px #b266ff;
    transition: box-shadow 0.4s ease;
}
#player-frame-container:hover { box-shadow: 0 0 60px #b266ff, 0 0 90px #b266ff; }
#player-frame-container iframe {
    display: block;
    width: 100%;
    height: 400px;
    border: 2px solid transparent;
    border-radius: 20px;
    background: #0a0c14;
    transition: transform 0.3s, border-color 0.3s;
}
#player-frame-container:hover iframe { border-color: #aa00ff; transform: scale(1.01); }
#player-frame-container::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 20px;
    box-shadow: inset 0 0 30px rgba(170, 0, 255, 0.3);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
#player-frame-container:hover::after { opacity: 1; }

/* Кнопки эпизодов */
.episodes-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 1rem 0 2rem; align-items: center; }
.episode-btn {
    width: 45px; height: 45px;
    background: rgba(170, 0, 255, 0.1);
    border: 1px solid #aa00ff;
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 0 8px rgba(170, 0, 255, 0.1);
}
.episode-btn:hover { background: #aa00ff; color: var(--bg-primary); transform: translateY(-3px); box-shadow: 0 0 25px #b266ff; }
.episode-btn.active { background: #aa00ff; color: var(--bg-primary); box-shadow: 0 0 35px #b266ff; }
.next-episode-info { margin-top: 1rem; padding: 0.5rem; background: rgba(170, 0, 255, 0.1); border: 1px solid #aa00ff; border-radius: 8px; color: var(--text-secondary); text-align: center; width: 100%; }

/* Персонажи – фиолетовое свечение */
.characters-carousel, .recommendations-carousel { position: relative; margin: 2rem 0; }
.characters-carousel-track-container, .recommendations-carousel-track-container { overflow: hidden; flex: 1; }
.characters-carousel-track, .recommendations-carousel-track { display: flex; gap: 16px; transition: transform 0.3s ease; will-change: transform; }

.character-carousel-card {
    flex: 0 0 150px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(170, 0, 255, 0.2);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    position: relative;
    box-shadow: 0 0 10px rgba(170, 0, 255, 0.05);
}
.character-carousel-card:hover { transform: translateY(-5px); border-color: #aa00ff; box-shadow: 0 0 30px rgba(170, 0, 255, 0.3); }
.character-carousel-image { width: 100%; height: 150px; object-fit: cover; }
.character-carousel-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: none;
    color: white;
    padding: 12px 8px 8px 8px;
    text-shadow: 0 0 8px rgba(0,0,0,0.8), 0 0 15px rgba(0,0,0,0.6);
    pointer-events: none;
}
.character-carousel-name {
    font-weight: 600;
    font-size: 1rem
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 10px rgba(170, 0, 255, 0.6), 0 0 20px rgba(170, 0, 255, 0.3);
}
.character-carousel-role { font-size: 0.9rem; color: rgba(255,255,255,0.9); text-shadow: 0 0 8px rgba(170, 0, 255, 0.4); }

/* Рекомендации – фиолетовое свечение (базовые стили, они будут переопределены в финальном блоке) */
.recommendation-carousel-card {
    flex: 0 0 auto;
    width: 200px;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    transition: none;
}
.recommendation-carousel-card:hover {
    transform: none;
    box-shadow: none;
}

/* Стрелки каруселей (базовые, переопределяются ниже) */
.characters-carousel .carousel-arrow, .recommendations-carousel .carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 10;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(170, 0, 255, 0.2);
    transition: box-shadow 0.3s;
}
.characters-carousel .carousel-arrow:hover,
.recommendations-carousel .carousel-arrow:hover {
    box-shadow: 0 0 20px rgba(170, 0, 255, 0.4);
}
.characters-carousel .carousel-arrow-left { left: -20px; }
.characters-carousel .carousel-arrow-right { right: -20px; }
.recommendations-carousel .carousel-arrow-left { left: -20px; }
.recommendations-carousel .carousel-arrow-right { right: -20px; }

/* Подтверждение возраста */
.age-verification-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.age-verification-modal { background: var(--bg-secondary); border: 2px solid #aa00ff; border-radius: 24px; padding: 2rem; max-width: 400px; text-align: center; box-shadow: 0 0 30px #b266ff; }
.age-verification-modal h2 { margin-bottom: 1rem; }
.age-verification-modal p { margin-bottom: 1rem; color: var(--text-secondary); }
.age-verification-buttons { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; }

/* Кнопки списков и комментарии – фиолетовое свечение */
.list-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    border: 1px solid var(--neon-purple);
    background: rgba(139, 92, 246, 0.15);
    color: white;
    font-size: 0.9rem;
    box-shadow: 0 0 8px rgba(166, 77, 255, 0.2);
    text-shadow: 0 0 8px rgba(166, 77, 255, 0.1);
}
.list-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    box-shadow: 0 0 20px var(--neon-purple);
}
.list-btn.active {
    background: var(--neon-purple);
    border-color: var(--neon-purple);
    box-shadow: 0 0 25px var(--neon-purple);
}

.comment {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--neon-purple);
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    border-radius: 8px;
    color: #ddd;
}
.comment strong {
    color: var(--neon-purple);
    text-shadow: 0 0 10px rgba(166, 77, 255, 0.2);
}

/* Кнопка "Назад" */
.anime-detail-container {
    position: relative;
}
.back-link {
    position: absolute;
    top: 1rem;
    left: 0;
    z-index: 20;
    margin: 0;
    display: inline-flex;
    align-items: center;
    animation: none !important;
    transition: none !important;
    transform: none !important;
}
.anime-detail-container > #anime-detail-content {
    margin-top: 3rem;
}

/* Адаптивность страницы аниме */
@media (min-width: 1600px) {
    .anime-poster-large { width: 400px; }
    #player-frame-container iframe { height: 600px; }
    .character-carousel-card { flex: 0 0 200px; }
    .character-carousel-image { height: 200px; }
    .recommendation-carousel-card { width: 250px; }
}
@media (min-width: 992px) and (max-width: 1199px) {
    .anime-poster-large { width: 260px; }
}
@media (max-width: 991px) {
    .anime-header { flex-direction: column; align-items: center; text-align: center; padding: 1.5rem; }
    .anime-info { min-width: auto; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; }
    .anime-poster-large { width: 220px; margin-bottom: 1rem; }
    .anime-meta-grid { justify-content: center; grid-template-columns: repeat(2, 1fr); }
    .genres-container { justify-content: center; }
    .anime-title { text-align: center; }
    .anime-title-english { text-align: center; }
}
@media (max-width: 767px) {
    .anime-header { padding: 1rem !important; margin: 0 8px; width: auto; }
    .anime-poster-large { width: 200px; }
    #player-frame-container iframe { height: 280px; }
    .character-carousel-card { flex: 0 0 140px; }
    .character-carousel-image { height: 140px; }
    .recommendation-carousel-card { width: 170px; }
    .characters-carousel .carousel-arrow,
    .recommendations-carousel .carousel-arrow { width: 30px; height: 30px; padding: 5px; }
    .episode-btn { width: 35px; height: 35px; font-size: 0.9rem; }
    .back-link { top: 0.5rem; }
}
@media (max-width: 575px) {
    .anime-poster-large { width: 170px; }
    #player-frame-container iframe { height: 240px; }
    .character-carousel-card { flex: 0 0 120px; }
    .character-carousel-image { height: 120px; }
    .recommendation-carousel-card { width: 150px; }
    .anime-meta-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .meta-item { padding: 0.5rem; }
    .meta-value { font-size: 0.9rem; }
}
@media (max-width: 400px) {
    .character-carousel-card { flex: 0 0 100px; }
    .character-carousel-image { height: 100px; }
    .recommendation-carousel-card { width: 130px; }
    .anime-poster-large { width: 150px; }
}

/* ============================================================
   КАРУСЕЛЬ РЕКОМЕНДАЦИЙ – СБРОС TRANSFORM
   ============================================================ */
.recommendations-carousel {
    position: relative;
    margin: 2rem 0 3rem 0;
    width: 100%;
    overflow: visible !important;
    clear: both !important;
    display: block !important;
    min-height: 340px !important;
}

.recommendations-carousel-track-container {
    overflow: hidden !important;
    width: 100%;
    height: 340px !important;
    min-height: 340px !important;
    display: block !important;
    flex: none !important;
}

.recommendations-carousel-track {
    display: flex !important;
    gap: 12px !important;
    transition: transform 0.3s ease;
    will-change: transform;
    height: 340px !important;
    align-items: stretch !important;
    width: max-content !important;
    flex-shrink: 0 !important;
}

.recommendation-carousel-card {
    flex: 0 0 240px !important;
    width: 240px !important;
    height: 340px !important;
    display: block !important;
    flex-shrink: 0 !important;
}

.recommendations-carousel .anime-card,
#recs-track .anime-card {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    border: 1px solid rgba(166, 77, 255, 0.6) !important;
    box-shadow: 0 0 15px rgba(166, 77, 255, 0.3) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    background: #1e293b !important;
    cursor: pointer !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important; /* ВОТ ЭТО ГЛАВНОЕ! */
}

.recommendations-carousel .anime-card:hover {
    box-shadow: 0 0 30px rgba(166, 77, 255, 0.7), 0 0 60px rgba(166, 77, 255, 0.4), 0 10px 30px rgba(0,0,0,0.5) !important;
    transform: translateY(-5px) !important;
}

.recommendations-carousel .anime-poster-container,
#recs-track .anime-poster-container {
    width: 100% !important;
    height: 100% !important;
    padding-top: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    background: transparent !important;
}

.recommendations-carousel .anime-poster,
#recs-track .anime-poster,
.recommendations-carousel .anime-card img,
#recs-track .anime-card img {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    transform: none !important; /* отменяем глобальный translateY(30px) */
    box-shadow: 0 0 15px rgba(166, 77, 255, 0.3) !important;
}
#recs-track .anime-card:hover {
    transform: translateY(-5px) !important;           /* только подъём, без увеличения */
    border-color: #aa00ff !important;                /* фиолетовая обводка, как у персонажей */
    box-shadow: 0 0 20px rgba(170, 0, 255, 0.5), 0 0 40px rgba(170, 0, 255, 0.3) !important;
    animation: none !important;
}
/* СВЕЧЕНИЕ ДЛЯ ЗАГОЛОВКА ПРИ НАВЕДЕНИИ */
#recs-track .anime-card:hover .anime-title {
    color: #ffffff !important;
    text-shadow: 0 0 15px rgba(166, 77, 255, 0.9), 0 0 30px rgba(166, 77, 255, 0.6), 0 0 50px rgba(166, 77, 255, 0.4) !important;
    transform: scale(1.05) !important;
    animation: neonPulse 1.2s ease-in-out infinite alternate !important;
}

/* СВЕЧЕНИЕ ДЛЯ МЕТА-ИНФОРМАЦИИ ПРИ НАВЕДЕНИИ */
#recs-track .anime-card:hover .anime-meta {
    color: #ffffff !important;
    text-shadow: 0 0 10px rgba(166, 77, 255, 0.7), 0 0 20px rgba(166, 77, 255, 0.4) !important;
    transform: scale(1.03) !important;
    animation: neonPulse 1s ease-in-out infinite alternate !important;
}
/* Анимация пульсации (усиление свечения) */
@keyframes neonPulse {
    0% {
        text-shadow: 0 0 8px rgba(166, 77, 255, 0.5), 0 0 16px rgba(166, 77, 255, 0.3);
    }
    100% {
        text-shadow: 0 0 20px rgba(166, 77, 255, 1), 0 0 40px rgba(166, 77, 255, 0.7), 0 0 60px rgba(166, 77, 255, 0.4);
    }
}

.recommendations-carousel .anime-info,
#recs-track .anime-info {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 8px 12px !important;
    background: transparent !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

.recommendations-carousel .anime-title,
#recs-track .anime-title {
    color: #ffffff !important;
    text-shadow: 0 0 8px rgba(166, 77, 255, 0.4), 0 0 16px rgba(166, 77, 255, 0.2) !important;
    transition: all 0.3s ease !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    margin: 0 0 4px 0 !important;
}

.recommendations-carousel .anime-meta,
#recs-track .anime-meta {
    color: #e0e0e0 !important;
    text-shadow: 0 0 5px rgba(166, 77, 255, 0.3) !important;
    transition: all 0.3s ease !important;
}

/* Стрелки – позиционированы абсолютно, видны над контентом */
.recommendations-carousel .carousel-arrow {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(0,0,0,0.6) !important;
    color: white !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    z-index: 20 !important;
    border-radius: 50% !important;
    box-shadow: 0 0 15px rgba(170, 0, 255, 0.3) !important;
    transition: all 0.3s !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.4rem !important;
    line-height: 1 !important;
}
.recommendations-carousel .carousel-arrow:hover {
    background: rgba(166, 77, 255, 0.7) !important;
    box-shadow: 0 0 30px rgba(166, 77, 255, 0.6) !important;
}
.recommendations-carousel .carousel-arrow-left {
    left: -22px !important;
}
.recommendations-carousel .carousel-arrow-right {
    right: -22px !important;
}
/* =============================================
   КНОПКА ОТПРАВКИ КОММЕНТАРИЯ В СТИЛЕ КНОПОК СПИСКОВ
   ============================================= */
.comment-form button[type="submit"] {
    padding: 0.5rem 1.2rem !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: 0.3s !important;
    border: 1px solid var(--neon-purple) !important;
    background: rgba(139, 92, 246, 0.15) !important;
    color: white !important;
    font-size: 0.9rem !important;
    box-shadow: 0 0 8px rgba(166, 77, 255, 0.2) !important;
    text-shadow: 0 0 8px rgba(166, 77, 255, 0.1) !important;
}

.comment-form button[type="submit"]:hover {
    background: rgba(139, 92, 246, 0.3) !important;
    box-shadow: 0 0 20px var(--neon-purple) !important;
}

.comment-form button[type="submit"]:active {
    background: var(--neon-purple) !important;
    border-color: var(--neon-purple) !important;
    box-shadow: 0 0 25px var(--neon-purple) !important;
}