* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    min-height: 100vh;
    font-size: 18px;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    padding: 30px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.3);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08) 0%, transparent 50%),
                      radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 50%);
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f97316, #fb923c, #f97316);
}

.logo {
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.logo-text {
    font-size: 34px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 4px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.search-box {
    display: flex;
    max-width: 900px;
    width: 95%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    background-color: #ffffff;
}

.search-input {
    flex: 1;
    width: 100%;
    padding: 18px 54px 18px 24px;
    font-size: 18px;
    border: none;
    outline: none;
    background-color: #ffffff;
    color: #1e293b;
    transition: all 0.3s ease;
}

.search-input:focus {
    background-color: #f8fafc;
}

.search-input::placeholder {
    color: #94a3b8;
}

.search-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.search-clear.show {
    opacity: 1;
    visibility: visible;
}

.search-clear:hover {
    color: #64748b;
    background-color: #eef2f7;
}

.search-clear:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}

.search-btn {
    padding: 18px 45px;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

.search-btn:hover {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    transform: translateY(-1px);
}

.search-btn:active {
    transform: translateY(0);
}

.main {
    flex: 1;
    padding: 30px 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.result-container {
    background-color: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
}

.result-header {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    padding: 16px 20px;
    text-align: center;
    position: relative;
}

.result-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #22c55e, #3b82f6, #f97316);
}

.result-title {
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 3px;
}

.result-content {
    padding: 0;
    max-height: none;
    overflow-y: visible;
}

.result-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    padding: 20px 32px;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
    transition: background-color 0.2s ease;
}

.result-row:hover {
    background-color: #f8fafc;
}

.result-row:last-child {
    border-bottom: none;
}

.result-row:nth-child(even) {
    background-color: #fafbfc;
}

.result-row:nth-child(even):hover {
    background-color: #f1f5f9;
}

.result-label {
    color: #64748b;
    font-size: 19px;
    font-weight: 500;
    text-align: left;
}

.result-value {
    color: #1e293b;
    font-size: 19px;
    font-weight: 500;
    text-align: center;
    word-break: break-all;
}

/* 渐进式出结果：还有字段在补时，卡片底部一行极淡提示（不画进度、不倒数） */
.result-pending {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 32px 18px;
    font-size: 13px;
    color: #94a3b8;
    letter-spacing: 0.2px;
}

.result-pending-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #3b82f6;
    animation: pending-pulse 1.3s ease-in-out infinite;
}

@keyframes pending-pulse {
    0%, 100% { opacity: 0.35; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .result-pending-dot { animation: none; opacity: 0.8; }
}

@media (max-width: 600px) {
    .result-pending { padding: 14px 20px 16px; font-size: 12.5px; }
}

#ipAddress {
    font-size: 13px;
    font-weight: 700;
    color: #1e40af;
    letter-spacing: 1px;
}

.result-value.badge {
    display: inline-block;
    padding: 7px 20px;
    border-radius: 24px;
    font-size: 17px;
    font-weight: 600;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-value.badge.green {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
}

.result-value.badge.red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
}

.result-value.badge.orange {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff;
}

.result-value.badge.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
}

.result-value.line-badge {
    background: transparent;
    color: #2563eb;
    border: none;
    box-shadow: none;
    padding: 4px 0;
    border-bottom: 2px solid #2563eb;
    border-radius: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
}

.result-value.circle-badge {
    background: #fff7ed;
    color: #ea580c;
    border: 2px solid #ea580c;
    box-shadow: none;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.result-value.badge.light-green {
    background: linear-gradient(135deg, #86efac 0%, #4ade80 100%);
    color: #166534;
}

.result-value.badge.yellow {
    background: linear-gradient(135deg, #fde047 0%, #facc15 100%);
    color: #854d0e;
}

/* 无数据 / 未知：中性灰，不暗示任何好坏（无分数时用它，绝不伪造成 50 分） */
.result-value.badge.muted {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #4b5563;
}

.private-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 20px 32px 0;
    padding: 16px 18px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%);
}

.private-notice-icon {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.private-notice-title {
    display: block;
    color: #1e3a8a;
    font-size: 18px;
    font-weight: 700;
}

.private-notice-detail {
    margin: 6px 0 0;
    color: #1e40af;
    font-size: 14px;
    line-height: 1.65;
}

.result-link {
    color: #3b82f6;
    font-size: 19px;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
}

.result-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

#coordinates {
    font-family: 'Courier New', monospace;
    color: #2563eb;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-text {
    color: #94a3b8;
    font-size: 16px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: #64748b;
    font-size: 15px;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 13px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    margin-top: 0;
}

.footer p {
    margin-bottom: 5px;
}

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

.ad-banner-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.ad-banner {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    text-decoration: none;
}

.ad-banner:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.ad-img {
    width: 100%;
    height: auto;
    display: block;
}

.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    body {
        font-size: 15px;
    }

    .header {
        padding: 20px 15px;
    }

    .logo {
        margin-bottom: 15px;
    }

    .logo-text {
        font-size: 26px;
        letter-spacing: 2px;
    }

    .search-box {
        width: 100%;
        flex-direction: column;
        border-radius: 10px;
    }

    .search-input-wrap {
        width: 100%;
    }

    .search-input {
        padding: 15px 48px 15px 18px;
        font-size: 16px;
    }

    .search-btn {
        padding: 15px;
        font-size: 16px;
    }

    .main {
        padding: 15px;
    }

    .result-container {
        border-radius: 12px;
    }

    .result-row {
        grid-template-columns: 100px 1fr;
        padding: 14px 16px;
        gap: 8px;
    }

    .result-label {
        font-size: 14px;
    }

    .result-value {
        font-size: 14px;
        text-align: left;
    }

    .result-value.badge {
        margin: 0;
    }

    .private-notice {
        margin: 14px 16px 0;
        padding: 13px 14px;
        gap: 10px;
    }

    .private-notice-icon {
        width: 42px;
        height: 42px;
        border-radius: 10px;
        font-size: 12px;
    }

    .private-notice-title {
        font-size: 16px;
    }

    .private-notice-detail {
        font-size: 13px;
        line-height: 1.55;
    }

    .result-link {
        font-size: 14px;
    }

    .ad-banner-container {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 15px;
    }

    /* 移动端悬浮客服调整 */
    .cs-float {
        right: 14px;
        bottom: 14px;
    }

    .cs-btn {
        width: 48px;
        height: 48px;
    }

    .cs-btn svg {
        width: 24px;
        height: 24px;
    }

    .cs-panel {
        width: 260px;
    }
}

/* ============ 悬浮客服 ============ */
.cs-float {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.cs-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.35);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    user-select: none;
}

.cs-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(30, 64, 175, 0.45);
}

.cs-btn.active {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
}

.cs-btn-text {
    font-size: 11px;
    line-height: 1;
    margin-top: 2px;
    letter-spacing: 1px;
}

.cs-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: 300px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.cs-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.cs-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.cs-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.cs-close:hover {
    opacity: 1;
}

.cs-panel-body {
    padding: 16px;
}

.cs-tip {
    margin: 0 0 12px;
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
}

.cs-tip-small {
    margin-top: 12px;
    margin-bottom: 0;
    font-size: 12px;
    color: #94a3b8;
}

.cs-item {
    display: flex;
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
    color: #334155;
    word-break: break-word;
    overflow-wrap: break-word;
}

.cs-item-label {
    flex-shrink: 0;
    color: #64748b;
    font-weight: 500;
}

.cs-item-value {
    color: #1e40af;
    word-break: break-all;
    overflow-wrap: break-word;
    min-width: 0;
    flex: 1;
}

.cs-item-value.cs-link,
a.cs-item-value {
    color: #1e40af;
    text-decoration: none;
    transition: color 0.2s ease;
}

a.cs-item-value:hover {
    color: #ea580c;
    text-decoration: underline;
}

/* ============ 顶部 Tab 导航栏（迁移自 connectivity.html）============ */
:root {
    --primary-blue: #0049d1;
}

.header-nav {
    display: flex;
    gap: 28px;
}

.nav-menu-toggle {
    display: none;
}

.left-group {
    display: flex;
    align-items: center;
    gap: 42px;
}

.nav-link {
    text-decoration: none;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    transition: color 0.2s;
    display: inline-flex;
    text-align: center;
    justify-content: space-around;
    min-width: 80px;
}

.nav-link.active {
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
}

.nav-link:hover {
    color: var(--primary-blue);
}

.hero-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    border: 0;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 12px rgba(31, 45, 72, 0.07);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    padding: 0.55rem 1rem;
}

.header-wrapper {
    display: flex;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
    gap: 6%;
}

.tagline {
    font-size: 15px;
    line-height: 1.3;
    color: gray;
    margin: 0;
    text-align: right;
}

.tagline-sub {
    font-size: 12px;
    opacity: 0.7;
}

/* 首页右上角后台入口（前期测试用，点击后走 Basic 认证） */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.admin-entry {
    font-size: 13px;
    color: #1e40af;
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid rgba(30, 64, 175, 0.35);
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.admin-entry:hover {
    background: #1e40af;
    color: #fff;
    border-color: #1e40af;
}

@media (max-width: 600px) {
    .header-right {
        gap: 8px;
    }

    .admin-entry {
        font-size: 12px;
        padding: 4px 9px;
    }
}

.site-logo {
    height: 28px;
}

@media (max-width: 600px) {
    .header-wrapper {
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 10px;
    }

    .left-group {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        align-items: center;
        justify-content: center;
        gap: 8px 10px;
    }

    .left-group > a {
        flex: 0 0 auto;
    }

    .nav-menu-toggle {
        display: none !important;
    }

    .header-nav {
        position: static;
        order: 3;
        display: flex;
        flex: 0 0 100%;
        width: 100%;
        gap: 2px;
        padding: 4px;
        overflow-x: auto;
        border: 1px solid #d7e0eb;
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(38, 50, 71, 0.06);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        scrollbar-width: none;
    }

    .header-nav::-webkit-scrollbar {
        display: none;
    }

    .header-nav .nav-link {
        flex: 1 1 auto;
        width: auto;
        min-width: max-content;
        justify-content: center;
        padding: 7px 4px;
        border: 0;
        border-radius: 7px;
        font-size: 12.5px;
        line-height: 1.2;
        white-space: nowrap;
        text-align: center;
        touch-action: manipulation;
    }

    .header-nav .nav-link.active,
    .header-nav .nav-link.is-nav-pending {
        border: 0;
        background: #eaf1ff;
        color: #1e40af;
        box-shadow: inset 0 -2px 0 #2563eb;
    }

    .header-nav .nav-link.is-nav-pending {
        background: #dbeafe;
    }

    html.ipii-nav-pending .hero-header::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 2px;
        background: linear-gradient(90deg, #2563eb, #93c5fd, #2563eb);
        background-size: 200% 100%;
        animation: ipii-nav-progress 0.8s linear infinite;
        pointer-events: none;
    }

    .header-right {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 2;
        gap: 8px;
        margin-left: 0;
    }

    .tagline {
        display: none;
    }

    .admin-entry {
        font-size: 12px;
        padding: 4px 9px;
    }

    .hero-header {
        padding: 0.5rem 0.75rem;
        background: #ffffff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .site-logo {
        height: 24px;
    }
}

@keyframes ipii-nav-progress {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* Safari 14.0.x 及更早浏览器的 flex gap 回退 */
@supports not (gap: 1px) {
    .header-nav > * + * {
        margin-left: 28px;
    }
}
