/* 
 * 全局样式 - 设置页面基础样式
 * 1. 字体栈使用系统优先策略，确保跨平台显示一致性
 * 2. 背景色和文字颜色采用苹果设计风格
 * 3. 基础间距设置确保内容不会紧贴边缘
 */
body {
    /* 使用系统优先的字体栈，确保在不同设备上都有良好的显示效果 */
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    /* 设置背景色为浅灰色，文字颜色为深灰色 */
    background-color: #f5f5f7;
    color: #1d1d1f;
    /* 设置行高为1.5倍，增加可读性 */
    line-height: 1.0;
    /* 清除默认边距 */
    margin: 0;
    /* 添加10px内边距，避免内容紧贴浏览器边缘 */
    padding: 10px;
}

/* 
 * 主容器样式
 * 1. 使用毛玻璃效果增强视觉层次
 * 2. 圆角边框和阴影创造卡片式UI
 * 3. 响应式设计通过媒体查询实现
 */
.container {
    /* 容器宽度100%，自动水平居中 */
    width: 100%;
    margin: 0 auto;
    /* 半透明白色背景，配合毛玻璃效果 */
    background: rgba(255, 255, 255, 0.8);
    /* 添加毛玻璃效果，增强视觉层次感 */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* 圆角边框 */
    border-radius: 12px;
    /* 内边距和阴影效果 */
    padding: 15px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* 
 * 平板及以上设备的响应式样式
 * 1. 限制最大宽度为800px
 * 2. 增加内边距和圆角半径
 */
@media (min-width: 768px) {
    .container {
        max-width: 800px;
        padding: 30px;
        border-radius: 18px;
    }
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #5c5c5c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 15px 0;
    color: #1d1d1f;
}

@media (min-width: 768px) {
    h1 {
        font-size: 34px;
    }
    h2 {
        font-size: 24px;
    }
}

/* 玩家列表样式 */
.player-list {
    margin-bottom: 20px;
}

.player-input {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.player-name {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    font-size: 20px;
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .player-input {
        gap: 10px;
        margin-bottom: 20px;
    }
    .player-name {
        padding: 12px 16px;
        border-radius: 12px;
        font-size: 16px;
    }
}

.player-name:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.08);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.3);
}

.player-item {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 12px;
    font-size: 16px;
    color: #1d1d1f;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center
}

.player-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 按钮样式 */
button {
    background: linear-gradient(135deg, #007AFF 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px;
    position: relative;
    z-index: 10;
    letter-spacing: 0.5px;
}

@media (min-width: 768px) {
    button {
        padding: 16px 32px;
        font-size: 18px;
        border-radius: 16px;
        margin: 12px;
    }
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

button:active {
    transform: translateY(0);
}

/* 计分板样式 */
.score-board {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

@media (min-width: 768px) {
    .score-board {
        border-radius: 16px;
        padding: 16px;
        margin-bottom: 16px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    }
}

.player-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    gap: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

.player-score .player-name {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 30px;
    flex: 1;
    letter-spacing: -0.1px;
}

@media (min-width: 768px) {
    .player-score .player-name {
        font-size: 30px;
    }
}

.score-input {
    width: 120px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.95);
    font-size: 20px;
    font-weight: 600;
    color: #007AFF;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    transform-origin: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scoreChange {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: #007AFF;
    }
    100% {
        transform: scale(1);
    }
}

.player-score:hover {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
}

.player-score .player-name {
    font-weight: 500;
    color: #1d1d1f;
    font-size: 17px;
}

.player-score:last-child {
    border-bottom: none;
}

.score-input {
    width: 180px;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    font-size: 25px;
    font-weight: 500;
    color: #007AFF;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    transform-origin: center;
}

.score-input:hover {
    border-color: #007AFF;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
}

.score-input:focus {
    outline: none;
    border-color: #007AFF;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
    transform: scale(1.02);
}

.score-input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.score-input.changed {
    animation: scoreChange 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 历史记录样式 */
.history-section {
    margin-top: 40px;
}

.history-item {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

/* 总分显示区域样式 */
.total-score-display {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.total-score-display h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    color: #1d1d1f;
}

.player-total {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 17px;
}

.player-total:last-child {
    border-bottom: none;
}

.player-total span:last-child {
    font-weight: 500;
    color: #007AFF;
}

/* 清除历史记录按钮样式 */
.clear-history {
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ff3b30 0%, #dc2626 100%);
}

.clear-history:hover {
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.delete-player {
    background: linear-gradient(135deg, #ff3b30 0%, #dc2626 100%);
    padding: 8px 16px;
    font-size: 14px;
    opacity: 0.8;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.delete-player:hover {
    opacity: 1;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.player-item.removing {
    opacity: 0;
    transform: translateX(100px);
    pointer-events: none;
}

.history-item h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 500;
    color: #1d1d1f;
}

.game-totals {
    font-size: 16px;
    line-height: 1.6;
    color: #1d1d1f;
}