.canvas-frame {
  overflow: visible;
}

.canvas-size-label {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 7;
  height: 21px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(105, 94, 116, .22);
  border-radius: 6px;
  background: rgba(255, 255, 255, .96);
  color: #4d4653;
  box-shadow: 0 2px 7px rgba(35, 27, 42, .08);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .01em;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.selection-overlay {
  display: none;
  position: absolute;
  z-index: 18;
  border: 2px solid #8b3dff;
  pointer-events: auto;
  cursor: move;
  transform-origin: center;
}

.selection-overlay.visible { display: block; }
.selection-overlay.protected-selection {
  border-color: #50636b;
  border-style: dashed;
  cursor: not-allowed;
}
.selection-overlay.protected-selection::before { display: none; }
.selection-overlay.protected-selection .selection-dimension {
  border-color: #70838a;
  color: #344a53;
}
.selection-lock-badge {
  position: absolute;
  left: 50%;
  top: -10px;
  z-index: 6;
  transform: translate(-50%, -100%);
  padding: 5px 9px;
  border-radius: 999px;
  background: #263e48;
  color: #fff;
  box-shadow: 0 4px 13px rgba(14, 37, 46, .22);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
.selection-overlay::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -28px;
  width: 2px;
  height: 26px;
  transform: translateX(-50%);
  background: #8b3dff;
}

.selection-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #8b3dff;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
}

.selection-handle[data-handle="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.selection-handle[data-handle="n"] { left: 50%; top: 0; cursor: ns-resize; }
.selection-handle[data-handle="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.selection-handle[data-handle="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.selection-handle[data-handle="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.selection-handle[data-handle="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.selection-handle[data-handle="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.selection-handle[data-handle="w"] { left: 0; top: 50%; cursor: ew-resize; }
.selection-handle[data-handle="rotate"] { left: 50%; top: -34px; background: #00c4cc; cursor: grab; }

.selection-overlay.image-selected .selection-handle[data-handle="n"],
.selection-overlay.image-selected .selection-handle[data-handle="s"] {
  width: 24px;
  height: 10px;
  border-radius: 999px;
}

.selection-overlay.image-selected .selection-handle[data-handle="e"],
.selection-overlay.image-selected .selection-handle[data-handle="w"] {
  width: 10px;
  height: 24px;
  border-radius: 999px;
}

.selection-dimension {
  position: absolute;
  z-index: 2;
  padding: 4px 7px;
  border: 1px solid #6f24c3;
  border-radius: 6px;
  background: #fff;
  color: #42146f;
  box-shadow: 0 2px 8px rgba(48, 20, 72, .18);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.selection-dimension.top { left: 50%; top: -14px; transform: translate(-50%, -100%); }
.selection-dimension.bottom { left: 50%; top: calc(100% + 14px); transform: translate(-50%, 0); }
.selection-dimension.left { left: -14px; top: 50%; transform: translate(-100%, -50%) rotate(-90deg); }
.selection-dimension.right { left: calc(100% + 14px); top: 50%; transform: translate(0, -50%) rotate(90deg); }

.text-editor {
  z-index: 24;
  min-width: 8px;
  min-height: 8px;
  border: 0;
  border-radius: 0;
  outline: 2px solid #8b3dff;
  outline-offset: 0;
  padding: 0;
  background: transparent;
  box-shadow: 0 0 0 3px rgba(139, 61, 255, .15), 0 8px 24px rgba(31, 15, 45, .2);
  white-space: pre;
  overflow: visible;
  caret-color: #8b3dff;
}

.text-editor-controls {
  position: absolute;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 5px 6px 5px 9px;
  border: 1px solid #8fbeb9;
  border-radius: 8px;
  background: #102b34;
  color: #fff;
  box-shadow: 0 10px 28px rgba(7,29,38,.26);
  white-space: nowrap;
}
.text-editor-controls span { color:#62ddd0; font-size:7px; font-weight:900; letter-spacing:.12em; }
.text-editor-controls small { color:#aec5c9; font-size:7px; }
.text-editor-controls button { height:26px; padding:0 9px; border:1px solid rgba(255,255,255,.18); border-radius:6px; background:rgba(255,255,255,.08); color:#fff; font-size:8px; font-weight:800; }
.text-editor-controls [data-apply-text] { border-color:#12b8aa; background:#0a9489; }
.text-editor-controls button:hover { background:rgba(255,255,255,.16); }
.text-editor-controls [data-apply-text]:hover { background:#087d75; }

@media (max-width: 720px) {
  .text-editor-controls { min-height:44px; max-width:calc(100% - 8px); }
  .text-editor-controls small { display:none; }
  .text-editor-controls button { min-width:58px; height:34px; }
}

.edit-text-button {
  border-color: #8b3dff !important;
  background: #f1e8ff !important;
  color: #5f1ca8;
  font-weight: 800;
}

.selection-edit-text {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: #8b3dff;
  color: #fff;
  box-shadow: 0 4px 12px rgba(73, 26, 119, .28);
  font-size: 9px;
  font-weight: 850;
  cursor: text;
}
.selection-edit-text:hover { background: #6f24c3; }

.toolbar-text-field {
  display: flex;
  align-items: center;
  gap: 5px;
}

.toolbar-text-field textarea {
  width: 190px;
  height: 31px;
  min-height: 31px;
  max-height: 62px;
  resize: vertical;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.25;
}

.text-spacing-controls {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border: 1px solid #e1dce4;
  border-radius: 8px;
  background: #faf9fb;
  flex: 0 0 auto;
}

.text-spacing-controls > span {
  color: #6b6370;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .45px;
  white-space: nowrap;
}

.text-spacing-controls label { gap: 3px !important; font-size: 8px; }
.text-spacing-controls input { width: 57px !important; height: 27px !important; padding: 2px 5px !important; text-align: right; font-variant-numeric: tabular-nums; }
.text-spacing-controls small { color: #8a828e; font-size: 7px; }

@media (max-width:850px) {
  .text-spacing-controls > span,
  .text-spacing-controls small { display:none; }
}

.font-library {
  display: grid;
  gap: 6px;
  max-height: 430px;
  padding-right: 3px;
  overflow-y: auto;
}

.font-choice {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e2dde6;
  border-radius: 9px;
  padding: 8px 10px;
  background: #fff;
  color: #211b26;
  text-align: left;
}

.font-choice:hover {
  border-color: #8b3dff;
  background: #f8f3ff;
}

.font-choice span {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-choice small {
  flex: 0 0 auto;
  color: #766e7c;
  font: 10px Arial, sans-serif;
}

.tool-rail .rail-icon {
  width: 24px;
  height: 24px;
  display: block;
  position: relative;
  color: currentColor;
  font-size: 0;
  line-height: 1;
}

.tool-rail button.active .rail-icon { color: #7c3aed; }

.rail-icon::before,
.rail-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}

.icon-design::before { inset: 4px 2px 2px 5px; border: 1.8px solid currentColor; border-radius: 3px; }
.icon-design::after { inset: 1px 6px 6px 1px; border: 1.8px solid currentColor; border-radius: 3px; background: #fff; }

.icon-elements::before { width: 13px; height: 13px; left: 2px; top: 8px; border: 1.8px solid currentColor; border-radius: 3px; }
.icon-elements::after { width: 12px; height: 12px; right: 2px; top: 2px; border: 1.8px solid currentColor; border-radius: 50%; }

.icon-text::before { content: "T"; inset: 0; display: grid; place-items: center; font: 800 22px/1 Georgia,serif; color: currentColor; }

.icon-brand::before { width: 14px; height: 14px; left: 5px; top: 5px; border: 1.8px solid currentColor; transform: rotate(45deg); border-radius: 2px; }
.icon-brand::after { width: 4px; height: 4px; right: 1px; top: 1px; border-radius: 50%; background: currentColor; box-shadow: -18px 17px 0 -1px currentColor; }

.icon-uploads::before { left: 3px; right: 3px; bottom: 2px; height: 7px; border: 1.8px solid currentColor; border-top: 0; border-radius: 0 0 4px 4px; }
.icon-uploads::after { width: 10px; height: 10px; left: 7px; top: 3px; border-left: 1.8px solid currentColor; border-top: 1.8px solid currentColor; transform: rotate(45deg); }

.icon-draw::before { width: 7px; height: 20px; left: 9px; top: 1px; border: 1.8px solid currentColor; border-radius: 4px 4px 2px 2px; transform: rotate(42deg); }
.icon-draw::after { width: 5px; height: 5px; right: 2px; bottom: 2px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; }

.icon-layers::before { width: 16px; height: 10px; left: 4px; top: 2px; border: 1.8px solid currentColor; border-radius: 3px; transform: skewY(-8deg); }
.icon-layers::after { width: 16px; height: 10px; left: 4px; bottom: 2px; border: 1.8px solid currentColor; border-radius: 3px; box-shadow: 0 -4px 0 -2px #fff, 0 -5.5px 0 -3.7px currentColor; }

.layer-note { margin: -4px 0 10px; color: #746d79; font-size: 9px; line-height: 1.45; }
.layer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.layer-actions button { height: 36px; border: 1px solid #d9d2df; border-radius: 7px; background: #fff; color: #4f4655; font-size: 9px; font-weight: 700; }
.layer-actions button:hover:not(:disabled) { border-color: #8b3dff; background: #f5ecfe; color: #6420b3; }
.layer-selection-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: -4px 0 12px; padding-bottom: 12px; border-bottom: 1px solid #e1dce4; }
.layer-selection-actions button { min-width: 0; height: 36px; border: 1px solid #c9dedf; border-radius: 6px; background: #eef8f7; color: #17635f; font-size: 8px; font-weight: 800; }
.layer-selection-actions button:hover:not(:disabled) { border-color: #0aa99c; background: #daf2ef; color: #075f58; }
.layer-selection-actions button[data-layer-command="delete"] { border-color: #efd4d8; background: #fff5f6; color: #a12839; }
.layer-row { grid-template-columns: 32px minmax(70px, 1fr) repeat(4, 32px) !important; cursor: pointer; }
.layer-row button { width: 32px; height: 32px; padding: 0; color: #514858; font-size: 11px; }
.layer-row button:hover:not(:disabled) { background: #e4d5f7; color: #6824b6; }
.layer-row[draggable="true"] { cursor: grab; }
.layer-row.dragging { cursor: grabbing; opacity: .55; }
.layer-row.drop-before { box-shadow: 0 -3px 0 #087f7c; }
.layer-row.drop-after { box-shadow: 0 3px 0 #087f7c; }

.topbar .brand-orb {
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.topbar .brand-orb video { object-fit: contain; }

.page-thumb-wrap { position: relative; flex: 0 0 auto; }
.page-thumb { min-width: 122px; }
.page-thumb b::before { content: "Page "; color: #746d79; font-weight: 600; }
.page-thumb-delete {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 2;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #33293a;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 3px 9px rgba(32, 22, 38, .24);
  opacity: 0;
  transform: scale(.82);
  transition: opacity .14s ease, transform .14s ease, background .14s ease;
}
.page-thumb-wrap:hover .page-thumb-delete,
.page-thumb-wrap.active .page-thumb-delete,
.page-thumb-delete:focus-visible { opacity: 1; transform: scale(1); }
.page-thumb-delete:hover:not(:disabled) { background: #d50529; }
.page-thumb-delete:disabled { display: none; }
