/* ============================
   基础重置
   ============================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Microsoft YaHei', sans-serif; 
    background-color: #f5f5f5; 
    padding-bottom: 60px;
    overflow-x: hidden;
}

.page { display: none; padding: 10px; }
.page.active { display: block; }

.header-date {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    padding: 12px 0;
    margin-bottom: 5px;
}

/* ============================
   首页彩种卡片
   ============================ */
.lottery-card {
    border: 2px solid #d4af37;
    border-radius: 8px;
    background-color: #fff;
    background-image: url('../images/back.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 5px 12px 5px;
    padding: 6px 0;
    position: relative;
}

.card-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 25px;
    margin-bottom: 6px;
    width: 100%;
    position: relative;
}

.card-header .lottery-name { 
    font-weight: bold; 
    font-size: 15px; 
    color: #8B4513;
    text-align: center;
    flex: 1;
}

.card-header .history-btn { 
    color: #4a90e2; 
    cursor: pointer; 
    font-size: 13px;
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
}

/* ============================
   号码球（首页）
   ============================ */
.balls-container {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-evenly;
    align-items: center;
    padding: 0 2px;
    width: 100%;
}

.ball {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #000 !important;
    font-size: 13px;
    font-weight: bold;
    position: relative;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ball.red   { background-image: url('../images/red.png'); }
.ball.blue  { background-image: url('../images/blue.png'); }
.ball.green { background-image: url('../images/green.png'); }

.ball .num { 
    font-size: 13px; 
    line-height: 1; 
    color: #000 !important; 
    z-index: 2; 
}
.ball .zodiac { 
    font-size: 10px; 
    position: absolute; 
    bottom: -16px; 
    color: #000 !important; 
    font-weight: normal; 
    white-space: nowrap; 
    z-index: 2; 
}

/* ============================
   倒计时区域
   ============================ */
.countdown-area {
    text-align: center;
    font-size: 14px;
    color: #ff0000;
    font-weight: bold;
    min-height: 30px;
    line-height: 30px;
    width: 100%;
    margin-top: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.countdown-area .red-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-image: url('../images/red.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 5px rgba(0,0,0,0.6);
    flex-shrink: 0;
}

/* ============================
   隐藏号码，放大倒计时
   ============================ */
.lottery-card.hide-balls .balls-container {
    display: none !important;
}

.lottery-card.hide-balls .countdown-area {
    font-size: 26px;
    font-weight: bold;
    color: #ff0000;
    min-height: 80px;
    line-height: 80px;
    margin-top: 0;
}

.lottery-card.hide-balls {
    padding: 14px 0;
}

/* ============================
   历史记录页面
   ============================ */
.year-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 10px 6px 10px;
    background: #fff;
    border-bottom: 1px solid #eee;
    margin-bottom: 0;
}
.year-tab {
    padding: 6px 16px;
    font-size: 14px;
    color: #666;
    background: #f0f0f0;
    border-radius: 15px;
    cursor: pointer;
    flex-shrink: 0;
}
.year-tab.active {
    background: #d4af37;
    color: #fff;
    font-weight: bold;
}

.history-tabs-wrap {
    background: #fff;
    padding: 10px;
    border-bottom: 1px solid #eee;
}
.history-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.history-tab {
    text-align: center;
    padding: 8px 4px;
    font-size: 13px;
    color: #666;
    background: #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
}
.history-tab.active {
    background: #4a90e2;
    color: #fff;
    font-weight: bold;
}

.history-list { padding: 8px 5px; }

.history-item {
    background: #fff;
    padding: 12px 8px 16px 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 6px;
}
.history-item .h-title {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #333;
    margin-bottom: 12px;
    padding: 0 4px;
}
.history-item .h-title .expect { font-weight: bold; }
.history-item .h-title .date { color: #999; font-size: 12px; }

.history-item .balls-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    padding: 0 4px;
    gap: 5px;
}
.history-item .ball {
    width: 34px;
    height: 34px;
    font-size: 11px;
    flex-shrink: 0;
}
.history-item .ball .num { font-size: 12px; }
.history-item .ball .zodiac { font-size: 9px; bottom: -14px; }

.history-item .plus-sign {
    font-size: 18px;
    color: #999;
    font-weight: bold;
    margin: 0 2px;
    flex-shrink: 0;
}

/* ============================
   底部导航
   ============================ */
.bottom-nav { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 55px; 
    background: #fff; 
    display: flex; 
    border-top: 1px solid #ddd; 
    z-index: 100; 
}
.nav-item { 
    flex: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    color: #999; 
    font-size: 15px; 
}
.nav-item.active { color: #e74c3c; font-weight: bold; }

/* ============================
   动画
   ============================ */
@keyframes popIn { 
    0% { transform: scale(0); opacity: 0; } 
    80% { transform: scale(1.15); } 
    100% { transform: scale(1); opacity: 1; } 
}
.ball.animate { animation: popIn 0.5s ease-out forwards; }

/* ============================
   开奖进行中：7 个字分别套红波背景
   ============================ */
.balls-container.drawing-now {
    background-image: none !important;
    background-color: transparent !important;
    min-height: auto;
    padding: 0 2px 20px 2px;
    margin: 0;
    justify-content: space-evenly;
    align-items: center;
}

.ball {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ball .num,
.ball .zodiac {
    display: block;
}
.ball .draw-char {
    display: none;
}

.balls-container.drawing-now .ball {
    background-image: url('../images/red.png') !important;
    color: #000 !important;
}
.balls-container.drawing-now .ball .num,
.balls-container.drawing-now .ball .zodiac {
    display: none !important;
}
.balls-container.drawing-now .ball .draw-char {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #000 !important;
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
    background: none;
}

/* ============================
   看料页面
   ============================ */
.kanliao-wrap {
    padding: 0 15px 20px 15px;
    text-align: center;
}

.kanliao-check {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: 0;
    margin-bottom: 12px;
    padding: 0;
    overflow: hidden;
    display: block;
    line-height: 0;
    font-size: 0;
}

.kanliao-check-img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: top;
}

.kanliao-title {
    font-size: 16px;
    font-weight: bold;
    color: #22c55e;
    margin-bottom: 4px;
}

.kanliao-sub {
    font-size: 12px;
    color: #999;
    margin-bottom: 16px;
}

.kanliao-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-width: 500px;
    margin: 0 auto 20px;
}

.kanliao-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 8px;
    background: linear-gradient(180deg, #2fd350 0%, #22b843 100%);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    border-radius: 18px;
    box-shadow: 0 3px 6px rgba(34, 197, 94, 0.3);
    transition: transform 0.15s ease;
    line-height: 1.3;
}
.kanliao-btn:active {
    transform: scale(0.97);
}
.kanliao-btn .ping {
    font-size: 11px;
    color: #fff2a8;
    font-weight: normal;
    margin-top: 2px;
}

.kanliao-tip {
    font-size: 12px;
    color: #22c55e;
    font-weight: bold;
    margin: 15px 0 12px;
}

.kanliao-browsers {
    display: flex;
    justify-content: center;
    gap: 28px;
}

.browser-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.browser-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
.browser-icon.uc     { background: #ff8800; }
.browser-icon.google { background: #4285f4; }
.browser-icon.micro  { background: #00bcf2; }

.browser-name {
    font-size: 11px;
    color: #333;
}

/* ============================
   挑码助手页面
   ============================ */
#tiaoma-page { padding: 8px; background: #fff; }

.tm-cell {
    cursor: pointer;
    text-align: center;
    padding: 8px 2px;
    font-size: 13px;
    color: #666;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    user-select: none;
    transition: all 0.15s;
}
.tm-cell:active {
    transform: scale(0.96);
}
.tm-cell.active {
    background: #fff7e6;
    border-color: #f0a020;
    color: #f0a020;
    font-weight: bold;
}
.tm-tabs {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
.tm-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
}
.tm-tab.active {
    background: #fff;
    color: #333;
    font-weight: bold;
    border-bottom: 2px solid #4a90e2;
}

.tm-result-area {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
    min-height: 100px;
    background: #fafafa;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

.tm-ball {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    user-select: none;
    transition: transform 0.1s;
}
.tm-ball:active { transform: scale(0.9); }

.tm-ball.red   { background-color: #e74c3c; }
.tm-ball.blue  { background-color: #3498db; }
.tm-ball.green { background-color: #2ecc71; }

.tm-selected-display {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #ccc;
    min-height: 20px;
}

.tm-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.tm-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    font-weight: bold;
}
.tm-btn-green {
    background: #fff;
    border: 1px solid #22c55e;
    color: #22c55e;
}
.tm-btn-green:active { background: #f0fff4; }

.tm-panel { }

.tm-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}
.tm-row-3 { grid-template-columns: repeat(3, 1fr); }
.tm-row-4 { grid-template-columns: repeat(4, 1fr); }
.tm-row-5 { grid-template-columns: repeat(5, 1fr); }
.tm-row-6 { grid-template-columns: repeat(6, 1fr); }
.tm-row-7 { grid-template-columns: repeat(7, 1fr); }
.tm-row-10 { grid-template-columns: repeat(10, 1fr); }
.tm-row-12 { grid-template-columns: repeat(12, 1fr); }

.tm-cell {
    text-align: center;
    padding: 8px 2px;
    font-size: 13px;
    color: #666;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    user-select: none;
}
.tm-cell.active {
    background: #fff7e6;
    border-color: #f0a020;
    color: #f0a020;
    font-weight: bold;
}

/* ============================
   小屏适配
   ============================ */
@media screen and (max-width: 375px) {
    .ball { width: 34px; height: 34px; }
    .ball .num { font-size: 12px; }
    .ball .zodiac { font-size: 9px; bottom: -14px; }
    .history-item .ball { width: 30px; height: 30px; }
    .history-item .ball .num { font-size: 11px; }
    .history-tab { font-size: 12px; padding: 6px 2px; }
    .year-tab { padding: 5px 12px; font-size: 13px; }
    .countdown-area .red-ball {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    .balls-container.drawing-now .ball .draw-char { font-size: 13px; }
    .kanliao-btn { font-size: 12px; padding: 8px 5px; }
    .kanliao-btn .ping { font-size: 10px; }
    .browser-icon { width: 32px; height: 32px; font-size: 13px; }
    .lottery-card.hide-balls .countdown-area {
        font-size: 22px;
        min-height: 70px;
        line-height: 70px;
    }
}