/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-y: auto; /* 仅在需要时显示滚动条 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #F5F2ED;
    color: #1A1818;
    min-height: 100vh;
    height: 100vh; /* 限制高度为视口高度 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 70px; /* 为导航栏留出空间 */
    overflow: hidden; /* 隐藏body的溢出 */
}

/* 顶部导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    height: 70px;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.navbar-brand:hover {
    opacity: 0.8;
}

.navbar-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.navbar-title {
    font-size: 20px;
    font-weight: 700;
    color: #CC785C;
    letter-spacing: -0.5px;
}


/* 页面容器 */
.page {
    display: none;
    width: 100%;
    height: calc(100vh - 70px); /* 减去导航栏高度 */
    animation: fadeIn 0.15s ease;
    overflow-y: auto; /* 页面内容在需要时可滚动 */
}

.page.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.container {
    max-width: 800px;
    padding: 40px 20px;
    width: 100%;
}

/* 标题 */
.title {
    font-size: 48px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: #1A1818;
}

.subtitle {
    font-size: 18px;
    text-align: center;
    color: #6B5D54;
    margin-bottom: 48px;
}

.page-title {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 40px;
    color: #1A1818;
}

/* 按钮样式 */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.btn:active {
    transform: translateY(0);
    transition: all 0.05s ease;
}

.btn-primary {
    background: #CC785C;
    color: white;
}

.btn-primary:hover {
    background: #B5674D;
}

.btn-secondary {
    background: white;
    color: #CC785C;
    border: 2px solid #CC785C;
}

.btn-secondary:hover {
    background: #FBF8F3;
}

.btn-large {
    padding: 24px 40px;
    font-size: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 280px;
}

.btn-subtitle {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.9;
}

.button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn-icon {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #1A1818;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* 测试类型卡片 */
.test-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.test-type-card {
    background: white;
    border: none;
    border-radius: 16px;
    padding: 32px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.test-type-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(204, 120, 92, 0.2);
    border: 2px solid #CC785C;
    padding: 30px 18px;
}

.test-type-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.test-type-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1A1818;
}

.test-type-desc {
    font-size: 14px;
    color: #6B5D54;
}

/* 测试页面 */
.test-header {
    position: fixed;
    top: 70px; /* 在导航栏下方 */
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.progress-info {
    font-size: 16px;
    font-weight: 600;
    color: #6B5D54;
}

.test-content {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* 视觉反应测试 */
.visual-test {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.visual-test.waiting {
    background: #86868b;
}

.visual-test.ready {
    background: #34c759;
}

.visual-test.too-early {
    background: #ff9500;
}

.visual-message {
    font-size: 32px;
    font-weight: 600;
    color: white;
    text-align: center;
    user-select: none;
}

/* 选择题测试（数字/字母识别、颜色匹配、Stroop） */
.choice-test {
    text-align: center;
    padding: 40px;
}

.test-prompt {
    font-size: 80px;
    font-weight: 700;
    margin-bottom: 60px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.choice-btn {
    padding: 40px 20px;
    font-size: 24px;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    background: white;
    color: #1A1818;
}

.choice-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.choice-btn:active {
    transform: scale(0.98);
    transition: all 0.05s ease;
}

.choice-btn.correct {
    background: #34c759;
    color: white;
}

.choice-btn.incorrect {
    background: #ff3b30;
    color: white;
}

/* 颜色按钮 */
.color-btn {
    height: 120px;
}

.color-btn.red { background: #ff3b30; }
.color-btn.blue { background: #007aff; }
.color-btn.green { background: #34c759; }
.color-btn.yellow { background: #ffcc00; }
.color-btn.purple { background: #af52de; }
.color-btn.orange { background: #ff9500; }

.color-btn:hover {
    opacity: 0.8;
}

/* 方向测试 */
.direction-test {
    text-align: center;
}

.direction-arrow {
    font-size: 120px;
    margin-bottom: 40px;
}

.direction-hint {
    font-size: 18px;
    color: #6B5D54;
    margin-bottom: 40px;
}

.direction-grid {
    display: grid;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.direction-btn {
    width: 100px;
    height: 100px;
    font-size: 48px;
    border: none;
    border-radius: 16px;
    background: white;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

.direction-btn:hover {
    transform: scale(1.1);
    background: #CC785C;
}

.direction-btn.up { grid-area: up; }
.direction-btn.down { grid-area: down; }
.direction-btn.left { grid-area: left; }
.direction-btn.right { grid-area: right; }

/* 视觉搜索测试 */
.search-test {
    text-align: center;
}

.search-instruction {
    font-size: 24px;
    margin-bottom: 40px;
}

.search-target {
    font-size: 48px;
    font-weight: 700;
    color: #CC785C;
    margin-bottom: 20px;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 500px;
    margin: 0 auto;
}

.search-item {
    aspect-ratio: 1;
    font-size: 36px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

.search-item:hover {
    transform: scale(1.05);
    background: #FBF8F3;
}

.search-item.target-found {
    background: #34c759;
    color: white;
}

/* 节奏/时序反应测试 */
.timing-test {
    text-align: center;
    padding: 40px 20px;
}

.timing-instruction {
    font-size: 20px;
    color: #6B5D54;
    margin-bottom: 60px;
}

.timing-track-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 200px;
    margin: 0 auto 40px;
    background: #FBF8F3;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.08);
}

.timing-track {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 4px;
    background: #CC785C;
    opacity: 0.3;
}

.timing-target {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #CC785C;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(204, 120, 92, 0.4);
    transition: all 0.1s ease;
}

.timing-target.clicked {
    background: #34c759;
    transform: translate(-50%, -50%) scale(1.3);
}

.timing-target-line {
    position: absolute;
    right: 100px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #34c759;
    box-shadow: 0 0 20px rgba(52, 199, 89, 0.5);
}

.timing-target-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid #34c759;
    border-radius: 50%;
    background: transparent;
}

.timing-hint {
    font-size: 16px;
    color: #6B5D54;
    margin-bottom: 20px;
}

.timing-feedback {
    font-size: 24px;
    font-weight: 700;
    min-height: 40px;
    margin-top: 20px;
}

.timing-feedback.perfect {
    color: #34c759;
}

.timing-feedback.good {
    color: #CC785C;
}

.timing-feedback.miss {
    color: #ff3b30;
}

.timing-action-btn {
    padding: 20px 60px;
    font-size: 20px;
    font-weight: 700;
    border: none;
    border-radius: 16px;
    background: #CC785C;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(204, 120, 92, 0.3);
    transition: all 0.1s ease;
}

.timing-action-btn:hover {
    background: #B5674D;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(204, 120, 92, 0.4);
}

.timing-action-btn:active {
    transform: translateY(0);
}

.timing-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 结果页面 */
.result-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.result-header {
    text-align: center;
    margin-bottom: 40px;
}

.result-type {
    font-size: 18px;
    color: #6B5D54;
    margin-bottom: 8px;
}

.result-time {
    font-size: 64px;
    font-weight: 700;
    color: #CC785C;
    margin-bottom: 16px;
}

.result-rating {
    font-size: 32px;
    margin-bottom: 16px;
}

.result-text {
    font-size: 20px;
    color: #1A1818;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: #FBF8F3;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: #6B5D54;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #CC785C;
}

.stat-unit {
    font-size: 16px;
    color: #6B5D54;
}

.result-grade {
    text-align: center;
    margin-bottom: 30px;
}

.grade-badge {
    display: inline-block;
    font-size: 72px;
    font-weight: 700;
    padding: 20px 40px;
    border-radius: 20px;
    background: linear-gradient(135deg, #CC785C 0%, #A85E47 100%);
    color: white;
    box-shadow: 0 8px 32px rgba(204, 120, 92, 0.3);
}

.grade-badge.s { background: linear-gradient(135deg, #D4976C 0%, #CC785C 100%); }
.grade-badge.a { background: linear-gradient(135deg, #C8916B 0%, #B5674D 100%); }
.grade-badge.b { background: linear-gradient(135deg, #B87A5A 0%, #9E5D42 100%); }
.grade-badge.c { background: linear-gradient(135deg, #A8725B 0%, #8B5642 100%); }
.grade-badge.d { background: linear-gradient(135deg, #8B6854 0%, #6B5D54 100%); }

.detail-list {
    margin-top: 30px;
}

.detail-item {
    padding: 16px;
    background: #FBF8F3;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-test-name {
    font-weight: 600;
    color: #1A1818;
}

.detail-result {
    color: #6B5D54;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
        height: 100vh;
    }

    .page {
        height: calc(100vh - 60px);
    }

    .navbar {
        height: 60px;
    }

    .navbar-logo {
        width: 32px;
        height: 32px;
    }

    .navbar-title {
        font-size: 18px;
    }

    .test-header {
        top: 60px;
    }

    .title {
        font-size: 36px;
    }

    .btn-large {
        min-width: 100%;
    }

    .test-type-grid {
        grid-template-columns: 1fr;
    }

    .test-prompt {
        font-size: 60px;
    }

    .choice-grid {
        grid-template-columns: 1fr;
    }

    .result-time {
        font-size: 48px;
    }

    .grade-badge {
        font-size: 56px;
    }
}

/* 工具类 */
.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}
