/* 节点测速站 - 样式：简洁留白，移动优先（与工具站同设计语言） */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: #e5e5e7;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --tab-bg: #ececf0;
  --good: #1a9e54;
  --warn: #d97a08;
  --bad: #d63b3b;
}
[data-theme="dark"] {
  --bg: #0d0d0f;
  --card: #1c1c1e;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --border: #38383a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --tab-bg: #2c2c2e;
  --good: #34c77b;
  --warn: #f5a623;
  --bad: #ff6b6b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.25s, color 0.25s;
}

/* 顶部导航 */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap; }
.brand small { font-weight: 400; color: var(--text-2); font-size: 13px; margin-left: 8px; }
.nav-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); font-weight: 700; }
.nav-links a.nav-rec { color: var(--accent); font-weight: 700; }
.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 主体 */
.main {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 60px;
  flex: 1;
}
.hero { text-align: center; margin-bottom: 28px; }
.hero h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; letter-spacing: 0.3px; }
.hero p { color: var(--text-2); font-size: 15px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.hint { font-size: 13px; color: var(--text-2); margin-top: 10px; }

textarea, input[type="url"], input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}
textarea:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}
textarea { min-height: 130px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 26px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-secondary {
  background: var(--tab-bg);
  color: var(--text);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
}
.btn-secondary:hover { background: var(--border); }
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }

/* 错误提示 */
.error-box {
  display: none;
  background: #fff1f0;
  border: 1px solid #ffccc7;
  color: #a8071a;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  margin-top: 14px;
}
[data-theme="dark"] .error-box { background: #2a1215; border-color: #5c1a1a; color: #ff9d9d; }
.error-box.show { display: block; }

/* 演示模式徽标 */
.demo-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--warn);
  background: rgba(217, 122, 8, 0.12);
  border: 1px solid rgba(217, 122, 8, 0.35);
  border-radius: 20px;
  padding: 3px 12px;
  margin-left: 8px;
  vertical-align: middle;
}

/* 测速结果行 */
.speed-list { margin-top: 6px; }
.speed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.speed-row:last-child { border-bottom: none; }
.speed-row .idx {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--tab-bg);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.speed-row.best .idx { background: var(--good); color: #fff; }
.speed-row .info { flex: 1; min-width: 0; }
.speed-row .name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.speed-row .meta { font-size: 12px; color: var(--text-2); }
.speed-row .vals { flex: none; text-align: right; font-size: 13px; }
.speed-row .lat { font-weight: 700; font-variant-numeric: tabular-nums; }
.speed-row .spd { color: var(--text-2); font-variant-numeric: tabular-nums; }
.lat.good { color: var(--good); }
.lat.mid { color: var(--warn); }
.lat.bad { color: var(--bad); }
/* 测速中动画 */
.testing-bar {
  height: 4px; border-radius: 2px; background: var(--tab-bg);
  overflow: hidden; margin-top: 8px; position: relative;
}
.testing-bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scan 1.2s linear infinite;
}
@keyframes scan {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .testing-bar::after { animation: none; }
}

/* 节点列表 */
.node-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.node-table th, .node-table td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.node-table th { color: var(--text-2); font-weight: 500; font-size: 13px; }
.node-table td.name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.region-tag {
  display: inline-block; font-size: 12px;
  background: var(--tab-bg); border-radius: 12px; padding: 2px 10px;
  color: var(--text-2); white-space: nowrap;
}
.copy-link-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-size: 13px; color: var(--accent); cursor: pointer;
  white-space: nowrap;
}
.copy-link-btn:hover { border-color: var(--accent); }

/* 下载列表 */
.dl-group { margin-bottom: 6px; }
.dl-group h3 { font-size: 15px; margin: 18px 0 10px; }
.dl-group h3:first-child { margin-top: 0; }
.dl-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.dl-item:last-child { border-bottom: none; }
.dl-item .d-name { font-size: 14px; font-weight: 600; }
.dl-item .d-desc { font-size: 12.5px; color: var(--text-2); }
.dl-item a.dl-btn {
  flex: none; text-decoration: none; font-size: 13px; font-weight: 600;
  color: var(--accent); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 16px;
}
.dl-item a.dl-btn:hover { border-color: var(--accent); }

/* 结果区（转换页复用） */
.result-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.node-count {
  font-size: 14px; color: var(--text-2);
  background: var(--tab-bg); border-radius: 20px; padding: 4px 14px;
}
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  border: none; background: var(--tab-bg); color: var(--text-2);
  border-radius: 20px; padding: 8px 18px; font-size: 14px; font-weight: 500; cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; }
.output-wrap { position: relative; }
pre.output {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; font-size: 12.5px; line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 420px; overflow: auto; white-space: pre; word-break: break-all;
}
.output-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.format-note { font-size: 13px; color: var(--text-2); margin-top: 10px; }
.url-row { display: flex; gap: 10px; margin-top: 12px; }
.url-row input { flex: 1; font-family: inherit; }

/* 推广卡片（含入场动效与 CTA 呼吸脉冲） */
.promo-card {
  background: linear-gradient(135deg, #0071e3, #42a5f5);
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
@keyframes promoSlideIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.promo-card.animate-in {
  animation: promoSlideIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
}
.promo-card a {
  animation: ctaPulse 3s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .promo-card.animate-in { animation: none; }
  .promo-card a { animation: none; }
}
.promo-card h3 { font-size: 17px; margin-bottom: 6px; }
.promo-card p { font-size: 14px; opacity: 0.92; }
.promo-card a {
  background: #fff;
  color: #0071e3;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 22px;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
}
.promo-card a:hover { background: #f0f7ff; }

/* 页脚 */
.footer {
  border-top: 1px solid var(--border);
  padding: 26px 20px 40px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
}
.footer-links { margin-bottom: 10px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: var(--accent); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* 区块标题行 */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 6px 2px 14px; flex-wrap: wrap; gap: 8px;
}
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head a { font-size: 13px; color: var(--accent); text-decoration: none; }
.section-head a:hover { text-decoration: underline; }
.update-time { font-size: 12.5px; color: var(--text-2); }

/* 移动端 */
@media (max-width: 560px) {
  .hero h1 { font-size: 22px; }
  .card { padding: 16px; }
  .brand small { display: none; }
  .url-row { flex-direction: column; }
  .url-row .btn { width: 100%; }
  .promo-card { flex-direction: column; text-align: center; }
  .nav-links { gap: 10px; }
  .nav-links a { font-size: 13px; }
  .node-table td.name { max-width: 130px; }
}

/* ---------- 桌面端两侧竖屏推广位 ---------- */
.side-promo {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 200px;
  z-index: 60;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 14px 16px;
  text-align: center;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.14);
}
.side-promo.left { left: max(16px, calc(50% - 660px)); }
.side-promo.right { right: max(16px, calc(50% - 660px)); }
@media (min-width: 1400px) {
  .side-promo.show { display: block; animation: spIn 0.5s ease both; }
}
@keyframes spIn {
  from { opacity: 0; transform: translateY(-50%) scale(0.94); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .side-promo.show { animation: none; }
}
.side-promo .sp-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff6b35, #f5365c);
  border-radius: 20px;
  padding: 3px 10px;
  margin-bottom: 10px;
}
.side-promo .sp-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 8px;
  line-height: 1.4;
}
.side-promo .sp-desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 12px;
}
.side-promo .sp-btn {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 10px;
  padding: 10px 0;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: spPulse 3s ease-in-out infinite;
}
.side-promo .sp-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
@keyframes spPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(0, 122, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .side-promo .sp-btn { animation: none; }
}
.side-promo .sp-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  opacity: 0.6;
}
.side-promo .sp-close:hover { opacity: 1; }
.side-promo .sp-link { display: block; }
.side-promo .sp-link img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* ---------- 移动端横幅广告 ---------- */
.mobile-banner {
  display: none;
  position: relative;
  margin: 14px 0;
}
@media (max-width: 1399px) {
  .mobile-banner.show { display: block; animation: mbIn 0.4s ease both; }
}
@keyframes mbIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-banner.show { animation: none; }
}
.mobile-banner img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}
.mobile-banner .mb-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
