/**
 * 反应速度测试工具样式 - 优化版
 */

/* 工具容器 */
.pwt-reaction-time-test {
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-size: 16px;
}

/* 模块选择器 */
.pwt-module-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 28px;
    gap: 10px;
    padding: 5px;
    background-color: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.pwt-module-tab {
    padding: 14px 0;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #555;
    position: relative;
    letter-spacing: 0.3px;
    border-radius: 8px;
    background-color: transparent;
    text-align: center;
    flex: 1;
    min-width: 110px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
}
.pwt-tool-title{font-size: 28px;font-weight: 600;margin-bottom: 10px;}
.pwt-tool-description{margin: 20px 0; font-size: 16px;}
.pwt-module-tab:hover {
    color: #3a7bc2;
    background-color: #f0f4f9;
    border-color: #e0e4e8;
}

.pwt-module-tab.active {
    color: white;
    background-color: #3a7bc2;
    box-shadow: 0 3px 10px rgba(58, 123, 194, 0.2);
}

.pwt-module-tab.active::before {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #3a7bc2;
}

/* 轮数选择器 */
.pwt-rounds-selector {
    margin: 24px 0;
    text-align: center;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.pwt-rounds-selector label {
    margin-right: 12px;
    font-weight: 600;
    color: #444;
    vertical-align: middle;
}

.pwt-rounds-note {
    font-size: 14px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
}

.pwt-rounds-disabled {
    opacity: 0.7;
    position: relative;
}

.pwt-rounds-disabled select {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.pwt-rounds-selector select {
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid #e0e4e8;
    background-color: #fff;
    font-size: 15px;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    cursor: pointer;
    outline: none;
}

.pwt-rounds-selector select:hover,
.pwt-rounds-selector select:focus {
    border-color: #3a7bc2;
    box-shadow: 0 2px 8px rgba(58, 123, 194, 0.15);
}

/* 模块容器 */
.pwt-module-container {
    display: none;
    margin: 24px 0;
    padding: 24px;
    border-radius: 12px;
    background-color: #f9fafb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.pwt-module-container.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.pwt-module-instructions {
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background-color: #eef4fb;
    border-radius: 8px;
    color: #2c3e50;
    font-weight: 500;
    line-height: 1.5;
    border-left: 4px solid #3a7bc2;
}

/* 测试区域 */
.pwt-test-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    position: relative;
    padding: 20px 0;
    margin-bottom: 10px;
    border-radius: 10px;
    background-color: #f9fafb;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

/* 测试方块 - 经典视觉反应测试 */
.pwt-test-block {
    width: 160px;
    height: 160px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pwt-test-block:hover {
    transform: scale(1.02);
}

.pwt-state-ready {
    background-color: #3a7bc2; /* 主色调 - 就绪状态 */
}

.pwt-state-waiting {
    background-color: #e74c3c; /* 红色 - 等待状态 */
}

.pwt-state-trigger {
    background-color: #2ecc71; /* 绿色 - 触发状态 */
}

/* 按钮样式 */
.pwt-button,
.pwt-start-button,
.pwt-ready-button {
    padding: 12px 28px;
    border-radius: 8px;
    border: none;
    background-color: #3a7bc2;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
    margin-top: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(58, 123, 194, 0.25);
    letter-spacing: 0.3px;
}

.pwt-button:hover,
.pwt-start-button:hover,
.pwt-ready-button:hover {
    background-color: #2d6cb0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58, 123, 194, 0.3);
}

.pwt-button:active,
.pwt-start-button:active,
.pwt-ready-button:active {
    transform: translateY(0);
}

.pwt-button-danger {
    background-color: #e74c3c;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.25);
}

.pwt-button-danger:hover {
    background-color: #c0392b;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* 结果容器 */
.pwt-result-container {
    margin: 24px 0;
    padding: 20px;
    border-radius: 10px;
    background-color: #f0f7ff;
    text-align: center;
    min-height: 30px;
    border: 1px solid #d0e3ff;
    font-size: 16px;
    color: #333;
    line-height: 1.6;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 5;
}

.pwt-result-container {
    position: relative;
}

.pwt-result-label {
    position: absolute;
    top: -10px;
    left: 20px;
    background-color: #3a7bc2;
    color: white;
    padding: 2px 12px;
    font-size: 14px;
    border-radius: 4px;
    font-weight: 500;
    z-index: 1;
}

.pwt-result-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pwt-result-summary p {
    margin: 0;
    font-size: 17px;
    background-color: white;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 进度显示 */
.pwt-progress {
    text-align: center;
    font-size: 15px;
    color: #666;
    margin: 10px 0 16px;
    padding: 12px 0;
    font-weight: 500;
    letter-spacing: 0.2px;
    border-top: 1px dashed #e0e4e8;
}

/* 音频提示区域 */
.pwt-test-prompt {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background-color: #3a7bc2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(58, 123, 194, 0.25);
    text-align: center;
    padding: 20px;
}

.pwt-test-prompt:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(58, 123, 194, 0.3);
}

.pwt-test-prompt.pwt-state-waiting {
    background-color: #e74c3c;
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.25);
}

.pwt-test-prompt.pwt-state-ready {
    background-color: #3a7bc2;
}

/* 复位状态样式 */
.pwt-test-area.pwt-resetting {
    pointer-events: none;
    position: relative;
    overflow: hidden;
}

.pwt-test-area.pwt-resetting::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.pwt-resetting-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    color: white;
    font-size: 18px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 30px;
    background-color: rgba(58, 123, 194, 0.9);
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: pulseReset 1.5s infinite;
}

/* 复位倒计时动画 */
@keyframes pulseReset {
    0% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(58, 123, 194, 0.7);
    }
    70% {
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 0 0 0 10px rgba(58, 123, 194, 0);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(58, 123, 194, 0);
    }
}

/* 复位圆形进度效果 */
.pwt-reset-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    z-index: 11;
    border-radius: 50%;
    background: conic-gradient(#3a7bc2 var(--progress, 0%), rgba(255, 255, 255, 0.3) 0);
    box-shadow: 0 0 15px rgba(58, 123, 194, 0.5);
}

.pwt-reset-circle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 66px;
    height: 66px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

.pwt-reset-circle::after {
    content: attr(data-seconds);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: bold;
    color: #3a7bc2;
    z-index: 2;
}

@keyframes spin {
    0% {
        --progress: 0%;
    }
    100% {
        --progress: 100%;
    }
}

/* 标尺样式 */
.pwt-ruler {
    width: 60px;
    height: 300px;
    background-color: #f1c40f;
    border-radius: 6px;
    position: relative;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(241, 196, 15, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwt-ruler-marks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pwt-ruler-marks::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 80%;
    height: 4px;
    background-color: #e74c3c;
    transform: translateX(-50%);
    border-radius: 2px;
}

/* 历史记录容器 */
.pwt-history-container {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid #eaeaea;
}

.pwt-history-container h4 {
    text-align: center;
    margin-bottom: 24px;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    position: relative;
    padding-bottom: 12px;
}

.pwt-history-container h4::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: #3a7bc2;
    border-radius: 3px;
}

/* 历史记录选项卡 */
.pwt-history-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}

.pwt-history-tab {
    padding: 10px 16px;
    cursor: pointer;
    border: 1px solid #e0e4e8;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    background-color: #fff;
}

.pwt-history-tab:hover {
    background-color: #f5f7fa;
    border-color: #d0d7de;
}

.pwt-history-tab.active {
    background-color: #3a7bc2;
    color: white;
    border-color: #3a7bc2;
    box-shadow: 0 2px 8px rgba(58, 123, 194, 0.2);
}

/* 历史数据图表 */
.pwt-history-chart-container {
    height: 280px;
    margin-bottom: 36px;
    padding: 16px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

/* 历史数据表格 */
.pwt-history-data-container {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 24px;
    border-radius: 10px;
    border: 1px solid #eaeaea;
    background-color: #fff;
    font-size: 14px;
}

.pwt-history-table {
    width: 100%;
    border-collapse: collapse;
}

.pwt-history-table th,
.pwt-history-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid #eaeaea;
}

.pwt-history-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #444;
    position: sticky;
    top: 0;
    z-index: 1;
}

.pwt-history-table tbody tr:hover {
    background-color: #f5f7fa;
}

.pwt-history-table .pwt-latest-record {
    background-color: #eef4fb;
}

.pwt-history-table .pwt-latest-record td {
    font-weight: 500;
}

.pwt-history-table .pwt-latest-record strong {
    color: #3a7bc2;
}

.pwt-history-table .pwt-no-data {
    text-align: center;
    color: #888;
    padding: 30px;
    font-style: italic;
}

/* 清除历史按钮 */
#pwt-clear-history {
    display: block;
    margin: 24px auto;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .pwt-reaction-time-test {
        padding: 16px;
    }
    
    .pwt-module-tab, 
    .pwt-history-tab {
        padding: 12px 0;
        font-size: 14px;
    }
    
    .pwt-module-container {
        padding: 16px;
    }
    
    .pwt-test-block {
        width: 140px;
        height: 140px;
    }
    
    .pwt-test-prompt {
        width: 180px;
        height: 180px;
        font-size: 16px;
    }
    
    .pwt-ruler {
        width: 50px;
        height: 260px;
    }
    
    .pwt-history-chart-container {
        height: 240px;
    }
    
    .pwt-button,
    .pwt-start-button,
    .pwt-ready-button {
        padding: 10px 22px;
        font-size: 15px;
    }
    
    .pwt-history-table th,
    .pwt-history-table td {
        padding: 12px 14px;
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .pwt-module-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px;
    }
    
    .pwt-module-tab {
        margin: 0;
        text-align: center;
        width: 100%;
     
        min-width: 0;
        border-radius: 6px;
    }
    
    .pwt-module-tab.active {
        background-color: #3a7bc2;
    }
    
    .pwt-module-tab.active::before {
        display: none;
    }
    
    .pwt-test-block {
        width: 120px;
        height: 120px;
    }
    
    .pwt-test-prompt {
        width: 150px;
        height: 150px;
        font-size: 15px;
    }
    
    .pwt-history-tabs {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .pwt-history-tab {
        flex: 0 0 calc(50% - 10px);
        margin: 0;
        text-align: center;
        padding: 10px 0;
    }
    
    .pwt-rounds-selector select {
        width: 100%;
        margin-top: 10px;
    }
    
    .pwt-rounds-selector label {
        display: block;
        margin-bottom: 8px;
    }
    
    .pwt-history-chart-container {
        height: 200px;
    }
}

/* 优化图表样式 */
.pwt-history-chart-container canvas {
    max-width: 100%;
}

/* 优化结果显示 */
.pwt-result-container strong {
    color: #3a7bc2;
    font-weight: 600;
}

/* 添加动画效果 */
.pwt-test-block, 
.pwt-test-prompt, 
.pwt-button,
.pwt-start-button,
.pwt-ready-button {
    will-change: transform;
}

/* 添加页面元素过渡动画 */
.pwt-module-container {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.pwt-module-container.active {
    animation: fadeInUp 0.4s ease forwards;
}

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

/* 结果显示动画 */
.pwt-result-container {
    transition: all 0.3s ease;
}

.pwt-result-summary p {
    animation: fadeIn 0.5s ease forwards;
    animation-delay: calc(var(--animation-order, 0) * 0.1s);
    opacity: 0;
}

.pwt-result-summary p:nth-child(1) {
    --animation-order: 1;
}

.pwt-result-summary p:nth-child(2) {
    --animation-order: 2;
}

.pwt-result-summary p:nth-child(3) {
    --animation-order: 3;
}

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

/* 确保音频元素完全隐藏 */
audio#pwt-audio-beep {
    position: absolute;
    visibility: hidden;
    height: 0;
    width: 0;
}

/* 优化Go/No-Go测试结果显示 */
.pwt-result-summary p {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border-radius: 6px;
    margin: 4px 0 !important;
}

.pwt-result-summary p:nth-child(odd) {
    background-color: #eef4fb;
}

/* 最后一次结果样式 */
.pwt-last-result {
    background-color: #e8f4ff !important;
    border-left: 4px solid #3a7bc2 !important;
    font-weight: 600;
    color: #333;
    position: relative;
}

.pwt-last-result span {
    color: #3a7bc2;
    font-weight: 700;
}