/* static/css3/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

@media (max-width: 375px) {
    html {
        font-size: 14px;
    }
}

@media (min-width: 376px) and (max-width: 414px) {
    html {
        font-size: 15px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
}

/* 顶部导航 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.9375rem;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.05);
}

.logo {
    font-size: 1.35rem;
    font-weight: normal;
    color: #000;
    text-align: center;
    flex: 1;
    margin: 0 0.75rem;
}

.header-side-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 0.8rem;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
    min-width: 3.8rem;
}

.backup-btn {
    background: linear-gradient(135deg, #07c160 0%, #05a050 100%);
    color: #fff;
    border-radius: 0.4rem;
    padding: 0.35rem 0.6rem;
    box-shadow: 0 2px 4px rgba(7, 193, 96, 0.25);
}

.backup-domain {
    font-size: 0.95rem;
    font-weight: 500;
}

.backup-text {
    font-size: 0.75rem;
    opacity: 0.95;
}

.search-trigger-icon {
    width: 1.45rem;
    height: 1.45rem;
    margin-bottom: 0.15rem;
    color: #50637f;
}

/* 搜索面板 */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    z-index: 1000;
    flex-direction: column;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-header {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    gap: 0.5rem;
}

.search-back {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #333;
}

.search-back svg {
    width: 1.4rem;
    height: 1.4rem;
}

.search-overlay-input-wrap {
    flex: 1;
    position: relative;
}

.search-overlay-input {
    width: 100%;
    height: 2.2rem;
    border: 1px solid #e0e0e0;
    border-radius: 1.1rem;
    padding: 0 2rem 0 0.875rem;
    font-size: 0.9rem;
    background: #f5f5f5;
    outline: none;
    box-sizing: border-box;
}

.search-overlay-input:focus {
    border-color: #07c160;
    background: #fff;
}

.search-overlay-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.3rem;
    height: 1.3rem;
    border: none;
    border-radius: 50%;
    background: #ccc;
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-overlay-clear.active {
    display: flex;
}

.search-overlay-submit {
    background: #07c160;
    color: #fff;
    border: none;
    border-radius: 1.1rem;
    padding: 0 1rem;
    height: 2.2rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.search-overlay-result {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    background: #fff;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:active {
    background: #f5f5f5;
}

.search-result-title {
    font-size: 0.95rem;
    color: #333;
}

.search-result-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

.gallery-item-highlight {
    animation: highlightPulse 1.5s ease;
}

@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 0 rgba(7, 193, 96, 0.6); }
    50% { box-shadow: 0 0 0 6px rgba(7, 193, 96, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(7, 193, 96, 0); }
}

/* 轮播图 - 自适应高度，图片完整显示 */
.banner-section {
    position: relative;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    background: #f5f5f5;
}

.banner-section * {
    box-sizing: border-box;
}

.banner-slider {
    position: relative;
    width: 100%;
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.banner-slide {
    width: 100%;
    min-width: 100%;
    aspect-ratio: 2.5 / 1;
    position: relative;
    flex-shrink: 0;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.banner-dots {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: #fff;
    width: 1rem;
    border-radius: 0.25rem;
}

/* 公告栏 */
.notice-bar {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #fff;
    margin-top: 1px;
    font-size: 16px;
    color: #50637f;
    overflow: hidden;
}

.notice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    flex-shrink: 0;
}

.notice-text-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 20px;
}

.notice-text {
    position: absolute;
    white-space: nowrap;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
}

/* 开奖区域 */
.lottery-section {
    background: #fff;
    margin-top: 0.625rem;
}

.lottery-tabs {
    display: flex;
    padding: 0 0.625rem;
    background: #fff;
    gap: 0.25rem;
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 1rem 0;
    cursor: pointer;
    background: #f5f5f5;
    border-radius: 0.5rem 0.5rem 0 0;
    border: none;
    outline: none;
}

.tab-item.active {
    background: #07c160;
    color: #fff;
}

.tab-name {
    font-size: 1.1rem;
    font-weight: bold;
    display: block;
}

.tab-date {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    display: block;
}

.lottery-result {
    padding: 0.9375rem 0.625rem;
    text-align: center;
    border: 2px solid #07c160;
    border-radius: 0 0 0.5rem 0.5rem;
    margin: 0 0.625rem 0.625rem 0.625rem;
    background: #fff;
}

.lottery-iframe {
    border: 2px solid #07c160;
    border-radius: 0 0 0.5rem 0.5rem;
    margin: 0 0.625rem 0.625rem 0.625rem;
    background: #fff;
    overflow: hidden;
    height: 11rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9375rem;
    font-size: 0.8125rem;
    white-space: nowrap;
    gap: 0.625rem;
}

.issue {
    color: #50637f;
    font-size: 1.0625rem;
    font-weight: normal;
}

.issue-text {
    color: #50637f;
}

.issue-num {
    color: #07c160;
}

.countdown {
    color: #eb5252;
    font-size: 1.0625rem;
    font-weight: normal;
}

.history-link {
    color: #07c160;
    font-size: 1.0625rem;
    text-decoration: none;
}

/* 数字球 */
.balls-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(0.2rem, 1.5vw, 0.4rem);
    margin: 1.25rem 0;
    flex-wrap: nowrap;
}

.ball-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.ball {
    width: clamp(2.3rem, 11vw, 3rem);
    height: clamp(2.3rem, 11vw, 3rem);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0.125rem 0.375rem rgba(0,0,0,0.15);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

/* 默认背景 */
.ball {
    background-image: url('../images3/numberbg/download.png');
    background-color: transparent;
}

.ball.red {
    background-image: url('../images3/numberbg/r.png');
    background-color: transparent;
}

.ball.green {
    background-image: url('../images3/numberbg/g.png');
    background-color: transparent;
}

.ball.blue {
    background-image: url('../images3/numberbg/b.png');
    background-color: transparent;
}

.ball-num {
    font-size: clamp(0.95rem, 5vw, 1.5rem);
    font-weight: 500;
    line-height: 1;
    color: #50637f;
    position: absolute;
    top: 44%;
    left: 47%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
}

.ball-zodiac {
    font-size: 1.0625rem;
    color: #50637f;
    font-weight: normal;
    white-space: nowrap;
}

.plus-sign {
    font-size: clamp(1.2rem, 5vw, 1.75rem);
    color: #50637f;
    font-weight: 500;
    flex-shrink: 0;
    align-self: center;
    margin-top: -0.9375rem;
}

.next-issue {
    color: #eb5252;
    font-size: 1.0625rem;
    margin-top: 0.3125rem;
}

/* 快捷链接 */
.quick-links {
    background: #fff;
    margin-top: 0.625rem;
    padding: 0.9375rem;
}

.link-row {
    display: grid;
    /* 默认 3 列，实际列数由 main.js 根据路线数量智能计算后内联覆盖 */
    grid-template-columns: repeat(3, 1fr);
    gap: 0.9375rem 0.625rem;
    margin-bottom: 0.9375rem;
}

.link-row:last-child {
    margin-bottom: 0;
}

.link-item {
    text-align: center;
    color: #fff;
    text-decoration: none;
    font-size: 1.0625rem;
    font-weight: 600;
    background: #07c160;
    padding: 0.75rem 0;
    border-radius: 0.25rem;
}

/* 只有一个路线时居中展示，避免按钮过宽 */
.link-item:only-child {
    width: 100%;
    max-width: 50%;
    margin: 0 auto;
}




/* 功能网格 */
.feature-grid {
    background: #fff;
    margin-top: 0.625rem;
    padding: 1.5rem 1rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.feature-icon-img {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: contain;
}

.feature-item span {
    font-size: 1.125rem;
    color: #50637f;
}

/* 图库标签 */
.gallery-tabs {
    display: flex;
    gap: 0.625rem;
    padding: 0.9375rem;
    background: #fff;
    margin-top: 0.625rem;
}

.gallery-tab {
    flex: 1;
    text-align: center;
    padding: 0.625rem 0;
    background: #07c160;
    color: #fff;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    cursor: pointer;
}

.gallery-tab.active {
    background: #058f4a;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.2);
}

/* 图库列表 - 左右两列交错排列（第1个左、第2个右，顺序往下） */
.gallery-list {
    background: #fff;
    padding: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.gallery-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gallery-item {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: #fff;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-title {
    padding: 0.75rem;
    font-size: 1.25rem;
    color: #50637f;
    text-align: center;
    background: #f3f7fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 图片查看器（灯箱） */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
}

.image-viewer img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.image-viewer.hide {
    display: none;
}





/* 响应式设计 - 适配不同屏幕 */

/* 超小屏幕 (iPhone SE等) */
@media (max-width: 375px) {
    .feature-grid {
        gap: 0.8571rem;
        grid-template-columns: repeat(4, 1fr);
        padding: 1.1429rem 0.8571rem;
    }
    
    .feature-icon-img {
        width: 3rem;
        height: 3rem;
    }
    
    .feature-item span {
        font-size: 0.8571rem;
    }
    
    .tab-name {
        font-size: 0.95rem;
    }
    
    .tab-date {
        font-size: 0.7143rem;
    }
    
    .logo {
        font-size: 1.15rem;
    }
}

/* 小屏幕 (iPhone 12/13/14等) */
@media (min-width: 376px) and (max-width: 414px) {
    .feature-grid {
        gap: 1rem;
        grid-template-columns: repeat(4, 1fr);
        padding: 1.3333rem 1rem;
    }
    
    .feature-icon-img {
        width: 3.3333rem;
        height: 3.3333rem;
    }
    
    .feature-item span {
        font-size: 1rem;
    }
}

/* 中等屏幕 (iPhone Plus/Max, Android大屏手机) */
@media (min-width: 415px) and (max-width: 768px) {
    .lottery-section {
        max-width: 100%;
    }
}

/* 平板设备 */
@media (min-width: 769px) and (max-width: 1024px) {
    body {
        max-width: 48rem;
        margin: 0 auto;
    }
    
    .banner-section {
        height: 12.5rem;
    }
}

/* 大屏幕 (桌面端) - 保持手机样式布局 */
@media (min-width: 1025px) {
    body {
        max-width: 30rem;
        margin: 0 auto;
        background: #e8e8e8;
    }
    
    .banner-section {
        height: 12.5rem;
    }
    
    /* 桌面端固定头部宽度 */
    .header {
        max-width: 30rem;
        margin: 0 auto;
        left: 0;
        right: 0;
        position: sticky;
        transform: none;
    }
    
    /* 确保所有主要内容区域都在容器内 */
    .banner-section,
    .notice-bar,
    .lottery-section,
    .feature-grid,
    .gallery-list {
        max-width: 30rem;
        margin-left: auto;
        margin-right: auto;
    }
}

/* 隐藏滚动条但保留功能 */
.balls-container::-webkit-scrollbar {
    display: none;
}

.balls-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 游戏入口响应式 */
.game-row {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 0.625rem;
}

/* 图库列表响应式 - 始终两列交错排列 */
@media (max-width: 30rem) {
    .gallery-list {
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .gallery-col {
        gap: 0.5rem;
    }
    
    .gallery-title {
        font-size: 1.125rem;
        padding: 0.625rem;
    }
}

@media (min-width: 30.0625rem) {
    .gallery-list {
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .gallery-col {
        gap: 0.75rem;
    }
}
/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(4.2rem + constant(safe-area-inset-bottom));
    height: calc(4.2rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    border-top: 1px solid rgba(229, 229, 229, 0.5);
    z-index: 100;
    box-shadow: 0 -0.125rem 0.25rem rgba(0,0,0,0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #ff4d4f;
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 500;
    transition: all 0.3s ease;
}

.bottom-nav-item.active {
    color: #07c160;
}

.bottom-nav-icon {
    width: 1.8rem;
    height: 1.8rem;
    margin-bottom: 0.35rem;
    fill: currentColor;
}

/* 为底部导航栏留出空间 */
body {
    padding-bottom: calc(4.2rem + constant(safe-area-inset-bottom));
    padding-bottom: calc(4.2rem + env(safe-area-inset-bottom));
}

/* 回到顶部按钮 - 调整位置避免被底部导航遮挡 */
.back-to-top {
    position: fixed;
    bottom: calc(4.5rem + constant(safe-area-inset-bottom));
    bottom: calc(4.5rem + env(safe-area-inset-bottom));
    right: 1rem;
    width: 3rem;
    height: 3rem;
    background: #07c160;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.2);
    z-index: 99;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:active {
    transform: scale(0.95);
}

.back-to-top svg {
    width: 1.5rem;
    height: 1.5rem;
    margin-bottom: 0;
}

.back-to-top span {
    font-size: 0.75rem;
    font-weight: 600;
}
