/* ===============================
   GAMES 页：游戏轮播
   - 所有游戏叠放在同一格里淡入淡出，切换时页面不跳
   - 高度以 Apex Girl 原有首屏规则为准（style.css 的 .main_bg_cover / .games_bg_cover），
     其他游戏绝对定位铺满这个高度，内容按可用高度缩放，不改动 Apex Girl 原样式
   - 自动播放由当前圆点里的进度条动画驱动（进度条走完切下一张），停在按钮上/键盘聚焦/弹窗打开时暂停
   - 叠放和隐藏只在 html.gc-js 下生效；脚本没跑起来时各游戏按普通页面上下排列，内容全部可见
   =============================== */
.games-carousel {
    --gc-interval: 6s;
    position: relative;
    overflow: hidden;
    background: #1b1036;
}

.games-carousel__track {
    display: grid;
}

.game-slide {
    position: relative;
}

/* 新的一张在上层淡入；离开的那张保持不透明，等淡入结束再隐藏，避免中途露出底色发暗 */
.gc-js .game-slide {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0s linear .8s, visibility 0s linear .8s;
}

.gc-js .game-slide.is-active {
    z-index: 1;
    opacity: 1;
    visibility: visible;
    transition: opacity .8s ease;
}

/* 轮播脚本初始化完成前不显示切换控件 */
.games-carousel:not(.is-ready) .games-carousel__arrow,
.games-carousel:not(.is-ready) .games-carousel__dots {
    display: none;
}

/* 左右箭头（仅桌面端） */
.games-carousel__arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-top: -26px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    background: rgba(15, 10, 35, .35);
    color: #ffffff;
    cursor: pointer;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: background .2s ease, transform .2s ease;
}

.games-carousel__arrow:hover {
    background: rgba(255, 255, 255, .22);
}

.games-carousel__arrow:focus-visible,
.games-carousel__dot:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.games-carousel__arrow.is-prev {
    left: 28px;
}

.games-carousel__arrow.is-next {
    right: 28px;
}

.games-carousel__arrow.is-prev:hover {
    transform: translateX(-2px);
}

.games-carousel__arrow.is-next:hover {
    transform: translateX(2px);
}

.games-carousel__arrow svg {
    width: 22px;
    height: 22px;
}

/* 圆点：当前项拉长成进度条。桌面端放左下角（避开 Apex Girl 宣传图），
   --gc-fold 由 JS 算出落在首屏外的高度，抬上来但最多 80px */
.games-carousel__dots {
    position: absolute;
    left: 28px;
    bottom: 24px;
    bottom: calc(24px + min(var(--gc-fold, 0px), 80px));
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(10, 6, 25, .3);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.games-carousel__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 28px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.games-carousel__pill {
    position: relative;
    display: block;
    width: 10px;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .45);
    transition: width .4s ease, background .3s ease;
}

.games-carousel__dot:hover .games-carousel__pill {
    background: rgba(255, 255, 255, .75);
}

.games-carousel__dot.is-active .games-carousel__pill {
    width: 36px;
    background: rgba(255, 255, 255, .3);
}

.games-carousel__pill i {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #ffffff;
    transform: scaleX(0);
    transform-origin: left center;
}

.games-carousel__dot.is-active .games-carousel__pill i {
    transform: scaleX(1);
}

.games-carousel.is-autoplay .games-carousel__dot.is-active .games-carousel__pill i {
    animation: gc-progress var(--gc-interval) linear forwards;
}

.games-carousel.is-paused .games-carousel__dot.is-active .games-carousel__pill i {
    animation-play-state: paused;
}

@keyframes gc-progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ===============================
   Tavern Legend 展示页
   尺寸里的 cqh = 这一屏可用高度的 1%，屏幕矮时内容跟着缩小
   =============================== */
/* 轮播模式下绝对定位铺满 Apex Girl 撑出的高度；兜底（上下排列）时自己占一屏高 */
.tl-hero {
    position: relative;
    min-height: 804px;
    container: tl-hero / size;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 120px 84px;
    box-sizing: border-box;
    overflow: hidden;
    color: #ffffff;
}

.gc-js .tl-hero {
    position: absolute;
    inset: 0;
    min-height: 0;
}

/* 背景：宣传图虚化 + 深紫渐变，与游戏 icon 的紫色调呼应 */
.tl-hero__bg {
    position: absolute;
    inset: -60px;
    z-index: -2;
    background: url(../images/2026/11/tavern-legend-feature.jpg) center / cover no-repeat;
    filter: blur(28px) saturate(1.3) brightness(.6);
}

.tl-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 30% 50%, rgba(139, 92, 246, .5) 0%, rgba(139, 92, 246, 0) 42%),
        linear-gradient(120deg, rgba(25, 12, 60, .9) 0%, rgba(58, 24, 120, .72) 55%, rgba(20, 10, 45, .9) 100%);
}

.tl-hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: clamp(32px, 6vw, 96px);
    width: 100%;
    max-width: 1180px;
    transform: translateY(16px);
    transition: transform .8s ease;
}

.game-slide.is-active .tl-hero__inner {
    transform: none;
}

.tl-hero__visual {
    position: relative;
    justify-self: center;
    width: min(100%, 400px);
    width: min(100%, 400px, 62cqh);
}

/* icon 背后的光晕 */
.tl-hero__visual::before {
    content: "";
    position: absolute;
    inset: 10%;
    z-index: -1;
    border-radius: 50%;
    background: rgba(168, 85, 247, .75);
    filter: blur(70px);
}

.tl-hero__icon-frame {
    padding: 6px;
    border-radius: 24%;
    background: linear-gradient(145deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, .08) 60%, rgba(255, 201, 77, .45));
    box-shadow: 0 30px 70px rgba(5, 0, 20, .55);
    animation: tl-float 6s ease-in-out infinite;
}

.tl-hero__icon-frame img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 22%;
}

.game-slide:not(.is-active) .tl-hero__icon-frame {
    animation-play-state: paused;
}

@keyframes tl-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.tl-hero__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* 标题字号与 Apex Girl 一致；窄屏/矮屏时再按可用宽高缩小，保证不折行 */
.tl-hero .tl-hero__title {
    margin: 0;
    padding: 0;
    font-size: clamp(42.901px, 2.681rem + ((1vw - 3.2px) * 4.073), 82px);
    font-size: min(clamp(42.901px, 2.681rem + ((1vw - 3.2px) * 4.073), 82px), 10.5cqh, 6.2cqw);
    line-height: 1.1;
    color: #ffffff;
    text-shadow: 0 4px 24px rgba(0, 0, 0, .35);
}

.tl-hero__desc {
    max-width: 520px;
    margin: 20px 0 0;
    margin-top: min(20px, 2.4cqh);
    font-size: clamp(16px, 1.3vw, 20px);
    line-height: 1.6;
    color: rgba(255, 255, 255, .92);
}

.tl-hero__tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 12px;
    max-width: 560px;
    margin: 26px 0 0;
    margin-top: min(26px, 3cqh);
    padding: 0;
    list-style: none;
}

.tl-hero__tags li {
    margin: 0;
    padding: 7px 16px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    font-size: 14px;
    line-height: 1.4;
    letter-spacing: .02em;
    color: #ffffff;
}

.tl-hero__tags li::before {
    content: "★";
    margin-right: 6px;
    color: #ffc94d;
}

/* 下载按钮 + 「Learn More」并排，高度一致 */
.tl-hero__actions {
    --tl-btn-w: 150px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
    margin-top: min(32px, 3.6cqh);
}

.tl-hero__download {
    display: inline-block;
    transition: transform .2s ease, filter .2s ease;
}

.tl-hero__download:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .35));
}

.tl-hero__download img {
    display: block;
    width: var(--tl-btn-w, 150px);
    height: auto;
}

.tl-hero__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* Google Play 按钮图片宽高比 776:230 */
    height: calc(var(--tl-btn-w) * 230 / 776);
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .02em;
    color: #ffffff;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.tl-hero__more[hidden] {
    display: none;
}

.tl-hero__more:hover {
    border-color: #ffffff;
    background: rgba(255, 255, 255, .18);
}

.tl-hero__more:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.tl-hero__more svg {
    width: 16px;
    height: 16px;
    transition: transform .2s ease;
}

.tl-hero__more:hover svg {
    transform: translateX(3px);
}

.tl-hero__shot {
    width: min(100%, 440px);
    width: min(100%, 440px, 56cqh);
    margin: 36px 0 0;
    margin-top: min(36px, 4cqh);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}

.tl-hero__shot img {
    display: block;
    width: 100%;
    height: auto;
}

/* 矮屏（如 1024×768、横屏手机）先收起特色标签 */
@container tl-hero (max-height: 520px) {
    .tl-hero__tags {
        display: none;
    }
}

@media only screen and (max-width: 1100px) {
    .tl-hero {
        padding-left: 88px;
        padding-right: 88px;
    }
}

/* 手机：上下排布 */
@media only screen and (max-width: 782px) {
    .games-carousel__arrow {
        display: none;
    }

    /* 手机端底部居中，不上抬（会压到 Apex Girl 宣传图） */
    .games-carousel__dots {
        left: 50%;
        bottom: 14px;
        transform: translateX(-50%);
    }

    .tl-hero {
        min-height: 100vh;
        padding: 3vh 20px 64px;
    }

    .tl-hero__inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        gap: min(28px, 3cqh);
        max-width: 560px;
    }

    .tl-hero__visual {
        width: min(48vw, 280px);
        width: min(48vw, 280px, 24cqh);
    }

    .tl-hero__visual::before {
        filter: blur(48px);
    }

    /* 竖排时标签要多占两三行，屏幕不够高就收起 */
    @container tl-hero (max-height: 660px) {
        .tl-hero__tags {
            display: none;
        }
    }

    .tl-hero .tl-hero__title {
        font-size: 48px;
        font-size: min(48px, 12.4cqw);
    }

    .tl-hero__desc {
        margin-top: 12px;
        font-size: 15px;
    }

    .tl-hero__tags {
        gap: 8px;
        margin-top: 18px;
    }

    .tl-hero__tags li {
        padding: 5px 12px;
        font-size: 12px;
    }

    .tl-hero__actions {
        --tl-btn-w: 150px;
        gap: 10px;
        margin-top: 20px;
    }

    .tl-hero__more {
        padding: 0 14px;
        font-size: 14px;
    }

    .tl-hero__shot {
        margin-top: 22px;
    }
}

@media only screen and (max-width: 460px) {
    .tl-hero .tl-hero__title {
        font-size: 40px;
        font-size: min(40px, 12.4cqw);
    }
}

/* 超窄屏（320 宽）两个按钮缩小一点，保证并排不折行 */
@media only screen and (max-width: 340px) {
    .tl-hero__actions {
        --tl-btn-w: 128px;
        gap: 8px;
    }

    .tl-hero__more {
        gap: 6px;
        padding: 0 12px;
        font-size: 13px;
    }
}

/* ===============================
   Tavern Legend 详情弹窗（Google Play 完整介绍）
   =============================== */
.tl-dialog {
    /* 弹窗放在 .site-blocks 外面（那里有 margin-block-start: 0 !important），这里再显式居中一次 */
    inset: 0;
    width: min(760px, calc(100vw - 32px));
    max-width: none;
    max-height: min(86vh, 900px);
    margin: auto;
    padding: 0;
    color-scheme: dark;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 20px;
    background: #1d1240;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
    color: #ffffff;
}

.tl-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: tl-dialog-in .3s ease;
}

.tl-dialog::backdrop {
    background: rgba(8, 4, 20, .72);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

@keyframes tl-dialog-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.98);
    }
}

/* 弹窗打开时锁住页面滚动 */
html.gc-dialog-open {
    overflow: hidden;
    scrollbar-gutter: stable;
}

/* 弹窗打开时轮播进度条暂停（自动播放跟着停） */
html.gc-dialog-open .games-carousel.is-autoplay .games-carousel__dot.is-active .games-carousel__pill i {
    animation-play-state: paused;
}

.tl-dialog__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #ffffff;
    cursor: pointer;
    transition: background .2s ease;
}

.tl-dialog__close:hover {
    background: rgba(255, 255, 255, .22);
}

.tl-dialog__close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.tl-dialog__close svg {
    width: 20px;
    height: 20px;
}

.tl-dialog__head {
    position: relative;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 18px;
    padding: 28px 72px 24px 32px;
    background: linear-gradient(120deg, rgba(139, 92, 246, .45), rgba(58, 24, 120, .2));
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.tl-dialog__icon {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 22%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

.tl-dialog .tl-dialog__title {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
}

.tl-dialog__slogan {
    margin: 6px 0 0;
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255, 255, 255, .82);
}

.tl-dialog__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 24px 32px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.tl-dialog__body p {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.75;
    color: rgba(255, 255, 255, .86);
}

.tl-dialog__features {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 8px 0 20px;
}

.tl-dialog__features section {
    padding: 18px 18px 14px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
}

.tl-dialog .tl-dialog__features h4 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: .06em;
    color: #ffffff;
}

.tl-dialog__features h4::before {
    content: "★";
    margin-right: 6px;
    color: #ffc94d;
}

.tl-dialog__features ul {
    margin: 0;
    padding-left: 18px;
}

.tl-dialog__features li {
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .8);
}

.tl-dialog__features li::marker {
    color: #b794f6;
}

.tl-dialog__body .tl-dialog__note {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: 13px;
    color: rgba(255, 255, 255, .55);
}

.tl-dialog__foot {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    padding: 16px 32px 20px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}

@media only screen and (max-width: 600px) {
    .tl-dialog {
        width: calc(100vw - 24px);
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 16px;
    }

    .tl-dialog__head {
        gap: 14px;
        padding: 20px 60px 18px 20px;
    }

    .tl-dialog__icon {
        width: 56px;
        height: 56px;
    }

    .tl-dialog .tl-dialog__title {
        font-size: 24px;
    }

    .tl-dialog__slogan {
        font-size: 13px;
    }

    .tl-dialog__body {
        padding: 18px 20px 4px;
    }

    .tl-dialog__body p {
        font-size: 14px;
    }

    .tl-dialog__features {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .tl-dialog__foot {
        padding: 14px 20px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gc-js .game-slide,
    .gc-js .game-slide.is-active,
    .tl-hero__inner,
    .games-carousel__pill {
        transition: none;
    }

    .tl-hero__icon-frame,
    .tl-dialog[open] {
        animation: none;
    }
}
