/* ============================================================
   PHPTS 多语言官网样式（自包含，不依赖任何外部主题 CSS）

   面向 41 种语言（含 ar / he / fa 的 RTL 与 de / fi / ru 的长词膨胀），
   四条硬约束：
   1) 方向相关属性一律用 CSS 逻辑属性（inline / block），RTL 自动镜像；
   2) 尺寸交给 flex / grid + clamp()，文案膨胀时换行而不是溢出、绝不重叠；
   3) 字体栈按文字系统用 :lang() 分派，覆盖 CJK / 天城 / 孟加拉 / 泰 / 老 / 缅 / 阿 / 希；
   4) 复杂文字单独抬高行高（--lh-*），避免上下文种被行框裁切。
   ============================================================ */

/* ---------------------------------------------------------- 1. 设计令牌 */
:root {
  --green: #009b4c;
  --green-dark: #007e3e;
  --ink: #232629;
  --ink-soft: #3c4247;
  --muted: #6b7178;
  --line: #e4e7ea;
  --bg: #f2f3f5;
  --bg-card: #fff;
  --footer-bg: #1f2326;
  --footer-fg: #b9bec3;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, .07);
  --shadow-lg: 0 10px 34px rgba(0, 0, 0, .10);

  --gutter: clamp(16px, 3vw, 24px);
  --maxw: 1170px;

  /* 行高：默认面向拉丁/西里尔；复杂文字在下面按语种抬高 */
  --lh-base: 1.7;
  --lh-tight: 1.28;

  /* 字体栈：先给通用回退，再按语种覆盖 */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, Tahoma, "Noto Sans", sans-serif;
}

/* ---------------------------------------------------------- 2. 各文字系统的字体栈与行高 */
html:lang(zh-CN) {
  --font-ui: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", system-ui, sans-serif;
  --lh-base: 1.85;
  --lh-tight: 1.35;
}

html:lang(zh-TW) {
  --font-ui: "Microsoft JhengHei UI", "Microsoft JhengHei", "PingFang TC",
    "Noto Sans TC", system-ui, sans-serif;
  --lh-base: 1.85;
  --lh-tight: 1.35;
}

html:lang(ja) {
  --font-ui: "Yu Gothic UI", "Meiryo", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Microsoft YaHei UI", system-ui, sans-serif;
  --lh-base: 1.85;
  --lh-tight: 1.35;
}

html:lang(ko) {
  --font-ui: "Malgun Gothic", "Noto Sans KR", "Microsoft YaHei UI", system-ui, sans-serif;
  --lh-base: 1.8;
  --lh-tight: 1.35;
}

/* 天城文（hi）与孟加拉文（bn）：元音符号上下都占空间，行高必须放宽 */
html:lang(hi) {
  --font-ui: "Nirmala UI", "Mangal", "Noto Sans Devanagari", "Segoe UI", sans-serif;
  --lh-base: 1.95;
  --lh-tight: 1.62;
}

html:lang(bn) {
  --font-ui: "Nirmala UI", "Vrinda", "Noto Sans Bengali", "Segoe UI", sans-serif;
  --lh-base: 2;
  --lh-tight: 1.65;
}

/* 泰文 / 老挝文：叠置元音与声调符号 */
html:lang(th) {
  --font-ui: "Leelawadee UI", "Tahoma", "Noto Sans Thai", "Segoe UI", sans-serif;
  --lh-base: 2;
  --lh-tight: 1.65;
}

html:lang(lo) {
  --font-ui: "Leelawadee UI", "Lao UI", Tahoma, "Noto Sans Lao", "Segoe UI", sans-serif;
  --lh-base: 2.1;
  --lh-tight: 1.7;
}

/* 缅文：字形在垂直方向堆叠最狠，行高取最大 */
html:lang(my) {
  --font-ui: "Myanmar Text", "Myanmar3", "Padauk", "Noto Sans Myanmar", "Segoe UI", sans-serif;
  --lh-base: 2.15;
  --lh-tight: 1.75;
}

/* 阿拉伯 / 波斯 / 希伯来：连写与上下标音 */
html:lang(ar),
html:lang(fa),
html:lang(he) {
  --font-ui: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Noto Sans Hebrew",
    "Arial", sans-serif;
  --lh-base: 1.95;
  --lh-tight: 1.5;
}

/* ---------------------------------------------------------- 3. 基础与重置 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-ui);
  line-height: var(--lh-base);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* 技术串（路径/版本号/邮箱/电话/URL）在 RTL 下保持 LTR，否则斜杠与点号会错位 */
html[dir="rtl"] :is(code, kbd, samp, .mono, .btn-sub, .note-ver, .note-date, .lang-cur, .tel, a[href^="mailto:"], a[href^="http"]) {
  direction: ltr;
  unicode-bidi: isolate;
}

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  line-height: var(--lh-tight);
  color: var(--ink);
  font-weight: 700;
}

p {
  margin: 0 0 1em;
}

p:last-child {
  margin-block-end: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  border: 0;
}

a {
  color: var(--green);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 显式跳过翻译/不需要阅读的内容 */
[hidden] {
  display: none !important;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------------------------------------------------------- 4. 按钮 */
.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  padding: 12px 26px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  line-height: var(--lh-tight);
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.btn:hover {
  text-decoration: none;
}

.btn-lg {
  padding: 15px 32px;
  font-size: 17px;
}

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

.btn-primary:hover {
  background: var(--green-dark);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--green);
  border-color: currentColor;
}

/* 悬停必须连 color 一起写：只写 background 的话，一旦元素同时带了 .btn-primary，
   它的 :hover 会把 color 定成白色，浅绿底 + 白字就看不清了（两者特异性相同，
   谁生效取决于书写顺序，不能依赖）。这里写成自足的，不依赖类组合。 */
.btn-ghost:hover {
  background: rgba(0, 155, 76, .07);
  color: var(--green);
}

.btn-sub {
  font-size: 12px;
  font-weight: 400;
  opacity: .85;
}

/* ---------------------------------------------------------- 5. 顶部导航 */
/* 导航不固定：随页面滚动一起走（原来 position: sticky 会一直压在顶部、
   在窄屏展开菜单时还会遮住正文）。若将来要恢复固定，注意给 .nav-collapse
   展开态留出高度，否则移动端菜单会被导航自身裁掉。 */
.site-nav {
  position: relative;
  z-index: 100;
  background: #fff;
  border-block-end: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  min-height: 68px;
  padding-block: 8px;
}

/* 品牌：非中文页用纯文字标识，避免图片里的中文出现在外语页面 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

/* 应用图标（绿色圆角方图，1024×1024 原图，交给浏览器缩放） */
.brand-icon {
  display: block;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 9px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .4px;
  line-height: 1.15;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.2;
  direction: ltr;
  unicode-bidi: isolate;
}

.brand-logo {
  display: block;
  height: 42px;
  width: auto;
}

.nav-toggle {
  display: none;
  margin-inline-start: auto;
  padding: 9px 10px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle .bar {
  display: block;
  width: 20px;
  height: 2px;
  margin-block: 4px;
  background: var(--ink);
}

.nav-collapse {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
}

.nav-list > li {
  position: relative;
}

.nav-list a {
  display: inline-block;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  text-decoration: none;
  white-space: normal;
}

.nav-list a:hover {
  color: var(--green);
  text-decoration: none;
}

/* 下拉：默认收起，hover / 键盘聚焦 / 触屏点击展开 */
.nav-dd-toggle::after {
  content: "▾";
  margin-inline-start: 6px;
  font-size: 10px;
  color: var(--muted);
}

.submenu {
  position: absolute;
  inset-block-start: 100%;
  inset-inline-start: 0;
  z-index: 110;
  min-width: 230px;
  max-width: min(90vw, 340px);
  padding: 8px 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}

.nav-dd:hover > .submenu,
.nav-dd:focus-within > .submenu,
.nav-dd.open > .submenu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.submenu li {
  position: relative;
}

.submenu a {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  white-space: normal;
}

.submenu .nav-dd-toggle::after {
  content: "▸";
}

html[dir="rtl"] .submenu .nav-dd-toggle::after {
  content: "◂";
}

/* 二级下拉向左展开，避免贴到视口右侧被裁掉 */
.submenu .submenu {
  inset-block-start: -9px;
  inset-inline-start: 100%;
}

/* ---------------------------------------------------------- 6. 语言选择器 */
.lang-form {
  margin: 0;
  flex: none;
}

.lang-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(260px, 60vw);
  padding: 7px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}

.lang-pill:hover {
  border-color: var(--green);
  color: var(--green);
}

.lang-globe,
.lang-caret {
  flex: none;
}

/* 语言名按语种膨胀（「Bahasa Indonesia」远长于「English」），一律省略号收口 */
.lang-cur {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 透明原生 select 覆盖整个胶囊：选项列表交给系统绘制，任何语言都不溢出、可键盘操作 */
.lang-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.lang-fallback {
  display: none;
  margin-block-start: 8px;
}

/* ---------------------------------------------------------- 7. 首屏 */
/* 背景是「白 → 浅灰 → 白」的三段渐变，不是「白 → 浅灰」：
   下一区块（.section-plain）是纯白，若首屏以灰色收尾，两者就在分界处硬碰成一条直线，
   看起来像图片被切掉。现在底部渐隐回白，同时留出下内边距让背景延伸到图片下方，
   过渡就化开了。灰色峰值取 52%，正好落在选项卡与截图那一带的背后。 */
.hero {
  padding-block: clamp(40px, 7vw, 72px) clamp(48px, 7vw, 88px);
  background: linear-gradient(#fff 0%, var(--bg) 52%, #fff 100%);
}

/* 标题与按钮居中；导语段落（.hero-intro）不居中、不限宽，
   直接占满 .container，与下方选项卡说明段落（.tab-panels > p）左右边界一致。 */
.hero-text {
  margin-inline: auto;
  text-align: center;
}

.hero h1 {
  font-size: clamp(27px, 4.6vw, 46px);
  margin-block-end: .4em;
}

/* 首屏导语：左对齐（RTL 自动镜像为右对齐），首行缩进两格（2em = 两个汉字宽）。
   宽度交给 .hero-text（已取消 880px 限宽），故这里只需覆盖对齐、缩进与自动外边距。 */
.hero-intro {
  text-align: start;
  text-indent: 2em;
  margin-inline: 0;
}

/* 第二、三段首屏导语：按产品要求与下方选项卡说明段落（.tab-panels p，15px）同字号 */
.lead.hero-intro-compact {
  font-size: 15px;
}

.lead {
  font-size: clamp(15px, 1.7vw, 18px);
  color: var(--muted);
  margin-inline: auto;
  margin-block-end: 1.6em;
}

.lead .hl {
  color: var(--green);
  font-weight: 700;
}

/* 首屏第三段改为模块清单：标题保持导语样式，条目逐行排列（emoji 图标 + 文本） */
.lead.hero-feature-title {
  margin-block-end: .6em;
}

.hero-feature-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  text-align: start;
}

.hero-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.hero-feature-list .ico {
  flex: none;
  width: 1.5em;
  text-align: center;
  line-height: inherit;
}

.hero-feature-list li > span:last-child {
  min-width: 0;
}

/* 模块清单右侧配竖版插图（2026-11-28）：
   宽屏两栏——文字在左、插图在右并与之同顶；窄屏回落单栏，图排在清单下方并限宽居中。
   插图是两张轮播（事件触发任务 / 独家自研模块），容器定 2:3 比例，切换时不引起回流。 */
.hero-feature-split {
  display: grid;
  gap: 0 clamp(18px, 2.4vw, 32px);
  align-items: start;
}

.hero-feature-figure {
  margin: 0;
  margin-block-start: clamp(16px, 2vw, 24px);
  align-self: center;
}

.hero-carousel {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  aspect-ratio: 2 / 3;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .7s ease;
}

.hero-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.hero-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 90, 55, .16);
  cursor: zoom-in;
}

/* 轮播圆点：当前张拉长成小胶囊，颜色取站内主绿 */
.hero-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-block-start: 10px;
}

.hero-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: rgba(12, 157, 104, .3);
  cursor: pointer;
  transition: width .25s ease, background-color .25s ease;
}

.hero-dots button:hover {
  background: rgba(12, 157, 104, .55);
}

.hero-dots button.is-active {
  width: 22px;
  background: var(--green);
}

.hero-dots button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

@media (min-width: 901px) {
  .hero-feature-split {
    grid-template-columns: minmax(0, 1fr) clamp(260px, 27vw, 310px);
  }

  /* 插图与左侧第二段导语同顶对齐，纵向占满「导语 + 小标题 + 清单」三行 */
  .hero-feature-split .hero-feature-figure {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin-block-start: 0;
    align-self: start;
  }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

/* ---------------------------------------------------------- 8. 图文分栏（全宽截图 + 下方横向选项卡） */
/* 截图占满整行，与顶部导航内容同宽；文字选项移到截图下方做成选项卡。
   选项卡用 grid 而不是居中的 flex-wrap：这些标签本身是整句，de/ru/fi 等语言膨胀后
   居中换行会退化成一行一个（俄语实测 5 行），grid 的列宽固定，换行发生在列内，
   行数可预测（一般 2 行），也更整齐。 */
.showcase {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vw, 26px);
  margin-block-start: clamp(32px, 5vw, 56px);
}

.showcase-tabs {
  width: 100%;
  min-width: 0;
}

.tab-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 8px;
}

.tab-strip li a {
  display: block;
  height: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
}

.tab-strip li a:hover {
  border-color: var(--green);
  color: var(--green);
  text-decoration: none;
}

.tab-strip li.active a {
  background: rgba(0, 155, 76, .08);
  border-color: var(--green);
  color: var(--green);
}

/* 当前选项的说明段落。
   不设 max-width：要与上方选项卡、下方截图同宽（此前限宽 920px 居中，
   两侧比选项卡窄出一截，看起来像「文字块被缩进去了」）。 */
.tab-panels {
  margin-block-start: clamp(16px, 2vw, 22px);
}

.tab-panels > * {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  text-align: start;
}

.tab-panels > .active {
  display: block;
}

/* 首屏选项卡说明段落：首行缩进两格（与首屏导语口径一致） */
.hero .tab-panels > p {
  text-indent: 2em;
}

/* PHPTS 专有 PHP 扩展：功能简介 + 函数签名/作用/参数 + 用法示例（代码块锁定 LTR，RTL 语种不镜像） */
.ext-intro {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.ext-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.ext-api {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.ext-api li {
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.ext-api li > code {
  display: block;
  margin-block-end: 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  direction: ltr;
  unicode-bidi: isolate;
  overflow-wrap: anywhere;
}

.ext-api li > p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
  unicode-bidi: plaintext;
}

.ext-code {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: #1f2430;
  color: #e8e8e8;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.65;
  text-align: start;
  direction: ltr;
  unicode-bidi: isolate;
}

.ext-code code {
  font-family: Consolas, "Courier New", monospace;
  white-space: pre;
}

/* 截图卡：图片按原始比例铺满整宽。
   这里**不能**给 .shot-frame 设固定 aspect-ratio：几张界面截图比例并不一致
   （1.30 ~ 1.65），固定 3:2 + object-fit:contain 会在顶栏下方留出一条浅色空带
   （看起来像「横框下有空隙」）。改为由图片自身决定高度，既无留白也不裁内容。
   选项与说明都在图片**上方**，所以切换选项时行高变化不会带动选项位置。 */
.shot {
  width: 100%;
  overflow: hidden;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.shot-chrome {
  display: flex;
  gap: 5px;
  padding: 11px 14px;
  border-block-end: 1px solid var(--line);
}

.shot-chrome span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dfe2e5;
}

.shot-frame {
  background: var(--bg-card);
  line-height: 0;
}

.shot-frame img {
  display: none;
  width: 100%;
  height: auto;
}

.shot-frame img.active {
  display: block;
}

/* ---------------------------------------------------------- 9. 区块与卡片网格 */
.section {
  padding-block: clamp(44px, 6vw, 72px);
}

.section-alt {
  background: var(--bg);
}

.section-plain {
  background: #fff;
}

.section-head {
  max-width: 820px;
  margin-inline: auto;
  margin-block-end: clamp(28px, 4vw, 44px);
  text-align: center;
}

.section-head h2 {
  font-size: clamp(23px, 3vw, 32px);
  margin-block-end: .35em;
}

.section-head .lead {
  font-size: 17px;
  margin-block-end: 0;
}

/* 「PHPTS 套件集成服务」导语：标题仍居中，导语左对齐、不限宽，
   左右边界与下方卡片网格一致，首行缩进两格。 */
.section-head-start {
  max-width: none;
}

.section-head-start .lead {
  text-align: start;
  text-indent: 2em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: clamp(18px, 2.4vw, 28px);
}

.card {
  padding: 26px 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.card h3 {
  font-size: 18px;
  margin-block: 14px 8px;
}

.card p {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0;
}

.card img {
  border-radius: 8px;
}

/* 图标 + 文字的横向卡片（内置工具区 / 左右分栏列表） */
.card-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  text-align: start;
}

.card-row > img {
  flex: none;
}

.card-row h3 {
  margin-block-start: 0;
}

/* 独家自研模块：按「服务 / 工具 / 调试助手 / 客户端」分组，
   每组标题 + 3 列（桌面）→ 2 列 → 1 列的自适应卡片；截图按原始比例撑满卡片宽度，不裁切。 */
.module-group + .module-group {
  margin-block-start: clamp(28px, 3.5vw, 44px);
}

.module-group > h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 14px;
  letter-spacing: .08em;
  color: var(--muted);
}

.module-group > h3::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--green);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  gap: clamp(16px, 2vw, 24px);
}

.module-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 20px -14px rgba(16, 24, 40, .16);
  text-align: start;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: #cfe3d8;
  box-shadow: 0 2px 4px rgba(16, 24, 40, .05), 0 14px 28px -16px rgba(16, 24, 40, .22);
}

.module-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  height: auto;
  object-fit: contain;
  object-position: center;
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
  border-block-end: 1px solid var(--line);
  cursor: zoom-in;
}

.module-body {
  flex: 1 1 auto;
  padding: 15px 17px 18px;
  /* 截图下方文字区加淡灰渐变底，与白色截图区分开；flex 撑满，同排卡片不会露出白底 */
  background: linear-gradient(180deg, #f8fafb, #f3f6f8);
}

.module-body h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 7px;
  font-size: 15.5px;
  color: var(--ink);
}

/* 标题前的品牌绿短条，与区块小标题的绿竖条呼应 */
.module-body h4::before {
  content: "";
  flex: none;
  inline-size: 3px;
  block-size: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #17ad78, #0a6a4a);
}

.module-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

/* 内置工具：图标 + 文字卡片列表 */
.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(20px, 3.4vw, 36px);
}

.tools-list {
  flex: 1 1 380px;
  min-width: 0;
  display: grid;
  gap: 18px;
}

/* 放大层：点击截图后全屏查看，点任意处或按 Esc 关闭 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 40px);
  background: rgba(0, 0, 0, .86);
  cursor: zoom-out;
  line-height: 0;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.lightbox-close {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-end: 16px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 22px;
  line-height: 40px;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, .3);
}

/* ---------------------------------------------- 9.1 事件驱动 PHP 方案对比 */
/* 白底区块（与全站灰白相间节奏一致）；表格与优势卡沿用站点卡片语言
   （白卡 + var(--line) 描边 + 站点阴影），仅 PHPTS 列保留品牌绿高亮；
   桌面端整表铺满容器，窄屏转为横向滚动 + 首列吸附。 */
.cmp-kicker {
  margin-block-end: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .38em;
  text-transform: uppercase;
  color: var(--muted);
}

/* 区块内小标题（关键维度对照 / 六大核心优势）：品牌绿竖条 + 标题 */
.cmp-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.cmp-sub::before {
  content: "";
  flex: none;
  inline-size: 5px;
  block-size: 18px;
  border-radius: 3px;
  background: linear-gradient(180deg, #17ad78, #0a6a4a);
}

/* 六方案架构卡：事件源 → 引擎调度 → PHP 形态，左右与下方矩阵表严格对齐 */
.cmp-cards {  display: grid;
  grid-template-columns: minmax(268px, 1.5fr) repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-block-end: 20px;
}

.cmp-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.cmp-card-us {
  border: 1.5px solid #17ad78;
  box-shadow: 0 10px 26px rgba(11, 122, 82, .14);
}

.cmp-card-head {
  margin-inline: -10px;
  padding: 12px 14px 10px;
  border-block-end: 1px solid var(--line);
}

.cmp-card-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}

.cmp-card-head p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

/* 主角卡头：品牌绿渐变 + 免 WSL 徽标 */
.cmp-card-us .cmp-card-head {
  position: relative;
  border-radius: 12.5px 12.5px 0 0;
  border-block-end: 0;
  padding: 14px 14px 12px;
  background: linear-gradient(150deg, #0a6a4a 0%, #0f9066 42%, #17ad78 72%, #0b7d57 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}

.cmp-card-us .cmp-card-head h3 {
  color: #fff;
  font-size: 15px;
  padding-inline-end: 56px;
  white-space: nowrap;
}

.cmp-card-us .cmp-card-head p {
  color: #c4ffe0;
}

.cmp-badge {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(166, 255, 208, .6);
  background: rgba(255, 255, 255, .16);
  color: #eafff4;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* 三级流程 */
.cmp-flow {
  display: flex;
  flex-direction: column;
  padding-block-start: 10px;
}

.cmp-stage {
  padding: 8px 9px;
  border: 1px solid #e7ebee;
  border-radius: 10px;
  background: #f7f9fa;
  text-align: center;
}

.cmp-stage-k {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #6b7178;
}

.cmp-stage strong {
  display: block;
  margin-block-start: 3px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink-soft);
}

.cmp-stage-d {
  display: block;
  margin-block-start: 2px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--muted);
}

.cmp-card-us .cmp-stage {
  border-color: #cde9da;
  background: #f2fbf6;
}

.cmp-card-us .cmp-stage-k {
  color: #3f8a66;
}

.cmp-card-us .cmp-stage strong {
  color: var(--green-dark);
  font-weight: 800;
}

/* 向下箭头 */
.cmp-arrow {
  position: relative;
  height: 14px;
  flex: 0 0 14px;
}

.cmp-arrow::before {
  content: "";
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 50%;
  width: 0;
  height: 0;
  border-inline: 4.5px solid transparent;
  border-block-start: 7px solid #2bbd85;
}

/* 关键事实 */
.cmp-facts {
  margin-block-start: 10px;
  padding-block-start: 9px;
  border-block-start: 1px dashed var(--line);
}

.cmp-facts-k {
  display: block;
  margin-block-end: 5px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #6b7178;
}

.cmp-facts ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cmp-facts li {
  position: relative;
  padding-inline-start: 10px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--muted);
}

.cmp-facts li + li {
  margin-block-start: 3px;
}

.cmp-facts li::before {
  content: "";
  position: absolute;
  inset-block-start: .55em;
  inset-inline-start: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #2bbd85;
}

/* 主角卡四枚能力芯片 */
.cmp-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-block-start: 10px;
  padding: 0;
  list-style: none;
}

.cmp-chips li {
  padding: 8px 9px;
  border: 1px solid #d5ece0;
  border-radius: 9px;
  background: #f4fbf7;
}

.cmp-chips strong {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1.4;
}

.cmp-chips span {
  display: block;
  margin-block-start: 2px;
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* 中等屏：三列两行，主角卡整行横排 */
@media (max-width: 1100px) {
  .cmp-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cmp-card-us {
    grid-column: 1 / -1;
  }

  .cmp-card-us .cmp-flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .cmp-card-us .cmp-arrow {
    display: none;
  }

  .cmp-card-us .cmp-chips {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* 优势卡一行六列放不下，折为三列 */
  .cmp-wins {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 平板竖屏 / 手机：两列与单列 */
@media (max-width: 780px) {
  .cmp-kicker {
    font-size: 11px;
    letter-spacing: .2em;
  }

  .cmp-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cmp-card-us .cmp-flow {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .cmp-card-us .cmp-arrow {
    display: block;
  }

  .cmp-card-us .cmp-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cmp-wins {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .cmp-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .cmp-wins {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 表格外壳 */
.cmp-scroll {
  position: relative;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  -webkit-overflow-scrolling: touch;
}

.cmp-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: transparent;
  font-size: 13px;
  line-height: 1.55;
}

.cmp-table th,
.cmp-table td {
  padding: 13px 15px;
  text-align: start;
  vertical-align: top;
  border-block-start: 1px solid var(--line);
}

/* 表头名称一律用显式 span 承载，避免继承样式导致文字不显示 */
.cmp-table thead th .cmp-th-t {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.cmp-table thead th {
  position: relative;
  padding-block: 15px;
  border-block-start: 0;
  border-block-end: 1px solid var(--line);
  background: #f6f7f8;
  white-space: nowrap;
}

.cmp-table thead th.cmp-dim {
  width: 126px;
}

.cmp-table thead th.cmp-dim .cmp-th-t {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
}

/* PHPTS 表头：品牌绿渐变 + 内高光 */
.cmp-table thead th.cmp-us {
  background: linear-gradient(150deg, #0a6a4a 0%, #0f9066 42%, #17ad78 72%, #0b7d57 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -14px 24px rgba(3, 60, 39, .25);
  white-space: normal;
}

.cmp-us-name {
  display: block;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  text-shadow: 0 1px 6px rgba(3, 60, 39, .45);
}

.cmp-us-tag {
  display: block;
  margin-block-start: 3px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  color: #c4ffe0;
}

/* 首列：维度名 */
.cmp-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 2;
  background: var(--bg-card);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: normal;
}

.cmp-table tbody th::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-end: -1px;
  width: 1px;
  background: var(--line);
}

.cmp-table tbody tr:hover td,
.cmp-table tbody tr:hover th {
  background: #fafbfc;
}

.cmp-table td strong,
.cmp-table td span {
  display: block;
}

.cmp-table td strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.cmp-table td span {
  margin-block-start: 3px;
  font-size: 12px;
  color: var(--muted);
}

/* 风险等级徽标：低 / 需关注 / 中 / 高 / 传统低 / Worker 中 */
.cmp-pill {
  display: inline-block;
  margin-inline-end: 4px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.65;
  vertical-align: 1px;
  white-space: nowrap;
}

.cmp-pill-low {
  background: #e6f7ef;
  border-color: #bfe8d7;
  color: #0a7a52;
}

.cmp-pill-warn {
  background: #fff5e4;
  border-color: #f2ddb5;
  color: #8a5a00;
}

.cmp-pill-high {
  background: #fdecea;
  border-color: #f5c8c4;
  color: #b3261e;
}

/* PHPTS 列底色偏绿，绿徽标加深一档保持对比 */
.cmp-table td.cmp-us .cmp-pill-low {
  background: #d8f3e6;
  border-color: #a9dfc7;
  color: #07603f;
}

/* PHPTS 整列：浅绿高亮 + 左右描边 */
.cmp-table tbody td.cmp-us {
  position: relative;
  background: #f2fbf6;
  box-shadow: inset 1px 0 0 #cde9da, inset -1px 0 0 #cde9da;
}

.cmp-table tbody tr:hover td.cmp-us {
  background: #e9f8f0;
}

.cmp-table tbody td.cmp-us strong {
  color: var(--green-dark);
  font-weight: 700;
}

/* 表尾行圆角收边 */
.cmp-table tbody tr:last-child th {
  border-end-start-radius: 8px;
}

.cmp-table tbody tr:last-child td:last-child {
  border-end-end-radius: 8px;
}

/* 六条核心优势：站点白卡 + 品牌绿编号球 */
.cmp-wins {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: clamp(20px, 2.8vw, 28px) 0 0;
  padding: 0;
  list-style: none;
}

.cmp-wins li {
  position: relative;
  display: block;
  padding: 14px 14px 15px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}

.cmp-wins li:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cmp-win-n {
  position: absolute;
  inset-block-start: 13px;
  inset-inline-start: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(150deg, #17ad78, #0a6a4a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 3px 8px rgba(11, 122, 82, .35);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
}

.cmp-wins strong {
  display: block;
  padding-inline-start: 29px;
  margin-block-end: 5px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.cmp-wins li div > span {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------------------------------------------------------- 11. 底部行动区 */
.cta-band {
  padding-block: clamp(40px, 5vw, 56px);
  background: var(--green);
  color: #fff;
  text-align: center;
}

.cta-band h2 {
  max-width: 900px;
  margin-inline: auto;
  margin-block-end: 1.2em;
  color: #fff;
  font-size: clamp(19px, 2.6vw, 26px);
  font-weight: 500;
}

.cta-band .btn-ghost {
  color: #fff;
  border-color: #fff;
}

.cta-band .btn-ghost:hover {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

/* ---------------------------------------------------------- 12. 页脚 */
.site-footer {
  padding-block: clamp(40px, 5vw, 56px) 24px;
  background: var(--footer-bg);
  color: var(--footer-fg);
  font-size: 14.5px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 32px;
}

.site-footer h3 {
  margin-block-end: 1em;
  color: #fff;
  font-size: 16px;
}

.site-footer li {
  margin-block-end: 9px;
}

.site-footer a {
  color: var(--footer-fg);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
}

.footer-about p {
  margin-block-end: 0;
}

.footer-about :is(a, code, .tel) {
  unicode-bidi: isolate;
}

.copyright {
  margin-block-start: 36px;
  padding-block-start: 20px;
  border-block-start: 1px solid #34393d;
  color: #82888e;
  text-align: center;
}

/* ---------------------------------------------------------- 13. 更新记录页（notes） */
/* 一个版本一张卡片：与首页同一套白底卡片 + 绿色强调；条目为纯文本，长文案靠 flex 换行 */
.notes {
  display: grid;
  gap: clamp(16px, 2vw, 22px);
  max-width: 900px;
  margin-inline: auto;
}

.note {
  padding: clamp(18px, 2.4vw, 26px) clamp(18px, 2.6vw, 30px);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* 版本号 + 日期：窄屏放不下时换行，不挤压、不溢出 */
.note-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-block: 0 12px;
  padding-block-end: 12px;
  border-block-end: 1px solid var(--line);
}

.note-ver {
  color: var(--green);
  font-size: clamp(18px, 2vw, 21px);
}

.note-date {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.note-list {
  display: grid;
  gap: 8px;
}

.note-list li {
  display: flex;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 15px;
}

/* 圆点跟着语种行高走（--lh-base 在 hi/th/lo/my 里被抬高），始终对齐首行中线 */
.note-list li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-block-start: calc(var(--lh-base) * .5em - 3px);
  border-radius: 50%;
  background: var(--green);
}

/* 接口取不到时的兜底入口 */
.notes-fallback {
  text-align: center;
}

/* ---------------------------------------------------------- 13.1 WebSocket 在线测试（websocket） */
/* 两栏：左侧上下为连接配置 + 发送消息，右侧为消息记录；记录面板跟随左栏高度铺满 */
.ws-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 22px);
  align-items: stretch;
}

.ws-col {
  display: grid;
  gap: clamp(16px, 2vw, 22px);
  align-content: start;
  min-width: 0;
}

.ws-panel {
  min-width: 0;
  padding: clamp(18px, 2.4vw, 26px);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.ws-panel h3 {
  margin-block: 0 16px;
  font-size: 17px;
}

/* 右侧记录框不参与网格行高计算：外层撑满左栏高度，内层绝对定位铺满，
   记录再多也只在 .ws-log 内部滚动，不把整页拉长 */
.ws-log-wrap {
  position: relative;
  min-width: 0;
}

.ws-panel-log {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ws-field {
  display: grid;
  gap: 6px;
  margin-block-end: 14px;
}

.ws-field label {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

/* 标签行：标签 + 一键填入等轻量操作，窄屏自动换行 */
.ws-label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

.ws-linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font: inherit;
  font-size: 13px;
  line-height: inherit;
  text-align: start;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.ws-linkbtn:hover {
  color: var(--green-dark);
}

/* 括号本身保持正文黑色、不可点击，只有括号内的文字是绿色链接 */
.ws-fill-hint {
  font-size: 13px;
  white-space: nowrap;
}

.ws-input,
.ws-textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
}

.ws-input:focus,
.ws-textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 155, 76, .14);
}

.ws-textarea {
  min-height: 150px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13.5px;
  line-height: 1.6;
}

.ws-number {
  width: 88px;
}

.ws-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ws-actions .btn {
  padding: 9px 16px;
  font-size: 14.5px;
}

.ws-actions-end {
  margin-block-start: 14px;
}

.ws-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
}

.ws-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.ws-unit {
  color: var(--muted);
  font-size: 14px;
}

/* 状态灯：颜色只表达状态，文案始终同时在旁边显示，不单靠颜色传达信息 */
.ws-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.ws-status i {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: #c3c8cd;
}

.ws-status[data-state="connecting"] i {
  background: #d99b00;
}

.ws-status[data-state="open"] {
  color: var(--green-dark);
}

.ws-status[data-state="open"] i {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 155, 76, .13);
}

.ws-status[data-state="closed"] i {
  background: #9aa1a8;
}

.ws-status[data-state="error"] {
  color: #c0392b;
}

.ws-status[data-state="error"] i {
  background: #c0392b;
}

.ws-hint {
  margin-block: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.ws-templates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block-start: 14px;
}

.ws-templates-label {
  color: var(--muted);
  font-size: 13px;
}

.ws-chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ws-chip:hover {
  border-color: var(--green);
  color: var(--green);
}

.ws-log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-block-end: 12px;
}

.ws-log-head h3 {
  margin: 0;
}

.ws-counters {
  color: var(--muted);
  font-size: 13.5px;
}

.ws-counters b {
  color: var(--ink);
  font-size: 15px;
}

.ws-sep {
  margin-inline: 4px;
}

.ws-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-inline-start: auto;
}

.ws-filter {
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ws-filter:hover {
  border-color: var(--green);
  color: var(--green);
}

.ws-filter.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.ws-clear {
  padding: 6px 16px;
  font-size: 13px;
}

.ws-log {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 6px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.ws-row {
  min-width: 0;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid #eef0f2;
  border-radius: 6px;
}

.ws-row-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 10px;
  color: var(--muted);
  font-size: 12px;
}

.ws-row-kind {
  font-weight: 700;
}

.ws-row-send .ws-row-kind {
  color: #0b63c5;
}

.ws-row-recv .ws-row-kind {
  color: var(--green-dark);
}

/* 消息体可能是 JSON（LTR）也可能是阿拉伯文/希伯来文（RTL）：
   unicode-bidi: plaintext 按每行首个强字符决定方向，两种都正确 */
.ws-row-body {
  margin-block-start: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

.ws-empty {
  padding-block: 48px;
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.ws-about {
  max-width: 900px;
  margin-inline: auto;
  margin-block-start: clamp(30px, 4vw, 46px);
  padding-block-start: clamp(22px, 3vw, 32px);
  border-block-start: 1px solid var(--line);
}

.ws-about h3 {
  font-size: 19px;
}

.ws-about p {
  color: var(--ink-soft);
  font-size: 15px;
}

.ws-features {
  display: grid;
  gap: 8px;
}

.ws-features li {
  display: flex;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 15px;
}

.ws-features li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-block-start: calc(var(--lh-base) * .5em - 3px);
  border-radius: 50%;
  background: var(--green);
}

/* ---------------------------------------------------------- 13.2 串口调试助手（serialport） */
/* 复用 13.1 的工具布局，只补串口参数表单与下拉框 */
.ws-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.ws-select {
  cursor: pointer;
}

.ws-select-inline {
  width: auto;
  min-width: 92px;
  padding-block: 6px;
}

.ws-port-info {
  margin-block: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

/* 串口名可能是 USB VID:PID（LTR），也可能是各语言文案，按首个强字符自动定方向 */
.ws-port-id {
  unicode-bidi: plaintext;
}

.ws-log-toggle {
  font-size: 13px;
}

/* ---------------------------------------------------------- 14. RTL 修正 */
html[dir="rtl"] .submenu {
  text-align: start;
}

/* ---------------------------------------------------------- 15. 响应式 */
@media (max-width: 900px) {
  .nav-toggle {
    display: block;
  }

  /* 折叠面板：展开后占满整行，纵向排列，避免横向挤压重叠 */
  .nav-collapse {
    display: none;
    flex-basis: 100%;
    justify-content: flex-start;
    padding-block-end: 12px;
  }

  .nav-collapse.open {
    display: flex;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .nav-list a {
    display: block;
  }

  /* 触屏没有 hover：改为点击展开的静态列表 */
  .submenu {
    position: static;
    max-width: none;
    margin-inline-start: 14px;
    padding: 0;
    border: 0;
    border-inline-start: 2px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }

  .nav-dd.open > .submenu {
    display: block;
  }

  .nav-dd:hover > .submenu {
    display: none;
  }

  .nav-dd.open:hover > .submenu {
    display: block;
  }

  .nav-lang {
    margin-block-start: 8px;
  }

  .lang-pill {
    max-width: 100%;
  }

  /* WebSocket 工具：窄屏由左右两栏变为上下单栏，记录区恢复固定高度 */
  .ws-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ws-log-wrap {
    position: static;
  }

  .ws-panel-log {
    position: static;
  }

  .ws-log {
    flex: none;
    height: clamp(280px, 46vh, 420px);
    min-height: 0;
  }

  .ws-filters {
    margin-inline-start: 0;
  }

  /* 方案对比表：窄屏收紧单元格留白，首列吸附宽度同步收窄 */
  .cmp-table th,
  .cmp-table td {
    padding: 10px 11px;
  }

  .cmp-table thead th.cmp-dim {
    width: 96px;
  }

  .cmp-table tbody th {
    font-size: 12px;
  }
}

@media (max-width: 520px) {
  .brand-logo {
    height: 34px;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
  }

  .btn {
    width: 100%;
  }

  .hero-actions {
    gap: 10px;
  }

  /* 工具页按钮较多：窄屏保持自适应宽度，避免 6 个按钮各占一整行 */
  .ws-actions .btn {
    width: auto;
  }

  .ws-number {
    width: 120px;
  }

  /* 串口参数在窄屏改为单列，避免下拉框被压得太窄 */
  .ws-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------- 16. 无障碍与降级 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-nav,
  .cta-band {
    display: none;
  }

  .section {
    padding-block: 12px;
  }

  body {
    color: #000;
  }
}
