/* ===== 首页动画背景 ===== */
/* 蓝紫色渐变动画背景；页面可继续用更具体的选择器调整色彩与透明度。 */
.animated-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    contain: layout style paint;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    opacity: 0.8;
    transform: translateZ(0);
}

.bg-bubbles {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

.bg-bubbles li {
    position: absolute;
    bottom: -160px;
    display: block;
    width: 40px;
    height: 40px;
    list-style: none;
    background-color: rgba(255, 255, 255, 0.15);
    animation: square 25s infinite linear;
    backface-visibility: hidden;
    will-change: transform;
}

.bg-bubbles li:nth-child(1) {
    left: 10%;
}

.bg-bubbles li:nth-child(2) {
    left: 20%;
    width: 80px;
    height: 80px;
    animation-delay: 2s;
    animation-duration: 17s;
}

.bg-bubbles li:nth-child(3) {
    left: 25%;
    animation-delay: 4s;
}

.bg-bubbles li:nth-child(4) {
    left: 40%;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.25);
    animation-duration: 22s;
}

.bg-bubbles li:nth-child(5) {
    left: 70%;
}

.bg-bubbles li:nth-child(6) {
    left: 80%;
    width: 120px;
    height: 120px;
    background-color: rgba(255, 255, 255, 0.2);
    animation-delay: 3s;
}

.bg-bubbles li:nth-child(7) {
    left: 32%;
    width: 160px;
    height: 160px;
    animation-delay: 7s;
}

.bg-bubbles li:nth-child(8) {
    left: 55%;
    width: 20px;
    height: 20px;
    animation-delay: 15s;
    animation-duration: 40s;
}

.bg-bubbles li:nth-child(9) {
    left: 25%;
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.3);
    animation-delay: 2s;
    animation-duration: 40s;
}

.bg-bubbles li:nth-child(10) {
    left: 90%;
    width: 160px;
    height: 160px;
    animation-delay: 11s;
}

@keyframes square {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-700px) rotate(600deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bg-bubbles li {
        animation: none !important;
    }
}

/* ===== 首页页面样式 ===== */
/* 首页视觉样板：仅在 .page-home 下生效，避免影响查询页和工具页。 */
.page-home {
    background: var(--site-color-page);
}

.page-home .animated-background {
    background: radial-gradient(circle at 16% 14%, rgba(79, 103, 232, 0.17), transparent 31%),
    radial-gradient(circle at 85% 18%, rgba(22, 163, 148, 0.13), transparent 30%),
    linear-gradient(180deg, #f7f8ff 0%, #f5f7fb 58%, #f8fafc 100%);
    opacity: 1;
}

.page-home .bg-bubbles li {
    border: 1px solid rgba(79, 103, 232, 0.1);
    border-radius: 32%;
    background: rgba(255, 255, 255, 0.34);
}

.page-home .bg-bubbles li:nth-child(n+7) {
    display: none;
}

.page-home .hide {
    display: none !important;
}

.page-home .show {
    display: block;
}

.home-main {
    position: relative;
    z-index: 2;
    width: min(100% - 40px, var(--site-content-width));
    margin: 0 auto;
    padding: 40px 0 48px;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 14px;
    max-width: 980px;
    margin: 0 auto 18px;
    text-align: center;
}

.home-hero h1 {
    display: flex;
    grid-column: 2;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--site-color-text);
    font-size: clamp(32px, 4vw, 44px);
    font-weight: 760;
    line-height: 1.14;
    letter-spacing: -0.04em;
}

.home-search-symbol {
    position: relative;
    width: 0.64em;
    height: 0.64em;
    color: var(--site-color-primary);
    border: 0.09em solid currentColor;
    border-radius: 50%;
}

.home-search-symbol::after {
    position: absolute;
    right: -0.28em;
    bottom: -0.18em;
    width: 0.32em;
    height: 0.09em;
    border-radius: var(--site-radius-pill);
    background: currentColor;
    content: "";
    transform: rotate(45deg);
    transform-origin: left center;
}

.home-hero > p {
    grid-column: 3;
    justify-self: start;
    margin: 0;
    color: var(--site-color-text-muted);
    font-size: 15px;
    font-weight: 550;
    line-height: 1.5;
    white-space: nowrap;
}

/* 首页的查询、当前 IP 与推广区域共用统一卡片基线。 */
.home-query-card,
.home-sources,
.home-promotions {
    background: var(--site-surface-glass);
}

.home-query-card {
    width: min(100%, var(--site-query-width));
    margin: 0 auto;
    padding: 22px 24px;
    border-radius: var(--site-radius-xl);
}

.home-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.home-section-heading h2,
.home-promotions-heading h2 {
    margin: 0;
    color: var(--site-color-text);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.35;
}

.home-section-heading p {
    margin: 6px 0 0;
    color: var(--site-color-text-muted);
    font-size: 14px;
}

.home-section-icon,
.home-current-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--site-color-primary);
    border-radius: var(--site-radius-md);
    background: var(--site-color-primary-soft);
    font-size: 18px;
}

.home-query-form {
    margin: 0;
}

.home-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--site-color-text-secondary);
    font-size: 14px;
    font-weight: 650;
}

.page-home .home-ip-input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 17px;
    color: var(--site-color-text);
    border: 1px solid var(--site-color-border-strong);
    border-radius: var(--site-radius-md);
    background: var(--site-color-surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 17px;
    transition: border-color var(--site-transition-fast), box-shadow var(--site-transition-fast);
}

.page-home .home-ip-input:focus {
    border-color: var(--site-color-primary);
    outline: none;
    box-shadow: var(--site-focus-ring);
}

.home-field-help {
    margin: 6px 0 0;
    color: var(--site-color-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.home-captcha {
    width: 100%;
    margin-top: 14px;
}

.home-captcha #embed-captcha {
    width: 100%;
    min-height: var(--site-touch-target);
}

.home-form-message {
    margin: 8px 0;
    color: var(--site-color-text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.home-form-error {
    padding: 10px 12px;
    color: var(--site-color-danger);
    border: 1px solid var(--site-color-danger-border);
    border-radius: var(--site-radius-sm);
    background: #fff5f4;
}

.page-home .home-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    margin-top: 14px;
    padding: 12px 20px;
    color: #fff !important;
    border: 0;
    border-radius: var(--site-radius-md);
    background: var(--site-gradient-primary);
    box-shadow: var(--site-shadow-button);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--site-transition-fast), box-shadow var(--site-transition-fast), background var(--site-transition-fast);
}

.page-home .home-submit:hover,
.page-home .home-submit:focus {
    color: #fff !important;
    background: var(--site-gradient-primary-hover);
    box-shadow: var(--site-shadow-button-hover);
    transform: translateY(-1px);
}

.page-home .home-submit:active {
    transform: translateY(0);
}

.page-home .home-submit-blocked {
    background: #98a2b3;
    box-shadow: none;
}

.page-home .home-submit-blocked:hover,
.page-home .home-submit-blocked:focus {
    background: #7b8492;
    box-shadow: none;
}

.home-card-label {
    margin: 0 0 4px;
    color: var(--site-color-text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home-current-ip {
    display: block;
    min-width: 0;
    margin: 0;
    color: var(--site-color-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 17px;
    font-weight: 750;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* 五个基础数据库在宽屏同排展示，便于直接比较结果差异。 */
.home-sources {
    margin-top: 18px;
    padding: 24px;
    border-radius: var(--site-radius-xl);
}

.home-sources-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 18px;
}

.home-sources-summary,
.home-current-inline {
    display: flex;
    align-items: center;
}

.home-sources-summary {
    flex: 0 1 auto;
    justify-content: flex-end;
    gap: 14px;
    min-width: 0;
}

.home-current-inline {
    gap: 10px;
    min-width: 0;
    padding-right: 14px;
    border-right: 1px solid var(--site-color-border);
}

.home-current-inline .home-current-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--site-radius-sm);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.home-current-inline-label {
    display: block;
    margin-bottom: 2px;
    color: var(--site-color-text-muted);
    font-size: 11px;
    font-weight: 650;
}

.home-copy-ip {
    flex: 0 0 auto;
    min-width: 58px;
    min-height: 38px;
    padding: 7px 11px;
    border: 1px solid var(--site-color-border-strong);
    border-radius: var(--site-radius-sm);
    color: var(--site-color-primary-dark);
    background: var(--site-color-primary-soft);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.home-copy-ip:hover,
.home-copy-ip:focus-visible {
    border-color: var(--site-color-primary);
    background: #fff;
}

.home-sources-heading h2 {
    margin: 0;
    color: var(--site-color-text);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.35;
}

.home-source-count {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    color: var(--site-color-primary-dark);
    border: 1px solid rgba(79, 103, 232, 0.18);
    border-radius: var(--site-radius-pill);
    background: var(--site-color-primary-soft);
    font-size: 12px;
    font-weight: 650;
}

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

.home-source-card {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--site-color-border);
    border-radius: var(--site-radius-md);
    background: var(--site-color-surface-soft);
    transition: transform var(--site-transition-fast), border-color var(--site-transition-fast), box-shadow var(--site-transition-fast);
}

.home-source-card:hover {
    border-color: rgba(79, 103, 232, 0.28);
    box-shadow: var(--site-shadow-sm);
    transform: translateY(-1px);
}

.home-source-card h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 9px;
    color: var(--site-color-primary-dark);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.35;
}

.home-source-card h3 small {
    padding: 2px 5px;
    color: var(--site-color-text-muted);
    border-radius: var(--site-radius-pill);
    background: #fff;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.home-source-card p {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--site-color-text-secondary);
    font-size: 13px;
    font-weight: 550;
    line-height: 1.55;
}

.home-promotions {
    margin-top: 30px;
    padding: 24px;
    border-radius: var(--site-radius-xl);
}

.home-promotions-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 18px;
}

.home-ad-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    color: var(--site-color-text-muted);
    border: 1px solid var(--site-color-border);
    border-radius: var(--site-radius-pill);
    background: var(--site-color-surface-soft);
    font-size: 11px;
}

.home-promotion-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.home-promotion-card {
    min-width: 0;
    border: 1px solid var(--site-color-border);
    border-radius: var(--site-radius-md);
    background: var(--site-color-surface-soft);
    transition: border-color var(--site-transition-fast), background var(--site-transition-fast), transform var(--site-transition-fast);
}

.home-promotion-card:hover {
    border-color: rgba(79, 103, 232, 0.34);
    background: var(--site-color-primary-soft);
    transform: translateY(-1px);
}

.home-promotion-card:focus-within {
    border-color: var(--site-color-primary);
    background: var(--site-color-primary-soft);
    box-shadow: var(--site-focus-ring);
}

.home-promotion-card a {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    min-height: 92px;
    padding: 16px;
    color: var(--site-color-text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.55;
}

.home-promotion-card a span {
    min-width: 0;
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

.home-promotion-card a:focus-visible {
    outline: 0;
}

.home-promotion-card a:hover,
.home-promotion-card a:focus {
    color: var(--site-color-primary-dark);
    text-decoration: none;
}

.home-promotion-card i {
    flex: 0 0 auto;
    margin-top: 3px;
    color: var(--site-color-text-subtle);
}

.home-disclaimer {
    margin: 22px auto 0;
    color: var(--site-color-text-muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

@media (max-width: 980px) {
    .home-source-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* 手机端：卡片改为紧凑布局，并降低留白与标题尺寸。 */
@media (max-width: 768px) {
    .home-main {
        width: min(100% - 28px, var(--site-content-width));
        padding: 24px 0 32px;
    }

    .home-hero {
        display: block;
        max-width: var(--site-query-width);
        margin-bottom: 14px;
    }

    .home-hero h1 {
        gap: 9px;
        font-size: 32px;
    }

    .home-hero > p {
        width: 100%;
        margin-top: 6px;
        padding: 0;
        font-size: 13px;
        text-align: right;
    }

    .home-query-card {
        padding: 18px;
        border-radius: var(--site-radius-lg);
    }

    .home-section-heading {
        margin-bottom: 20px;
    }

    .home-section-heading h2 {
        font-size: 18px;
    }

    .home-section-icon {
        width: 38px;
        height: 38px;
    }

    .home-sources,
    .home-promotions {
        margin-top: 20px;
        padding: 20px 16px;
        border-radius: var(--site-radius-lg);
    }

    .home-sources-heading {
        align-items: center;
    }

    .home-source-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-promotion-grid {
        grid-template-columns: 1fr;
    }

    .home-promotion-card a {
        min-height: auto;
        padding: 14px;
    }
}

@media (max-width: 600px) {
    .home-sources-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .home-sources-summary {
        justify-content: space-between;
        width: 100%;
    }
}

@media (max-width: 420px) {
    .home-main {
        width: min(100% - 20px, var(--site-content-width));
        padding-top: 20px;
    }

    .home-hero h1 {
        font-size: 27px;
    }

    .home-current-inline {
        flex: 1 1 auto;
    }

    .home-copy-ip {
        min-height: var(--site-touch-target);
    }

    /* 360px 左右的小屏采用单列，避免较长归属地被压成窄竖排。 */
    .home-source-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 360px) {
    .home-hero h1 {
        font-size: 24px;
    }

    .home-search-symbol {
        display: none;
    }

    .home-hero > p {
        font-size: 12px;
    }
}

.captcha-retry-button {
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--site-touch-target);
    margin-top: 8px;
    padding: 9px 14px;
    border: 1px solid var(--site-color-border-strong);
    border-radius: var(--site-radius-md);
    color: var(--site-color-primary-dark);
    background: #fff;
    font-weight: 700;
}

.captcha-retry-button.show {
    display: inline-flex;
}
