body.editor-open {
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
body.editor-open .site-header,
body.editor-open .site-footer,
body.editor-open .ad-slot,
body.editor-open .band,
body.editor-open .steps-section,
body.editor-open .two-col,
body.editor-open .faq-block,
body.editor-open .skip-link,
body.editor-open .crumb,
body.editor-open .tool-hero h1,
body.editor-open .tool-hero .lede,
body.editor-open .tool-hero .trust-row {
  display: none !important;
}
body.editor-open main,
body.editor-open .hero-stage.tool-hero,
body.editor-open .hero-center,
body.editor-open .uploader {
  margin: 0;
  padding: 0;
  max-width: none;
  width: 100%;
  background: transparent;
}
body.editor-open .wrap.hero-center { width: 100%; }
body.editor-open .uploader.has-file .dropzone,
body.editor-open .uploader.has-file .tool-actions,
body.editor-open .uploader.has-file .file-list { display: none !important; }

.ed-app {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: 56px 72px minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  background: #f4f5f7;
  font-family: Inter, system-ui, sans-serif;
  text-align: left;
  color: #1b2430;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ed-app > .ed-top { grid-row: 1; }
.ed-app > .ed-toolbar { grid-row: 2; }
.ed-app > .ed-body { grid-row: 3; min-height: 0; }
.ed-app.has-format > .ed-body { grid-row: 4; }
.ed-app > .ed-zoom,
.ed-app > .ed-pager,
.ed-app > #page-label,
.ed-app > .ed-pop { grid-row: 1; grid-column: 1; }
.ed-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #e6eaef;
}
.ed-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #1b2430;
  text-decoration: none;
  font-size: 1.15rem;
}
.ed-logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: #f95a38; color: #fff;
  display: grid; place-items: center; font-size: .75rem;
}
.ed-top-actions { display: flex; align-items: center; gap: 8px; }
.ed-icon-btn {
  width: 36px; height: 36px; border: 0; background: transparent;
  border-radius: 10px; cursor: pointer; color: #4b5563;
}
.ed-icon-btn:hover { background: #f3f4f6; }
.ed-save {
  background: #f95a38; color: #fff; border: 0; border-radius: 999px;
  padding: 10px 18px; font-weight: 800; cursor: pointer; letter-spacing: .02em;
  text-transform: uppercase; font-size: .82rem;
}
.ed-save:hover { filter: brightness(1.05); }

.save-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(27, 36, 48, .5);
}
.save-modal[hidden] { display: none !important; }
.save-modal-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(27, 36, 48, .2);
  position: relative;
}
.save-modal-card h2 { margin: 0 0 8px; font-size: 1.45rem; }
.save-modal-card p { margin: 0 0 16px; color: #64748b; }
.save-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}
.save-modal-ad:empty { display: none; }
.save-modal-ad:not(:empty) { margin: 0 0 16px; }
.save-modal-card .btn { width: 100%; }

.ed-toolbar {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #e6eaef;
  overflow-x: auto;
}
.ed-tool {
  min-width: 76px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 6px 8px 4px;
  cursor: pointer;
  color: #4b5563;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 600;
  line-height: 1.1;
}
.ed-tool svg { width: 22px; height: 22px; }
.ed-tool:hover { background: #f3f4f6; color: #111827; }
.ed-tool.on { background: #1b2430; color: #fff; }
.ed-tool.on svg { stroke: #fff; fill: none; }

.ed-format {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: #fff;
  border-bottom: 1px solid #e6eaef;
  font-size: .82rem;
}
.ed-app.has-format { grid-template-rows: 56px 72px 40px minmax(0, 1fr); }
.ed-app.has-format > .ed-format { display: flex; grid-row: 3; }
.ed-format label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ed-format textarea { width: 220px; height: 28px; resize: none; border: 1px solid #e5e7eb; border-radius: 8px; padding: 4px 8px; font: inherit; font-size: 16px; }
.ed-format input[type="range"] { width: 120px; }
.ed-format input[type="color"] { width: 36px; height: 32px; padding: 0; border: 0; background: transparent; }
.ed-hl-colors {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ed-hl-colors[hidden] { display: none !important; }
.ed-hl-label { font-weight: 700; font-size: .82rem; margin-right: 4px; }
.ed-hl-swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0;
}
.ed-hl-swatch.on { box-shadow: 0 0 0 2px #1b2430; }
.ed-fmt-hl-picker { font-size: .75rem; }
.ed-del { border: 1px solid #fecaca; background: #fff; color: #b91c1c; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-weight: 700; }

.ed-body {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 148px;
  min-height: 0;
}
.ed-rail {
  background: #fff;
  border-right: 1px solid #e6eaef;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  gap: 4px;
}
.ed-rail a, .ed-rail span {
  width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  text-decoration: none;
  color: #6b7280;
  font-size: .62rem;
  font-weight: 700;
}
.ed-rail svg { width: 20px; height: 20px; }
.ed-rail a:hover { background: #f3f4f6; color: #111; }
.ed-rail .on { background: #1b2430; color: #fff; }

.editor-canvas-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #eceef2;
  min-height: 0;
  touch-action: pan-x pan-y;
}
.editor-canvas-wrap.ed-drawing {
  touch-action: none;
  overscroll-behavior: none;
}
.page-stage {
  position: relative;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .12);
  line-height: 0;
}
.page-stage canvas { position: absolute; left: 0; top: 0; display: block; }
.page-stage { position: relative; }
.page-stage #pdf-canvas { position: relative; z-index: 1; }
.stage-loader {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: rgba(255,255,255,.72);
  border-radius: 8px;
}
.stage-loader[hidden] { display: none !important; }
.stage-loader p { margin: 0; font-weight: 700; color: #1b2430; }
.page-stage #overlay { z-index: 2; }

.text-layer { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; }
.pdf-word {
  position: absolute; color: transparent; cursor: text; border-radius: 2px;
  white-space: nowrap; overflow: visible; line-height: 1; z-index: 3;
  pointer-events: none;
}
.text-layer.is-live .pdf-word { pointer-events: auto; }
.pdf-word:hover { background: rgba(255, 235, 59, .45); outline: 1px solid rgba(202, 168, 0, .55); }
.pdf-word-edit {
  position: absolute; z-index: 6; border: 2px solid #1b2430; border-radius: 3px;
  font-family: Helvetica, Arial, sans-serif; padding: 0 4px; background: #fff59d;
  pointer-events: auto; font-size: 16px; max-width: calc(100vw - 24px);
  -webkit-user-select: text; user-select: text;
}
.hit-layer {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  z-index: 4; pointer-events: none; touch-action: none;
}
.anno-layer { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 5; pointer-events: none; }
.anno-box {
  position: absolute; pointer-events: auto; min-width: 48px; cursor: move;
  padding: 2px 4px 2px 18px; border: 1px dashed transparent; border-radius: 4px;
  line-height: 1.2; background: rgba(255,255,255,.01);
  touch-action: none;
}
.anno-box.selected { border-color: #2563eb; background: rgba(255,255,255,.94); box-shadow: 0 0 0 1px #2563eb; }
.anno-box.stamp { font-weight: 800; letter-spacing: .04em; padding: 6px 10px 6px 22px; border: 2px solid currentColor; }
.anno-handle {
  position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 14px; border-radius: 2px; background: #2563eb; cursor: grab;
  touch-action: none;
}
.anno-input {
  display: block; border: 0; background: transparent; font: inherit; color: inherit;
  resize: both; min-width: 80px; min-height: 1.3em; outline: none; cursor: text;
  overflow: hidden; padding: 2px 4px; margin: 0; font-family: Helvetica, Arial, sans-serif;
  font-size: inherit; line-height: 1.3; white-space: pre-wrap; word-break: break-word;
  touch-action: manipulation; -webkit-user-select: text; user-select: text;
  field-sizing: content;
}
.ed-format .ed-fmt-text textarea {
  width: 260px; min-height: 64px; height: auto; resize: vertical; white-space: pre-wrap;
}
.anno-img { display: block; pointer-events: none; }

.ed-thumbs {
  background: #f7f8fa;
  border-left: 1px solid #e6eaef;
  overflow: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.ed-thumb {
  border: 2px solid transparent;
  background: #fff;
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15,23,42,.08);
}
.ed-thumb.on { border-color: #1b2430; }
.ed-thumb canvas { display: block; width: 110px; height: auto; }
.ed-thumb span { display: block; text-align: center; font-size: .7rem; color: #6b7280; margin-top: 4px; }

.ed-zoom {
  position: fixed; right: 168px; bottom: 18px; z-index: 45;
  display: flex; gap: 6px; background: #fff; border-radius: 999px;
  padding: 6px; box-shadow: 0 8px 24px rgba(15,23,42,.16);
}
.ed-zoom button {
  min-width: 32px; height: 32px; border: 0; border-radius: 999px; background: #f3f4f6; cursor: pointer; font-weight: 800;
  padding: 0 10px; font-size: .75rem;
}

.ed-pop {
  position: absolute; z-index: 60; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 12px; padding: 8px; box-shadow: 0 16px 40px rgba(15,23,42,.18);
  display: flex; flex-direction: column; gap: 4px; min-width: 160px;
}
.ed-pop[hidden] { display: none !important; }
.ed-pop button {
  border: 0; background: #f9fafb; text-align: left; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font-weight: 700; font-size: .85rem;
}
.ed-pop button:hover { background: #eef2ff; }

.editor-canvas-wrap.ed-cursor-draw, .editor-canvas-wrap.ed-cursor-draw * { cursor: crosshair; }
.editor-canvas-wrap.ed-cursor-erase, .editor-canvas-wrap.ed-cursor-erase * { cursor: cell; }

.ed-pager {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e6eaef;
  z-index: 46;
}
.ed-pager button {
  min-width: 72px; min-height: 40px; border: 1px solid #e5e7eb; border-radius: 10px;
  background: #fff; font-weight: 700; cursor: pointer;
}
.ed-pager #mobile-page-label { font-size: .85rem; font-weight: 700; color: #4b5563; min-width: 72px; text-align: center; }

@media (max-width: 900px) {
  .ed-app {
    grid-template-rows: 48px 58px minmax(0, 1fr) auto;
  }
  .ed-app.has-format {
    grid-template-rows: 48px 58px auto minmax(0, 1fr) auto;
  }
  .ed-app > .ed-body { grid-row: 3; }
  .ed-app.has-format > .ed-body { grid-row: 4; }
  .ed-app > .ed-pager { display: flex; grid-row: 4; }
  .ed-app.has-format > .ed-pager { grid-row: 5; }

  .ed-top { padding: 0 10px; }
  .ed-logo { font-size: 1rem; }
  .ed-logo-word { display: none; }
  .ed-save { padding: 8px 12px; font-size: .72rem; }
  .ed-icon-btn { width: 40px; height: 40px; }

  .ed-toolbar {
    justify-content: flex-start;
    gap: 0;
    padding: 4px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .ed-toolbar::-webkit-scrollbar { display: none; }
  .ed-tool {
    flex: 0 0 auto;
    min-width: 58px;
    min-height: 48px;
    font-size: .58rem;
    padding: 4px 6px;
  }
  .ed-tool svg { width: 20px; height: 20px; }

  .ed-format {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding: 8px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .ed-format label { white-space: nowrap; font-size: .75rem; }
  .ed-format textarea { width: 140px; min-height: 36px; font-size: 16px; }
  .ed-format input[type="range"] { width: 90px; }
  .ed-del { min-height: 36px; }

  .ed-body { grid-template-columns: 1fr; }
  .ed-rail, .ed-thumbs { display: none; }
  .editor-canvas-wrap { padding: 8px; }

  .ed-zoom {
    right: 12px;
    bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .ed-zoom button { width: 40px; height: 40px; }

  .anno-handle {
    width: 18px; height: 22px; left: 0;
  }
  .anno-box { padding-left: 24px; }
  .pdf-word {
    min-height: 22px;
    padding: 2px 0;
  }

  .ed-pop {
    position: fixed;
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: calc(72px + env(safe-area-inset-bottom));
    max-height: 40vh;
    overflow: auto;
  }
}

@media (max-width: 480px) {
  .ed-tool span { max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
