:root {
  --bg-1: #3a1208;          /* 背景深红棕 */
  --bg-2: #1a0904;
  --brand: #fbbf24;         /* 标题黄 */
  --card: #ffffff;
  --card-hover: #fff8f3;
  --text: #1f2937;
  --text-soft: #6b7280;
  --text-mute: #9ca3af;
  --label: #1f2937;
  --domain: #ec4899;        /* 域名粉红 */
  --ok: #10b981;            /* 延迟绿 */
  --fail: #9ca3af;          /* 失败灰 */
  --btn: #dc2626;           /* 按钮红 */
  --btn-hover: #b91c1c;
  --glow-1: #ec4899;
  --glow-2: #06b6d4;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI",
        "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 100, 50, .12), transparent),
    radial-gradient(ellipse 60% 80% at 100% 50%, rgba(120, 30, 0, .3), transparent),
    linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex; flex-direction: column;
  position: relative;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; }

/* ======== 装饰背景图（用渐变模拟，data.site.hero_left/hero_right 可覆盖） ======== */
.deco-left, .deco-right {
  position: fixed; top: 0; bottom: 0;
  width: 30vw; max-width: 360px;
  pointer-events: none; opacity: .85; z-index: 0;
  background-repeat: no-repeat;
  background-size: contain;
}
.deco-left {
  left: 0;
  background-position: left center;
  /* 默认占位：抽象渐变。data.site.hero_left = url 可覆盖 */
  background-image: radial-gradient(circle at 20% 50%, rgba(255, 200, 150, .25), transparent 60%);
}
.deco-right {
  right: 0;
  background-position: right center;
  background-image: radial-gradient(circle at 80% 30%, rgba(180, 60, 200, .2), transparent 60%);
}
@media (max-width: 760px) {
  .deco-left, .deco-right { display: none; }
}

/* ======== Header ======== */
.page-head {
  position: relative; z-index: 2;
  text-align: center;
  padding: 40px 20px 20px;
}
.brand-mark {
  display: inline-block;
  font-weight: 800; font-size: 22px;
  color: var(--brand);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  letter-spacing: .04em;
  margin-bottom: 8px;
  padding: 4px 14px;
  border-radius: 20px;
}
.brand-mark.has-logo {
  padding: 0; background: none;
}
.brand-mark img { height: 56px; vertical-align: middle; }
.page-head h1 {
  margin: 0 auto 14px;
  font-size: clamp(28px, 5.5vw, 44px);
  font-weight: 800; letter-spacing: .05em;
  color: white;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}
.status {
  display: inline-block;
  background: rgba(0, 0, 0, .4);
  color: white;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.status.done { background: rgba(16, 185, 129, .25); }

/* ======== 主区：线路列表 ======== */
main {
  position: relative; z-index: 2;
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}
.loading { color: rgba(255, 255, 255, .7); padding: 40px 0; text-align: center; }

.lines { display: flex; flex-direction: column; gap: 16px; }

.line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  position: relative;
  transition: all .25s cubic-bezier(.4, 0, .2, 1);
}
.line:hover { background: var(--card-hover); transform: translateY(-1px); }

/* 最佳线路：发光描边 */
.line.best { animation: glow 2.4s ease-in-out infinite; }
.line.best::before {
  content: ""; position: absolute; inset: -2px;
  padding: 2px;
  background: linear-gradient(120deg, var(--glow-1), var(--glow-2), var(--glow-1));
  background-size: 200% 200%;
  border-radius: 16px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: -1;
  animation: gradient-shift 4s linear infinite;
}
@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes glow {
  0%,100% { box-shadow: 0 0 24px rgba(236, 72, 153, .4), 0 8px 24px rgba(0, 0, 0, .25); }
  50%     { box-shadow: 0 0 36px rgba(236, 72, 153, .65), 0 8px 24px rgba(0, 0, 0, .25); }
}

.line-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.line-label {
  font-weight: 700; font-size: 14px; color: var(--label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.line-domain {
  font-size: 14px; color: var(--domain); font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.line-latency {
  flex: 0 0 auto;
  font-weight: 700; font-size: 16px;
  color: var(--ok);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 90px; text-align: center;
}
.line-latency.testing { color: var(--text-mute); font-weight: 500; font-size: 14px; }
.line-latency.failed  { color: var(--fail); font-weight: 500; font-size: 14px; }

.line-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.btn {
  padding: 8px 18px;
  border: 1px solid var(--btn);
  background: white;
  color: var(--btn);
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  transition: all .15s;
}
.btn.primary { background: var(--btn); color: white; }
.btn:hover { background: var(--btn-hover); color: white; border-color: var(--btn-hover); }
.btn:active { transform: scale(.96); }

/* ======== 移动端 ======== */
@media (max-width: 600px) {
  .page-head { padding: 28px 16px 16px; }
  .line {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "info latency"
      "actions actions";
    gap: 10px 12px;
    padding: 14px 14px;
  }
  .line-info { grid-area: info; }
  .line-latency { grid-area: latency; min-width: auto; }
  .line-actions { grid-area: actions; gap: 8px; }
  .btn { flex: 1; padding: 10px 0; text-align: center; font-size: 13.5px; }
}

footer {
  position: relative; z-index: 2;
  text-align: center;
  padding: 16px 16px 28px;
  color: rgba(255, 255, 255, .55);
  font-size: 12px;
}
footer .meta { margin-top: 6px; opacity: .7; }
@supports (padding: max(0px)) {
  body { padding-bottom: max(0px, env(safe-area-inset-bottom)); }
}

/* 复制成功的 toast */
.toast {
  position: fixed; left: 50%; bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(16, 185, 129, .95); color: white;
  padding: 10px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  opacity: 0; transition: opacity .25s, transform .25s;
  z-index: 100; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
