/* 视频号视频下载 · 样式
   设计原则：白底、细线、单一绿色强调，信息密度克制。 */

:root {
  --green: #07c160;
  --green-deep: #06a552;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-mute: #94a3b8;
  --line: #e6e9ef;
  --line-soft: #eef1f5;
  --bg: #f7f8fa;
  --card: #ffffff;
  --danger: #e5484d;
  --danger-bg: #fff5f5;
  --warn: #b45309;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px -12px rgba(15, 23, 42, 0.12);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(80% 50% at 50% -10%, rgba(7, 193, 96, 0.10), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--line-soft);
  padding: 1px 5px;
  border-radius: 5px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 顶栏 ---------- */
.site-header {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 22px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  color: var(--green);
}
.brand-mark svg { width: 100%; height: 100%; }

.header-note {
  font-size: 13px;
  color: var(--ink-mute);
}

/* ---------- 主体 ---------- */
.page {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 24px 24px;
  flex: 1;
}

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

.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hero-sub {
  margin: 16px auto 0;
  max-width: 520px;
  color: var(--ink-soft);
  font-size: 15px;
}

/* ---------- 输入面板 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 6px 6px 6px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.panel:focus-within {
  border-color: rgba(7, 193, 96, 0.45);
  box-shadow: 0 0 0 4px rgba(7, 193, 96, 0.10), var(--shadow-card);
}

.share-input {
  display: block;
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 16px 18px 6px;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}
.share-input::placeholder { color: var(--ink-mute); }

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  flex-wrap: wrap;
}

.hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-mute);
  font-size: 12.5px;
}
.hint svg { width: 14px; height: 14px; flex: none; }

.panel-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.12s ease, opacity 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(7, 193, 96, 0.9);
}
.btn-primary:hover { background: var(--green-deep); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-quiet {
  color: var(--ink-soft);
  border-color: var(--line);
  background: #fff;
}
.btn-quiet:hover { border-color: #d6dae2; background: #fafbfc; }

.btn-lg { height: 48px; padding: 0 26px; font-size: 15px; }

.dl-icon { width: 18px; height: 18px; }

.btn-spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: 0.9; }

/* ---------- 提示条 ---------- */
.alert {
  margin-top: 18px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  border: 1px solid #f3d2d3;
  background: var(--danger-bg);
  color: #a3282c;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: rise 0.22s ease both;
}
.alert::before {
  content: "";
  width: 16px; height: 16px;
  margin-top: 2px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.8 15 14H1L8 1.8Zm0 3.8v3.6m0 2.4v.4' stroke='black' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.8 15 14H1L8 1.8Zm0 3.8v3.6m0 2.4v.4' stroke='black' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.alert.is-info {
  border-color: #dbe3ec;
  background: #f6f8fb;
  color: var(--ink-soft);
}

/* ---------- 结果卡片 ---------- */
.result {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  animation: rise 0.26s ease both;
}

.result-media { min-width: 0; }

.media-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  max-height: 360px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0b1220;
  display: grid;
  place-items: center;
}

.preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0b1220;
  display: block;
}

.cover {
  width: 100%; height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.media-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.55);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(7, 193, 96, 0.22), transparent 60%),
    linear-gradient(160deg, #111827, #0b1220);
  font-size: 12.5px;
  letter-spacing: 0.06em;
}
.media-placeholder svg {
  width: 56px; height: 56px;
  padding: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}
.media-placeholder.is-hidden { display: none; }

.result-body { min-width: 0; display: flex; flex-direction: column; }

.result-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--line-soft);
  white-space: nowrap;
}
.pill-ok { color: var(--green-deep); background: rgba(7, 193, 96, 0.10); }

.result-title {
  font-size: 20px;
  line-height: 1.42;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.result-desc {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.result-author {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--ink-mute);
}

.result-actions {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- 下载进度 ---------- */
.progress {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-mute);
}
.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}
.progress-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.18s ease;
}
.progress.is-indeterminate .progress-track i {
  width: 40% !important;
  animation: sweep 1.2s ease-in-out infinite;
}
.progress-text { min-width: 76px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 使用说明 ---------- */
.steps {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.step {
  padding: 18px 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}
.step h3 { margin-top: 10px; font-size: 14.5px; font-weight: 600; }
.step p { margin-top: 6px; font-size: 13px; color: var(--ink-mute); line-height: 1.6; }

/* ---------- 页脚 ---------- */
.site-footer {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 40px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-mute);
}
.site-footer strong { color: var(--ink-soft); font-weight: 500; }
.footer-meta { margin-top: 6px; opacity: 0.75; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  max-width: calc(100vw - 40px);
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 12px 30px -12px rgba(15, 23, 42, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .site-header { padding: 16px 18px 0; }
  .header-note { display: none; }
  .page { padding: 36px 18px 16px; }
  .hero { margin-bottom: 28px; }
  .hero-sub { margin-top: 12px; font-size: 14px; }
  .br-mobile { display: none; }

  .panel-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .panel-actions { margin-left: 0; }
  .panel-actions .btn { flex: 1; }
  .hint { padding: 0 6px; }

  .result {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
  }
  .media-frame { aspect-ratio: 16 / 10; max-height: 300px; }
  .result-actions { padding-top: 16px; }
  .result-actions .btn { flex: 1 1 0; min-width: 0; }

  .steps { grid-template-columns: 1fr; gap: 10px; margin-top: 28px; }
  .step { display: grid; grid-template-columns: 24px 1fr; column-gap: 10px; }
  .step h3 { margin-top: 0; }
  .step p { grid-column: 2; }
}

@media (max-width: 400px) {
  .page { padding-top: 28px; }
  .hero h1 { font-size: 26px; }
  .share-input { min-height: 84px; padding: 14px 14px 4px; }
  .panel-foot { padding: 8px 10px 10px 12px; }
  .btn { height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
