/* ============================================
   全局样式与变量
   ============================================ */
* {
    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; }
