/* หน้าต่างสกิลแบบใหม่ (skill-window-1026 · client/skill-window.js) — ปุ่มมีคำ · แต้มสกิลเด่นที่หัว · 2 ช่อง (กว้าง) / รายการ→รายละเอียด (แคบ)
 * ขนาดตัว/ปุ่มอ่านตัวแปรกลาง ui-scale.css (--fs-* · --btn-*) — ห้ามใส่ px ตรง ๆ ใน font-size (server/ui-scale.test.js)
 * ขึ้นต้น #windows ทุกกฎ: กฎเก่ากว้าง ๆ (ui-kit "html:not(.touch-ui) body .win span:not(…)…" · ui-astra !important) ไม่ทับ
 * ?skw=0 = หน้าเดิม (ไม่มีคลาส skw-on / .skw) */

/* ── กรอบหน้าต่าง: คอม = ขนาด M กลางจอ (เดิม 420px) · จอสัมผัส = Screen Shell เดิม (ui-touch.css) ── */
html:not(.touch-ui) body #windows .win[data-win="skills"].skw-win { width: var(--win-m-w, 820px) !important; max-width: calc(100vw - 16px) !important; max-height: calc(100vh - 110px); }
html:not(.touch-ui) body #windows .win[data-win="skills"].skw-on { height: var(--win-m-h, 640px); }   /* ช่องลัดล่างจอต้องยังเห็น (ใส่ช่องลัดแล้วช่องวาบ) */
html body #windows .win[data-win="skills"].skw-on > .body { flex: 1 1 auto; min-height: 0; overflow: hidden !important; padding: 0 !important; display: flex; flex-direction: column; background: #fdf8ec; }
html body #windows .win[data-win="skills"].skw-on > .foot { display: none !important; }

#windows .skw { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; container: skw / inline-size; color: #443629; font-size: var(--fs-body, 15px); line-height: 1.45; }
#windows .skw img { -webkit-user-drag: none; user-select: none; }

/* ── แถบหัว: แต้มสกิล + ชิป (ใช้ทั้งแท็บสกิลและคัมภีร์) ── */
#windows .skw-tabs { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; margin: 0; border-bottom: 1px solid #ead8ad; background: linear-gradient(#fffaf0, #f8efdc); }
#windows .tm-wrap ~ .skw-tabs, #windows .body > .skw-tabs { margin: -2px -2px 8px; border-radius: 12px; }
#windows .skw-pts { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 2px 12px 2px 6px; margin-right: 4px; border-radius: 999px; background: #f3ead6; border: 2px solid #e2d3b0; color: #6e5a3a; font-size: var(--fs-sm, 14px); font-weight: 700; white-space: nowrap; }
#windows .skw-pts img { width: 26px; height: 26px; }
#windows .skw-pts b { font-size: var(--fs-name, 18px); color: #5a4630; }
#windows .skw-pts.has { background: linear-gradient(#fff6d6, #f9e4a4); border-color: #e8b64a; color: #7a5410; box-shadow: 0 0 0 3px #e8b64a33; }
#windows .skw-pts.has b { color: #b26a00; }
#windows .skw-chip { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; min-width: 48px; padding: 0 12px; border-radius: 999px; border: 2px solid #e2d3b0; background: #fffaf0; color: #6a563a; font-size: var(--fs-sm, 14px); font-weight: 700; white-space: nowrap; cursor: pointer; position: relative; }
#windows .skw-chip img { width: 22px; height: 22px; }
#windows .skw-chip:hover { border-color: #c9b48a; }
#windows .skw-chip.on { background: #2f6f73; border-color: #2f6f73; color: #fff; }
#windows .skw-chip.tome { margin-left: auto; }
#windows .skw-chip.tome em { font-style: normal; font-size: var(--fs-xs, 12px); padding: 1px 7px; border-radius: 999px; background: #efe6d0; color: #7a6a50; }
#windows .skw-chip.tome.locked { border-style: dashed; color: #8a7a5e; }
#windows .skw-chip.tome.on em { background: #ffffff33; color: #fff; }
#windows .skw-chip .tm-dot { position: absolute; top: -3px; right: -3px; }

/* ── ผัง: 2 ช่อง (เนื้อ ≥ 700px) / ช่องเดียว + ย้อนกลับ ── */
#windows .skw-main { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
#windows .skw-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px 12px; }
#windows .skw-detail { min-height: 0; display: flex; flex-direction: column; background: #fffdf7; }
#windows .skw-detail-in { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#windows .skw-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
@container skw (min-width: 700px) {
  #windows .skw-main { grid-template-columns: minmax(300px, 46%) minmax(0, 1fr); }
  #windows .skw-detail { border-left: 2px solid #ead8ad; }
  #windows .skw-backrow { display: none !important; }
}
@container skw (max-width: 699.98px) {
  #windows .skw[data-view="list"] .skw-detail, #windows .skw[data-picking] .skw-detail { display: none; }
  #windows .skw[data-view="detail"]:not([data-picking]) .skw-list { display: none; }
}

/* ── หัวกลุ่ม (อาชีพขั้น · ไม้ตาย · ช่องกุญแจ) — ไม่ใช่กล่อง ไม่ดูเหมือนแถวกดไม่ได้ ── */
#windows .skw-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 14px 2px 6px; padding-bottom: 4px; border-bottom: 2px solid #e6d7b4; color: #2f6f73; font-size: var(--fs-sm, 14px); font-weight: 800; }
#windows .skw-list > .skw-head:first-child, #windows .skw-tip + .skw-head { margin-top: 2px; }
#windows .skw-head small { font-weight: 400; color: #8a6a2a; font-size: var(--fs-xs, 12px); }
#windows .skw-tip { margin: 0 0 8px; padding: 6px 10px; border-radius: 10px; background: #e6f3ef; color: #2f6f73; font-size: var(--fs-sm, 14px); font-weight: 700; }
#windows .skw-none { margin: 20px 4px; color: #8a7a5e; text-align: center; }

/* ── แถว ── */
#windows .skw-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 64px; padding: 7px 10px; margin: 0 0 6px; border-radius: 12px; border: 2px solid #ecdfc2; background: #fffdf6; cursor: pointer; box-sizing: border-box; }
#windows .skw-row:hover { border-color: #d7c49b; }
#windows .skw-row:focus-visible { outline: 3px solid #2f6f7399; outline-offset: 1px; }
#windows .skw-row.sel { border-color: #2f6f73; background: #eef6f3; box-shadow: 0 0 0 2px #2f6f7322; }
#windows .skw-row[data-state="ready"]:not(.sel) { border-color: #b9dcc4; background: #f6fbf4; }
#windows .skw-row[data-state="locked"] { background: #f6f1e7; }
#windows .skw-row[data-state="locked"] .skw-ic { filter: grayscale(.7); opacity: .7; }
#windows .skw-ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: var(--fs-xs, 12px); box-shadow: inset 0 -3px 0 #0003, 0 1px 2px #0002; overflow: hidden; }
#windows .skw-ic-key { background: #efe6d0; }
#windows .skw-ic-key img { width: 70%; height: 70%; object-fit: contain; }
#windows .skw-rt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#windows .skw-nm { font-size: var(--fs-body, 15px); font-weight: 800; color: #3d2f22; line-height: 1.3; overflow-wrap: anywhere; }
#windows .skw-nm small { font-size: var(--fs-xs, 12px); font-weight: 700; color: #8a6a2a; }
#windows .skw-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--fs-sm, 14px); color: #6e5e47; }
#windows .skw-lv { font-weight: 700; color: #5a4a36; white-space: nowrap; }
#windows .skw-dim { color: #8a7a5e; font-size: var(--fs-xs, 12px); }
#windows .skw-kind { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 3px; border-radius: 999px; border: 1px solid; font-size: var(--fs-xs, 12px); font-weight: 800; letter-spacing: .02em; line-height: 1.5; white-space: nowrap; }
#windows .skw-kind img { width: 18px; height: 18px; }
#windows .skw-kind i { font-style: normal; width: 18px; text-align: center; }
#windows .skw-kind.k-active { background: #dff1ea; color: #1f6a5a; border-color: #a9d6c6; }
#windows .skw-kind.k-passive { background: #e3eefa; color: #2d5f93; border-color: #b7cfe9; }
#windows .skw-kind.k-ult { background: #fbefd0; color: #8a5a10; border-color: #e7c983; }
#windows .skw-bar { display: inline-block; width: 56px; height: 6px; border-radius: 6px; overflow: hidden; background: #e6dcc6; }
#windows .skw-bar > span { display: block; height: 100%; border-radius: inherit; background: #5aa37f; }
#windows .skw-bar.ult-bar { width: 72px; }
#windows .skw-bar.ult-bar > span { background: linear-gradient(90deg, #e8b64a, #f0c766); }
#windows .skw-st { display: flex; align-items: center; justify-content: flex-end; }
#windows .skw-pill { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; font-size: var(--fs-sm, 14px); font-weight: 700; white-space: nowrap; }
#windows .skw-pill small { font-size: var(--fs-xs, 12px); font-weight: 600; opacity: .85; margin-left: 2px; }
#windows .skw-pill .ic-svg, #windows .skw-pill i[class^="ui-ic"] { width: 16px; height: 16px; }
#windows .skw-pill.full { background: #fbefcd; color: #8a6510; border-color: #e3c46f; }
#windows .skw-pill.lock { background: #efe9dd; color: #6e6455; border-color: #d8cdb8; }
#windows .skw-pill.wait { background: #f6efe2; color: #7d6a50; border-color: #e3d6bd; }
#windows .skw-pill.ready { background: #dff1e3; color: #2f7a45; border-color: #a9d3b4; }
#windows .skw-pill.auto { background: #e3eefa; color: #2d5f93; border-color: #b7cfe9; }
#windows .skw-pill.soon { background: #fff3d6; color: #8a5a10; border-color: #e7c983; }
#windows .skw-pill.gauge { background: #f6efe2; color: #7a5a20; border-color: #e3d6bd; }
#windows .skw-upbtn { min-height: var(--btn-h, 44px); min-width: 84px; padding: 0 14px; border-radius: 12px; border: 1px solid #2f7a4c; background: linear-gradient(#62b97f, #3f9160); color: #fff; font-size: var(--fs-body, 15px); font-weight: 800; box-shadow: 0 2px 0 #2c6d45; cursor: pointer; white-space: nowrap; }
#windows .skw-upbtn:hover { filter: brightness(1.05); }
#windows .skw-upbtn:active { transform: translateY(1px); box-shadow: 0 1px 0 #2c6d45; }
#windows .skw-pick { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 10px 0; padding: 6px 6px 6px 12px; border-radius: 12px; background: #fff3c9; border: 2px solid #e8b64a; color: #6e4a10; }

/* ── รายละเอียด ── */
#windows .skw-backrow { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 10px 0; }
#windows .skw-backrow .skw-pts { margin: 0; }
#windows .skw-back { flex: none; min-height: var(--btn-h, 44px); padding: 0 16px; border-radius: 12px; border: 2px solid #c9b48a; background: #fffaf0; color: #5a4630; font-size: var(--fs-btn, 16px); font-weight: 800; cursor: pointer; }
#windows .skw-dhead { display: flex; align-items: center; gap: 12px; }
#windows .skw-big { width: 72px; height: 72px; flex: none; border-radius: 16px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: var(--fs-name, 18px); box-shadow: inset 0 -4px 0 #0003, 0 2px 6px #0002; overflow: hidden; }
#windows .skw-big.skw-ic-key img { width: 64%; height: 64%; object-fit: contain; }
#windows .skw-dname { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
#windows .skw-dname > b { font-size: var(--fs-title, 20px); color: #3d2f22; line-height: 1.25; }
#windows .skw-el { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--el) 22%, #fff); border: 1px solid color-mix(in srgb, var(--el) 55%, #fff); color: #4a3a28; font-size: var(--fs-xs, 12px); font-weight: 700; }
#windows .skw-onbar { color: #2f6f73; font-size: var(--fs-xs, 12px); font-weight: 700; }
#windows .skw-how { margin: 0; padding: 6px 10px; border-radius: 10px; background: #eef6f3; color: #2f5f58; font-size: var(--fs-sm, 14px); }
#windows .skw-how.auto { background: #e7f0fb; color: #2d5f93; font-weight: 700; }
#windows .skw-desc { margin: 0; font-size: var(--fs-body, 15px); line-height: 1.6; color: #443629; }
#windows .skw-facts { display: flex; flex-wrap: wrap; gap: 6px; }
#windows .skw-facts > span { padding: 4px 10px; border-radius: 10px; background: #f1e8d4; color: #4a3a28; font-size: var(--fs-sm, 14px); font-weight: 700; }
#windows .skw-facts i { font-style: normal; font-weight: 400; color: #7a6a50; margin-right: 5px; }
#windows .skw-note { color: #8a7a5e; font-size: var(--fs-xs, 12px); margin-top: -4px; }
#windows .skw-next { padding: 8px 12px; border-radius: 12px; border: 2px solid #cfe5d6; background: #f3faf4; }
#windows .skw-next h5 { margin: 0 0 4px; font-size: var(--fs-body, 15px); color: #2f6f53; }
#windows .skw-next ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
#windows .skw-next li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: var(--fs-body, 15px); }
#windows .skw-next li i { font-style: normal; min-width: 110px; color: #5f6f5a; font-size: var(--fs-sm, 14px); }
#windows .skw-next li s { color: #9a8f7a; }
#windows .skw-next li b { color: #2f8a4f; font-weight: 800; }
#windows .skw-next li b.arrow { color: #9a8f7a; font-weight: 400; }
#windows .skw-next p { margin: 0; color: #5f6f5a; font-size: var(--fs-sm, 14px); }
#windows .skw-next.max { border-color: #e3c46f; background: #fdf6e0; }
#windows .skw-next.max h5 { margin: 0; color: #8a6510; }
#windows .skw-why { margin: 0; padding: 6px 10px; border-radius: 10px; background: #f3ede2; color: #6e5a3a; font-size: var(--fs-sm, 14px); }
#windows .skw-detail-in > .skw-why, #windows .skw-detail-in > .skw-hint { margin: 0 12px 6px; flex: none; }
#windows .skw-why.wait { background: #fdf3df; color: #8a5a10; }
#windows .skw-why.soon { background: #fff3d6; color: #8a5a10; }
#windows .skw-hint { margin: 0; color: #2f6f73; font-size: var(--fs-sm, 14px); font-weight: 700; }
#windows .skw-acts { flex: none; display: flex; align-items: stretch; gap: 8px; padding: 8px 12px 10px; border-top: 1px solid #ead8ad; background: #fbf4e4; }
#windows .skw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--btn-h, 44px); padding: 0 14px; border-radius: 12px; border: 2px solid #c9b48a; background: #fffaf0; color: #5a4630; font-size: var(--fs-btn, 16px); font-weight: 800; cursor: pointer; white-space: nowrap; }
#windows .skw-btn img { width: 26px; height: 26px; flex: none; }
#windows .skw-btn.hot { border-color: #2f6f73; color: #2f6f73; background: #f2faf8; }
#windows .skw-btn.main { flex: 1 1 auto; min-height: var(--btn-h-main, 52px); font-size: var(--fs-btn-main, 18px); }
#windows .skw-btn.main.up { border-color: #2f7a4c; background: linear-gradient(#62b97f, #3f9160); color: #fff; box-shadow: 0 2px 0 #2c6d45; }
#windows .skw-btn.main > span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
#windows .skw-btn.main small { font-size: var(--fs-xs, 12px); font-weight: 600; opacity: .9; }
#windows .skw-btn.auto.on { background: #2f6f73; border-color: #2f6f73; color: #fff; }
#windows .skw-btn:disabled, #windows .skw-btn.main.up:disabled { background: #ece5d6; border-color: #d6ccb6; color: #8a7f6c; box-shadow: none; cursor: default; }
#windows .skw-btn:disabled img { filter: grayscale(1); opacity: .6; }
#windows .skw-autotag { display: inline-flex; align-items: center; padding: 0 12px; min-height: var(--btn-h, 44px); border-radius: 12px; background: #e3eefa; color: #2d5f93; font-size: var(--fs-sm, 14px); font-weight: 800; white-space: nowrap; }
#windows .skw-empty, #windows .skw-novice { display: flex; align-items: center; gap: 14px; padding: 18px; color: #5a4a36; }
#windows .skw-empty { flex-direction: column; text-align: center; margin: auto; }
#windows .skw-empty img, #windows .skw-novice img { width: 110px; height: auto; flex: none; }
#windows .skw-novice p { margin: 0; font-size: var(--fs-body, 15px); line-height: 1.6; }

/* ── จอเตี้ย (มือถือแนวนอน): แน่นขึ้นนิดหน่อย ปุ่มยังเต็ม 44–48 ── */
@media (max-height: 460px) {
  #windows .skw-row { min-height: 58px; padding: 5px 8px; gap: 8px; grid-template-columns: 44px minmax(0, 1fr) auto; }
  #windows .skw-ic { width: 44px; height: 44px; }
  #windows .skw-big { width: 56px; height: 56px; border-radius: 14px; }
  #windows .skw-scroll { padding: 8px 12px; gap: 8px; }
  #windows .skw-tabs { padding: 6px 8px; }
  #windows .skw-acts { padding: 6px 10px 8px; }
}
html.touch-ui #windows .skw-upbtn, html.touch-ui #windows .skw-btn, html.touch-ui #windows .skw-back { min-height: var(--btn-h, 48px); }
html.touch-ui #windows .skw-btn.main { min-height: var(--btn-h-main, 52px); }
/* หัวหน้าต่างบนจอเตี้ย: สำเนาแถบ (ui-root.js hslot) — แต้มสกิลไม่ต้องมีกรอบหนา */
html.touch-ui #windows .hslot .skw-tabs { border: 0; background: none; padding: 0; flex-wrap: nowrap; }
html.touch-ui #windows .hslot .skw-pts { min-height: 40px; }

/* ── ใส่ช่องลัดแล้ว: ช่องบนฮอตบาร์วาบสั้น ๆ (3 ครั้ง ไม่ค้าง) ── */
@keyframes skwFlash { 0% { box-shadow: 0 0 0 0 #2f6f73cc; } 60% { box-shadow: 0 0 0 7px #2f6f7333; } 100% { box-shadow: 0 0 0 0 #2f6f7300; } }
#hotbar .slot.skw-flash, #touch-acts .skw-flash { animation: skwFlash .55s ease-out 3; outline: 3px solid #2f6f73; outline-offset: 1px; }
/* ชิปบนหัว (จอสัมผัส): กฎแท็บกลาง ui-touch.css ตั้ง min-width:0 !important — ชิปสั้น ("All") ต้องกว้าง ≥ 44 นิ้วกดได้ */
html.touch-ui body #windows .win[data-win="skills"] :is(.body, .hslot) .skw-tabs > button.skw-chip { min-width: 48px !important; }
/* โหมดเลือกสกิลใส่ปุ่มกลมว่าง (มือถือ): รายการเต็มความกว้าง ไม่มีช่องรายละเอียดว่าง */
#windows .skw[data-picking] .skw-main { grid-template-columns: minmax(0, 1fr) !important; }
#windows .skw[data-picking] .skw-detail { display: none !important; }

/* ── skill-easy-1105: ป้าย "แนะนำ" · แถบอัปตามแนะนำ · ปุ่มยืนยันเรียนสกิลใหม่ · ป้าย "ใช้ได้ตรงนี้" บนช่องลัด ── */
#windows .skw-rec { display: inline-flex; align-items: center; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #fff1c9; color: #8a5a10; border: 1px solid #e8b64a; font-size: var(--fs-xs, 12px); font-weight: 800; vertical-align: middle; white-space: nowrap; }
#windows .skw-row.rec-on { box-shadow: inset 3px 0 0 #e8b64a; }
#windows .skw-auto { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; padding: 8px 10px; border-radius: 12px; background: #fff7e2; border: 1px solid #e8cf8f; color: #5d4a26; font-size: var(--fs-sm, 14px); }
#windows .skw-auto > span { flex: 1 1 160px; min-width: 0; }
#windows .skw-auto .skw-btn.main { flex: 0 0 auto; min-height: var(--btn-h, 44px); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 16px; font-weight: 800; }
#windows .skw-auto .skw-btn.main small { font-size: var(--fs-xs, 12px); font-weight: 600; opacity: .9; }
#windows .skw-auto.ask { display: block; }
#windows .skw-auto.ask ul { margin: 6px 0 8px; padding: 0; list-style: none; display: grid; gap: 3px; }
#windows .skw-auto.ask li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; border-radius: 8px; background: #fffdf6; }
#windows .skw-auto-acts { display: flex; justify-content: flex-end; gap: 8px; }
#windows .skw-auto-acts .skw-btn { min-height: var(--btn-h, 44px); padding: 0 16px; }
#windows .skw-auto.busy { justify-content: center; color: #2f6f73; }
#windows .skw-upbtn.arm, #windows .skw-btn.main.up.arm { background: linear-gradient(#f0c35a, #d99a2b); border-color: #b47a1c; box-shadow: 0 2px 0 #9a6614; color: #3d2a08; }
#hotbar .skw-here, #touch-acts [data-slot] > .skw-here { position: absolute; left: 50%; bottom: calc(100% + 8px); translate: -50% 0; padding: 4px 10px; border-radius: 10px; background: #2f6f73; color: #fff; font-family: system-ui, sans-serif; font-size: var(--fs-sm, 14px); font-weight: 800; line-height: 1.2; font-style: normal; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 6px #0004; animation: skwHere .6s ease-out; }
#hotbar .skw-here::after, #touch-acts [data-slot] > .skw-here::after { content: ''; position: absolute; left: 50%; top: 100%; translate: -50% 0; border: 6px solid transparent; border-top-color: #2f6f73; }
@keyframes skwHere { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
