/* ============================================================================
   广告位样式（lain42）—— 响应式，跟随大厅主题
   
   注意：#ad-slot 位于 .container 内部，所以这里**不再设 max-width / 横向 padding**
   （否则会和容器的内边距叠加，左右多出一截）。
   
   断点跟大厅现有约定一致：1200 / 1024 / 768
   ============================================================================ */

#ad-slot {
  margin: 0 0 28px;
}

.ad-strip {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  background: var(--panel-color, rgba(10, 12, 18, 0.44));
  padding: 14px 16px;
  backdrop-filter: blur(6px);
}

/* ---- 头部：角标 + 提示 ---- */
.ad-strip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ad-tag {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--accent-color, #8ea1ff);
  border: 1px solid rgba(142, 161, 255, 0.35);
  border-radius: 4px;
  padding: 3px 6px;
}

.ad-hint {
  font-size: 11px;
  color: rgba(215, 221, 235, 0.34);
  white-space: nowrap;
}

/* ---- 卡片：桌面横向排列，自适应列数 ---- */
.ad-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}

.ad-card {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;                       /* 关键：让 grid 子项能被压缩，长文本不撑破 */
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ad-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(142, 161, 255, 0.22);
}

.ad-img {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.ad-body { min-width: 0; flex: 1 1 auto; }   /* min-width:0 才能让 ellipsis 生效 */

.ad-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--front-color, #f8fbff);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ad-text {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(215, 221, 235, 0.62);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ad-by {
  font-size: 11px;
  color: rgba(215, 221, 235, 0.36);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================================
   断点
   ============================================================================ */

/* ≤1200：每张卡最小宽度收一点，窄屏时更容易两列变一列 */
@media (max-width: 1200px) {
  .ad-list { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

/* ≤1024：单列（平板竖屏 / 小笔记本），卡片横向铺满更好读 */
@media (max-width: 1024px) {
  .ad-list { grid-template-columns: 1fr; }
}

/* ≤768：跟大厅其他部分一致地收紧 */
@media (max-width: 768px) {
  #ad-slot { margin-bottom: 20px; }
  .ad-strip { padding: 12px; border-radius: 12px; }
  .ad-strip-head { margin-bottom: 10px; }
  .ad-card { padding: 9px 10px; gap: 10px; }
  .ad-img { width: 44px; height: 44px; }
  .ad-title { font-size: 13px; }
  .ad-text { font-size: 12px; -webkit-line-clamp: 2; line-clamp: 2; }
  .ad-hint { display: none; }          /* 小屏省地方，角标「广告」够了 */
}

/* ≤420：超窄屏（小手机竖屏），图片再收一档，标题允许折行 */
@media (max-width: 420px) {
  .ad-strip { padding: 10px; }
  .ad-img { width: 38px; height: 38px; border-radius: 6px; }
  .ad-title { white-space: normal; }   /* 太窄了，硬截断反而看不清 */
  .ad-by { display: none; }
}

/* ⚠️ 不要加 @media (prefers-color-scheme: light) 之类的浅色适配：
   大厅是**纯深色主题**（theme 变量写死 --background-color: 17,18,22），
   不跟随系统配色。加了反而会让广告条在白底系统上变成浅色、和整页割裂。
   —— 这个 bug 我第一版就踩了，靠截图看出来的。 */

/* 触屏：hover 没意义，改成按下反馈 */
@media (hover: none) {
  .ad-card:hover { background: none; border-color: transparent; }
  .ad-card:active { background: rgba(255, 255, 255, 0.08); }
}

/* 尊重「减少动效」偏好 */
@media (prefers-reduced-motion: reduce) {
  .ad-card { transition: none; }
}


/* 给没有 .container 的页面（room / community）用的外层容器。
   数值抄 .container：1320px / 28px，≤768 时 16px。 */
.ad-slot-outer {
  max-width: 1320px;
  margin: 20px auto 0;
  padding: 0 28px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .ad-slot-outer { padding: 0 16px; margin-top: 14px; }
}
