/* ================================
   🌍 全球 CSS 重置框架
   作用：清除浏览器默认样式，提供一致的样式基础
============================== */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s,
samp, small, strike, strong, sub, sup, tt,
var, b, u, i, center, dl, dt, dd, ol, ul,
li, fieldset, form, label, legend, table,
caption, tbody, tfoot, thead, tr, th, td {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
}

/* HTML 和 body 默认设置 */
html {
    height: 100%;
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
}

body {
    height: 100%;
    line-height: 1;
    font-family: Arial, Helvetica, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 125vh;
    background: url('../logo/bg.png') no-repeat center center fixed;
    background-size: cover; /* 或者 contain，根据需要调整 */
    overflow: auto;
}

/* 📱 响应式优化 */
@media screen and (max-width: 768px) {
    body {
        background-attachment: scroll; /* 禁用 fixed */
        background-size: cover; /* 根据需要调整 */
    }

    /* 其他已有的样式 */
    .logo img {
        width: var(--logo-width);
    }

    #app {
        gap: 8px; 
        width: calc(var(--card-width) * 3 + 36px);
        max-width: 380px;
        margin: 10px auto 30px; 
    }

    .modal-content {
        width: 90vw;
        max-width: var(--modal-max-width);
        min-width: var(--modal-min-width);
        padding: 20px;
    }

    #slideList {
        width: 90vw;
        max-width: var(--slideList-max-width);
        min-width: var(--slideList-min-width);
        max-height: 380px;
        margin: 0 auto 10px;
    }

    #slideList .slide-item {
        padding: 8px 12px;
    }

    #slideList .slide-item span {
        font-size: 0.85rem;
        margin-right: 10px;
        flex: 1; 
    }

    #slideList .slide-item .amount {
        flex: 1.5;
    }

    #slideList .slide-item span:last-child {
        margin-right: 0;
    }
}

/* 列表重置 */
ol, ul {
    list-style: none;
}

/* 引用和标点重置 */
blockquote, q {
    quotes: none;
}

blockquote::before,
blockquote::after,
q::before,
q::after {
    content: '';
    content: none;
}

/* 链接默认样式 */
a {
    text-decoration: none;
    color: inherit;
}

/* 表格重置 */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* 表单元素重置 */
input, button, textarea, select {
    font: inherit;
    margin: 0;
    border: none;
    outline: none;
}

/* 图片默认样式 */
img {
    border: none;
    max-width: 100%;
    height: auto;
    display: block;
}

/* 标题默认样式 */
h1, h2, h3, h4, h5, h6 {
    font-weight: normal;
}

/* 媒体元素 */
audio, canvas, iframe, img, svg, video {
    vertical-align: middle;
}

/* 清除浮动 */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
    visibility: hidden;
}

/* 全局盒模型 */
*, *::before, *::after {
    box-sizing: border-box;
}

/* 滚动条隐藏（可选） */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* 选中文本样式 */
::selection {
    background-color: #b3d4fc;
    color: #fff;
}

/* ================================
   🌟 全局变量定义（保持原始尺寸）
============================== */
:root {
    /* Logo 尺寸 */
    --logo-width: 100px; /* 原始 Logo 宽度 */

    /* 卡牌尺寸 */
    --card-width: 100px; /* 原始卡牌宽度 */
    --card-height: 150px; /* 原始卡牌高度 */

    /* 弹窗尺寸 */
    --modal-width: 350px; /* 原始弹窗宽度 */
    --modal-max-width: 350px; /* 原始弹窗最大宽度 */
    --modal-min-width: 300px; /* 原始弹窗最小宽度 */

    /* 底部轮播列表尺寸 */
    --slideList-width: 400px; /* 原始底部轮播宽度 */
    --slideList-max-width: 400px; /* 原始轮播最大宽度 */
    --slideList-min-width: 280px; /* 原始轮播最小宽度 */
}

/* ================================
   🌍 页面整体容器
============================== */
.container {
    display: flex;
    flex-direction: column;
    min-height: 125vh;
    width: 100%;
    max-width: 480px;
    justify-content: space-between;
    align-items: center; /* 水平居中子元素 */
    position: relative; /* 为绝对定位的子元素提供定位上下文 */
}

/* 📱 强制PC端与移动端使用相同样式 */
@media screen and (min-width: 768px) {
    body {
        background-size: contain; /* 在较大视口上使用 contain */
        max-width: 480px;
        margin: 0 auto;
    }
}

/* 🌟 Logo 样式 */
.logo {
    margin-top: 5vh; /* 控制距离顶部的高度，使用视口高度 */
    margin-bottom: 3vh; /* 控制距离底部的高度 */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.logo img {
    width: var(--logo-width);
    height: auto;
    object-fit: contain;
    animation: flip 16s infinite linear;
}

/* 关键帧分布：
   0%   ~ 18.75%  :  3s   -> 0deg -> 180deg
   18.75%~ 50%    :  5s   -> 保持 180deg
   50%  ~ 68.75%  :  3s   -> 180deg -> 0deg
   68.75%~ 100%   :  5s   -> 保持 0deg
*/
@keyframes flip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(180deg);
    }
    68.75% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

/* 🃏 卡牌布局容器 */
#app {
    margin-top: 35px; /* 调整距离顶部的高度 */
    margin-bottom: 35px; /* 调整距离底部的高度 */
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 固定3列 */
    grid-template-rows: repeat(2, 1fr); /* 固定2行 */
    gap: 15px;
    width: 90%; /* 保持容器宽度百分比，适配不同屏幕 */
    max-width: 380px;
    margin: 10px auto;
    aspect-ratio: 3 / 2;
    position: relative;
    z-index: 3;
}

/* 🃏 卡牌翻转样式 */
.card {
    width: var(--card-width);
    height: var(--card-height);
    perspective: 1000px; /* 3D 透视 */
    cursor: pointer;
    position: relative;  /* 为之后 .card::before(流光) 做定位 */
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden; /* 隐藏背面 */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.card-front {
    background: url('../logo/wp方.png') center/cover;
}

.card-back {
    background: #fff;
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    border-radius: 10px;
}

/* 💬 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* 半透明背景 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000; /* 最顶层 */
}

/* 合并 .modal-content 重复样式 */
.modal-content {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center; /* 图片、文字居中 */
    width: var(--modal-width);
    max-width: var(--modal-max-width);
    min-width: var(--modal-min-width);
}

.modal-content img {
    width: 60%;
    height: auto;
    margin-bottom: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.modal-buttons {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}


/* 🌟 按钮基础样式 */
.enter-btn, .close-btn {
    padding: 0; /* 移除默认内边距，以便更好地控制按钮大小 */
    width: 140px; /* PC版本按钮更大 */
    height: 60px; /* PC版本按钮更高 */
    background-size: 100% 100%; /* 确保背景图片完全覆盖按钮 */
    background-repeat: no-repeat; /* 不重复背景图片 */
    background-position: center; /* 背景图片居中显示 */
    border: none; /* 移除默认边框 */
    cursor: pointer; /* 鼠标悬停时显示为指针 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent; /* 隐藏按钮文本 */
    transition: all 0.3s ease; /* 平滑过渡效果 */
    background-color: transparent; /* 确保背景颜色透明 */
}

/* 🌟 进入按钮样式 */
.enter-btn {
    background-image: url('../logo/按钮.png'); /* 替换为您的进入按钮背景图片路径 */
}

/* 🌟 关闭按钮样式 */
.close-btn {
    background-image: url('../logo/按钮2.png'); /* 替换为您的关闭按钮背景图片路径 */
}

/* 按钮悬停效果 */
.enter-btn:hover, .close-btn:hover {
    opacity: 0.8; /* 悬停时稍微透明 */
    transform: scale(1.05); /* 稍微放大 */
}

/* 按钮点击效果 */
.enter-btn:active, .close-btn:active {
    opacity: 0.6; /* 点击时更透明 */
    transform: scale(1); /* 还原大小 */
}

/* 📱 响应式优化 */
@media screen and (max-width: 768px) {
    .enter-btn, .close-btn {
        width: 100px; /* 移动端按钮适中大小 */
        height: 45px; /* 移动端按钮适中高度 */
    }
}

/* 插入的图片样式 */
#inserted-image-container {
    position: relative;
    top: 85px; /* 控制距离顶部的高度 */
    bottom: 30px; /* 控制距离底部的高度 */
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: var(--slideList-max-width);
    margin: 0 auto;
    z-index: 2;
    margin-bottom: -5px; /* 负的 margin-bottom 以消除间距 */
}

#inserted-image {
    width: 100%;
    height: auto;
    object-fit: contain;
}



/* 底部轮播列表 */
#slideList {
    position: relative;
    width: 100%;
    max-width: var(--slideList-max-width);
    min-width: var(--slideList-min-width);
    height: auto;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin: 1px auto;
    z-index: 0;
    margin-top: 35px; /* 控制距离顶部的高度 */
    margin-bottom: 35px; /* 控制距离底部的高度 */
    touch-action: pan-y; /* 允许滑动屏幕查看更多内容 */
    overflow: visible; /* 移除滚动条 */
    display: flex;
    flex-direction: column;
    gap: 1px; /* 设置所有消息之间的间隔高度 */
}

/* 小屏幕优化，确保内容能够延伸并显示 */
@media screen and (max-width: 768px) {
    #slideList {
        padding: 8px;
        max-width: 100%;
        /* 让列表内容更适配小屏幕 */
        margin: 1px auto;
        display: flex;
        flex-direction: column;
        gap: 1px; /* 设置所有消息之间的间隔高度 */
    }
    
    /* 强制页面内容扩展并能滑动查看 */
    body {
        min-height: 100%; /* 保证页面高度足够 */
        overflow-y: scroll; /* 始终显示页面滚动条 */
    }

    /* 确保 #slideList 的高度能够根据内容动态调整 */
    #slideList {
        height: auto;
    }
}

/* 底部轮播项（不再堆叠，横向排列） */
#slideList .slide-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px; /* 你可以调整这个值来间接影响高度 */
    height: 40px; /* 直接设置高度 */
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 0px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    flex-wrap: nowrap; /* 确保内容不堆叠 */
}

/*-------------------------------------------------------------------*/
#slideList .slide-item:hover {
    transform: translateY(-2px) scale(1.02); /* 悬停时稍微上移并放大 */
    background-color: #f1f1f1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
/*-------------------------------------------------------------------*/

/* 轮播项中的各个信息块 */
#slideList .slide-item span {
    flex: 1; 
    text-align: left;
    font-size: 0.9rem;
    color: #333;
    margin-right: 15px;
}

#slideList .slide-item .amount {
    flex: 1.5; 
    text-align: right;
    color: #dc3545;
    font-weight: bold;
}

#slideList .slide-item span:last-child {
    margin-right: 0;
}



/* 弹窗文字说明样式 */
.modal-content p {
    font-weight: bold;
    text-align: left !important; /* 左对齐文本 */
    font-size: 20px;             /* px 单位 */
    color: #333;
    line-height: 1.5;
    white-space: pre-line;       /* 允许 \n 换行 */
}

/* 数字和 % 符号的高亮动画 */
.modal-content p .highlight {
    font-size: 1.5em;
    color: #e74c3c;
    animation: blinkAndScale 1s infinite;
}

@keyframes blinkAndScale {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* =============================
 *  卡牌伪元素：流光 的公共样式
 ============================= */

.card::before {
    content: "";
    position: absolute;
    top: 3px; /* 增加上边距 */
    left: 3px; /* 增加左边距 */
    width: calc(100% - 2px);  /* 流光区域比卡牌小 6px */
    height: calc(100% - 2px); /* 流光区域比卡牌小 6px */
    border-radius: 10px;
    pointer-events: none;  /* 不阻碍鼠标点击 */
    z-index: 1;            /* 盖在卡牌之上 */
   background: linear-gradient(
    to right,
    rgba(255, 204, 0, 0.6),  /* 金色 */
    rgba(0, 204, 255, 0.6),  /* 天蓝色 */
    rgba(255, 204, 0, 0.6)   /* 金色 */
);

    background-size: 300% 300%;
    opacity: 0; /* 默认透明 */
}

/* ======================================
 * 21s 的大动画周期：
 *   前 3s 执行流光，后 18s 隐藏
 ====================================== */
@keyframes flowSequence {
    /* 0% ~14.2857%（约0s~3s）展示流光 */
    0% {
        opacity: 1;
        background-position: 0% 50%;
    }
    /* ~7.1428%（约1.5s）移动到右侧 */
    7.1428% {
        background-position: 100% 50%;
    }
    /* ~14.2857%（约3s）回到左并开始淡出 */
    14.2857% {
        opacity: 0;
        background-position: 0% 50%;
    }
    /* 后面时间都隐藏 */
    100% {
        opacity: 0;
        background-position: 0% 50%;
    }
}

/* =========================================================
 * 让每张卡都用 flowSequence，并通过 animation-delay 排队
 * 依次延迟 0s, 3s, 6s, 9s, 12s, 15s...
 * ========================================================= */
.card:nth-child(1)::before {
    animation: flowSequence 21s infinite;
    animation-delay: 0s;
}

.card:nth-child(2)::before {
    animation: flowSequence 21s infinite;
    animation-delay: 3s;
}

.card:nth-child(3)::before {
    animation: flowSequence 21s infinite;
    animation-delay: 6s;
}

.card:nth-child(4)::before {
    animation: flowSequence 21s infinite;
    animation-delay: 9s;
}

.card:nth-child(5)::before {
    animation: flowSequence 21s infinite;
    animation-delay: 12s;
}

.card:nth-child(6)::before {
    animation: flowSequence 21s infinite;
    animation-delay: 15s;
}