/* ============================================================
   PRIVAD 私有扩展商店 · 共用样式
   浅色海洋蓝视觉 | 单一 CSS 文件，无外部依赖
   ============================================================ */
:root {
  /* 品牌海洋蓝 */
  --primary: #0f4c81;
  --primary-dark: #0a2a52;
  --primary-mid: #1273b8;
  --primary-light: #e8f1fb;
  --primary-lighter: #f4f8fd;

  /* 中性 */
  --text: #1f2d3d;
  --text-strong: #14202e;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e9f1;
  --line-soft: #eef2f7;
  --bg: #eef2f7;
  --panel: #ffffff;

  /* 语义色 */
  --ok: #0b7a55;
  --ok-bg: #e2f6ee;
  --ok-bd: #bce8d6;
  --warn: #9a6206;
  --warn-bg: #fdf1dd;
  --warn-bd: #f3ddb0;
  --stop: #a32d2f;
  --stop-bg: #fcecec;
  --stop-bd: #f2c9ca;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15, 76, 129, .06), 0 8px 24px rgba(15, 76, 129, .06);
  --shadow-lg: 0 2px 6px rgba(15, 76, 129, .08), 0 16px 40px rgba(15, 76, 129, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

/* 内联 SVG 默认按容器撑满是常见的布局事故源（无 width/height 时会铺满整页），
   统一给一个默认尺寸，具体尺寸再由各自规则覆盖。 */
svg:not([width]) { width: 1em; height: 1em; flex: none; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: linear-gradient(120deg, #082443 0%, #0f4c81 62%, #1273b8 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(8, 36, 67, .18);
}
.topbar .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #fff;
  flex: none;
}
.brand img, .brand .mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  flex: none;
}
/* 品牌文字块。
   ⚠ 本 bug 的完整定位链（勿回退）：
      现象：块高 52.4px，实际内容仅 33px（.name 19.8+ .sub 12.6 + 间距 2），
            底部多出 18px 空白 → 几何中心对齐了，视觉上却没居中。
      试过且**无效**的方案：改 line-height（→52.4 变 49.5，量级不对）、
            align-self:center、flex:none、gap/margin 调整、块改 grid、.brand 改 grid/block。
      二分实测定位：块显式 height:34px + flex 列 + justify-content:center → 高度变 34px ✅
      根因：.name/.sub 作为块级子元素继承 body 的 line-height:1.65（约 29.7px），
            行盒高度远超实际字高，两行叠加后多出 18px，且位于底部。
      对策：给块一个与图标等高的固定高度（34px），用 flex + justify-content:center
            让两行文字在块内居中。固定高度同时规避了行盒残留问题。 */
/* 品牌文字块 —— 垂直居中修复（勿回退）。
   现象：文字中心在y=22，顶栏中心在 y=31，偏上9px，视觉上没居中。
   排查过的无效方案（高度恒为 52.4 或居中不生效）：
     align-items:center / flex:none / justify-content:center /
     gap / margin / align-self /块改 grid(align-content) / 块改 block。
   实测有效解法（三者对比）：
     块 display:flex + justify-content:center  → 中心 22  ❌
     块 display:grid + grid-template-rows:1fr 1fr + align-items:center → 中心 31.2  ✅
   原理：行高1.1 下两行文字的**行盒**在 flex 均分时仍按内容高堆叠在顶部，
   grid 的 1fr 1fr 会把34px 明确二等分，配合 align-items:center 才真正居中。 */
.brand > div {
  flex: none;
  height: 34px;                        /* 与图标等高 */
  display: grid;
  grid-template-rows: 1fr 1fr;         /* 明确二等分 */
  align-items: center;                 /* 每行内垂直居中 */
  line-height: 1.1;
}
.brand .name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .3px;
  line-height: 1.1;
  white-space: nowrap;
}
.brand .sub {
  font-size: 11.5px;
  color: #a9cbe8;
  line-height: 1.1;
  white-space: nowrap;
}
.topnav {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
}
.topnav a {
  color: #d3e5f5;
  text-decoration: none;
  font-size: 14px;
  padding: 7px 13px;
  border-radius: 8px;
  white-space: nowrap;      /* 导航项不折行 */
  transition: background .15s, color .15s;
}
.topnav a:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.topnav a.on { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 600; }

/* ---------------- 页头横幅 ---------------- */
.hero {
  background: linear-gradient(120deg, #082443 0%, #0f4c81 62%, #1273b8 100%);
  color: #fff;
  padding: 40px 0 38px;
}
.hero .wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.hero h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .4px;
  line-height: 1.25;
}
.hero p.lead {
  color: #c3dcf1;
  font-size: 15px;
  margin-top: 8px;
  max-width: 620px;
}
.hero .stats {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, .16);
}
.hero .stats div { min-width: 74px; }
.hero .stats b {
  display: block;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.hero .stats span {
  font-size: 12.5px;
  color: #a9cbe8;
}

/* ---------------- 容器 ---------------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.main { padding: 30px 0 70px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
h2 {
  font-size: 18.5px;
  font-weight: 600;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-strong);
}
h2 .bar { width: 4px; height: 19px; border-radius: 2px; background: var(--primary); flex: none; }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

/* ---------------- 搜索与筛选 ---------------- */
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
}
.search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted-light);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ---------------- 扩展卡片网格 ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
/* 扩展很少时（1~2 个），让卡片横向铺满而非挤在左侧留大片空白 */
.grid.count-1 { grid-template-columns: minmax(0, 1fr); }
.grid.count-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ext {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 21px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  position: relative;
}
.ext:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: #c3d9ef;
}
.ext .row1 { display: flex; gap: 13px; align-items: flex-start; }
.ext .ico {
  width: 54px; height: 54px;
  border-radius: 13px;
  flex: none;
  box-shadow: 0 3px 10px rgba(15, 76, 129, .16);
  object-fit: cover;
  background: var(--primary-light);
}
.ext .ico.ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 700;
  color: #fff;
}
.ext h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.ext .ver {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 7px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.ext .cat {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 1.5px 7px;
  border-radius: 6px;
}
.ext .desc {
  color: var(--muted);
  font-size: 13.8px;
  margin: 11px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 62px;
}
.ext .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--muted-light);
}
.ext .foot .tags {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.ext .foot .tags span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ext .foot .dl {
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.badge-star {
  position: absolute;
  top: 13px; right: 13px;
  background: linear-gradient(135deg, #f0a020, #e8890b);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 20px;
  box-shadow: 0 2px 6px rgba(232, 137, 11, .3);
}

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty svg { color: var(--line); margin-bottom: 14px; width: 46px; height: 46px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 5px; }

/* ---------------- 加载失败提示 ---------------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 15px 18px;
  font-size: 14px;
  border: 1px solid;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.alert .ic { flex: none; width: 19px; height: 19px; margin-top: 2px; }
.alert.ok { background: var(--ok-bg); border-color: var(--ok-bd); color: #075239; }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: #6b4604; }
.alert.stop { background: var(--stop-bg); border-color: var(--stop-bd); color: #7a2224; }
.alert.info { background: var(--primary-lighter); border-color: #cfe0f2; color: var(--primary-dark); }
.alert b { font-weight: 600; }

/* ---------------- 详情页 ---------------- */
.crumb {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.crumb a { color: var(--primary); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.crumb .sep { color: var(--muted-light); }

.dhead {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.dhead .ico {
  width: 74px; height: 74px;
  border-radius: 18px;
  flex: none;
  box-shadow: 0 4px 14px rgba(15, 76, 129, .2);
  object-fit: cover;
  background: var(--primary-light);
}
.dhead .ico.ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
}
.dhead .meta { flex: 1 1 260px; min-width: 0; }
.dhead h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dhead .pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.pill {
  font-size: 12.5px;
  padding: 3.5px 10px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}
.pill.gray { background: var(--line-soft); color: var(--muted); }
.dhead .desc {
  color: var(--muted);
  font-size: 14.5px;
  margin-top: 11px;
  max-width: 640px;
}

/* 下载区 */
.dlgrid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: stretch;
}
.dl {
  flex: 1 1 250px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  background: #fbfcfe;
  display: flex;
  flex-direction: column;
}
.dl.primary { border-color: var(--primary); background: var(--primary-light); }
.dl h3 {
  font-size: 15.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-strong);
}
.dl .m {
  font-size: 12.5px;
  color: var(--muted);
  margin: 5px 0 14px;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.btn {
  display: block;
  text-align: center;
  text-decoration: none;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 14.5px;
  font-weight: 600;
  margin-top: auto;
  transition: background .15s;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.dl.primary .btn { background: var(--primary); color: #fff; }
.dl.primary .btn:hover { background: var(--primary-dark); }
.dl .btn.ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.dl .btn.ghost:hover { background: var(--primary-light); }
.dl .rec {
  font-size: 12px;
  color: var(--muted);
  margin-top: 9px;
  text-align: center;
}

/* 步骤 */
ol.steps { counter-reset: s; list-style: none; padding: 0; }
ol.steps > li { counter-increment: s; position: relative; padding: 0 0 20px 44px; }
ol.steps > li::before {
  content: counter(s);
  position: absolute; left: 0; top: 1px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
ol.steps > li:last-child { padding-bottom: 0; }
ol.steps b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 3px; color: var(--text-strong); }
ol.steps p { color: var(--muted); font-size: 14px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f7f9fc; font-weight: 600; font-size: 13.5px; color: #43536a; }
tr:last-child td { border-bottom: none; }
td code { white-space: nowrap; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 列表（要点） */
ul.list { margin: 12px 0 0 20px; font-size: 14.5px; }
ul.list li { margin-bottom: 8px; }
ul.list li:last-child { margin-bottom: 0; }

/* FAQ */
details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: #fff;
  overflow: hidden;
}
details:last-child { margin-bottom: 0; }
summary {
  cursor: pointer;
  padding: 13px 17px;
  font-size: 15px;
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-strong);
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  width: 0; height: 0;
  flex: none;
  border-left: 6px solid var(--primary);
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  transition: transform .15s;
}
details[open] summary::before { transform: rotate(90deg); }
details[open] summary { border-bottom: 1px solid var(--line); }
.ans { padding: 14px 17px; color: #334155; font-size: 14.5px; }
.ans p { margin-bottom: 9px; }
.ans p:last-child { margin-bottom: 0; }

/* 代码 */
code, kbd {
  font-family: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1.5px 6px;
  color: var(--primary-dark);
  word-break: break-all;
}
kbd { background: #fff; font-size: 12.5px; box-shadow: 0 1px 2px rgba(0,0,0,.07); }
pre {
  background: #0d2137;
  color: #d7e6f5;
  border-radius: var(--radius-sm);
  padding: 14px 17px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.65;
  margin: 11px 0 0;
  font-family: "SF Mono", Consolas, "Liberation Mono", monospace;
}
pre .cmt { color: #7f9cba; }
pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  word-break: normal;
}

/* 更新历史 */
.hist { list-style: none; padding: 0; }
.hist li {
  padding: 0 0 16px 24px;
  border-left: 2px solid var(--line);
  position: relative;
  margin-left: 5px;
}
.hist li:last-child { border-left-color: transparent; padding-bottom: 0; }
.hist li::before {
  content: "";
  position: absolute;
  left: -6px; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.hist .v {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.hist .v .d { font-size: 12.5px; color: var(--muted-light); font-weight: 400; }
.hist ul { margin: 6px 0 0 18px; font-size: 13.8px; color: var(--muted); }
.hist ul li { border: none; padding: 0; margin: 0 0 3px; }
.hist ul li::before { display: none; }

/* 页脚 */
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 28px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 34px;
  line-height: 1.9;
}
.foot a { color: var(--primary); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot .flinks { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }

/* 响应式 */
@media (max-width: 720px) {
  .wrap { padding: 0 15px; }
  .hero { padding: 28px 0 26px; }
  /* 标题必须能换行 —— 否则窄视口下会被挤成逐字竖排 */
  .hero h1 { font-size: 22px; overflow-wrap: break-word; }
  .hero .lead { font-size: 14px; }
  .hero .stats { gap: 20px; }
  .hero .stats b { font-size: 19px; }
  .card { padding: 19px 17px; }
  .grid { grid-template-columns: 1fr; }
  .dhead h1 { font-size: 20px; overflow-wrap: break-word; }
  .dhead .ico { width: 60px; height: 60px; }
  .topbar .inner { height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .brand .sub { display: none; }
  .topnav a { padding: 6px 9px; font-size: 13px; }
  .ext .desc { min-height: 0; }
}

/* 窄屏（≤520px）：顶栏改为上下两行，导航独占一行并横向滚动。
   之前 6 个导航项挤在一行会把 hero 标题压成竖排。 */
@media (max-width: 520px) {
  .topbar .inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    height: auto;
  }
  .topnav {
    margin-left: 0;
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex: none; }
  .hero h1 { font-size: 20px; }
  .brand .name { font-size: 17px; }
  /* 卡片头部在极窄屏改为纵向，避免图标与标题互相挤压 */
  .dhead { gap: 12px; }
  .steps > li { padding-left: 34px; }
  ol.steps > li::before { width: 23px; height: 23px; font-size: 13px; }
  .copyrow { flex-direction: column; }
  .copybtn { padding: 9px 0; }
  .picker { gap: 8px; }
  .toolbar { gap: 10px; }
  table { font-size: 13px; }
}
