.ad-banner {
    position: fixed;
    top: 120px;
    width: 240px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    z-index: 100;
    opacity: 1;
}

.ad-banner::-webkit-scrollbar {
    width: 0;
    display: none;
}

.ad-banner-left {
    left: 20px;
}

.ad-banner-right {
    right: 20px;
}

.ad-content {
    background: linear-gradient(135deg, #0a0a0f 0%, #12121a 50%, #1a1a28 100%);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(100, 126, 234, 0.2);
    height: 650px;
    display: flex;
    flex-direction: column;
}


.ad-label {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(90deg, #667eea, #764ba2);
    padding: 4px 8px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 8px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.ad-headline {
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px 0;
    line-height: 1.2;
    text-align: center;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}


.ad-lorebook-cover {
    width: 100%;
    height: 160px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ad-lorebook-cover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 100%);
    pointer-events: none;
}

.ad-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px 0;
    line-height: 1.3;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: center;
    min-height: 48px;
    max-height: 48px;
}

.ad-author {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 8px 0;
    text-align: center;
    font-style: italic;
}

.ad-description {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 12px 0;
    line-height: 1.4;
    text-align: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.ad-tagline {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 16px 0;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.ad-quote {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 16px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    line-height: 1.5;
    font-style: italic;
    position: relative;
    text-align: center;
}

.ad-quote i {
    color: #667eea;
    font-size: 0.8em;
    opacity: 0.7;
}

.ad-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

.ad-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 14px;
}

.ad-rating i {
    color: #ffd700;
}

.ad-rating .fa-star-half-alt {
    color: #ffd700;
}

.ad-rating .far.fa-star {
    color: rgba(255, 215, 0, 0.3);
}

.ad-cta {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    margin-top: auto;
    box-shadow: 0 4px 15px rgba(100, 126, 234, 0.3);
}

.ad-cta::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;
}

.ad-cta:hover::before {
    left: 100%;
}

.ad-cta:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(100, 126, 234, 0.4);
}

.ad-content:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7), 
                0 0 30px rgba(100, 126, 234, 0.4),
                inset 0 0 30px rgba(255, 255, 255, 0.05);
}


.ad-banner.fade-switch {
    animation: fadeSwitch 0.8s ease;
}

@keyframes fadeSwitch {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hide banners when screen is too narrow to prevent overlap with main content */
/* Main content is max 1200px wide, plus 240px for each banner = 1680px minimum */
@media (max-width: 1680px) {
    .ad-banner {
        display: none;
    }
}

.ad-banner-mobile {
    display: none;
}

@media (max-width: 768px) {
    .ad-banner-mobile {
        display: block;
        width: 100%;
        margin: 20px 0;
        position: relative;
        animation: slideUp 0.5s ease;
    }
    
    .ad-banner-mobile .ad-content {
        width: 90%;
        margin: 0 auto;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 16px;
        padding: 12px;
    }
    
    .ad-banner-mobile .ad-lorebook-cover {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
        margin: 0;
    }
    
    .ad-banner-mobile .ad-info {
        flex: 1;
    }
    
    .ad-banner-mobile .ad-label {
        margin-bottom: 8px;
        width: auto;
        display: inline-block;
    }
    
    .ad-banner-mobile .ad-cta {
        width: auto;
        padding: 6px 16px;
        align-self: flex-start;
        margin-top: 8px;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}