/* ============================================================
   ui4 · 论坛首页两栏布局（配合 discuz_v4 模板使用）
   只作用于 #pt / #ct 之内，头部（#hd / #nv / #scbar）完全不动
   ============================================================ */
:root{
  --brand:#35548F;
  --brand-d:#2A4478;
  --brand-s:#EFF3FA;
  --ink:#1A2233;
  --ink-2:#4A5468;
  --muted:#8A93A3;
  --line:#E6E9EF;
  --r:12px;
}
.ui4,.ui4 *{box-sizing:border-box}
.ui4 a{text-decoration:none;color:inherit}

/* ---------- 面包屑（沿用主题位置，只去掉失效小房子） ---------- */
#pt.ui4-pt{
  background:transparent !important;
  box-shadow:none !important;
  padding:0 8px 12px !important;
  margin:0 0 14px !important;
  height:auto !important;min-height:0;
  line-height:1.6;font-size:12.5px;color:var(--muted);
  border:0 !important;
  border-bottom:1px dashed #CDCDCD !important;
}
#pt.ui4-pt a{color:var(--muted)}
#pt.ui4-pt a:hover{color:var(--brand)}
/* 面包屑：与原模板一致 —— 只留小房子图标，不显示站点名 */
#pt .nvhm{white-space:nowrap}
#pt.ui4-pt em{margin:0 9px !important;color:#A6AEBC;font-style:normal}

/* ---------- 两栏 ---------- */
.ui4-2col{
  display:grid;
  grid-template-columns:318px minmax(0,1fr);
  gap:0;
  align-items:stretch;
}
.ui4-main{min-width:0}
/* 左栏卡片居中：左边距(#ct)12px、右边距(分隔线)20px → 右移4px，两边各16px */
.ui4-main>.ui4-sec{transform:translateX(4px)}
.ui4-side{
  min-width:0;position:static;
  border-left:1px solid #CDCDCD;
  padding-left:20px;
  margin-left:20px;
}

/* ---------- 左栏白底面板 ---------- */
.ui4-sec{margin:0}
.ui4-sec + .ui4-sec{
  margin-top:20px;
  border-top:1px solid #CDCDCD
}
.ui4-sec-h{
  display:flex;align-items:baseline;gap:8px;
  padding:10px;
}
.ui4-sec-h h2{font-size:12.5px;font-weight:600;color:#5B6478}
.ui4-sec-h h2 a{color:inherit}
.ui4-sec-h h2 a:hover{color:var(--brand)}
.ui4-sec-h span{font-size:11px;color:#A6AEBC}

.ui4-grid{display:grid;gap:8px}

/* 版块：按钮样式（整块可点：标题链接拉伸覆盖整块） */
.bd{
  position:relative;
  display:grid;grid-template-columns:30px minmax(0,1fr);gap:10px;align-items:center;
  padding:10px;
  background:#F7F9FC;
  border:1px solid #DCE3EE;
  box-shadow:0 1px 2px rgba(26,34,51,.04);
  transition:background .16s,border-color .16s,box-shadow .16s;
  cursor:pointer;
}
.bd:hover{background:#fff;border-color:#8FA6CC;box-shadow:0 6px 14px -10px rgba(28,42,72,.6)}
.bd:active{transform:translateY(1px)}
.bd:hover .bd-t a{color:var(--brand)}
/* 自定义背景图模式：版块按钮玻璃拟态——半透明 + 背景模糊，融入背景 */
body.xzsy-bg-on:not(.xzsy-dark) .bd{
  background:rgba(255,255,255,calc(var(--xzsy-op,.75) * .62))!important;
  border-color:rgba(255,255,255,.55)!important;
  -webkit-backdrop-filter:blur(10px) saturate(1.1);
  backdrop-filter:blur(10px) saturate(1.1);
  box-shadow:0 2px 12px rgba(120,90,110,.08)!important;
}
body.xzsy-bg-on:not(.xzsy-dark) .bd:hover{
  background:rgba(255,255,255,calc(var(--xzsy-op,.75) * .85))!important;
  border-color:rgba(255,255,255,.8)!important;
}
.bd-ic{
  width:30px;height:30px;
  display:flex;align-items:center;justify-content:center;
  background:none;border-radius:0;
}
.bd-ic svg{width:26px;height:24px;display:block}
.bd-ic img{width:26px;height:26px;object-fit:contain}
.bd-b{min-width:0;display:flex;flex-direction:column}
.bd-t{
  display:flex;align-items:center;gap:7px;
  font-size:13.5px;font-weight:600;color:var(--ink);line-height:1.45;
}
.bd-t a{
  color:var(--ink);min-width:0;display:block;position:static;
}
/* 拉伸点击热区：点图标/数字/留白都进板块 */
.bd-t a::after{
  content:"";position:absolute;inset:0;z-index:2;border-radius:8px;
}
.bd-t b{font-weight:600;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bd-t em{
  font-style:normal;flex:none;
  font-size:10.5px;font-weight:600;line-height:17px;
  color:#C2410C;background:#FFF1E7;border-radius:5px;padding:0 5px;
  font-variant-numeric:tabular-nums;
}
.bd-m{margin-top:3px;font-size:12.5px;line-height:1.55;color:var(--muted);font-variant-numeric:tabular-nums}
.bd-m s{text-decoration:none;color:#CDD3DE;margin:0 5px}
/* 版块行不显示「最新回复」这一行 */
.bd-l{display:none !important}

/* ---------- 通用卡片 ---------- */
.sc{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:15px 16px}
.sc-h{
  display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  font-size:13.5px;font-weight:600;color:var(--ink);
  margin-bottom:12px;
}
.sc-h span{font-size:11.5px;font-weight:400;color:var(--muted)}

/* ---------- 右栏：最新主题 ---------- */
.ui4-side .ui4-sec-h{justify-content:space-between;padding:0 0 8px}
.tl-row{
  display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:12px;align-items:center;
  padding:4px 0;border-bottom:1px dashed #CDCDCD;
  transition:background .14s;
}
.tl-row:last-of-type{border-bottom:0}
.tl-row:hover{background:#FAFBFD}
.tl-b{display:block;min-width:0}
.tl-t{
  display:flex;align-items:flex-start;gap:7px;
  font-size:13.5px;color:var(--ink);line-height:18px;
}
/* 标题文本块：与胶囊分开成独立盒，多行时左边界与首行文字对齐 */
.tl-x{flex:1 1 auto;min-width:0;white-space:normal;word-break:break-word}
/* 标题前的版块胶囊（按 fid 分 5 组配色）；2px 上偏移让胶囊中线与首行文字中线重合 */
.tl-f{
  flex:none;display:inline-block;max-width:112px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  height:18px;line-height:18px;padding:0 6px;margin-top:0;
  font-size:10.5px;font-weight:500;border-radius:4px;
}
.tl-f.f0{color:#4A65A0;background:#EDF1F9}
.tl-f.f1{color:#2F7A72;background:#E7F4F2}
.tl-f.f2{color:#6B4C9A;background:#F1EDF9}
.tl-f.f3{color:#A6581E;background:#FCF0E5}
.tl-f.f4{color:#3E7A34;background:#EAF4E8}
.tl-row:hover .tl-t{color:var(--brand)}
.tl-t em{
  font-style:normal;font-size:10px;font-weight:600;line-height:15px;
  color:#fff;background:var(--brand);border-radius:4px;padding:0 4px;margin-left:5px;
  vertical-align:1px;
}
.tl-r{display:flex;gap:6px;justify-content:flex-end;align-items:center;font-variant-numeric:tabular-nums;white-space:nowrap}
/* 右侧：回复 / 查看 数字胶囊 */
.tl-n{
  display:inline-flex;align-items:baseline;gap:3px;
  font-size:11px;color:var(--muted);line-height:16px;
  background:#F5F7FB;border:1px solid #E7EBF3;border-radius:6px;
  padding:1px 7px;
  transition:background .14s,border-color .14s;
}
.tl-n b{font-weight:600;color:var(--ink-2)}
.tl-row:hover .tl-n{background:#fff;border-color:#D8DFEC}
/* 模板里回复/查看的分隔用 <s> 包裹，去掉删除线，只留「/」 */
.tl-r s{text-decoration:none;color:#CDD3DE}
.tl-more{
  display:block;font-size:12px;color:var(--brand);
  padding:12px 0 2px;
}
.tl-more:hover{color:var(--brand-d)}
/* 「查看全部」放进标题行右上角后，不再占一整行：去掉上下留白、靠右对齐 */
.ui4-latest .ui4-sec-h>.tl-more{
  margin-left:auto;padding:0;font-size:11px;line-height:1;
  display:inline-flex;align-items:center;
}

/* ---------- 最新主题：查看全部（整页列表） ---------- */
.ui4-allwrap{max-width:none;padding: 0 .75rem;}
.ui4-allwrap .ui4-sec-h{padding:0 0 10px}
.tl-all .tl-t{font-size:14px}
/* 整页列表只有标题 + 右侧计数两个子元素，不需要右栏那条 34px 的首列缩进 */
.tl-all .tl-row{grid-template-columns:minmax(0,1fr) auto;padding:10px 0}

/* ---------- 左栏：友情链接 ---------- */
#ui4_lk ul{
  display:block;margin:0;padding:0;list-style:none;
}
#ui4_lk li{
  position:relative;display:block;
  list-style:none;margin:0 !important;padding:10px !important;
  background:transparent;border-bottom:1px solid #CDCDCD;
  float:none !important;width:auto !important;border-top:0 !important;
  border-left:0 !important;border-right:0 !important;
  border-radius:0;min-width:0;min-height:36px;box-shadow:none !important;
  transition:background .14s;
}
#ui4_lk li:last-child{border-bottom:0}
#ui4_lk li:hover{background:#FBFCFE}
/* 友链不显示图标 */
#ui4_lk li img{display:none !important}
#ui4_lk .lk_content{min-width:0;float:none !important}
#ui4_lk h5{margin:0;font-size:12.5px;font-weight:500;line-height:20px}
#ui4_lk h5 a{
  display:block;color:var(--ink);background:none;padding:0;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
#ui4_lk h5 a:hover{color:var(--brand)}
#ui4_lk p{
  margin:2px 0 0;font-size:11.5px;color:var(--muted);line-height:1.55;
  display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;
}
#ui4_lk .ui4-lk-row{padding:10px 10px 0;border-top:1px solid #CDCDCD;margin-top:8px;font-size:11.5px;color:var(--muted);line-height:1.7}
#ui4_lk .ui4-lk-row a{color:var(--ink-2)}
#ui4_lk .ui4-lk-row a:hover{color:var(--brand)}

/* ---------- 响应式 ---------- */
@media (max-width:1100px){
  .ui4-2col{grid-template-columns:290px minmax(0,1fr);gap:14px}
  /* gap14 + margin20 = 34px；卡片左12px → 右移11px，两边各23px */
  .ui4-main>.ui4-sec{transform:translateX(11px)}
}
@media (max-width:1000px){
  .ui4-2col{grid-template-columns:minmax(0,1fr)}
  /* 窄屏单栏：#ct 左右内边距各 12px 已对称，不能再位移，否则右侧贴边 */
  .ui4-main>.ui4-sec{transform:none}
  .ui4-side{
    border-left:0;padding-left:0;margin-left:0;
    border-top:1px solid #CDCDCD;margin-top:14px;padding-top:12px;
  }
}
@media (max-width:760px){
  .ui4-grid{grid-template-columns:minmax(0,1fr)}
  /* 最新主题：小屏收窄胶囊，避免挤压标题 */
  .tl-r{gap:4px}
  .tl-n{padding:1px 5px;font-size:10.5px;line-height:15px}
  .tl-t{gap:5px}
  .tl-f{max-width:82px}

  /* 小屏主题会隐藏面包屑层级，这里补回 */
  #pt.ui4-pt a{display:inline !important}
  /* 小房子是字体图标（dzicon），保持 inline 且行高 1，避免 inline-block 继承 25.6px 行高把图标顶到文字上方 */
  #pt.ui4-pt .nvhm{
    display:inline !important;width:16px;
    line-height:1;vertical-align:baseline;
  }
}

/* ---------- 访客引导：无可浏览版块时整页单栏 ---------- */
.ui4-guest .ui4-sec-h{padding-left:10px}
.ui4-guest-b{
  margin:0 10px;
  padding:34px 20px 30px;
  text-align:center;
  background:#F7F9FC;
  border:1px solid #DCE3EE;
  border-radius:10px;
}
.ui4-guest-t{font-size:14px;font-weight:600;color:var(--ink);line-height:1.6}
.ui4-guest-d{margin-top:6px;font-size:12.5px;color:var(--muted);line-height:1.7}
.ui4-guest-a{margin-top:16px;display:flex;justify-content:center;gap:10px}
.ui4-btn{
  display:inline-block;min-width:96px;height:34px;line-height:32px;
  padding:0 18px;border:1px solid var(--brand);border-radius:8px;
  background:var(--brand);color:#fff !important;
  font-size:13px;font-weight:600;text-align:center;text-decoration:none;
  box-shadow:0 4px 10px -6px rgba(53,84,143,.75);
  transition:background .15s,box-shadow .15s;
}
.ui4-btn:hover{background:var(--brand-d);border-color:var(--brand-d);color:#fff !important}
.ui4-btn-g{background:#fff;color:var(--brand) !important;border-color:#C3D0E6;box-shadow:none}
.ui4-btn-g:hover{background:#F4F7FC;border-color:#A9BCD9;color:var(--brand-d) !important}
@media (max-width:760px){
  .ui4-guest-b{margin:0;padding:26px 16px 24px}
}
/* 右侧访客提示卡（友情链接留在左栏） */
.ui4-side .ui4-guest-b{margin:0;padding:46px 24px 42px}
.ui4-guest-in{max-width:560px;margin:0 auto}
/* 去掉链接下划线：正文区域任何 a 及其 hover/visited 都不画线，仅靠颜色区分 */
.ui4 a,.ui4 a:hover,.ui4 a:visited{text-decoration:none}
.tl-x a,.tl-x a:hover{color:inherit;text-decoration:none}


/* ---------- 左栏：站点背景设置面板 ---------- */
#ui4_bgpanel{margin-top:20px;padding:18px 0;border-top:1px solid #CDCDCD}
#ui4_bgpanel .ui4-sec-h{justify-content:flex-start;align-items:center}
#ui4_bgpanel .ui4-sec-h h2{flex:none;white-space:nowrap}
#ui4_bgpanel .bgp-act{margin-left:auto;display:flex;gap:10px;flex:none;white-space:nowrap}
#ui4_bgpanel .bgp-act a{font-size:11px;color:var(--brand);cursor:pointer;white-space:nowrap}
#ui4_bgpanel .bgp-act a:hover{color:var(--brand-d)}
.bgp-body{padding:2px 10px 10px}
.bgp-body.bgp-fold{display:none}
.bgp-row{margin-bottom:11px}
.bgp-row>label{display:block;font-size:11.5px;color:var(--ink-2);margin-bottom:5px}
/* Discuz 基础样式里有全局 label{cursor:pointer}，面板里的「图片链接 / 本地图片 /
   背景底色 …」只是说明文字，不是控件，hover 变手型会让人以为整行可点。
   真正可点的开关（label.bgp-switch-cell 包着 checkbox）保留 pointer */
#ui4_bgpanel .bgp-row>label:not(.bgp-switch-cell){cursor:default}
.bgp-row>label b{font-weight:600;color:var(--brand)}
.bgp-inline{display:flex;gap:6px;align-items:center}
.bgp-inline input[type=text]{
  flex:1;min-width:0;height:30px;padding:0 8px;font-size:12px;
  border:1px solid #DCE3EE;border-radius:6px;background:#fff;color:var(--ink);
}
.bgp-inline input[type=text]:focus{outline:none;border-color:#8FA6CC}
.bgp-inline button,
.bgp-switch-row>button{
  flex:none;height:30px;padding:0 10px;font-size:11.5px;
  display:inline-flex;align-items:center;justify-content:center;gap:5px;
  border:1px solid #C3D0E6;border-radius:6px;background:#fff;color:var(--brand);
  cursor:pointer;transition:background .15s;
}
.bgp-inline button:hover,.bgp-switch-row>button:hover{background:var(--brand-s)}
.bgp-inline button svg,.bgp-switch-row>button svg{width:13px;height:13px;flex:none}
.bgp-inline input[type=file]{flex:1;min-width:0;font-size:11px;color:var(--muted)}
.bgp-inline input.bgp-file-hidden{position:absolute;width:1px;height:1px;opacity:0;overflow:hidden;pointer-events:none}
.bgp-filewrap{flex:1;min-width:0;display:flex;align-items:center;gap:7px}
.bgp-filebtn{
  flex:none;height:30px;padding:0 12px;display:inline-flex;align-items:center;gap:5px;
  font-size:11.5px;font-weight:500;line-height:1;
  border:1px solid #C3D0E6;border-radius:6px;background:var(--brand-s);color:var(--brand);
  cursor:pointer;transition:background .15s,border-color .15s,transform .08s;
}
.bgp-filebtn svg{width:13px;height:13px;flex:none}
.bgp-filebtn:hover{background:#E3EBF8;border-color:#9DB1D4}
.bgp-filebtn:active{transform:translateY(1px)}
.bgp-fname{
  flex:1;min-width:0;height:30px;padding:0 8px;font-size:11px;
  border:1px solid #DCE3EE;border-radius:6px;background:#fff;color:var(--muted);
  cursor:default;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.bgp-fname:focus{outline:none;border-color:#DCE3EE}
.bgp-fname.has{color:var(--ink-2)}
/* 色块本身是可点的取色控件，保留手型；文字 label 仍为 default */
.bgp-inline input[type=color]{flex:none;width:70px;height:30px;padding:0;border:1px solid #DCE3EE;border-radius:6px;background:#fff;cursor:pointer}
.bgp-inline select{flex:none;height:30px;padding:0 6px;font-size:11.5px;border:1px solid #DCE3EE;border-radius:6px;background:#fff;color:var(--ink-2)}
.bgp-row input[type=range]{width:100%;height:20px;accent-color:var(--brand)}
/* 「背景柔化 / 背景模糊」并排两列：共用一行、各占一半。
   包了一层 .bgp-col 之后，上面 .bgp-row>label 的直系选择器匹配不到，
   这里把字号/颜色/hover 手型的修正补回来（label 只是说明文字，不该是 pointer） */
.bgp-double{display:flex;gap:12px;align-items:flex-start}
.bgp-double>.bgp-col{flex:1 1 0;min-width:0}
.bgp-double>.bgp-col>label{display:block;font-size:11.5px;color:var(--ink-2);margin-bottom:5px;cursor:default;white-space:nowrap}
.bgp-double>.bgp-col>label b{font-weight:600;color:var(--brand)}
/* 深色模式开关 */
.bgp-dark-row{margin-bottom:14px;padding-bottom:12px;border-bottom:1px dashed var(--line)}
.bgp-switch-row{display:flex;gap:14px;align-items:center}
.bgp-switch-row>button{margin-left:auto}
.bgp-row>.bgp-switch-cell{display:inline-flex;align-items:center;gap:7px;margin-bottom:0;cursor:pointer}
.bgp-switch-name{font-size:11.5px;color:var(--ink-2);white-space:nowrap}
.bgp-switch{flex:none;display:inline-block;position:relative;width:38px;height:21px;cursor:pointer}
.bgp-switch input{position:absolute;width:1px;height:1px;opacity:0;margin:0}
.bgp-switch-track{display:block;width:38px;height:21px;border-radius:11px;background:#C3D0E6;transition:background .18s}
.bgp-switch-track:after{content:"";position:absolute;left:2px;top:2px;width:17px;height:17px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.2);transition:transform .18s}
.bgp-switch input:checked + .bgp-switch-track{background:var(--brand)}
.bgp-switch input:checked + .bgp-switch-track:after{transform:translateX(17px)}

#ui4_bgpanel .bgp-status{margin:0;font-size:11px;color:#2F7A72;white-space:nowrap;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;opacity:0;transition:opacity .2s}
#ui4_bgpanel .bgp-status.show{opacity:1}

/* ---------- 首页「最新回复 / 最新主题」两栏 ----------
   用容器查询按「这块自己的宽度」决定排版，不依赖视口断点：
     · 宽度 >= 560px → 左右两栏（桌面右栏 700~840px 都在这档，每栏 330~400px）；
     · 更窄（手机 ~340px）→ 上下堆叠，两块都显示。
   阈值从 900 降到 560：桌面右栏实际只有 700 出头，900 那条永远不触发，看起来像没改。 */
.ui4-side{container-type:inline-size}
.ui4-latest{display:grid;grid-template-columns:minmax(0,1fr);gap:0}
/* 每栏留内边距，深色下这一块才有「底色」可依附（颜色写在 dark.css） */
.ui4-latest-col{min-width:0;padding:12px 14px;box-sizing:border-box}
.ui4-latest .ui4-sec-h{padding:0 0 10px}
/* 最新回复右侧的时间（比「x回复/x查看」胶囊轻一点） */
.tl-time{font-size:11px;color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums}

/* 这一块里的行不要头像：网格去掉 34px 头像列，标题直接顶到左边；
   行高固定 40px，两栏内容不同（一边是时间、一边是胶囊）也不会高低不齐 */
.ui4-latest .tl-row{grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:0;height:40px;align-items:center}
/* 栏宽只有 340 上下，版块胶囊和统计胶囊各收一点，给标题留位置 */
.ui4-latest .tl-f{max-width:84px}
.ui4-latest .tl-n{padding:1px 6px;gap:2px}
.ui4-latest .tl-n b{font-size:10.5px}
.ui4-latest .tl-t{gap:6px;line-height:19px}
/* 标题只排一行，超出用 … 截断；New 标签在 tl-x 外面，跟着标题走不被裁掉。
   flex:0 1 auto 让 tl-x 只占自身宽度，短标题时 New 紧贴标题，长标题才收缩出省略号 */
.ui4-latest .tl-x{flex:0 1 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ui4-latest .tl-t em{flex:none;align-self:flex-start;margin-top:2px;margin-left:0}
/* 最新主题只留「x 回复」，查看数不再显示 */
.ui4-latest-col--thread .tl-r .tl-n + .tl-n{display:none}
/* 右侧那块（时间 / 回复胶囊）定宽，两栏的标题列才能一样宽 */
.ui4-latest .tl-r{width:60px;justify-content:flex-end}

/* 窄容器（手机）：两块上下叠，都显示 */
.ui4-latest-col--reply{display:block}
.ui4-latest-col + .ui4-latest-col{border-top:1px solid var(--line);margin-top:6px}

@container (min-width:560px){
  .ui4-latest{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0 20px}
  .ui4-latest-col + .ui4-latest-col{
    border-top:0;margin-top:0;border-left:0;
    position:relative;
  }
  /* 竖线用伪元素画在 20px 间隙正中：不占列宽，两栏内容才严格等宽 */
  .ui4-latest-col + .ui4-latest-col::before{
    content:"";position:absolute;top:12px;bottom:12px;left:-10px;width:1px;background:#CDCDCD;
  }
}

/* 窄容器（手机上下两段）：行的虚线两端要跟上方卡片的横线末尾齐平，
   所以内边距从「栏」挪到「行」上——虚线铺满整宽，文字仍缩进 14px */
@container (max-width:559px){
  .ui4-latest-col{padding-left:0;padding-right:0}
  .ui4-latest .ui4-sec-h{padding-left:5px;padding-right:5px}
  .ui4-latest .tl-row{box-sizing:border-box;padding-left:5px;padding-right:5px}
}
