/* --- 基本重置和全局样式 --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

/* 步骤2: 设置新的最外层容器为Flex布局 */
.page-wrapper {
    display: flex;
    flex-direction: column; /* 子元素垂直排列 */
    min-height: 100%; /* 关键：最小高度为100%视口高度 */
}

/* 步骤3: 让内容区域自动伸展，填满所有可用空间 */
.content-wrap {
    flex: 1 0 auto; /* 关键：flex-grow: 1, flex-shrink: 0, flex-basis: auto */
}

/* --- 修改 body 和 footer 的原有样式 --- */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    background-color: #f4f4f4;
    max-width: 438px;
    margin: 0 auto;
    /* max-width 和 margin 应该应用在 page-wrapper 上，而不是 body */
}

.page-wrapper {
    /* 将原来 body 的样式移到这里 */
    max-width: 438px;
    margin: 0 auto;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    background-color: #f4f4f4; /* 保持页面的背景色 */
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- 头部 --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #e53935; /* 红色背景 */
    color: white;
    padding: 0 15px;
    height: 50px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-link, .header-btn {
    font-size: 14px;
}

.header-title {
    font-size: 18px;
    font-weight: 500;
}

.header-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

/* --- 主体内容 --- */
.main-content {
    width: 100%;
    overflow: hidden;
}

/* --- 轮播图 --- */
.swiper-container {
    width: 100%;
    height: 246px; /* 在438px宽度下的高度 */
}

.swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Swiper分页器样式 */
.swiper-pagination-bullet-active {
    background-color: #e53935;
}

.swiper-pagination {
    display: none;
}

/* --- 公告 --- */
.announcement-wrapper {
    padding: 10px;
    background-color: #fff;
    border-bottom: 1px solid #eee;
}

.announcement {
    display: flex;
    align-items: center;
    background-color: #f9f9f9;
    border-radius: 20px; /* 更圆润的角 */
    padding: 8px 15px;
    max-width: 416px;
    margin: 0 auto;
    overflow: hidden; /* 隐藏滚动内容的容器 */
}

.announcement-prefix {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* 防止被压缩 */
    padding-right: 10px; /* 分隔线与文字的距离 */
    margin-right: 10px;
    border-right: 1px solid #e0e0e0;
}

.icon-speaker {
    width: 18px;
    height: 18px;
    color: #e53935; /* 红色图标 */
    margin-right: 6px;
}

.prefix-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.announcement-content-wrapper {
    flex-grow: 1; /* 占据所有剩余空间 */
    overflow: hidden; /* 必须，隐藏内部滚动的p标签 */
    white-space: nowrap; /* 防止p标签自身换行 */
}

.announcement-content p {
    display: inline-block; /* 必须，让动画作用于p标签 */
    padding-left: 100%; /* 关键！让动画从右侧边缘外开始 */
    animation: marquee 15s linear infinite;
}

/* 最终的无缝滚动动画 */
@keyframes marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}


/* style.css (在公告和彩种列表样式之间添加) */

/* --- 彩种分类导航 --- */
.lottery-tabs-wrapper {
    background-color: #fff;
    padding: 0 10px;
    border-bottom: 1px solid #eee;
    overflow-x: auto; /* 关键：实现横向滚动 */
    overflow-y: hidden;
    /* 隐藏滚动条 */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.lottery-tabs-wrapper::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.lottery-tabs {
    display: flex;
    flex-wrap: nowrap; /* 保证不换行 */
    white-space: nowrap;
}

.tab-item {
    display: inline-block;
    padding: 15px 36px;
    font-size: 15px;
    color: #333;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    flex-shrink: 0; /* 防止被压缩 */
    transition: color 0.3s;
}

/* 选中状态的样式 */
.tab-item.active {
    color: #e53935; /* 文字变红 */
    font-weight: 600;
}

/* 选中状态的下划线 */
.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 5px; /* 下划线距离文字的距离 */
    left: 50%;
    transform: translateX(-50%); /* 居中 */
    width: 60%; /* 比文字短一点 */
    height: 3px;
    background-color: #e53935; /* 红色 */
    border-radius: 2px;
}

/* --- 彩种内容区域 --- */
.lottery-content {
    display: none; /* 默认隐藏所有内容 */
}

.lottery-content.active {
    display: block; /* 只显示有active类的那个 */
}



/* --- 彩种列表 --- */
.lottery-list {
    padding: 10px;
}

.lottery-item {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    width: 100%;
    max-width: 420px; /* 在438px容器内的宽度 */
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lottery-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.lottery-name {
    font-size: 16px;
    font-weight: 500;
}

.lottery-issue {
    font-size: 12px;
    color: #999; /* 期号灰色 */
    margin-left: 8px;
}

.lottery-status {
    font-size: 14px;
}
.lottery-status.opening { color: #e53935; } /* 开奖中红色 */
.lottery-status.next-draw { color: #333; }

.lottery-numbers {
    display: flex;
    gap: 8px;
}


/* --- 底部 --- */
.footer {
    text-align: center;
    padding: 20px 15px;
    font-size: 12px;
    color: #999;
    background-color: #ffffff; /* 1. 背景改为白色 */
    flex-shrink: 0; /* 2. 防止页脚在flex布局中被压缩 */
    border-top: 1px solid #eee; /* 3. 添加一个上边框，与内容分隔 */
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.footer-nav a {
    color: #666;
}

/* --- 全屏弹框 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    height: 50px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 18px;
}

.close-btn {
    font-size: 28px;
    font-weight: 300;
    background: none;
    border: none;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-lottery-item {
    display: block;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
}

/* style.css (追加内容) */

/* --- 动态效果样式 --- */

/* 开奖中状态文本 */
.lottery-status.opening {
    color: #e53935;
    font-weight: bold;
}

/* 倒计时文本 */
.countdown-text {
    font-size: 14px;
    color: #333;
}
.countdown-time {
    color: #e53935; /* 倒计时时间红色突出 */
    font-weight: 500;
    margin-left: 4px;
}

/* 滚动的数字球 */
.ball.scrolling {
    animation: digit-scroll 0.1s linear infinite;
}

@keyframes digit-scroll {
    0% { transform: translateY(-5px); }
    50% { transform: translateY(5px); }
    100% { transform: translateY(-5px); }
}


.ball {
    display: inline-block; /* 改为 inline-block */
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    line-height: 30px; /* 垂直居中静态数字 */
    overflow: hidden; /* 关键：隐藏内部滚动的长条的超出部分 */
}

/* 球的背景色 */
.ball.red { background-color: #e53935; }
.ball.qxc-a { background-color: #0092df; }
.ball.qxc-b { background-color: #0fabde; }

/* 内部滚动的数字长条 */
.digit-reel {
    position: absolute;
    left: 0;
    width: 100%;
    /* 我们将通过 JS 设置动画 */
}

/* 数字长条中的每一个数字 */
.digit-reel span {
    display: block;
    height: 30px; /* 每个数字的高度与球的高度相同 */
    line-height: 30px;
}
.lottery-status.stopped {
    color: #999; /* 灰色文字 */
    background-color: #f0f0f0; /* 浅灰色背景 */
    border-radius: 4px;
    padding: 2px 6px;
}

/* 核心滚动动画 */
@keyframes reel-scroll {
    0% {
        transform: translateY(0%);
    }
    100% {
        /*
         * 假设有11个数字 (0-9, 再加一个0用于无缝循环)
         * 总高度是 11 * 30px = 330px
         * 滚动10个数字的高度即为 (10/11) * 100%
         * (10 / 11) 大约是 90.9090...%
         */
        transform: translateY(-90.909090909%);
    }
}