:root {
  --bg: #0a1530;
  --bg-deep: #070f24;
  --card: #132449;
  --card-edge: #1f3566;
  --text: #f4f7ff;
  --muted: #9fb0d6;
  --accent: #4da3ff;
  --accent-ink: #04122b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(2, 8, 24, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% -10%, #14285a 0%, var(--bg) 55%, var(--bg-deep) 100%);
  background-attachment: fixed;
}

h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
dl, dd, p { margin: 0; }

.container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* Accessibility helpers */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Header / footer */
.site-header { padding: 1.25rem 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-mark {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 8px var(--accent);
}

/* Header navigation */
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.site-nav a:hover { color: var(--text); background: rgba(159, 176, 214, 0.12); }
.site-nav a[aria-current="page"] { color: var(--text); background: rgba(77, 163, 255, 0.16); }

.site-footer {
  margin-top: auto;
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding-block: 1.5rem 2rem;
}

.col-main, .col-side {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Cards */
.panel {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); margin-bottom: 1rem; }
.side-title { font-size: 1.15rem; margin-bottom: 0.75rem; }

/* IP panel */
.ip-panel { padding: 1.75rem; }

.ip-list { display: grid; gap: 1.1rem; margin-bottom: 1.5rem; }

.ip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.9rem;
}

.ip-row dt {
  min-width: 3.5rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 1.1rem;
}

.ip-value {
  font-size: clamp(1.25rem, 3.4vw, 1.9rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Info card */
.info-list { display: grid; }

.info-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--card-edge);
}
.info-row:first-child { padding-top: 0; }
.info-row:last-child { border-bottom: 0; padding-bottom: 0; }
.info-row dt { color: var(--muted); font-weight: 600; }
.info-row dd { overflow-wrap: anywhere; }

.details-link {
  display: inline-block;
  margin: 1.25rem 0 0;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.details-link:hover { color: #8cc4ff; }

/* Complete IP details (expandable card) */
.details-card { margin-top: 1rem; }
.details-card[hidden] { display: none; }
.details-title { margin: 0 0 1rem; font-size: 1.15rem; line-height: 1.3; }
.details-card .info-row { grid-template-columns: 9rem 1fr; }
.details-note { margin-top: 1.1rem; font-size: 0.85rem; color: var(--muted); }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #7bbcff; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--card-edge);
}
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Map placeholder */
.map-placeholder {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 260px;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-edge);
  box-shadow: var(--shadow);
  background:
    radial-gradient(circle at 60% 40%, #1d3b73 0%, transparent 55%),
    linear-gradient(135deg, #12275a, #0d1d44);
  display: grid;
  place-items: center;
}

.map-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-grid path { fill: none; stroke: rgba(160, 190, 255, 0.14); stroke-width: 1; }

.map-pin {
  position: relative;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg) translateY(-14px);
  box-shadow: 0 0 0 8px rgba(77, 163, 255, 0.2);
}
.map-pin::after {
  content: "";
  position: absolute;
  inset: 6px;
  background: var(--bg);
  border-radius: 50%;
}

.map-label {
  position: absolute;
  bottom: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Leaflet map (sits on top of the placeholder once a location is known) */
.map-leaflet {
  position: absolute;
  inset: 0;
  z-index: 0; /* keeps Leaflet's internal layers below the rest of the page */
  visibility: hidden;
  background: #0d1d44;
  font-family: var(--font);
}

.map-placeholder.is-ready .map-leaflet { visibility: visible; }
.map-placeholder.is-ready .map-grid,
.map-placeholder.is-ready .map-pin,
.map-placeholder.is-ready .map-label { display: none; }

.map-leaflet .leaflet-popup-content {
  margin: 0.7rem 0.9rem;
  color: var(--bg);
  line-height: 1.4;
}

/* VPN card */
.vpn-card { display: grid; gap: 1rem; justify-items: start; }
.vpn-text { color: var(--muted); }
.vpn-note { font-size: 0.85rem; color: var(--muted); }

.vpn-output { width: 100%; }
.vpn-result[hidden], .vpn-error[hidden], .vpn-row[hidden] { display: none; }

.vpn-list { display: grid; }
.vpn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--card-edge);
}
.vpn-row:first-child { padding-top: 0; }
.vpn-row dt { color: var(--muted); font-weight: 600; }
.vpn-row dd { font-weight: 600; overflow-wrap: anywhere; }

/* Status pills: the text always says the result, colour is only a reinforcement */
.vpn-status {
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  background: rgba(159, 176, 214, 0.15);
  color: var(--muted);
}
.vpn-status[data-state="yes"] { background: rgba(255, 107, 107, 0.16); color: #ff9a9a; }
.vpn-status[data-state="no"]  { background: rgba(61, 220, 151, 0.16);  color: #5fe5ad; }

.vpn-summary {
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(159, 176, 214, 0.08);
}
.vpn-summary[data-state="alert"] { border-left-color: #ff6b6b; background: rgba(255, 107, 107, 0.1); }
.vpn-summary[data-state="clear"] { border-left-color: #3ddc97; background: rgba(61, 220, 151, 0.1); }

.vpn-error { color: #ff9a9a; }

/* Informational content below the tool */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.seo-wrap { padding-bottom: 2.5rem; }

.seo-content {
  max-width: 52rem;
  margin-inline: auto;
  padding: 2rem;
}

.seo-content section + section {
  margin-top: 1.9rem;
  padding-top: 1.9rem;
  border-top: 1px solid var(--card-edge);
}

.seo-content h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
}

.seo-content h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.35;
}

.seo-content p { color: #d6def2; line-height: 1.7; }
.seo-content p + p { margin-top: 0.9rem; }

.seo-content ul { margin: 0.8rem 0 0; padding-left: 1.25rem; color: #d6def2; }
.seo-content li { margin-top: 0.45rem; line-height: 1.6; padding-left: 0.2rem; }
.seo-content li:first-child { margin-top: 0; }
.seo-content li::marker { color: var(--accent); }
.seo-content strong { color: var(--text); }

.seo-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.4em;
  border-radius: 6px;
  background: rgba(77, 163, 255, 0.12);
  color: #bcdcff;
  white-space: nowrap;
}

.faq-item + .faq-item { margin-top: 1.2rem; }

/* Comparison table: scrolls sideways inside its own box on narrow screens */
.table-scroll {
  margin-top: 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-md);
}

.compare-table {
  width: 100%;
  min-width: 32rem;
  border-collapse: collapse;
  text-align: left;
}

.compare-table th,
.compare-table td {
  padding: 0.75rem 0.9rem;
  vertical-align: top;
  line-height: 1.5;
  border-bottom: 1px solid var(--card-edge);
}

.compare-table thead th { background: rgba(159, 176, 214, 0.1); font-weight: 700; }
.compare-table tbody th { width: 28%; color: var(--muted); font-weight: 600; }
.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table td { color: #d6def2; }

/* About page (reuses .panel and .seo-content) */
.about-main { padding-block: 1.5rem 2.5rem; }
.about-content h1 {
  margin-bottom: 1rem;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}
/* Gap between a bullet list and the paragraph that follows it (privacy page) */
.about-content ul + p { margin-top: 0.9rem; }
.seo-content a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }
.seo-content a:hover { color: #8cc4ff; }

/* Responsive */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 1.75rem; }
  .col-main, .col-side { gap: 1.75rem; }
  .map-placeholder { max-height: 220px; }
}

@media (max-width: 480px) {
  /* Five nav links on phones: a tidy 3 + 2 grid instead of a lone link on the second row */
  .site-nav ul { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; }
  .panel { padding: 1.15rem; }
  .ip-panel { padding: 1.25rem; }
  .info-row { grid-template-columns: 5.5rem 1fr; gap: 0.75rem; }
  .details-card .info-row { grid-template-columns: 7.5rem 1fr; }
  .ip-panel .btn { width: 100%; }
  .seo-content { padding: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
