:root {
    --bg-color: #121212;
    --mouse-base: #2a2a2a;
    --highlight: #00ff88; 
    --text-main: #e0e0e0;
    --text-dim: #757575;
    --border: #444;
    --accent-red: #ff4444; 
    --info-blue: #4fc3f7;
    --double-click-normal: #00ff88; /* 修改：双击改为绿色 */
    --double-click-fault: #ff4444;
    --test-area-border-default: #4a4a4a;
    --test-area-border-active: #4fc3f7;
    --test-area-border-testing: #4fc3f7; /* 修改：测试中改为浅蓝色 */
    --test-area-border-error: #ff4444;
    --test-area-border-double-click: #00ff88; /* 修改：双击检测改为绿色 */
    
    /* 新增: 按键状态颜色 */
    --click-normal: var(--info-blue);      /* 颜色A: 普通单击 - 浅蓝色 */
    --click-double: var(--double-click-normal); /* 颜色B: 正常双击 - 绿色 */
    --click-fault: var(--double-click-fault);   /* 颜色C: 故障双击 - 红色 */
    
    /* 新增: 数据面板状态颜色 */
    --counter-click-normal: rgba(79, 195, 247, 0.2); /* 浅蓝色半透明 */
    --counter-click-double: rgba(0, 255, 136, 0.2); /* 绿色半透明 */
    --counter-click-fault: rgba(255, 68, 68, 0.2); /* 红色半透明 */
    
    /* 新增: 日志状态颜色 */
    --log-click-normal: #4fc3f7; /* 浅蓝色 */
    --log-click-double: #00ff88; /* 绿色 */
    --log-click-fault: #ff4444; /* 红色 */
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* 改为从顶部开始 */
    min-height: 100vh;
    margin: 0;
    user-select: none;
    padding: 10px 0 30px 0; /* 添加上下内边距 */
}

h1 { 
    margin-bottom: 8px; /* 减小间距 */
    font-weight: 300; 
    letter-spacing: 1px;
    font-size: 1.8rem; /* 减小标题字体 */
}

p { 
    color: var(--text-dim); 
    margin-bottom: 20px; /* 减小间距 */
    font-size: 0.9rem; /* 减小副标题字体 */
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr 350px; /* 减小右侧面板宽度 */
    gap: 25px; /* 减小间距 */
    align-items: stretch;
    max-width: 1000px; /* 减小整体最大宽度 */
    width: 100%;
    padding: 0 15px; /* 减小内边距 */
    margin-bottom: 20px; /* 添加底部间距 */
}

/* --- 测试区容器样式 - 减小尺寸 --- */
.test-area-container {
    position: relative;
    border: 3px solid var(--test-area-border-default); /* 减小边框 */
    border-radius: 15px; /* 减小圆角 */
    padding: 20px; /* 减小内边距 */
    background-color: rgba(30, 30, 30, 0.8);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); /* 减小阴影 */
    min-height: 420px; /* 显著减小最小高度 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.test-area-container:hover {
    border-color: var(--test-area-border-active);
    box-shadow: 0 0 25px rgba(79, 195, 247, 0.4);
}

.test-area-container.active {
    border-color: var(--test-area-border-active);
    box-shadow: 0 0 30px rgba(79, 195, 247, 0.6);
    animation: test-area-pulse 2s infinite alternate;
}

.test-area-container.testing {
    border-color: var(--test-area-border-testing);
    box-shadow: 0 0 30px rgba(79, 195, 247, 0.6); /* 修改：使用浅蓝色 */
}

.test-area-container.double-click-detected {
    border-color: var(--test-area-border-double-click);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.6); /* 修改：使用绿色 */
    animation: double-click-border 0.5s ease-in-out 2;
}

.test-area-container.error {
    border-color: var(--test-area-border-error);
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.6);
}

@keyframes test-area-pulse {
    from {
        box-shadow: 0 0 25px rgba(79, 195, 247, 0.4);
    }
    to {
        box-shadow: 0 0 35px rgba(79, 195, 247, 0.7);
    }
}

@keyframes double-click-border {
    0%, 100% {
        border-color: var(--test-area-border-double-click);
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.6);
    }
    50% {
        border-color: #80ffbf; /* 浅绿色 */
        box-shadow: 0 0 45px rgba(0, 255, 136, 0.9);
    }
}

.test-area-label {
    position: absolute;
    top: -15px;
    left: 20px;
    background-color: var(--bg-color);
    padding: 5px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #ffffff; /* 改为纯白色，更醒目 */
    border: 2px solid var(--test-area-border-active); /* 使用激活状态的颜色 */
    z-index: 10;
    box-shadow: 0 0 10px rgba(79, 195, 247, 0.5); /* 添加发光效果 */
}

.test-area-icon {
    color: var(--info-blue);
    font-size: 1rem; /* 稍微增大图标 */
}

.test-area-text {
    font-weight: 700; /* 加粗字体 */
    text-transform: uppercase; /* 英文版大写字母 */
    letter-spacing: 1px; /* 增加字母间距 */
    color: #ffffff; /* 纯白色 */
    text-shadow: 0 0 8px rgba(79, 195, 247, 0.7); /* 添加文字发光效果 */
}

.test-area-status {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold; /* 状态文本加粗 */
    background-color: var(--test-area-border-default);
    color: var(--text-main);
    transition: all 0.3s ease;
}

.test-area-container.active .test-area-status {
    background-color: var(--test-area-border-active);
    color: #000;
}

.test-area-container.testing .test-area-status {
    background-color: var(--test-area-border-testing);
    color: #000;
}

.test-area-container.double-click-detected .test-area-status {
    background-color: var(--test-area-border-double-click);
    color: #000;
}

.test-area-container.error .test-area-status {
    background-color: var(--test-area-border-error);
    color: #fff;
}

.test-area-info {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item i {
    color: var(--info-blue);
}

/* --- Mouse visualization area - 减小尺寸 --- */
.mouse-visual {
    position: relative;
    width: 220px; /* 减小宽度 */
    height: 350px; /* 减小高度 */
    background-color: var(--mouse-base);
    border-radius: 110px 110px 90px 90px; /* 根据新尺寸调整圆角 */
    border: 2px solid var(--border);
    display: flex;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); /* 减小阴影 */
}

.btn-zone {
    position: absolute;
    background-color: #333;
    transition: background-color 0.05s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem; /* 稍微增大字体 */
    color: #555;
    font-weight: bold;
}

.btn-zone.active {
    background-color: var(--click-normal); /* 修改：使用单击颜色 */
    color: #000;
    box-shadow: 0 0 15px rgba(79, 195, 247, 0.7); /* 修改：浅蓝色发光 */
}

.left-click { top: 0; left: 0; width: 50%; height: 120px; border-radius: 110px 0 0 0; border-right: 1px solid #111; }
.right-click { top: 0; right: 0; width: 50%; height: 120px; border-radius: 0 110px 0 0; border-left: 1px solid #111; }
.middle-click { top: 40px; width: 30px; height: 60px; border-radius: 15px; background-color: #1a1a1a; z-index: 10; border: 1px solid #444; }

.side-btn { left: -10px; width: 18px; height: 55px; border-radius: 9px 0 0 9px; background-color: #3a3a3a; }
.btn-forward { top: 170px; }
.btn-back { top: 235px; }

.scroll-indicator {
    position: absolute;
    top: 15px;
    color: var(--highlight);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 22px; /* 稍微增大图标 */
}
.scroll-up { top: -30px; }
.scroll-down { top: 110px; z-index: 11; }

/* --- Right side: data panel - 减小尺寸并与左侧对齐 --- */
.stats-panel {
    background-color: #1e1e1e;
    padding: 20px; /* 减小内边距 */
    border-radius: 15px; /* 减小圆角 */
    width: 100%;
    height: 100%;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5); /* 减小阴影 */
    display: flex;
    flex-direction: column;
    border: 2px solid #2a2a2a; /* 添加边框与左侧协调 */
}

.stat-box { 
    margin-bottom: 20px; /* 减小间距 */
    flex: 1;
}

.stat-box:last-child {
    margin-bottom: 0;
    flex: 1.2; /* 事件日志区域稍微大一点 */
}

.stat-header-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px; /* 减小间距 */
}

.stat-label {
    font-size: 0.8rem; /* 减小字体 */
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600; /* 增加字体粗细 */
}

.reset-btn {
    background-color: var(--accent-red); 
    color: white;
    border: none;
    padding: 6px 12px; /* 减小按钮内边距 */
    border-radius: 6px; /* 稍微增加圆角 */
    font-family: inherit;
    font-weight: bold;
    font-size: 0.8rem; /* 减小按钮字体 */
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.4); 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
}

.reset-btn:hover {
    background-color: #ff6666;
    transform: scale(1.05); 
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.6);
}

.reset-btn:active {
    transform: scale(0.95);
}

.stat-value {
    font-size: 1.5rem;
    font-family: 'Courier New', monospace;
    color: var(--highlight);
}

/* Counter table style - 调整布局和字体 */
.counter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px; /* 减小间距 */
}

.counter-item {
    background: #252525;
    padding: 12px; /* 减小内边距 */
    border-radius: 10px; /* 增加圆角 */
    display: flex;
    font-size: 0.85rem; /* 减小字体 */
    transition: background-color 0.2s, color 0.1s, transform 0.1s;
    min-height: 65px; /* 减小最小高度 */
}

.counter-item.active-counter {
    background-color: var(--click-normal); /* 修改：使用单击颜色 */
    color: #000;
    transform: scale(1.02);
    transition: none;
}

.counter-item.active-counter .counter-num,
.counter-item.active-counter .counter-label {
    color: #000;
}

.counter-label {
    font-size: 0.75rem; /* 减小字体 */
    color: var(--text-dim);
    margin-top: 4px; /* 减小间距 */
    display: flex;
    justify-content: space-between;
}

.counter-num {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #fff;
    margin-left: 5px;
    font-size: 1rem; /* 减小数字字体 */
}

/* Event log container - 调整大小 */
.log-container {
    height: 140px; /* 减小高度 */
    overflow-y: auto;
    background: #111;
    border: 1px solid #333;
    padding: 12px; /* 减小内边距 */
    font-family: monospace;
    font-size: 0.75rem; /* 减小字体 */
    border-radius: 8px; /* 增加圆角 */
    flex: 1;
}

.log-item { 
    margin-bottom: 4px; 
    border-bottom: 1px solid #222; 
    padding-bottom: 3px; 
    color: #aaa;
    line-height: 1.3; /* 减小行高 */
}

.log-alert { 
    color: var(--log-click-fault);  /* 使用故障双击颜色 */
    font-weight: bold; 
    animation: pulse-alert 1s infinite alternate;
}

@keyframes pulse-alert {
    from {
        opacity: 0.7;
        text-shadow: 0 0 5px rgba(255, 68, 68, 0.5); /* 使用故障双击颜色 */
    }
    to {
        opacity: 1;
        text-shadow: 0 0 15px rgba(255, 68, 68, 0.8); /* 使用故障双击颜色 */
    }
}

/* 修改：让松开日志颜色更淡 */
.log-release {
    color: #666666; /* 比原来更淡的灰色 */
    font-style: italic; /* Italic, indicates auxiliary information */
    font-size: 0.75rem; /* 稍微再小一点 */
    opacity: 0.8; /* 添加透明度使颜色更淡 */
}

/* 修改现有的日志样式 */
/* 普通单击日志样式 */
.log-item:not(.log-alert):not(.log-double-click):not(.log-double-click-fault):not(.log-release) {
    color: var(--log-click-normal); /* 使用普通单击颜色 */
}

/* 修改现有的双击日志样式 */
.log-double-click {
    color: var(--log-click-double); /* 使用正常双击颜色 */
    font-weight: bold;
}

.log-double-click-fault {
    color: var(--log-click-fault); /* 使用故障双击颜色 */
    font-weight: bold;
    animation: pulse-alert 1s infinite alternate;
}

/* 修改指南容器样式，使其直接显示 */
.guide-container {
    max-width: 800px;
    width: 90%;
    height: auto; /* 直接显示，不需要折叠 */
    overflow: visible; /* 内容可见 */
    border-bottom: 1px solid #333; /* 直接显示边框 */
    margin: 25px 0 30px 0; /* 减小上下边距 */
}

.guide-content {
    padding: 20px 10px;
    color: #bbb;
}

/* 滚轮上滚高亮效果 */
.wheel-up-highlight {
    background: linear-gradient(135deg, #4fc3f7, #2196f3) !important;
    color: #000 !important;
    transform: scale(1.02) !important;
    transition: none !important;
    box-shadow: 0 0 15px rgba(79, 195, 247, 0.8) !important;
}

.wheel-up-highlight .counter-num,
.wheel-up-highlight .counter-label {
    color: #000 !important;
    font-weight: bold !important;
}

/* 滚轮下滚高亮效果 */
.wheel-down-highlight {
    background: linear-gradient(135deg, #ff9800, #ff5722) !important;
    color: #000 !important;
    transform: scale(1.02) !important;
    transition: none !important;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.8) !important;
}

.wheel-down-highlight .counter-num,
.wheel-down-highlight .counter-label {
    color: #000 !important;
    font-weight: bold !important;
}

/* 双击事件相关样式 - 更新为新的样式类 */
/* 鼠标按钮双击效果 */
.btn-zone.double-click-active {
    background-color: var(--click-double) !important;
    color: #000 !important;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.8) !important;
    animation: double-click-pulse 0.3s ease-in-out 2;
}

/* 鼠标按钮异常双击效果 */
.btn-zone.fault-double-click-active {
    background-color: var(--click-fault) !important;
    color: #fff !important;
    box-shadow: 0 0 25px rgba(255, 68, 68, 0.8) !important;
    animation: fault-double-click-pulse 0.3s ease-in-out 2;
}

/* 鼠标按钮单击效果 */
.btn-zone.click-active {
    background-color: var(--click-normal) !important;
    color: #000 !important;
    box-shadow: 0 0 20px rgba(79, 195, 247, 0.7) !important;
    animation: click-pulse 0.2s ease-in-out;
}

/* ===== 单击状态样式 ===== */
/* 数据面板单击效果 */
.counter-item.click-highlight {
    background-color: var(--counter-click-normal) !important;
    border: 1px solid rgba(79, 195, 247, 0.4) !important;
}

/* ===== 正常双击状态样式 ===== */
/* 数据面板双击效果 */
.counter-item.double-highlight {
    background-color: var(--counter-click-double) !important;
    border: 1px solid rgba(0, 255, 136, 0.5) !important;
}

/* ===== 异常双击状态样式 ===== */
/* 数据面板异常双击效果 */
.counter-item.fault-highlight {
    background-color: var(--counter-click-fault) !important;
    border: 1px solid rgba(255, 68, 68, 0.5) !important;
}

/* ===== 动画定义 ===== */
@keyframes double-click-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 35px rgba(0, 255, 136, 0.9);
        transform: scale(1.05);
    }
}

@keyframes fault-double-click-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 35px rgba(255, 68, 68, 0.9);
        transform: scale(1.05);
    }
}

/* 单击脉冲动画 */
@keyframes click-pulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(79, 195, 247, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(79, 195, 247, 0.8);
        transform: scale(1.03);
    }
}

/* 添加新的双击效果类 - 为不同按钮提供不同的视觉效果 */
.btn-zone.double-click-effect {
    background-color: var(--double-click-normal) !important;
    color: #000 !important;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.8) !important;
    transform: scale(1.05) !important;
    transition: none !important;
    z-index: 20 !important;
}

.btn-zone.double-click-fault-effect {
    background-color: var(--double-click-fault) !important;
    color: #fff !important;
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.8) !important;
    transform: scale(1.05) !important;
    transition: none !important;
    z-index: 20 !important;
}

/* 为不同按钮的行添加双击高亮效果 */
.counter-item.double-click-highlight {
    background-color: rgba(0, 255, 136, 0.2) !important;
    border: 1px solid rgba(0, 255, 136, 0.5) !important;
}

.counter-item.double-click-fault-highlight {
    background-color: rgba(255, 68, 68, 0.2) !important;
    border: 1px solid rgba(255, 68, 68, 0.5) !important;
}

/* 按键区域的双击动画 */
@keyframes button-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.btn-zone.double-click-pulse {
    animation: button-pulse 0.3s ease-in-out 2;
}

/* 新增一个闪光动画用于双击效果 */
@keyframes double-click-flash {
    0%, 100% {
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.8);
    }
    50% {
        box-shadow: 0 0 50px rgba(0, 255, 136, 1);
    }
}

@keyframes double-click-fault-flash {
    0%, 100% {
        box-shadow: 0 0 30px rgba(255, 68, 68, 0.8);
    }
    50% {
        box-shadow: 0 0 50px rgba(255, 68, 68, 1);
    }
}

.guide-content h2 { 
    color: var(--text-main); 
    font-size: 1.1rem; /* 减小字体 */
    margin-top: 20px; 
    margin-bottom: 10px;
}

.guide-content h3 { 
    color: var(--info-blue); 
    font-size: 1rem; /* 减小字体 */
    margin-top: 18px;
}

.guide-content p { 
    color: #888; 
    line-height: 1.6; 
    margin-bottom: 12px;
    font-size: 0.85rem; /* 稍微减小字体 */
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 800px;
    }
    
    .test-area-container {
        min-height: 380px;
        padding: 15px;
    }
    
    .stats-panel {
        min-height: auto;
        height: auto;
        padding: 15px;
    }
    
    .mouse-visual {
        width: 200px;
        height: 320px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }
    
    p {
        font-size: 0.8rem;
    }
    
    .dashboard {
        padding: 0 10px;
    }
    
    .test-area-container {
        padding: 15px;
        min-height: 350px;
    }
    
    .stats-panel {
        padding: 15px;
    }
    
    .mouse-visual {
        width: 180px;
        height: 300px;
    }
    
    .stat-header-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .reset-btn {
        align-self: flex-start;
    }
    
    .counter-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .log-container {
        height: 120px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.3rem;
    }
    
    .test-area-label {
        font-size: 0.7rem;
        padding: 3px 10px;
    }
    
    .counter-item {
        padding: 8px;
        min-height: 55px;
    }
    
    .counter-label {
        font-size: 0.7rem;
    }
    
    .counter-num {
        font-size: 0.9rem;
    }
}