/* ===== 苹果 Glassmorphism 玻璃拟态 ===== */
:root {
  --bg-1: #0f1023;
  --bg-2: #1a1b3a;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bg-strong: rgba(255, 255, 255, 0.13);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-highlight: rgba(255, 255, 255, 0.3);
  --text: #f5f5f7;
  --text-dim: rgba(245, 245, 247, 0.62);
  --text-faint: rgba(245, 245, 247, 0.4);
  --accent: #0a84ff;
  --radius-lg: 24px;
  --radius-md: 17px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 var(--glass-highlight);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2) 70%, #23245a);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 背景漂浮光斑 ===== */
.bg-orbs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 22s ease-in-out infinite;
}
.orb-1 { width: 480px; height: 480px; background: #5b8cff; top: -140px; left: -120px; }
.orb-2 { width: 420px; height: 420px; background: #c86bff; top: 18%; right: -160px; animation-delay: -6s; }
.orb-3 { width: 380px; height: 380px; background: #36c5ff; bottom: -130px; left: 22%; animation-delay: -12s; }
.orb-4 { width: 300px; height: 300px; background: #ff7ad9; bottom: 6%; right: 16%; opacity: 0.32; animation-delay: -16s; }

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0) scale(1); }
  50% { transform: translateY(-36px) translateX(26px) scale(1.06); }
}

/* ===== 玻璃面板 ===== */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ===== 布局 ===== */
.app { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 26px 20px 60px; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  margin-bottom: 26px;
  border-radius: var(--radius-lg);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  font-size: 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(90, 140, 255, 0.5), rgba(200, 107, 255, 0.5));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 18px rgba(90,140,255,.35);
}
.brand h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.header-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  transition: transform .15s, background .15s;
}
.icon-btn:hover { background: var(--glass-bg-strong); transform: scale(1.05); }

/* ===== 区块 ===== */
.section { margin-bottom: 26px; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; padding-left: 4px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title-row .section-title { margin-bottom: 0; }

/* ===== 平台卡片 ===== */
.platform-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.platform-card {
  padding: 18px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: transform .16s, box-shadow .2s;
  text-align: center;
}
.platform-card:hover { transform: translateY(-4px); }
.platform-card.active {
  background: var(--glass-bg-strong);
  box-shadow: 0 0 0 2px var(--pc-color, var(--accent)), 0 18px 44px rgba(0,0,0,.4);
}
.pc-icon {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--pc-color, var(--accent)) 26%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 22px color-mix(in srgb, var(--pc-color, var(--accent)) 36%, transparent);
}
.pc-name { font-size: 14px; font-weight: 600; }
.pc-desc { font-size: 11px; color: var(--text-faint); }
.pc-loading { color: var(--text-faint); font-size: 13px; padding: 26px 0; }

/* ===== 输入区 ===== */
.input-panel { padding: 16px; }
.input-row { display: flex; gap: 10px; }
#url-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#url-input::placeholder { color: var(--text-faint); }
#url-input:focus { border-color: rgba(255,255,255,.45); box-shadow: 0 0 0 3px rgba(10,132,255,.25); }

.btn {
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  padding: 0 20px;
  height: 46px;
  transition: transform .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { height: 34px; font-size: 12px; padding: 0 14px; border-radius: 10px; }
.btn-primary {
  background: linear-gradient(135deg, #0a84ff, #7d5cff);
  color: #fff;
  box-shadow: 0 8px 22px rgba(10, 132, 255, 0.4), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-ghost {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.btn-ghost:hover { background: var(--glass-bg-strong); }

.btn-spinner, .spinner {
  width: 15px; height: 15px;
  display: inline-block;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

.detect-tip {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}
.detect-tip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ===== 解析结果 ===== */
.result-panel { padding: 20px; display: flex; gap: 18px; align-items: flex-start; }
.result-cover-wrap {
  width: 132px; height: 80px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,.3);
  display: grid; place-items: center;
  border: 1px solid var(--glass-border);
}
.result-cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fallback { font-size: 34px; opacity: .5; }
.result-info { flex: 1; min-width: 0; }
.result-title { font-size: 16px; font-weight: 700; line-height: 1.45; word-break: break-all; }
.result-author { font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.quality-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.quality-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s;
}
.quality-chip:hover { color: var(--text); }
.quality-chip.active {
  background: linear-gradient(135deg, rgba(10,132,255,.9), rgba(125,92,255,.9));
  border-color: transparent;
  color: #fff;
}
.result-actions { display: flex; align-items: center; gap: 14px; }
.result-error { font-size: 12.5px; color: #ff6b81; word-break: break-all; }

/* ===== 任务列表 ===== */
.task-list { display: flex; flex-direction: column; gap: 12px; }
.empty-state {
  padding: 34px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
  border-radius: var(--radius-md);
}
.task-item {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform .15s;
}
.task-item:hover { transform: translateY(-2px); }
.task-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 21px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--t-color, var(--accent)) 22%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; display: flex; gap: 12px; flex-wrap: wrap; }
.task-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  margin-top: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0a84ff, #7d5cff);
  transition: width .25s ease;
  box-shadow: 0 0 12px rgba(10,132,255,.6);
}
.task-actions { display: flex; align-items: center; gap: 8px; }
.task-status {
  font-size: 11.5px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  white-space: nowrap;
}
.task-status.done { color: #4cd964; border-color: rgba(76,217,100,.4); background: rgba(76,217,100,.12); }
.task-status.failed, .task-status.cancelled { color: #ff6b81; border-color: rgba(255,107,129,.4); background: rgba(255,107,129,.12); }
.task-status.downloading, .task-status.resolving, .task-status.queued { color: #0a84ff; border-color: rgba(10,132,255,.4); background: rgba(10,132,255,.12); }
.task-cancel {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  transition: color .15s, background .15s;
}
.task-cancel:hover { color: #ff6b81; background: rgba(255,107,129,.15); }

/* 把服务器上下载好的文件保存回本机 */
.task-save {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  text-decoration: none;
  display: grid; place-items: center;
  transition: color .15s, background .15s;
}
.task-save:hover { color: #4cd964; background: rgba(76,217,100,.15); }

/* ===== 设置弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(10, 12, 30, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.modal { width: min(420px, 92vw); padding: 26px; }
.modal h2 { font-size: 18px; margin-bottom: 20px; }
.field-label { display: block; font-size: 12.5px; color: var(--text-dim); margin: 12px 0 7px; }
.modal-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(0,0,0,.3);
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font);
  outline: none;
}
.modal-input:focus { border-color: rgba(255,255,255,.45); box-shadow: 0 0 0 3px rgba(10,132,255,.25); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.modal-note { margin-top: 14px; font-size: 12px; color: #4cd964; word-break: break-all; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 13.5px;
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  max-width: 80vw;
  text-align: center;
}
.toast.error { border-color: rgba(255,107,129,.5); }

.footer { text-align: center; font-size: 11.5px; color: var(--text-faint); margin-top: 40px; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

@media (max-width: 660px) {
  .platform-grid { grid-template-columns: repeat(2, 1fr); }
  .result-panel { flex-direction: column; align-items: stretch; }
  .result-cover-wrap { align-self: stretch; height: 130px; width: auto; }
  .input-row { flex-wrap: wrap; }
  #url-input { min-width: 100%; }
}