:root {
  --bg: #07090c;
  --panel: #0b1016;
  --panel-hover: #0e151c;
  --line: #1b2530;
  --line-strong: #2c3a47;
  --text: #eef2ea;
  --text-soft: #c3ccc5;
  --muted: #8593a0;
  --accent: #d8ff4f;
  --accent-dim: rgba(216, 255, 79, 0.12);
  --teal: #6ee7d8;
  --danger: #ff7d6b;
  --font-sans: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --max-width: 1160px;
}

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

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(55% 38% at 82% -8%, rgba(216, 255, 79, 0.08), transparent 70%),
    radial-gradient(40% 30% at 8% 0%, rgba(110, 231, 216, 0.05), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 88px 88px;
  -webkit-mask-image: radial-gradient(ellipse 90% 65% at 50% 0%, #000 12%, transparent 74%);
  mask-image: radial-gradient(ellipse 90% 65% at 50% 0%, #000 12%, transparent 74%);
  pointer-events: none;
  z-index: 0;
}

.topbar,
main,
.footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 32px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

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

/* ---------- 顶部栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 26px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--accent);
  background: var(--panel);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-sub {
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(11, 16, 22, 0.7);
  color: var(--text-soft);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(216, 255, 79, 0.45);
  animation: pulse 2.2s ease-out infinite;
}

[data-state="loading"] .status-dot {
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(110, 231, 216, 0.4);
}

[data-state="error"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(255, 125, 107, 0.4);
  animation: none;
}

/* ---------- 主视觉 ---------- */

main {
  flex: 1;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: center;
  gap: 56px;
  padding-block: 72px 54px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: 0.24em;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.ip-wrap {
  margin-top: 22px;
}

.ip-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.ip-type {
  padding: 2px 7px;
  border: 1px solid rgba(216, 255, 79, 0.4);
  border-radius: 5px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.ip-type.is-v6 {
  border-color: rgba(110, 231, 216, 0.45);
  background: rgba(110, 231, 216, 0.1);
  color: var(--teal);
}

.ip {
  display: block;
  min-height: 1.08em;
  color: #f7faf3;
  font-family: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.5rem, 6vw, 4.7rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.06;
  word-break: break-all;
}

.ip.is-long {
  font-size: clamp(1.8rem, 4.2vw, 3.4rem);
  letter-spacing: -0.02em;
  line-height: 1.14;
}

.ip-skeleton {
  display: block;
  width: min(480px, 72%);
  height: 0.72em;
  margin-block: 0.1em;
  border-radius: 10px;
  background: linear-gradient(100deg, #121922 25%, #1d2833 40%, #121922 60%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.alt-ip {
  margin-top: 14px;
  color: var(--muted);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.alt-ip[hidden] {
  display: none;
}

.location {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  color: var(--text-soft);
  font-size: 17px;
  letter-spacing: 0.01em;
}

.flag {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 24px;
  border: 1px solid rgba(216, 255, 79, 0.35);
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding-inline: 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #0a0d05;
}

.btn-primary:hover {
  background: #e4ff74;
}

.btn-primary.copied {
  background: var(--teal);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text-soft);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.source {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
}

/* ---------- 雷达 ---------- */

.radar {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 255, 79, 0.06), rgba(7, 9, 12, 0) 68%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.radar-ring {
  position: absolute;
  border: 1px solid rgba(216, 255, 79, 0.13);
  border-radius: 50%;
}

.ring-1 {
  inset: 0;
  border-color: rgba(216, 255, 79, 0.22);
}

.ring-2 {
  inset: 14%;
}

.ring-3 {
  inset: 28%;
}

.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(216, 255, 79, 0.32), rgba(216, 255, 79, 0.06) 22%, transparent 42%);
  -webkit-mask: radial-gradient(circle, transparent 0 17%, #000 18%);
  mask: radial-gradient(circle, transparent 0 17%, #000 18%);
  animation: sweep 5s linear infinite;
}

[data-state="ready"] .radar-sweep {
  animation-duration: 9s;
}

.radar-axis {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.axis-x {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}

.axis-y {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.radar-core {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  gap: 10px;
  transform: translate(-50%, -50%);
}

.radar-core-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(216, 255, 79, 0.1), 0 0 22px rgba(216, 255, 79, 0.55);
  animation: ping 2.4s ease-out infinite;
}

.radar-core-label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

.radar-tick {
  position: absolute;
  color: rgba(255, 255, 255, 0.28);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.tick-a {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.tick-b {
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.tick-c {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.tick-d {
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

/* ---------- 信息面板 ---------- */

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(13, 18, 24, 0.92), rgba(8, 12, 17, 0.92));
  overflow: hidden;
  margin-bottom: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-no {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.panel-title h2 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.coords {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.12em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.stat {
  min-width: 0;
  padding: 22px 24px 24px;
  background: var(--panel);
  transition: background-color 0.2s ease;
}

.stat:hover {
  background: var(--panel-hover);
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.09em;
}

.stat-value {
  min-height: 26px;
  margin-top: 10px;
  color: var(--text);
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.stat-code {
  margin-left: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

[data-state="loading"] .stat-value {
  min-width: 84px;
  color: transparent;
  border-radius: 5px;
  background: linear-gradient(100deg, #111821 25%, #1c2733 40%, #111821 60%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  user-select: none;
}

[data-state="loading"] .stat-value.mono {
  min-width: 70px;
}

[data-state="loading"] .location {
  color: var(--muted);
}

[data-state="error"] .ip {
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  letter-spacing: 0.01em;
  color: var(--text-soft);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 64px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

.notice-mark {
  color: var(--accent);
  font-size: 12px;
  line-height: 1.75;
}

/* ---------- 页脚 ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 22px 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ---------- 动效 ---------- */

.hero-copy > * {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.hero-copy > :nth-child(1) { animation-delay: 0.05s; }
.hero-copy > :nth-child(2) { animation-delay: 0.12s; }
.hero-copy > :nth-child(3) { animation-delay: 0.19s; }
.hero-copy > :nth-child(4) { animation-delay: 0.26s; }

.radar {
  opacity: 0;
  animation: fade 1s ease 0.2s forwards;
}

.panel,
.notice {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.3, 1) 0.32s forwards;
}

.notice {
  animation-delay: 0.42s;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  to {
    opacity: 1;
  }
}

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

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

@keyframes ping {
  0% { box-shadow: 0 0 0 5px rgba(216, 255, 79, 0.12), 0 0 22px rgba(216, 255, 79, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(216, 255, 79, 0), 0 0 22px rgba(216, 255, 79, 0.35); }
  100% { box-shadow: 0 0 0 5px rgba(216, 255, 79, 0.12), 0 0 22px rgba(216, 255, 79, 0.5); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(216, 255, 79, 0.4); }
  70% { box-shadow: 0 0 0 7px rgba(216, 255, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(216, 255, 79, 0); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 32px;
  }

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

@media (max-width: 820px) {
  .topbar,
  main,
  .footer {
    padding-inline: 22px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-block: 52px 40px;
  }

  .radar {
    display: none;
  }

  .ip {
    font-size: clamp(2.3rem, 9vw, 3.6rem);
  }
}

@media (max-width: 560px) {
  .brand-sub {
    display: none;
  }

  .status {
    padding-inline: 10px;
  }

  .hero {
    padding-block: 42px 34px;
  }

  .ip-label {
    font-size: 12px;
  }

  .location {
    font-size: 15px;
  }

  .actions {
    gap: 10px;
    margin-top: 28px;
  }

  .btn {
    height: 42px;
    padding-inline: 16px;
    font-size: 13px;
  }

  .source {
    flex-basis: 100%;
    margin-left: 2px;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 18px 20px;
  }

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

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

  .stat-value {
    font-size: 15.5px;
  }

  .notice {
    margin-bottom: 44px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .hero-copy > *,
  .radar,
  .panel,
  .notice {
    opacity: 1;
    transform: none;
  }
}
