/* ==========================================================================
   VideoSaver — 单文件样式表
   设计取舍：
   * 不引 CSS 框架（Tailwind/Bootstrap 会带来 10~50KB 额外体积与 CSP 麻烦），
     这个站点只有 5 个页面类型，手写 ~600 行足够且首屏更快。
   * 用 CSS 变量做主题，暗色优先（这类工具站 60%+ 是夜间使用）。
   * 字体走系统栈：免加载、免 GDPR 字体服务合规问题、免 FOUT。
   ========================================================================== */

:root {
  --bg: #0b1020;
  --bg-soft: #121a2f;
  --surface: #17203a;
  --surface-2: #1e2a49;
  --line: #263356;
  --text: #e9eefb;
  --muted: #9aa7c7;
  --brand: #4f7cff;
  --brand-2: #7c5cff;
  --ok: #2ecc8f;
  --warn: #ffb020;
  --err: #ff5f6d;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgb(0 0 0 / 35%);
  --wrap: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fe;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0f3fb;
    --line: #dde4f5;
    --text: #141a2b;
    --muted: #5c6885;
    --shadow: 0 10px 30px rgb(20 30 60 / 10%);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgb(79 124 255 / 18%), transparent 70%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.9rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { font-size: 1.125rem; color: var(--muted); }
.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;
}
.skip {
  position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff;
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 0;
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 700; color: var(--text); letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand--footer { margin-bottom: .5rem; }

.nav { display: none; gap: 1.1rem; margin-inline-start: auto; font-size: .93rem; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); text-decoration: none; }

@media (min-width: 720px) {
  .nav { display: flex; }
}

.lang-menu { margin-inline-start: auto; position: relative; }
.lang-menu summary {
  cursor: pointer; list-style: none; padding: .4rem .7rem;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: .85rem; color: var(--muted);
}
.lang-menu summary::-webkit-details-marker { display: none; }

/* ---- 移动端导航（<720px 时替代隐藏的 .nav）---- */
.mobile-nav { display: block; position: relative; }
@media (min-width: 720px) { .mobile-nav { display: none; } }
/* 窄屏下让"菜单"靠右、语言紧随其后；两个 auto margin 会平分空间，
   所以这里把语言的 auto 收回，否则它俩会散开。 */
@media (max-width: 719px) {
  .mobile-nav { margin-inline-start: auto; }
  .lang-menu { margin-inline-start: 0; }
}
.mobile-nav summary {
  cursor: pointer; list-style: none;
  padding: .35rem .6rem; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1.05rem; line-height: 1;
  color: var(--text);
}
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav__list {
  position: absolute; inset-inline-start: 0; top: calc(100% + .45rem);
  width: min(78vw, 20rem); max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: .45rem; z-index: 45;
  display: flex; flex-direction: column; gap: .1rem;
}
.mobile-nav__list a {
  padding: .5rem .6rem; border-radius: 8px;
  color: var(--text); font-size: .92rem;
}
.mobile-nav__list a:hover { background: var(--surface-2); text-decoration: none; }
.mobile-nav__group {
  margin-top: .4rem; padding: .35rem .6rem .2rem;
  font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
  border-top: 1px solid var(--line);
}
.lang-list {
  position: absolute; inset-inline-end: 0; top: calc(100% + .4rem);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  display: grid; grid-template-columns: repeat(2, minmax(9rem, 1fr));
  padding: .35rem; z-index: 40; max-height: 60vh; overflow: auto;
}
.lang-list a {
  padding: .45rem .6rem; border-radius: 8px; color: var(--text); font-size: .9rem;
}
.lang-list a:hover { background: var(--surface-2); text-decoration: none; }
.lang-list a[aria-current] { color: var(--brand); font-weight: 600; }

/* -------------------------------------------------------------------- hero */

.hero { padding: clamp(2rem, 5vw, 4.5rem) 0 1.5rem; text-align: center; }
.hero__inner { max-width: 760px; }
.hero__sub { color: var(--muted); font-size: 1.06rem; }

/* ------------------------------------------------------------------ 表单 */

.resolver { margin-top: 1.8rem; }
.resolver__row {
  display: flex; gap: .5rem; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: .55rem;
  box-shadow: var(--shadow);
}
/* 窄屏优化：输入框独占一行，两个按钮排在下方并右对齐。
   不这样做时 390px 宽的手机上，输入框只能显示约 11 个字符，
   用户看不到自己粘进来的完整链接，会怀疑"没粘上"。 */
@media (max-width: 520px) {
  .resolver__row { padding: .5rem; }
  .resolver input { flex: 1 1 100%; padding: .6rem .7rem; font-size: 16px; }
  .resolver .btn { flex: 1 1 auto; }
}
.resolver__row:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgb(79 124 255 / 18%), var(--shadow);
}
.resolver input {
  flex: 1 1 16rem; min-width: 0;
  background: transparent; border: 0; outline: none;
  color: var(--text); font-size: 1rem; padding: .75rem .9rem;
  font-family: inherit;
}
.resolver input::placeholder { color: var(--muted); }
.resolver__note { margin-top: .7rem; }
.resolver__error {
  margin-top: 1rem; color: var(--err); font-weight: 500;
  background: color-mix(in srgb, var(--err) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 40%, transparent);
  border-radius: var(--radius-sm); padding: .7rem 1rem;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 600; border-radius: var(--radius-sm);
  padding: .7rem 1.15rem; transition: transform .08s ease, filter .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; box-shadow: 0 6px 18px rgb(79 124 255 / 35%);
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--primary:disabled { opacity: .6; cursor: progress; }
.btn--ghost {
  background: var(--surface-2); color: var(--text); border-color: var(--line);
}
.btn--ghost:hover { background: var(--line); }
.btn--sm { padding: .45rem .8rem; font-size: .875rem; }

/* ------------------------------------------------------------------ 结果 */

.result { margin-top: 1.5rem; text-align: start; }
.result__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
@media (min-width: 640px) {
  .result__card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 1.1rem; }
}
.result__thumb {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: var(--radius-sm); background: var(--surface-2);
  /* 移动端必须限高：卡片是单列时 16:9 缩略图会占满整屏，
     把真正的下载按钮挤出首屏（实测 390px 宽下占 600px+ 高）。 */
  max-height: 200px;
}
@media (min-width: 640px) {
  .result__thumb { max-height: none; }
}
.result__title {
  font-size: 1.02rem; font-weight: 600; margin: 0 0 .3rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.result__meta { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-bottom: .8rem; }
.result__options {
  display: grid;
  /* 用 grid 而不是 flex-wrap：每个选项是"按钮 + 直链"的两行结构，
     用 flex 时高度不齐会让直链入口错位到别的选项下面（实际截图出现过）。 */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  align-items: start;
  gap: .55rem;
}

.option {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); border-radius: var(--radius-sm);
  padding: .55rem .8rem; font: inherit; font-size: .9rem; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.result__body { min-width: 0; }
.format-group { margin-top: 1.2rem; }
.format-group__title { font-size: 1rem; text-align: start; text-wrap: balance; margin-bottom: .65rem; }
details.format-group { border-top: 1px solid var(--line); padding-top: 1rem; }
details.format-group > summary { cursor: pointer; color: var(--muted); }
.format-group__hint, .result__notice { font-size: .84rem; color: var(--muted); text-wrap: pretty; }
.result__notice { padding: .65rem; border-inline-start: 3px solid var(--warn); background: var(--surface-2); }
.option { flex-wrap: wrap; min-height: 48px; width: 100%; text-align: start; font-variant-numeric: tabular-nums; }
.option:disabled { cursor: not-allowed; opacity: .6; }
.option__limit { color: var(--warn); font-size: .78rem; }
.progress__label .btn { display: flex; margin-top: .5rem; }
.format-group { scroll-margin-top: 5rem; }
.option:hover { border-color: var(--brand); }
.option--default { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface-2)); }
.option--busy { opacity: .7; cursor: progress; }
.option strong { font-weight: 700; }
.option .tag {
  font-size: .72rem; padding: .1rem .4rem; border-radius: 6px;
  background: color-mix(in srgb, var(--brand) 22%, transparent); color: var(--brand);
}
.option .tag--ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.option .tag--warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
/* 「无声」必须比普通标签更醒目：用户点了才发现没声音，会直接判定站点坏了 */
.option .tag--danger {
  background: color-mix(in srgb, var(--err) 22%, transparent);
  color: var(--err);
  font-weight: 700;
}
.option__size { color: var(--muted); font-size: .8rem; }

/* 每个下载项一块：主按钮（同源代理，保证落盘）+ 次级"直链"入口 */
.option-wrap { display: flex; flex-direction: column; gap: .25rem; }
.linkish {
  align-self: flex-start;
  background: none; border: 0; padding: 0 .2rem;
  color: var(--muted); font: inherit; font-size: .78rem;
  cursor: pointer; text-decoration: underline dotted;
}
.linkish:hover { color: var(--brand); }

.progress {
  margin-top: .7rem; height: 6px; border-radius: 99px;
  background: var(--surface-2); overflow: hidden;
}
.progress__bar {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .4s ease;
}
.progress__label { font-size: .82rem; color: var(--muted); margin-top: .35rem; }

/* ------------------------------------------------------------------ 区块 */

.section { padding: 2.2rem 0; }
.section h2 { text-align: center; }

.steps {
  list-style: none; padding: 0; margin: 1.5rem 0 0;
  display: grid; gap: 1rem;
}
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem;
}
.steps__num {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 700; font-size: .9rem; margin-bottom: .6rem;
}
.steps p { color: var(--muted); margin: 0; }

/* 平台链接：窄屏下一律两列等宽，避免出现「2+2+1」这种最后一行只剩一个
   居中小胶囊的排列 —— 宽度参差不齐时视觉上像少了一行，也不好点。
   宽屏仍用居中 wrap，数量变化时不会留下空网格。 */
.chips {
  list-style: none; padding: 0; margin: 1.1rem 0 0;
  display: grid; gap: .5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px) {
  .chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
}
.chip {
  display: flex; align-items: center; justify-content: center;
  padding: .5rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: .875rem; text-align: center;
  line-height: 1.35;
}
.chip:hover { border-color: var(--brand); text-decoration: none; }

.cards { display: grid; gap: 1rem; margin-top: 1.5rem; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(4, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem;
}
.card p { color: var(--muted); margin: 0; font-size: .93rem; }

.faq { margin-top: 1.2rem; display: grid; gap: .5rem; }
.faq details {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .2rem 1rem;
}
.faq summary {
  cursor: pointer; padding: .8rem 0; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--muted); margin: 0 0 .9rem; font-size: .94rem; }

.notice {
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
}
.notice h2 { text-align: start; font-size: 1.1rem; }
.notice p { color: var(--muted); margin: 0; }

/* ------------------------------------------------------------------ 广告 */

.ad-slot {
  margin: 1.5rem auto;
  min-height: 90px;
  display: grid; place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  position: relative;
  overflow: hidden;
}
.ad-slot--top { min-height: 100px; margin-top: .5rem; }
.ad-slot--footer { min-height: 90px; margin: 1.2rem auto 0; }
.ad-slot__label {
  position: absolute; top: .3rem; inset-inline-start: .6rem;
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); opacity: .7;
}
.ad-slot ins { display: block; width: 100%; }

/* ---------------------------------------------------------------- 联盟位 */
/* 与广告位刻意用不同视觉：实线边框 + 内容卡片，不是"空广告框"，
   也不使用主按钮样式 —— 避免被误认为下载按钮（误导性投放会被处罚）。 */
.affiliate {
  margin: 1.5rem auto;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: start;
}
.affiliate__title { margin: 0 0 .35rem; font-weight: 700; }
.affiliate__body { margin: 0 0 .85rem; color: var(--muted); }
.affiliate__cta { display: inline-block; }
.affiliate__disclosure { margin: .7rem 0 0; font-size: .78rem; line-height: 1.45; }

/* ------------------------------------------------------------------ 法务 */

.legal { max-width: 760px; }
.legal h1 { margin-bottom: .3rem; }
.legal h2 { text-align: start; font-size: 1.15rem; margin-top: 1.8rem; }
.legal p { color: var(--muted); }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; display: flex; gap: .4rem; }

/* ------------------------------------------------------------------ 底部 */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  padding: 1.5rem 0 .9rem;
}
.footer-grid { display: grid; gap: 1rem; }
@media (min-width: 700px) {
  .footer-grid { grid-template-columns: 1.3fr repeat(3, 1fr); gap: 1.5rem; }
}
.footer-grid h3 {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: .4rem;
}
/* 页脚是全站内链最密集处（平台 5 + 功能 4 + 法务 6）。
   窄屏若沿用单列，光页脚就要多占 400px+，用户会以为页面到底了。
   两列网格让链接保持可读字号，同时把页脚高度压到原来一半。 */
.footer-grid ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: .25rem .9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
/* 宽屏每列只有 ~230px，两列会把「Instagram Reels 下载器」挤成两行、
   反而更高；桌面恢复单列，靠三组并排控制高度。 */
@media (min-width: 700px) {
  .footer-grid ul { grid-template-columns: 1fr; }
}
.footer-grid ul a { color: var(--text); font-size: .85rem; line-height: 1.5; display: block; }
.footer-grid ul a:hover { color: var(--brand); text-decoration: none; }
.footer-bottom {
  margin-top: 1rem; padding-top: .8rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: space-between;
}
.footer-bottom p { margin: 0; }

/* ------------------------------------------------------------------ 同意条 */

.consent {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgb(0 0 0 / 30%);
  padding: .9rem 1rem;
  display: flex; flex-wrap: wrap; gap: .8rem 1.2rem;
  align-items: center; justify-content: space-between;
}
.consent[hidden] { display: none; }
.consent__body { max-width: 60ch; font-size: .9rem; }
.consent__body p { margin: .2rem 0 0; color: var(--muted); }
.consent__actions { display: flex; gap: .5rem; }

/* ------------------------------------------------------------------ RTL */

[dir="rtl"] .faq summary { flex-direction: row-reverse; }
[dir="rtl"] .breadcrumb { flex-direction: row-reverse; }

/* ------------------------------------------------------------------ 无障碍 */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* 法务页的"未本地化"提示：必须醒目但不能像错误 */
.notice--legal {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
}
.notice--legal p { margin: .4rem 0 0; }
.notice--legal a { font-weight: 600; }