/* ═══ flow เปิดซองแสตมป์ (ใบ stamp-open-flow-1030 · client/stamp-flow.js) ═══
   กระเป๋า › แท็บแสตมป์: หมวดย่อย · การ์ดใหญ่ · แผงรายละเอียด + ปุ่ม "เปิดซอง" ใหญ่ · หน้าผล (.srv.sfl): ใช้กลางจอส่วนใหญ่ · ปุ่มเปิดอีก/เก็บไว้/ไปหน้าแปะ
   เลย์เอาต์ตามความกว้างจริง (ไม่ใช่ชื่อเครื่อง): คอมกว้าง = หมวด | กริด | รายละเอียด (container query) · จอสัมผัส = แท็บกระเป๋า | กริด 55 | แผง 45 · จอเตี้ยสุด = แท็บเป็นชิป (ui-bag2.css)
   ตัวหนังสือ/ปุ่มใช้ตัวแปรกลาง ui-scale.css (ไฟล์ใหม่ = 0 px ตรง · server/ui-scale.test.js) · perf: transform/opacity เท่านั้น ไม่มี blur/animation ค้าง
   ?sflow=0 = ไม่มีคลาส sfl-on / sfl → กฎนี้ไม่มีผล */

/* ── คอม: หน้าต่างกระเป๋ากว้างขึ้นเมื่ออยู่แท็บแสตมป์ ── */
html:not(.touch-ui) #windows .win.sfl-wide { width: var(--sfl-win-w, min(820px, calc(100vw - 24px))) !important; max-width: none !important; }

/* ── โครง ── */
.inv.sfl-on { container: sflinv / inline-size; }
.inv.sfl-on > .sfl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sfl-subs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.sfl-subs::-webkit-scrollbar { display: none; }
.sfl-subs button { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid #e0cfab; background: #fffaf0;
  color: #6b4a1a; font: 600 var(--fs-sm, 14px)/1 var(--font-head, var(--font)); cursor: pointer; white-space: nowrap; }
.sfl-subs button small { font: 600 var(--fs-xs, 12px)/1 var(--font); opacity: .7; }
.sfl-subs button.on { background: #2f6f73; border-color: #245d60; color: #fff; }
html.touch-ui .inv.sfl-on .sfl-subs button { min-height: 44px !important; }
.sfl-body { display: grid; grid-template-columns: minmax(0, 55fr) minmax(0, 45fr); gap: 10px; align-items: start; }

/* กริดการ์ดใหญ่ — ภาพ + Rank + จำนวน + สถานะเลือก (ไม่มีข้อความผล) */
.inv.sfl-on .grid.sfl-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)) !important; gap: 8px !important; align-content: start; padding: 6px !important; }
.inv.sfl-on .sfl-card.slot { position: relative; display: grid !important; place-items: center; width: auto !important; height: auto !important; min-height: 0 !important; aspect-ratio: 4 / 5;
  padding: 6px; box-sizing: border-box; border-radius: 14px; border: 1.5px solid #e6d6b0; background: radial-gradient(circle at 50% 38%, #fffdf6, #f6ead0); cursor: pointer; transition: transform .12s ease-out; }
.inv.sfl-on .sfl-card.slot:active { transform: scale(.97); }
.inv.sfl-on .sfl-card.sel { border-color: #2f6f73; box-shadow: 0 0 0 3px #2f6f7355, 0 3px 10px #2f6f7333; }
.sfl-card .stp.sfl-art { --w: min(58px, 70%); pointer-events: none; }
.sfl-card .cst.sfl-art { width: 52px; height: 78px; pointer-events: none; }
.sfl-card .bag-icon.sfl-art { display: grid; place-items: center; width: 74%; height: 74%; font-size: var(--fs-hero, 24px); pointer-events: none; }
.sfl-card .bag-icon.sfl-art .ic3d { width: 100%; height: 100%; object-fit: contain; }
.sfl-card .stp-tagr { position: absolute; left: 4px; top: 4px; }
.sfl-card .qty { position: absolute; right: 5px; bottom: 4px; min-width: 22px; padding: 0 5px; border-radius: 999px; background: #4a3a20; color: #fff; font: 700 var(--fs-xs, 12px)/1.6 var(--font); text-align: center; }
.sfl-gotdot { position: absolute; right: 3px; top: 3px; padding: 1px 6px; border-radius: 999px; background: #2f6f73; color: #fff; font: 700 var(--fs-xs, 12px)/1.4 var(--font-head, var(--font)); font-style: normal; letter-spacing: .03em; pointer-events: none; }

/* แผงรายละเอียด — ค้างบนสุดตอนเลื่อนกริด · ปุ่มหลักใหญ่ */
.sfl-side { position: sticky; top: 0; min-width: 0; }
.sfl-dsc { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.sfl-det, .sfl-empty { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; border: 1.5px solid #e6d6b0; background: linear-gradient(#fffdf6, #fbf2de); color: #4a3a20; box-sizing: border-box; }
.sfl-empty p { margin: 0; color: #8a6a3a; font: 500 var(--fs-sm, 14px)/1.4 var(--font); }
.sfl-det.rB { border-color: #9cc3e8; } .sfl-det.rA { border-color: #c9b2ee; } .sfl-det.rS { border-color: #e8b64a; box-shadow: 0 0 0 2px #e8b64a33; }
.sfl-dh { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sfl-dh > .sfl-big { flex: none; }
.sfl-dh > span.sfl-big { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 14px; background: radial-gradient(circle, #fff, #f3e4c2); font-size: var(--fs-hero, 24px); }
.sfl-dh > span.sfl-big .ic3d { width: 92%; height: 92%; object-fit: contain; }
.sfl-dh > .stp.sfl-big { --w: 78px; }
.sfl-dh > .cst.sfl-big { width: 76px; height: 114px; }
.sfl-dt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sfl-dt .srv-rk { align-self: flex-start; }
.sfl-nm { font: 600 var(--fs-name, 18px)/1.25 var(--font-head, var(--font)); color: #4a2e12; overflow-wrap: anywhere; }
.sfl-dt small { font: 500 var(--fs-sm, 14px)/1.35 var(--font); color: #6b5a3a; }
.sfl-dt small b { color: #2f6f73; }
.sfl-left { font: 500 var(--fs-sm, 14px)/1.3 var(--font); color: #6b5a3a; } .sfl-left b { font: 700 var(--fs-name, 18px)/1 var(--font-head, var(--font)); color: #2f6f73; }
.sfl-val { margin: 0; font: 700 var(--fs-hero, 24px)/1.1 var(--font-head, var(--font)); color: #2f6f73; }
.sfl-val.fxs, html.touch-ui .sfl-val.fxs { font-size: var(--fs-body, 16px); line-height: 1.3; }   /* สายค่าคงที่ = ประโยค (เจ้าของ 8 พ.ย.) */
.sfl-note, .sfl-tut, .sfl-warn, .sfl-err { margin: 0; font: 500 var(--fs-sm, 14px)/1.4 var(--font); }
.sfl-note { color: #7a6540; }
.sfl-tut { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: #e8f3f1; color: #245d60; }
.sfl-tut .ui-ic { width: 18px; height: 18px; flex: none; }
.sfl-warn, .sfl-err { padding: 6px 10px; border-radius: 10px; background: #fdeee6; color: #a0402a; }
.sfl-err[hidden] { display: none; }
.sfl-acts > :is(.sfl-err, .sfl-warn), .sfl-dacts > :is(.sfl-err, .sfl-warn) { flex: 1 1 100%; }
.sfl-odds { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font: 500 var(--fs-sm, 14px)/1.4 var(--font); color: #6b5a3a; }
.sfl-odds > span { color: #8a6a3a; }
.sfl-odds i { display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-weight: 600; color: #4a3a20; }
.sfl-odds .srv-rk { min-width: 20px; height: 20px; padding: 0 5px; font-size: var(--fs-xs, 12px) !important; }
.sfl-dacts { display: flex; flex-wrap: wrap; gap: 8px; }
.sfl-dacts button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--btn-h, 44px); padding: 0 16px; border-radius: 14px; border: 1.5px solid #cdb27a;
  background: #fffaf0; color: #5b4526; font: 600 var(--fs-btn, 16px)/1 var(--font-head, var(--font)); cursor: pointer; }
.sfl-dacts button.main { flex: 1 1 100%; min-height: var(--btn-h-main, 52px); border-color: #245d60; background: linear-gradient(#3f8584, #2f6f73); color: #fff; font-size: var(--fs-btn-main, 18px); box-shadow: 0 3px 0 #1f4f52; }
.sfl-dacts button.main:active { transform: translateY(2px); box-shadow: 0 1px 0 #1f4f52; }
.sfl-dacts button:disabled { opacity: .55; cursor: default; transform: none; }
.sfl-dacts button.wait { opacity: .8; }
.sfl-dacts .ui-ic { width: 22px; height: 22px; }
.sfl-skip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font: 500 var(--fs-sm, 14px)/1.2 var(--font); color: #6b5a3a; cursor: pointer; }
.sfl-skip input { width: 20px; height: 20px; accent-color: #2f6f73; }
html.touch-ui .sfl-skip { min-height: 44px; }
.sfl-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 4px; border: 0; background: none; color: #2f6f73; font: 600 var(--fs-sm, 14px)/1 var(--font-head, var(--font)); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
html.touch-ui .sfl-link { min-height: 44px; }
.sfl-link .ui-ic { width: 18px; height: 18px; }
.sfl-det .stp-range { margin: 0; }

/* คอมกว้าง (กระเป๋าขยาย ≥ 680): หมวด | กริด | รายละเอียด 3 ช่อง */
@container sflinv (min-width: 680px) {
  html:not(.touch-ui) .inv.sfl-on > .sfl { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; align-items: start; }
  html:not(.touch-ui) .inv.sfl-on .sfl-subs { flex-direction: column; overflow: visible; }
  html:not(.touch-ui) .inv.sfl-on .sfl-subs button { justify-content: space-between; min-height: 44px; }
  html:not(.touch-ui) .inv.sfl-on .sfl-body { grid-column: 2; grid-template-columns: minmax(0, 1fr) minmax(260px, 44%); }
  html:not(.touch-ui) .inv.sfl-on .grid.sfl-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)) !important; }
}
/* แคบ (แผงซ้อนใต้กริดไม่ได้ — กริด 55 / แผง 45 แต่ภาพย่อ) */
@container sflinv (max-width: 520px) {
  .sfl-dh > span.sfl-big { width: 64px; height: 64px; }
  .sfl-dh > .stp.sfl-big { --w: 58px; }
  .sfl-dh > .cst.sfl-big { width: 56px; height: 84px; }
  .inv.sfl-on .grid.sfl-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)) !important; gap: 6px !important; }
  .sfl-det { padding: 10px; gap: 6px; }
  .sfl-val { font-size: var(--fs-title, 20px); }
}
/* จอเตี้ย (มือถือแนวนอน): แผงเลื่อนในตัว ปุ่มหลักค้างล่าง */
@media (max-height: 520px) {
  /* แผง = เนื้อเลื่อนได้ (.sfl-dsc) + แถวปุ่มอยู่ท้ายเสมอ (ไม่ลอยทับเนื้อ — หัวหน้า: แถวโอกาสถูกปุ่มทับ) */
  html.touch-ui .sfl-det { max-height: calc(100dvh - var(--sfl-chrome, 186px)); overflow: hidden; }
  html.touch-ui .sfl-dsc { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; gap: 6px; }
  html.touch-ui .sfl-det { gap: 6px; padding: 10px; }
  html.touch-ui .sfl-dacts { flex: none; gap: 6px; }
  html.touch-ui .sfl-dacts button.main { min-height: 48px; flex: 1 1 auto; }
  html.touch-ui .sfl-dh > span.sfl-big { width: 56px; height: 56px; }
  html.touch-ui .sfl-dh > span.sfl-big { width: 64px; height: 64px; }
  html.touch-ui .sfl-dh > .stp.sfl-big { --w: 54px; }
  html.touch-ui .sfl-dh > .cst.sfl-big { width: 54px; height: 81px; }
  html.touch-ui .sfl-val { font-size: var(--fs-title, 20px); }
  html.touch-ui .inv.sfl-on .grid.sfl-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)) !important; }
}

/* ── หน้าผลเปิดซอง (.srv.sfl · ใช้กลางจอส่วนใหญ่) ── */
.srv.sfl .srv-card { width: min(800px, 100%); --sw: min(236px, calc((min(80vh, 100vh - 24px) - 40px) * .6446)); }
.srv.sfl .srv-info { gap: 7px; }
.srv.sfl:not(.s5) .srv-info > :is(.sfl-cmbbox, .sfl-link, .sfl-err, .cstx-set) { opacity: 0; transform: translateY(6px); }
.sfl-nd { display: inline-flex; }
.sfl-dup { padding: 1px 9px; border-radius: 99px; background: #f1e6cc; color: #6b4a1a; font: 600 var(--fs-xs, 12px)/1.6 var(--font-head, var(--font)); }
.srv-new.sfl-new { letter-spacing: .02em; }
.sfl-cmbbox:empty { display: none; }
.sfl-cmbbox { display: flex; flex-direction: column; gap: 6px; }
.sfl-cmb { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 4px 4px 10px; border-radius: 12px; background: #eef6f4; border: 1px solid #cfe3df; font: 500 var(--fs-sm, 14px)/1.3 var(--font); color: #2d4a48; }
.sfl-cmb > .ui-ic { width: 18px; height: 18px; flex: none; }
.sfl-cmb > span { flex: 1 1 auto; min-width: 0; } .sfl-cmb b { color: #245d60; } .sfl-cmb em { font-style: normal; font-weight: 700; color: #2f6f73; margin-left: 2px; }
.sfl-cmb .sfl-link { min-height: 36px; }
.srv.sfl .srv-mkt.sfl-link { min-height: 32px; font-size: var(--fs-xs, 12px); color: #7a6540; }
html.touch-ui .srv.sfl .srv-mkt.sfl-link { min-height: 44px; }
.srv.sfl .sfl-acts { margin-top: 4px; }
.srv.sfl .sfl-acts button { min-height: var(--btn-h, 44px); font-size: var(--fs-btn, 16px); }
.srv.sfl .sfl-acts button.main { min-height: var(--btn-h-main, 52px); padding: 0 20px; font-size: var(--fs-btn-main, 18px); box-shadow: 0 3px 0 #1f4f52; }
.srv.sfl .sfl-acts button.main small { font: 600 var(--fs-sm, 14px)/1 var(--font); opacity: .85; }
.srv.sfl .sfl-acts .sfl-place.up { border-color: #2f6f73; color: #245d60; }
.srv.sfl .sfl-err { margin-top: 2px; }
.sfl-spin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #ffffff66; border-top-color: #fff; animation: sfl-spin .7s linear 6; }
@keyframes sfl-spin { to { transform: rotate(1turn); } }
/* เปิดอีกซองต่อเนื่อง: การ์ดไม่ซูมเข้าใหม่ พื้นหรี่คงเดิม (ไม่กระพริบ) */
.srv.sfl.again .srv-card { animation: none; }
@media (max-height: 520px) {
  .srv.sfl .srv-card { max-height: 94vh; width: min(760px, 100%); --sw: min(190px, calc((94vh - 40px) * .6446)); }
  .srv.sfl .srv-info { max-height: calc(94vh - 24px); gap: 4px; }
  .srv.sfl .sfl-acts { position: sticky; bottom: 0; padding-top: 4px; background: linear-gradient(#f6ead000, #f6ead0 35%); }
  .srv.sfl .sfl-acts button { min-height: 44px; padding: 0 12px; font-size: var(--fs-sm, 14px); }
  .srv.sfl .sfl-acts button.main { min-height: 48px; font-size: var(--fs-btn, 16px); }
  .srv.sfl .stp-range { margin: 0; }
}
/* แสตมป์ดันมีอักษร Rank ในภาพเองแล้ว — ในการ์ดใช้ป้ายมุมแบบเดียวกับแสตมป์มอน (ไม่ซ้ำสองป้าย) */
.sfl-card .cst.sfl-art .rk { display: none; }
.sfl-card .bag-icon.sfl-art { width: 92%; height: 92%; }
/* จอเตี้ยสุด (≤ 380 · 667×375): แท็บกระเป๋าเป็นแถวชิปอยู่แล้ว (ui-bag2.css G2) — หมวดย่อยซ่อน (เรียงซองก่อนอยู่แล้ว) ให้กริด+แผงได้ความสูงเต็ม */
@media (max-height: 380px) {
  html.touch-ui .inv.sfl-on .sfl-subs { display: none; }
  html.touch-ui .sfl-det { max-height: calc(100dvh - var(--sfl-chrome-s, 194px)); }
  html.touch-ui .sfl-dt small, html.touch-ui .sfl-det .sfl-tut { display: none; }
  html.touch-ui .sfl-nm { font-size: var(--fs-body, 16px); }
}
/* แท็บเล็ต/จอสูง (≥ 600): การ์ดใหญ่ขึ้น โปร่ง · ปุ่มหลัก 56 */
@media (min-height: 600px) {
  html.touch-ui .inv.sfl-on .grid.sfl-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)) !important; gap: 12px !important; }
  html.touch-ui .sfl-card .stp.sfl-art { --w: min(76px, 70%); }
  html.touch-ui .sfl-card .cst.sfl-art { width: 68px; height: 102px; }
  html.touch-ui .sfl-dacts button.main { min-height: 56px; }
}
/* ฉากยังเล่น: บรรทัดเสริม (แถวดาว/ตำนาน/ผูกตัว/คอมโบ) โผล่พร้อมตัวเลข ไม่ลอยก่อนแสตมป์ */
.srv.sfl:not(.s5) .srv-info > :not(.srv-kick):not(.srv-name):not(.srv-rank):not(.srv-fx) { opacity: 0; }
/* หน้าผล: ยืนยันการผูก = แผ่นทับล่างการ์ด (อยู่ในจอทั้งหมดทุกขนาด — หัวหน้า: ปุ่มถูกตัดขอบล่าง) */
.srv.sfl .srv-ask:not([hidden]) { position: absolute; z-index: 4; left: 12px; right: 12px; bottom: 12px; box-shadow: 0 6px 20px rgba(60, 40, 10, .3); background: #fff8e4; }
/* S: ใบไม้อยู่ฝั่งภาพเท่านั้น หลังข้อความ · ริบบิ้น "S RANK" บนการ์ดไม่ซ้ำกับป้ายข้างชื่อ (ธงพิเศษ ตำนาน/S+/ฟอยล์ ยังขึ้น) */
.srv.sfl .srv-petals { right: auto; width: calc(var(--sw) * 1.12 + 24px); z-index: 0; }
.srv.sfl .srv-info { position: relative; z-index: 2; }
.srv.sfl .srv-ribbon:not(.lgd):not(.plus):not(.foil) { display: none; }
.sfl-dt .sfl-odds { gap: 2px 8px; font-size: var(--fs-xs, 12px); }
/* 667×375: ภาพในแผงซ่อน (การ์ดที่เลือกในกริดคือภาพเดียวกัน) · ปุ่มเปิด+เปิดทั้งหมดแถวเดียว → แถวโอกาส/แถบช่วงเห็นเต็ม (หัวหน้า 30 ต.ค.) */
@media (max-height: 380px) {
  html.touch-ui .sfl-dh > .sfl-big { display: none; }
  html.touch-ui .sfl-dacts { flex-wrap: nowrap; }
  html.touch-ui .sfl-dacts button:not(.main) { flex: none; padding: 0 10px; font-size: var(--fs-sm, 14px); }
  html.touch-ui .sfl-dt .sfl-odds { gap: 0 6px; }
  html.touch-ui .sfl-val { font-size: var(--fs-name, 18px); }
}
/* จอเตี้ย: บรรทัดรองใต้ชื่อซองซ่อน (อังกฤษยาว ดันแถวโอกาสตก) · ปุ่มผลแถวเดียวไม่ตกขอบล่าง */
@media (max-height: 520px) {
  html.touch-ui .sfl-det.env .sfl-dt small { display: none; }
  .srv.sfl .sfl-acts { flex-wrap: nowrap; }
  .srv.sfl .sfl-acts > button { flex: 0 1 auto; min-width: 0; white-space: nowrap; padding: 0 10px; }
  .srv.sfl .sfl-acts > button:not(.main) .ui-ic { display: none; }
}
@media (max-height: 380px) {
  .srv.sfl .sfl-acts > button { padding: 0 8px; font-size: var(--fs-xs, 12px); }
  .srv.sfl .sfl-acts > button.main { font-size: var(--fs-sm, 14px); }
}
@media (max-height: 520px) { html.touch-ui .sfl-det.env .sfl-dh > .sfl-big { display: none; } }   /* ภาพซอง = การ์ดที่เลือกในกริด · แถวโอกาสได้เต็มกว้าง (อังกฤษ 844×390) */
/* 667×375: ลิงก์ "ดูราคาตลาด" ถูกแถบปุ่ม sticky บัง (ด่าน hud-cover 31 ต.ค.) — จอเตี้ยสุดซ่อน ดูราคาได้ที่ตลาด */
@media (max-height: 380px) { .srv.sfl .srv-mkt.sfl-link { display: none; } }
