:root{
  --blue:#1677ff; --blue2:#4da3ff; --blueSoft:#e8f2ff;
  --green:#16c172; --greenSoft:#e3f9ee;
  --red:#e5484d; --redSoft:#ffeceb; --amber:#b7791f; --amberSoft:#fff6e0;
  --ink:#1b2a41; --muted:#6b7a90; --line:#e3e8ef; --bg:#f4f7fb; --card:#fff;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{background:var(--bg)}
body{font-family:'Prompt',system-ui,sans-serif;color:var(--ink);min-height:100vh;display:flex;flex-direction:column}
button{font:inherit;cursor:pointer}
.top{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:8px;padding:10px 16px;background:#fff;border-bottom:1px solid var(--line)}
.top .back{border:0;background:none;font-size:28px;line-height:1;color:var(--blue);width:28px}
.brand{font-weight:600;flex:1}
.brand b{color:var(--blue)}
.stepno{font-size:12px;color:var(--muted)}
main{flex:1;width:100%;max-width:480px;margin:0 auto;padding:16px}
.screen{display:none;flex-direction:column;gap:12px}
.screen.active{display:flex}
h1{font-size:26px;line-height:1.35}
h1 span{color:var(--blue)}
h2{font-size:20px}
.muted{color:var(--muted)}
.small{font-size:13px}
.center{text-align:center;display:flex;flex-direction:column;align-items:center;gap:8px}
.spacer{flex:1;min-height:8px}
.hero{padding:16px 0 4px}
.hero p{margin-top:8px}
.ticks{list-style:none;display:flex;flex-direction:column;gap:6px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px}
.ticks li::before{content:"✓";color:var(--green);font-weight:700;margin-right:8px}
.btn{display:block;width:100%;text-align:center;border:0;border-radius:14px;padding:14px;font-weight:600;font-size:16px;color:#fff;background:linear-gradient(180deg,var(--blue2),var(--blue));box-shadow:0 4px 10px rgba(22,119,255,.3)}
.btn.green{background:linear-gradient(180deg,#3ddc91,var(--green));box-shadow:0 4px 10px rgba(22,193,114,.3)}
.btn.ghost{background:#fff;color:var(--blue);border:2px solid var(--blue);box-shadow:none}
.btn:disabled{opacity:.5}
.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px}
.card ul{padding-left:18px;display:flex;flex-direction:column;gap:4px}
.row{display:flex;align-items:center;gap:8px}
.between{justify-content:space-between}
.pgrid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.pc{background:#fff;border:2px solid var(--line);border-radius:14px;padding:14px 10px;text-align:center;display:flex;flex-direction:column;gap:4px;align-items:center}
.pc:hover,.pc:focus-visible{border-color:var(--blue);background:var(--blueSoft)}
.pc .ic{font-size:30px}
.pc .n{font-weight:600;font-size:15px}
.pc .s{font-size:12px;color:var(--muted)}
.tip{display:flex;gap:12px;align-items:center;background:#fff;border-radius:14px;padding:12px;border:1px solid var(--line)}
.tip .num{width:46px;height:46px;border-radius:12px;background:var(--blueSoft);display:flex;align-items:center;justify-content:center;font-size:24px;flex:none}
.spinner{width:56px;height:56px;border-radius:50%;border:6px solid var(--blueSoft);border-top-color:var(--blue);animation:spin 1s linear infinite;margin:40px 0 8px}
@keyframes spin{to{transform:rotate(360deg)}}
.checks{display:flex;flex-direction:column;gap:6px}
.chk{display:flex;gap:8px;align-items:flex-start;font-size:14px;padding:8px 12px;border-radius:10px;background:var(--greenSoft);color:#0c6b40}
.chk.warn{background:var(--amberSoft);color:#7a5200}
.chk.bad{background:var(--redSoft);color:#9b1c20}
/* รูปตัวอย่างค้างอยู่บนจอ ตอนเลื่อนลงไปใช้แถบปรับ */
.previewWrap{position:sticky;top:52px;z-index:4;align-self:stretch;margin:0 -16px;padding:8px 16px;background:var(--bg);display:flex;flex-direction:column;align-items:center;gap:6px;transition:box-shadow .2s}
.previewWrap.stuck{box-shadow:0 6px 12px -6px rgba(27,42,65,.25)}
#previewCanvas{width:min(220px,44vw);height:auto;border-radius:6px;box-shadow:0 6px 18px rgba(27,42,65,.18);background:#fff}
.previewLabel{font-size:12px;color:var(--muted)}
.swatches{display:flex;gap:8px}
.sw{width:32px;height:32px;border-radius:50%;border:2px solid var(--line)}
.sw.sel{outline:3px solid var(--blue);outline-offset:2px}
.ofits{display:flex;flex-wrap:wrap;gap:8px}
.ofit{border:2px solid var(--line);background:#fff;border-radius:20px;padding:6px 12px;font-size:14px}
.ofit.sel{border-color:var(--blue);background:var(--blueSoft);color:var(--blue);font-weight:600}
.chip{font-size:12px;padding:3px 10px;border-radius:20px;background:var(--blueSoft);color:var(--blue);font-weight:500}
#previewCanvas{touch-action:none;user-select:none;-webkit-user-select:none}
.cv{position:relative;display:flex}
.genOverlay{position:absolute;inset:0;border-radius:6px;background:rgba(255,255,255,.75);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;font-weight:600;font-size:14px}
.genOverlay[hidden]{display:none}
.spinner.sm{width:36px;height:36px;border-width:4px;margin:0}
.ofit:disabled{opacity:.5}
#outfitAdj{display:flex;flex-direction:column;gap:8px}
#outfitAdj[hidden]{display:none}
.slider{display:flex;flex-direction:column;gap:4px;font-size:14px}
.slider input{width:100%;accent-color:var(--blue)}
.files{font-size:14px}
.sheetPrev{width:100%;height:auto;border:1px solid var(--line);border-radius:6px}
.ppLogo{background:#0b3d6e;color:#fff;font-weight:700;padding:6px 18px;border-radius:8px;letter-spacing:.5px}
.qrBox{width:240px;max-width:70vw;aspect-ratio:1}
.qrBox img,.qrBox svg{width:100%;height:100%;image-rendering:pixelated}
.amount{font-size:24px;font-weight:700;color:var(--blue)}
.warn{background:var(--amberSoft);color:#7a5200;border-radius:10px;padding:8px 10px;font-size:13px}
.howpay{padding-left:20px;display:flex;flex-direction:column;gap:2px}
.payMsg{text-align:center;font-size:14px;min-height:1.2em}
.payMsg.err{color:var(--red)}
.testBtn{border-style:dashed}
.bigcheck{width:72px;height:72px;border-radius:50%;background:var(--green);color:#fff;font-size:42px;display:flex;align-items:center;justify-content:center;margin-top:12px}
.dl{list-style:none;display:flex;flex-direction:column;gap:8px}
.dl li{display:flex;justify-content:space-between;align-items:center;gap:8px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 12px;font-size:14px}
.dl a{color:var(--blue);font-weight:600;text-decoration:none;white-space:nowrap}
footer{text-align:center;padding:16px}
.mini{border:1.5px solid var(--line);background:#fff;border-radius:20px;padding:6px 12px;font-size:13px;color:var(--ink);user-select:none;-webkit-user-select:none;touch-action:none;-webkit-touch-callout:none}
.mini:active{background:var(--blueSoft);border-color:var(--blue)}
#previewCanvas{cursor:grab}
