/* ========== 完全复用统一的全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

body {
    background-color: #f5f7fa;
    padding: 0;
    min-width: 1200px; /* 电脑端最小宽度 */
}

/* ========== 统一风格的导航栏 ========== */
.navbar {
    background-color: #28a745; /* 统一绿色导航栏 */
    color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 999;
}
.navbar-container {
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-logo {
    font-size: 20px;
    font-weight: 700;
}
.navbar-menu {
    display: flex;
    gap: 30px;
}
.navbar-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.3s;
}
.navbar-menu a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ========== 统一风格的页脚 ========== */
.footer {
    background-color: #333;
    color: #ccc;
    padding: 20px 15px;
    margin-top: 40px;
}
.footer-container {
    max-width: 1920px;
    margin: 0 auto;
}
.footer-copyright {
    text-align: center;
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

/* ========== 容器样式（适配统一风格） ========== */
.container {
    width: 98%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 15px;
}
.container-inner {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    padding: 30px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* ========== 模块样式（统一风格） ========== */
.module {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}
.title-btn-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e9f0;
}
.title-btn-container h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
    padding-left: 10px;
    border-left: 4px solid #28a745;
}
.card-link-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #28a745;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.2s;
}
.card-link-btn:hover {
    background: #218838;
}

/* ========== 表单样式（统一风格） ========== */
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e5e9f0;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}
.form-control:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn:hover {
    background-color: #218838;
}

/* ========== 结果区域（核心：解决所有问题） ========== */
.result-area {
    margin-top: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e9f0;
    overflow: hidden !important; /* 强制隐藏所有滚动条 */
    box-sizing: border-box;
    height: 30px; /* 你想调多高就改这里！比如40px/50px，文字永远居中 */
    display: flex; /* 弹性布局居中 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    padding: 0 !important; /* 清空内边距，高度完全由你控制 */
}

/* 初始提示文字 - 适配任意高度容器 */
.result-area .initial-loading {
    color: #28a745;
    font-size: 14px;
    margin: 0;
    padding: 0;
    line-height: normal; /* 取消行高绑定 */
}

/* 追踪中/错误提示 - 同样居中 */
.result-loading:not(.initial-loading),
.result-error {
    color: #28a745;
    font-size: 14px;
    margin: 0;
    padding: 0;
}

/* 表格区域 - 单独适配，不影响初始状态 */
.result-area:has(.result-table) {
    height: auto !important; /* 表格高度自适应 */
    display: block !important; /* 恢复块布局 */
    padding: 20px !important; /* 表格加内边距 */
    overflow-x: auto !important; /* 仅表格显示横向滚动条 */
}

/* 表格样式 */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    table-layout: fixed;
}
.result-table th, .result-table td {
    padding: 12px 15px;
    border: 1px solid #e5e9f0;
    text-align: left;
    word-wrap: break-word;
}
.result-table th {
    background-color: #f0f8f4;
    color: #28a745;
    font-weight: 600;
}
.result-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* ========== 状态样式 ========== */
.delay-low { color: #28a745; font-weight: 500; }
.delay-mid { color: #f59e0b; font-weight: 500; }
.delay-high { color: #ef4444; font-weight: 500; }
.error-msg { color: #ef4444; margin-bottom: 10px; padding: 8px; background: #fff1f0; border-radius: 4px; }

/* ========== 历史记录样式 ========== */
.history-display-area {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e9f0;
}
.history-display-area h4 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}
.history-item {
    text-decoration: none;
    color: #333;
    cursor: pointer;
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
    margin: 0;
}
.history-item:hover {
    background: #e8f4f8;
    border-color: #28a745;
    color: #28a745;
}

/* ========== 文章模块样式（匹配DNS工具说明区域） ========== */
.mod-article {
    margin-top: 20px;
    background: #f0f8fb; /* 匹配DNS模块浅蓝背景 */
    border-left: 3px solid #28a745; /* 左侧绿色竖线（和DNS模块一致） */
    padding: 18px 22px; /* 内边距匹配DNS模块 */
    border-radius: 0 6px 6px 0; /* 右侧圆角 */
    color: #333; /* 统一文字颜色 */
    font-size: 14px; /* 统一文字大小 */
    line-height: 1.8; /* 行高匹配DNS模块 */
}
.mod-article .hd {
    margin-bottom: 0; /* 取消标题底部间距 */
}
.mod-article .title {
    color: #333; /* 主标题改为黑色（匹配DNS模块） */
    font-size: 16px; 
    font-weight: 600;
    margin-bottom: 12px;
    position: relative;
    padding-left: 18px; /* 给红色箭头留位置 */
}
/* 红色小箭头（和DNS模块一致） */
.mod-article .title::before {
    content: "✦";
    position: absolute;
    left: 0;
    top: 2px;
    color: #dc3545; /* 红色箭头 */
    font-size: 12px;
}
.mod-article .bd {
    line-height: 1.8;
    color: #333;
    font-size: 14px;
}
/* 子标题样式（匹配DNS模块） */
.mod-article .bd h4 {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin: 15px 0 10px 0;
    position: relative;
    padding-left: 18px; /* 给红色箭头留位置 */
}
.mod-article .bd h4::before {
    content: "✦";
    position: absolute;
    left: 0;
    top: 2px;
    color: #dc3545; /* 红色箭头 */
    font-size: 12px;
}
/* 段落样式（匹配DNS模块） */
.mod-article .bd p {
    margin: 0 0 10px 0;
    padding: 0;
}

/* ========== 路由追踪核心布局 ========== */
.traceroute-container { margin-bottom: 24px; }
.traceroute-top { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.traceroute-input { flex: 1; padding: 16px 20px; border: 1px solid #e5e7eb; border-radius: 12px; font-size: 16px; background: #fff; }
.traceroute-btn { padding: 16px 40px; background: #22c55e; color: #fff; border: none; border-radius: 12px; font-size: 18px; cursor: pointer; transition: background 0.3s; }
.traceroute-btn:hover { background: #16a34a; }

/* 选项区样式 */
.traceroute-options { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.option-group { display: flex; align-items: center; gap: 12px; }
.option-group label { font-size: 16px; color: #374151; }
.node-select { padding: 12px 16px; border: 1px solid #e5e7eb; border-radius: 12px; font-size: 16px; min-width: 280px; }
.dns-group { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 16px; color: #374151; }
.radio-label input[type="radio"] { width: 20px; height: 20px; accent-color: #2563eb; }
.dns-input { padding: 12px 16px; border: 1px solid #e5e7eb; border-radius: 12px; font-size: 16px; min-width: 280px; }

/* 检测中提示样式 */
#loading {
    display: none;
    text-align: center;
    font-size: 16px;
    color: #007bff;
    padding: 12px;
    font-weight: 500;
    background: #e8f4fd;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #b8daff;
}

/* ========== 响应式适配（仅保留必要逻辑，无冲突） ========== */
@media only screen and (max-width: 767px) {
    body {
        min-width: unset !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }
    .container {
        width: 100% !important;
        padding: 0 10px !important;
    }
    .container-inner {
        padding: 15px !important;
        margin: 10px auto !important;
        border-radius: 8px !important;
    }

    /* 导航栏适配 */
    .navbar {
        padding: 10px 15px !important;
    }
    .navbar-container {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }
    .navbar-menu {
        gap: 10px !important;
        flex-wrap: wrap !important;
        width: 100% !important;
    }
    .navbar-menu a {
        font-size: 12px !important;
    }

    /* 标题按钮区适配 */
    .title-btn-container {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    .card-link-btn, .btn {
        width: 100% !important;
        text-align: center !important;
    }

    .module {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }

    /* 路由追踪布局适配 */
    .traceroute-top {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .traceroute-input,
    .traceroute-btn {
        width: 100% !important;
    }

    .traceroute-options,
    .option-group,
    .dns-group {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        width: 100% !important;
    }
    .node-select,
    .dns-input {
        min-width: unset !important;
        width: 100% !important;
    }

    /* 历史记录适配 */
    .history-items {
        max-height: 120px !important;
        gap: 6px !important;
    }
    .history-item {
        font-size: 12px !important;
        padding: 5px 10px !important;
    }

    /* 结果区域手机端适配（核心：继承PC端的弹性居中） */
    .result-area {
        height: 40px !important; /* 手机端默认高度，可改 */
    }
    .result-table {
        min-width: 600px !important;
        font-size: 12px !important;
    }
    .result-table th,
    .result-table td {
        padding: 8px 10px !important;
    }
}