/* BDSM 角色人格测试 v3.0 - 极简白底风格 */

/* ========== 基础变量 ========== */
:root {
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent-color: #6366f1;
    --accent-light: #e0e7ff;
    --border-color: #e5e5e5;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* ========== 特色卡片网格 ========== */

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ========== 页面容器 ========== */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ========== 首页 ========== */
.hero-section {
    text-align: center;
    padding: 60px 0 40px;
}

.logo-container {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

.logo-emoji {
    font-size: 80px;
    line-height: 1;
    display: block;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-style: italic;
    letter-spacing: 0.08em;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 40px 0;
}

.feature {
    background: #f8f8f8;
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
}

.feature-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

.feature-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 32px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    display: block;
    text-align: center;
    text-decoration: none;
}

.btn.primary {
    background: var(--text-primary);
    color: white;
}

.btn.primary:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn.secondary {
    background: #f0f0f0;
    color: var(--text-primary);
}

.btn.secondary:hover {
    background: #e5e5e5;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========== 首页双按钮布局 ========== */
.home-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.home-buttons .btn {
    margin: 0;
    width: 100%;
}

/* ========== 退出测试按钮 ========== */
/* (已合并到文件末尾) */

/* 焦点状态 - 可访问性 */
.btn:focus-visible,
.option:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* 选项卡式焦点 */
.option:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* ========== 提示文字 ========== */
.tips {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 20px;
}

.warning-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 16px;
}

/* ========== 测试页面 ========== */
/* (test-header 已合并到文件末尾) */

/* .progress-container 已合并 */

/* .progress-bar 已合并 */

/* .progress-fill 已合并 */

/* .progress-info 已合并 */

/* ========== 题目卡片 ========== */
/* (question-card 已合并到文件末尾) */

.question-number {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.q-icon {
    font-size: 1.2rem;
}

.q-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.question-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 30px;
}

/* ========== 选项 ========== */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    background: #f8f8f8;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.option:hover {
    background: #f0f0f0;
    border-color: #e0e0e0;
}

.option.selected {
    background: var(--accent-light);
    border-color: var(--accent-color);
}

.option-letter {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    flex-shrink: 0;
}

.option.selected .option-letter {
    background: var(--accent-color);
    color: white;
}

.option-text {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
}

/* ========== 导航按钮 ========== */
.nav-buttons {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    justify-content: center;
}

.nav-buttons .btn {
    flex: 1;
    max-width: none;
    width: auto;
}

/* ========== 结果页面 ========== */
.personality-card {
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    color: white;
    border-radius: var(--radius-xl);
    padding: 50px 30px;
    text-align: center;
    margin-bottom: 30px;
}

.card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.personality-emoji {
    font-size: 80px;
    line-height: 1;
}

.personality-badge {
    background: rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* MBTI风格显示 */
.mbti-style-result {
    margin: 20px 0 8px;
}

.personality-abbr {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: #fff;
    text-shadow: 0 0 40px rgba(255,255,255,0.5), 0 0 80px var(--accent-color);
    margin: 0;
    line-height: 1;
}

.personality-english {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.1em;
    margin: 8px 0 4px;
    opacity: 0.95;
}

.personality-chinese {
    font-size: 1rem;
    color: rgba(255,255,255,0.85);
    font-weight: 400;
}

.personality-tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    font-style: italic;
    margin-top: 12px;
}

/* 旧的样式保留兼容 */
.personality-type {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
}

/* ========== 分享卡片 ========== */
.share-card {
    background: #f8f8f8;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 30px;
    text-align: center;
}

.share-card-inner {
    border: 2px dashed #e0e0e0;
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 16px;
}

.share-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.share-icon {
    font-size: 1.2rem;
}

.share-emoji {
    font-size: 48px;
    margin-bottom: 8px;
}

.share-type {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.share-english {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.share-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.share-hashtag {
    font-size: 0.85rem;
    color: var(--accent-color);
}

.copy-btn {
    width: 100%;
    padding: 14px;
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

/* ========== 结果内容 ========== */
.result-content {
    margin-bottom: 30px;
}

.result-section {
    margin-bottom: 28px;
}

.result-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-intro {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 16px;
    color: var(--text-primary);
    background: #f8f8f8;
    padding: 16px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-color);
}

.result-psychology {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.result-scene {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-primary);
    background: #fff;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid #e0e0e0;
    font-style: italic;
}

.strengths-text, .growth-text, .partner-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* ========== 特质标签 ========== */
.traits-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.trait-tag {
    background: var(--accent-light);
    color: var(--accent-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ========== 偏好图表（bdsm-test.info 风格） ========== */
.dimension-section {
    margin-bottom: 24px;
}

.dimension-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.section-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.section-dot.positive {
    background: #22c55e;
}

.section-dot.negative {
    background: #f97316;
}

.dimension-item {
    background: #fafafa;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1px solid #f0f0f0;
}

.dimension-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.dimension-emoji {
    font-size: 1.2rem;
}

.dimension-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.dimension-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.dimension-badge.high {
    background: #dcfce7;
    color: #16a34a;
}

.dimension-badge.low {
    background: #ffedd5;
    color: #ea580c;
}

.dimension-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.dimension-bar {
    flex: 1;
    height: 10px;
    background: #e5e5e5;
    border-radius: 5px;
    overflow: hidden;
}

.dimension-bar.positive {
    background: linear-gradient(90deg, #dcfce7, #bbf7d0);
}

.dimension-bar.negative {
    background: linear-gradient(90deg, #ffedd5, #fed7aa);
}

.dimension-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

.dimension-bar.positive .dimension-bar-fill {
    background: #22c55e;
}

.dimension-bar.negative .dimension-bar-fill {
    background: #f97316;
}

.dimension-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}

.dimension-percentile {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.dimension-percentile strong {
    color: var(--text-secondary);
    font-weight: 600;
}


/* ========== 相关人格 ========== */
.related-types {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.related-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f0f0f0;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.related-chip:hover {
    background: #e0e0e0;
}

.chip-emoji {
    font-size: 1rem;
}

.chip-name {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ========== 结果操作 ========== */
.result-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
}

.result-actions .btn {
    flex: 1;
}

/* ========== 底部信息 ========== */
.footer-info {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid #e5e5e5;
    margin-top: 20px;
}

.footer-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-credit {
    margin-top: 8px;
    font-size: 0.8rem !important;
}

/* ========== 加载动画 ========== */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e5e5;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header {
    text-align: center;
    padding: 40px 30px 20px;
}

.modal-emoji {
    font-size: 60px;
    display: block;
    margin-bottom: 12px;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.modal-body {
    padding: 0 30px 30px;
}

.modal-tagline {
    font-size: 1rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-align: center;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* ========== 展开按钮 ========== */
.expand-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px 0;
    font-weight: 500;
}

/* ========== iOS 安全区域支持 ========== */
/* 兼容刘海屏设备 */
@supports (padding: env(safe-area-inset-bottom)) {
    :root {
        --safe-area-bottom: env(safe-area-inset-bottom);
        --safe-area-top: env(safe-area-inset-top);
    }
    
    body {
        /* 顶部安全区域 */
        padding-top: env(safe-area-inset-top);
    }
    
    .container {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    
    .test-header {
        padding-top: calc(16px + env(safe-area-inset-top));
    }
    
    .question-card {
        margin-top: calc(80px + env(safe-area-inset-top));
    }
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
    .container {
        padding: 30px 16px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .logo-emoji {
        font-size: 60px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .question-card {
        padding: 30px 20px;
        margin-top: 70px;
    }

    .question-card h2 {
        font-size: 1.2rem;
    }

    .option {
        padding: 16px;
    }

    .personality-card {
        padding: 40px 20px;
    }

    .personality-type {
        font-size: 2rem;
    }

    .personality-abbr {
        font-size: 3rem;
    }

    .personality-english {
        font-size: 1.1rem;
    }

    .personality-emoji {
        font-size: 60px;
    }

    .share-type {
        font-size: 1.6rem;
    }

    .share-english {
        font-size: 0.9rem;
    }

    .result-actions {
        flex-direction: column;
    }

    .nav-buttons {
        flex-direction: column;
    }

    .nav-buttons .btn {
        width: 100%;
    }
}

/* ========== 测试页面头部 ========== */
.test-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px 16px;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ========== 退出按钮 ========== */
.exit-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.2s;
    flex-shrink: 0;
}

.exit-btn:hover {
    background: #e5e5e5;
    color: var(--text-primary);
}

.exit-btn:active {
    transform: scale(0.95);
}

/* ========== 进度条容器 ========== */
.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ========== 问题卡片 ========== */
.question-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-top: 80px;
    box-shadow: var(--shadow-md);
}
