/* ============================================================
   镜像港 · 现代毛玻璃 UI
   深色 aurora 基底 · backdrop-blur 卡片 · 青紫发光强调
   ============================================================ */

:root {
  /* palette */
  --bg-0: #070a14;
  --bg-1: #0b1020;
  --surface: rgba(22, 30, 54, 0.55);
  --surface-2: rgba(28, 38, 68, 0.65);
  --surface-hi: rgba(40, 52, 88, 0.7);
  --border: rgba(120, 150, 220, 0.18);
  --border-hi: rgba(150, 180, 255, 0.35);
  --text: #e8edf9;
  --text-dim: #9aa6c4;
  --text-mute: #6473a0;

  --teal: #5eead4;
  --teal-glow: rgba(94, 234, 212, 0.5);
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --violet-glow: rgba(167, 139, 250, 0.5);
  --amber: #fbbf24;
  --rose: #fb7185;
  --green: #4ade80;

  /* fonts */
  --ff-display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --ff-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--ff-body);
  background: var(--bg-0);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===================== Aurora background ===================== */
.aurora {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(167, 139, 250, 0.12), transparent 60%),
    radial-gradient(1000px 700px at 0% 100%, rgba(94, 234, 212, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: drift 22s ease-in-out infinite alternate;
}
.orb-1 { width: 520px; height: 520px; top: -120px; left: -100px;
  background: radial-gradient(circle, var(--teal), transparent 70%); }
.orb-2 { width: 460px; height: 460px; top: 20%; right: -140px;
  background: radial-gradient(circle, var(--violet), transparent 70%);
  animation-delay: -7s; }
.orb-3 { width: 380px; height: 380px; bottom: -120px; left: 40%;
  background: radial-gradient(circle, var(--cyan), transparent 70%);
  animation-delay: -14s; }

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, -40px) scale(1.15); }
}

/* subtle film grain */
.grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.035;
  mix-blend-mode: overlay;
}

/* ===================== Layout ===================== */
.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.hero { text-align: center; margin-bottom: 32px; }

/* brand */
.brand { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 36px;
  animation: rise 0.7s cubic-bezier(.2,.7,.3,1) both; }
.brand-top { display: inline-flex; align-items: center; gap: 14px; }
.logo-mark {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 30px -8px rgba(94, 234, 212, 0.3);
}
.brand h1 {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, var(--teal) 50%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.brand-sub { font-size: 12.5px; color: var(--text-mute); font-family: var(--ff-mono); letter-spacing: 0.02em; }

/* search */
.search-wrap { max-width: 640px; margin: 0 auto 28px;
  animation: rise 0.7s 0.1s cubic-bezier(.2,.7,.3,1) both; }
.search-box {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  height: 64px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.6), 0 0 0 4px rgba(94,234,212,.12), 0 0 40px -8px var(--teal-glow);
  transform: translateY(-1px);
}
.search-icon { color: var(--text-dim); flex-shrink: 0; transition: color .3s; }
.search-box:focus-within .search-icon { color: var(--teal); }
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 16px; font-family: var(--ff-body);
}
.search-box input::placeholder { color: var(--text-mute); }
.search-box kbd {
  font-family: var(--ff-mono); font-size: 12px;
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.03);
}

/* tabs */
.tabs { display: inline-flex; gap: 4px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; backdrop-filter: blur(20px);
  animation: rise 0.7s 0.2s cubic-bezier(.2,.7,.3,1) both; }
.tab {
  position: relative;
  border: 0; cursor: pointer; background: transparent;
  color: var(--text-dim); font-family: var(--ff-body); font-weight: 600;
  font-size: 13.5px; padding: 9px 18px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .25s, background .25s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--bg-0); background: linear-gradient(135deg, var(--teal), var(--cyan)); }
.badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--rose); color: #fff;
  border-radius: 9px; font-size: 11px; font-weight: 700;
}
.tab.active .badge { background: rgba(0,0,0,0.25); color: var(--bg-0); }
.hidden { display: none !important; }

/* ===================== Panes ===================== */
.pane { display: none; animation: fade 0.4s ease both; }
.pane.active { display: block; }

@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* empty state */
.empty-state {
  text-align: center; padding: 56px 20px;
  color: var(--text-dim);
  animation: fade .5s ease;
}
.empty-glyph { color: var(--text-mute); margin-bottom: 18px; opacity: 0.7; }
.empty-state h2 {
  font-family: var(--ff-display); font-weight: 600; font-size: 22px;
  color: var(--text); margin-bottom: 8px; letter-spacing: -0.01em;
}
.empty-state p { font-size: 14px; max-width: 380px; margin: 0 auto; }

/* ===================== Results grid ===================== */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
/* 空状态/加载提示横跨网格所有列，居中显示 */
.results > .empty-state,
.results > .center-load,
.results > :not(.repo-card) {
  grid-column: 1 / -1;
  text-align: center;
}

.repo-card {
  position: relative;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
  overflow: hidden;
  transition: transform .3s cubic-bezier(.2,.7,.3,1), border-color .3s, box-shadow .3s;
  animation: rise 0.5s ease both;
}
.repo-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px circle at var(--mx,50%) var(--my,0%), rgba(94,234,212,0.10), transparent 50%);
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.repo-card:hover { transform: translateY(-4px); border-color: var(--border-hi);
  box-shadow: 0 24px 50px -24px rgba(94,234,212,.35); }
.repo-card:hover::before { opacity: 1; }

.repo-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.repo-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.repo-name h3 { font-family: var(--ff-display); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.repo-name .official {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--teal); background: rgba(94,234,212,.12);
  border: 1px solid rgba(94,234,212,.3);
  padding: 2px 7px; border-radius: 6px; text-transform: uppercase;
}
.repo-desc {
  font-size: 13px; color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin: 6px 0 16px; min-height: 38px;
}
.repo-meta { display: flex; gap: 18px; font-size: 12.5px; color: var(--text-mute); font-family: var(--ff-mono); }
.repo-meta span { display: inline-flex; align-items: center; gap: 5px; }
.repo-meta .star { color: var(--amber); }
.repo-meta svg { opacity: 0.8; }

/* ===================== Modal ===================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 8, 16, 0.7);
  backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 24px;
  animation: fade .25s ease;
}
.modal-card {
  width: min(820px, 100%); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: 22px;
  backdrop-filter: blur(40px);
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.8), 0 0 60px -20px var(--violet-glow);
  animation: rise .35s cubic-bezier(.2,.8,.3,1);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 24px 26px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-family: var(--ff-display); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.modal-desc { font-size: 13px; color: var(--text-dim); margin-top: 4px; max-width: 540px; }
.close-btn { background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--text-dim); width: 36px; height: 36px; border-radius: 10px;
  cursor: pointer; display: grid; place-items: center; transition: all .2s; flex-shrink: 0; }
.close-btn:hover { color: var(--text); border-color: var(--border-hi); background: rgba(255,255,255,.07); }

.modal-body { padding: 20px 26px 26px; overflow-y: auto; }
.tags-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 12px; }
.tag-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .25s, background .25s, transform .25s;
}
.tag-item:hover { border-color: var(--border-hi); background: rgba(255,255,255,0.05); transform: translateY(-2px); }
.tag-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tag-name { font-family: var(--ff-mono); font-size: 14px; font-weight: 600; color: var(--text);
  word-break: break-all; }
.tag-size { font-size: 11.5px; color: var(--text-mute); font-family: var(--ff-mono); }
.tag-date { font-size: 11px; color: var(--text-mute); }

/* platform selector chips */
.plat-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.plat-chip {
  cursor: pointer; border: 1px solid var(--border);
  background: rgba(255,255,255,0.03); color: var(--text-dim);
  font-family: var(--ff-mono); font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 7px;
  transition: all .2s;
}
.plat-chip:hover { color: var(--text); border-color: var(--border-hi); }
.plat-chip.active {
  color: var(--bg-0);
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  border-color: transparent;
  box-shadow: 0 4px 14px -4px var(--violet-glow);
}
.plat-none { font-size: 11.5px; color: var(--text-mute); font-family: var(--ff-mono); }

/* platform badge in task card */
.task-plat {
  display: inline-block; margin-left: 8px;
  font-size: 11px; font-weight: 600; vertical-align: middle;
  color: var(--violet); background: rgba(167,139,250,.14);
  border: 1px solid rgba(167,139,250,.3);
  padding: 1px 7px; border-radius: 5px;
}
.dl-btn {
  margin-top: 10px; cursor: pointer;
  border: 1px solid var(--border-hi); background: linear-gradient(135deg, rgba(94,234,212,.18), rgba(34,211,238,.12));
  color: var(--teal); font-family: var(--ff-body); font-weight: 600; font-size: 13px;
  padding: 7px 12px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .25s;
}
.dl-btn:hover { background: linear-gradient(135deg, var(--teal), var(--cyan)); color: var(--bg-0); border-color: transparent;
  box-shadow: 0 6px 20px -6px var(--teal-glow); }
.dl-btn:disabled { opacity: 0.5; cursor: default; }

.tags-loading, .tags-error { text-align: center; padding: 40px; color: var(--text-dim); }
.tags-error { color: var(--rose); }

/* ===================== Tasks ===================== */
.tasks-list { display: flex; flex-direction: column; gap: 14px; }
.task-card {
  padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(20px);
  animation: rise .4s ease both;
}
.task-card.done { border-color: rgba(74,222,128,.4); box-shadow: 0 0 30px -10px rgba(74,222,128,.3); }
.task-card.failed { border-color: rgba(251,113,133,.4); }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.task-ref { font-family: var(--ff-mono); font-weight: 600; font-size: 15px; }
.task-status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 7px; font-family: var(--ff-mono); }
.st-queued  { color: var(--text-mute); background: rgba(255,255,255,.04); }
.st-pulling, .st-saving { color: var(--cyan); background: rgba(34,211,238,.12); }
.st-done    { color: var(--green); background: rgba(74,222,128,.14); }
.st-failed  { color: var(--rose); background: rgba(251,113,133,.14); }

.progress-track {
  height: 8px; border-radius: 4px;
  background: rgba(255,255,255,.06);
  overflow: hidden; position: relative;
}
.progress-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--teal), var(--cyan), var(--violet));
  background-size: 200% 100%;
  transition: width .4s cubic-bezier(.2,.7,.3,1);
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
.task-detail { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-dim); font-family: var(--ff-mono); }
.task-actions { margin-top: 12px; }
.task-actions .dl-btn { margin: 0; }
.err-msg { color: var(--rose); font-size: 12.5px; margin-top: 8px; font-family: var(--ff-mono); word-break: break-all; }

/* ===================== Files ===================== */
.files-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.files-header h2 { font-family: var(--ff-display); font-size: 20px; font-weight: 600; }
.ghost-btn { cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); padding: 8px 16px; border-radius: 10px; font-family: var(--ff-body); font-size: 13px;
  backdrop-filter: blur(20px); transition: all .2s; }
.ghost-btn:hover { color: var(--text); border-color: var(--border-hi); }

.files-list { display: flex; flex-direction: column; gap: 10px; }
.file-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); backdrop-filter: blur(20px);
  transition: border-color .25s, transform .25s;
  animation: rise .4s ease both;
}
.file-item:hover { border-color: var(--border-hi); transform: translateX(2px); }
.file-ico { color: var(--violet); flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-family: var(--ff-mono); font-size: 14px; font-weight: 600; word-break: break-all; }
.file-sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; font-family: var(--ff-mono); }
.file-actions { display: flex; gap: 8px; }
.del-btn { cursor: pointer; border: 1px solid var(--border); background: transparent;
  color: var(--text-mute); width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  transition: all .2s; flex-shrink: 0; }
.del-btn:hover { color: var(--rose); border-color: rgba(251,113,133,.4); background: rgba(251,113,133,.08); }

/* ===================== Toast ===================== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 100; opacity: 0;
  background: var(--surface-2); border: 1px solid var(--border-hi);
  color: var(--text); padding: 12px 22px; border-radius: 12px;
  backdrop-filter: blur(24px); box-shadow: var(--shadow);
  font-size: 13.5px; font-weight: 500;
  transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(251,113,133,.5); }

/* loading spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { text-align: center; padding: 50px; color: var(--text-dim); }

/* ===================== Responsive ===================== */
@media (max-width: 640px) {
  .app { padding: 28px 16px 60px; }
  .brand { flex-direction: column; gap: 10px; }
  .search-box { height: 56px; }
  .search-box input { font-size: 15px; }
  .tabs { flex-wrap: wrap; }
  .tab { font-size: 12.5px; padding: 8px 14px; }
  .results { grid-template-columns: 1fr; }
}
