@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&family=Sora:wght@400;600&display=swap&subset=latin-ext");

:root {
  color-scheme: dark;
  font-family: "Space Grotesk", "Sora", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: radial-gradient(circle at 10% 20%, #1c1140 0%, #030112 55%);
  --bg-highlight: rgba(7, 13, 43, 0.6);
  --card: rgba(9, 16, 45, 0.92);
  --card-muted: rgba(255, 255, 255, 0.04);
  --border: rgba(120, 134, 181, 0.35);
  --border-strong: rgba(255, 255, 255, 0.5);
  --muted: rgba(222, 232, 255, 0.78);
  --muted-strong: rgba(248, 251, 255, 0.92);
  --text: #f8fbff;
  --accent: #7cf0d6;
  --accent-strong: #7f7dff;
  --danger: #ff92b0;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(120deg, rgba(6, 20, 53, 0.95), rgba(4, 3, 20, 0.95)),
    var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 3rem;
}

.page {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

#connection-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#connection-indicator.htmx-request {
  opacity: 1;
  transform: translateY(0);
}

#connection-indicator::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  animation: spin 0.9s linear infinite;
}

.app-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.brand-title {
  margin: 0;
  font-size: clamp(2.75rem, 8vw, 4.5rem);
  letter-spacing: 0.02em;
  font-weight: 700;
}

.brand-title span {
  color: var(--accent);
  text-shadow: 0 0 18px rgba(124, 240, 214, 0.55);
}

.hero-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.45em;
  font-size: 0.7rem;
  color: var(--muted);
}

.lead {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.panel-card {
  border-radius: 1.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 2rem;
  box-shadow: 0 25px 80px rgba(1, 3, 20, 0.55);
  backdrop-filter: blur(20px);
  animation: floatIn 0.8s ease both;
}

.panel-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.65rem;
  color: var(--muted);
}

.ip-value {
  margin: 0.6rem 0 0;
  font-size: clamp(2.5rem, 10vw, 3.5rem);
  font-weight: 600;
}

.meta-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-ghost {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.45rem 1.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px rgba(124, 240, 214, 0.25);
}

.copy-pill:focus-visible,
.copy-btn:focus-visible,
.tab-button:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px rgba(124, 240, 214, 0.35);
}

.update-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(124, 240, 214, 0.1);
  border: 1px solid rgba(124, 240, 214, 0.35);
  font-size: 0.8rem;
  color: var(--muted-strong);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.update-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(124, 240, 214, 0.85);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0 0;
}

.details-grid dd {
  margin: 0.5rem 0 0;
  color: var(--text);
  word-break: break-word;
}

.geo-card {
  margin-top: 1.5rem;
  padding: 1.2rem;
  border-radius: 1.2rem;
  background: var(--card-muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.geo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.geo-card dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem 1.5rem;
  margin: 0;
}

.geo-card dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.geo-card dd {
  margin: 0.35rem 0 0;
  color: var(--muted-strong);
  font-weight: 600;
}

.geo-pill {
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
}

.geo-empty {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.muted {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.collapsible-block {
  margin-top: 1.5rem;
  border-radius: 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.collapsible-block[open] {
  box-shadow: 0 0 25px rgba(127, 125, 255, 0.25);
  border-color: var(--accent-strong);
}

.headers-head {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.3em;
}

.headers-head span {
  font-weight: inherit;
  color: inherit;
  text-transform: uppercase;
}

.headers-head::-webkit-details-marker {
  display: none;
}

.collapsible-body {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.headers-actions {
  display: flex;
  justify-content: flex-end;
}

.headers-list {
  max-height: 320px;
  overflow: auto;
  font-size: 0.85rem;
}

.headers-list dl > div + div {
  margin-top: 1rem;
}

.headers-list dt {
  font-weight: 600;
}

.headers-list dd {
  margin: 0.2rem 0 0;
  color: var(--muted);
  word-break: break-word;
}

.api-block {
  margin-top: 1.25rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.api-block summary {
  cursor: pointer;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 600;
}

.api-block summary::-webkit-details-marker {
  display: none;
}

.api-note {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.api-body {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-actions {
  display: flex;
  justify-content: flex-end;
}

.api-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.api-link:hover,
.api-link:focus-visible {
  border-color: var(--accent);
}

.api-json {
  margin: 0;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
  line-height: 1.5;
  font-family: "Ubuntu Mono", "SFMono-Regular", Consolas, monospace;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-pill {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.copy-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translate(-50%, 20px);
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  background: rgba(12, 18, 38, 0.9);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 640px) {
  .panel-card {
    padding: 1.5rem;
  }
  .panel-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .meta-actions {
    width: 100%;
    justify-content: space-between;
  }

  .headers-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .headers-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .headers-search {
    width: 100%;
  }

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

@media (max-width: 480px) {
  body {
    padding: 1.5rem 0.75rem 2.5rem;
  }

  .meta-actions {
    gap: 0.5rem;
  }

  .btn-ghost,
  .update-pill {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .headers-head {
    padding: 0.85rem;
  }

  .headers-list {
    max-height: 220px;
  }
}

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

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