/* 苏白专题短代码：前台样式
 * 结构：透明外层 + 浅色圆角标题区 + 圆角卡片容器 + 专题卡片网格
 */
.subai-game-topics-shortcode {
    --subai-game-topics-max-width: 1200px;
    --subai-game-topics-gap: 18px;
    --subai-game-topics-columns-pc: 4;
    --subai-game-topics-columns-tablet: 3;
    --subai-game-topics-columns-mobile: 1;
    --subai-game-topics-padding-top: 0px;
    --subai-game-topics-padding-bottom: 0px;
    --subai-game-topics-header-radius: 16px;
    --subai-game-topics-header-padding-y: 16px;
    --subai-game-topics-header-padding-x: 22px;
    --subai-game-topics-header-min-height: 72px;
    --subai-game-topics-header-margin-bottom: 14px;
    --subai-game-topics-shell-radius: 16px;
    --subai-game-topics-shell-padding-pc: 22px;
    --subai-game-topics-shell-padding-m: 14px;
    --subai-game-topics-header-bg: #ffffff;
    --subai-game-topics-shell-bg: #ffffff;
    background: transparent !important;
    padding: var(--subai-game-topics-padding-top) 0 var(--subai-game-topics-padding-bottom) !important;
    margin-top: 0 !important;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
}

.subai-game-topics-shortcode *,
.subai-game-topics-shortcode *::before,
.subai-game-topics-shortcode *::after {
    box-sizing: border-box;
}

.subai-game-topics-container {
    width: min(var(--subai-game-topics-max-width), 100%);
    margin: 0 auto;
    background: transparent !important;
}

/* 只在包含 [专题] 短代码的页面，清除子比文章/页面内容容器自带白底 */
body:not(.wp-admin) article:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .post:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .page:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .content-wrap:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .single-content:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .article-content:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .entry-content:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .wp-block-post-content:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .post-content:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .post-body:has(.subai-game-topics-shortcode.is-parent-bg-clear-enabled),
body:not(.wp-admin) .subai-game-topics-parent-clear {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body:not(.wp-admin) .subai-game-topics-parent-clear > .subai-game-topics-shortcode:first-child,
body:not(.wp-admin) .subai-game-topics-parent-clear > p:first-child + .subai-game-topics-shortcode {
    margin-top: 0 !important;
}

/* 顶部标题区：类似 special-header-title，但更贴合子比浅色卡片 */
.subai-game-topics-header {
    position: relative;
    overflow: hidden;
    border-radius: var(--subai-game-topics-header-radius);
    margin: 0 0 var(--subai-game-topics-header-margin-bottom) !important;
    padding: var(--subai-game-topics-header-padding-y) var(--subai-game-topics-header-padding-x) !important;
    min-height: var(--subai-game-topics-header-min-height) !important;
    height: auto !important;
    background:
        radial-gradient(circle at 12% 22%, rgba(91, 141, 239, 0.14), transparent 34%),
        linear-gradient(135deg, var(--subai-game-topics-header-bg), #f7faff 68%, #eef4ff);
    border: 1px solid rgba(226, 233, 247, 0.95);
    box-shadow: 0 8px 28px rgba(34, 73, 140, 0.07);
}


/* 避免被原站/子比专题页的 .special-header 大高度样式影响 */
.subai-game-topics-header.special-header {
    height: auto !important;
    min-height: var(--subai-game-topics-header-min-height) !important;
    padding: var(--subai-game-topics-header-padding-y) var(--subai-game-topics-header-padding-x) !important;
    margin-top: 0 !important;
}
.subai-game-topics-shortcode > p,
.subai-game-topics-shortcode + p:empty,
.subai-game-topics-shortcode p:empty {
    display: none !important;
}
.entry-content > .subai-game-topics-shortcode:first-child,
.article-content > .subai-game-topics-shortcode:first-child,
.wp-block-post-content > .subai-game-topics-shortcode:first-child {
    margin-top: 0 !important;
}

.subai-game-topics-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--subai-game-topics-header-image, none);
    background-size: cover;
    background-position: center;
    opacity: .18;
    pointer-events: none;
}

.subai-game-topics-header::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    right: -72px;
    top: -86px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(91, 141, 239, .16), rgba(54, 195, 255, .08));
    pointer-events: none;
}

.subai-game-topics-header-mask {
    display: none !important;
}

.subai-game-topics-header-inner {
    position: relative !important;
    z-index: 2;
    inset: auto !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
}

.subai-game-topics-header-title {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 !important;
    color: #222 !important;
    font-size: 24px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    letter-spacing: .2px;
}

.subai-game-topics-header-title i {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #5b8def, #36c3ff);
    box-shadow: 0 8px 20px rgba(91, 141, 239, .28);
    font-size: 19px;
    flex-shrink: 0;
}

.subai-game-topics-header-desc {
    margin: 10px 0 0 53px !important;
    color: #697386 !important;
    font-size: 14px !important;
    line-height: 1.7 !important;
    max-width: 680px;
}

.subai-game-topics-shortcode.header-align-center .subai-game-topics-header {
    text-align: center;
}

.subai-game-topics-shortcode.header-align-center .subai-game-topics-header-title {
    justify-content: center;
}

.subai-game-topics-shortcode.header-align-center .subai-game-topics-header-desc {
    margin-left: auto !important;
    margin-right: auto !important;
}

.subai-game-topics-shortcode.header-style-clean .subai-game-topics-header {
    background: var(--subai-game-topics-header-bg);
}

.subai-game-topics-shortcode.header-style-none .subai-game-topics-header {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    padding-left: 0;
    padding-right: 0;
}

.subai-game-topics-shortcode.header-style-none .subai-game-topics-header::after,
.subai-game-topics-shortcode.header-style-none .subai-game-topics-header::before {
    display: none !important;
}

/* 避免被原站/子比专题页的 .special-header 大高度样式影响 */
.subai-game-topics-header.special-header {
    height: auto !important;
    min-height: var(--subai-game-topics-header-min-height) !important;
    padding: var(--subai-game-topics-header-padding-y) var(--subai-game-topics-header-padding-x) !important;
    margin-top: 0 !important;
}
.subai-game-topics-shortcode > p,
.subai-game-topics-shortcode + p:empty,
.subai-game-topics-shortcode p:empty {
    display: none !important;
}
.entry-content > .subai-game-topics-shortcode:first-child,
.article-content > .subai-game-topics-shortcode:first-child,
.wp-block-post-content > .subai-game-topics-shortcode:first-child {
    margin-top: 0 !important;
}

.subai-game-topics-header::before {
    display: none;
}

/* 卡片区圆角背景。外层透明，这一层是插件创建的圆角卡片背景 */
.subai-game-topics-card-shell {
    background: transparent !important;
}

.subai-game-topics-shortcode.has-cards-shell .subai-game-topics-card-shell {
    background: var(--subai-game-topics-shell-bg) !important;
    border: 1px solid #eef3fc;
    border-radius: var(--subai-game-topics-shell-radius);
    padding: var(--subai-game-topics-shell-padding-pc);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.055);
}

.subai-game-topics-shortcode.no-cards-shell .subai-game-topics-card-shell {
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.subai-game-topics-grid {
    display: grid !important;
    grid-template-columns: repeat(var(--subai-game-topics-columns-pc), minmax(0, 1fr)) !important;
    gap: var(--subai-game-topics-gap) !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.subai-game-topics-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eef3fc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    position: relative;
    transform: translateY(0);
    transition: all .34s cubic-bezier(.25, .46, .45, .94);
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

.subai-game-topics-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(91, 141, 239, .25), transparent);
    opacity: 0;
    transition: all .34s ease;
    z-index: 2;
}

.subai-game-topics-shortcode.is-hover-enabled .subai-game-topics-card:hover {
    transform: translateY(-7px);
    border-color: rgba(91, 141, 239, .22);
    box-shadow: 0 16px 42px rgba(91, 141, 239, .12), 0 6px 18px rgba(0, 0, 0, .055);
}

.subai-game-topics-shortcode.is-hover-enabled .subai-game-topics-card:hover::before {
    opacity: 1;
    left: 5%;
    right: 5%;
}

.subai-game-topics-card .cover {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    display: block !important;
    overflow: hidden !important;
    background: #f0f4fd !important;
    text-decoration: none !important;
    flex-shrink: 0 !important;
}

.subai-game-topics-card .cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform .55s cubic-bezier(.25, .46, .45, .94);
}

.subai-game-topics-shortcode.is-hover-enabled .subai-game-topics-card:hover .cover img {
    transform: scale(1.055);
}

.subai-game-topics-card .info {
    padding: 14px 16px 16px;
    background: #fff;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.subai-game-topics-card .info h3 {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    margin: 0 0 4px;
    line-height: 1.45;
    transition: color .25s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subai-game-topics-card .info h3 a {
    color: inherit !important;
    text-decoration: none !important;
}

.subai-game-topics-card .info h3 a:hover,
.subai-game-topics-shortcode.is-hover-enabled .subai-game-topics-card:hover .info h3 {
    color: #5b8def !important;
}

.subai-game-topics-card .info .desc {
    font-size: 13px;
    color: #888;
    line-height: 1.55;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
    flex: 1;
}

.subai-game-topics-card .info .bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.subai-game-topics-card .info .bottom .num {
    font-size: 13px;
    color: #999;
    min-width: 0;
}

.subai-game-topics-card .info .bottom .num b {
    color: #5b8def;
    font-size: 16px;
}

.subai-game-topics-card .info .bottom .btn-view {
    display: inline-block;
    padding: 4px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #fff !important;
    background: #5b8def;
    border-radius: 20px;
    text-decoration: none !important;
    transition: all .25s ease;
    box-shadow: 0 2px 8px rgba(91, 141, 239, .15);
    white-space: nowrap;
}

.subai-game-topics-card .info .bottom .btn-view:hover {
    background: #4a7ad4;
    box-shadow: 0 4px 16px rgba(91, 141, 239, .30);
    transform: translateY(-2px);
}

.subai-game-topics-empty {
    max-width: 1200px;
    margin: 20px auto;
    padding: 24px;
    background: #fff;
    border: 1px solid #eef3fc;
    border-radius: 12px;
    color: #888;
    text-align: center;
}

@media (max-width: 1200px) {
    .subai-game-topics-grid {
        grid-template-columns: repeat(var(--subai-game-topics-columns-tablet), minmax(0, 1fr)) !important;
    }
}

@media (max-width: 620px) {
    .subai-game-topics-container {
        width: 100%;
    }

    .subai-game-topics-header {
        margin-bottom: 12px !important;
        padding: 14px 14px !important;
        min-height: 64px !important;
    }

    .subai-game-topics-header-title {
        font-size: 20px !important;
        gap: 9px;
    }

    .subai-game-topics-header-title i {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 16px;
    }

    .subai-game-topics-header-desc {
        margin-left: 45px !important;
        font-size: 13px !important;
    }

    .subai-game-topics-shortcode.has-cards-shell .subai-game-topics-card-shell {
        padding: var(--subai-game-topics-shell-padding-m);
    }

    .subai-game-topics-grid {
        grid-template-columns: repeat(var(--subai-game-topics-columns-mobile), minmax(0, 1fr)) !important;
        gap: max(12px, var(--subai-game-topics-gap)) !important;
    }

    .subai-game-topics-card .info h3,
    .subai-game-topics-card .info .desc {
        white-space: normal !important;
        word-break: break-word !important;
        overflow: visible !important;
        text-overflow: clip !important;
        max-height: none !important;
    }

    .subai-game-topics-card .info .desc {
        display: block !important;
        -webkit-line-clamp: unset !important;
        -webkit-box-orient: initial !important;
        min-height: 0 !important;
    }

    .subai-game-topics-card .info .bottom {
        flex-wrap: wrap;
    }
}

/* 子比暗夜模式适配：兼容 body.dark-theme 与 body.night */
body.dark-theme .subai-game-topics-shortcode,
body.night .subai-game-topics-shortcode {
    background: transparent !important;
}

body.dark-theme .subai-game-topics-header,
body.night .subai-game-topics-header {
    background:
        radial-gradient(circle at 12% 22%, rgba(91, 141, 239, .18), transparent 34%),
        linear-gradient(135deg, var(--main-bg-color, #222), rgba(91, 141, 239, .08)) !important;
    border-color: var(--main-border-color, rgba(255, 255, 255, .08)) !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .28) !important;
}

body.dark-theme .subai-game-topics-header-title,
body.night .subai-game-topics-header-title {
    color: var(--key-color, #f5f7fb) !important;
}

body.dark-theme .subai-game-topics-header-desc,
body.night .subai-game-topics-header-desc {
    color: var(--muted-color, #9aa4b2) !important;
}

body.dark-theme .subai-game-topics-shortcode.has-cards-shell .subai-game-topics-card-shell,
body.night .subai-game-topics-shortcode.has-cards-shell .subai-game-topics-card-shell {
    background: var(--main-bg-color, #222) !important;
    border-color: var(--main-border-color, rgba(255, 255, 255, .08)) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .32) !important;
}

body.dark-theme .subai-game-topics-card,
body.night .subai-game-topics-card {
    background: var(--main-bg-color, #2a2b2e) !important;
    border-color: var(--main-border-color, rgba(255, 255, 255, .08)) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .26) !important;
}

body.dark-theme .subai-game-topics-card .info,
body.night .subai-game-topics-card .info {
    background: var(--main-bg-color, #2a2b2e) !important;
}

body.dark-theme .subai-game-topics-card .cover,
body.night .subai-game-topics-card .cover {
    background: rgba(255, 255, 255, .05) !important;
}

body.dark-theme .subai-game-topics-card .info h3,
body.dark-theme .subai-game-topics-card .info h3 a,
body.night .subai-game-topics-card .info h3,
body.night .subai-game-topics-card .info h3 a {
    color: var(--key-color, #f5f7fb) !important;
}

body.dark-theme .subai-game-topics-card .info .desc,
body.night .subai-game-topics-card .info .desc {
    color: var(--muted-color, #a8b0bd) !important;
}

body.dark-theme .subai-game-topics-card .info .bottom .num,
body.night .subai-game-topics-card .info .bottom .num {
    color: var(--muted-color, #9aa4b2) !important;
}

body.dark-theme .subai-game-topics-empty,
body.night .subai-game-topics-empty {
    background: var(--main-bg-color, #222) !important;
    border-color: var(--main-border-color, rgba(255, 255, 255, .08)) !important;
    color: var(--muted-color, #9aa4b2) !important;
}
