/**
 * Protocol Explorer 样式 —— 复刻 protocol-explorer-alpha.vercel.app 设计
 * 白底蓝色线稿等距插画 + 深蓝工具条 + 红/蓝/绿/黄/紫报文配色；含暗色与移动端适配。
 */

.pe-wrap {
  --pe-blue: #1741cc;
  --pe-blue-deep: #102fa0;
  --pe-ink: #1d4ed8;
  --pe-text: #16233f;
  --pe-muted: #5b6b85;
  --pe-bg: #f3f6fb;
  --pe-panel: #ffffff;
  --pe-line: #e2e9f5;
  --pe-grid: #e3eaf6;
  --pe-red: #c22626;
  --pe-red-bg: #fdf1f1;
  --pe-iso-a: #eef3fe;
  --pe-iso-b: #dbe6fb;
  --pe-iso-c: #c7d6f8;
  --pe-iso-d: #f8fafe;
  --pe-hover: #f2f6fd;

  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--pe-text);
  background: var(--pe-bg);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--pe-line);
  margin: 14px 0;
}
.pe-wrap * { box-sizing: border-box; }

/* ---------- 暗色 ---------- */
.pe-dark .pe-wrap {
  --pe-blue: #2563eb;
  --pe-blue-deep: #102fa0;
  --pe-ink: #7ea6f4;
  --pe-text: #dbe6f4;
  --pe-muted: #8fa1bb;
  --pe-bg: #0e1526;
  --pe-panel: #16203a;
  --pe-line: #263450;
  --pe-grid: #1d2942;
  --pe-red: #ef6a6a;
  --pe-red-bg: #3a1d22;
  --pe-iso-a: #1e2a48;
  --pe-iso-b: #243154;
  --pe-iso-c: #2c3c62;
  --pe-iso-d: #101a30;
  --pe-hover: #1b2642;
}
.pe-dark .pe-wrap .pe-st-a1 { stop-color: #2b3b69; } .pe-dark .pe-wrap .pe-st-a2 { stop-color: #1e2a48; }
.pe-dark .pe-wrap .pe-st-b1 { stop-color: #2d3d6d; } .pe-dark .pe-wrap .pe-st-b2 { stop-color: #223054; }
.pe-dark .pe-wrap .pe-st-c1 { stop-color: #38507f; } .pe-dark .pe-wrap .pe-st-c2 { stop-color: #293a61; }
.pe-dark .pe-wrap .pe-st-scr1 { stop-color: #3f8bff; } .pe-dark .pe-wrap .pe-st-scr2 { stop-color: #1740a8; }
.pe-dark .pe-wrap .pe-st-g1 { stop-color: rgba(0,0,0,.45); } .pe-dark .pe-wrap .pe-st-g2 { stop-color: rgba(0,0,0,0); }
.pe-dark .pe-wrap .pe-st-sky1 { stop-color: #17233f; } .pe-dark .pe-wrap .pe-st-sky2 { stop-color: #0e1526; }

/* ================= 顶部工具条 ================= */
.pe-topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  background: linear-gradient(180deg, #1a46d6, var(--pe-blue-deep));
  color: #fff;
  padding: 14px 20px;
}
.pe-logo {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 10px;
  font-size: 22px;
}
.pe-brand { min-width: 0; }
.pe-brand b {
  display: block;
  font-style: italic;
  letter-spacing: 3px;
  font-size: 17px;
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
.pe-brand span { font-size: 11.5px; opacity: .82; }
.pe-top-item { min-width: 0; }
.pe-top-lbl { font-size: 11px; opacity: .75; display: block; margin-bottom: 4px; white-space: nowrap; }
.pe-top-val { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.pe-top-val small { font-weight: 400; opacity: .8; display: block; }
.pe-top-sep { width: 1px; height: 34px; background: rgba(255,255,255,.22); flex: none; }

.pe-osi { display: flex; align-items: center; gap: 5px; }
.pe-osi-n {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.8);
}
.pe-osi-n.is-cur { background: #fff; color: var(--pe-blue-deep); border-color: #fff; }

.pe-prog { min-width: 150px; flex: 1; max-width: 230px; }
.pe-prog-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pe-prog-top b { font-size: 16px; }
.pe-prog-txt { font-size: 10.5px; opacity: .8; }
.pe-segs { display: flex; gap: 3px; margin-top: 6px; }
.pe-segs .pe-seg { flex: 1; height: 7px; border-radius: 3px; background: rgba(255,255,255,.22); min-width: 5px; }
.pe-segs .pe-seg.is-done { background: #34d399; }
.pe-segs .pe-seg.is-ing { background: #fbbf24; }
.pe-segs .pe-seg.is-cur { background: rgba(255,255,255,.7); }

.pe-top-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.pe-top-actions a {
  color: #fff; text-decoration: none; font-size: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  opacity: .85; padding: 5px 8px; border-radius: 8px;
}
.pe-top-actions a:hover { opacity: 1; background: rgba(255,255,255,.12); }
.pe-lang, .pe-theme {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 700;
  cursor: pointer; min-width: 44px;
}
.pe-lang:hover, .pe-theme:hover { background: rgba(255,255,255,.24); }

/* ================= 主体布局 ================= */
.pe-app {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 336px;
  grid-template-rows: minmax(430px, 1fr) auto;
  height: clamp(620px, calc(100vh - 150px), 880px);
}
.pe-side {
  grid-row: 1 / 3;
  border-right: 1px solid var(--pe-line);
  background: var(--pe-panel);
  display: flex; flex-direction: column;
  min-height: 0;
}
.pe-main { position: relative; min-width: 0; display: flex; flex-direction: column; }
.pe-right {
  border-left: 1px solid var(--pe-line);
  background: var(--pe-panel);
  overflow-y: auto;
  min-height: 0;
}
.pe-bottom {
  grid-column: 2 / 4;
  border-top: 1px solid var(--pe-line);
  background: var(--pe-panel);
  min-height: 0;
  display: flex; flex-direction: column;
}
/* ================= 侧栏 ================= */
.pe-side-head {
  padding: 16px 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.pe-side-head h2 { margin: 0; font-size: 19px; color: var(--pe-blue); letter-spacing: .5px; }
.pe-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--pe-line); }
.pe-tab {
  border: 0; background: none; cursor: pointer;
  padding: 8px 9px 10px;
  font-size: 12.5px; color: var(--pe-muted);
  border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit;
}
.pe-tab .pe-tab-n {
  background: var(--pe-hover); border-radius: 8px;
  padding: 0 6px; font-size: 10.5px; font-weight: 700;
  color: var(--pe-muted);
}
.pe-tab.is-active { color: var(--pe-blue); border-bottom-color: var(--pe-blue); font-weight: 700; }
.pe-tab.is-active .pe-tab-n { background: var(--pe-blue); color: #fff; }

.pe-search { padding: 10px 12px 4px; }
.pe-search input {
  width: 100%;
  border: 1px solid var(--pe-line); background: var(--pe-panel);
  color: var(--pe-text); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.pe-search input:focus { border-color: var(--pe-blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.pe-search input::placeholder { color: var(--pe-muted); }
.pe-no-match { text-align: center; color: var(--pe-muted); font-size: 12.5px; padding: 26px 10px; }

.pe-list { overflow-y: auto; flex: 1; min-height: 0; padding: 8px; }
.pe-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer; position: relative;
  border: 1px solid transparent;
  flex-wrap: wrap;
}
.pe-item:hover { background: var(--pe-hover); }
.pe-item.is-active { background: var(--pe-red-bg); border-color: rgba(194,38,38,.25); }
.pe-item-radio {
  width: 15px; height: 15px; flex: none; margin-top: 2px;
  border: 2px solid #b6c4dc; border-radius: 50%;
  position: relative;
}
.pe-item-radio.is-done { border-color: #16a34a; background: #16a34a; }
.pe-item-radio.is-done::after {
  content: "✓"; position: absolute; inset: 0;
  color: #fff; font-size: 9px; font-weight: 900;
  display: grid; place-items: center;
}
.pe-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pe-item-main b { font-size: 14px; color: var(--pe-text); }
.pe-item.is-active .pe-item-main b { color: var(--pe-red); }
.pe-item-main i { font-style: normal; font-size: 11.5px; color: var(--pe-muted); margin-top: 1px; }
.pe-item-chev { color: #b6c4dc; font-size: 14px; margin-top: 1px; }
.pe-item.is-active .pe-item-chev { color: var(--pe-red); }

.pe-steps { width: 100%; margin-top: 8px; display: flex; flex-direction: column; }
.pe-step {
  display: flex; gap: 10px;
  padding: 7px 6px 7px 2px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
}
.pe-step:hover { background: rgba(194,38,38,.08); }
.pe-step::before {
  content: ""; position: absolute; left: 11px; top: 0; bottom: 0;
  width: 0; border-left: 1.5px dashed rgba(194,38,38,.4);
}
.pe-step:first-child::before { top: 50%; }
.pe-step:last-child::before { bottom: 50%; }
.pe-step-n {
  width: 21px; height: 21px; flex: none; z-index: 1;
  background: var(--pe-blue); color: #fff;
  border-radius: 50%; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800;
}
.pe-step-t { display: flex; flex-direction: column; min-width: 0; }
.pe-step-t b { font-size: 12px; color: var(--pe-text); font-weight: 600; }
.pe-step-t i { font-style: normal; font-size: 10.5px; color: var(--pe-muted); }

/* ================= 主画布 ================= */
.pe-canvas-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px 0; }
.pe-view-sw {
  display: inline-flex;
  background: var(--pe-panel);
  border: 1px solid var(--pe-line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(23,65,204,.07);
}
.pe-view-sw button {
  border: 0; background: none; cursor: pointer;
  padding: 7px 16px; font-size: 13px; color: var(--pe-muted);
  font-family: inherit;
}
.pe-view-sw button.is-active { background: var(--pe-blue); color: #fff; font-weight: 700; }
.pe-canvas-hint { font-size: 11.5px; color: var(--pe-muted); }

.pe-canvas { flex: 1; min-height: 0; overflow: auto; padding: 4px 10px 10px; position: relative; }
.pe-net, .pe-seq { width: 100%; min-height: 320px; display: block; }
.pe-net { height: 100%; min-height: 380px; }
.pe-seq { height: auto; }

/* SVG 渐变端点：颜色由 CSS 控制，随明暗主题切换 */
.pe-st-a1 { stop-color: #f7faff; } .pe-st-a2 { stop-color: #e4edfd; }
.pe-st-b1 { stop-color: #e1ebfc; } .pe-st-b2 { stop-color: #c4d5f7; }
.pe-st-c1 { stop-color: #cbd9fa; } .pe-st-c2 { stop-color: #a7bef1; }
.pe-st-scr1 { stop-color: #a6c9ff; } .pe-st-scr2 { stop-color: #2c69ff; }
.pe-st-g1 { stop-color: rgba(30,58,138,.18); } .pe-st-g2 { stop-color: rgba(30,58,138,0); }
.pe-st-sky1 { stop-color: #fdfeff; } .pe-st-sky2 { stop-color: #e9eefb; }

.pe-edge { stroke: var(--pe-ink); stroke-width: 2; stroke-dasharray: 5 6; opacity: .42; }
.pe-edge-dot { fill: var(--pe-ink); opacity: .5; }
.pe-iso-name { text-anchor: middle; font-size: 15px; font-weight: 700; fill: var(--pe-ink); paint-order: stroke; stroke: var(--pe-panel); stroke-width: 4px; stroke-linejoin: round; }
.pe-iso-ip { font-size: 11.5px; font-weight: 500; fill: var(--pe-muted); font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; paint-order: stroke; stroke: var(--pe-panel); stroke-width: 3px; stroke-linejoin: round; }
.pe-iso-led-g { fill: #22c55e; stroke: none; }
.pe-iso-led-a { fill: #f59e0b; stroke: none; }
.pe-signal { fill: none; stroke: var(--pe-blue); stroke-width: 2.2; stroke-linecap: round; opacity: .2; animation: pePulse 2.4s ease-in-out infinite; }
.pe-signal.s2 { animation-delay: .4s; }
.pe-signal.s3 { animation-delay: .8s; }
@keyframes pePulse { 0%, 100% { opacity: .12; } 50% { opacity: .8; } }
.pe-capsule { filter: drop-shadow(0 2px 5px rgba(13,35,90,.35)); }
.pe-capsule-txt { font-size: 12.5px; font-weight: 700; font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
.pe-lost-x { font-size: 12px; font-weight: 700; }

/* 阶段提示卡 */
.pe-step-intro {
  position: absolute; left: 0; right: 0; top: 8px;
  display: flex; justify-content: center;
  pointer-events: none;
  opacity: 0; transform: translateY(-8px);
  transition: opacity .3s, transform .3s;
  z-index: 5;
}
.pe-step-intro.is-on { opacity: 1; transform: none; }
.pe-intro-card {
  background: var(--pe-panel);
  border: 1px solid var(--pe-line);
  border-left: 4px solid var(--pe-blue);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(23,65,204,.12);
  padding: 8px 14px;
  display: flex; flex-direction: column; gap: 2px;
  max-width: 440px;
}
.pe-intro-card b { color: var(--pe-blue); font-size: 12.5px; }
.pe-intro-card span { font-size: 11.5px; color: var(--pe-muted); }

/* 时序视图 */
.pe-seq-chip { fill: var(--pe-hover); stroke: var(--pe-line); }
.pe-seq-name { font-size: 14px; font-weight: 700; fill: var(--pe-text); }
.pe-seq-ip { font-size: 10.5px; fill: var(--pe-muted); font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
.pe-seq-life { stroke: var(--pe-ink); stroke-width: 1.6; stroke-dasharray: 4 5; opacity: .45; }
.pe-seq-t { font-size: 10.5px; fill: var(--pe-muted); font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
.pe-seq-phase { font-size: 11px; font-weight: 700; fill: var(--pe-blue); paint-order: stroke; stroke: var(--pe-panel); stroke-width: 3px; stroke-linejoin: round; }
.pe-seq-lbl { font-size: 11.5px; font-weight: 600; paint-order: stroke; stroke: var(--pe-panel); stroke-width: 3px; }
.pe-seq-lost { font-size: 11.5px; font-weight: 700; paint-order: stroke; stroke: var(--pe-panel); stroke-width: 3px; }
.pe-seq-arr line { opacity: .38; stroke-width: 1.4; transition: opacity .25s, stroke-width .25s; }
.pe-seq-arr.on line { opacity: 1; stroke-width: 2; }
.pe-seq-arr { cursor: pointer; }
.pe-seq-arr:hover line { opacity: 1; }
.pe-arr-committed { cursor: pointer; }
.pe-canvas.pe-scroll { overflow: auto; }
.pe-canvas.pe-scroll .pe-net { width: 920px; height: 515px; min-height: 0; }
.pe-canvas.pe-scroll .pe-seq { width: auto; max-width: none; }
/* ================= 概览面板 ================= */
.pe-right { padding: 16px; }
.pe-ov-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pe-ov-head h2 { margin: 0; font-size: 26px; color: var(--pe-blue); line-height: 1.1; }
.pe-ov-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--pe-muted); }
.pe-ov-badge {
  flex: none;
  font-size: 11px; font-weight: 700;
  color: #16a34a; background: rgba(22,163,74,.12);
  border: 1px solid rgba(22,163,74,.3);
  padding: 4px 10px; border-radius: 20px;
  white-space: nowrap;
}
.pe-ov-badge.is-done { background: rgba(22,163,74,.18); }
.pe-ov-desc { font-size: 12.5px; line-height: 1.75; color: var(--pe-text); margin: 14px 0; }
.pe-ov-rows { margin: 0; border-top: 1px solid var(--pe-line); }
.pe-ov-rows > div {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--pe-line);
  font-size: 12.5px;
}
.pe-ov-rows dt { color: var(--pe-muted); flex: none; }
.pe-ov-rows dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }

/* ================= 底部数据包流 ================= */
.pe-flow-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--pe-line);
  flex-wrap: wrap;
}
.pe-flow-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14.5px; font-weight: 800; color: var(--pe-text); }
.pe-legend { display: inline-flex; align-items: center; gap: 12px; font-weight: 500; font-size: 11.5px; color: var(--pe-muted); flex-wrap: wrap; }
.pe-lg { display: inline-flex; align-items: center; gap: 5px; }
.pe-lg i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pe-lg-note { opacity: .75; }
.pe-flow-ctl { display: flex; align-items: center; gap: 8px; }
.pe-flow-ctl select {
  border: 1px solid var(--pe-line); background: var(--pe-panel);
  color: var(--pe-text); border-radius: 8px; padding: 6px 8px;
  font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.pe-btn {
  border: 1px solid var(--pe-line); background: var(--pe-panel);
  color: var(--pe-text);
  border-radius: 8px; padding: 7px 14px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.pe-btn:hover { background: var(--pe-hover); }
.pe-btn-play { background: var(--pe-blue); border-color: var(--pe-blue); color: #fff; }
.pe-btn-play:hover { background: var(--pe-blue-deep); }

.pe-table-wrap { overflow: auto; max-height: 248px; min-height: 130px; }
.pe-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pe-table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--pe-panel);
  text-align: left; font-size: 10.5px; color: var(--pe-muted);
  padding: 7px 12px; border-bottom: 1px solid var(--pe-line);
  white-space: nowrap;
}
.pe-table td { padding: 7px 12px; border-bottom: 1px solid var(--pe-line); white-space: nowrap; }
.pe-table td.pe-info { white-space: normal; min-width: 220px; }
.pe-row { cursor: pointer; transition: background .15s; }
.pe-row:hover { background: var(--pe-hover); }
.pe-row.is-dim { opacity: .45; }
.pe-row.is-now { background: var(--pe-red-bg); }
.pe-no {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  color: #fff; font-size: 10.5px; font-weight: 800;
}
.pe-td-ip { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 11px; }
.pe-lost-tag { color: var(--pe-red); font-weight: 800; }

/* ================= 包检查器 ================= */
.pe-ins-row td { padding: 0 !important; white-space: normal !important; }
.pe-ins-meta {
  padding: 9px 14px;
  font-size: 12px; color: var(--pe-muted);
  background: var(--pe-hover);
  border-bottom: 1px solid var(--pe-line);
}
.pe-ins-meta b { color: var(--pe-blue); margin-right: 6px; }
.pe-ins-grid { display: grid; grid-template-columns: minmax(260px, 5fr) minmax(300px, 7fr); }
.pe-layers { border-right: 1px solid var(--pe-line); max-height: 330px; overflow: auto; padding: 6px 0; }
.pe-layer { border-bottom: 1px dashed var(--pe-line); padding: 6px 0 8px; }
.pe-layer:last-child { border-bottom: 0; }
.pe-layer-name {
  font-size: 10.5px; font-weight: 800; color: var(--pe-blue);
  padding: 2px 14px 5px;
  text-transform: uppercase; letter-spacing: .4px;
}
.pe-field { display: flex; flex-direction: column; gap: 1px; padding: 4px 14px; border-radius: 6px; }
.pe-field:hover { background: var(--pe-hover); }
.pe-field-name { font-size: 11.5px; color: var(--pe-muted); }
.pe-field-val { font-size: 12px; font-weight: 600; color: var(--pe-text); word-break: break-all; }
.pe-field-hex { font-size: 10.5px; color: var(--pe-muted); opacity: .8; font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }

.pe-hex { max-height: 330px; overflow: auto; padding: 8px 10px; background: var(--pe-hover); }
.pe-hex-line { display: flex; gap: 10px; font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 11.5px; line-height: 1.7; }
.pe-hex-off { color: var(--pe-muted); opacity: .8; flex: none; }
.pe-hex-bytes { white-space: pre; }
.pe-hex-b { border-radius: 3px; padding: 0 1px; transition: background .1s; cursor: pointer; }
.pe-hex-b.hl { background: var(--pe-blue); color: #fff; }
.pe-hex-asc { color: var(--pe-muted); white-space: pre; }

/* ================= Toast ================= */
.pe-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--pe-blue); color: #fff;
  padding: 9px 18px; border-radius: 24px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(13,35,90,.35);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 999;
}
.pe-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ================= 滚动条 ================= */
.pe-list::-webkit-scrollbar, .pe-right::-webkit-scrollbar, .pe-table-wrap::-webkit-scrollbar,
.pe-layers::-webkit-scrollbar, .pe-hex::-webkit-scrollbar, .pe-canvas::-webkit-scrollbar { width: 8px; height: 8px; }
.pe-list::-webkit-scrollbar-thumb, .pe-right::-webkit-scrollbar-thumb, .pe-table-wrap::-webkit-scrollbar-thumb,
.pe-layers::-webkit-scrollbar-thumb, .pe-hex::-webkit-scrollbar-thumb, .pe-canvas::-webkit-scrollbar-thumb {
  background: #c6d2e8; border-radius: 6px;
}
.pe-dark .pe-list::-webkit-scrollbar-thumb, .pe-dark .pe-right::-webkit-scrollbar-thumb, .pe-dark .pe-table-wrap::-webkit-scrollbar-thumb,
.pe-dark .pe-layers::-webkit-scrollbar-thumb, .pe-dark .pe-hex::-webkit-scrollbar-thumb, .pe-dark .pe-canvas::-webkit-scrollbar-thumb { background: #2c3c62; }

/* ================= 无障碍 ================= */
@media (prefers-reduced-motion: reduce) {
  .pe-capsule, .pe-capsule-txt, .pe-step-intro, .pe-seq-arr line, .pe-row, .pe-btn, .pe-signal { transition: none !important; animation: none !important; }
}

/* ================= 响应式 ================= */
.pe-mobile-bar { display: none; }
@media (max-width: 1200px) {
  .pe-app { grid-template-columns: 244px minmax(0, 1fr) 300px; }
}
@media (max-width: 1024px) {
  .pe-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; height: auto; }
  .pe-side { grid-row: auto; border-right: 0; border-bottom: 1px solid var(--pe-line); }
  .pe-list { max-height: 320px; }
  .pe-right { border-left: 0; border-top: 1px solid var(--pe-line); }
  .pe-bottom { grid-column: auto; }
  .pe-topbar { flex-wrap: wrap; gap: 10px 18px; }
  .pe-top-sep { display: none; }
  .pe-prog { max-width: none; }
  .pe-ins-grid { grid-template-columns: 1fr; }
  .pe-layers { border-right: 0; border-bottom: 1px solid var(--pe-line); }
  .pe-mobile-bar { display: block; padding: 10px 14px 0; }
  .pe-mobile-bar select {
    width: 100%;
    border: 1px solid var(--pe-line); background: var(--pe-panel);
    color: var(--pe-text); border-radius: 10px;
    padding: 10px 12px; font-size: 14px; font-family: inherit;
  }
  .pe-net { min-height: 300px; }
}

/* 手机端顶栏精简：隐藏 OSI 指示与「正在学习」标签，保留进度与操作 */
@media (max-width: 700px) {
  .pe-top-learn, .pe-top-osi { display: none; }
  .pe-top-sep { display: none; }
  .pe-canvas-hint { display: none; }
  .pe-topbar { gap: 12px; padding: 12px 14px; }
  .pe-brand b { font-size: 14.5px; letter-spacing: 2px; }
  .pe-brand span { font-size: 10.5px; }
  .pe-table-wrap { max-height: 320px; }
  .pe-btn { padding: 9px 14px; }
  .pe-flow-ctl select { padding: 8px 10px; }
  .pe-legend { gap: 8px; }
  .pe-right { padding: 14px; }
  .pe-ov-head h2 { font-size: 22px; }
  .pe-canvas { padding: 4px 6px 8px; }
}
/* 小屏手机：进一步精简 */
@media (max-width: 480px) {
  .pe-top-actions a .pe-x-hide { display: none; }
  .pe-lang { min-width: 40px; padding: 6px 8px; }
  .pe-view-sw button { padding: 8px 14px; }
  .pe-prog { min-width: 120px; }
  .pe-table { font-size: 11.5px; }
  .pe-table th, .pe-table td { padding: 7px 9px; }
  .pe-ins-meta { font-size: 11px; }
}

/* ================= 「怎么用」极简折叠 ================= */
.tool-usage {
  --tu-text: #16233f;
  --tu-muted: #5b6b85;
  --tu-line: #e2e9f5;
  --tu-hover: #f2f6fd;

  margin: 14px 0 4px;
  border: 0;
  border-top: 1px solid var(--tu-line);
  color: var(--tu-text);
}
:root.pe-dark .tool-usage {
  --tu-text: #dbe6f4;
  --tu-muted: #8fa1bb;
  --tu-line: #263450;
  --tu-hover: #182336;
}
.tool-usage[open] summary { border-bottom: 0; }
.tool-usage summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  cursor: pointer;
  border-radius: 10px;
  list-style: none;
  user-select: none;
  transition: background-color .15s;
}
.tool-usage summary::-webkit-details-marker { display: none; }
.tool-usage summary::marker { content: ''; }
.tool-usage summary h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--tu-text);
}
.tool-usage summary:hover { background: var(--tu-hover); }
.tool-usage summary:focus-visible {
  outline: 2px solid #1741cc;
  outline-offset: -2px;
}
:root.pe-dark .tool-usage summary:focus-visible { outline-color: #7ea6f4; }
.tool-usage-caret {
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--tu-muted);
  border-bottom: 2px solid var(--tu-muted);
  transform: rotate(-45deg) translateY(-2px);
  transition: transform .18s ease;
}
.tool-usage[open] .tool-usage-caret {
  transform: rotate(45deg) translateY(-2px);
}
.tool-usage ol {
  margin: 4px 0 14px;
  padding-left: 22px;
  color: var(--tu-muted);
  font-size: 14px;
  line-height: 1.9;
}
.tool-usage li + li { margin-top: 4px; }
@media (max-width: 480px) {
  .tool-usage summary { padding: 10px 2px; }
}
