/*
 * ponytail.css — Ponytail 极简代码工作台（/tools/ponytail）
 * 1. --pt-* 变量定义在 :root（toast 挂在 .pt 之外）
 * 2. [hidden] 全局兜底：本站老坑，凡设了 display 的元素都要覆盖
 * 3. 断点降序：≥1600 / ≤1400 / ≤1100 / ≤900 / ≤767 / ≤420
 * 4. body{overflow-y:scroll} 会让页内 sticky 失效，本页改 overflow:visible
 */

:root {
    --pt-bg: #0d1017;
    --pt-card: #151a23;
    --pt-card-2: #1b212c;
    --pt-card-3: #202836;
    --pt-border: #27303f;
    --pt-border-2: #354054;
    --pt-text: #e8ecf3;
    --pt-sub: #aab5c6;
    --pt-faint: #96a2b4;          /* 对卡片底 ≥6.5:1，小字也清晰 */
    --pt-hover: #1f2632;
    --pt-accent: #7d97f0;
    --pt-accent-2: #5b72c9;
    --pt-btn-fill: #4659a6;       /* 白字 ≥5.5:1，满足 AA */
    --pt-accent-soft: rgba(125, 151, 240, .14);
    --pt-ok: #45c46a;
    --pt-ok-soft: rgba(69, 196, 106, .13);
    --pt-warn: #e0ad3a;
    --pt-warn-soft: rgba(224, 173, 58, .13);
    --pt-err: #ec6a5e;
    --pt-err-soft: rgba(236, 106, 94, .13);
    --pt-blue: #63b8e8;
    --pt-zebra: rgba(127, 127, 127, .055);
    --pt-shadow: 0 16px 38px -22px rgba(0, 0, 0, .9);
    --pt-shadow-sm: 0 4px 14px -8px rgba(0, 0, 0, .7);
    --pt-r: 16px;
    --pt-r-s: 10px;
    --pt-sticky-top: 60px;        /* 页签 8px + 高度 52px */
    --pt-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

[data-theme="light"] {
    --pt-bg: #f4f6fa;
    --pt-card: #ffffff;
    --pt-card-2: #f1f4f9;
    --pt-card-3: #e9eef6;
    --pt-border: #e1e6ef;
    --pt-border-2: #ccd5e3;
    --pt-text: #1d2532;
    --pt-sub: #4c5766;
    --pt-faint: #5f6a79;          /* 对白底 ≥5.5:1 */
    --pt-hover: #edf1f8;
    --pt-accent: #3b4a9c;
    --pt-accent-2: #2f3c85;
    --pt-btn-fill: #3b4a9c;
    --pt-accent-soft: rgba(59, 74, 156, .08);
    --pt-ok: #1a7f37;
    --pt-ok-soft: rgba(26, 127, 55, .09);
    --pt-warn: #946200;
    --pt-warn-soft: rgba(148, 98, 0, .09);
    --pt-err: #b03024;
    --pt-err-soft: rgba(176, 48, 36, .09);
    --pt-blue: #1c6b96;
    --pt-zebra: rgba(15, 20, 25, .038);
    --pt-shadow: 0 10px 26px -20px rgba(16, 24, 40, .45);
    --pt-shadow-sm: 0 3px 12px -8px rgba(16, 24, 40, .35);
}

/* 满屏（保留左侧导航） */
body.page-ponytail-full .app,
body.page-ponytail-full .main-content,
body.page-ponytail-full .page-container { max-width: 100%; }
body.page-ponytail-full .main-content { width: 100%; border-right: 0; min-width: 0; }
body.page-ponytail-full { overflow: visible; }

.pt { max-width: 100%; padding: 22px 24px 64px; box-sizing: border-box; color: var(--pt-text); }
.pt *, .pt *::before, .pt *::after { box-sizing: border-box; }
.pt [hidden], .pt-toast[hidden] { display: none !important; }
.pt a { color: var(--pt-accent); }
.pt code, .pt pre, .pt .pt-code { font-family: var(--pt-mono); }
.pt :focus-visible { outline: 2px solid var(--pt-accent); outline-offset: 2px; }

/* ---------- Hero ---------- */
.pt-hero {
    position: relative; display: flex; gap: 16px; align-items: flex-start;
    padding: 20px 22px; margin-bottom: 14px; border: 1px solid var(--pt-border);
    border-radius: var(--pt-r); background: linear-gradient(120deg, var(--pt-accent-soft), transparent 62%), var(--pt-card);
    box-shadow: var(--pt-shadow-sm);
}
.pt-hero.is-collapsed { padding: 12px 22px; }
.pt-hero.is-collapsed .pt-hero-extra { display: none; }
.pt-hero-ic {
    flex: 0 0 auto; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
    font-size: 24px; background: var(--pt-accent-soft); border: 1px solid var(--pt-border-2);
}
.pt-hero.is-collapsed .pt-hero-ic { width: 36px; height: 36px; font-size: 19px; }
.pt-hero-tx { flex: 1 1 auto; min-width: 0; }
.pt-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pt-hero-t { margin: 0; font-size: 23px; line-height: 1.35; letter-spacing: .2px; }
.pt-hero-sub { margin: 8px 0 12px; font-size: 13.5px; line-height: 1.85; color: var(--pt-sub); max-width: 108ch; }
.pt-hero-sub code { padding: 1px 5px; border-radius: 5px; background: var(--pt-card-2); font-size: 12.5px; }
.pt-hero-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.pt-tag { padding: 4px 10px; border-radius: 999px; font-size: 12px; color: var(--pt-sub); background: var(--pt-card-2); border: 1px solid var(--pt-border); }
.pt-fold {
    flex: 0 0 auto; width: 28px; height: 28px; border: 0; border-radius: 8px; cursor: pointer;
    background: transparent; color: var(--pt-sub); display: grid; place-items: center;
}
.pt-fold:hover { background: var(--pt-hover); color: var(--pt-accent); }
.pt-fold svg { transition: transform .18s ease; }
.pt-hero.is-collapsed .pt-fold svg { transform: rotate(-90deg); }

/* ---------- 统计条 ---------- */
.pt-stats {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0;
    margin-bottom: 14px; border: 1px solid var(--pt-border); border-radius: var(--pt-r);
    background: var(--pt-card); overflow: hidden;
}
.pt-stat { padding: 12px 16px; border-left: 1px solid var(--pt-border); min-width: 0; }
.pt-stat:first-child { border-left: 0; }
.pt-stat b { display: block; font-size: 21px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.pt-stat:nth-child(1) b { color: var(--pt-accent); }
.pt-stat:nth-child(2) b { color: var(--pt-err); }
.pt-stat:nth-child(3) b { color: var(--pt-ok); }
.pt-stat:nth-child(4) b { color: var(--pt-warn); }
.pt-stat:nth-child(5) b { color: var(--pt-blue); }
.pt-stat span { display: block; margin-top: 3px; font-size: 12px; color: var(--pt-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 页签 ---------- */
.pt-tabs {
    display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain;
    padding: 6px; margin-bottom: 14px; border: 1px solid var(--pt-border); border-radius: var(--pt-r);
    background: var(--pt-card); position: sticky; top: 8px; z-index: 30;
}
.pt-tab {
    flex: 1 0 auto; min-height: 40px; padding: 8px 14px; border: 1px solid transparent; border-radius: var(--pt-r-s);
    background: transparent; color: var(--pt-sub); cursor: pointer; font-size: 13.5px; white-space: nowrap;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.pt-tab:hover { background: var(--pt-hover); color: var(--pt-text); }
.pt-tab.is-on { background: var(--pt-accent-soft); border-color: var(--pt-accent-2); color: var(--pt-text); font-weight: 600; }

/* ---------- 卡片 / 按钮 ---------- */
.pt-pane { display: grid; gap: 14px; }
.pt-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pt-card {
    min-width: 0; border: 1px solid var(--pt-border); border-radius: var(--pt-r);
    background: var(--pt-card); box-shadow: var(--pt-shadow-sm);
    overflow: hidden; overflow: clip;   /* clip 不建滚动容器，卡片头 sticky 才生效 */
}
.pt-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 12px 16px; border-bottom: 1px solid var(--pt-border); background: var(--pt-card-2);
    position: sticky; top: var(--pt-sticky-top); z-index: 3;
}
.pt-card-head--sub { position: static; margin-top: 4px; background: transparent; }
.pt-card-t { margin: 0; font-size: 15px; font-weight: 650; }
.pt-hint { font-size: 11.5px; font-weight: 400; color: var(--pt-faint); margin-left: 6px; }
.pt-card-acts { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pt-btn {
    min-height: 36px; padding: 7px 13px; border-radius: var(--pt-r-s); border: 1px solid var(--pt-border-2);
    background: var(--pt-card-2); color: var(--pt-text); cursor: pointer; font-size: 13px; white-space: nowrap;
}
.pt-btn:hover { background: var(--pt-hover); border-color: var(--pt-accent-2); }
.pt-btn:disabled { opacity: .55; cursor: not-allowed; }
.pt-btn-sm { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.pt-btn-pri { background: var(--pt-btn-fill); border-color: var(--pt-btn-fill); color: #fff; }
.pt-btn-pri:hover { background: var(--pt-accent-2); border-color: var(--pt-accent-2); }
.pt-btn-danger { color: var(--pt-err); }
.pt-hidden-file { display: none; }
.pt-inline-note { font-size: 12px; color: var(--pt-faint); line-height: 1.7; }
.pt-note { padding: 10px 16px 16px; margin: 0; font-size: 12px; line-height: 1.8; color: var(--pt-faint); }
.pt-lead { padding: 14px 16px 0; margin: 0; font-size: 13.5px; line-height: 1.9; color: var(--pt-sub); max-width: 110ch; }
.pt-empty { padding: 28px 16px; text-align: center; color: var(--pt-faint); font-size: 13px; line-height: 1.8; }

/* ---------- 表单 / 输入 ---------- */
.pt-io-bar, .pt-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 16px; }
.pt-form { flex-direction: column; align-items: stretch; }
.pt-field { display: flex; flex-direction: column; gap: 5px; min-width: 140px; flex: 1 1 160px; }
.pt-field > span { font-size: 12px; color: var(--pt-faint); }
.pt-input, .pt-select, .pt-mini-ta {
    width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--pt-border-2); border-radius: var(--pt-r-s);
    background: var(--pt-bg); color: var(--pt-text); font-size: 13px; font-family: inherit;
}
.pt-input:focus, .pt-select:focus, .pt-mini-ta:focus { border-color: var(--pt-accent); outline: none; }
.pt-mini-ta { min-height: 70px; resize: vertical; line-height: 1.65; }
.pt-checks { border: 1px dashed var(--pt-border-2); border-radius: var(--pt-r-s); padding: 10px 12px; display: grid; gap: 8px; }
.pt-checks legend { font-size: 12px; color: var(--pt-faint); padding: 0 5px; }
.pt-checks label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--pt-sub); cursor: pointer; }
.pt-checks input { width: 16px; height: 16px; accent-color: var(--pt-accent-2); }

/* ---------- 拖放 / 代码编辑 ---------- */
.pt-drop {
    margin: 12px 16px 0; padding: 14px; text-align: center; border: 2px dashed var(--pt-border-2);
    border-radius: var(--pt-r-s); color: var(--pt-sub); cursor: pointer; background: var(--pt-card-2);
    display: flex; flex-direction: column; gap: 3px; align-items: center;
}
.pt-drop small { color: var(--pt-faint); font-size: 11.5px; }
.pt-drop:hover, .pt-drop.is-over { border-color: var(--pt-accent); background: var(--pt-accent-soft); color: var(--pt-text); }
.pt-drop--sm { margin-top: 12px; padding: 10px; }
.pt-code {
    display: block; width: calc(100% - 32px); margin: 12px 16px 0; min-height: 320px; padding: 12px 14px;
    border: 1px solid var(--pt-border-2); border-radius: var(--pt-r-s); background: var(--pt-bg);
    color: var(--pt-text); font-size: 12.8px; line-height: 1.7; tab-size: 4; resize: vertical;
    white-space: pre; overflow: auto; overscroll-behavior: contain;
}
.pt-code::placeholder { color: var(--pt-faint); }
.pt-code--gain { min-height: 240px; }
.pt-io-foot { padding: 8px 16px 12px; font-size: 12px; color: var(--pt-faint); font-variant-numeric: tabular-nums; }

/* ---------- 审查报告 ---------- */
.pt-card--io, .pt-card--report { align-self: start; }
#ptPaneReview { grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr); }
.pt-report-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; padding: 12px 16px; }
.pt-metric { padding: 9px 11px; border: 1px solid var(--pt-border); border-radius: var(--pt-r-s); background: var(--pt-card-2); }
.pt-metric b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.pt-metric span { font-size: 11.5px; color: var(--pt-faint); }
.pt-findings { padding: 0 16px 18px; max-height: 620px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.pt-group-t { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: 13.5px; font-weight: 650; }
.pt-group-t i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pt-group--must i { background: var(--pt-err); }
.pt-group--should i { background: var(--pt-warn); }
.pt-group--nice i { background: var(--pt-blue); }
.pt-group-t em { font-style: normal; font-size: 11.5px; font-weight: 400; color: var(--pt-faint); }
.pt-find {
    border: 1px solid var(--pt-border); border-left: 3px solid var(--pt-border-2); border-radius: var(--pt-r-s);
    background: var(--pt-card-2); margin-bottom: 9px; overflow: hidden;
}
.pt-find--must { border-left-color: var(--pt-err); }
.pt-find--should { border-left-color: var(--pt-warn); }
.pt-find--nice { border-left-color: var(--pt-blue); }
.pt-find-h { display: flex; align-items: center; gap: 8px; padding: 9px 12px; flex-wrap: wrap; }
.pt-find-n { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
    background: var(--pt-card-3); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pt-find-t { font-size: 13.5px; font-weight: 650; flex: 1 1 auto; min-width: 0; }
.pt-find-loc { font-size: 11.5px; color: var(--pt-faint); font-family: var(--pt-mono); }
.pt-pill { padding: 2px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--pt-border-2); color: var(--pt-sub); }
.pt-pill--cut { color: var(--pt-ok); border-color: var(--pt-ok); }
.pt-find-b { padding: 0 12px 10px 42px; display: grid; gap: 5px; }
.pt-find-b p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--pt-sub); }
.pt-find-b strong { color: var(--pt-text); font-weight: 600; }
.pt-find-ev { margin: 2px 0 0; padding: 7px 9px; border-radius: 7px; background: var(--pt-bg);
    font-size: 11.8px; color: var(--pt-sub); white-space: pre-wrap; word-break: break-all; max-height: 90px; overflow: auto; }
.pt-verdict { margin-top: 14px; padding: 11px 13px; border-radius: var(--pt-r-s); border: 1px dashed var(--pt-border-2);
    background: var(--pt-card-2); font-size: 12.5px; line-height: 1.8; color: var(--pt-sub); }
.pt-verdict b { color: var(--pt-text); }

/* ---------- 多文件审计 ---------- */
.pt-files { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 16px 0; }
.pt-file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px;
    border: 1px solid var(--pt-border-2); background: var(--pt-card-2); font-size: 12px; color: var(--pt-sub); }
.pt-file-chip b { color: var(--pt-text); font-weight: 600; }
.pt-file-chip button { border: 0; background: transparent; color: var(--pt-faint); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.pt-file-chip button:hover { color: var(--pt-err); }
.pt-audit-out { padding: 6px 16px 18px; }
.pt-audit-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.pt-file-row { border: 1px solid var(--pt-border); border-radius: var(--pt-r-s); margin-bottom: 8px; overflow: hidden; }
.pt-file-row-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px;
    background: var(--pt-card-2); font-size: 13px; flex-wrap: wrap; }
.pt-file-row-h b { font-family: var(--pt-mono); font-size: 12.5px; }
.pt-file-row-b { padding: 8px 12px 10px; display: grid; gap: 4px; }
.pt-audit-item { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.6; color: var(--pt-sub); }
.pt-audit-item i { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; }
.pt-audit-item.is-must i { background: var(--pt-err); }
.pt-audit-item.is-should i { background: var(--pt-warn); }
.pt-audit-item.is-nice i { background: var(--pt-blue); }

/* ---------- 债务账本 ---------- */
.pt-debt-stat { padding: 10px 16px 0; font-size: 12.5px; color: var(--pt-sub); }
.pt-debt-out { padding: 8px 16px 18px; }
.pt-debt-file { margin: 10px 0 14px; }
.pt-debt-file > h3 { margin: 0 0 7px; font-size: 13px; font-family: var(--pt-mono); color: var(--pt-accent); }
.pt-debt-row { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 9px; padding: 8px 10px;
    border: 1px solid var(--pt-border); border-radius: var(--pt-r-s); background: var(--pt-card-2); margin-bottom: 6px; }
.pt-debt-row > span { font-family: var(--pt-mono); font-size: 11.5px; color: var(--pt-faint); }
.pt-debt-row p { margin: 0; font-size: 12.5px; line-height: 1.7; word-break: break-word; }
.pt-debt-row em { font-style: normal; color: var(--pt-sub); }
.pt-debt-noway { color: var(--pt-err); font-size: 11.5px; margin-left: 6px; }

/* ---------- 收益对比 ---------- */
.pt-gain-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 9px; padding: 14px 16px 6px; }
.pt-gain-item { padding: 11px 13px; border: 1px solid var(--pt-border); border-radius: var(--pt-r-s); background: var(--pt-card-2); }
.pt-gain-item b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.pt-gain-item.is-good b { color: var(--pt-ok); }
.pt-gain-item.is-bad b { color: var(--pt-err); }
.pt-gain-item span { display: block; margin-top: 3px; font-size: 11.5px; color: var(--pt-faint); }
.pt-gain-item small { display: block; margin-top: 4px; font-size: 11px; color: var(--pt-sub); }
.pt-gain-safety { padding: 4px 16px 12px; display: grid; gap: 7px; }
.pt-safe { padding: 9px 11px; border-radius: var(--pt-r-s); font-size: 12.5px; line-height: 1.7;
    border: 1px solid var(--pt-border); background: var(--pt-card-2); color: var(--pt-sub); }
.pt-safe.is-ok { border-color: var(--pt-ok); color: var(--pt-ok); }
.pt-safe.is-warn { border-color: var(--pt-warn); background: var(--pt-warn-soft); }
.pt-safe.is-err { border-color: var(--pt-err); background: var(--pt-err-soft); }
.pt-gain-log { padding: 0 16px 16px; }
.pt-log-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
    padding: 8px 10px; border-top: 1px solid var(--pt-border); font-size: 12px; color: var(--pt-sub); }
.pt-log-row b { color: var(--pt-ok); }

/* ---------- 规则生成器 ---------- */
.pt-rules-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 14px; align-items: start; }
.pt-rules-grid > .pt-card--out, .pt-rules-grid > .pt-card:last-child { position: sticky; top: 62px; }
.pt-prompt-out, .pt-install {
    margin: 0; padding: 14px 16px; font-size: 12.5px; line-height: 1.75; color: var(--pt-text);
    white-space: pre-wrap; word-break: break-word; overflow: auto; scrollbar-width: thin;
}
.pt-prompt-out { min-height: 380px; max-height: 60vh; background: var(--pt-bg); }
.pt-install { border-top: 1px solid var(--pt-border); background: var(--pt-card-2); font-size: 12px; color: var(--pt-sub); max-height: 180px; }

/* ---------- 决策阶梯 ---------- */
.pt-ladder { padding: 12px 16px 18px; display: grid; gap: 9px; }
.pt-rung { border: 1px solid var(--pt-border); border-left: 3px solid var(--pt-accent-2); border-radius: var(--pt-r-s);
    background: var(--pt-card-2); padding: 10px 13px; margin-left: calc(var(--pt-rung, 0) * 14px); }
.pt-rung-h { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pt-rung-n { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    background: var(--pt-accent-soft); color: var(--pt-accent); font-size: 12px; font-weight: 700; }
.pt-rung-t { font-size: 13.5px; font-weight: 650; flex: 1 1 auto; min-width: 0; }
.pt-rung-p { margin: 7px 0 0 33px; font-size: 12.5px; line-height: 1.8; color: var(--pt-sub); }
.pt-rung-e { margin: 6px 0 0 33px; padding: 7px 10px; border-radius: 7px; background: var(--pt-bg);
    font-family: var(--pt-mono); font-size: 11.8px; color: var(--pt-blue); white-space: pre-wrap; }
.pt-never { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 9px; padding: 14px 16px 18px; }
.pt-never-i { padding: 11px 13px; border-radius: var(--pt-r-s); border: 1px solid var(--pt-err);
    background: var(--pt-err-soft); font-size: 12.5px; line-height: 1.7; }
.pt-never-i b { display: block; margin-bottom: 4px; color: var(--pt-err); }

/* ---------- 案例库 ---------- */
.pt-examples { padding: 14px 16px 18px; display: grid; gap: 12px; }
.pt-ex { border: 1px solid var(--pt-border); border-radius: var(--pt-r-s); overflow: hidden; }
.pt-ex-h { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 10px 13px; background: var(--pt-card-2); }
.pt-ex-h b { font-size: 13.5px; }
.pt-ex-h .pt-pill { margin-left: auto; }
.pt-ex-task { padding: 8px 13px 0; font-size: 12.5px; color: var(--pt-sub); line-height: 1.7; }
.pt-ex-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px 13px 12px; }
.pt-ex-code { min-width: 0; }
.pt-ex-code h4 { margin: 0 0 6px; font-size: 11.5px; color: var(--pt-faint); font-weight: 600; }
.pt-ex-code pre { margin: 0; padding: 9px 10px; border-radius: 7px; background: var(--pt-bg);
    font-size: 11.8px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; max-height: 210px; overflow: auto; }
.pt-ex-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    padding: 0 13px 12px; font-size: 12px; color: var(--pt-faint); }

/* ---------- 命令 / 基准 / FAQ ---------- */
.pt-commands { padding: 12px 16px 18px; display: grid; gap: 7px; }
.pt-cmd-row { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr) auto; gap: 9px; align-items: start;
    padding: 8px 10px; border: 1px solid var(--pt-border); border-radius: var(--pt-r-s); background: var(--pt-card-2); }
.pt-cmd-row code { font-size: 12px; color: var(--pt-accent); word-break: break-all; }
.pt-cmd-row span { font-size: 12.5px; color: var(--pt-sub); line-height: 1.65; }
.pt-bench { padding: 12px 16px 0; display: grid; gap: 9px; }
.pt-bar-row { display: grid; grid-template-columns: minmax(90px, 130px) minmax(0, 1fr) auto; gap: 9px; align-items: center; font-size: 12px; }
.pt-bar-row > span { color: var(--pt-sub); }
.pt-bar-track { height: 12px; border-radius: 999px; background: var(--pt-card-3); overflow: hidden; }
.pt-bar-fill { height: 100%; border-radius: 999px; background: var(--pt-accent-2); }
.pt-bar-fill.is-base { background: var(--pt-border-2); }
.pt-bar-row b { font-variant-numeric: tabular-nums; color: var(--pt-text); min-width: 62px; text-align: right; }
.pt-bench-extra { padding: 6px 0 0; display: grid; gap: 5px; font-size: 12px; color: var(--pt-sub); line-height: 1.7; }
.pt-faq { padding: 12px 16px 18px; display: grid; gap: 8px; }
.pt-faq details { border: 1px solid var(--pt-border); border-radius: var(--pt-r-s); background: var(--pt-card-2); }
.pt-faq summary { padding: 10px 12px; cursor: pointer; font-size: 13px; font-weight: 600; }
.pt-faq details p { margin: 0; padding: 0 12px 11px; font-size: 12.5px; line-height: 1.8; color: var(--pt-sub); }
.pt-card--source { padding: 16px; }
.pt-card--source p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.85; color: var(--pt-sub); }

/* ---------- Toast ---------- */
.pt-toast {
    position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    z-index: 100002; max-width: min(88vw, 560px); padding: 11px 16px; border-radius: 10px;
    background: var(--pt-card-3); color: var(--pt-text); border: 1px solid var(--pt-border-2);
    box-shadow: var(--pt-shadow); font-size: 13px; line-height: 1.6;
}
.pt-toast.is-err { border-color: var(--pt-err); }

/* ==================== 修复轮增强（置于断点之前，保证可被断点覆盖） ==================== */
.pt-tabs, .pt-code, .pt-findings, .pt-prompt-out, .pt-install, .pt-ex-code pre, .pt-find-ev {
    scrollbar-width: thin; scrollbar-color: var(--pt-border-2) transparent;
}
.pt-tabs::-webkit-scrollbar, .pt-code::-webkit-scrollbar, .pt-findings::-webkit-scrollbar,
.pt-prompt-out::-webkit-scrollbar, .pt-install::-webkit-scrollbar,
.pt-ex-code pre::-webkit-scrollbar, .pt-find-ev::-webkit-scrollbar { width: 10px; height: 10px; }
.pt-tabs::-webkit-scrollbar-thumb, .pt-code::-webkit-scrollbar-thumb,
.pt-findings::-webkit-scrollbar-thumb, .pt-prompt-out::-webkit-scrollbar-thumb,
.pt-install::-webkit-scrollbar-thumb, .pt-ex-code pre::-webkit-scrollbar-thumb,
.pt-find-ev::-webkit-scrollbar-thumb { background: var(--pt-border-2); border-radius: 8px; }
/* 长文本限制行宽，超宽屏不再出现 2000px 的单行段落 */
.pt-find-b p, .pt-rung-p, .pt-faq details p, .pt-card--source p, .pt-note,
.pt-inline-note, .pt-ex-task, .pt-ex-foot > span, .pt-verdict, .pt-hero-sub { max-width: 88ch; }
.pt-lead { max-width: 96ch; }
/* 分组标题在报告自身滚动区内吸顶 */
.pt-group-t { position: sticky; top: 0; z-index: 2; padding: 8px 0; background: var(--pt-card); }
.pt-find:nth-child(even) { background: var(--pt-zebra); }
@media (hover: hover) {
    .pt-find:hover { border-color: var(--pt-border-2); box-shadow: var(--pt-shadow-sm); }
    .pt-btn:hover { transform: translateY(-1px); }
}

/* ==================== 响应式 ==================== */
@media (min-width: 2200px) {
    .pt { padding-left: clamp(34px, 2.4vw, 64px); padding-right: clamp(34px, 2.4vw, 64px); }
    .pt-stat b { font-size: 24px; }
}
@media (min-width: 1600px) {
    .pt { padding-left: 34px; padding-right: 34px; }
    #ptPaneReview { grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr); }
    .pt-rules-grid { grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); }
    .pt-stat b { font-size: 23px; }
    .pt-ex-codes { gap: 14px; }
}
@media (max-width: 1400px) {
    .pt-rules-grid { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
}
@media (max-width: 1100px) {
    .pt { padding: 18px 18px 60px; }
    #ptPaneReview, .pt-rules-grid { grid-template-columns: minmax(0, 1fr); }
    .pt-rules-grid > .pt-card:last-child { position: static; }
    .pt-card--report .pt-findings { max-height: none; }
    .pt-group-t { position: static; }   /* 报告不再自身滚动，吸顶会与页签打架 */
    .pt-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* 平板专属边框规则：不再用高特异性污染手机 2 列布局 */
@media (min-width: 768px) and (max-width: 1100px) {
    .pt-stat:nth-child(4) { border-left: 0; }
    .pt-stat:nth-child(n + 4) { border-top: 1px solid var(--pt-border); }
}
@media (max-width: 900px) {
    .pt-grid-2, .pt-ex-codes { grid-template-columns: minmax(0, 1fr); }
    .pt-rung { margin-left: 0; }
    .pt-hero-sub { font-size: 13px; }
}
@media (max-width: 767px) {
    .pt { padding: 14px 12px 56px; }
    .pt-hero { padding: 14px; gap: 10px; }
    .pt-hero-ic { width: 38px; height: 38px; font-size: 19px; }
    .pt-hero-t { font-size: 18px; }
    .pt-fold { width: 44px; height: 44px; }
    .pt-tabs { top: 0; gap: 4px; padding: 4px; }
    .pt-tab { flex: 0 0 auto; min-height: 44px; padding: 9px 12px; font-size: 12.5px; }
    .pt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pt-stat { border-left: 1px solid var(--pt-border); border-top: 1px solid var(--pt-border); padding: 10px 12px; }
    .pt-stat:nth-child(odd) { border-left: 0; }
    .pt-stat:nth-child(4) { border-left: 1px solid var(--pt-border); }
    .pt-stat:nth-child(-n + 2) { border-top: 0; }
    .pt-stat b { font-size: 18px; }
    .pt-card-head { padding: 10px 12px; }
    .pt-io-bar, .pt-form { padding: 10px 12px; }
    .pt-field { flex: 1 1 100%; }
    .pt-btn, .pt-btn-sm { min-height: 44px; padding: 10px 13px; font-size: 13px; }
    .pt-input, .pt-select, .pt-mini-ta, .pt-code, .pt-code--gain { font-size: 16px; }
    .pt-code { width: calc(100% - 24px); margin: 10px 12px 0; min-height: 240px; }
    .pt-code--gain { min-height: 200px; }
    .pt-prompt-out { min-height: 260px; max-height: 52vh; }
    .pt-io-foot { padding: 8px 12px 12px; }
    .pt-drop { margin: 10px 12px 0; min-height: 64px; }
    .pt-file-chip button { width: 40px; height: 40px; display: grid; place-items: center; }
    .pt-checks input { width: 20px; height: 20px; }
    .pt-report-meta { padding: 10px 12px; }
    .pt-findings, .pt-audit-out, .pt-debt-out, .pt-examples, .pt-commands, .pt-faq { padding-left: 12px; padding-right: 12px; }
    .pt-find-b { padding-left: 12px; }
    .pt-cmd-row { grid-template-columns: minmax(0, 1fr); }
    .pt-cmd-row button { justify-self: start; }
    .pt-bar-row { grid-template-columns: minmax(70px, 100px) minmax(0, 1fr) auto; }
    .pt-rung-p, .pt-rung-e { margin-left: 0; }
}
/* 站点 mobile-header 在 ≤700px 出现且高约 53px：页签与卡片头必须让位 */
@media (max-width: 700px) {
    :root { --pt-sticky-top: 105px; }
    .pt-tabs { top: 53px; }
}
@media (max-width: 420px) {
    .pt-hero-tags { gap: 5px; }
    .pt-tag { font-size: 11.5px; padding: 3px 8px; }
    .pt-hero-ic { display: none; }
    .pt-card-acts { gap: 5px; }
    .pt-gain-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* 触屏平板 / 手机：16px 防 iOS 聚焦放大，44px 触控目标（不误伤桌面窄窗口） */
@media (pointer: coarse) {
    .pt-input, .pt-select, .pt-mini-ta, .pt-code, .pt-code--gain { font-size: 16px; }
    .pt-btn, .pt-btn-sm, .pt-tab, .pt-fold { min-height: 44px; }
    .pt-fold { width: 44px; height: 44px; }
    .pt-file-chip button { min-width: 40px; min-height: 40px; }
}
@media (hover: none) {
    .pt-btn:not(.pt-btn-pri):hover, .pt-tab:not(.is-on):hover { background: var(--pt-card-2); }
    .pt-drop:hover { border-color: var(--pt-border-2); }
    .pt-btn:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .pt *, .pt *::before, .pt *::after { transition: none !important; animation: none !important; }
}
@media print {
    .pt-tabs, .pt-card-acts, .pt-drop, .pt-toast { display: none !important; }
    .pt-pane[hidden] { display: block !important; }
    .pt-card { break-inside: avoid; box-shadow: none; }
}
