/* ============================================================================
   MBTI 人格测试 H5 - 全站样式
   ============================================================================ */

/* CSS 变量定义 */
:root {
    /* 主色调 */
    --primary-blue: #3B82C4;
    --primary-blue-light: #5BA3D9;
    --primary-blue-dark: #2A6A9F;
    
    /* 背景色 */
    --bg-main: #E9F0F4;
    --bg-card: #FFFFFF;
    --bg-card-shadow: rgba(0, 0, 0, 0.08);
    
    /* 按钮颜色 */
    --btn-28: #F5F0E1;
    --btn-48: #A8B4D4;
    --btn-93: #F6D365;
    --btn-orange: #F5A623;
    
    /* 文字颜色 */
    --text-dark: #333333;
    --text-gray: #666666;
    --text-light: #999999;
    --text-white: #FFFFFF;
    
    /* 间距 */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* 字体 */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================================================
   App 容器
   ============================================================================ */

.app-container {
    max-width: 414px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ============================================================================
   导航栏
   ============================================================================ */

.nav-bar {
    height: 50px;
    padding: 8px 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-main);
}

.nav-left {
    width: 60px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-dark);
}

.nav-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
}

.nav-right {
    width: 60px;
}

/* ============================================================================
   MBTI 横幅插画
   ============================================================================ */

.mbti-banner {
    width: 100%;
    height: 100px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mbti-banner img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.banner-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-placeholder svg {
    width: 100%;
    height: 100%;
}

/* ============================================================================
   主内容区
   ============================================================================ */

.main-content {
    flex: 1;
    padding: 0 16px 100px;
    overflow-y: auto;
}

/* ============================================================================
   橙色提示条
   ============================================================================ */

.tip-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--btn-orange);
    color: var(--text-white);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(245, 166, 35, 0.3);
}

.tip-banner.hidden {
    display: none;
}

.tip-text {
    font-size: 14px;
}

.tip-close {
    font-size: 20px;
    color: var(--text-white);
    opacity: 0.9;
    line-height: 1;
}

.tip-close:hover {
    opacity: 1;
}

/* ============================================================================
   模块标题
   ============================================================================ */

.section-title {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.title-bar {
    width: 4px;
    height: 20px;
    background-color: var(--primary-blue);
    border-radius: 2px;
    margin-right: var(--spacing-sm);
}

.title-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-blue);
}

/* ============================================================================
   内容卡片
   ============================================================================ */

.content-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 2px 12px var(--bg-card-shadow);
}

/* 首页说明卡片 */
.intro-card {
    padding: var(--spacing-lg);
}

.intro-card p {
    color: var(--text-gray);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: var(--spacing-md);
    text-align: justify;
}

.intro-card p:last-child {
    margin-bottom: 0;
}

/* ============================================================================
   版本选择按钮
   ============================================================================ */

.version-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.version-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.version-btn:active {
    transform: scale(0.98);
}

.version-28 {
    background-color: var(--btn-28);
}

.version-48 {
    background-color: var(--btn-48);
}

.version-93 {
    background-color: var(--btn-93);
}

/* ============================================================================
   小提示栏
   ============================================================================ */

.hint-bar {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.hint-icon {
    color: var(--primary-blue);
    margin-right: var(--spacing-sm);
    display: flex;
    align-items: center;
}

.hint-label {
    color: var(--primary-blue);
    font-size: 14px;
    font-weight: 500;
    margin-right: var(--spacing-xs);
}

.hint-text {
    color: var(--text-light);
    font-size: 14px;
}

/* ============================================================================
   答题页面
   ============================================================================ */

/* 进度条 */
.progress-section {
    margin-bottom: var(--spacing-md);
}

.progress-text {
    text-align: center;
    color: var(--text-gray);
    font-size: 14px;
    margin-bottom: var(--spacing-xs);
}

.progress-text span {
    color: var(--primary-blue);
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-blue-light));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 答题卡片 */
.test-card {
    min-height: 300px;
}

.question-text {
    font-size: 16px;
    color: var(--text-dark);
    line-height: 1.8;
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.option-btn {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background-color: #F5F7FA;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-dark);
    text-align: left;
    transition: all 0.2s;
    cursor: pointer;
    border: 2px solid transparent;
}

.option-btn:hover {
    background-color: #EBF0F5;
}

.option-btn.selected {
    background-color: rgba(59, 130, 196, 0.1);
    border-color: var(--primary-blue);
}

.option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background-color: var(--primary-blue);
    color: var(--text-white);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    margin-right: var(--spacing-sm);
    flex-shrink: 0;
}

.option-btn.selected .option-label {
    background-color: var(--primary-blue);
}

.option-text {
    flex: 1;
    line-height: 1.5;
}

/* 导航按钮 */
.nav-buttons {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.nav-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
}

.prev-btn {
    background-color: #F5F7FA;
    color: var(--text-gray);
}

.prev-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.next-btn {
    background-color: var(--primary-blue);
    color: var(--text-white);
}

.next-btn:hover {
    background-color: var(--primary-blue-dark);
}

/* ============================================================================
   结果页面
   ============================================================================ */

.result-card {
    position: relative;
    padding: var(--spacing-xl);
}

.result-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--spacing-lg);
}

.result-avatar {
    width: 100px;
    height: 120px;
    margin-right: var(--spacing-lg);
    flex-shrink: 0;
}

.result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-info {
    flex: 1;
}

.result-code {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 4px;
}

.result-name {
    font-size: 18px;
    color: var(--primary-blue-light);
    margin-bottom: var(--spacing-sm);
}

.result-intro {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.8;
    margin-bottom: var(--spacing-lg);
}

.detail-btn {
    display: block;
    text-align: center;
    padding: 14px 20px;
    background-color: var(--primary-blue);
    color: var(--text-white);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
}

/* 浮动按钮 */
.float-btn {
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background-color: var(--bg-card);
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--primary-blue);
    line-height: 1.3;
    box-shadow: 0 4px 12px rgba(59, 130, 196, 0.3);
}

.float-btn span {
    display: block;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.action-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.retry-btn {
    background-color: #F5F7FA;
    color: var(--text-gray);
}

.types-btn {
    background-color: var(--primary-blue);
    color: var(--text-white);
}

/* ============================================================================
   类型列表页
   ============================================================================ */

.types-card {
    padding: var(--spacing-md);
}

.types-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.type-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background-color: #F8FAFC;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.type-item:active {
    transform: scale(0.98);
}

.type-code {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-blue-dark);
}

.type-avatar {
    width: 50px;
    height: 60px;
}

.type-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #E0E7EE 0%, #C5D1DC 100%);
    border-radius: var(--radius-sm);
}

.avatar-placeholder.large {
    width: 100px;
    height: 120px;
}

/* ============================================================================
   类型详情页
   ============================================================================ */

.detail-card {
    position: relative;
    padding: var(--spacing-xl) var(--spacing-lg);
    overflow: visible;
}

.card-border-left,
.card-border-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--text-dark);
}

.card-border-left {
    left: 0;
}

.card-border-right {
    right: 0;
}

.detail-header {
    display: flex;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px dashed #E5E5E5;
}

.detail-avatar {
    width: 120px;
    height: 150px;
    margin-right: var(--spacing-lg);
    flex-shrink: 0;
}

.detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-info {
    flex: 1;
}

.detail-code {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 4px;
}

.detail-name {
    font-size: 18px;
    color: var(--primary-blue-light);
    margin-bottom: var(--spacing-md);
}

.detail-intro p {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.8;
    margin-bottom: var(--spacing-sm);
    text-indent: 2em;
}

/* 浮动按钮 (详情页) */
.float-btn-wrapper {
    position: absolute;
    right: -25px;
    top: 180px;
}

.float-btn-detail {
    width: 65px;
    height: 65px;
    background-color: var(--bg-card);
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--primary-blue);
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(59, 130, 196, 0.3);
    cursor: pointer;
}

.float-btn-detail span {
    display: block;
}

/* 详情段落 */
.detail-section {
    margin-bottom: var(--spacing-xl);
}

.section-heading {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-sm);
    border-left: 3px solid var(--primary-blue);
}

.section-content {
    color: var(--text-gray);
    font-size: 14px;
    line-height: 1.8;
}

.section-content p {
    margin-bottom: var(--spacing-sm);
    text-indent: 2em;
}

.section-content p:last-child {
    margin-bottom: 0;
}

/* ============================================================================
   底部 TabBar
   ============================================================================ */

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    height: 65px;
    background-color: var(--bg-card);
    border-top: 1px solid #E5E5E5;
    display: flex;
    z-index: 100;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    color: var(--text-light);
    transition: color 0.2s;
}

.tab-item.active {
    color: var(--primary-blue);
}

.tab-icon {
    margin-bottom: 4px;
}

.tab-text {
    font-size: 11px;
}

/* ============================================================================
   响应式适配
   ============================================================================ */

@media screen and (max-width: 375px) {
    :root {
        --spacing-lg: 16px;
        --spacing-xl: 20px;
    }
    
    .result-avatar,
    .detail-avatar {
        width: 80px;
        height: 100px;
    }
    
    .detail-avatar {
        width: 100px;
        height: 130px;
    }
    
    .result-code,
    .detail-code {
        font-size: 28px;
    }
}

/* ============================================================================
   动画效果
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-card {
    animation: fadeIn 0.3s ease;
}

/* ============================================================================
   加载状态
   ============================================================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-light);
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary-blue);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

