/* ============================================================
   版面 v2：① 上横简介条  ② 三列主区（左/中/右）  ③ 下横分享条
   目标：一屏看全 · 卡片带背景图 · 列内独立滚动
   ============================================================ */

/* ---------- ① 上横：简介条（小字、紧凑） ---------- */
.intro-bar {
  padding: 13px 0 15px;
  background: linear-gradient(180deg, rgba(255,255,255,.94) 0%, rgba(255,255,255,.4) 100%);
  border-bottom: 1px solid var(--line);
}
.intro-inner { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.intro-main { flex: 1 1 420px; min-width: 0; }
.intro-h1 { font-size: 21px; line-height: 1.28; margin: 0 0 5px; font-weight: 800; letter-spacing: -.3px; color: var(--ink); }
.intro-sub { font-size: 12.6px; color: var(--ink-2); margin: 0 0 3px; line-height: 1.6; }
.intro-note { font-size: 11.2px; color: var(--muted); margin: 0; line-height: 1.5; }
.intro-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.intro-bar .stats { margin: 0; }
.intro-bar .stats li { padding: 0 16px; }
.intro-bar .stats strong { font-size: 19px; }
.intro-bar .stats span { font-size: 11px; }
.intro-bar .hero-cta { justify-content: flex-end; gap: 8px; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: 999px; }

/* ---------- ② 三列主区 ---------- */
.deck {
  display: grid;
  grid-template-columns: 266px minmax(0, 1fr) 292px;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.col-left, .col-mid, .col-right {
  max-height: calc(100vh - 398px);
  min-height: 330px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
}
.col::-webkit-scrollbar { width: 6px; }
.col::-webkit-scrollbar-thumb { background: #d8deea; border-radius: 999px; }
.col::-webkit-scrollbar-track { background: transparent; }

/* 面板卡片（带背景图） */
.panel {
  flex: 0 0 auto;
  background-color: #fff;
  background-image: url("/bg/common.svg");
  background-size: cover;
  background-position: right top;
  background-repeat: no-repeat;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 13px;
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.panel-head h2 {
  margin: 0; font-size: 14px; font-weight: 800; color: var(--ink);
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap; flex-shrink: 0;
}
.panel-head .btn { padding: 5px 11px; font-size: 11.5px; flex-shrink: 0; }
.panel-head h2::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--violet));
}
.panel-sub { font-size: 11px; color: var(--muted); margin: 0 0 8px; line-height: 1.5; }
.mini-note { font-size: 11px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }

/* 左列：逛分类（模块 / 子分类竖排） */
.col-left .module-tabs { display: flex; flex-direction: column; gap: 5px; }
.col-left .module-tab { width: 100%; justify-content: flex-start; padding: 7px 10px; font-size: 12.5px; }
.col-left .sub-chips { margin-top: 8px; gap: 5px; }
.col-left .sub-chip { font-size: 11.5px; padding: 4px 9px; }

/* 左列：怎么玩（紧凑步骤） */
.mini-steps { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: ms; }
.mini-steps li { position: relative; padding-left: 25px; counter-increment: ms; }
.mini-steps li::before {
  content: counter(ms); position: absolute; left: 0; top: 1px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 10.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.mini-steps b { display: block; font-size: 12.5px; color: var(--ink); font-weight: 700; margin-bottom: 1px; }
.mini-steps span { font-size: 11.5px; color: var(--muted); line-height: 1.55; }

/* 左列：关于本站（小字） */
.about-mini p { font-size: 11.6px; color: var(--ink-2); line-height: 1.62; margin: 0 0 6px; }
.about-mini p:last-child { margin-bottom: 0; }
.about-mini strong { color: var(--ink); }

/* 中列：内容区（单列流，卡片紧凑以便一屏多看几条） */
.col-mid .latest-feed { grid-template-columns: 1fr; gap: 8px; }
.col-mid .post-list { grid-template-columns: 1fr; gap: 8px; }
.col-mid .pub-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.col-mid .post { padding: 9px 11px 10px; }
.col-mid .post-head { margin-bottom: 3px; }
.col-mid .post-title { font-size: 13.5px; }
.col-mid .post-desc { font-size: 12px; margin: 2px 0 5px; line-height: 1.5; }
.col-mid .post-meta { font-size: 11px; }
.col-mid .panel-latest .latest-feed { max-height: none; }
.panel-latest { background-image: url("/bg/video.svg"); }
.panel-posts { background-image: url("/bg/tool.svg"); }
.panel-pub { background-image: url("/bg/site.svg"); }

/* 右列：个人中心 + 我的收藏夹 */
.panel-center { background-image: url("/bg/common.svg"); }
.panel-favs { background-image: url("/bg/book.svg"); }
.mine-card {
  background-color: #fff;
  background-image: url("/bg/common.svg");
  background-size: cover; background-position: right top; background-repeat: no-repeat;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
.mine-row { display: flex; align-items: center; gap: 10px; }
.mine-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--violet)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.mine-name { font-size: 13.5px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-desc { font-size: 11.2px; color: var(--muted); line-height: 1.5; margin: 6px 0 0; }
.mine-acts { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.col-right .fav-toolbar { margin-bottom: 7px; }
.col-right .fav-toolbar input { padding: 7px 12px; font-size: 12.5px; }
.col-right .fav-new-row input { padding: 6px 10px; font-size: 12px; }
.col-right .fav-new-head { font-size: 10.8px; margin: 9px 0 5px; }
.col-right .fav-quickadd input { padding: 5px 8px; font-size: 11.2px; }
.col-right .fav-list { max-height: none; overflow: visible; margin-top: 8px; }
.col-right .fav-card { padding: 9px 11px; }
.col-right .fav-links li { font-size: 12px; }

/* 帖子卡片按模块换背景图 */
.post { background-image: url("/bg/common.svg"); background-size: cover; background-position: right center; background-repeat: no-repeat; }
.post[data-mod="video"] { background-image: url("/bg/video.svg"); }
.post[data-mod="book"] { background-image: url("/bg/book.svg"); }
.post[data-mod="tool"] { background-image: url("/bg/tool.svg"); }
.post[data-mod="site"] { background-image: url("/bg/site.svg"); }
.pub-card { background-image: url("/bg/site.svg"); background-size: cover; background-position: right top; background-repeat: no-repeat; }
.fav-card { background-image: url("/bg/book.svg"); background-size: cover; background-position: right top; background-repeat: no-repeat; }

/* ---------- ③ 下横：分享条 ---------- */
.share-bar {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  border-top: 1px solid var(--line);
  padding: 11px 0 13px;
}
.share-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.share-head h2 { margin: 0; font-size: 14px; font-weight: 800; color: var(--ink); }
.share-bar .share-grid { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 0; }
.share-bar .qr-box { padding: 6px 9px; }
.share-bar .qr-img { width: 66px; height: 66px; }
.share-bar .qr-cap { font-size: 10.5px; margin: 3px 0 0; }
.share-bar .share-tip { font-size: 11.8px; margin: 0 0 6px; }
.share-bar .share-btns { gap: 6px; }
.share-bar .share-btn { font-size: 12px; padding: 6px 11px; }
.share-bar .share-actions { flex: 1 1 320px; }

/* 页脚压缩，给主区让高度 */
.site-footer { padding: 12px 0 14px; margin-top: 0; }
.site-footer p { margin: 2px 0; font-size: 11px; }
.site-footer .disclaimer { font-size: 10.5px; }

/* ---------- 分页「显示更多」按钮 ---------- */
.load-more {
  display: block; width: 100%; margin: 4px 0 2px; padding: 10px 12px;
  background: #fff; border: 1px dashed var(--line-2, #cdd6e6); border-radius: 12px;
  color: var(--primary); font-size: 12.8px; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.load-more:hover { background: var(--primary-soft); border-color: var(--primary); }
.load-more:active { transform: translateY(1px); }

/* ---------- 回到顶部（长页/手机端） ---------- */
.top-fab {
  position: fixed; right: 20px; bottom: 90px; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow-sm); z-index: 49;
}
.top-fab[hidden] { display: none; }
.top-fab:active { transform: translateY(1px); }

/* ---------- 响应式：窄屏堆叠 ---------- */
@media (max-width: 1180px) {
  .deck { grid-template-columns: 240px minmax(0, 1fr); }
  .col-right { grid-column: 1 / -1; }
  .col-left, .col-mid, .col-right { max-height: none; overflow: visible; }
}
@media (max-width: 860px) {
  .deck { grid-template-columns: 1fr; }
  .col-right { grid-column: auto; }
  /* 单列堆叠后「固定可视高度」整体失效，min-height 也要清掉，否则列底留白 */
  .col-left, .col-mid, .col-right { min-height: 0; }
  .intro-inner { flex-direction: column; align-items: flex-start; gap: 9px; }
  .intro-side { align-items: flex-start; }
  .intro-bar .stats li { padding: 0 12px; }

  /* ★ 修复：竖排后 flex-basis 会被当成「高度」，
     .intro-main{flex:1 1 420px} 会硬撑出 420px 空白 → 必须改成 0 0 auto */
  .intro-main, .intro-side { flex: 0 0 auto; width: 100%; }
  .intro-bar { padding: 11px 0 12px; }
  .intro-h1 { font-size: 19px; }
  .intro-sub { font-size: 12.2px; }
  .intro-side { gap: 7px; }
  .intro-bar .stats { width: 100%; justify-content: space-between; gap: 0; }
  .intro-bar .stats li { flex: 1 1 0; text-align: center; }
  /* 按钮组：允许换行 + 允许收缩到内容以下（否则 flex 项 min-content 会撑破视口） */
  .intro-bar .hero-cta { width: 100%; gap: 7px; flex-wrap: wrap; }
  .intro-bar .hero-cta .btn {
    flex: 1 1 auto; min-width: 0; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    text-align: center; padding: 9px 10px; font-size: 13px;
  }
}

/* ---------- 顶栏在手机上换两行：品牌+按钮一行，搜索框整行 ---------- */
@media (max-width: 760px) {
  /* 用 grid + display:contents，避免搜索框被「品牌」占位挤窄，保证整行铺满 */
  .nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand mine lang"
      "search search search";
    gap: 8px;
    height: auto; min-height: 58px; padding: 9px 0;
    align-items: center;
  }
  .brand { grid-area: brand; min-width: 0; }
  .brand-mark { white-space: nowrap; }
  .brand-sub { display: none; }
  .nav-links { display: none; }
  .nav-right { display: contents; }
  .mine-btn { grid-area: mine; justify-self: end; flex: 0 0 auto; }
  .lang-select { grid-area: lang; justify-self: end; flex: 0 0 auto; }
  .search-box { grid-area: search; margin: 0; }
  .search-box input { width: 100%; max-width: none; }

  /* 悬浮分享钮缩小、半透明，别挡内容 */
  #share-fab, .share-fab {
    width: 38px; height: 38px; font-size: 15px; right: 10px; bottom: 10px;
    opacity: .55; box-shadow: 0 4px 14px rgba(31, 79, 240, .32);
  }
  #share-fab:active, .share-fab:active { opacity: 1; }

  /* 回到顶部：与分享钮同侧竖排，别叠在一起 */
  .top-fab {
    width: 36px; height: 36px; right: 10px; bottom: 56px; font-size: 16px;
    opacity: .7;
  }
  .top-fab:active { opacity: 1; }

  /* 三列面板与帖子卡在手机端再紧凑一档 */
  .panel { padding: 11px 12px 12px; }
  .panel-head h2 { font-size: 13.5px; }
  .col-mid .post { padding: 9px 11px; }

  /* 下横分享条：手机端竖排居中，别再左对齐乱飘 */
  .share-bar .share-head { justify-content: center; text-align: center; }
  .share-bar .share-grid { flex-direction: column; align-items: center; text-align: center; gap: 10px; }
  .share-bar .qr-box { display: flex; flex-direction: column; align-items: center; }
  .share-bar .qr-img { width: 62px; height: 62px; }
  .share-bar .share-actions { flex: 0 0 auto; width: 100%; text-align: center; }
  .share-bar .share-btns { justify-content: center; }

  /* 页脚在手机端收窄，减少无谓滚动 */
  .site-footer { padding: 10px 0 12px; }
}

/* ---------- 超窄屏（<400px）再收一点 ---------- */
@media (max-width: 400px) {
  .container { padding: 0 14px; }
  .intro-h1 { font-size: 17.5px; }
  .intro-note { font-size: 10.8px; }
  .intro-bar .stats strong { font-size: 17px; }
  .intro-bar .stats li { padding: 0 6px; }
  .intro-bar .hero-cta .btn { font-size: 12.2px; }
}
