@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── RESET & ROOT ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #080b14;
    --bg2:         #0d1120;
    --bg3:         #111827;
    --panel:       rgba(255,255,255,0.035);
    --panel-hover: rgba(255,255,255,0.055);
    --border:      rgba(255,255,255,0.08);
    --border2:     rgba(255,255,255,0.13);

    --text:        #f0f0f8;
    --muted:       #6b7194;
    --hint:        #3d4168;

    --green:       #22d77a;
    --green-dim:   rgba(34,215,122,0.12);
    --green-glow:  rgba(34,215,122,0.25);
    --red:         #ff4f6a;
    --red-dim:     rgba(255,79,106,0.12);
    --amber:       #f5a623;
    --amber-dim:   rgba(245,166,35,0.12);
    --blue:        #4d9fff;
    --blue-dim:    rgba(77,159,255,0.12);

    --radius:      12px;
    --radius-sm:   8px;
    --radius-lg:   18px;
    --mono:        'JetBrains Mono', monospace;
    --sans:        'Space Grotesk', sans-serif;

    --scan-duration: 2.5s;
}

/* ─── BASE ─────────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    /* Subtle animated background */
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(77,159,255,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 40% 40% at 80% 80%, rgba(34,215,122,0.04) 0%, transparent 50%);
}

.container { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* ─── LOADING OVERLAY ──────────────────────────────────────────────────────── */
#loadingOverlay {
    position: fixed; inset: 0; z-index: 999;
    background: var(--bg);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 20px;
    transition: opacity 0.6s, visibility 0.6s;
}
#loadingOverlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.scan-ring {
    width: 72px; height: 72px;
    border-radius: 50%;
    border: 2px solid var(--border2);
    border-top-color: var(--green);
    border-right-color: var(--green);
    animation: spin 1s linear infinite;
    position: relative;
}
.scan-ring::after {
    content: '';
    position: absolute; inset: 8px;
    border-radius: 50%;
    border: 1px solid var(--border);
    border-bottom-color: var(--blue);
    animation: spin 1.8s linear infinite reverse;
}
.scan-label {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}
.scan-steps { display: flex; flex-direction: column; gap: 6px; width: 220px; }
.scan-step {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--hint);
    display: flex; align-items: center; gap: 8px;
    transition: color 0.3s;
}
.scan-step.active { color: var(--green); }
.scan-step.done   { color: var(--muted); }
.scan-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--hint);
    flex-shrink: 0;
    transition: background 0.3s;
}
.scan-step.active .scan-dot { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.scan-step.done   .scan-dot { background: var(--muted); }

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

/* ─── HEADER ───────────────────────────────────────────────────────────────── */
header {
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    background: rgba(8,11,20,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
}
.logo span { color: var(--green); }
.logo sub {
    font-size: 9px;
    font-family: var(--mono);
    color: var(--muted);
    letter-spacing: 1px;
    vertical-align: middle;
    margin-left: 4px;
    border: 1px solid var(--border2);
    padding: 1px 4px;
    border-radius: 3px;
}
.header-actions { display: flex; gap: 10px; align-items: center; }
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px;
    border-radius: 30px;
    border: 1px solid var(--border2);
    background: var(--panel);
    color: var(--muted);
    font-family: var(--sans);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn:hover { background: var(--panel-hover); color: var(--text); border-color: rgba(255,255,255,0.2); }
.btn-primary { background: var(--green-dim); border-color: rgba(34,215,122,0.3); color: var(--green); }
.btn-primary:hover { background: var(--green); color: #000; border-color: var(--green); }

/* ─── HERO ─────────────────────────────────────────────────────────────────── */
.hero {
    padding: 48px 0 36px;
    text-align: center;
    position: relative;
}
.flag-wrap {
    width: 52px; height: 36px;
    margin: 0 auto 16px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border2);
    background: var(--bg3);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.flag-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ip-row {
    display: flex; justify-content: center; align-items: center; gap: 12px;
    flex-wrap: wrap;
}
.ip-display {
    font-family: var(--mono);
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--text);
    line-height: 1;
}
@media (max-width: 600px) { .ip-display { font-size: 32px; } }

.copy-btn {
    background: var(--panel);
    border: 1px solid var(--border2);
    color: var(--muted);
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.copy-btn:hover { background: var(--panel-hover); color: var(--text); border-color: rgba(255,255,255,0.2); }
.copy-btn.ok    { background: var(--green-dim); color: var(--green); border-color: rgba(34,215,122,0.3); }

.location-line {
    margin-top: 8px;
    font-size: 15px;
    color: var(--muted);
}
.location-line span { color: var(--text); font-weight: 600; }

/* ─── SCORE BAR (below hero) ───────────────────────────────────────────────── */
.score-hero {
    margin: 24px auto 40px;
    max-width: 540px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: none;
}
.score-hero.visible { display: block; }
.score-top {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 12px;
}
.score-num {
    font-family: var(--mono);
    font-size: 40px; font-weight: 700;
    line-height: 1;
    color: var(--green);
    transition: color 0.4s;
}
.score-num.risk { color: var(--red); }
.score-num.warn { color: var(--amber); }
.score-verdict {
    font-size: 14px; font-weight: 600;
    color: var(--muted);
    text-align: right;
    max-width: 200px;
}
.score-track {
    height: 6px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.score-fill {
    height: 100%; width: 0;
    background: var(--green);
    border-radius: 10px;
    transition: width 1.2s cubic-bezier(0.4,0,0.2,1), background 0.4s;
}
.score-fill.risk { background: var(--red); }
.score-fill.warn { background: var(--amber); }

/* ─── RISK PILLS ───────────────────────────────────────────────────────────── */
.risk-pills {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 14px;
}
.risk-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
    border: 1px solid transparent;
}
.pill-red    { background: var(--red-dim);   border-color: rgba(255,79,106,0.25); color: var(--red); }
.pill-amber  { background: var(--amber-dim); border-color: rgba(245,166,35,0.25); color: var(--amber); }
.pill-green  { background: var(--green-dim); border-color: rgba(34,215,122,0.25); color: var(--green); }

/* ─── SUMMARY CARDS ────────────────────────────────────────────────────────── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.mini-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: border-color 0.2s, background 0.2s;
}
.mini-card:hover {
    background: var(--panel-hover);
    border-color: var(--border2);
}
.mini-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.mini-label svg { opacity: 0.6; flex-shrink: 0; }
.mini-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    word-break: break-word;
}

/* ─── SECTION GRID ─────────────────────────────────────────────────────────── */
.section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 720px) { .section-grid { grid-template-columns: 1fr; } }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
}
.panel-head {
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.panel-icon {
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    background: var(--green-dim);
    border: 1px solid rgba(34,215,122,0.2);
    display: flex; align-items: center; justify-content: center;
    color: var(--green);
    flex-shrink: 0;
}
.panel-icon.red   { background: var(--red-dim);   border-color: rgba(255,79,106,0.2);  color: var(--red);   }
.panel-icon.amber { background: var(--amber-dim);  border-color: rgba(245,166,35,0.2); color: var(--amber); }
.panel-icon.blue  { background: var(--blue-dim);   border-color: rgba(77,159,255,0.2); color: var(--blue);  }
.panel-title {
    font-size: 12px; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase;
    color: var(--text);
}

/* Data rows */
.d-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.d-row:last-child { border-bottom: none; padding-bottom: 0; }
.d-key  { color: var(--muted); font-weight: 500; white-space: nowrap; flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.d-key svg { opacity: 0.5; }
.d-val  { color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }
.d-val.mono { font-family: var(--mono); font-size: 12px; }

/* ─── BADGES ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.5px; text-transform: uppercase;
}
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red   { background: var(--red-dim);   color: var(--red);   }
.badge-amber { background: var(--amber-dim); color: var(--amber); }
.badge-blue  { background: var(--blue-dim);  color: var(--blue);  }

/* ─── TIME SYNC BOX ────────────────────────────────────────────────────────── */
.time-sync-box {
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 10px;
    border: 1px solid transparent;
    transition: all 0.4s;
}
.time-sync-box.ok  { background: var(--green-dim); border-color: rgba(34,215,122,0.2); }
.time-sync-box.bad { background: var(--red-dim);   border-color: rgba(255,79,106,0.2); }
.time-sync-label {
    font-size: 10px; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

/* ─── WEBRTC PANEL ─────────────────────────────────────────────────────────── */
.webrtc-result {
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 8px;
    font-size: 12px;
    font-family: var(--mono);
}
.webrtc-result.safe  { background: var(--green-dim); color: var(--green); }
.webrtc-result.leak  { background: var(--red-dim);   color: var(--red);   }
.webrtc-ip-list { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.webrtc-ip { opacity: 0.8; }

/* ─── FINGERPRINT TABLE ────────────────────────────────────────────────────── */
.fp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}
.fp-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}
.fp-item-label { font-size: 10px; color: var(--muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.8px; }
.fp-item-val   { font-family: var(--mono); font-size: 11px; color: var(--text); font-weight: 500; word-break: break-all; }

/* ─── SEO CONTENT BLOCK ────────────────────────────────────────────────────── */
.info-block {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 28px;
}
.info-block h2 {
    font-size: 17px; font-weight: 700;
    margin-bottom: 10px;
}
.info-block p { font-size: 14px; color: var(--muted); line-height: 1.7; }
.info-block p + p { margin-top: 8px; }
.info-block strong { color: var(--text); }

/* ─── WHAT WE CHECK GRID ───────────────────────────────────────────────────── */
.checks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.check-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex; align-items: flex-start; gap: 10px;
}
.check-icon {
    width: 28px; height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.check-name  { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.check-desc  { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ─── FLOATING SCORE BAR (bottom) ──────────────────────────────────────────── */
.score-bar-wrap {
    position: fixed; bottom: 20px; left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px); max-width: 860px;
    z-index: 200;
    display: none;
}
.score-bar-wrap.visible { display: block; }
.score-capsule {
    background: rgba(13,17,32,0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border2);
    border-radius: 50px;
    padding: 10px 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.sc-pct {
    font-family: var(--mono);
    font-size: 18px; font-weight: 700;
    min-width: 50px;
    color: var(--green);
    transition: color 0.4s;
}
.sc-pct.risk { color: var(--red); }
.sc-pct.warn { color: var(--amber); }
.sc-bar {
    flex-grow: 1; height: 5px;
    background: var(--border);
    border-radius: 10px; overflow: hidden;
}
.sc-fill {
    height: 100%; width: 0;
    background: var(--green);
    border-radius: 10px;
    transition: width 1.2s cubic-bezier(0.4,0,0.2,1), background 0.4s;
}
.sc-fill.risk { background: var(--red); }
.sc-fill.warn { background: var(--amber); }
.sc-msg {
    font-size: 13px; font-weight: 600;
    color: var(--text); white-space: nowrap;
}
@media (max-width: 500px) { .sc-msg { display: none; } }

/* ─── FOOTER ───────────────────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 32px 0 100px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
    font-size: 13px;
    color: var(--hint);
}
footer a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}
footer a:hover { color: var(--text); }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }
.tg-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--panel);
    border: 1px solid var(--border2);
    color: var(--muted);
    margin-top: 12px;
    transition: all 0.25s;
}
.tg-btn:hover {
    background: #0088cc;
    color: #fff;
    border-color: #0088cc;
    box-shadow: 0 0 20px rgba(0,136,204,0.35);
    transform: translateY(-2px);
}

/* ─── UTILITY ──────────────────────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--bg3) 25%, rgba(255,255,255,0.05) 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    height: 14px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.dot-sep { color: var(--hint); margin: 0 6px; }

/* ─── PULSE on load (IP number) ────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.anim-in { animation: fadeUp 0.5s ease forwards; }
