:root {
    --bg: #eef2f6;
    --surface: #ffffff;
    --surface-soft: #f6f8fb;
    --text: #111827;
    --muted: #64748b;
    --line: #d9e2ec;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --teal: #0f766e;
    --amber: #b45309;
    --danger: #dc2626;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
    --radius: 8px;
}

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

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(238, 242, 246, 0) 360px),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: 0;
}

.app-shell,
.container {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
}

.top-nav {
    position: sticky;
    top: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0 28px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(217, 226, 236, 0.88);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: #ffffff;
    background: var(--primary);
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
}

.brand-text {
    white-space: nowrap;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-nav ul {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.top-nav a:not(.brand) {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 14px;
    color: var(--muted);
    border-radius: 7px;
    font-size: 0.94rem;
    font-weight: 700;
}

.top-nav a:not(.brand):hover {
    color: var(--text);
    background: var(--surface-soft);
    text-decoration: none;
}

.top-nav a.active {
    color: var(--primary);
    background: #eaf1ff;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
}

.language-switcher select {
    min-height: 36px;
    padding: 7px 30px 7px 10px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
}

.language-switcher select:focus {
    border-color: rgba(37, 99, 235, 0.78);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.hero-tool {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 22px;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 320px;
    padding: 10px 4px;
}

.eyebrow,
.section-kicker {
    color: var(--teal);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-copy h1 {
    max-width: 620px;
    margin: 8px 0 12px;
    font-size: 2.95rem;
    line-height: 1.05;
}

.subtitle {
    max-width: 560px;
    color: var(--muted);
    font-size: 1.05rem;
}

.hero-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.hero-metrics span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    color: #334155;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
}

.query-panel,
.ip-info,
.tool-card,
.loading,
.error,
.content-section,
header {
    background: var(--surface);
    border: 1px solid rgba(217, 226, 236, 0.92);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.query-panel {
    align-self: center;
    padding: 24px;
}

.panel-heading,
.info-header,
.tool-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.panel-heading,
.tool-card-header {
    margin-bottom: 16px;
}

.panel-heading h2,
.tool-card h2,
.info-header h2 {
    margin-top: 3px;
    font-size: 1.25rem;
    line-height: 1.25;
}

.search-box,
.inline-form {
    display: flex;
    gap: 10px;
}

input,
textarea {
    width: 100%;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input {
    min-height: 46px;
    padding: 10px 13px;
}

textarea {
    resize: vertical;
    min-height: 128px;
    padding: 12px 13px;
}

input:focus,
textarea:focus {
    background: #ffffff;
    border-color: rgba(37, 99, 235, 0.78);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

.primary-btn,
.soft-btn,
.ghost-btn,
.copy-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 15px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.94rem;
    font-weight: 800;
    white-space: nowrap;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.primary-btn {
    color: #ffffff;
    background: var(--primary);
}

.primary-btn:hover {
    background: var(--primary-dark);
}

.soft-btn {
    color: #1f2937;
    background: #e8eef5;
}

.soft-btn:hover {
    background: #dce6f0;
}

.ghost-btn,
.copy-chip {
    color: var(--primary);
    background: #ffffff;
    border: 1px solid var(--line);
}

.ghost-btn:hover,
.copy-chip:hover {
    background: #eef5ff;
    border-color: #b8c9f8;
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

.quick-actions.align-left {
    justify-content: flex-start;
}

.input-hint {
    min-height: 22px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 22px;
    padding: 18px;
    color: var(--primary);
    font-weight: 700;
}

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid #dbeafe;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.82s linear infinite;
}

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

.error {
    margin-bottom: 22px;
    padding: 14px 16px;
    color: #991b1b;
    background: #fff1f2;
    border-color: #fecdd3;
    font-weight: 700;
}

.ip-info {
    margin-bottom: 22px;
    padding: 24px;
    animation: fadeIn 0.24s ease;
}

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

.info-header {
    align-items: center;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.result-ip {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

#ipAddress {
    max-width: 100%;
    padding: 8px 12px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-weight: 800;
    word-break: break-all;
}

.ip-type {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 7px 12px;
    color: #ffffff;
    background: var(--teal);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 800;
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.summary-item {
    min-width: 0;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.summary-label,
.info-label {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.summary-item strong {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
    font-size: 1rem;
}

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

.info-item {
    min-width: 0;
    padding: 14px;
    background: var(--surface-soft);
    border-radius: var(--radius);
}

.info-value {
    display: block;
    margin-top: 6px;
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.map-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.map-container h3 {
    font-size: 1.08rem;
}

.map-container p {
    color: var(--muted);
    font-size: 0.9rem;
}

.map-link {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.map-link a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    color: var(--primary);
    background: #eef5ff;
    border-radius: var(--radius);
    font-weight: 800;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.tool-card {
    min-width: 0;
    padding: 20px;
}

.wide-card {
    grid-column: span 2;
}

.history-card {
    grid-row: span 2;
}

.tool-note {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    color: var(--amber);
    background: #fff7ed;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.result-list {
    margin-top: 14px;
}

.result-list.empty-state,
.table-empty,
.history-empty {
    color: var(--muted);
    font-size: 0.92rem;
}

.result-list dl {
    display: grid;
    grid-template-columns: minmax(96px, 0.8fr) minmax(0, 1.4fr);
    gap: 8px 12px;
    padding: 12px;
    background: var(--surface-soft);
    border-radius: var(--radius);
}

.result-list dt {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.result-list dd {
    min-width: 0;
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.table-wrap {
    width: 100%;
    margin-top: 12px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.bulk-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    background: #ffffff;
}

.bulk-table th,
.bulk-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
}

.bulk-table th {
    color: #334155;
    background: var(--surface-soft);
    font-weight: 800;
}

.bulk-table tr:last-child td {
    border-bottom: 0;
}

.bulk-table td {
    overflow-wrap: anywhere;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-item {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.history-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.history-ip {
    color: var(--text);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.history-meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.history-item button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.82rem;
}

header {
    margin-bottom: 20px;
    padding: 28px 24px;
}

header h1 {
    color: var(--text);
    font-size: 2rem;
    line-height: 1.15;
}

.content-section {
    margin-bottom: 22px;
    padding: 24px;
}

.content-section p {
    margin-bottom: 12px;
}

.content-section h2 {
    margin: 24px 0 12px;
    color: var(--text);
    font-size: 1.35rem;
}

.content-section h2:first-child {
    margin-top: 0;
}

.content-section h3 {
    margin: 16px 0 10px;
    font-size: 1.08rem;
}

.content-section h4 {
    margin: 12px 0 8px;
}

.content-section ul {
    margin: 10px 0 16px 20px;
}

.content-section li {
    margin: 7px 0;
}

.policy-section,
.about-section {
    margin-bottom: 28px;
}

.last-updated,
.policy-notice,
.disclaimer {
    padding: 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius);
}

.last-updated {
    color: var(--amber);
    font-weight: 700;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.feature-item,
.use-cases li,
.changelog-item {
    padding: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.feature-icon {
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 900;
}

.feature-item h3 {
    color: var(--text);
    font-size: 1.05rem;
}

.feature-item p {
    margin: 6px 0 0;
    color: var(--muted);
}

.use-cases {
    list-style: none;
    margin-left: 0 !important;
}

.use-cases strong {
    color: var(--primary);
}

.changelog {
    display: grid;
    gap: 12px;
    margin: 16px 0;
}

.changelog-item h4 {
    color: var(--primary);
}

.back-link {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.back-link a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 14px;
    color: var(--primary);
    background: #eef5ff;
    border-radius: var(--radius);
    font-weight: 800;
}

footer {
    padding: 24px 0 32px;
    color: var(--muted);
    text-align: center;
    font-size: 0.9rem;
}

footer p {
    margin: 4px 0;
}

@media (max-width: 980px) {
    .hero-tool,
    .tool-grid {
        grid-template-columns: 1fr;
    }

    .hero-copy {
        min-height: auto;
        padding-top: 4px;
    }

    .query-panel {
        align-self: stretch;
    }

    .wide-card,
    .history-card {
        grid-column: auto;
        grid-row: auto;
    }

    .info-grid,
    .summary-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .app-shell,
    .container {
        width: min(100% - 20px, 1160px);
    }

    .top-nav {
        position: static;
        flex-direction: column;
        align-items: stretch;
        margin-top: 10px;
    }

    .brand {
        justify-content: center;
    }

    .nav-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .top-nav ul {
        justify-content: center;
        flex-wrap: wrap;
    }

    .language-switcher select {
        width: 100%;
    }

    .hero-tool {
        gap: 16px;
        margin-bottom: 16px;
    }

    .hero-copy h1 {
        font-size: 2.05rem;
    }

    .query-panel,
    .ip-info,
    .tool-card,
    .content-section,
    header {
        padding: 18px;
    }

    .panel-heading,
    .info-header,
    .tool-card-header,
    .map-container,
    .history-main {
        flex-direction: column;
        align-items: stretch;
    }

    .result-ip,
    .map-link {
        justify-content: flex-start;
    }

    .search-box,
    .inline-form {
        flex-direction: column;
    }

    .primary-btn,
    .soft-btn,
    .ghost-btn {
        width: 100%;
    }

    .quick-actions.align-left {
        justify-content: stretch;
    }

    .info-grid,
    .summary-row {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 420px) {
    .top-nav a:not(.brand) {
        padding: 7px 10px;
        font-size: 0.88rem;
    }

    .brand-text {
        display: none;
    }

    .hero-copy h1 {
        font-size: 1.78rem;
    }

    header h1 {
        font-size: 1.55rem;
    }
}
