/**
 * 号码样式自定义CSS
 * 这个文件包含所有彩票号码球的自定义样式规则
 */

/* 基本号码球样式覆盖 - 使用!important确保覆盖主题样式 */
.number-ball.custom-bg,
.lottery-ball.custom-bg,
.lottery-shortcode-ball.custom-bg,
.lottery-item-ball.custom-bg,
.lottery-shortcode-item-ball.custom-bg,
.history-lottery-item-ball.custom-bg,
span.custom-bg {
    position: relative !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: transparent !important; /* 移除原背景色 */
    background-size: cover !important;
    background-position: center !important;
    /* 去掉默认颜色，让内联样式生效 */
    /* color: #fff !important; */
    /* 去掉默认文本阴影，可能会影响自定义颜色显示 */
    /* text-shadow: 1px 1px 2px rgba(0,0,0,0.6) !important; */
    overflow: visible !important; /* 修改为visible以显示前缀后缀 */
    border-radius: 50% !important;
    text-align: center !important;
    transition: all 0.3s ease !important; /* 添加过渡效果 */
}

/* 前缀和后缀样式 */
.ball-prefix-suffix {
    position: absolute !important;
    bottom: -16px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 10px !important;
    white-space: nowrap !important;
    color: #333 !important;
    background-color: rgba(255, 255, 255, 0.7) !important;
    padding: 1px 4px !important;
    border-radius: 3px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    z-index: 5 !important;
    max-width: 100px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* 历史记录页面前缀后缀样式 */
.history-lottery-item-ball .ball-prefix-suffix {
    bottom: -14px !important;
    font-size: 9px !important;
}

/* 首页球号的前缀后缀 */
.lottery-numbers .number-ball .ball-prefix-suffix {
    bottom: -18px !important;
    font-size: 10px !important;
}

/* shortcode中球号的前缀后缀 */
.lottery-shortcode-ball .ball-prefix-suffix {
    bottom: -16px !important;
    font-size: 10px !important;
}

.lottery-shortcode-item-ball .ball-prefix-suffix {
    bottom: -14px !important;
    font-size: 9px !important;
}

/* 重置特殊号码球样式 */
.number-ball.special-number.custom-bg,
.lottery-ball.special.custom-bg,
.lottery-shortcode-ball.special.custom-bg,
.lottery-item-ball.special.custom-bg,
.lottery-shortcode-item-ball.special.custom-bg,
.history-lottery-item-ball.special.custom-bg {
    background-color: transparent !important;
}

/* 提高号码文字的层级和内容溢出处理 */
.number-ball.custom-bg,
.lottery-ball.custom-bg span,
.lottery-shortcode-ball.custom-bg span,
.lottery-item-ball.custom-bg span,
.lottery-shortcode-item-ball.custom-bg span,
.history-lottery-item-ball.custom-bg span,
span.custom-bg span {
    position: relative !important;
    z-index: 2 !important;
    /* 确保内联颜色和大小样式能生效 */
    color: inherit !important;
    font-size: inherit !important;
}

/* 首页所有球的通用样式 */
.lottery-numbers .number-ball.custom-bg {
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    margin: 0 5px !important;
    /* 设置为初始值，让内联样式覆盖 */
    font-size: initial; 
    font-weight: bold !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 确保首页所有彩种的球都能显示背景图片 */
#taiwan-lottery .lottery-numbers .number-ball.custom-bg,
#macau-lottery .lottery-numbers .number-ball.custom-bg,
#hongkong-lottery .lottery-numbers .number-ball.custom-bg {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* 修复首页特别号码 */
.lottery-numbers .number-ball.special-number.custom-bg {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* 修复在历史记录页面的号码球样式 */
.history-lottery-item-ball.custom-bg {
    width: 30px !important;
    height: 30px !important;
    font-size: 14px !important; /* 默认文字大小，可被内联样式覆盖 */
    margin: 2px !important;
    margin-bottom: 18px !important; /* 给前缀后缀留出空间 */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    z-index: 2 !important; /* 确保内容在顶层 */
    
    /* 确保不应用默认颜色 */
    background-color: transparent !important;
    color: inherit;
    text-shadow: none;
}

/* 优化历史记录页面选择器，减少嵌套和复杂度 */
.history-lottery-item-ball.custom-bg {
    color: inherit;
    text-shadow: none;
}

/* 简化特别号码样式 */
.history-lottery-item-ball.special.custom-bg {
    background-color: transparent !important;
}

/* 移除可能导致性能问题的attr函数，它在CSS中支持有限 */
.history-lottery-item-ball.custom-bg.style-applied {
    /* 不再使用attr()函数，改为依赖内联样式 */
    text-shadow: none !important;
}

/* 修复在shortcode中的号码球样式 */
.lottery-shortcode-ball.custom-bg {
    width: 35px !important;
    height: 35px !important;
    line-height: 35px !important;
    font-size: 16px !important; /* 默认文字大小，可被内联样式覆盖 */
    margin: 0 3px !important;
    margin-bottom: 20px !important; /* 给前缀后缀留出空间 */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.lottery-shortcode-item-ball.custom-bg {
    width: 28px !important;
    height: 28px !important;
    line-height: 28px !important;
    font-size: 13px !important; /* 默认文字大小，可被内联样式覆盖 */
    margin: 0 2px !important;
    margin-bottom: 16px !important; /* 给前缀后缀留出空间 */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* 响应式样式 */
@media (max-width: 767px) {
    .lottery-numbers .number-ball.custom-bg {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important; /* 默认文字大小，可被内联样式覆盖 */
    }
    
    .history-lottery-item-ball.custom-bg {
        width: 26px !important;
        height: 26px !important;
        font-size: 12px !important; /* 默认文字大小，可被内联样式覆盖 */
    }
    
    .lottery-shortcode-ball.custom-bg {
        width: 30px !important;
        height: 30px !important;
        line-height: 30px !important;
        font-size: 14px !important; /* 默认文字大小，可被内联样式覆盖 */
    }
    
    .lottery-shortcode-item-ball.custom-bg {
        width: 24px !important;
        height: 24px !important;
        line-height: 24px !important;
        font-size: 12px !important; /* 默认文字大小，可被内联样式覆盖 */
    }
    
    /* 响应式前缀后缀样式 */
    .ball-prefix-suffix {
        font-size: 12px !important;
        padding: 0 3px !important;
    }
}

@media (max-width: 480px) {
    .lottery-numbers .number-ball.custom-bg {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important; /* 默认文字大小，可被内联样式覆盖 */
        margin: 0 3px !important;
    }
    
    .history-lottery-item-ball.custom-bg {
        width: 24px !important;
        height: 24px !important;
        font-size: 11px !important; /* 默认文字大小，可被内联样式覆盖 */
        margin: 1px !important;
        margin-bottom: 16px !important;
    }
    
    .lottery-shortcode-item-ball.custom-bg {
        width: 22px !important;
        height: 22px !important;
        line-height: 22px !important;
        font-size: 11px !important; /* 默认文字大小，可被内联样式覆盖 */
        margin: 0 1px !important;
        margin-bottom: 14px !important;
    }
    
    /* 更小屏幕的前缀后缀样式 */
    .ball-prefix-suffix {
        font-size: 11px !important;
        padding: 0 2px !important;
        bottom: -12px !important;
    }
} 