/* ============================================================
   广告位样式（Adsterra 第一批：Native / 728x90 / 320x50）
   原则：
   1. 广告位始终占位，避免广告回填时页面跳动（CLS）
   2. 桌面只显示 728x90，移动只显示 320x50，二者互斥
   3. 广告不进入工具卡内部，不与上传/执行/下载按钮相邻
   ============================================================ */

.ad-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 28px auto;
    padding-top: 14px;
    max-width: 100%;
    overflow: hidden;
}

/* 横幅位左上角的“AD”标识，弱化处理，不抢内容。
   默认透明：只有广告真的回填后才显示，空位不会留下孤零零的 AD。 */
.ad-slot::before {
    content: 'AD';
    position: absolute;
    top: 0;
    left: 0;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.14em;
    color: var(--text-muted, #86868b);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ad-slot.ad-filled::before {
    opacity: 1;
}

.ad-slot iframe {
    display: block;
    border: 0;
    max-width: 100%;
}

/* 728x90：90 + 14 的内边距 */
.ad-slot[data-ad="leaderboard"] {
    width: 728px;
    height: 104px;
}

/* 320x50：50 + 14 的内边距 */
.ad-slot[data-ad="mobile-banner"] {
    width: 320px;
    height: 64px;
}

/* 原生位：高度由广告内容决定，先预留一部分避免抖动 */
.ad-slot[data-ad="native"] {
    width: 100%;
    max-width: 728px;
    min-height: 150px;
    padding-top: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

/* 原生位不用伪元素的 AD 角标，改用真实标签（填充后才显示） */
.ad-slot[data-ad="native"]::before {
    content: none;
}

.ad-slot[data-ad="native"].ad-filled {
    min-height: 0;
}

.ad-native-container {
    width: 100%;
}

/* 原生广告的「广告 / Advertisement」标签：默认隐藏，填充后才出现 */
.ad-label {
    display: none;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted, #86868b);
    margin-bottom: 8px;
}

.ad-slot.ad-filled .ad-label {
    display: block;
}

/* 原生位未填充时收起，避免留下大片空白 */
.ad-slot[data-ad="native"].ad-empty {
    display: none;
}

/* 任何广告位未填充都彻底收起：不留空白、不显示 AD */
.ad-slot.ad-empty {
    display: none !important;
}

/* 本会话已确认无填充：不占布局空间，但保留真实尺寸。
   这里用「绝对定位 + opacity 0」而不是 height:0 —— 部分广告脚本会先量容器尺寸，
   容器高度为 0 时可能直接不渲染。这样既不影响排版，也不会让脚本判定为不可见。 */
.ad-slot.ad-hold {
    position: absolute !important;
    left: 0;
    top: 0;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
}

/* 断点切换：桌面 728 / 移动 320 */
@media (max-width: 819px) {
    .ad-slot[data-ad="leaderboard"] {
        display: none !important;
    }
}

@media (min-width: 820px) {
    .ad-slot[data-ad="mobile-banner"] {
        display: none !important;
    }
}

/* 极窄屏（< 360px）320 横幅会溢出，直接不显示 */
@media (max-width: 359px) {
    .ad-slot[data-ad="mobile-banner"] {
        display: none !important;
    }
}
