/* Aim Trainer 专用样式 */

/* 训练模式选择器 */
.mode-selector {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

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

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

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    background-color: var(--background-secondary);
    border: 2px solid var(--background-tertiary);
    border-radius: var(--border-radius-large);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    text-align: center;
}

.mode-btn svg {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.mode-btn span {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
}

.mode-btn small {
    font-size: var(--font-size-small);
    color: var(--text-secondary);
    margin-top: -var(--spacing-xs);
}

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

.mode-btn:hover svg {
    color: var(--error-color);
}

.mode-btn.active {
    border-color: var(--error-color);
    background: linear-gradient(135deg, var(--error-color) 0%, #DC3545 100%);
    color: white;
    box-shadow: var(--shadow-large);
}

.mode-btn.active svg,
.mode-btn.active span,
.mode-btn.active small {
    color: white;
}

/* 训练设置 */
.training-settings {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-lg);
    background-color: var(--background-secondary);
    border-radius: var(--border-radius-large);
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 120px;
}

.setting-group label {
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-group select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--background-tertiary);
    border-radius: var(--border-radius);
    background-color: var(--background-primary);
    color: var(--text-primary);
    font-size: var(--font-size-small);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.setting-group select:focus {
    outline: none;
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.1);
}

/* 训练统计显示 */
.training-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, var(--background-secondary) 0%, rgba(255, 59, 48, 0.05) 100%);
    border-radius: var(--border-radius-large);
    border: 1px solid rgba(255, 59, 48, 0.1);
    flex-wrap: wrap;
}

.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);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: var(--font-size-xl);
    color: var(--error-color);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(255, 59, 48, 0.1);
}

/* 瞄准训练容器 */
.aim-trainer-container {
    max-width: 900px;
    margin: 0 auto;
}

/* 指示区域 */
.instruction-area {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-xl);
    background-color: var(--background-secondary);
    border-radius: var(--border-radius-large);
    transition: all 0.3s ease;
}

.instruction-icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--spacing-lg);
    color: var(--error-color);
    opacity: 0.8;
}

.instruction-area h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.instruction-area p {
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* 训练区域 */
.training-area {
    width: 100%;
    height: 60vh;
    min-height: 400px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: var(--border-radius-large);
    position: relative;
    overflow: hidden;
    cursor: crosshair;
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-large);
    border: 2px solid var(--background-tertiary);
}

.training-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 59, 48, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255, 59, 48, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

/* 准星 */
.crosshair {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 10;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background-color: #ffffff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.crosshair::before {
    width: 20px;
    height: 2px;
    top: 9px;
    left: 0;
}

.crosshair::after {
    width: 2px;
    height: 20px;
    top: 0;
    left: 9px;
}

.training-area:hover .crosshair {
    opacity: 1;
}

/* 目标样式 */
.target {
    position: absolute;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.1s ease;
    border: 3px solid white;
    box-shadow: 
        0 0 0 2px var(--error-color),
        0 4px 12px rgba(255, 59, 48, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    z-index: 5;
}

/* 目标尺寸 */
.target.small {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #ff6b6b 0%, var(--error-color) 100%);
}

.target.medium {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #ff6b6b 0%, var(--error-color) 70%, #c0392b 100%);
}

.target.large {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #ff6b6b 0%, var(--error-color) 60%, #c0392b 100%);
}

/* 目标动画效果 */
.target:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 0 2px var(--error-color),
        0 6px 20px rgba(255, 59, 48, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.target.hit {
    animation: targetHit 0.3s ease-out forwards;
}

.target.missed {
    animation: targetMissed 0.5s ease-out forwards;
}

@keyframes targetHit {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        background: radial-gradient(circle, #00ff00 0%, #28a745 100%);
        border-color: #28a745;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

@keyframes targetMissed {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    25% {
        transform: scale(0.8);
        opacity: 0.7;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* 移动目标动画 */
.target.moving {
    animation: moveTarget 3s linear infinite;
}

@keyframes moveTarget {
    0% {
        transform: translateX(0) translateY(0);
    }
    25% {
        transform: translateX(100px) translateY(-50px);
    }
    50% {
        transform: translateX(200px) translateY(0);
    }
    75% {
        transform: translateX(100px) translateY(50px);
    }
    100% {
        transform: translateX(0) translateY(0);
    }
}

/* 点击效果 */
.click-effect {
    position: absolute;
    pointer-events: none;
    z-index: 15;
    animation: clickRipple 0.6s ease-out forwards;
}

@keyframes clickRipple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
        border: 2px solid #ffffff;
        border-radius: 50%;
    }
    100% {
        width: 60px;
        height: 60px;
        opacity: 0;
        border: 1px solid #ffffff;
        border-radius: 50%;
        margin: -30px 0 0 -30px;
    }
}

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

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

.aim-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(--error-color) 0%, #DC3545 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);
}

/* 性能分析 */
.performance-analysis {
    border-top: 1px solid var(--background-tertiary);
    padding-top: var(--spacing-xl);
}

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

.analysis-content {
    background-color: var(--background-primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-small);
}

.analysis-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.analysis-content .highlight {
    color: var(--error-color);
    font-weight: 600;
}

/* 准确度图表 */
.accuracy-chart {
    background-color: var(--background-primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    text-align: center;
    box-shadow: var(--shadow-small);
}

.accuracy-chart h5 {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

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

/* 特殊效果 */
.training-glow {
    animation: trainingGlow 2s ease-in-out infinite alternate;
}

@keyframes trainingGlow {
    0% {
        box-shadow: var(--shadow-medium), 0 0 20px rgba(255, 59, 48, 0.2);
    }
    100% {
        box-shadow: var(--shadow-large), 0 0 30px rgba(255, 59, 48, 0.4);
    }
}

.streak-effect {
    animation: streakEffect 0.8s ease-out;
}

@keyframes streakEffect {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

/* 暂停覆盖层 */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-2xl);
    font-weight: 600;
    z-index: 20;
    border-radius: var(--border-radius-large);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .mode-options {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-md);
    }
    
    .mode-btn {
        width: 100%;
        max-width: 200px;
        flex-direction: row;
        justify-content: flex-start;
        gap: var(--spacing-md);
    }
    
    .mode-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .training-settings {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .training-stats {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    .training-area {
        height: 50vh;
        min-height: 300px;
    }
    
    .crosshair {
        width: 16px;
        height: 16px;
    }
    
    .crosshair::before {
        width: 16px;
        top: 7px;
    }
    
    .crosshair::after {
        height: 16px;
        left: 7px;
    }
    
    .aim-results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .training-area {
        height: 45vh;
        min-height: 250px;
    }
    
    .target.small {
        width: 24px;
        height: 24px;
    }
    
    .target.medium {
        width: 44px;
        height: 44px;
    }
    
    .target.large {
        width: 64px;
        height: 64px;
    }
    
    .instruction-area,
    .aim-results-container {
        padding: var(--spacing-lg);
    }
    
    .training-settings {
        padding: var(--spacing-md);
    }
}

/* 无障碍支持 */
.target:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .training-area {
        background: #000000;
        border: 3px solid var(--text-primary);
    }
    
    .target {
        border: 3px solid #ffffff;
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    .target,
    .mode-btn,
    .crosshair {
        transition: none;
    }
    
    .target.moving {
        animation: none;
    }
    
    @keyframes targetHit,
    @keyframes targetMissed,
    @keyframes moveTarget,
    @keyframes clickRipple,
    @keyframes trainingGlow,
    @keyframes streakEffect {
        animation-duration: 0.01ms;
    }
}
