:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111827;
  --panel-deep: #0b1220;
  --line: rgba(148, 163, 184, 0.2);
  --text: #f8fafc;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --success: #34d399;
  --shadow: 0 24px 80px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button {
  font: inherit;
}

.shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 48px 20px;
}

.panel {
  width: min(100%, 760px);
  padding: clamp(26px, 5vw, 46px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: enter 520ms ease-out both;
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.8vw, 2.75rem);
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: 0;
}

.country-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 10px 6px 8px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 8px;
  color: var(--soft);
  background: var(--panel-deep);
}

.country-badge[hidden] {
  display: none;
}

.country-badge__flag {
  font-size: 1.35rem;
  line-height: 1;
}

.country-badge__code {
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0;
}

.ip-display {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
  padding: clamp(18px, 3vw, 24px);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 8px;
  background: var(--panel-deep);
}

.ip-display__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ip-display strong {
  overflow-wrap: anywhere;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1.55rem, 3.9vw, 2.35rem);
  font-weight: 760;
  line-height: 1.16;
  letter-spacing: 0;
}

.has-long-ip .ip-display strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: clamp(1.05rem, 2.7vw, 1.55rem);
  font-weight: 700;
  line-height: 1.38;
}

.details {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line);
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.42fr) minmax(0, 1fr);
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 680;
}

dd {
  min-width: 0;
  margin: 0;
  color: var(--soft);
  font-size: 0.95rem;
  font-weight: 640;
  text-align: right;
  overflow-wrap: anywhere;
}

.detail-row:first-child dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.actions button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(56, 189, 248, 0.36);
  border-radius: 8px;
  color: #04111d;
  background: var(--accent);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 750;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.actions button:hover {
  transform: translateY(-1px);
  background: #7dd3fc;
}

.actions button:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.35);
  outline-offset: 3px;
}

.actions .button-secondary {
  color: var(--text);
  background: rgba(15, 23, 42, 0.76);
}

.actions .button-secondary:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(125, 211, 252, 0.56);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  padding: 11px 14px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 8px;
  color: #d1fae5;
  background: rgba(6, 78, 59, 0.82);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

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

@media (max-width: 560px) {
  .shell {
    align-items: start;
    padding: 20px 14px;
  }

  .actions {
    flex-direction: column;
  }

  .panel__header {
    gap: 14px;
  }

  .country-badge {
    min-height: 34px;
    padding: 5px 8px 5px 7px;
  }

  .country-badge__flag {
    font-size: 1.15rem;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  dd {
    text-align: left;
  }

  .actions button {
    width: 100%;
  }
}

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