:root {
  --font-sans: "Outfit", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --bg: #f5f6f8;
  --ink: #1a1d23;
  --muted: #5c6570;
  --line: #e3e6ee;
  --card: #ffffff;
  --pine: #0e6b4f;
  --pine-dark: #0a523c;
  --pine-soft: #e8f6f0;
  --amber: #8a4e0f;
  --amber-soft: #fff6e8;
  --red: #8e3030;
  --red-soft: #fdeeee;
  --blue: #1d4e89;
  --shadow: 0 10px 30px rgba(26, 29, 35, 0.05);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans), sans-serif;
  font-size: 1.02rem;
  line-height: 1.65;
}

h1, h2, h3 {
  font-family: var(--font-display), Georgia, serif;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.18;
}

h1 { font-size: clamp(2rem, 4vw, 3.15rem); margin: 0 0 0.55rem; }
h2 { font-size: clamp(1.45rem, 2.4vw, 2rem); margin: 0 0 0.55rem; }
h3 { font-size: 1.15rem; margin: 0 0 0.35rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--pine-dark); }
button, input { font: inherit; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--ink);
  color: white;
  padding: 8px 12px;
  z-index: 50;
}
.skip:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  background: #1c2430;
  border-bottom: 3px solid #0e6b4f;
  box-shadow: none;
}

.header-inner, .wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.98rem;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: block;
  flex: 0 0 auto;
  background: transparent;
  box-shadow: none;
}
.logo-word {
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 1.12rem;
  line-height: 1;
}
.logo-word span { color: #9ee0c4; }

.site-header nav, .site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-header nav a {
  text-decoration: none;
  color: #e7ebf0;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  background: transparent;
}

.site-header nav a[aria-current="page"] { background: #0e6b4f; color: #fff; }
.site-header nav a:hover { background: rgba(255, 255, 255, 0.08); }
.site-header nav a[aria-current="page"]:hover { background: #0c5c44; }

.nav-more {
  display: none;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.nav-more::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 6px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}
.nav-more-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 3;
  min-width: 176px;
  padding: 6px;
  border-radius: 12px;
  background: #1c2430;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}
.nav-more-panel a {
  display: block;
  text-decoration: none;
  color: #e7ebf0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
}
.nav-more-panel a[aria-current="page"] { background: #0e6b4f; color: #fff; }
.nav-more-panel a:hover { background: rgba(255, 255, 255, 0.08); }

.site-footer nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
}
.site-footer nav a:hover { background: #eef1f5; }

.page { padding: 36px 0 20px; }
.page-intro { max-width: 680px; margin-bottom: 22px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--pine-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.lede, .panel-lead { color: var(--muted); max-width: 62ch; }
.panel-lead { margin: 6px 0 0; }

.panel, .side-card, .prose, .faq-list article, .guide-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.panel, .side-card, .prose { padding: 22px; }
.panel-title { font-size: clamp(1.6rem, 3vw, 2.1rem); }

.ip-well {
  margin-top: 18px;
  padding: 8px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.ip-kicker {
  margin: 0 0 14px;
  color: var(--ink);
  font-family: var(--font-display), Georgia, serif;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  text-transform: none;
}

.ip-pair { display: grid; gap: 10px; }

.ip-line-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 14px;
  border-radius: 14px;
  background: #f7f8fa;
  border: 1px solid #eef0f4;
}

.ip-kind {
  font-weight: 700;
  color: var(--pine-dark);
}

.ip-num, .ip-value {
  margin: 0;
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: clamp(1.02rem, 2.3vw, 1.35rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.03em;
  word-break: break-all;
  color: var(--ink);
}

.ip-value.sm { font-size: 1rem; line-height: 1.4; }

.ip-actions, .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.ip-actions {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.ip-well .copy-btn {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
  padding: 8px 14px;
  min-height: 40px;
}

.ip-well .text-btn {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.leaflet-control-attribution { display: none !important; }

.copy-btn, .primary-btn, .text-btn, .chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 16px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.primary-btn, .copy-btn {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
}

.primary-btn:hover, .copy-btn:hover { background: var(--pine-dark); }
.text-btn:hover, .chip:hover { background: #f3f5f8; }
.copy-btn:disabled { opacity: 0.55; cursor: default; }

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid rgba(14, 107, 79, 0.35);
  outline-offset: 2px;
}

.pills, .examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--pine-soft);
  color: var(--pine-dark);
  font-size: 0.9rem;
  font-weight: 650;
}
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.neutral { background: #f3f4f7; color: var(--ink); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
}
.banner strong { display: block; margin-bottom: 2px; }
.banner p { margin: 0; }
.banner.warn { background: var(--amber-soft); }
.banner.bad { background: var(--red-soft); }
.banner.good { background: var(--pine-soft); }
.banner.neutral { background: #f4f5f7; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.meta-card {
  padding: 14px;
  border-radius: 14px;
  background: #f7f8fa;
  border: 1px solid #eef0f4;
  min-height: 96px;
}

.meta-card span, .detail-list dt, .field span, .alt-row b {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
}

.full-ip { grid-column: 1 / -1; }

.full-ip code {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: clamp(1.02rem, 2.2vw, 1.28rem);
  line-height: 1.45;
  word-break: break-all;
  color: var(--ink);
}

.full-ip .text-btn { margin-top: 12px; }

.quiet { color: var(--muted); }
.extra-ips, .leak-box { margin-top: 16px; }

.alt-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.alt-row code {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.95rem;
  word-break: break-all;
}

.leak-alert, .leak-ok {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 14px;
}
.leak-alert { background: var(--amber-soft); }
.leak-ok { background: var(--pine-soft); }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.guide-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  min-height: 148px;
}
.guide-card strong { font-size: 1.08rem; }
.guide-card span { color: var(--muted); }
.guide-card:hover { border-color: #cfd6e2; }

.skeleton {
  height: 16px;
  margin: 8px 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #eceff3, #f8f9fb, #eceff3);
  background-size: 200% 100%;
  animation: shine 1.2s linear infinite;
}
.skeleton.lg { height: 42px; }
@keyframes shine {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.prose, .faq { margin-top: 28px; }
.prose section + section { margin-top: 22px; }
.faq-list { display: grid; gap: 12px; }
.faq-list article { padding: 16px 18px; box-shadow: none; }

.location-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px;
  align-items: start;
}

.field { display: block; margin: 12px 0; }
.field input {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--font-mono), ui-monospace, monospace;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 16px 0 0;
}
.detail-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.detail-list dt { margin: 0; }
.detail-list dd {
  margin: 0;
  min-width: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.map-shell {
  position: sticky;
  top: 72px;
  height: min(640px, calc(100vh - 96px));
  min-height: 460px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e7ebf0;
  z-index: 0;
}
.map-canvas, #map { height: 100%; width: 100%; min-height: 0; background: #f3f5f4; }
.map-card {
  position: absolute;
  z-index: 500;
  left: 14px;
  top: 14px;
  max-width: min(320px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 30px rgba(28, 36, 48, 0.12);
}
.map-card-kicker {
  margin: 0;
  color: var(--pine-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.map-card-place {
  margin: 4px 0 0;
  color: var(--ink);
  font-family: var(--font-display), Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: -0.03em;
}
.map-card-ip {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.92rem;
  word-break: break-all;
}
.map-pin-wrap { background: transparent; border: 0; }
.map-pin {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 50% 0;
  background: #0e6b4f;
  border: 2px solid #fff;
  box-shadow: 0 8px 16px rgba(14, 107, 79, 0.35);
  transform: rotate(-45deg);
}
.map-pin::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  left: 5px;
  top: 5px;
  border-radius: 50%;
  background: #fff;
}
.map-canvas img { max-width: none; }

.ip-toast {
  position: fixed;
  top: 64px;
  right: max(16px, calc((100vw - 1080px) / 2));
  z-index: 1100;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(340px, calc(100% - 32px));
  margin: 0;
  padding: 8px 28px 8px 12px;
  border-radius: 12px;
  background: rgba(28, 36, 48, 0.78);
  color: #fff;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px rgba(28, 36, 48, 0.16);
}
.ip-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3dce8a;
  flex: 0 0 auto;
  animation: ip-pulse 1.4s ease-in-out infinite;
}
@keyframes ip-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.2; transform: scale(0.7); }
}
.ip-toast-label {
  color: #9ee0c4;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ip-toast-value {
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.3;
  word-break: break-all;
}
.ip-toast-close {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}
.lookup-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.lookup-result .ip-value,
.lookup-result .pills,
.lookup-result .quiet { margin: 0; }

.site-footer {
  margin-top: 36px;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 26px 0 32px;
  color: var(--muted);
}
.footer-grid {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.footer-grid p { margin: 6px 0 0; max-width: 36ch; }
.site-footer nav a { color: var(--muted); }

.error-text { color: var(--red); font-weight: 650; }
.noscript-note {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--amber-soft);
  border-radius: 12px;
}

@media (max-width: 980px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 4px 0;
  }
  .header-inner { position: relative; }
  .logo { gap: 6px; }
  .logo-mark { width: 26px; height: 26px; border-radius: 7px; }
  .logo-word { font-size: 0.92rem; }
  .nav-more.is-needed { display: inline-flex; }
  .nav-more-panel.is-open { display: block; }
  .site-header nav {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;
    justify-content: flex-end;
    padding-bottom: 0;
    scrollbar-width: none;
  }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 6px;
  }
}

@media (max-width: 900px) {
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .guide-grid, .location-grid { grid-template-columns: 1fr; }
  .location-grid { gap: 18px; }
  .side-card { position: relative; z-index: 1; width: 100%; }
  .side-card .row-actions { flex-direction: column; align-items: stretch; }
  .side-card .row-actions button { width: 100%; white-space: normal; }
  .map-shell { position: relative; z-index: 0; width: 100%; height: 380px; min-height: 380px; max-height: none; margin-top: 4px; }
  .map-card { top: auto; bottom: 12px; left: 12px; right: 12px; max-width: none; }
  .footer-grid { flex-direction: column; }
  .guide-card { min-height: 0; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.85rem; }
  .wrap, .header-inner, .footer-grid { width: min(1080px, calc(100% - 24px)); }
  .panel, .side-card, .prose { padding: 16px; }
  .ip-well { padding-top: 4px; }
  .ip-line-row { grid-template-columns: 1fr auto; padding: 12px; }
  .ip-kind { grid-column: 1 / -1; }
  .ip-num { font-size: 1rem; }
  .ip-actions, .row-actions { flex-direction: column; align-items: stretch; }
  .ip-actions button, .row-actions button, .row-actions .primary-btn, .row-actions .text-btn { width: 100%; }
  .ip-line-row .copy-btn { width: auto; justify-self: end; }
  .alt-row, .detail-row { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .detail-row { gap: 2px; padding: 12px 0; }
  .ip-toast {
    right: 12px;
    max-width: calc(100% - 24px);
  }
  .page { padding-top: 22px; }
  .page-intro { margin-bottom: 16px; }
  .leaflet-control-zoom { margin-top: 10px !important; margin-right: 10px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
