/* NAT检测页面样式 */
.nat-test-page {
    max-width: 1000px;
    margin: 40px auto 60px;
    padding: 0 20px;
}

/* 页面标题 */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.header-icon {
    width: 56px;
    height: 56px;
    color: #2c3e50;
    margin-bottom: 16px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.page-header p {
    font-size: 16px;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

/* 检测说明 */
.detection-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 32px;
    font-size: 14px;
    color: #0c4a6e;
    line-height: 1.6;
}

.detection-notice svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    color: #0284c7;
}

.detection-notice code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13px;
    color: #0c4a6e;
}

/* 检测工具卡片 */
.test-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.test-status {
    text-align: center;
    padding: 40px 0;
}

.status-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    color: #2c3e50;
}

.status-icon.loading {
    color: #3b82f6;
}

.status-icon.error {
    color: #ef4444;
}

.test-status h3 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.test-status p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* 测试结果 */
.test-result {
    padding: 20px 0;
}

.result-header {
    text-align: center;
    margin-bottom: 32px;
}

.result-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    padding: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.result-icon.green {
    background: #d1fae5;
    color: #059669;
}

.result-icon.blue {
    background: #dbeafe;
    color: #2563eb;
}

.result-icon.yellow {
    background: #fef3c7;
    color: #d97706;
}

.result-icon.red {
    background: #fee2e2;
    color: #dc2626;
}

.result-icon.gray {
    background: #f3f4f6;
    color: #6b7280;
}

.result-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.result-item {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 12px;
}

.result-item label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
}

.result-value {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    word-break: break-all;
}

.result-description {
    background: #fffbf0;
    border: 1px solid #ffe9a8;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.result-description h4 {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px 0;
}

.result-description p {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin: 0;
}

/* 测试按钮 */
.test-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.test-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a1a 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.3);
}

.test-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.test-btn.secondary {
    background: #fff;
    color: #2c3e50;
    border: 1px solid #e8e8e8;
}

.test-btn.secondary:hover {
    background: #f8f8f8;
}

.test-btn svg {
    width: 20px;
    height: 20px;
}

/* IPv6测试链接按钮 */
.test-btn.ipv6-link {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

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

.test-btn.ipv6-link:hover::before {
    left: 100%;
}

.test-btn.ipv6-link:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

/* NAT类型说明 */
.info-section {
    margin-bottom: 40px;
}

.info-section h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 24px 0;
}

/* NAT结构图 */
.nat-structure-image {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    text-align: center;
}

.nat-structure-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-caption {
    margin-top: 16px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.info-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
}

.info-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 32px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.info-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* 卡片头部：图标+标题 */
.info-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.card-icon {
    width: 56px;
    height: 56px;
    padding: 14px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon.green {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.card-icon.blue {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.card-icon.yellow {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.card-icon.red {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.info-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    flex: 1;
}

/* 卡片内容区域 */
.info-card-content {
    margin-bottom: 20px;
}

.info-card p {
    font-size: 15px;
    color: #4b5563;
    line-height: 1.7;
    margin: 0 0 14px 0;
}

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

.info-card p strong {
    color: #1f2937;
    font-weight: 600;
}

.card-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.card-badge.best {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #047857;
}

.card-badge.good {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1d4ed8;
}

.card-badge.moderate {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
}

.card-badge.poor {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #b91c1c;
}

/* 常见问题 */
.faq-section h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 24px 0;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.faq-item {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 24px;
}

.faq-item h4 {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px 0;
}

.faq-item p {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin: 0;
}

/* 工具类 */
.d-none {
    display: none !important;
}

/* 优化提示 - 一行布局 */
.sponsor-tip {
    margin-top: 24px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.sponsor-tip #sponsorTipText {
    font-size: 15px;
    font-weight: 500;
    color: #2c3e50;
    flex: 1;
    min-width: 200px;
}

.sponsor-tip #sponsorTipLink {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: #fff;
    color: #ef4444;
    border: 2px solid #ef4444;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.sponsor-tip #sponsorTipLink:hover {
    background: #ef4444;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* 增强的检测结果样式 */
.result-main {
    margin-bottom: 24px;
}

.result-primary {
    text-align: center;
    margin-bottom: 24px;
}

.nat-level-badge {
    display: inline-block;
    padding: 8px 24px;
    border-radius: 24px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 2px;
}

.nat-level-badge.level-excellent {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.nat-level-badge.level-good {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nat-level-badge.level-moderate {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.nat-level-badge.level-poor {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.nat-type-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.nat-type-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
}

.result-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.detail-box {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.detail-icon {
    font-size: 28px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.detail-icon svg {
    width: 28px;
    height: 28px;
    color: inherit;
}

.detail-content label {
    display: block;
    font-size: 13px;
    color: #999;
    font-weight: 500;
    margin-bottom: 8px;
}

.detail-content .detail-value {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    word-break: break-all;
}

/* 网络环境提示 */
.network-alert {
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.network-alert svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.network-alert p {
    margin: 0;
    line-height: 1.6;
}

.network-alert.alert-success {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.network-alert.alert-info {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.network-alert.alert-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.network-alert.alert-danger {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* 应用兼容性 */
.nat-compatibility h4 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 20px 0;
    text-align: center;
}

.nat-apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.nat-app-item {
    text-align: center;
}

.nat-app-circle {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
}

.nat-app-circle svg {
    transform: rotate(-90deg);
}

.nat-app-circle circle {
    fill: none;
    stroke-width: 6;
}

.nat-app-circle circle.progress-bg {
    stroke: #e5e7eb;
}

.nat-app-circle circle.progress-bar {
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.nat-app-circle.app-excellent circle.progress-bar {
    stroke: #10b981;
}

.nat-app-circle.app-good circle.progress-bar {
    stroke: #3b82f6;
}

.nat-app-circle.app-fair circle.progress-bar {
    stroke: #f59e0b;
}

.nat-app-circle.app-poor circle.progress-bar {
    stroke: #ef4444;
}

/* 圆圈内的文字 */
.nat-app-circle .nat-app-rating {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    pointer-events: none;
}

.nat-app-circle.app-excellent .nat-app-rating {
    color: #10b981;
}

.nat-app-circle.app-good .nat-app-rating {
    color: #3b82f6;
}

.nat-app-circle.app-fair .nat-app-rating {
    color: #f59e0b;
}

.nat-app-circle.app-poor .nat-app-rating {
    color: #ef4444;
}

.nat-app-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

.nat-app-label .app-icon {
    flex-shrink: 0;
    color: #64748b;
    transition: color 0.3s ease;
}

.nat-app-item:hover .app-icon {
    color: #3b82f6;
}

/* 优化建议 */
.optimization-tip {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.tip-icon {
    flex-shrink: 0;
    font-size: 24px;
    margin-top: 2px;
}

.tip-content {
    flex: 1;
}

.tip-content h5 {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

.tip-content p {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.tip-button {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tip-button svg {
    width: 16px;
    height: 16px;
}

.tip-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 优化指南模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
}

.guide-section {
    margin-bottom: 28px;
}

.guide-section:last-child {
    margin-bottom: 0;
}

.guide-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 12px 0;
    padding-left: 12px;
    border-left: 3px solid #3b82f6;
}

.guide-section p {
    font-size: 14px;
    color: #475569;
    line-height: 1.7;
    margin: 0 0 12px 0;
}

.guide-section ol {
    margin: 0;
    padding-left: 24px;
}

.guide-section li {
    font-size: 14px;
    color: #334155;
    line-height: 1.8;
    margin-bottom: 8px;
}

.guide-section code {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13px;
    color: #0f172a;
}

.guide-section .note {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    color: #92400e;
    margin-top: 12px;
    line-height: 1.7;
}

.guide-section ul {
    margin: 8px 0;
    padding-left: 24px;
}

.guide-section ul li {
    margin-bottom: 6px;
    line-height: 1.7;
}

.guide-section strong {
    color: #1e293b;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .info-cards {
        grid-template-columns: 1fr;
    }

    .result-details {
        grid-template-columns: 1fr;
    }

    .result-details-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    /* 移动端结果网格改为单列 */
    .result-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .result-item {
        padding: 16px;
    }

    .result-value {
        font-size: 16px;
        word-break: break-word;
    }

    /* 移动端详情框优化 - 3列布局 */
    .detail-box {
        padding: 12px 8px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .detail-icon {
        font-size: 20px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .detail-icon svg {
        width: 20px;
        height: 20px;
    }

    .detail-content {
        flex: 1;
        text-align: center;
    }

    .detail-content label {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .detail-content .detail-value {
        font-size: 13px;
        font-weight: 600;
    }

    .nat-apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .test-card {
        padding: 24px 16px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .info-section h2,
    .faq-section h2 {
        font-size: 22px;
    }

    /* 移动端按钮布局 */
    .test-actions {
        flex-direction: column;
        gap: 10px;
    }

    .test-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 24px;
        font-size: 15px;
    }

    /* 移动端NAT类型标题 */
    .nat-type-title {
        font-size: 20px;
        line-height: 1.3;
    }

    .nat-type-subtitle {
        font-size: 14px;
    }

    /* 移动端NAT等级徽章 */
    .nat-level-badge {
        font-size: 16px;
        padding: 6px 20px;
        letter-spacing: 1px;
    }

    .optimization-tip {
        flex-direction: column;
    }

    .modal-content {
        max-height: 90vh;
    }

    .modal-header,
    .modal-body {
        padding: 20px;
    }

    /* 移动端检测说明 */
    .detection-notice {
        padding: 12px 16px;
        font-size: 13px;
    }

    /* 移动端结果描述 */
    .result-description {
        padding: 16px;
    }

    .result-description h4 {
        font-size: 15px;
    }

    .result-description p {
        font-size: 13px;
    }

    /* 移动端网络提示 */
    .network-alert {
        padding: 12px 16px;
        font-size: 13px;
    }

    /* 移动端优化提示 */
    .sponsor-tip {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 14px 16px;
    }

    .sponsor-tip #sponsorTipText {
        font-size: 14px;
        min-width: auto;
    }

    .sponsor-tip #sponsorTipLink {
        width: 100%;
        justify-content: center;
        padding: 10px 20px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .nat-apps-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nat-level-badge {
        font-size: 14px;
        padding: 6px 16px;
    }

    .test-card {
        padding: 20px 12px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .result-item label {
        font-size: 12px;
    }

    .result-value {
        font-size: 15px;
    }

    .nat-type-title {
        font-size: 18px;
    }

    .nat-type-subtitle {
        font-size: 13px;
    }

    /* 超小屏幕详情框 */
    .detail-box {
        padding: 12px;
    }

    .detail-content label {
        font-size: 11px;
    }

    .detail-content .detail-value {
        font-size: 14px;
    }
}

/* 检测进度条 */
.progress-container {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    margin: 20px auto 12px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.progress-text {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #3b82f6;
    margin-top: 8px;
}

/* 庆祝效果 - 五彩纸屑 */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f0f;
    top: -10px;
    opacity: 0;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotateZ(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotateZ(720deg);
    }
}

/* 结果卡片弹出动画 */
.test-result.celebrate {
    animation: result-pop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes result-pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 结果图标脉冲动画 */
.result-icon.pulse {
    animation: icon-pulse 0.8s ease-out;
}

@keyframes icon-pulse {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(0.95);
    }
    75% {
        transform: scale(1.1);
    }
}

/* NAT工作原理图表样式 */
.nat-diagram-toggle {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e8e8e8;
}

.diagram-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.diagram-toggle-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.diagram-toggle-btn .toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.diagram-toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

.nat-diagram-content {
    margin-top: 16px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.nat-diagram-content .mermaid {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.diagram-note {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin: 0;
    padding: 12px;
    background: white;
    border-left: 3px solid #667eea;
    border-radius: 4px;
}

.diagram-note strong {
    color: #333;
    font-weight: 600;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .nat-diagram-content .mermaid {
        padding: 10px;
        font-size: 12px;
    }
    
    .diagram-note {
        font-size: 12px;
        padding: 10px;
    }
}

/* Mermaid图表样式增强 */
.nat-diagram-content .mermaid svg {
    max-width: 100%;
    height: auto;
}

.nat-diagram-content .mermaid .node rect,
.nat-diagram-content .mermaid .node circle,
.nat-diagram-content .mermaid .node ellipse,
.nat-diagram-content .mermaid .node polygon {
    stroke-width: 2px !important;
}

.nat-diagram-content .mermaid .edgeLabel {
    background-color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
}

.nat-diagram-content .mermaid text {
    fill: #1a1a1a !important;
    font-size: 13px !important;
    font-weight: 500 !important;
}

.nat-diagram-content .mermaid .edgePath .path {
    stroke-width: 2px !important;
}
/* NAT工作原理流程图样式 - 纯CSS实现 */
.flow-diagram {
    background: white;
    padding: 30px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.flow-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 15px 0;
}

.flow-node {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    min-width: 140px;
    text-align: center;
    transition: all 0.3s ease;
}

.flow-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.flow-node.client {
    background: #e3f2fd;
    border-color: #2196f3;
}

.flow-node.nat {
    background: #fff9c4;
    border-color: #fbc02d;
    border-width: 3px;
}

.flow-node.nat.success {
    background: #c8e6c9;
    border-color: #4caf50;
}

.flow-node.server {
    background: #fff3e0;
    border-color: #ff9800;
}

.node-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.node-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
}

.node-detail {
    font-size: 12px;
    color: #666;
    font-family: 'Courier New', monospace;
}

.node-status {
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.node-status.success {
    background: #c8e6c9;
    color: #2e7d32;
}

.node-status.fail {
    background: #ffcdd2;
    color: #c62828;
}

.flow-arrow {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.arrow-line {
    width: 60px;
    height: 2px;
    background: #666;
}

.arrow-label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.arrow-head {
    font-size: 24px;
    font-weight: bold;
}

.flow-split {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.split-line {
    width: 2px;
    height: 40px;
    background: #666;
    position: relative;
}

.split-line::after {
    content: '→';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #666;
}

.flow-spacer {
    flex: 1;
    min-width: 140px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .flow-diagram {
        padding: 20px 10px;
    }
    
    .flow-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .flow-node {
        min-width: 100%;
        max-width: 280px;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
    }
    
    .arrow-line {
        width: 40px;
    }
    
    .flow-split {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
    }
    
    .split-line {
        width: 40px;
        height: 2px;
    }
    
    .split-line::after {
        right: auto;
        bottom: -20px;
        top: auto;
        transform: rotate(90deg);
    }
    
    .flow-spacer {
        display: none;
    }
}
/* 简化的文字流程图样式 */
.text-diagram {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.diagram-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.diagram-box {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 140px;
    text-align: center;
    line-height: 1.6;
}

.diagram-box.highlight {
    background: #fff9c4;
    border-color: #fbc02d;
    border-width: 3px;
}

.diagram-box strong {
    color: #333;
    display: block;
    margin-bottom: 4px;
}

.diagram-box code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #495057;
}

.diagram-arrow {
    font-size: 24px;
    color: #666;
    font-weight: bold;
}

.diagram-spacer {
    min-width: 140px;
}

.status-success {
    display: inline-block;
    background: #c8e6c9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.status-fail {
    display: inline-block;
    background: #ffcdd2;
    color: #c62828;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .text-diagram {
        padding: 15px 10px;
    }
    
    .diagram-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .diagram-box {
        width: 100%;
        max-width: 280px;
    }
    
    .diagram-arrow {
        transform: rotate(90deg);
    }
    
    .diagram-spacer {
        display: none;
    }
}

/* ASCII流程图样式 */
.nat-flow-chart {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 0 0 16px 0;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
    overflow-x: auto;
    white-space: pre;
}

/* 流程图中的关键元素着色 */
.nat-flow-chart {
    /* 使用CSS变量来控制颜色 */
    --success-color: #10b981;
    --fail-color: #ef4444;
    --network-color: #3b82f6;
    --device-color: #8b5cf6;
}

/* 图例说明 */
.diagram-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 13px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-icon {
    font-weight: bold;
}

.legend-icon.success {
    color: #10b981;
}

.legend-icon.fail {
    color: #ef4444;
}

.legend-icon.arrow {
    color: #6b7280;
}

/* 工作原理折叠区域 */
.nat-diagram-toggle {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.diagram-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.diagram-toggle-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}

.diagram-toggle-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.diagram-toggle-btn .toggle-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.diagram-toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

.nat-diagram-content {
    margin-top: 16px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.diagram-note {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    color: #1e40af;
    line-height: 1.6;
}

.diagram-note strong {
    color: #1e3a8a;
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 卡片容器 */
    .info-cards {
        padding: 0 12px;
        gap: 20px;
    }

    /* 卡片样式 */
    .info-card {
        padding: 20px 16px;
        border-radius: 12px;
    }

    /* 卡片头部 */
    .info-card-header {
        gap: 12px;
        margin-bottom: 16px;
    }

    .card-icon {
        width: 44px;
        height: 44px;
        padding: 10px;
        border-radius: 12px;
    }

    .info-card h3 {
        font-size: 17px;
        line-height: 1.3;
    }

    /* 徽章 */
    .card-badge {
        position: static;
        display: inline-block;
        margin-top: 12px;
        padding: 4px 10px;
        font-size: 11px;
    }

    /* 卡片内容 */
    .info-card-content {
        margin-bottom: 16px;
    }

    .info-card p {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 12px;
    }

    /* 图例 - 移动端垂直排列 */
    .diagram-legend {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        font-size: 13px;
        margin-bottom: 12px;
        background: #f9fafb;
        border-radius: 8px;
    }

    .legend-item {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .legend-icon {
        font-size: 16px;
        font-weight: bold;
        min-width: 24px;
    }

    /* 流程图容器 - 添加滚动 */
    .nat-diagram-content {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;  /* 限制最大宽度为视口宽度 */
        margin: 0 -16px;  /* 负边距让滚动区域延伸到卡片边缘 */
        padding: 0 16px;  /* 内边距保持内容对齐 */
    }

    /* 流程图 - 让内容自然撑开 */
    .nat-flow-chart {
        font-size: 11px;
        padding: 16px 12px;
        line-height: 1.6;
        background: #fafafa;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 12px;
        white-space: pre !important;
        word-wrap: normal;
        word-break: keep-all;
        /* 让内容自然宽度显示 */
        display: inline-block;
        min-width: calc(100% - 32px);  /* 减去padding */
        /* 添加滚动条样式 */
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 #f1f5f9;
    }

    /* 确保pre标签内容不被压缩 */
    .nat-flow-chart pre {
        margin: 0;
        white-space: pre !important;
    }

    /* WebKit浏览器滚动条样式 */
    .nat-flow-chart::-webkit-scrollbar {
        height: 8px;
    }

    .nat-flow-chart::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 4px;
    }

    .nat-flow-chart::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }

    .nat-flow-chart::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }

    /* 说明文字 */
    .diagram-note {
        padding: 12px 14px;
        font-size: 14px;
        line-height: 1.7;
        margin-top: 0;
        border-radius: 8px;
    }

    .diagram-note strong {
        display: block;
        margin-bottom: 4px;
        font-size: 15px;
    }

    /* 折叠按钮 */
    .nat-diagram-toggle {
        margin-top: 16px;
        padding-top: 16px;
    }

    .diagram-toggle-btn {
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 8px;
        font-weight: 500;
    }

    .diagram-toggle-btn .toggle-icon {
        width: 20px;
        height: 20px;
    }
}

/* 小屏手机优化 (iPhone SE等) */
@media (max-width: 375px) {
    .info-cards {
        padding: 0 8px;
        gap: 16px;
    }

    .info-card {
        padding: 16px 12px;
    }

    .info-card h3 {
        font-size: 16px;
    }

    .info-card p {
        font-size: 13px;
    }

    .card-icon {
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    /* 图例更紧凑 */
    .diagram-legend {
        padding: 10px;
        gap: 6px;
        font-size: 12px;
    }

    .legend-icon {
        font-size: 14px;
        min-width: 20px;
    }

    /* 流程图 */
    .nat-flow-chart {
        font-size: 10px;  /* 增大字体 */
        padding: 12px 8px;
        line-height: 1.5;
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        white-space: pre !important;
        word-wrap: normal;
        word-break: keep-all;
        max-width: 100%;
        width: 100%;
        display: inline-block;  /* inline-block让内容撑开 */
    }

    /* 说明文字 */
    .diagram-note {
        font-size: 13px;
        padding: 10px 12px;
    }

    .diagram-note strong {
        font-size: 14px;
    }

    /* 折叠按钮 */
    .diagram-toggle-btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .diagram-toggle-btn .toggle-icon {
        width: 18px;
        height: 18px;
    }
}

/* 移动端触摸优化 */
@media (max-width: 767px) {
    /* 按钮触摸反馈 */
    .test-btn {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
        min-height: 44px;
        min-width: 120px;
        cursor: pointer;
        position: relative;
        z-index: 10;
    }

    .test-btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    /* 确保按钮可点击 */
    .test-btn:disabled {
        pointer-events: none;
        opacity: 0.6;
    }

    /* 整个测试卡片区域触摸优化 */
    .test-card {
        touch-action: pan-y;
    }

    /* 测试操作区域 */
    .test-actions {
        position: relative;
        z-index: 5;
    }

    /* 确保测试结果区域不会阻挡点击 */
    .test-result {
        pointer-events: none;
    }

    .test-result * {
        pointer-events: auto;
    }

    /* 按钮按下效果类（由JS添加） */
    .test-btn.btn-pressed {
        transform: scale(0.97) !important;
        opacity: 0.9 !important;
    }

    /* 修复iOS上的点击延迟 */
    .test-btn,
    .test-btn * {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    /* 确保SVG图标不会阻挡点击 */
    .test-btn svg {
        pointer-events: none;
    }

    /* 确保按钮容器不会被其他元素遮挡 */
    .test-actions {
        position: relative;
        z-index: 100;
    }

    /* 确保状态区域不会覆盖按钮 */
    .test-status {
        position: relative;
        z-index: 1;
    }
}
