/* หน้าต่างกิลด์ (client/guild-window.js · ใบ guild-1025 ขั้น 1.5) — หัวแบนเนอร์หอกิลด์ · แท็บ · เนื้อหาเลื่อนในกล่องตัวเอง · ขนาดคงที่ทุกแท็บ
   ชิ้นในเนื้อหา (การ์ด/แถวสมาชิก/ฟอร์ม) ใช้ ui-guild.css + ui-social.css เดิม · ไม่มี z-index นอกตาราง */
#windows .win[data-win="guild"] > .body { padding: 0; overflow: hidden; display: flex; background: #fffaf0; }
html:not(.touch-ui) #windows .win[data-win="guild"] > .body { height: min(640px, calc(100vh - 150px)); }
#windows .gw { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
#windows .gw-hero { position: relative; flex: none; height: 128px; display: flex; align-items: center; gap: 16px; padding: 0 22px;
  background: url('assets/ui/guild/hall_banner.webp') right 30% / cover no-repeat, #f4e3c0; border-bottom: 2px solid #e8c77a; }
#windows .gw-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #fffaf0f2 0%, #fffaf0d9 38%, #fffaf000 70%); pointer-events: none; }
#windows .gw-hero > * { position: relative; }
#windows .gw-emb { width: 88px; height: 88px; filter: drop-shadow(0 3px 4px #0003); }
#windows .gw-hero-t { display: grid; gap: 4px; min-width: 0; max-width: 60%; }
#windows .gw-hero-t b { font: 800 var(--fs-hero, 26px)/1.15 var(--font-head); color: #1f5558; overflow-wrap: anywhere; }
#windows .gw-hero-t small { font: 600 var(--fs-sm, 14px)/1.35 var(--font); color: #5a4626; overflow-wrap: anywhere; display: flex; gap: 4px; align-items: center; }
#windows .gw-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
#windows .gw-lv { padding: 2px 8px; border-radius: 999px; background: #2f6f73; color: #fffdf6; font: 700 var(--fs-xs, 12px) var(--font); }
#windows .gw-hero-art { position: relative; width: 96px; height: 70px; flex: none; }
#windows .gw-hero-art .gd-emb { position: absolute; width: 46px; height: 46px; }
#windows .gw-hero-art .a { left: 24px; top: 0; width: 54px; height: 54px; z-index: 1; }
#windows .gw-hero-art .b { left: 0; top: 18px; transform: rotate(-12deg); }
#windows .gw-hero-art .c { left: 52px; top: 18px; transform: rotate(12deg); }
#windows .gw-tabs { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px 16px 0; }
#windows .gw-tabs button { position: relative; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid #e2cf9f; background: linear-gradient(#fffef9, #fbf3e3); color: #4a3512; font: 800 var(--fs-body, 15px) var(--font-head); box-shadow: 0 2px 0 #e4d1a6; }
#windows .gw-tabs button i { font-style: normal; display: inline-flex; }
#windows .gw-tabs button.on { background: linear-gradient(#2f7c80, #246064); border-color: #1d5155; color: #fffdf6; box-shadow: 0 2px 0 #1a4447; }
#windows .gw-tabs button:focus-visible { outline: 3px solid #e8b64a; outline-offset: 2px; }
#windows .gw-tabs .gw-lock { opacity: .7; }
#windows .gw-tabs .sx-num { position: absolute; top: -6px; right: -4px; }
#windows .gw-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
#windows .gw-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#windows .gw-stat { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border-radius: 14px; background: #fffdf7; border: 1px solid #e6dabb; box-shadow: 0 1px 0 #e7d8b4; }
#windows .gw-stat i { font-style: normal; }
#windows .gw-stat b { font: 800 var(--fs-title, 20px) var(--font-head); color: #1f5558; }
#windows .gw-stat small { font: 600 var(--fs-xs, 12px) var(--font); color: #8a7a5a; }
#windows .gw-acts { display: flex; flex-wrap: wrap; gap: 8px; }
#windows .gw-acts .sx-btn { min-height: 46px; }
#windows .sx-btn.gw-locked { background: #f1ece0; border-color: #d9cfb6; color: #8a7a5a; }
#windows .sx-btn.gw-locked em { font-style: normal; font-size: var(--fs-xs, 12px); padding: 1px 6px; border-radius: 999px; background: #e3d8bd; color: #6b5a3a; }
#windows .gw-dev { display: grid; gap: 12px; }
#windows .gw-dev-h { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 14px; background: #fff3d6; border: 1px solid #e8c77a; }
#windows .gw-dev-h b { display: block; font: 800 var(--fs-body, 16px) var(--font-head); color: #6b4e14; }
#windows .gw-dev-h small { font: 500 var(--fs-sm, 13px)/1.4 var(--font); color: #6b5a3a; }
#windows .gw-dev-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
#windows .gw-dev-card { display: grid; justify-items: center; gap: 4px; padding: 10px 8px 12px; border-radius: 14px; background: #fffdf7; border: 1px dashed #d9c79a; text-align: center; }
#windows .gw-dev-card img { width: 96px; height: 96px; object-fit: contain; filter: saturate(.75) opacity(.85); }
#windows .gw-dev-card b { font: 800 var(--fs-body, 15px) var(--font-head); color: #4a3512; }
#windows .gw-dev-card small { font: 500 var(--fs-xs, 12px)/1.35 var(--font); color: #8a7a5a; }
#windows .gw-soon { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #efe6cf; color: #6b5a3a; font: 700 var(--fs-xs, 12px) var(--font); }
#windows .gd-short { grid-template-columns: auto minmax(0, 1fr) auto; }

/* จอสัมผัส (มือถือแนวนอน 844×390 · แท็บเล็ต) — เต็มจอ · แท็บแนวตั้งซ้าย · เนื้อหาใช้ความสูงที่เหลือทั้งหมด */
html.touch-ui #windows .win[data-win="guild"] > .body { flex: 1; min-height: 0; }
html.touch-ui #windows .gw.has { display: grid; grid-template-columns: 132px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
html.touch-ui #windows .gw.has .gw-hero { grid-column: 1 / -1; }
html.touch-ui #windows .gw.has .gw-tabs { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 6px; padding: 8px 0 8px 8px; overflow-y: auto; }
html.touch-ui #windows .gw.has .gw-tabs button { min-height: 48px; justify-content: flex-start; font-size: var(--fs-sm, 14px); }
html.touch-ui #windows .gw.has .gw-body { grid-column: 2; grid-row: 2; padding: 8px 10px 10px; }
/* จอเตี้ย: หัวแบนเนอร์เหลือแถบ 58px (ตรา + ชื่อ + ประกาศบรรทัดเดียว) */
@media (max-height: 500px) {
  #windows .gw-hero { height: 58px; gap: 10px; padding: 0 12px; }
  #windows .gw-emb { width: 46px; height: 46px; }
  #windows .gw-hero-t { max-width: 75%; gap: 0; }
  #windows .gw-hero-t b { font-size: var(--fs-name, 18px); }
  #windows .gw-hero-t small { font-size: var(--fs-xs, 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  #windows .gw-hero-art { width: 70px; height: 46px; }
  #windows .gw-hero-art .gd-emb { width: 32px; height: 32px; }
  #windows .gw-hero-art .a { left: 18px; width: 38px; height: 38px; }
  #windows .gw-hero-art .b { left: 0; top: 10px; }
  #windows .gw-hero-art .c { left: 38px; top: 10px; }
  #windows .gw-chips { display: none; }
  #windows .gw-stats { gap: 6px; }
  #windows .gw-stat { padding: 6px 4px; }
  #windows .gw-stat b { font-size: var(--fs-btn, 17px); }
  #windows .gw-dev-grid { gap: 6px; }
  #windows .gw-dev-card img { width: 64px; height: 64px; }
}

/* .gw ใช้คลาส sx2 ร่วม (ขนาดปุ่ม/การ์ดเท่าหน้าสังคม) — ยกเลิกโครงกริดของหน้าสังคมบนจอสัมผัสตอนยังไม่มีกิลด์ + ปุ่มก่อตั้งในหัว */
html.touch-ui #windows .gw.sx2:not(.has) { display: flex; flex-direction: column; }
#windows .gw-hero .gw-found { margin-left: auto; }
@media (max-height: 500px) { #windows .gw-hero .gw-found { min-height: 44px; padding: 0 12px; font-size: var(--fs-body, 15px); } }

/* ไอคอนเล็กในป้าย/หัว (icon() ไม่กำหนดขนาดเอง) · หัวแบนเนอร์: ข้อความหดก่อนชนปุ่มก่อตั้ง · แท็บข้างจอสัมผัสไม่ตัดบรรทัด */
#windows .gw-soon img, #windows .gw-tabs .gw-lock img, #windows .gw-locked img, #windows .gw-hero-t small img { width: 16px; height: 16px; }
#windows .gw-dev-h > img { width: 28px; height: 28px; flex: none; }
#windows .gw-hero-t { flex: 1 1 auto; max-width: none; }
#windows .gw-hero-t small { min-width: 0; }
html.touch-ui #windows .gw.has .gw-tabs button { white-space: nowrap; padding: 0 8px; }
html.touch-ui #windows .gw.has .gw-tabs .gw-lock { display: none; }
@media (max-height: 500px) { #windows .gw-hero-t small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; } }

/* กองทุนกิลด์ (client/gfund-tab.js · guild-fund-1113) — หน้าย่อยในแท็บพัฒนากิลด์ · ตัวหนังสือใช้ตัวแปรกลาง ui-scale · ปุ่ม ≥ 44 (สัมผัส 48)
   หน้า "กองทุน" ออกแบบให้พอดีมือถือ 844×390 ไม่ต้องเลื่อน (หัวแบนเนอร์เตี้ย 58) · หน้ารายการ (บริจาค/ร้าน/ช่างไม้/บันทึก) เลื่อนในกล่อง .gf-list ของตัวเอง */
#windows .gf { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#windows .gf-sub { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
#windows .gf-sub button { min-height: var(--btn-h, 44px); display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 6px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid #e2cf9f; background: #fffdf7; color: #4a3512; font: 800 var(--fs-sm, 14px) var(--font-head); white-space: nowrap; }
#windows .gf-sub button.on { background: #fff3d6; border-color: #e8b64a; color: #6b4e14; box-shadow: inset 0 -3px 0 #e8b64a; }
#windows .gf-sub button img { width: 18px; height: 18px; }
#windows .gf-in { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#windows .gf-bar { display: block; height: 10px; border-radius: 999px; background: #efe4c8; overflow: hidden; }
#windows .gf-bar.thin { height: 6px; }
#windows .gf-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2f7c80, #4aa3a0); }
#windows .gf-top { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; background: #fffdf7; border: 1px solid #e6dabb; }
#windows .gf-lvb { display: grid; justify-items: center; min-width: 64px; padding: 4px 8px; border-radius: 12px; background: #2f6f73; color: #fffdf6; }
#windows .gf-lvb small { font: 700 var(--fs-xs, 12px) var(--font); opacity: .85; }
#windows .gf-lvb b { font: 800 var(--fs-title, 20px) var(--font-head); }
#windows .gf-lvt { flex: 1; min-width: 0; display: grid; gap: 4px; }
#windows .gf-lvt b { font: 800 var(--fs-body, 16px) var(--font-head); color: #1f5558; }
#windows .gf-lvt small, #windows .gf-note, #windows .gf-itn small, #windows .gf-qn small, #windows .gf-qp small { font: 600 var(--fs-xs, 12px)/1.35 var(--font); color: #8a7a5a; }
#windows .gf-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#windows .gf-st { display: grid; gap: 2px; padding: 6px 8px; border-radius: 12px; background: #fffdf7; border: 1px solid #e6dabb; text-align: center; }
#windows .gf-st small { font: 700 var(--fs-xs, 12px) var(--font); color: #8a7a5a; display: flex; gap: 3px; justify-content: center; align-items: center; }
#windows .gf-st small img { width: 14px; height: 14px; }
#windows .gf-st b { font: 800 var(--fs-name, 18px) var(--font-head); color: #1f5558; }
#windows .gf-st.war { background: #f6efe0; border-style: dashed; }
#windows .gf-q { display: grid; gap: 4px; }
#windows .gf-q h4, #windows .gf-logs h4 { margin: 0; display: flex; align-items: center; gap: 6px; font: 800 var(--fs-sm, 14px) var(--font-head); color: #4a3512; }
#windows .gf-q h4 small { font: 600 var(--fs-xs, 12px) var(--font); color: #8a7a5a; }
#windows .gf-q h4 img { width: 18px; height: 18px; }
#windows .gf-qr { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 10px; align-items: center; padding: 4px 10px; border-radius: 10px; background: #fffdf7; border: 1px solid #ece2c8; }
#windows .gf-qr.done { background: #eef6ee; border-color: #b9d8b9; }
#windows .gf-qn { display: grid; min-width: 0; }
#windows .gf-qn b { font: 800 var(--fs-sm, 14px) var(--font-head); color: #4a3512; display: flex; gap: 4px; align-items: center; }
#windows .gf-qn b img { width: 16px; height: 16px; }
#windows .gf-qn small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#windows .gf-qp { display: grid; gap: 2px; }
#windows .gf-qp small i { font-style: normal; }
#windows .gf-note { margin: 0; }
#windows .gf-gifts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#windows .gf-hint { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #fff3d6; border: 1px solid #e8c77a; }
#windows .gf-hint > img { width: 26px; height: 26px; flex: none; }
#windows .gf-hint > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
#windows .gf-hint b { font: 800 var(--fs-body, 15px) var(--font-head); color: #6b4e14; }
#windows .gf-hint small { font: 500 var(--fs-sm, 13px)/1.4 var(--font); color: #6b5a3a; }
#windows .gf-don { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
#windows .gf-cap { display: grid; gap: 4px; font: 700 var(--fs-sm, 14px) var(--font); color: #4a3512; }
#windows .gf-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; max-height: 52vh; }
#windows .gf-it, #windows .gf-gold, #windows .gf-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 12px; background: #fffdf7; border: 1px solid #e6dabb; }
#windows .gf-it.on { border-color: #2f7c80; background: #eef7f6; }
#windows .gf-row.have { background: #eef6ee; }
#windows .gf-it > img, #windows .gf-gold > img { width: 34px; height: 34px; object-fit: contain; flex: none; }
#windows .gf-itn { flex: 1; min-width: 0; display: grid; }
#windows .gf-itn b { font: 800 var(--fs-sm, 14px) var(--font-head); color: #4a3512; display: flex; gap: 4px; align-items: center; overflow-wrap: anywhere; }
#windows .gf-itn b img { width: 16px; height: 16px; }
#windows .gf-step { display: flex; align-items: center; gap: 4px; flex: none; }
#windows .gf-step button { min-width: var(--btn-h, 44px); min-height: var(--btn-h, 44px); padding: 0 6px; border-radius: 10px; cursor: pointer; border: 1.5px solid #e2cf9f; background: #fffef9; color: #4a3512; font: 800 var(--fs-sm, 14px) var(--font-head); }
#windows .gf-step button.all { min-width: 64px; }
#windows .gf-step > b { min-width: 48px; text-align: center; font: 800 var(--fs-body, 15px) var(--font-head); color: #1f5558; }
#windows .gf-foot { display: flex; align-items: center; gap: 10px; padding-top: 4px; border-top: 1px dashed #e2cf9f; }
#windows .gf-foot > span { flex: 1; min-width: 0; display: grid; }
#windows .gf-foot b { font: 800 var(--fs-body, 15px) var(--font-head); color: #1f5558; }
#windows .gf-foot small { font: 600 var(--fs-xs, 12px) var(--font); color: #8a7a5a; }
#windows .gf-foot small.warn { color: #a85a42; }
#windows .gf-foot .sx-btn, #windows .gf-row .sx-btn { min-height: var(--btn-h, 44px); flex: none; }
#windows .gf .sx-btn.sure { background: #e8b64a; border-color: #b8893c; color: #3a2a08; }
#windows .gf .sx-btn em { font-style: normal; font-size: var(--fs-xs, 12px); }
#windows .gf-own { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: #e6f1e6; color: #2f5f2f; font: 700 var(--fs-xs, 12px) var(--font); }
#windows .gf-own.lock { background: #efe6cf; color: #6b5a3a; }
#windows .gf-own img { width: 14px; height: 14px; }
#windows .gf-logs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 10px; min-height: 0; }
#windows .gf-ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; max-height: 50vh; overflow-y: auto; overscroll-behavior: contain; }
#windows .gf-ul li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 4px 8px; border-radius: 8px; background: #fffdf7; font: 600 var(--fs-sm, 13px) var(--font); color: #4a3512; }
#windows .gf-ul li > span { margin-left: auto; font-weight: 800; color: #1f5558; }
#windows .gf-ul li small { flex-basis: 100%; font-size: var(--fs-xs, 12px); color: #8a7a5a; }
#windows .gf-ul li.none { color: #8a7a5a; }
/* คอม: มุมขวาล่างของหน้าต่างมีใบไม้ประดับ — ปุ่มบริจาคต้องไม่อยู่ใต้ใบไม้ */
html:not(.touch-ui) #windows .gf-foot { padding-right: 60px; }
/* จอแคบ (มือถือเล็ก 667): แท็บย่อย 5 ปุ่มไม่พอที่สำหรับไอคอน + คำอังกฤษ */
@media (max-width: 720px) { #windows .gf-sub button img { display: none; } #windows .gf-sub button { padding: 0 4px; } }
/* จอเตี้ย (มือถือแนวนอน): ย่อหน้ากองทุนให้พอดีจอเดียว */
@media (max-height: 500px) {
  #windows .gf { gap: 5px; }
  #windows .gf-in { gap: 5px; }
  #windows .gf-top { padding: 4px 10px; gap: 8px; }
  #windows .gf-lvb { min-width: 52px; padding: 2px 6px; }
  #windows .gf-lvb b { font-size: var(--fs-name, 18px); }
  #windows .gf-st { padding: 3px 6px; }
  #windows .gf-st b { font-size: var(--fs-body, 15px); }
  #windows .gf-q { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 6px; }
  #windows .gf-q h4 { grid-column: 1 / -1; }
  #windows .gf-qr { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 6px; padding: 3px 8px; }
  #windows .gf-qp { display: contents; }
  #windows .gf-qp small { grid-column: 2; grid-row: 1; white-space: nowrap; }
  #windows .gf-qp .gf-bar { grid-column: 1 / -1; grid-row: 2; }
  #windows .gf-qn b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #windows .gf-qp small i { display: none; }
  #windows .gf-lvt { grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: baseline; }
  #windows .gf-lvt b { grid-area: 1 / 1; }
  #windows .gf-lvt small { grid-area: 1 / 2; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #windows .gf-lvt .gf-bar { grid-area: 2 / 1 / 3 / 3; }
  #windows .gf-cap { display: flex; align-items: center; gap: 8px; }
  #windows .gf-cap .gf-bar { flex: 1; min-width: 40px; }
  #windows .gf-gold .gf-itn small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #windows .gf-qn small, #windows .gf-note { display: none; }
  #windows .gf-list { max-height: 38vh; }
  #windows .gf-ul { max-height: 46vh; }
}
