/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    padding: 40px 45px;
}

/* ===== 头部 ===== */
.header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid #f0f2f5;
}

.header .logo {
    font-size: 14px;
    color: #667eea;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.header h1 {
    font-size: 34px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.5px;
}

.header h1 .highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header .subtitle {
    color: #8b8fa3;
    font-size: 15px;
    margin-top: 8px;
    font-weight: 400;
}

/* ===== 语言切换 - 右上角 ===== */
.lang-switcher {
    text-align: right;
    padding: 0 0 10px 0;
    margin-bottom: 4px;
}

.lang-switcher .lang-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 8px;
    margin-bottom: 3px;
}

.lang-switcher .lang-row:last-child {
    margin-bottom: 0;
}

.lang-switcher .lang-link {
    color: #8b8fa3;
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-block;
    font-size: 12px;
    white-space: nowrap;
}

.lang-switcher .lang-link:hover {
    color: #667eea;
    background: #eef1ff;
}

.lang-switcher .lang-link.active {
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-weight: 500;
}

/* ===== RTL 支持 ===== */
.rtl .lang-switcher {
    text-align: left;
}

.rtl .lang-switcher .lang-row {
    justify-content: flex-start;
}

.rtl .info-item .value {
    text-align: left;
}

.rtl .suffix-tags {
    justify-content: flex-end !important;
}

.rtl .country-detail-grid .country-detail-item {
    align-items: flex-end;
}

.rtl .result-header .query-ip small {
    margin-left: 0;
    margin-right: 8px;
}

.rtl .query-stats .stat-item {
    margin-left: 0;
    margin-right: 24px;
}

.rtl .tag {
    margin-left: 0;
    margin-right: 4px;
}

.rtl .speed-item .speed-name {
    text-align: right;
}

.rtl .speed-item .speed-time {
    text-align: left;
}

.rtl .relation-item .rel-detail .rel-count {
    margin-right: 4px;
}

/* ===== 搜索框 ===== */
.search-box {
    padding: 0 0 28px 0;
    margin-bottom: 32px;
    border-bottom: 2px solid #f0f2f5;
}

.form-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-group input {
    flex: 1;
    min-width: 200px;
    padding: 14px 22px;
    border: 2px solid #e0e4ec;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s;
    outline: none;
    background: #fafbfc;
    color: #1a1a2e;
}

.form-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: #ffffff;
}

.form-group input::placeholder {
    color: #b0b8c8;
}

.form-group button {
    padding: 14px 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

.form-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.35);
}

.form-group button:active {
    transform: scale(0.97);
}

.error-box {
    margin-top: 16px;
    padding: 14px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #b91c1c;
    font-weight: 500;
    font-size: 14px;
}

/* ===== 统计信息 ===== */
.stats-top {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: #f7f8fc;
    padding: 14px 12px;
    border-radius: 12px;
    border: 1px solid #e8eaf0;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.stat-card .num {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-card .num.gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card .label {
    font-size: 12px;
    color: #8b8fa3;
    display: block;
    margin-top: 4px;
}

/* ===== 查询结果 ===== */
.result-section {
    animation: fadeIn 0.4s ease;
    margin-bottom: 28px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, #f7f8fc 0%, #eef1ff 100%);
    border-radius: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.result-header .query-ip {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

.result-header .query-ip .emoji {
    font-size: 28px;
    margin-right: 6px;
}

.result-header .query-ip small {
    font-weight: 400;
    font-size: 14px;
    color: #8b8fa3;
    margin-left: 8px;
}

.badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.query-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.query-stats .stat-item {
    font-size: 13px;
    color: #8b8fa3;
}

.query-stats .stat-item strong {
    color: #1a1a2e;
    font-weight: 600;
}

.query-stats .stat-item .count-num {
    color: #667eea;
    font-weight: 700;
    font-size: 17px;
}

/* ===== 信息网格 ===== */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 30px;
    background: #fafbfc;
    border-radius: 14px;
    padding: 6px 24px;
    border: 1px solid #e8eaf0;
}

.info-item {
    padding: 14px 0;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-item:last-child,
.info-item:nth-last-child(2) {
    border-bottom: none;
}

.info-item .label {
    color: #8b8fa3;
    font-size: 13px;
    font-weight: 500;
    min-width: 76px;
}

.info-item .value {
    color: #1a1a2e;
    font-size: 14px;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
    max-width: 60%;
}

.info-full {
    grid-column: 1 / -1;
}

.tag {
    display: inline-block;
    padding: 3px 16px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 4px;
}

.tag.green {
    background: #d1fae5;
    color: #065f46;
}

.tag.red {
    background: #fee2e2;
    color: #991b1b;
}

.tag.gray {
    background: #e5e7eb;
    color: #374151;
}

.tag.blue {
    background: #dbeafe;
    color: #1e40af;
}

.tag.orange {
    background: #fef3c7;
    color: #92400e;
}

/* ===== 国家详细信息 ===== */
.country-detail-section {
    margin-top: 16px;
    padding: 16px 20px;
    background: #f7f8fc;
    border-radius: 12px;
    border: 1px solid #e8eaf0;
}

.country-detail-section .detail-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.country-detail-section .detail-title .country-name {
    color: #667eea;
}

.country-detail-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.country-detail-item {
    display: flex;
    flex-direction: column;
}

.country-detail-item .cd-label {
    font-size: 11px;
    color: #8b8fa3;
}

.country-detail-item .cd-value {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a2e;
    margin-top: 2px;
}

.suffix-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e8eaf0;
}

.suffix-section .suffix-title {
    font-size: 12px;
    font-weight: 500;
    color: #8b8fa3;
    margin-bottom: 6px;
}

/* ===== DNS记录 ===== */
.dns-section {
    margin-top: 16px;
    padding: 16px 20px;
    background: #f7f8fc;
    border-radius: 12px;
    border: 1px solid #e8eaf0;
}

.dns-section .dns-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dns-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.dns-table th {
    background: #eef1ff;
    color: #1a1a2e;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #e8eaf0;
}

.dns-table td {
    padding: 8px 12px;
    border: 1px solid #e8eaf0;
    word-break: break-all;
    color: #1a1a2e;
}

.dns-table tr:nth-child(even) {
    background: #fafbfc;
}

.dns-table .dns-empty {
    color: #b0b8c8;
    text-align: center;
    padding: 20px;
}

/* ===== 速度对比 ===== */
.speed-section {
    margin-top: 16px;
    padding: 16px 20px;
    background: #f7f8fc;
    border-radius: 12px;
    border: 1px solid #e8eaf0;
}

.speed-section .speed-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.speed-loading {
    text-align: center;
    padding: 20px;
    color: #8b8fa3;
    font-size: 14px;
}

.speed-loading .spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.speed-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e8eaf0;
    transition: all 0.2s;
}

.speed-item:hover {
    border-color: #667eea;
}

.speed-item .speed-name {
    font-weight: 500;
    color: #1a1a2e;
    font-size: 14px;
    min-width: 100px;
}

.speed-item .speed-bar-wrap {
    flex: 1;
    height: 20px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 16px;
    position: relative;
}

.speed-item .speed-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.6s ease;
    width: 0%;
}

.speed-item .speed-bar-fill.slow {
    background: linear-gradient(90deg, #FF9800, #F44336);
}

.speed-item .speed-bar-fill.fast {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.speed-item .speed-time {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 14px;
    min-width: 80px;
    text-align: right;
}

.speed-item .speed-time.timeout {
    color: #f44336;
}

.speed-item .speed-badge {
    font-size: 11px;
    padding: 2px 12px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 500;
}

.speed-item .speed-badge.first {
    background: #ffd700;
    color: #8B7500;
}

.speed-item .speed-badge.user {
    background: #667eea;
    color: #fff;
}

/* ===== 同IP网站 / IP反查域名 ===== */
.relation-section {
    margin-top: 20px;
    padding: 18px 24px;
    background: #f7f8fc;
    border-radius: 14px;
    border: 1px solid #e8eaf0;
}

.relation-section .relation-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.relation-section .relation-title .rel-count {
    background: #e5e7eb;
    padding: 2px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.relation-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.relation-item {
    background: #ffffff;
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid #e8eaf0;
    transition: all 0.2s;
    text-align: center;
}

.relation-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.08);
    transform: translateY(-2px);
}

.relation-item .rel-domain {
    font-weight: 500;
    color: #1a1a2e;
    font-size: 14px;
    word-break: break-all;
}

.relation-item .rel-detail {
    font-size: 11px;
    color: #8b8fa3;
    margin-top: 4px;
}

.relation-item .rel-detail .rel-count {
    color: #667eea;
    font-weight: 500;
}

.relation-empty {
    color: #b0b8c8;
    text-align: center;
    padding: 24px 0;
    font-size: 14px;
    grid-column: 1 / -1;
}

/* ===== 最近查询 ===== */
.recent-section {
    margin-top: 10px;
    padding-top: 24px;
    border-top: 2px solid #f0f2f5;
}

.recent-section .section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recent-section .section-title .badge-count {
    background: #e5e7eb;
    padding: 2px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.recent-grid .recent-card {
    background: #f7f8fc;
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid #e8eaf0;
    transition: all 0.25s;
    cursor: default;
}

.recent-grid .recent-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.08);
}

.recent-card .rc-query {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a2e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.recent-card .rc-query .rc-type {
    font-weight: 400;
    font-size: 10px;
    background: #e5e7eb;
    padding: 1px 12px;
    border-radius: 10px;
    color: #6b7280;
}

.recent-card .rc-detail {
    font-size: 12px;
    color: #8b8fa3;
}

.recent-card .rc-detail .rc-location {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-card .rc-detail .rc-time {
    font-size: 10px;
    color: #b0b8c8;
    display: block;
    margin-top: 2px;
}

.recent-card .rc-count {
    font-size: 11px;
    color: #667eea;
    font-weight: 500;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.recent-empty {
    color: #b0b8c8;
    text-align: center;
    padding: 40px 0;
    font-size: 15px;
    grid-column: 1 / -1;
}

/* ===== 网站介绍 ===== */
.site-intro {
    margin-top: 32px;
    padding: 24px 28px;
    background: linear-gradient(135deg, #f7f8fc 0%, #eef1ff 100%);
    border-radius: 14px;
    border-left: 4px solid #667eea;
    line-height: 2;
}

.site-intro .intro-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.site-intro .intro-title .highlight {
    color: #667eea;
}

.site-intro p {
    color: #374151;
    font-size: 14px;
    margin-bottom: 8px;
}

.site-intro .feature-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 30px;
    margin: 10px 0;
    padding-left: 0;
    list-style: none;
}

.site-intro .feature-list li {
    color: #374151;
    font-size: 14px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-intro .feature-list li::before {
    content: "✅";
    font-size: 14px;
}

.site-intro .tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.site-intro .tech-stack .tech-tag {
    background: #ffffff;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    color: #667eea;
    border: 1px solid #dbeafe;
    font-weight: 500;
}

/* ===== 商业化信息 ===== */
.business-info-section {
    background: linear-gradient(135deg, #fff9ef, #ffefdf);
    border-radius: 24px;
    padding: 30px 35px;
    margin: 30px 0 20px;
    border: 2px solid #c97e2c;
}

.business-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    text-align: center;
    justify-content: center;
}

.business-info-header .business-icon {
    font-size: 32px;
}

.business-info-header h3 {
    font-size: 24px;
    color: #6b3a1c;
    margin: 0;
}

.business-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.business-version {
    background: white;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    border: 1px solid #ffe0b5;
    transition: all 0.3s ease;
}

.business-version:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(201, 126, 44, 0.15);
}

.business-version.hot {
    border-color: #c97e2c;
    box-shadow: 0 4px 20px rgba(201, 126, 44, 0.2);
}

.business-version.pro {
    border-color: #b8860b;
    background: linear-gradient(135deg, #fffdf5, #fdf6e3);
}

.version-tag {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #f0e6d8;
    color: #6b3a1c;
    margin-bottom: 10px;
}

.business-version.hot .version-tag {
    background: #c97e2c;
    color: white;
}

.business-version.pro .version-tag {
    background: #b8860b;
    color: white;
}

.version-price {
    font-size: 32px;
    font-weight: 800;
    color: #c97e2c;
    margin: 8px 0;
}

.version-price:before {
    content: '¥';
    font-size: 20px;
}

.version-desc {
    font-size: 14px;
    color: #6b4c3b;
    margin-bottom: 12px;
    line-height: 1.6;
}

.business-version ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.business-version ul li {
    font-size: 13px;
    color: #4a2a1a;
    padding: 4px 0;
    border-bottom: 1px solid #f5ede5;
}

.business-version ul li:last-child {
    border-bottom: none;
}

.business-contact {
    text-align: center;
    padding-top: 18px;
    margin-top: 18px;
    border-top: 2px solid #ffe0b5;
}

.business-contact p {
    margin: 6px 0;
    font-size: 15px;
    color: #4a2a1a;
}

.business-contact a {
    color: #c97e2c;
    text-decoration: none;
    font-weight: 600;
}

.business-contact a:hover {
    text-decoration: underline;
}

.business-tip {
    color: #b97f52;
    font-size: 14px;
    margin-top: 10px !important;
    font-weight: 500;
}

/* ===== 底部 ===== */
.client-ip-info {
    font-size: 12px;
    color: #b0b8c8;
    text-align: center;
    margin-top: 12px;
    padding: 10px;
    background: #f7f8fc;
    border-radius: 10px;
    border: 1px solid #e8eaf0;
}

/* ========== AI客服按钮 ========== */
.float-ai-btn {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 68px;
    height: 86px;
    border-radius: 16px 0 0 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    box-shadow: -4px 0 25px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    gap: 2px;
}

.float-ai-btn .avatar-carousel {
    width: 48px;
    height: 42px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.float-ai-btn .avatar-carousel .avatar-track {
    display: flex;
    flex-direction: column;
    animation: avatarSlide 24s ease-in-out infinite;
}

.float-ai-btn:hover .avatar-carousel .avatar-track {
    animation-play-state: paused;
}

.float-ai-btn .avatar-carousel .avatar-item {
    width: 48px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.float-ai-btn .avatar-carousel .avatar-item img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    object-fit: cover;
    background: white;
}

@keyframes avatarSlide {
    0%,
    5% {
        transform: translateY(0);
    }
    10%,
    15% {
        transform: translateY(-42px);
    }
    20%,
    25% {
        transform: translateY(-84px);
    }
    30%,
    35% {
        transform: translateY(-126px);
    }
    40%,
    45% {
        transform: translateY(-168px);
    }
    50%,
    55% {
        transform: translateY(-210px);
    }
    60%,
    65% {
        transform: translateY(-252px);
    }
    70%,
    75% {
        transform: translateY(-294px);
    }
    80%,
    85% {
        transform: translateY(-336px);
    }
    90%,
    95% {
        transform: translateY(-378px);
    }
    100% {
        transform: translateY(0);
    }
}

.float-ai-btn .btn-label {
    font-size: 0.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.2);
    padding: 1px 8px;
    border-radius: 10px;
}

.float-ai-btn .badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 1;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.float-ai-btn:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46a0);
    transform: translateY(-50%) scale(1.03);
    box-shadow: -4px 0 35px rgba(102, 126, 234, 0.55);
}

/* ========== AI聊天窗口 ========== */
.ai-chat-window {
    position: fixed;
    top: 50%;
    right: -420px;
    transform: translateY(-50%);
    width: 400px;
    max-width: calc(100vw - 20px);
    max-height: 80vh;
    background: white;
    border-radius: 20px 0 0 20px;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-right: none;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-window.active {
    right: 0;
}

.ai-chat-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ai-chat-header .ai-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-header .ai-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.ai-chat-header .ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-chat-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.ai-chat-header .ai-status {
    font-size: 0.65rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-header .ai-status .queue-info {
    background: rgba(255, 255, 255, 0.2);
    padding: 0 8px;
    border-radius: 10px;
    font-size: 0.6rem;
}

.ai-chat-header button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-chat-header button:hover {
    opacity: 1;
}

.ai-chat-messages {
    flex: 1;
    padding: 14px 16px;
    overflow-y: auto;
    max-height: 420px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.user-info-row {
    text-align: right;
    margin-bottom: 2px;
    padding-right: 4px;
    font-weight: 600;
    font-size: 0.82rem;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 6px;
}

.user-info-row .user-emoji {
    font-size: 1.2rem;
}

.agent-info-row {
    text-align: left;
    margin-bottom: 2px;
    padding-left: 4px;
    font-weight: 600;
    font-size: 0.82rem;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.agent-info-row .agent-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
}

.agent-info-row .agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-msg {
    margin-bottom: 2px;
    max-width: 88%;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.6;
    word-wrap: break-word;
    clear: both;
    margin-top: 0;
}

.ai-msg.user {
    background: #667eea;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-msg.bot {
    background: white;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ai-msg .typing {
    display: inline-block;
    animation: dot 1.2s infinite;
}

@keyframes dot {
    0%,
    60%,
    100% {
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
}

.ai-chat-input-area {
    padding: 10px 14px;
    border-top: 1px solid #e2e8f0;
    background: white;
    flex-shrink: 0;
}

.ai-chat-input-area .ai-input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.ai-chat-input-area .ai-input-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.8rem;
    outline: none;
    background: #f8fafc;
    min-width: 0;
}

.ai-chat-input-area .ai-input-row input:focus {
    border-color: #667eea;
    background: white;
}

.ai-chat-input-area .ai-validate-tip {
    font-size: 0.65rem;
    min-height: 14px;
    color: #ef4444;
}

.ai-chat-input-area .ai-validate-tip.valid {
    color: #10b981;
}

.ai-chat-input-area .ai-chat-send-row {
    display: flex;
    gap: 6px;
}

.ai-chat-input-area .ai-chat-send-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
}

.ai-chat-input-area .ai-chat-send-row input:focus {
    border-color: #667eea;
}

.ai-chat-input-area .ai-chat-send-row button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 18px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.ai-chat-input-area .ai-chat-send-row button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.ai-chat-input-area .ai-chat-send-row button:hover:not(:disabled) {
    opacity: 0.9;
}

.ai-chat-input-area .ai-tip {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 4px;
    text-align: center;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .recent-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .relation-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .country-detail-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .site-intro .feature-list {
        grid-template-columns: 1fr;
    }
    .speed-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    .speed-item .speed-bar-wrap {
        flex: 1 1 100%;
        margin: 4px 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 24px 18px;
    }
    .header h1 {
        font-size: 26px;
    }
    .form-group input {
        min-width: 100%;
    }
    .form-group button {
        width: 100%;
        justify-content: center;
    }
    .info-grid {
        grid-template-columns: 1fr;
        padding: 4px 16px;
    }
    .info-item {
        flex-wrap: wrap;
        gap: 4px;
    }
    .info-item .value {
        max-width: 100%;
        text-align: left;
    }
    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .stats-top {
        grid-template-columns: repeat(3, 1fr);
    }
    .recent-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .relation-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .country-detail-grid {
        grid-template-columns: 1fr 1fr;
    }
    .search-box {
        padding: 0 0 20px 0;
    }
    .dns-table {
        font-size: 12px;
    }
    .dns-table th,
    .dns-table td {
        padding: 6px 8px;
    }
    .speed-item .speed-name {
        min-width: 70px;
        font-size: 13px;
    }
    .speed-item .speed-time {
        min-width: 60px;
        font-size: 13px;
    }
    .site-intro {
        padding: 18px 16px;
    }
    .site-intro .feature-list li {
        font-size: 13px;
    }

    /* 语言切换 - 移动端居中 */
    .lang-switcher {
        text-align: center;
    }
    .lang-switcher .lang-row {
        justify-content: center;
    }
    .lang-switcher .lang-link {
        font-size: 11px;
        padding: 2px 7px;
    }
    .lang-switcher .lang-row {
        gap: 2px 5px;
    }
    .rtl .lang-switcher {
        text-align: center;
    }
    .rtl .lang-switcher .lang-row {
        justify-content: center;
    }

    /* 商业化信息 - 移动端 */
    .business-info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .business-info-section {
        padding: 20px;
    }
    .business-info-header h3 {
        font-size: 18px;
    }
    .version-price {
        font-size: 26px;
    }

    /* AI客服 - 移动端 */
    .float-ai-btn {
        width: 56px;
        height: 70px;
        padding: 4px 3px;
    }
    .float-ai-btn .avatar-carousel {
        width: 40px;
        height: 34px;
    }
    .float-ai-btn .avatar-carousel .avatar-item {
        width: 40px;
        height: 34px;
    }
    .float-ai-btn .avatar-carousel .avatar-item img {
        width: 28px;
        height: 28px;
    }
    @keyframes avatarSlide {
        0%,
        5% {
            transform: translateY(0);
        }
        10%,
        15% {
            transform: translateY(-34px);
        }
        20%,
        25% {
            transform: translateY(-68px);
        }
        30%,
        35% {
            transform: translateY(-102px);
        }
        40%,
        45% {
            transform: translateY(-136px);
        }
        50%,
        55% {
            transform: translateY(-170px);
        }
        60%,
        65% {
            transform: translateY(-204px);
        }
        70%,
        75% {
            transform: translateY(-238px);
        }
        80%,
        85% {
            transform: translateY(-272px);
        }
        90%,
        95% {
            transform: translateY(-306px);
        }
        100% {
            transform: translateY(0);
        }
    }
    .ai-chat-window {
        width: calc(100vw - 16px);
        right: calc(-100vw + 16px);
        max-height: 85vh;
        border-radius: 16px 0 0 16px;
        top: 50%;
        transform: translateY(-50%);
    }
    .ai-chat-window.active {
        right: 0;
    }
    .ai-chat-messages {
        max-height: 340px;
    }
    .ai-chat-input-area .ai-input-row {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .stats-top {
        grid-template-columns: 1fr 1fr;
    }
    .recent-grid {
        grid-template-columns: 1fr 1fr;
    }
    .relation-grid {
        grid-template-columns: 1fr 1fr;
    }
    .country-detail-grid {
        grid-template-columns: 1fr;
    }
    .recent-grid .recent-card {
        padding: 12px;
    }
    .container {
        padding: 16px 12px;
        border-radius: 16px;
    }
    .site-intro .feature-list {
        grid-template-columns: 1fr;
    }

    .lang-switcher .lang-link {
        font-size: 10px;
        padding: 2px 5px;
    }
    .lang-switcher .lang-row {
        gap: 1px 3px;
    }

    /* AI客服 - 小屏手机 */
    .float-ai-btn {
        width: 46px;
        height: 58px;
        padding: 3px 2px;
    }
    .float-ai-btn .avatar-carousel {
        width: 34px;
        height: 28px;
    }
    .float-ai-btn .avatar-carousel .avatar-item {
        width: 34px;
        height: 28px;
    }
    .float-ai-btn .avatar-carousel .avatar-item img {
        width: 22px;
        height: 22px;
    }
    .float-ai-btn .btn-label {
        font-size: 0.4rem;
        padding: 0 5px;
    }
    @keyframes avatarSlide {
        0%,
        5% {
            transform: translateY(0);
        }
        10%,
        15% {
            transform: translateY(-28px);
        }
        20%,
        25% {
            transform: translateY(-56px);
        }
        30%,
        35% {
            transform: translateY(-84px);
        }
        40%,
        45% {
            transform: translateY(-112px);
        }
        50%,
        55% {
            transform: translateY(-140px);
        }
        60%,
        65% {
            transform: translateY(-168px);
        }
        70%,
        75% {
            transform: translateY(-196px);
        }
        80%,
        85% {
            transform: translateY(-224px);
        }
        90%,
        95% {
            transform: translateY(-252px);
        }
        100% {
            transform: translateY(0);
        }
    }
    .ai-chat-window {
        width: calc(100vw - 8px);
        right: calc(-100vw + 8px);
        border-radius: 12px 0 0 12px;
    }
    .ai-chat-messages {
        max-height: 280px;
        padding: 10px 12px;
    }
    .ai-msg {
        font-size: 0.82rem;
        padding: 6px 12px;
        max-width: 92%;
    }
}