:root {
  --bg: #070816;
  --card: rgba(18, 20, 46, 0.78);
  --card-border: rgba(139, 148, 255, 0.22);
  --card-sub: rgba(13, 15, 36, 0.55);
  --text: #e9ecff;
  --text-dim: #9aa3c9;
  --accent: #6d5cff;
  --accent-2: #a855f7;
  --accent-3: #22d3ee;
  --accent-4: #d946ef;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 20px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  --card-glow: 0 0 0 1px rgba(139, 148, 255, 0.08), 0 0 42px rgba(109, 92, 255, 0.22);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 12% -10%, rgba(99, 102, 241, 0.34), transparent 60%),
    radial-gradient(800px 520px at 88% 0%, rgba(217, 70, 239, 0.26), transparent 58%),
    radial-gradient(720px 520px at 50% 118%, rgba(6, 182, 212, 0.28), transparent 60%),
    radial-gradient(560px 420px at 98% 40%, rgba(168, 85, 247, 0.22), transparent 55%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  top: -22%;
  left: -12%;
  width: 62vmax;
  height: 62vmax;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(124, 58, 237, 0.55), transparent 60%);
  filter: blur(70px);
  z-index: -1;
  pointer-events: none;
  animation: drift 18s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  bottom: -28%;
  right: -14%;
  width: 58vmax;
  height: 58vmax;
  border-radius: 50%;
  background: radial-gradient(circle at 60% 60%, rgba(34, 211, 238, 0.5), transparent 60%);
  filter: blur(70px);
  z-index: -1;
  pointer-events: none;
  animation: drift2 24s ease-in-out infinite alternate;
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(6vmax, 5vmax) scale(1.18); }
}

@keyframes drift2 {
  0%   { transform: translate(0, 0) scale(1.1); }
  100% { transform: translate(-6vmax, -5vmax) scale(1); }
}

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

.container {
  width: min(1080px, 92%);
  margin: 0 auto;
}

/* ---------- Header ---------- */
.site-header {
  padding: 14px 0 8px;
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
}

.logo img {
  height: 42px;
  width: auto;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.45));
}

.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav a:hover {
  color: #d6daff;
  background: rgba(109, 92, 255, 0.16);
  border-color: rgba(139, 148, 255, 0.45);
  box-shadow: 0 6px 20px rgba(109, 92, 255, 0.35);
}

/* ---------- Main grid ---------- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 16px;
  margin-top: 12px;
  padding-bottom: 10px;
}

.left-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--card-glow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 34px;
  margin-top: 22px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 0;
  padding: 22px 24px;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  background: linear-gradient(90deg, #4f46e5, #8b5cf6, #d946ef, #06b6d4, #4f46e5);
  background-size: 300% 100%;
  animation: gradientShift 6s linear infinite;
}

.hero::after {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 70, 239, 0.22), transparent 70%);
  pointer-events: none;
  animation: floaty 12s ease-in-out infinite alternate;
}

@keyframes floaty {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-46px, 36px) scale(1.18); }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3), var(--accent-2));
  background-size: 220% 220%;
  animation: gradientShift 5s ease infinite;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero h1 {
  margin: 10px 0 8px;
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-4), var(--accent-3), var(--accent));
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 8s linear infinite;
}

.ip-box {
  position: relative;
  padding: 14px 16px;
  border-radius: 16px;
  text-align: center;
  border: 2px solid transparent;
  background: linear-gradient(rgba(13, 15, 36, 0.92), rgba(13, 15, 36, 0.92)) padding-box,
    linear-gradient(135deg, #6d5cff, #d946ef, #22d3ee, #6d5cff) border-box;
  background-size: 100% 100%, 300% 300%;
  animation: boxGlow 3s ease-in-out infinite;
}

@keyframes boxGlow {
  0%, 100% {
    box-shadow: 0 0 22px rgba(124, 58, 237, 0.35), inset 0 0 16px rgba(124, 58, 237, 0.12);
  }
  50% {
    box-shadow: 0 0 46px rgba(217, 70, 239, 0.55), inset 0 0 26px rgba(217, 70, 239, 0.2);
  }
}

.ip-display {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: clamp(1.45rem, 3.3vw, 2.2rem);
  letter-spacing: 1px;
  background: linear-gradient(90deg, #a5b4fc, var(--accent-2), var(--accent-4), var(--accent-3), #a5b4fc);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  word-break: break-all;
  animation: gradientShift 9s linear infinite;
  filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.5));
}

.ip-display-secondary {
  margin-top: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
  word-break: break-all;
}

.hero-sub {
  color: var(--text-dim);
  margin: 8px 0 14px;
  font-size: 0.92rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2) 55%, var(--accent-4), var(--accent-3), var(--accent));
  background-size: 260% 260%;
  animation: gradientShift 6s ease infinite;
  color: #fff;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.45);
}

.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -160%;
  width: 55%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(217, 70, 239, 0.5);
}

.btn-primary:hover::after {
  left: 160%;
}

.btn-outline {
  background: rgba(109, 92, 255, 0.08);
  color: #cdd2ff;
  border-color: rgba(139, 148, 255, 0.45);
}

.btn-outline:hover {
  background: rgba(109, 92, 255, 0.18);
  border-color: rgba(165, 180, 252, 0.7);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Details grid ---------- */
.ip-details {
  background: var(--card-sub);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 9px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.detail-item {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--card-border);
  border-top: 2px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.detail-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(109, 92, 255, 0.35);
}

.detail-item:nth-child(1) {
  border-top-color: #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.16), rgba(255, 255, 255, 0.03));
}
.detail-item:nth-child(2) {
  border-top-color: #0ea5e9;
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.16), rgba(255, 255, 255, 0.03));
}
.detail-item:nth-child(3) {
  border-top-color: #8b5cf6;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.18), rgba(255, 255, 255, 0.03));
}
.detail-item:nth-child(4) {
  border-top-color: #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.16), rgba(255, 255, 255, 0.03));
}
.detail-item:nth-child(5) {
  border-top-color: #d946ef;
  background: linear-gradient(180deg, rgba(217, 70, 239, 0.18), rgba(255, 255, 255, 0.03));
}
.detail-item:nth-child(6) {
  border-top-color: #06b6d4;
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.16), rgba(255, 255, 255, 0.03));
}
.detail-item:nth-child(7) {
  border-top-color: #6366f1;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.18), rgba(255, 255, 255, 0.03));
}
.detail-item:nth-child(8) {
  border-top-color: #14b8a6;
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.16), rgba(255, 255, 255, 0.03));
}

.detail-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}

.detail-value {
  font-size: 0.78rem;
  font-weight: 600;
  word-break: break-word;
}

/* ---------- Ad slots ---------- */
.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed rgba(139, 148, 255, 0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(109, 92, 255, 0.08), rgba(34, 211, 238, 0.05));
  color: var(--text-dim);
  text-align: center;
  padding: 14px;
  margin-top: 14px;
  min-height: 90px;
}

.ad-slot-top { min-height: 100px; }

.ad-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7a84ad;
}

.ad-hint {
  font-size: 0.85rem;
}

.ad-slot .adsbygoogle {
  width: 100%;
}

.ad-slot-footer { margin-top: 0; }

.ad-slot-footer + .ad-slot-footer { margin-top: 14px; }

/* ---------- Map ---------- */
.map-section {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  padding: 20px 22px 16px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-4), var(--accent-3), var(--accent));
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 8s linear infinite;
}

.section-note {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.map-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.map-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #aab2d8;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-source.is-you {
  background: linear-gradient(135deg, #4f46e5, #06b6d4, #4f46e5);
  background-size: 250% 250%;
  animation: gradientShift 6s ease infinite;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.map-source.is-lookup {
  background: linear-gradient(135deg, #7c3aed, #d946ef, #7c3aed);
  background-size: 250% 250%;
  animation: gradientShift 6s ease infinite;
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.35);
}

.map {
  height: 480px;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  z-index: 0;
}

.map .leaflet-popup-content {
  font-family: "Inter", sans-serif;
  color: #111;
}

.map .leaflet-popup-content-wrapper {
  border-radius: 10px;
}

.map .leaflet-popup-content a {
  color: #4f46e5;
}

/* ---------- Lookup ---------- */
.lookup-block {
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}

.lookup-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.lookup-form {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  align-self: stretch;
}

.ip-input {
  flex: 1;
  min-width: 200px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ip-input:focus {
  border-color: var(--accent-4);
  box-shadow: 0 0 0 4px rgba(217, 70, 239, 0.25);
}

.ip-input::placeholder {
  color: #6b74a3;
}

.form-error {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 6px;
  min-height: 1.1em;
}

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

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 6px;
  padding: 6px 0 10px;
  flex-shrink: 0;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  text-align: center;
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.footer-disclaimer {
  font-size: 0.72rem;
  opacity: 0.8;
}

/* ---------- SEO content ---------- */
.seo-content {
  margin-top: 16px;
  padding: 26px 30px;
}

.seo-content h2 {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-4), var(--accent-3), var(--accent));
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 8s linear infinite;
}

.seo-content p {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-top: 10px;
}

.seo-content strong {
  color: var(--text);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: linear-gradient(135deg, var(--ok), #0d9488);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 12px 22px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Loading ---------- */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .map {
    height: 320px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 4px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    gap: 10px;
  }

  .site-header {
    padding-top: 12px;
  }

  .logo img {
    height: 34px;
  }

  .nav a {
    padding: 7px 12px;
    font-size: 0.85rem;
  }

  .hero {
    padding: 18px 18px 20px;
  }

  .ip-details {
    padding: 8px;
  }

  .detail-item {
    padding: 7px 10px;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 20px;
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .lookup-form {
    flex-direction: column;
  }

  .ip-input {
    width: 100%;
    min-width: 0;
  }

  .lookup-form .btn {
    width: 100%;
  }

  .map {
    height: 280px;
  }

  .map-source {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 360px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .hero::before,
  .hero::after,
  .badge,
  .hero h1,
  .ip-box,
  .ip-display,
  .section-head h2,
  .seo-content h2,
  .btn-primary,
  .map-source.is-you,
  .map-source.is-lookup {
    animation: none;
  }

  .ip-display {
    filter: none;
  }
}
