/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* 背景层 - 用于平滑过渡 */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

/* 过渡背景层 - 在主背景之上，通过opacity淡入 */
.bg-layer.bg-transition {
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-layer.bg-transition.active {
    opacity: 1;
}

/* NT 分析家 - 紫色 */
.bg-layer.bg-nt {
    background: linear-gradient(-45deg, #7C3AED, #8B5CF6, #A78BFA, #6D28D9);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

/* NF 外交家 - 绿色 */
.bg-layer.bg-nf {
    background: linear-gradient(-45deg, #10B981, #34D399, #059669, #047857);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

/* SJ 守护者 - 蓝色 */
.bg-layer.bg-sj {
    background: linear-gradient(-45deg, #3B82F6, #60A5FA, #2563EB, #1D4ED8);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

/* SP 探险家 - 黄色/金色 */
.bg-layer.bg-sp {
    background: linear-gradient(-45deg, #F59E0B, #FBBF24, #D97706, #B45309);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

/* 动态渐变背景 */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 背景装饰圆形 */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

body::before {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #fff 0%, transparent 70%);
    top: -200px;
    right: -200px;
    animation: float1 20s ease-in-out infinite;
}

body::after {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #fff 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    animation: float2 25s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-50px, 50px) rotate(180deg); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(30px, -30px) rotate(-180deg); }
}

.container {
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

/* 页面切换 */
.page {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.25),
        0 10px 30px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.page.active {
    display: block;
}

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

/* 开始页面 */
#start-page {
    text-align: center;
}

#start-page h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s ease-in-out infinite;
    background-size: 200% auto;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

.description {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.description p {
    color: #555;
    line-height: 1.9;
    margin-bottom: 12px;
    position: relative;
    padding-left: 20px;
}

.description p::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: #764ba2;
    font-size: 0.8em;
}

.description p:last-child {
    margin-bottom: 0;
}

/* 按钮样式 */
.btn {
    padding: 16px 45px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% auto;
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
}

.btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.45);
    background-position: 100% center;
}

.btn.secondary {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
    color: #495057;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.btn.secondary:hover {
    background: linear-gradient(135deg, #e8ecf3 0%, #dde2ea 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 测试页面 */
.progress-bar {
    width: 100%;
    height: 10px;
    background: linear-gradient(90deg, #f0f0f0, #e0e0e0);
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    background-size: 200% auto;
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    width: 0%;
    animation: progressGlow 2s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

@keyframes progressGlow {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.question-counter {
    text-align: center;
    color: #888;
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.question-box {
    background: linear-gradient(135deg, #fafbfc 0%, #f0f2f5 100%);
    padding: 35px 30px;
    border-radius: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
}

.question-box::before {
    content: '"';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 4rem;
    color: rgba(102, 126, 234, 0.15);
    font-family: Georgia, serif;
    line-height: 1;
}

.question-text {
    font-size: 1.2rem;
    color: #333;
    line-height: 1.7;
    text-align: center;
    font-weight: 450;
}

/* 选项按钮 */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    padding: 18px 25px;
    font-size: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    color: #495057;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 0;
}

.option-btn span {
    position: relative;
    z-index: 1;
}

.option-btn:hover {
    border-color: #667eea;
    transform: translateX(8px);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
}

.option-btn:hover::before {
    opacity: 0.05;
}

.option-btn.selected {
    border-color: transparent;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% auto;
    color: white;
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    animation: selectPulse 0.6s ease;
}

@keyframes selectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1.02); }
}

/* 导航按钮 */
.nav-buttons {
    margin-top: 25px;
    display: flex;
    justify-content: flex-start;
}

/* 结果页面 */
#result-page {
    text-align: center;
}

#result-page h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-icon {
    width: 140px;
    height: 140px;
    margin: 0 auto 15px;
    animation: iconFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(102, 126, 234, 0.3));
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.result-icon svg {
    width: 100%;
    height: 100%;
}

.result-type {
    font-size: 4.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
    letter-spacing: 4px;
    animation: typeShimmer 3s ease-in-out infinite;
    background-size: 200% auto;
}

@keyframes typeShimmer {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.result-animal {
    font-size: 1.3rem;
    color: #888;
    margin-bottom: 25px;
    font-weight: 500;
}

.result-dimensions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.dimension {
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f2f5 100%);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.08);
    transition: all 0.3s ease;
}

.dimension:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.dimension-label {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.dimension-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.dimension-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    margin-top: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dimension-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    background-size: 200% auto;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    animation: fillGlow 2s ease-in-out infinite;
}

@keyframes fillGlow {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.result-description {
    background: linear-gradient(135deg, #fafbfc 0%, #f0f2f5 100%);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.result-description h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-description p {
    color: #555;
    line-height: 1.9;
    font-size: 0.95rem;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 分享按钮默认隐藏，移动端显示 */
#share-btn {
    display: none;
}

/* 移动端适配 - 使用pointer检测触摸设备，更可靠 */
@media (pointer: coarse), (max-width: 1024px) {
    #share-btn {
        display: inline-block;
    }
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    /* 开始页面和测试页面居中 */
    #start-page,
    #test-page {
        margin: auto;
    }

    /* 结果页面从顶部开始，支持滚动查看完整内容 */
    #result-page {
        margin: 20px auto;
    }

    .page {
        padding: 25px 20px;
        border-radius: 20px;
    }

    #start-page h1 {
        font-size: 1.8rem;
    }

    .description {
        padding: 20px;
    }

    .description p {
        font-size: 0.9rem;
        padding-left: 18px;
    }

    .btn {
        padding: 14px 28px;
        font-size: 1rem;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .question-box {
        padding: 25px 20px;
    }

    .question-box::before {
        font-size: 3rem;
        left: 12px;
    }

    .result-type {
        font-size: 3rem;
        letter-spacing: 2px;
    }

    .result-icon {
        width: 100px;
        height: 100px;
    }

    .result-dimensions {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .dimension {
        padding: 15px;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-description {
        padding: 20px;
    }
}

/* 平板和小屏设备 */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 15px;
    }

    #start-page,
    #test-page {
        margin: auto;
    }

    #result-page {
        margin: 20px auto;
    }

    .page {
        padding: 30px 25px;
    }
}

/* 结果页面移动端优化 - 确保内容完整显示 */
@media (max-width: 768px) {
    #result-page {
        padding-bottom: 30px;
    }

    .result-description {
        max-height: 300px;
        overflow-y: auto;
    }

    .result-type {
        font-size: 3.5rem;
    }

    #result-page h1 {
        font-size: 1.6rem;
        margin-bottom: 15px;
    }
}