/* ADMA Frontend Styles - 見切れ完全修正版 */
.adma-container {
    position: absolute;
    z-index: 9999;
    /* 画面はみ出し防止 */
    max-width: 100vw !important;
    overflow: visible !important;
}

.adma-container.adma-scroll-follow {
    position: fixed;
}

.adma-content {
    /* 影と背景を完全削除 */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    /* はみ出し防止 */
    max-width: 100vw !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.adma-ad-content {
    padding: 0 !important;
    margin: 0 !important;
    text-align: center;
    /* はみ出し防止 */
    max-width: 100% !important;
    overflow: visible !important;
}

.adma-ad-content img {
    display: block;
    margin: 0 auto;
    /* スマホではみ出し防止 */
    max-width: 100% !important;
    height: auto !important;
}

.adma-ad-content iframe {
    display: block;
    margin: 0 auto;
    /* スマホではみ出し防止 */
    max-width: 100% !important;
    height: auto !important;
}

.adma-close {
    position: absolute;
    background: #ff4444;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
    /* 影削除 */
    box-shadow: none !important;
}

.adma-close:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.adma-close span {
    font-weight: bold;
    line-height: 1;
}

/* Close button positions */
.adma-close-top_left {
    top: 10px;
    left: 10px;
}

.adma-close-top_right {
    top: 10px;
    right: 10px;
}

.adma-close-bottom_left {
    bottom: 10px;
    left: 10px;
}

.adma-close-bottom_right {
    bottom: 10px;
    right: 10px;
}

/* Ad container positions - PC用 */
.adma-position-top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.adma-position-bottom {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.adma-position-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

.adma-position-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

.adma-position-top_left {
    top: 20px;
    left: 20px;
}

.adma-position-top_right {
    top: 20px;
    right: 20px;
}

.adma-position-bottom_left {
    bottom: 20px;
    left: 20px;
}

.adma-position-bottom_right {
    bottom: 20px;
    right: 20px;
}

.adma-position-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* スマホ専用修正 - 見切れ完全防止 */
@media screen and (max-width: 768px) {
    .adma-container {
        max-width: 100vw !important;
        width: auto !important;
    }
    
    .adma-content {
        max-width: calc(100vw - 20px) !important;
        overflow: visible !important;
    }
    
    .adma-ad-content {
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    .adma-ad-content img {
        max-width: calc(100vw - 40px) !important;
        width: auto !important;
        height: auto !important;
    }
    
    .adma-ad-content iframe {
        max-width: calc(100vw - 40px) !important;
        width: auto !important;
        height: auto !important;
    }
    
    .adma-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    /* スマホ位置調整 - 見切れ防止重要 */
    .adma-position-left {
        left: 10px !important;
        right: auto !important;
        transform: translateY(-50%) !important;
        top: 50% !important;
    }
    
    .adma-position-right {
        right: 10px !important;
        left: auto !important;
        transform: translateY(-50%) !important;
        top: 50% !important;
    }
    
    .adma-position-top_left {
        left: 10px !important;
        top: 20px !important;
        transform: none !important;
    }
    
    .adma-position-bottom_left {
        left: 10px !important;
        bottom: 20px !important;
        transform: none !important;
    }
    
    .adma-position-top_right {
        right: 10px !important;
        left: auto !important;
        top: 20px !important;
        transform: none !important;
    }
    
    .adma-position-bottom_right {
        right: 10px !important;
        left: auto !important;
        bottom: 20px !important;
        transform: none !important;
    }
    
    .adma-position-center {
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        right: auto !important;
    }
    
    .adma-position-top {
        left: 50% !important;
        top: 20px !important;
        transform: translateX(-50%) !important;
        right: auto !important;
    }
    
    .adma-position-bottom {
        left: 50% !important;
        bottom: 20px !important;
        transform: translateX(-50%) !important;
        right: auto !important;
    }
}

/* 小さいスマホ (480px以下) */
@media screen and (max-width: 480px) {
    .adma-content {
        max-width: calc(100vw - 10px) !important;
    }
    
    .adma-ad-content img {
        max-width: calc(100vw - 20px) !important;
    }
    
    .adma-ad-content iframe {
        max-width: calc(100vw - 20px) !important;
    }
    
    .adma-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    /* より小さい画面での位置調整 */
    .adma-position-left {
        left: 5px !important;
    }
    
    .adma-position-right {
        right: 5px !important;
    }
    
    .adma-position-top_left {
        left: 5px !important;
    }
    
    .adma-position-bottom_left {
        left: 5px !important;
    }
    
    .adma-position-top_right {
        right: 5px !important;
    }
    
    .adma-position-bottom_right {
        right: 5px !important;
    }
}

/* Animation styles */
.adma-container {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.adma-container.adma-visible {
    opacity: 1;
}

.adma-container.adma-hiding {
    animation: admaFadeOut 0.3s ease forwards;
}

@keyframes admaFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* HTML全体の横スクロール防止 */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}