/* 短视频下载器 - 手机端样式 */
:root {
  --bg: #f4f4fb;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-dim: #8a8aa3;
  --accent: #6d5dfc;
  --accent2: #ff4d8d;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(60, 50, 160, 0.10);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12121c;
    --card: #1d1d2e;
    --text: #ececf5;
    --text-dim: #8f8fa8;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
.app { max-width: 520px; margin: 0 auto; padding: 0 16px 32px; }

/* 头部 */
.hero { text-align: center; padding: 34px 0 22px; }
.logo {
  width: 62px; height: 62px; margin: 0 auto 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff;
  box-shadow: 0 8px 24px rgba(109, 93, 252, 0.35);
}
.logo-down { font-size: 18px; margin-left: 2px; }
.hero h1 { font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.sub { color: var(--text-dim); font-size: 13px; margin-top: 6px; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.input-card { margin-bottom: 16px; }
textarea {
  width: 100%; resize: none;
  border: 1.5px solid rgba(109, 93, 252, 0.25);
  border-radius: 12px;
  background: transparent; color: var(--text);
  font-size: 14px; line-height: 1.6; font-family: inherit;
  padding: 12px;
  outline: none;
}
textarea:focus { border-color: var(--accent); }

.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn {
  border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600;
  padding: 13px 0; flex: 1;
  cursor: pointer; font-family: inherit;
  transition: transform 0.08s ease, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 16px rgba(109, 93, 252, 0.35);
}
.btn.ghost {
  color: var(--text);
  background: rgba(109, 93, 252, 0.10);
  border: 1.5px solid rgba(109, 93, 252, 0.25);
}
.btn.big { font-size: 16px; padding: 15px 0; margin-top: 14px; width: 100%; }
.btn:disabled { opacity: 0.55; }
.hint { color: var(--text-dim); font-size: 12px; margin-top: 10px; text-align: center; }

/* 结果 */
.result-card { padding: 16px 16px 20px; }
.meta-row { display: flex; gap: 8px; margin-bottom: 12px; }
.chip {
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(109, 93, 252, 0.14); color: var(--accent);
}
.chip.dim { background: rgba(138, 138, 163, 0.15); color: var(--text-dim); }
.cover-wrap { border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.cover-wrap img { width: 100%; display: block; }
#r-title { font-size: 16px; line-height: 1.5; font-weight: 600; }
.author { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

video { width: 100%; border-radius: 12px; margin-top: 14px; background: #000; }

/* 图集 */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 8px; display: block; cursor: pointer;
}
.grid a { position: relative; }

/* 历史 */
.sec-title { font-size: 14px; color: var(--text-dim); margin: 20px 0 10px; padding-left: 4px; }
.list { padding: 6px 12px; }
.h-item {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(138, 138, 163, 0.15);
}
.h-item:last-child { border-bottom: none; }
.h-item img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }
.h-item .h-info { flex: 1; min-width: 0; }
.h-item .h-title {
  font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.h-item .h-time { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%);
  background: rgba(20, 20, 40, 0.92); color: #fff;
  font-size: 13px; padding: 10px 18px; border-radius: 999px;
  z-index: 99; max-width: 86vw; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.toast.err { background: rgba(200, 60, 60, 0.95); }

.hidden { display: none !important; }
.err { color: #e05c5c; font-size: 13px; margin-top: 10px; text-align: center; }

/* 下载进度条 */
#dl-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 10, 25, 0.72);
  display: flex; align-items: center; justify-content: center;
}
.dl-box {
  width: min(82vw, 340px);
  background: var(--card); border-radius: 16px;
  padding: 20px 18px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.dl-title {
  font-size: 13px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 12px;
}
.dl-bar {
  height: 8px; border-radius: 99px; overflow: hidden;
  background: rgba(109, 93, 252, 0.15);
}
.dl-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 0.25s ease;
}
.dl-fill.indeterminate {
  width: 100% !important;
  background: linear-gradient(90deg, var(--accent) 25%, var(--accent2) 50%, var(--accent) 75%);
  background-size: 200% 100%;
  animation: dl-slide 1.2s linear infinite;
}
@keyframes dl-slide { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.dl-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
#dl-pct { font-size: 13px; font-weight: 600; color: var(--text); }
.dl-cancel {
  border: none; background: transparent;
  color: var(--text-dim); font-size: 13px;
  padding: 6px 10px; cursor: pointer;
}

footer { text-align: center; color: var(--text-dim); font-size: 11px; margin-top: 26px; }
