:root {
  --primary: #107ef4;
  --primary-dark: #0a5bc4;
  --dark: #1e2022;
  --dark-soft: #4a5562;
  --gray: #8c98a4;
  --light: #f8fafd;
  --orange: #fd7e14;
  --yellow: #ffc107;
  --green: #28a745;
  --red: #dc3545;
  --border: #e8edf3;
  --text: #2d3748;
  --text-dim: #718096;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 1140px; margin: 0 auto; padding: 0 15px; }
.text-center { text-align: center; }
.text-white { color: #fff !important; }
.text-white-70 { color: rgba(255,255,255,0.7); }
.text-white-50 { color: rgba(255,255,255,0.5); }
.text-white-55 { color: rgba(255,255,255,0.55); }
.small { font-size: 13px; }
.list-unstyled { list-style: none; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }
.mt-2 { margin-top: .5rem; }
.py-9 { padding-top: 3rem; padding-bottom: 3rem; }
.pt-9 { padding-top: 3rem; }
.pb-5 { padding-bottom: 2rem; }
.ml-auto { margin-left: auto !important; }
.my-4 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.row { display: flex; flex-wrap: wrap; }
.col-lg-12 { flex: 0 0 100%; }
.col-md-7 { flex: 0 0 58.33%; }
.col-md-12 { flex: 0 0 100%; }
.col-lg-4 { flex: 0 0 33.33%; }
.col-lg-2 { flex: 0 0 16.66%; }
.col-sm-4 { flex: 0 0 33.33%; }
.justify-content-center { justify-content: center; }
.justify-content-md-between { justify-content: space-between; }
.align-self-center { align-self: center; }
.d-flex { display: flex; }
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from {opacity:0; transform:translateY(4px);} to {opacity:1; transform:translateY(0);} }

/* Gradient dark */
.gradient-dark {
  background: linear-gradient(135deg, #1a1c2e 0%, #2d1b4e 40%, #1e2022 100%);
}

/* Navbar */
.navbar {
  position: relative;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.navbar-brand i { color: var(--primary); font-size: 22px; }

.navbar-collapse {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar-nav {
  display: flex;
  list-style: none;
  align-items: center;
  gap: 6px;
}

.navbar-nav.ml-auto { margin-left: auto; }

.nav-item { position: relative; }

.nav-link {
  display: block;
  padding: 8px 16px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: all 0.2s;
}

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

.navbar-toggler {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.navbar-toggler-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  position: relative;
}

.navbar-toggler-icon::before, .navbar-toggler-icon::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 2px;
  background: #fff;
  left: 0;
}
.navbar-toggler-icon::before { top: -7px; }
.navbar-toggler-icon::after { top: 7px; }

/* Promo section */
.duik-promo {
  position: relative;
  text-align: center;
  overflow: hidden;
}

.duik-promo .lead { font-size: 16px; margin-top: 8px; }
.duik-promo hr { border: 0; border-top: 1px solid rgba(255,255,255,0.15); margin: 16px auto; max-width: 300px; }
.duik-promo h1 { font-size: 36px; font-weight: 700; letter-spacing: -0.03em; }

.promo-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 50px;
}

/* Main */
main { padding: 20px 0 40px; }
.zj-con { min-height: 200px; }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 7px 18px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-dim);
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.refresh-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 16px;
}

.refresh-countdown {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-dim);
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-refresh:hover { border-color: var(--primary); color: var(--primary); }
.btn-refresh:disabled { opacity: 0.5; cursor: not-allowed; }

#refreshIcon.spinning { animation: spin 0.8s linear infinite; }

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

/* Notice fieldset (原站 layui 风格) */
.layui-elem-field {
  background: #fdf6ec;
  color: #e6a23c;
  padding: 12px 18px;
  border: 1px solid #faecd8;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
  text-align: center;
}

/* Table */
.table-responsive { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 8px;
  overflow: hidden;
}

.table-striped thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 2px solid var(--border);
  background: #f9fafb;
  white-space: nowrap;
}

.table-striped tbody tr {
  border-bottom: 1px solid #f0f2f5;
  transition: background 0.15s;
}

.table-striped tbody tr:nth-child(even) {
  background: #fafbfc;
}

.table-striped tbody tr:hover {
  background: #f0f7ff !important;
}

.table-striped td {
  padding: 11px 16px;
  font-size: 14px;
}

.col-asn { }

.td-rank { font-weight: 600; color: var(--gray); }
.td-rank.top3 { color: var(--orange); }

.td-ip {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 14px;
}

.carrier-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.carrier-电信 { background: #e3f2fd; color: #1976d2; }
.carrier-联通 { background: #fff3e0; color: #f57c00; }
.carrier-移动 { background: #e8f5e9; color: #388e3c; }
.carrier-多线 { background: #f3e5f5; color: #7b1fa2; }
.carrier-IPv6 { background: #e0f7fa; color: #00838f; }
.carrier-日本 { background: #e3f2fd; color: #1565c0; }

.td-copyable {
  cursor: pointer;
  user-select: none;
}
.td-copyable:hover {
  color: var(--primary);
}
.td-copyable.copied {
  color: var(--green);
}

.col-country { font-weight: 600; font-size: 13px; white-space: nowrap; }
.col-colo { font-size: 13px; white-space: nowrap; }
.col-colo a { color: var(--primary); text-decoration: none; }
.col-colo a:hover { text-decoration: underline; }

.latency-green { color: var(--green); font-weight: 600; }
.latency-amber { color: var(--orange); font-weight: 600; }
.latency-red { color: var(--red); font-weight: 600; }

.td-colo a, .td-action a {
  color: var(--primary);
  text-decoration: none;
}
.td-colo a:hover { text-decoration: underline; }

.td-time { color: var(--gray); font-size: 13px; }

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-dim);
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary); }
.btn-copy.copied { border-color: var(--green); color: var(--green); }

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px;
  gap: 14px;
  color: var(--text-dim);
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Error */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px;
  gap: 12px;
  color: var(--text-dim);
}
.error-icon { font-size: 36px; color: var(--red); opacity: 0.7; }

.btn-retry {
  padding: 8px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.btn-retry:hover { background: var(--primary-dark); }

/* Footer */
footer { margin-top: 20px; }
footer hr { border: 0; }
footer ul li { margin-bottom: 8px; }
footer a { text-decoration: none; transition: color 0.2s; }
footer a:hover { color: #fff; }
footer h4 { margin-bottom: 12px; font-weight: 700; }

/* Go to top */
.go-to {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(16,126,244,0.4);
  z-index: 90;
  transition: transform 0.2s;
}
.go-to:hover { transform: translateY(-2px); }

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--dark);
  color: #fff;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Responsive */
@media (max-width: 991px) {
  .navbar-collapse { display: none; }
  .navbar-toggler { display: block; }
  .navbar-collapse.show {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--dark);
    padding: 16px;
  }
  .duik-promo h1 { font-size: 28px; }
  .col-md-7, .col-md-12 { flex: 0 0 100%; }
  .col-sm-4, .col-lg-2, .col-lg-4 { flex: 0 0 100%; margin-bottom: 1.5rem; }
}

@media (max-width: 768px) {
  .filter-bar { justify-content: flex-start; }
  .refresh-area { margin-left: 0; width: 100%; justify-content: center; margin-top: 8px; }
  .col-asn { display: none; }
  .col-country, .col-colo { display: none; }
  .duik-promo h1 { font-size: 24px; }
}

@media (max-width: 480px) {
  .table-striped td, .table-striped thead th { padding: 10px 12px; font-size: 13px; }
  .td-ip { font-size: 12px; }
}
.search-area {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
}

.search-input {
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  border-radius: 6px;
  outline: none;
  width: 260px;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
}

.search-input::placeholder {
  color: #aaa;
  font-size: 13px;
}

.btn-search {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-search:hover { background: var(--primary-dark); }
.btn-search:disabled { opacity: 0.5; cursor: not-allowed; }

.search-info {
  background: #e3f2fd;
  color: #1565c0;
  padding: 10px 18px;
  border-radius: 4px;
  margin-bottom: 12px;
  font-size: 13px;
  text-align: center;
  display: none;
}

@media (max-width: 768px) {
  .search-area { margin-left: 0; width: 100%; margin-top: 8px; }
  .search-input { flex: 1; width: auto; }
}
