/* BDSM人格测试 - 主样式文件 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* 防止水平滚动 */
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    body {
        padding: 12px;
    }
}

.page { 
    display: none; 
}

.page.active { 
    display: block; 
    animation: fadeIn 0.3s; 
}

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

.container { 
    max-width: 700px; 
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box; /* 确保padding计算在内 */
}

/* 欢迎页样式 */
.welcome-card {
    background: white;
    padding: 48px 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

@media (max-width: 640px) {
    .welcome-card {
        padding: 32px 24px;
        border-radius: 12px;
    }
}

.logo { 
    font-size: 64px; 
    margin-bottom: 16px; 
}

@media (max-width: 640px) {
    .logo {
        font-size: 48px;
        margin-bottom: 12px;
    }
}

.welcome-card h1 {
    font-size: 32px;
    margin-bottom: 8px;
    color: #1f2937;
}

@media (max-width: 640px) {
    .welcome-card h1 {
        font-size: 24px;
        margin-bottom: 6px;
    }
}

.subtitle {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 8px;
}

@media (max-width: 640px) {
    .subtitle {
        font-size: 16px;
        margin-bottom: 6px;
    }
}

.author {
    font-size: 14px;
    color: #9ca3af;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .author {
        font-size: 13px;
        margin-bottom: 16px;
    }
}

.description {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 32px;
    font-size: 15px;
}

@media (max-width: 640px) {
    .description {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 24px;
    }
}

.disclaimer {
    background: #fef3c7;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 32px;
}

@media (max-width: 640px) {
    .disclaimer {
        padding: 10px;
        font-size: 12px;
        margin-bottom: 24px;
        border-radius: 6px;
    }
}

.btn-start {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
    .btn-start {
        padding: 14px;
        font-size: 16px;
        border-radius: 10px;
    }
}

.btn-start:hover {
    background: #4f46e5;
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    .btn-start:active {
        transform: scale(0.98);
    }
    
    .btn-start:hover {
        transform: none;
    }
}

/* 测试信息区域 */
.test-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
    margin: 32px 0;
    padding: 24px 0;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .test-info {
        gap: 24px;
        margin: 24px 0;
        padding: 20px 0;
    }
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

@media (max-width: 640px) {
    .info-item {
        min-width: 80px;
        gap: 6px;
    }
}

.info-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

@media (max-width: 640px) {
    .info-label {
        font-size: 12px;
    }
}

.info-value {
    font-size: 18px;
    color: #1f2937;
    font-weight: 600;
}

@media (max-width: 640px) {
    .info-value {
        font-size: 16px;
    }
}

/* 返回链接区域 */
.back-link {
    margin-top: 24px;
    text-align: center;
}

@media (max-width: 640px) {
    .back-link {
        margin-top: 20px;
    }
}

.back-link a {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.back-link a:hover {
    color: #6366f1;
}

@media (max-width: 640px) {
    .back-link a {
        font-size: 13px;
    }
}

/* 测评页面样式 */
#assessmentPage {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #ec4899 100%);
    min-height: 100vh;
    padding: 20px 16px;
}

@media (max-width: 640px) {
    #assessmentPage {
        padding: 16px 12px;
    }
}

#assessmentPage .container {
    max-width: 700px;
}

/* 测评标题和统计信息 */
.assessment-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

@media (max-width: 640px) {
    .assessment-header {
        margin-bottom: 32px;
    }
}

.assessment-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    color: white;
}

@media (max-width: 640px) {
    .assessment-title {
        font-size: 24px;
        margin-bottom: 12px;
    }
}

.test-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .test-stats {
        font-size: 13px;
        gap: 8px;
    }
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-icon {
    font-size: 16px;
}

@media (max-width: 640px) {
    .stat-icon {
        font-size: 14px;
    }
}

.dot {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

/* 进度显示 */
.progress-display {
    text-align: center;
    margin-bottom: 30px;
}

@media (max-width: 640px) {
    .progress-display {
        margin-bottom: 24px;
    }
}

.progress-percentage-large {
    font-size: 72px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

@media (max-width: 640px) {
    .progress-percentage-large {
        font-size: 56px;
    }
}

/* 进度条容器 */
.progress-bar-container {
    margin-bottom: 30px;
}

@media (max-width: 640px) {
    .progress-bar-container {
        margin-bottom: 24px;
    }
}

.progress-bar-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

@media (max-width: 640px) {
    .progress-bar-track {
        height: 6px;
        border-radius: 8px;
    }
}

.progress-bar-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@media (max-width: 640px) {
    .progress-bar-fill {
        border-radius: 8px;
    }
}

.progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.5);
}

/* 题目卡片 - 滑动条样式 */
.questions-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (max-width: 640px) {
    .questions-container {
        gap: 12px;
    }
}

.question-card {
    background: white;
    padding: 28px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@media (max-width: 640px) {
    .question-card {
        padding: 20px 16px;
        border-radius: 12px;
    }
}

.q-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

@media (max-width: 640px) {
    .q-header {
        gap: 10px;
        margin-bottom: 14px;
    }
}

.q-num {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .q-num {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
}

.q-text {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.6;
    color: #1f2937;
    flex: 1;
}

@media (max-width: 640px) {
    .q-text {
        font-size: 15px;
        line-height: 1.5;
    }
}

/* 滑动条样式 */
.slider-container {
    margin-top: 20px;
    padding: 0 4px;
}

@media (max-width: 640px) {
    .slider-container {
        margin-top: 16px;
        padding: 0 2px;
    }
}

.slider-wrapper {
    position: relative;
    height: 50px;
    margin-bottom: 8px;
}

@media (max-width: 640px) {
    .slider-wrapper {
        height: 44px;
        margin-bottom: 6px;
    }
}

.slider-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 20px;
    background: transparent;
    border-radius: 12px;
    display: flex;
    gap: 2px;
}

.slider-grid {
    flex: 1;
    height: 100%;
    background: #e5e7eb;
    border-radius: 3px;
    transition: background 0.3s ease;
}

.slider-grid.active-1 { background: #7dd3fc; }
.slider-grid.active-2 { background: #38bdf8; }
.slider-grid.active-3 { background: #0ea5e9; }
.slider-grid.active-4 { background: #8b5cf6; }
.slider-grid.active-5 { background: #a78bfa; }

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 16px;
    background: transparent;
    outline: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    z-index: 2;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a78bfa, #c4b5fd);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.5);
    transition: all 0.2s;
}

@media (max-width: 640px) {
    .slider::-webkit-slider-thumb {
        width: 36px;
        height: 36px;
    }
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(167, 139, 250, 0.6);
}

@media (max-width: 640px) {
    .slider::-webkit-slider-thumb:active {
        transform: scale(1.2);
    }
    
    .slider::-webkit-slider-thumb:hover {
        transform: none;
    }
}

.slider::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a78bfa, #c4b5fd);
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.5);
    transition: all 0.2s;
}

@media (max-width: 640px) {
    .slider::-moz-range-thumb {
        width: 36px;
        height: 36px;
    }
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(167, 139, 250, 0.6);
}

@media (max-width: 640px) {
    .slider::-moz-range-thumb:active {
        transform: scale(1.2);
    }
    
    .slider::-moz-range-thumb:hover {
        transform: none;
    }
}

.slider-inactive::-webkit-slider-thumb {
    background: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.slider-inactive::-moz-range-thumb {
    background: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

@media (max-width: 640px) {
    .slider-labels {
        margin-top: 10px;
    }
}

.slider-label {
    font-size: 12px;
    color: #9ca3af;
}

@media (max-width: 640px) {
    .slider-label {
        font-size: 11px;
    }
}

.slider-label.active {
    color: #6366f1;
    font-weight: 600;
}

/* 导航按钮 */
.nav-btns {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding: 0 4px;
}

@media (max-width: 640px) {
    .nav-btns {
        margin-top: 24px;
        gap: 8px;
    }
}

.btn-nav {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

@media (max-width: 640px) {
    .btn-nav {
        padding: 12px 16px;
        font-size: 14px;
    }
}

.btn-nav:not(:disabled):hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

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

/* 隐藏下一题和提交按钮（因为自动跳转） */
#nextBtn,
#submitBtn {
    display: none !important;
}

/* 结果页样式 */
.result-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 100%;
    box-sizing: border-box; /* 确保padding计算在内 */
    overflow-x: hidden; /* 防止水平溢出 */
}

@media (max-width: 640px) {
    .result-card {
        padding: 24px 16px;
        border-radius: 12px;
    }
}

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

@media (max-width: 640px) {
    .result-header {
        margin-bottom: 24px;
    }
}

.result-header h2 {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 8px;
}


@media (max-width: 640px) {
    .result-header h2 {
        font-size: 22px;
        margin-bottom: 6px;
    }
}

/* 主人格分布 */
.main-personality {
    margin-bottom: 32px;
}

@media (max-width: 640px) {
    .main-personality {
        margin-bottom: 24px;
    }
}

.main-personality h3 {
    font-size: 20px;
    margin-bottom: 16px;
    color: #1f2937;
}

@media (max-width: 640px) {
    .main-personality h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }
}

/* 雷达图 */
#radarChart {
    max-width: 400px;
    margin: 0 auto 32px;
    display: block;
}

@media (max-width: 640px) {
    #radarChart {
        max-width: 100%;
        margin: 0 auto 24px;
    }
}

/* 详细性格 */
.characters-section, .plays-section {
    margin-bottom: 32px;
}

@media (max-width: 640px) {
    .characters-section, .plays-section {
        margin-bottom: 24px;
    }
}

.section-title {
    font-size: 20px;
    margin-bottom: 16px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Elk 测试的 section-title 稍大一些 */
.dimension-section .section-title {
    font-size: 22px;
    margin-bottom: 8px;
}

.section-icon {
    font-size: 24px;
}

.dimension-section .section-icon {
    font-size: 28px;
}

@media (max-width: 640px) {
    .section-title {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .dimension-section .section-title {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .section-icon {
        font-size: 20px;
    }
    
    .dimension-section .section-icon {
        font-size: 24px;
    }
}

.section-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

/* Elk 测试的 section-subtitle */
.dimension-section .section-subtitle {
    margin-bottom: 12px;
}

@media (max-width: 640px) {
    .dimension-section .section-subtitle {
        font-size: 12px;
        margin-bottom: 10px;
    }
}

@media (max-width: 640px) {
    .section-subtitle {
        font-size: 12px;
        margin-bottom: 12px;
    }
}

/* 前三名展示 */
.top-three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .top-three {
        gap: 12px;
        margin-bottom: 20px;
    }
}

.top-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.top-item:hover {
    transform: translateY(-4px);
}

@media (max-width: 640px) {
    .top-item:active {
        transform: scale(0.95);
    }
    
    .top-item:hover {
        transform: none;
    }
}

.top-icon-circle {
    width: 100px;
    height: 100px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0f2fe 0%, #ddd6fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
    border: 3px solid #60a5fa;
}

@media (max-width: 640px) {
    .top-icon-circle {
        width: 80px;
        height: 80px;
        font-size: 36px;
        border-width: 2px;
        margin-bottom: 8px;
    }
}

.top-item:nth-child(2) .top-icon-circle {
    border-color: #a78bfa;
}

.top-item:nth-child(3) .top-icon-circle {
    border-color: #c4b5fd;
}

.top-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

@media (max-width: 640px) {
    .top-name {
        font-size: 13px;
        margin-bottom: 3px;
    }
}

.top-score {
    font-size: 20px;
    font-weight: 700;
    color: #6366f1;
}

@media (max-width: 640px) {
    .top-score {
        font-size: 18px;
    }
}

/* 展开/收起按钮 */
.expand-btn {
    width: 100%;
    padding: 12px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s;
    margin-bottom: 16px;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
    .expand-btn {
        padding: 10px;
        font-size: 13px;
        gap: 6px;
        margin-bottom: 12px;
    }
}

.expand-btn:hover {
    background: #f3f4f6;
    border-color: #6366f1;
    color: #6366f1;
}

@media (max-width: 640px) {
    .expand-btn:active {
        background: #f3f4f6;
        border-color: #6366f1;
        color: #6366f1;
        transform: scale(0.98);
    }
    
    .expand-btn:hover {
        background: #f9fafb;
        border-color: #e5e7eb;
        color: #6b7280;
    }
}

.expand-icon {
    transition: transform 0.3s;
}

.expand-icon.expanded {
    transform: rotate(180deg);
}

/* 条形图列表 - 紧凑样式 */
.items-grid {
    display: none;
    flex-direction: column;
    gap: 0;
    margin-bottom: 16px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 640px) {
    .items-grid {
        margin-bottom: 12px;
        border-radius: 6px;
    }
}

.items-grid.show {
    display: flex;
}

.item-card {
    background: white;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 12px;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
    .item-card {
        padding: 10px 12px;
        gap: 10px;
    }
}

.item-card:last-child {
    border-bottom: none;
}

.item-card:hover {
    background: #f9fafb;
}

@media (max-width: 640px) {
    .item-card:active {
        background: #f9fafb;
    }
    
    .item-card:hover {
        background: white;
    }
}

.item-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

@media (max-width: 640px) {
    .item-icon {
        font-size: 16px;
        width: 20px;
    }
}

.item-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 13px;
    min-width: 80px;
}

@media (max-width: 640px) {
    .item-name {
        font-size: 12px;
        min-width: 70px;
    }
}

.item-bar-container {
    flex: 1;
    height: 20px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

@media (max-width: 640px) {
    .item-bar-container {
        height: 18px;
        border-radius: 3px;
    }
}

.item-bar {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa 0%, #a78bfa 100%);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.item-score {
    font-size: 13px;
    font-weight: 600;
    color: #6366f1;
    min-width: 40px;
    text-align: right;
}

@media (max-width: 640px) {
    .item-score {
        font-size: 12px;
        min-width: 35px;
    }
}

/* 按钮组 */
.action-btns {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

@media (max-width: 640px) {
    .action-btns {
        flex-direction: column;
        gap: 10px;
        margin-top: 24px;
    }
}

.btn-action {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
    .btn-action {
        padding: 14px;
        font-size: 15px;
        border-radius: 10px;
        width: 100%;
    }
}

.btn-action.primary {
    background: #6366f1;
    color: white;
}

.btn-action.secondary {
    background: #f3f4f6;
    color: #1f2937;
}

.btn-action:hover {
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    .btn-action:active {
        transform: scale(0.98);
    }
    
    .btn-action:hover {
        transform: none;
    }
}

/* 说明弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

@media (max-width: 640px) {
    .modal {
        padding: 16px;
        align-items: flex-end;
    }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    .modal-content {
        padding: 24px 20px;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        animation: slideUp 0.3s ease-out;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
}

@media (max-width: 640px) {
    .modal-title {
        font-size: 18px;
        margin-bottom: 12px;
    }
}

.modal-text {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 24px;
    font-size: 15px;
}

@media (max-width: 640px) {
    .modal-text {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 20px;
    }
}

.modal-close {
    width: 100%;
    padding: 12px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
    .modal-close {
        padding: 14px;
        font-size: 16px;
        border-radius: 10px;
    }
    
    .modal-close:active {
        transform: scale(0.98);
    }
}

/* 二维码区域 */
.qrcode-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid #f3f4f6;
    text-align: center;
}

@media (max-width: 640px) {
    .qrcode-section {
        margin-top: 32px;
        padding-top: 24px;
    }
    
    .qrcode-section img {
        max-width: 160px !important;
        margin-bottom: 8px !important;
    }
    
    .qrcode-section p {
        font-size: 13px !important;
    }
}

/* ========== Elk 测试特有样式 ========== */

/* 结果页标题（Elk 使用渐变文字） */
body.elk-test #resultPage .result-header h2 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 32px;
}

@media (max-width: 640px) {
    body.elk-test #resultPage .result-header h2 {
        font-size: 24px;
    }
}

/* 雷达图区域（Elk 大尺寸雷达图） */
.radar-section {
    margin-bottom: 50px;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.05), rgba(142, 68, 173, 0.05));
    border-radius: 20px;
    padding: 30px;
}

.radar-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: auto;
}

.radar-section #radarChart {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .radar-section {
        padding: 20px 15px;
        margin-bottom: 40px;
    }
    
    .radar-container {
        padding: 15px;
    }
    
    .radar-section #radarChart {
        width: 100% !important;
        height: auto !important;
    }
}

/* 维度区域（Elk 测试） */
.dimension-section {
    margin-bottom: 28px;
}

@media (max-width: 640px) {
    .dimension-section {
        margin-bottom: 24px;
    }
}

/* 维度网格（Elk 2列布局） */
.dimension-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .dimension-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* 维度项包装器 */
.dimension-item-wrapper {
    margin-bottom: 0;
    min-width: 0; /* 允许收缩 */
    width: 100%;
    box-sizing: border-box;
}

.dimension-item-wrapper.expanded {
    margin-bottom: 0;
    grid-column: 1 / -1; /* 展开时跨越所有列 */
}

/* 维度项 */
.dimension-item {
    background: #f9fafb;
    padding: 12px 14px;
    border-radius: 10px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
    min-width: 0; /* 允许内容收缩 */
    overflow: hidden; /* 防止内容溢出 */
    width: 100%;
    box-sizing: border-box;
}

.dimension-item:hover {
    background: #f3f4f6;
    border-color: #9b59b6;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.1);
}

/* 展开/折叠按钮 */
.dim-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.3s;
}

.toggle-icon {
    transition: transform 0.3s ease;
    color: #9b59b6;
    width: 16px;
    height: 16px;
}

.dimension-item-wrapper.expanded .toggle-icon {
    transform: rotate(180deg);
}

.dim-toggle {
    flex-shrink: 0; /* 防止按钮被压缩 */
}

/* 维度说明文字（展开/折叠） */
.dim-explain {
    background: #ffffff;
    padding: 0;
    margin-top: 0;
    border-radius: 0 0 10px 10px;
    border-left: 3px solid #9b59b6;
    color: #555;
    font-size: 13px;
    line-height: 1.6;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
}

.dim-explain.collapsed {
    max-height: 0;
    padding: 0 16px;
    margin-top: 0;
    opacity: 0;
}

.dim-explain.expanded {
    max-height: 500px;
    padding: 12px 16px;
    margin-top: 8px;
    opacity: 1;
    border-top: 1px solid #e5e7eb;
}

/* 维度图标 */
.dim-icon {
    font-size: 28px;
    flex-shrink: 0; /* 防止图标被压缩 */
    line-height: 1;
}

/* 维度信息 */
.dim-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* 允许收缩 */
    flex: 1; /* 占据可用空间 */
    overflow: hidden; /* 防止溢出 */
}

/* 维度名称 */
.dim-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* 允许收缩 */
}

/* 维度等级标签 */
.dim-level {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
    flex-shrink: 0; /* 防止标签被压缩 */
    white-space: nowrap;
}

.dim-level.level-极高,
.dim-level.level-高 {
    background: #fecaca;
    color: #991b1b;
}

.dim-level.level-中 {
    background: #fef3c7;
    color: #92400e;
}

.dim-level.level-低,
.dim-level.level-极低 {
    background: #dbeafe;
    color: #1e40af;
}

/* 维度进度条容器 */
.dim-bar-container {
    flex: 1;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    min-width: 60px; /* 减少最小宽度 */
    max-width: 150px; /* 限制最大宽度 */
}

/* 维度进度条 */
.dim-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 12px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 维度值 */
.dim-value {
    font-size: 15px;
    font-weight: 700;
    color: #667eea;
    min-width: 45px;
    text-align: right;
    flex-shrink: 0; /* 防止收缩 */
}

/* 无数据提示 */
.no-data {
    text-align: center;
    color: #9ca3af;
    padding: 20px;
    font-size: 14px;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .dimension-item {
        padding: 10px 12px;
        border-radius: 8px;
        gap: 6px;
        grid-template-columns: auto 1fr auto auto;
    }
    
    .dim-explain.expanded {
        padding: 10px 12px;
        font-size: 12px;
        margin-top: 6px;
    }
    
    .dim-icon {
        font-size: 24px;
        flex-shrink: 0;
    }
    
    .dim-info {
        min-width: 0;
        gap: 3px;
        flex: 1;
    }
    
    .dim-name {
        font-size: 14px;
    }
    
    .dim-level {
        font-size: 11px;
        padding: 2px 6px;
        flex-shrink: 0;
    }
    
    .dim-bar-container {
        height: 20px;
        border-radius: 10px;
        min-width: 50px;
        max-width: 120px;
    }
    
    .dim-value {
        font-size: 13px;
        min-width: 40px;
    }
    
    .dim-toggle {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    .toggle-icon {
        width: 14px;
        height: 14px;
    }
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* 图片弹窗样式 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.image-modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.image-modal-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
    text-align: center;
}

.image-modal-content img {
    max-width: 100%;
    max-height: calc(90vh - 120px);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: default; /* 允许长按保存 */
}

.image-modal-close {
    margin-top: 20px;
    padding: 12px 32px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    width: auto;
    min-width: 120px;
}

.image-modal-close:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

.image-modal-close:active {
    transform: scale(0.98);
}

.image-modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #6b7280;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.image-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    color: #1f2937;
}

.image-modal-close-btn:active {
    transform: scale(0.9);
}

@media (max-width: 640px) {
    .image-modal {
        padding: 10px;
    }
    
    .image-modal-content {
        padding: 20px 16px;
        max-width: 95%;
        border-radius: 12px;
    }
    
    .image-modal-content h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .image-modal-content img {
        max-height: calc(90vh - 100px);
    }
    
    .image-modal-close {
        margin-top: 16px;
        padding: 14px 24px;
        font-size: 16px;
        width: 100%;
    }
    
    .image-modal-close-btn {
        width: 32px;
        height: 32px;
        top: 8px;
        right: 8px;
        font-size: 18px;
    }
}

/* 分析与建议样式 */
.analysis-section {
    margin-top: 40px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
}

.analysis-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analysis-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.analysis-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.analysis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.analysis-header:hover {
    background-color: #f3f4f6;
}

.analysis-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

.analysis-score {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 16px;
}

.score-value {
    font-size: 18px;
    font-weight: 700;
    color: #6366f1;
}

.score-unit {
    font-size: 12px;
    color: #6b7280;
}

.score-level {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.score-level.level-高 {
    background-color: #fee2e2;
    color: #991b1b;
}

.score-level.level-中 {
    background-color: #fef3c7;
    color: #92400e;
}

.score-level.level-低 {
    background-color: #dbeafe;
    color: #0c2d6b;
}

.analysis-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.toggle-icon {
    transition: transform 0.3s ease;
    color: #6b7280;
}

.analysis-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border-top: 1px solid #e5e7eb;
}

.analysis-content.expanded {
    max-height: 500px;
}

.analysis-text {
    padding: 16px;
    color: #374151;
    line-height: 1.6;
}

.analysis-main {
    margin: 0 0 12px 0;
    font-size: 14px;
}

.analysis-advice {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    padding-left: 12px;
    border-left: 3px solid #6366f1;
}
