:root {
  --bg: #07080f;
  --text: #eef2ff;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.14);
  --glass: rgba(18, 22, 38, 0.62);
  --glass-border: rgba(167, 139, 250, 0.18);
  --purple: #a78bfa;
  --cyan: #22d3ee;
  --violet: #7c3aed;
  --ok: #34d399;
  --danger: #f87171;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font-family: var(--font);
  background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }

.mesh {
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(124,58,237,.28), transparent 55%),
    radial-gradient(900px 600px at 95% 0%, rgba(34,211,238,.16), transparent 50%),
    radial-gradient(800px 500px at 50% 110%, rgba(167,139,250,.12), transparent 45%),
    linear-gradient(180deg, #0a0b14 0%, #07080f 100%);
}
.glow { position: fixed; z-index: -2; pointer-events: none; filter: blur(60px); opacity: .55; }
.glow-a { width: 420px; height: 420px; left: -80px; top: 120px; background: rgba(124,58,237,.35); border-radius: 50%; }
.glow-b { width: 360px; height: 360px; right: -60px; top: 40px; background: rgba(34,211,238,.22); border-radius: 50%; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: rgba(7,8,15,.55);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 920px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.logo { display: grid; place-items: center; filter: drop-shadow(0 0 12px rgba(167,139,250,.35)); }
.brand-text strong { font-size: 15px; letter-spacing: .02em; }

.wrap { max-width: 920px; margin: 0 auto; padding: 36px 20px 80px; }
.hero { text-align: center; margin-bottom: 8px; }
.hero h1 {
  margin: 0 0 28px; font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 750;
  letter-spacing: -.02em; line-height: 1.15;
}
.grad {
  background: linear-gradient(115deg, #c4b5fd 0%, #22d3ee 55%, #a78bfa 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.04);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.hero-card { text-align: left; padding: 18px; transition: border-color .2s, box-shadow .2s; }
.hero-card:focus-within {
  border-color: rgba(34,211,238,.35);
  box-shadow: var(--shadow), 0 0 0 4px rgba(34,211,238,.1);
}

.input-shell { position: relative; }
.input-ico {
  position: absolute; left: 14px; top: 16px; color: var(--muted); pointer-events: none;
}
textarea#url {
  width: 100%; min-height: 84px; resize: vertical; border: 0; outline: none;
  border-radius: 14px; padding: 14px 14px 14px 44px;
  background: rgba(8,10,18,.72); color: var(--text);
  font: 15px/1.5 var(--font); box-shadow: inset 0 0 0 1px var(--line);
}
textarea#url::placeholder { color: #64748b; }
textarea#url:focus { box-shadow: inset 0 0 0 1px rgba(167,139,250,.45); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 12px;
  padding: 11px 18px; font: 600 14px/1 var(--font); color: var(--text);
  transition: transform .12s ease, box-shadow .2s, background .2s, opacity .2s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  position: relative; overflow: hidden; color: #0b1020;
  background: linear-gradient(135deg, #c4b5fd 0%, #67e8f9 100%);
  box-shadow: 0 8px 28px rgba(124,58,237,.35);
}
.btn-primary:hover { box-shadow: 0 10px 32px rgba(34,211,238,.35); }
.btn-shine {
  position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%); animation: shine 3.5s ease-in-out infinite;
}
@keyframes shine { 0%,60%{transform:translateX(-120%)} 80%{transform:translateX(120%)} 100%{transform:translateX(120%)} }
.btn-ghost {
  background: rgba(255,255,255,.03); border: 1px solid var(--line); color: var(--muted);
}
.btn-ghost:hover { color: var(--text); border-color: rgba(167,139,250,.35); }
.btn-mini {
  padding: 7px 10px; border-radius: 9px; font-size: 12px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted);
}
.btn-mini:hover { color: var(--text); border-color: rgba(34,211,238,.4); }

.status { min-height: 1.4em; margin: 16px 0 8px; color: var(--muted); font-size: 13.5px; text-align: center; }

.section {
  margin-top: 18px; padding: 18px; animation: rise .35s ease both;
}
@keyframes rise { from { opacity:0; transform: translateY(8px);} to { opacity:1; transform:none;} }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }

.mirror-row, .asset, .cmd-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border-radius: 14px; background: rgba(8,10,18,.55);
  border: 1px solid var(--line); margin-top: 10px;
  transition: transform .15s ease, border-color .2s, box-shadow .2s;
}
.mirror-row:hover, .asset:hover {
  transform: translateY(-1px);
  border-color: rgba(167,139,250,.28);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.mirror-main { flex: 1; min-width: 0; }
.mirror-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.mirror-title .name { font-weight: 650; font-size: 14px; }
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: rgba(148,163,184,.12); color: var(--muted);
}
.badge.ok { background: rgba(52,211,153,.14); color: var(--ok); }
.badge.bad { background: rgba(248,113,113,.14); color: var(--danger); }
.badge.tag { background: rgba(167,139,250,.16); color: #ddd6fe; }
.badge.pre { background: rgba(251,191,36,.14); color: #fbbf24; }
.url {
  font-family: var(--mono); font-size: 12px; color: #cbd5e1;
  word-break: break-all; line-height: 1.45;
}
.row-actions { display: flex; flex-shrink: 0; gap: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  text-decoration: none; color: #e0f2fe;
  background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(34,211,238,.18));
  border: 1px solid rgba(34,211,238,.25);
  transition: transform .12s, box-shadow .2s;
}
.chip:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(34,211,238,.15); color: #fff; }
.chip.ghost {
  background: rgba(255,255,255,.03); border-color: var(--line); color: var(--muted);
}

.release {
  margin-top: 12px; padding: 16px; border-radius: 16px;
  background: rgba(8,10,18,.5); border: 1px solid var(--line);
  transition: border-color .2s, transform .15s;
}
.release:hover { border-color: rgba(167,139,250,.3); }
.release-top {
  appearance: none; width: 100%; border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0; font: inherit;
}
.release-top .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.release-top .cnt { opacity: .75; }
.release-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s cubic-bezier(.2,.7,.2,1); }
.release-inner { overflow: hidden; min-height: 0; }
.release.open .release-body { grid-template-rows: 1fr; }
.release.open .release-inner { padding-top: 8px; }
.release.open > .release-top .chev { transform: rotate(180deg); }
.note-btn { margin-top: 6px; }
.release h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.changelog {
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.02); border: 1px solid var(--line);
  color: #cbd5e1; font-size: 13px; white-space: pre-wrap; display: none;
}
.changelog.open { display: block; }
.asset-name { font-weight: 650; font-size: 14px; }
.asset-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.cmd-row code {
  flex: 1; font-family: var(--mono); font-size: 12px; color: #e2e8f0;
  white-space: pre-wrap; word-break: break-all;
}

.pager { display: flex; gap: 10px; margin-top: 16px; justify-content: center; }

/* skeleton */
.skel { overflow: hidden; position: relative; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--line); padding: 16px; margin-top: 12px; }
.skel-line { height: 12px; border-radius: 6px; background: rgba(148,163,184,.12); margin: 10px 0; }
.skel-line.w40 { width: 40%; } .skel-line.w70 { width: 70%; } .skel-line.w90 { width: 90%; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(167,139,250,.08), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%);} to { transform: translateX(100%);} }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  z-index: 80; padding: 12px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  color: #052e1b; background: linear-gradient(135deg, #6ee7b7, #67e8f9);
  box-shadow: 0 12px 40px rgba(52,211,153,.35);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot {
  text-align: center; padding: 24px 20px 40px; color: var(--muted); font-size: 12.5px;
  border-top: 1px solid var(--line); background: rgba(0,0,0,.2);
}
.foot p { margin: 0; }

@media (max-width: 640px) {
  .wrap { padding: 24px 14px 64px; }
  .hero-card { padding: 14px; }
  .mirror-row, .asset { flex-direction: column; }
  .row-actions { width: 100%; }
  .row-actions .btn-mini { flex: 1; text-align: center; }
}

/* mirror picker */
.picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.pick {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 999px; font: 600 12px/1 var(--font); color: var(--muted);
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  transition: color .15s, border-color .2s, background .2s, box-shadow .2s;
}
.pick:hover { color: var(--text); border-color: rgba(167,139,250,.35); }
.pick.on {
  color: #fff; border-color: rgba(34,211,238,.5);
  background: linear-gradient(135deg, rgba(124,58,237,.3), rgba(34,211,238,.2));
  box-shadow: 0 6px 20px rgba(34,211,238,.15);
}
.pick .badge { font-size: 10.5px; padding: 1px 6px; }
.badge.best { background: linear-gradient(135deg, #fde68a, #fbbf24); color: #3b2300; }
.mirror-row.fastest { border-color: rgba(251,191,36,.35); box-shadow: 0 0 0 1px rgba(251,191,36,.12), 0 10px 30px rgba(0,0,0,.25); }

/* live latency + folding */
.head-actions { display: flex; gap: 8px; align-items: center; }
.btn-retest { display: inline-flex; align-items: center; gap: 6px; }
.btn-retest.spin svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge.ms { font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; transition: background .25s, color .25s; }
.badge.mid { background: rgba(251,191,36,.12); color: #fcd34d; }
.badge.slow { background: rgba(251,146,60,.14); color: #fdba74; }
.badge.pending { position: relative; overflow: hidden; color: #a5b4fc; background: rgba(129,140,248,.12); }
.badge.pending::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(167,139,250,.35), transparent);
  animation: shimmer 1s infinite;
}
.mirror-row.fold, .asset.fold, .pick.fold { display: none; }
.mirror-row.unfold, .asset.unfold { animation: rise .3s ease both; }
.fold-toggle {
  appearance: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 12px; padding: 10px; border-radius: 12px;
  font: 600 12.5px/1 var(--font); color: var(--muted);
  background: rgba(255,255,255,.025); border: 1px dashed rgba(167,139,250,.25);
  transition: color .15s, border-color .2s, background .2s;
}
.fold-toggle:hover { color: var(--text); border-color: rgba(34,211,238,.45); background: rgba(34,211,238,.05); }
.fold-toggle.inline { width: auto; display: inline-flex; margin: 0; padding: 7px 12px; border-radius: 999px; }
.fold-toggle[hidden] { display: none; }
.chev {
  display: inline-block; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .25s; opacity: .8;
}
.chev.up { transform: rotate(-135deg) translateY(-1px); }
.release-top > .chev { transform: none; width: 18px; height: 18px; border: 0; position: relative; flex-shrink: 0; }
.release-top > .chev::before {
  content: ""; position: absolute; left: 5px; top: 3px; width: 7px; height: 7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
}
.picker-shell { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.picker-shell .picker { margin: 0; }
.pick { animation: rise .25s ease both; }
