/* PDP性格测试 - 移动端优先样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #7B8FA8;
    --primary-light: #A8B8C8;
    --primary-dark: #5A6F85;
    --bg: #F5F6FA;
    --card-bg: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E8ECEF;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --radius: 16px;
    --radius-sm: 12px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.app {
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
}

/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: flex;
    flex-direction: column;
}

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

/* ===== 首页 ===== */
.page-home {
    padding: 16px;
    gap: 12px;
}

.home-header {
    text-align: center;
    padding: 24px 0 12px;
}

.logo-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.home-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-light);
}

.home-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.rules {
    text-align: left;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.rule-item:last-child {
    margin-bottom: 0;
}

.rule-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary-light);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* 测评维度 */
.type-icons {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.type-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.type-icon-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.type-icon-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.type-icon-sub {
    font-size: 11px;
    color: var(--text-light);
}

/* 注意事项 */
.notice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notice-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
}

.notice-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:active {
    background: #D5D9DD;
}

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

.btn-prev {
    background: #E8DDD4;
    color: var(--text);
}

.btn-next {
    background: var(--primary);
    color: white;
}

.btn-start {
    margin-top: 4px;
}

.home-footer {
    text-align: center;
    padding: 24px 0 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.home-footer a {
    color: #999;
    text-decoration: none;
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* ===== 测试页 ===== */
.page-test {
    padding: 16px;
    gap: 12px;
}

/* 统计卡片 */
.test-stats-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.test-stats-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.test-stats-left {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.test-stats-right {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.test-stats-bottom {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-light);
}

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

.test-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    flex: 1;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.question-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    width: fit-content;
}

.question-text {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    line-height: 1.4;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.option-btn:active {
    background: #F5F7FA;
}

.option-btn.selected {
    border-color: var(--primary);
    background: #F0F4F8;
}

.option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--border);
    color: var(--text-light);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.2s;
}

.option-btn.selected .option-label {
    background: var(--primary);
    color: white;
}

.option-text {
    font-size: 15px;
    color: var(--text);
}

.test-nav {
    display: flex;
    gap: 12px;
}

.test-nav .btn {
    flex: 1;
}

.test-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.hint-icon {
    font-size: 14px;
}

/* ===== 结果页 ===== */
.page-result {
    padding: 16px;
}

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

.result-icon {
    font-size: 72px;
    margin-bottom: 8px;
}

.result-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.result-subtitle {
    font-size: 14px;
    color: var(--text-light);
}

.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.type-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}

.type-name {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
}

.type-desc {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
}

/* 分数图表 */
.scores-chart {
    margin-bottom: 24px;
}

.score-item {
    margin-bottom: 12px;
}

.score-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 13px;
}

.score-name {
    font-weight: 600;
}

.score-value {
    color: var(--text-light);
}

.score-bar-bg {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}

/* 详细信息 */
.type-details {
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.detail-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-light);
}

.traits-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.trait-tag {
    padding: 6px 14px;
    background: #F0F4F8;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text);
}

/* 结果页操作按钮 */
.result-actions {
    display: flex;
    gap: 12px;
}

.result-actions .btn {
    flex: 1;
}

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 详解按钮 */
.detail-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    justify-content: center;
}

.detail-btn {
    padding: 10px 14px;
    background: var(--primary-light);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    flex: 1 1 calc(50% - 4px);
    min-width: 140px;
    box-sizing: border-box;
}

.detail-btn:active {
    transform: scale(0.96);
    opacity: 0.9;
}

/* 详解页 */
.page-detail {
    padding: 0;
    background: var(--bg);
}

.detail-header {
    padding: 16px 20px;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-back:active {
    background: rgba(255,255,255,0.3);
}

.detail-header h1 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.detail-content {
    padding: 16px;
}

.detail-block {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.detail-block h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.detail-text {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
}

.detail-text br {
    display: block;
    content: "";
    margin-bottom: 4px;
}

/* 响应式优化 */
@media (min-width: 481px) {
    .app {
        padding: 20px 0;
    }

    .page {
        min-height: auto;
    }
}
