/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

/* 页面切换 */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 欢迎页面 */
#welcomePage h1 {
    text-align: center;
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    font-size: 1.2em;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.welcome-content {
    max-width: 700px;
    margin: 0 auto;
}

.info-box {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border-left: 4px solid var(--primary-color);
}

.info-box h3 {
    color: var(--primary-color);
    margin-bottom: 16px;
    font-size: 1.3em;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.info-box li:before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 8px;
}

.function-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.function-list li {
    background: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95em;
}

/* 按钮 */
.btn-primary, .btn-secondary, .btn-link {
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    font-size: 1.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    display: block;
    margin: 40px auto 0;
    min-width: 200px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-link {
    background: transparent;
    color: var(--primary-color);
    padding: 8px 16px;
    text-decoration: underline;
}

/* 进度条 */
.progress-section {
    margin-bottom: 32px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 600;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

/* 题目区域 */
.question-section {
    margin-bottom: 32px;
}

.question-category {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 16px;
}

.question-title {
    font-size: 1.5em;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.question-hint {
    color: var(--text-secondary);
    font-size: 0.95em;
    font-style: italic;
    margin-bottom: 24px;
    padding-left: 16px;
    border-left: 3px solid var(--border-color);
}

.answer-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    min-height: 200px;
    transition: border-color 0.3s ease;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.word-count {
    text-align: right;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* 导航按钮 */
.navigation {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.navigation button {
    flex: 1;
}

/* 答题概览 */
.answer-overview {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

#toggleOverview {
    display: block;
    margin: 0 auto;
}

.overview-panel {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
}

.overview-item {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.overview-item:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.overview-item.answered {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.overview-item.current {
    border-color: var(--secondary-color);
    border-width: 3px;
}

/* 加载页面 */
.loading-content {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 32px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content h2 {
    color: var(--primary-color);
    margin-bottom: 16px;
}

.loading-content p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.loading-status {
    background: var(--bg-secondary);
    padding: 16px 24px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-style: italic;
    display: inline-block;
}

/* 结果页面 */
#resultPage h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 40px;
}

.result-main {
    text-align: center;
    margin-bottom: 48px;
}

.mbti-type {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 40px 60px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.type-label {
    color: rgba(255,255,255,0.9);
    font-size: 1.1em;
    margin-bottom: 8px;
    font-weight: 600;
}

.type-value {
    font-size: 4em;
    font-weight: 900;
    color: white;
    letter-spacing: 8px;
}

.result-section {
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.result-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.4em;
}

.function-analysis, .detailed-analysis, .function-stack {
    color: var(--text-primary);
    line-height: 1.8;
}

.function-item {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary-color);
}

.function-item strong {
    color: var(--primary-color);
    font-size: 1.1em;
}

.result-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 40px;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 24px;
    }
    
    #welcomePage h1 {
        font-size: 1.8em;
    }
    
    .function-list {
        grid-template-columns: 1fr;
    }
    
    .navigation {
        flex-direction: column;
    }
    
    .overview-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }
    
    .type-value {
        font-size: 3em;
        letter-spacing: 4px;
    }
    
    .result-actions {
        flex-direction: column;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .container {
        box-shadow: none;
    }
    
    .navigation, .result-actions {
        display: none;
    }
}
.question-hint {
    display: none; /* 默认隐藏判型观察点 */
}

/* 或者，如果要保留但样式更柔和 */
.question-hint {
    color: #9ca3af;
    font-size: 0.85em;
    font-style: italic;
    margin-bottom: 20px;
    padding: 8px 12px;
    background: #f9fafb;
    border-left: 3px solid #e5e7eb;
    border-radius: 4px;
}
