/* ============================================================
   站群工具站 —— 公共基础样式（所有站点共用）
   说明：
   1. 整站配色由 CSS 变量 --brand / --accent 驱动，构建时按站点配置注入；
   2. 明亮 / 暗黑主题通过 <html data-theme="light|dark"> 切换；
   3. 布局使用 Flexbox 与 Grid，配合响应式断点适配手机端。
   ============================================================ */

/* ---------- 主题变量：明亮模式（默认） ---------- */
:root {
  --brand: #3498db;          /* 主色（由站点配置注入，此处为兜底） */
  --accent: #2ecc71;         /* 强调色（由站点配置注入，此处为兜底） */
  --bg: #f5f7fa;             /* 页面背景 */
  --fg: #1f2933;             /* 主要文字 */
  --card: #ffffff;           /* 卡片背景 */
  --muted: #6b7280;          /* 次要文字 */
  --border: #e5e7eb;         /* 描边 */
  --radius: 14px;            /* 圆角 */
  --shadow: 0 6px 20px rgba(17, 24, 39, 0.06); /* 卡片阴影 */
  --max-width: 1080px;       /* 内容最大宽度 */
}

/* ---------- 主题变量：暗黑模式 ---------- */
[data-theme="dark"] {
  --bg: #0f1419;
  --fg: #e6e9ef;
  --card: #171d25;
  --muted: #98a2b3;
  --border: #242c37;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* 页面纵向 Flex 布局：内容较短时让主体撑满屏幕，页脚始终贴在屏幕底部 */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* 通用容器：居中 + 左右留白 */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 18px;
}

/* ============================================================
   页头
   ============================================================ */
.site-header {
  position: sticky;               /* 吸顶，滚动时始终可见 */
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(8px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

/* 品牌区：Logo 方块 + 品牌名/标语 */
.brand { display: flex; align-items: center; gap: 10px; }

.brand__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-size: 16px; font-weight: 700; }
.brand__tagline { font-size: 12px; color: var(--muted); }

/* 顶部工具导航 */
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }

.site-nav__link {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
  transition: background .18s, color .18s;
}

.site-nav__link:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.site-nav__link.is-active { background: var(--brand); color: #fff; }

/* ============================================================
   页面主体
   ============================================================ */
.page {
  padding: 28px 18px 8px;
  /* 撑满页头与页脚之间的剩余空间，避免内容少的页面页脚悬在半空 */
  flex: 1 0 auto;
}

/* ---------- 首页首屏 ---------- */
.hero {
  padding: 28px 24px;
  margin-bottom: 22px;
  border-radius: var(--radius);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--brand) 12%, transparent),
      color-mix(in srgb, var(--accent) 10%, transparent));
  border: 1px solid var(--border);
}

.hero__title { margin: 0 0 10px; font-size: 28px; line-height: 1.35; }
.hero__intro { margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- 区块标题 ---------- */
.section-title { font-size: 18px; margin: 4px 0 16px; }

.tool-section { margin: 26px 0; }

/* ---------- 门户搜索框（仅主域门户首页使用） ---------- */
.portal-search { margin: 0 0 4px; }

/* 搜索框外壳：整块可点击聚焦，聚焦时高亮主色 */
.portal-search__box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .18s, box-shadow .18s;
}

.portal-search__box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.portal-search__icon { flex: none; color: var(--muted); }

/* 输入框：去掉边框与默认外观，与外壳融为一体 */
.portal-search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 15px;
}

.portal-search__input::placeholder { color: var(--muted); }

/* 隐藏浏览器自带的清空按钮，统一使用自绘按钮，保证各浏览器外观一致 */
.portal-search__input::-webkit-search-cancel-button { display: none; }

/* 自绘清空按钮 */
.portal-search__clear {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.portal-search__clear:hover { color: var(--fg); }

/* 无匹配结果提示 */
.portal-search__empty { margin: 12px 2px 0; font-size: 14px; color: var(--muted); }

/* 分类筛选胶囊：纯前端过滤子站卡片，选中态用品牌色 */
.portal-cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.portal-cats__btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.6;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.portal-cats__btn:hover { border-color: var(--brand); color: var(--brand); }
.portal-cats__btn.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }

/* 精选工具与下方全部站点之间留出节奏 */
.portal-featured { margin-top: 26px; }

/* hidden 属性必须显式生效：卡片与按钮自带 display 样式，会覆盖浏览器默认的 [hidden] 规则 */
.tool-card[hidden],
.portal-search__clear[hidden],
.portal-search__empty[hidden] { display: none; }

/* ---------- 工具卡片网格（Grid 自适应） ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .18s, border-color .18s;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
}

.tool-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
}

.tool-card__name { font-size: 16px; font-weight: 600; }
.tool-card__desc { font-size: 13px; color: var(--muted); }

/* ============================================================
   工具页
   ============================================================ */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb__sep { margin: 0 6px; }
.breadcrumb__current { color: var(--fg); }

.tool-head { margin-bottom: 18px; }
.tool-head__title { margin: 0 0 6px; font-size: 26px; }
.tool-head__desc { margin: 0; color: var(--muted); font-size: 14px; }

/* 主体两栏：左侧工具，右侧广告；窄屏时纵向堆叠 */
.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.tool-main {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* 右侧栏：桌面端整体吸顶，让购买入口与推荐位始终保持在视野内
   （窄屏时在下方响应式断点里恢复为普通布局） */
.tool-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;   /* 吸顶：工具内容滚动时右侧栏跟随停留在顶部 */
  top: 18px;          /* 与页面顶部留一点呼吸感 */
}

/* ============================================================
   通用表单控件（各工具模块复用）
   ============================================================ */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 6px;
  color: var(--fg);
}

.field-textarea,
.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.field-textarea:focus,
.field-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

/* 按钮组 */
.field-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.btn {
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .06s;
}

.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn--primary:hover { background: color-mix(in srgb, var(--brand) 85%, #000); color: #fff; }

/* 提示信息 */
.field-msg { min-height: 20px; margin: 6px 0; font-size: 13px; color: var(--muted); }
.field-msg.is-ok { color: var(--accent); }
.field-msg.is-err { color: #e74c3c; }

/* 统计数字卡片（字数统计等工具使用） */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.stat-card {
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-card__value { font-size: 20px; font-weight: 700; color: var(--brand); }
.stat-card__label { font-size: 12px; color: var(--muted); }

/* ============================================================
   广告位
   ============================================================ */
.ad-slot {
  margin: 18px 0;
  padding: 8px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px dashed var(--border);
}

.ad-slot--header { margin: 18px auto; max-width: var(--max-width); }

/* ============================================================
   用户反馈组件（页面底部，设计得低调一些，不打扰工具使用）
   ============================================================ */
.feedback {
  max-width: 560px;
  margin: 30px auto 4px;
  padding: 0 18px;
  text-align: center;
}

/* 第一屏：一句提问 + 两个评价按钮 */
.feedback__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.feedback__q { margin: 0; font-size: 13.5px; color: var(--muted); }

.feedback__actions { display: flex; gap: 8px; }

/* 胶囊按钮：与站点头部语言切换按钮风格保持一致 */
.feedback__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s, opacity .15s;
}

.feedback__btn:hover { border-color: var(--brand); color: var(--brand); }
.feedback__btn:disabled { opacity: .6; cursor: default; }

/* 主要按钮（提交）：用站点主色，视觉上明确「下一步」 */
.feedback__btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.feedback__btn--primary:hover { color: #fff; opacity: .88; }

/* 第二屏：可选留言表单 */
.feedback__form { margin-top: 12px; text-align: left; }

.feedback__text {
  width: 100%;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}

.feedback__text:focus { outline: none; border-color: var(--brand); }

.feedback__form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.feedback__err { margin: 8px 0 0; font-size: 12.5px; color: #d92d20; }

.feedback__done { margin: 0; font-size: 13.5px; color: var(--brand); }

/* hidden 属性显式生效：组件内多个元素自带 display，会覆盖浏览器默认的 [hidden] 规则 */
.feedback [hidden] { display: none; }

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  margin-top: 36px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  background: var(--card);
}

.site-footer__note { margin: 0 0 6px; }
.site-footer__copy { margin: 0; }

/* 页脚合规页链接：关于 / 隐私 / Cookie / 条款 / 联系，一行居中，窄屏自动换行 */
.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin: 0 0 16px;
}

.site-footer__link {
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
  transition: color .15s;
}

.site-footer__link:hover { color: var(--brand); }

/* ============================================================
   合规页（关于 / 隐私 / Cookie / 条款 / 联系）
   说明：正文以阅读为主，限制行宽、加大行高，长文档更好读
   ============================================================ */
.legal-page {
  max-width: 760px;
  margin: 0 auto;
}

.legal-page__title {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.25;
}

.legal-page__meta {
  margin: 0 0 22px;
  font-size: 12.5px;
  color: var(--muted);
}

.legal-page h2 {
  margin: 26px 0 10px;
  font-size: 17px;
  line-height: 1.35;
}

.legal-page p {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.75;
}

.legal-page ul {
  margin: 0 0 14px;
  padding-left: 20px;
}

.legal-page li {
  margin: 6px 0;
  font-size: 14.5px;
  line-height: 1.7;
}

.legal-page a { color: var(--brand); }

/* ============================================================
   联盟用品推荐位（工具页侧边栏）
   说明：与侧边广告位视觉分离，明确标注为商品推荐而不是工具功能
   ============================================================ */
.affiliate {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.affiliate__title {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.4;
}

.affiliate__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.affiliate__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-size: 13.5px;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}

.affiliate__item:hover { border-color: var(--brand); color: var(--brand); }

.affiliate__cta { flex: none; color: var(--muted); font-size: 13px; }
.affiliate__item:hover .affiliate__cta { color: var(--brand); }

/* 联盟披露文案：按平台要求必须可见，字号略小但不隐藏 */
.affiliate__note {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* ============================================================
   页头右侧操作区（工具导航 + 右上角语言切换按钮）
   ============================================================ */
.site-header__actions {
  display: flex;                                /* 导航与切换按钮同一行，右对齐 */
  align-items: center;
  gap: 16px;
}

/* 语言切换按钮（页头右上角，纯手动点击跳转到另一语言版本） */
.lang-switch {
  display: inline-flex;                          /* 内联胶囊按钮，跟随页头吸顶常驻 */
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  border: 1px solid var(--border);               /* 浅描边，与页头导航风格统一 */
  border-radius: 999px;                          /* 胶囊形，贴合现代应用观感 */
  background: var(--card);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;                           /* 避免窄屏被换行 */
  transition: transform .18s, background .18s, color .18s;
}

.lang-switch:hover { background: var(--brand); color: #fff; }
.lang-switch:active { transform: scale(0.96); }

/* ============================================================
   成交中心购买入口（工具页 CTA）
   说明：只在后台为该工具配置了付费商品时输出，因此默认不占版面
   ============================================================ */
.offer-cta {
  margin: 28px 0 0;                              /* 与工具主体拉开距离 */
  padding: 24px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* 用主色做极浅的渐变底，既有存在感又不抢工具本身的注意力 */
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand) 8%, var(--card)),
    color-mix(in srgb, var(--accent) 8%, var(--card)));
  box-shadow: var(--shadow);
  text-align: center;
}

.offer-cta__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--brand);
}

.offer-cta__title {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.4;
  color: var(--fg);
}

.offer-cta__desc {
  margin: 0 auto 18px;
  max-width: 620px;
  font-size: 14px;
  color: var(--muted);
}

/* 购买按钮：主色实心，足够大的点击区域 */
.offer-cta__btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .18s, background .18s;
}

.offer-cta__btn:hover { background: color-mix(in srgb, var(--brand) 85%, #000); color: #fff; }
.offer-cta__btn:active { transform: scale(0.97); }

/* 支付安全提示：降低下单顾虑，字号小但保持可读 */
.offer-cta__hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 右侧栏卡片形态 ----------
   桌面端：入口位于右侧栏首位，做成窄卡片，左对齐、按钮通栏，
   既不抢工具主体注意力，又能让人一眼看到价格和购买方式 */
.tool-side .offer-cta {
  margin: 0;                       /* 放在栏首，不需要与上方内容拉开距离 */
  padding: 18px 16px;
  text-align: left;                /* 窄卡片左对齐更接近大厂定价卡片的阅读习惯 */
}

.tool-side .offer-cta__eyebrow { margin-bottom: 6px; font-size: 11px; letter-spacing: .8px; }

.tool-side .offer-cta__title { margin-bottom: 6px; font-size: 17px; }

/* 窄栏里描述最多两三行，去掉原来的最大宽度限制 */
.tool-side .offer-cta__desc { margin: 0 0 14px; max-width: none; font-size: 13px; line-height: 1.6; }

/* 按钮通栏：在 300px 宽的栏里更醒目，点击区域也更大 */
.tool-side .offer-cta__btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  text-align: center;
  font-size: 14px;
}

.tool-side .offer-cta__hint { margin-top: 10px; font-size: 11px; line-height: 1.5; }

/* ============================================================
   响应式断点
   ============================================================ */
@media (max-width: 860px) {
  /* 工具页两栏在平板/手机上改为单栏，广告移到内容下方 */
  .tool-layout { grid-template-columns: 1fr; }
  /* 单栏后取消吸顶，否则右侧栏会浮动在工具上方挡住内容 */
  .tool-side { flex-direction: row; flex-wrap: wrap; position: static; top: auto; }
  /* 购买入口在手机上独占一行并恢复居中排版，观感与整宽卡片一致 */
  .tool-side .offer-cta { flex: 1 1 100%; text-align: center; padding: 20px 18px; }
  .tool-side .offer-cta__desc { margin-left: auto; margin-right: auto; max-width: 520px; }
  /* 单栏后侧边区域变宽，联盟推荐位独占一行，避免被挤成窄条 */
  .affiliate { flex: 1 1 100%; }
}

@media (max-width: 640px) {
  .site-header__inner { flex-direction: column; align-items: flex-start; padding: 10px 0; gap: 8px; }
  /* 手机上右侧操作区撑满一行：导航横向可滚动，语言按钮贴右 */
  .site-header__actions { width: 100%; }
  .site-nav { flex: 1; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .hero { padding: 20px 16px; }
  .hero__title { font-size: 22px; }
  .tool-head__title { font-size: 22px; }
}
