:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --light: #94a3b8;
  --accent: #0f766e;
  --accent-bg: #e8f7f5;
  --accent-hover: #0b7669;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --blue-border: rgba(37,99,235,.22);
  --green: #059669;
  --green-light: #d1fae5;
  --green-border: rgba(5,150,105,.22);
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --purple-border: rgba(124,58,237,.22);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
button, select, a, input { font: inherit; }

/* ── 动画 ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
@keyframes pulse { 0%,100%{ box-shadow:0 0 0 0 rgba(16,185,129,.55); } 70%{ box-shadow:0 0 0 7px rgba(16,185,129,0); } }
@keyframes gradFlow { 0%{ background-position:0% 50%; } 50%{ background-position:100% 50%; } 100%{ background-position:0% 50%; } }
@keyframes spin { from{transform:rotate(0)} to{transform:rotate(360deg)} }

.skel { background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 300px 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }

/* ── 通用 ── */
.wrap { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }

/* ── 顶部 Hero 区 ── */
.hero {
  position: relative;
  background: linear-gradient(168deg, #ffffff 0%, #eef4ff 35%, #e8f0fe 55%, #f0f4ff 80%, #f4f7fb 100%);
  padding-bottom: 48px;
  overflow: hidden;
}
/* 装饰光斑 */
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none; filter: blur(70px);
}
.hero::before { width: 420px; height: 420px; background: rgba(59,130,246,.1); top: -100px; left: -80px; }
.hero::after  { width: 320px; height: 320px; background: rgba(124,58,237,.07); bottom: -40px; right: -60px; }
/* 网格纹理 */
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-size: 48px 48px;
  background-image:
    linear-gradient(to right, rgba(148,163,184,.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148,163,184,.1) 1px, transparent 1px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.12) 0%, transparent 70%);
}

.hero-content { position: relative; z-index: 1; }

/* 导航 */
header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; padding: 24px 0 0;
  animation: fadeUp .6s cubic-bezier(.16,1,.3,1) both;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  box-shadow: 0 6px 20px rgba(37,99,235,.3);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.brand:hover .brand-icon { transform: rotate(-8deg) scale(1.08); }
.brand h1 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 0; }
.brand .sub { font-size: 13px; color: var(--muted); margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 10px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  transition: all .2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #93c5fd; background: #f0f7ff; }
.btn.primary {
  border-color: var(--blue-border); background: var(--blue-light); color: #1e40af;
}
.btn.primary:hover { background: #bfdbfe; }

/* 标题区 */
.hero-title {
  text-align: center;
  padding: 40px 0 8px;
  animation: fadeUp .6s .08s cubic-bezier(.16,1,.3,1) both;
}
.live-tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 14px; border-radius: 999px;
  background: rgba(255,255,255,.75); backdrop-filter: blur(8px);
  border: 1px solid rgba(16,185,129,.25);
  font-size: 12px; font-weight: 700; color: #047857;
  margin-bottom: 20px;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; animation: pulse 2s infinite; }
.hero-title h2 {
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 700; letter-spacing: -.03em; line-height: 1.12;
  margin: 0 0 14px;
}
.hero-title p {
  font-size: 16px; color: var(--muted); max-width: 580px; margin: 0 auto;
}
.hero-title p strong { color: var(--blue); font-weight: 700; }

/* 统计栏 */
.stats {
  display: grid; grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 12px; padding: 28px 0 0;
  animation: fadeUp .6s .16s cubic-bezier(.16,1,.3,1) both;
}
.stat {
  background: rgba(255,255,255,.78); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.85); border-radius: 14px;
  padding: 18px 16px; box-shadow: 0 4px 16px rgba(15,23,42,.04);
  transition: all .28s ease;
}
.stat:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(15,23,42,.08); }
.stat span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat strong { display: block; font-size: 21px; overflow-wrap: anywhere; }

/* ── 主体 ── */
.main-body { position: relative; z-index: 1; margin-top: -12px; }

/* 筛选面板 */
.filter-panel {
  background: rgba(255,255,255,.82); backdrop-filter: blur(16px);
  border: 1px solid rgba(226,232,240,.6); border-radius: 16px;
  padding: 16px 18px; margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(15,23,42,.04);
  display: flex; flex-direction: column; gap: 12px;
  animation: fadeUp .5s .24s cubic-bezier(.16,1,.3,1) both;
}
.f-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.f-between { justify-content: space-between; }
.f-label { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 40px; }
.f-divider { border: none; border-top: 1px solid rgba(226,232,240,.5); margin: 0; }

/* Chip 和 Pill */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 6px 13px; cursor: pointer;
  font-size: 13px;
  transition: all .18s ease;
}
.chip:hover { transform: translateY(-1px); border-color: #8ecaff; }
.chip.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-hover); font-weight: 700; }

.search-box { position: relative; flex: 1; max-width: 260px; min-width: 150px; }
.search-box i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--light); font-size: 15px; }
.search-box input {
  width: 100%; padding: 7px 12px 7px 32px;
  border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; color: var(--text);
  outline: none; transition: all .2s;
}
.search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.sel-wrap select {
  padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; color: var(--text);
  cursor: pointer; outline: none;
}
.f-meta { font-size: 13px; color: var(--light); }
.f-meta strong { color: var(--accent); font-weight: 700; }

/* 区域标题 */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar h2 { font-size: 17px; display: flex; align-items: center; gap: 6px; margin: 0; }
.toolbar h2 i { color: var(--blue); }
.toolbar .meta { color: var(--muted); font-size: 13px; }

/* 通知 */
.notice {
  position: fixed; left: 50%; bottom: 28px; z-index: 999;
  transform: translate(-50%, 60px) scale(.95); opacity: 0;
  background: #0f172a; color: #fff; border-radius: 12px;
  padding: 12px 20px; font-weight: 700; font-size: 14px;
  box-shadow: 0 12px 40px rgba(15,23,42,.25);
  display: flex; align-items: center; gap: 8px;
  transition: all .35s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}
.notice.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.notice i { color: #38bdf8; font-size: 18px; }

/* ── 卡片网格 ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; margin-bottom: 40px; }

/* 卡片 - 保留原版排版骨架，加入毛玻璃特效 */
.card {
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(15,23,42,.04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
  animation: cardIn .45s cubic-bezier(.16,1,.3,1) backwards;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #a8d8ff;
  box-shadow: 0 18px 42px rgba(22, 119, 210, .14);
}
.card.v6 {
  border-color: rgba(15,143,127,.32);
}
.card.v6:hover {
  border-color: rgba(15,143,127,.5);
  box-shadow: 0 18px 42px rgba(15,143,127,.12);
}

/* 卡片顶部色带 */
.card-stripe { height: 3px; }
.card.carrier-ct .card-stripe { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.card.carrier-cu .card-stripe { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.card.carrier-cm .card-stripe { background: linear-gradient(90deg, #059669, #34d399); }

.card-body { padding: 18px 20px 16px; }

/* 卡片头 - 和原版一致的双栏 */
.card-head {
  display: flex; justify-content: space-between;
  gap: 10px; align-items: flex-start;
  margin-bottom: 14px;
}
.card-title { min-width: 0; }
.card-title h3 {
  margin: 0 0 8px; font-size: 19px;
  line-height: 1.25; overflow-wrap: anywhere;
}
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.badge {
  border: 1px solid rgba(56,189,248,.42);
  background: #eef7ff; color: #155a95;
  border-radius: 999px; padding: 3px 8px;
  font-size: 12px; white-space: nowrap;
}
.badge.strong { border-color: rgba(22,119,210,.34); background: #e8f3ff; color: #0f4f91; font-weight: 700; }
.badge.good { border-color: rgba(15,143,127,.34); background: #e9fbf7; color: #0b7669; }
.badge.ipv6 { border-color: rgba(15,143,127,.34); background: #e9fbf7; color: #0b7669; }
.colo-badge {
  background: var(--panel-2); color: var(--muted);
  font-size: 12px;
  padding: 4px 10px; border-radius: 8px;
  border: 1px solid rgba(226,232,240,.6);
  white-space: nowrap; flex-shrink: 0;
}

/* 域名和 IP 行 - 原版网格布局 */
.endpoint-body { display: grid; gap: 9px; margin-bottom: 2px; }
.endpoint-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px; align-items: baseline;
}
.field-label {
  color: var(--muted); font-size: 12px; font-weight: 700;
}
.host, .ip {
  display: block;
  color: var(--accent);
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  min-width: 0; margin: 0; padding: 2px 4px;
  cursor: pointer; border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}
.host:hover, .ip:hover { background: #e8f7f5; color: #0b7669; }
.host { font-size: 16px; font-weight: 800; line-height: 1.35; }
.ip   { font-size: 20px; font-weight: 900; line-height: 1.22; letter-spacing: 0; }
.ip.v6 { font-size: 16px; line-height: 1.36; }
.copy-hint {
  color: var(--light); font-size: 14px; cursor: pointer;
  transition: color .15s; align-self: center;
}
.copy-hint:hover { color: var(--accent); }

/* 2×2 指标网格 - 和原版一致 */
.metrics {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px; margin-top: 12px;
}
.metric {
  background: rgba(255, 255, 255, .75);
  border: 1px solid rgba(216, 225, 236, .72);
  border-radius: 8px; padding: 10px; min-height: 66px;
}
.metric span {
  display: block; color: var(--muted);
  font-size: 12px; margin-bottom: 5px;
}
.metric strong {
  display: block; min-width: 0; font-size: 15px;
  overflow-wrap: anywhere;
}

/* 底行 */
.sync-line {
  margin: 10px 0 0; color: var(--muted);
  font-size: 13px; line-height: 1.6;
}

/* ── 安装引导 ── */
.setup-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 50%, #f5f3ff 100%);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 32px; margin-bottom: 40px;
  box-shadow: 0 4px 24px rgba(15,23,42,.04);
  position: relative; overflow: hidden;
}
.setup-panel::before {
  content:''; position: absolute; top: -50px; right: -50px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.06), transparent);
  pointer-events: none;
}
.setup-panel h2 {
  font-size: 19px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px; position: relative;
}
.setup-panel h2 i { color: var(--blue); }
.setup-desc { color: var(--muted); font-size: 14px; margin-bottom: 18px; position: relative; }
.codeblk {
  background: #0f172a; border-radius: 12px;
  padding: 16px 18px; position: relative; margin-bottom: 22px;
}
.codeblk pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: #7dd3fc; font-size: 13px; line-height: 1.6;
  overflow-x: auto; margin: 0;
}
.codeblk .cbtn {
  position: absolute; right: 12px; top: 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: #94a3b8; padding: 5px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 5px; transition: all .15s;
}
.codeblk .cbtn:hover { background: rgba(255,255,255,.15); color: #fff; }

.info-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px; position: relative;
}
.info-block {
  background: rgba(255,255,255,.7); border-radius: 12px;
  padding: 16px; border: 1px solid rgba(226,232,240,.4);
}
.info-block h3 {
  font-size: 14px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.info-block h3 i { font-size: 16px; }
.info-block p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ── 页脚 ── */
.footer {
  background: #fff; border-top: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.ft-bar {
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #7c3aed, #059669, #f59e0b, #2563eb);
  background-size: 200% 100%; animation: gradFlow 5s linear infinite;
}
.ft-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-size: 36px 36px;
  background-image:
    linear-gradient(rgba(226,232,240,.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226,232,240,.2) 1px, transparent 1px);
  mask-image: radial-gradient(ellipse at 50% 0%, rgba(0,0,0,.08), transparent 55%);
}
.ft-main {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 0 auto;
  padding: 48px 28px 24px;
  display: grid; grid-template-columns: 1.8fr 1fr 1fr 1fr; gap: 40px;
}
.ft-brand { display: flex; flex-direction: column; gap: 14px; }
.ft-brand-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.ft-brand-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.ft-brand-name { font-size: 15px; font-weight: 700; margin: 0; }
.ft-brand-desc { font-size: 13px; color: var(--muted); line-height: 1.7; max-width: 320px; }
.ft-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ft-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 3px 9px;
  border-radius: 999px; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--line);
}
.ft-col h4 {
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 16px; margin-top: 0;
}
.ft-links { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.ft-links a {
  color: var(--muted); text-decoration: none; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .2s ease;
}
.ft-links a:hover { color: var(--blue); transform: translateX(4px); }
.ft-links a i { font-size: 14px; opacity: .5; }
.ft-bottom {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 0 auto;
  padding: 18px 28px 32px;
  border-top: 1px solid rgba(226,232,240,.5);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--light);
}
.ft-bottom a { color: var(--muted); text-decoration: none; transition: color .15s; }
.ft-bottom a:hover { color: var(--blue); }
.ft-blinks { display: flex; gap: 18px; }

.empty { border: 1px dashed var(--line); color: var(--muted); border-radius: 12px; padding: 48px; text-align: center; grid-column: 1/-1; }
.error { color: #9f1239; border-color: rgba(244,63,94,.3); background: #fff1f2; }

/* ── 响应式 ── */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .ft-main { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid  { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .ft-main { grid-template-columns: 1fr; }
  header { flex-direction: column; }
  .actions { justify-content: flex-start; }
  .hero-title { text-align: left; }
  .f-row { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .setup-panel { padding: 22px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .ft-bottom { flex-direction: column; gap: 10px; text-align: center; }
}


/* ---------------------------------------------------------------------------
 * Accessibility
 * ------------------------------------------------------------------------- */

/* Visible keyboard focus. The page previously had none. */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Copy affordances are real buttons now, not click-handling <i> elements. */
.copy-hint {
  background: none;
  border: 0;
  padding: 2px;
  cursor: pointer;
  color: inherit;
  font-size: inherit;
  line-height: 1;
}

/* Footer items that were dead href="#" anchors are plain text. */
.ft-links .ft-static {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  opacity: .85;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/*
 * Six keyframe animations plus per-card entry delays are a lot of motion. The inline
 * animation-delay each card carries cannot be overridden from CSS, so app.js also skips
 * setting it when this query matches.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
