:root {
  --bg: #0b1020;
  --bg-soft: #11182d;
  --card: rgba(17, 24, 45, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #eaf1ff;
  --muted: #9fb0d3;
  --primary: #5b8cff;
  --primary-2: #7c5cff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(91, 140, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(124, 92, 255, 0.14), transparent 26%),
    linear-gradient(180deg, #07101f 0%, #0b1020 100%);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
  opacity: 0.35;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(7, 16, 31, 0.75);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-btn {
  display: none;
}

.mobile-nav-panel {
  display: none;
}

.menu-icon-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 999px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #fff;
  cursor: pointer;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 20px 40px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}

.header h1 {
  margin: 0 0 10px;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.auto-refresh-tip {
  color: #c6d4f7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.card {
  grid-column: span 6;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(14px);
}

.card.full {
  grid-column: 1 / -1;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.inline-head-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-tip {
  color: var(--muted);
  font-size: 12px;
}

.info-list {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 11px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
}

.row span {
  color: var(--muted);
  font-size: 14px;
  flex: 0 0 auto;
}

.row strong {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  word-break: break-all;
  max-width: 70%;
}

.break-all {
  word-break: break-all;
}

.card-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.05);
  color: #fff;
  border-radius: 12px;
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.09);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
}

.btn.small {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tag.waiting {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.28);
}

.tag.success {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.28);
}

.tag.error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.28);
}

.tag.info {
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.28);
}

.latency-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.latency-item {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 14px;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.latency-name {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d8e4ff;
  font-size: 14px;
  font-weight: 600;
}

.latency-icon-img {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255,255,255,0.06);
}

.latency-value {
  margin-top: 12px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.latency-value.good {
  color: #22c55e;
}

.latency-value.mid {
  color: #f59e0b;
}

.latency-value.bad {
  color: #ef4444;
}

#summary-section {
  margin-top: 16px;
}

.summary {
  line-height: 1.9;
  color: var(--text);
  white-space: pre-line;
  font-size: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 99;
  font-size: 14px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.footer {
  padding: 0 20px 36px;
}

.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.footer-desc {
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .latency-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .desktop-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .mobile-nav-panel {
    display: none;
    padding: 0 20px 16px;
    max-width: 1240px;
    margin: 0 auto;
    flex-direction: column;
    gap: 8px;
  }

  .mobile-nav-panel.open {
    display: flex;
  }

  .card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 22px 14px 34px;
  }

  .topbar-inner {
    padding: 12px 14px;
  }

  .header h1 {
    font-size: 32px;
  }

  .row {
    flex-direction: column;
    align-items: flex-start;
  }

  .row strong {
    max-width: 100%;
    text-align: left;
  }

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