:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f0f0ee;
  --glass: rgba(255, 255, 255, 0.82);
  --ink: #111214;
  --ink-2: #4a4d55;
  --ink-3: #8a8d95;
  --line: #e4e4e0;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.14);
  --geo: #ff5a36;
  --ok: #1f9d55;
  --warn: #e08a00;
  --bad: #e5484d;
  --shadow: 0 1px 2px rgba(17, 18, 20, 0.04), 0 12px 32px -12px rgba(17, 18, 20, 0.18);
  --r-s: 8px;
  --r-m: 14px;
  --r-l: 22px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e0f11;
    --surface: #16171a;
    --surface-2: #1d1f23;
    --glass: rgba(22, 23, 26, 0.82);
    --ink: #f2f2f0;
    --ink-2: #b4b6bc;
    --ink-3: #7c7f87;
    --line: #2a2c31;
    --accent: #3d9bff;
    --accent-soft: rgba(61, 155, 255, 0.18);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e0f11;
  --surface: #16171a;
  --surface-2: #1d1f23;
  --glass: rgba(22, 23, 26, 0.82);
  --ink: #f2f2f0;
  --ink-2: #b4b6bc;
  --ink-3: #7c7f87;
  --line: #2a2c31;
  --accent: #3d9bff;
  --accent-soft: rgba(61, 155, 255, 0.18);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }

/* ---------- шапка ---------- */

.top {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.logo {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center; flex: none;
}
.muted { color: var(--ink-3); font-weight: 500; }
.lookup {
  margin-left: auto;
  display: flex; align-items: center;
  height: 38px; width: min(320px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 0 4px 0 12px;
  transition: border-color .15s, box-shadow .15s;
}
.lookup:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lookup input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-family: var(--mono); font-size: 13px; }
.lookup input::placeholder { font-family: Inter, system-ui, sans-serif; font-size: 14px; color: var(--ink-3); }
.lookup button, .icon-btn {
  border: 0; background: none; cursor: pointer; color: var(--ink-2);
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
}
.lookup button:hover, .icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; flex: none; }
.i-moon { display: none; }
:root[data-theme='dark'] .i-sun { display: none; }
:root[data-theme='dark'] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .i-sun { display: none; }
  :root:not([data-theme='light']) .i-moon { display: block; }
}

main { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------- карта и карточка IP ---------- */

.hero {
  position: relative;
  height: clamp(440px, 62vh, 640px);
  border-radius: var(--r-l);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  isolation: isolate;
}
.map { position: absolute; inset: 0; }
.map-note {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  color: var(--ink-3); font-size: 14px;
  background:
    radial-gradient(circle at 70% 40%, var(--accent-soft), transparent 50%),
    repeating-linear-gradient(0deg, transparent 0 39px, var(--line) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, var(--line) 39px 40px);
}

/* приглушённая подложка в светлой теме и ночная — в тёмной */
.map [class*='ground-pane'] { filter: saturate(0.55) contrast(1.02) brightness(1.02); }
:root[data-theme='dark'] .map [class*='ground-pane'] { filter: invert(1) hue-rotate(180deg) saturate(0.5) brightness(0.92) contrast(0.92); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .map [class*='ground-pane'] { filter: invert(1) hue-rotate(180deg) saturate(0.5) brightness(0.92) contrast(0.92); }
}
.map [class*='copyrights-pane'] { opacity: .75; }

.ipcard {
  position: absolute; left: 24px; top: 24px; z-index: 2000;
  width: min(440px, calc(100% - 48px));
  padding: 22px 24px 20px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
}
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.ip-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.ip {
  font-size: clamp(28px, 4.4vw, 40px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums; word-break: break-all;
}
.ip.v6 { font-size: clamp(18px, 2.6vw, 24px); font-family: var(--mono); font-weight: 500; letter-spacing: 0; }
.copy {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2);
  transition: background .15s, color .15s, border-color .15s;
}
.copy:hover { color: var(--ink); border-color: var(--ink-3); }
.copy.done { color: var(--ok); border-color: var(--ok); }
.place { margin-top: 14px; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.place .flag { font-size: 22px; line-height: 1; }
.isp { margin-top: 2px; color: var(--ink-2); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip {
  height: 26px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.back { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: 500; color: var(--accent); text-decoration: none; }
.back:hover { text-decoration: underline; }

/* метка на карте */
.pin { position: relative; width: 22px; height: 22px; transform: translate(-11px, -11px); }
.pin::before, .pin::after { content: ''; position: absolute; inset: 0; border-radius: 50%; }
.pin::before { background: var(--c, var(--accent)); border: 3px solid #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); z-index: 1; }
.pin::after { background: var(--c, var(--accent)); animation: pulse 2.4s ease-out infinite; }
.pin.geo { --c: var(--geo); }
@keyframes pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(4.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin::after { animation: none; opacity: 0; } }

/* ---------- карточки ---------- */

.grid {
  display: grid; gap: 16px; margin: 16px 0 32px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 22px 24px 24px; min-width: 0;
}
.card.wide { grid-column: 1 / -1; }
.card h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.lead { margin: 6px 0 16px; color: var(--ink-2); font-size: 14px; }

.kv { margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--ink-3); font-size: 14px; flex: none; }
.kv dd { margin: 0; text-align: right; font-weight: 500; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-variant-ligatures: none; font-family: var(--mono); font-size: 13px; font-weight: 400; }
.kv dd .none { color: var(--ink-3); font-weight: 400; }

.btn {
  margin-top: 16px; height: 38px; padding: 0 16px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: default; }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--ink-3); }
.hint.err { color: var(--bad); }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; padding-top: 2px; }
.checks b { display: block; font-size: 14px; font-weight: 600; }
.checks .sub { display: block; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.dot { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--ink-3); opacity: .5; }
.ok .dot { background: var(--ok); opacity: 1; }
.warn .dot { background: var(--warn); opacity: 1; }
.bad .dot { background: var(--bad); opacity: 1; }

.api { display: grid; gap: 10px; }
.cmd {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  background: var(--surface-2); border-radius: 10px; padding: 10px 10px 10px 14px;
}
.cmd code { font-variant-ligatures: none; font-family: var(--mono); font-size: 13px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.cmd code::-webkit-scrollbar { display: none; }
.cmd .c { color: var(--ink-3); }
.cmd .d { display: block; font-family: Inter, system-ui, sans-serif; font-size: 12px; color: var(--ink-3); margin-top: 2px; white-space: normal; }
.cmd .copy { height: 28px; padding: 0 10px; }

.foot {
  max-width: 1240px; margin: 0 auto; padding: 8px 24px 40px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  font-size: 13px; color: var(--ink-3);
}

/* ---------- узкие экраны ---------- */

@media (max-width: 720px) {
  .top { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .brand-name .muted { display: none; }
  .lookup { order: 3; width: 100%; margin-left: 0; }
  .icon-btn { margin-left: auto; }
  main { padding: 0 16px; }
  .hero { height: auto; border-radius: var(--r-m); overflow: visible; background: none; box-shadow: none; }
  .map { position: relative; height: 300px; border-radius: var(--r-m); overflow: hidden; background: var(--surface-2); }
  .map-note { height: 300px; bottom: auto; border-radius: var(--r-m); }
  .ipcard { position: relative; left: auto; bottom: auto; width: auto; margin-top: -40px; margin-inline: 10px; }
  .card { padding: 18px 18px 20px; }
  .foot { padding: 8px 16px 32px; }
}
