* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #e9ecef; color: #222; }
header { position: sticky; top: 0; z-index: 10; background: #fff; padding: 10px 16px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
h1 { margin: 0 0 8px; font-size: 18px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { padding: 8px 12px; border: 1px solid #adb5bd; border-radius: 6px; background: #f8f9fa; cursor: pointer; font-size: 14px; }
.btn:hover:not(:disabled) { background: #e9ecef; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: #1971c2; border-color: #1971c2; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #1864ab; }
.btn.armed { background: #fff3bf; border-color: #f08c00; }
#hint { margin: 8px 0 0; font-size: 13px; color: #555; }

main { padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
main.placing .page { cursor: crosshair; }
.page { position: relative; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); touch-action: none; }
.page canvas { display: block; }

.sig { position: absolute; border: 1px dashed #1971c2; cursor: move; touch-action: none; }
.sig img { width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.sig .handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #1971c2; cursor: nwse-resize; border-radius: 2px; }
.sig .del { position: absolute; right: -10px; top: -10px; width: 20px; height: 20px; line-height: 18px; text-align: center; background: #e03131; color: #fff; border-radius: 50%; cursor: pointer; font-size: 14px; }
