/* Оверлей с рекламой */
.overlay {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483647;
    max-width: 50vw;
    max-height: 50vh;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.overlay.show {
    opacity: 1;
    transform: scale(1);
}

.ad-link {
    display: block;
    text-decoration: none;
}

.ad-container {
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

.overlay img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.ad-title {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 50, 50, 0.9);
    color: white;
    padding: 6px 15px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    max-width: 80%;
    z-index: 2;
}

.caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4444;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-align: center;
    line-height: 32px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    z-index: 3;
}

.close-btn:hover {
    background: #ff0000;
}

.ad-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    /* Расстояние между кнопкой и картинкой */
}

.order-ad-btn {
    background: white;
    color: #222;
    border: 1px solid #222;
    border-radius: 3px;
    /* Легко скошенные углы */
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.order-ad-btn:hover {
    background: #f9f9f9;
    border-color: #000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* НАЧАЛО ИЗМЕНЕНИЙ: Для десктопной версии */
@media (min-width: 800px) {
    .overlay {
        max-width: 25vw; /* Максимум 25% ширины окна */
        max-height: 100vh; /* Максимум 100% высоты окна */
    }
    
    .ad-container {
        max-height: 100vh;
    }
    
    .overlay video {
        max-height: calc(100vh - 60px); /* Учитываем отступы и заголовок */
    }
}
@media (min-width: 1251px) {
    .overlay {
        max-width: 350px !important; /* Фиксированная максимальная ширина */
    }
}
/* КОНЕЦ ИЗМЕНЕНИЙ */