:root {
  --bg: #14121f; --surface: #1f1c2e; --surface-2: #2a2640; --line: #37324f;
  --text: #f3f1fa; --muted: #a39dbd; --accent: #ff8a3d; --accent-2: #7c5cff;
  --ok: #3ccf91; --err: #ff6b6b; --radius: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
.wrap { max-width: 560px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }

.top { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.logo { border-radius: 12px; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }
.dot { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px #3ccf9122; }
.dot.off { background: var(--err); box-shadow: 0 0 0 4px #ff6b6b22; }

.plats { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px 6px; scrollbar-width: none; }
.plats::-webkit-scrollbar { display: none; }
.plat { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 99px; padding: 6px 12px 6px 6px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.plat em { font-style: normal; font-size: 10px; font-weight: 500; background: var(--surface-2); padding: 1px 6px; border-radius: 99px; }
.plat.on { color: var(--text); border-color: var(--accent); background: var(--surface-2); }
.pi { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.pi-tiktok { background: #111; box-shadow: inset 0 0 0 1px #444; }
.pi-douyin { background: #1c1c2b; box-shadow: inset 0 0 0 1px #444; font-size: 11px; }
.pi-facebook { background: #1877f2; font-family: Georgia, serif; font-size: 15px; }
.pi-rednote { background: #ff2442; font-size: 11px; }
.pi-youtube { background: #ff0033; font-size: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
textarea { width: 100%; resize: vertical; min-height: 76px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; font-size: 15px; }
textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; border-color: transparent; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.btn { border: 0; border-radius: 12px; padding: 12px 16px; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; min-height: 46px; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #ff5f6d); color: #1a1020; margin-left: auto; flex: 1; }
.btn.ghost { background: var(--surface-2); }
.btn.alt { background: var(--accent-2); }
.btn.block { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }

.msg { min-height: 1.4em; margin: 12px 4px; color: var(--muted); font-size: 14px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

.result { display: grid; gap: 12px; margin-bottom: 20px; }
.media { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.media img.cover { width: 96px; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.meta h3 { font-size: 15px; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.who { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.who img { width: 20px; height: 20px; border-radius: 50%; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.tag.p-tiktok { color: #ffc0d3; } .tag.p-facebook { color: #9cc4ff; } .tag.p-rednote { color: #ff9aa9; } .tag.p-youtube { color: #ff9a9a; } .tag.p-douyin { color: #9fd4ff; }
.dl-row { display: grid; gap: 6px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.thumbs img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; }
.actions { display: grid; gap: 8px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .3s; }
.bar.indet > i { width: 35%; animation: slide 1.1s infinite ease-in-out; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.files { display: grid; gap: 8px; }
.small { font-size: 12px; color: var(--muted); text-align: center; }

.history { margin-top: 8px; }
.hhead { display: flex; align-items: baseline; justify-content: space-between; }
h2 { font-size: 16px; margin: 8px 4px; }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 8px; }
#hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#hist li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
#hist img { width: 44px; height: 58px; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
#hist .t { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hist .s { font-size: 12px; color: var(--muted); }
#hist button { background: var(--surface-2); border: 0; color: var(--text); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.empty { color: var(--muted); font-size: 14px; margin: 4px; }
.foot { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
.foot a { color: var(--muted); }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(320px, 90vw); }
dialog::backdrop { background: #000a; }
dialog h3 { margin: 0 0 12px; }
dialog input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; margin-bottom: 12px; }
dialog .btn { width: 100%; }
