/* ============================================
   全局样式与变量
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色调 */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    
    /* 功能色 */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* 文字颜色 */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;
    
    /* 背景色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* 边框 */
    --border: #e5e7eb;
    --border-dark: #d1d5db;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.15);
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* 过渡 */
    --transition: all 0.3s ease;
}

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;
}

/* ============================================
   顶部导航
   ============================================ */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    object-fit: cover;
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.brand-desc {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.channel-link {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.95em;
}

.channel-link:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   页面容器
   ============================================ */
.page {
    display: none;
    animation: fadeIn 0.4s ease;
    padding: 20px;
    min-height: calc(100vh - 80px);
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-xl);
}

/* ============================================
   欢迎页面
   ============================================ */
.welcome-header {
    text-align: center;
    margin-bottom: 32px;
}

.welcome-header h2 {
    font-size: 2.2em;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 800;
}

.version-tag {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.9em;
    font-weight: 600;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.info-card {
    background: var(--bg-secondary);
    padding: 24px 16px;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.info-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.info-icon {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.info-card h3 {
    font-size: 1.1em;
    color: var(--primary);
    margin-bottom: 4px;
}

.info-card p {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.info-box {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    border-left: 4px solid var(--primary);
}

.info-box.accent {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border-left-color: var(--secondary);
}

.info-box h3 {
    color: var(--primary);
    margin-bottom: 16px;
    font-size: 1.2em;
}

.info-box ul {
    list-style: none;
}

.info-box li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-secondary);
}

.info-box li:before {
    content: "▸";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 8px;
}

.function-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.function-tag {
    background: white;
    padding: 12px;
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--primary);
    border: 2px solid var(--primary-light);
}

.action-buttons {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

/* ============================================
   按钮样式
   ============================================ */
.btn-primary, .btn-secondary, .btn-nav, .btn-submit, .btn-link {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1em;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-icon {
    font-size: 1.2em;
}

.btn-icon-only {
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.2em;
    transition: var(--transition);
}

.btn-icon-only:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.btn-link {
    background: transparent;
    color: var(--primary);
    text-decoration: underline;
    padding: 8px 16px;
}

.btn-block {
    width: 100%;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   测试页面
   ============================================ */
.progress-section {
    margin-bottom: 32px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-info {
    display: flex;
    gap: 16px;
    align-items: center;
}

.progress-current {
    font-weight: 600;
    color: var(--text-primary);
}

.progress-percent {
    background: var(--bg-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9em;
}

.progress-actions {
    display: flex;
    gap: 8px;
}

.progress-bar {
    height: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 题目区域 */
.question-section {
    margin-bottom: 32px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.question-category {
    background: var(--primary);
    color: white;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.9em;
    font-weight: 600;
}

.question-number {
    color: var(--text-secondary);
    font-weight: 600;
}

.question-title {
    font-size: 1.4em;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.answer-area {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-lg);
}

.answer-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    min-height: 180px;
    transition: var(--transition);
    background: white;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.answer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.word-count {
    font-weight: 600;
    color: var(--primary);
}

.word-hint {
    margin-left: 8px;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.answer-tips {
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* 导航 */
.navigation {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.btn-nav {
    min-width: 120px;
}

.nav-center {
    text-align: center;
}

.btn-submit {
    grid-column: 2 / 4;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    padding: 16px 32px;
    font-size: 1.1em;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

/* 答题概览 */
.overview-panel {
    display: none;
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-top: 24px;
    animation: slideDown 0.3s ease;
}

.overview-panel.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.overview-header h3 {
    color: var(--primary);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5em;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.overview-item {
    aspect-ratio: 1;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    position: relative;
}

.overview-item:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.overview-item.answered {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.overview-item.answered::after {
    content: '✓';
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 0.8em;
}

.overview-item.current {
    border-color: var(--secondary);
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.overview-legend {
    display: flex;
    gap: 24px;
    justify-content: center;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: white;
    margin-right: 6px;
    vertical-align: middle;
}

.legend-dot.answered {
    background: var(--primary);
    border-color: var(--primary);
}

.legend-dot.current {
    border-color: var(--secondary);
    border-width: 3px;
}

/* ============================================
   加载页面
   ============================================ */
.loading-content {
    text-align: center;
    padding: 60px 20px;
}

.loading-animation {
    position: relative;
    margin-bottom: 40px;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 6px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.loading-content h2 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.8em;
}

.loading-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.loading-status {
    background: var(--bg-secondary);
    padding: 16px 24px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.loading-progress-bar {
    max-width: 400px;
    margin: 0 auto;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
    width: 0%;
    animation: loadingProgress 3s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* ============================================
   结果页面
   ============================================ */
.result-header {
    text-align: center;
    margin-bottom: 32px;
}

.result-header h1 {
    color: var(--primary);
    font-size: 2em;
    margin-bottom: 8px;
}

.result-date {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.result-main {
    text-align: center;
    margin-bottom: 40px;
}

.mbti-type-card {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 40px 80px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.mbti-type-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.type-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1em;
    margin-bottom: 8px;
    font-weight: 600;
}

.type-value {
    font-size: 4.5em;
    font-weight: 900;
    color: white;
    letter-spacing: 12px;
    line-height: 1;
    margin-bottom: 8px;
    text-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.type-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    font-weight: 500;
}

/* 结果标签页 */
.result-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1em;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.result-content {
    min-height: 300px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.function-item {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border-left: 4px solid var(--primary);
    transition: var(--transition);
}

.function-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.function-item strong {
    color: var(--primary);
    font-size: 1.2em;
    display: block;
    margin-bottom: 8px;
}

.analysis-text {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
    line-height: 1.8;
    color: var(--text-primary);
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

/* ============================================
   历史记录页面
   ============================================ */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.history-header h1 {
    color: var(--primary);
    font-size: 1.8em;
}

.history-list {
    display: grid;
    gap: 20px;
}

.history-item {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
    transition: var(--transition);
    cursor: pointer;
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-type {
    font-size: 2em;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 4px;
}

.history-date {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.history-item-body {
    color: var(--text-secondary);
    line-height: 1.6;
}

.history-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.history-actions button {
    padding: 8px 16px;
    font-size: 0.9em;
}

.history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.history-empty-icon {
    font-size: 4em;
    margin-bottom: 16px;
}

/* ============================================
   弹窗
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    color: var(--primary);
    font-size: 1.3em;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5em;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

.modal-hint {
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 0.9em;
}

.export-textarea {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    resize: vertical;
    margin-bottom: 16px;
}

.share-preview {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    white-space: pre-line;
    line-height: 1.8;
}

.share-actions {
    text-align: center;
}

.share-hint {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 12px;
}

/* ============================================
   Toast 提示
   ============================================ */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 16px 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
    max-width: 90%;
    text-align: center;
    font-weight: 600;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

.toast.info {
    background: var(--info);
}

/* ============================================
   底部版权
   ============================================ */
.footer {
    text-align: center;
    padding: 32px 20px;
    color: rgba(255, 255, 255, 0.9);
}

.footer p {
    margin: 8px 0;
}

.footer a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
}

.footer a:hover {
    color: var(--primary-light);
}

.footer-note {
    font-size: 0.9em;
    opacity: 0.8;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
    .header-content {
        padding: 12px 16px;
    }
    
    .logo {
        width: 40px;
        height: 40px;
    }
    
    .brand-name {
        font-size: 1.1em;
    }
    
    .channel-link {
        padding: 8px 16px;
        font-size: 0.85em;
    }
    
    .page {
        padding: 12px;
    }
    
    .container {
        padding: 24px 20px;
    }
    
    .welcome-header h2 {
        font-size: 1.6em;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .type-value {
        font-size: 3em;
        letter-spacing: 8px;
    }
    
    .mbti-type-card {
        padding: 30px 50px;
    }
    
    .navigation {
        grid-template-columns: 1fr;
    }
    
    .btn-nav {
        width: 100%;
    }
    
    .nav-center {
        order: 3;
    }
    
    .btn-submit {
        grid-column: 1;
    }
    
    .overview-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions button {
        width: 100%;
    }
    
    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .history-actions {
        flex-direction: column;
    }
    
    .history-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .function-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .type-value {
        font-size: 2.5em;
        letter-spacing: 6px;
    }
    
    .result-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .tab-btn.active {
        border-left-color: var(--primary);
    }
}

/* ============================================
   打印样式
   ============================================ */
@media print {
    body {
        background: white;
    }
    
    .header,
    .navigation,
    .result-actions,
    .progress-actions,
    .footer {
        display: none;
    }
    
    .container {
        box-shadow: none;
        max-width: 100%;
    }
    
    .page {
        padding: 0;
    }
}

/* ============================================
   工具类
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none; }
/* ============================================
   混合题型样式
   ============================================ */

/* 选择题 */
.choice-question {
    animation: fadeIn 0.3s ease;
}

.function-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    color: white;
    font-weight: 600;
    margin-bottom: 24px;
    font-size: 0.9em;
}

.choice-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-option {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.choice-option:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.choice-option input[type="radio"] {
    margin-right: 16px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.choice-option .option-text {
    flex: 1;
    font-size: 1em;
    color: var(--text-primary);
}

.choice-option .option-check {
    opacity: 0;
    color: var(--success);
    font-size: 1.2em;
    font-weight: bold;
    transition: var(--transition);
}

.choice-option.selected {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary);
}

.choice-option.selected .option-check {
    opacity: 1;
}

/* 简答题 */
.essay-question {
    animation: fadeIn 0.3s ease;
}

.essay-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--info);
    border-radius: var(--radius);
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.hint-icon {
    font-size: 1.5em;
}

.essay-keywords {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 0.9em;
}

.keyword-tag {
    display: inline-block;
    padding: 4px 10px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-right: 8px;
    margin-top: 4px;
    color: var(--primary);
    font-weight: 500;
}

/* 概览中的简答题标识 */
.overview-item.essay-type {
    border: 2px solid var(--info);
    font-weight: 700;
}

.overview-item.essay-type::before {
    content: '✎';
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.8em;
    color: var(--info);
}

/* 自动保存Toast - 修复圆角和位置 */
#autoSaveToast {
    position: fixed;
    top: 80px;
    left: 20px;
    transform: translateX(-200%);
    background: rgba(40, 40, 40, 0.92);
    backdrop-filter: blur(8px);
    color: white;
    padding: 12px 24px;
    border-radius: 50px; /* 明确指定圆角 */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 2000;
    font-weight: 500;
    font-size: 0.9em;
    white-space: nowrap;
}

#autoSaveToast.show {
    transform: translateX(0);
    opacity: 1;
}

/* 功能标签 - 确保显示 */
.function-badge {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    margin-bottom: 24px;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 概览面板 - 确保显示动画流畅 */
.overview-panel {
    display: none;
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-top: 24px;
    animation: slideDown 0.3s ease;
}

.overview-panel.show {
    display: block;
}

/* 导出按钮悬停效果 */
.btn-icon-only {
    padding: 10px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.2em;
    transition: var(--transition);
    color: var(--text-primary);
}

.btn-icon-only:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}


/* 响应式 */
@media (max-width: 768px) {
    .choice-option {
        padding: 12px 16px;
    }
    
    .choice-option input[type="radio"] {
        width: 18px;
        height: 18px;
    }
    
    #autoSaveToast {
        top: 70px;
        left: 10px;
        font-size: 0.85em;
        padding: 8px 16px;
    }
}


/* ============================================
   隐藏答题页的功能提示
   ============================================ */
.function-badge,
.essay-keywords {
    display: none !important;
}

/* ============================================
   低调的自动保存提示 - 仅图标
   ============================================ */
#autoSaveToast {
    position: fixed;
    top: 80px;
    left: 20px;
    
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    
    background: rgba(16, 185, 129, 0.9);
    backdrop-filter: blur(4px);
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    transform: translateX(-100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2000;
    
    font-size: 16px;
    line-height: 1;
    color: white;
    
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#autoSaveToast.show {
    transform: translateX(0) scale(1);
    opacity: 1;
    animation: saveSuccess 0.5s ease;
}

@keyframes saveSuccess {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 
                    0 0 0 8px rgba(16, 185, 129, 0.2);
    }
}

@media (max-width: 768px) {
    #autoSaveToast {
        top: 70px;
        left: 10px;
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}


/* ============================================
   优化的结果页面样式
   ============================================ */

/* MBTI类型卡片增强 */
.type-group {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95em;
    margin-top: 12px;
    font-weight: 500;
    letter-spacing: 1px;
}

/* 快速概览 */
.result-quick-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.overview-stat {
    background: linear-gradient(135deg, var(--bg-secondary), white);
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.overview-stat:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.overview-stat-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.overview-stat-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.overview-stat-value {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary);
}

/* 标签增强 */
.tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-icon {
    font-size: 1.1em;
}

/* 内容区块 */
.content-section {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    font-size: 1.3em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.title-icon {
    font-size: 1.2em;
}

/* 人格概述 */
.personality-summary {
    line-height: 1.9;
    font-size: 1.05em;
    color: var(--text-primary);
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.ai-analysis {
    line-height: 1.8;
    color: var(--text-primary);
    background: white;
    padding: 20px;
    border-radius: var(--radius);
}

/* 核心特质网格 */
.traits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.trait-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    transition: var(--transition);
}

.trait-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.trait-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.trait-card-icon {
    font-size: 2.5em;
}

.trait-card-title {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--primary);
}

.trait-card-description {
    line-height: 1.7;
    color: var(--text-secondary);
}

/* 认知功能堆栈 */
.function-stack-detailed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.function-stack-item {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    border-left: 5px solid var(--primary);
    transition: var(--transition);
}

.function-stack-item:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
}

.function-stack-item:nth-child(1) { border-left-color: #6366f1; }
.function-stack-item:nth-child(2) { border-left-color: #8b5cf6; }
.function-stack-item:nth-child(3) { border-left-color: #ec4899; }
.function-stack-item:nth-child(4) { border-left-color: #f59e0b; }

.function-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.function-name-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.function-icon-large {
    font-size: 2.5em;
}

.function-name-text h4 {
    font-size: 1.4em;
    color: var(--primary);
    margin-bottom: 4px;
}

.function-name-text .function-fullname {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.function-position-badge {
    padding: 6px 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9em;
}

.function-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.function-keyword {
    padding: 4px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    font-size: 0.85em;
    color: var(--primary);
    font-weight: 600;
}

.function-description {
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.function-learn-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    padding: 8px 16px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    transition: var(--transition);
}

.function-learn-more:hover {
    background: var(--primary);
    color: white;
    transform: translateX(4px);
}

/* 优势劣势列表 */
.strength-list, .weakness-list, .development-list {
    list-style: none;
    display: grid;
    gap: 12px;
}

.strength-list li, .weakness-list li, .development-list li {
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius);
    border-left: 4px solid var(--success);
    line-height: 1.7;
    transition: var(--transition);
    position: relative;
    padding-left: 50px;
}

.strength-list li::before {
    content: '✓';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3em;
    font-weight: bold;
    color: var(--success);
}

.weakness-list li {
    border-left-color: var(--warning);
}

.weakness-list li::before {
    content: '!';
    color: var(--warning);
}

.development-list li {
    border-left-color: var(--info);
}

.development-list li::before {
    content: '→';
    color: var(--info);
}

.strength-list li:hover, .weakness-list li:hover, .development-list li:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow-sm);
}

.development-intro {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.development-intro p {
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
}

/* 职业标签 */
.career-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.career-tag {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.95em;
    transition: var(--transition);
    cursor: default;
}

/* 为 .career-tag 元素添加 hover 状态样式（补全选择器） */
.career-tag:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}


/* 著名人物 */
.famous-people {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.famous-person {
    background: white;
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.famous-person:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.famous-person-icon {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.famous-person-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95em;
}

/* 深入了解卡片 */
.learn-more-section {
    margin: 40px 0;
}

.learn-more-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    padding: 32px;
    border-radius: var(--radius-xl);
    text-align: center;
    border: 2px solid var(--primary-light);
}

.learn-more-card h3 {
    color: var(--primary);
    font-size: 1.5em;
    margin-bottom: 12px;
}

.learn-more-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 1.05em;
}

.btn-learn-more {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1.1em;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-learn-more:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-arrow {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.btn-learn-more:hover .btn-arrow {
    transform: translateX(4px);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .result-quick-overview {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .traits-grid {
        grid-template-columns: 1fr;
    }
    
    .function-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .career-tags {
        justify-content: center;
    }
    
    .famous-people {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .learn-more-card {
        padding: 24px 20px;
    }
}

@media (max-width: 480px) {
    .result-quick-overview {
        grid-template-columns: 1fr;
    }
    
    .famous-people {
        grid-template-columns: 1fr;
    }
}
/* 重新分析按钮样式 */
#reanalyzeBtn {
    transition: var(--transition);
}

#reanalyzeBtn:hover {
    opacity: 1 !important;
    color: var(--primary);
    transform: scale(1.05);
}

/* 失败状态的结果卡片 */
.mbti-type-card.failed {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
}

.mbti-type-card.failed .type-value {
    opacity: 0.5;
}
