:root{--bg:#fff;--surface:#f4f9fb;--surface-strong:#e8f2f7;--ink:#0d1822;--muted:#525f6b;--line:#d4dce2;--primary:#0065c1;--primary-hover:#0054a5;--primary-soft:#daeeff;--success:#006f33;--error:#c51f1c;--focus:#009ce6;--radius:14px;--shadow:0 8px 8px #0e1c280d;--ease:cubic-bezier(.16, 1, .3, 1);--z-modal-backdrop:40;--z-modal:50}@supports (color:lab(0% 0 0)){:root{--bg:lab(100% 0 0);--surface:lab(97.4717% -1.28028 -1.75731);--surface-strong:lab(94.8267% -2.54491 -3.50555);--ink:lab(7.75062% -2.47745 -8.29722);--muted:lab(39.6742% -3.12503 -8.47623);--line:lab(87.2726% -2.25481 -3.74192);--primary:lab(41.5714% 6.57269 -64.3264);--primary-hover:lab(34.1913% 12.5788 -67.5928);--primary-soft:lab(93.0394% -4.52405 -11.9316);--success:lab(40.27% -43.9409 26.7027);--error:lab(43.4968% 62.8011 47.1827);--focus:lab(60.2883% -15.034 -49.7062);--shadow:0 8px 8px lab(9.47486% -2.97675 -9.92772/.05)}}*{box-sizing:border-box}html{background:var(--bg);color:var(--ink);font-family:Noto Sans Thai,Leelawadee UI,Tahoma,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}body{min-height:100vh;margin:0}button,input,textarea{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed}:focus-visible{outline:3px solid var(--focus);outline-offset:3px}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.login-shell{background:radial-gradient(circle at 50% 10%, var(--primary-soft), transparent 38%), var(--bg);place-items:center;min-height:100vh;padding:24px;display:grid}.login-panel{border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);width:min(100%,420px);padding:42px}.brand-mark{background:var(--primary);color:#fff;border-radius:12px;place-items:center;width:48px;height:48px;font-size:1.25rem;font-weight:800;display:grid}.brand-mark.small{border-radius:9px;width:34px;height:34px;font-size:.95rem}.product-name{color:var(--primary);margin:18px 0 6px;font-weight:700}.login-panel h1{letter-spacing:-.025em;text-wrap:balance;margin:0;font-size:1.75rem}.login-description{color:var(--muted);margin:10px 0 28px;line-height:1.65}.login-panel form{gap:10px;display:grid}label{font-size:.92rem;font-weight:700}input{border:1px solid var(--line);background:var(--bg);width:100%;min-height:48px;color:var(--ink);transition:border-color .18s var(--ease), box-shadow .18s var(--ease);border-radius:10px;padding:0 14px}input::placeholder{color:#5a656e;color:lab(41.9988% -2.56944 -6.81088)}input:hover{border-color:#97abb9;border-color:lab(68.7149% -4.65888 -9.77122)}input:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-soft);outline:none}textarea{resize:vertical;border:1px solid var(--line);background:var(--bg);width:100%;color:var(--ink);transition:border-color .18s var(--ease), box-shadow .18s var(--ease);border-radius:10px;padding:12px 14px;line-height:1.6}textarea::placeholder{color:#5a656e;color:lab(41.9988% -2.56944 -6.81088)}textarea:hover{border-color:#97abb9;border-color:lab(68.7149% -4.65888 -9.77122)}textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-soft);outline:none}.form-error{color:var(--error);margin:2px 0 4px;font-size:.9rem}.primary-button,.secondary-button,.text-button{min-height:46px;transition:background-color .18s var(--ease), transform .18s var(--ease), opacity .18s var(--ease);border:0;border-radius:10px;padding:0 18px;font-weight:750}.primary-button{background:var(--primary);color:#fff;justify-content:center;align-items:center;gap:9px;display:inline-flex}.primary-button:hover:not(:disabled){background:var(--primary-hover);transform:translateY(-1px)}.primary-button:active:not(:disabled){transform:translateY(0)}.primary-button:disabled{opacity:.45}.primary-button svg{fill:none;stroke:currentColor;stroke-width:1.8px;stroke-linecap:round;stroke-linejoin:round;width:19px}.secondary-button{border:1px solid var(--line);background:var(--bg);color:var(--ink)}.secondary-button:hover:not(:disabled){background:var(--surface)}.secondary-button.compact{min-height:38px;padding:0 13px;font-size:.86rem}.text-button{min-height:38px;color:var(--muted);background:0 0;padding:0 10px}.text-button:hover{color:var(--ink);background:var(--surface)}.topbar{border-bottom:1px solid var(--line);background:var(--bg);justify-content:space-between;align-items:center;height:66px;padding:0 max(24px,50vw - 590px);display:flex}.brand-lockup{letter-spacing:-.01em;align-items:center;gap:10px;font-weight:800;display:flex}.workspace{width:min(100% - 40px,1180px);margin:0 auto;padding:56px 0 72px}.intro{max-width:650px;margin-bottom:38px}.step-label{color:var(--primary);margin:0 0 9px;font-size:.92rem;font-weight:750}.intro h1{letter-spacing:-.035em;text-wrap:balance;max-width:620px;margin:0;font-size:2.35rem;line-height:1.22}.intro>p:last-child{max-width:610px;color:var(--muted);text-wrap:pretty;margin:14px 0 0;line-height:1.75}.tool-layout{grid-template-columns:minmax(0,.92fr) minmax(0,1.08fr);align-items:start;gap:40px;display:grid}.generator{gap:28px;display:grid}.field{gap:9px;display:grid}.label-row{justify-content:space-between;gap:20px;display:flex}.label-row span{color:var(--muted);font-size:.82rem}.field-help,.privacy-note{color:var(--muted);margin:0;font-size:.82rem;line-height:1.55}.dropzone{border-radius:var(--radius);background:var(--surface);min-height:205px;color:var(--ink);transition:border-color .18s var(--ease), background-color .18s var(--ease), transform .18s var(--ease);border:1px dashed #8ca9be;border:1px dashed lab(67.5596% -6.72776 -14.548);flex-direction:column;justify-content:center;align-items:center;gap:7px;display:flex}.dropzone:hover,.dropzone.dragging{border-color:var(--primary);background:var(--primary-soft)}.dropzone.dragging{transform:scale(1.01)}.dropzone>span:last-child{color:var(--muted);font-size:.82rem}.upload-icon{background:var(--bg);width:44px;height:44px;color:var(--primary);border-radius:11px;place-items:center;margin-bottom:4px;display:grid}.upload-icon svg{fill:none;stroke:currentColor;stroke-width:1.8px;stroke-linecap:round;stroke-linejoin:round;width:22px}.library-label-row{align-items:center}.library-add-button{align-items:center;gap:7px;display:inline-flex}.library-add-button svg,.library-delete svg{fill:none;stroke:currentColor;stroke-width:1.7px;stroke-linecap:round;stroke-linejoin:round;width:17px;height:17px}.reference-library{min-width:0}.reference-grid{grid-template-columns:repeat(auto-fill,minmax(108px,1fr));gap:9px;max-height:290px;padding:3px;display:grid;overflow-y:auto}.library-item{border:1px solid var(--line);background:var(--bg);min-width:0;transition:border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);border-radius:10px;position:relative;overflow:hidden}.library-item:hover{border-color:#82a3bf;border-color:lab(65.1658% -6.44562 -18.4852);transform:translateY(-1px)}.library-item.selected{border-color:var(--primary);box-shadow:0 0 0 2px var(--primary-soft)}.library-select{width:100%;color:var(--ink);text-align:left;background:0 0;border:0;gap:7px;padding:6px 6px 9px;display:grid}.library-select:disabled{opacity:.65}.library-select img{aspect-ratio:4/3;object-fit:cover;background:var(--surface);border-radius:6px;width:100%;display:block}.library-select>span:not(.library-loading){text-overflow:ellipsis;white-space:nowrap;font-size:.75rem;font-weight:650;overflow:hidden}.library-loading{aspect-ratio:4/3;color:#fff;background:#0c1721b8;background:lab(7.19539% -2.3348 -8.24623/.72);border-radius:6px;place-items:center;font-size:.72rem;font-weight:700;display:grid;position:absolute;inset:6px 6px auto}.library-delete{color:#3b5062;color:lab(32.6851% -4.48559 -13.3776);opacity:0;width:30px;height:30px;transition:opacity .18s var(--ease), color .18s var(--ease), background-color .18s var(--ease);background:#fffffff0;background:lab(100% 0 0/.94);border:0;border-radius:8px;place-items:center;display:grid;position:absolute;top:9px;right:9px}.library-item:hover .library-delete,.library-delete:focus-visible{opacity:1}.library-delete:hover:not(:disabled){color:var(--error);background:#ffebe8;background:lab(94.5494% 7.658 4.12686)}.library-empty,.library-status{border:1px dashed var(--line);background:var(--surface);text-align:center;border-radius:10px;flex-direction:column;justify-content:center;align-items:center;gap:4px;min-height:96px;padding:18px;display:flex}.library-empty strong{font-size:.86rem}.library-empty span,.library-status{color:var(--muted);font-size:.78rem;line-height:1.5}.upload-divider{color:var(--muted);align-items:center;gap:11px;font-size:.76rem;display:flex}.upload-divider:before,.upload-divider:after{content:"";background:var(--line);flex:1;height:1px}.reference-preview{border:1px solid var(--line);border-radius:var(--radius);grid-template-columns:78px minmax(0,1fr) auto;align-items:center;gap:14px;min-height:104px;padding:12px;display:grid}.reference-preview img{object-fit:cover;background:var(--surface);border-radius:9px;width:78px;height:78px}.reference-preview>div{gap:4px;min-width:0;display:grid}.reference-preview strong{text-overflow:ellipsis;white-space:nowrap;font-size:.9rem;overflow:hidden}.reference-preview span{color:var(--muted);font-size:.8rem}.reference-preview .stored-label{width:fit-content;color:var(--primary);margin-top:2px;font-size:.74rem;font-weight:700}.error-banner{color:#9a0006;color:lab(32.0708% 56.7362 45.825);background:#ffebe8;background:lab(94.5494% 7.658 4.12686);border-radius:10px;align-items:flex-start;gap:10px;padding:12px 14px;display:flex}.error-banner>span{background:var(--error);color:#fff;border-radius:50%;flex:none;place-items:center;width:20px;height:20px;font-size:.75rem;font-weight:800;display:grid}.error-banner p{margin:0;font-size:.88rem;line-height:1.55}.generate-button{width:100%}.privacy-note{text-align:center;margin-top:-17px}.result-panel{border-radius:var(--radius);background:var(--surface);min-width:0;padding:22px}.result-heading{justify-content:space-between;align-items:center;gap:16px;margin-bottom:16px;display:flex}.result-heading h2{margin:0;font-size:1rem}.result-heading p{color:var(--muted);margin:4px 0 0;font-size:.8rem}.success-badge{color:#00491c;color:lab(26.0827% -38.0289 23.3709);background:#c9f1d0;background:lab(91.5143% -17.7954 11.3992);border-radius:999px;padding:5px 9px;font-size:.75rem;font-weight:750}.result-canvas{aspect-ratio:3/2;background-color:#fff;background-image:linear-gradient(45deg,#e1e1e1 25%,#0000 25%),linear-gradient(-45deg,#e1e1e1 25%,#0000 25%),linear-gradient(45deg,#0000 75%,#e1e1e1 75%),linear-gradient(-45deg,#0000 75%,#e1e1e1 75%);background-image:linear-gradient(45deg,lab(89.56% -.0000298023 0) 25%,#0000 25%),linear-gradient(-45deg,lab(89.56% -.0000298023 0) 25%,#0000 25%),linear-gradient(45deg,#0000 75%,lab(89.56% -.0000298023 0) 75%),linear-gradient(-45deg,#0000 75%,lab(89.56% -.0000298023 0) 75%);background-position:0 0,0 12px,12px -12px,-12px 0;background-size:24px 24px;border-radius:11px;place-items:center;min-height:340px;display:grid;overflow:hidden}.result-canvas>img{object-fit:contain;max-width:88%;max-height:88%;display:block}.empty-result,.processing{text-align:center;background:#ffffffe0;background:lab(100% 0 0/.88);border-radius:12px;place-items:center;width:min(85%,340px);padding:34px;display:grid}.empty-symbol{border:1px solid var(--line);background:var(--surface);width:60px;height:60px;color:var(--primary);border-radius:13px;place-items:center;margin-bottom:13px;font-size:1.05rem;font-weight:850;display:grid}.empty-result p,.processing p{color:var(--muted);margin:7px 0 0;font-size:.82rem}.progress-orbit{border:2px solid var(--primary-soft);border-radius:50%;width:52px;height:52px;margin-bottom:17px;position:relative}.progress-orbit span{background:var(--primary);transform-origin:5px 31px;border-radius:50%;width:10px;height:10px;animation:1.4s linear infinite orbit;position:absolute;top:-5px;left:calc(50% - 5px)}.progress-track{background:var(--surface-strong);border-radius:99px;width:100%;height:5px;margin-top:20px;overflow:hidden}.progress-track span{border-radius:inherit;background:var(--primary);width:38%;height:100%;animation:progress 2.4s var(--ease) infinite alternate;display:block}.result-actions{grid-template-columns:1fr auto auto;gap:10px;margin-top:14px;display:grid}.icon-button{justify-content:center;align-items:center;gap:8px;display:inline-flex}.icon-button svg{fill:none;stroke:currentColor;stroke-width:1.8px;stroke-linecap:round;stroke-linejoin:round;width:18px;height:18px}.mask-backdrop{z-index:var(--z-modal-backdrop);background:#050e17b8;background:lab(3.67278% -1.34034 -6.27561/.72);place-items:center;padding:24px;display:grid;position:fixed;inset:0}.mask-dialog{z-index:var(--z-modal);border-radius:var(--radius);background:var(--bg);width:min(1120px,100%);max-height:calc(100vh - 48px);animation:modal-in .22s var(--ease);overflow:hidden;box-shadow:0 8px 8px #00020538;box-shadow:0 8px 8px lab(.452471% -.172891 -1.39955/.22)}.mask-dialog-header{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-start;gap:20px;padding:20px 22px 17px;display:flex}.mask-dialog-header h2{letter-spacing:-.015em;margin:0;font-size:1.15rem}.mask-dialog-header p{color:var(--muted);margin:4px 0 0;font-size:.82rem}.mask-close-button{background:var(--surface);width:38px;height:38px;color:var(--muted);border:0;border-radius:9px;flex:none;place-items:center;display:grid}.mask-close-button:hover:not(:disabled){background:var(--surface-strong);color:var(--ink)}.mask-close-button svg{fill:none;stroke:currentColor;stroke-width:1.8px;stroke-linecap:round;width:19px}.mask-editor-form{grid-template-columns:minmax(0,1.45fr) minmax(290px,.7fr);gap:22px;max-height:calc(100vh - 139px);padding:22px;display:grid;overflow-y:auto}.mask-stage-column,.mask-instructions{min-width:0}.mask-toolbar{justify-content:space-between;align-items:center;gap:16px;margin-bottom:10px;display:flex}.brush-control{min-width:0;color:var(--muted);align-items:center;gap:9px;font-size:.8rem;display:flex}.brush-control>svg{fill:none;width:19px;stroke:var(--primary);stroke-width:1.8px;stroke-linecap:round;stroke-linejoin:round;flex:none}.brush-control label{white-space:nowrap;color:var(--ink);font-size:.8rem}.brush-control input[type=range]{width:130px;min-height:auto;box-shadow:none;accent-color:var(--primary);background:0 0;border:0;padding:0}.brush-control input[type=range]:focus-visible{outline:3px solid var(--focus);outline-offset:3px}.brush-control>span{font-variant-numeric:tabular-nums;width:42px}.mask-stage{background-color:#fff;background-image:linear-gradient(45deg,#e1e1e1 25%,#0000 25%),linear-gradient(-45deg,#e1e1e1 25%,#0000 25%),linear-gradient(45deg,#0000 75%,#e1e1e1 75%),linear-gradient(-45deg,#0000 75%,#e1e1e1 75%);background-image:linear-gradient(45deg,lab(89.56% -.0000298023 0) 25%,#0000 25%),linear-gradient(-45deg,lab(89.56% -.0000298023 0) 25%,#0000 25%),linear-gradient(45deg,#0000 75%,lab(89.56% -.0000298023 0) 75%),linear-gradient(-45deg,#0000 75%,lab(89.56% -.0000298023 0) 75%);background-position:0 0,0 10px,10px -10px,-10px 0;background-size:20px 20px;border-radius:11px;display:grid;position:relative;overflow:hidden}.mask-stage img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;width:100%;height:auto;display:block}.mask-stage canvas:not(.mask-data-canvas){cursor:crosshair;touch-action:none;width:100%;height:100%;position:absolute;inset:0}.mask-data-canvas{display:none}.mask-legend{color:var(--muted);align-items:center;gap:7px;margin-top:9px;font-size:.76rem;display:flex}.mask-legend>span{background:#de1d3f8c;background:lab(48.9234% 70.6508 34.7407/.55);border-radius:4px;width:13px;height:13px}.mask-instructions{flex-direction:column;gap:10px;display:flex}.mask-dialog-actions{grid-template-columns:auto 1fr;gap:9px;margin-top:auto;padding-top:8px;display:grid}.server-note{color:var(--muted);text-align:center;margin:0;font-size:.74rem;line-height:1.5}@keyframes orbit{to{transform:rotate(360deg)}}@keyframes progress{0%{transform:translate(-15%)}to{transform:translate(175%)}}@keyframes modal-in{0%{opacity:0;transform:translateY(8px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}@media (max-width:820px){.workspace{width:min(100% - 28px,650px);padding-top:38px}.tool-layout{grid-template-columns:1fr;gap:34px}.intro h1{font-size:1.95rem}.result-panel{padding:16px}.result-canvas{min-height:290px}.mask-dialog{width:min(720px,100%)}.mask-editor-form{grid-template-columns:1fr}}@media (max-width:520px){.topbar{padding:0 14px}.workspace{width:min(100% - 24px,650px)}.login-panel{padding:28px 22px}.intro h1{font-size:1.7rem}.reference-preview{grid-template-columns:64px minmax(0,1fr)}.reference-preview img{width:64px;height:64px}.reference-preview .secondary-button{grid-column:1/-1}.reference-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.library-delete{opacity:1}.result-canvas{min-height:235px}.result-actions{grid-template-columns:1fr}.mask-backdrop{padding:0}.mask-dialog{border-radius:0;width:100%;height:100%;max-height:none}.mask-dialog-header{padding:16px 14px 14px}.mask-editor-form{gap:18px;max-height:calc(100vh - 76px);padding:14px}.mask-toolbar{align-items:flex-end}.brush-control{grid-template-columns:auto auto 1fr;display:grid}.brush-control input[type=range]{grid-column:1/-1;width:min(42vw,150px)}.brush-control>span{text-align:right}.mask-dialog-actions{grid-template-columns:1fr}}@media (prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}
