/* ===== base shell ===== */
#lhps-app{max-width:1120px;margin:0 auto;padding:20px;font-family:Arial,"Microsoft YaHei",sans-serif;color:#13253d}
.lhps-shell{background:#f7f4ed;min-height:560px;padding:0 28px 40px;border-radius:22px}
.lhps-head{height:70px;border-bottom:1px solid #e4ded4;display:flex;justify-content:space-between;align-items:center}
.lhps-head b{font-size:18px}.lhps-head b:first-letter{background:#13253d;color:#fff}
.lhps-head span{font-size:12px;color:#748295}
.lhps-warn{margin:14px 0 0;padding:10px 14px;background:#fdf3e3;border:1px solid #f0dcb0;color:#8a6716;border-radius:10px;font-size:12px;text-align:center}
.lhps-preview-bar{display:flex;align-items:center;gap:12px;padding:10px 14px;background:#eef4e7;border-bottom:1px solid #cfe0da;font-size:12px;color:#4c6b52;flex-shrink:0}
.lhps-preview-bar button{border:0;background:#0f9d8a;color:#fff;border-radius:20px;padding:6px 14px;font-size:12px;cursor:pointer;flex-shrink:0}
.lhps-preview-bar button:hover{background:#0c8778}
.lhps-preview-modal{padding:0;background:#0f1d2ecc}
.lhps-preview-frame{width:min(720px,100%);height:100%;max-height:100vh;background:#f3f6ee;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 20px 60px rgba(0,0,0,.35)}
.lhps-preview-frame iframe{flex:1;border:0;width:100%}

/* ===== upload / success ===== */
.lhps-intro{padding:60px 0 35px}
.lhps-intro small,.lhps-success>small,.lhps-dialog small{color:#2967a6;letter-spacing:.16em;font-size:10px;font-weight:700}
.lhps-intro h1{font-size:clamp(32px,4.4vw,52px);line-height:1.12;letter-spacing:-.02em;margin:16px 0 14px}
.lhps-intro h1 em{font-style:normal;color:#2967a6}
.lhps-intro p{max-width:430px;color:#708096;line-height:1.7;font-size:14px;margin:0}
.lhps-upload{height:250px;margin-top:24px;border:1.5px dashed #b8c8d8;border-radius:20px;background:#fff9;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:12px;cursor:pointer;transition:border-color .15s,background .15s}
.lhps-upload.lhps-drag-over{border-color:#0f9d8a;background:#f2faf8}
.lhps-upload:hover{background:#fff;border-color:#2967a6}
.lhps-upload input{display:none}
.lhps-upload strong{font-size:17px}
.lhps-upload span,.lhps-success p{font-size:13px;color:#708096}
.lhps-success small{display:block;margin-top:14px;font-size:13px;color:#708096}
.lhps-wait{text-align:center;padding:160px 0;color:#708096}
.lhps-success{max-width:650px;margin:70px auto;text-align:center;background:#fff;border:1px solid #dce5ee;border-radius:20px;padding:45px 28px}
.lhps-check{margin:auto;width:54px;height:54px;border-radius:50%;display:grid;place-items:center;background:#e9f6ed;color:#4b986c;font-size:28px}
.lhps-success h2{font:32px Georgia,serif;margin:20px 0 10px}
.lhps-link{display:flex;gap:8px;margin:24px 0;position:relative}
.lhps-copied-tip{position:absolute;top:-32px;right:0;background:#13253d;color:#fff;font-size:11px;padding:5px 10px;border-radius:6px;white-space:nowrap;pointer-events:none;animation:lhps-tip-in .15s ease}
@keyframes lhps-tip-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}
.lhps-link input{min-width:0;flex:1;border:1px solid #dce5ee;border-radius:8px;padding:12px;font-size:12px}
.lhps-link button,.lhps-open{border:0;border-radius:8px;color:#fff;padding:12px 16px;text-decoration:none;font-size:13px;cursor:pointer;font-family:inherit}
.lhps-link button{background:#0f9d8a}
.lhps-link button:hover{background:#0c8778}
.lhps-open{display:inline-block;background:#2967a6}
.lhps-big{margin:20px 0}
.lhps-reupload{display:block;margin:22px auto 0;border:0;background:transparent;color:#9aa6ac;font-size:12px;text-decoration:underline;cursor:pointer}
.lhps-share-tool{display:block;margin:16px auto 0;border:1px solid #cfe0da;background:#fff;color:#0c8778;font-size:12px;padding:8px 16px;border-radius:20px;cursor:pointer}
.lhps-share-tool:hover{background:#f2faf8}
.lhps-signer-picker{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;margin:16px 2px 0;font-size:13px;color:#4b5a6a}
.lhps-signer-picker input{border:1px solid #dce5ee;border-radius:8px;padding:7px 10px;font-size:13px;background:#fff;width:80px}
.lhps-signer-hint{flex-basis:100%;font-size:11px;color:#9aa6b0}
.lhps-signer-badge{background:#eef4e7;border:1px solid #cfe0da;color:#2f5c3d;border-radius:10px;padding:9px 14px;font-size:12px;margin-bottom:14px;text-align:center}
.lhps-warn-yellow{background:#fdf3e3;border:1.5px solid #f0dcb0;border-radius:12px;padding:14px 18px;margin:20px 0;font-size:13px;color:#8a6716;text-align:left}

/* ===== signing editor ===== */
.lhps-filebar{background:#fff;border:1px solid #dce5ee;border-radius:12px;padding:15px;margin:25px 0 18px;display:flex;justify-content:space-between;font-size:13px}
.lhps-filebar span{color:#708096}
.lhps-editor{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(240px,.6fr);gap:20px;align-items:start}
.lhps-sheet{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;position:relative;width:100%;max-width:860px;margin:0 auto;padding:10px 0 0}
.lhps-pdf-canvas{display:block;max-width:100%;height:auto;border:1px solid #e4e4df;box-shadow:0 14px 30px #1d2f4114;background:#fff}
.lhps-pagenav{display:flex;align-items:center;justify-content:center;gap:14px;margin-top:10px;font-size:12px;color:#708096}
.lhps-pagenav button{border:1px solid #dce5ee;background:#fff;border-radius:6px;padding:5px 10px;color:#2967a6}
.lhps-pagenav button:disabled{opacity:.4}
.lhps-empty{margin:60px auto;border:1px dashed #c9d7e4;border-radius:8px;padding:18px 22px;color:#9aaaba;font-size:12px;text-align:center}

.lhps-sticker{position:absolute;background:#e9f4fddd;border:1.5px solid #6ca2d2;border-radius:8px;cursor:grab;touch-action:none;display:flex;align-items:center;justify-content:center;flex-direction:column;padding:2px;z-index:3}
.lhps-sticker img{max-width:100%;max-height:100%;pointer-events:none}
.lhps-sticker .lhps-resize{position:absolute;right:-9px;bottom:-9px;width:20px;height:20px;border-radius:50%;background:#2967a6;border:2px solid #fff;cursor:nwse-resize;touch-action:none}
.lhps-sticker .lhps-rotate-fix{position:absolute;left:-9px;top:-9px;width:22px;height:22px;border-radius:50%;background:#fff;border:1.5px solid #2967a6;color:#2967a6;font-size:13px;line-height:1;cursor:pointer;padding:0}
.lhps-sticker .lhps-remove-stamp{position:absolute;right:-9px;top:-9px;width:22px;height:22px;border-radius:50%;background:#fff;border:1.5px solid #a63a2e;color:#a63a2e;font-size:14px;line-height:1;cursor:pointer;padding:0}

.lhps-editor aside{background:#fff;border:1px solid #dce5ee;border-radius:17px;padding:20px;display:flex;flex-direction:column}
.lhps-primary,.lhps-download{border:0;border-radius:10px;padding:14px 28px;text-align:center;display:flex;justify-content:center;align-items:center;gap:10px;font-weight:700;width:fit-content;max-width:100%;margin-left:auto;margin-right:auto}
.lhps-stamp-again{display:flex;justify-content:center;align-items:center;gap:8px;border:1.5px dashed #9ec7bd;background:#f2faf8;color:#0c8778;border-radius:10px;padding:10px 20px;font-weight:600;font-size:13px;width:fit-content;max-width:100%;margin:10px auto 0;cursor:pointer}
.lhps-stamp-again:hover{background:#e7f5f1}
.lhps-stamp-count{text-align:center;font-size:12px;color:#708096;margin-top:8px}
.lhps-primary{background:#0f9d8a;color:#fff}
.lhps-primary:hover{background:#0c8778}
.lhps-primary:disabled,.lhps-download:disabled{opacity:.5}
.lhps-download{background:#0f9d8a;color:#fff;margin-top:auto}
.lhps-download:hover{background:#0c8778}
.lhps-original{border-top:1px solid #edf0f3;border-bottom:1px solid #edf0f3;margin:25px 0;padding:16px 0;display:flex;justify-content:space-between;font-size:12px}
.lhps-original a{color:#2967a6;text-decoration:none}
.lhps-editor aside p{font-size:11px;color:#8b98a7;line-height:1.7}
.lhps-usage-note{background:#eef4e7;border:1px solid #cfe0da;border-radius:10px;padding:12px 14px;margin-bottom:14px;font-size:11px;color:#4c6b52;line-height:1.7}
.lhps-usage-note b{display:block;color:#2f5c3d;font-size:12px;margin-bottom:4px}
.lhps-notice{position:fixed;z-index:99;bottom:25px;left:50%;transform:translateX(-50%);background:#13253d;color:#fff;padding:12px 18px;border-radius:8px;font-size:13px;max-width:86vw;text-align:center}

/* ===== signature modal (desktop / default) ===== */
.lhps-modal{position:fixed;z-index:999;inset:0;background:#0f1d2e77;display:grid;place-items:center;padding:20px}
.lhps-dialog{width:min(560px,100%);background:#fff;border-radius:20px;padding:25px;position:relative}
.lhps-close{display:block;border:1px solid #dce5ee;border-radius:20px;padding:7px 16px;font-size:13px;color:#4b5a6a;background:#f7f9fb;margin-bottom:14px;cursor:pointer}
.lhps-dialog h2{font:32px Georgia;margin:12px 0 8px}
.lhps-signer-dialog{width:min(360px,100%)}
.lhps-signer-ask{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:14px;color:#33414f;margin:6px 0 4px}
.lhps-signer-ask input{width:2.6em;border:1px solid #dce5ee;border-radius:6px;padding:5px 6px;font-size:14px;text-align:center}
.lhps-orientation-note{color:#7e8c7e;font-size:12px;margin:0 0 14px;max-width:100%;overflow-wrap:break-word;word-break:break-word}
.lhps-orientation-note b{color:#2f5c3d;font-weight:600}
.lhps-pad{position:relative;height:190px;border:1px solid #cfdae3;border-radius:11px;background:repeating-linear-gradient(0deg,#fff,#fff 41px,#edf2f5 42px);overflow:hidden;touch-action:none}
.lhps-pad canvas{display:block;width:100%;height:100%;touch-action:none;cursor:crosshair}
.lhps-pad span{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:#b7c3cd;pointer-events:none;font-size:13px}
.lhps-dialog-actions{display:flex;justify-content:center;gap:10px;margin-top:18px}
.lhps-clear,.lhps-confirm{border:0;padding:11px 16px;border-radius:8px}
.lhps-clear{color:#68798b;background:#f1f4f6}
.lhps-confirm{background:#2967a6;color:#fff;font-weight:700}

/* ===== TRUE fullscreen signing pad on narrow phones =====
   Deliberately NOT using a CSS rotate transform here. An earlier version rotated the whole
   dialog with `transform:rotate(90deg)` + 100vh/100vw to fake landscape without requiring the
   device to actually turn — but 100vh doesn't reliably track the real visible area inside
   WeChat's in-app browser (it shifts as the address bar animates), and touch coordinates ended
   up measured against the wrong box, so strokes landed away from the finger. A plain, unrotated,
   full-screen box has no such ambiguity: getBoundingClientRect() is exact with no transform to
   account for, so drawing is pixel-accurate on every device. The trade-off is it's not a "true"
   landscape canvas unless the user physically turns their phone — but it IS as wide as the full
   screen, which already gives plenty of room to spread characters out. */
@media (max-width:900px){
  body.lhps-signing{position:fixed;width:100%;overflow:hidden}
  .lhps-signing .lhps-modal{padding:0;background:#0f1d2ecc}
  .lhps-signing .lhps-dialog{
    position:fixed;inset:0;
    max-width:none;max-height:none;
    border-radius:0;padding:16px 18px;
    display:flex;flex-direction:column;overflow:hidden;
    box-sizing:border-box;
  }
  .lhps-signing .lhps-dialog>*{max-width:100%;box-sizing:border-box}
  .lhps-signing .lhps-dialog h2{font-size:20px;margin:4px 0 4px}
  .lhps-signing .lhps-orientation-note{margin:0 0 8px}
  .lhps-signing .lhps-pad{flex:0 0 66%;min-height:0}
  .lhps-signing .lhps-dialog-actions{margin-top:12px;flex-shrink:0}
}

/* ===== responsive tweaks ===== */
@media(max-width:720px){
  #lhps-app{padding:8px}
  .lhps-shell{padding:0 15px 25px}
  .lhps-intro{padding:40px 0 25px}
  .lhps-intro h1{font-size:24px!important;line-height:1.4!important}
  .lhps-intro p{font-size:13px}
  .lhps-editor{grid-template-columns:1fr}
  .lhps-editor aside{min-height:290px}
  .lhps-filebar{gap:12px;line-height:1.4}
  .lhps-link{display:block}
  .lhps-link input{width:100%;margin-bottom:8px}
}

/* ===== standalone (WeChat share link) theme ===== */
.lhps-standalone{background:radial-gradient(900px 560px at 88% -8%,#eaf2e3 0%,transparent 60%),radial-gradient(800px 520px at -10% 108%,#edf3e6 0%,transparent 55%),#f3f6ee;position:relative;overflow-x:hidden}
/* 竹叶水墨装饰：固定于四角，不参与交互，仅在独立签字页显示 */
.lhps-bamboo-deco{position:fixed;pointer-events:none;z-index:0;opacity:.16;mix-blend-mode:multiply}
.lhps-bamboo-deco.tr{top:-40px;right:-60px;width:360px}
.lhps-bamboo-deco.bl{bottom:-50px;left:-70px;width:380px;transform:rotate(180deg)}
@media (max-width:720px){.lhps-bamboo-deco{display:none}}
.lhps-standalone #lhps-app{position:relative;z-index:1}
.lhps-standalone .lhps-shell{background:#fbfaf4;border:1px solid #e1e9d9;box-shadow:0 40px 80px -48px rgba(38,54,43,.35)}
.lhps-standalone .lhps-head{border-bottom-color:#e1e9d9}
.lhps-standalone .lhps-head b,.lhps-standalone .lhps-intro h1,.lhps-standalone .lhps-dialog h2{font-family:'Noto Serif SC',Georgia,serif}
.lhps-standalone .lhps-head b:first-letter{background:#2f5c3d}
.lhps-standalone .lhps-head span,.lhps-standalone .lhps-intro p,.lhps-standalone .lhps-upload span,.lhps-standalone .lhps-success p,.lhps-standalone .lhps-success small{color:#7e8c7e}
.lhps-standalone .lhps-intro h1{font-size:clamp(24px,2.8vw,36px)!important;line-height:1.35!important;letter-spacing:0!important;font-weight:600!important;margin:14px 0 12px!important;color:#26362b}
.lhps-standalone .lhps-intro h1 em{color:#4f8b5b}
.lhps-standalone .lhps-intro small{color:#2f5c3d}
.lhps-standalone .lhps-upload{border-color:#c4dbbe;background:#fff}
.lhps-standalone .lhps-upload:hover,.lhps-standalone .lhps-upload.lhps-drag-over{border-color:#4f8b5b;background:#f3f6ee}
.lhps-standalone .lhps-upload strong{color:#26362b}
.lhps-standalone .lhps-primary{background:#0f9d8a}
.lhps-standalone .lhps-primary:hover{background:#0c8778}
.lhps-standalone .lhps-download{background:#0f9d8a;color:#fff}
.lhps-standalone .lhps-download:hover{background:#0c8778}
.lhps-standalone .lhps-open{background:#2f5c3d}
.lhps-standalone .lhps-confirm{background:#a63a2e}
.lhps-standalone .lhps-confirm:hover{background:#8a2f26}
.lhps-standalone .lhps-pad{border-color:#e1e9d9;background:repeating-linear-gradient(0deg,#fff,#fff 41px,#eef2e7 42px)}
