*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
}

.lottery-container {
    max-width: 900px;
    margin: 0 auto;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #fff;
    border: 1px solid #ddd;
}

.page-shell {
    max-width: 900px;
    margin: 10px auto;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.site-banners {
    width: 100%;
    margin-bottom: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-bottom: none;
    overflow: hidden;
}

.site-banner-item + .site-banner-item {
    border-top: 1px solid #eee;
}

.site-banner-item img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.site-banner-link {
    display: block;
    line-height: 0;
}

#recommend-images-section .recommend-images-grid,
.caishen-images-section .recommend-images-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 4px;
    width: 100%;
}

.recommend-image-card {
    min-width: 0;
    text-align: center;
}

.recommend-image-thumb {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #e8e8e8;
    cursor: zoom-in;
    transition: transform 0.2s, box-shadow 0.2s;
}

.recommend-image-thumb:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.recommend-image-title {
    margin-top: 4px;
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    word-break: break-all;
}

@media (min-width: 520px) {
    #recommend-images-section .recommend-images-grid,
    .caishen-images-section .recommend-images-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px 4px;
    }
}

@media (min-width: 720px) {
    #recommend-images-section .recommend-images-grid,
    .caishen-images-section .recommend-images-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.recommend-image-preview {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    cursor: zoom-out;
    padding: 20px;
}

.recommend-image-preview[hidden] {
    display: none !important;
}

.recommend-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body.recommend-preview-open {
    overflow: hidden;
}

.page-shell .lottery-container {
    margin: 0;
}

.page-shell .history-page {
    margin: 0;
    max-width: none;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    padding: 10px;
}

.lottery-tabs {
    display: flex;
    width: 100%;
    border-bottom: 1px solid #ddd;
}

.lottery-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 6px;
    text-align: center;
    cursor: pointer;
    border: 1px solid #ddd;
    border-bottom: none;
    margin-right: -1px;
    background: #fff;
    color: #666;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.lottery-tab:first-child {
    border-left: none;
}

.lottery-tab.active {
    color: #2ecc71;
    border-top: 3px solid #2ecc71;
    font-weight: bold;
    position: relative;
    z-index: 1;
}

.lottery-tab:hover:not(.active) {
    color: #333;
}

.lottery-body {
    padding: 10px 10px 12px;
}

.lottery-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 6px;
}

.lottery-title {
    font-size: 16px;
    color: #333;
}

.lottery-title .issue {
    color: #e74c3c;
    font-weight: bold;
}

.lottery-countdown {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    font-family: "Courier New", monospace;
    letter-spacing: 2px;
}

.lottery-history-link {
    color: #e74c3c;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

.lottery-history-link:hover {
    text-decoration: underline;
}

.lottery-numbers {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(3px, 1vw, 8px);
    flex-wrap: nowrap;
    margin-bottom: 4px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 0;
}

/* 开奖号码：圆形彩边球 + 下方生肖 */
.lottery-card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding: 0;
    background: transparent;
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    flex-shrink: 0;
}

/* 球形：实心填色 */
.lottery-card .number,
.hist-ball {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ffffff;
    font-weight: bold;
    line-height: 1;
    border: none;
    background: #cccccc;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.lottery-card .number {
    width: clamp(42px, 11vw, 56px);
    height: clamp(42px, 11vw, 56px);
    font-size: clamp(16px, 4.5vw, 22px);
    flex-shrink: 0;
}

.lottery-card.red .number,
.hist-ball.red {
    background: #e74c3c;
}

.lottery-card.blue .number,
.hist-ball.blue {
    background: #3498db;
}

.lottery-card.green .number,
.hist-ball.green {
    background: #27ae60;
}

.lottery-card.gray .number,
.lottery-card.placeholder .number,
.hist-ball.gray {
    background: #bdc3c7;
    color: #555555;
}

.lottery-card.awaiting .number {
    background: #e8e8e8;
    color: #888888;
    font-size: clamp(14px, 3.8vw, 18px);
    letter-spacing: 1px;
}

.lottery-card.placeholder .number {
    font-size: clamp(13px, 3.5vw, 17px);
}

.lottery-card.hit .number,
.hist-ball.hit {
    color: #ffffff;
    box-shadow: 0 0 0 2px #f1c40f, 0 2px 5px rgba(0, 0, 0, 0.15);
}

.lottery-card .hit-mark,
.hist-hit-mark {
    font-size: 10px;
    margin-left: 1px;
    color: #ffffff;
    font-weight: bold;
}

.lottery-card .remark-empty {
    visibility: hidden;
    min-height: 14px;
}

.lottery-card .remark {
    background: transparent;
    color: #555555;
    font-size: clamp(10px, 2.6vw, 12px);
    padding: 0;
    border-radius: 0;
    min-width: 0;
    max-width: none;
    width: auto;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
}

.lottery-plus {
    flex: 0 0 auto;
    font-size: clamp(16px, 4.5vw, 24px);
    font-weight: bold;
    color: #888888;
    margin: 0 clamp(2px, 0.6vw, 6px);
    align-self: center;
    line-height: 1;
    padding-top: clamp(10px, 3vw, 14px);
}

.lottery-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 6px;
}

.lottery-footer-refresh-only {
    justify-content: center;
}

.lottery-next {
    font-size: 14px;
    color: #333;
}

.lottery-next .issue {
    color: #e74c3c;
    font-weight: bold;
}

.lottery-refresh {
    background: #f39c12;
    color: #fff;
    border: none;
    padding: 6px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.lottery-refresh:hover {
    background: #e67e22;
}

.lottery-empty {
    text-align: center;
    padding: 20px 10px;
    color: #999;
    font-size: 15px;
}

.section-block {
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px dashed #ddd;
}

.lottery-footer + .section-block {
    margin-top: 4px;
    padding-top: 4px;
}

.section-title {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    margin-bottom: 0;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.section-title-row .section-title {
    margin-bottom: 0;
}

.section-title-row .lottery-history-link {
    flex-shrink: 0;
    font-size: 14px;
}

.section-row {
    margin-bottom: 8px;
}

.section-row-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.section-row-label .issue {
    color: #e74c3c;
    font-weight: bold;
}

.section-numbers {
    margin-bottom: 0;
}

.section-numbers.lottery-numbers,
.lottery-numbers.section-numbers {
    justify-content: flex-start;
}

.lottery-card.card-sm .number {
    width: clamp(32px, 9vw, 40px);
    height: clamp(32px, 9vw, 40px);
    font-size: clamp(13px, 3.6vw, 16px);
}

.lottery-card.card-sm.placeholder .number {
    font-size: clamp(11px, 3vw, 14px);
}

.lottery-card.card-sm .remark {
    font-size: clamp(9px, 2.2vw, 11px);
}

.section-numbers .lottery-plus {
    font-size: clamp(14px, 3.5vw, 20px);
}

/* 历史开奖表格（基础，sections.css 增强） */
.hist-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e8e8e8;
    background: #fff;
}

.hist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.hist-table thead th {
    background: #f5f5f5;
    color: #333;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

.hist-table tbody td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    text-align: center;
}

.hist-table .col-issue .issue-num {
    color: #e74c3c;
    font-weight: bold;
}

.hist-balls {
    display: inline-flex;
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 6px;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
}

.hist-ball-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hist-ball {
    width: 36px;
    height: 36px;
    font-size: 15px;
}

.hist-zodiac {
    font-size: 13px;
    color: #444;
    line-height: 1.1;
}

.hist-plus {
    font-size: 20px;
    font-weight: bold;
    color: #888888;
    line-height: 36px;
    margin: 0 4px;
    align-self: center;
}

/* 推荐号码基础 */
.recommend-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recommend-panel {
    background: #fff;
    border: 1px solid #ddd;
}

.rec-label {
    color: #00ff00;
    font-weight: bold;
}

.rec-value {
    color: #ff0000;
    font-weight: bold;
}

.rec-footer .rec-text {
    color: #00ff00;
    font-weight: bold;
}

.rec-footer .rec-highlight {
    color: #ff0000;
    font-weight: bold;
}

.section-block .section-title {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.hist-page-content {
    background: #fff;
    border: 1px solid #ddd;
}

.hist-page-tabs {
    margin-bottom: 0;
    border: 1px solid #ddd;
    border-bottom: none;
    background: #fff;
}

.history-page .hist-page-content .hist-table-wrap {
    border: none;
}
.history-page {
    max-width: 960px;
    margin: 10px auto;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.history-header h2 {
    font-size: 20px;
    color: #333;
}

.history-back {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
}

.history-item {
    background: #fff;
    border: 1px solid #ddd;
    margin-bottom: 8px;
    padding: 10px 12px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
    color: #666;
}

.history-item-header .issue {
    color: #e74c3c;
    font-weight: bold;
    font-size: 16px;
}

.history-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.history-pagination a,
.history-pagination span {
    padding: 6px 12px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.history-pagination a:hover {
    background: #f5f5f5;
}

.history-pagination .current {
    background: #2ecc71;
    color: #fff;
    border-color: #2ecc71;
}

/* ========== 平板 / 手机自适应 ========== */
@media (max-width: 768px) {
    .lottery-container,
    .history-page,
    .page-shell {
        margin: 4px 2px;
        max-width: none;
    }

    .page-shell .lottery-container,
    .page-shell .history-page {
        margin: 0;
    }

    .site-banners {
        border-left: none;
        border-right: none;
    }

    #recommend-images-section .recommend-images-grid,
    .caishen-images-section .recommend-images-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px 3px;
    }

    .recommend-image-title {
        font-size: 12px;
    }

    .lottery-body {
        padding: 8px 6px 10px;
    }

    .lottery-card .number {
        width: clamp(38px, 10vw, 48px);
        height: clamp(38px, 10vw, 48px);
        font-size: clamp(14px, 4vw, 18px);
    }

    .lottery-card .remark {
        font-size: clamp(9px, 2.4vw, 11px);
    }

    .lottery-card .remark-empty {
        min-height: 12px;
    }

    .lottery-card.placeholder .number {
        font-size: clamp(11px, 3vw, 14px);
    }

    .lottery-plus {
        font-size: clamp(14px, 4vw, 20px);
        padding-top: clamp(8px, 2.5vw, 12px);
    }

    .lottery-tabs {
        flex-wrap: nowrap;
    }

    .lottery-tab {
        flex: 1 1 0;
        min-width: 0;
        padding: 7px 4px;
        font-size: 14px;
    }

    .lottery-header {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 6px;
        margin-bottom: 8px;
    }

    .lottery-title {
        font-size: 15px;
        width: auto;
    }

    .lottery-countdown {
        font-size: clamp(20px, 6vw, 26px);
        letter-spacing: 1px;
    }

    .lottery-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        margin-top: 6px;
    }

    .lottery-next {
        font-size: 13px;
        line-height: 1.5;
        word-break: break-all;
    }

    .lottery-refresh {
        width: 100%;
        padding: 10px 20px;
    }

    .lottery-empty {
        padding: 16px 8px;
        font-size: 14px;
        line-height: 1.5;
    }

    .section-block {
        margin-top: 4px;
        padding-top: 3px;
    }

    .lottery-footer + .section-block {
        margin-top: 3px;
        padding-top: 3px;
    }

    .section-title {
        font-size: 14px;
    }

    .history-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 4px;
    }

    .history-header h2 {
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    .lottery-container,
    .page-shell {
        margin: 2px 0;
        border-left: none;
        border-right: none;
    }

    .page-shell .lottery-container {
        margin: 0;
        border-left: none;
        border-right: none;
    }

    .lottery-numbers {
        gap: 2px;
        justify-content: center;
    }

    .lottery-card {
        max-width: 12%;
        flex-shrink: 1;
    }

    .lottery-card .remark {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .lottery-card .number {
        width: clamp(34px, 9.5vw, 42px);
        height: clamp(34px, 9.5vw, 42px);
    }

    .lottery-card .remark-empty {
        min-height: 11px;
    }

    .hist-table .col-issue,
    .hist-table .col-time {
        font-size: 12px;
        padding: 8px 6px;
    }

    .hist-table .col-time {
        max-width: 88px;
    }
}
