* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
}

/* 首页样式 */
#home-page {
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.home-title {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 800px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    text-align: center;
    margin-top: 50px;
}

#home-page h1 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.btn-group {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
    background: rgba(255, 255, 255, 1);
    /* ✅ 确保完全不透明 */
    padding: 10px 20px;
}

.btn {
    flex: 1;
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

/* 香港图库 - 激活状态（红色） */
.btn-hk-active {
    background-color: #ec1c1c;
    color: white;
}

/* 澳门图库 - 激活状态（绿色） */
.btn-mo-active {
    background-color: #4CAF50;
    color: white;
}

/* 非激活状态（灰色） */
.btn-inactive {
    background-color: white;
    color: #000;
    border: 1px solid #ddd;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-green {
    background-color: #4CAF50;
    color: white;
}

.btn-blue {
    background-color: #ec1c1c;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.zy20-5 {
    padding: 0px 20px;
}

/* 开奖结果区域样式 */
#lottery-result {
    margin: 0 0 10px 0;
    padding: 5px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#numbers-container {
    display: flex;
    justify-content: space-evenly;
    margin: 10px 0 30px 0;
    width: 100%;
}

/* 开奖号码样式 */
.number-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    width: 12.8%;
    max-width: 12.8%;
    height: 50px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 18px;
    color: white;
    position: relative;
    cursor: default;
    flex-shrink: 0;
}

.number-item .number_hm {
    position: absolute;
    top: 40%;
    left: 47%;
    transform: translate(-50%, -50%);
}

.number_hm {
    color: #333;
    font-size: 1.4em;
}

.number-item .info {
    font-size: 16px;
    margin-top: 55px;
    color: #333;
}

#next-draw-time {
    color: #787878;
    font-size: 16px;
    margin: 5px;
    text-align: left;
}

/* 年份选择样式 */
#year-selection {
    margin-top: 10px;
}

#year-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    gap: 8px;
    justify-content: flex-start;
    margin-top: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;

    /* 隐藏滚动条 - Firefox */
    scrollbar-width: none;

    /* 隐藏滚动条 - IE/Edge */
    -ms-overflow-style: none;
}

/* 隐藏滚动条 - Webkit 浏览器 (Chrome/Safari/移动端) */
#year-buttons::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* 彩色按钮样式 */
.year-btn-color {
    background-color: #007bff;
    /* 蓝色 */
    color: white;
}

/* 黑白按钮样式 */
.year-btn-bw {
    background-color: #6c757d;
    /* 灰色 */
    color: white;
}

/* 悬停效果统一 */
.year-btn-color:hover,
.year-btn-bw:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.year-btn-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.year-btn {
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

/* 缩图展示区域 */
#thumbnail-container {
    margin-top: 10px;
}

#thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

#thumbnails img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
}

#loading-more {
    text-align: center;
    margin-top: 20px;
    display: none;
}

/* 列表页样式 */
#list-page {
    display: none;
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

#container {
    max-width: 800px;
    margin: 0 auto;
    padding: 120px 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

#list-content {
    text-align: center;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.title a {
    color: #007bff;
    text-decoration: none;
}

.title a:hover {
    text-decoration: underline;
}

.number {
    color: #333;
    font-size: 0.9em;
    background-color: #f5f5f5;
    /* ✅ 添加灰色背景 */
    border-radius: 4px;
    /* ✅ 添加小圆角 */
    padding: 4px 8px;
    margin-right: 5px;
}

/* 右侧导航栏 */
#nav {
    position: fixed;
    right: 20px;
    top: 58%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 1000;
}

#nav a {
    text-decoration: none;
    color: #007bff;
    font-size: 14px;
    text-align: center;
    border-radius: 50%;
    background-color: #e9ecef;
    transition: background-color 0.3s;
}

#nav a:hover {
    background-color: #007bff;
    color: #fff;
}

#container h2 {
    scroll-margin-top: 94px;
    padding-top: 20px;
    margin-top: -10px;

}

@media (max-width: 768px) {
    #nav {
        right: 2px;
    }

    #container {
        padding: 120px 20px 5px 5px;
    }

    .detail-content {
        padding:5px !important;
    }

    #detail-page {
        padding: 0px !important;
    }

    .expanded-row {
        gap: 5px !important;
    }

    .expanded-content {
        padding: 10px !important;
    }

    #color-select,
    #search-input,
    #search-button {
        height: 44px;
        /* 移动端稍大一点，方便点击 */
        font-size: 16px;
        /* 防止 iOS 自动缩放 */
    }

    #thumbnails {
        gap: 5px;
    }

    #search-container {
        padding: 10px 5px !important;
    }

    .zy20-5 {
        padding: 0px 5px;
    }

    .btn-group {
        padding: 10px 5px;
    }

    .year-btn,
    .period-bj {
        padding: 10px 5px !important;
    }

    #year-buttons,
    .period-container {
        gap: 5px !important;
    }

    .announcement-icon {
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }

    .announcement-content {
        font-size: 12px;
        animation-duration: 10s;
    }

    #numbers-container {
        margin: 0px 0 20px 0;
    }

    .number-item {
        width: 11.8%;
        font-size: 16px;
    }

    .number-item .number_hm {
        top: 45%;
    }
    #announcement-bar {
    padding: 5px;
    }
}

/* 内容页样式 */
#detail-page {
    display: none;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.detail-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

#detail-page h2 {
    margin-top: 0;
    text-align: center;
}

#detail-page img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
}

.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.period-container {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.period-item {
    flex: 1;
    padding: 10px 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 14px;
    background-color: white;
    text-align: center;
}

.period-item:hover {
    background-color: #f0f0f0;
}

.toggle-button {
    flex: 1;
    padding: 10px 5px;
    border: 1px solid #007bff;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    background-color: #007bff;
    color: white;
    text-align: center;
}

.toggle-button:hover {
    background-color: #0056b3;
}

.expanded-periods {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.expanded-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 800px;
    width: 94%;
    max-height: 80%;
    overflow-y: auto;
}

.expanded-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

#back-button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
}

#back-button:hover {
    background-color: #0056b3;
}

/* 搜索容器样式 - 优化版 */
#search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    padding: 10px 20px;
}

/* 下拉菜单样式优化 */
#color-select {
    padding: 9px 15px;
    border: 1px solid #ddd;
    border-right: none;
    background-color: #fff;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    min-width: 80px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 42px;
    /* 固定高度 */
    box-sizing: border-box;
    /* 包含 padding 和 border */
    line-height: 20px;
    /* 行高对齐 */
    vertical-align: middle;
    border-radius: 6px 0 0 6px;
    -webkit-appearance: none;
    appearance: none;
}

/* 搜索输入框样式优化 */
#search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    outline: none;
    font-size: 14px;
    transition: all 0.3s ease;
    height: 42px;
    /* ✅ 同样设置固定高度 */
    box-sizing: border-box;
    border-radius: 0;
}

#search-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* 搜索按钮样式优化 */
#search-button {
    width: 67px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 42px;
    /* ✅ 按钮也统一高度 */
    box-sizing: border-box;
    border-radius: 0 6px 6px 0;
}

#search-button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

#search-button:active {
    transform: translateY(0);
}

/* 全屏图片查看器样式 */
#image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: none;
}

#image-viewer .viewer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);  /* ✅ 加深背景 */
    cursor: zoom-out;
    z-index: 1;
}

#image-viewer .viewer-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    cursor: pointer;
    /* 添加这个 */
}

#image-viewer .viewer-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    cursor: zoom-out;
    border-radius: 8px;
    pointer-events: auto;  /* ✅ 图片本身可点击 */
    user-select: none;
}

#image-viewer .viewer-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s;
    z-index: 3;
}

#image-viewer .viewer-close:hover {
    color: #007bff;
}

/* 内容页主图点击样式 */
#main-image {
    cursor: zoom-in;
    transition: transform 0.3s;
}

#main-image:hover {
    opacity: 0.9;
}

/* 头部悬停返回按钮样式 */
.back-gd {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 800px;
    width: 100%;
    z-index: 1500;
    box-sizing: border-box;
}

/* 列表页头部三列布局 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 10px;
    box-sizing: border-box;
    background-color: #007bff;
}

.header-left {
    width: 50px;
    /* ✅ 从 50px 增加到 80px */
    min-width: 50px;
    height: 50px;
    /* ✅ 确保足够高度 */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* 中间区域 */
.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
}

#list-title {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

#page-title {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 右边区域 */
.header-right {
    width: 50px;
    /* ✅ 从 50px 增加到 80px */
    min-width: 50px;
    height: 50px;
    /* ✅ 确保足够高度 */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.header-right:hover {
    transform: scale(1.1);
}

/* 列表页和内容页的返回按钮显示控制 */
#back-to-home-float {
    display: none;
}

#back-to-detail-float {
    display: none;
}

/* 页面激活时显示对应返回按钮 */
#list-page {
    display: none;
}

#list-page.active #back-to-home-float {
    display: flex;
}

#detail-page {
    display: none;
}

#detail-page.active #back-to-detail-float {
    display: flex;
}

.period-bj {
    padding: 10px 20px;
    background-color: #fff;
    height: 60px;
}

.home-icon {
    width: 30px;
    height: 24px;
    background-color: #fff;
    clip-path: path('M12.5 25V17.5h5v7.5h6.25V15h3.75L15 3.75 2.5 15h3.75v10z');
    transform: scale(1.2);
}

.fh-icon {
    width: 24px;
    height: 24px;
    background-color: #fff;
    clip-path: path('M11.67 3.75L3.42 12l8.25 8.25 1.59-1.59L6.5 12l6.76-6.67z');
    transform: scale(1.4);
}

.search-icon {
    width: 24px;
    height: 24px;
    background-color: #fff;
    clip-path: path('M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z');
    transform: scale(1.4);
}

.search-icon:active {
    transform: scale(0.95);
}

/* 搜索弹窗样式 */
#search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: none;
}

.search-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.search-modal-content {
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border-radius: 10px;
    width: 98%;
    max-width: 400px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.search-modal-header span:first-child {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.search-close {
    font-size: 30px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.search-close:hover {
    color: #f00;
}

.search-modal-body {
    display: flex;
}

#modal-color-select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px 0 0 6px;
    background-color: #fff;
    font-size: 14px;
    cursor: pointer;
}

#modal-search-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-left: none;
    border-right: none;
    font-size: 14px;
    outline: none;
}

#modal-search-button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-weight: 500;
}

#modal-search-button:hover {
    background-color: #0056b3;
}

.share-icon {
    width: 24px;
    height: 24px;
    background-color: #fff;
    clip-path: path('M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92z');
    transform: scale(1.2);
}

.share-icon:active {
    transform: scale(0.95);
}

/* Toast 提示框样式 */
#toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 15px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    justify-content: center;
}

#toast.show {
    opacity: 1;
    visibility: visible;
}

#toast .toast-icon {
    width: 24px;
    height: 24px;
    background-color: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* 需要添加以下 CSS 样式 */
.btn-group[data-fixed="fixed"] {
    width: 100%;
    max-width: 800px;
    margin-top: 50px;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 占位元素样式 */
.btn-group-placeholder {
    display: none;
    width: 100%;
}

.logo {
    width: 100%;
    margin-top: 50px;
    overflow: hidden;
    /* ✅ 添加这行 */
}

.logo img {
    width: 100%;
    max-width: 100%;
    /* ✅ 添加这行 */
    max-height: 200px;
    /* ✅ 添加这行 */
    display: block;
    /* ✅ 添加这行，消除底部间隙 */
}

/* 公告栏容器 */
#announcement-bar {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 5px 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border-bottom: 1px solid #ddd;
}

/* 公告图标 - 使用背景图片 */
.announcement-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
    background-image: url('/img/laba.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* 文字容器 */
.announcement-text {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* 滚动文字 */
.announcement-content {
    display: inline-block;
    white-space: nowrap;
    color: #1d1919;
    font-size: 14px;
    animation: scroll-left 15s linear infinite;
    padding-left: 100%;
}

/* 滚动动画 */
@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* 悬停暂停滚动 */
#announcement-bar:hover .announcement-content {
    animation-play-state: paused;
}

.lottery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
}

.lottery-header h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: normal;
}

#period {
    color: #007bff;
}

.lottery-record-link {
    color: #007bff;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
}



/* 返回顶部按钮样式 */
#back-to-top {
    position: fixed;
    right: 20px;
    bottom: 40px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    opacity: 0.8;
}

#back-to-top:hover {
    opacity: 1;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#back-to-top:active {
    transform: translateY(0);
}

#back-to-top.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    #back-to-top {
        right: 20px;
        bottom: 30px;
        width: 45px;
        height: 45px;
    }
}