/* ==========================================================================
   延伸阅读 / 外部网页参考 / 商业推广广告位（第七轮 AI 联网工作流）
   --------------------------------------------------------------------------
   1) .qxa-*           延伸阅读容器、站内词条、外部网页参考
   2) .qxa-ads / .qxa-ad*  商业推广广告位（独立区块、显著「广告」标识、两位轮播）
   3) .qxa-web-toggle / .qxa-strong*  问答页联网开关、站内已有词条提示
   --------------------------------------------------------------------------
   约定：
   - 全部使用 site.css / ui-unify.css 的语义令牌（--surface/--ink/--brand/--line/--warn 等），
     三套皮肤（deepblue/verdant/dark）自动跟随；仅暗色皮肤做少量反色补充。
   - 广告区视觉必须与「站内推荐/外部网页参考」明显区分：独立背景、虚线边框、红色「广告」角标、
     区块标题「商业推广」+ 说明「以下为商业广告，非站内推荐或搜索结果」。
   - 移动端断点与全站一致：960 / 640 / 400px。
   ========================================================================== */

.qxa { margin-top: 30px; }
.qxa [hidden] { display: none !important; }

.qxa-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-3);
}

/* ==========================================================================
   一、延伸阅读（站内词条 / 外部网页参考）
   ========================================================================== */

.qxa-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.qxa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.qxa-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
}
.qxa-head h2 .ico { color: var(--brand); }
.qxa-sub {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
}
.qxa-sub-web {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
  color: var(--accent-600);
}
.qxa-note { font-size: 12px; color: var(--ink-3); }

/* 站内词条列表 */
.qxa-internal-list { display: flex; flex-direction: column; }
.qxa-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px dashed var(--line);
  color: inherit;
}
.qxa-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.qxa-item:hover .qxa-item-main b { color: var(--brand); }
.qxa-item-ico {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand);
}
.qxa-item-ico .ico { width: 17px; height: 17px; }
.qxa-item-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.qxa-item-main b { font-size: 15px; line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.qxa-item-desc {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.qxa-item-go { color: var(--ink-4); }
.qxa-item-go .ico { width: 16px; height: 16px; }

/* 外部网页参考列表（视觉上与站内区别：左侧站点图标 + 站点/日期元信息 + 外链箭头） */
.qxa-web { border-style: solid; }
.qxa-web-list { display: flex; flex-direction: column; }
.qxa-web-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px dashed var(--line);
  color: inherit;
}
.qxa-web-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.qxa-web-item:hover .qxa-web-main b { color: var(--brand); }
.qxa-web-ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
}
.qxa-web-favicon { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }
.qxa-web-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.qxa-web-main b { font-size: 15px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.qxa-web-meta {
  font-size: 12px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.qxa-web-meta::after {
  content: "外部";
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 10px;
  line-height: 15px;
}
.qxa-web-snippet {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   二、商业推广（广告）：独立区块、显著标识、两位轮播
   ========================================================================== */

.qxa-ads {
  margin-top: 22px;
  padding: 14px 16px 16px;
  border: 1px solid color-mix(in srgb, var(--warn) 38%, var(--line));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--warn) 6%, var(--surface));
  box-shadow: var(--shadow-xs);
}
.qxa-ads-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.qxa-ads-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: .5px;
  color: var(--ink-2);
}
.qxa-ad-label {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.qxa-ads-note { font-size: 12px; color: var(--ink-3); }

.qxa-ad-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.qxa-ad-slot { min-width: 0; }
.qxa-ad-slot:empty { display: none; }

.qxa-ad {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: inherit;
  min-height: 96px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.qxa-ad:hover { border-color: var(--brand-300); box-shadow: var(--shadow-xs); }
.qxa-ad-flag {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 0 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--danger) 88%, #000);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  letter-spacing: 1px;
  font-weight: 700;
}
.qxa-ad-img { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--bg-mute); display: block; }
.qxa-ad-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qxa-ad-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-right: 44px; }
.qxa-ad-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.qxa-ad-desc {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.qxa-ad-host { margin-top: 2px; font-size: 11.5px; color: var(--ink-3); overflow-wrap: anywhere; }

/* ==========================================================================
   三、问答页：联网搜索开关 + 站内已有词条提示
   ========================================================================== */

.qxa-web-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.qxa-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.qxa-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.qxa-switch-ui {
  position: relative;
  width: 36px;
  height: 20px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  transition: background-color var(--t-fast) var(--ease);
}
.qxa-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform var(--t-fast) var(--ease);
}
.qxa-switch input:checked + .qxa-switch-ui { background: var(--brand); }
.qxa-switch input:checked + .qxa-switch-ui::after { transform: translateX(16px); }
.qxa-switch input:focus-visible + .qxa-switch-ui { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.qxa-switch-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.qxa-web-hint { font-size: 12px; color: var(--ink-3); }

/* 站内已有词条卡片（site.js 渲染到 #qaExisting） */
.qxa-strong { margin: 18px 0 0; }
.qxa-strong-card {
  padding: 16px 18px;
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--brand-50), var(--surface) 84%);
  box-shadow: var(--shadow-xs);
}
.qxa-strong-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 12px;
}
.qxa-strong-title {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
  margin-bottom: 6px;
}
.qxa-strong-title:hover { color: var(--brand); }
.qxa-strong-desc { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.qxa-strong-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
}
.qxa-strong-more .ico { width: 14px; height: 14px; }

/* ==========================================================================
   四、暗色皮肤微调
   ========================================================================== */

[data-skin="dark"] .qxa-ad-label {
  background: color-mix(in srgb, var(--danger) 78%, #000);
  color: #fff;
}
[data-skin="dark"] .qxa-ads {
  border-color: color-mix(in srgb, var(--warn) 34%, var(--line));
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
}
[data-skin="dark"] .qxa-ad { background: var(--surface); }
[data-skin="dark"] .qxa-sub { color: var(--brand-300); background: rgba(74, 158, 204, .14); }
[data-skin="dark"] .qxa-sub-web { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
[data-skin="dark"] .qxa-item-ico { background: rgba(74, 158, 204, .14); border-color: rgba(142, 200, 228, .28); color: var(--brand-300); }
[data-skin="dark"] .qxa-strong-card { background: linear-gradient(90deg, var(--brand-50), var(--surface) 84%); }
[data-skin="dark"] .qxa-switch-ui::after { background: #e8eff5; }

/* ==========================================================================
   五、移动端
   ========================================================================== */

@media (max-width: 960px) {
  .qxa-ad-slots { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .qxa { margin-top: 24px; }
  .qxa-block { padding: 14px; }
  .qxa-head h2 { font-size: 16px; }
  .qxa-note { display: none; }
  .qxa-item { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; }
  .qxa-item-ico { width: 30px; height: 30px; border-radius: 8px; }
  .qxa-ads { padding: 12px; }
  .qxa-ads-note { width: 100%; }
  .qxa-web-toggle { padding: 10px 12px; }
  .qxa-web-hint { width: 100%; padding-left: 44px; }
}

@media (max-width: 400px) {
  .qxa-ad { min-height: 0; padding: 10px 10px 10px 11px; }
  .qxa-ad-main { padding-right: 28px; }
  .qxa-strong-card { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .qxa-ad,
  .qxa-switch-ui,
  .qxa-switch-ui::after { transition: none !important; }
}
