/* CSS 变量定义 */
:root {
    --primary: #e91e63;
    --primary-light: #fce4ec;
    --primary-dark: #c2185b;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #333333;
    --text-light: #888888;
    --border: #eeeeee;
    --success: #4caf50;
    --warning: #ff9800;
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 容器 */
.container {
    margin: 0 auto;
    background: var(--card-bg);
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

section {
    padding-bottom: 20px;
}

/* 顶部彩种导航 */
.lottery-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.lottery-nav a {
    display: block;
    padding: 10px;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    transition: all 0.2s;
}

.lottery-nav a:hover,
.lottery-nav a.active {
    background: var(--primary);
    color: white;
}

/* 彩种头部 */
.lottery-header {
    padding: 20px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.lottery-header .title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.lottery-header .latest {
    font-size: 14px;
    color: var(--text-light);
}

.lottery-header .latest span {
    color: var(--primary);
    font-weight: 600;
}

/* 下期信息卡片 */
.next-issue-card {
    margin: 16px;
    padding: 16px;
    background: var(--primary-light);
    border-radius: 8px;
    min-height: 200px;
    transition: opacity 0.2s ease;
}

.next-issue-header {
    text-align: center;
    margin-bottom: 12px;
}

.next-issue-header .label {
    font-size: 14px;
    color: var(--text-light);
}

.next-issue-header .issue-no {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-left: 8px;
}

/* 倒计时区域 */
.countdown-section {
    text-align: center;
    margin: 12px 0;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.countdown-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.countdown-time {
    font-size: 24px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    color: var(--primary);
    letter-spacing: 1px;
}

/* 预测号码区域 */
.prediction-section {
    text-align: center;
    margin-top: 12px;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.prediction-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.prediction-balls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.prediction-balls .ball {
    width: 32px;
    height: 32px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.prediction-sum {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.sum-label {
    font-size: 13px;
    color: var(--text-light);
}

.sum-ball {
    width: 32px;
    height: 32px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.refresh-btn {
    display: block;
    margin-top: 12px;
    padding: 6px 12px;
    text-align: center;
    text-decoration: none;
    font-size: 12px;
    color: var(--primary);
    background: white;
    border: 1px solid var(--primary);
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;
}

.refresh-btn:hover {
    background: var(--primary);
    color: white;
}

/* Tab 导航 */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
}

.tabs a {
    flex: 1;
    padding: 14px;
    text-align: center;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-light);
    position: relative;
    transition: all 0.2s;
}

.tabs a.active {
    color: var(--primary);
}

.tabs a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 20%;
    width: 60%;
    height: 2px;
    background: var(--primary);
}

/* 开奖记录表格 */
.result-table {
    width: 100%;
    border-collapse: collapse;
}

.result-table th {
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.result-table td {
    padding: 14px 8px;
    font-size: 13px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.result-table tr:hover {
    background: #fafafa;
}

/* 期号 */
.issue-no {
    font-weight: 600;
    color: var(--text);
}

/* 时间 */
.time {
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.4;
}

/* 号码球 */
.balls {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: wrap;
}

.ball {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

/* 不同颜色的球 */
.ball-red {
    background: linear-gradient(135deg, #ef5350, #e53935);
}

.ball-orange {
    background: linear-gradient(135deg, #ffa726, #fb8c00);
}

.ball-yellow {
    background: linear-gradient(135deg, #ffee58, #fdd835);
    color: #333;
}

.ball-green {
    background: linear-gradient(135deg, #66bb6a, #43a047);
}

.ball-cyan {
    background: linear-gradient(135deg, #26c6da, #00acc1);
}

.ball-blue {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
}

.ball-purple {
    background: linear-gradient(135deg, #ab47bc, #8e24aa);
}

.ball-pink {
    background: linear-gradient(135deg, #ec407a, #d81b60);
}

.ball-gray {
    background: linear-gradient(135deg, #78909c, #546e7a);
}

/* 特殊球（最后一个/特码） */
.ball-special {
    background: linear-gradient(135deg, #e91e63, #c2185b);
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.4);
}

/* 号码文字格式 */
.balls-text {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 14px;
    color: var(--text);
}

.balls-text .sum {
    color: var(--primary);
    font-weight: 600;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
    color: var(--text-light);
    border: 1px solid var(--border);
    display: inline-block;
    min-width: 32px;
    text-align: center;
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* 空状态 */
.empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-light);
}

/* 表格容器优化 */
.result-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* 走势表格 */
.trend-table {
    width: 100%;
    table-layout: fixed;
    min-width: 600px;
}

.trend-table th,
.trend-table td {
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    word-break: break-word;
}

.trend-table th {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 期号列固定宽度 */
.trend-table th:first-child,
.trend-table td:first-child {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    position: sticky;
    left: 0;
    background: var(--card-bg);
    z-index: 2;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

/* 值列固定宽度 */
.trend-table th:nth-child(2),
.trend-table td:nth-child(2) {
    width: 50px;
    min-width: 50px;
}

/* 其他列均匀分配剩余空间 */
.trend-table th:not(:first-child):not(:nth-child(2)),
.trend-table td:not(:first-child):not(:nth-child(2)) {
    width: auto;
}

/* 走势表格中的球（值列） */
.trend-table .ball {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* 大小单双标签 */
.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 500;
    color: white;
}

.tag-red {
    background: linear-gradient(135deg, #ef5350, #e53935);
}

.tag-blue {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
}

/* 期数选择按钮 */
.limit-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-light);
    font-size: 14px;
    transition: all 0.2s;
}

.limit-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.limit-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 小屏幕优化（iPhone SE 375px） */
@media (max-width: 375px) {
    .trend-table {
        min-width: 800px;
    }

    .trend-table th,
    .trend-table td {
        padding: 6px 3px;
        font-size: 10px;
    }

    .trend-table th {
        font-size: 9px;
    }

    .trend-table .ball {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .tag {
        min-width: 22px;
        height: 22px;
        font-size: 9px;
    }

    .trend-table th:first-child,
    .trend-table td:first-child {
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }

    .trend-table th:nth-child(2),
    .trend-table td:nth-child(2) {
        width: 45px;
        min-width: 45px;
    }
}