/* ==========================================================================
   dy.qunganji.com 全局自适应增强样式（本地文件，不依赖任何远程资源）
   作用：补齐 Tailwind 工具类无法覆盖的响应式细节
   原则：只做增强，不改动 Tailwind 已生成的样式，可安全删除回退
   ========================================================================== */

/* ---------- 1. 基础：盒模型与媒体元素 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;          /* 防止个别元素导致整页横向滚动 */
    -webkit-tap-highlight-color: transparent;
}

img, video, iframe, canvas, svg, embed, object {
    max-width: 100%;
    height: auto;
}

/* 视频类按比例自适应，避免高度塌陷 */
iframe[src*="youtube"], iframe[src*="player"], video {
    aspect-ratio: 16 / 9;
    width: 100%;
}

/* ---------- 2. 文字与长内容断行 ---------- */
p, li, td, th, dd, dt, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

a, span, strong, em { overflow-wrap: break-word; }

pre, code, kbd, samp {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-word;
}

/* 用户输入的抖音/快手分享链接往往很长，必须能断行 */
.break-anywhere { word-break: break-all; overflow-wrap: anywhere; }

/* ---------- 3. 表格：窄屏横向滚动而不是挤压变形 ---------- */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table { min-width: 640px; }

/* 正文内嵌表格统一处理（不破坏后台已有的滚动容器） */
.article-content table,
.prose table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
}

/* ---------- 4. 容器与安全区 ---------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

/* 刘海屏 / 底部手势条 */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    .safe-bottom { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .safe-top    { padding-top: max(0px, env(safe-area-inset-top)); }
}

/* ---------- 5. 触控友好：可点击元素最小热区 ---------- */
@media (hover: none) and (pointer: coarse) {
    button,
    [role="button"],
    a.btn-hover,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
    }
    /* 触屏上取消 hover 位移，避免点按后元素"卡住" */
    .btn-hover:hover { transform: none; }
    .hover\:scale-\[1\.02\]:hover { transform: none; }
}

/* ---------- 6. 断点微调 ---------- */
/* 大屏：容器略放宽，避免内容过窄 */
@media (min-width: 1400px) {
    .container { max-width: 1280px; }
}

/* 平板 */
@media (max-width: 1024px) {
    .container { padding-left: 16px; padding-right: 16px; }
}

/* 手机横屏 / 大屏手机 */
@media (max-width: 768px) {
    .container { padding-left: 14px; padding-right: 14px; }

    /* 标题层级整体下调一档，避免小屏标题过大换行 */
    h1 { font-size: 1.5rem; line-height: 1.35; }
    h2 { font-size: 1.25rem; line-height: 1.4; }

    /* 固定高度区域在窄屏自动放宽 */
    .max-h-\[90vh\] { max-height: 85vh; }
}

/* 主流手机（375~430px） */
@media (max-width: 640px) {
    body { font-size: 15px; }

    .container { padding-left: 12px; padding-right: 12px; }

    h1 { font-size: 1.375rem; }
    h2 { font-size: 1.125rem; }
    h3 { font-size: 1rem; }

    /* iOS 聚焦输入框会放大页面：字号必须 >= 16px */
    input[type="text"],
    input[type="url"],
    input[type="search"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px;
    }

    /* 表单按钮在窄屏占满整行，便于单手操作 */
    form .btn-block-mobile,
    form button[type="submit"] { width: 100%; }

    /* 卡片阴影在小屏收敛，提升信息密度 */
    .card-shadow { box-shadow: 0 4px 10px -2px rgba(0, 0, 0, .08); }

    /* 模态框在小屏贴边显示 */
    .modal-backdrop { padding: 12px; }

    /* 表格卡片化：仅对标记了 .table-stack 的表格生效 */
    .table-stack thead { display: none; }
    .table-stack tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 8px 4px;
    }
    .table-stack td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        border: none;
        padding: 6px 10px;
        text-align: right;
    }
    .table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        text-align: left;
        flex-shrink: 0;
    }
}

/* 超小屏（iPhone SE 320~360px） */
@media (max-width: 380px) {
    .container { padding-left: 10px; padding-right: 10px; }
    body { font-size: 14px; }
    h1 { font-size: 1.25rem; }
    .text-4xl { font-size: 1.75rem; }
    .text-5xl { font-size: 2rem; }
}

/* ---------- 7. 横屏矮屏（如手机横放） ---------- */
@media (max-height: 500px) and (orientation: landscape) {
    .sticky { position: static; }
    .min-h-screen { min-height: auto; }
}

/* ---------- 8. 打印 ---------- */
@media print {
    nav, footer, .no-print, button { display: none !important; }
    body { background: #fff; color: #000; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 12px; }
}

/* ---------- 9. 动效减弱偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   第二部分：视觉设计系统（2026-11 改版）
   作用域：body.bg-gray-50 = 前台页面；后台(body.bg-gray-100 / bg-slate-900)不受影响
   原则：零 HTML / 文案改动，纯表现层，不影响 SEO（标题、正文、链接、语义全部保留）
   ========================================================================== */

:root {
    --brand:        #3B82F6;
    --brand-deep:   #2563EB;
    --brand-dark:   #1D4ED8;
    --accent:       #10B981;
    --ink:          #0F172A;
    --ink-2:        #334155;
    --ink-3:        #64748B;
    --line:         #E2E8F0;
    --radius-lg:    16px;
    --radius-md:    12px;
    --shadow-card:  0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -16px rgba(15, 23, 42, .14);
    --shadow-card-hover: 0 2px 4px rgba(15, 23, 42, .05), 0 20px 44px -18px rgba(37, 99, 235, .25);
    --shadow-btn:   0 10px 24px -10px rgba(37, 99, 235, .65);
    --font-ui: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

body.bg-gray-50 {
    font-family: var(--font-ui);
    background-color: #F6F8FB;
    background-image:
        radial-gradient(1100px 520px at 88% -8%, rgba(59, 130, 246, .10), transparent 62%),
        radial-gradient(820px 460px at -8% 6%, rgba(16, 185, 129, .08), transparent 58%);
    background-repeat: no-repeat;
}

/* ---------- 顶部导航：玻璃拟态 ---------- */
body.bg-gray-50 nav.sticky {
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, .8);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02), 0 8px 24px -20px rgba(15, 23, 42, .25);
}
body.bg-gray-50 nav.sticky .text-primary.font-bold {
    background: linear-gradient(120deg, var(--brand-deep), var(--brand) 55%, #60A5FA);
    -webkit-background-clip: text;
    background-clip: text;
}
body.bg-gray-50 nav.sticky a[class*="border-b-2"] {
    border-radius: 8px 8px 0 0;
}

/* ---------- 页头主标题（覆盖所有前台页面：含 main 包裹页与静态页） ---------- */
body.bg-gray-50 main > header p,
body.bg-gray-50 .container > header p {
    max-width: 46rem;
    margin-left: auto;
    margin-right: auto;
    color: var(--ink-3);
    font-size: 1.02rem;
    line-height: 1.8;
}
body.bg-gray-50 main > header h1,
body.bg-gray-50 .container > header h1 {
    letter-spacing: -.02em;
    line-height: 1.25;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    body.bg-gray-50 main > header h1,
    body.bg-gray-50 .container > header h1 {
        color: var(--ink); /* 回退色 */
        background: linear-gradient(115deg, var(--ink) 30%, var(--brand-deep) 68%, var(--brand));
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* ---------- 卡片体系 ---------- */
body.bg-gray-50 .card-shadow {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(226, 232, 240, .75);
    box-shadow: var(--shadow-card);
}
body.bg-gray-50 main > section.card-shadow {
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
body.bg-gray-50 main > section.card-shadow:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, .35);
    box-shadow: var(--shadow-card-hover);
}

/* 卡片内小节标题：图标做成渐变圆角块 */
body.bg-gray-50 main h2,
body.bg-gray-50 .container h2 {
    letter-spacing: -.01em;
}
body.bg-gray-50 main h2 > .fa,
body.bg-gray-50 .container h2 > .fa,
body.bg-gray-50 main h3 > .fa,
body.bg-gray-50 .container h3 > .fa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(59, 130, 246, .14), rgba(37, 99, 235, .22));
    color: var(--brand-deep);
    font-size: .95rem;
    flex-shrink: 0;
}

/* ---------- 平台清单 → 徽章网格 ---------- */
body.bg-gray-50 main .grid.grid-cols-1[class*="sm:grid-cols-3"] > div {
    background: #F8FAFC;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    color: var(--ink-2);
    transition: border-color .2s ease, background .2s ease;
}
body.bg-gray-50 main .grid.grid-cols-1[class*="sm:grid-cols-3"] > div:hover {
    border-color: rgba(59, 130, 246, .45);
    background: #fff;
}

/* ---------- 使用步骤 → 渐变时间线 ---------- */
body.bg-gray-50 .space-y-3 > .flex:has(> span.rounded-full) {
    position: relative;
    align-items: flex-start;
}
body.bg-gray-50 .space-y-3 > .flex:has(> span.rounded-full) p {
    color: var(--ink-2);
    line-height: 1.75;
}
body.bg-gray-50 span.bg-primary.rounded-full {
    background: linear-gradient(135deg, var(--brand), var(--brand-deep)) !important;
    box-shadow: 0 4px 10px -3px rgba(37, 99, 235, .55);
    width: 1.65rem !important;
    height: 1.65rem !important;
    font-size: .8rem;
    font-weight: 700;
}

/* ---------- 解析输入区 ---------- */
body.bg-gray-50 #urlInput {
    border-radius: var(--radius-md);
    border: 1.5px solid var(--line);
    background: #F8FAFC;
    padding: .9rem 1.1rem;
    color: var(--ink);
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
body.bg-gray-50 #urlInput::placeholder { color: #94A3B8; }
body.bg-gray-50 #urlInput:focus {
    background: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .14);
}
body.bg-gray-50 #fetchBtn {
    border-radius: var(--radius-md);
    background-image: linear-gradient(135deg, var(--brand), var(--brand-deep));
    box-shadow: var(--shadow-btn);
    letter-spacing: .02em;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
body.bg-gray-50 #fetchBtn:hover:not([disabled]) {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -10px rgba(37, 99, 235, .7);
    filter: saturate(1.08);
}
body.bg-gray-50 #fetchBtn:active:not([disabled]) { transform: translateY(0); }
body.bg-gray-50 #fetchBtn.cursor-not-allowed {
    background-image: none;
    background-color: rgba(59, 130, 246, .45);
    box-shadow: none;
}

/* ---------- 结果视频卡片 ---------- */
body.bg-gray-50 #videoInfo { border-radius: var(--radius-lg); }
body.bg-gray-50 #videoInfo .aspect-video { background: #0F172A; }

/* ---------- FAQ 手风琴 ---------- */
body.bg-gray-50 main details {
    border-radius: var(--radius-md);
    border-color: var(--line);
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
body.bg-gray-50 main details:hover {
    border-color: rgba(59, 130, 246, .45);
    box-shadow: 0 6px 18px -12px rgba(15, 23, 42, .25);
}
body.bg-gray-50 main details[open] {
    border-color: rgba(59, 130, 246, .55);
    background: linear-gradient(180deg, rgba(239, 246, 255, .55), #fff 45%);
    box-shadow: 0 8px 22px -14px rgba(37, 99, 235, .35);
}
body.bg-gray-50 main details summary .fa-angle-right {
    transition: transform .2s ease;
}
body.bg-gray-50 main details[open] summary .fa-angle-right {
    transform: rotate(90deg);
}

/* ---------- 友情链接 → 低饱和链接组 ---------- */
body.bg-gray-50 main section a.btn-hover.px-3 {
    background: #F8FAFC;
    border: 1px solid var(--line);
    color: var(--ink-3) !important;
    border-radius: 8px;
    font-size: .86rem;
    transition: all .2s ease;
}
body.bg-gray-50 main section a.btn-hover.px-3:hover {
    color: var(--brand-deep) !important;
    border-color: rgba(59, 130, 246, .5);
    background: #EFF6FF;
    transform: translateY(-1px);
}

/* ---------- 错误/加载状态 ---------- */
body.bg-gray-50 #error { border-radius: var(--radius-md); }

/* ---------- 页脚 ---------- */
body.bg-gray-50 footer.bg-slate-900 {
    background: linear-gradient(180deg, #0F172A, #0B1220);
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--brand), var(--accent)) 1;
    margin-top: 4rem;
}
body.bg-gray-50 footer.bg-slate-900 a { transition: color .2s ease, transform .2s ease; }
body.bg-gray-50 footer.bg-slate-900 a:hover { color: #93C5FD !important; }

/* ---------- 可访问性：键盘焦点可见 ---------- */
body.bg-gray-50 a:focus-visible,
body.bg-gray-50 button:focus-visible,
body.bg-gray-50 input:focus-visible,
body.bg-gray-50 summary:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------- 移动端微调 ---------- */
@media (max-width: 640px) {
    body.bg-gray-50 main > header h1 { letter-spacing: -.015em; }
    body.bg-gray-50 .card-shadow { border-radius: 14px; }
    body.bg-gray-50 #fetchBtn { font-size: 1.02rem; padding-top: .9rem; padding-bottom: .9rem; }
    body.bg-gray-50 footer.bg-slate-900 { margin-top: 2.5rem; }
}

/* 尊重减弱动效偏好（沿用全局规则，此处仅补充悬停位移） */
@media (prefers-reduced-motion: reduce) {
    body.bg-gray-50 main > section.card-shadow:hover,
    body.bg-gray-50 #fetchBtn:hover:not([disabled]),
    body.bg-gray-50 main section a.btn-hover.px-3:hover { transform: none; }
}

/* ==========================================================================
   第三部分：全站页面统一覆盖（list/userlist/seo 等页面与所有内容页）
   作用：这些页面使用 .bg-white.rounded-xl.shadow-md 卡片与通用表单/按钮结构，
        之前仅首页的设计令牌未覆盖到，这里统一接入同一套视觉体系
   原则：仍然零 HTML 改动、纯表现层，不影响 SEO
   ========================================================================== */

/* ---------- 通用卡片（内容页 / 结果视频卡 / 工具说明卡） ---------- */
body.bg-gray-50 .bg-white.rounded-xl.shadow-md {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(226, 232, 240, .75);
    box-shadow: var(--shadow-card);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
body.bg-gray-50 .bg-white.rounded-xl.shadow-md:hover {
    border-color: rgba(59, 130, 246, .35);
    box-shadow: var(--shadow-card-hover);
}
/* 结果视频卡内的封面容器，与卡片圆角贴合 */
body.bg-gray-50 .bg-white.rounded-xl.shadow-md .relative { overflow: hidden; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

/* ---------- 通用输入框 / 文本域（对齐首页 #urlInput 质感） ---------- */
body.bg-gray-50 input.w-full,
body.bg-gray-50 textarea.w-full {
    border-radius: var(--radius-md);
    border: 1.5px solid var(--line);
    background: #F8FAFC;
    color: var(--ink);
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
body.bg-gray-50 input.w-full::placeholder,
body.bg-gray-50 textarea.w-full::placeholder { color: #94A3B8; }
body.bg-gray-50 input.w-full:focus,
body.bg-gray-50 textarea.w-full:focus {
    background: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .14);
    outline: none;
}

/* ---------- 通用主按钮（渐变 + 投影，覆盖各页 bg-blue-600 按钮） ---------- */
body.bg-gray-50 button.bg-blue-600,
body.bg-gray-50 a.bg-blue-600,
body.bg-gray-50 button.bg-primary.btn-hover,
body.bg-gray-50 a.bg-primary.btn-hover {
    border-radius: var(--radius-md);
    background-image: linear-gradient(135deg, var(--brand), var(--brand-deep));
    box-shadow: var(--shadow-btn);
    letter-spacing: .02em;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
body.bg-gray-50 button.bg-blue-600:hover,
body.bg-gray-50 a.bg-blue-600:hover,
body.bg-gray-50 button.bg-primary.btn-hover:hover,
body.bg-gray-50 a.bg-primary.btn-hover:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -10px rgba(37, 99, 235, .7);
    filter: saturate(1.08);
}
body.bg-gray-50 button.bg-blue-600:active { transform: translateY(0); }
body.bg-gray-50 button.bg-blue-600[disabled] {
    background-image: none;
    background-color: rgba(59, 130, 246, .45);
    box-shadow: none;
    cursor: not-allowed;
}
/* 次级蓝色文字链接（查看视频 / 下载视频等） */
body.bg-gray-50 .text-blue-600 { transition: color .2s ease; }

/* ---------- 结果计数徽章 ---------- */
body.bg-gray-50 #resultCount {
    border-radius: 999px;
    font-weight: 600;
}

/* ---------- 错误提示框 ---------- */
body.bg-gray-50 #errorMsg { border-radius: var(--radius-md); }

/* ---------- 静态页简易页脚（©快手批量工具 / 网站地图） ---------- */
body.bg-gray-50 footer.text-center {
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}
body.bg-gray-50 footer.text-center a {
    display: inline-block;
    margin-top: .5rem;
    color: var(--ink-3);
    transition: color .2s ease;
}
body.bg-gray-50 footer.text-center a:hover { color: var(--brand-deep); }

/* ---------- 全站移动端收尾 ---------- */
@media (max-width: 640px) {
    body.bg-gray-50 .bg-white.rounded-xl.shadow-md { border-radius: 14px; }
    body.bg-gray-50 footer.text-center { margin-top: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    body.bg-gray-50 .bg-white.rounded-xl.shadow-md:hover,
    body.bg-gray-50 button.bg-blue-600:hover,
    body.bg-gray-50 a.bg-blue-600:hover { transform: none; }
}
