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

:root {
    /* 主色系 */
    --primary-color: #4a6bff;
    --primary-dark: #3a56cc;
    --primary-light: #6d85ff;
    --secondary-color: #00d4aa;
    --accent-color: #ff6b9d;
    
    /* 背景色 */
    --bg-primary: #0f1525;
    --bg-secondary: #1a2236;
    --bg-card: #222d44;
    --bg-hover: #2a3652;
    
    /* 文本色 */
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    
    /* 边框和阴影 */
    --border-color: #2d3748;
    --border-radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    /* 字体 */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    user-select: none; /* 防止文本选中 */
}

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

/* 顶部导航 */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: var(--font-size-xl);
}

.logo-section h1 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.version-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-left: 10px;
}

.header-controls {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: var(--bg-hover);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    width: 100%;
}

@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .app-container {
        max-width: 1200px;
    }
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.center-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* 卡片样式 */
.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
    transition: transform 0.3s, box-shadow 0.3s;
    width: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: var(--font-size-lg);
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 i {
    color: var(--primary-color);
}

/* 测试区域 */
.test-area-wrapper {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    min-height: 500px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.test-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: linear-gradient(145deg, #151e32, #12192b);
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    width: 100%;
}

.test-area.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 30px rgba(74, 107, 255, 0.3);
    background: linear-gradient(145deg, #1a2540, #161f38);
    cursor: pointer;
}

.test-area.waiting {
    border-color: var(--secondary-color);
    box-shadow: 0 0 30px rgba(0, 212, 170, 0.3);
    cursor: pointer;
}

.test-area.running {
    border-color: var(--accent-color);
    box-shadow: 0 0 30px rgba(255, 107, 157, 0.3);
    cursor: pointer;
}

.test-area.finished {
    border-color: var(--secondary-color);
    box-shadow: 0 0 30px rgba(0, 212, 170, 0.2);
    background: linear-gradient(145deg, #151e32, #12192b);
    cursor: default;
}

.click-indicator {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    width: 100%;
    margin: 0 auto;
}

.click-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.click-instruction {
    font-size: var(--font-size-xl);
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.5;
}

.current-mode-display {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.mode-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.mode-value {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--primary-color);
}

.test-controls {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.timer-display {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    background: linear-gradient(90deg, #4a6bff, #00d4aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-display.countdown {
    color: #ff6b9d;
    -webkit-text-fill-color: #ff6b9d;
}

.progress-bar {
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 4px;
}

/* 模式选择器 */
.mode-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 768px) {
    .mode-buttons {
        grid-template-columns: 1fr;
    }
}

.mode-btn {
    padding: 12px 15px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.mode-btn:hover {
    background-color: var(--bg-hover);
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(74, 107, 255, 0.4);
}

.mode-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    margin-bottom: 4px;
}

.mode-desc {
    font-size: var(--font-size-xs);
    opacity: 0.8;
}

/* 实时统计数据 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    background-color: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.stat-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* 历史记录 */
.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 12px 15px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s;
}

.history-item:hover {
    background-color: var(--bg-hover);
    transform: translateX(5px);
}

.history-time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: 5px;
}

.history-cps {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary-color);
}

.history-mode {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 5px;
}

/* 控制按钮组 */
.control-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
    width: 100%;
    justify-content: center;
}

.control-btn {
    padding: 16px 30px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: var(--font-size-xl);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    position: relative;
    overflow: hidden;
}

.control-btn i {
    font-size: var(--font-size-xl);
}

/* 重新开始按钮的样式 */
.control-btn.restart {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(74, 107, 255, 0.3);
}

.control-btn.restart:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(74, 107, 255, 0.5);
}

.control-btn.restart:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 107, 255, 0.4);
}

/* 测试完成后的高亮样式 */
.control-btn.restart.highlight {
    background: linear-gradient(135deg, #ff6b9d, #ff9a3d, #ffd166);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 30px rgba(255, 107, 157, 0.5);
    animation: pulseGlow 2s infinite alternate;
    position: relative;
}

.control-btn.restart.highlight:before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(135deg, #ff6b9d, #ff9a3d, #ffd166);
    border-radius: 12px;
    z-index: -1;
    filter: blur(15px);
    opacity: 0.7;
    animation: pulseGlowBefore 2s infinite alternate;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 20px rgba(255, 107, 157, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 35px rgba(255, 107, 157, 0.8);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 25px rgba(255, 107, 157, 0.6);
        transform: scale(1.01);
    }
}

@keyframes pulseGlowBefore {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        opacity: 0.6;
    }
}

/* 鼠标按钮模式选择器 */
.button-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background-color: var(--bg-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.mode-option:hover {
    background-color: var(--bg-hover);
    border-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* 增强选中效果 */
.mode-option.active {
    background: linear-gradient(135deg, rgba(74, 107, 255, 0.2), rgba(0, 212, 170, 0.2));
    border-color: var(--primary-color);
    border-width: 3px;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(74, 107, 255, 0.3);
}

.mode-option.active:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0.1;
    z-index: 0;
}

.mode-option.active .mode-icon {
    color: var(--primary-color);
    transform: scale(1.1);
}

.mode-option.active .mode-title {
    color: var(--primary-color);
    font-weight: 700;
}

.mode-option.active .mode-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    color: white;
    font-size: var(--font-size-sm);
}

.mode-option.active .mode-check i {
    display: block !important;
}

.mode-icon {
    font-size: var(--font-size-xl);
    color: var(--primary-color);
    transition: all 0.3s;
    z-index: 1;
}

.mode-info {
    flex: 1;
    z-index: 1;
}

.mode-title {
    font-weight: 600;
    margin-bottom: 2px;
    transition: all 0.3s;
}

.mode-description {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.mode-check {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* 结果仪表板 */
.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.result-card {
    background-color: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.result-card.primary {
    border-top: 4px solid var(--primary-color);
}

.result-card.secondary {
    border-top: 4px solid var(--secondary-color);
}

.result-card.accent {
    border-top: 4px solid var(--accent-color);
}

.result-value {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    margin-bottom: 5px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: var(--font-size-3xl);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 25px;
}

/* 通知区域 */
.notification-area {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    padding: 15px 20px;
    border-radius: 8px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    max-width: 300px;
    animation: slideInRight 0.3s;
    border-left: 4px solid var(--primary-color);
}

.notification.success {
    border-left-color: var(--secondary-color);
}

.notification.error {
    border-left-color: var(--accent-color);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification.fade-out {
    animation: fadeOutUp 0.3s ease forwards;
}

@keyframes fadeOutUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* 点击动画 */
@keyframes clickEffect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.click-animation {
    animation: clickEffect 0.15s ease;
}

/* 粒子效果 */
.particle {
    position: fixed;
    pointer-events: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    animation: particleFloat 0.8s ease-out forwards;
    z-index: 1000;
}

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

/* 倒计时动画 */
@keyframes countdownPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.countdown-animation {
    animation: countdownPulse 0.5s ease;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .app-container {
        max-width: 1000px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .click-title {
        font-size: var(--font-size-2xl);
    }
    
    .click-instruction {
        font-size: var(--font-size-lg);
    }
}

@media (max-width: 992px) {
    .app-container {
        max-width: 800px;
    }
    
    .test-area-wrapper {
        min-height: 400px;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .app-container {
        max-width: 100%;
    }
    
    .app-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .main-content {
        gap: 15px;
    }
    
    .test-area-wrapper {
        min-height: 400px;
        padding: 20px;
    }
    
    .click-title {
        font-size: var(--font-size-2xl);
    }
    
    .click-instruction {
        font-size: var(--font-size-lg);
    }
    
    .timer-display {
        font-size: var(--font-size-3xl);
    }
    
    .control-btn {
        padding: 14px 20px;
        font-size: var(--font-size-lg);
    }
}

/* 完成测试后的提示区域 */
.test-complete-notice {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.1), rgba(255, 154, 61, 0.1));
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    animation: fadeIn 0.5s ease;
}

.test-complete-notice h3 {
    color: var(--accent-color);
    margin-bottom: 8px;
    font-size: var(--font-size-lg);
}

.test-complete-notice p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}