﻿/* ===== 前台样式 ===== */
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #222;
    /* 浅灰纸质纹理背景（SVG fractalNoise，与参考图同质感） */
    background-color: #ececec;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.55  0 0 0 0 0.55  0 0 0 0.13 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-attachment: fixed;
    background-size: 220px 220px;
    line-height: 1.7;
}
.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }

/* 顶部导航 */
.site-header { background: #16a34a; box-shadow: 0 2px 8px rgba(0,0,0,.1); max-width: 780px; margin: 0 auto; }
.site-header.fixed { position: sticky; top: 0; z-index: 100; }
.topbar { border-bottom: none; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.main-nav { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; width: 100%; justify-content: space-between; }
.nav-logo { display: inline-flex; align-items: center; margin-right: 6px; }
/* 导航左侧赛事图标：自动旋转滚动（与开奖卡片图标同款动画） */
.nav-event-logo { height: 38px; width: auto; max-width: 100%; display: block; object-fit: contain; flex-shrink: 0; margin-right: 6px; animation: lottery-spin 6s linear infinite; transform-origin: center center; will-change: transform; }
.nav-logo img { height: 38px; width: auto; max-width: 100%; display: block; object-fit: contain; }
.main-nav-spacer,
.main-nav-right { all: unset; }
.main-nav a {
    color: #ffffff; text-decoration: none; font-size: 20px; font-weight: 700;
    padding: 4px 0; transition: opacity .15s;
    text-shadow:
        0.2px  0.2px 0 #1f2937,
       -0.2px  0.2px 0 #1f2937,
        0.2px -0.2px 0 #1f2937,
       -0.2px -0.2px 0 #1f2937,
        2px    2px   2px rgba(0, 0, 0, 0.5);
    -webkit-text-stroke: 0.2px #1f2937;
}
.main-nav a.nav-home {
    color: #dc2626;
    text-shadow:
        0.3px  0.3px 0 #ffffff,
       -0.3px  0.3px 0 #ffffff,
        0.3px -0.3px 0 #ffffff,
       -0.3px -0.3px 0 #ffffff,
        0.6px  0    0 #ffffff,
       -0.6px  0    0 #ffffff,
         0   0.6px  0 #ffffff,
         0  -0.6px  0 #ffffff,
        2px    2px   2px rgba(0, 0, 0, 0.35);
    -webkit-text-stroke: 0.3px #ffffff;
}
.main-nav a:hover { opacity: 0.8; }
.main-nav a.active { opacity: 1; }
.banner img { width: 100%; max-height: 280px; object-fit: cover; display: block; }

/* 主体 */
.site-main { padding: 4px 0 48px; }
.cat-nav { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.cat-nav a {
    padding: 6px 16px; background: #fff; border-radius: 20px; text-decoration: none;
    color: #555; font-size: 14px; border: 1px solid #eee;
}
.cat-nav a.active, .cat-nav a:hover { background: #2563eb; color: #fff; border-color: #2563eb; }

/* 文章网格 */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.05); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-cover { height: 160px; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px 16px 18px; }
.card-body h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.4; }
.card-sum { margin: 0 0 12px; color: #777; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: #999; }
.cat-tag { background: #eef2ff; color: #2563eb; padding: 2px 8px; border-radius: 4px; font-size: 12px; }

/* 列表页 */
.page-h1 { font-size: 24px; margin: 8px 0 18px; }
.article-list { display: flex; flex-direction: column; gap: 14px; }
.list-item { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.li-link { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; text-decoration: none; color: inherit; }
.li-cover { width: 160px; height: 110px; flex: 0 0 160px; overflow: hidden; border-radius: 6px; }
.li-cover img { width: 100%; height: 100%; object-fit: cover; }
.li-body { flex: 1; min-width: 0; }
.li-title { margin: 0; font-size: 18px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-title .hot-icon { display: inline-block; margin-right: 4px; font-size: 16px; transform-origin: center bottom; animation: hot-pulse 1.4s ease-in-out infinite; }
@keyframes hot-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.2); } }
.li-sum { margin: 0 0 10px; color: #777; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.li-meta { font-size: 13px; color: #999; flex: 0 0 auto; white-space: nowrap; }

/* 推荐到首页（首页内联表格） */
.featured-table { width: 100%; table-layout: fixed; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.featured-table thead th { background: #fde68a; color: #92400e; font-size: 14px; font-weight: 700; text-align: left; padding: 10px 14px; border-bottom: 2px solid #f59e0b; white-space: nowrap; }
.featured-table tbody td { padding: 8px 14px; border-bottom: 1px solid #f1f5f9; font-size: 14px; vertical-align: middle; }
.featured-table tbody tr:last-child td { border-bottom: 0; }
.featured-table tbody tr:hover { background: #f9fafb; }
.featured-table .ft-no { width: 44px; text-align: right; color: #9ca3af; }
.featured-table .ft-title { min-width: 0; width: auto; }
.featured-table .ft-link { color: #111827; text-decoration: none; display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; font-weight: 700; }
.featured-table .ft-link:hover { color: #2563eb; }
.featured-table .ft-link .hot-icon { display: inline-block; margin-right: 4px; font-size: 16px; transform-origin: center bottom; animation: hot-pulse 1.4s ease-in-out infinite; }
.featured-table .ft-cat { width: 110px; color: #6b7280; font-size: 13px; white-space: nowrap; }
@media (max-width: 768px) {
    .featured-table .ft-cat { display: none; }
    .featured-table .ft-no  { display: none; }
    .featured-table thead th.ft-cat,
    .featured-table thead th.ft-no  { display: none; }
}

/* 文章详情 */
.article-wrap { max-width: 780px; }
.post { background: #fff; border-radius: 12px; padding: 28px 32px; box-shadow: 0 2px 10px rgba(0,0,0,.05); overflow: hidden; }
.post-head h1 { margin: 0 0 12px; font-size: 28px; line-height: 1.35; word-break: break-word; overflow-wrap: break-word; }
.post-meta { display: flex; gap: 14px; align-items: center; color: #999; font-size: 13px; margin-bottom: 18px; flex-wrap: wrap; }
.post-cover { margin: -8px -8px 20px; overflow: hidden; border-radius: 8px; }
.post-cover img { width: 100%; border-radius: 8px; display: block; }
.post-content { font-size: 16px; line-height: 1.9; word-break: break-word; overflow-wrap: break-word; max-width: 100%; }
.post-content img { max-width: 100%; height: auto; border-radius: 6px; }
.post-content iframe,
.post-content video,
.post-content embed,
.post-content object { max-width: 100%; height: auto; }
.post-content iframe[src*="youtube"],
.post-content iframe[src*="vimeo"] { aspect-ratio: 16/9; height: auto; }
.post-content pre { background: #f4f4f5; padding: 14px; border-radius: 8px; overflow-x: auto; max-width: 100%; white-space: pre; word-break: break-word; }
.post-content code { word-break: break-word; overflow-wrap: anywhere; }
.post-content h2, .post-content h3 { margin: 1.2em 0 .6em; word-break: break-word; }
.post-content a { word-break: break-all; overflow-wrap: anywhere; }

/* 文章内表格：CSS 强制 100% 宽防换行 + 极小字号兜底 + JS 按需再缩字号 */
.post-content table { width: 100% !important; max-width: 100% !important; border-collapse: collapse; margin: 14px 0; font-size: clamp(9px, 2.5vw, 13px); line-height: 1.35; word-break: break-word; overflow-wrap: anywhere; }
.post-content table th,
.post-content table td { width: auto !important; padding: clamp(2px, 0.8vw, 5px) clamp(3px, 1.2vw, 7px); box-sizing: border-box; word-break: break-word; overflow-wrap: anywhere; white-space: normal; }
.post-content table img { max-width: 100%; height: auto; }

/* 一肖一码 / 期号发布区：专用样式（撞色表头 + 中奖高亮 + 自适应） */
.post-content table.yxym { background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; }
.post-content table.yxym th[colspan] { background: #429a94; color: #fff; font-size: 15px; padding: 10px; }
.post-content table.yxym td:first-child { background: #429a94; color: #fff; font-weight: 600; font-size: 13px; width: 32%; }
.post-content table.yxym td { color: #111; font-size: 14px; vertical-align: middle; }
.post-content table.yxym span[style*="background: rgb(255, 255, 0)"] { color: #b91c1c !important; font-weight: 700; padding: 0 2px; }

/* 移动端：表格进一步压缩（JS 会自动缩放，CSS 仅作辅助） */
@media (max-width: 768px) {
    .post-content { font-size: 15px; line-height: 1.75; }
    .post-content table.yxym th[colspan] { font-size: 13px; padding: 7px 6px; }
    .post-content table.yxym td:first-child { font-size: 11px; width: 30%; }
    .post-content table.yxym td { font-size: 12px; }
}

/* 文章返回键 */
.post-back { margin-top: 30px; padding-top: 18px; border-top: 1px dashed #e5e7eb; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.post-back a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 7px; text-decoration: none; font-size: 14px; }
.post-back .btn-back { background: #2563eb; color: #fff; }
.post-back .btn-back:hover { background: #1d4ed8; }
.post-back .btn-home { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.post-back .btn-home:hover { border-color: #2563eb; color: #2563eb; }
.related { background: #fff; border-radius: 12px; padding: 18px 24px; margin-top: 22px; }
.rel-title { font-size: 18px; margin: 0 0 10px; }
.related ul { margin: 0; padding-left: 20px; }
.related li { margin: 6px 0; }
.related a { color: #2563eb; text-decoration: none; }
.back { margin-top: 22px; }
.back a { color: #666; text-decoration: none; }

/* 广告位 */
.ad { display: block; margin: 18px auto; border-radius: 8px; overflow: hidden; max-width: 780px; }
.ad-text { background: #fff7e6; border: 1px dashed #ffd591; padding: 14px 18px; color: #8a6d3b; text-decoration: none; }
.ad-text .ad-title { font-weight: 700; margin-bottom: 4px; }
.ad-image img { width: 100%; display: block; }

/* 导航广告（导航栏下方，随导航固定悬浮） */
.nav-ad-bar { background: #fffbeb; text-align: center; border-top: 1px solid rgba(0,0,0,.06); }
.nav-ad-bar .ad { margin: 0 auto; border-radius: 0; max-width: 780px; }
.nav-ad-bar .ad-text { background: transparent; border: none; padding: 8px 14px; }
.nav-ad-bar .ad-code { padding: 4px 0; }
.nav-ad-bar .ad-image img { width: 100%; display: block; }

/* 下滑显示广告：导航下方固定悬浮，默认隐藏在视口上方，下拉后滑出 */
.ad-navslide { position: fixed; left: 0; right: 0; top: 0; z-index: 99; max-width: 780px; margin: 0 auto; background: #fffbeb; border-bottom: 1px solid #fde68a; box-shadow: 0 2px 10px rgba(0,0,0,.08); transform: translateY(-110%); transition: transform .25s ease; }
.ad-navslide.show { transform: translateY(0); }
.ad-navslide .ad { margin: 0 auto; border-radius: 0; }
.ad-navslide .ad-text { background: transparent; border: none; padding: 8px 14px; }
.ad-navslide .ad-code { padding: 4px 0; }
.ad-navslide .ad-image img { width: 100%; display: block; }
@media (max-width:768px){ .ad-navslide { max-width: 100%; } }

/* 第 6 球与第 7 球（特码）之间的 ➕ 分隔符：纵向在球体与生肖/五行标注的正中间 */
.ball-plus { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; align-self: center; font-size: 14px; font-weight: 800; color: #92400e; line-height: 1; }

/* 开奖时间行（默认隐藏，需要的页面自行开启，如 lottery-page2.php） */
.lottery-opentime { display: none; }

/* 页脚 */
.site-footer { background: #1f2937; color: #cbd5e1; padding: 28px 0; margin-top: 40px; text-align: center; font-size: 13px; }
.site-footer .icp { color: #94a3b8; margin-top: 6px; }
.empty { text-align: center; color: #999; padding: 60px 0; }

@media (max-width: 768px) {
    .article-grid { grid-template-columns: 1fr; }
    .li-cover { width: 100%; height: 180px; flex: none; }
    .post { padding: 18px 16px; }
    .post-cover { margin: -4px -4px 16px; }
    /* H5 全屏 */
    .wrap { max-width: 100%; padding: 0 12px; }
    .site-header { max-width: 100%; }
    .article-wrap { max-width: 100%; }
    .topbar-inner { height: 54px; padding: 0 4px; }
    .main-nav {
        gap: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
    }
    .main-nav::-webkit-scrollbar { display: none; }
    .main-nav a { font-size: 16px; flex-shrink: 0; padding: 2px 0; }
  .nav-logo img { height: 30px; }
  .nav-event-logo { height: 30px; }
    .post-head h1 { font-size: 22px; }
    .post-meta { font-size: 12px; gap: 10px; }
    .banner img { max-height: 160px; }
}
@media (max-width:768px){
  .main-nav-spacer,
  .main-nav-right { display: none; }
}

/* 开奖公告器 */
.lottery { background: linear-gradient(135deg, #fff, #fff); border: 1px solid #14a4ff; border-radius: 14px; padding: 18px 22px; margin: 14px 0; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.04); position: relative; }
.lottery-refresh { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid #fcd34d; background: rgba(255,255,255,.7); color: #b45309; font-size: 18px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: background .15s; }
.lottery-refresh:hover { background: #fff; }
.lottery-refresh.spinning { animation: lottery-spin 0.8s linear infinite; }
@keyframes lottery-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.lottery-event { font-size: 22px; font-weight: 800; color: #b45309; letter-spacing: 1px; }
.lottery-event-wrap { display: flex; align-items: center; justify-content: center; gap: 12px; }
.lottery-event-info { display: flex; flex-direction: column; align-items: flex-start; }
.lottery-logo {
    width: 80px; height: 60px; object-fit: contain; display: block; flex-shrink: 0;
    animation: lottery-spin 6s linear infinite;
    transform-origin: center center;
    will-change: transform;
}
@media (prefers-reduced-motion: reduce) { .lottery-logo { animation: none; } }
.lottery-round { font-size: 15px; color: #92400e; margin-top: 4px; }
.lottery-round .lottery-tag { background: #f59e0b; color: #fff; border-radius: 4px; padding: 1px 8px; font-size: 12px; margin-left: 6px; text-decoration: none; }
.lottery-round .lottery-tag:hover { background: #d97706; }
.lottery-round a.lottery-tag { display: inline-block; text-decoration: none; vertical-align: 1px; }
.lottery-heads { display: grid; grid-template-columns: repeat(7, 46px); gap: 8px; justify-content: center; margin: 14px 0 8px; font-size: 13px; color: #78350f; }
.lottery-heads span:last-child { color: #dc2626; font-weight: 800; font-style: italic; letter-spacing: 1px; }
.lottery-balls { display: grid; grid-template-columns: repeat(7, 46px); gap: 10px; justify-content: center; }

/* 号码球（公基础类）*/
.ball { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; box-shadow: inset 0 -3px 6px rgba(0,0,0,.2), 0 2px 5px rgba(0,0,0,.15); flex-shrink: 0; line-height: 1; }
.lottery-balls .ball { width: 46px; height: 46px; font-size: 19px; }
.history-balls .ball { width: 38px; height: 38px; font-size: 15px; }
.lc-red { background: #e11d48 url('ball-hong.png') center center / cover no-repeat; color: #2f2c2b; }
.lc-blue { background: #2563eb url('ball-lan.png') center center / cover no-repeat; color: #2f2c2b; }
.lc-green { background: #16a34a url('ball-lv.png') center center / cover no-repeat; color: #2f2c2b; }
.ball-empty { background: transparent; border: 2px dashed #c4b5fd; color: #b45309; font-size: 12px; box-shadow: none; }
.history-balls .ball-empty { font-size: 10px; }

.lottery-next { margin-top: 14px; font-size: 14px; color: #a16207; text-align: center; line-height: 1.9; }
.lottery-next .lottery-next-row { display: block; }
.lottery-next .lottery-refresh,
.lottery-next .lottery-refresh:hover,
.lottery-next .lottery-refresh.spinning { all: unset; }
.lottery-next .cd-time { display: inline-block; padding: 2px 8px; background: #fde68a; color: #92400e; border: 1px solid #f59e0b; border-radius: 4px; font-family: ui-monospace, Consolas, monospace; font-weight: 700; font-size: 13px; margin-left: 4px; }
.lottery-next .cd-time { display: inline-block; padding: 1px 8px; margin: 0 4px; background: #fef3c7; border: 1px solid #fde68a; border-radius: 4px; color: #b45309; font-weight: 700; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* 号码球单元（号码 + 下方属性标签） */
.ball-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ball-meta {
    font-size: 12px;
    font-weight: 700;
    color: #92400e;
    background: #fff;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 1px 4px;
    line-height: 1.4;
    letter-spacing: 0;
    white-space: nowrap;
    min-height: 18px;
    box-sizing: border-box;
}
.ball-meta .sx { color: #2f2c2b; }
.ball-meta .wx { font-weight: 800; }
.ball-meta .wx-jin  { color: #ffcc00; }
.ball-meta .wx-mu   { color: #33cc33; }
.ball-meta .wx-shui { color: #3399ff; }
.ball-meta .wx-huo  { color: #ff6600; }
.ball-meta .wx-tu   { color: #cc9900; }
.history-balls .ball-cell { gap: 3px; }
.history-balls .ball-meta  { font-size: 11px; padding: 1px 3px; }

/* 历史开奖页面 */
.history-list { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.history-row { background: #fff; border-radius: 10px; padding: 14px 18px; box-shadow: 0 1px 5px rgba(0,0,0,.05); }
.history-head { text-align: center; font-size: 16px; font-weight: 700; color: #b45309; margin-bottom: 12px; }
.history-balls { display: grid; grid-template-columns: repeat(7, 38px); gap: 8px; justify-content: center; align-items: center; }

@media (max-width: 768px) {
    .lottery-event { font-size: 18px; }
    .lottery-logo { width: 60px; height: 45px; }
    .lottery-heads { grid-template-columns: repeat(7, 38px); gap: 6px; font-size: 11px; }
    .lottery-balls { grid-template-columns: repeat(7, 38px); gap: 6px; }
    .lottery-balls .ball { width: 38px; height: 38px; font-size: 16px; }
}

.featured-full{margin:18px 0;}
.ff-item{background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:18px 20px;margin-bottom:16px;}
.ff-title{
    background: #fde68a;
    margin: -18px -20px 14px;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    border-bottom: 1px solid #f59e0b;
    text-align: center;
}
.ff-title a{color:#1f2937;text-decoration:none;}
.ff-title a:hover{color:#16a34a;}
/* 正文正序 / 倒序切换按钮（首页内容推荐 + 文章详情页共用） */
.ff-bar{display:flex;justify-content:flex-end;margin:0 0 10px;}
.post-bar{display:flex;justify-content:flex-end;margin:-8px 0 14px;}
.ff-order-btn,
.post-order-btn{
    padding:4px 12px;font-size:12px;font-weight:600;cursor:pointer;
    border:1px solid #fcd34d;background:#fff;color:#b45309;border-radius:999px;
    transition:background .15s,color .15s,border-color .15s;
    font-family:inherit;line-height:1.6;
}
.ff-order-btn:hover,
.post-order-btn:hover{background:#fffbeb;}
.ff-order-btn.is-reversed,
.post-order-btn.is-reversed{background:#f59e0b;color:#fff;border-color:#f59e0b;}
.ff-cover{margin:0 0 12px;}
.ff-cover img{max-width:100%;height:auto;border-radius:6px;display:block;}
.ff-content{font-size:15px;line-height:1.75;color:#374151;}
.ff-content p{margin:8px 0;}
.ff-content img{max-width:100%;height:auto;border-radius:4px;}
.ff-content h1,.ff-content h2,.ff-content h3{margin:14px 0 8px;}
.ff-content a{color:#2563eb;text-decoration:underline;}
.ff-meta{display:flex;gap:14px;align-items:center;margin-top:14px;padding-top:12px;border-top:1px dashed #e5e7eb;font-size:13px;color:#6b7280;}
.ff-meta .ff-more{margin-left:auto;color:#16a34a;text-decoration:none;font-weight:500;}
.ff-meta .ff-more:hover{text-decoration:underline;}
@media (max-width:768px){
  .ff-item{padding:14px 14px;}
  .ff-title{margin:-14px -14px 12px;padding:10px 14px;font-size:17px;}
  .ff-content{font-size:14px;}
  .ff-bar{margin-bottom:8px;}
}

/* ===== 弹窗广告 ===== */
.ad-popup-mask {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 9990;
    padding: 20px;
}
.ad-popup-box {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    overflow: hidden;
    animation: ad-popup-in .25s ease-out;
}
@keyframes ad-popup-in {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}
.ad-popup-close {
    position: absolute; top: 8px; right: 10px;
    width: 32px; height: 32px;
    border: none; background: rgba(0,0,0,.6); color: #fff;
    border-radius: 50%; cursor: pointer;
    font-size: 20px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
}
.ad-popup-close:hover { background: rgba(0,0,0,.85); }
.ad-popup-body { display: block; }
.ad-popup-body img { display: block; max-width: 80vw; max-height: 80vh; }
.ad-popup-text { padding: 32px 36px; min-width: 280px; }
.ad-popup-title { font-size: 20px; font-weight: 800; color: #111827; margin-bottom: 12px; }
.ad-popup-content { font-size: 14px; color: #4b5563; line-height: 1.7; margin-bottom: 14px; }
.ad-popup-link a { color: #2563eb; text-decoration: none; font-weight: 600; }

/* ===== 漂浮广告 ===== */
.ad-floating {
    position: fixed;
    right: 20px;
    bottom: 100px;
    width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
    z-index: 9990;
    overflow: hidden;
}
.ad-floating-close {
    position: absolute; top: 4px; right: 6px;
    width: 24px; height: 24px;
    border: none; background: rgba(0,0,0,.5); color: #fff;
    border-radius: 50%; cursor: pointer;
    font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
}
.ad-floating-close:hover { background: rgba(0,0,0,.8); }
.ad-floating-body { display: block; }
.ad-floating-body img { display: block; width: 100%; height: auto; }
.ad-floating-text { padding: 18px 20px; }
.ad-floating-title { font-size: 15px; font-weight: 700; color: #111827; margin-bottom: 6px; }
.ad-floating-content { font-size: 13px; color: #4b5563; line-height: 1.6; }

/* ===== 侧边客服 ===== */
.ad-contact {
    position: fixed;
    right: 16px;
    bottom: 200px;
    width: 60px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    padding: 8px 4px;
    text-align: center;
    text-decoration: none;
    color: #374151;
    z-index: 9990;
    transition: transform .15s, box-shadow .15s;
    display: block;
}
.ad-contact:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.18); color: #111827; }
.ad-contact-icon {
    display: block;
    width: 44px; height: 44px;
    margin: 0 auto 4px;
    object-fit: contain;
    border-radius: 8px;
}
.ad-contact-icon-text {
    background: #16a34a;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 44px;
    text-align: center;
}
.ad-contact-label { font-size: 12px; line-height: 1.2; }
/* 多条客服时向上堆叠：用 JS 排序后给第 N 条加 right-bottom 偏移 */
/* 这里给每条 .ad-contact 用 nth-of-type 上移，避免堆积到底部 */
.ad-contact:nth-of-type(2) { bottom: 268px; }
.ad-contact:nth-of-type(3) { bottom: 336px; }
.ad-contact:nth-of-type(4) { bottom: 404px; }

/* ===== 回到顶部按钮（页面下拉后自动出现，固定右下角） ===== */
.back-to-top {
    position: fixed;
    right: 16px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.78);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 9991;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease, bottom .2s ease, background .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.back-to-top:hover { background: rgba(17, 24, 39, 0.95); }
.back-to-top:active { transform: scale(.94); }
.btt-arrow { font-size: 18px; line-height: 1; font-weight: 700; }
.btt-text { font-size: 9px; line-height: 1; letter-spacing: .5px; opacity: .85; }

@media (max-width: 768px) {
    .ad-floating { width: 180px; bottom: 220px; right: 10px; }
    .ad-contact { right: 8px; bottom: 260px; }
    .ad-contact:nth-of-type(2) { bottom: 328px; }
    .ad-contact:nth-of-type(3) { bottom: 396px; }
    .ad-contact:nth-of-type(4) { bottom: 464px; }
    .ad-popup-text { padding: 22px 24px; min-width: 240px; }
    .back-to-top { right: 8px; width: 44px; height: 44px; }
    .btt-arrow { font-size: 16px; }
    .btt-text { font-size: 8px; }
}