:root {
    --font-size-caption2: clamp(0.69rem, 0.5vw + 0.5rem, 0.8rem);
    --font-size-caption1: clamp(0.75rem, 0.5vw + 0.6rem, 0.875rem);
    --font-size-body: clamp(0.875rem, 0.5vw + 0.7rem, 1rem);
    --font-size-title3: clamp(1rem, 0.5vw + 0.8rem, 1.25rem);
    --color-bg: #000000;
    --color-text-primary: #ffffff;
    --color-text-secondary: #8d8d8d;
    --color-text-tertiary: #5a5a5a;
    --color-card-bg: #121212;
    --color-border-default: #333333;
    --color-border-hover: #ffffff;
    --color-primary: #ffffff;
    --color-progress: #0a84ff;
}
* { box-sizing: border-box; }
body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 2rem 1rem 10rem 1rem;
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    font-size: var(--font-size-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap; }
header.page-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 100;
}
header.page-header h1 { font-size: 2rem; }
header.page-header p { font-size: var(--font-size-body); color: var(--color-text-secondary); margin: 0.5rem 0 0 0; max-width: 600px; margin-left: auto; margin-right: auto; }
main { flex-grow: 1; }
.grid-container { display: grid; gap: 1.5rem; grid-template-columns: 1fr; grid-template-areas: "my-ip" "location" "map" "asn" "threat" "client"; }
@media (min-width: 768px) { .grid-container { grid-template-columns: repeat(2, 1fr); grid-template-areas: "my-ip my-ip" "location map" "asn threat" "client client"; } }
@media (min-width: 1024px) { .grid-container { grid-template-columns: repeat(3, 1fr); grid-template-areas: "my-ip my-ip location" "map map asn" "threat client client"; } }
.grid-card { position: relative; padding: 2px; background: transparent; border-radius: 1rem; overflow: hidden; opacity: 0; transform: translateY(20px); animation: fade-in-up 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
@keyframes fade-in-up { to { opacity: 1; transform: translateY(0); } }
.card-content-wrapper { position: relative; background-color: var(--color-card-bg); padding: 1.5rem; border-radius: inherit; z-index: 2; display: flex; flex-direction: column; height: 100%; }
.card-border { position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(135deg, var(--color-border-default), var(--color-border-default)); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; transition: background 0.4s ease; z-index: 1; }
.grid-card:hover .card-border { background: linear-gradient(135deg, #ffffff, #555555); }
.card-glow { position: absolute; inset: -2px; border-radius: inherit; background: radial-gradient(circle 300px at var(--mouse-x, -300px) var(--mouse-y, -300px), rgba(255, 255, 255, 0.1), transparent); opacity: 0; transition: opacity 0.4s ease; z-index: 0; }
.grid-card:hover .card-glow { opacity: 1; }
.card-my-ip { grid-area: my-ip; } .card-location { grid-area: location; } .card-map { grid-area: map; } .card-asn { grid-area: asn; } .card-threat { grid-area: threat; } .card-client { grid-area: client; }
.card-title { font-size: var(--font-size-caption1); font-weight: 500; color: var(--color-text-secondary); margin: 0 0 1rem 0; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.card-content-wrapper ul { list-style: none; margin: 0; padding: 0; font-size: var(--font-size-caption1); }
.card-content-wrapper li { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--color-border-default); min-height: 28px; }
.card-content-wrapper li:last-child { border-bottom: none; }
.card-content-wrapper li strong { font-weight: 500; color: var(--color-text-secondary); white-space: nowrap; margin-right: 1rem; }
.card-content-wrapper li span { color: var(--color-text-primary); text-align: right; word-break: break-all; }
.ip-list { margin: 0; padding: 0; list-style: none; }
.ip-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--color-border-default); }
.ip-list li:last-child { border-bottom: none; }
.ip-main-info { display: flex; align-items: center; gap: 0.75rem; }
.ip-item .flag-icon { width: 28px; height: 21px; border-radius: 4px; border: 1px solid var(--color-border-default); object-fit: cover; }
.ip-item .flag-placeholder { width: 28px; height: 21px; display: inline-block; }
.ip-item-info { display: flex; align-items: baseline; gap: 0.5rem; flex-direction: row; }
.ip-item-info strong { font-size: var(--font-size-title3); font-weight: 500; color: var(--color-text-primary); white-space: nowrap; }
.ip-item-info .ip-type { font-size: var(--font-size-caption2); color: var(--color-text-secondary); white-space: nowrap; }
.ip-tag { font-size: var(--font-size-caption2); font-weight: 500; color: var(--color-text-primary); background-color: var(--color-border-default); padding: 0.2rem 0.5rem; border-radius: 6px; white-space: nowrap; }
.map-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.location-selector { background-color: var(--color-border-default); border: 1px solid var(--color-border-default); color: var(--color-text-primary); border-radius: 0.5rem; padding: 0.25rem 0.5rem; font-size: var(--font-size-caption2); flex-grow: 1; }
.fullscreen-btn { background: none; border: none; color: var(--color-text-secondary); font-size: var(--font-size-body); cursor: pointer; padding: 0.25rem; }
.map-container { flex-grow: 1; border-radius: 0.75rem; overflow: hidden; border: 1px solid var(--color-border-default); min-height: 150px; }
.map-container iframe { width: 100%; height: 100%; border: 0; filter: invert(0.9) hue-rotate(180deg); }
.map-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.map-button { flex-grow: 1; text-align: center; padding: 0.5rem; background-color: transparent; border: 1px solid var(--color-border-default); color: var(--color-text-secondary); border-radius: 0.5rem; text-decoration: none; font-size: var(--font-size-caption1); transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
.map-button:hover { background-color: var(--color-border-default); color: var(--color-text-primary); border-color: var(--color-border-hover); }
.map-button i { margin-right: 0.5rem; }
.progress-bar-container { display: flex; align-items: center; gap: 0.5rem; width: 60%; }
.progress-bar-wrapper { flex-grow: 1; height: 6px; background-color: var(--color-border-default); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background-color: var(--color-progress); border-radius: 3px; transition: width 0.5s ease-out; }
.progress-bar-label { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: var(--font-size-caption2); }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 1000; display: flex; justify-content: center; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity 0.4s ease; }
.sheet.visible { opacity: 1; pointer-events: auto; }
.sheet-content { background: var(--color-card-bg); width: 100%; max-width: 1200px; max-height: 90vh; border-radius: 1.5rem 1.5rem 0 0; transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); padding: 1rem; display: flex; flex-direction: column; }
.sheet.visible .sheet-content { transform: translateY(0); }
.sheet-close-btn { position: absolute; top: 1rem; right: 1rem; background: var(--color-border-default); color: var(--color-text-primary); border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 1.2rem; cursor: pointer; z-index: 10; display: flex; align-items: center; justify-content: center; }
#map-sheet-content { height: 90vh; }
#map-sheet-map-container { flex-grow: 1; border-radius: 1rem; overflow: hidden; }
#map-sheet-map-container iframe { width: 100%; height: 100%; border: 0; filter: invert(0.9) hue-rotate(180deg); }
#contact-sheet-content-inner { padding: 1.5rem; text-align: center; }
#contact-sheet-content-inner h3 { margin-top: 0; }
#contact-sheet-content-inner p { color: var(--color-text-secondary); }
#contact-sheet-content-inner a { color: var(--color-primary); text-decoration: none; font-weight: 500; display: block; margin: 1rem auto; padding: 0.75rem 1rem; border: 1px solid var(--color-border-default); border-radius: 0.75rem; max-width: 250px; }
.pwa-prompt { position: fixed; bottom: 6rem; left: 1rem; right: 1rem; max-width: 400px; margin: 0 auto; background-color: var(--color-card-bg); border: 1px solid var(--color-border-default); border-radius: 1rem; padding: 1.5rem; z-index: 999; display: none; flex-direction: column; gap: 1rem; opacity: 0; transform: translateY(20px); pointer-events: none; transition: opacity 0.5s ease, transform 0.5s ease; }
.pwa-prompt.visible { display: flex; opacity: 1; transform: translateY(0); pointer-events: auto; }
.pwa-prompt .pwa-header { display: flex; gap: 1rem; align-items: center; }
.pwa-prompt .pwa-icon { width: 48px; height: 48px; border-radius: 12px; }
.pwa-prompt .pwa-app-info .name { font-weight: 700; }
.pwa-prompt .pwa-app-info .description { font-size: var(--font-size-caption1); color: var(--color-text-secondary); }
.pwa-prompt .pwa-close-btn { position: absolute; top: 0.5rem; right: 0.5rem; background: none; border: none; color: var(--color-text-secondary); font-size: 1.5rem; cursor: pointer; }
.pwa-prompt .pwa-instructions { font-size: var(--font-size-caption1); color: var(--color-text-secondary); margin-top: 1rem; }
.how-to-body { margin-top: 1rem; display: none; }
.how-to-body.visible { display: block; }
.pwa-prompt .pwa-step { display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem; }
.pwa-prompt .pwa-step svg { width: 24px; height: 24px; fill: var(--color-text-secondary); flex-shrink: 0; }
.pwa-actions { margin-top: 1rem; }
.pwa-install-btn { width: 100%; padding: 0.75rem; background: var(--color-primary); color: var(--color-bg); border: none; border-radius: 0.75rem; font-size: var(--font-size-body); font-weight: 700; cursor: pointer; }

.search-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    display: flex;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 500px;
    border-radius: 1.5rem;
    overflow: visible;
    pointer-events: all;
    z-index: 10;
}

.search-bar::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    z-index: 0;
    opacity: 0;
    background: linear-gradient(270deg,
        #8a2be2,
        #4169e1,
        #00bfff,
        #32cd32,
        #ffd700,
        #ff4500,
        #8a2be2);
    background-size: 600% 600%;
    filter: blur(8px);
    transition: opacity 0.4s ease-in-out;
    /* No animation by default */
}

.search-bar:focus-within::before {
    opacity: 0.8;
    animation: siri-wave 6s ease infinite, breath-glow 3s ease-in-out infinite;
}

.search-bar-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--color-card-bg, rgba(30, 30, 30, 0.6));
    border: 1px solid var(--color-border-default, rgba(255, 255, 255, 0.15));
    border-radius: inherit;
    position: relative;
    z-index: 1;
    color: var(--color-text-primary, #ffffff);
    backdrop-filter: blur(10px);
}

#ip-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    font-size: 1rem;
    padding: 0;
    margin: 0;
}

.search-bar i {
    color: var(--color-text-tertiary, #ccc);
}

@keyframes siri-wave {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes breath-glow {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.03);
        opacity: 1;
    }
}
footer { text-align: center; margin: 2rem auto 1rem; font-size: var(--font-size-caption2); color: var(--color-text-secondary); }
footer button { background: none; border: none; color: inherit; cursor: pointer; padding: 0.25rem; font-size: inherit; font-family: inherit; }
footer button:hover { color: var(--color-text-primary); }
.loader-container { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; position: fixed; inset: 0; z-index: 200; background: var(--color-bg); opacity: 1; transition: opacity 0.5s ease; }
.loader-container.hidden { opacity: 0; pointer-events: none; }
.loader-spinner { width: 40px; height: 40px; border: 3px solid var(--color-border-default); border-top-color: var(--color-border-hover); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }
#language-switcher-container { position: absolute; top: 0; right: 0; padding: 1.5rem; }
.language-switcher { position: relative; }
.language-switcher-button { background: none; border: none; color: var(--color-text-secondary); font-size: 1.25rem; cursor: pointer; transition: color 0.2s; }
.language-switcher-button:hover { color: var(--color-text-primary); }
.language-dropdown { position: absolute; top: calc(100% + 0.5rem); right: 0; background-color: var(--color-card-bg); border: 1px solid var(--color-border-default); border-radius: 0.75rem; list-style: none; padding: 0.5rem; margin: 0; z-index: 1001; min-width: 150px; opacity: 0; transform: translateY(-10px); pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
.language-dropdown.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.language-option { display: block; background: none; border: none; color: var(--color-text-primary); padding: 0.5rem 1rem; width: 100%; text-align: left; border-radius: 0.5rem; font-size: var(--font-size-caption1); cursor: pointer; }
.language-option:hover { background-color: var(--color-border-default); }
.language-option.active { font-weight: 700; color: var(--color-primary); }