/* ═══════════════════════════════════════
   网页下载器 · 统一样式
   零外部依赖，不引任何 CDN 字体/框架
   ═══════════════════════════════════════ */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e6e8ec;
  --line-soft: #f0f1f4;
  --text: #181b23;
  --muted: #6b7280;
  --brand: #2b6cff;
  --brand-d: #1d54d8;
  --brand-soft: #eef3ff;
  --ok: #16a34a;
  --ok-soft: #eaf8ef;
  --warn: #d97706;
  --warn-soft: #fff7e8;
  --danger: #dc2626;
  --danger-soft: #fdeeee;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── 布局 ─── */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  max-width: 940px;
  margin: 0 auto;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.2px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

.brand-dot {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff9540, #ff6a00);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.topbar .spacer { flex: 1; }

.navlink {
  color: var(--muted);
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
}
.navlink:hover { background: var(--line-soft); text-decoration: none; color: var(--text); }

.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 26px 20px 80px;
}

.wrap-narrow { max-width: 560px; }

/* ─── 卡片 ─── */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 650;
  margin: 0;
}

.card-title-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin-left: auto;
}

h1.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -.3px;
}

.page-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 22px;
}

/* ─── 拖拽区 ─── */

.dropzone {
  border: 2px dashed #cfd5e0;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 46px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
  user-select: none;
}

.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.008);
}

.dropzone-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 12px;
  display: block;
}

.dropzone-main {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dropzone-hint {
  font-size: 13px;
  color: var(--muted);
}

/* ─── 表单 ─── */

.field { margin-bottom: 14px; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3c4150;
  margin-bottom: 6px;
}

.input, .select {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid #d6dae2;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}

.input:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(43, 108, 255, .13);
}

.input::placeholder { color: #a6adba; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
}

.field-tip {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

/* ─── 按钮 ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .14s, border-color .14s, opacity .14s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }

.btn-ghost {
  background: #fff;
  color: #3c4150;
  border-color: #d6dae2;
}
.btn-ghost:hover { background: #f7f8fa; }

.btn-danger { background: #fff; color: var(--danger); border-color: #f3c3c3; }
.btn-danger:hover { background: var(--danger-soft); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 11px; }
.btn-block { width: 100%; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── 进度条 ─── */

.progress {
  height: 9px;
  background: #e9ecf1;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4a86ff, #2b6cff);
  border-radius: 99px;
  transition: width .25s ease;
}

.progress-bar.is-done { background: linear-gradient(90deg, #22c55e, #16a34a); }
.progress-bar.is-error { background: linear-gradient(90deg, #f87171, #dc2626); }

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  gap: 10px;
}

.progress-meta strong { color: var(--text); font-weight: 600; }

/* ─── 提示条 ─── */

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 14px;
  border: 1px solid;
}

.alert-info { background: var(--brand-soft); border-color: #d3e0ff; color: #1a3f8f; }
.alert-ok { background: var(--ok-soft); border-color: #c3e9d1; color: #14612f; }
.alert-warn { background: var(--warn-soft); border-color: #f6dfb4; color: #86540a; }
.alert-danger { background: var(--danger-soft); border-color: #f5cbcb; color: #8f1d1d; }

.alert strong { font-weight: 650; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert li { margin: 3px 0; }

/* ─── 标签 / 徽章 ─── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 99px;
  background: var(--line-soft);
  color: var(--muted);
}

.tag-ok { background: var(--ok-soft); color: #14612f; }
.tag-warn { background: var(--warn-soft); color: #86540a; }
.tag-danger { background: var(--danger-soft); color: #8f1d1d; }
.tag-brand { background: var(--brand-soft); color: #1a3f8f; }

/* ─── 列表 ─── */

.share-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  background: #fff;
}

.share-item.is-dead { opacity: .58; }

.share-top {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.share-name {
  font-weight: 620;
  font-size: 14.5px;
  word-break: break-all;
}

.share-meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 11px;
}

.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── 结果框 ─── */

.link-box {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.link-box input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: #f8f9fb;
  min-width: 0;
}

/* ─── 用量仪表 ─── */

.meter { margin-bottom: 16px; }
.meter:last-child { margin-bottom: 0; }

.meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
  gap: 10px;
}

.meter-head .k { color: var(--muted); }

/* ─── 体检项 ─── */

.check-item {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: flex-start;
}
.check-item:last-child { border-bottom: none; }

.check-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}
.check-icon.ok { background: var(--ok); }
.check-icon.bad { background: var(--danger); }

.check-body { flex: 1; min-width: 0; }
.check-name { font-weight: 620; font-size: 14px; }
.check-msg { font-size: 13px; color: var(--muted); word-break: break-word; }
.check-fix { font-size: 12.5px; color: var(--warn); margin-top: 4px; }

/* ─── 下载页 ─── */

.dl-file {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 4px 0 18px;
}

.dl-icon {
  width: 54px; height: 54px;
  border-radius: 13px;
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.dl-name {
  font-size: 17px;
  font-weight: 680;
  word-break: break-all;
  line-height: 1.4;
}

.dl-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

details.acc {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 16px;
  background: #fcfcfd;
}

details.acc > summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: #3c4150;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before {
  content: "▸";
  font-size: 11px;
  color: var(--muted);
  transition: transform .15s;
}
details.acc[open] > summary::before { transform: rotate(90deg); }

details.acc .acc-body {
  margin-top: 11px;
  font-size: 13px;
  color: #4b5160;
  line-height: 1.75;
}

details.acc .acc-body ol { margin: 6px 0 0; padding-left: 20px; }
details.acc .acc-body li { margin: 4px 0; }

code.inline {
  background: #eef1f6;
  padding: 1px 6px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
}

/* ─── 图标按钮（用于下载页大按钮）─── */

.dl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 680;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .14s;
}

.dl-btn-primary { background: var(--brand); color: #fff; }
.dl-btn-primary:hover { background: var(--brand-d); text-decoration: none; color: #fff; }

.dl-btn-ghost {
  background: #fff;
  color: #3c4150;
  border-color: #d6dae2;
  margin-top: 10px;
}
.dl-btn-ghost:hover { background: #f7f8fa; text-decoration: none; }

/* ─── 空状态 / 加载 ─── */

.center-box {
  text-align: center;
  padding: 46px 20px;
}

.center-icon { font-size: 44px; margin-bottom: 14px; }

.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid #dfe3ea;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-right { text-align: right; }

/* ─── Toast ─── */

#toast-host {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: #23262e;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .22);
  animation: toast-in .2s ease;
  max-width: 82vw;
}

.toast.ok { background: #157f3c; }
.toast.err { background: #b81c1c; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}
