/* CPS Test 专用样式 */

/* 时间选择器 */
.time-selector {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.time-selector h3 {
    font-size: var(--font-size-large);
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.time-options {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.time-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid var(--background-tertiary);
    background-color: var(--background-secondary);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.time-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--background-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-small);
}

.time-btn.active {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-medium);
}

/* CPS测试容器 */
.cps-test-container {
    max-width: 900px;
    margin: 0 auto;
}

/* CPS测试区域 */
.cps-test-area {
    width: 100%;
    height: 40vh;
    min-height: 350px;
    background: linear-gradient(135deg, var(--background-secondary) 0%, var(--background-tertiary) 100%);
    border-radius: var(--border-radius-large);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.cps-test-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0, 122, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cps-test-area:hover::before {
    opacity: 1;
}

.cps-test-area.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-color: var(--primary-color);
    animation: clickPulse 0.1s ease;
}

.cps-test-area.testing {
    background: linear-gradient(135deg, var(--success-color) 0%, #28A745 100%);
    cursor: pointer;
    animation: testingGlow 2s ease-in-out infinite alternate;
}

.cps-test-area.finished {
    background: linear-gradient(135deg, var(--background-secondary) 0%, var(--background-tertiary) 100%);
    cursor: default;
}

@keyframes clickPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

@keyframes testingGlow {
    0% { box-shadow: var(--shadow-medium), 0 0 20px rgba(52, 199, 89, 0.3); }
    100% { box-shadow: var(--shadow-large), 0 0 30px rgba(52, 199, 89, 0.5); }
}

/* CPS内容 */
.cps-content {
    text-align: center;
    color: var(--text-primary);
    z-index: 2;
    position: relative;
}

.cps-test-area.active .cps-content,
.cps-test-area.testing .cps-content {
    color: white;
}

.cps-icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--spacing-lg);
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.cps-test-area:hover .cps-icon {
    transform: scale(1.1);
}

.cps-content h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.cps-content p {
    font-size: var(--font-size-base);
    opacity: 0.9;
    margin-bottom: var(--spacing-lg);
}

/* 点击计数器 */
.click-counter {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

.cps-test-area.testing .click-counter {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.click-counter.animate {
    transform: scale(1.2);
    animation: counterBounce 0.1s ease;
}

@keyframes counterBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 实时统计 */
.live-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background-color: var(--background-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-small);
}

.stat-item {
    text-align: center;
    min-width: 80px;
}

.stat-label {
    display: block;
    font-size: var(--font-size-small);
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    display: block;
    font-size: var(--font-size-xl);
    color: var(--text-primary);
    font-weight: 700;
}

/* CPS结果容器 */
.cps-results-container {
    background: linear-gradient(135deg, var(--background-secondary) 0%, rgba(0, 122, 255, 0.05) 100%);
    border-radius: var(--border-radius-large);
    padding: var(--spacing-xl);
    margin-top: var(--spacing-xl);
    border: 1px solid rgba(0, 122, 255, 0.1);
}

.cps-results-container h3 {
    text-align: center;
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-xl);
    color: var(--text-primary);
}

.cps-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.result-card.highlight {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    transform: scale(1.02);
    box-shadow: var(--shadow-large);
}

.result-card.highlight .result-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.result-card.highlight .result-label {
    color: rgba(255, 255, 255, 0.9);
}

.result-card.highlight .result-value {
    color: white;
    font-size: var(--font-size-2xl);
}

/* 节奏分析 */
.rhythm-analysis {
    border-top: 1px solid var(--background-tertiary);
    padding-top: var(--spacing-xl);
    text-align: center;
}

.rhythm-analysis h4 {
    font-size: var(--font-size-large);
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.rhythm-chart {
    background-color: var(--background-primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-small);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

#rhythmCanvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

.rhythm-description {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .time-options {
        gap: var(--spacing-sm);
    }
    
    .time-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        min-width: 80px;
        font-size: var(--font-size-small);
    }
    
    .cps-test-area {
        height: 45vh;
        min-height: 300px;
    }
    
    .cps-icon {
        width: 60px;
        height: 60px;
    }
    
    .cps-content h3 {
        font-size: var(--font-size-large);
    }
    
    .click-counter {
        font-size: 3rem;
    }
    
    .live-stats {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    .stat-item {
        min-width: auto;
    }
    
    .cps-results-grid {
        grid-template-columns: 1fr;
    }
    
    .rhythm-chart {
        padding: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    .time-options {
        flex-direction: column;
        align-items: center;
    }
    
    .time-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .cps-test-area {
        height: 40vh;
        min-height: 250px;
    }
    
    .click-counter {
        font-size: 2.5rem;
    }
    
    .live-stats {
        padding: var(--spacing-md);
    }
    
    .cps-results-container {
        padding: var(--spacing-lg);
    }
}

/* 特殊效果 */
.click-effect {
    position: absolute;
    pointer-events: none;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    animation: clickEffect 0.6s ease-out forwards;
    z-index: 10;
}

@keyframes clickEffect {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

/* 进度条样式 */
.progress-ring {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
}

.progress-ring-circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 4;
}

.progress-ring-progress {
    fill: none;
    stroke: white;
    stroke-width: 4;
    stroke-linecap: round;
    transform-origin: center;
    transform: rotate(-90deg);
    transition: stroke-dashoffset 0.1s ease;
}

/* 高分效果 */
.high-score-effect {
    animation: highScoreGlow 1s ease-in-out;
}

@keyframes highScoreGlow {
    0%, 100% {
        box-shadow: var(--shadow-medium);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.6), var(--shadow-large);
    }
}
