/**
 * 霸服游戏下载 - 前端样式 v2
 * 深色蓝调卡片列表 + 蓝色渐变 banner，移动端优先
 * 文件名 v2 用于绕过 CDN 缓存
 */

/* ===== 强制覆盖主题内容区背景，确保深色全宽 ===== */
.bafu-gd-page {
    background: #0f172a !important;
    min-height: 80vh;
    padding: 0 !important;
    margin: 0 !important;
    color: #e2e8f0;
    box-sizing: border-box;
}
.bafu-gd-page * { box-sizing: border-box; }
.bafu-gd-page a { color: inherit; }

body.bafu-gd-body,
.single-bafu_game .content-wrap,
.post-type-archive-bafu_game .content-wrap,
.single-bafu_game #main,
.post-type-archive-bafu_game #main {
    background: #0f172a !important;
}

/* ===== 顶部功能栏：返回首页 + 搜索过滤 ===== */
.bafu-gd-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(15,23,42,0.97);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(148,163,184,0.15);
}
.bafu-gd-back-home {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 14px;
    background: #1e293b;
    color: #93c5fd !important;
    border: 1px solid #3b82f6;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.bafu-gd-back-home:active { transform: scale(0.97); }
.bafu-gd-ico-back { font-size: 16px; line-height: 1; }

/* 滚动提示条 */
.bafu-gd-marquee {
    overflow: hidden;
    background: rgba(15,23,42,0.9);
    padding: 4px 0;
    border-bottom: 1px solid rgba(148,163,184,0.1);
    white-space: nowrap;
    position: relative;
    height: 28px;
    line-height: 28px;
}
.bafu-gd-marquee-inner {
    display: inline-block;
    color: #ef4444 !important;
    text-decoration: none !important;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    animation: bafuMarquee 10s linear infinite;
    padding-left: 100%;
}
@keyframes bafuMarquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.bafu-gd-search {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    height: 36px;
    background: #0f172a;
    border: 1px solid rgba(148,163,184,0.2);
    border-radius: 18px;
    padding: 0 12px;
}
.bafu-gd-search:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.bafu-gd-ico-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    margin-right: 8px;
    flex-shrink: 0;
}
.bafu-gd-search:focus-within .bafu-gd-ico-search { color: #60a5fa; }
#bafu-gd-search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-size: 13px;
}
#bafu-gd-search-input::placeholder { color: #64748b; }

/* ===== 每日积分弹窗 ===== */
/* 兼容旧 WebView：不用 inset 简写，显式写 top/right/bottom/left */
.bafu-bonus-modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; }
.bafu-bonus-modal[hidden] { display: none; }
.bafu-bonus-mask { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(2,6,23,0.7); }
.bafu-bonus-box {
    position: relative; z-index: 1; width: 78%; max-width: 320px;
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(59,130,246,0.35);
    border-radius: 16px; padding: 26px 20px 20px; text-align: center;
    box-shadow: 0 20px 60px rgba(2,6,23,0.8);
    animation: bafuBonusIn .28s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes bafuBonusIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.bafu-bonus-icon { font-size: 40px; line-height: 1; margin-bottom: 14px; }
.bafu-bonus-text { color: #e2e8f0; font-size: 16px; font-weight: 700; line-height: 1.6; white-space: pre-line; margin-bottom: 20px; }
.bafu-bonus-btn {
    width: 100%; height: 42px; border: none; border-radius: 21px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.bafu-bonus-btn:active { transform: scale(0.97); }

/* ===== 列表自动翻页加载状态 ===== */
.bafu-gd-loading { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; color: #94a3b8; font-size: 14px; }
.bafu-gd-loading[hidden] { display: none !important; }
.bafu-gd-spinner { width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid rgba(96,165,250,.25); border-top-color: #60a5fa; border-right-color: #38bdf8; border-radius: 50%; animation: bafu-gd-spin .72s linear infinite; }
@keyframes bafu-gd-spin { to { transform: rotate(360deg); } }

/* ===== 普通用户下载扣积分确认弹窗 ===== */
.bafu-points-download-title { color: #f8fafc; font-size: 20px; font-weight: 800; text-align: center; margin-bottom: 14px; }
.bafu-points-download-text { color: #cbd5e1; font-size: 15px; line-height: 1.75; text-align: left; margin-bottom: 20px; }
.bafu-points-download-text strong { color: #f59e0b; font-size: 17px; }
.bafu-points-download-status { margin-top: 14px; padding: 9px 12px; border-radius: 9px; text-align: center; font-weight: 700; }
.bafu-points-download-status.is-success { color: #86efac; background: rgba(34,197,94,.12); }
.bafu-points-download-status.is-error { color: #fca5a5; background: rgba(239,68,68,.12); }
.bafu-points-download-modal button:disabled { opacity: .58; }

/* ===== 下载前注意事项弹窗 ===== */
.bafu-download-notice-modal .bafu-bonus-box { text-align: left; }
.bafu-download-notice-title { color: #f59e0b; font-size: 19px; font-weight: 800; margin-bottom: 14px; text-align: center; }
.bafu-download-notice-text { color: #e2e8f0; font-size: 15px; line-height: 1.75; white-space: pre-wrap; max-height: 45vh; overflow-y: auto; margin-bottom: 20px; }
.bafu-download-notice-modal .bafu-bonus-btn { display: block; text-align: center; }
.bafu-download-notice-modal .bafu-bonus-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===== 论坛频道弹窗（双按钮，左图标右文字） ===== */
.bafu-channel-modal .bafu-bonus-box { padding-top: 26px; }
.bafu-channel-head { display: flex; align-items: center; text-align: left; margin-bottom: 20px; }
.bafu-channel-icon { flex-shrink: 0; margin-right: 14px; }
.bafu-channel-text { margin-bottom: 0; font-size: 17px; }
.bafu-bonus-btns { display: flex; gap: 10px; }
.bafu-bonus-btns .bafu-bonus-btn { flex: 1; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.bafu-bonus-btn-ghost {
    flex: 1; height: 42px; border: 1px solid rgba(148,163,184,0.4); border-radius: 21px;
    background: transparent; color: #94a3b8; font-size: 15px; font-weight: 600; cursor: pointer;
}
.bafu-bonus-btn-ghost:active { transform: scale(0.97); }
#bafu-gd-search-clear {
    flex-shrink: 0;
    width: 22px; height: 22px;
    background: rgba(148,163,184,0.15);
    color: #94a3b8;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#bafu-gd-search-clear:hover { background: rgba(148,163,184,0.3); color: #fff; }

/* ===== 卡片列表 ===== */
.bafu-gd-list {
    padding: 10px 0 30px;
    max-width: 720px;
    margin: 0 auto;
}

.bafu-gd-card {
    position: relative;
    margin: 8px 10px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.06);
    background: #1e293b;
    box-shadow: 0 8px 24px rgba(17,24,39,0.25);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.bafu-gd-card:active { transform: scale(0.99); }

.bafu-gd-card-main {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

/* 卡片右侧游戏截图背景：填充右侧空余区域
   渐变由内联多层 background 实现（兼容所有 WebView，无割裂线） */
.bafu-gd-shot-bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 58%;
    z-index: 1;
    background-size: cover, cover;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: normal;
}

.bafu-gd-icon {
    width: 4.5rem;
    min-width: 4.5rem;
    height: 4.5rem;
    margin: 12px;
    flex-shrink: 0;
}
.bafu-gd-icon img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    background: #334155;
}

.bafu-gd-info {
    display: flex;
    flex-direction: column;
    margin: 12px 0;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.bafu-gd-name {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.2px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bafu-gd-tag {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.2;
}
.bafu-gd-desc {
    color: #64748b;
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.bafu-gd-stats {
    display: flex;
    gap: 14px;
    color: #64748b;
    font-size: 12px;
    margin-top: 2px;
}
.bafu-gd-stat { display: inline-flex; align-items: center; }

.bafu-gd-arrow {
    align-self: center;
    margin: 0 12px 0 6px;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    /* 深色圆底衬：截图背景上依然清晰 */
    background: rgba(15,23,42,0.78);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(148,163,184,0.35), 0 2px 6px rgba(0,0,0,0.35);
    backdrop-filter: blur(2px);
    position: relative;
}
.bafu-gd-arrow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-top: 2px solid #e2e8f0;
    border-right: 2px solid #e2e8f0;
    transform: translate(-32%,-50%) rotate(45deg);
}

/* 广告角标（右上角迷你徽章，不遮挡图标） */
.bafu-gd-ribbon {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
}
.bafu-gd-ribbon span {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    letter-spacing: -0.2px;
}

/* ===== 分页 ===== */
.bafu-gd-list .pagination,
.bafu-gd-list .nav-links {
    text-align: center;
    margin: 20px 0 10px;
    padding: 0 10px;
}
.bafu-gd-list .page-numbers {
    display: inline-block;
    min-width: 36px;
    height: 36px;
    line-height: 36px;
    margin: 0 3px;
    padding: 0 10px;
    background: #1e293b;
    color: #e2e8f0 !important;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}
.bafu-gd-list .page-numbers.current { background: #3d8bf4; color: #fff !important; }

/* ===== 空状态 ===== */
.bafu-gd-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
    font-size: 15px;
}

/* ===== 详情页 ===== */
.bafu-gd-single { padding-bottom: 120px !important; }

.bafu-gd-detail-card {
    background: #1e293b;
    margin: 10px;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(17,24,39,0.25);
}
.bafu-gd-detail-head {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.bafu-gd-detail-icon {
    width: 80px;
    height: 80px;
    min-width: 80px;
    flex-shrink: 0;
}
.bafu-gd-detail-icon img {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
    background: #334155;
}
.bafu-gd-detail-info { flex: 1; min-width: 0; }
.bafu-gd-detail-name {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 6px;
    line-height: 1.3;
}
.bafu-gd-detail-tag {
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 6px;
}
.bafu-gd-detail-meta {
    color: #64748b;
    font-size: 12px;
    display: flex;
    gap: 12px;
}
.bafu-gd-detail-tags2 {
    color: #a78bfa;
    font-size: 13px;
    margin-top: 10px;
}

.bafu-gd-section {
    background: #1e293b;
    margin: 10px;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(17,24,39,0.25);
}
.bafu-gd-section-title {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid #3d8bf4;
}
.bafu-gd-detail-content {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
}
.bafu-gd-detail-content p { margin: 0 0 10px; color: #cbd5e1; }
.bafu-gd-detail-content img { max-width: 100%; height: auto; border-radius: 8px; }

.bafu-gd-shots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bafu-gd-shot img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

/* ===== 底部下载栏（上排左右双下载按钮，下排更新日志按钮） ===== */
/* 主题弹窗或移动侧边菜单打开时隐藏下载栏，避免浮在遮罩/菜单上面 */
body.modal-open .bafu-gd-dl-bar,
body.bafu-modal-open .bafu-gd-dl-bar,
body.mobile-navbar-show .bafu-gd-dl-bar,
body.drawer-show .bafu-gd-dl-bar { display: none !important; }
/* 新浏览器额外支持插件自有弹窗；旧 WebView 不影响上面的关键规则 */
body:has(.bafu-bonus-modal:not([hidden])) .bafu-gd-dl-bar { display: none !important; }
.bafu-gd-dl-bar {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: rgba(15,23,42,0.97);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(148,163,184,0.15);
    border-bottom: 1px solid rgba(148,163,184,0.15);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 9999;
    max-width: 720px;
    margin: 0 auto;
    border-radius: 12px 12px 0 0;
}

/* 下载按钮一排（左立即下载 + 右备用下载） */
.bafu-gd-dl-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

/* 立即下载按钮（左侧主按钮） */
.bafu-gd-dl-big {
    flex: 1;
    display: block;
    height: 42px;
    line-height: 42px;
    background: linear-gradient(90deg, #3d8bf4, #2563eb);
    color: #fff !important;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    border-radius: 21px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(61,139,244,0.4);
}
.bafu-gd-dl-big:active { transform: scale(0.99); }

/* 备用下载按钮（右侧次按钮） */
.bafu-gd-dl-bak {
    flex: 1;
    display: block;
    height: 42px;
    line-height: 42px;
    background: #1e293b;
    color: #93c5fd !important;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid #3b82f6;
    border-radius: 21px;
    text-decoration: none;
    box-sizing: border-box;
}
.bafu-gd-dl-bak:active { transform: scale(0.99); }
.bafu-gd-dl-bak:hover { background: #334155; }

/* 单个下载按钮时占满整行 */
.bafu-gd-dl-row .bafu-gd-dl-big:only-child {
    width: 100%;
}

/* 更新日志切换按钮（下方，全宽，点击弹窗） */
.bafu-gd-cl-btn {
    display: block;
    width: 100%;
    height: 30px;
    line-height: 30px;
    background: #1e293b;
    color: #93c5fd;
    border: 1px solid #3b82f6;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    padding: 0;
    text-align: center;
}
.bafu-gd-cl-btn:hover { background: #334155; }
.bafu-gd-cl-btn:active { transform: scale(0.99); }
.bafu-gd-cl-btn::after {
    content: ' ▾';
    font-size: 10px;
}

/* ===== 更新日志弹窗（底部抽屉式） ===== */
.bafu-gd-cl-modal { position: fixed; inset: 0; z-index: 10000; }
.bafu-gd-cl-modal[hidden] { display: none; }
.bafu-gd-cl-mask {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.55);
    animation: bafuFade 0.2s ease;
}
.bafu-gd-cl-sheet {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    max-height: 75vh;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    animation: bafuSlideUp 0.25s ease;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
}
.bafu-gd-cl-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(148,163,184,0.15);
}
.bafu-gd-cl-sheet-title {
    font-size: 15px;
    font-weight: 600;
    color: #93c5fd;
}
.bafu-gd-cl-close {
    width: 30px; height: 30px;
    background: transparent;
    color: #94a3b8;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}
.bafu-gd-cl-close:hover { background: rgba(148,163,184,0.15); color: #fff; }
.bafu-gd-cl-sheet-body {
    padding: 14px 16px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.7;
}
.bafu-gd-cl-sheet-body p { margin: 0 0 8px; }
.bafu-gd-cl-sheet-body p:last-child { margin-bottom: 0; }
@keyframes bafuFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bafuSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.bafu-gd-back {
    text-align: center;
    margin: 20px 0;
}
.bafu-gd-back a {
    display: inline-block;
    padding: 8px 24px;
    background: #334155;
    color: #94a3b8 !important;
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
}

/* ===== 响应式 ===== */
@media (min-width: 768px) {
    .bafu-gd-list { max-width: 720px; }
    .bafu-gd-name { font-size: 1.3rem; }
}

@media (max-width: 360px) {
    .bafu-gd-icon { width: 4rem; min-width: 4rem; height: 4rem; margin: 10px; }
    .bafu-gd-name { font-size: 1.05rem; }
}
