/* Reset & base */
body {
    font-family: Arial, sans-serif;
    padding: 20px;
    background: #f9f9f9;
    margin: 0;
}

h2 {
    margin-top: 2rem;
    font-size: 1.5rem;
    color: #333;
}

/* Header & Footer */
/* 基础样式 */
header {
    background: #2f70f2;
    color: white;
    font-weight: bold;
    position: relative;
}

.header-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 24px;
}

/* PC导航 */
.nav-pc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 30px;
}

.nav-pc ul li a {
    color: white;
    text-decoration: none;
    font-size: 18px;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

.nav-pc ul li a.active,
.nav-pc ul li a:hover {
    border-color: #fff;
}

/* 移动端菜单按钮，默认隐藏 */
.nav-toggle {
    display: none;
    font-size: 28px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    user-select: none;
}

/* 移动端抽屉菜单，默认隐藏 */
.nav-mobile {
    position: fixed;
    top: 0;
    left: -295px; /* 初始隐藏在左侧外 */
    width: 250px;
    height: 100%;
    background: #2f70f2;
    box-shadow: 2px 0 8px rgba(0,0,0,0.3);
    padding: 20px;
    transition: left 0.3s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.nav-mobile.open {
    left: 0;
}

.nav-mobile .nav-close {
    align-self: flex-end;
    font-size: 30px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    margin-bottom: 20px;
}

.nav-mobile ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.nav-mobile ul li {
    margin-bottom: 15px;
}

.nav-mobile ul li a {
    color: white;
    font-size: 20px;
    text-decoration: none;
}

.nav-mobile ul li a.active,
.nav-mobile ul li a:hover {
    text-decoration: underline;
}

/* 响应式切换 */
@media (max-width: 600px) {
    .nav-pc {
        display: none;
    }
    .nav-toggle {
        display: block;
    }
}


footer {
    text-align: center;
    padding: 15px 0;
    background: #f0f0f0;
    color: #666;
    font-size: 14px;
    margin-top: 30px;
}

/* Section */
section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin: 20px auto;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 0 auto;
}

th, td {
    padding: 10px;
    border: 1px solid #ccc;
    text-align: center;
}

/* Ball display */
.ball {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    margin: 4px;
    user-select: none;
    font-size: 14px;
    text-align: center;
}

.red {
    background: #e03e3e;
}

.blue {
    background: #2f70f2;
}

/* Ball list container */
.ball-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

/* Recommend Button */
#recommend-btn {
    margin-top: 1rem;
    padding: 8px 16px;
    font-size: 16px;
    cursor: pointer;
    background: #2f70f2;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

#recommend-btn:hover {
    background-color: #1d4fbd;
}

/* History */
.history-item {
    margin-bottom: 10px;
    text-align: center;
}

#toggle-history-btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    user-select: none;
}
#toggle-history-btn:hover {
    background-color: #0056b3;
}
#toggle-history-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.5);
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    table, th, td {
        font-size: 14px;
    }

    .ball {
        width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: 13px;
    }

    #recommend-btn {
        width: 100%;
    }
}


#back-to-top {
    display: none;
    position: fixed;
    bottom: 60px;
    right: 20px;
    z-index: 999;
    background-color: #007bff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    align-items: center;
    justify-content: center;
}

#back-to-top svg {
    transition: transform 0.3s ease;
}

#back-to-top:hover {
    background-color: #0056b3;
}

#back-to-top:hover svg {
    transform: translateY(-3px);
}

/* ========== 分页 ========== */
.pagination-wrapper {
    margin-top: 30px;
    text-align: center;
}

.pagination {
    display: inline-flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
    justify-content: center;
    gap: 6px;
}

.pagination li a,
.pagination li span {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #ccc;
    background: #fff;
    color: #007bff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s;
    user-select: none;
}

.pagination li a:hover {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

.pagination li.active span {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    cursor: default;
}

.pagination li.disabled span {
    background-color: #f0f0f0;
    color: #999;
    border-color: #ddd;
    cursor: not-allowed;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #back-to-top {
        width: 44px;
        height: 44px;
        bottom: 80px;
        right: 16px;
        display: none;
    }

    .pagination li a,
    .pagination li span {
        padding: 6px 10px;
        font-size: 12px;
    }
}
