
/* ------------------------------------------------------------
   1. 顶栏：与首页逐像素对齐
   ------------------------------------------------------------ */
body.page-compact .appbar{
  background:linear-gradient(180deg,rgba(255,255,255,.88),rgba(247,249,252,.74));
  backdrop-filter:saturate(180%) blur(16px);
  -webkit-backdrop-filter:saturate(180%) blur(16px);
  border-bottom:1px solid #e5eaf2;
  box-shadow:0 1px 0 rgba(255,255,255,.75) inset,0 12px 28px -26px rgba(16,24,40,.45);
}
body.page-compact .brand{padding:4px 0;border-radius:8px;text-decoration:none}
body.page-compact .brand-logo{transition:transform var(--t-base)}
body.page-compact .nav{margin-left:0}
body.page-compact .nav a{
  position:relative;border:1px solid transparent;
  transition:background var(--t-fast),color var(--t-fast),border-color var(--t-fast),box-shadow var(--t-fast);
}
body.page-compact .nav a:hover{background:rgba(16,24,40,.045);color:var(--ink)}

/* ------------------------------------------------------------
   2. 背景：关掉极光色雾，只留首页同款舞台层
   ------------------------------------------------------------ */
body.page-compact::before{display:none}

body.page-compact::after{
  content:'';position:fixed;inset:0;z-index:-1;pointer-events:none;
  background-image:
    radial-gradient(680px 340px at 50% -4%,rgba(37,99,235,.07),transparent 72%),
    linear-gradient(rgba(15,23,42,.035) 1px,transparent 1px),
    linear-gradient(90deg,rgba(15,23,42,.035) 1px,transparent 1px);
  background-size:auto,56px 56px,56px 56px;
  background-position:center top,center top,center top;
  background-repeat:no-repeat,repeat,repeat;
  -webkit-mask-image:radial-gradient(1200px 760px at 50% 22%,#000 0%,rgba(0,0,0,.56) 48%,rgba(0,0,0,.10) 76%,transparent 90%);
  mask-image:radial-gradient(1200px 760px at 50% 22%,#000 0%,rgba(0,0,0,.56) 48%,rgba(0,0,0,.10) 76%,transparent 90%);
}

/* ------------------------------------------------------------
   3. 页头：只保留底部 1px 品牌地平线（首页 .hero::after 同款）
   ------------------------------------------------------------ */
body.page-compact .hero{
  background:transparent; /* 去掉 suite.css 那层 .02 蓝渐变，与首页一致 */
}
body.page-compact .hero::before{
  content:'';position:absolute;left:0;right:0;bottom:0;height:1px;z-index:1;pointer-events:none;
  background:linear-gradient(90deg,transparent,rgba(37,99,235,.14) 18%,rgba(37,99,235,.30) 50%,rgba(37,99,235,.14) 82%,transparent);
}

/* ------------------------------------------------------------
   4. 工作台卡顶部彩条：全宽 + 四色中心点（12.5/37.5/62.5/87.5）
      + 50% 强度 + 两端 12%/88% 渐隐。
      卡片圆角会自动裁切背景层，两端自然收进圆角里。
   ------------------------------------------------------------ */
body.page-compact .card{
  background-image:linear-gradient(90deg,
    rgba(37,99,235,0) 0%,
    rgba(37,99,235,.5) 12.5%,
    rgba(79,70,229,.5) 37.5%,
    rgba(13,148,136,.5) 62.5%,
    rgba(124,58,237,.5) 87.5%,
    rgba(124,58,237,0) 100%);
  background-size:100% 2px;
  background-position:center top;
  background-repeat:no-repeat;
}

/* ------------------------------------------------------------
   5. 窄屏：字标缩小沿用 suite.css 的 .brand-logo 规则，此处无需重复；
      其余窄屏菜单交互继续沿用 suite.css，不动。
   ------------------------------------------------------------ */


/* 卡片宽度 880 -> 870（suite.css 的 --page-narrow 保持不动） */
body.page-compact .page{max-width:870px}

/* 共通间距收紧：只动输入态可见的外壳 / 按钮行 / 参数行，不碰文字与结构 */
body.page-compact .hero{padding-top:16px;padding-bottom:8px}
body.page-compact .page{padding-top:6px;padding-bottom:4px}
body.page-compact .card{padding-top:18px;padding-bottom:18px}
body.page-compact .actions{margin-top:16px}
body.page-compact .cmd-ref{margin-top:12px}
body.page-compact .param-table{margin-bottom:6px}
body.page-compact .seg{margin-bottom:16px}

/* 步骤间距：各页原值不同，按页收，convert 本来只有 10px 不能反向变宽 */
body.page-compact:has(.param-table) .step + .step{margin-top:6px}
body.page-compact:has(.seg) .step + .step{margin-top:16px}
body.page-compact:has(.cmd-ref):not(:has(.param-table)):not(:has(.seg)) .step + .step{margin-top:20px}

/* convert 额外收一点：它是唯一溢出的页，多出参数表 + 目标密码区 + 参考命令 */
body.page-compact:has(.param-table) .lab{margin-bottom:6px}
body.page-compact:has(.param-table) .step .body{padding-bottom:0}
body.page-compact:has(.param-table) .card{padding-top:16px;padding-bottom:16px}

/* 文本框增高：900 -> 目标值，768 -> 自动回落到原值。
   K 值含页头 128px 的占用：页头每高 1px 文本框少 1px，视口变化时自动平衡 */
body.page-compact:has(.step-result) .text-input{
  height:clamp(190px,calc(100svh - 560px),250px);   /* 900:250 / 768:208 */
}
body.page-compact:has(.seg) .text-input{
  height:clamp(135px,calc(100svh - 748px),168px);   /* 900:152 / 768:135 */
}
body.page-compact:has(.cmd-ref):not(:has(.param-table)):not(:has(.seg)) .text-input{
  height:clamp(170px,calc(100svh - 714px),194px);   /* 900:186 / 768:170 */
}
/* convert 的输入框保持 130px 不动（该页目标只是消除首屏滚动） */

/* ------------------------------------------------------------
   7. 入场动效：与首页 index.html 的 rise 完全一致
      @keyframes rise{from{opacity:0;transform:translateY(14px)}to{...}}
      顶栏 / 页脚用纯淡入，避免底部 14px 位移在临界视口闪出滚动条；
      标题、副标题、工作台卡按 0.02 / 0.08 / 0.14s 依次缓出。
      .box 自带 position:relative，卡片位移不会改变上传/密码按钮的包含块。
   ------------------------------------------------------------ */
@keyframes rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@keyframes softFade{from{opacity:0}to{opacity:1}}
body.page-compact .appbar{animation:softFade .5s var(--ease) both}
body.page-compact .hero h1{animation:rise .6s var(--ease) .02s both}
body.page-compact .hero p.sub{animation:rise .6s var(--ease) .08s both}
body.page-compact .card{animation:rise .62s var(--ease) .14s both}
body.page-compact .site-footer{animation:softFade .6s var(--ease) .24s both}

@media (prefers-reduced-motion:reduce){
  body.page-compact .appbar,
  body.page-compact .hero h1,
  body.page-compact .hero p.sub,
  body.page-compact .card,
  body.page-compact .site-footer{animation:none!important}
}

/* ------------------------------------------------------------
   8. 窄屏：恢复 suite.css / 各页 style.css 原本的断点约定
      （上面的收紧规则特异性更高，必须在这里显式还原）
   ------------------------------------------------------------ */
@media (max-width:680px){
  body.page-compact .hero{padding:26px 18px 14px}
  body.page-compact .page{padding:14px 14px 52px}
  body.page-compact .card{padding:20px 16px}
}
@media (max-width:640px){
  /* match 的选择器带两层 :not()，这里要写全才能盖住，否则 390px 下仍是 170px */
  body.page-compact:has(.step-result) .text-input,
  body.page-compact:has(.param-table) .text-input,
  body.page-compact:has(.seg) .text-input,
  body.page-compact:has(.cmd-ref):not(:has(.param-table)):not(:has(.seg)) .text-input{height:150px}
}

/* ------------------------------------------------------------
   9. 工具页标题：与「关于本站」.post-title 同款渐变字
      只取颜色语言（#0f172a → #1d4ed8），不搬小标 / 装饰线 / 镜面光带。
      老浏览器不支持 background-clip:text 时回落到纯色，避免标题消失。
   ------------------------------------------------------------ */
body.page-compact .hero h1{
  background:linear-gradient(92deg,#0f172a 0%,#1d4ed8 92%);
  -webkit-background-clip:text;background-clip:text;
  -webkit-text-fill-color:transparent;
}
@supports not ((-webkit-background-clip:text) or (background-clip:text)){
  body.page-compact .hero h1{background:none;color:var(--ink);-webkit-text-fill-color:currentColor}
}

/* ------------------------------------------------------------
   10. convert 目标参数区：新证书密码 | 别名 两列并排
   两个标题都用通用 .lab b（与源区「原证书密码」同字号、顶部对齐），
   输入框各占约半宽（不再占满整行）；随机生成按钮留在密码框右侧。
   DOM 把标题 .lab 移进各 .ks-field，app.js 非 JKS 目标隐藏 #aliasField，
   此时密码列靠 flex:1 自动占满整行。所有 id / 事件绑定保持原样。
   ------------------------------------------------------------ */
body.page-compact:has(.param-table) .ks-fields{
  display:flex;gap:20px;align-items:flex-start;
}
body.page-compact:has(.param-table) .ks-field{
  display:block;flex:1 1 0;min-width:0;
}
body.page-compact:has(.param-table) .ks-field > .lab{margin-bottom:10px}
body.page-compact:has(.param-table) .ks-field > .param-input{width:100%;min-width:0}
body.page-compact:has(.param-table) .ks-pwd-row{
  display:flex;gap:8px;
}
body.page-compact:has(.param-table) .ks-pwd-input{
  position:relative;flex:1 1 auto;min-width:0;
}
body.page-compact:has(.param-table) .ks-pwd-input > .param-input{width:100%}
body.page-compact:has(.param-table) .gen-pwd-btn{flex:0 0 auto}
/* 兼容模式勾选区：随行拉伸到按钮同高，内容垂直居中（display 由 JS 切换，勿在此设 display） */
body.page-compact:has(.param-table) #pfxCompatWrap{display:flex;align-items:center;gap:6px}
/* i 图标 + 悬停气泡：复用 FAQ 徽章配色，气泡绝对定位、抬高 z-index */
body.page-compact:has(.param-table) .tip-i{
  flex:0 0 auto;width:15px;height:15px;border-radius:50%;display:grid;place-items:center;
  background:#eef4ff;color:#2563eb;font-size:11px;font-weight:700;line-height:1;cursor:help;
}
body.page-compact:has(.param-table) .tip-wrap{position:relative;display:flex;align-items:center}
body.page-compact:has(.param-table) .tip-bubble{
  position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);
  width:max-content;max-width:260px;background:#0f172a;color:#fff;font-size:12px;font-weight:400;
  line-height:1.6;padding:9px 12px;border-radius:8px;box-shadow:0 10px 28px -10px rgba(15,23,42,.45);
  opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s;z-index:40;white-space:normal;
}
body.page-compact:has(.param-table) .tip-bubble::after{
  content:"";position:absolute;top:100%;left:50%;transform:translateX(-50%);
  border:6px solid transparent;border-top-color:#0f172a;
}
body.page-compact:has(.param-table) .tip-wrap:hover .tip-bubble,
body.page-compact:has(.param-table) .tip-wrap:focus-within .tip-bubble{opacity:1;visibility:visible}

/* 窄屏：折成上下两行，避免随机生成按钮把密码框挤窄 */
@media (max-width:680px){
  body.page-compact:has(.param-table) .ks-fields{flex-wrap:wrap;gap:14px}
  body.page-compact:has(.param-table) .ks-field{flex:1 1 100%}
  /* 兼容模式放到下一行独占，否则和随机生成一起把密码框挤到 48px */
  body.page-compact:has(.param-table) .ks-pwd-row{flex-wrap:wrap}
  body.page-compact:has(.param-table) #pfxCompatWrap{flex:1 1 100%}
  /* 气泡改为左对齐图标，宽度按视口收缩，避免两端被裁出屏幕 */
  body.page-compact:has(.param-table) .tip-bubble{left:0;transform:none;max-width:calc(100vw - 130px)}
  body.page-compact:has(.param-table) .tip-bubble::after{left:12px;transform:none}
}

/* ------------------------------------------------------------
   11. 四页页头统一高度并拉高：96 / 116px → 128px（对齐视口无关）
   实测余量（1440x900，页脚顶 840）：convert 13 / view 278 /
   convert-key 19 / match 26。页头统一 +32（convert +12）后：
     - view 余 246px，无需补偿；
     - convert 挤 8px 间距（actions / cmd-ref / card 底）；
     - convert-key 文本框 168→152 + 挤 4px 间距；
     - match 文本框 194→186 + 步骤间距 24→20。
   各页余量 ≥6px，首屏继续零滚动；矮屏 / 窄屏回落原压缩值。
   ------------------------------------------------------------ */
@media (min-width:681px) and (min-height:840px){
  /* 32 + 标题 36 + 副题间距 8 + 副题 20 + 32 = 128px，四页逐像素一致 */
  body.page-compact .hero{padding-top:32px;padding-bottom:32px}
  body.page-compact .page{padding-top:7px}
  body.page-compact .hero h1{font-size:28px}

  /* convert：+12px 后只剩 1px 余量，从按钮行 / 参考命令 / 卡片底再挤 8px */
  body.page-compact:has(.param-table) .actions{margin-top:12px}
  body.page-compact:has(.param-table) .cmd-ref{margin-top:10px}
  body.page-compact:has(.param-table) .card{padding-bottom:14px}
}

/* 窄屏：label 按内容宽，给输入框多留一点空间；两列自然折成上下两行 */
@media (max-width:680px){
  body.page-compact:has(.param-table) .ks-field > .field-label{flex:0 0 auto}
}

/* ------------------------------------------------------------
   12. 工具页「常见问题」右栏（convert / convert-key 共用）：
      表单卡保持 870px 居中不动，宽屏时 FAQ 悬浮于右侧空白，
      窄屏回落卡下堆叠。DOM：<aside class="side-rail"><section
      class="rail-card"><h2 class="rail-title"> + .faq-item 组。
   ------------------------------------------------------------ */
.side-rail{margin-top:16px}
.rail-card{background:#fff;border:1px solid #e6ebf2;border-radius:14px;padding:4px 16px;box-shadow:0 10px 34px -14px rgba(23,52,99,.08)}
.rail-title{margin:0;padding:12px 0 6px;font-size:15px;font-weight:600;color:#0f172a}
.rail-card .faq-item{margin:0;border:none;border-top:1px solid #eef2f7;border-radius:0;background:none;overflow:visible}
.rail-card .faq-item summary{display:flex;align-items:center;gap:9px;padding:12px 0;font-size:14px;font-weight:600;cursor:pointer;list-style:none}
.rail-card .faq-item summary::-webkit-details-marker{display:none}
.rail-card .faq-q{flex:0 0 auto;width:22px;height:22px;border-radius:6px;display:grid;place-items:center;background:#eef4ff;color:#2563eb;font-size:12px;font-weight:700}
.rail-card .faq-item summary .chev{margin-left:auto;color:#94a3b8;transition:transform .2s}
.rail-card .faq-item[open] summary .chev{transform:rotate(180deg)}
.rail-card .faq-a{margin:0;padding:0 0 12px 31px;font-size:13.5px;color:#44546b;line-height:1.75}
.rail-card .faq-a + .faq-a{margin-top:-6px}
.rail-card .faq-a code{font-family:Consolas,Menlo,monospace;font-size:12.5px;background:#f2f5f9;border-radius:4px;padding:1px 5px;color:#475569}
@media (min-width:1440px){
  body.page-compact main.page{position:relative}
  body.page-compact .side-rail{position:absolute;top:2px;left:calc(50% + 459px);width:min(360px,calc(50vw - 467px));margin-top:0}
}
