/* =========================================================
   pan.29o.cn 美化覆盖层 (V6.0 Nuxt UI 之上)
   设计语言: #4285f4 蓝色主题(与 5.x 美化版一致)
   实现方式: 重定义 --ui-* CSS 变量 + 少量组件微调
   作者原版文件零改动, 升级只需保留此文件
   ========================================================= */

/* --- 1. 品牌色: indigo → Google Blue 4285f4 色阶 --- */
html {
  /* 亮色 primary 色阶(参考 Tailwind blue, 微调至品牌蓝) */
  --ui-color-primary-50:  #eff6ff;
  --ui-color-primary-100: #dbeafe;
  --ui-color-primary-200: #bfdbfe;
  --ui-color-primary-300: #93c5fd;
  --ui-color-primary-400: #60a5fa;
  --ui-color-primary-500: #3b82f6;   /* 主要交互色: 用天蓝而非深靛 */
  --ui-color-primary-600: #2b6fd8;   /* hover 深一档 */
  --ui-color-primary-700: #1d5fc2;
  --ui-color-primary-800: #1e40af;
  --ui-color-primary-900: #1e3a8a;
  --ui-color-primary-950: #172554;
  /* Nuxt UI 主引用 */
  --ui-primary: var(--ui-color-primary-500);
}
html.dark {
  /* 暗色 primary: 提亮保证深底对比 */
  --ui-color-primary-DEFAULT: var(--ui-color-primary-400);
  --ui-primary: var(--ui-color-primary-400);
}

/* --- 2. 品牌注入: 强调色/焦点环 --- */
html {
  --ui-default-focus: var(--ui-color-primary-500);
}
html.dark {
  --ui-default-focus: var(--ui-color-primary-400);
}

/* --- 3. 圆角语言: Nuxt UI default=rounded-md, 统一 12px 大圆角(卡片感) --- */
html {
  --ui-radius: 0.75rem;                       /* 12px 组件圆角 */
}

/* --- 4. 卡片与阴影: 柔和双层阴影(与 5.x 美化一致的轻盈感) --- */
html {
  --ui-shadow: 0 1px 2px rgba(31,45,61,.04), 0 8px 24px rgba(31,45,61,.06);
}
html.dark {
  --ui-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

/* --- 5. 表面底色微调: 略带蓝灰, 与 5.x 版 f5f7fa 一致 --- */
html {
  --ui-bg-muted: #f7f9fc;
}
html.dark {
  --ui-bg-muted: #1a222c;
}

/* --- 6. 组件级微调(轻手, 只改视觉不动布局) --- */

/* 主内容卡片: 圆角统一加大 */
main .rounded-lg { border-radius: 0.875rem; }

/* 按钮: 主色按钮 hover 微深, 过渡平滑 */
button { transition: background-color .18s ease, color .18s ease, border-color .18s ease, opacity .18s ease; }

/* 链接: 品牌蓝(只针对普通文本链接, 不碰按钮——solid按钮的文字必须保持白色) */
a:not([class]):not([href^="#"]) { color: var(--ui-primary); }

/* 滚动条: 细窄现代风(webkit) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120,135,155,.35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,135,155,.55); }
::-webkit-scrollbar-track { background: transparent; }
html.dark ::-webkit-scrollbar-thumb { background: rgba(150,165,185,.25); }

/* 文本选中: 蓝色选区 */
::selection { background: rgba(59,130,246,.25); }
html.dark ::selection { background: rgba(96,165,250,.35); }

/* --- 7. 页脚运行时长(与 5.x 版一致的站点传统) --- */
/* V6 SPA 页脚为作者组件, 运行统计如需补充可后续在此追加 */

/* =========================================================
   页脚重塑 V4: 紧凑单行设计
   一行搞定: 左版权 | 中运行时长 | 右友链, 高度最小化
   ========================================================= */
footer {
  background: #1d2b3a !important;
  border-top: 0 !important;
  padding: 14px 0 !important;
  color: #8ba0b5;
  margin-top: 40px;
}
footer .hm-foot-grid {
  max-width: var(--ui-container, 80rem);
  margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 24px; flex-wrap: wrap;
}
/* 左: 站名+版权(合并为单行小字) */
.hm-foot-brand-block { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.hm-foot-brand {
  font-size: 13px; font-weight: 700; color: #e6eef7;
  white-space: nowrap;
}
.hm-foot-copy { font-size: 12px; color: #7e93a8; margin: 0; line-height: 1.5; white-space: nowrap; }
.hm-foot-copy a { color: #a8c0d8 !important; }
.hm-foot-copy a:hover { color: #fff !important; text-decoration: none; }
/* 中: 运行时长(纯文字数字, 极简) */
.hm-foot-run { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.hm-run-label { font-size: 12px; color: #7e93a8; margin-right: 4px; }
.hm-runtime { display: inline-flex; align-items: baseline; }
.hm-runtime b {
  font-size: 12.5px; font-weight: 600; color: #c9d7e5;
  font-variant-numeric: tabular-nums;
}
.hm-runtime i { font-style: normal; font-size: 11px; color: #64809a; margin-right: 3px; }
/* 右: 友链(纯文字链接, 无胶囊底) */
.hm-foot-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.hm-foot-links a {
  font-size: 12px; color: #8ba0b5 !important;
  text-decoration: none; white-space: nowrap;
  transition: color .15s;
}
.hm-foot-links a:hover { color: #fff !important; }
/* 暗色模式 */
html.dark footer { background: #131a23 !important; }

/* ===== 移动端: 三段自然换行堆叠, 保持紧凑 ===== */
@media (max-width: 767px) {
  footer { padding: 12px 0 !important; margin-top: 24px; }
  footer .hm-foot-grid {
    flex-direction: column; align-items: center;
    gap: 8px 0;
  }
  .hm-foot-brand-block { flex-direction: column; align-items: center; gap: 2px; }
  .hm-foot-copy { white-space: normal; text-align: center; }
  .hm-runtime { justify-content: center; }
}

/* ===== 修正: 文件详情页下载按钮可见性兜底 =====
   UButton(soft variant) 依赖 color-mix 渲染底色, 个别环境变量解析异常时整钮隐形;
   用显式规则保证: 蓝色淡底 + 蓝字 + 图标尺寸, 无论上游变量是否生效都可见 */
a[class*="soft"], button[class*="soft"] {
  color: var(--ui-color-primary-600, #2b6fd8) !important;
  background-color: rgba(59,130,246,.12) !important;
  border-radius: 0.5rem;
}
a[class*="soft"]:hover, button[class*="soft"]:hover {
  background-color: rgba(59,130,246,.2) !important;
}
html.dark a[class*="soft"], html.dark button[class*="soft"] {
  color: var(--ui-color-primary-300, #93c5fd) !important;
  background-color: rgba(96,165,250,.15) !important;
}

/* ===== 顶部文字广告位(导航栏下方, 3排x8个, 多色高亮) ===== */
/* 宽度对齐: .hm-ad-bar 元素在 JS 中复用 UContainer 同款类
   (w-full max-w-(--ui-container) mx-auto px-4 sm:px-6 lg:px-8),
   与导航栏内容/文件列表卡片左右边界像素级一致, 此处只管网格内部 */
.hm-ad-bar {
  margin-top: 10px;
}
.hm-ad-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px 6px;
}
.hm-ad-item {
  display: flex; align-items: center; justify-content: center;
  gap: 4px;
  padding: 7px 4px;
  border-radius: 8px;
  font-size: 12px; font-weight: 600; line-height: 1.3;
  text-align: center; text-decoration: none !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid transparent;
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.hm-ad-item:hover { transform: translateY(-2px); filter: brightness(.96); text-decoration: none; }
.hm-ad-tag {
  flex-shrink: 0;
  padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,.75);
  color: inherit !important;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
/* 六色循环高亮 */
.hm-ad-c0 { background: #fff1f0; border-color: rgba(245,63,63,.35); color: #cf1322; }
.hm-ad-c1 { background: #fff7e6; border-color: rgba(250,140,22,.4); color: #ad5b00; }
.hm-ad-c2 { background: #f0fdf4; border-color: rgba(34,197,94,.4); color: #15803d; }
.hm-ad-c3 { background: #ecfeff; border-color: rgba(14,165,233,.4); color: #0e7490; }
.hm-ad-c4 { background: #eff6ff; border-color: rgba(59,130,246,.4); color: #1d5fc2; }
.hm-ad-c5 { background: #f5f3ff; border-color: rgba(139,92,246,.4); color: #6d28d9; }
/* 暗色模式 */
html.dark .hm-ad-item { background: rgba(255,255,255,.06); }
html.dark .hm-ad-c0 { background: rgba(245,63,63,.14); border-color: rgba(245,63,63,.4); color: #ff7875; }
html.dark .hm-ad-c1 { background: rgba(250,140,22,.14); border-color: rgba(250,140,22,.4); color: #ffc069; }
html.dark .hm-ad-c2 { background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.4); color: #69db7c; }
html.dark .hm-ad-c3 { background: rgba(14,165,233,.14); border-color: rgba(14,165,233,.4); color: #5cdbf3; }
html.dark .hm-ad-c4 { background: rgba(59,130,246,.14); border-color: rgba(96,165,250,.4); color: #93c5fd; }
html.dark .hm-ad-c5 { background: rgba(139,92,246,.14); border-color: rgba(139,92,246,.4); color: #c4b5fd; }
html.dark .hm-ad-tag { background: rgba(255,255,255,.18); }
/* 多端自适应: 平板 4 列(6排), 手机 4 列(6排, 紧凑) */
@media (max-width: 1023px) {
  .hm-ad-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hm-ad-item { font-size: 11.5px; }
}
@media (max-width: 767px) {
  .hm-ad-bar { margin-top: 8px; }
  .hm-ad-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px 4px; }
  .hm-ad-item { padding: 6px 2px; font-size: 11px; gap: 3px; border-radius: 6px; }
  .hm-ad-tag { padding: 0 3px; font-size: 9px; }
}

/* ===== 左右悬浮竖向广告(仿 itdog.cn, 固定视口两侧) ===== */
.hm-side-ad-wrap { position: relative; z-index: 40; pointer-events: none; }
.hm-side-ad {
  position: fixed; top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
  display: block;
  z-index: 40;
  transition: opacity .18s;
}
.hm-side-ad:hover { opacity: .92; }
.hm-side-ad-left { left: calc((100vw - var(--ui-container, 80rem)) / 2 - 130px); }
.hm-side-ad-right { right: calc((100vw - var(--ui-container, 80rem)) / 2 - 130px); }
.hm-side-ad img {
  display: block;
  width: 120px; height: auto;
  max-height: 60vh;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(31,45,61,.15);
}
html.dark .hm-side-ad img { box-shadow: 0 2px 12px rgba(0,0,0,.45); }
/* 关闭按钮: 悬停广告时显示 */
.hm-side-ad-close {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; line-height: 16px;
  text-align: center;
  border-radius: 50%;
  background: rgba(31,45,61,.55);
  color: #fff;
  font-size: 14px; font-weight: 700;
  opacity: 0;
  cursor: pointer;
  transition: opacity .15s;
  user-select: none;
}
.hm-side-ad:hover .hm-side-ad-close { opacity: 1; }

/* ===== 移动端贴边迷你模式 =====
   窄屏下侧边广告不再浮在内容两侧(空间不够), 改为缩成 44px 宽的迷你竖条
   紧贴屏幕左右边缘、垂直居中, 不遮挡正文; 图片等比裁切, 悬停(长按)显示关闭 */
@media (max-width: 1279px) {
  .hm-side-ad { top: 50%; bottom: auto; transform: translateY(-50%); }
  .hm-side-ad-left { left: 0; border-radius: 0 8px 8px 0; }
  .hm-side-ad-right { right: 0; border-radius: 8px 0 0 8px; }
  .hm-side-ad img {
    width: 44px; max-height: 190px;
    border-radius: 0;
    opacity: .92;
  }
  .hm-side-ad-left img  { border-radius: 0 8px 8px 0; }
  .hm-side-ad-right img { border-radius: 8px 0 0 8px; }
  /* 迷你模式下关闭按钮常显(移动端没有 hover), 尺寸放大便于点按 */
  .hm-side-ad-close {
    opacity: 1;
    width: 22px; height: 22px; line-height: 20px;
    top: 2px; font-size: 15px;
  }
  .hm-side-ad-left .hm-side-ad-close  { right: 2px; }
  .hm-side-ad-right .hm-side-ad-close { left: 2px; right: auto; }
}

/* ===== 修正: solid 主按钮(下载文件/请先登录/开始上传)蓝底白字 =====
   之前的全局 a{color} 把白字染蓝导致按钮一片蓝; 现已删除全局规则,
   Nuxt UI solid 按钮自带 bg-primary + 白字, 无需干预; 此处仅兜底 text-inverted */
[class*="text-inverted"] { color: #fff; }

/* ===== 顶部导航栏"赞助我们"链接 ===== */
header .hm-nav-sponsor { list-style: none; display: flex; align-items: center; }
header .hm-nav-sponsor-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 8px;
  color: var(--ui-text-muted, #64748b) !important;
  font-size: 13.5px; font-weight: 500; text-decoration: none;
  transition: color .18s, background-color .18s;
  white-space: nowrap;
}
header .hm-nav-sponsor-icon { flex-shrink: 0; width: 15px; height: 15px; }
header .hm-nav-sponsor-link:hover {
  color: var(--ui-text-highlighted, #1e293b) !important;
  background: var(--ui-bg-elevated, #f1f5f9);
}
/* "广告投放"按钮: 高亮胶囊样式, 与"赞助我们"区分 */
header .hm-nav-ads-link {
  background: linear-gradient(90deg, #3b82f6, #8b5cf6) !important;
  color: #fff !important;
  border-radius: 20px;
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(59,130,246,.3);
}
header .hm-nav-ads-link:hover {
  color: #fff !important;
  filter: brightness(1.08);
  background: linear-gradient(90deg, #3b82f6, #8b5cf6) !important;
}
header .hm-nav-ads-icon { flex-shrink: 0; width: 15px; height: 15px; }
/* 移动端: 抽屉内的克隆项为垂直列表项, 撑满整行 */
@media (max-width: 1023px) {
  header .hm-nav-sponsor-link { padding: 4px 10px; font-size: 12.5px; }
  /* 抽屉内"广告投放"保持胶囊样式 */
  ul[data-slot="list"] .hm-nav-ads-link {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6) !important;
    color: #fff !important;
    width: auto;
    justify-content: center;
  }
  ul[data-slot="list"] .hm-nav-ads-link:hover {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6) !important;
  }
  /* 抽屉内的克隆项: 完全复刻 Nuxt UI vertical 菜单原有项的布局
     (li 无额外 padding; a 用 px-2.5 py-1.5 rounded-md text-sm 同款参数) */
  ul[data-slot="list"] .hm-nav-sponsor {
    display: block; padding: 8px 0;
  }
  ul[data-slot="list"] .hm-nav-sponsor-link {
    display: flex; flex-direction: row; align-items: center; gap: 6px;
    padding: 6px 10px; font-size: 14px; font-weight: 400;
    width: 100%; white-space: nowrap;
    border-radius: calc(var(--ui-radius, 0.25rem) * 1.5);
    background: none; box-shadow: none;
  }
  ul[data-slot="list"] .hm-nav-sponsor-link:hover {
    background: var(--ui-bg-elevated, #f1f5f9);
    color: var(--ui-text-highlighted, #1e293b) !important;
  }
  ul[data-slot="list"] .hm-nav-sponsor span { white-space: nowrap; }
}
