/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  color: #1a1a1a;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* === Header === */
header {
  margin-bottom: 36px;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  color: #666;
  font-size: 14px;
  margin-top: 4px;
}

/* === Sections === */
section {
  margin-bottom: 40px;
}

section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #333;
}

/* === IP Cards === */
.ip-cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.ip-card {
  flex: 1;
  min-width: 240px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ip-card .ip-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ip-card .ip-address {
  font-size: 22px;
  font-weight: 700;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  letter-spacing: -0.3px;
}

.ip-card .ip-flag {
  width: 28px;
  height: 21px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

.ip-card .ip-location {
  font-size: 14px;
  color: #555;
}

.ip-card .ip-isp {
  font-size: 13px;
  color: #888;
}

.ip-card .ip-source {
  font-size: 11px;
  color: #bbb;
  margin-top: 4px;
}

/* === Shimmer Animation === */
.shimmer-card {
  min-height: 100px;
}

.shimmer-line {
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.shimmer-line.w40 { width: 40%; }
.shimmer-line.w60 { width: 60%; }
.shimmer-line.w80 { width: 80%; }

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

/* === Ping Grid === */
.ping-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.ping-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
  transition: border-color 0.2s;
}

.ping-item:hover {
  border-color: #ddd;
}

.ping-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.ping-latency {
  font-size: 13px;
  color: #888;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  min-width: 50px;
  text-align: right;
}

.ping-dots {
  width: 100%;
  display: flex;
  gap: 4px;
}

.ping-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.3s;
}

.dot-gray   { background: #ddd; }
.dot-green  { background: #22c55e; }
.dot-lgreen { background: #84cc16; }
.dot-yellow { background: #eab308; }
.dot-red    { background: #ef4444; }

.ping-dot.pinging {
  animation: pulse 0.8s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === Routing Table === */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid #eee;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: #fafafa;
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: #666;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafafa;
}

.site-name {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* === Category Tags === */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.tag-domestic  { background: #fee2e2; color: #dc2626; }
.tag-social    { background: #f3e8ff; color: #9333ea; }
.tag-ai        { background: #fce7f3; color: #db2777; }
.tag-crypto    { background: #fef9c3; color: #a16207; }
.tag-tools     { background: #dbeafe; color: #2563eb; }
.tag-cdn       { background: #d1fae5; color: #059669; }
.tag-dev       { background: #e0e7ff; color: #4f46e5; }

/* === IP in table === */
.ip-cell {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
}

.geo-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.geo-cell .flag-sm {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}

.detect-fail {
  color: #bbb;
  font-style: italic;
}

/* === Footer === */
footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: center;
  font-size: 13px;
  color: #aaa;
}

/* === Responsive: 768px === */
@media (max-width: 768px) {
  .container {
    padding: 24px 16px;
  }

  header h1 {
    font-size: 24px;
  }

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

  th, td {
    padding: 8px 12px;
  }
}

/* === Responsive: 480px === */
@media (max-width: 480px) {
  .container {
    padding: 20px 12px;
  }

  header h1 {
    font-size: 20px;
  }

  .ip-card {
    min-width: 100%;
  }

  .ip-card .ip-address {
    font-size: 18px;
  }

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

  .ping-item {
    padding: 10px 12px;
  }

  table {
    font-size: 13px;
  }

  th, td {
    padding: 8px 10px;
  }

  .tag {
    font-size: 10px;
    padding: 1px 6px;
  }
}
