@charset "UTF-8";
/* 设计变量 */
:root {
  /* 本站为固定浅色主题：声明后，Android Chrome / 微信内置浏览器的
     「强制深色」(Force Dark) 不会再自动反转配色，避免手机上出现半黑半白 */
  color-scheme: light;
  --c-bg:        #f2f8fb;
  --c-bg-2:      #e9f3f8;
  --c-card:      #ffffff;
  --c-line:      #dceaf2;
  --c-line-soft: #eef6fa;
  --c-text:      #17242e;
  --c-text-2:    #435263;
  --c-sub:       #748290;
  --c-primary:   #12a594;
  --c-primary-2: #2e9ec9;
  --c-brand-grad: linear-gradient(135deg, #19b89a 0%, #14a99c 55%, #2e9ec9 100%);
  --c-warm:      #0f766e;
  --c-radius:    16px;
  --c-radius-sm: 10px;
  --c-shadow:    0 1px 2px rgba(20, 62, 92, .05), 0 8px 24px rgba(20, 62, 92, .07);
  --c-shadow-hov:0 4px 10px rgba(20, 62, 92, .09), 0 16px 36px rgba(20, 62, 92, .11);
  --wrap:        1200px;
}

/* ---------------- 基础重置 ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color: var(--c-text);
  background: linear-gradient(180deg, #f7fcfe 0%, var(--c-bg) 220px, var(--c-bg-2) 100%);
  /* fixed 背景在 iOS / Android 上会拖慢滚动，只有真正支持 hover 的设备才启用 */
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;            /* 新版浏览器：避开移动端地址栏高度抖动 */
  /* 点按时不要出现灰色高亮块；同时去掉 300ms 点击延迟 */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-x: hidden;
}
a { color: var(--c-text-2); text-decoration: none; transition: color .18s, background-color .18s; }
a:hover { color: var(--c-primary); }
/* height:auto 让正文配图按原始比例缩放；图标类规则有明确 width+height，不会被覆盖 */
img { border: 0; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.4; overflow-wrap: break-word; }
ul, ol { margin: 0; padding: 0; list-style: none; }
input, button, select, textarea { font-family: inherit; font-size: inherit; }
code { background: #f8efe7; padding: 1px 5px; border-radius: 4px; font-size: 13px; color: #b02a37; }

.container {
  width: 100%; max-width: var(--wrap); margin: 0 auto;
  padding: 0 16px;                                       /* 兜底：不支持 max()/env() 的老内核 */
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.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;
}

/* =============================================================
   1. 顶部工具栏
   ============================================================= */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(12px);   /* iOS Safari ≤ 15 必须带前缀 */
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-line);
  /* 刘海屏 / 灵动岛：加入「添加到主屏幕」全屏运行时，避免内容钻进状态栏 */
  padding-top: env(safe-area-inset-top);
}
.topbar-inner { display: flex; align-items: center; gap: 14px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
/* 站标：品牌图片 log.jpeg（零外部请求，本地资源；带 ?v=filemtime 自动版本号） */
.brand-icon {
  width: 33px; height: 33px; flex: 0 0 auto; display: block;
  border-radius: 9px; object-fit: contain;
}
.brand-name { font-size: 17px; font-weight: 700; color: var(--c-text); white-space: nowrap; }

.topnav { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; overflow: hidden; }
.topnav a {
  padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--c-text-2); white-space: nowrap;
}
.topnav a:hover { background: var(--c-line-soft); color: var(--c-primary); }
.topnav a.is-active { background: #fdeadb; color: var(--c-primary); font-weight: 600; }

.topbar-search { flex: 0 0 250px; display: flex; }
.topbar-search input {
  flex: 1; min-width: 0; height: 34px; padding: 0 12px; border: 1px solid var(--c-line);
  border-right: 0; border-radius: 9px 0 0 9px; background: #fffaf6; outline: none; color: var(--c-text);
}
.topbar-search input:focus { border-color: var(--c-primary); background: #fff; }
.topbar-search button {
  height: 34px; padding: 0 14px; border: 0; border-radius: 0 9px 9px 0; cursor: pointer;
  background: var(--c-brand-grad); color: #fff; font-weight: 600;
}

/* 首页搜索卡：居中大搜索 + 引擎切换，提交 /search.php 由 PHP 后端直出 */
.search-card {
  margin: 22px 0 0; padding: 26px 20px 20px; text-align: center;
  background: var(--c-card); border: 1px solid var(--c-line);
  border-radius: var(--c-radius); box-shadow: var(--c-shadow);
}
.srch-h1 {
  margin: 0 0 16px; font-size: 15px; font-weight: 600;
  color: var(--c-text-2); letter-spacing: .2px; line-height: 1.6;
}
.srch-h1 em { font-style: normal; font-weight: 700; color: var(--c-primary); }

/* 通用搜索条（首页搜索卡 / 搜索结果页共用；PHP 后端 SSR 出结果） */
.search-form { display: flex; max-width: 660px; margin: 0 auto; }
.search-form input[type=text] {
  flex: 1; min-width: 0; height: 48px; padding: 0 18px; font-size: 15px;
  border: 1px solid var(--c-line); border-right: 0; border-radius: 12px 0 0 12px;
  background: #fffaf6; outline: none; color: var(--c-text);
}
.search-form input[type=text]:focus {
  border-color: var(--c-primary); background: #fff;
  box-shadow: inset 0 0 0 3px rgba(232, 89, 12, .10);
}
.search-form button {
  height: 48px; padding: 0 30px; border: 0; border-radius: 0 12px 12px 0; cursor: pointer;
  background: var(--c-brand-grad); color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 1px;
  box-shadow: 0 6px 16px rgba(214, 51, 108, .26); transition: filter .18s;
}
.search-form button:hover { filter: brightness(1.06); }

.search-card .search-form { position: relative; max-width: 680px; }
.search-card .search-form input[type=text] { padding-left: 48px; }
.search-icon {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; pointer-events: none; z-index: 1;
}

.search-tab { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.search-tab .tab {
  padding: 5px 18px; font-size: 13px; border-radius: 999px;
  border: 1px solid var(--c-line); background: var(--c-line-soft); color: var(--c-text-2);
}
.search-tab .tab:hover { border-color: var(--c-primary); color: var(--c-primary); background: #fdeadb; }
.search-tab .tab.is-active {
  border-color: transparent; color: #fff; font-weight: 600;
  background: var(--c-brand-grad); box-shadow: 0 4px 12px rgba(232, 89, 12, .26);
}

.srch-stat { margin: 14px 0 0; font-size: 12.5px; color: var(--c-sub); }
.srch-stat b { color: var(--c-primary); font-weight: 700; }
.srch-stat a { color: var(--c-primary); }
.srch-stat a:hover { text-decoration: underline; }

/* =============================================================
   3. 分组链接网格（对应参考站的 nav-grid：一级分类 · 二级分组）
   -------------------------------------------------------------
   参考站为 2px 直角白块 + hover 深灰底；本站改为 8px 圆角 + hover 暖色渐变底，
   并把「一级分类」做成暖色胶囊，视觉上一眼可区分
   ============================================================= */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));   /* 兜底 */
  gap: 28px 22px; margin: 18px 0 0;
}
.nav-group { min-width: 0; }
.group-title {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 8px; font-size: 12.5px; min-width: 0;
}
.group-title .gt-main {
  flex: 0 0 auto; padding: 2px 9px; border-radius: 999px; font-weight: 600;
  color: var(--c-primary); background: #fdeadb;
}
.group-title .gt-sub {
  flex: 0 1 auto; color: var(--c-sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.group-title .gt-more { flex: 0 0 auto; margin-left: auto; font-size: 12px; color: var(--c-sub); }
.group-title .gt-more:hover { color: var(--c-primary); }

.group-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));   /* 兜底 */
  gap: 8px;
}
.group-links > li { min-width: 0; }
.group-links a {
  display: block; padding: 0 10px; line-height: 40px; border-radius: 8px; font-size: 13.5px;
  color: var(--c-text-2); background: var(--c-card); border: 1px solid var(--c-line);
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: all .2s;
}
.group-links a:hover {
  color: #fff; border-color: transparent; background: var(--c-brand-grad);
  box-shadow: 0 6px 14px rgba(232, 89, 12, .22); transform: translateY(-1px);
}
/* 资讯组：文章标题较长，单列左对齐展示，避免截断 */
.nav-group--news .group-links { grid-template-columns: minmax(0, 1fr); }
.nav-group--news .group-links a { text-align: left; }

/* =============================================================
   4. 通用区块（分类页 / 标签页 / 搜索页 / 文章页共用）
   ============================================================= */
.section {
  margin: 16px 0 0; padding: 18px 18px 6px; background: var(--c-card);
  border: 1px solid var(--c-line); border-radius: var(--c-radius); box-shadow: var(--c-shadow);
}
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--c-line-soft);
}
.section-title { font-size: 16px; color: var(--c-text); display: flex; align-items: center; gap: 8px; }
.section-title::before {
  content: ""; width: 18px; height: 6px; border-radius: 999px; background: var(--c-brand-grad);
}
.section-more { font-size: 13px; color: var(--c-sub); }
.section-more:hover { color: var(--c-primary); }

/* 文章条目（分类页「相关教程文章」等处的内链列表） */
.a-item { display: block; padding: 10px 0; border-bottom: 1px dashed rgba(0, 0, 0, .07); }
.a-item:last-child { border-bottom: 0; }
.a-item-title {
  display: block; margin-bottom: 3px; font-size: 13.5px; font-weight: 600;
  color: var(--c-text); line-height: 1.5;
}
.a-item:hover .a-item-title { color: var(--c-primary); }
.a-item-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 12.5px; color: var(--c-sub); line-height: 1.6;
}
.a-item-meta { margin-top: 5px; display: flex; gap: 10px; font-size: 11.5px; color: var(--c-sub); }

/* 图标（文字小图 / 自定义 logo）
   形状、配色、尺寸、居中全部由 includes/functions.php 的 icon_html() 内联输出，
   这里只保留悬停动效这类「增强」表现。
   这样做的原因：外部 CSS 一旦被浏览器缓存成旧版本（或老内核不支持 :has()），
   依赖 class 的图标会退化成「深灰字趴在彩色方块左上角」——本站真实踩过这个坑。 */
.ico-char { transition: transform .18s ease; }
.lcard:hover .ico-char { transform: translateY(-1px) scale(1.03); }

/* =============================================================
   8. 列表 / 文章卡片 / 详情
   ============================================================= */
.crumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 18px 0 0; font-size: 13px; color: var(--c-sub);
}
.crumb a { color: var(--c-sub); }
.crumb a:hover { color: var(--c-primary); }
.crumb-sep { color: #dbc7b8; }
.crumb-cur { color: var(--c-text-2); font-weight: 600; }

.page-head { margin: 16px 0 0; }
.page-head h1 { font-size: 22px; color: var(--c-text); }
.page-head .ph-desc { margin-top: 8px; font-size: 13.5px; color: var(--c-sub); line-height: 1.75; }
.page-head .ph-meta { margin-top: 8px; font-size: 12.5px; color: var(--c-sub); }

.lgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));            /* 兜底 */
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 12px; margin-top: 14px;
}
.lcard {
  display: flex; gap: 11px; padding: 13px; background: var(--c-card);
  border: 1px solid var(--c-line); border-radius: var(--c-radius-sm);
  box-shadow: 0 1px 2px rgba(88, 52, 26, .03); transition: all .18s;
}
.lcard:hover { border-color: #f4d4bb; box-shadow: var(--c-shadow-hov); transform: translateY(-2px); }
/* 图标盒子的尺寸 / 底色同样由 icon_html() 内联给出，这里只兜底对齐方式 */
.lcard-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.lcard-icon img { object-fit: contain; }
.lcard-main { min-width: 0; flex: 1; }
.lcard-name { font-size: 14px; font-weight: 600; color: var(--c-text); display: block; }
.lcard:hover .lcard-name { color: var(--c-primary); }
.lcard-desc {
  margin-top: 3px; font-size: 12.5px; color: var(--c-sub); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lcard-cat { margin-top: 6px; font-size: 11.5px; color: var(--c-primary); }

.art-item {
  display: block; padding: 16px 18px; background: var(--c-card); border: 1px solid var(--c-line);
  border-radius: var(--c-radius-sm); margin-top: 12px; box-shadow: 0 1px 2px rgba(88, 52, 26, .03);
  transition: all .18s;
}
.art-item:hover { border-color: #f4d4bb; box-shadow: var(--c-shadow-hov); }
.art-item h3 { font-size: 16px; color: var(--c-text); margin-bottom: 6px; }
.art-item:hover h3 { color: var(--c-primary); }
.art-item p { margin: 0; font-size: 13.5px; color: var(--c-sub); line-height: 1.7; }
.art-meta { margin-top: 9px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 12px; color: var(--c-sub); }
.art-cat { padding: 1px 8px; border-radius: 999px; background: #fdeadb; color: var(--c-primary-2); }

.tag {
  display: inline-block; padding: 3px 10px; margin: 0 6px 6px 0; font-size: 12px;
  border-radius: 999px; background: var(--c-line-soft); color: var(--c-text-2); border: 1px solid var(--c-line);
}
.tag:hover { background: #fdeadb; color: var(--c-primary); border-color: #f7d8bd; }
.tag-list { margin-top: 12px; }

/* 详情页 */
.detail {
  margin-top: 16px; padding: 24px; background: var(--c-card); border: 1px solid var(--c-line);
  border-radius: var(--c-radius); box-shadow: var(--c-shadow);
}
.detail h1 { font-size: 23px; line-height: 1.5; color: var(--c-text); }
.detail-meta {
  margin-top: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--c-line-soft);
  display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--c-sub);
}
.detail-body { margin-top: 18px; font-size: 15px; line-height: 1.95; color: var(--c-text-2); }
.detail-body h3 { margin: 22px 0 8px; font-size: 17px; color: var(--c-text); }
.detail-body h4 { margin: 18px 0 6px; font-size: 15px; color: var(--c-text); }
.detail-body p { margin: 10px 0; }
.detail-body ul, .detail-body ol { margin: 10px 0 10px 22px; list-style: disc; }
.detail-body ol { list-style: decimal; }
.detail-body li { margin: 5px 0; }
.detail-body strong { color: var(--c-text); }
.detail-body img { border-radius: 10px; margin: 10px 0; }
/* 正文里的宽内容（表格 / 代码块 / 长链接）在窄屏上改为块级横向滚动，不撑破页面 */
.detail-body table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-collapse: collapse; }
.detail-body pre { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 12px 14px; background: #faf6f2; border-radius: 10px; font-size: 13px; }
.detail-body a { overflow-wrap: anywhere; }

/* 磁力占位框 */
.magnet-box {
  margin-top: 18px; padding: 15px 16px; background: #fff8f2;
  border: 1px dashed #f2cdae; border-radius: var(--c-radius-sm);
}
.magnet-box .mb-title { font-size: 13px; font-weight: 700; color: var(--c-primary-2); margin-bottom: 8px; }
.magnet-box .mb-value {
  display: block; padding: 10px 12px; background: #fff; border: 1px solid var(--c-line);
  border-radius: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px;
  color: var(--c-text-2); word-break: break-all; line-height: 1.6;
}
.magnet-box .mb-tip { margin-top: 8px; font-size: 12px; color: var(--c-sub); }

/* 站点详情按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 22px; border-radius: 10px;
  background: var(--c-brand-grad); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 16px rgba(214, 51, 108, .26); border: 0; cursor: pointer;
}
.btn:hover { color: #fff; filter: brightness(1.06); }
.btn--ghost { background: #fff; color: var(--c-primary); border: 1px solid var(--c-line); box-shadow: none; }
.btn--ghost:hover { color: var(--c-primary); border-color: var(--c-primary); }

/* =============================================================
   9. 分页（PHP 直出）
   ============================================================= */
.pager {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 22px 0 6px; justify-content: center;
}
.pg-btn {
  min-width: 34px; padding: 6px 11px; text-align: center; font-size: 13px;
  border: 1px solid var(--c-line); border-radius: 8px; background: #fff; color: var(--c-text-2);
}
.pg-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pg-btn.is-active { background: var(--c-brand-grad); border-color: transparent; color: #fff; font-weight: 700; }
.pg-btn.is-disabled { color: #cbb9a9; background: #fbf7f3; cursor: not-allowed; }
.pg-gap { padding: 0 3px; color: var(--c-sub); }
.pg-info { margin-left: 8px; font-size: 12.5px; color: var(--c-sub); }

/* =============================================================
   10. 空状态 / 页脚
   ============================================================= */
.empty {
  padding: 46px 20px; text-align: center; color: var(--c-sub); font-size: 14px;
  background: var(--c-card); border: 1px dashed var(--c-line); border-radius: var(--c-radius); margin-top: 14px;
}

.footer {
  margin: 28px 0 0; padding: 26px 0 34px; border-top: 1px solid var(--c-line);
  background: rgba(255, 255, 255, .6); font-size: 12.5px; color: var(--c-sub); text-align: center;
}
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-bottom: 12px; }
.footer-links a { color: var(--c-text-2); font-size: 13px; }
.footer-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 14px; }
.footer p { margin: 5px 0; line-height: 1.8; }

/* =============================================================
   11. 后台管理
   ============================================================= */
.adm { display: flex; min-height: 100vh; min-height: 100dvh; background: #fbf6f1; }
.adm-side {
  flex: 0 0 190px; background: #2b1f16; color: #e6d5c6; padding: 18px 0;
}
.adm-side .as-brand { padding: 0 18px 16px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid #3d2c20; margin-bottom: 12px; }
.adm-side a { display: block; padding: 10px 18px; color: #c3a993; font-size: 13.5px; }
.adm-side a:hover { background: #3a2a1e; color: #fff; }
.adm-side a.is-active { background: #c2410c; color: #fff; font-weight: 600; }
.adm-main { flex: 1; min-width: 0; padding: 20px 24px 60px; }
.adm-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.adm-top h1 { font-size: 20px; }
.adm-panel { background: #fff; border: 1px solid var(--c-line); border-radius: var(--c-radius); padding: 20px; box-shadow: var(--c-shadow); margin-bottom: 18px; }
.adm-panel h2 { font-size: 15px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--c-line-soft); }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--c-text-2); margin-bottom: 5px; }
.form-row .hint { font-size: 12px; color: var(--c-sub); font-weight: 400; margin-left: 6px; }
.inp, .sel, .txa {
  width: 100%; padding: 8px 11px; border: 1px solid var(--c-line); border-radius: 8px;
  background: #fffaf6; outline: none; color: var(--c-text);
}
.inp:focus, .sel:focus, .txa:focus { border-color: var(--c-primary); background: #fff; }
.txa { min-height: 110px; resize: vertical; line-height: 1.7; }
.txa-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.form-grid .form-row.full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 8px; }

.btn-adm {
  display: inline-block; padding: 8px 18px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--c-brand-grad); color: #fff; font-size: 13.5px; font-weight: 600;
}
.btn-adm:hover { color: #fff; filter: brightness(1.06); }
.btn-adm--gray { background: #f5ece3; color: var(--c-text-2); }
.btn-adm--gray:hover { color: var(--c-text); }
.btn-adm--danger { background: #fee2e2; color: #b91c1c; }
.btn-adm--sm { padding: 4px 10px; font-size: 12.5px; }

/* 表格外层滚动容器：窄屏下横向滑动查看，避免撑破页面 */
.tbl-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap::-webkit-scrollbar { height: 6px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: #e4d3c4; border-radius: 3px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--c-line-soft); text-align: left; vertical-align: middle; }
.tbl th { background: #fbf5ef; font-weight: 600; color: var(--c-text-2); white-space: nowrap; }
.tbl tr:hover td { background: #fffaf6; }
.tbl .col-act { white-space: nowrap; }
.tbl .col-act a { margin-right: 8px; font-size: 12.5px; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.alert--ok  { background: #e8f7f4; color: #0f766e; border: 1px solid #bfe3dc; }
.alert--err { background: #fdecec; color: #b91c1c; border: 1px solid #f6c9c9; }

.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #fdf1e7, #fdf6f0); padding: 20px; }
/* 固定 340px 在 320px 机型上会横向溢出，改成「不超过容器」；
   用 width+max-width 而非 min()，老内核同样生效 */
.login-box { width: 340px; max-width: 100%; padding: 30px 26px; background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(88, 52, 26, .12); }
.login-box h1 { font-size: 18px; margin-bottom: 20px; text-align: center; }

/* =============================================================
   12. 响应式 / 多机型适配
   -------------------------------------------------------------
   断点梯度（桌面优先，由宽到窄逐级覆盖）：
     ≥1600   2K / 4K 显示器            —— 版面加宽，分组网格 4 列
     1280+   常规台式机                 —— 默认样式（分组网格 3 列）
     1279    小笔记本 / 平板横屏        —— 顶部导航改横向滑动，不再被裁切
     1024    iPad / iPad Pro           —— 分组网格降为 2 列
     900     小平板 / 大屏手机横屏      —— 顶部栏改两行
     640     主流手机（iPhone 12-16 / 大部分安卓）
     480     小屏手机（iPhone SE / 老安卓）
     375     极窄屏（iPhone SE1 / 小屏安卓）
     340     超窄屏（小屏安卓分屏）
     300     折叠机外屏（Galaxy Fold 280px）
   另含：手机横屏矮屏兜底 / 触摸设备 / 减弱动态效果偏好
   ============================================================= */

/* ---------------- 2K 及以上：加宽版面，分组网格 4 列 ---------------- */
@media (min-width: 1600px) {
  :root { --wrap: 1320px; }
  .nav-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 24px; }
  .group-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lgrid { grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); }
}

/* ---------------- 小笔记本 / 平板横屏 ---------------- */
@media (max-width: 1279px) {
  .topbar-search { flex: 0 0 210px; }
  /* 导航项放不下时改为横向滑动，避免链接被 overflow:hidden 直接裁掉（不可达） */
  .topnav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { padding: 6px 9px; }
}

/* ---------------- 平板（iPad 横竖屏 / iPad Pro） ---------------- */
@media (max-width: 1024px) {
  .nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 20px; }
  .topbar-search { flex: 0 0 200px; }
  .adm-side { flex: 0 0 172px; }
  .lgrid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ---------------- 小平板 / 大屏手机横屏：顶部栏改为两行 ---------------- */
@media (max-width: 900px) {
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 9px 0; gap: 9px; }
  .topnav { order: 3; flex: 1 1 100%; padding-bottom: 2px; }
  .topbar-search { flex: 1 1 180px; min-width: 0; }
  .detail { padding: 20px 18px; }
}

/* ---------------- 主流手机（iPhone 12-16 / 大部分安卓 360-430px） ---------------- */
@media (max-width: 640px) {
  .container {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  /* --- 顶部栏 --- */
  .topbar-inner { padding: 8px 0; gap: 8px; }
  .brand { gap: 7px; }
  .brand-icon { width: 30px; height: 30px; }
  .brand-name { font-size: 16px; }
  .topnav a { padding: 8px 11px; font-size: 13px; }   /* 触控区 ≥ 36px */
  .topbar-search { flex: 1 1 140px; min-width: 0; }
  /* 关键：输入框字号 < 16px 时 iOS Safari 聚焦会自动放大整页，这里强制 16px */
  .topbar-search input { height: 38px; font-size: 16px; padding: 0 10px; }
  .topbar-search button { height: 38px; padding: 0 15px; font-size: 13.5px; }

  /* --- 搜索卡 --- */
  .search-card { margin-top: 14px; padding: 20px 14px 16px; border-radius: 14px; }
  .srch-h1 { font-size: 13.5px; margin-bottom: 14px; }
  .srch-stat { font-size: 12px; line-height: 1.75; }

  .search-form input[type=text] { height: 44px; font-size: 16px; padding: 0 14px; }
  .search-form button { height: 44px; padding: 0 18px; font-size: 15px; }
  .search-card .search-form input[type=text] { padding-left: 42px; }
  .search-icon { left: 12px; }

  .search-tab { gap: 7px; margin-top: 12px; }
  .search-tab .tab { padding: 7px 15px; font-size: 13px; }   /* 触控区 ≥ 36px */

  /* --- 分组链接：单列分组、组内 2 列，加大触控区 --- */
  .nav-grid { grid-template-columns: minmax(0, 1fr); gap: 20px 16px; margin-top: 14px; }
  .group-links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .group-links a { line-height: 42px; font-size: 13.5px; }
  .nav-group--news .group-links { grid-template-columns: minmax(0, 1fr); }

  /* --- 通用区块 --- */
  .section { margin-top: 12px; padding: 15px 13px 4px; }
  .section-head { padding-bottom: 10px; gap: 8px; }
  .section-title { font-size: 15px; }
  .section-more { font-size: 12px; white-space: nowrap; }

  /* --- 列表 / 详情 --- */
  .crumb { margin-top: 14px; font-size: 12.5px; }
  .page-head h1 { font-size: 19px; }
  .page-head .ph-desc { font-size: 13px; }
  .lgrid { grid-template-columns: 1fr; gap: 10px; }
  .lcard { padding: 12px; }
  .art-item { padding: 14px; margin-top: 10px; }
  .art-item h3 { font-size: 15px; }
  .detail { padding: 18px 14px; margin-top: 12px; }
  .detail h1 { font-size: 19px; }
  .detail-body { font-size: 15px; line-height: 1.9; }
  .detail-body h3 { font-size: 16px; }
  .magnet-box { padding: 13px 12px; }
  .magnet-box .mb-value { font-size: 12px; padding: 9px 10px; }
  .btn { padding: 10px 20px; }

  /* --- 分页：加大点击区 --- */
  .pager { gap: 6px; margin: 18px 0 6px; }
  .pg-btn { min-width: 38px; padding: 8px 11px; font-size: 13px; }
  .pg-info { flex: 1 1 100%; text-align: center; margin: 6px 0 0; }

  /* --- 页脚 --- */
  .footer { margin-top: 22px; padding: 20px 0 calc(24px + env(safe-area-inset-bottom)); }
  .footer-links { gap: 8px 14px; }
  .footer-links a { font-size: 12.5px; }
  .footer-tags { gap: 6px; }

  /* --- 后台 --- */
  .adm { flex-direction: column; min-height: 100vh; min-height: 100dvh; }
  .adm-side {
    flex: none; display: flex; overflow-x: auto; padding: 8px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    position: sticky; top: 0; z-index: 20;
  }
  .adm-side::-webkit-scrollbar { display: none; }
  .adm-side .as-brand { display: none; }
  .adm-side a { white-space: nowrap; padding: 10px 14px; border-radius: 8px; }
  .adm-main { padding: 14px 12px calc(48px + env(safe-area-inset-bottom)); }
  .adm-top h1 { font-size: 18px; }
  .adm-panel { padding: 15px 13px; }
  .form-grid { grid-template-columns: 1fr; }
  .inp, .sel, .txa { font-size: 16px; }               /* 防 iOS 聚焦缩放 */
  .login-box { padding: 26px 20px; }
  /* 多列宽表：给足最小宽度后由外层 .tbl-wrap 横向滑动查看（概览那张 4 列小表不加，避免无谓滚动） */
  .tbl-wrap .tbl { min-width: 600px; }
}

/* ---------------- 小屏手机（iPhone SE / 6-8 / 老安卓 320-480px） ---------------- */
@media (max-width: 480px) {
  .search-card { padding: 18px 12px 14px; }
  .srch-h1 { font-size: 13px; }
  /* 搜索框在窄屏改为上下堆叠，更好点按与输入 */
  .search-form { flex-wrap: wrap; }
  .search-form input[type=text] { flex: 1 1 100%; border-right: 1px solid var(--c-line); border-radius: 11px; }
  .search-form button { flex: 1 1 100%; margin-top: 8px; border-radius: 11px; }
  .search-icon { display: none; }                      /* 输入框整行展开后不再需要内嵌图标 */
  .group-links a { font-size: 13px; }
  .section-title { font-size: 14.5px; }
  .detail-body { font-size: 14.5px; }
  .magnet-box .mb-value { font-size: 11.5px; }
  .pg-btn { min-width: 36px; padding: 8px 10px; }
}

/* ---------------- 极窄屏（iPhone SE 第一代 320px / 小屏安卓） ---------------- */
@media (max-width: 375px) {
  .container {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .brand-name { font-size: 15px; }
  .topbar-search button { padding: 0 12px; }
  .srch-h1 { font-size: 12.5px; line-height: 1.55; }
  .search-tab .tab { padding: 6px 13px; font-size: 12.5px; }
  .group-links a { line-height: 40px; font-size: 13px; padding: 0 8px; }
  .pg-btn { min-width: 34px; padding: 7px 9px; font-size: 12.5px; }
}

/* ---------------- 超窄屏（小屏安卓分屏 / 折叠机内屏窄态） ---------------- */
@media (max-width: 340px) {
  .brand-name { font-size: 14px; }
  .search-card { padding: 16px 10px 12px; border-radius: 12px; }
  .srch-h1 { font-size: 12.5px; }
  .srch-stat { font-size: 11.5px; }
  .search-tab { gap: 6px; }
  .search-tab .tab { padding: 6px 12px; font-size: 12px; }
  .group-links a { line-height: 38px; font-size: 12.5px; padding: 0 7px; }
  .section { padding: 13px 10px 2px; }
  .magnet-box .mb-value { font-size: 11px; }
  .pg-gap { display: none; }                          /* 极窄时省略页码省略号，优先保证按钮可点 */
}

/* ---------------- 折叠机外屏（Galaxy Fold 280px 等） ---------------- */
@media (max-width: 300px) {
  .brand-name { display: none; }                      /* 只留站标，把宽度让给搜索框 */
  .topbar-search { flex: 1 1 100%; }
  .srch-h1 { font-size: 12px; }
  .group-links a { line-height: 36px; font-size: 12px; }
  .pg-info { font-size: 11.5px; }
}

/* ---------------- 手机横屏 / 矮屏：压缩纵向高度，让首屏信息量最大化 ---------------- */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar-inner { padding: 6px 0; gap: 6px; }
  .search-card { margin-top: 12px; padding: 14px 16px 12px; }
  .srch-h1, .srch-stat { display: none; }
  .search-tab { margin-top: 10px; }
  .nav-grid { margin-top: 12px; gap: 16px 18px; }
}

/* ---------------- 触摸设备：关闭依赖 hover 的位移，避免「点完状态卡住」 ---------------- */
@media (hover: none) and (pointer: coarse) {
  body { background-attachment: scroll; }             /* fixed 背景在移动端会掉帧 */
  html { scroll-behavior: auto; }
  .group-links a:hover { transform: none; box-shadow: none; }
  .lcard:hover { transform: none; }
  .btn:active, .btn-adm:active, .pg-btn:active, .search-tab .tab:active { filter: brightness(.94); }
}

/* ---------------- 尊重系统「减弱动态效果」偏好 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html { scroll-behavior: auto; }
}


/* 影视模块（movie cards / ranking / detail） */
.mv-hero{background:var(--c-brand-grad);color:#fff;border-radius:var(--c-radius);padding:34px 26px;margin:16px 0 22px;position:relative;overflow:hidden}
.mv-hero::after{content:"";position:absolute;right:-70px;top:-70px;width:240px;height:240px;border-radius:50%;background:rgba(255,255,255,.12)}
.mv-hero::before{content:"";position:absolute;left:-40px;bottom:-60px;width:160px;height:160px;border-radius:50%;background:rgba(255,255,255,.08)}
.mv-hero-inner{position:relative;z-index:1;max-width:780px}
.mv-h1{font-size:27px;color:#fff;margin:0 0 8px}
.mv-h1 span{font-weight:400;opacity:.92;font-size:19px}
.mv-sub{color:rgba(255,255,255,.92);margin:0 0 18px;font-size:14px;line-height:1.7}
.mv-hero .search-form{display:flex;background:#fff;border-radius:999px;padding:6px 6px 6px 18px;max-width:640px;box-shadow:0 8px 30px rgba(0,0,0,.16);align-items:center}
.mv-hero .search-form .search-icon{font-size:16px;opacity:.7}
.mv-hero .search-form input{flex:1;border:0;outline:0;background:transparent;padding:11px 8px;font-size:15px;color:var(--c-text);min-width:0}
.mv-hero .search-form button{border:0;border-radius:999px;background:var(--c-primary);color:#fff;padding:11px 24px;font-weight:600;cursor:pointer}
.mv-stats{display:flex;gap:28px;margin:18px 0 0;list-style:none;padding:0}
.mv-stats li{color:rgba(255,255,255,.92);font-size:13px}
.mv-stats strong{display:block;font-size:21px;color:#fff;line-height:1.2}
.mv-block{margin:0 0 28px}
.block-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:0 0 14px;border-bottom:1px solid var(--c-line);padding-bottom:10px;flex-wrap:wrap}
.block-title{font-size:18px;display:flex;align-items:center;gap:8px}
.block-title em{font-style:normal;font-size:12px;font-weight:400;color:var(--c-sub);background:var(--c-line-soft);padding:2px 9px;border-radius:999px}
.bt-ico{font-size:18px}
.block-more{font-size:13px;color:var(--c-sub)}
.block-more:hover{color:var(--c-primary)}
.mv-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:14px}
.mv-card{background:var(--c-card);border:1px solid var(--c-line);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;transition:transform .18s,box-shadow .18s}
.mv-card:hover{transform:translateY(-3px);box-shadow:var(--c-shadow-hov)}
.mv-poster{position:relative;display:block;aspect-ratio:2/3;background:linear-gradient(135deg,#e8eef5,#dae6f0);overflow:hidden}
.mv-poster img{width:100%;height:100%;object-fit:cover;display:block}
.mv-nopic{display:flex;align-items:center;justify-content:center;height:100%;color:#9aa7b6;font-size:13px}
.mv-badge{position:absolute;right:6px;top:6px;background:rgba(0,0,0,.62);color:#fff;font-size:11px;padding:1px 8px;border-radius:6px;line-height:1.7;max-width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mv-badge-rank{left:6px;right:auto;top:6px;background:linear-gradient(135deg,#f59e0b,#ef4444);font-weight:700}
.mv-info{padding:9px 10px 11px;display:flex;flex-direction:column;flex:1}
.mv-title{font-size:14px;line-height:1.4;margin:0 0 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mv-title a{color:var(--c-text)}
.mv-title a:hover{color:var(--c-primary)}
.mv-meta{display:flex;flex-wrap:wrap;gap:3px 9px;font-size:12px;color:var(--c-sub);margin-bottom:9px;flex:1}
.mv-btn{margin-top:auto;text-align:center;background:var(--c-line-soft);color:var(--c-primary);border-radius:8px;padding:6px 8px;font-size:12.5px;font-weight:600}
.mv-btn:hover{background:var(--c-primary);color:#fff}
.cat-tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:12px}
.cat-tile{display:flex;align-items:center;justify-content:space-between;background:var(--c-card);border:1px solid var(--c-line);border-radius:12px;padding:14px 16px;font-weight:600;color:var(--c-text)}
.cat-tile:hover{border-color:var(--c-primary);color:var(--c-primary);box-shadow:var(--c-shadow)}
.ct-go{font-size:12px;color:var(--c-sub);font-weight:400}
.cat-tiles-sm{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));margin:0 0 18px}
.cat-tiles-sm .cat-tile{padding:9px 12px;font-size:14px}
.art-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:10px}
.mv-detail{background:var(--c-card);border:1px solid var(--c-line);border-radius:var(--c-radius);padding:20px;margin:16px 0 24px;box-shadow:var(--c-shadow)}
.mv-detail-top{display:flex;gap:20px;flex-wrap:wrap}
.mv-detail-poster{flex:0 0 210px;max-width:210px;border-radius:12px;overflow:hidden;background:#e8eef5}
.mv-detail-poster img{width:100%;display:block}
.mv-detail-head{flex:1;min-width:240px}
.mv-detail-head h1{font-size:22px;margin:0 0 8px}
.mv-detail-head h1 em{font-size:16px;color:var(--c-sub);font-style:normal}
.mv-alias{margin:0 0 3px;font-size:13px;color:var(--c-sub)}
.mv-score-row{display:flex;gap:14px;align-items:center;margin:10px 0;flex-wrap:wrap}
.mv-score{font-size:13px;color:var(--c-sub)}
.mv-score b{font-size:18px;color:#f59e0b;margin-left:4px}
.mv-score-db b{color:#22a06b}
.mv-remark{background:var(--c-line-soft);color:var(--c-primary);font-size:12px;padding:2px 10px;border-radius:999px}
.mv-facts{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:6px 18px;margin:12px 0;font-size:13.5px}
.mv-facts div{display:flex;gap:8px}
.mv-facts dt{color:var(--c-sub);flex:0 0 56px}
.mv-facts dd{margin:0;color:var(--c-text-2);flex:1}
.mv-detail-actions{display:flex;gap:10px;margin:14px 0 0;flex-wrap:wrap}
.mv-detail-body h2{font-size:17px;margin:18px 0 8px}
.mv-detail-body p{color:var(--c-text-2);line-height:1.9}
.mv-disclaim{margin-top:14px;font-size:12.5px;color:var(--c-sub);background:var(--c-line-soft);padding:10px 14px;border-radius:10px}
.pager{margin-top:18px}
@media(max-width:640px){
 .mv-hero{padding:24px 16px;border-radius:12px}
 .mv-h1{font-size:21px}.mv-h1 span{display:block;font-size:15px;margin-top:4px}
 .mv-stats{gap:18px}.mv-stats strong{font-size:18px}
 .mv-grid{grid-template-columns:repeat(auto-fill,minmax(108px,1fr));gap:10px}
 .mv-detail{padding:14px}.mv-detail-poster{flex:0 0 128px;max-width:128px}
 .mv-detail-head h1{font-size:18px}
}
