/* Reset & Base Styles - 增强响应式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #e17055;
    --info-color: #74b9ff;
    --dark-color: #2d3436;
    --medium-color: #636e72;
    --light-color: #f8f9fa;
    --border-color: #e8e8e8;
    --shadow-light: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 15px 40px rgba(0, 0, 0, 0.12);
    --border-radius: 20px;
    --transition: all 0.3s ease;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1800px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    padding: 40px;
}

/* Header - 改进响应式 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

header h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    color: var(--dark-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

header h1 i {
    color: var(--primary-color);
}

.subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--medium-color);
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.6;
    text-wrap: pretty;
}

/* Dashboard Layout - 改进网格系统 */
.dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

/* 让总积分排名卡片占据2列空间 */
.card.points-ranking {
    grid-column: span 2;
}

/* 卡片基础样式 */
.card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.card h2 {
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    color: var(--dark-color);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.card h2 i {
    color: var(--primary-color);
    flex-shrink: 0;
}

/* 卡片边框颜色 */
.player-management { border-top: 6px solid var(--success-color); }
.game-input { border-top: 6px solid #fd79a8; }
.stats-overview { border-top: 6px solid var(--warning-color); }
.chart-card { border-top: 6px solid var(--info-color); }
.history-export { border-top: 6px solid var(--secondary-color); }
.points-ranking { border-top: 6px solid var(--danger-color); }

/* 表单样式 - 改进响应式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    word-break: break-word;
}

.player-input, .score-input {
    width: 100%;
    padding: 16px 20px;
    border-radius: 12px;
    border: 2px solid #ddd;
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    transition: var(--transition);
}

.player-input:focus, .score-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* 按钮样式 - 改进触摸目标 */
.action-btn {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: clamp(14px, 2vw, 16px) clamp(20px, 3vw, 32px);
    border-radius: 12px;
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    width: 100%;
    margin-top: 10px;
    min-height: 44px;
    text-align: center;
    white-space: nowrap;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.3);
}

.action-btn.small {
    padding: 6px 10px;
    font-size: 0.85rem;
    min-height: 32px;
    width: auto;
    margin: 0 2px;
}

.action-btn.small i {
    font-size: 0.8rem;
}

.score-input {
    width: 60px;
    padding: 4px 8px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}

.history-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.action-btn.primary { background: linear-gradient(to right, #00b894, #00cec9); }
.action-btn.success { background: linear-gradient(to right, var(--success-color), #00cec9); }
.action-btn.danger { background: linear-gradient(to right, var(--danger-color), #fab1a0); }

.action-btn i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* 历史记录表格 - 移动端优化 */
.history-table-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.history-table th {
    background: var(--light-color);
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: clamp(0.8rem, 1.1vw, 0.9rem);
    white-space: nowrap;
    min-width: 50px;
}

.history-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--medium-color);
    text-align: center;
    font-size: clamp(0.75rem, 1vw, 0.85rem);
    white-space: nowrap;
    min-width: 45px;
}

.history-table tr:hover {
    background: var(--light-color);
}

/* 历史记录表格特定列样式 */
.history-id {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 50px;
}

.history-date {
    color: var(--medium-color);
    min-width: 80px;
}

.history-winner {
    font-weight: 700;
    color: var(--success-color);
    min-width: 70px;
}

/* 张数显示样式 */
.score-display {
    display: inline-block;
    padding: 5px 10px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 6px;
    font-weight: 600;
    color: var(--dark-color);
    transition: var(--transition);
    position: relative;
    cursor: help;
    min-width: 50px;
    font-size: 0.85rem;
}

.score-display:hover {
    background: rgba(108, 92, 231, 0.2);
    transform: translateY(-2px);
}

/* 积分提示框样式 */
.score-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 6px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.score-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

/* ========== 总积分排名：完整显示所有内容，添加滚动条 ========== */
.points-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
    -webkit-overflow-scrolling: touch;
}

/* 滚动条样式 */
.points-grid::-webkit-scrollbar {
    width: 6px;
}

.points-grid::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 3px;
}

.points-grid::-webkit-scrollbar-thumb {
    background: var(--medium-color);
    border-radius: 3px;
}

.points-grid::-webkit-scrollbar-thumb:hover {
    background: var(--dark-color);
}

.rank-item {
    background: var(--light-color);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
    min-height: 80px;
}

.rank-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-light);
}

/* 排名徽章样式 - 奖牌颜色 */
.rank-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    width: 40px;
}

/* 奖牌颜色：冠军金色，亚军银色，季军铜色，第四名铁色，其他蓝色 */
.rank-item:nth-child(1) .rank-badge {
    color: #FFD700; /* 金色 */
    text-shadow: 0 0 3px rgba(255, 215, 0, 0.3);
}

.rank-item:nth-child(2) .rank-badge {
    color: #C0C0C0; /* 银色 */
    text-shadow: 0 0 3px rgba(192, 192, 192, 0.3);
}

.rank-item:nth-child(3) .rank-badge {
    color: #CD7F32; /* 铜色 */
    text-shadow: 0 0 3px rgba(205, 127, 50, 0.3);
}

.rank-item:nth-child(4) .rank-badge {
    color: #5D6D7E; /* 铁色 - 深灰色 */
    text-shadow: 0 0 3px rgba(93, 109, 126, 0.3);
}

.rank-item:nth-child(n+5) .rank-badge {
    color: var(--primary-color); /* 蓝色 */
}

/* 排名位置 */
.rank-position {
    font-weight: 800;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--dark-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    min-width: 60px;
}

/* 玩家姓名 */
.rank-player {
    color: var(--dark-color);
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    font-weight: 700;
    word-break: break-word;
    line-height: 1.2;
    flex: 1;
    min-width: 100px;
}

/* 总积分 */
.rank-score {
    font-weight: 800;
    color: var(--dark-color);
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    min-width: 80px;
    text-align: center;
    border: 2px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

/* 累计总张数 */
.rank-tiles {
    font-weight: 600;
    color: var(--primary-color);
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    background: var(--primary-light);
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 70px;
    text-align: center;
    flex-shrink: 0;
}

/* 胜率统计 - 完整显示 */
.rank-stats-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    margin-left: 10px;
}

.rank-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
}

.rank-stat-label {
    font-size: 0.75rem;
    color: var(--medium-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rank-stat-label i {
    font-size: 0.9rem;
}

.rank-stat-value {
    font-weight: 700;
    color: var(--dark-color);
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    background: white;
    padding: 5px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    min-width: 50px;
    text-align: center;
}

/* 不同胜率的颜色 */
.rank-stat-item.weekly .rank-stat-label i { color: #6c5ce7; }
.rank-stat-item.monthly .rank-stat-label i { color: #00b894; }
.rank-stat-item.yearly .rank-stat-label i { color: #fdcb6e; }

/* 信息提示 */
.info-note {
    margin-top: 20px;
    padding: 12px 15px;
    background: var(--light-color);
    border-radius: 8px;
    color: var(--medium-color);
    font-size: clamp(0.85rem, 1.2vw, 0.9rem);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-left: 4px solid var(--info-color);
    line-height: 1.5;
}

.info-note i {
    color: var(--info-color);
    flex-shrink: 0;
    margin-top: 2px;
}

/* 页脚样式 */
footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: var(--medium-color);
    font-size: clamp(0.8rem, 1.1vw, 0.9rem);
}

footer p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.disclaimer {
    font-size: clamp(0.75rem, 1vw, 0.8rem);
    color: #b2bec3;
    font-style: italic;
}

/* 图表容器 */
.chart-container {
    height: clamp(250px, 40vw, 300px);
    margin-top: 20px;
    position: relative;
}

/* 导出控制按钮组 */
.export-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

/* 图表控制 */
.chart-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.chart-controls label {
    font-weight: 600;
    color: var(--dark-color);
    white-space: nowrap;
}

.chart-controls select {
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--dark-color);
    font-size: 1rem;
    flex: 1;
    min-width: 150px;
}

/* ========== 响应式设计 ========== */

/* 大桌面 (1200px以上) */
@media (min-width: 1200px) {
    .dashboard {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 中等桌面 (992px-1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
    .export-controls {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板 (768px-991px) - 简化设计，确保正确显示 */

/* 平板竖屏：和手机布局一致，单列布局 */
@media (max-width: 991px) and (min-width: 768px) and (orientation: portrait) {
    .container {
        padding: 25px;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .card.points-ranking {
        grid-column: span 1;
    }
    
    .export-controls {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chart-controls select {
        width: 100%;
    }
    
    /* 总积分排名在平板上的优化：紧凑水平布局 */
    .rank-item {
        padding: 14px 16px;
        gap: 10px;
        min-height: 65px;
        /* 紧凑水平布局，类似电脑端但缩小 */
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    
    .rank-badge {
        font-size: 1.4rem;
        width: 30px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .rank-position {
        font-size: 0.85rem;
        min-width: 45px;
        flex-shrink: 0;
        font-weight: 700;
        text-transform: uppercase;
    }
    
    .rank-player {
        font-size: 0.95rem;
        font-weight: 600;
        flex: 1;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        padding: 0 8px;
    }
    
    .rank-score {
        font-size: 1.05rem;
        padding: 5px 10px;
        min-width: 65px;
        border-radius: 6px;
        flex-shrink: 0;
        font-weight: 700;
        text-align: center;
        background: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }
    
    /* 胜率统计：紧凑水平布局 */
    .rank-stats-container {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: 8px;
    }
    
    .rank-stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        min-width: 55px;
    }
    
    .rank-stat-label {
        font-size: 0.6rem;
        color: var(--medium-color);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.2px;
        display: flex;
        align-items: center;
        gap: 3px;
    }
    
    .rank-stat-label i {
        font-size: 0.8rem;
    }
    
    .rank-stat-value {
        font-weight: 700;
        color: var(--dark-color);
        font-size: 0.8rem;
        background: white;
        padding: 3px 6px;
        border-radius: 4px;
        min-width: 40px;
        text-align: center;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    }
}

/* 平板横屏：简单合理的2列布局 */
@media (max-width: 991px) and (min-width: 768px) and (orientation: landscape) {
    .container {
        padding: 25px;
    }
    
    .dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* 总积分排名卡片：占据2列 */
    .card.points-ranking {
        grid-column: span 2;
    }
    
    /* 图表卡片：占据2列 */
    .card.chart-card {
        grid-column: span 2;
    }
    
    .export-controls {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chart-controls select {
        width: 100%;
    }
    
    /* 总积分排名在平板上的优化：紧凑水平布局 */
    .rank-item {
        padding: 14px 16px;
        gap: 10px;
        min-height: 65px;
        /* 紧凑水平布局，类似电脑端但缩小 */
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    
    .rank-badge {
        font-size: 1.4rem;
        width: 30px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .rank-position {
        font-size: 0.85rem;
        min-width: 45px;
        flex-shrink: 0;
        font-weight: 700;
        text-transform: uppercase;
    }
    
    .rank-player {
        font-size: 0.95rem;
        font-weight: 600;
        flex: 1;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        padding: 0 8px;
    }
    
    .rank-score {
        font-size: 1.05rem;
        padding: 5px 10px;
        min-width: 65px;
        border-radius: 6px;
        flex-shrink: 0;
        font-weight: 700;
        text-align: center;
        background: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }
    
    /* 胜率统计：紧凑水平布局 */
    .rank-stats-container {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: 8px;
    }
    
    .rank-stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        min-width: 55px;
    }
    
    .rank-stat-label {
        font-size: 0.6rem;
        color: var(--medium-color);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.2px;
        display: flex;
        align-items: center;
        gap: 3px;
    }
    
    .rank-stat-label i {
        font-size: 0.8rem;
    }
    
    .rank-stat-value {
        font-weight: 700;
        color: var(--dark-color);
        font-size: 0.8rem;
        background: white;
        padding: 3px 6px;
        border-radius: 4px;
        min-width: 40px;
        text-align: center;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    }
}

/* 大手机 (576px-767px) - 手机横屏：自适应宽度，充分利用横屏空间 */
@media (max-width: 767px) and (min-width: 576px) {
    .container {
        padding: 18px;
        border-radius: 14px;
        width: 100%;
        max-width: 100%;
    }
    
    body {
        padding: 8px;
        overflow-x: hidden;
    }
    
    header h1 {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .subtitle {
        font-size: 0.95rem;
        text-align: center;
        line-height: 1.4;
        padding: 0 10px;
    }
    
    /* 手机横屏：单列布局，100%宽度 */
    .dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 100%;
    }
    
    .card.points-ranking {
        grid-column: span 1;
    }
    
    .card {
        padding: 20px;
        border-radius: 14px;
        width: 100%;
    }
    
    .card h2 {
        font-size: 1.4rem;
        margin-bottom: 18px;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .card h2 i {
        font-size: 1.3rem;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 6px;
    }
    
    .player-input, .score-input {
        padding: 14px 16px;
        font-size: 0.95rem;
        width: 100%;
    }
    
    .action-btn {
        padding: 14px 16px;
        font-size: 0.95rem;
        width: 100%;
        min-height: 44px;
        gap: 10px;
    }
    
    .action-btn i {
        font-size: 1.1rem;
    }
    
    /* 比赛记录输入：自适应宽度 */
    .game-input .form-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 18px;
        width: 100%;
    }
    
    .game-input .form-group {
        margin-bottom: 0;
        width: 100%;
    }
    
    .game-input .score-input {
        padding: 12px 14px;
        font-size: 0.95rem;
        width: 100%;
    }
    
    .export-controls {
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }
    
    /* 历史记录表格：自适应宽度 */
    .history-table-container {
        max-height: 350px;
        margin-top: 18px;
        border-radius: 10px;
        width: 100%;
        overflow-x: auto;
    }
    
    .history-table {
        min-width: 450px; /* 减少最小宽度 */
        width: 100%;
    }
    
    .history-table th {
        padding: 10px 8px;
        font-size: 0.8rem;
        min-width: 45px;
        white-space: nowrap;
    }
    
    .history-table td {
        padding: 8px 6px;
        font-size: 0.75rem;
        min-width: 40px;
        white-space: nowrap;
    }
    
    .history-id {
        min-width: 45px;
    }
    
    .history-date {
        min-width: 70px;
    }
    
    .history-winner {
        min-width: 60px;
    }
    
    .chart-container {
        height: 180px;
        width: 100%;
    }
    
    .chart-controls {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .chart-controls select {
        width: 100%;
        min-width: auto;
        padding: 12px 14px;
        font-size: 0.95rem;
    }
    
    .info-note {
        padding: 12px 14px;
        font-size: 0.85rem;
        gap: 10px;
        border-radius: 8px;
        width: 100%;
    }
    
    .info-note i {
        font-size: 0.95rem;
    }
    
    /* ========== 总积分排名：紧凑水平布局，类似电脑端，添加滚动条 ========== */
    .points-grid {
        gap: 10px;
        margin-top: 18px;
        width: 100%;
        max-height: 350px; /* 手机横屏高度适中 */
        overflow-y: auto;
        padding-right: 5px;
        -webkit-overflow-scrolling: touch;
    }
    
    .rank-item {
        padding: 14px 16px;
        border-radius: 10px;
        gap: 10px;
        min-height: 65px;
        border-left-width: 4px;
        width: 100%;
        /* 紧凑水平布局，类似电脑端但缩小 */
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    
    .rank-badge {
        font-size: 1.4rem;
        width: 28px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .rank-position {
        font-size: 0.8rem;
        min-width: 45px;
        flex-shrink: 0;
        font-weight: 700;
        text-transform: uppercase;
    }
    
    .rank-player {
        font-size: 1rem;
        font-weight: 600;
        flex: 1;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        padding: 0 8px;
    }
    
    .rank-score {
        font-size: 1.05rem;
        padding: 4px 10px;
        min-width: 55px;
        border-radius: 6px;
        flex-shrink: 0;
        font-weight: 700;
        text-align: center;
        background: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }
    
    /* 胜率统计：紧凑水平布局 */
    .rank-stats-container {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: 8px;
    }
    
    .rank-stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        min-width: 50px;
    }
    
    .rank-stat-label {
        font-size: 0.6rem;
        color: var(--medium-color);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.2px;
        display: flex;
        align-items: center;
        gap: 3px;
    }
    
    .rank-stat-label i {
        font-size: 0.8rem;
    }
    
    .rank-stat-value {
        font-weight: 700;
        color: var(--dark-color);
        font-size: 0.8rem;
        background: white;
        padding: 3px 6px;
        border-radius: 4px;
        min-width: 40px;
        text-align: center;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    }
    
    footer {
        margin-top: 30px;
        padding-top: 15px;
        font-size: 0.75rem;
        width: 100%;
    }
    
    footer p {
        margin-bottom: 10px;
        line-height: 1.4;
    }
    
    .disclaimer {
        font-size: 0.7rem;
    }
}

/* 小手机 (575px以下) - 手机竖屏：自适应宽度，确保内容适应屏幕 */
@media (max-width: 575px) {
    .container {
        padding: 12px;
        border-radius: 10px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    body {
        padding: 2px;
        overflow-x: hidden;
    }
    
    header h1 {
        font-size: 1.4rem;
        flex-direction: column;
        text-align: center;
        gap: 6px;
        line-height: 1.3;
    }
    
    .subtitle {
        font-size: 0.85rem;
        text-align: center;
        line-height: 1.4;
        padding: 0 5px;
    }
    
    /* 手机竖屏：单列布局，100%宽度 */
    .dashboard {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }
    
    .card.points-ranking {
        grid-column: span 1;
    }
    
    .card {
        padding: 15px;
        border-radius: 10px;
        width: 100%;
        overflow: hidden;
    }
    
    .card h2 {
        font-size: 1.2rem;
        margin-bottom: 12px;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .card h2 i {
        font-size: 1.1rem;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }
    
    .player-input, .score-input {
        padding: 12px 14px;
        font-size: 0.9rem;
        width: 100%;
    }
    
    .action-btn {
        padding: 12px 14px;
        font-size: 0.9rem;
        width: 100%;
        min-height: 44px;
        gap: 8px;
    }
    
    .action-btn i {
        font-size: 1rem;
    }
    
    /* 比赛记录输入：自适应宽度 */
    .game-input .form-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 12px;
        width: 100%;
    }
    
    .game-input .form-group {
        margin-bottom: 0;
        width: 100%;
    }
    
    .game-input .score-input {
        padding: 10px 12px;
        font-size: 0.9rem;
        width: 100%;
    }
    
    /* 历史记录表格：自适应宽度，减少最小宽度 */
    .history-table-container {
        max-height: 300px;
        margin-top: 15px;
        border-radius: 8px;
        width: 100%;
        overflow-x: auto;
    }
    
    .history-table {
        min-width: 350px; /* 大幅减少最小宽度 */
        width: 100%;
        font-size: 0.75rem;
    }
    
    .history-table th {
        padding: 8px 6px;
        font-size: 0.7rem;
        min-width: 40px;
        white-space: nowrap;
    }
    
    .history-table td {
        padding: 6px 4px;
        font-size: 0.65rem;
        min-width: 35px;
        white-space: nowrap;
    }
    
    .history-id {
        min-width: 40px;
    }
    
    .history-date {
        min-width: 60px;
    }
    
    .history-winner {
        min-width: 50px;
    }
    
    .export-controls {
        grid-template-columns: 1fr;
        gap: 8px;
        width: 100%;
    }
    
    .chart-container {
        height: 160px;
        width: 100%;
    }
    
    .chart-controls {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .chart-controls select {
        width: 100%;
        min-width: auto;
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .info-note {
        padding: 10px 12px;
        font-size: 0.8rem;
        gap: 8px;
        border-radius: 6px;
        width: 100%;
    }
    
    .info-note i {
        font-size: 0.9rem;
    }
    
    /* ========== 总积分排名：紧凑水平布局，类似电脑端，添加滚动条 ========== */
    .points-grid {
        gap: 8px;
        margin-top: 15px;
        width: 100%;
        max-height: 300px; /* 手机竖屏高度较小 */
        overflow-y: auto;
        padding-right: 5px;
        -webkit-overflow-scrolling: touch;
    }
    
    .rank-item {
        padding: 8px 10px;
        border-radius: 8px;
        gap: 6px;
        min-height: 60px;
        border-left-width: 3px;
        width: 100%;
        /* 紧凑水平布局，类似电脑端但缩小 */
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        overflow: visible;
    }
    
    .rank-badge {
        font-size: 1.1rem;
        width: 22px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .rank-position {
        font-size: 0.7rem;
        min-width: 35px;
        flex-shrink: 0;
        font-weight: 700;
        text-transform: uppercase;
    }
    
    .rank-player {
        font-size: 0.9rem;
        font-weight: 600;
        flex: 1;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 60px; /* 确保最小宽度，防止被压缩 */
        padding: 0 5px;
    }
    
    .rank-score {
        font-size: 0.95rem;
        padding: 3px 8px;
        min-width: 50px;
        border-radius: 5px;
        flex-shrink: 0;
        font-weight: 700;
        text-align: center;
        background: white;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    }
    
    /* 胜率统计：紧凑水平布局，确保所有统计项都能显示 */
    .rank-stats-container {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
        margin-left: 4px;
        flex-wrap: nowrap;
        overflow: visible;
    }
    
    .rank-stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1px;
        min-width: 40px;
        flex-shrink: 0;
    }
    
    .rank-stat-label {
        font-size: 0.5rem;
        color: var(--medium-color);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.1px;
        display: flex;
        align-items: center;
        gap: 1px;
        white-space: nowrap;
    }
    
    .rank-stat-label i {
        font-size: 0.6rem;
    }
    
    .rank-stat-value {
        font-weight: 700;
        color: var(--dark-color);
        font-size: 0.7rem;
        background: white;
        padding: 1px 4px;
        border-radius: 3px;
        min-width: 30px;
        text-align: center;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        white-space: nowrap;
    }
    
    /* 确保排名项有足够的空间显示所有内容 */
    .rank-player {
        min-width: 50px;
        max-width: 80px;
    }
    
    footer {
        margin-top: 25px;
        padding-top: 12px;
        font-size: 0.7rem;
        width: 100%;
    }
    
    footer p {
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .disclaimer {
        font-size: 0.65rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .action-btn, .player-input, .score-input, select {
        min-height: 44px;
    }
    
    .card:hover {
        transform: none;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 消息提示 */
.message {
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message.success {
    background: rgba(0, 184, 148, 0.1);
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
}

.message.error {
    background: rgba(225, 112, 85, 0.1);
    border-left: 4px solid var(--danger-color);
    color: var(--danger-color);
}

.message.info {
    background: rgba(108, 92, 231, 0.1);
    border-left: 4px solid var(--primary-color);
    color: var(--primary-color);
}

/* 移动端优化：防止横向滚动 */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    .container {
        width: 100%;
        margin: 0 auto;
    }
}

/* ========== 分组选择器 ========== */
.group-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.group-selector label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1rem;
}

.group-selector select {
    padding: 8px 36px 8px 12px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: white;
    font-size: 1rem;
    color: var(--dark-color);
    cursor: pointer;
    min-width: 150px;
    appearance: auto;
}

.group-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.group-selector .action-btn.small {
    margin-top: 0;
    width: 36px;
    height: 36px;
    padding: 0;
}

/* ========== 分组管理弹窗 ========== */
.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    color: var(--dark-color);
}

.modal-header h3 i {
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--medium-color);
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px 24px;
    max-height: 400px;
    overflow-y: auto;
}

/* 分组列表项 */
.group-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--light-color);
    margin-bottom: 8px;
    gap: 10px;
}

.group-list-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1rem;
    flex: 1;
}

.group-list-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.group-badge {
    background: var(--primary-color);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 4px;
}

/* 新建分组 */
.group-create {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.group-create input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    font-size: 0.95rem;
}

.group-create input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.group-create .action-btn.small {
    margin-top: 0;
    white-space: nowrap;
}

/* ========== 密码弹窗 ========== */
.modal-sm {
    max-width: 380px;
}

.password-message {
    font-size: 0.9rem;
    color: var(--medium-color);
    margin-bottom: 16px;
    line-height: 1.5;
}

.password-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    font-size: 1.1rem;
    margin-bottom: 16px;
    letter-spacing: 3px;
}

.password-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.password-actions {
    display: flex;
    gap: 10px;
}

.password-actions .action-btn {
    margin-top: 0;
    flex: 1;
}

/* 锁定按钮状态 */
.action-btn.small.warning {
    background: var(--warning-color);
    color: var(--dark-color);
}

.action-btn.small.success {
    background: var(--success-color);
}
