body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-image: url('images/bg.jpg');
    width: 100%;
    height: 100vh;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #5c3a1a; /* 深棕色文字 */
}

.container {
    width: 90%; /* Ensure it takes full available width */
    max-width: 800px;
    margin: 40px auto;
    padding: 20px; /* Slightly reduce padding */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    background-color: rgba(255, 255, 255, 0.85); /* 半透明白色背景 */
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* position: relative; */ /* Commented out as it might interfere with flex layout */
    display: flex;
    flex-direction: column;
    height: 90vh; /* Limit height to allow scrolling within */
    border: 1px solid #e0c4a2; /* 浅棕色边框 */
}

/* .header-decoration {
    background-image: url('images/header_bg.png'); 
    background-repeat: repeat-x;
    height: 60px; 
    position: absolute;
    top: -30px; 
    left: 0;
    right: 0;
    z-index: 1;
} */ 

/* .footer-decoration {
    background-image: url('images/footer_bg.png'); 
    background-repeat: no-repeat;
    background-position: center bottom;
    height: 100px; 
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    z-index: 1;
} */ 

h1 {
    text-align: center;
    color: #8b4513; /* 鞍褐色 */
    font-size: 2.5em;
    margin-bottom: 30px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    flex-shrink: 0; /* Prevent shrinking */
}

.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    background-color: #fffaf0; /* FloralWhite 背景 */
    padding: 15px;
    border-radius: 25px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    box-sizing: border-box; /* Include padding and border */
    border: 1px solid #f5e5c6; /* 浅黄色边框 */
    flex-shrink: 0; /* Prevent shrinking */
}

#searchInput {
    padding: 10px 15px;
    border: none;
    border-radius: 20px 0 0 20px;
    outline: none;
    font-size: 1em;
    flex-grow: 1;
    background-color: transparent;
    color: #5c3a1a;
}

#searchInput::placeholder {
    color: #a08464;
}

.search-button {
    padding: 10px 20px;
    border: none;
    background-color: #e0c4a2; /* 浅棕色按钮背景 */
    color: #8b4513; /* 鞍褐色文字 */
    border-radius: 0 20px 20px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.search-button img {
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

.search-button:hover {
    background-color: #d3b89a; /* 悬停时稍深的棕色 */
}
.gg{
    display: flex;
    justify-content: space-between; /* 让图片分布在两端 */
}
.gg img{
    width: 48%; /* 稍微减小宽度以确保间距 */
    height: auto;
    box-sizing: border-box; /* Include padding and border */
}


#rankList {
    overflow-y: auto; /* Enable vertical scrolling */
    flex-grow: 1; /* Allow it to take available space */
    margin-top: 0px; /* Add some space above the table */
    min-height: 0; /* Help flexbox calculate height correctly for scrolling */
}

#lastUpdated {
    text-align: center;
    margin-bottom: 25px;
    font-size: 0.9em;
    color: #7a5c3e;
    flex-shrink: 0; /* Prevent shrinking */
}

table {
    width: 100%;
    border-collapse: collapse;
    box-sizing: border-box; /* Include padding and border */
    table-layout: fixed; /* 固定表格布局 */
    margin-top: 20px;
    background-color: #fff; /* 表格背景设为白色 */
    border-radius: 8px;
    /* overflow: hidden; /* Removed to allow sticky header */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

th, td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #f0e6d8; /* 更浅的分割线 */
}

thead {
    position: sticky;
    top: 0;
    z-index: 10; /* Increased z-index to ensure it's above scrolling content */
    background-color: #f8f0e3; /* Ensure thead has background */
}

th {
    background-color: #f8f0e3; /* 非常浅的棕褐色表头 */
    color: #8b4513; /* 鞍褐色 */
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
    padding: 12px 15px; /* Restore padding */
    /* text-align: left; Removed, rely on default/column specific */
    /* position: sticky; Moved to thead */
    /* top: 0; Moved to thead */
    /* z-index: 2; Ensure th is above content if needed, but thead handles sticking */
}

tr:last-child td {
    border-bottom: none;
}

tr:nth-child(even) {
    background-color: #fdfaf6; /* 偶数行淡色背景 */
}

tr:hover {
    background-color: #f5efea; /* 悬停时背景色 */
}

.rank-col {
    width: 15%;
    font-weight: bold;
}

.name-col {
    width: 40%;
    text-align: left;
    padding-left: 25px;
}

/* 确保姓名列的单元格内容能换行 */
td.name-col {
    overflow-wrap: break-word;
    word-wrap: break-word; /* 兼容旧浏览器 */
    word-break: break-all; /* 允许在任意字符间断行，更强制 */
}

.points-col {
    width: 45%;
    font-weight: bold;
    color: #c8884a; /* 积分用稍亮的棕色 */
}

.no-nickname {
    color: #999;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        width: 90%;
        margin: 20% 5% 5% 5%;
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .search-container {
        flex-direction: column;
        padding: 10px;
    }

    #searchInput {
        border-radius: 20px;
        margin-bottom: 10px;
        width: calc(100% - 30px); /* 调整宽度 */
        text-align: center;
    }

    .search-button {
        border-radius: 20px;
        width: 100%;
        justify-content: center;
    }

    th, td {
        padding: 8px 10px;
        font-size: 0.9em;
    }

    .name-col {
        padding-left: 15px;
    }
}

/* 弹窗 (Modal) 背景 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed; /* 固定定位 */
    z-index: 1000; /* 置于顶层 */
    left: 0;
    top: 0;
    width: 100%; /* 全宽 */
    height: 100%; /* 全高 */
    overflow: auto; /* 如果内容过长则启用滚动 */
    background-color: rgba(0,0,0,0.8); /* 半透明黑色背景 */
    /* display: flex; 使用 Flexbox 居中 - Removed to prevent default display */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
}

/* 弹窗内容 (图片) */
.modal-content {
    margin: 90px auto auto auto;
    display: block;
    max-width: 90%;
    max-height: 80vh; /* 限制最大高度，避免图片过大 */
}

/* 关闭按钮 */
.close-button {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}