/* pdf-editor.css — the free in-browser PDF editor at /pdf (and /pdf/zh, /pdf/fr).
   Two halves: the marketing landing page (.pe-hero … .pe-foot, same visual
   language as /kit) and the editor shell that replaces it once a file is open
   (.pe-bar / .pe-rail / .pe-stage / .pe-side). */

:root { color-scheme: light; }
body.pe-body-base {
  background: #fafaf9;
  color: #14110D;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
}

/* ─────────────────────────── landing page ─────────────────────────── */
.pe-wrap { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.pe-hero { padding: 3.5rem 0 2rem; }
.pe-eyebrow { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: #b45309; font-weight: 700; }
.pe-h1 { font-family: Fraunces, Georgia, "Songti SC", "Noto Serif SC", serif; font-weight: 500; font-size: clamp(2rem, 4.5vw, 3.4rem); line-height: 1.12; letter-spacing: -.01em; margin: .6rem 0 1rem; }
.pe-h1 em { font-style: italic; color: #b45309; }
.pe-lead { font-size: 1.1rem; line-height: 1.6; color: #44403c; max-width: 46rem; }
.pe-lead strong { color: #14110D; }
.pe-langs { display: inline-flex; gap: .35rem; align-items: center; margin-right: .5rem; font-size: .8rem; font-weight: 600; }
.pe-lang { padding: .25rem .5rem; border-radius: .4rem; color: #57534e; text-decoration: none; }
.pe-lang:hover { background: #f5f5f4; color: #14110D; }
.pe-lang.on { background: #14110D; color: #fff; }

.pe-drop { margin: 2rem 0 0; border: 2px dashed #d6d3d1; border-radius: 1.25rem; background: #fff; padding: 2.5rem 1.5rem; text-align: center; transition: border-color .15s, background .15s; }
.pe-drop.over { border-color: #b45309; background: #fffbeb; }
.pe-drop p { margin: 0; color: #57534e; }
.pe-drop .pe-big { font-size: 1.15rem; font-weight: 600; color: #14110D; margin-bottom: .35rem; }
.pe-btn-primary, .pe-btn-secondary { display: inline-flex; align-items: center; gap: .5rem; padding: .8rem 1.4rem; border-radius: .75rem; font-weight: 600; font-size: .95rem; border: 0; cursor: pointer; transition: background .15s, transform .05s; font-family: inherit; }
.pe-btn-primary:active, .pe-btn-secondary:active { transform: translateY(1px); }
.pe-btn-primary { background: #d97706; color: #fff; }
.pe-btn-primary:hover { background: #b45309; }
.pe-btn-secondary { background: #fff; color: #14110D; border: 1px solid #d6d3d1; }
.pe-btn-secondary:hover { border-color: #a8a29e; }
.pe-privacy { margin-top: 1rem; font-size: .85rem; color: #78716c; }
.pe-status { min-height: 1.5rem; margin-top: .75rem; color: #57534e; font-size: .95rem; }
.pe-status.pe-err, .pe-toast.pe-err { color: #b91c1c; }

.pe-section { padding: 3rem 0 0; }
.pe-h2 { font-family: Fraunces, Georgia, "Songti SC", "Noto Serif SC", serif; font-weight: 500; font-size: 1.9rem; letter-spacing: -.01em; margin: 0 0 1rem; }
.pe-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.pe-card { background: #fff; border: 1px solid #e7e5e4; border-radius: 1rem; padding: 1.25rem 1.35rem; }
.pe-card h3 { margin: 0 0 .4rem; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.pe-card p { margin: 0; color: #57534e; font-size: .95rem; line-height: 1.55; }
.pe-card .pe-ic { width: 1.4rem; height: 1.4rem; color: #b45309; flex: none; }
.pe-prose { color: #44403c; line-height: 1.65; max-width: 48rem; }
.pe-prose p { margin: 0 0 .9rem; }
.pe-guide { display: inline-block; margin-top: .4rem; font-weight: 600; color: #b45309; text-decoration: none; }
.pe-guide:hover { text-decoration: underline; }
.pe-steps { counter-reset: s; display: grid; gap: .9rem; margin: 1.2rem 0 0; padding: 0; list-style: none; max-width: 48rem; }
.pe-steps li { counter-increment: s; position: relative; padding-left: 2.6rem; color: #44403c; line-height: 1.6; }
.pe-steps li::before { content: counter(s); position: absolute; left: 0; top: -.1rem; width: 1.8rem; height: 1.8rem; border-radius: 999px; background: #14110D; color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 700; }
.pe-steps b { color: #14110D; }
.pe-faq details { background: #fff; border: 1px solid #e7e5e4; border-radius: .75rem; padding: .9rem 1.2rem; margin-bottom: .6rem; }
.pe-faq summary { cursor: pointer; font-weight: 600; }
.pe-faq p { margin: .6rem 0 0; color: #44403c; line-height: 1.6; }
.pe-foot { margin-top: 4rem; padding: 2rem 0 3rem; border-top: 1px solid #e7e5e4; font-size: .85rem; color: #78716c; }
.pe-foot a { color: #44403c; text-decoration: underline; text-underline-offset: 2px; }
.pe-foot .pe-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .75rem; }
@media (max-width: 640px) { .pe-hero { padding-top: 2rem; } .pe-drop { padding: 1.75rem 1rem; } }

/* ───────────────────────────── editor shell ───────────────────────────── */
body.pe-editing { overflow: hidden; }
body.pe-editing .pe-hide-when-editing { display: none !important; }

#pe-app { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: #e7e5e4; }
#pe-app[hidden] { display: none; }

.pe-bar { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; background: #fff; border-bottom: 1px solid #e7e5e4; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.pe-bar-l, .pe-bar-r { display: flex; align-items: center; gap: .3rem; flex: none; }
.pe-bar-r { margin-left: auto; }
.pe-fname { font-size: .8rem; color: #57534e; max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 .4rem; }
.pe-tools { display: flex; align-items: center; gap: .12rem; flex: none; padding: 0 .3rem; }
.pe-sep { width: 1px; height: 1.3rem; background: #e7e5e4; margin: 0 .25rem; flex: none; }

.pe-tool, .pe-btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; height: 2.05rem; min-width: 2.05rem; padding: 0 .38rem; border: 1px solid transparent; border-radius: .5rem; background: transparent; color: #44403c; cursor: pointer; font: inherit; font-size: .8rem; }
.pe-tool:hover, .pe-btn:hover:not(:disabled) { background: #f5f5f4; }
.pe-tool.on { background: #14110D; color: #fff; }
.pe-btn.on { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.pe-btn:disabled { opacity: .35; cursor: default; }
.pe-btn-t { padding: 0 .6rem; font-weight: 600; }
.pe-zoom { height: 2.05rem; min-width: 3.2rem; border: 1px solid #e7e5e4; border-radius: .5rem; background: #fff; font: inherit; font-size: .78rem; color: #57534e; cursor: pointer; }
.pe-go { height: 2.05rem; padding: 0 .95rem; border: 0; border-radius: .5rem; background: #d97706; color: #fff; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.pe-go:hover { background: #b45309; }

.pe-body { flex: 1; display: flex; min-height: 0; }

/* thumbnail rail */
.pe-rail { width: 15rem; flex: none; background: #fff; border-right: 1px solid #e7e5e4; overflow-y: auto; padding: .6rem; }
.pe-rail.off { display: none; }
.pe-rail-head { display: flex; flex-direction: column; gap: .4rem; padding: .2rem .2rem .6rem; border-bottom: 1px solid #f5f5f4; }
.pe-rail-head strong { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: #78716c; }
.pe-rail-acts, .pe-rail-bulk { display: flex; flex-wrap: wrap; gap: .3rem; }
.pe-rail-bulk { padding: .5rem .2rem; border-bottom: 1px solid #f5f5f4; align-items: center; }
.pe-mark-n { font-size: .72rem; color: #b45309; font-weight: 700; }
.pe-txtbtn { border: 1px solid #e7e5e4; background: #fff; border-radius: .4rem; padding: .28rem .5rem; font: inherit; font-size: .72rem; color: #44403c; cursor: pointer; }
.pe-txtbtn:hover { border-color: #d97706; color: #b45309; }
.pe-txtbtn.danger:hover { border-color: #dc2626; color: #b91c1c; }
.pe-ins-hint { font-size: .68rem; line-height: 1.4; color: #a8a29e; padding: .1rem .2rem 0; }
.pe-thumbs { display: grid; gap: 0; padding: .2rem .2rem .6rem; }
.pe-thumb { border: 2px solid transparent; border-radius: .5rem; padding: .25rem; }
.pe-thumb.on { border-color: #d97706; background: #fffbeb; }
.pe-thumb.cur { position: relative; }
.pe-thumb.cur .pe-thumb-box { border-color: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,.28); }
.pe-thumb.cur .pe-thumb-n { color: #fff; background: #d97706; border-radius: 999px; padding: .05rem .4rem; font-weight: 700; }
.pe-thumb.cur::before { content: ""; position: absolute; left: -.35rem; top: .25rem; bottom: .25rem; width: 3px; border-radius: 2px; background: #d97706; }

/* the strip between two thumbnails: click the + to insert a page exactly
   there, or drop a dragged thumbnail into it to move a page between two */
.pe-gap { height: 1.15rem; display: flex; align-items: center; justify-content: center; position: relative; }
.pe-gap::before { content: ""; position: absolute; left: .5rem; right: .5rem; height: 1px; background: transparent; transition: background .12s; }
.pe-gap:hover::before, .pe-gap.dropto::before { background: #d97706; }
.pe-gap.dropto::before { height: 2px; }
.pe-gap-btn { width: 1.15rem; height: 1.15rem; padding: 0; border-radius: 999px; border: 1px solid #e7e5e4; background: #fff; color: #a8a29e; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; z-index: 1; transition: color .12s, border-color .12s, transform .12s; }
.pe-gap:hover .pe-gap-btn, .pe-gap-btn:focus-visible { color: #b45309; border-color: #d97706; transform: scale(1.12); }

.pe-menu { position: fixed; z-index: 95; background: #fff; border: 1px solid #e7e5e4; border-radius: .6rem; box-shadow: 0 16px 40px -18px rgba(0,0,0,.5); padding: .25rem; display: grid; min-width: 10rem; max-width: 22rem; }
.pe-menu-i { display: flex; gap: .5rem; align-items: flex-start; text-align: left; border: 0; background: transparent; border-radius: .4rem; padding: .45rem .6rem; font: inherit; font-size: .8rem; color: #44403c; cursor: pointer; }
.pe-menu-i:hover { background: #f5f5f4; color: #14110D; }
.pe-menu-ic { flex: none; color: #a8a29e; display: inline-flex; margin-top: .1rem; }
.pe-menu-i:hover .pe-menu-ic { color: #b45309; }
.pe-menu-t b { display: block; font-weight: 600; }
.pe-menu-t i { display: block; font-style: normal; font-size: .72rem; line-height: 1.4; color: #a8a29e; margin-top: .1rem; }

/* find bar, and the markers it paints on the pages */
.pe-findbar { display: flex; align-items: center; gap: .35rem; padding: .4rem .6rem; background: #fffbeb; border-bottom: 1px solid #fde68a; flex-wrap: wrap; }
.pe-findbar[hidden] { display: none; }
.pe-find-ic { color: #b45309; display: inline-flex; }
.pe-find-inp { flex: 1; min-width: 8rem; max-width: 22rem; border: 1px solid #fde68a; background: #fff; border-radius: .45rem; padding: .35rem .55rem; font: inherit; font-size: .85rem; color: #14110D; }
.pe-find-inp:focus { outline: 2px solid #fbbf24; outline-offset: -1px; }
.pe-find-n { font-size: .75rem; color: #92400e; min-width: 3.4rem; font-variant-numeric: tabular-nums; }
.pe-fl { position: absolute; inset: 0; pointer-events: none; }
.pe-findmark { position: absolute; background: rgba(250, 204, 21, .45); outline: 1px solid rgba(180, 83, 9, .5); border-radius: 1px; }
.pe-findmark.on { background: rgba(249, 115, 22, .55); outline: 2px solid #b45309; }
.pe-tpl-n { flex: 1; font-size: .82rem; color: #44403c; }
.pe-thumb.drag { opacity: .4; }
.pe-thumb.dropto { border-color: #14110D; }
.pe-thumb-box { background: #fff; border: 1px solid #e7e5e4; border-radius: .3rem; overflow: hidden; cursor: pointer; }
.pe-thumb-box canvas { display: block; width: 100%; height: auto; }
.pe-thumb-foot { display: flex; align-items: center; gap: .25rem; padding: .25rem .1rem 0; }
.pe-thumb-n { font-size: .7rem; color: #78716c; min-width: 1.2rem; }
.pe-thumb-acts { display: flex; gap: .1rem; margin-left: auto; }
.pe-mini { border: 0; background: transparent; color: #a8a29e; cursor: pointer; padding: .15rem; border-radius: .25rem; display: inline-flex; }
.pe-mini:hover { background: #f5f5f4; color: #14110D; }

/* page stage */
.pe-stage { flex: 1; overflow: auto; padding: 1.4rem 1rem 4rem; display: flex; flex-direction: column; align-items: center; gap: 1.4rem; background: #e7e5e4; }
.pe-stage.pe-over { outline: 3px dashed #d97706; outline-offset: -8px; }
.pe-sheetwrap { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.pe-sheet { position: relative; background: #fff; box-shadow: 0 6px 26px -12px rgba(0,0,0,.4); outline: 0 solid transparent; transition: outline-color .15s, outline-width .15s; }
/* the page you are on gets a ring and a badge, on the sheet and in the rail —
   one faint border was not enough to feel like a selection */
.pe-sheetwrap.cur .pe-sheet { outline: 3px solid #d97706; outline-offset: 3px; }
.pe-canvas { display: block; width: 100%; height: 100%; }
.pe-cap { font-size: .72rem; color: #78716c; display: flex; align-items: center; gap: .4rem; }
.pe-cap-cur { display: none; font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: #d97706; border-radius: 999px; padding: .1rem .45rem; }
.pe-sheetwrap.cur .pe-cap { color: #14110D; font-weight: 600; }
.pe-sheetwrap.cur .pe-cap-cur { display: inline-block; }
.pe-ov { position: absolute; inset: 0; }
.pe-stage[data-tool="select"] .pe-ov { cursor: default; }
.pe-stage:not([data-tool="select"]) .pe-ov { cursor: crosshair; }
.pe-ghost { position: absolute; border: 1px dashed #b45309; background: rgba(217,119,6,.12); pointer-events: none; }

/* annotations */
.pe-an { position: absolute; box-sizing: border-box; }
.pe-stage[data-tool="select"] .pe-an { cursor: move; }
.pe-stage:not([data-tool="select"]) .pe-an { pointer-events: none; }
.pe-an.sel { outline: 1px solid #2563eb; outline-offset: 1px; }
.pe-an.editing { outline: 2px solid #2563eb; }
.pe-an svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pe-an-highlight .pe-hl { position: absolute; inset: 0; mix-blend-mode: multiply; }
.pe-tx { width: 100%; min-height: 100%; outline: 0; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.pe-tx:empty::before, .pe-note-tx:empty::before { content: attr(data-ph); color: #a8a29e; }
.pe-an.editing .pe-tx, .pe-an.editing .pe-note-tx { cursor: text; }
.pe-note { position: absolute; inset: 0; border-radius: .15rem .15rem .15rem 0; box-shadow: 1px 2px 6px -2px rgba(0,0,0,.35); padding: .35rem .45rem; overflow: hidden; }
/* "no background" note — just the words, sitting on the document */
.pe-note.bare { box-shadow: none; padding: .05rem .1rem; }
.pe-note.bare .pe-note-tx { color: #14110D; }
.pe-note-tx { outline: 0; white-space: pre-wrap; word-break: break-word; color: #3f3a22; line-height: 1.25; }
.pe-an.pin { width: 20px !important; height: 20px !important; }
.pe-stamp { position: absolute; inset: 0; border: 1.6px solid currentColor; border-radius: .1rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 3.6px currentColor; }
.pe-stamp i { font-style: normal; font-size: .62em; font-weight: 600; letter-spacing: .02em; opacity: .85; }

/* selection handles */
.pe-h { position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid #2563eb; border-radius: 2px; }
.pe-h-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.pe-h-n  { left: calc(50% - 4.5px); top: -5px; cursor: ns-resize; }
.pe-h-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.pe-h-e  { right: -5px; top: calc(50% - 4.5px); cursor: ew-resize; }
.pe-h-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.pe-h-s  { left: calc(50% - 4.5px); bottom: -5px; cursor: ns-resize; }
.pe-h-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.pe-h-w  { left: -5px; top: calc(50% - 4.5px); cursor: ew-resize; }
.pe-h-a  { left: -5px; top: -5px; border-radius: 50%; cursor: crosshair; }
.pe-h-b  { right: -5px; bottom: -5px; border-radius: 50%; cursor: crosshair; }
.pe-h-rot { left: calc(50% - 5px); top: -22px; border-radius: 50%; background: #2563eb; cursor: grab; }

/* right-hand style panel */
.pe-side { width: 15rem; flex: none; background: #fff; border-left: 1px solid #e7e5e4; overflow-y: auto; padding: .8rem; }
/* what the armed tool (or the selected mark) actually does, always on screen */
.pe-side-tool { display: flex; gap: .55rem; align-items: flex-start; background: #fafaf9; border: 1px solid #e7e5e4; border-radius: .6rem; padding: .6rem .65rem; margin-bottom: .6rem; }
.pe-side-ic { flex: none; width: 1.9rem; height: 1.9rem; border-radius: .45rem; background: #14110D; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.pe-side-tool b { display: block; font-size: .85rem; color: #14110D; }
.pe-side-tool i { display: block; font-style: normal; font-size: .74rem; line-height: 1.45; color: #78716c; margin-top: .15rem; }
.pe-side-page { font-size: .74rem; font-weight: 600; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: .45rem; padding: .35rem .5rem; margin-bottom: .8rem; }
.pe-side-h { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: #78716c; font-weight: 700; margin-bottom: .6rem; }
.pe-side-p { font-size: .76rem; color: #a8a29e; line-height: 1.5; margin: 0 0 .8rem; }
.pe-row { margin-bottom: .8rem; }
.pe-row-l { display: block; font-size: .72rem; color: #78716c; margin-bottom: .3rem; }
.pe-sw-row { display: flex; flex-wrap: wrap; gap: .28rem; align-items: center; }
.pe-sw { width: 1.35rem; height: 1.35rem; border-radius: .3rem; border: 1px solid rgba(0,0,0,.18); cursor: pointer; padding: 0; }
.pe-sw.on { box-shadow: 0 0 0 2px #2563eb; }
.pe-sw-none { background: #fff; font-size: .75rem; color: #a8a29e; line-height: 1; }
.pe-sw-any { width: 1.6rem; height: 1.5rem; padding: 0; border: 1px solid #e7e5e4; border-radius: .3rem; background: #fff; cursor: pointer; }
.pe-slider { display: flex; align-items: center; gap: .4rem; }
.pe-slider input { flex: 1; min-width: 0; accent-color: #d97706; }
.pe-slider-v { font-size: .72rem; color: #57534e; min-width: 2.1rem; text-align: right; font-variant-numeric: tabular-nums; }
.pe-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.pe-chip { border: 1px solid #e7e5e4; background: #fff; border-radius: .35rem; padding: .25rem .5rem; font: inherit; font-size: .72rem; color: #44403c; cursor: pointer; }
.pe-chip.on { background: #14110D; color: #fff; border-color: #14110D; }
.pe-side-acts { display: grid; gap: .3rem; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid #f5f5f4; }
.pe-side-acts .pe-txtbtn { text-align: left; }

/* modals */
.pe-modal { position: fixed; inset: 0; z-index: 90; background: rgba(20,17,13,.45); display: grid; place-items: center; padding: 1rem; }
.pe-mcard { background: #fff; border-radius: 1rem; width: min(46rem, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 30px 70px -30px rgba(0,0,0,.6); }
.pe-card-h { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid #f5f5f4; }
.pe-card-h strong { font-size: 1rem; }
.pe-x { border: 0; background: transparent; color: #78716c; cursor: pointer; display: inline-flex; padding: .3rem; border-radius: .3rem; }
.pe-x:hover { background: #f5f5f4; color: #14110D; }
.pe-card-b { padding: 1rem 1.1rem 1.2rem; overflow-y: auto; }
.pe-card-acts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.pe-b { border: 1px solid #d6d3d1; background: #fff; border-radius: .5rem; padding: .5rem .9rem; font: inherit; font-size: .85rem; font-weight: 600; color: #44403c; cursor: pointer; }
.pe-b:hover { border-color: #a8a29e; }
.pe-b.p { background: #d97706; border-color: #d97706; color: #fff; }
.pe-b.p:hover { background: #b45309; border-color: #b45309; }
.pe-tabs { display: flex; gap: .3rem; border-bottom: 1px solid #f5f5f4; margin-bottom: .9rem; }
.pe-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: .45rem .7rem; font: inherit; font-size: .85rem; font-weight: 600; color: #78716c; cursor: pointer; }
.pe-tab.on { color: #14110D; border-bottom-color: #d97706; }
.pe-sigpad { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px dashed #d6d3d1; border-radius: .6rem; background: #fff; touch-action: none; cursor: crosshair; }
.pe-inp { width: 100%; border: 1px solid #d6d3d1; border-radius: .5rem; padding: .5rem .65rem; font: inherit; font-size: .9rem; background: #fff; color: #14110D; }
.pe-inp:focus { outline: 2px solid #fbbf24; outline-offset: -1px; border-color: #d97706; }
.pe-hands { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .5rem; margin-top: .7rem; }
.pe-hand { border: 1px solid #e7e5e4; border-radius: .5rem; background: #fff; padding: .5rem; font-size: 1.5rem; cursor: pointer; color: #14110D; }
.pe-hand.on { border-color: #d97706; background: #fffbeb; }
.pe-saved { margin-top: 1.2rem; padding-top: .9rem; border-top: 1px solid #f5f5f4; }
.pe-saved-h { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: #78716c; font-weight: 700; margin-bottom: .5rem; }
.pe-saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .6rem; }
.pe-saved-i { border: 1px solid #e7e5e4; border-radius: .6rem; padding: .5rem; }
.pe-saved-p { height: 4.2rem; display: grid; place-items: center; overflow: hidden; }
.pe-saved-p img { max-width: 100%; max-height: 100%; }
.pe-saved-f { display: flex; align-items: center; gap: .3rem; margin-top: .4rem; }
.pe-saved-k { font-size: .8rem; color: #a8a29e; }
.pe-mini-btn { border: 1px solid #e7e5e4; background: #fff; border-radius: .35rem; padding: .2rem .45rem; font: inherit; font-size: .7rem; cursor: pointer; color: #44403c; }
.pe-mini-btn.danger:hover { border-color: #dc2626; color: #b91c1c; }
.pe-stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .45rem; }
.pe-stamp-o { border: 1.5px solid #b91c1c; color: #b91c1c; background: #fff; border-radius: .25rem; padding: .5rem .4rem; font: inherit; font-size: .78rem; font-weight: 800; letter-spacing: .06em; cursor: pointer; }
.pe-stamp-o:hover { background: #fef2f2; }
.pe-row2 { display: flex; gap: .5rem; margin-top: .8rem; align-items: center; }
.pe-row2 .pe-inp { flex: 1; }
.pe-opts { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .7rem; }
.pe-chk { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: #44403c; cursor: pointer; }
.pe-chk input { accent-color: #d97706; }
.pe-hr { border: 0; border-top: 1px solid #f5f5f4; margin: 1.1rem 0; }
.pe-form { display: grid; gap: .7rem; }
.pe-f { display: grid; gap: .25rem; }
.pe-f label { font-size: .74rem; color: #78716c; }
.pe-hint { font-size: .74rem; color: #a8a29e; line-height: 1.5; margin: .35rem 0 0; }
.pe-logo { margin-top: .9rem; }
.pe-logo-p { border: 1px dashed #d6d3d1; border-radius: .6rem; min-height: 4.5rem; display: grid; place-items: center; padding: .5rem; background: #fafaf9; }
.pe-logo-p img { max-height: 4rem; max-width: 100%; }
.pe-logo-e { font-size: .78rem; color: #a8a29e; }
.pe-exp-status { margin-top: .7rem; font-size: .82rem; color: #57534e; min-height: 1.2rem; }

/* tooltip: name + a sentence, up in ~90ms rather than the browser's 1.5s */
.pe-tip { position: fixed; z-index: 120; pointer-events: none; max-width: 17rem; background: #14110D; color: #fff; border-radius: .5rem; padding: .45rem .6rem; box-shadow: 0 14px 34px -16px rgba(0,0,0,.7); }
.pe-tip b { display: block; font-size: .78rem; font-weight: 700; }
.pe-tip i { display: block; font-style: normal; font-size: .72rem; line-height: 1.4; color: #d6d3d1; margin-top: .15rem; }

/* toast (the editor covers the landing page's status line) */
.pe-toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%) translateY(1rem); z-index: 100; background: #14110D; color: #fff; padding: .6rem 1rem; border-radius: .6rem; font-size: .85rem; box-shadow: 0 12px 32px -14px rgba(0,0,0,.7); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: min(90vw, 30rem); }
.pe-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.pe-toast.pe-err { background: #7f1d1d; color: #fff; }

/* Touch: a finger on an armed tool must draw, not scroll the page; a finger on
   a mark must drag it. With the select tool the page still pans normally. */
.pe-stage:not([data-tool="select"]) .pe-ov { touch-action: none; }
.pe-stage[data-tool="select"] .pe-an { touch-action: none; }
.pe-sigpad { touch-action: none; }
@media (pointer: coarse) {
  .pe-h { width: 15px; height: 15px; }
  .pe-h-nw, .pe-h-ne, .pe-h-w, .pe-h-a { left: -8px; }
  .pe-h-ne, .pe-h-e, .pe-h-se, .pe-h-b { right: -8px; }
  .pe-h-nw, .pe-h-n, .pe-h-ne, .pe-h-a { top: -8px; }
  .pe-h-sw, .pe-h-s, .pe-h-se, .pe-h-b { bottom: -8px; }
  .pe-h-n, .pe-h-s, .pe-h-rot { left: calc(50% - 7.5px); }
  .pe-h-e, .pe-h-w { top: calc(50% - 7.5px); }
  .pe-h-rot { top: -26px; }
}

/* narrow screens: rail and style panel collapse, page area keeps the space */
@media (max-width: 900px) {
  .pe-rail { position: absolute; left: 0; top: 0; bottom: 0; z-index: 5; box-shadow: 6px 0 24px -12px rgba(0,0,0,.4); }
  .pe-side { width: 12rem; }
}
/* On a phone the style panel becomes a bottom sheet that rises when something
   is selected. Hiding it outright left no way to restyle — or to delete — a
   mark, because there is no Delete key either. */
@media (max-width: 700px) {
  .pe-fname { display: none; }
  .pe-btn-t span { display: none; }
  .pe-side {
    position: fixed; left: 0; right: 0; bottom: 0; width: auto; z-index: 70;
    max-height: 46vh; border-left: 0; border-top: 1px solid #e7e5e4;
    border-radius: 1rem 1rem 0 0; box-shadow: 0 -12px 30px -18px rgba(0,0,0,.5);
    transform: translateY(105%); transition: transform .18s ease;
  }
  body.pe-has-sel .pe-side { transform: none; }
  .pe-side-acts { grid-template-columns: 1fr 1fr; }
}
