/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

a {
    color: #0389ff;
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: #fe5000;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 15px;
}

.clear::after {
    content: "";
    display: table;
    clear: both;
}

/* ===== 头部样式 ===== */
.site-header {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 20px; /* 根据需要调整数值 */
}

#primary-bar {
    background: #3d4557;
    color: #fff;
    font-size: 13px;
    padding: 8px 0;
}
#primary-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#primary-nav ul {
    list-style: none;
    display: flex;
}
#primary-nav ul li a {
    color: #fff;
    padding: 0 15px;
    border-right: 1px solid rgba(255,255,255,0.2);
}
#primary-nav ul li:last-child a {
    border-right: none;
}
.top-right {
    display: flex;
    gap: 15px;
    align-items: center;
}
.top-right li {
    list-style: none;
    color: #fff;
}
.top-right a {
    color: #fff;
}
.site-start {
    padding: 20px 0;
}
.site-start .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.site-branding {
    display: flex;
    align-items: center;
    gap: 15px;
}
.site-title h1 {
    font-size: 24px;
    font-weight: 700;
}
.site-title a {
    color: #333;
}
.site-desc {
    font-size: 13px;
    color: #999;
    border-left: 1px solid #ddd;
    padding-left: 15px;
}
.site-desc .line2 {
    color: #fe5000;
}

.header-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}
.header-search form {
    display: flex;
}
.header-search .search-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #0389ff;
    border-right: none;
    border-radius: 4px 0 0 4px;
    outline: none;
}
.header-search .search-submit {
    padding: 8px 20px;
    background: #0389ff;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-weight: 500;
}
.header-search .search-submit:hover {
    background: #fe5000;
}

.header-icons {
    display: flex;
    gap: 15px;
}
.header-icon {
    position: relative;
    cursor: pointer;
}
.header-icon span {
    background: #f0f2f5;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
}
.header-icon .bottom-space {
    display: none;
    position: absolute;
    top: 30px;
    right: 0;
    z-index: 100;
}
.header-icon:hover .bottom-space {
    display: block;
}
.bottom {
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    width: 180px;
    text-align: center;
}
.bottom img {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
}
.bottom h3 {
    font-size: 13px;
    font-weight: normal;
}

/* ===== 内容区域 ===== */
.content-wrap-full {
    width: 100%;
}
.section-links {
    background: #fff;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}
.section-header h3 {
    font-size: 18px;
    font-weight: 600;
}
.section-header h3 a {
    color: #333;
}
.section-header h3 a:hover {
    color: #0389ff;
}
.section-more a {
    color: #999;
    font-size: 16px;
    cursor: pointer;
}
.section-more a:hover {
    color: #0389ff;
}

/* 网格布局：默认每行8列，最小列宽140px，自适应 */
.section-links-wrap {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 15px;
}

/* 选手卡片样式（横向，固定高度60px） */
.player-card {
    height: 50px;
    background: #f9f9f9;
    border-radius: 6px;
    transition: 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible !important; /* 确保悬浮框不被裁剪 */
    z-index: 1;
    padding-left: 0; /* 让手柄和勾选框控制左边距 */
}
.player-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    z-index: 10;
}
.player-card .player-main-link {
    display: flex;
    align-items: center;
    height: 100%;
    color: #333;
}
.player-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-left: 8px; /* 左边距让图标与文字有间距 */
    display: flex;
    align-items: center;
    justify-content: center;
}
.player-avatar img {
    width: 25px;
    height: 25px;
    object-fit: cover;
    border-radius: 50%;
}
.player-name {
    flex: 1;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    padding: 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 悬浮平台图标（右侧竖排，图标+文字，宽120px） */
.player-card .player-platforms-hover {
    display: none; /* 默认隐藏 */
    position: absolute;
    right: 0;
    top: 80%;
    width: 120px;
    background: rgba(0,0,0,.5);
    border-radius: 6px;
    padding: 8px;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.player-card:hover .player-platforms-hover {
    display: flex; /* PC悬停显示 */
}
.player-card.mobile-active .player-platforms-hover {
    display: flex; /* 移动端点击后显示 */
}
.player-platforms-hover .platform-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 12px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}
.player-platforms-hover .platform-item:hover {
    background: rgba(255,255,255,0.2);
}
.player-platforms-hover .platform-item img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}
.player-platforms-hover .platform-item .platform-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.player-platforms-hover .platform-item.is-main {
    border: 1px solid #fe5000;
    background: rgba(254,80,0,0.2);
}

/* 分类设置模态框 */
#category-settings-modal,
#player-sort-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
#category-settings-modal .modal-content,
#player-sort-modal .modal-content {
    background: #fff;
    width: 400px;
    max-width: 90%;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}
#category-settings-modal h3,
#player-sort-modal h3 {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.close-modal {
    cursor: pointer;
    font-size: 24px;
    color: #999;
}
#category-sortable-list,
#player-sortable-list {
    list-style: none;
    margin: 15px 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}
#category-sortable-list li,
#player-sortable-list li {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
#category-sortable-list li .drag-handle,
#player-sortable-list li .drag-handle {
    cursor: move;
    margin-right: 10px;
    color: #999;
}
#category-sortable-list li .cat-name,
#player-sortable-list li .player-name {
    flex: 1;
    margin-left: 10px;
}
#save-category-settings,
#save-player-sort {
    background: #0389ff;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

/* 搜索高亮 */
.highlight {
    background-color: #fe5000;
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
}

/* 搜索结果弹窗 */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.search-modal-content {
    background: #fff;
    width: 800px;
    max-width: 95%;
    max-height: 85vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    padding: 25px;
    position: relative;
    text-align: center;
    margin: auto;
}
.search-modal-content h3 {
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #0389ff;
    padding-bottom: 10px;
    text-align: center;
}
.close-search {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}
.close-search:hover {
    color: #fe5000;
}
.search-results-list {
    max-height: 65vh;
    overflow-y: auto;
}
.search-results-list .results-count {
    color: #666;
    margin-bottom: 15px;
    text-align: center;
}
.search-results-list .no-results {
    text-align: center;
    padding: 40px 0;
    color: #999;
    font-size: 16px;
}
.search-results-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}
.search-result-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s;
    flex: 0 0 140px;
    max-width: 140px;
}
.search-result-card:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.search-result-card .result-link {
    display: block;
    color: #333;
    text-decoration: none;
    text-align: center;
}
.search-result-card .result-avatar {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-result-card .result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.search-result-card .result-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}
.search-result-card .result-platforms {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    text-align: center;
}
.search-result-card .result-platforms a {
    display: inline-block;
    text-align: center;
}
.search-result-card .result-platforms a img {
    width: 30px;
    height: 30px;
}

/* sortable 占位符样式 */
.sortable-placeholder {
    background: #e3f2fd !important;
    border: 2px dashed #0389ff !important;
    border-radius: 6px;
    visibility: visible !important;
    min-height: 50px;
}

/* 选手卡片拖动状态 */
.player-card.ui-sortable-helper {
    opacity: 0.8;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    cursor: move !important;
}

/* 确保section-links-wrap可以正确排序 */
.section-links-wrap {
    min-height: 50px;
}

/* 拖动手柄样式 - 默认隐藏 */
.player-card .drag-handle-icon {
    display: none;
}

/* 移动按钮样式 - 默认隐藏 */
.player-card .move-btn {
    display: none;
}

/* 排序模式：显示手柄 */
.section-links.sort-mode .player-card .drag-handle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    flex-shrink: 0;
}
.section-links.sort-mode .player-card .drag-handle-icon:active {
    cursor: grabbing;
}

/* PC端手柄样式 */
.section-links.sort-mode .player-card .drag-handle-icon {
    width: 24px;
    height: 24px;
    background: #ff9800;
    color: #fff;
    border-radius: 4px;
    margin-right: 8px;
    font-size: 12px;
}

/* 手机端排序移动按钮样式 */
@media (max-width: 768px) {
    /* 手机端排序模式显示移动按钮 */
    .section-links.sort-mode .player-card .move-btn {
        display: inline-block !important;
        background: #ff9800;
        color: #fff;
        border: none;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        cursor: pointer;
        font-size: 14px;
        line-height: 28px;
        text-align: center;
        z-index: 100;
        pointer-events: auto !important;
        vertical-align: middle;
    }
    .section-links.sort-mode .player-card .move-btn:active {
        background: #f57c00;
        transform: scale(0.95);
    }
    /* 禁止点击选手卡片本身和链接 */
    .section-links.sort-mode .player-card {
        cursor: default;
    }
    .section-links.sort-mode .player-card .player-main-link {
        pointer-events: none;
    }
}

/* 手机端分类设置上下移动按钮 */
.cat-move-up,
.cat-move-down {
    background: #ff9800;
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-left: 5px;
    flex-shrink: 0;
}
.cat-move-up:hover,
.cat-move-down:hover {
    background: #f57c00;
}
#category-sortable-list li {
    flex-wrap: wrap;
}

/* 分类拖动模式激活状态 */
.section-links.sort-mode .section-header {
    border-radius: 6px 6px 0 0;
}

.section-links.sort-mode .category-sort-handle {
    background: #ff9800;
    color: #fff;
    border-radius: 4px;
}

/* 拖动模式下的选手卡片 */
.section-links.sort-mode .player-card {
    position: relative;
}

/* 拖动模式隐藏悬浮窗口 */
.section-links.sort-mode .player-card .player-platforms-hover {
    display: none !important;
}

/* 选手排序控制按钮容器 */
.sort-controls {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    justify-content: center;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 0 0 6px 6px;
}

.sort-btn {
    background: #ff9800;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sort-btn:hover {
    background: #f57c00;
}

.sort-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 分类排序控制 */
.category-sort-controls {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    justify-content: center;
}

/* 直播状态标记 */
.live-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    margin-left: 5px;
}
.live-status.online {
    background: #28a745;
    box-shadow: 0 0 5px #28a745;
}

/* ===== 底部 ===== */
.site-footer {
    background: #222c3c;
    color: #aaa;
    padding: 30px 0 20px;
    margin-top: 30px;
}
.friend-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #3a4555;
    margin-bottom: 20px;
}
.friend-section strong {
    color: #fff;
}
.friend-nav {
    display: flex;
    gap: 20px;
    list-style: none;
}
.friend-nav a {
    color: #aaa;
}
.friend-nav a:hover {
    color: #fff;
}
#site-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.site-info a {
    color: #aaa;
}
.site-info a:hover {
    color: #fff;
}
.footer-nav {
    display: flex;
    gap: 20px;
    list-style: none;
}
.footer-nav a {
    color: #aaa;
}

/* ===== 响应式 ===== */
/* 大屏幕：保持8列 */
@media (max-width: 1300px) {
    .section-links-wrap {
        grid-template-columns: repeat(6, 1fr);
    }
}
@media (max-width: 1100px) {
    .section-links-wrap {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 800px) {
    .section-links-wrap {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 600px) {
    .section-links-wrap {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 400px) {
    .section-links-wrap {
        grid-template-columns: 1fr;
    }
    .player-card {
        width: 100%;
    }
}