/* HAT V1.2.2 – floating scratchpad */
#hat122Scratch{position:fixed;z-index:120;top:120px;right:45px;width:min(640px,calc(100vw - 22px));height:min(475px,calc(100dvh - 115px));min-width:310px;min-height:235px;display:flex;flex-direction:column;overflow:hidden;background:#eef4f8;color:#23394e;border:1px solid #95b0c4;border-radius:13px;box-shadow:0 16px 48px #071b2b88;font:13px 'Segoe UI',sans-serif;touch-action:none}
#hat122Scratch[hidden]{display:none!important}
#hat122Scratch button{cursor:pointer;border:1px solid #b7c9d6;border-radius:7px;background:#fff;color:#173850;font:inherit;padding:5px 9px;min-height:30px}
#hat122Scratch button[aria-pressed="true"]{background:#c8e7f9;border-color:#499ccc;font-weight:700}
#hat122Scratch .hat122-header{display:flex;gap:7px;align-items:center;padding:7px 9px;background:#dae9f3;cursor:move;user-select:none;touch-action:none}
#hat122Scratch .hat122-header strong{font-size:14px}#hat122Scratch .hat122-help{margin-right:auto;font-size:11px;opacity:.7}
#hat122Scratch .hat122-tools{display:flex;flex-wrap:wrap;gap:5px;align-items:center;padding:7px;border-bottom:1px solid #bbccd8;flex:0 0 auto}
#hat122Scratch .hat122-tools label{display:flex;align-items:center;gap:4px;font-size:12px}
#hat122Scratch input[type=color]{width:29px;height:27px;padding:1px;border:1px solid #acc2d2;border-radius:5px}#hat122Scratch input[type=range]{width:66px;accent-color:#287cbe}
#hat122Scratch .hat122-surface{flex:1 1 auto;min-height:50px;overflow:hidden}#hat122Scratch canvas{width:100%;height:100%;display:block;touch-action:none;cursor:crosshair}
#hat122Scratch .hat122-bottom{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:5px 9px;font-size:11px;background:#e0ebf2;flex:0 0 auto}
#hat122Scratch .hat122-resize{position:absolute;bottom:0;right:0;width:20px;height:20px;cursor:nwse-resize;touch-action:none;background:linear-gradient(135deg,transparent 48%,#7193ac 50%,transparent 55%,transparent 68%,#7193ac 71%,transparent 76%)}
#hat122Scratch.hat122-min{height:auto!important;min-height:0}#hat122Scratch.hat122-min .hat122-tools,#hat122Scratch.hat122-min .hat122-surface,#hat122Scratch.hat122-min .hat122-bottom,#hat122Scratch.hat122-min .hat122-resize{display:none}
#hat122ScratchToggle.hat122-active{background:#bde0f5!important;color:#163b57!important}
@media(max-width:700px){#hat122Scratch{top:80px;right:7px;width:calc(100vw - 14px);height:min(420px,calc(100dvh - 145px))}#hat122Scratch .hat122-help{display:none}#hat122Scratch .hat122-tools{gap:3px;padding:5px}}
@media print{#hat122Scratch,#hat122ScratchToggle{display:none!important}}
