/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 80px;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    background: #f5f7fa;
    min-height: 100vh;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 20px 16px;
    text-align: center;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.header .subtitle {
    font-size: 13px;
    opacity: 0.9;
}

/* 活动信息 */
.event-info {
    background: white;
    margin: 12px;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.info-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.info-row .label {
    color: #666;
    width: 70px;
}

.info-row .value {
    color: #333;
    flex: 1;
}

.edit-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
}

/* Tab 切换 */
.tabs {
    display: flex;
    background: white;
    margin: 0 12px 12px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tab {
    flex: 1;
    padding: 14px;
    border: none;
    background: #f8f9fa;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

/* 比赛列表 */
.matches-container {
    padding: 0 12px;
}

.court-section {
    display: none;
}

.court-section.active {
    display: block;
}

.court-title {
    font-size: 15px;
    color: #333;
    padding: 12px;
    background: white;
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.matches-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 比赛卡片 */
.match-card {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.match-card:last-child {
    border-bottom: none;
}

.match-card.finished {
    background: #f8fff8;
}

.match-card:hover {
    background: #f8f9fa;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.match-round {
    font-size: 12px;
    color: #999;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
}

.match-type {
    font-size: 12px;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.match-type.混双 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.match-type.男双 {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.match-type.女双 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.match-teams {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.team:hover {
    background: #e9ecef;
}

.team-name {
    font-size: 14px;
    color: #333;
    flex: 1;
}

.team-score-display {
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
    min-width: 30px;
    text-align: right;
}

.team.winner .team-score-display {
    color: #11998e;
}

.vs-divider {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 4px 0;
}

.match-status {
    text-align: center;
    font-size: 13px;
    color: #999;
    padding: 8px;
}

.match-status.pending {
    color: #999;
}

.match-status.in-progress {
    color: #f5a623;
}

.match-status.finished {
    color: #11998e;
    font-weight: 500;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
    font-size: 16px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 16px;
}

.match-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.match-info .teams {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.match-info .type {
    color: #666;
    font-size: 13px;
}

/* 比分输入 */
.score-input-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.team-score {
    flex: 1;
}

.team-score label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.set-score {
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 16px;
    border-radius: 10px;
}

.set-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 600;
}

.set-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-input label {
    font-size: 13px;
    color: #666;
    text-align: center;
}

.team-input input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    font-weight: 600;
}

.team-input input:focus {
    outline: none;
    border-color: #667eea;
}

.vs {
    font-size: 14px;
    color: #999;
    font-weight: 600;
    padding-top: 24px;
}

/* 按钮 */
.save-btn, .clear-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.save-btn:hover {
    opacity: 0.9;
}

.clear-btn {
    background: #f0f0f0;
    color: #666;
}

.clear-btn:hover {
    background: #e0e0e0;
}

/* 底部操作栏 */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    display: flex;
    padding: 12px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.action-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    margin: 0 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #e9ecef;
}

.action-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.action-btn.primary:hover {
    opacity: 0.9;
}

/* 统计列表 */
.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.stats-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.stats-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stats-list {
    max-height: 400px;
    overflow-y: auto;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-player {
    font-size: 14px;
    color: #333;
}

.stat-games {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.stat-games span {
    color: #666;
}

.stat-games .total {
    font-weight: 600;
    color: #667eea;
}

.stats-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.action-btn-small {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn-small:hover {
    background: #e0e0e0;
}

.action-btn-small.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 战绩分析 */
.analysis-filter {
    margin-bottom: 16px;
}

.analysis-filter label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.analysis-filter select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.analysis-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.analysis-card {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.analysis-card .value {
    font-size: 24px;
    font-weight: 600;
    color: #667eea;
}

.analysis-card .label {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.analysis-card.win .value {
    color: #11998e;
}

.analysis-card.loss .value {
    color: #f5a623;
}

.analysis-list {
    max-height: 300px;
    overflow-y: auto;
}

.analysis-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.analysis-item:last-child {
    border-bottom: none;
}

.analysis-match-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.analysis-match-type {
    font-size: 11px;
    color: white;
    background: #667eea;
    padding: 2px 6px;
    border-radius: 4px;
}

.analysis-match-result {
    font-size: 12px;
    font-weight: 600;
}

.analysis-match-result.win {
    color: #11998e;
}

.analysis-match-result.loss {
    color: #f5a623;
}

.analysis-teams {
    font-size: 13px;
    color: #333;
    line-height: 1.5;
}

.analysis-score {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* 海报样式 */
.poster-container {
    position: fixed;
    left: -9999px;
}

.poster {
    width: 375px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    padding: 24px;
    border-radius: 16px;
}

.poster-header {
    text-align: center;
    padding: 20px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin-bottom: 16px;
    color: white;
}

.poster-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.poster-event-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.95;
}

.poster-date {
    font-size: 12px;
    opacity: 0.8;
}

.poster-summary {
    display: flex;
    justify-content: space-around;
    padding: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.summary-item {
    text-align: center;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-label {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.poster-matches {
    font-size: 12px;
}

.poster-match {
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-left: 3px solid #667eea;
}

.poster-match-type {
    font-size: 11px;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
    font-weight: 500;
}

.poster-match-teams {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poster-team {
    flex: 1;
    font-size: 13px;
    color: #333;
}

.poster-score {
    font-weight: 700;
    color: #667eea;
    padding: 0 12px;
    font-size: 13px;
}

.poster-match.finished {
    border-left-color: #11998e;
}

.poster-match.finished .poster-score {
    color: #11998e;
}

/* 响应式 */
@media (max-width: 375px) {
    .header h1 {
        font-size: 18px;
    }
    
    .team-name {
        font-size: 13px;
    }
    
    .action-btn {
        font-size: 12px;
        padding: 10px 8px;
    }
}
