:root {
    --background-color: #ecf0f1;
    --text-color: #34495e;
    --hover-color: #e8f4f8;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--background-color);
    transition: background-color 0.3s ease;
}

body.male {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
}

body.female {
    --primary-color: #e74c3c;
    --secondary-color: #c0392b;
}

h1, h2 {
    color: var(--secondary-color);
}

h1 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 0.5em;
}

.description {
    text-align: center;
    margin-bottom: 1em;
    font-size: 1.1em;
    color: var(--secondary-color);
}

.intro {
    text-align: center;
    margin-bottom: 2em;
    font-size: 1em;
    color: var(--text-color);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.intro-full {
    display: block;
}

.intro-short {
    display: none;
}

.gender-toggle {
    text-align: center;
    margin-bottom: 2em;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--secondary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.gender-label {
    margin: 0 10px;
    font-weight: bold;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

tr.player-row {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

tr.player-row:hover {
    background-color: var(--hover-color);
}

.player-name {
    position: relative;
    display: inline-block;
}

.player-name::after {
    content: "Click to view profile →";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease, left 0.3s ease;
    pointer-events: none;
}

tr.player-row:hover .player-name::after {
    opacity: 1;
    left: calc(100% + 10px);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    vertical-align: middle;
}

.flag {
    width: 30px;
    height: 15px;
    margin-right: 10px;
    vertical-align: middle;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.pagination-button {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1em;
    transition: opacity 0.3s ease;
}

.pagination-button:hover {
    opacity: 0.9;
}

.pagination-button.hidden {
    visibility: hidden;
    pointer-events: none;
}

#page-info {
    font-size: 0.9em;
    color: var(--text-color);
}

.gender-indicator {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 1em;
    color: var(--primary-color);
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    table {
        font-size: 14px;
    }
    th, td {
        padding: 10px 5px;
    }
    .avatar {
        width: 30px;
        height: 30px;
        margin-right: 5px;
    }
    .flag {
        width: 20px;
        height: 10px;
        margin-right: 5px;
    }
    .tournaments-column {
        display: none;
    }
    .player-name::after {
        content: none;
    }
    tr.player-row {
        position: relative;
    }
    tr.player-row::after {
        content: "👆 Tap for profile";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(52, 152, 219, 0.8);
        color: white;
        text-align: center;
        padding: 5px;
        font-size: 0.8em;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    tr.player-row:active::after {
        opacity: 1;
    }
    .intro-full {
        display: none;
    }
    .intro-short {
        display: block;
    }
}

/* 骨架屏样式 */
#skeleton-screen {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.skeleton-header,
.skeleton-description,
.skeleton-intro,
.skeleton-toggle,
.skeleton-indicator,
.skeleton-cell,
.skeleton-pagination {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.skeleton-header {
    height: 40px;
    margin-bottom: 20px;
}

.skeleton-description {
    height: 20px;
    margin-bottom: 15px;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}

.skeleton-intro {
    height: 60px;
    margin-bottom: 30px;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.skeleton-toggle {
    height: 34px;
    width: 200px;
    margin: 0 auto 20px;
}

.skeleton-indicator {
    height: 24px;
    width: 180px;
    margin: 0 auto 20px;
}

.skeleton-table {
    width: 100%;
    border-collapse: collapse;
}

.skeleton-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.skeleton-cell {
    height: 20px;
    flex-grow: 1;
    margin-right: 10px;
}

.skeleton-cell:first-child {
    width: 10%;
}

.skeleton-cell:nth-child(2) {
    width: 50%;
}

.skeleton-cell:nth-child(3) {
    width: 20%;
}

.skeleton-cell:last-child {
    width: 20%;
    margin-right: 0;
}

.skeleton-pagination {
    height: 40px;
    margin-top: 20px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 响应式设计调整 */
@media (max-width: 768px) {
    .skeleton-cell.tournaments-column {
        display: none;
    }
    
    .skeleton-cell:nth-child(2) {
        width: 60%;
    }
    
    .skeleton-cell:last-child {
        width: 30%;
    }
}